From 118f53ec459b4e025025fc810dfa2d8e6739ed5f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 7 Feb 2011 17:29:26 -0500 Subject: [PATCH 001/558] freetdm: allow reception of FACILITY msg in any channel state when transparent facility is enabled --- .../ftmod_sangoma_isdn_stack_hndl.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 0b52011d42..fff34fcae6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -797,6 +797,23 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Processing FACILITY IND (suId:%u suInstId:%u spInstId:%u)\n", suId, suInstId, spInstId); + if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { + /* If Facility decoding is disabled, we do not care about current call state, just pass event up to user */ + ftdm_sigmsg_t sigev; + if (facEvnt->facElmt.facStr.pres) { + get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); + } + memset(&sigev, 0, sizeof(sigev)); + sigev.chan_id = ftdmchan->chan_id; + sigev.span_id = ftdmchan->span_id; + sigev.channel = ftdmchan; + + sigev.event_id = FTDM_SIGEVENT_FACILITY; + ftdm_span_send_signal(ftdmchan->span, &sigev); + ISDN_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + switch (ftdmchan->state) { case FTDM_CHANNEL_STATE_GET_CALLERID: /* Update the caller ID Name */ From f82c23ea69038a0a7faec9680d7837a9bf46f3a9 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Mon, 28 Feb 2011 12:46:12 -0300 Subject: [PATCH 002/558] freetdm: updated mkrelease.sh to download libsng-ss7 and libsng-isdn, compile freetdm and mod_freetdm and test the ABI compatibility against older releases, through an external script, before generating the tarball. --- libs/freetdm/mkrelease.sh | 86 +++++++++++++++++++++++++++++++++++---- 1 file changed, 79 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 58d176119d..414542b349 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -29,11 +29,89 @@ then exit 1 fi +arch=$(uname -m) + +# defs +LIBSNG_ISDN_URL=ftp://ftp.sangoma.com/linux/libsng_isdn +LIBSNG_ISDN_NAME=libsng_isdn-7-current +LIBSNG_SS7_URL=ftp://ftp.sangoma.com/linux/libsng_ss7 +LIBSNG_SS7_NAME=libsng_ss7-3-current +LIBSNG_ISDN_DIR="$LIBSNG_ISDN_NAME.$arch" +LIBSNG_SS7_DIR="$LIBSNG_SS7_NAME.$arch" + +# download and decompress a tarball +# $1 = prefix_url, such as ftp://ftp.sangoma.com/foo/bar +# $2 = package name, such as libsng_isdn-7.0.0.x86_64 +function download() { + wget $1/$2.tgz + if [ $? = 0 ] + then + tardir=$(tar -tf $2.tgz | head -n1 | sed 's,\/,,g') + tar -xvzf $2.tgz || echo "FAILED to decompress $2.tgz" + if [ "$tardir" != "$2" ] + then + mv $tardir $2 || echo "FAILED to move $tardir to $2" + fi + echo "SUCCESSFULLY downloaded $2" + else + echo "FAILED to download $1/$2.tgz" + fi +} + +# download and build libsng-ss7 +fullname="$LIBSNG_ISDN_NAME.$arch" +if [ -d $fullname ] +then + echo "skipping isdn download since $fullname directory already exists ... remove if you want this step to be performed" +else + download $LIBSNG_ISDN_URL $fullname +fi + +cd $LIBSNG_ISDN_DIR +make DESTDIR=$INSTALLPREFIX install || echo "Failed to build libsng-isdn" +cd .. + +# download and build libsng-ss7 +fullname="$LIBSNG_SS7_NAME.$arch" +if [ -d $fullname ] +then + echo "skipping ss7 download since $fullname directory already exists ... remove if you want this step to be performed" +else + download $LIBSNG_SS7_URL $fullname +fi + +cd $LIBSNG_SS7_DIR +make DESTDIR=$INSTALLPREFIX install || echo "Failed to build libsng-ss7" +cd .. + if [ ! -d $INSTALLPREFIX ] then mkdir -p $INSTALLPREFIX || exit 1 fi +# attempt to compile freetdm +echo "Build freetdm and mod_freetdm now..." +make all mod_freetdm || exit 1 +echo "freetdm built OK" + +major=$(echo "$VERSION" | cut -d. -f1) +minor=$(echo "$VERSION" | cut -d. -f2) +micro=$(echo "$VERSION" | cut -d. -f3) +release="freetdm-$VERSION" + +# ABI compatibility check +if [ -x /usr/local/bin/ftdm_abi_check.py ]; then + /usr/local/bin/ftdm_abi_check.py $major + if [ $? -ne 0 ]; then + echo "ABI compabitility test failed, not creating release. Either increment the major version number or fix the interface." + exit 1 + fi +else + echo -ne "\n\nWARNING: /usr/local/bin/abi_check.py not found, skipping ABI compatibility test\n\n" +fi + +# clean the source tree +rm -rf $LIBSNG_ISDN_DIR $LIBSNG_SS7_DIR make clean make mod_freetdm-clean if [ $NODOCS = "NO" ] @@ -41,13 +119,7 @@ then make dox || exit 1 fi -major=$(echo "$VERSION" | cut -d. -f1) -minor=$(echo "$VERSION" | cut -d. -f2) -micro=$(echo "$VERSION" | cut -d. -f3) -release="freetdm-$VERSION" - -echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (directory will be removed if exists already) ... press any key to continue" -read +echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (directory will be removed if exists already) ... " mkdir -p $INSTALLPREFIX/$release From d458004519dec4e652b2b2fd0ebd5ba892dc6c9b Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Mon, 28 Feb 2011 12:55:56 -0300 Subject: [PATCH 003/558] freetdm: passing ftdm path to abi test script --- libs/freetdm/mkrelease.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 414542b349..34b93b7ad7 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -101,7 +101,7 @@ release="freetdm-$VERSION" # ABI compatibility check if [ -x /usr/local/bin/ftdm_abi_check.py ]; then - /usr/local/bin/ftdm_abi_check.py $major + /usr/local/bin/ftdm_abi_check.py $(pwd) $major if [ $? -ne 0 ]; then echo "ABI compabitility test failed, not creating release. Either increment the major version number or fix the interface." exit 1 From 3a0d5b6297d37f45bc1a8e26a89dc7751514d3de Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 28 Feb 2011 12:42:43 -0500 Subject: [PATCH 004/558] freetdm: remove unused prototype for ftdm_call_clear_data --- libs/freetdm/src/include/freetdm.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 6556164aac..d2c0a7e267 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -1463,11 +1463,6 @@ FT_DECLARE(ftdm_iterator_t *) ftdm_iterator_next(ftdm_iterator_t *iter); */ FT_DECLARE(ftdm_status_t) ftdm_iterator_free(ftdm_iterator_t *iter); -/*! \brief Clears all the temporary data attached to this call - * \note Clears caller_data->variables and caller_data->raw_data. - * */ -FT_DECLARE(void) ftdm_call_clear_data(ftdm_caller_data_t *caller_data); - /*! \brief Get the span pointer associated to the channel */ FT_DECLARE(ftdm_span_t *) ftdm_channel_get_span(const ftdm_channel_t *ftdmchan); From 64b24240c004b3ac80f8f53d1059cfac1db856c8 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Mon, 28 Feb 2011 18:48:55 -0300 Subject: [PATCH 005/558] freetdm: added more arguments to ftdm_abi_check when generating ftdm releases --- libs/freetdm/mkrelease.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 34b93b7ad7..70b98cf251 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -101,7 +101,7 @@ release="freetdm-$VERSION" # ABI compatibility check if [ -x /usr/local/bin/ftdm_abi_check.py ]; then - /usr/local/bin/ftdm_abi_check.py $(pwd) $major + /usr/local/bin/ftdm_abi_check.py --release_path=$(pwd) --archive_path=/usr/local/freetdm_releases --major_version=$major if [ $? -ne 0 ]; then echo "ABI compabitility test failed, not creating release. Either increment the major version number or fix the interface." exit 1 From f9540b7258e9a39e9f79599d1427f8f1e4bb6ae2 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 28 Feb 2011 18:53:02 -0500 Subject: [PATCH 006/558] freetdm: Do not call sng_isdn_retrieve_facility_caller_name when transparent facility is enabled --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index cfc5017a8d..9cac9d05b1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -162,7 +162,10 @@ void sngisdn_process_con_ind (sngisdn_event_data_t *sngisdn_event) #if 1 /* this section will not be needed once asn decoding function with key-value pairs is implemented */ - if (signal_data->facility == SNGISDN_OPT_TRUE && conEvnt->facilityStr.eh.pres) { + if (signal_data->facility == SNGISDN_OPT_TRUE && + signal_data->facility_ie_decode != SNGISDN_OPT_FALSE && + conEvnt->facilityStr.eh.pres) { + /* Verify whether the Caller Name will come in a subsequent FACILITY message */ uint16_t ret_val; char retrieved_str[255]; @@ -832,7 +835,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) If there will be no information following, but current FACILITY IE contains a caller name, returns 0 If there will be information following, returns 1 */ - + if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) { strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } else { From 9b9ed009b7189dd450169e4f116d5774fb418bc8 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Wed, 2 Mar 2011 22:42:59 -0300 Subject: [PATCH 007/558] freetdm: changed mkrelease.sh to ship ABI compatibility test reports with the generated release. --- libs/freetdm/mkrelease.sh | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 70b98cf251..45bc1cf868 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -89,6 +89,11 @@ then mkdir -p $INSTALLPREFIX || exit 1 fi +if [ ! -d $INSTALLPREFIX/bin-releases ] +then + mkdir -p $INSTALLPREFIX/bin-releases || exit 1 +fi + # attempt to compile freetdm echo "Build freetdm and mod_freetdm now..." make all mod_freetdm || exit 1 @@ -101,19 +106,16 @@ release="freetdm-$VERSION" # ABI compatibility check if [ -x /usr/local/bin/ftdm_abi_check.py ]; then - /usr/local/bin/ftdm_abi_check.py --release_path=$(pwd) --archive_path=/usr/local/freetdm_releases --major_version=$major + /usr/local/bin/ftdm_abi_check.py --release_path=$(pwd) --archive_path=$INSTALLPREFIX/bin-releases --version=$VERSION + if [ $? -ne 0 ]; then echo "ABI compabitility test failed, not creating release. Either increment the major version number or fix the interface." exit 1 fi else - echo -ne "\n\nWARNING: /usr/local/bin/abi_check.py not found, skipping ABI compatibility test\n\n" + echo -ne "\n\nWARNING: /usr/local/bin/ftdm_abi_check.py not found, skipping ABI compatibility test\n\n" fi -# clean the source tree -rm -rf $LIBSNG_ISDN_DIR $LIBSNG_SS7_DIR -make clean -make mod_freetdm-clean if [ $NODOCS = "NO" ] then make dox || exit 1 @@ -121,15 +123,28 @@ fi echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (directory will be removed if exists already) ... " -mkdir -p $INSTALLPREFIX/$release +mkdir -p $INSTALLPREFIX/$release $INSTALLPREFIX/bin-releases/$major/$release cp -r ./* $INSTALLPREFIX/$release +# copy ABI compatibility reports to release +if [ -d compat_reports ]; then + cp -r ./compat_reports $INSTALLPREFIX/$release + rm -rf ./compat_reports +fi + find $INSTALLPREFIX/ -name .libs -exec rm -rf {} \; find $INSTALLPREFIX/ -name .deps -exec rm -rf {} \; find $INSTALLPREFIX/ -name *.so -exec rm -rf {} \; find $INSTALLPREFIX/ -name *.lo -exec rm -rf {} \; +cp -r ./* $INSTALLPREFIX/bin-releases/$major/$release +cp -r ./.libs $INSTALLPREFIX/bin-releases/$major/$release + +# clean the source tree +rm -rf $LIBSNG_ISDN_DIR $LIBSNG_SS7_DIR +make clean +make mod_freetdm-clean tar -C $INSTALLPREFIX -czf $INSTALLPREFIX/$release.tar.gz $release/ From c56bf093fb66e8e4df2ced45449e66a8afa6a4da Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Wed, 2 Mar 2011 23:18:56 -0300 Subject: [PATCH 008/558] freetdm: some fixes to mkrelease.sh --- libs/freetdm/mkrelease.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 45bc1cf868..4b9a18bf9f 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -133,14 +133,15 @@ if [ -d compat_reports ]; then rm -rf ./compat_reports fi -find $INSTALLPREFIX/ -name .libs -exec rm -rf {} \; -find $INSTALLPREFIX/ -name .deps -exec rm -rf {} \; -find $INSTALLPREFIX/ -name *.so -exec rm -rf {} \; -find $INSTALLPREFIX/ -name *.lo -exec rm -rf {} \; - cp -r ./* $INSTALLPREFIX/bin-releases/$major/$release cp -r ./.libs $INSTALLPREFIX/bin-releases/$major/$release +find $INSTALLPREFIX/$release -name .libs -exec rm -rf {} \; +find $INSTALLPREFIX/$release -name .deps -exec rm -rf {} \; +find $INSTALLPREFIX/$release -name *.so -exec rm -rf {} \; +find $INSTALLPREFIX/$release -name *.lo -exec rm -rf {} \; +rm -rf $INSTALLPREFIX/$release/{$LIBSNG_ISDN_DIR,$LIBSNG_SS7_DIR,*.tgz} + # clean the source tree rm -rf $LIBSNG_ISDN_DIR $LIBSNG_SS7_DIR make clean From 1fbb321f3d665d1ee73658bdeb134e42f0b01187 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Thu, 3 Mar 2011 09:48:48 -0500 Subject: [PATCH 009/558] freetdm: Allow user to indicate FACILITY on outbound calls --- libs/freetdm/src/ftdm_io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 765a3b3431..6b225fe8f0 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -2312,7 +2312,9 @@ FT_DECLARE(ftdm_status_t) _ftdm_channel_call_indicate(const char *file, const ch ftdm_set_flag(ftdmchan, FTDM_CHANNEL_IND_ACK_PENDING); } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + if (indication != FTDM_CHANNEL_INDICATE_FACILITY && + ftdm_test_flag(ftdmchan, FTDM_CHANNEL_OUTBOUND)) { + ftdm_log_chan_ex(ftdmchan, file, func, line, FTDM_LOG_LEVEL_WARNING, "Cannot indicate %s in outgoing channel in state %s\n", ftdm_channel_indication2str(indication), ftdm_channel_state2str(ftdmchan->state)); status = FTDM_EINVAL; From c5dd481fbd7713e996f1d25d04f03758887d7bfd Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 2 Mar 2011 10:59:43 -0500 Subject: [PATCH 010/558] freetdm: ISDN - ftdm_complete_state is not called in state_advance if a new state is set --- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 1437b45883..d119ff4fd2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -603,6 +603,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm ftdm_sigmsg_t sigev; ftdm_channel_state_t initial_state; sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data; + uint8_t state_change = 0; memset(&sigev, 0, sizeof(sigev)); @@ -673,6 +674,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROCEED); if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } } else { @@ -693,6 +695,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_RINGING); if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) { + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } } else { @@ -752,6 +755,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm /* Send a release complete */ sngisdn_snd_release(ftdmchan, 0); /*now go to the HANGUP complete state*/ + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } break; @@ -811,6 +815,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm } } /* now go to the HANGUP complete state */ + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } break; @@ -819,6 +824,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) || sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) { /* If the remote side aborted, we will not get anymore message for this call */ + state_change++; ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN); } else { /* waiting on remote confirmation before moving to down */ @@ -873,8 +879,10 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm break; } - /* Acknowledge the state change */ - ftdm_channel_complete_state(ftdmchan); + if (!state_change) { + /* Acknowledge the state change */ + ftdm_channel_complete_state(ftdmchan); + } /* If sngisdn_info->variables is not NULL, it means did not send any * sigevent to the user, therefore we have to free that hashtable */ From 00dc8577e826ab06cc41d79d4485a219fa7075e0 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 1 Mar 2011 09:54:52 -0500 Subject: [PATCH 011/558] freetdm: Typo in function define --- libs/freetdm/src/ftdm_io.c | 2 +- libs/freetdm/src/include/private/ftdm_core.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 6b225fe8f0..4c75b6bd8a 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -4051,7 +4051,7 @@ done: return status; } -FT_DECLARE(ftdm_iterator_t) *ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter) +FT_DECLARE(ftdm_iterator_t *) ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter) { int allocated = 0; if (iter) { diff --git a/libs/freetdm/src/include/private/ftdm_core.h b/libs/freetdm/src/include/private/ftdm_core.h index 464b1c0209..3c21be392f 100644 --- a/libs/freetdm/src/include/private/ftdm_core.h +++ b/libs/freetdm/src/include/private/ftdm_core.h @@ -590,7 +590,7 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_open_chan(ftdm_channel_t *ftdmchan); FT_DECLARE(void) ftdm_ack_indication(ftdm_channel_t *ftdmchan, ftdm_channel_indication_t indication, ftdm_status_t status); -FT_DECLARE(ftdm_iterator_t) *ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); +FT_DECLARE(ftdm_iterator_t *) ftdm_get_iterator(ftdm_iterator_type_t type, ftdm_iterator_t *iter); /*! From d36933df10cb788e2791018eac4a35de40344c62 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 7 Mar 2011 10:57:37 -0500 Subject: [PATCH 012/558] Fix for Raw Facility IE, introduced with ftdm_variables3 patch --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index bd3db2942a..d0856bdce9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -370,7 +370,7 @@ ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8 my_data[1] = data_len; memcpy(&my_data[2], data, data_len); - sngisdn_add_raw_data((sngisdn_chan_data_t*)ftdmchan->call_data, data, data_len+2); + sngisdn_add_raw_data((sngisdn_chan_data_t*)ftdmchan->call_data, my_data, data_len+2); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Raw Facility IE copied available\n"); } else { From 189d81a1b2913c9ce3a83dbe07a5c05de6a7be7c Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 8 Mar 2011 16:50:35 -0600 Subject: [PATCH 013/558] Bugfix: FreeSWITCH::Client::sendmsg was returning the first FSES packet it received, which caused a race condition when an event was in transit; now it waits for Content-Type: command/reply --- scripts/perl/FreeSWITCH/Client.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/perl/FreeSWITCH/Client.pm b/scripts/perl/FreeSWITCH/Client.pm index 9e97218580..01748a8180 100644 --- a/scripts/perl/FreeSWITCH/Client.pm +++ b/scripts/perl/FreeSWITCH/Client.pm @@ -143,7 +143,13 @@ sub sendmsg($$$) { } $self->output("\n"); - return $self->readhash($to); + for(;;) { + $e = $self->readhash(undef); + last if $e->{socketerror} or $e->{'content-type'} eq 'command/reply'; + push @{$self->{events}}, $e; + } + + return $e; } sub command($$) { From dcf515ffafd6765f852d7dc656e64e7c56b7d68b Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Mon, 7 Mar 2011 11:36:18 -0500 Subject: [PATCH 014/558] freetdm: ss7 - bug fix for race condition on startup causing seg fault --- .../ftmod_sangoma_ss7_handle.c | 20 +++++++++++++++++++ .../ftmod_sangoma_ss7_main.c | 3 +++ 2 files changed, 23 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 331312fafb..cb742ac4c9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -884,6 +884,12 @@ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info ; ftdm_channel_t *ftdmchan; + /* confirm that the circuit is active on our side otherwise move to the next circuit */ + if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[circuit], SNGSS7_ACTIVE)) { + SS7_ERROR("[CIC:%d]Circuit is not active yet, skipping!\n",g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic); + return FTDM_FAIL; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -1189,6 +1195,13 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui /* check that the infId matches and that this is not a siglink */ if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { + + /* confirm that the circuit is active on our side otherwise move to the next circuit */ + if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[i], SNGSS7_ACTIVE)) { + SS7_ERROR("[CIC:%d]Circuit is not active yet, skipping!\n",g_ftdm_sngss7_data.cfg.isupCkt[i].cic); + i++; + continue; + } /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { @@ -1248,6 +1261,13 @@ ftdm_status_t handle_resume(uint32_t suInstId, uint32_t spInstId, uint32_t circu if ((g_ftdm_sngss7_data.cfg.isupCkt[i].infId == infId) && (g_ftdm_sngss7_data.cfg.isupCkt[i].type == VOICE)) { + /* confirm that the circuit is active on our side otherwise move to the next circuit */ + if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[i], SNGSS7_ACTIVE)) { + SS7_ERROR("[CIC:%d]Circuit is not active yet, skipping!\n",g_ftdm_sngss7_data.cfg.isupCkt[i].cic); + i++; + continue; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 2f630fe462..10e73d3fbd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1397,6 +1397,9 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); + /* flag the circuit as active */ + sngss7_set_flag(sngss7_info->circuit, SNGSS7_ACTIVE); + /* check if the interface is paused or resumed */ if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is PAUSED\n", sngss7_intf->id); From c0a2a225ba3f4dce536c1ce558c5337547e6d60e Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Tue, 8 Mar 2011 17:51:10 -0500 Subject: [PATCH 015/558] freetdm: ss7 - bug fix in GRS handling --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c | 15 +- .../ftmod_sangoma_ss7_handle.c | 439 +++++++++++++----- .../ftmod_sangoma_ss7_support.c | 41 +- 3 files changed, 364 insertions(+), 131 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index df0414a7f5..b7eaa37639 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -396,16 +396,13 @@ int ft_to_sngss7_cfg_all(void) x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { - if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { - if (ftmod_ss7_isup_ckt_config(x)) { - SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("ISUP CKT %d configuration DONE!\n", x); - } - - } /* if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */ + if (ftmod_ss7_isup_ckt_config(x)) { + SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x); + return 1; + } else { + SS7_INFO("ISUP CKT %d configuration DONE!\n", x); + } /* set the SNGSS7_CONFIGURED flag */ g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index cb742ac4c9..e0b6ae08c0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -881,238 +881,187 @@ ftdm_status_t handle_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t cir /******************************************************************************/ ftdm_status_t handle_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt) { - sngss7_chan_data_t *sngss7_info ; - ftdm_channel_t *ftdmchan; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); /* confirm that the circuit is active on our side otherwise move to the next circuit */ if (!sngss7_test_flag(&g_ftdm_sngss7_data.cfg.isupCkt[circuit], SNGSS7_ACTIVE)) { - SS7_ERROR("[CIC:%d]Circuit is not active yet, skipping!\n",g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic); + SS7_ERROR("[CIC:%d]Rx %s but circuit is not active yet, skipping!\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); return FTDM_FAIL; } - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); - SS7_FUNC_TRACE_EXIT(__FUNCTION__); - return FTDM_FAIL; - } - - SS7_FUNC_TRACE_ENTER(__FUNCTION__); - switch (evntType) { /**************************************************************************/ case SIT_STA_REATTEMPT: /* reattempt indication */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Reattempt indication\n", sngss7_info->circuit->cic); handle_reattempt(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_ERRORIND: /* error indication */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Error indication\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CONTCHK: /* continuity check */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CCR start\n", sngss7_info->circuit->cic); handle_cot_start(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CONTREP: /* continuity report */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx COT report\n", sngss7_info->circuit->cic); handle_cot(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_STPCONTIN: /* stop continuity */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CCR stop\n", sngss7_info->circuit->cic); handle_cot_stop(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGQRYRSP: /* circuit grp query response from far end forwarded to upper layer by ISUP */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CQM\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CONFUSION: /* confusion */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CFN\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_LOOPBACKACK: /* loop-back acknowledge */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LPA\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRRSRVREQ: /* circuit reservation request */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Ckt Resveration req\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRRSRVACK: /* circuit reservation acknowledgement */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Ckt Res ack\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRBLOREQ: /* circuit blocking request */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx BLO\n", sngss7_info->circuit->cic); handle_blo_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRBLORSP: /* circuit blocking response */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx BLA\n", sngss7_info->circuit->cic); handle_blo_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRUBLREQ: /* circuit unblocking request */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UBL\n", sngss7_info->circuit->cic); handle_ubl_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRUBLRSP: /* circuit unblocking response */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UBA\n", sngss7_info->circuit->cic); handle_ubl_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRRESREQ: /* circuit reset request - RSC */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RSC\n", sngss7_info->circuit->cic); handle_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRLOCRES: /* reset initiated locally by the software */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local RSC\n", sngss7_info->circuit->cic); handle_local_rsc_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRRESRSP: /* circuit reset response */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RSC-RLC\n", sngss7_info->circuit->cic); handle_rsc_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGBREQ: /* CGB request */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CGB\n", sngss7_info->circuit->cic); handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGUREQ: /* CGU request */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CGU\n", sngss7_info->circuit->cic); handle_cgu_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CGQRYREQ: /* circuit group query request */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CQM\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CGBRSP: /* mntc. oriented CGB response */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx mntc CGB\n", sngss7_info->circuit->cic); /*handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);*/ break; /**************************************************************************/ case SIT_STA_CGURSP: /* mntc. oriented CGU response */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx mntc CGU\n", sngss7_info->circuit->cic); /*SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType));*/ break; /**************************************************************************/ case SIT_STA_GRSREQ: /* circuit group reset request */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx GRS\n", sngss7_info->circuit->cic); handle_grs_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRUNEQPD: /* circuit unequipped indication */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UCIC\n", sngss7_info->circuit->cic); handle_ucic(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_GRSRSP: /* circuit group reset response */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx GRA\n", sngss7_info->circuit->cic); handle_grs_rsp(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_PAUSEIND: /* pause indication */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUS\n", sngss7_info->circuit->cic); handle_pause(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_RESUMEIND: /* resume indication */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx RES\n", sngss7_info->circuit->cic); handle_resume(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_USRPARTA: /* user part available */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx UPA\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_RMTUSRUNAV: /* remote user not available */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Remote User not Available\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG0: /* congestion indication level 0 */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L0\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG1: /* congestion indication level 1 */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L1\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG2: /* congestion indication level 2 */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L2\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPCONG3: /* congestion indication level 3 */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Congestion L3\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_MTPSTPCONG: /* stop congestion indication level 0 */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Stop Congestion\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRLOCALBLOIND: /* Mngmt local blocking */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local BLO\n", sngss7_info->circuit->cic); handle_local_blk(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_CIRLOCALUBLIND: /* Mngmt local unblocking */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local UBL\n", sngss7_info->circuit->cic); handle_local_ubl(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_OVERLOAD: /* Overload */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Overload\n", sngss7_info->circuit->cic); handle_olm_msg(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt); break; /**************************************************************************/ case SIT_STA_LMCGBREQ: /* when LM requests ckt grp blocking */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM CGB\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_LMCGUREQ: /* when LM requests ckt grp unblocking */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM CGU\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_LMGRSREQ: /* when LM requests ckt grp reset */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM RSC\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CGBINFOIND: /* circuit grp blking ind , no resp req */ - /*SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx CGB no resp req\n", sngss7_info->circuit->cic);*/ /* handle_cgb_req(suInstId, spInstId, circuit, globalFlg, evntType, siStaEvnt);*/ break; /**************************************************************************/ case SIT_STA_LMCQMINFOREQ: /* when LM requests ckt grp query */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx LM CQM\n", sngss7_info->circuit->cic); // SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ case SIT_STA_CIRLOCGRS: /* group reset initiated locally by the software */ - SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Local GRS\n", sngss7_info->circuit->cic); SS7_WARN(" %s indication not currently supported\n", DECODE_LCC_EVENT(evntType)); break; /**************************************************************************/ @@ -1134,11 +1083,25 @@ ftdm_status_t handle_reattempt(uint32_t suInstId, uint32_t spInstId, uint32_t ci sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1311,11 +1274,25 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1352,11 +1329,25 @@ ftdm_status_t handle_cot_stop(uint32_t suInstId, uint32_t spInstId, uint32_t cir sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1383,11 +1374,25 @@ ftdm_status_t handle_cot(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1437,11 +1442,25 @@ ftdm_status_t handle_blo_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1473,11 +1492,25 @@ ftdm_status_t handle_blo_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1500,11 +1533,25 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1539,11 +1586,25 @@ ftdm_status_t handle_ubl_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1566,11 +1627,25 @@ ftdm_status_t handle_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1611,13 +1686,26 @@ ftdm_status_t handle_local_rsc_req(uint32_t suInstId, uint32_t spInstId, uint32_ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; - } + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + } /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); @@ -1656,11 +1744,25 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1733,10 +1835,25 @@ ftdm_status_t handle_grs_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ int range; - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* extract the range value from the event structure */ @@ -1769,10 +1886,25 @@ ftdm_status_t handle_grs_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_span_data_t *sngss7_span = NULL; int range; - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* extract the range value from the event structure */ @@ -1811,11 +1943,25 @@ ftdm_status_t handle_local_blk(uint32_t suInstId, uint32_t spInstId, uint32_t ci sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1847,11 +1993,25 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* lock the channel */ @@ -1885,11 +2045,25 @@ ftdm_status_t handle_ucic(uint32_t suInstId, uint32_t spInstId, uint32_t circuit ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* check if we just sent a GRS request...*/ @@ -1934,13 +2108,26 @@ ftdm_status_t handle_cgb_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ memset(&status[0], '\0', sizeof(status)); - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; - } + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + } /* grab the span info */ sngss7_span = ftdmchan->span->signal_data; @@ -2069,11 +2256,25 @@ ftdm_status_t handle_cgu_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ memset(&sigev, 0, sizeof (sigev)); memset(&status[0], '\0', sizeof(status)); - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* grab the span info */ @@ -2187,11 +2388,25 @@ ftdm_status_t handle_olm_msg(uint32_t suInstId, uint32_t spInstId, uint32_t circ sngss7_chan_data_t *sngss7_info = NULL; ftdm_channel_t *ftdmchan = NULL; - /* get the ftdmchan and ss7_chan_data from the circuit */ - if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { - SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); + /* confirm that the circuit is voice channel */ + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("[CIC:%d]Rx %s on non-voice CIC\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_FAIL; + } else { + /* get the ftdmchan and ss7_chan_data from the circuit */ + if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { + SS7_ERROR("Failed to extract channel data for ISUP circuit = %d!\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_FAIL; + } + + SS7_INFO_CHAN(ftdmchan, "[CIC:%d]Rx %s\n", + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic, + DECODE_LCC_EVENT(evntType)); } /* handle overload */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 9296dbc08a..814f418a13 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -531,8 +531,18 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan) sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; int i; + + SS7_INFO("Rx GRS (%d:%d)\n", + g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_grs.circuit].cic, + (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_grs.circuit].cic + sngss7_span->rx_grs.range)); + for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + /* confirm this is a voice channel, otherwise we do nothing */ + if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) { + continue; + } + /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); @@ -553,10 +563,6 @@ ftdm_status_t check_if_rx_grs_started(ftdm_span_t *ftdmspan) ftdm_sangoma_ss7_process_state_change (ftdmchan); } - SS7_INFO_CHAN(ftdmchan, "Rx GRS (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_grs.circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_grs.circuit].cic + sngss7_span->rx_grs.range)); - /* flag the channel as having received a reset */ sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX); @@ -595,12 +601,14 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) int byte = 0; int bit = 0; - - ftdm_log(FTDM_LOG_DEBUG, "Found Rx GRS on span %s...checking circuits\n", ftdmspan->name); - /* check all the circuits in the range to see if they are done resetting */ for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + /* confirm this is a voice channel, otherwise we do nothing */ + if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) { + continue; + } + /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); @@ -630,6 +638,11 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) /* check all the circuits in the range to see if they are done resetting */ for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + /* confirm this is a voice channel, otherwise we do nothing */ + if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) { + continue; + } + /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n",i); @@ -664,6 +677,12 @@ ftdm_status_t check_if_rx_grs_processed(ftdm_span_t *ftdmspan) GRS_UNLOCK_ALL: for ( i = sngss7_span->rx_grs.circuit; i < (sngss7_span->rx_grs.circuit + sngss7_span->rx_grs.range + 1); i++) { + + /* confirm this is a voice channel, otherwise we do nothing */ + if (g_ftdm_sngss7_data.cfg.isupCkt[i].type != VOICE) { + continue; + } + /* extract the channel in question */ if (extract_chan_data(i, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", i); @@ -685,6 +704,10 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan) sngss7_span_data_t *sngss7_span = (sngss7_span_data_t *)ftdmspan->signal_data; int i; + SS7_INFO("Rx GRA (%d:%d)\n", + g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_gra.circuit].cic, + (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_gra.circuit].cic + sngss7_span->rx_gra.range)); + for (i = sngss7_span->rx_gra.circuit; i < (sngss7_span->rx_gra.circuit + sngss7_span->rx_gra.range + 1); i++) { /* extract the channel in question */ @@ -707,9 +730,7 @@ ftdm_status_t check_if_rx_gra_started(ftdm_span_t *ftdmspan) ftdm_sangoma_ss7_process_state_change (ftdmchan); } - SS7_INFO_CHAN(ftdmchan, "Rx GRA (%d:%d)\n", - g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_gra.circuit].cic, - (g_ftdm_sngss7_data.cfg.isupCkt[sngss7_span->rx_gra.circuit].cic + sngss7_span->rx_gra.range)); + switch (ftdmchan->state) { /**********************************************************************/ From 93bfa6d1e99e8037bd6f2d01fce280b306eafabf Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Tue, 15 Feb 2011 11:45:17 -0500 Subject: [PATCH 016/558] chlog freetdm: ss7 - adding initial support for RELAY --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 22 +++--- .../ftmod_sangoma_ss7_cntrl.c | 67 ++++++++++++++++ .../ftmod_sangoma_ss7_logger.c | 13 +++- .../ftmod_sangoma_ss7_main.c | 63 +++++++++------ .../ftmod_sangoma_ss7_main.h | 27 +++++++ .../ftmod_sangoma_ss7_relay.c | 76 ++++++++++--------- .../ftmod_sangoma_ss7_support.c | 44 +++++++++++ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 2 +- 8 files changed, 246 insertions(+), 68 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 2f56619863..f8b12ea588 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -967,12 +967,14 @@ static ftdm_status_t handle_show_inreset(ftdm_stream_handle_t *stream, int span, /******************************************************************************/ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, int chan, int verbose) { - int x; - int bit; - sngss7_chan_data_t *ss7_info; - ftdm_channel_t *ftdmchan; - int lspan; - int lchan; + sngss7_chan_data_t *ss7_info; + ftdm_channel_t *ftdmchan; + int x; + int bit; + int lspan; + int lchan; + const char *text; + int flag; x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { @@ -1001,11 +1003,11 @@ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, i ss7_info->circuit->cic); for (bit = 0; bit < 33; bit++) { - stream->write_function(stream, "|"); if (ss7_info->ckt_flags & ( 0x1 << bit)) { - stream->write_function(stream, "%2d=1", bit); - } else { - stream->write_function(stream, "%2d=0", bit); + stream->write_function(stream, "|"); + flag = bit; + text = ftmod_ss7_ckt_flag2str(flag); + stream->write_function(stream, "%s",text); } } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c index c1b18e529a..83ef5e0a42 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c @@ -68,11 +68,14 @@ int ftmod_ss7_shutdown_isup(void); int ftmod_ss7_shutdown_mtp3(void); int ftmod_ss7_shutdown_mtp2(void); int ftmod_ss7_shutdown_relay(void); +int ftmod_ss7_disable_relay_channel(uint32_t chanId); int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId); int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId); int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId); + +int ftmod_ss7_block_isup_ckt(uint32_t cktId); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -712,6 +715,38 @@ int ftmod_ss7_shutdown_relay(void) return (sng_cntrl_relay(&pst, &cntrl)); } +/******************************************************************************/ +int ftmod_ss7_disable_relay_channel(uint32_t chanId) +{ + RyMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTRY; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(RyMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTRY; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STGEN; + + + cntrl.hdr.elmId.elmntInst1 = chanId; + + cntrl.t.cntrl.action = ADISIMM; /* Deactivate */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_relay(&pst, &cntrl)); +} + /******************************************************************************/ int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId) { @@ -808,6 +843,38 @@ int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId) } +/******************************************************************************/ +int ftmod_ss7_block_isup_ckt(uint32_t cktId) +{ + SiMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSI; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SiMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSI; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STICIR; + + cntrl.t.cntrl.s.siElmnt.elmntId.circuit = cktId; + cntrl.t.cntrl.s.siElmnt.elmntParam.cir.flag = LSI_CNTRL_CIR_FORCE; + + cntrl.t.cntrl.action = ADISIMM; /* block via BLO */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_isup(&pst, &cntrl)); +} + /******************************************************************************/ /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c index f4143fc864..2a395c9ad1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -766,7 +766,18 @@ void handle_sng_relay_alarm(Pst *pst, RyMngmt *sta) DECODE_LRY_REASON(sta->t.usta.s.ryErrUsta.reason)); /* process the event */ - handle_relay_disconnect_on_error(sta); + switch (sta->t.usta.s.ryErrUsta.reason) { + /**********************************************************************/ + case (LRYRSNMGMTREQ): + /* do nothing since this is a shutdown */ + break; + /**********************************************************************/ + default: + /* handle the error */ + handle_relay_disconnect_on_error(sta); + break; + /**********************************************************************/ + } /* switch (sta->t.usta.s.ryErrUsta.reason) */ break; /**************************************************************************/ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 10e73d3fbd..7b885102b9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -365,6 +365,9 @@ static void *ftdm_sangoma_ss7_run(ftdm_thread_t * me, void *obj) /* check each channel on the span to see if there is an un-procressed SUS/RES flag */ check_for_res_sus_flag(ftdmspan); + /* check each channel on the span to see if it needs to be reconfigured */ + check_for_reconfig_flag(ftdmspan); + /* Poll for events, e.g HW DTMF */ switch (ftdm_span_poll_event(ftdmspan, 0, NULL)) { /**********************************************************************/ @@ -926,33 +929,27 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } } - /* if we're not coming from HANGUP_COMPLETE we need to check for resets - * we can also check if we are in a PAUSED state (no point in sending message - */ - if ((ftdmchan->last_state != FTDM_CHANNEL_STATE_HANGUP_COMPLETE) && - (!sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED))) { - /* check if this is an outgoing RSC */ - if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) && - !(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT))) { + /* check if this is an outgoing RSC */ + if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) && + !(sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_SENT))) { - /* send a reset request */ - ft_to_sngss7_rsc (ftdmchan); - sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT); + /* send a reset request */ + ft_to_sngss7_rsc (ftdmchan); + sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_SENT); - } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) */ - - /* check if this is the first channel of a GRS (this flag is thrown when requesting reset) */ - if ( (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) && - !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT)) && - (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE))) { + } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_TX)) */ - /* send out the grs */ - ft_to_sngss7_grs (ftdmchan); - sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT); + /* check if this is the first channel of a GRS (this flag is thrown when requesting reset) */ + if ( (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) && + !(sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT)) && + (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_BASE))) { - }/* if ( sngss7_test_ckt_flag ( sngss7_info, FLAG_GRP_RESET_TX ) ) */ - } /* if ( last_state != HANGUP && !PAUSED */ + /* send out the grs */ + ft_to_sngss7_grs (ftdmchan); + sngss7_set_ckt_flag(sngss7_info, FLAG_GRP_RESET_SENT); + + }/* if ( sngss7_test_ckt_flag ( sngss7_info, FLAG_GRP_RESET_TX ) ) */ /* if the sig_status is up...bring it down */ if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_SIG_UP)) { @@ -1598,6 +1595,8 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) { /*this function is called by the FT-core to unload the signaling module */ + int x; + ftdm_log (FTDM_LOG_INFO, "Starting ftmod_sangoma_ss7 unload...\n"); if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_CC)) { @@ -1625,6 +1624,26 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) } if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) { + /* go through all the relays channels and configure it */ + x = 1; + while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) { + /* check if this relay channel has been configured already */ + if ((g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED)) { + + /* send the specific configuration */ + if (ftmod_ss7_disable_relay_channel(x)) { + SS7_CRITICAL("Relay Channel %d disable failed!\n", x); + return 1; + } else { + SS7_INFO("Relay Channel %d disable DONE!\n", x); + } + + /* set the SNGSS7_CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.relay[x].flags &= !SNGSS7_CONFIGURED; + } /* if !SNGSS7_CONFIGURED */ + x++; + } /* while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) */ + ftmod_ss7_shutdown_relay(); sng_isup_free_relay(); sngss7_clear_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 4d09dfa7e3..291eea0985 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -506,6 +506,27 @@ typedef enum { FLAG_RELAY_DOWN = (1 << 30) } sng_ckt_flag_t; +#define CKT_FLAGS_STRING \ + "RX_RSC", \ + "TX_RSC", \ + "TX_RSC_REQ_SENT", \ + "TX_RSC_RSP_RECIEVED", \ + "RX_GRS", \ + "RX_GRS_DONE", \ + "RX_GRS_CMPLT", \ + "GRS_BASE", \ + "TX_GRS", \ + "TX_GRS_REQ_SENT", \ + "TX_GRS_RSP_RECIEVED", \ + "REMOTE_REL", \ + "LOCAL_REL", \ + "GLARE", \ + "INF_RESUME", \ + "INF_PAUSED", \ + "RELAY_DOWN", \ + "CKT_RECONFIG" +FTDM_STR2ENUM_P(ftmod_ss7_ckt_state2flag, ftmod_ss7_ckt_flag2str, sng_ckt_flag_t) + /* ckt blocking flags */ typedef enum { FLAG_CKT_UCIC_BLOCK = (1 << 0), @@ -626,12 +647,17 @@ int ftmod_ss7_shutdown_isup(void); int ftmod_ss7_shutdown_mtp3(void); int ftmod_ss7_shutdown_mtp2(void); int ftmod_ss7_shutdown_relay(void); +int ftmod_ss7_disable_relay_channel(uint32_t chanId); int ftmod_ss7_disable_grp_mtp3Link(uint32_t procId); int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId); int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId); +int ftmod_ss7_block_isup_ckt(uint32_t cktId); + + + /* in ftmod_sangoma_ss7_sta.c */ int ftmod_ss7_mtp1link_sta(uint32_t id, L1Mngmt *cfm); int ftmod_ss7_mtp2link_sta(uint32_t id, SdMngmt *cfm); @@ -756,6 +782,7 @@ int find_ssf_type_in_map(const char *ssfType); int find_cic_cntrl_in_map(const char *cntrlType); ftdm_status_t check_status_of_all_isup_intf(void); +ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan); void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id); void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c index d003371ff2..d34d62c217 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c @@ -61,23 +61,28 @@ ftdm_status_t handle_relay_connect(RyMngmt *sta) /* test if this is the first time the channel comes up */ if (!sngss7_test_flag(sng_relay, SNGSS7_RELAY_INIT)) { - SS7_DEBUG("Relay Channel %d initial connection UP\n", sng_relay->id); + SS7_INFO("Relay Channel %d initial connection UP\n", sng_relay->id); /* mark the channel as being up */ sngss7_set_flag(sng_relay, SNGSS7_RELAY_INIT); } else { - SS7_DEBUG("Relay Channel %d connection UP\n", sng_relay->id); + SS7_INFO("Relay Channel %d connection UP\n", sng_relay->id); /* react based on type of channel */ switch (sng_relay->type) { /******************************************************************/ case (LRY_CT_TCP_CLIENT): + /* check the status of all isup intfs in case we weren't connected when + * the interface became active + */ + check_status_of_all_isup_intf(); + /* reconfigure all ISUP ckts, since the main system would have lost all configs */ if (reconfig_all_ckts_for_relay()) { SS7_ERROR("Failed to reconfigure ISUP Ckts!\n"); - /* we're done....this is very bad! */ - } else { + } else { + /* if the circuits reconfiged then bring then back up */ enable_all_ckts_for_relay(); } @@ -104,16 +109,20 @@ ftdm_status_t handle_relay_disconnect_on_error(RyMngmt *sta) /* check which procId is in error, if it is 1, disable the ckts */ if (sta->t.usta.s.ryErrUsta.errPid == 1 ) { - disable_all_ckts_for_relay(); - + /* we've lost the server, bring down the mtp2 links */ disble_all_mtp2_sigs_for_relay(); + + /* we've lost the server, bring the sig status down on all ckts */ + disable_all_ckts_for_relay(); } /* check if the channel is a server, means we just lost a MGW */ if (g_ftdm_sngss7_data.cfg.relay[sta->t.usta.s.ryErrUsta.errPid].type == LRY_CT_TCP_SERVER) { - block_all_ckts_for_relay(sta->t.usta.s.ryErrUsta.errPid); - + /* we've lost the client, bring down all mtp3 links for this procId */ disable_all_sigs_for_relay(sta->t.usta.s.ryErrUsta.errPid); + + /* we've lost the client, bring down all the ckts for this procId */ + block_all_ckts_for_relay(sta->t.usta.s.ryErrUsta.errPid); } return FTDM_SUCCESS; @@ -222,30 +231,26 @@ ftdm_status_t enable_all_ckts_for_relay(void) /******************************************************************************/ ftdm_status_t reconfig_all_ckts_for_relay(void) { -#if 1 int x; - int ret; + sngss7_chan_data_t *sngss7_info = NULL; + /* go through all the circuits on our ProcId */ x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + /**************************************************************************/ if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { - - ret = ftmod_ss7_isup_ckt_config(x); - if (ret) { - SS7_CRITICAL("ISUP CKT %d configuration FAILED (%d)!\n", x, ret); - return 1; - } else { - SS7_INFO("ISUP CKT %d configuration DONE!\n", x); - } + /* grab the private data structure */ + sngss7_info = g_ftdm_sngss7_data.cfg.isupCkt[x].obj; + + /* mark the circuit for re-configuration */ + sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG); + } - } /* if ( g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */ - - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED; - + /* move to the next circuit */ x++; + /**************************************************************************/ } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ -#endif + return FTDM_SUCCESS; } @@ -253,23 +258,26 @@ ftdm_status_t reconfig_all_ckts_for_relay(void) ftdm_status_t block_all_ckts_for_relay(uint32_t procId) { int x; - - SS7_INFO("BLOcking all ckts on ProcID = %d\n", procId); + int ret; /* we just lost connection to this procId, send out a block for all these circuits */ x = (procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { /**************************************************************************/ if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { - /* send out a BLO */ - sng_cc_sta_request (1, - 0, - 0, - g_ftdm_sngss7_data.cfg.isupCkt[x].id, - 0, - SIT_STA_CIRBLOREQ, - NULL); + /* send a block request via stack manager */ + ret = ftmod_ss7_block_isup_ckt(g_ftdm_sngss7_data.cfg.isupCkt[x].id); + if (ret) { + SS7_INFO("Successfully BLOcked CIC:%d(ckt:%d) due to Relay failure\n", + g_ftdm_sngss7_data.cfg.isupCkt[x].cic, + g_ftdm_sngss7_data.cfg.isupCkt[x].id); + } else { + SS7_ERROR("Failed to BLOck CIC:%d(ckt:%d) due to Relay failure\n", + g_ftdm_sngss7_data.cfg.isupCkt[x].cic, + g_ftdm_sngss7_data.cfg.isupCkt[x].id); + } + } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */ /* move along */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 814f418a13..ded695c205 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -83,6 +83,7 @@ int find_ssf_type_in_map(const char *ssfType); int find_cic_cntrl_in_map(const char *cntrlType); ftdm_status_t check_status_of_all_isup_intf(void); +ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan); void sngss7_send_signal(sngss7_chan_data_t *sngss7_info, ftdm_signal_event_t event_id); void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_status_t status); @@ -90,6 +91,9 @@ ftdm_status_t sngss7_add_var(sngss7_chan_data_t *ss7_info, const char* var, cons ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data, ftdm_size_t data_len); /******************************************************************************/ +FTDM_ENUM_NAMES(CKT_FLAGS_NAMES, CKT_FLAGS_STRING) +FTDM_STR2ENUM(ftmod_ss7_ckt_state2flag, ftmod_ss7_ckt_flag2str, sng_ckt_flag_t, CKT_FLAGS_NAMES, 31) + /* FUNCTIONS ******************************************************************/ uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) { @@ -1475,6 +1479,46 @@ void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_statu return; } +/******************************************************************************/ +ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) +{ + ftdm_channel_t *ftdmchan = NULL; + sngss7_chan_data_t *sngss7_info = NULL; + int x; + int ret; + + for (x = 1; x < (ftdmspan->chan_count + 1); x++) { + /**************************************************************************/ + /* extract the channel structure and sngss7 channel data */ + ftdmchan = ftdmspan->channels[x]; + + /* if the call data is NULL move on */ + if (ftdmchan->call_data == NULL) { + SS7_WARN_CHAN(ftdmchan, "Reconfiguring channel that has not call_data!%s\n", " "); + continue; + } + + /* grab the private data */ + sngss7_info = ftdmchan->call_data; + + /* check the reconfig flag */ + if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG)) { + ret = ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id); + + if (ret) { + SS7_CRITICAL("ISUP CKT %d re-configuration FAILED!\n", x); + } else { + SS7_INFO("ISUP CKT %d re-configuration DONE!\n", x); + } + + /* clear the re-config flag ... no matter what */ + sngss7_clear_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG); + + } /* if ((sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG)) */ + } /* for (x = 1; x < (span->chan_count + 1); x++) */ + + return FTDM_SUCCESS; +} /******************************************************************************/ /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 166fe5dc04..49da10cdf1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -2668,7 +2668,7 @@ static int ftmod_ss7_fill_in_isup_interface(sng_isup_inf_t *sng_isup) if (sng_isup->tpause != 0) { g_ftdm_sngss7_data.cfg.isupIntf[i].tpause = sng_isup->tpause; } else { - g_ftdm_sngss7_data.cfg.isupIntf[i].tpause = 150; + g_ftdm_sngss7_data.cfg.isupIntf[i].tpause = 3000; } if (sng_isup->tstaenq != 0) { g_ftdm_sngss7_data.cfg.isupIntf[i].tstaenq = sng_isup->tstaenq; From 21c60c698dbf82014f053f202de73f2bc4c5986f Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Wed, 9 Mar 2011 15:10:14 -0500 Subject: [PATCH 017/558] freetdm: ss7 - bug fix for compile bug introduced by merging --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 291eea0985..02c450b94a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -503,7 +503,8 @@ typedef enum { FLAG_GLARE = (1 << 13), FLAG_INFID_RESUME = (1 << 14), FLAG_INFID_PAUSED = (1 << 15), - FLAG_RELAY_DOWN = (1 << 30) + FLAG_RELAY_DOWN = (1 << 30), + FLAG_CKT_RECONFIG = (1 << 31) } sng_ckt_flag_t; #define CKT_FLAGS_STRING \ From dbfa7fa817e52a1a4b92be27cf29e1a0f1d2260f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 9 Mar 2011 16:55:33 -0500 Subject: [PATCH 018/558] freetdm:Fix ftdm_sigmsg_get_raw_data_detached ISDN: Fix for Facility IE in Facility message not passed to user in raw mode --- libs/freetdm/src/ftdm_io.c | 7 +++++-- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c | 9 +-------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 4c75b6bd8a..12397c0666 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -6053,9 +6053,12 @@ FT_DECLARE(ftdm_status_t) ftdm_sigmsg_get_raw_data_detached(ftdm_sigmsg_t *sigms if (!sigmsg || !sigmsg->raw.len) { return FTDM_FAIL; } - + *data = sigmsg->raw.data; - *datalen = sigmsg->raw.len; + *datalen = sigmsg->raw.len; + + sigmsg->raw.data = NULL; + sigmsg->raw.len = 0; return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 9cac9d05b1..33f3d9870b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -808,17 +808,10 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) if (signal_data->facility_ie_decode == SNGISDN_OPT_FALSE) { /* If Facility decoding is disabled, we do not care about current call state, just pass event up to user */ - ftdm_sigmsg_t sigev; if (facEvnt->facElmt.facStr.pres) { get_facility_ie_str(ftdmchan, &facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len-2); + sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_FACILITY); } - memset(&sigev, 0, sizeof(sigev)); - sigev.chan_id = ftdmchan->chan_id; - sigev.span_id = ftdmchan->span_id; - sigev.channel = ftdmchan; - - sigev.event_id = FTDM_SIGEVENT_FACILITY; - ftdm_span_send_signal(ftdmchan->span, &sigev); ISDN_FUNC_TRACE_EXIT(__FUNCTION__); return; } From 59da356d067a1158029ed7c3fe46a052d4245a5e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 Mar 2011 20:06:27 -0600 Subject: [PATCH 019/558] fix mistake from earlier commit and improve flow of dtmf through a bridge when timer is disabled --- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 ++-- src/switch_ivr_bridge.c | 1 + src/switch_rtp.c | 9 +++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index ebf51b9c39..3bc5cc2231 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1480,7 +1480,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (ok) { switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); - switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); + switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); sofia_set_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE); } @@ -1528,7 +1528,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (sofia_test_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE)) { switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); - switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); + switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_NOBLOCK); sofia_clear_flag(tech_pvt, TFLAG_NOTIMER_DURING_BRIDGE); } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 88c72bf1b8..dbe3b811fe 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -386,6 +386,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) if (send_dtmf) { switch_core_session_send_dtmf(session_b, &dtmf); + switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK); } } } diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 6b8c6b0dc6..e81812a463 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -267,6 +267,8 @@ typedef enum { RESULT_GOTO_TIMERCHECK } handle_rfc2833_result_t; +static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session); + static handle_rfc2833_result_t handle_rfc2833(switch_rtp_t *rtp_session, switch_size_t bytes, int *do_cng) { #ifdef DEBUG_2833 @@ -2209,6 +2211,7 @@ static void do_2833(switch_rtp_t *rtp_session, switch_core_session_t *session) if (rtp_session->dtmf_data.out_digit_dur > 0) { int x, loops = 1; + rtp_session->dtmf_data.out_digit_sofar += samples; rtp_session->dtmf_data.out_digit_sub_sofar += samples; @@ -2737,7 +2740,10 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_USE_TIMER) && rtp_session->read_pollfd) { int pt = poll_sec * 1000000; - if (rtp_session->dtmf_data.out_digit_dur > 0 || rtp_session->dtmf_data.in_digit_sanity) { + do_2833(rtp_session, session); + + if (rtp_session->dtmf_data.out_digit_dur > 0 || rtp_session->dtmf_data.in_digit_sanity || rtp_session->sending_dtmf || + switch_queue_size(rtp_session->dtmf_data.dtmf_queue) || switch_queue_size(rtp_session->dtmf_data.dtmf_inqueue)) { pt = 20000; } @@ -2746,7 +2752,6 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } poll_status = switch_poll(rtp_session->read_pollfd, 1, &fdr, pt); - do_2833(rtp_session, session); if (rtp_session->dtmf_data.out_digit_dur > 0) { return_cng_frame(); From 9e89f607c8a92ee6af26b7af4c6c9cfc2bcd9f41 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 Mar 2011 00:18:06 -0600 Subject: [PATCH 020/558] FS-3140 --comment-only please try this patch --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 12 ++++++++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 11 ++++++++++- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index c3b60da317..156a69d5a7 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -231,6 +231,7 @@ typedef enum { PFLAG_PRESENCE_ON_FIRST_REGISTER, PFLAG_NO_CONNECTION_REUSE, PFLAG_RENEG_ON_HOLD, + PFLAG_RENEG_ON_REINVITE, PFLAG_RTP_NOTIMER_DURING_BRIDGE, /* No new flags below this line */ PFLAG_MAX diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 8e38393efb..761a03ce62 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -2442,6 +2442,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { sofia_clear_pflag(profile, PFLAG_RENEG_ON_HOLD); } + } else if (!strcasecmp(var, "renegotiate-codec-on-reinvite")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } else { + sofia_clear_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } } else if (!strcasecmp(var, "presence-probe-on-register")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); @@ -3137,6 +3143,12 @@ switch_status_t config_sofia(int reload, char *profile_name) } else { sofia_clear_pflag(profile, PFLAG_RENEG_ON_HOLD); } + } else if (!strcasecmp(var, "renegotiate-codec-on-reinvite")) { + if (switch_true(val)) { + sofia_set_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } else { + sofia_clear_pflag(profile, PFLAG_RENEG_ON_REINVITE); + } } else if (!strcasecmp(var, "presence-probe-on-register")) { if (switch_true(val)) { sofia_set_pflag(profile, PFLAG_PRESENCE_PROBE_ON_REGISTER); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 91cf5b6fba..1e42afc269 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -4290,7 +4290,15 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } } - if (!reneg) { + if (reneg) { + reneg = sofia_test_pflag(tech_pvt->profile, PFLAG_RENEG_ON_REINVITE); + + if ((val = switch_channel_get_variable(tech_pvt->channel, "sip_renegotiate_codec_on_reinvite"))) { + reneg = switch_true(val); + } + } + + if (!reneg && tech_pvt->num_negotiated_codecs) { codec_array = tech_pvt->negotiated_codecs; total_codecs = tech_pvt->num_negotiated_codecs; } @@ -4688,6 +4696,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp); tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port; tech_pvt->agreed_pt = (switch_payload_t) map->rm_pt; + tech_pvt->num_negotiated_codecs = 0; tech_pvt->negotiated_codecs[tech_pvt->num_negotiated_codecs++] = mimp; switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port); switch_channel_set_variable(tech_pvt->channel, SWITCH_REMOTE_MEDIA_IP_VARIABLE, tech_pvt->remote_sdp_audio_ip); From e8474d602d3830f6132bf6847cefc487f6907917 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 Mar 2011 00:33:43 -0600 Subject: [PATCH 021/558] ESL-57 --- libs/esl/src/esl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index b0bc311ce0..27000f6071 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -934,7 +934,6 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ goto fail; } - esl_event_safe_destroy(&handle->last_event); esl_event_safe_destroy(&handle->last_ievent); if (check_q && handle->race_event) { @@ -1053,6 +1052,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ *save_event = revent; revent = NULL; } else { + esl_event_safe_destroy(&handle->last_event); handle->last_event = revent; } From 3bbab5cbeae67dae6181cd435af40b575040ae85 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 10 Mar 2011 09:25:49 -0500 Subject: [PATCH 022/558] freetdm: ftmod_zt - print more specific errors for overrun and bad checksum --- libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c index 1b55b739fc..9c01b41299 100644 --- a/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c +++ b/libs/freetdm/src/ftmod/ftmod_zt/ftmod_zt.c @@ -1064,6 +1064,20 @@ static __inline__ ftdm_status_t zt_channel_process_event(ftdm_channel_t *fchan, fchan->rx_cas_bits = bits; } break; + case ZT_EVENT_BADFCS: + { + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Bad frame checksum (ZT_EVENT_BADFCS)!\n"); + /* What else could we do? */ + *event_id = FTDM_OOB_NOOP; + } + break; + case ZT_EVENT_OVERRUN: + { + ftdm_log_chan_msg(fchan, FTDM_LOG_ERROR, "Driver overrun! (ZT_EVENT_OVERRUN)\n"); + /* What else could we do? */ + *event_id = FTDM_OOB_NOOP; + } + break; case ZT_EVENT_NONE: { ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "No event\n"); From 687140b5888e51615c78f60f08b1d1c84cb3388a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 9 Mar 2011 20:26:17 -0600 Subject: [PATCH 023/558] FS-3139 --- libs/libdingaling/src/libdingaling.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c index 44c4589429..6793c3df61 100644 --- a/libs/libdingaling/src/libdingaling.c +++ b/libs/libdingaling/src/libdingaling.c @@ -384,9 +384,12 @@ static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, } while(xml) { - char *type = xtype ? xtype : iks_find_attrib(xml, "type"); + char *type = NULL; iks *tag; - + + if (iks_type(xml)!=IKS_CDATA) + type = xtype ? xtype : iks_find_attrib(xml, "type"); + if (type) { if (!strcasecmp(type, "redirect")) { @@ -994,9 +997,9 @@ static int on_commands(void *user_data, ikspak *pak) uint8_t is_result = strcasecmp(type, "result") ? 0 : 1; uint8_t is_error = strcasecmp(type, "error") ? 0 : 1; iks *xml, *xsession, *xerror = NULL, *xredir = NULL; - + struct iks_tag* tmp; xml = iks_child (pak->x); - + tmp = (struct iks_tag*) xml; if (is_error) { if ((xerror = working_find(xml, "error"))) { char *code = iks_find_attrib(xerror, "code"); From 8758d2f71df0e689f65e2330755d2cc3ebb7f3b0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 Mar 2011 10:47:26 -0600 Subject: [PATCH 024/558] FS-3141 --- src/switch_channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 4341ea9214..bc9b76e90b 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -751,7 +751,7 @@ SWITCH_DECLARE(switch_event_header_t *) switch_channel_variable_first(switch_cha switch_assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); - if ((hi = channel->variables->headers)) { + if (channel->variables && (hi = channel->variables->headers)) { channel->vi = 1; } else { switch_mutex_unlock(channel->profile_mutex); From 1a54968d99505923ec370963bc32466b62650cfc Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Thu, 10 Mar 2011 18:25:43 +0100 Subject: [PATCH 025/558] ftmod_libpri: go to PROGRESS_MEDIA in on_ringing() if there is inband information available and rework channel opening to not skip state changes when the channel is already open. The latter part affects on_ringing(), on_progress() and on_proceeding(). Somewhat experimental and untested (apart from a compile run). Signed-off-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index e051477346..6653a923aa 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -943,12 +943,12 @@ static int on_proceeding(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ if (chan) { /* Open channel if inband information is available */ - if ((pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) && !ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", + if (pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) { + ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, B-Channel %d:%d\n", ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); - if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && (ftdm_channel_open_chan(chan) != FTDM_SUCCESS)) { ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", @@ -985,12 +985,12 @@ static int on_progress(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_ev if (chan) { /* Open channel if inband information is available */ - if ((pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) && !ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", + if (pevent->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) { + ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, B-Channel %d:%d\n", ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); - if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && (ftdm_channel_open_chan(chan) != FTDM_SUCCESS)) { ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", @@ -1028,8 +1028,6 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->ringing.channel); if (chan) { - ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", ftdm_span_get_id(span), pevent->ringing.channel); - /* we may get on_ringing even when we're already in FTDM_CHANNEL_STATE_PROGRESS_MEDIA */ // if (ftdm_channel_get_state(chan) == FTDM_CHANNEL_STATE_PROGRESS_MEDIA) { // /* dont try to move to STATE_PROGRESS to avoid annoying veto warning */ @@ -1037,12 +1035,12 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve // } /* Open channel if inband information is available */ - if ((pevent->ringing.progressmask & PRI_PROG_INBAND_AVAILABLE) && !ftdm_test_flag(chan, FTDM_CHANNEL_OPEN)) { - ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, opening B-Channel %d:%d\n", + if ((pevent->ringing.progressmask & PRI_PROG_INBAND_AVAILABLE)) { + ftdm_log(FTDM_LOG_DEBUG, "-- In-band information available, B-Channel %d:%d\n", ftdm_channel_get_span_id(chan), ftdm_channel_get_id(chan)); - if (ftdm_channel_open_chan(chan) != FTDM_SUCCESS) { + if (!ftdm_test_flag(chan, FTDM_CHANNEL_OPEN) && (ftdm_channel_open_chan(chan) != FTDM_SUCCESS)) { ftdm_caller_data_t *caller_data = ftdm_channel_get_caller_data(chan); ftdm_log(FTDM_LOG_ERROR, "-- Error opening channel %d:%d\n", @@ -1053,9 +1051,13 @@ static int on_ringing(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_eve ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); goto out; } + ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d with media\n", ftdm_span_get_id(span), pevent->proceeding.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); + } else { +// ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); + ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d\n", ftdm_span_get_id(span), pevent->proceeding.channel); + ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RINGING); } -// ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_PROGRESS); - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_RINGING); } else { ftdm_log(FTDM_LOG_DEBUG, "-- Ringing on channel %d:%d but it's not in the span?\n", ftdm_span_get_id(span), pevent->ringing.channel); From a80fae922ff3cb7411bef8b189b4c905d3da9ed9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 Mar 2011 11:33:01 -0600 Subject: [PATCH 026/558] FS-3126 --- src/switch_core_sqldb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 58eb90485a..27bac6d4b4 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1714,7 +1714,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force) switch_cache_db_handle_t *dbh; char *sql; - switch_time_t now; + time_t now; if (!switch_test_flag((&runtime), SCF_USE_SQL)) { return SWITCH_STATUS_FALSE; From 844f69def072313c849ab098000edf11fd368f3f Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Thu, 10 Mar 2011 09:56:10 -0800 Subject: [PATCH 027/558] Update to-be-recorded prompts --- docs/phrase/phrase_en.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 41bc69cde1..36d986bb61 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -428,6 +428,7 @@ + From 4832d26a3a4fdf1763d7fa1503d6148e06b6eab0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 Mar 2011 15:32:09 -0600 Subject: [PATCH 028/558] put this back to 0 --- src/mod/endpoints/mod_sofia/sofia_glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 1e42afc269..3ca14e921d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -3176,7 +3176,7 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f if ((val = switch_channel_get_variable(tech_pvt->channel, "jitterbuffer_msec")) || (val = tech_pvt->profile->jb_msec)) { int jb_msec = atoi(val); - int maxlen = 0, max_drift = 1000; + int maxlen = 0, max_drift = 0; char *p, *q; if ((p = strchr(val, ':'))) { From a8f01d5bc68e4e9ba1f46fa1fd8ac50f170b21b8 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 10 Mar 2011 16:58:16 -0600 Subject: [PATCH 029/558] Correct gains usage example --- libs/freetdm/mod_freetdm/mod_freetdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 0652a8e128..c230e186ee 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -4059,7 +4059,7 @@ SWITCH_STANDARD_API(ft_function) ftdm_channel_t *chan; ftdm_span_t *span = NULL; if (argc < 4) { - stream->write_function(stream, "-ERR Usage: ft gains []\n"); + stream->write_function(stream, "-ERR Usage: ft gains []\n"); goto end; } ftdm_span_find_by_name(argv[3], &span); From 59f6654e960656c95ca5ff01fc4871a36a9c3fba Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 10 Mar 2011 22:02:45 -0600 Subject: [PATCH 030/558] send another presence event on calls that were cancelled from LOSE_RACE to fix winnable race in Broadsoft SCA --- src/mod/endpoints/mod_sofia/sofia_presence.c | 2 +- src/switch_channel.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index 91808a7f50..a9a762e00e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -2004,7 +2004,7 @@ static void sync_sla(sofia_profile_t *profile, const char *to_user, const char * switch_core_hash_init(&sh->hash, sh->pool); sql = switch_mprintf("select sip_from_user,sip_from_host,call_info,call_info_state,uuid from sip_dialogs " - "where hostname='%q' and ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", + "where call_info_state is not null and hostname='%q' and ((sip_from_user='%q' and sip_from_host='%q') or presence_id='%q@%q')", mod_sofia_globals.hostname, to_user, to_host, to_user, to_host); diff --git a/src/switch_channel.c b/src/switch_channel.c index bc9b76e90b..f737dc53c6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2539,6 +2539,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_hangup(switch_chan if (hangup_cause == SWITCH_CAUSE_LOSE_RACE) { + switch_channel_presence(channel, "unknown", "cancelled", NULL); switch_channel_set_variable(channel, "presence_call_info", NULL); } From 373972c0e6d528e4e5d2c1cd20dc4c4f110d7e2e Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 11 Mar 2011 08:52:32 -0600 Subject: [PATCH 031/558] OPENZAP-147 2008 project also needs x64 additions --- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj | 2 +- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2010.vcxproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj index 2e7fb82041..01395cb1db 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.2008.vcproj @@ -118,7 +118,7 @@ - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) true EnableFastChecks MultiThreadedDLL @@ -157,7 +157,7 @@ - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDLL From 9257b749534932dde03940007b2ea276a71d7855 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 11 Mar 2011 11:16:52 -0500 Subject: [PATCH 032/558] freetdm: Updated variables.txt documentation --- libs/freetdm/docs/variables.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/docs/variables.txt b/libs/freetdm/docs/variables.txt index 0beecd016c..cb518e14d8 100644 --- a/libs/freetdm/docs/variables.txt +++ b/libs/freetdm/docs/variables.txt @@ -10,6 +10,7 @@ example #1a - Making an outbound call: To make an outbound call: ftdm_usrmsg_t usrmsg; + memset(&usrmsg, 0, sizeof(usrmsg)); /* Attach variable to usrmsg */ ftdm_usrmsg_add_var(&usrmsg, "isdn.prog_ind.descr", "inband-info-available"); @@ -22,6 +23,7 @@ When using ftmod_sangoma_isdn, user want to specify progress indicator inside PR ftdm_usrmsg_t usrmsg; + memset(&usrmsg, 0, sizeof(usrmsg)); /* Attach variable to usrmsg */ ftdm_usrmsg_add_var(&usrmsg, "isdn.prog_ind.descr", "inband-info-available"); @@ -40,6 +42,8 @@ When using ftmod_sangoma_isdn, user wants to transmit a custom Facility IE, insi uint8_t *my_facility_ie = ftdm_calloc(1, 200); /*memory has to be allocated using ftdm_calloc !! */ unsigned my_facility_ie_len = 0; + memset(&usrmsg, 0, sizeof(usrmsg)); + /* Fill my_facility_ie with custom data here */ my_facility_ie[my_facility_ie_len++] = 0x1C; /* Q.931 Facility IE ID */ my_facility_ie[my_facility_ie_len++] = 0x03; /* Length of facility IE */ @@ -49,7 +53,7 @@ When using ftmod_sangoma_isdn, user wants to transmit a custom Facility IE, insi ftdm_usrmsg_set_raw_data(&usrmsg, my_facility_ie, my_facility_ie_len); - ftdm_channel_call_indicate(ftdmchan, FTDM_CHANNEL_INDICATE_FACILITY, &usrmsg); + ftdm_channel_call_indicate_ex(ftdmchan, FTDM_CHANNEL_INDICATE_FACILITY, &usrmsg); /* FreeTDM will automatically free my_facility_ie */ From 51a531aaefe3c7c7f966da4a4fb035fec51a2875 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 11 Mar 2011 12:40:56 -0500 Subject: [PATCH 033/558] mod_callcenter: Fix a bug when an caller leave the queue from a BREAK Call (Transfer...), it doesn't think an agent answered. --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 12e1960841..99e790db50 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2302,7 +2302,7 @@ SWITCH_STANDARD_APP(callcenter_function) } /* Hangup any agents been callback */ - if (!switch_channel_up(member_channel)) { /* If channel is still up, it mean that the member didn't hangup, so we should leave the agent alone */ + if (!switch_channel_up(member_channel) || !switch_channel_get_variable(member_channel, "cc_agent_uuid")) { /* If channel is still up, it mean that the member didn't hangup, so we should leave the agent alone */ switch_core_session_hupall_matching_var("cc_member_uuid", member_uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); sql = switch_mprintf("UPDATE members SET state = '%q', uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), member_uuid); From 6cd5ce7265ce2400dea3715aa0ac9aa3617df3b3 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Fri, 11 Mar 2011 10:24:55 -0800 Subject: [PATCH 034/558] Add README_IMPORTANT.txt to default configuration --- conf/README_IMPORTANT.txt | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 conf/README_IMPORTANT.txt diff --git a/conf/README_IMPORTANT.txt b/conf/README_IMPORTANT.txt new file mode 100644 index 0000000000..8d82b404f6 --- /dev/null +++ b/conf/README_IMPORTANT.txt @@ -0,0 +1,35 @@ + -= PLEASE READ THIS BEFORE YOU PUT A FreeSWITCH BOX INTO PRODUCTION =- + +This configuration, generally known as the "default configuration" for FreeSWITCH, is *NOT* designed to be put into a production environment without some important modifications. Please keep in mind that the default configuration is designed to demonstrate what FreeSWITCH *can* do, not what it *should* do in your specific scenario. + +*** SECURING YOUR SERVER *** + +By default, FreeSWITCH starts up and does a NATPMP and UPnP request to your router. If your router supports either of these protocols then FreeSWITCH does two things: +#1 - It gets the external IP address, which it uses for SIP communications +#2 - It causes there to be a "pinhole" opened up in the router allowing inbound communications to your FreeSWITCH server + +Please re-read #2. Now, please re-read #2 again. If you do not want a pinhole coming through your router then DO NOT USE the "auto-nat" tools. The way to disable the auto-nat (that is, UPnP/NATPMP) checking is to start FreeSWITCH with the "-nonat" flag. Easy enough. + +If you are planning on putting a system into production then you had better pay attention to security in other areas as well. If you are behind a firewall then make sure your firewall is actually protecting you. If you have your server on a public-facing Internet connection then we recommend a few things: +#1 - Consider using iptables (Linux/Unix) +#2 - Consider using fail2ban (see http://wiki.freeswitch.org/wiki/Fail2ban) + +*** SECURING YOUR USERS *** + +By default, the static XML files have 20 "directory users" in conf/directory/10xx.xml, numbered 1000-1019. Also, the default dialplan has routing for calls to those same extension numbers. (NOTE: the directory and the dialplan are 100% separate concepts. Check out chapters 3-5 of the awesome FreeSWITCH book for details.) + +The default users all have *very* simple passwords for SIP credentials and voicemail. If you put those into a production system then you are either brave, ignorant, or stupid. Please don't be any of those three things! You have a few choices for handling your users: + +#1 - Delete the static XML files and use mod_xml_curl for dynamic users from a back-end database +#2 - Manually edit the static XML user directory files and modify the passwords +#3 - Run the handy randomize-passwords.pl script found in scripts/perl/ subdirectory under the main FreeSWITCH source directory + +*** GETTING HELP *** + +FreeSWITCH has a thriving on-line community - we welcome you to join us! +IRC: #freeswitch on irc.freenode.net +Mailing List: freeswitch-users on lists.freeswitch.org + +You can also get professional FreeSWITCH assistance by visiting http://www.freeswitchsolutions.com or sending an email to consulting@freeswitch.org. + +Happy FreeSWITCHing! From 24a972925b851c39d4f39db5f536d12ef4118a8b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 11 Mar 2011 13:00:16 -0600 Subject: [PATCH 035/558] pass header in X-FS headers on attended transfer CID update to indicate specific situation to flip callee/caller id when targeting a 1 legged call --- src/include/switch_channel.h | 1 + src/include/switch_types.h | 2 ++ src/mod/endpoints/mod_sofia/mod_sofia.c | 11 +++++++ src/mod/endpoints/mod_sofia/sofia.c | 25 +++++++++++++-- src/switch_channel.c | 41 ++++++++++++++++--------- src/switch_ivr_originate.c | 2 ++ 6 files changed, 65 insertions(+), 17 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index 25273bafc4..fdbbc9ab91 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -315,6 +315,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc */ SWITCH_DECLARE(void) switch_channel_set_caller_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension); +SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel); SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in); /*! diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 4253d0e542..79494d8979 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -1107,6 +1107,8 @@ typedef enum { CF_DIALPLAN, CF_BLOCK_BROADCAST_UNTIL_MEDIA, CF_CNG_PLC, + CF_ATTENDED_TRANSFER, + CF_LAZY_ATTENDED_TRANSFER, /* WARNING: DO NOT ADD ANY FLAGS BELOW THIS LINE */ CF_FLAG_MAX } switch_channel_flag_t; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 3bc5cc2231..f50e057d5f 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1878,6 +1878,17 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote)) { snprintf(message, sizeof(message), "X-FS-Display-Name: %s\nX-FS-Display-Number: %s\n", name, number); + if (switch_channel_test_flag(tech_pvt->channel, CF_LAZY_ATTENDED_TRANSFER)) { + snprintf(message + strlen(message), sizeof(message) - strlen(message), "X-FS-Lazy-Attended-Transfer: true\n"); + switch_channel_clear_flag(tech_pvt->channel, CF_LAZY_ATTENDED_TRANSFER); + switch_channel_clear_flag(tech_pvt->channel, CF_ATTENDED_TRANSFER); + } + + if (switch_channel_test_flag(tech_pvt->channel, CF_ATTENDED_TRANSFER)) { + snprintf(message + strlen(message), sizeof(message) - strlen(message), "X-FS-Attended-Transfer: true\n"); + switch_channel_clear_flag(tech_pvt->channel, CF_ATTENDED_TRANSFER); + } + nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/update_display"), TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)), TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END()); diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 761a03ce62..d612e30f0b 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -637,7 +637,7 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro char *dup = NULL; switch_event_t *event; const char *val; - int fs = 0; + int fs = 0, lazy = 0, att = 0; if (switch_true(switch_channel_get_variable(channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) { return; @@ -656,6 +656,16 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro name = (char *) val; fs++; } + + if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Lazy-Attended-Transfer"))) { + lazy = switch_true(val); + fs++; + } + + if ((val = sofia_glue_get_unknown_header(sip, "X-FS-Attended-Transfer"))) { + att = switch_true(val); + fs++; + } if (!fs) { if ((passerted = sip_p_asserted_identity(sip))) { @@ -727,6 +737,10 @@ void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *pro caller_profile->callee_id_name = switch_sanitize_number(switch_core_strdup(caller_profile->pool, name)); caller_profile->callee_id_number = switch_sanitize_number(switch_core_strdup(caller_profile->pool, number)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s Update Callee ID to \"%s\" <%s>\n", switch_channel_get_name(channel), name, number); + + if (lazy || (att && !switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) { + switch_channel_flip_cid(channel); + } } if (send) { @@ -5717,9 +5731,14 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Attended Transfer [%s][%s]\n", switch_str_nil(br_a), switch_str_nil(br_b)); - if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) && (tmp = switch_core_session_locate(br_b))) { + if ((tmp = switch_core_session_locate(br_b))) { switch_channel_t *tchannel = switch_core_session_get_channel(tmp); - switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE); + + if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER)) { + switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE); + } + + switch_channel_set_flag(tchannel, CF_ATTENDED_TRANSFER); switch_core_session_rwunlock(tmp); } diff --git a/src/switch_channel.c b/src/switch_channel.c index f737dc53c6..784577c642 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2434,26 +2434,39 @@ SWITCH_DECLARE(switch_status_t) switch_channel_caller_extension_masquerade(switc return status; } +SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel) +{ + switch_mutex_lock(channel->profile_mutex); + if (channel->caller_profile->callee_id_name) { + switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name); + channel->caller_profile->caller_id_name = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_name); + } + channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING; + + if (channel->caller_profile->callee_id_number) { + switch_channel_set_variable(channel, "pre_transfer_caller_id_number", channel->caller_profile->caller_id_number); + channel->caller_profile->caller_id_number = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_number); + } + channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING; + switch_mutex_unlock(channel->profile_mutex); + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s Flipping CID from \"%s\" <%s> to \"%s\" <%s>\n", + switch_channel_get_name(channel), + switch_channel_get_variable(channel, "pre_transfer_caller_id_name"), + switch_channel_get_variable(channel, "pre_transfer_caller_id_number"), + channel->caller_profile->caller_id_name, + channel->caller_profile->caller_id_number + ); + +} + SWITCH_DECLARE(void) switch_channel_sort_cid(switch_channel_t *channel, switch_bool_t in) { if (in) { if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND && !switch_channel_test_flag(channel, CF_DIALPLAN)) { switch_channel_set_flag(channel, CF_DIALPLAN); - - switch_mutex_lock(channel->profile_mutex); - if (channel->caller_profile->callee_id_name) { - switch_channel_set_variable(channel, "pre_transfer_caller_id_name", channel->caller_profile->caller_id_name); - channel->caller_profile->caller_id_name = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_name); - } - channel->caller_profile->callee_id_name = SWITCH_BLANK_STRING; - - if (channel->caller_profile->callee_id_number) { - switch_channel_set_variable(channel, "pre_transfer_caller_id_number", channel->caller_profile->caller_id_number); - channel->caller_profile->caller_id_number = switch_core_strdup(channel->caller_profile->pool, channel->caller_profile->callee_id_number); - } - channel->caller_profile->callee_id_number = SWITCH_BLANK_STRING; - switch_mutex_unlock(channel->profile_mutex); + switch_channel_flip_cid(channel); } return; diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 92137ea5d8..fe5edac504 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3264,6 +3264,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_channel_set_variable(switch_core_session_get_channel(holding_session), SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true"); switch_core_session_rwunlock(holding_session); } + switch_channel_set_flag(peer_channel, CF_LAZY_ATTENDED_TRANSFER); switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(peer_session)); holding = NULL; oglobals.idx = IDX_NADA; @@ -3335,6 +3336,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_channel_set_variable(switch_core_session_get_channel(holding_session), SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE, "true"); switch_core_session_rwunlock(holding_session); } + switch_channel_set_flag(originate_status[i].peer_channel, CF_LAZY_ATTENDED_TRANSFER); switch_ivr_uuid_bridge(holding, switch_core_session_get_uuid(originate_status[i].peer_session)); holding = NULL; } else { From b0ded7ff3b39ead5049d0474834fc1722190050f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 11 Mar 2011 14:48:26 -0500 Subject: [PATCH 036/558] freetdm: ISDN-Q921 Unsollicited protocol errors printed in DEBUG instead of INFO --- .../ftmod_sangoma_isdn_stack_rcv.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 791b65f0f6..9df1fe5557 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -662,6 +662,7 @@ void sngisdn_rcv_phy_ind(SuId suId, Reason reason) void sngisdn_rcv_q921_ind(BdMngmt *status) { ftdm_span_t *ftdmspan; + unsigned loglevel = FTDM_LOG_LEVEL_INFO; sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[status->t.usta.lnkNmb].spans[1]; @@ -677,19 +678,11 @@ void sngisdn_rcv_q921_ind(BdMngmt *status) } switch (status->t.usta.alarm.category) { - case (LCM_CATEGORY_INTERFACE): - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", - ftdmspan->name, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + case (LCM_CATEGORY_PROTOCOL): + loglevel = FTDM_LOG_LEVEL_DEBUG; break; default: - ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", - ftdmspan->name, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + loglevel = FTDM_LOG_LEVEL_INFO; switch (status->t.usta.alarm.event) { case ENTR_CONG: /* Entering Congestion */ @@ -703,6 +696,12 @@ void sngisdn_rcv_q921_ind(BdMngmt *status) } break; } + ftdm_log(FTDM_PRE, loglevel, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", + ftdmspan->name, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + return; } void sngisdn_rcv_q931_ind(InMngmt *status) From 7da95316925292ac4813af0add7b929481fa9d0f Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 11 Mar 2011 15:06:22 -0500 Subject: [PATCH 037/558] freetdm:Fix for Q921 indications not decoded properly --- .../ftmod_sangoma_isdn_stack_rcv.c | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c index 9df1fe5557..7b9989dd4c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_rcv.c @@ -662,7 +662,6 @@ void sngisdn_rcv_phy_ind(SuId suId, Reason reason) void sngisdn_rcv_q921_ind(BdMngmt *status) { ftdm_span_t *ftdmspan; - unsigned loglevel = FTDM_LOG_LEVEL_INFO; sngisdn_span_data_t *signal_data = g_sngisdn_data.dchans[status->t.usta.lnkNmb].spans[1]; @@ -679,11 +678,19 @@ void sngisdn_rcv_q921_ind(BdMngmt *status) switch (status->t.usta.alarm.category) { case (LCM_CATEGORY_PROTOCOL): - loglevel = FTDM_LOG_LEVEL_DEBUG; + ftdm_log(FTDM_LOG_DEBUG, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", + ftdmspan->name, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); break; default: - loglevel = FTDM_LOG_LEVEL_INFO; - + ftdm_log(FTDM_LOG_INFO, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", + ftdmspan->name, + DECODE_LCM_CATEGORY(status->t.usta.alarm.category), + DECODE_LLD_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, + DECODE_LLD_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); + switch (status->t.usta.alarm.event) { case ENTR_CONG: /* Entering Congestion */ ftdm_log(FTDM_LOG_WARNING, "s%d: Entering Congestion\n", ftdmspan->span_id); @@ -696,12 +703,6 @@ void sngisdn_rcv_q921_ind(BdMngmt *status) } break; } - ftdm_log(FTDM_PRE, loglevel, "[SNGISDN Q921] %s: %s: %s(%d): %s(%d)\n", - ftdmspan->name, - DECODE_LCM_CATEGORY(status->t.usta.alarm.category), - DECODE_LCM_EVENT(status->t.usta.alarm.event), status->t.usta.alarm.event, - DECODE_LCM_CAUSE(status->t.usta.alarm.cause), status->t.usta.alarm.cause); - return; } void sngisdn_rcv_q931_ind(InMngmt *status) From 75ba53cfb2ac746e832f8f61d6bc519c80ecabf1 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Fri, 11 Mar 2011 17:02:51 -0500 Subject: [PATCH 038/558] freetdm: minor changes to mkrelease.sh --- libs/freetdm/mkrelease.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 4b9a18bf9f..46d4fbd93f 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -129,8 +129,7 @@ cp -r ./* $INSTALLPREFIX/$release # copy ABI compatibility reports to release if [ -d compat_reports ]; then - cp -r ./compat_reports $INSTALLPREFIX/$release - rm -rf ./compat_reports + mv ./compat_reports $INSTALLPREFIX/$release fi cp -r ./* $INSTALLPREFIX/bin-releases/$major/$release @@ -141,9 +140,9 @@ find $INSTALLPREFIX/$release -name .deps -exec rm -rf {} \; find $INSTALLPREFIX/$release -name *.so -exec rm -rf {} \; find $INSTALLPREFIX/$release -name *.lo -exec rm -rf {} \; rm -rf $INSTALLPREFIX/$release/{$LIBSNG_ISDN_DIR,$LIBSNG_SS7_DIR,*.tgz} +rm -rf $INSTALLPREFIX/bin-releases/$major/$release/{$LIBSNG_ISDN_DIR,$LIBSNG_SS7_DIR,*.tgz} # clean the source tree -rm -rf $LIBSNG_ISDN_DIR $LIBSNG_SS7_DIR make clean make mod_freetdm-clean From acd6d4442b882e33f7a67ff8c942b6576982527f Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Fri, 11 Mar 2011 17:36:42 -0500 Subject: [PATCH 039/558] freetdm: fixes to mkrelease.sh --- libs/freetdm/mkrelease.sh | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/libs/freetdm/mkrelease.sh b/libs/freetdm/mkrelease.sh index 46d4fbd93f..b079158541 100755 --- a/libs/freetdm/mkrelease.sh +++ b/libs/freetdm/mkrelease.sh @@ -125,6 +125,12 @@ echo "Creating $release ($major.$minor.$micro) at $INSTALLPREFIX/$release (direc mkdir -p $INSTALLPREFIX/$release $INSTALLPREFIX/bin-releases/$major/$release +cp -r ./* $INSTALLPREFIX/bin-releases/$major/$release +cp -r ./.libs $INSTALLPREFIX/bin-releases/$major/$release + +make clean +make mod_freetdm-clean + cp -r ./* $INSTALLPREFIX/$release # copy ABI compatibility reports to release @@ -132,20 +138,7 @@ if [ -d compat_reports ]; then mv ./compat_reports $INSTALLPREFIX/$release fi -cp -r ./* $INSTALLPREFIX/bin-releases/$major/$release -cp -r ./.libs $INSTALLPREFIX/bin-releases/$major/$release - -find $INSTALLPREFIX/$release -name .libs -exec rm -rf {} \; -find $INSTALLPREFIX/$release -name .deps -exec rm -rf {} \; -find $INSTALLPREFIX/$release -name *.so -exec rm -rf {} \; -find $INSTALLPREFIX/$release -name *.lo -exec rm -rf {} \; rm -rf $INSTALLPREFIX/$release/{$LIBSNG_ISDN_DIR,$LIBSNG_SS7_DIR,*.tgz} rm -rf $INSTALLPREFIX/bin-releases/$major/$release/{$LIBSNG_ISDN_DIR,$LIBSNG_SS7_DIR,*.tgz} -# clean the source tree -make clean -make mod_freetdm-clean - tar -C $INSTALLPREFIX -czf $INSTALLPREFIX/$release.tar.gz $release/ - - From 30dd1774ad59ff4db0f10f4d4d4de7660d4bc0c7 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 12 Mar 2011 11:03:03 -0500 Subject: [PATCH 040/558] =?UTF-8?q?mod=5Fcallcenter:=20Add=20new=20CLI=20c?= =?UTF-8?q?md=20and=20change=20some=20to=20be=20more=20standard.=20=20Patc?= =?UTF-8?q?h=20from=20Fran=C3=A7ois=20Delawarde,=20thanks.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mod_callcenter/mod_callcenter.c | 121 +++++++++++++----- 1 file changed, 90 insertions(+), 31 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 99e790db50..468739806d 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2395,17 +2395,24 @@ static int list_result_callback(void *pArg, int argc, char **argv, char **column "callcenter_config agent set reject_delay_time [agent_name] [wait second] | "\ "callcenter_config agent set busy_delay_time [agent_name] [wait second] | "\ "callcenter_config agent get status [agent_name] | " \ +"callcenter_config agent list | " \ "callcenter_config tier add [queue_name] [agent_name] [level] [position] | " \ "callcenter_config tier set state [queue_name] [agent_name] [state] | " \ "callcenter_config tier set level [queue_name] [agent_name] [level] | " \ "callcenter_config tier set position [queue_name] [agent_name] [position] | " \ "callcenter_config tier del [queue_name] [agent_name] | " \ +"callcenter_config tier list | " \ "callcenter_config queue load [queue_name] | " \ "callcenter_config queue unload [queue_name] | " \ "callcenter_config queue reload [queue_name] | " \ -"callcenter_config tier list [queue_name] | " \ -"callcenter_config queue list [queue_name] | " \ -"callcenter_config queue count [queue_name]" +"callcenter_config queue list | " \ +"callcenter_config queue list agents [queue_name] [status] | " \ +"callcenter_config queue list members [queue_name] | " \ +"callcenter_config queue list tiers [queue_name] | " \ +"callcenter_config queue count | " \ +"callcenter_config queue count agents [queue_name] [status] | " \ +"callcenter_config queue count members [queue_name] | " \ +"callcenter_config queue count tiers [queue_name]" SWITCH_STANDARD_API(cc_config_api_function) { @@ -2513,6 +2520,7 @@ SWITCH_STANDARD_API(cc_config_api_function) } } + } else if (action && !strcasecmp(action, "get")) { if (argc-initial_argc < 2) { stream->write_function(stream, "%s", "-ERR Invalid!\n"); @@ -2538,6 +2546,7 @@ SWITCH_STANDARD_API(cc_config_api_function) } } + } else if (action && !strcasecmp(action, "list")) { struct list_result cbt; cbt.row_process = 0; @@ -2616,6 +2625,7 @@ SWITCH_STANDARD_API(cc_config_api_function) goto done; } } + } else if (action && !strcasecmp(action, "del")) { if (argc-initial_argc < 2) { stream->write_function(stream, "%s", "-ERR Invalid!\n"); @@ -2635,19 +2645,13 @@ SWITCH_STANDARD_API(cc_config_api_function) } } else if (action && !strcasecmp(action, "list")) { - if (argc-initial_argc < 1) { - stream->write_function(stream, "%s", "-ERR Invalid!\n"); - goto done; - } else { - const char *queue = argv[0 + initial_argc]; - struct list_result cbt; - cbt.row_process = 0; - cbt.stream = stream; - sql = switch_mprintf("SELECT * FROM tiers WHERE queue = '%q' ORDER BY level, position", queue); - cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, list_result_callback, &cbt /* Call back variables */); - switch_safe_free(sql); - stream->write_function(stream, "%s", "+OK\n"); - } + struct list_result cbt; + cbt.row_process = 0; + cbt.stream = stream; + sql = switch_mprintf("SELECT * FROM tiers ORDER BY level, position"); + cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, list_result_callback, &cbt /* Call back variables */); + switch_safe_free(sql); + stream->write_function(stream, "%s", "+OK\n"); } } else if (section && !strcasecmp(section, "queue")) { if (action && !strcasecmp(action, "load")) { @@ -2664,6 +2668,7 @@ SWITCH_STANDARD_API(cc_config_api_function) stream->write_function(stream, "%s", "-ERR Invalid Queue not found!\n"); } } + } else if (action && !strcasecmp(action, "unload")) { if (argc-initial_argc < 1) { stream->write_function(stream, "%s", "-ERR Invalid!\n"); @@ -2674,6 +2679,7 @@ SWITCH_STANDARD_API(cc_config_api_function) stream->write_function(stream, "%s", "+OK\n"); } + } else if (action && !strcasecmp(action, "reload")) { if (argc-initial_argc < 1) { stream->write_function(stream, "%s", "-ERR Invalid!\n"); @@ -2689,7 +2695,9 @@ SWITCH_STANDARD_API(cc_config_api_function) stream->write_function(stream, "%s", "-ERR Invalid Queue not found!\n"); } } + } else if (action && !strcasecmp(action, "list")) { + /* queue list */ if (argc-initial_argc < 1) { switch_hash_index_t *hi; stream->write_function(stream, "%s", "name|strategy|moh_sound|time_base_score|tier_rules_apply|tier_rule_wait_second|tier_rule_wait_multiply_level|tier_rule_no_agent_no_wait|discard_abandoned_after|abandoned_resume_allowed|max_wait_time|max_wait_time_with_no_agent|max_wait_time_with_no_agent_time_reached|record_template\n"); @@ -2708,35 +2716,81 @@ SWITCH_STANDARD_API(cc_config_api_function) stream->write_function(stream, "%s", "+OK\n"); goto done; } else { - const char *queue_name = argv[0 + initial_argc]; + const char *sub_action = argv[0 + initial_argc]; + const char *queue_name = argv[1 + initial_argc]; + const char *status = NULL; struct list_result cbt; + + /* queue list agents */ + if (sub_action && !strcasecmp(sub_action, "agents")) { + if (argc-initial_argc > 2) { + status = argv[2 + initial_argc]; + } + if (status) { + sql = switch_mprintf("SELECT agents.* FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q'", queue_name, status); + } else { + sql = switch_mprintf("SELECT agents.* FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q'", queue_name); + } + /* queue list members */ + } else if (sub_action && !strcasecmp(sub_action, "members")) { + sql = switch_mprintf("SELECT * FROM members WHERE queue = '%q';", queue_name); + /* queue list tiers */ + } else if (sub_action && !strcasecmp(sub_action, "tiers")) { + sql = switch_mprintf("SELECT * FROM tiers WHERE queue = '%q';", queue_name); + } else { + stream->write_function(stream, "%s", "-ERR Invalid!\n"); + goto done; + } + cbt.row_process = 0; cbt.stream = stream; - sql = switch_mprintf("SELECT * FROM members WHERE queue = '%q'", queue_name); cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, list_result_callback, &cbt /* Call back variables */); switch_safe_free(sql); stream->write_function(stream, "%s", "+OK\n"); } + } else if (action && !strcasecmp(action, "count")) { + /* queue count */ if (argc-initial_argc < 1) { - stream->write_function(stream, "%s", "-ERR Invalid!\n"); + switch_hash_index_t *hi; + int queue_count = 0; + switch_mutex_lock(globals.mutex); + for (hi = switch_hash_first(NULL, globals.queue_hash); hi; hi = switch_hash_next(hi)) { + queue_count++; + } + switch_mutex_unlock(globals.mutex); + stream->write_function(stream, "%d\n", queue_count); goto done; } else { - const char *queue_name = argv[0 + initial_argc]; + const char *sub_action = argv[0 + initial_argc]; + const char *queue_name = argv[1 + initial_argc]; + const char *status = NULL; char res[256] = ""; - switch_event_t *event; - /* Check to see if agent already exist */ - sql = switch_mprintf("SELECT count(*) FROM members WHERE queue = '%q'", queue_name); + + /* queue count agents */ + if (sub_action && !strcasecmp(sub_action, "agents")) { + if (argc-initial_argc > 2) { + status = argv[2 + initial_argc]; + } + if (status) { + sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q' AND agents.status = '%q'", queue_name, status); + } else { + sql = switch_mprintf("SELECT count(*) FROM agents,tiers WHERE tiers.agent = agents.name AND tiers.queue = '%q'", queue_name); + } + /* queue count members */ + } else if (sub_action && !strcasecmp(sub_action, "members")) { + sql = switch_mprintf("SELECT count(*) FROM members WHERE queue = '%q';", queue_name); + /* queue count tiers */ + } else if (sub_action && !strcasecmp(sub_action, "tiers")) { + sql = switch_mprintf("SELECT count(*) FROM tiers WHERE queue = '%q';", queue_name); + } else { + stream->write_function(stream, "%s", "-ERR Invalid!\n"); + goto done; + } + cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); stream->write_function(stream, "%d\n", atoi(res)); - - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "members-count"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Count", res); - switch_event_fire(&event); - } } } } @@ -2792,7 +2846,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_console_set_complete("add callcenter_config agent get status"); switch_console_set_complete("add callcenter_config agent list"); - switch_console_set_complete("add callcenter_config tier add"); switch_console_set_complete("add callcenter_config tier del"); switch_console_set_complete("add callcenter_config tier set state"); @@ -2804,7 +2857,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_console_set_complete("add callcenter_config queue unload"); switch_console_set_complete("add callcenter_config queue reload"); switch_console_set_complete("add callcenter_config queue list"); + switch_console_set_complete("add callcenter_config queue list agents"); + switch_console_set_complete("add callcenter_config queue list members"); + switch_console_set_complete("add callcenter_config queue list tiers"); switch_console_set_complete("add callcenter_config queue count"); + switch_console_set_complete("add callcenter_config queue count agents"); + switch_console_set_complete("add callcenter_config queue count members"); + switch_console_set_complete("add callcenter_config queue count tiers"); /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; From 5f2337859b3f468abdd3e07c23dc6b465fbdb830 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 12 Mar 2011 11:29:20 -0500 Subject: [PATCH 041/558] mod_callcenter: >WARNING, some event value got removed< Adding new event time value that can then be used to calculate the Wait;Talk;Total duration of a member were on call. CC-Wait-Time CC-Talk-Time and CC-Total-Time are no longer returned. Visit the code or check the wiki for the updated variable. --- .../mod_callcenter/mod_callcenter.c | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 468739806d..0e40cbb591 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1466,6 +1466,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); @@ -1514,9 +1517,14 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_event_set_data(agent_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "bridge-agent-end"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Hangup-Cause", switch_channel_cause2str(cause)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%ld", (long) switch_epoch_time_now(NULL)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); @@ -1543,10 +1551,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Terminated"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answer-Time", "%ld", (long) (t_agent_answered - t_agent_called)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Wait-Time", "%ld", (long) (t_agent_answered - t_member_called)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Talk-Time", "%ld", (long) (switch_epoch_time_now(NULL) - t_agent_answered)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Total-Time", "%ld", (long) (switch_epoch_time_now(NULL) - t_member_called)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); @@ -1566,7 +1574,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s Origination Canceled : %s\n",h->agent_name, switch_channel_cause2str(cause)); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s Origination Canceled : %s\n", h->agent_name, switch_channel_cause2str(cause)); switch (cause) { case SWITCH_CAUSE_USER_NOT_REGISTERED: /* When we are calling a unregistred device */ @@ -1609,6 +1617,19 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } } + /* Fire up event when contact agent fails */ + if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "bridge-agent-fail"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Hangup-Cause", switch_channel_cause2str(cause)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); + switch_event_fire(&event); + } + } done: @@ -2314,7 +2335,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Wait-Time", "%ld", (long) (switch_epoch_time_now(NULL) - t_member_called)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member \"%s\" <%s> exit queue %s due to %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), From 943e289043fadc8725609ea991c160484de7eb56 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 12 Mar 2011 11:44:35 -0500 Subject: [PATCH 042/558] mod_callcenter: Small event value correction from previous commit --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 0e40cbb591..c4a8ea389f 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2335,7 +2335,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member \"%s\" <%s> exit queue %s due to %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), From 26303c5c7a53383d89eae2ac1df21bd38953dc64 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 12 Mar 2011 11:58:35 -0500 Subject: [PATCH 043/558] =?UTF-8?q?mod=5Fcallcenter:=20Add=20better=20supp?= =?UTF-8?q?ort=20when=20agent=20doesn't=20answer,=20including=20creating?= =?UTF-8?q?=20a=20new=20variable=20for=20the=20delay=20that=20is=20differe?= =?UTF-8?q?nt=20than=20reject=20or=20busy.=20=20Thanks=20to=20Fran=C3=A7oi?= =?UTF-8?q?s=20Delawarde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mod_callcenter/mod_callcenter.c | 81 +++++++++++-------- 1 file changed, 49 insertions(+), 32 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index c4a8ea389f..6d09479714 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -216,6 +216,7 @@ static char agents_sql[] = " wrap_up_time INTEGER NOT NULL DEFAULT 0,\n" " reject_delay_time INTEGER NOT NULL DEFAULT 0,\n" " busy_delay_time INTEGER NOT NULL DEFAULT 0,\n" +" no_answer_delay_time INTEGER NOT NULL DEFAULT 0,\n" " last_bridge_start INTEGER NOT NULL DEFAULT 0,\n" " last_bridge_end INTEGER NOT NULL DEFAULT 0,\n" " last_offered_call INTEGER NOT NULL DEFAULT 0,\n" @@ -705,6 +706,7 @@ static cc_queue_t *load_queue(const char *queue_name) switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", NULL, "alter table agents add ready_time integer not null default 0;" "alter table agents add reject_delay_time integer not null default 0;" "alter table agents add busy_delay_time integer not null default 0;"); + switch_cache_db_test_reactive(dbh, "select count(no_answer_delay_time) from agents", NULL, "alter table agents add no_answer_delay_time integer not null default 0;"); switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", "drop table agents", agents_sql); switch_cache_db_test_reactive(dbh, "select count(queue) from tiers", "drop table tiers" , tiers_sql); switch_mutex_init(&queue->mutex, SWITCH_MUTEX_NESTED, queue->pool); @@ -768,6 +770,7 @@ struct call_helper { int max_no_answer; int reject_delay_time; int busy_delay_time; + int no_answer_delay_time; switch_memory_pool_t *pool; }; @@ -1007,6 +1010,12 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); + result = CC_STATUS_SUCCESS; + } else if (!strcasecmp(key, "no_answer_delay_time")) { + sql = switch_mprintf("UPDATE agents SET no_answer_delay_time = '%ld', system = 'single_box' WHERE name = '%q'", atol(value), agent); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + result = CC_STATUS_SUCCESS; } else if (!strcasecmp(key, "type")) { if (strcasecmp(value, CC_AGENT_TYPE_CALLBACK) && strcasecmp(value, CC_AGENT_TYPE_UUID_STANDBY)) { @@ -1203,6 +1212,7 @@ static switch_status_t load_agent(const char *agent_name) const char *wrap_up_time = switch_xml_attr(x_agent, "wrap-up-time"); const char *reject_delay_time = switch_xml_attr(x_agent, "reject-delay-time"); const char *busy_delay_time = switch_xml_attr(x_agent, "busy-delay-time"); + const char *no_answer_delay_time = switch_xml_attr(x_agent, "no-answer-delay-time"); if (type) { cc_status_t res = cc_agent_add(agent_name, type); @@ -1225,6 +1235,9 @@ static switch_status_t load_agent(const char *agent_name) if (busy_delay_time) { cc_agent_update("busy_delay_time", busy_delay_time, agent_name); } + if (no_answer_delay_time) { + cc_agent_update("no_answer_delay_time", no_answer_delay_time, agent_name); + } if (type && res == CC_STATUS_AGENT_ALREADY_EXIST) { cc_agent_update("type", type, agent_name); @@ -1565,8 +1578,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } else { - int delay_next_agent_call = 0; /* Agent didn't answer or originate failed */ + int delay_next_agent_call = 0; sql = switch_mprintf("UPDATE members SET state = '%q', serving_agent = '', serving_system = ''" " WHERE serving_agent = '%q' AND serving_system = '%q' AND uuid = '%q' AND system = 'single_box'", cc_member_state2str(CC_MEMBER_STATE_WAITING), @@ -1577,30 +1590,22 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s Origination Canceled : %s\n", h->agent_name, switch_channel_cause2str(cause)); switch (cause) { - case SWITCH_CAUSE_USER_NOT_REGISTERED: /* When we are calling a unregistred device */ - case SWITCH_CAUSE_USER_BUSY: /* Could be the phone is in Do Not Disturb */ - delay_next_agent_call = (h->busy_delay_time > delay_next_agent_call?h->busy_delay_time:delay_next_agent_call); - break; - case SWITCH_CAUSE_CALL_REJECTED: /* User could have press the reject call on their phone */ - delay_next_agent_call = (h->reject_delay_time > delay_next_agent_call?h->reject_delay_time:delay_next_agent_call); - break; - default: - break; - } - - switch (cause) { - case SWITCH_CAUSE_USER_NOT_REGISTERED: /* When we are calling a unregistred device */ - case SWITCH_CAUSE_USER_BUSY: /* Could be the phone is in Do Not Disturb */ - case SWITCH_CAUSE_CALL_REJECTED: /* User could have press the reject call on their phone */ + /* When we hang-up agents that did not answer in ring-all strategy */ case SWITCH_CAUSE_ORIGINATOR_CANCEL: - if (delay_next_agent_call > 0) { - char ready_epoch[64]; - switch_snprintf(ready_epoch, sizeof(ready_epoch), "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL) + delay_next_agent_call); /* Make the time configurable */ - cc_agent_update("ready_time", ready_epoch , h->agent_name); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s Sleeping for %d secondes\n", h->agent_name, delay_next_agent_call); - } break; + /* Busy: Do Not Disturb, Circuit congestion */ + case SWITCH_CAUSE_NORMAL_CIRCUIT_CONGESTION: + case SWITCH_CAUSE_USER_BUSY: + delay_next_agent_call = (h->busy_delay_time > delay_next_agent_call? h->busy_delay_time : delay_next_agent_call); + break; + /* Reject: User rejected the call */ + case SWITCH_CAUSE_CALL_REJECTED: + delay_next_agent_call = (h->reject_delay_time > delay_next_agent_call? h->reject_delay_time : delay_next_agent_call); + break; + /* No answer: Destination does not answer for some other reason */ default: + delay_next_agent_call = (h->no_answer_delay_time > delay_next_agent_call? h->no_answer_delay_time : delay_next_agent_call); + tiers_state = CC_TIER_STATE_NO_ANSWER; /* Update Agent NO Answer count */ @@ -1615,6 +1620,15 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa h->agent_name, h->max_no_answer); cc_agent_update("status", cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), h->agent_name); } + break; + } + + /* Put agent to sleep for some time if necessary */ + if (delay_next_agent_call > 0) { + char ready_epoch[64]; + switch_snprintf(ready_epoch, sizeof(ready_epoch), "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL) + delay_next_agent_call); + cc_agent_update("ready_time", ready_epoch , h->agent_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s sleeping for %d seconds\n", h->agent_name, delay_next_agent_call); } /* Fire up event when contact agent fails */ @@ -1691,14 +1705,14 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames char *sql = NULL; char res[256]; char *agent_status = argv[2]; - char *agent_tier_state = argv[8]; - char *agent_last_bridge_end = argv[9]; - char *agent_wrap_up_time = argv[10]; - char *agent_state = argv[11]; - char *agent_ready_time = argv[12]; - char *agent_tier_level = argv[13]; - char *agent_type = argv[14]; - char *agent_uuid = argv[15]; + char *agent_tier_state = argv[9]; + char *agent_last_bridge_end = argv[10]; + char *agent_wrap_up_time = argv[11]; + char *agent_state = argv[12]; + char *agent_ready_time = argv[13]; + char *agent_tier_level = argv[14]; + char *agent_type = argv[15]; + char *agent_uuid = argv[16]; switch_bool_t contact_agent = SWITCH_TRUE; @@ -1808,6 +1822,7 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames h->max_no_answer = atoi(argv[5]); h->reject_delay_time = atoi(argv[6]); h->busy_delay_time = atoi(argv[7]); + h->no_answer_delay_time = atoi(argv[8]); cc_agent_update("state", cc_agent_state2str(CC_AGENT_STATE_RECEIVING), h->agent_name); @@ -1922,7 +1937,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName sql_order_by = switch_mprintf("level, position"); } - sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time,tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" " ORDER BY %q", @@ -2066,7 +2081,7 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj switch_channel_set_flag_value(member_channel, CF_BREAK, 2); } - /* Will drop the caller if no agent was found for more than X secondes */ + /* Will drop the caller if no agent was found for more than X seconds */ if (queue->max_wait_time_with_no_agent > 0 && m->t_member_called < queue->last_agent_exist_check - queue->max_wait_time_with_no_agent_time_reached && queue->last_agent_exist_check - queue->last_agent_exist >= queue->max_wait_time_with_no_agent) { m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT; @@ -2416,6 +2431,7 @@ static int list_result_callback(void *pArg, int argc, char **argv, char **column "callcenter_config agent set ready_time [agent_name] [wait till epoch] | "\ "callcenter_config agent set reject_delay_time [agent_name] [wait second] | "\ "callcenter_config agent set busy_delay_time [agent_name] [wait second] | "\ +"callcenter_config agent set no_answer_delay_time [agent_name] [wait second] | "\ "callcenter_config agent get status [agent_name] | " \ "callcenter_config agent list | " \ "callcenter_config tier add [queue_name] [agent_name] [level] [position] | " \ @@ -2865,6 +2881,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_console_set_complete("add callcenter_config agent set ready_time"); switch_console_set_complete("add callcenter_config agent set reject_delay_time"); switch_console_set_complete("add callcenter_config agent set busy_delay_time"); + switch_console_set_complete("add callcenter_config agent set no_answer_delay_time"); switch_console_set_complete("add callcenter_config agent get status"); switch_console_set_complete("add callcenter_config agent list"); From 233d3164be4412aaaf8f9f42d8042e48279a018a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 13 Mar 2011 18:43:23 -0500 Subject: [PATCH 044/558] wait --- src/switch_ivr_originate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index fe5edac504..c418d40e36 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -3613,6 +3613,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } if (*bleg) { + switch_channel_t *bchan = switch_core_session_get_channel(*bleg); + if (session && caller_channel) { switch_caller_profile_t *cloned_profile, *peer_profile = switch_channel_get_caller_profile(switch_core_session_get_channel(*bleg)); @@ -3622,7 +3624,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } } - + + while(switch_channel_get_state(bchan) != switch_channel_get_running_state(bchan) && switch_channel_up(bchan)) switch_cond_next(); switch_ivr_sleep(*bleg, 0, SWITCH_TRUE, NULL); } From 34a3800954cb374c91590f6415df4935bb975137 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 13 Mar 2011 22:26:43 -0500 Subject: [PATCH 045/558] FS-2815 --- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 78d97ce259..30889cad4c 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -599,8 +599,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) } if (globals.retries && globals.delay <= 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retries set but delay 0 setting to 5000ms\n"); - globals.delay = 5000; + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retries set but delay 0 setting to 5 seconds\n"); + globals.delay = 5; } globals.retries++; From 25cee25547e26399a94eceb1fa271d6d3f1739ba Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 14 Mar 2011 12:31:56 -0400 Subject: [PATCH 046/558] =?UTF-8?q?mod=5Fcallcenter:=20Add=20better=20hand?= =?UTF-8?q?le=20of=20failed=20agent,=20member=20channel=20getting=20a=20br?= =?UTF-8?q?eak,=20and=20debuging=20info=20upon=20leaving.=20=20Thanks=20to?= =?UTF-8?q?=20Fran=C3=A7ois=20Delawarde=20(with=20some=20changes)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mod_callcenter/mod_callcenter.c | 62 ++++++++++++------- 1 file changed, 38 insertions(+), 24 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 6d09479714..84ff411b4d 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -160,13 +160,15 @@ struct cc_member_cancel_reason_table { typedef enum { CC_MEMBER_CANCEL_REASON_NONE, CC_MEMBER_CANCEL_REASON_TIMEOUT, - CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT + CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT, + CC_MEMBER_CANCEL_REASON_BREAK_OUT } cc_member_cancel_reason_t; static struct cc_member_cancel_reason_table MEMBER_CANCEL_REASON_CHART[] = { {"NONE", CC_MEMBER_CANCEL_REASON_NONE}, {"TIMEOUT", CC_MEMBER_CANCEL_REASON_TIMEOUT}, {"NO_AGENT_TIMEOUT", CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT}, + {"BREAK_OUT", CC_MEMBER_CANCEL_REASON_BREAK_OUT}, {NULL, 0} }; @@ -1524,7 +1526,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa while(switch_channel_up(member_channel) && switch_channel_up(agent_channel) && globals.running) { switch_yield(100000); } - tiers_state = CC_TIER_STATE_READY; + tiers_state = CC_TIER_STATE_READY; if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(agent_channel, event); @@ -1563,16 +1565,18 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", h->queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Hangup-Cause", switch_channel_cause2str(cause)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Terminated"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", - switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", - switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); switch_event_fire(&event); } @@ -2337,53 +2341,63 @@ SWITCH_STANDARD_APP(callcenter_function) h->running = 0; } - /* Hangup any agents been callback */ - if (!switch_channel_up(member_channel) || !switch_channel_get_variable(member_channel, "cc_agent_uuid")) { /* If channel is still up, it mean that the member didn't hangup, so we should leave the agent alone */ - switch_core_session_hupall_matching_var("cc_member_uuid", member_uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); + /* Check if we were removed be cause FS Core(BREAK) asked us too */ + if (h->member_cancel_reason == CC_MEMBER_CANCEL_REASON_NONE && !switch_channel_get_variable(member_channel, "cc_agent_uuid")) { + h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_BREAK_OUT; + } + + /* Canceled for some reason */ + if (!switch_channel_up(member_channel) || h->member_cancel_reason != CC_MEMBER_CANCEL_REASON_NONE) { + /* Update member state */ sql = switch_mprintf("UPDATE members SET state = '%q', uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); - /* Generate an Event and update some channel variable */ + /* Hangup any callback agents */ + switch_core_session_hupall_matching_var("cc_member_uuid", member_uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); + + /* Generate an event */ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member \"%s\" <%s> exit queue %s due to %s\n", - switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), - switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), - queue_name, cc_member_cancel_reason2str(h->member_cancel_reason)); - - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", cc_member_cancel_reason2str(h->member_cancel_reason)); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Cancel"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cancel-Reason", cc_member_cancel_reason2str(h->member_cancel_reason)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); } - /* for xml_cdr needs */ + /* Update some channel variables for xml_cdr needs */ switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%ld", (long) switch_epoch_time_now(NULL)); - switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", cc_member_cancel_reason2str(h->member_cancel_reason)); + switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "cancel"); + switch_channel_set_variable_printf(member_channel, "cc_cancel_reason", "%s", cc_member_cancel_reason2str(h->member_cancel_reason)); - - /* Send Event with queue count */ - cc_queue_count(queue_name); + /* Print some debug log information */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member \"%s\" <%s> exit queue %s due to %s\n", + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), + switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), + queue_name, cc_member_cancel_reason2str(h->member_cancel_reason)); } else { - switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "answered"); + /* Update member state */ sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ANSWERED), (long) switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); - /* Send Event with queue count */ - cc_queue_count(queue_name); + /* Update some channel variables for xml_cdr needs */ + switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "answered"); } + /* Send Event with queue count */ + cc_queue_count(queue_name); + end: return; From d4f845ed0832659791bc07abd63350e1c901ba98 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 14 Mar 2011 12:42:02 -0400 Subject: [PATCH 047/558] =?UTF-8?q?mod=5Fcallcenter:=20Should=20resolve=20?= =?UTF-8?q?lot=20of=20loopback=20issues=20mentioned.=20=20Thanks=20to=20Fr?= =?UTF-8?q?an=C3=A7ois=20Delawarde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mod_callcenter/mod_callcenter.c | 29 +++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 84ff411b4d..65ad78f5d8 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1399,8 +1399,6 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent", "%s", h->agent_name); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent_type", "%s", h->agent_type); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); - /* Force loopback to remain live, if not, the loop will detect the actual channel to gone */ - switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "loopback_bowout", "false"); t_agent_called = switch_epoch_time_now(NULL); dialstr = switch_mprintf("%s", h->originate_string); @@ -1445,9 +1443,36 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa const char *agent_uuid = switch_core_session_get_uuid(agent_session); switch_channel_t *member_channel = switch_core_session_get_channel(member_session); switch_channel_t *agent_channel = switch_core_session_get_channel(agent_session); + const char *other_loopback_leg_uuid = switch_channel_get_variable(agent_channel, "other_loopback_leg_uuid"); switch_channel_set_variable(agent_channel, "cc_member_pre_answer_uuid", NULL); + /* Loopback special case */ + if (other_loopback_leg_uuid) { + switch_core_session_t *other_loopback_session = switch_core_session_locate(other_loopback_leg_uuid); + if (other_loopback_session) { + switch_channel_t *other_loopback_channel = switch_core_session_get_channel(other_loopback_session); + const char *real_uuid = switch_channel_get_variable(other_loopback_channel, SWITCH_SIGNAL_BOND_VARIABLE); + + switch_channel_set_variable(other_loopback_channel, "cc_member_pre_answer_uuid", NULL); + + /* Switch the agent session */ + if (real_uuid) { + switch_core_session_rwunlock(agent_session); + agent_uuid = real_uuid; + agent_session = switch_core_session_locate(agent_uuid); + agent_channel = switch_core_session_get_channel(agent_session); + + switch_channel_set_variable(agent_channel, "cc_queue", h->queue_name); + switch_channel_set_variable(agent_channel, "cc_agent", h->agent_name); + switch_channel_set_variable(agent_channel, "cc_agent_type", h->agent_type); + switch_channel_set_variable(agent_channel, "cc_member_uuid", h->member_uuid); + } + switch_core_session_rwunlock(other_loopback_session); + } + } + + if (!strcasecmp(h->queue_strategy,"ring-all")) { char res[256]; /* Map the Agent to the member */ From 69a5b300610e5a87dd0eb58c5bbbfad671260c96 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 Mar 2011 11:43:42 -0500 Subject: [PATCH 048/558] FS-3150 --comment-only this looks like an unhandled parse error, try this patch, though the call will likely fail but we can see what it doesn't like about the sdp now --- src/mod/endpoints/mod_sofia/sofia.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d612e30f0b..d657fdd410 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4422,10 +4422,15 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase); - - if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38) { - if (sip->sip_payload && sip->sip_payload->pl_data) { - switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data); + + if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) { + switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data); + + if (!t38_options) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_WARNING, "%s Error parsing SDP:\n%s\n", + switch_channel_get_name(tech_pvt->channel), sip->sip_payload->pl_data); + goto end; + } else { char *remote_host = switch_rtp_get_remote_host(tech_pvt->rtp_session); switch_port_t remote_port = switch_rtp_get_remote_port(tech_pvt->rtp_session); char tmp[32] = ""; From 4c435ec53032efc543f32cf4220547af3fb20363 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 14 Mar 2011 11:54:08 -0500 Subject: [PATCH 049/558] change text of error message to be more descriptive --- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 6e3649a68f..766c6ceee1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1914,7 +1914,7 @@ void sofia_reg_handle_sip_r_challenge(int status, } else if (gateway) { switch_snprintf(authentication, sizeof(authentication), "%s:%s:%s:%s", scheme, realm, gateway->auth_username, gateway->register_password); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No Matching gateway found\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot locate any authentication credentials to complete an authentication request for realm '%s'\n", realm); goto cancel; } From c8e17e0864c9fa26e2eef31d04d4f62cf7995d1c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 14 Mar 2011 16:46:56 -0400 Subject: [PATCH 050/558] chlog:FreeTDM - Added PRI-BRI Debug document --- libs/freetdm/docs/PRI-BRI-Debug.pdf | Bin 0 -> 399483 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 libs/freetdm/docs/PRI-BRI-Debug.pdf diff --git a/libs/freetdm/docs/PRI-BRI-Debug.pdf b/libs/freetdm/docs/PRI-BRI-Debug.pdf new file mode 100755 index 0000000000000000000000000000000000000000..53386b1b52eb580ef551c5e26954d5d6b202b119 GIT binary patch literal 399483 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 z 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�&~09jn}FRe}M_3 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

sek&& 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

A2FNH`4p_vD^GO&KA%+ymsts1imY{pEW? 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�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 B{{rj9Ut>5gipmP+t-szd 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 Xrh%{C5`8>-+wU4rH;tp Date: Thu, 10 Mar 2011 15:35:09 -0500 Subject: [PATCH 051/558] chlog: freetdm: ss7 - more work on relay stability --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 12 +- .../ftmod_sangoma_ss7_cntrl.c | 32 ++++ .../ftmod_sangoma_ss7_handle.c | 13 +- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c | 98 ++++++++++-- .../ftmod_sangoma_ss7_main.c | 55 +++---- .../ftmod_sangoma_ss7_main.h | 44 +++++- .../ftmod_sangoma_ss7_relay.c | 62 ++++++-- .../ftmod_sangoma_ss7_support.c | 142 +++++++++++++++++- 8 files changed, 387 insertions(+), 71 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index f8b12ea588..2cd3a13e30 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -1011,6 +1011,15 @@ static ftdm_status_t handle_show_flags(ftdm_stream_handle_t *stream, int span, i } } + for (bit = 0; bit < 33; bit++) { + if (ss7_info->blk_flags & ( 0x1 << bit)) { + stream->write_function(stream, "|"); + flag = bit; + text = ftmod_ss7_blk_flag2str(flag); + stream->write_function(stream, "%s",text); + } + } + stream->write_function(stream, "\n"); } /* if ( span and chan) */ @@ -1172,7 +1181,8 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, ftdm_channel_state2str(ftdmchan->state)); if ((sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_MN_BLOCK_TX)) || - (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX))) { + (sngss7_test_ckt_blk_flag(ss7_info, FLAG_GRP_MN_BLOCK_TX)) || + (sngss7_test_ckt_blk_flag(ss7_info, FLAG_CKT_LC_BLOCK_RX))) { stream->write_function(stream, "l_mn=Y|"); }else { stream->write_function(stream, "l_mn=N|"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c index 83ef5e0a42..8a7b095675 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c @@ -76,6 +76,7 @@ int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId); int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId); int ftmod_ss7_block_isup_ckt(uint32_t cktId); +int ftmod_ss7_unblock_isup_ckt(uint32_t cktId); /******************************************************************************/ /* FUNCTIONS ******************************************************************/ @@ -875,6 +876,37 @@ int ftmod_ss7_block_isup_ckt(uint32_t cktId) return (sng_cntrl_isup(&pst, &cntrl)); } +/******************************************************************************/ +int ftmod_ss7_unblock_isup_ckt(uint32_t cktId) +{ + SiMngmt cntrl; + Pst pst; + + /* initalize the post structure */ + smPstInit(&pst); + + /* insert the destination Entity */ + pst.dstEnt = ENTSI; + + /* initalize the control structure */ + memset(&cntrl, 0x0, sizeof(SiMngmt)); + + /* initalize the control header */ + smHdrInit(&cntrl.hdr); + + cntrl.hdr.msgType = TCNTRL; /* this is a control request */ + cntrl.hdr.entId.ent = ENTSI; + cntrl.hdr.entId.inst = S_INST; + cntrl.hdr.elmId.elmnt = STICIR; + + cntrl.t.cntrl.s.siElmnt.elmntId.circuit = cktId; + cntrl.t.cntrl.s.siElmnt.elmntParam.cir.flag = LSI_CNTRL_CIR_FORCE; + + cntrl.t.cntrl.action = AENA; /* unblock via UBL */ + cntrl.t.cntrl.subAction = SAELMNT; /* specificed element */ + + return (sng_cntrl_isup(&pst, &cntrl)); +} /******************************************************************************/ /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index e0b6ae08c0..3981cd6597 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1183,7 +1183,7 @@ ftdm_status_t handle_pause(uint32_t suInstId, uint32_t spInstId, uint32_t circui sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); /* clear the resume flag on the channel */ - sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); + sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); } /* unlock the channel again before we exit */ @@ -1565,9 +1565,6 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* throw the unblock flag */ sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); - /* clear the block flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); - /* set the channel to suspended state */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); @@ -2017,12 +2014,12 @@ ftdm_status_t handle_local_ubl(uint32_t suInstId, uint32_t spInstId, uint32_t ci /* lock the channel */ ftdm_mutex_lock(ftdmchan->mutex); - /* check if the circuit is already blocked or not */ - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { - SS7_WARN("Received local UBL on circuit that is already unblocked!\n"); + /* check if the circuit is blocked or not */ + if (!sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX)) { + SS7_WARN("Received local UBL on circuit that is not blocked!\n"); } - /* throw the ckt block flag */ + /* throw the ckt unblock flag */ sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); /* set the channel to suspended state */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c index 76984b907b..f143c20eb9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_in.c @@ -66,6 +66,12 @@ void sngss7_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -104,6 +110,12 @@ void sngss7_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCo ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -142,6 +154,12 @@ void sngss7_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiCn ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -181,6 +199,12 @@ void sngss7_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -219,6 +243,12 @@ void sngss7_rel_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiRe ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -257,6 +287,12 @@ void sngss7_dat_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiIn ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -295,6 +331,12 @@ void sngss7_fac_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -334,6 +376,12 @@ void sngss7_fac_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -373,6 +421,12 @@ void sngss7_umsg_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit) ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -417,21 +471,10 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint /**************************************************************************/ case (SIT_STA_PAUSEIND): case (SIT_STA_RESUMEIND): - - /* the circuit for this type of event may not exist on the local system - * so first check if the circuit is local - */ - if ((circuit >= (g_ftdm_sngss7_data.cfg.procId * 1000)) && - (circuit < ((g_ftdm_sngss7_data.cfg.procId +1) * 1000))) { - - /* the circuit is on the local system, handle normally */ - goto sta_ind_local; - } - - /* the circuit is not local, so find a local circuit with the same intfId - * by finding the orginial circuit in our array first, finding the intfId - * from there, then go through the local circuits to see if we find a - * match and use that circuit instead + /* the circuit may or may not be on the local system so we have to find + * circuit with the same intfId. The circuit specified might also be + * a non-voice cic so we also need to find the first voice cic on this + * system with the same intfId. */ intfId = g_ftdm_sngss7_data.cfg.isupCkt[circuit].infId; @@ -444,6 +487,10 @@ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint /* compare the intfIds */ if (g_ftdm_sngss7_data.cfg.isupCkt[x].infId == intfId) { + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type == VOICE) { + + } + /* we have a match, setup the pointers to the correct values */ circuit = x; @@ -472,7 +519,14 @@ move_along: break; /**************************************************************************/ default: -sta_ind_local: + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx %s on circuit that is not a voice CIC (%d)\n", + DECODE_LCC_EVENT(evntType), + g_ftdm_sngss7_data.cfg.isupCkt[circuit].cic); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -520,6 +574,12 @@ void sngss7_susp_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiS ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); @@ -561,6 +621,12 @@ void sngss7_resm_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, SiR ftdm_channel_t *ftdmchan = NULL; sngss7_event_data_t *sngss7_event = NULL; + if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].type != VOICE) { + SS7_ERROR("Rx sig event on circuit that is not a voice CIC (%d)\n", circuit); + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return; + } + /* get the ftdmchan and ss7_chan_data from the circuit */ if (extract_chan_data(circuit, &sngss7_info, &ftdmchan)) { SS7_ERROR("Failed to extract channel data for circuit = %d!\n", circuit); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 7b885102b9..46bc53ec57 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -909,8 +909,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) case FTDM_CHANNEL_STATE_RESTART: /* CICs needs a Reset */ if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK)) { - if ((sngss7_test_ckt_blk_flag(sngss7_info, FLAG_RESET_RX)) || - (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_GRP_RESET_RX))) { + if ((sngss7_test_ckt_flag(sngss7_info, FLAG_RESET_RX)) || + (sngss7_test_ckt_flag(sngss7_info, FLAG_GRP_RESET_RX))) { SS7_DEBUG_CHAN(ftdmchan,"Incoming Reset request on CIC in UCIC block, removing UCIC block%s\n", ""); @@ -1020,10 +1020,13 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /**************************************************************************/ case FTDM_CHANNEL_STATE_SUSPENDED: /* circuit has been blocked */ - SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->ckt_flags); + SS7_DEBUG_CHAN(ftdmchan,"Current flags: ckt=0x%X, blk=0x%X\n", + sngss7_info->ckt_flags, + sngss7_info->blk_flags); /**********************************************************************/ if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_RESUME)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing RESUME%s\n", ""); /* clear the RESUME flag */ @@ -1038,27 +1041,23 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_TX)) || (sngss7_test_ckt_flag (sngss7_info, FLAG_GRP_RESET_RX))) { - /* go back to the reset state */ + /* don't bring up the sig status but also move to reset */ goto suspend_goto_restart; } else { - /* bring the sig status back up */ sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); } - - /* go back to the last state */ - goto suspend_goto_last; } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */ - if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { + if ((sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) && + (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { + SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE%s\n", ""); /* bring the sig status down */ sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); - - /* go back to the last state */ - goto suspend_goto_last; } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */ + /**********************************************************************/ if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX) && !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN)) { @@ -1081,6 +1080,10 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX_DN)){ SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_RX flag %s\n", ""); + /* clear the block flags */ + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN); + /* clear the unblock flag */ sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX); @@ -1090,9 +1093,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* send a uba */ ft_to_sngss7_uba (ftdmchan); - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX_DN); - /* check the last state and return to it to allow the call to finish */ goto suspend_goto_last; } @@ -1119,8 +1119,12 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX_DN)){ SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", ""); + /* clear the block flags */ + sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX); + sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN); + /* clear the unblock flag */ - sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX); /* bring the sig status up */ sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_UP); @@ -1128,9 +1132,6 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* send a ubl */ ft_to_sngss7_ubl (ftdmchan); - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_TX_DN); - /* check the last state and return to it to allow the call to finish */ goto suspend_goto_last; } @@ -1153,15 +1154,17 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX) && !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX_DN)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_UNBLK_RX flag %s\n", ""); + + /* clear the block flags */ + sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX); + sngss7_clear_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN); /* clear the unblock flag */ - sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX); /* send a uba */ /*ft_to_sngss7_uba(ftdmchan);*/ - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX_DN); /* check the last state and return to it to allow the call to finish */ goto suspend_goto_last; @@ -1191,10 +1194,11 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK) && !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK_DN)) { - SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", "");; + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", ""); /* remove the UCIC block flag */ sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK); + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_BLOCK_DN); /* remove the UCIC unblock flag */ sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK); @@ -1202,13 +1206,12 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* throw the channel into reset to sync states */ sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); - /* throw the done flag */ - sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_UCIC_UNBLK_DN); - /* bring the channel into restart again */ goto suspend_goto_restart; } + SS7_ERROR_CHAN(ftdmchan,"No block flag processed!%s\n", ""); + suspend_goto_last: state_flag = 0; ftdm_set_state(ftdmchan, ftdmchan->last_state); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 02c450b94a..df8b086c49 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -560,6 +560,41 @@ typedef enum { FLAG_GRP_MN_UNBLK_TX_DN = (1 << 27) } sng_ckt_block_flag_t; +#define BLK_FLAGS_STRING \ + "UCIC BLK", \ + "UCIC BLK DN", \ + "UCIC UNBLK", \ + "UCIC UNBLK DN", \ + "RX LC BLK", \ + "RX LC BLK DN", \ + "RX LC UNBLK", \ + "RX LC UNBLK DN", \ + "RX CKT BLK", \ + "RX CKT BLK DN", \ + "RX CKT UNBLK", \ + "RX CKT UNBLK DN", \ + "TX CKT BLK", \ + "TX CKT BLK DN", \ + "TX CKT UNBLK", \ + "TX CKT UNBLK DN", \ + "RX GRP MN BLK", \ + "RX GRP MN BLK DN", \ + "RX GRP MN UNBLK", \ + "RX GRP MN UNBLK DN", \ + "TX GRP MN BLK", \ + "TX GRP MN BLK DN", \ + "TX GRP MN UNBLK", \ + "TX GRP MN UNBLK DN", \ + "RX GRP HW BLK", \ + "RX GRP HW BLK DN", \ + "RX GRP HW UNBLK", \ + "RX GRP HW UNBLK DN", \ + "TX GRP HW BLK", \ + "TX GRP HW BLK DN", \ + "TX GRP HW UNBLK", \ + "TX GRP HW UNBLK DN" +FTDM_STR2ENUM_P(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t) + /* valid for every cfg array except circuits */ typedef enum { SNGSS7_CONFIGURED = (1 << 0), @@ -656,7 +691,7 @@ int ftmod_ss7_enable_grp_mtp3Link(uint32_t procId); int ftmod_ss7_disable_grp_mtp2Link(uint32_t procId); int ftmod_ss7_block_isup_ckt(uint32_t cktId); - +int ftmod_ss7_unblock_isup_ckt(uint32_t cktId); /* in ftmod_sangoma_ss7_sta.c */ @@ -795,6 +830,13 @@ void handle_isup_t35(void *userdata); /******************************************************************************/ /* MACROS *********************************************************************/ +#define SS7_STATE_CHANGE(ftdmchan, new_state) \ +if (ftdmchan->state == new_state) { \ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_IDLE); \ +} else { \ + ftdm_set_state(ftdmchan, new_state); \ +} + #define SS7_DEBUG(a,...) ftdm_log(FTDM_LOG_DEBUG,a , ##__VA_ARGS__ ); #define SS7_INFO(a,...) ftdm_log(FTDM_LOG_INFO,a , ##__VA_ARGS__ ); #define SS7_WARN(a,...) ftdm_log(FTDM_LOG_WARNING,a , ##__VA_ARGS__ ); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c index d34d62c217..1af538d727 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_relay.c @@ -45,10 +45,11 @@ ftdm_status_t handle_relay_connect(RyMngmt *sta); ftdm_status_t handle_relay_disconnect(RyMngmt *sta); -static ftdm_status_t enable_all_ckts_for_relay(void); +/*static ftdm_status_t enable_all_ckts_for_relay(void);*/ static ftdm_status_t reconfig_all_ckts_for_relay(void); static ftdm_status_t disable_all_ckts_for_relay(void); static ftdm_status_t block_all_ckts_for_relay(uint32_t procId); +static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId); static ftdm_status_t disable_all_sigs_for_relay(uint32_t procId); static ftdm_status_t disble_all_mtp2_sigs_for_relay(void); /******************************************************************************/ @@ -72,26 +73,20 @@ ftdm_status_t handle_relay_connect(RyMngmt *sta) switch (sng_relay->type) { /******************************************************************/ case (LRY_CT_TCP_CLIENT): - /* check the status of all isup intfs in case we weren't connected when - * the interface became active - */ - check_status_of_all_isup_intf(); - /* reconfigure all ISUP ckts, since the main system would have lost all configs */ if (reconfig_all_ckts_for_relay()) { SS7_ERROR("Failed to reconfigure ISUP Ckts!\n"); /* we're done....this is very bad! */ - } else { - /* if the circuits reconfiged then bring then back up */ - enable_all_ckts_for_relay(); } - break; /******************************************************************/ case (LRY_CT_TCP_SERVER): - /*unblock_all_ckts_for_relay(sta->t.usta.s.ryErrUsta.errPid);*/ + /* bring the sig links on the client system back up */ ftmod_ss7_enable_grp_mtp3Link(sta->t.usta.s.ryUpUsta.id); - + + /* unbloock the ckts on the client system */ + unblock_all_ckts_for_relay(sta->t.usta.s.ryUpUsta.id); + break; /******************************************************************/ default: @@ -179,7 +174,7 @@ ftdm_status_t disable_all_ckts_for_relay(void) return FTDM_SUCCESS; } - +#if 0 /******************************************************************************/ ftdm_status_t enable_all_ckts_for_relay(void) { @@ -227,7 +222,7 @@ ftdm_status_t enable_all_ckts_for_relay(void) return FTDM_SUCCESS; } - +#endif /******************************************************************************/ ftdm_status_t reconfig_all_ckts_for_relay(void) { @@ -244,6 +239,9 @@ ftdm_status_t reconfig_all_ckts_for_relay(void) /* mark the circuit for re-configuration */ sngss7_set_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG); + + /* clear the relay flag */ + sngss7_clear_ckt_flag(sngss7_info, FLAG_RELAY_DOWN); } /* move to the next circuit */ @@ -312,6 +310,42 @@ ftdm_status_t disble_all_mtp2_sigs_for_relay(void) } +/******************************************************************************/ +static ftdm_status_t unblock_all_ckts_for_relay(uint32_t procId) +{ + int x; + int ret; + + /* we just got connection to this procId, send out a unblock for all these circuits + * since we blocked them when we lost the connection + */ + x = (procId * 1000) + 1; + while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + /**************************************************************************/ + if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) { + + /* send a block request via stack manager */ + ret = ftmod_ss7_unblock_isup_ckt(g_ftdm_sngss7_data.cfg.isupCkt[x].id); + if (ret) { + SS7_INFO("Successfully unblocked CIC:%d(ckt:%d) due to Relay connection\n", + g_ftdm_sngss7_data.cfg.isupCkt[x].cic, + g_ftdm_sngss7_data.cfg.isupCkt[x].id); + } else { + SS7_ERROR("Failed to unblock CIC:%d(ckt:%d) due to Relay connection\n", + g_ftdm_sngss7_data.cfg.isupCkt[x].cic, + g_ftdm_sngss7_data.cfg.isupCkt[x].id); + } + + } /* if (g_ftdm_sngss7_data.cfg.isupCkt[x].type == VOICE) */ + + /* move along */ + x++; + /**************************************************************************/ + } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ + + return FTDM_SUCCESS; +} + /******************************************************************************/ /* For Emacs: * Local Variables: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index ded695c205..2b915b1053 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -94,6 +94,9 @@ ftdm_status_t sngss7_add_raw_data(sngss7_chan_data_t *sngss7_info, uint8_t* data FTDM_ENUM_NAMES(CKT_FLAGS_NAMES, CKT_FLAGS_STRING) FTDM_STR2ENUM(ftmod_ss7_ckt_state2flag, ftmod_ss7_ckt_flag2str, sng_ckt_flag_t, CKT_FLAGS_NAMES, 31) +FTDM_ENUM_NAMES(BLK_FLAGS_NAMES, BLK_FLAGS_STRING) +FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t, BLK_FLAGS_NAMES, 31) + /* FUNCTIONS ******************************************************************/ uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) { @@ -1484,6 +1487,11 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) { ftdm_channel_t *ftdmchan = NULL; sngss7_chan_data_t *sngss7_info = NULL; + sng_isup_inf_t *sngss7_intf = NULL; + uint8_t state; + uint8_t bits_ab = 0; + uint8_t bits_cd = 0; + uint8_t bits_ef = 0; int x; int ret; @@ -1494,7 +1502,7 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) /* if the call data is NULL move on */ if (ftdmchan->call_data == NULL) { - SS7_WARN_CHAN(ftdmchan, "Reconfiguring channel that has not call_data!%s\n", " "); + SS7_WARN_CHAN(ftdmchan, "Found ftdmchan with no sig module data!%s\n", " "); continue; } @@ -1503,12 +1511,136 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) /* check the reconfig flag */ if (sngss7_test_ckt_flag(sngss7_info, FLAG_CKT_RECONFIG)) { - ret = ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id); + /* confirm the state of all isup interfaces*/ + check_status_of_all_isup_intf(); - if (ret) { - SS7_CRITICAL("ISUP CKT %d re-configuration FAILED!\n", x); + sngss7_intf = &g_ftdm_sngss7_data.cfg.isupIntf[sngss7_info->circuit->infId]; + + /* check if the interface is paused or resumed */ + if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { + SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is PAUSED\n", sngss7_intf->id); + /* throw the pause flag */ + sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); + sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); } else { - SS7_INFO("ISUP CKT %d re-configuration DONE!\n", x); + SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is RESUMED\n", sngss7_intf->id); + /* throw the resume flag */ + sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); + sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); + } + + /* query for the status of the ckt */ + if (ftmod_ss7_isup_ckt_sta(sngss7_info->circuit->id, &state)) { + SS7_ERROR("Failed to read isup ckt = %d status\n", sngss7_info->circuit->id); + continue; + } + + /* extract the bit sections */ + bits_ab = (state & (SNG_BIT_A + SNG_BIT_B)) >> 0; + bits_cd = (state & (SNG_BIT_C + SNG_BIT_D)) >> 2; + bits_ef = (state & (SNG_BIT_E + SNG_BIT_F)) >> 4; + + if (bits_cd == 0x0) { + /* check if circuit is UCIC or transient */ + if (bits_ab == 0x3) { + /* bit a and bit b are set, unequipped */ + ret = ftmod_ss7_isup_ckt_config(sngss7_info->circuit->id); + if (ret) { + SS7_CRITICAL("ISUP CKT %d re-configuration FAILED!\n",x); + } else { + SS7_INFO("ISUP CKT %d re-configuration DONE!\n", x); + } + + /* reset the circuit to sync states */ + ftdm_mutex_lock(ftdmchan->mutex); + + /* flag the circuit as active */ + sngss7_set_flag(sngss7_info->circuit, SNGSS7_ACTIVE); + + /* throw the channel into reset */ + sngss7_set_ckt_flag(sngss7_info, FLAG_RESET_TX); + + /* throw the channel to suspend */ + ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + + /* unlock the channel */ + ftdm_mutex_unlock(ftdmchan->mutex); + + } /* if (bits_ab == 0x3) */ + } else { + /* check the maintenance block status in bits A and B */ + switch (bits_ab) { + /**************************************************************************/ + case (0): + /* no maintenace block...do nothing */ + break; + /**************************************************************************/ + case (1): + /* locally blocked */ + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); + + /* set the channel to suspended state */ + SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + break; + /**************************************************************************/ + case (2): + /* remotely blocked */ + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + + /* set the channel to suspended state */ + SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + break; + /**************************************************************************/ + case (3): + /* both locally and remotely blocked */ + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX); + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + + /* set the channel to suspended state */ + SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + break; + /**************************************************************************/ + default: + break; + /**************************************************************************/ + } /* switch (bits_ab) */ + + /* check the hardware block status in bits e and f */ + switch (bits_ef) { + /**************************************************************************/ + case (0): + /* no maintenace block...do nothing */ + break; + /**************************************************************************/ + case (1): + /* locally blocked */ + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX); + + /* set the channel to suspended state */ + SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + break; + /**************************************************************************/ + case (2): + /* remotely blocked */ + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); + + /* set the channel to suspended state */ + SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + break; + /**************************************************************************/ + case (3): + /* both locally and remotely blocked */ + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_TX); + sngss7_set_ckt_blk_flag(sngss7_info, FLAG_GRP_HW_BLOCK_RX); + + /* set the channel to suspended state */ + SS7_STATE_CHANGE(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); + break; + /**************************************************************************/ + default: + break; + /**************************************************************************/ + } /* switch (bits_ef) */ } /* clear the re-config flag ... no matter what */ From 2c009dd954f2480ab9dcace77b596ecdd9229363 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 15 Mar 2011 14:29:04 -0500 Subject: [PATCH 052/558] doh --- src/mod/applications/mod_conference/mod_conference.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 762bc1aa40..9c85d40c8b 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -564,7 +564,10 @@ static conference_member_t *conference_member_get(conference_obj_t *conference, member = NULL; } - switch_thread_rwlock_rdlock(member->rwlock); + if (member) { + switch_thread_rwlock_rdlock(member->rwlock); + } + switch_mutex_unlock(conference->member_mutex); return member; From c6f67322312bf02be37346be22d7e086fff3aed2 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 16 Mar 2011 23:31:43 +0800 Subject: [PATCH 053/558] Fixed a vulnerability in T.4 and T.6 processing which is similar to http://bugzilla.maptools.org/show_bug.cgi?id=2297 in libtiff. A really screwed up 2D T.4 image, or a maliciously constructed T.4 2D or T.6 image should potential run off the end of an image decoder buffer. --- libs/spandsp/src/t4_rx.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/libs/spandsp/src/t4_rx.c b/libs/spandsp/src/t4_rx.c index dfdf914804..131bfc0179 100644 --- a/libs/spandsp/src/t4_rx.c +++ b/libs/spandsp/src/t4_rx.c @@ -652,6 +652,7 @@ static __inline__ void force_drop_rx_bits(t4_state_t *s, int bits) static int rx_put_bits(t4_state_t *s, uint32_t bit_string, int quantity) { int bits; + int old_a0; /* We decompress bit by bit, as the data stream is received. We need to scan continuously for EOLs, so we might as well work this way. */ @@ -809,8 +810,23 @@ static int rx_put_bits(t4_state_t *s, uint32_t bit_string, int quantity) s->t4_t6_rx.a0, s->t4_t6_rx.b1, s->t4_t6_rx.run_length); - s->t4_t6_rx.run_length += (s->t4_t6_rx.b1 - s->t4_t6_rx.a0 + t4_2d_table[bits].param); + old_a0 = s->t4_t6_rx.a0; s->t4_t6_rx.a0 = s->t4_t6_rx.b1 + t4_2d_table[bits].param; + /* We need to check if a bad or malicious image is failing to move forward along the row. + Going back is obviously bad. We also need to avoid a stall on the spot, except for the + special case of the start of the row. Zero movement as the very first element in the + row is perfectly normal. */ + if (s->t4_t6_rx.a0 <= old_a0) + { + if (s->t4_t6_rx.a0 < old_a0 || s->t4_t6_rx.b_cursor > 1) + { + /* Undo the update we just started, and carry on as if this code does not exist */ + /* TODO: we really should record that something wasn't right at this point. */ + s->t4_t6_rx.a0 = old_a0; + break; + } + } + s->t4_t6_rx.run_length += (s->t4_t6_rx.a0 - old_a0); add_run_to_row(s); /* We need to move one step in one direction or the other, to change to the opposite colour */ @@ -832,8 +848,9 @@ static int rx_put_bits(t4_state_t *s, uint32_t bit_string, int quantity) s->ref_runs[s->t4_t6_rx.b_cursor], s->ref_runs[s->t4_t6_rx.b_cursor + 1]); s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++]; - s->t4_t6_rx.run_length += (s->t4_t6_rx.b1 - s->t4_t6_rx.a0); + old_a0 = s->t4_t6_rx.a0; s->t4_t6_rx.a0 = s->t4_t6_rx.b1; + s->t4_t6_rx.run_length += (s->t4_t6_rx.a0 - old_a0); s->t4_t6_rx.b1 += s->ref_runs[s->t4_t6_rx.b_cursor++]; break; case S_Ext: From 2d3d8f8d34dd365b32f63a0b9906112d508d221c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 16 Mar 2011 16:19:39 -0500 Subject: [PATCH 054/558] Add mod_ladspa (Audio plugin framework for linux) http://http://www.ladspa.org/ try it with autotalent http://web.mit.edu/tbaran/www/autotalent.html --- conf/dialplan/default/ladspa.xml | 73 +++ src/mod/applications/mod_ladspa/Makefile | 5 + src/mod/applications/mod_ladspa/load.c | 173 ++++++ src/mod/applications/mod_ladspa/mod_ladspa.c | 579 +++++++++++++++++++ src/mod/applications/mod_ladspa/utils.h | 72 +++ 5 files changed, 902 insertions(+) create mode 100644 conf/dialplan/default/ladspa.xml create mode 100644 src/mod/applications/mod_ladspa/Makefile create mode 100644 src/mod/applications/mod_ladspa/load.c create mode 100644 src/mod/applications/mod_ladspa/mod_ladspa.c create mode 100644 src/mod/applications/mod_ladspa/utils.h diff --git a/conf/dialplan/default/ladspa.xml b/conf/dialplan/default/ladspa.xml new file mode 100644 index 0000000000..926c31a87a --- /dev/null +++ b/conf/dialplan/default/ladspa.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/applications/mod_ladspa/Makefile b/src/mod/applications/mod_ladspa/Makefile new file mode 100644 index 0000000000..1a77c52a0d --- /dev/null +++ b/src/mod/applications/mod_ladspa/Makefile @@ -0,0 +1,5 @@ +BASE=../../../.. + +LOCAL_OBJS += load.o +include $(BASE)/build/modmake.rules + diff --git a/src/mod/applications/mod_ladspa/load.c b/src/mod/applications/mod_ladspa/load.c new file mode 100644 index 0000000000..652ecfa0f2 --- /dev/null +++ b/src/mod/applications/mod_ladspa/load.c @@ -0,0 +1,173 @@ +/* load.c + + Free software by Richard W.E. Furse. Do with as you will. No + warranty. */ + +/*****************************************************************************/ + +#include +#include +#include +#include + +/*****************************************************************************/ + +#include "ladspa.h" +#include "utils.h" +#include "inttypes.h" +#include "switch.h" +/*****************************************************************************/ + +/* This function provides a wrapping of dlopen(). When the filename is + not an absolute path (i.e. does not begin with / character), this + routine will search the LADSPA_PATH for the file. */ +static void *dlopenLADSPA(const char *pcFilename, int iFlag) +{ + + char *pcBuffer; + const char *pcEnd; + const char *pcLADSPAPath; + const char *pcStart; + int iEndsInSO; + int iNeedSlash; + size_t iFilenameLength; + void *pvResult; + + iFilenameLength = strlen(pcFilename); + pvResult = NULL; + + if (pcFilename[0] == '/') { + + /* The filename is absolute. Assume the user knows what he/she is + doing and simply dlopen() it. */ + + pvResult = dlopen(pcFilename, iFlag); + if (pvResult != NULL) + return pvResult; + + } else { + + /* If the filename is not absolute then we wish to check along the + LADSPA_PATH path to see if we can find the file there. We do + NOT call dlopen() directly as this would find plugins on the + LD_LIBRARY_PATH, whereas the LADSPA_PATH is the correct place + to search. */ + + pcLADSPAPath = getenv("LADSPA_PATH"); + + if (pcLADSPAPath) { + + pcStart = pcLADSPAPath; + while (*pcStart != '\0') { + pcEnd = pcStart; + while (*pcEnd != ':' && *pcEnd != '\0') + pcEnd++; + + pcBuffer = malloc(iFilenameLength + 2 + (pcEnd - pcStart)); + if (pcEnd > pcStart) + strncpy(pcBuffer, pcStart, pcEnd - pcStart); + iNeedSlash = 0; + if (pcEnd > pcStart) + if (*(pcEnd - 1) != '/') { + iNeedSlash = 1; + pcBuffer[pcEnd - pcStart] = '/'; + } + strcpy(pcBuffer + iNeedSlash + (pcEnd - pcStart), pcFilename); + + pvResult = dlopen(pcBuffer, iFlag); + + free(pcBuffer); + if (pvResult != NULL) + return pvResult; + + pcStart = pcEnd; + if (*pcStart == ':') + pcStart++; + } + } + } + + /* As a last ditch effort, check if filename does not end with + ".so". In this case, add this suffix and recurse. */ + iEndsInSO = 0; + if (iFilenameLength > 3) + iEndsInSO = (strcmp(pcFilename + iFilenameLength - 3, ".so") == 0); + if (!iEndsInSO) { + pcBuffer = malloc(iFilenameLength + 4); + strcpy(pcBuffer, pcFilename); + strcat(pcBuffer, ".so"); + pvResult = dlopenLADSPA(pcBuffer, iFlag); + free(pcBuffer); + } + + if (pvResult != NULL) + return pvResult; + + /* If nothing has worked, then at least we can make sure we set the + correct error message - and this should correspond to a call to + dlopen() with the actual filename requested. The dlopen() manual + page does not specify whether the first or last error message + will be kept when multiple calls are made to dlopen(). We've + covered the former case - now we can handle the latter by calling + dlopen() again here. */ + return dlopen(pcFilename, iFlag); +} + +/*****************************************************************************/ + +void *loadLADSPAPluginLibrary(const char *pcPluginFilename) +{ + + void *pvPluginHandle; + + pvPluginHandle = dlopenLADSPA(pcPluginFilename, RTLD_NOW); + if (!pvPluginHandle) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to load plugin \"%s\": %s\n", pcPluginFilename, dlerror()); + } + + return pvPluginHandle; +} + +/*****************************************************************************/ + +void unloadLADSPAPluginLibrary(void *pvLADSPAPluginLibrary) +{ + dlclose(pvLADSPAPluginLibrary); +} + +/*****************************************************************************/ + +const LADSPA_Descriptor *findLADSPAPluginDescriptor(void *pvLADSPAPluginLibrary, const char *pcPluginLibraryFilename, const char *pcPluginLabel) +{ + + const LADSPA_Descriptor *psDescriptor; + LADSPA_Descriptor_Function pfDescriptorFunction; + unsigned long lPluginIndex; + + dlerror(); + pfDescriptorFunction = (LADSPA_Descriptor_Function) (intptr_t)dlsym(pvLADSPAPluginLibrary, "ladspa_descriptor"); + if (!pfDescriptorFunction) { + const char *pcError = dlerror(); + if (pcError) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Unable to find ladspa_descriptor() function in plugin " + "library file \"%s\": %s.\n" "Are you sure this is a LADSPA plugin file?\n", pcPluginLibraryFilename, pcError); + return NULL; + } + } + + for (lPluginIndex = 0;; lPluginIndex++) { + psDescriptor = pfDescriptorFunction(lPluginIndex); + if (psDescriptor == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, + "Unable to find label \"%s\" in plugin library file \"%s\".\n", pcPluginLabel, pcPluginLibraryFilename); + return NULL; + } + if (strcmp(psDescriptor->Label, pcPluginLabel) == 0) + return psDescriptor; + } +} + +/*****************************************************************************/ + +/* EOF */ diff --git a/src/mod/applications/mod_ladspa/mod_ladspa.c b/src/mod/applications/mod_ladspa/mod_ladspa.c new file mode 100644 index 0000000000..871d203646 --- /dev/null +++ b/src/mod/applications/mod_ladspa/mod_ladspa.c @@ -0,0 +1,579 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Anthony Minessale II + * + * mod_ladspa.c -- LADSPA + * + */ +#include +#include "ladspa.h" +#include "utils.h" + +/* Prototypes */ +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_ladspa_shutdown); +SWITCH_MODULE_RUNTIME_FUNCTION(mod_ladspa_runtime); +SWITCH_MODULE_LOAD_FUNCTION(mod_ladspa_load); + +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) + * Defines a switch_loadable_module_function_table_t and a static const char[] modname + */ +SWITCH_MODULE_DEFINITION(mod_ladspa, mod_ladspa_load, mod_ladspa_shutdown, NULL); + +#define MAX_INDEX 256 + +typedef struct { + switch_core_session_t *session; + char *plugin_name; + char *label_name; + void *library_handle; + const LADSPA_Descriptor *ldesc; + LADSPA_Handle handle; + LADSPA_Data config[MAX_INDEX]; + uint8_t has_config[MAX_INDEX]; + int skip; + LADSPA_Data in_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]; + LADSPA_Data out_buf[SWITCH_RECOMMENDED_BUFFER_SIZE]; + LADSPA_Data out_ports[MAX_INDEX]; +} switch_ladspa_t; + + + +int check_range(const LADSPA_Descriptor *ldesc, int i, LADSPA_Data val) +{ + if (ldesc->PortRangeHints[i].LowerBound && ldesc->PortRangeHints[i].UpperBound && + (val < ldesc->PortRangeHints[i].LowerBound || val > ldesc->PortRangeHints[i].UpperBound)) { + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "Param %f out of bounds %f-%f\n", + val, ldesc->PortRangeHints[i].LowerBound, ldesc->PortRangeHints[i].UpperBound); + return 0; + } + + return 1; +} + +int find_default(const LADSPA_Descriptor *ldesc, int i, LADSPA_Data *ptr) + +{ + LADSPA_Data dftval = 0; + int fail = 0; + + LADSPA_PortRangeHintDescriptor port_hint = ldesc->PortRangeHints[i].HintDescriptor; + + switch (port_hint & LADSPA_HINT_DEFAULT_MASK) { + case LADSPA_HINT_DEFAULT_NONE: + break; + case LADSPA_HINT_DEFAULT_MINIMUM: + dftval = ldesc->PortRangeHints[i].LowerBound; + break; + case LADSPA_HINT_DEFAULT_LOW: + if (LADSPA_IS_HINT_LOGARITHMIC(port_hint)) { + dftval = exp(log(ldesc->PortRangeHints[i].LowerBound) + * 0.75 + log(ldesc->PortRangeHints[i].UpperBound) + * 0.25); + } else { + dftval = (ldesc->PortRangeHints[i].LowerBound * 0.75 + ldesc->PortRangeHints[i].UpperBound * 0.25); + } + break; + case LADSPA_HINT_DEFAULT_MIDDLE: + if (LADSPA_IS_HINT_LOGARITHMIC(port_hint)) { + dftval = sqrt(ldesc->PortRangeHints[i].LowerBound * ldesc->PortRangeHints[i].UpperBound); + } else { + dftval = 0.5 * (ldesc->PortRangeHints[i].LowerBound + ldesc->PortRangeHints[i].UpperBound); + } + break; + case LADSPA_HINT_DEFAULT_HIGH: + if (LADSPA_IS_HINT_LOGARITHMIC(port_hint)) { + dftval = exp(log(ldesc->PortRangeHints[i].LowerBound) + * 0.25 + log(ldesc->PortRangeHints[i].UpperBound) + * 0.75); + } else { + dftval = (ldesc->PortRangeHints[i].LowerBound * 0.25 + ldesc->PortRangeHints[i].UpperBound * 0.75); + } + break; + case LADSPA_HINT_DEFAULT_MAXIMUM: + dftval = ldesc->PortRangeHints[i].UpperBound; + break; + case LADSPA_HINT_DEFAULT_0: + dftval = 0; + break; + case LADSPA_HINT_DEFAULT_1: + dftval = 1; + break; + case LADSPA_HINT_DEFAULT_100: + dftval = 100; + break; + case LADSPA_HINT_DEFAULT_440: + dftval = 440; + break; + default: + fail = 1; + break; + } + + if (!fail) { + *ptr = dftval; + } + + return !fail; +} + +static void dump_info(const LADSPA_Descriptor *ldesc) +{ + int i = 0; + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Plugin Name: \"%s\"\n", ldesc->Name); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Plugin Label: \"%s\"\n", ldesc->Label); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Plugin Unique ID: %lu\n", ldesc->UniqueID); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Maker: \"%s\"\n", ldesc->Maker); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Copyright: \"%s\"\n", ldesc->Copyright); + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Must Run Real-Time: "); + if (LADSPA_IS_REALTIME(ldesc->Properties)) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Yes\n"); + else + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "No\n"); + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Has activate() Function: "); + if (ldesc->activate != NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Yes\n"); + else + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "No\n"); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Has deactivate() Function: "); + if (ldesc->deactivate != NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Yes\n"); + else + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "No\n"); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Has run_adding() Function: "); + if (ldesc->run_adding != NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Yes\n"); + else + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "No\n"); + + if (ldesc->instantiate == NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: PLUGIN HAS NO INSTANTIATE FUNCTION.\n"); + if (ldesc->connect_port == NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: PLUGIN HAS NO CONNECT_PORT FUNCTION.\n"); + if (ldesc->run == NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: PLUGIN HAS NO RUN FUNCTION.\n"); + if (ldesc->run_adding != NULL && ldesc->set_run_adding_gain == NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: PLUGIN HAS RUN_ADDING FUNCTION BUT " "NOT SET_RUN_ADDING_GAIN.\n"); + if (ldesc->run_adding == NULL && ldesc->set_run_adding_gain != NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: PLUGIN HAS SET_RUN_ADDING_GAIN FUNCTION BUT " "NOT RUN_ADDING.\n"); + if (ldesc->cleanup == NULL) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: PLUGIN HAS NO CLEANUP FUNCTION.\n"); + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Environment: "); + if (LADSPA_IS_HARD_RT_CAPABLE(ldesc->Properties)) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Normal or Hard Real-Time\n"); + else + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Normal\n"); + + if (LADSPA_IS_INPLACE_BROKEN(ldesc->Properties)) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "This plugin cannot use in-place processing. " "It will not work with all hosts.\n"); + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "Ports:"); + + if (ldesc->PortCount == 0) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\tERROR: PLUGIN HAS NO PORTS.\n"); + + for (i = 0; i < ldesc->PortCount; i++) { + LADSPA_Data dft = 0.0f; + int found = 0; + + if (LADSPA_IS_PORT_CONTROL(ldesc->PortDescriptors[i])) { + found = find_default(ldesc, i, &dft); + } + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n \"%s\" ", ldesc->PortNames[i]); + + if (LADSPA_IS_PORT_INPUT(ldesc->PortDescriptors[i]) + && LADSPA_IS_PORT_OUTPUT(ldesc->PortDescriptors[i])) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: INPUT AND OUTPUT"); + else if (LADSPA_IS_PORT_INPUT(ldesc->PortDescriptors[i])) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "input"); + else if (LADSPA_IS_PORT_OUTPUT(ldesc->PortDescriptors[i])) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "output"); + else + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "ERROR: NEITHER INPUT NOR OUTPUT"); + + if (LADSPA_IS_PORT_CONTROL(ldesc->PortDescriptors[i]) + && LADSPA_IS_PORT_AUDIO(ldesc->PortDescriptors[i])) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, ", ERROR: CONTROL AND AUDIO"); + else if (LADSPA_IS_PORT_CONTROL(ldesc->PortDescriptors[i])) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, ", control"); + else if (LADSPA_IS_PORT_AUDIO(ldesc->PortDescriptors[i])) + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, ", audio"); + else + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, ", ERROR: NEITHER CONTROL NOR AUDIO"); + + if (LADSPA_IS_PORT_CONTROL(ldesc->PortDescriptors[i])) { + if (found) { + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n RANGE: %f-%f DEFAULT: %f\n", + ldesc->PortRangeHints[i].LowerBound, ldesc->PortRangeHints[i].UpperBound, dft); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n RANGE: %f-%f DEFAULT: none.\n", + ldesc->PortRangeHints[i].LowerBound, ldesc->PortRangeHints[i].UpperBound); + } + } + + + + } + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, "\n\n"); +} + + + + + +static switch_bool_t ladspa_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) +{ + switch_ladspa_t *pvt = (switch_ladspa_t *) user_data; + //switch_frame_t *frame = NULL; + switch_channel_t *channel = switch_core_session_get_channel(pvt->session); + + switch (type) { + case SWITCH_ABC_TYPE_INIT: + { + switch_codec_implementation_t read_impl = { 0 }; + LADSPA_PortDescriptor port_desc; + int i = 0, j = 0, k = 0; + + switch_core_session_get_read_impl(pvt->session, &read_impl); + + if (!(pvt->library_handle = loadLADSPAPluginLibrary(pvt->plugin_name))) { + return SWITCH_FALSE; + } + + if (!(pvt->ldesc = findLADSPAPluginDescriptor(pvt->library_handle, pvt->plugin_name, pvt->label_name))) { + return SWITCH_FALSE; + } + + + pvt->handle = pvt->ldesc->instantiate(pvt->ldesc, read_impl.actual_samples_per_second); + + dump_info(pvt->ldesc); + + + for (i = 0; i < pvt->ldesc->PortCount; i++) { + port_desc = pvt->ldesc->PortDescriptors[i]; + + if (LADSPA_IS_PORT_CONTROL(port_desc) && LADSPA_IS_PORT_INPUT(port_desc)) { + LADSPA_Data dft = 0.0f; + int found = find_default(pvt->ldesc, i, &dft); + + if (found && !pvt->has_config[j]) { + pvt->config[j] = dft; + pvt->has_config[j] = 1; + } + + if (pvt->has_config[j]) { + if (!check_range(pvt->ldesc, i, pvt->config[j])) { + pvt->config[j] = dft; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_WARNING, "FALLING TO DEFAULT PARAM %d [%s] (%f)\n", + j+1, + pvt->ldesc->PortNames[i], + pvt->config[j]); + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(pvt->session), SWITCH_LOG_DEBUG, "ADDING PARAM %d [%s] (%f)\n", + j+1, + pvt->ldesc->PortNames[i], + pvt->config[j]); + pvt->ldesc->connect_port(pvt->handle, i, &pvt->config[j++]); + usleep(10000); + } + } + + if (LADSPA_IS_PORT_INPUT(port_desc) && LADSPA_IS_PORT_AUDIO(port_desc)) { + pvt->ldesc->connect_port(pvt->handle, i, pvt->in_buf); + } + + if (LADSPA_IS_PORT_OUTPUT(port_desc)) { + if (LADSPA_IS_PORT_AUDIO(port_desc)) { + pvt->ldesc->connect_port(pvt->handle, i, pvt->out_buf); + } else if (k < MAX_INDEX) { + pvt->ldesc->connect_port(pvt->handle, i, &pvt->out_ports[k++]); + } + } + } + } + + break; + + case SWITCH_ABC_TYPE_CLOSE: + { + + if (pvt->handle && pvt->ldesc) { + pvt->ldesc->cleanup(pvt->handle); + } + + if (pvt->library_handle) { + unloadLADSPAPluginLibrary(pvt->library_handle); + } + } + break; + + case SWITCH_ABC_TYPE_WRITE_REPLACE: + case SWITCH_ABC_TYPE_READ_REPLACE: + { + switch_frame_t *rframe; + int16_t *slin; + + if (type == SWITCH_ABC_TYPE_READ_REPLACE) { + rframe = switch_core_media_bug_get_read_replace_frame(bug); + } else { + rframe = switch_core_media_bug_get_write_replace_frame(bug); + } + + slin = rframe->data; + + if (switch_channel_media_ready(channel)) { + switch_short_to_float(slin, pvt->in_buf, rframe->samples); + pvt->ldesc->run(pvt->handle, rframe->samples); + switch_float_to_short(pvt->out_buf, slin, rframe->samples); + } + + if (type == SWITCH_ABC_TYPE_READ_REPLACE) { + switch_core_media_bug_set_read_replace_frame(bug, rframe); + } else { + switch_core_media_bug_set_write_replace_frame(bug, rframe); + } + + if (pvt->skip && !--pvt->skip) { + return SWITCH_FALSE; + } + + } + break; + case SWITCH_ABC_TYPE_WRITE: + default: + break; + } + + return SWITCH_TRUE; +} + +switch_status_t stop_ladspa_session(switch_core_session_t *session) +{ + switch_media_bug_t *bug; + switch_channel_t *channel = switch_core_session_get_channel(session); + + if ((bug = switch_channel_get_private(channel, "ladspa"))) { + switch_channel_set_private(channel, "ladspa", NULL); + switch_core_media_bug_remove(session, &bug); + return SWITCH_STATUS_SUCCESS; + } + + return SWITCH_STATUS_FALSE; +} + +switch_status_t ladspa_session(switch_core_session_t *session, const char *flags, const char *plugin_name, const char *label, const char *params) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_media_bug_t *bug; + switch_status_t status; + switch_ladspa_t *pvt = { 0 }; + switch_codec_implementation_t read_impl = { 0 }; + int i, bflags = SMBF_READ_REPLACE | SMBF_ANSWER_REQ; + char *pstr; + int argc; + char *argv[50]; + char *dparams = NULL; + + if (zstr(plugin_name)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s INVALID PLUGIN\n", switch_channel_get_name(channel)); + return SWITCH_STATUS_FALSE; + } + + if (zstr(flags)) { + flags = "r"; + } + + if (strchr(flags, 'w')) { + bflags = SMBF_WRITE_REPLACE; + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "FLAGS: %s PLUGIN: %s LABEL: %s PARAMS: %s\n", + flags, plugin_name, label, params); + + switch_core_session_get_read_impl(session, &read_impl); + + pvt = switch_core_session_alloc(session, sizeof(*pvt)); + + pvt->session = session; + if (!zstr(label)) { + pvt->label_name = switch_core_session_strdup(session, label); + } else { + char *p; + pvt->label_name = switch_core_session_strdup(session, plugin_name); + if ((p = strrchr(pvt->label_name, '.'))) { + *p = '\0'; + } + } + + if (strstr(plugin_name, ".so")) { + pvt->plugin_name = switch_core_session_strdup(session, plugin_name); + } else { + pvt->plugin_name = switch_core_session_sprintf(session, "%s.so", plugin_name); + } + + dparams = switch_core_session_strdup(session, params); + + argc = switch_split(dparams, ' ', argv); + + for (i = 0; i < argc; i++) { + pvt->config[i] = atof(argv[i]); + pvt->has_config[i] = 1; + } + + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + + pstr = switch_core_session_sprintf(session, "%s|%s|%s|%s", flags, plugin_name, label, params); + + if ((status = switch_core_media_bug_add(session, "ladspa", pstr, + ladspa_callback, pvt, 0, bflags | SMBF_NO_PAUSE, &bug)) != SWITCH_STATUS_SUCCESS) { + return status; + } + + switch_channel_set_private(channel, "ladspa", bug); + + return SWITCH_STATUS_SUCCESS; +} + + +static void ladspa_parse(switch_core_session_t *session, const char *data) +{ + char *argv[5] = { 0 }; + int argc; + char *lbuf; + + if (data) { + lbuf = strdup(data); + argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0]))); + ladspa_session(session, argv[0], argv[1], argv[2], argv[3]); + free(lbuf); + } +} + +#define APP_SYNTAX "||
which + allows for a header bits setting (and maybe more in the + future) + * DNSSEC is never automaticaly set, even when you query + for DNSKEY/RRSIG or DS. + * Implement a crude RTT check, it now distinguishes between + reachable and unreachable. + * A form of secure tracing was added + * Secure Chasing has been improved + * -x does a reverse lookup for the given IP address + + Examples: + * ldns-dpa was added to the examples - this is the Dns Packet + Analyzer tool. + * ldnsd - as very, very simple nameserver impl. + * ldns-zsplit - split zones for parrallel signing + * ldns-zcat - cat split zones back together + * ldns-keyfetcher - Fetches DNSKEY records with a few (non-strong, + non-DNSSEC) anti-spoofing techniques. + * ldns-walk - 'Walks' a DNSSEC signed zone + * Added an all-static target to the makefile so you can use examples + without installing the library + * When building in the source tree or in a direct subdirectory of + the build dir, configure does not need --with-ldns=../ anymore + + Code: + * All networking code was moved to net.c + * rdata.c: added asserts to the rdf set/get functions + * const keyword was added to pointer arguments that + aren't changed + + API: + Changed: + * renamed ldns/dns.h to ldns/ldns.h + * ldns_rr_new_frm_str() is extented with an extra variable which + in common use may be NULL. This trickles through to: + o ldns_rr_new_frm_fp + o ldns_rr_new_frm_fp_l + Which also get an extra variable + Also the function has been changed to return a status message. + The compiled RR is returned in the first argument. + * ldns_zone_new_frm_fp_l() and ldns_zone_new_frm_fp() are + changed to return a status msg. + * ldns_key_new_frm_fp is changed to return ldns_status and + the actual key list in the first argument + * ldns_rdata_new_frm_fp[_l]() are changed to return a status. + the rdf is return in the first argument + * ldns_resolver_new_frm_fp: same treatment: return status and + the new resolver in the first argument + * ldns_pkt_query_new_frm_str(): same: return status and the + packet in the first arg + * tsig.h: internal used functions are now static: + ldns_digest_name and ldns_tsig_mac_new + * ldns_key_rr2ds has an extra argument to specify the hash to + use. + * ldns_pkt_rcode() is renamed to ldns_pkt_get_rcode, ldns_pkt_rcode + is now the rcode type, like ldns_pkt_opcode + New: + * ldns_resolver_searchlist_count: return the searchlist counter + * ldns_zone_sort: Sort a zone + * ldns_bgsend(): background send, returns a socket. + * ldns_pkt_empty(): check is a packet is empty + * ldns_rr_list_pop_rr_list(): pop multiple rr's from another rr_list + * ldns_rr_list_push_rr_list(): push multiple rr's to an rr_list + * ldns_rr_list_compare(): compare 2 ldns_rr_lists + * ldns_pkt_push_rr_list: rr_list equiv for rr + * ldns_pkt_safe_push_rr_list: rr_list equiv for rr + Removed: + * ldns_resolver_bgsend(): was not used in 1.0.0 and is not used now + * ldns_udp_server_connect(): was faulty and isn't really part of + the core ldns idea any how. + * ldns_rr_list_insert_rr(): obsoleted, because not used. + * char *_when was removed from the ldns_pkt structure + +18 Oct 2005: 1.0.0: ldns-team + * Commited a patch from HÃ¥kan Olsson + * Added UPDATE support (Jakob Schlyter and HÃ¥kan Olsson) + * License change: ldns is now BSD licensed + * ldns now depends on SSL + * Networking code cleanup, added (some) server udp/tcp support + * A zone type is introduced. Currently this is a list + of RRs, so it will not scale well. + * [beta] Zonefile parsing was added + * [tools] Drill was added to ldns - see drill/ + * [tools] experimental signer was added + * [building] better check for ssl + * [building] major revision of build system + * [building] added rpm .spec in packaging/ (thanks to Paul Wouters) + * [building] A lot of cleanup in the build scripts (thanks to Jakob Schlyter + and Paul Wouters) + +28 Jul 2005: 0.70: ldns-team + * [func] ldns_pkt_get_section now returns copies from the rrlists + in the packet. This can be freed by the user program + * [code] added ldns_ prefixes to function from util.h + * [inst] removed documentation from default make install + * Usual fixes in documentation and code + +20 Jun 2005: 0.66: ldns-team + Rel. Focus: drill-pre2 uses some functions which are + not in 0.65 + * dnssec_cd bit function was added + * Zone infrastructure was added + * Usual fixes in documentation and code + +13 Jun 2005: 0.65: ldns-team + * Repository is online at: + http://www.nlnetlabs.nl/ldns/svn/ + * Apply reference copying throuhgout ldns, except in 2 + places in the ldns_resolver structure (._domain and + ._nameservers) + * Usual array of bugfixes + * Documentation added + * keygen.c added as an example for DNSSEC programming + +23 May 2005: 0.60: ldns-team + * Removed config.h from the header installed files + (you're not supposed to include that in a libary) + * Further tweaking + - DNSSEC signing/verification works + - Assorted bug fixes and tweaks (memory management) + +May 2005: 0.50: ldns-team + * First usable release + * Basic DNS functionality works + * DNSSEC validation works diff --git a/libs/ldns/LICENSE b/libs/ldns/LICENSE new file mode 100644 index 0000000000..6d4c6be096 --- /dev/null +++ b/libs/ldns/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2005,2006, NLnetLabs +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of NLnetLabs nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/ldns/Makefile.in b/libs/ldns/Makefile.in new file mode 100644 index 0000000000..6e0ce40641 --- /dev/null +++ b/libs/ldns/Makefile.in @@ -0,0 +1,368 @@ +# Standard installation pathnames +# See the file LICENSE for the license +SHELL = @SHELL@ +VERSION = @PACKAGE_VERSION@ +version_info = @LIBTOOL_VERSION_INFO@ +srcdir = @srcdir@ +basesrcdir = $(shell basename `pwd`) +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +mandir = @mandir@ +datarootdir = @datarootdir@ +datadir = @datadir@ +libdir = @libdir@ +includedir = @includedir@ +doxygen = @doxygen@ +pywrapdir = ${srcdir}/contrib/python +swig = @swig@ +python_site =@PYTHON_SITE_PKG@ +pyldns_inst =@PYLDNS@ +pyldns_uninst =@PYLDNS@ +ifeq "$(pyldns_inst)" "pyldns" + pyldns_inst=install-@PYLDNS@ + pyldns_uninst=uninstall-@PYLDNS@ +else + pyldns_inst= + pyldns_uninst= +endif +glibtool = @libtool@ +libtool = ./libtool +ifdef glibtool +libtool = $(glibtool) +endif + +CC = @CC@ +ifeq "$(srcdir)" "." + CPPFLAGS = $(strip -I. @CPPFLAGS@ @DEFS@) +else + CPPFLAGS = $(strip -I. -I$(srcdir) @CPPFLAGS@ @DEFS@) +endif +CFLAGS = $(strip @CFLAGS@) +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +LIBOBJS = @LIBOBJS@ +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ +LIBSSL_CPPFLAGS = @LIBSSL_CPPFLAGS@ +LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ +RUNTIME_PATH = @RUNTIME_PATH@ +DATE = $(shell date +%Y%m%d) +LIBTOOL = $(libtool) --tag=CC --quiet +INSTALL_LDNS_CONFIG = @INSTALL_LDNS_CONFIG@ + +LINT = splint +LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list +#-Dglob64=glob -Dglobfree64=globfree +# compat with openssl linux edition. +LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"EC_KEY=unsigned" -D"EC_POINT=unsigned" -D"EC_GROUP=unsigned" +# compat with NetBSD +ifeq "$(shell uname)" "NetBSD" +LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ +endif +# compat with OpenBSD +LINTFLAGS+="-Dsigset_t=long" +# FreeBSD8 +LINTFLAGS+="-D__uint16_t=uint16_t" + +INSTALL = $(srcdir)/install-sh + +LIBDNS_SOURCES = rdata.c util.c rr.c packet.c wire2host.c \ + host2str.c buffer.c str2host.c tsig.c resolver.c \ + net.c host2wire.c dname.c dnssec.c dnssec_verify.c \ + keys.c higher.c rr_functions.c parse.c update.c \ + error.c zone.c dnssec_zone.c dnssec_sign.c rbtree.c \ + sha1.c sha2.c +LIBDNS_HEADERS = $(srcdir)/ldns/error.h \ + $(srcdir)/ldns/packet.h \ + $(srcdir)/ldns/common.h \ + $(srcdir)/ldns/rdata.h \ + $(srcdir)/ldns/rr.h \ + $(srcdir)/ldns/wire2host.h \ + $(srcdir)/ldns/host2str.h \ + $(srcdir)/ldns/host2wire.h \ + $(srcdir)/ldns/str2host.h \ + $(srcdir)/ldns/buffer.h \ + $(srcdir)/ldns/resolver.h \ + $(srcdir)/ldns/dname.h \ + $(srcdir)/ldns/dnssec.h \ + $(srcdir)/ldns/dnssec_verify.h \ + $(srcdir)/ldns/dnssec_sign.h \ + $(srcdir)/ldns/keys.h \ + $(srcdir)/ldns/higher.h \ + $(srcdir)/ldns/parse.h \ + $(srcdir)/ldns/rr_functions.h \ + $(srcdir)/ldns/ldns.h \ + $(srcdir)/ldns/zone.h \ + $(srcdir)/ldns/dnssec_zone.h \ + $(srcdir)/ldns/update.h \ + $(srcdir)/ldns/tsig.h \ + $(srcdir)/ldns/rbtree.h \ + $(srcdir)/ldns/sha1.h \ + $(srcdir)/ldns/sha2.h +LIBDNS_OBJECTS = $(LIBDNS_SOURCES:.c=.o) $(LIBOBJS) +LIBDNS_LOBJECTS = $(LIBDNS_SOURCES:.c=.lo) $(LIBOBJS:.o=.lo) + +ALL_SOURCES = $(LIBDNS_SOURCES) + +COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) +COMP_LIB = $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) +LINK = $(CC) $(strip $(CFLAGS) $(LDFLAGS) $(LIBS)) +LINK_LIB = $(LIBTOOL) --mode=link $(CC) $(strip $(CFLAGS) $(LDFLAGS) $(LIBS) -version-number $(version_info) -no-undefined) + +%.o: $(srcdir)/%.c $(LIBDNS_HEADERS) ldns/net.h ldns/util.h ldns/config.h + $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $< + +.PHONY: clean realclean docclean manpages doc lint all lib pyldns test +.PHONY: install uninstall install-doc uninstall-doc uninstall-pyldns +.PHONY: install-h uninstall-h install-lib uninstall-lib install-pyldns + +all: copy-headers lib linktest manpages @PYLDNS@ + +linktest: $(srcdir)/linktest.c $(LIBDNS_HEADERS) ldns/net.h ldns/util.h ldns/config.h libldns.la + $(LIBTOOL) --mode=link $(CC) $(srcdir)/linktest.c $(CPPFLAGS) $(LIBSSL_CPPFLAGS) $(CFLAGS) -lldns $(LIBS) -o linktest + +lib: libldns.la + if [ ! -d lib ] ; then ln -s .libs lib ; fi ; + +lib-export-all: libldns.la-export-all + if [ ! -d lib ] ; then ln -s .libs lib ; fi ; + +libldns.la: $(LIBDNS_OBJECTS) + $(LINK_LIB) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) --export-symbols $(srcdir)/ldns_symbols.def -o libldns.la $(LIBDNS_LOBJECTS) -rpath $(libdir) $(RUNTIME_PATH) + +libldns.la-export-all: $(LIBDNS_OBJECTS) + $(LINK_LIB) -o libldns.la $(LIBDNS_LOBJECTS) -rpath $(libdir) $(RUNTIME_PATH) + +$(addprefix include/ldns/, $(notdir $(LIBDNS_HEADERS))): include/ldns/%.h: $(srcdir)/ldns/%.h + @if [ ! -d include ] ; then ($(INSTALL) -d include || echo "include exists") ; fi ; + @if [ ! -d include/ldns ] ; then (cd include; ln -s ../ldns ./ldns || echo "include/ldns exists") ; fi ; + $(INSTALL) -c -m 644 $< ./include/ldns/ + +include/ldns/util.h include/ldns/net.h include/ldns/config.h: include/ldns/%.h: ./ldns/%.h + @if [ ! -d include ] ; then ($(INSTALL) -d include || echo "include exists") ; fi ; + @if [ ! -d include/ldns ] ; then (cd include; ln -s ../ldns ./ldns || echo "include/ldns exists") ; fi ; + $(INSTALL) -c -m 644 $< ./include/ldns/ + +copy-headers: $(addprefix include/ldns/, $(notdir $(LIBDNS_HEADERS))) include/ldns/util.h include/ldns/net.h include/ldns/config.h + +mancheck: + sh -c 'find . -name \*.\[13\] -exec troff -z {} \;' 2>&1 | sed "s/^\.\///" | sed "s/\(:[0\-9]\+:\)/\1 warning:/g" + +doxygen: manpages + $(INSTALL) -d doc +ifdef doxygen +# if we are not in base we need to copy some html files too + if [ ! -e doc/header.html ] ; then \ + $(INSTALL) -c -m 644 $(srcdir)/doc/header.html doc/ ; \ + fi ; + $(doxygen) $(srcdir)/libdns.doxygen +endif + +manpages: $(srcdir)/doc/function_manpages + $(INSTALL) -d doc + cat $(srcdir)/ldns/*.h | $(srcdir)/doc/doxyparse.pl -m $(srcdir)/doc/function_manpages 2>&1 | \ + grep -v ^doxygen | grep -v ^cat > doc/ldns_manpages + +pyldns: _ldns.la + +$(pywrapdir)/ldns_wrapper.c: $(pywrapdir)/ldns.i $(wildcard $(pywrapdir)/*.i) $(LIBDNS_HEADERS) ldns/util.h ldns/config.h + $(swig) -python -o $@ $(CPPFLAGS) $(PYTHON_CPPFLAGS) $< + +ldns_wrapper.lo: $(pywrapdir)/ldns_wrapper.c $(LIBDNS_HEADERS) ldns/util.h ldns/config.h + $(COMP_LIB) -I./include/ldns $(PYTHON_CPPFLAGS) -c $< -o $@ + +_ldns.la: ldns_wrapper.lo libldns.la + $(LIBTOOL) --tag=CC --mode=link $(CC) $(strip $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) $(PYTHON_LDFLAGS) -module -version-number $(version_info) -no-undefined -o $@ $< -rpath $(python_site) -L. -L.libs -lldns $(LIBS)) + +install: install-h install-lib install-config install-manpages $(pyldns_inst) + +uninstall: uninstall-manpages uninstall-h uninstall-lib $(pyldns_uninst) + +destclean: uninstall + +install-config: + if [ $(INSTALL_LDNS_CONFIG) = "yes" ] ; then \ + $(INSTALL) -d $(DESTDIR)$(bindir); \ + $(INSTALL) -c -m 755 packaging/ldns-config $(DESTDIR)$(bindir)/; \ + fi + +install-manpages: manpages + ${INSTALL} -d $(DESTDIR)$(mandir)/man3 + for f in doc/man/man3/*; do \ + ${INSTALL} -c -m 444 $$f $(DESTDIR)$(mandir)/man3/; \ + done + +uninstall-manpages: + for i in `cat doc/ldns_manpages`; do \ + rm -f $(DESTDIR)$(mandir)/man3/$$i.3 ; done + rmdir -p $(DESTDIR)$(mandir)/man3 || echo "ok, dir already gone" + +install-h: lib + $(INSTALL) -m 755 -d $(DESTDIR)$(includedir)/ldns + for i in $(LIBDNS_HEADERS); do \ + $(INSTALL) -c -m 644 $$i $(DESTDIR)$(includedir)/ldns/; done + $(INSTALL) -c -m 644 include/ldns/util.h $(DESTDIR)$(includedir)/ldns/ + $(INSTALL) -c -m 644 include/ldns/net.h $(DESTDIR)$(includedir)/ldns/ + +uninstall-h: + for i in $(LIBDNS_HEADERS); do \ + rm -f $(DESTDIR)$(includedir)/$$i; done + [ ! -d $(DESTDIR)$(includedir)/ldns ] || rmdir -p $(DESTDI)$(includedir)/ldns || echo "ok, dir already gone" + exit 0 + +install-lib: lib + $(INSTALL) -m 755 -d $(DESTDIR)$(libdir) + $(LIBTOOL) --mode=install cp libldns.la $(DESTDIR)$(libdir) + $(LIBTOOL) --mode=finish $(DESTDIR)$(libdir) + +uninstall-lib: + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libldns.la + rmdir -p $(DESTDIR)$(libdir) || echo "ok, dir already gone" + +install-pyldns: @PYLDNS@ + $(INSTALL) -m 755 -d $(DESTDIR)$(python_site)/ldns + $(INSTALL) -c -m 644 $(pywrapdir)/ldns.py $(DESTDIR)$(python_site)/ldns.py + $(LIBTOOL) --mode=install cp _ldns.la $(DESTDIR)$(python_site) + $(LIBTOOL) --mode=finish $(DESTDIR)$(python_site) + +uninstall-pyldns: + rm -f $(DESTDIR)$(python_site)/ldns/* + rmdir -p $(DESTDIR)$(python_site)/ldns + +clean: + rm -f *.o *.d *.lo + rm -f *~ + rm -rf autom4te.cache/ + rm -f tags + rm -f *.key + rm -f *.ds + rm -f *.private + rm -rf include/ + rm -rf lib + rm -rf .libs + rm -f linktest + rm -f $(pywrapdir)/ldns_wrapper.c $(pywrapdir)/ldns.py + +distclean: clean docclean libclean + rm -f ltmain.sh + +realclean: clean docclean libclean + rm -f config.status + rm -f config.log + rm -f Makefile + rm -f ldns/config.h.in + rm -f ldns/config.h + rm -f ldns/util.h + rm -f config.h.in + rm -f configure + rm -f config.sub + rm -f config.guess + rm -f ltmain.sh + +docclean: + rm -rf doc/html/ + rm -rf doc/man/ + rm -rf doc/latex/ + rm -f doc/*.txt + rm -f doc/*.tex + rm -f doc/ldns_manpages + +libclean: + $(LIBTOOL) --mode clean rm -f libldns.la + $(LIBTOOL) --mode clean rm -f libldns.a + $(LIBTOOL) --mode clean rm -f libldns.so + $(LIBTOOL) --mode clean rm -f libldns.so.* + $(LIBTOOL) --mode clean rm -f _ldns.la + rm -rf ldns/net.h ldns/util.h ldns/config.h + rm -rf *.lo + rm -rf .libs + rm -rf libtool + +## No need for changes here + +lint: + for i in $(LIBDNS_SOURCES); do \ + $(LINT) $(LINTFLAGS) -I. -I$(srcdir) $(srcdir)/$$i ; \ + if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ + done + +tags: $(srcdir)/*.c ldns/*.[ch] + ctags -f $(srcdir)/tags $(srcdir)/*.[ch] ldns/*.[ch] + +b64_pton$U.o: $(srcdir)/compat/b64_pton.c + $(COMP_LIB) -c $(srcdir)/compat/b64_pton.c -o $@ + +b64_ntop$U.o: $(srcdir)/compat/b64_ntop.c + $(COMP_LIB) -c $(srcdir)/compat/b64_ntop.c -o $@ + +b32_pton$U.o: $(srcdir)/compat/b32_pton.c + $(COMP_LIB) -c $(srcdir)/compat/b32_pton.c -o $@ + +b32_ntop$U.o: $(srcdir)/compat/b32_ntop.c + $(COMP_LIB) -c $(srcdir)/compat/b32_ntop.c -o $@ + +malloc$U.o: $(srcdir)/compat/malloc.c + $(COMP_LIB) -c $(srcdir)/compat/malloc.c -o $@ + +realloc$U.o: $(srcdir)/compat/realloc.c + $(COMP_LIB) -c $(srcdir)/compat/realloc.c -o $@ + +timegm$U.o: $(srcdir)/compat/timegm.c + $(COMP_LIB) -c $(srcdir)/compat/timegm.c -o $@ + +isblank$U.o: $(srcdir)/compat/isblank.c + $(COMP_LIB) -c $(srcdir)/compat/isblank.c -o $@ + +isasciik$U.o: $(srcdir)/compat/isascii.c + $(COMP_LIB) -c $(srcdir)/compat/isascii.c -o $@ + +strlcpy$U.o: $(srcdir)/compat/strlcpy.c + $(COMP_LIB) -c $(srcdir)/compat/strlcpy.c -o $@ + +memmove$U.o: $(srcdir)/compat/memmove.c + $(COMP_LIB) -c $(srcdir)/compat/memmove.c -o $@ + +inet_pton$U.o: $(srcdir)/compat/inet_pton.c + $(COMP_LIB) -c $(srcdir)/compat/inet_pton.c -o $@ + +inet_aton$U.o: $(srcdir)/compat/inet_aton.c + $(COMP_LIB) -c $(srcdir)/compat/inet_aton.c -o $@ + +inet_ntop$U.o: $(srcdir)/compat/inet_ntop.c + $(COMP_LIB) -c $(srcdir)/compat/inet_ntop.c -o $@ + +snprintf$U.o: $(srcdir)/compat/snprintf.c + $(COMP_LIB) -c $(srcdir)/compat/snprintf.c -o $@ + +fake-rfc2553$U.o: $(srcdir)/compat/fake-rfc2553.c + $(COMP_LIB) -c $(srcdir)/compat/fake-rfc2553.c -o $@ + +gmtime_r$U.o: $(srcdir)/compat/gmtime_r.c + $(COMP_LIB) -c $(srcdir)/compat/gmtime_r.c -o $@ + +ctime_r$U.o: $(srcdir)/compat/ctime_r.c + $(COMP_LIB) -c $(srcdir)/compat/ctime_r.c -o $@ + +# Automatic dependencies. +%.d: $(srcdir)/%.c + $(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \ + | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.o $@ : !g'\'' > $@; \ + [ -s $@ ] || rm -f $@' + +allclean: test-clean clean + +test-clean: + tpkg -b test clean + +test: + if test -x "`which bash`"; then bash test/test_all.sh; else sh test/test_all.sh; fi + +#-include $(ALL_SOURCES:.c=.d) + +# Recreate symbols file, only needed when API changes +# make clean first (and after this make clean; make again) +symbols: lib-export-all + nm -g lib/libldns.so | cut -d " " -f 3 | grep ldns | sort > $(srcdir)/ldns_symbols.def + diff --git a/libs/ldns/README b/libs/ldns/README new file mode 100644 index 0000000000..74e470a03d --- /dev/null +++ b/libs/ldns/README @@ -0,0 +1,129 @@ + +Contents: + REQUIREMENTS + INSTALLATION + libdns + examples + drill + INFORMATION FOR SPECIFIC OPERATING SYSTEMS + Mac OS X + Solaris + Your Support + +Project page: +http://www.nlnetlabs.nl/ldns/ +On that page you can also subscribe to the ldns mailing list. + +* Development +ldns is mainly developed on Linux and FreeBSD. It is regularly tested to +compile on other systems like Solaris and Mac OS X. + +REQUIREMENTS +- OpenSSL (Optional, but needed for features like DNSSEC) +- libpcap (Optional, but needed for examples/ldns-dpa) +- (GNU) libtool (in OSX, that's glibtool, not libtool) +- GNU make + +INSTALLATION +1. Unpack the tarball +2. cd ldns- +3. ./configure +4. gmake (it needs gnu make to compile, on systems where GNU make is the + default you can just use 'make') +5. sudo gmake install +6. Optional. (cd examples; ./configure; gmake), make example programs included. +7. Optional. (cd drill; ./configure; gmake; gmake install), to build drill. + +You can configure and compile it in a separate build directory. + +* Examples +There are some examples and dns related tools in the examples/ directory. +These can be built with: +1. cd examples/ +2. ./configure [--with-ldns=] +3. gmake + +* Drill +Drill can be built with: +1. cd drill/ +2. ./configure [--with-ldns=] +3. gmake + +Note that you need to set LD_LIBRARY_PATH if you want to run the binaries +and you have not installed the library to a system directory. You can use +the make target all-static for the examples to run them if you don't want to +install the library. + + +* Building from subversion repository + +If you are building from the repository you will need to have (gnu) +autotools like libtool and autoreconf installed. A list of all the commands +needed to build everything can be found in README.svn. Note that the actual +commands may be a little bit different on your machine. Most notable, you'll need to run libtoolize (or glibtoolize), if you skip this step, you'll get an error about missing config.sub. + +* Developers +ldns is developed by the ldns team at NLnet Labs. This team currently +consists of: + o Wouter Wijngaards + o Matthijs Mekking + +Former main developers: + o Jelte Jansen + o Miek Gieben + +* Credits +We have received patches from the following people, thanks! + o Erik Rozendaal + o HÃ¥kan Olsson + o Jakob Schlyter + o Paul Wouters + o Simon Vallet + o OndÅ™ej Surý + + +IFORMATION FOR SPECIFIC OPERATING SYSTEMS + +MAC OS X + +For MACOSX 10.4 and later, it seems that you have to set the +MACOSX_DEPLOYMENT_TARGET environment variable to 10.4 before running +make. Apparently it defaults to 10.1. + +This appears to be a known problem in 10.2 to 10.4, see: +http://developer.apple.com/qa/qa2001/qa1233.html +for more information. + + +SOLARIS + +In Solaris multi-architecture systems (that have both 32-bit and +64-bit support), it can be a bit taxing to convince the system to +compile in 64-bit mode. Jakob Schlyter has kindly contributed a build +script that sets the right build and link options. You can find it in +contrib/build-solaris.sh + + +Your Support +NLnet Labs offers all of its software products as open source, most are +published under a BDS license. You can download them, not only from the +NLnet Labs website but also through the various OS distributions for +which NSD, ldns, and Unbound are packaged. We therefore have little idea +who uses our software in production environments and have no direct ties +with 'our customers'. + +Therefore, we ask you to contact us at users@NLnetLabs.nl and tell us +whether you use one of our products in your production environment, +what that environment looks like, and maybe even share some praise. +We would like to refer to the fact that your organization is using our +products. We will only do that if you explicitly allow us. In all other +cases we will keep the information you share with us to ourselves. + +In addition to the moral support you can also support us +financially. NLnet Labs is a recognized not-for-profit charity foundation +that is chartered to develop open-source software and open-standards +for the Internet. If you use our software to satisfaction please express +that by giving us a donation. For small donations PayPal can be used. For +larger and regular donations please contact us at users@NLnetLabs.nl. Also +see http://www.nlnetlabs.nl/labs/contributors/. + diff --git a/libs/ldns/README.snapshots b/libs/ldns/README.snapshots new file mode 100644 index 0000000000..891fcca1d6 --- /dev/null +++ b/libs/ldns/README.snapshots @@ -0,0 +1,8 @@ +ldns - snapshot releases + +Snapshot releases are not official released. They can be released to +interested parties for development. + +Snapshots can be recognized from the date in the the tar file name. + +They should not be used for packaging in distributions. diff --git a/libs/ldns/README.svn b/libs/ldns/README.svn new file mode 100644 index 0000000000..10f7cb4163 --- /dev/null +++ b/libs/ldns/README.svn @@ -0,0 +1,26 @@ + +# The ldns subversion repository can found at: +# www.nlnetlabs.nl/ldns/svn/ + +# small list of commands to build all on a linux system +# libtoolize is needed for most other targets + +# on Solaris, and other systems that may not have +# the default 'automake' and 'aclocal' script aliases, +# the correct versions may need to be set. On those +# systems, the 'autoreconf' line should be changed to: +# AUTOMAKE=automake-1.10 ACLOCAL=aclocal-1.10 autoreconf +# (and these systems probably need gmake instead of make) + +# older versions of libtoolize do not support --install +# so you might need to remove that (with newer versions +# it is needed) +libtoolize -c --install +autoreconf --install +./configure +make +make doc # needs doxygen for the html pages +(cd examples && autoreconf && ./configure && make) +(cd drill && autoreconf && ./configure && make) +(cd pcat && autoreconf && ./configure && make) +(cd examples/nsd-test && autoreconf && ./configure && make) diff --git a/libs/ldns/ac_pkg_swig.m4 b/libs/ldns/ac_pkg_swig.m4 new file mode 100644 index 0000000000..738f69d45e --- /dev/null +++ b/libs/ldns/ac_pkg_swig.m4 @@ -0,0 +1,122 @@ +# =========================================================================== +# http://autoconf-archive.cryp.to/ac_pkg_swig.html +# =========================================================================== +# +# SYNOPSIS +# +# AC_PROG_SWIG([major.minor.micro]) +# +# DESCRIPTION +# +# This macro searches for a SWIG installation on your system. If found you +# should call SWIG via $(SWIG). You can use the optional first argument to +# check if the version of the available SWIG is greater than or equal to +# the value of the argument. It should have the format: N[.N[.N]] (N is a +# number between 0 and 999. Only the first N is mandatory.) +# +# If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that +# the swig package is this version number or higher. +# +# In configure.in, use as: +# +# AC_PROG_SWIG(1.3.17) +# SWIG_ENABLE_CXX +# SWIG_MULTI_MODULE_SUPPORT +# SWIG_PYTHON +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Sebastian Huber +# Copyright (c) 2008 Alan W. Irwin +# Copyright (c) 2008 Rafael Laboissiere +# Copyright (c) 2008 Andrew Collier +# +# 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Macro Archive. When you make and +# distribute a modified version of the Autoconf Macro, you may extend this +# special exception to the GPL to apply to your modified version as well. + +AC_DEFUN([AC_PROG_SWIG],[ + AC_PATH_PROG([SWIG],[swig]) + if test -z "$SWIG" ; then + AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org]) + SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' + elif test -n "$1" ; then + AC_MSG_CHECKING([for SWIG version]) + [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] + AC_MSG_RESULT([$swig_version]) + if test -n "$swig_version" ; then + # Calculate the required version number components + [required=$1] + [required_major=`echo $required | sed 's/[^0-9].*//'`] + if test -z "$required_major" ; then + [required_major=0] + fi + [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + [required_minor=`echo $required | sed 's/[^0-9].*//'`] + if test -z "$required_minor" ; then + [required_minor=0] + fi + [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] + [required_patch=`echo $required | sed 's/[^0-9].*//'`] + if test -z "$required_patch" ; then + [required_patch=0] + fi + # Calculate the available version number components + [available=$swig_version] + [available_major=`echo $available | sed 's/[^0-9].*//'`] + if test -z "$available_major" ; then + [available_major=0] + fi + [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + [available_minor=`echo $available | sed 's/[^0-9].*//'`] + if test -z "$available_minor" ; then + [available_minor=0] + fi + [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] + [available_patch=`echo $available | sed 's/[^0-9].*//'`] + if test -z "$available_patch" ; then + [available_patch=0] + fi + if test $available_major -ne $required_major \ + -o $available_minor -ne $required_minor \ + -o $available_patch -lt $required_patch ; then + AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) + SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' + else + AC_MSG_NOTICE([SWIG executable is '$SWIG']) + SWIG_LIB=`$SWIG -swiglib` + AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB']) + fi + else + AC_MSG_WARN([cannot determine SWIG version]) + SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' + fi + fi + AC_SUBST([SWIG_LIB]) +]) diff --git a/libs/ldns/acx_nlnetlabs.m4 b/libs/ldns/acx_nlnetlabs.m4 new file mode 100644 index 0000000000..147af7f9ad --- /dev/null +++ b/libs/ldns/acx_nlnetlabs.m4 @@ -0,0 +1,1310 @@ +# acx_nlnetlabs.m4 - common macros for configure checks +# Copyright 2009, Wouter Wijngaards, NLnet Labs. +# BSD licensed. +# +# Version 11 +# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. +# 2010-07-02 Add check for ss_family (for minix). +# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. +# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. +# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl +# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN +# 2010-01-20 added AHX_COONFIG_STRLCAT +# 2009-07-14 U_CHAR detection improved for windows crosscompile. +# added ACX_FUNC_MALLOC +# fixup some #if to #ifdef +# NONBLOCKING test for mingw crosscompile. +# 2009-07-13 added ACX_WITH_SSL_OPTIONAL +# 2009-07-03 fixup LDFLAGS for empty ssl dir. +# +# Automates some of the checking constructs. Aims at portability for POSIX. +# Documentation for functions is below. +# +# the following macro's are provided in this file: +# (see below for details on each macro). +# +# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. +# ACX_RSRC_VERSION - create windows resource version number. +# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. +# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). +# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. +# ACX_DEPFLAG - find cc dependency flags. +# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. +# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. +# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. +# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. +# ACX_TYPE_U_CHAR - u_char type. +# ACX_TYPE_RLIM_T - rlim_t type. +# ACX_TYPE_SOCKLEN_T - socklen_t type. +# ACX_TYPE_IN_ADDR_T - in_addr_t type. +# ACX_TYPE_IN_PORT_T - in_port_t type. +# ACX_ARG_RPATH - add --disable-rpath option. +# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. +# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, +# where --without-ssl is also accepted +# ACX_LIB_SSL - setup to link -lssl. +# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. +# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. +# ACX_FUNC_DEPRECATED - see if func is deprecated. +# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. +# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. +# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. +# ACX_FUNC_MALLOC - check malloc, define replacement . +# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. +# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. +# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. +# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. +# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. +# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. +# AHX_CONFIG_SNPRINTF - snprintf compat prototype +# AHX_CONFIG_INET_PTON - inet_pton compat prototype +# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype +# AHX_CONFIG_INET_ATON - inet_aton compat prototype +# AHX_CONFIG_MEMMOVE - memmove compat prototype +# AHX_CONFIG_STRLCAT - strlcat compat prototype +# AHX_CONFIG_STRLCPY - strlcpy compat prototype +# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype +# AHX_CONFIG_W32_SLEEP - w32 compat for sleep +# AHX_CONFIG_W32_USLEEP - w32 compat for usleep +# AHX_CONFIG_W32_RANDOM - w32 compat for random +# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom +# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. +# ACX_CFLAGS_STRIP - strip one flag from CFLAGS +# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS +# AHX_CONFIG_FLAG_OMITTED - define omitted flag +# AHX_CONFIG_FLAG_EXT - define omitted extension flag +# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags +# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. +# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. +# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family +# + +dnl Escape backslashes as \\, for C:\ paths, for the C preprocessor defines. +dnl for example, ACX_ESCAPE_BACKSLASH($from_var, to_var) +dnl $1: the text to change. +dnl $2: the result. +AC_DEFUN([ACX_ESCAPE_BACKSLASH], [$2="`echo $1 | sed -e 's/\\\\/\\\\\\\\/g'`" +]) + +dnl Calculate comma separated windows-resource numbers from package version. +dnl Picks the first three(,0) or four numbers out of the name. +dnl $1: variable for the result +AC_DEFUN([ACX_RSRC_VERSION], +[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `] +]) + +dnl Routine to help check for compiler flags. +dnl Checks if the compiler will accept the flag. +dnl $1: the flag without a - in front, so g to check -g. +dnl $2: executed if yes +dnl $3: executed if no +AC_DEFUN([ACX_CHECK_COMPILER_FLAG], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(whether $CC supports -$1) +cache=`echo $1 | sed 'y%.=/+-%___p_%'` +AC_CACHE_VAL(cv_prog_cc_flag_$cache, +[ +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c +]) +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +AC_MSG_RESULT(yes) +: +$2 +else +AC_MSG_RESULT(no) +: +$3 +fi +]) + +dnl setup flags for ACX_CHECK_COMPILER_FLAG_NEEDED +dnl ERRFLAG: result, compiler flag to turn warnings into errors +AC_DEFUN([ACX_CHECK_ERROR_FLAGS], +[ +ACX_CHECK_COMPILER_FLAG(Werror, [ERRFLAG="-Werror"], [ERRFLAG="-errwarn"]) +ACX_CHECK_COMPILER_FLAG(Wall, [ERRFLAG="$ERRFLAG -Wall"], + [ERRFLAG="$ERRFLAG -errfmt"]) +]) + +dnl Routine to help check for needed compiler flags. +dnl $1: flags for CC +dnl $2: the includes and code +dnl $3: if the given code only compiles with the flag, execute argument 3 +dnl $4: if the given code compiles without the flag, execute argument 4 +dnl $5: with and without flag the compile fails, execute argument 5. +AC_DEFUN([ACX_CHECK_COMPILER_FLAG_NEEDED], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([ACX_CHECK_ERROR_FLAGS]) +AC_MSG_CHECKING(whether we need $1 as a flag for $CC) +cache=AS_TR_SH($1) +dnl cache=`echo $1 | sed 'y%.=/+- %___p__%'` +AC_CACHE_VAL(cv_prog_cc_flag_needed_$cache, +[ +echo '$2' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else +[ +if test -z "`$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi +] +fi +rm -f conftest conftest.c conftest.o +]) +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +AC_MSG_RESULT(yes) +: +$3 +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +AC_MSG_RESULT(no) +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: +$4 +else +AC_MSG_RESULT(failed) +: +$5 +fi +fi +]) + +dnl Check for CC dependency flag +dnl DEPFLAG: set to flag that generates dependencies. +AC_DEFUN([ACX_DEPFLAG], +[ +AC_MSG_CHECKING([$CC dependency flag]) +echo 'void f(){}' >conftest.c +if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then + DEPFLAG="-MM" +else + if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then + DEPFLAG="-xM1" + else + DEPFLAG="-MM" # dunno do something + fi +fi +AC_MSG_RESULT($DEPFLAG) +rm -f conftest.c +AC_SUBST(DEPFLAG) +]) + +dnl Determine flags that gives POSIX and BSD functionality. +dnl CFLAGS is modified for the result. +AC_DEFUN([ACX_DETERMINE_EXT_FLAGS_UNBOUND], +[ +ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) +ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) + +AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT]) + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE, +[ +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + const char* str = NULL; + struct msghdr msg; + msg.msg_control = 0; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + str = gai_strerror(0); + return a; +} +], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE, +[ +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + const char* str = NULL; + struct msghdr msg; + msg.msg_control = 0; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + str = gai_strerror(0); + return a; +} +], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, +[ +#include +#include +int test() { + int a = 0; + return a; +} +], [CFLAGS="$CFLAGS $C99FLAG"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED(-D_BSD_SOURCE, +[ +#include + +int test() { + int a; + a = isascii(32); + return a; +} +], [CFLAGS="$CFLAGS -D_BSD_SOURCE"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE, +[ +#include + +int test() { + struct in6_pktinfo inf; + int a = (int)sizeof(inf); + return a; +} +], [CFLAGS="$CFLAGS -D_GNU_SOURCE"]) + +# check again for GNU_SOURCE for setresgid. May fail if setresgid +# is not available at all. -D_FRSRESGID is to make this check unique. +# otherwise we would get the previous cached result. +ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE -D_FRSRESGID, +[ +#include + +int test() { + int a = setresgid(0,0,0); + a = setresuid(0,0,0); + return a; +} +], [CFLAGS="$CFLAGS -D_GNU_SOURCE"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED(-D_POSIX_C_SOURCE=200112, +[ +#include "confdefs.h" +#ifdef HAVE_TIME_H +#include +#endif +#include + +int test() { + int a = 0; + char *t; + time_t time = 0; + char *buf = NULL; + const char* str = NULL; + t = ctime_r(&time, buf); + str = gai_strerror(0); + return a; +} +], [CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED(-D__EXTENSIONS__, +[ +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +], [CFLAGS="$CFLAGS -D__EXTENSIONS__"]) + +])dnl End of ACX_DETERMINE_EXT_FLAGS_UNBOUND + +dnl Check the printf-format attribute (if any) +dnl result in HAVE_ATTR_FORMAT. +dnl Make sure you also include the AHX_CONFIG_FORMAT_ATTRIBUTE. +AC_DEFUN([ACX_CHECK_FORMAT_ATTRIBUTE], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute) +AC_CACHE_VAL(ac_cv_c_format_attribute, +[ac_cv_c_format_attribute=no +AC_TRY_COMPILE( +[#include +void f (char *format, ...) __attribute__ ((format (printf, 1, 2))); +void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2))); +], [ + f ("%s", "str"); +], +[ac_cv_c_format_attribute="yes"], +[ac_cv_c_format_attribute="no"]) +]) + +AC_MSG_RESULT($ac_cv_c_format_attribute) +if test $ac_cv_c_format_attribute = yes; then + AC_DEFINE(HAVE_ATTR_FORMAT, 1, [Whether the C compiler accepts the "format" attribute]) +fi +])dnl End of ACX_CHECK_FORMAT_ATTRIBUTE + +dnl Setup ATTR_FORMAT config.h parts. +dnl make sure you call ACX_CHECK_FORMAT_ATTRIBUTE also. +AC_DEFUN([AHX_CONFIG_FORMAT_ATTRIBUTE], +[ +#ifdef HAVE_ATTR_FORMAT +# define ATTR_FORMAT(archetype, string_index, first_to_check) \ + __attribute__ ((format (archetype, string_index, first_to_check))) +#else /* !HAVE_ATTR_FORMAT */ +# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ +#endif /* !HAVE_ATTR_FORMAT */ +]) + +dnl Check how to mark function arguments as unused. +dnl result in HAVE_ATTR_UNUSED. +dnl Make sure you include AHX_CONFIG_UNUSED_ATTRIBUTE also. +AC_DEFUN([ACX_CHECK_UNUSED_ATTRIBUTE], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute) +AC_CACHE_VAL(ac_cv_c_unused_attribute, +[ac_cv_c_unused_attribute=no +AC_TRY_COMPILE( +[#include +void f (char *u __attribute__((unused))); +], [ + f ("x"); +], +[ac_cv_c_unused_attribute="yes"], +[ac_cv_c_unused_attribute="no"]) +]) + +dnl Setup ATTR_UNUSED config.h parts. +dnl make sure you call ACX_CHECK_UNUSED_ATTRIBUTE also. +AC_DEFUN([AHX_CONFIG_UNUSED_ATTRIBUTE], +[ +#if defined(DOXYGEN) +# define ATTR_UNUSED(x) x +#elif defined(__cplusplus) +# define ATTR_UNUSED(x) +#elif defined(HAVE_ATTR_UNUSED) +# define ATTR_UNUSED(x) x __attribute__((unused)) +#else /* !HAVE_ATTR_UNUSED */ +# define ATTR_UNUSED(x) x +#endif /* !HAVE_ATTR_UNUSED */ +]) + +AC_MSG_RESULT($ac_cv_c_unused_attribute) +if test $ac_cv_c_unused_attribute = yes; then + AC_DEFINE(HAVE_ATTR_UNUSED, 1, [Whether the C compiler accepts the "unused" attribute]) +fi +])dnl + +dnl Pre-fun for ACX_LIBTOOL_C_ONLY +AC_DEFUN([ACX_LIBTOOL_C_PRE], [ +# skip these tests, we do not need them. +AC_DEFUN([AC_PROG_F77], [:]) +AC_DEFUN([AC_PROG_FC], [:]) +AC_DEFUN([AC_PROG_CXX], [:]) +AC_DEFUN([AC_PROG_CXXCPP], [:]) +AC_DEFUN([AC_PROG_OBJC], [:]) +AC_DEFUN([AC_PROG_OBJCCPP], [:]) +AC_DEFUN([AC_LIBTOOL_CXX], [:]) +AC_DEFUN([AC_LIBTOOL_F77], [:]) +# always use ./libtool unless override from commandline (libtool=mylibtool) +if test -z "$libtool"; then + libtool="./libtool" +fi +AC_SUBST(libtool) +# avoid libtool max commandline length test on systems that fork slowly. +AC_CANONICAL_HOST +if echo "$host_os" | grep "sunos4" >/dev/null; then + lt_cv_sys_max_cmd_len=32750; +fi +AC_PATH_TOOL(AR, ar, [false]) +if test $AR = false; then + AC_MSG_ERROR([Cannot find 'ar', please extend PATH to include it]) +fi +]) + +dnl Perform libtool check, portably, only for C +AC_DEFUN([ACX_LIBTOOL_C_ONLY], [ +dnl as a requirement so that is gets called before LIBTOOL +dnl because libtools 'AC_REQUIRE' names are right after this one, before +dnl this function contents. +AC_REQUIRE([ACX_LIBTOOL_C_PRE]) +AC_PROG_LIBTOOL +]) + +dnl Detect if u_char type is defined, otherwise define it. +AC_DEFUN([ACX_TYPE_U_CHAR], +[AC_CHECK_TYPE([u_char], , + [AC_DEFINE([u_char], [unsigned char], [Define to 'unsigned char if not defined])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_WINSOCK2_H +# include +#endif +]) ]) + +dnl Detect if rlim_t type is defined, otherwise define it. +AC_DEFUN([ACX_TYPE_RLIM_T], +[AC_CHECK_TYPE(rlim_t, , + [AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_RESOURCE_H +# include +#endif +]) ]) + +dnl Detect if socklen_t type is defined, otherwise define it. +AC_DEFUN([ACX_TYPE_SOCKLEN_T], +[ +AC_CHECK_TYPE(socklen_t, , + [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_WS2TCPIP_H +# include +#endif +]) ]) + +dnl Detect if in_addr_t type is defined, otherwise define it. +AC_DEFUN([ACX_TYPE_IN_ADDR_T], +[ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +]) ]) + +dnl Detect if in_port_t type is defined, otherwise define it. +AC_DEFUN([ACX_TYPE_IN_PORT_T], +[ AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_NETINET_IN_H +# include +#endif +]) ]) + +dnl Add option to disable the evil rpath. Check whether to use rpath or not. +dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool. +AC_DEFUN([ACX_ARG_RPATH], +[ +AC_ARG_ENABLE(rpath, + [ --disable-rpath disable hardcoded rpath (default=enabled)], + enable_rpath=$enableval, enable_rpath=yes) +if test "x$enable_rpath" = xno; then + dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.]) + AC_CONFIG_COMMANDS([disable-rpath], [ + sed < libtool > libtool-2 \ + 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' + mv libtool-2 libtool + chmod 755 libtool + libtool="./libtool" + ]) +fi +]) + +dnl Add a -R to the RUNTIME_PATH. Only if rpath is enabled and it is +dnl an absolute path. +dnl $1: the pathname to add. +AC_DEFUN([ACX_RUNTIME_PATH_ADD], [ + if test "x$enable_rpath" = xyes; then + if echo "$1" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$1" + fi + fi +]) + +dnl Common code for both ACX_WITH_SSL and ACX_WITH_SSL_OPTIONAL +dnl Takes one argument; the withval checked in those 2 functions +dnl sets up the environment for the given openssl path +AC_DEFUN([ACX_SSL_CHECKS], [ + withval=$1 + if test x_$withval != x_no; then + AC_MSG_CHECKING(for SSL) + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" + fi + for dir in $withval; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes" + AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) + dnl assume /usr/include is already in the include-path. + if test "$ssldir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" + fi + break; + fi + done + if test x_$found_ssl != x_yes; then + AC_MSG_ERROR(Cannot find the SSL libraries in $withval) + else + AC_MSG_RESULT(found in $ssldir) + HAVE_SSL=yes + dnl assume /usr is already in the lib and dynlib paths. + if test "$ssldir" != "/usr" -a "$ssldir" != ""; then + LDFLAGS="$LDFLAGS -L$ssldir/lib" + LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" + ACX_RUNTIME_PATH_ADD([$ssldir/lib]) + fi + + AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) + LIBS="$LIBS -lcrypto" + LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" + AC_TRY_LINK(, [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ], [ + AC_MSG_RESULT(yes) + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + ], [ + AC_MSG_RESULT(no) + # check if -lwsock32 or -lgdi32 are needed. + BAKLIBS="$LIBS" + BAKSSLLIBS="$LIBSSL_LIBS" + LIBS="$LIBS -lgdi32" + LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" + AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) + AC_TRY_LINK([], [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ],[ + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + AC_MSG_CHECKING([if -lcrypto needs -ldl]) + AC_TRY_LINK([], [ + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + ],[ + AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, + [If you have HMAC_CTX_init]) + AC_MSG_RESULT(yes) + ],[ + AC_MSG_RESULT(no) + AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) + ]) + ]) + ]) + fi + AC_SUBST(HAVE_SSL) + AC_SUBST(RUNTIME_PATH) + # openssl engine functionality needs dlopen(). + BAKLIBS="$LIBS" + AC_SEARCH_LIBS([dlopen], [dl]) + if test "$LIBS" != "$BAKLIBS"; then + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + fi + fi +AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) +])dnl End of ACX_SSL_CHECKS + +dnl Check for SSL, where SSL is mandatory +dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found +dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. +dnl Checks main header files of SSL. +dnl +AC_DEFUN([ACX_WITH_SSL], +[ +AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], + [enable SSL (will check /usr/local/ssl + /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ + ],[ + withval="yes" + ]) + if test x_$withval = x_no; then + AC_MSG_ERROR([Need SSL library to do digital signature cryptography]) + fi + ACX_SSL_CHECKS($withval) +])dnl End of ACX_WITH_SSL + +dnl Check for SSL, where ssl is optional (--without-ssl is allowed) +dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found +dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. +dnl Checks main header files of SSL. +dnl +AC_DEFUN([ACX_WITH_SSL_OPTIONAL], +[ +AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], + [enable SSL (will check /usr/local/ssl + /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ + ],[ + withval="yes" + ]) + ACX_SSL_CHECKS($withval) +])dnl End of ACX_WITH_SSL_OPTIONAL + +dnl Setup to use -lssl +dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one). +AC_DEFUN([ACX_LIB_SSL], +[ +# check if libssl needs libdl +BAKLIBS="$LIBS" +LIBS="-lssl $LIBS" +AC_MSG_CHECKING([if libssl needs libdl]) +AC_TRY_LINK_FUNC([SSL_CTX_new], [ + AC_MSG_RESULT([no]) + LIBS="$BAKLIBS" +] , [ + AC_MSG_RESULT([yes]) + LIBS="$BAKLIBS" + AC_SEARCH_LIBS([dlopen], [dl]) +]) ])dnl End of ACX_LIB_SSL + +dnl Setup to use very large files (>2Gb). +dnl setups fseeko and its own +AC_DEFUN([ACX_SYS_LARGEFILE], +[ +AC_SYS_LARGEFILE +dnl try to see if an additional _LARGEFILE_SOURCE 1 is needed to get fseeko +ACX_CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1, +[ +#include +int test() { + int a = fseeko(stdin, 0, 0); + return a; +} +], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"]) +]) + +dnl Check getaddrinfo. +dnl Works on linux, solaris, bsd and windows(links winsock). +dnl defines HAVE_GETADDRINFO, USE_WINSOCK. +AC_DEFUN([ACX_CHECK_GETADDRINFO_WITH_INCLUDES], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(for getaddrinfo) +ac_cv_func_getaddrinfo=no +AC_LINK_IFELSE( +[ +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} +], +dnl this case on linux, solaris, bsd +[ac_cv_func_getaddrinfo="yes"], +dnl no quick getaddrinfo, try mingw32 and winsock2 library. +ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +AC_LINK_IFELSE( +AC_LANG_PROGRAM( +[ +#ifdef HAVE_WS2TCPIP_H +#include +#endif +], +[ + (void)getaddrinfo(NULL, NULL, NULL, NULL); +] +), +[ +ac_cv_func_getaddrinfo="yes" +dnl already: LIBS="$LIBS -lws2_32" +AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used]) +USE_WINSOCK="1" +], +[ +ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" +]) +) + +AC_MSG_RESULT($ac_cv_func_getaddrinfo) +if test $ac_cv_func_getaddrinfo = yes; then + AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) +fi +])dnl Endof AC_CHECK_GETADDRINFO_WITH_INCLUDES + +dnl check if a function is deprecated. defines DEPRECATED_func in config.h. +dnl $1: function name +dnl $2: C-statement that calls the function. +dnl $3: includes for the program. +dnl $4: executes if yes +dnl $5: executes if no +AC_DEFUN([ACX_FUNC_DEPRECATED], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(if $1 is deprecated) +cache=`echo $1 | sed 'y%.=/+-%___p_%'` +AC_CACHE_VAL(cv_cc_deprecated_$cache, +[ +echo '$3' >conftest.c +echo 'void f(){ $2 }' >>conftest.c +if test -z "`$CC -c conftest.c 2>&1 | grep deprecated`"; then +eval "cv_cc_deprecated_$cache=no" +else +eval "cv_cc_deprecated_$cache=yes" +fi +rm -f conftest conftest.o conftest.c +]) +if eval "test \"`echo '$cv_cc_deprecated_'$cache`\" = yes"; then +AC_MSG_RESULT(yes) +AC_DEFINE_UNQUOTED(AS_TR_CPP([DEPRECATED_$1]), 1, [Whether $1 is deprecated]) +: +$4 +else +AC_MSG_RESULT(no) +: +$5 +fi +])dnl end of ACX_FUNC_DEPRECATED + +dnl check if select and nonblocking sockets actually work. +dnl Needs fork(2) and select(2). +dnl defines NONBLOCKING_IS_BROKEN, and if that is true multiple reads from +dnl a nonblocking socket do not work, a new call to select is necessary. +AC_DEFUN([ACX_CHECK_NONBLOCKING_BROKEN], +[ +AC_MSG_CHECKING([if nonblocking sockets work]) +if echo $target | grep mingw32 >/dev/null; then + AC_MSG_RESULT([no (windows)]) + AC_DEFINE([NONBLOCKING_IS_BROKEN], 1, [Define if the network stack does not fully support nonblocking io (causes lower performance).]) +else +AC_RUN_IFELSE(AC_LANG_PROGRAM([ +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif +],[[ + int port; + int sfd, cfd; + int num = 10; + int i, p; + struct sockaddr_in a; + /* test if select and nonblocking reads work well together */ + /* open port. + fork child to send 10 messages. + select to read. + then try to nonblocking read the 10 messages + then, nonblocking read must give EAGAIN + */ + + port = 12345 + (time(0)%32); + sfd = socket(PF_INET, SOCK_DGRAM, 0); + if(sfd == -1) { + perror("socket"); + return 1; + } + memset(&a, 0, sizeof(a)); + a.sin_family = AF_INET; + a.sin_port = htons(port); + a.sin_addr.s_addr = inet_addr("127.0.0.1"); + if(bind(sfd, (struct sockaddr*)&a, sizeof(a)) < 0) { + perror("bind"); + return 1; + } + if(fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) { + perror("fcntl"); + return 1; + } + + cfd = socket(PF_INET, SOCK_DGRAM, 0); + if(cfd == -1) { + perror("client socket"); + return 1; + } + a.sin_port = 0; + if(bind(cfd, (struct sockaddr*)&a, sizeof(a)) < 0) { + perror("client bind"); + return 1; + } + a.sin_port = htons(port); + + /* no handler, causes exit in 10 seconds */ + alarm(10); + + /* send and receive on the socket */ + if((p=fork()) == 0) { + for(i=0; i +#include +#ifdef HAVE_WINSOCK2_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +], [ + (void)mkdir("directory"); +], +AC_MSG_RESULT(yes) +AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.]) +, +AC_MSG_RESULT(no) +) +])dnl end of ACX_MKDIR_ONE_ARG + +dnl Check for ioctlsocket function. works on mingw32 too. +AC_DEFUN([ACX_FUNC_IOCTLSOCKET], +[ +# check ioctlsocket +AC_MSG_CHECKING(for ioctlsocket) +AC_LINK_IFELSE(AC_LANG_PROGRAM([ +#ifdef HAVE_WINSOCK2_H +#include +#endif +], [ + (void)ioctlsocket(0, 0, NULL); +]), [ +AC_MSG_RESULT(yes) +AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available]) +],[AC_MSG_RESULT(no)]) +])dnl end of ACX_FUNC_IOCTLSOCKET + +dnl detect malloc and provide malloc compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([ACX_FUNC_MALLOC], +[ + AC_FUNC_MALLOC + if test "$ac_cv_func_malloc_0_nonnull" = no; then + AC_DEFINE_UNQUOTED([malloc], [rpl_malloc_$1], [Define if replacement function should be used.]) + fi +]) + +dnl Define fallback for fseeko and ftello if needed. +AC_DEFUN([AHX_CONFIG_FSEEKO], +[ +#ifndef HAVE_FSEEKO +#define fseeko fseek +#define ftello ftell +#endif /* HAVE_FSEEKO */ +]) + +dnl Define RAND_MAX if not defined +AC_DEFUN([AHX_CONFIG_RAND_MAX], +[ +#ifndef RAND_MAX +#define RAND_MAX 2147483647 +#endif +]) + +dnl Define MAXHOSTNAMELEN if not defined +AC_DEFUN([AHX_CONFIG_MAXHOSTNAMELEN], +[ +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif +]) + +dnl Define IPV6_MIN_MTU if not defined +AC_DEFUN([AHX_CONFIG_IPV6_MIN_MTU], +[ +#ifndef IPV6_MIN_MTU +#define IPV6_MIN_MTU 1280 +#endif /* IPV6_MIN_MTU */ +]) + +dnl provide snprintf, vsnprintf compat prototype +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_SNPRINTF], +[ +#ifndef HAVE_SNPRINTF +#define snprintf snprintf_$1 +#define vsnprintf vsnprintf_$1 +#include +int snprintf (char *str, size_t count, const char *fmt, ...); +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); +#endif /* HAVE_SNPRINTF */ +]) + +dnl provide inet_pton compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_INET_PTON], +[ +#ifndef HAVE_INET_PTON +#define inet_pton inet_pton_$1 +int inet_pton(int af, const char* src, void* dst); +#endif /* HAVE_INET_PTON */ +]) + +dnl provide inet_ntop compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_INET_NTOP], +[ +#ifndef HAVE_INET_NTOP +#define inet_ntop inet_ntop_$1 +const char *inet_ntop(int af, const void *src, char *dst, size_t size); +#endif +]) + +dnl provide inet_aton compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_INET_ATON], +[ +#ifndef HAVE_INET_ATON +#define inet_aton inet_aton_$1 +int inet_aton(const char *cp, struct in_addr *addr); +#endif +]) + +dnl provide memmove compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_MEMMOVE], +[ +#ifndef HAVE_MEMMOVE +#define memmove memmove_$1 +void *memmove(void *dest, const void *src, size_t n); +#endif +]) + +dnl provide strlcat compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_STRLCAT], +[ +#ifndef HAVE_STRLCAT +#define strlcat strlcat_$1 +size_t strlcat(char *dst, const char *src, size_t siz); +#endif +]) + +dnl provide strlcpy compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_STRLCPY], +[ +#ifndef HAVE_STRLCPY +#define strlcpy strlcpy_$1 +size_t strlcpy(char *dst, const char *src, size_t siz); +#endif +]) + +dnl provide gmtime_r compat prototype. +dnl $1: unique name for compat code +AC_DEFUN([AHX_CONFIG_GMTIME_R], +[ +#ifndef HAVE_GMTIME_R +#define gmtime_r gmtime_r_$1 +struct tm *gmtime_r(const time_t *timep, struct tm *result); +#endif +]) + +dnl provide w32 compat definition for sleep +AC_DEFUN([AHX_CONFIG_W32_SLEEP], +[ +#ifndef HAVE_SLEEP +#define sleep(x) Sleep((x)*1000) /* on win32 */ +#endif /* HAVE_SLEEP */ +]) + +dnl provide w32 compat definition for usleep +AC_DEFUN([AHX_CONFIG_W32_USLEEP], +[ +#ifndef HAVE_USLEEP +#define usleep(x) Sleep((x)/1000 + 1) /* on win32 */ +#endif /* HAVE_USLEEP */ +]) + +dnl provide w32 compat definition for random +AC_DEFUN([AHX_CONFIG_W32_RANDOM], +[ +#ifndef HAVE_RANDOM +#define random rand /* on win32, for tests only (bad random) */ +#endif /* HAVE_RANDOM */ +]) + +dnl provide w32 compat definition for srandom +AC_DEFUN([AHX_CONFIG_W32_SRANDOM], +[ +#ifndef HAVE_SRANDOM +#define srandom(x) srand(x) /* on win32, for tests only (bad random) */ +#endif /* HAVE_SRANDOM */ +]) + +dnl provide w32 compat definition for FD_SET_T +AC_DEFUN([AHX_CONFIG_W32_FD_SET_T], +[ +/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */ +#ifdef HAVE_WINSOCK2_H +#define FD_SET_T (u_int) +#else +#define FD_SET_T +#endif +]) + +dnl Remove an extension flag from CFLAGS, define replacement to be made. +dnl Used by ACX_STRIP_EXT_FLAGS. +dnl $1: the name of the flag, for example -D_GNU_SOURCE. +AC_DEFUN([ACX_CFLAGS_STRIP], +[ + if echo $CFLAGS | grep " $1" >/dev/null 2>&1; then + CFLAGS="`echo $CFLAGS | sed -e 's/ $1//g'`" + AC_DEFINE(m4_bpatsubst(OMITTED_$1,[[-=]],_), 1, Put $1 define in config.h) + fi +]) + +dnl Remove EXT flags from the CFLAGS and set them to be defined in config.h +dnl use with ACX_DETERMINE_EXT_FLAGS. +AC_DEFUN([ACX_STRIP_EXT_FLAGS], +[ + AC_MSG_NOTICE([Stripping extension flags...]) + ACX_CFLAGS_STRIP(-D_GNU_SOURCE) + ACX_CFLAGS_STRIP(-D_BSD_SOURCE) + ACX_CFLAGS_STRIP(-D__EXTENSIONS__) + ACX_CFLAGS_STRIP(-D_POSIX_C_SOURCE=200112) + ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE=600) + ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE_EXTENDED=1) + ACX_CFLAGS_STRIP(-D_ALL_SOURCE) + ACX_CFLAGS_STRIP(-D_LARGEFILE_SOURCE=1) +]) dnl End of ACX_STRIP_EXT_FLAGS + +dnl define one omitted flag for config.h +dnl $1: flag name. -D_GNU_SOURCE +dnl $2: replacement define. _GNU_SOURCE +dnl $3: define value, 1 +AC_DEFUN([AHX_CONFIG_FLAG_OMITTED], +[#if defined($1) && !defined($2) +#define $2 $3 +[#]endif ]) + +dnl Wrapper for AHX_CONFIG_FLAG_OMITTED for -D style flags +dnl $1: the -DNAME or -DNAME=value string. +AC_DEFUN([AHX_CONFIG_FLAG_EXT], +[AHX_CONFIG_FLAG_OMITTED(m4_bpatsubst(OMITTED_$1,[[-=]],_),m4_bpatsubst(m4_bpatsubst($1,-D,),=.*$,),m4_if(m4_bregexp($1,=),-1,1,m4_bpatsubst($1,^.*=,))) +]) + +dnl config.h part to define omitted cflags, use with ACX_STRIP_EXT_FLAGS. +AC_DEFUN([AHX_CONFIG_EXT_FLAGS], +[AHX_CONFIG_FLAG_EXT(-D_GNU_SOURCE) +AHX_CONFIG_FLAG_EXT(-D_BSD_SOURCE) +AHX_CONFIG_FLAG_EXT(-D__EXTENSIONS__) +AHX_CONFIG_FLAG_EXT(-D_POSIX_C_SOURCE=200112) +AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE=600) +AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE_EXTENDED=1) +AHX_CONFIG_FLAG_EXT(-D_ALL_SOURCE) +AHX_CONFIG_FLAG_EXT(-D_LARGEFILE_SOURCE=1) +]) + +dnl check if memcmp is using signed characters and replace if so. +AC_DEFUN([ACX_CHECK_MEMCMP_SIGNED], +[AC_MSG_CHECKING([if memcmp compares unsigned]) +AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include +#include +#include +int main(void) +{ + char a = 255, b = 0; + if(memcmp(&a, &b, 1) < 0) + return 1; + return 0; +} +]])], [AC_MSG_RESULT([yes]) ], +[ AC_MSG_RESULT([no]) + AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes]) + AC_LIBOBJ([memcmp]) +], [ AC_MSG_RESULT([cross-compile no]) + AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes]) + AC_LIBOBJ([memcmp]) +]) ]) + +dnl define memcmp to its replacement, pass unique id for program as arg +AC_DEFUN([AHX_MEMCMP_BROKEN], [ +#ifdef MEMCMP_IS_BROKEN +# ifdef memcmp +# undef memcmp +# endif +#define memcmp memcmp_$1 +int memcmp(const void *x, const void *y, size_t n); +#endif +]) + +dnl ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family +AC_DEFUN([ACX_CHECK_SS_FAMILY], +[AC_CHECK_MEMBER([struct sockaddr_storage.ss_family], [], [ + AC_CHECK_MEMBER([struct sockaddr_storage.__ss_family], [ + AC_DEFINE([ss_family], [__ss_family], [Fallback member name for socket family in struct sockaddr_storage]) + ],, [AC_INCLUDES_DEFAULT +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + ]) +], [AC_INCLUDES_DEFAULT +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +]) ]) + +dnl End of file diff --git a/libs/ldns/acx_python.m4 b/libs/ldns/acx_python.m4 new file mode 100644 index 0000000000..f4bf421f86 --- /dev/null +++ b/libs/ldns/acx_python.m4 @@ -0,0 +1,200 @@ +AC_DEFUN([AC_PYTHON_DEVEL],[ + # + # Allow the use of a (user set) custom python version + # + AC_ARG_VAR([PYTHON_VERSION],[The installed Python + version to use, for example '2.3'. This string + will be appended to the Python interpreter + canonical name.]) + + AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) + if test -z "$PYTHON"; then + AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) + PYTHON_VERSION="" + fi + + if test -z "$PYTHON_VERSION"; then + PYTHON_VERSION=`$PYTHON -c "import sys, string; \ + print string.split(sys.version)[[0]]"` + fi + + # + # Check for a version of Python >= 2.1.0 + # + AC_MSG_CHECKING([for a version of Python >= '2.1.0']) + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[[0]]; \ + print ver >= '2.1.0'"` + if test "$ac_supports_python_ver" != "True"; then + if test -z "$PYTHON_NOVERSIONCHECK"; then + AC_MSG_RESULT([no]) + AC_MSG_FAILURE([ +This version of the AC@&t@_PYTHON_DEVEL macro +doesn't work properly with versions of Python before +2.1.0. You may need to re-run configure, setting the +variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, +PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. +Moreover, to disable this check, set PYTHON_NOVERSIONCHECK +to something else than an empty string. +]) + else + AC_MSG_RESULT([skip at user request]) + fi + else + AC_MSG_RESULT([yes]) + fi + + # + # if the macro parameter ``version'' is set, honour it + # + if test -n "$1"; then + AC_MSG_CHECKING([for a version of Python $1]) + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[[0]]; \ + print ver $1"` + if test "$ac_supports_python_ver" = "True"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([this package requires Python $1. +If you have it installed, but it isn't the default Python +interpreter in your system path, please pass the PYTHON_VERSION +variable to configure. See ``configure --help'' for reference. +]) + PYTHON_VERSION="" + fi + fi + + # + # Check if you have distutils, else fail + # + AC_MSG_CHECKING([for the distutils Python package]) + ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` + if test -z "$ac_distutils_result"; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + AC_MSG_ERROR([cannot import Python module "distutils". +Please check your Python installation. The error was: +$ac_distutils_result]) + PYTHON_VERSION="" + fi + + # + # Check for Python include path + # + AC_MSG_CHECKING([for Python include path]) + if test -z "$PYTHON_CPPFLAGS"; then + python_path=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_inc();"` + if test -n "${python_path}"; then + python_path="-I$python_path" + fi + PYTHON_CPPFLAGS=$python_path + fi + AC_MSG_RESULT([$PYTHON_CPPFLAGS]) + AC_SUBST([PYTHON_CPPFLAGS]) + + # + # Check for Python library path + # + AC_MSG_CHECKING([for Python library path]) + if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + py_version=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print join(get_config_vars('VERSION'))"` + if test "$py_version" = "[None]"; then + if test -n "$PYTHON_VERSION"; then + py_version=$PYTHON_VERSION + else + py_version=`$PYTHON -c "import sys; \ + print sys.version[[:3]]"` + fi + fi + + PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print '-L' + get_python_lib(0,1), \ + '-L' + os.path.dirname(get_python_lib(0,1)), \ + '-lpython';"`$py_version + fi + AC_MSG_RESULT([$PYTHON_LDFLAGS]) + AC_SUBST([PYTHON_LDFLAGS]) + + # + # Check for site packages + # + AC_MSG_CHECKING([for Python site-packages path]) + if test -z "$PYTHON_SITE_PKG"; then + PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_lib(0,0);"` + fi + AC_MSG_RESULT([$PYTHON_SITE_PKG]) + AC_SUBST([PYTHON_SITE_PKG]) + + # + # libraries which must be linked in when embedding + # + AC_MSG_CHECKING(python extra libraries) + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LOCALMODLIBS'), conf('LIBS')"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) + AC_SUBST(PYTHON_EXTRA_LIBS) + + # + # linking flags needed when embedding + # + AC_MSG_CHECKING(python extra linking flags) + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LINKFORSHARED')"` + fi + AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) + AC_SUBST(PYTHON_EXTRA_LDFLAGS) + + # + # final check to see if everything compiles alright + # + AC_MSG_CHECKING([consistency of all components of python development environment]) + AC_LANG_PUSH([C]) + # save current global flags + LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + AC_TRY_LINK([ + #include + ],[ + Py_Initialize(); + ],[pythonexists=yes],[pythonexists=no]) + + AC_MSG_RESULT([$pythonexists]) + + if test ! "$pythonexists" = "yes"; then + AC_MSG_ERROR([ + Could not link test program to Python. Maybe the main Python library has been + installed in some non-standard library path. If so, pass it to configure, + via the LDFLAGS environment variable. + Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" + ============================================================================ + ERROR! + You probably have to install the development version of the Python package + for your distribution. The exact name of this package varies among them. + ============================================================================ + ]) + PYTHON_VERSION="" + fi + AC_LANG_POP + # turn back to default flags + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + + # + # all done! + # +]) + diff --git a/libs/ldns/buffer.c b/libs/ldns/buffer.c new file mode 100644 index 0000000000..5a6b0ba74c --- /dev/null +++ b/libs/ldns/buffer.c @@ -0,0 +1,176 @@ +/* + * buffer.c -- generic memory buffer . + * + * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + */ + +#include + +#include +#include + +ldns_buffer * +ldns_buffer_new(size_t capacity) +{ + ldns_buffer *buffer = LDNS_MALLOC(ldns_buffer); + + if (!buffer) { + return NULL; + } + + buffer->_data = (uint8_t *) LDNS_XMALLOC(uint8_t, capacity); + if (!buffer->_data) { + LDNS_FREE(buffer); + return NULL; + } + + buffer->_position = 0; + buffer->_limit = buffer->_capacity = capacity; + buffer->_fixed = 0; + buffer->_status = LDNS_STATUS_OK; + + ldns_buffer_invariant(buffer); + + return buffer; +} + +void +ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t size) +{ + assert(data != NULL); + + buffer->_position = 0; + buffer->_limit = buffer->_capacity = size; + buffer->_fixed = 0; + buffer->_data = LDNS_XMALLOC(uint8_t, size); + if(!buffer->_data) { + buffer->_status = LDNS_STATUS_MEM_ERR; + return; + } + memcpy(buffer->_data, data, size); + buffer->_status = LDNS_STATUS_OK; + + ldns_buffer_invariant(buffer); +} + +bool +ldns_buffer_set_capacity(ldns_buffer *buffer, size_t capacity) +{ + void *data; + + ldns_buffer_invariant(buffer); + assert(buffer->_position <= capacity); + + data = (uint8_t *) LDNS_XREALLOC(buffer->_data, uint8_t, capacity); + if (!data) { + buffer->_status = LDNS_STATUS_MEM_ERR; + return false; + } else { + buffer->_data = data; + buffer->_limit = buffer->_capacity = capacity; + return true; + } +} + +bool +ldns_buffer_reserve(ldns_buffer *buffer, size_t amount) +{ + ldns_buffer_invariant(buffer); + assert(!buffer->_fixed); + if (buffer->_capacity < buffer->_position + amount) { + size_t new_capacity = buffer->_capacity * 3 / 2; + + if (new_capacity < buffer->_position + amount) { + new_capacity = buffer->_position + amount; + } + if (!ldns_buffer_set_capacity(buffer, new_capacity)) { + buffer->_status = LDNS_STATUS_MEM_ERR; + return false; + } + } + buffer->_limit = buffer->_capacity; + return true; +} + +int +ldns_buffer_printf(ldns_buffer *buffer, const char *format, ...) +{ + va_list args; + int written = 0; + size_t remaining; + + if (ldns_buffer_status_ok(buffer)) { + ldns_buffer_invariant(buffer); + assert(buffer->_limit == buffer->_capacity); + + remaining = ldns_buffer_remaining(buffer); + va_start(args, format); + written = vsnprintf((char *) ldns_buffer_current(buffer), remaining, + format, args); + va_end(args); + if (written == -1) { + buffer->_status = LDNS_STATUS_INTERNAL_ERR; + return -1; + } else if ((size_t) written >= remaining) { + if (!ldns_buffer_reserve(buffer, (size_t) written + 1)) { + buffer->_status = LDNS_STATUS_MEM_ERR; + return -1; + } + va_start(args, format); + written = vsnprintf((char *) ldns_buffer_current(buffer), + ldns_buffer_remaining(buffer), format, args); + va_end(args); + if (written == -1) { + buffer->_status = LDNS_STATUS_INTERNAL_ERR; + return -1; + } + } + buffer->_position += written; + } + return written; +} + +void +ldns_buffer_free(ldns_buffer *buffer) +{ + if (!buffer) { + return; + } + + LDNS_FREE(buffer->_data); + + LDNS_FREE(buffer); +} + +void * +ldns_buffer_export(ldns_buffer *buffer) +{ + buffer->_fixed = 1; + return buffer->_data; +} + +int +ldns_bgetc(ldns_buffer *buffer) +{ + if (!ldns_buffer_available_at(buffer, buffer->_position, sizeof(uint8_t))) { + ldns_buffer_set_position(buffer, ldns_buffer_limit(buffer)); + /* ldns_buffer_rewind(buffer);*/ + return EOF; + } + return (int)ldns_buffer_read_u8(buffer); +} + +void +ldns_buffer_copy(ldns_buffer* result, ldns_buffer* from) +{ + size_t tocopy = ldns_buffer_limit(from); + + if(tocopy > ldns_buffer_capacity(result)) + tocopy = ldns_buffer_capacity(result); + ldns_buffer_clear(result); + ldns_buffer_write(result, ldns_buffer_begin(from), tocopy); + ldns_buffer_flip(result); +} diff --git a/libs/ldns/compat/b32_ntop.c b/libs/ldns/compat/b32_ntop.c new file mode 100644 index 0000000000..038ebdc958 --- /dev/null +++ b/libs/ldns/compat/b32_ntop.c @@ -0,0 +1,333 @@ +/* + * Copyright (c) 1996, 1998 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. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ +#include + +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#include +#include +#include +#include + +#include + +static const char Base32[] = + "abcdefghijklmnopqrstuvwxyz234567"; +/* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/ +/* 00000000001111111111222222222233 + 01234567890123456789012345678901*/ +static const char Base32_extended_hex[] = +/* "0123456789ABCDEFGHIJKLMNOPQRSTUV";*/ + "0123456789abcdefghijklmnopqrstuv"; +static const char Pad32 = '='; + +/* (From RFC3548 and draft-josefsson-rfc3548bis-00.txt) +5. Base 32 Encoding + + The Base 32 encoding is designed to represent arbitrary sequences of + octets in a form that needs to be case insensitive but need not be + humanly readable. + + A 33-character subset of US-ASCII is used, enabling 5 bits to be + represented per printable character. (The extra 33rd character, "=", + is used to signify a special processing function.) + + The encoding process represents 40-bit groups of input bits as output + strings of 8 encoded characters. Proceeding from left to right, a + 40-bit input group is formed by concatenating 5 8bit input groups. + These 40 bits are then treated as 8 concatenated 5-bit groups, each + of which is translated into a single digit in the base 32 alphabet. + When encoding a bit stream via the base 32 encoding, the bit stream + must be presumed to be ordered with the most-significant-bit first. + That is, the first bit in the stream will be the high-order bit in + the first 8bit byte, and the eighth bit will be the low-order bit in + the first 8bit byte, and so on. + + Each 5-bit group is used as an index into an array of 32 printable + characters. The character referenced by the index is placed in the + output string. These characters, identified in Table 3, below, are + selected from US-ASCII digits and uppercase letters. + + Table 3: The Base 32 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 9 J 18 S 27 3 + 1 B 10 K 19 T 28 4 + 2 C 11 L 20 U 29 5 + 3 D 12 M 21 V 30 6 + 4 E 13 N 22 W 31 7 + 5 F 14 O 23 X + 6 G 15 P 24 Y (pad) = + 7 H 16 Q 25 Z + 8 I 17 R 26 2 + + + Special processing is performed if fewer than 40 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a body. When fewer than 40 input bits + are available in an input group, zero bits are added (on the right) + to form an integral number of 5-bit groups. Padding at the end of + the data is performed using the "=" character. Since all base 32 + 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 40 + bits; here, the final unit of encoded output will be an integral + multiple of 8 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 six + "=" padding characters, + + (3) the final quantum of encoding input is exactly 16 bits; here, the + final unit of encoded output will be four characters followed by four + "=" padding characters, + + (4) the final quantum of encoding input is exactly 24 bits; here, the + final unit of encoded output will be five characters followed by + three "=" padding characters, or + + (5) the final quantum of encoding input is exactly 32 bits; here, the + final unit of encoded output will be seven characters followed by one + "=" padding character. + + +6. Base 32 Encoding with Extended Hex Alphabet + + The following description of base 32 is due to [7]. This encoding + should not be regarded as the same as the "base32" encoding, and + should not be referred to as only "base32". + + One property with this alphabet, that the base64 and base32 alphabet + lack, is that encoded data maintain its sort order when the encoded + data is compared bit-wise. + + This encoding is identical to the previous one, except for the + alphabet. The new alphabet is found in table 4. + + Table 4: The "Extended Hex" Base 32 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 0 9 9 18 I 27 R + 1 1 10 A 19 J 28 S + 2 2 11 B 20 K 29 T + 3 3 12 C 21 L 30 U + 4 4 13 D 22 M 31 V + 5 5 14 E 23 N + 6 6 15 F 24 O (pad) = + 7 7 16 G 25 P + 8 8 17 H 26 Q + +*/ + + +int +ldns_b32_ntop_ar(uint8_t const *src, size_t srclength, char *target, size_t targsize, const char B32_ar[]) { + size_t datalength = 0; + uint8_t input[5]; + uint8_t output[8]; + size_t i; + memset(output, 0, 8); + + while (4 < srclength) { + input[0] = *src++; + input[1] = *src++; + input[2] = *src++; + input[3] = *src++; + input[4] = *src++; + srclength -= 5; + + output[0] = (input[0] & 0xf8) >> 3; + output[1] = ((input[0] & 0x07) << 2) + ((input[1] & 0xc0) >> 6); + output[2] = (input[1] & 0x3e) >> 1; + output[3] = ((input[1] & 0x01) << 4) + ((input[2] & 0xf0) >> 4); + output[4] = ((input[2] & 0x0f) << 1) + ((input[3] & 0x80) >> 7); + output[5] = (input[3] & 0x7c) >> 2; + output[6] = ((input[3] & 0x03) << 3) + ((input[4] & 0xe0) >> 5); + output[7] = (input[4] & 0x1f); + + assert(output[0] < 32); + assert(output[1] < 32); + assert(output[2] < 32); + assert(output[3] < 32); + assert(output[4] < 32); + assert(output[5] < 32); + assert(output[6] < 32); + assert(output[7] < 32); + + if (datalength + 8 > targsize) { + return (-1); + } + target[datalength++] = B32_ar[output[0]]; + target[datalength++] = B32_ar[output[1]]; + target[datalength++] = B32_ar[output[2]]; + target[datalength++] = B32_ar[output[3]]; + target[datalength++] = B32_ar[output[4]]; + target[datalength++] = B32_ar[output[5]]; + target[datalength++] = B32_ar[output[6]]; + target[datalength++] = B32_ar[output[7]]; + } + + /* Now we worry about padding. */ + if (0 != srclength) { + /* Get what's left. */ + input[0] = input[1] = input[2] = input[3] = input[4] = (uint8_t) '\0'; + for (i = 0; i < srclength; i++) + input[i] = *src++; + + output[0] = (input[0] & 0xf8) >> 3; + assert(output[0] < 32); + if (srclength >= 1) { + output[1] = ((input[0] & 0x07) << 2) + ((input[1] & 0xc0) >> 6); + assert(output[1] < 32); + output[2] = (input[1] & 0x3e) >> 1; + assert(output[2] < 32); + } + if (srclength >= 2) { + output[3] = ((input[1] & 0x01) << 4) + ((input[2] & 0xf0) >> 4); + assert(output[3] < 32); + } + if (srclength >= 3) { + output[4] = ((input[2] & 0x0f) << 1) + ((input[3] & 0x80) >> 7); + assert(output[4] < 32); + output[5] = (input[3] & 0x7c) >> 2; + assert(output[5] < 32); + } + if (srclength >= 4) { + output[6] = ((input[3] & 0x03) << 3) + ((input[4] & 0xe0) >> 5); + assert(output[6] < 32); + } + + + if (datalength + 1 > targsize) { + return (-2); + } + target[datalength++] = B32_ar[output[0]]; + if (srclength >= 1) { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = B32_ar[output[1]]; + if (srclength == 1 && output[2] == 0) { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + } else { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = B32_ar[output[2]]; + } + } else { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + } + if (srclength >= 2) { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = B32_ar[output[3]]; + } else { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + } + if (srclength >= 3) { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = B32_ar[output[4]]; + if (srclength == 3 && output[5] == 0) { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + } else { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = B32_ar[output[5]]; + } + } else { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + } + if (srclength >= 4) { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = B32_ar[output[6]]; + } else { + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + } + if (datalength + 1 > targsize) { return (-2); } + target[datalength++] = Pad32; + } + if (datalength+1 > targsize) { + return (int) (datalength); + } + target[datalength] = '\0'; /* Returned value doesn't count \0. */ + return (int) (datalength); +} + +int +ldns_b32_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { + return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32); +} + +/* deprecated, here for backwards compatibility */ +int +b32_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { + return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32); +} + +int +ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize) { + return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32_extended_hex); +} + +/* deprecated, here for backwards compatibility */ +int +b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize) { + return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32_extended_hex); +} + diff --git a/libs/ldns/compat/b32_pton.c b/libs/ldns/compat/b32_pton.c new file mode 100644 index 0000000000..9c261e615b --- /dev/null +++ b/libs/ldns/compat/b32_pton.c @@ -0,0 +1,387 @@ +/* + * Copyright (c) 1996, 1998 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. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ +#include + +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#include +#include +#include +#include + +/* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/ +static const char Base32[] = + "abcdefghijklmnopqrstuvwxyz234567"; +/* "0123456789ABCDEFGHIJKLMNOPQRSTUV";*/ +static const char Base32_extended_hex[] = + "0123456789abcdefghijklmnopqrstuv"; +static const char Pad32 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) +5. Base 32 Encoding + + The Base 32 encoding is designed to represent arbitrary sequences of + octets in a form that needs to be case insensitive but need not be + humanly readable. + + A 33-character subset of US-ASCII is used, enabling 5 bits to be + represented per printable character. (The extra 33rd character, "=", + is used to signify a special processing function.) + + The encoding process represents 40-bit groups of input bits as output + strings of 8 encoded characters. Proceeding from left to right, a + 40-bit input group is formed by concatenating 5 8bit input groups. + These 40 bits are then treated as 8 concatenated 5-bit groups, each + of which is translated into a single digit in the base 32 alphabet. + When encoding a bit stream via the base 32 encoding, the bit stream + must be presumed to be ordered with the most-significant-bit first. + That is, the first bit in the stream will be the high-order bit in + the first 8bit byte, and the eighth bit will be the low-order bit in + the first 8bit byte, and so on. + + Each 5-bit group is used as an index into an array of 32 printable + characters. The character referenced by the index is placed in the + output string. These characters, identified in Table 3, below, are + selected from US-ASCII digits and uppercase letters. + + Table 3: The Base 32 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 9 J 18 S 27 3 + 1 B 10 K 19 T 28 4 + 2 C 11 L 20 U 29 5 + 3 D 12 M 21 V 30 6 + 4 E 13 N 22 W 31 7 + 5 F 14 O 23 X + 6 G 15 P 24 Y (pad) = + 7 H 16 Q 25 Z + 8 I 17 R 26 2 + + + Special processing is performed if fewer than 40 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a body. When fewer than 40 input bits + are available in an input group, zero bits are added (on the right) + to form an integral number of 5-bit groups. Padding at the end of + the data is performed using the "=" character. Since all base 32 + 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 40 + bits; here, the final unit of encoded output will be an integral + multiple of 8 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 six + "=" padding characters, + + (3) the final quantum of encoding input is exactly 16 bits; here, the + final unit of encoded output will be four characters followed by four + "=" padding characters, + + (4) the final quantum of encoding input is exactly 24 bits; here, the + final unit of encoded output will be five characters followed by + three "=" padding characters, or + + (5) the final quantum of encoding input is exactly 32 bits; here, the + final unit of encoded output will be seven characters followed by one + "=" padding character. + + +6. Base 32 Encoding with Extended Hex Alphabet + + The following description of base 32 is due to [7]. This encoding + should not be regarded as the same as the "base32" encoding, and + should not be referred to as only "base32". + + One property with this alphabet, that the base32 and base32 alphabet + lack, is that encoded data maintain its sort order when the encoded + data is compared bit-wise. + + This encoding is identical to the previous one, except for the + alphabet. The new alphabet is found in table 4. + + Table 4: The "Extended Hex" Base 32 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 0 9 9 18 I 27 R + 1 1 10 A 19 J 28 S + 2 2 11 B 20 K 29 T + 3 3 12 C 21 L 30 U + 4 4 13 D 22 M 31 V + 5 5 14 E 23 N + 6 6 15 F 24 O (pad) = + 7 7 16 G 25 P + 8 8 17 H 26 Q + + + + +*/ +/* skips all whitespace anywhere. + converts characters, four at a time, starting at (or after) + src from base - 32 numbers into three 8 bit bytes in the target area. + it returns the number of data bytes stored at the target, or -1 on error. + */ + +int +ldns_b32_pton_ar(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize, const char B32_ar[]) +{ + int tarindex, state, ch; + char *pos; + int i = 0; + + state = 0; + tarindex = 0; + + while ((ch = *src++) != '\0' && (i == 0 || i < (int) hashed_owner_str_len)) { + i++; + ch = tolower(ch); + if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ + continue; + + if (ch == Pad32) + break; + + pos = strchr(B32_ar, ch); + if (pos == 0) { + /* A non-base32 character. */ + return (-ch); + } + + switch (state) { + case 0: + if (target) { + if ((size_t)tarindex >= targsize) { + return (-2); + } + target[tarindex] = (pos - B32_ar) << 3; + } + state = 1; + break; + case 1: + if (target) { + if ((size_t)tarindex + 1 >= targsize) { + return (-3); + } + target[tarindex] |= (pos - B32_ar) >> 2; + target[tarindex+1] = ((pos - B32_ar) & 0x03) + << 6 ; + } + tarindex++; + state = 2; + break; + case 2: + if (target) { + if ((size_t)tarindex + 1 >= targsize) { + return (-4); + } + target[tarindex] |= (pos - B32_ar) << 1; + } + /*tarindex++;*/ + state = 3; + break; + case 3: + if (target) { + if ((size_t)tarindex + 1 >= targsize) { + return (-5); + } + target[tarindex] |= (pos - B32_ar) >> 4; + target[tarindex+1] = ((pos - B32_ar) & 0x0f) << 4 ; + } + tarindex++; + state = 4; + break; + case 4: + if (target) { + if ((size_t)tarindex + 1 >= targsize) { + return (-6); + } + target[tarindex] |= (pos - B32_ar) >> 1; + target[tarindex+1] = ((pos - B32_ar) & 0x01) + << 7 ; + } + tarindex++; + state = 5; + break; + case 5: + if (target) { + if ((size_t)tarindex + 1 >= targsize) { + return (-7); + } + target[tarindex] |= (pos - B32_ar) << 2; + } + state = 6; + break; + case 6: + if (target) { + if ((size_t)tarindex + 1 >= targsize) { + return (-8); + } + target[tarindex] |= (pos - B32_ar) >> 3; + target[tarindex+1] = ((pos - B32_ar) & 0x07) + << 5 ; + } + tarindex++; + state = 7; + break; + case 7: + if (target) { + if ((size_t)tarindex + 1 >= targsize) { + return (-9); + } + target[tarindex] |= (pos - B32_ar); + } + tarindex++; + state = 0; + break; + default: + abort(); + } + } + + /* + * We are done decoding Base-32 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad32) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-10); + + case 2: /* Valid, means one byte of info */ + case 3: + /* Skip any number of spaces. */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace((unsigned char)ch)) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad32) { + return (-11); + } + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 4: /* Valid, means two bytes of info */ + case 5: + case 6: + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!(isspace((unsigned char)ch) || ch == '=')) { + return (-12); + } + + case 7: /* Valid, means three bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace((unsigned char)ch)) { + return (-13); + } + + /* + * Now make sure for cases 2 and 3 that the "extra" + * bits that slopped past the last full byte were + * zeros. If we don't check them, they become a + * subliminal channel. + */ + if (target && target[tarindex] != 0) { + return (-14); + } + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-15); + } + + return (tarindex); +} + +int +ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) +{ + return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32); +} + +/* deprecated, here for backwards compatibility */ +int +b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) +{ + return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32); +} + +int +ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) +{ + return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex); +} + +/* deprecated, here for backwards compatibility */ +int +b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) +{ + return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex); +} diff --git a/libs/ldns/compat/b64_ntop.c b/libs/ldns/compat/b64_ntop.c new file mode 100644 index 0000000000..d0b52b514b --- /dev/null +++ b/libs/ldns/compat/b64_ntop.c @@ -0,0 +1,202 @@ +/* + * Copyright (c) 1996, 1998 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. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ +#include + +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#include +#include +#include +#include + +#define Assert(Cond) if (!(Cond)) abort() + +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char Pad64 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + The following encoding technique is taken from RFC 1521 by Borenstein + and Freed. It is reproduced here in a slightly 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 base64 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. + + Table 1: The Base64 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 base64 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 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. + */ + +int +ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { + size_t datalength = 0; + uint8_t input[3]; + uint8_t output[4]; + size_t i; + + if (srclength == 0) { + if (targsize > 0) { + target[0] = '\0'; + return 0; + } else { + return -1; + } + } + + while (2 < srclength) { + input[0] = *src++; + input[1] = *src++; + input[2] = *src++; + srclength -= 3; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + output[3] = input[2] & 0x3f; + Assert(output[0] < 64); + Assert(output[1] < 64); + Assert(output[2] < 64); + Assert(output[3] < 64); + + if (datalength + 4 > targsize) { + return (-1); + } + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + target[datalength++] = Base64[output[2]]; + target[datalength++] = Base64[output[3]]; + } + + /* Now we worry about padding. */ + if (0 != srclength) { + /* Get what's left. */ + input[0] = input[1] = input[2] = (uint8_t) '\0'; + for (i = 0; i < srclength; i++) + input[i] = *src++; + + output[0] = input[0] >> 2; + output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); + output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); + Assert(output[0] < 64); + Assert(output[1] < 64); + Assert(output[2] < 64); + + if (datalength + 4 > targsize) { + return (-2); + } + target[datalength++] = Base64[output[0]]; + target[datalength++] = Base64[output[1]]; + if (srclength == 1) { + target[datalength++] = Pad64; + } else { + target[datalength++] = Base64[output[2]]; + } + target[datalength++] = Pad64; + } + if (datalength >= targsize) { + return (-3); + } + target[datalength] = '\0'; /* Returned value doesn't count \0. */ + return (int) (datalength); +} diff --git a/libs/ldns/compat/b64_pton.c b/libs/ldns/compat/b64_pton.c new file mode 100644 index 0000000000..aa637d2275 --- /dev/null +++ b/libs/ldns/compat/b64_pton.c @@ -0,0 +1,260 @@ +/* + * Copyright (c) 1996, 1998 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. + */ + +/* + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + */ +#include + +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#include +#include +#include +#include + +#define Assert(Cond) if (!(Cond)) abort() + +static const char Base64[] = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; +static const char Pad64 = '='; + +/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) + The following encoding technique is taken from RFC 1521 by Borenstein + and Freed. It is reproduced here in a slightly 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 base64 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. + + Table 1: The Base64 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 base64 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 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. + */ + +/* skips all whitespace anywhere. + converts characters, four at a time, starting at (or after) + src from base - 64 numbers into three 8 bit bytes in the target area. + it returns the number of data bytes stored at the target, or -1 on error. + */ + +int +ldns_b64_pton(char const *src, uint8_t *target, size_t targsize) +{ + int tarindex, state, ch; + char *pos; + + state = 0; + tarindex = 0; + + if (strlen(src) == 0) { + return 0; + } + + while ((ch = *src++) != '\0') { + if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ + continue; + + if (ch == Pad64) + break; + + pos = strchr(Base64, ch); + if (pos == 0) { + /* A non-base64 character. */ + return (-1); + } + + switch (state) { + case 0: + if (target) { + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] = (pos - Base64) << 2; + } + state = 1; + break; + case 1: + if (target) { + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 4; + target[tarindex+1] = ((pos - Base64) & 0x0f) + << 4 ; + } + tarindex++; + state = 2; + break; + case 2: + if (target) { + if ((size_t)tarindex + 1 >= targsize) + return (-1); + target[tarindex] |= (pos - Base64) >> 2; + target[tarindex+1] = ((pos - Base64) & 0x03) + << 6; + } + tarindex++; + state = 3; + break; + case 3: + if (target) { + if ((size_t)tarindex >= targsize) + return (-1); + target[tarindex] |= (pos - Base64); + } + tarindex++; + state = 0; + break; + default: + abort(); + } + } + + /* + * We are done decoding Base-64 chars. Let's see if we ended + * on a byte boundary, and/or with erroneous trailing characters. + */ + + if (ch == Pad64) { /* We got a pad char. */ + ch = *src++; /* Skip it, get next. */ + switch (state) { + case 0: /* Invalid = in first position */ + case 1: /* Invalid = in second position */ + return (-1); + + case 2: /* Valid, means one byte of info */ + /* Skip any number of spaces. */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace((unsigned char)ch)) + break; + /* Make sure there is another trailing = sign. */ + if (ch != Pad64) + return (-1); + ch = *src++; /* Skip the = */ + /* Fall through to "single trailing =" case. */ + /* FALLTHROUGH */ + + case 3: /* Valid, means two bytes of info */ + /* + * We know this char is an =. Is there anything but + * whitespace after it? + */ + for ((void)NULL; ch != '\0'; ch = *src++) + if (!isspace((unsigned char)ch)) + return (-1); + + /* + * Now make sure for cases 2 and 3 that the "extra" + * bits that slopped past the last full byte were + * zeros. If we don't check them, they become a + * subliminal channel. + */ + if (target && target[tarindex] != 0) + return (-1); + } + } else { + /* + * We ended by seeing the end of the string. Make sure we + * have no partial bytes lying around. + */ + if (state != 0) + return (-1); + } + + return (tarindex); +} diff --git a/libs/ldns/compat/ctime_r.c b/libs/ldns/compat/ctime_r.c new file mode 100644 index 0000000000..4ffd8b7e35 --- /dev/null +++ b/libs/ldns/compat/ctime_r.c @@ -0,0 +1,16 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +char *ctime_r(const time_t *timep, char *buf) +{ + /* no thread safety. */ + char* result = ctime(timep); + if(buf && result) + strcpy(buf, result); + return result; +} diff --git a/libs/ldns/compat/fake-rfc2553.c b/libs/ldns/compat/fake-rfc2553.c new file mode 100644 index 0000000000..431e04a215 --- /dev/null +++ b/libs/ldns/compat/fake-rfc2553.c @@ -0,0 +1,229 @@ +/* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */ +/* + * Copyright (C) 2000-2003 Damien Miller. All rights reserved. + * Copyright (C) 1999 WIDE Project. 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. Neither the name of the project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Pseudo-implementation of RFC2553 name / address resolution functions + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For example, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + */ + +#include +#include +#include +#include +#include +#include +#include "compat/fake-rfc2553.h" + +#ifndef HAVE_GETNAMEINFO +int getnameinfo(const struct sockaddr *sa, size_t ATTR_UNUSED(salen), char *host, + size_t hostlen, char *serv, size_t servlen, int flags) +{ + struct sockaddr_in *sin = (struct sockaddr_in *)sa; + struct hostent *hp; + char tmpserv[16]; + + if (serv != NULL) { + snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port)); + if (strlcpy(serv, tmpserv, servlen) >= servlen) + return (EAI_MEMORY); + } + + if (host != NULL) { + if (flags & NI_NUMERICHOST) { + if (strlcpy(host, inet_ntoa(sin->sin_addr), + hostlen) >= hostlen) + return (EAI_MEMORY); + else + return (0); + } else { + hp = gethostbyaddr((char *)&sin->sin_addr, + sizeof(struct in_addr), AF_INET); + if (hp == NULL) + return (EAI_NODATA); + + if (strlcpy(host, hp->h_name, hostlen) >= hostlen) + return (EAI_MEMORY); + else + return (0); + } + } + return (0); +} +#endif /* !HAVE_GETNAMEINFO */ + +#ifndef HAVE_GAI_STRERROR +#ifdef HAVE_CONST_GAI_STRERROR_PROTO +const char * +#else +char * +#endif +gai_strerror(int err) +{ + switch (err) { + case EAI_NODATA: + return ("no address associated with name"); + case EAI_MEMORY: + return ("memory allocation failure."); + case EAI_NONAME: + return ("nodename nor servname provided, or not known"); + default: + return ("unknown/invalid error."); + } +} +#endif /* !HAVE_GAI_STRERROR */ + +#ifndef HAVE_FREEADDRINFO +void +freeaddrinfo(struct addrinfo *ai) +{ + struct addrinfo *next; + + for(; ai != NULL;) { + next = ai->ai_next; + free(ai); + ai = next; + } +} +#endif /* !HAVE_FREEADDRINFO */ + +#ifndef HAVE_GETADDRINFO +static struct +addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints) +{ + struct addrinfo *ai; + + ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in)); + if (ai == NULL) + return (NULL); + + memset(ai, '\0', sizeof(*ai) + sizeof(struct sockaddr_in)); + + ai->ai_addr = (struct sockaddr *)(ai + 1); + /* XXX -- ssh doesn't use sa_len */ + ai->ai_addrlen = sizeof(struct sockaddr_in); + ai->ai_addr->sa_family = ai->ai_family = AF_INET; + + ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; + ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; + + /* XXX: the following is not generally correct, but does what we want */ + if (hints->ai_socktype) + ai->ai_socktype = hints->ai_socktype; + else + ai->ai_socktype = SOCK_STREAM; + + if (hints->ai_protocol) + ai->ai_protocol = hints->ai_protocol; + + return (ai); +} + +int +getaddrinfo(const char *hostname, const char *servname, + const struct addrinfo *hints, struct addrinfo **res) +{ + struct hostent *hp; + struct servent *sp; + struct in_addr in; + int i; + long int port; + u_long addr; + + port = 0; + if (servname != NULL) { + char *cp; + + port = strtol(servname, &cp, 10); + if (port > 0 && port <= 65535 && *cp == '\0') + port = htons(port); + else if ((sp = getservbyname(servname, NULL)) != NULL) + port = sp->s_port; + else + port = 0; + } + + if (hints && hints->ai_flags & AI_PASSIVE) { + addr = htonl(0x00000000); + if (hostname && inet_aton(hostname, &in) != 0) + addr = in.s_addr; + *res = malloc_ai(port, addr, hints); + if (*res == NULL) + return (EAI_MEMORY); + return (0); + } + + if (!hostname) { + *res = malloc_ai(port, htonl(0x7f000001), hints); + if (*res == NULL) + return (EAI_MEMORY); + return (0); + } + + if (inet_aton(hostname, &in)) { + *res = malloc_ai(port, in.s_addr, hints); + if (*res == NULL) + return (EAI_MEMORY); + return (0); + } + + /* Don't try DNS if AI_NUMERICHOST is set */ + if (hints && hints->ai_flags & AI_NUMERICHOST) + return (EAI_NONAME); + + hp = gethostbyname(hostname); + if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { + struct addrinfo *cur, *prev; + + cur = prev = *res = NULL; + for (i = 0; hp->h_addr_list[i]; i++) { + struct in_addr *in = (struct in_addr *)hp->h_addr_list[i]; + + cur = malloc_ai(port, in->s_addr, hints); + if (cur == NULL) { + if (*res != NULL) + freeaddrinfo(*res); + return (EAI_MEMORY); + } + if (prev) + prev->ai_next = cur; + else + *res = cur; + + prev = cur; + } + return (0); + } + + return (EAI_NODATA); +} +#endif /* !HAVE_GETADDRINFO */ diff --git a/libs/ldns/compat/fake-rfc2553.h b/libs/ldns/compat/fake-rfc2553.h new file mode 100644 index 0000000000..4c277ee902 --- /dev/null +++ b/libs/ldns/compat/fake-rfc2553.h @@ -0,0 +1,183 @@ +/* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */ +/* + * Copyright (C) 2000-2003 Damien Miller. All rights reserved. + * Copyright (C) 1999 WIDE Project. 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. Neither the name of the project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Pseudo-implementation of RFC2553 name / address resolution functions + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For example, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + */ + +#ifndef _FAKE_RFC2553_H +#define _FAKE_RFC2553_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * First, socket and INET6 related definitions + */ +#ifndef HAVE_STRUCT_SOCKADDR_STORAGE +#ifndef _SS_MAXSIZE +# define _SS_MAXSIZE 128 /* Implementation specific max size */ +# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) +struct sockaddr_storage { + struct sockaddr ss_sa; + char __ss_pad2[_SS_PADSIZE]; +}; +# define ss_family ss_sa.sa_family +#endif /* _SS_MAXSIZE */ +#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ + +#ifndef IN6_IS_ADDR_LOOPBACK +# define IN6_IS_ADDR_LOOPBACK(a) \ + (((uint32_t *)(a))[0] == 0 && ((uint32_t *)(a))[1] == 0 && \ + ((uint32_t *)(a))[2] == 0 && ((uint32_t *)(a))[3] == htonl(1)) +#endif /* !IN6_IS_ADDR_LOOPBACK */ + +#ifndef HAVE_STRUCT_IN6_ADDR +struct in6_addr { + uint8_t s6_addr[16]; +}; +#endif /* !HAVE_STRUCT_IN6_ADDR */ + +#ifndef HAVE_STRUCT_SOCKADDR_IN6 +struct sockaddr_in6 { + unsigned short sin6_family; + uint16_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; +}; +#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ + +#ifndef AF_INET6 +/* Define it to something that should never appear */ +#define AF_INET6 AF_MAX +#endif + +/* + * Next, RFC2553 name / address resolution API + */ + +#ifndef NI_NUMERICHOST +# define NI_NUMERICHOST (1) +#endif +#ifndef NI_NAMEREQD +# define NI_NAMEREQD (1<<1) +#endif +#ifndef NI_NUMERICSERV +# define NI_NUMERICSERV (1<<2) +#endif + +#ifndef AI_PASSIVE +# define AI_PASSIVE (1) +#endif +#ifndef AI_CANONNAME +# define AI_CANONNAME (1<<1) +#endif +#ifndef AI_NUMERICHOST +# define AI_NUMERICHOST (1<<2) +#endif + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif /* !NI_MAXSERV */ +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif /* !NI_MAXHOST */ + +#ifndef INT_MAX +#define INT_MAX 0xffffffff +#endif + +#ifndef EAI_NODATA +# define EAI_NODATA (INT_MAX - 1) +#endif +#ifndef EAI_MEMORY +# define EAI_MEMORY (INT_MAX - 2) +#endif +#ifndef EAI_NONAME +# define EAI_NONAME (INT_MAX - 3) +#endif +#ifndef EAI_SYSTEM +# define EAI_SYSTEM (INT_MAX - 4) +#endif + +#ifndef HAVE_STRUCT_ADDRINFO +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +#endif /* !HAVE_STRUCT_ADDRINFO */ + +#ifndef HAVE_GETADDRINFO +#ifdef getaddrinfo +# undef getaddrinfo +#endif +#define getaddrinfo(a,b,c,d) (ssh_getaddrinfo(a,b,c,d)) +int getaddrinfo(const char *, const char *, + const struct addrinfo *, struct addrinfo **); +#endif /* !HAVE_GETADDRINFO */ + +#if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO) +#define gai_strerror(a) (ssh_gai_strerror(a)) +char *gai_strerror(int); +#endif /* !HAVE_GAI_STRERROR */ + +#ifndef HAVE_FREEADDRINFO +#define freeaddrinfo(a) (ssh_freeaddrinfo(a)) +void freeaddrinfo(struct addrinfo *); +#endif /* !HAVE_FREEADDRINFO */ + +#ifndef HAVE_GETNAMEINFO +#define getnameinfo(a,b,c,d,e,f,g) (ssh_getnameinfo(a,b,c,d,e,f,g)) +int getnameinfo(const struct sockaddr *, size_t, char *, size_t, + char *, size_t, int); +#endif /* !HAVE_GETNAMEINFO */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_FAKE_RFC2553_H */ + diff --git a/libs/ldns/compat/gmtime_r.c b/libs/ldns/compat/gmtime_r.c new file mode 100644 index 0000000000..7062e7dee3 --- /dev/null +++ b/libs/ldns/compat/gmtime_r.c @@ -0,0 +1,14 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +struct tm *gmtime_r(const time_t *timep, struct tm *result) +{ + /* no thread safety. */ + *result = *gmtime(timep); + return result; +} diff --git a/libs/ldns/compat/inet_aton.c b/libs/ldns/compat/inet_aton.c new file mode 100644 index 0000000000..e8c3a57b9a --- /dev/null +++ b/libs/ldns/compat/inet_aton.c @@ -0,0 +1,182 @@ +/* From openssh4.3p2 compat/inet_aton.c */ +/* + * Copyright (c) 1983, 1990, 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. 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. + * - + * --Copyright-- + */ + +/* OPENBSD ORIGINAL: lib/libc/net/inet_addr.c */ + +#include + +#if !defined(HAVE_INET_ATON) + +#include +#include +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#include + +#if 0 +/* + * Ascii internet address interpretation routine. + * The value returned is in network order. + */ +in_addr_t +inet_addr(const char *cp) +{ + struct in_addr val; + + if (inet_aton(cp, &val)) + return (val.s_addr); + return (INADDR_NONE); +} +#endif + +/* + * Check whether "cp" is a valid ascii representation + * of an Internet address and convert to a binary address. + * Returns 1 if the address is valid, 0 if not. + * This replaces inet_addr, the return value from which + * cannot distinguish between failure and a local broadcast address. + */ +int +inet_aton(const char *cp, struct in_addr *addr) +{ + uint32_t val; + int base, n; + char c; + unsigned int parts[4]; + unsigned int *pp = parts; + + c = *cp; + for (;;) { + /* + * Collect number up to ``.''. + * Values are specified as for C: + * 0x=hex, 0=octal, isdigit=decimal. + */ + if (!isdigit((int) c)) + return (0); + val = 0; base = 10; + if (c == '0') { + c = *++cp; + if (c == 'x' || c == 'X') + base = 16, c = *++cp; + else + base = 8; + } + for (;;) { + if (isascii((int) c) && isdigit((int) c)) { + val = (val * base) + (c - '0'); + c = *++cp; + } else if (base == 16 && isascii((int) c) && isxdigit((int) c)) { + val = (val << 4) | + (c + 10 - (islower((int) c) ? 'a' : 'A')); + c = *++cp; + } else + break; + } + if (c == '.') { + /* + * Internet format: + * a.b.c.d + * a.b.c (with c treated as 16 bits) + * a.b (with b treated as 24 bits) + */ + if (pp >= parts + 3) + return (0); + *pp++ = val; + c = *++cp; + } else + break; + } + /* + * Check for trailing characters. + */ + if (c != '\0' && (!isascii((int) c) || !isspace((int) c))) + return (0); + /* + * Concoct the address according to + * the number of parts specified. + */ + n = pp - parts + 1; + switch (n) { + + case 0: + return (0); /* initial nondigit */ + + case 1: /* a -- 32 bits */ + break; + + case 2: /* a.b -- 8.24 bits */ + if ((val > 0xffffff) || (parts[0] > 0xff)) + return (0); + val |= parts[0] << 24; + break; + + case 3: /* a.b.c -- 8.8.16 bits */ + if ((val > 0xffff) || (parts[0] > 0xff) || (parts[1] > 0xff)) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16); + break; + + case 4: /* a.b.c.d -- 8.8.8.8 bits */ + if ((val > 0xff) || (parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff)) + return (0); + val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); + break; + } + if (addr) + addr->s_addr = htonl(val); + return (1); +} + +#endif /* !defined(HAVE_INET_ATON) */ diff --git a/libs/ldns/compat/inet_ntop.c b/libs/ldns/compat/inet_ntop.c new file mode 100644 index 0000000000..57509c7c98 --- /dev/null +++ b/libs/ldns/compat/inet_ntop.c @@ -0,0 +1,216 @@ +/* From openssh 4.3p2 compat/inet_ntop.c */ +/* Copyright (c) 1996 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. + */ + +/* OPENBSD ORIGINAL: lib/libc/net/inet_ntop.c */ + +#include + +#ifndef HAVE_INET_NTOP + +#include +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#include +#include +#include + +#ifndef IN6ADDRSZ +#define IN6ADDRSZ 16 /* IPv6 T_AAAA */ +#endif + +#ifndef INT16SZ +#define INT16SZ 2 /* for systems without 16-bit ints */ +#endif + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static const char *inet_ntop4(const u_char *src, char *dst, size_t size); +static const char *inet_ntop6(const u_char *src, char *dst, size_t size); + +/* char * + * inet_ntop(af, src, dst, size) + * convert a network format address to presentation format. + * return: + * pointer to presentation format address (`dst'), or NULL (see errno). + * author: + * Paul Vixie, 1996. + */ +const char * +inet_ntop(int af, const void *src, char *dst, size_t size) +{ + switch (af) { + case AF_INET: + return (inet_ntop4(src, dst, size)); + case AF_INET6: + return (inet_ntop6(src, dst, size)); + default: +#ifdef EAFNOSUPPORT + errno = EAFNOSUPPORT; +#else + errno = ENOSYS; +#endif + return (NULL); + } + /* NOTREACHED */ +} + +/* const char * + * inet_ntop4(src, dst, size) + * format an IPv4 address, more or less like inet_ntoa() + * return: + * `dst' (as a const) + * notes: + * (1) uses no statics + * (2) takes a u_char* not an in_addr as input + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop4(const u_char *src, char *dst, size_t size) +{ + static const char fmt[] = "%u.%u.%u.%u"; + char tmp[sizeof "255.255.255.255"]; + int l; + + l = snprintf(tmp, size, fmt, src[0], src[1], src[2], src[3]); + if (l <= 0 || l >= (int)size) { + errno = ENOSPC; + return (NULL); + } + strlcpy(dst, tmp, size); + return (dst); +} + +/* const char * + * inet_ntop6(src, dst, size) + * convert IPv6 binary address into presentation (printable) format + * author: + * Paul Vixie, 1996. + */ +static const char * +inet_ntop6(const u_char *src, char *dst, size_t size) +{ + /* + * Note that int32_t and int16_t need only be "at least" large enough + * to contain a value of the specified size. On some systems, like + * Crays, there is no such thing as an integer variable with 16 bits. + * Keep this in mind if you think this function should have been coded + * to use pointer overlays. All the world's not a VAX. + */ + char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"]; + char *tp, *ep; + struct { int base, len; } best, cur; + u_int words[IN6ADDRSZ / INT16SZ]; + int i; + int advance; + + /* + * Preprocess: + * Copy the input (bytewise) array into a wordwise array. + * Find the longest run of 0x00's in src[] for :: shorthanding. + */ + memset(words, '\0', sizeof words); + for (i = 0; i < IN6ADDRSZ; i++) + words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); + best.base = -1; + cur.base = -1; + for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { + if (words[i] == 0) { + if (cur.base == -1) + cur.base = i, cur.len = 1; + else + cur.len++; + } else { + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + cur.base = -1; + } + } + } + if (cur.base != -1) { + if (best.base == -1 || cur.len > best.len) + best = cur; + } + if (best.base != -1 && best.len < 2) + best.base = -1; + + /* + * Format the result. + */ + tp = tmp; + ep = tmp + sizeof(tmp); + for (i = 0; i < (IN6ADDRSZ / INT16SZ) && tp < ep; i++) { + /* Are we inside the best run of 0x00's? */ + if (best.base != -1 && i >= best.base && + i < (best.base + best.len)) { + if (i == best.base) { + if (tp + 1 >= ep) + return (NULL); + *tp++ = ':'; + } + continue; + } + /* Are we following an initial run of 0x00s or any real hex? */ + if (i != 0) { + if (tp + 1 >= ep) + return (NULL); + *tp++ = ':'; + } + /* Is this address an encapsulated IPv4? */ + if (i == 6 && best.base == 0 && + (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { + if (!inet_ntop4(src+12, tp, (size_t)(ep - tp))) + return (NULL); + tp += strlen(tp); + break; + } + advance = snprintf(tp, ep - tp, "%x", words[i]); + if (advance <= 0 || advance >= ep - tp) + return (NULL); + tp += advance; + } + /* Was it a trailing run of 0x00's? */ + if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) { + if (tp + 1 >= ep) + return (NULL); + *tp++ = ':'; + } + if (tp + 1 >= ep) + return (NULL); + *tp++ = '\0'; + + /* + * Check for overflow, copy, and we're done. + */ + if ((size_t)(tp - tmp) > size) { + errno = ENOSPC; + return (NULL); + } + strlcpy(dst, tmp, size); + return (dst); +} + +#endif /* !HAVE_INET_NTOP */ diff --git a/libs/ldns/compat/inet_pton.c b/libs/ldns/compat/inet_pton.c new file mode 100644 index 0000000000..7a4f57614f --- /dev/null +++ b/libs/ldns/compat/inet_pton.c @@ -0,0 +1,230 @@ +/* $KAME: inet_pton.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ + +/* Copyright (c) 1996 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. + */ + +#include + +#include +#include +#include + +/* + * WARNING: Don't even consider trying to compile this on a system where + * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. + */ + +static int inet_pton4 (const char *src, uint8_t *dst); +static int inet_pton6 (const char *src, uint8_t *dst); + +/* + * + * The definitions we might miss. + * + */ +#ifndef NS_INT16SZ +#define NS_INT16SZ 2 +#endif + +#ifndef NS_IN6ADDRSZ +#define NS_IN6ADDRSZ 16 +#endif + +#ifndef NS_INADDRSZ +#define NS_INADDRSZ 4 +#endif + +/* int + * inet_pton(af, src, dst) + * convert from presentation format (which usually means ASCII printable) + * to network format (which is usually some kind of binary format). + * return: + * 1 if the address was valid for the specified address family + * 0 if the address wasn't valid (`dst' is untouched in this case) + * -1 if some other error occurred (`dst' is untouched in this case, too) + * author: + * Paul Vixie, 1996. + */ +int +inet_pton(af, src, dst) + int af; + const char *src; + void *dst; +{ + switch (af) { + case AF_INET: + return (inet_pton4(src, dst)); + case AF_INET6: + return (inet_pton6(src, dst)); + default: +#ifdef EAFNOSUPPORT + errno = EAFNOSUPPORT; +#else + errno = ENOSYS; +#endif + return (-1); + } + /* NOTREACHED */ +} + +/* int + * inet_pton4(src, dst) + * like inet_aton() but without all the hexadecimal and shorthand. + * return: + * 1 if `src' is a valid dotted quad, else 0. + * notice: + * does not touch `dst' unless it's returning 1. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton4(src, dst) + const char *src; + uint8_t *dst; +{ + static const char digits[] = "0123456789"; + int saw_digit, octets, ch; + uint8_t tmp[NS_INADDRSZ], *tp; + + saw_digit = 0; + octets = 0; + *(tp = tmp) = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr(digits, ch)) != NULL) { + uint32_t new = *tp * 10 + (pch - digits); + + if (new > 255) + return (0); + *tp = new; + if (! saw_digit) { + if (++octets > 4) + return (0); + saw_digit = 1; + } + } else if (ch == '.' && saw_digit) { + if (octets == 4) + return (0); + *++tp = 0; + saw_digit = 0; + } else + return (0); + } + if (octets < 4) + return (0); + + memcpy(dst, tmp, NS_INADDRSZ); + return (1); +} + +/* int + * inet_pton6(src, dst) + * convert presentation level address to network order binary form. + * return: + * 1 if `src' is a valid [RFC1884 2.2] address, else 0. + * notice: + * (1) does not touch `dst' unless it's returning 1. + * (2) :: in a full address is silently ignored. + * credit: + * inspired by Mark Andrews. + * author: + * Paul Vixie, 1996. + */ +static int +inet_pton6(src, dst) + const char *src; + uint8_t *dst; +{ + static const char xdigits_l[] = "0123456789abcdef", + xdigits_u[] = "0123456789ABCDEF"; + uint8_t tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; + const char *xdigits, *curtok; + int ch, saw_xdigit; + uint32_t val; + + memset((tp = tmp), '\0', NS_IN6ADDRSZ); + endp = tp + NS_IN6ADDRSZ; + colonp = NULL; + /* Leading :: requires some special handling. */ + if (*src == ':') + if (*++src != ':') + return (0); + curtok = src; + saw_xdigit = 0; + val = 0; + while ((ch = *src++) != '\0') { + const char *pch; + + if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) + pch = strchr((xdigits = xdigits_u), ch); + if (pch != NULL) { + val <<= 4; + val |= (pch - xdigits); + if (val > 0xffff) + return (0); + saw_xdigit = 1; + continue; + } + if (ch == ':') { + curtok = src; + if (!saw_xdigit) { + if (colonp) + return (0); + colonp = tp; + continue; + } + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (uint8_t) (val >> 8) & 0xff; + *tp++ = (uint8_t) val & 0xff; + saw_xdigit = 0; + val = 0; + continue; + } + if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && + inet_pton4(curtok, tp) > 0) { + tp += NS_INADDRSZ; + saw_xdigit = 0; + break; /* '\0' was seen by inet_pton4(). */ + } + return (0); + } + if (saw_xdigit) { + if (tp + NS_INT16SZ > endp) + return (0); + *tp++ = (uint8_t) (val >> 8) & 0xff; + *tp++ = (uint8_t) val & 0xff; + } + if (colonp != NULL) { + /* + * Since some memmove()'s erroneously fail to handle + * overlapping regions, we'll do the shift by hand. + */ + const int n = tp - colonp; + int i; + + for (i = 1; i <= n; i++) { + endp[- i] = colonp[n - i]; + colonp[n - i] = 0; + } + tp = endp; + } + if (tp != endp) + return (0); + memcpy(dst, tmp, NS_IN6ADDRSZ); + return (1); +} diff --git a/libs/ldns/compat/isascii.c b/libs/ldns/compat/isascii.c new file mode 100644 index 0000000000..8a4ab37431 --- /dev/null +++ b/libs/ldns/compat/isascii.c @@ -0,0 +1,15 @@ +/* Just a replacement, if the original isascii is not + present */ + +#if HAVE_CONFIG_H +#include +#endif + +int isascii(int c); + +/* true if character is ascii. */ +int +isascii(int c) +{ + return c >= 0 && c < 128; +} diff --git a/libs/ldns/compat/isblank.c b/libs/ldns/compat/isblank.c new file mode 100644 index 0000000000..3b38154c5f --- /dev/null +++ b/libs/ldns/compat/isblank.c @@ -0,0 +1,15 @@ +/* Just a replacement, if the original isblank is not + present */ + +#if HAVE_CONFIG_H +#include +#endif + +int isblank(int c); + +/* true if character is a blank (space or tab). C99. */ +int +isblank(int c) +{ + return (c == ' ') || (c == '\t'); +} diff --git a/libs/ldns/compat/malloc.c b/libs/ldns/compat/malloc.c new file mode 100644 index 0000000000..bbc632e4f6 --- /dev/null +++ b/libs/ldns/compat/malloc.c @@ -0,0 +1,22 @@ +/* Just a replacement, if the original malloc is not + GNU-compliant. See autoconf documentation. */ + +#if HAVE_CONFIG_H +#include +#endif +#undef malloc + +#include + +void *malloc (); + +/* Allocate an N-byte block of memory from the heap. + If N is zero, allocate a 1-byte block. */ + +void * +rpl_malloc (size_t n) +{ + if (n == 0) + n = 1; + return malloc (n); +} diff --git a/libs/ldns/compat/memmove.c b/libs/ldns/compat/memmove.c new file mode 100644 index 0000000000..e458092c33 --- /dev/null +++ b/libs/ldns/compat/memmove.c @@ -0,0 +1,43 @@ +/* + * memmove.c: memmove compat implementation. + * + * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. +*/ + +#include +#include + +void *memmove(void *dest, const void *src, size_t n); + +void *memmove(void *dest, const void *src, size_t n) +{ + uint8_t* from = (uint8_t*) src; + uint8_t* to = (uint8_t*) dest; + + if (from == to || n == 0) + return dest; + if (to > from && to-from < (int)n) { + /* to overlaps with from */ + /* */ + /* */ + /* copy in reverse, to avoid overwriting from */ + int i; + for(i=n-1; i>=0; i--) + to[i] = from[i]; + return dest; + } + if (from > to && from-to < (int)n) { + /* to overlaps with from */ + /* */ + /* */ + /* copy forwards, to avoid overwriting from */ + size_t i; + for(i=0; i +#endif +#undef realloc + +#include + +void *realloc (void*, size_t); +void *malloc (size_t); + +/* Changes allocation to new sizes, copies over old data. + * if oldptr is NULL, does a malloc. + * if size is zero, allocate 1-byte block.... + * (does not return NULL and free block) + */ + +void * +rpl_realloc (void* ptr, size_t n) +{ + if (n == 0) + n = 1; + if(ptr == 0) { + return malloc(n); + } + return realloc(ptr, n); +} + diff --git a/libs/ldns/compat/snprintf.c b/libs/ldns/compat/snprintf.c new file mode 100644 index 0000000000..b7445111cb --- /dev/null +++ b/libs/ldns/compat/snprintf.c @@ -0,0 +1,770 @@ +#include + +#ifndef HAVE_SNPRINTF + +#include +#include + +/* Define this as a fall through, HAVE_STDARG_H is probably already set */ + +#define HAVE_VARARGS_H + +/************************************************************** + * Original: + * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 + * A bombproof version of doprnt (dopr) included. + * Sigh. This sort of thing is always nasty do deal with. Note that + * the version here does not include floating point... + * + * snprintf() is used instead of sprintf() as it does limit checks + * for string length. This covers a nasty loophole. + * + * The other functions are there to prevent NULL pointers from + * causing nast effects. + * + * More Recently: + * Brandon Long (blong@fiction.net) 9/15/96 for mutt 0.43 + * This was ugly. It is still ugly. I opted out of floating point + * numbers, but the formatter understands just about everything + * from the normal C string format, at least as far as I can tell from + * the Solaris 2.5 printf(3S) man page. + * + * Brandon Long (blong@fiction.net) 10/22/97 for mutt 0.87.1 + * Ok, added some minimal floating point support, which means this + * probably requires libm on most operating systems. Don't yet + * support the exponent (e,E) and sigfig (g,G). Also, fmtint() + * was pretty badly broken, it just wasn't being exercised in ways + * which showed it, so that's been fixed. Also, formated the code + * to mutt conventions, and removed dead code left over from the + * original. Also, there is now a builtin-test, just compile with: + * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm + * and run snprintf for results. + * + **************************************************************/ + + +/* varargs declarations: */ + +#if defined(HAVE_STDARG_H) +# include +# define HAVE_STDARGS /* let's hope that works everywhere (mj) */ +# define VA_LOCAL_DECL va_list ap +# define VA_START(f) va_start(ap, f) +# define VA_SHIFT(v,t) ; /* no-op for ANSI */ +# define VA_END va_end(ap) +#else +# if defined(HAVE_VARARGS_H) +# include +# undef HAVE_STDARGS +# define VA_LOCAL_DECL va_list ap +# define VA_START(f) va_start(ap) /* f is ignored! */ +# define VA_SHIFT(v,t) v = va_arg(ap,t) +# define VA_END va_end(ap) +# else +/*XX ** NO VARARGS ** XX*/ +# endif +#endif + +int snprintf (char *str, size_t count, const char *fmt, ...); +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); + +static void dopr (char *buffer, size_t maxlen, const char *format, + va_list args); +static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max); +static void fmtint (char *buffer, size_t *currlen, size_t maxlen, + long value, int base, int min, int max, int flags); +static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, + long double fvalue, int min, int max, int flags); +static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c ); + +int vsnprintf (char *str, size_t count, const char *fmt, va_list args) +{ + str[0] = 0; + dopr(str, count, fmt, args); + return(strlen(str)); +} + +/* VARARGS3 */ +#ifdef HAVE_STDARGS +int snprintf (char *str,size_t count,const char *fmt,...) +#else +int snprintf (va_alist) va_dcl +#endif +{ +#ifndef HAVE_STDARGS + char *str; + size_t count; + char *fmt; +#endif + VA_LOCAL_DECL; + + VA_START (fmt); + VA_SHIFT (str, char *); + VA_SHIFT (count, size_t ); + VA_SHIFT (fmt, char *); + (void) vsnprintf(str, count, fmt, ap); + VA_END; + return(strlen(str)); +} + +/* + * dopr(): poor man's version of doprintf + */ + +/* format read states */ +#define DP_S_DEFAULT 0 +#define DP_S_FLAGS 1 +#define DP_S_MIN 2 +#define DP_S_DOT 3 +#define DP_S_MAX 4 +#define DP_S_MOD 5 +#define DP_S_CONV 6 +#define DP_S_DONE 7 + +/* format flags - Bits */ +#define DP_F_MINUS 1 +#define DP_F_PLUS 2 +#define DP_F_SPACE 4 +#define DP_F_NUM 8 +#define DP_F_ZERO 16 +#define DP_F_UP 32 + +/* Conversion Flags */ +#define DP_C_SHORT 1 +#define DP_C_LONG 2 +#define DP_C_LDOUBLE 3 + +#define char_to_int(p) (p - '0') +#define MAX(p,q) ((p >= q) ? p : q) + +static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) +{ + char ch; + long value; + long double fvalue; + char *strvalue; + int min; + int max; + int state; + int flags; + int cflags; + size_t currlen; + + state = DP_S_DEFAULT; + currlen = flags = cflags = min = 0; + max = -1; + ch = *format++; + + while (state != DP_S_DONE) + { + if ((ch == '\0') || (currlen >= maxlen)) + state = DP_S_DONE; + + switch(state) + { + case DP_S_DEFAULT: + if (ch == '%') + state = DP_S_FLAGS; + else + dopr_outch (buffer, &currlen, maxlen, ch); + ch = *format++; + break; + case DP_S_FLAGS: + switch (ch) + { + case '-': + flags |= DP_F_MINUS; + ch = *format++; + break; + case '+': + flags |= DP_F_PLUS; + ch = *format++; + break; + case ' ': + flags |= DP_F_SPACE; + ch = *format++; + break; + case '#': + flags |= DP_F_NUM; + ch = *format++; + break; + case '0': + flags |= DP_F_ZERO; + ch = *format++; + break; + default: + state = DP_S_MIN; + break; + } + break; + case DP_S_MIN: + if (isdigit((int) ch)) + { + min = 10*min + char_to_int (ch); + ch = *format++; + } + else if (ch == '*') + { + min = va_arg (args, int); + ch = *format++; + state = DP_S_DOT; + } + else + state = DP_S_DOT; + break; + case DP_S_DOT: + if (ch == '.') + { + state = DP_S_MAX; + ch = *format++; + } + else + state = DP_S_MOD; + break; + case DP_S_MAX: + if (isdigit((int) ch)) + { + if (max < 0) + max = 0; + max = 10*max + char_to_int (ch); + ch = *format++; + } + else if (ch == '*') + { + max = va_arg (args, int); + ch = *format++; + state = DP_S_MOD; + } + else + state = DP_S_MOD; + break; + case DP_S_MOD: + /* Currently, we don't support Long Long, bummer */ + switch (ch) + { + case 'h': + cflags = DP_C_SHORT; + ch = *format++; + break; + case 'l': + cflags = DP_C_LONG; + ch = *format++; + break; + case 'L': + cflags = DP_C_LDOUBLE; + ch = *format++; + break; + default: + break; + } + state = DP_S_CONV; + break; + case DP_S_CONV: + switch (ch) + { + case 'd': + case 'i': + if (cflags == DP_C_SHORT) + value = va_arg (args, int); + else if (cflags == DP_C_LONG) + value = va_arg (args, long int); + else + value = va_arg (args, int); + fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); + break; + case 'o': + flags &= ~DP_F_PLUS; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned int); + else if (cflags == DP_C_LONG) + value = va_arg (args, unsigned long int); + else + value = va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); + break; + case 'u': + flags &= ~DP_F_PLUS; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned int); + else if (cflags == DP_C_LONG) + value = va_arg (args, unsigned long int); + else + value = va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); + break; + case 'X': + flags |= DP_F_UP; + case 'x': + flags &= ~DP_F_PLUS; + if (cflags == DP_C_SHORT) + value = va_arg (args, unsigned int); + else if (cflags == DP_C_LONG) + value = va_arg (args, unsigned long int); + else + value = va_arg (args, unsigned int); + fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); + break; + case 'f': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, long double); + else + fvalue = va_arg (args, double); + /* um, floating point? */ + fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); + break; + case 'E': + flags |= DP_F_UP; + case 'e': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, long double); + else + fvalue = va_arg (args, double); + break; + case 'G': + flags |= DP_F_UP; + case 'g': + if (cflags == DP_C_LDOUBLE) + fvalue = va_arg (args, long double); + else + fvalue = va_arg (args, double); + break; + case 'c': + dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); + break; + case 's': + strvalue = va_arg (args, char *); + if (max < 0) + max = maxlen; /* ie, no max */ + fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); + break; + case 'p': + strvalue = va_arg (args, void *); + fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); + break; + case 'n': + if (cflags == DP_C_SHORT) + { + short int *num; + num = va_arg (args, short int *); + *num = currlen; + } + else if (cflags == DP_C_LONG) + { + long int *num; + num = va_arg (args, long int *); + *num = currlen; + } + else + { + int *num; + num = va_arg (args, int *); + *num = currlen; + } + break; + case '%': + dopr_outch (buffer, &currlen, maxlen, ch); + break; + case 'w': + /* not supported yet, treat as next char */ + ch = *format++; + break; + default: + /* Unknown, skip */ + break; + } + ch = *format++; + state = DP_S_DEFAULT; + flags = cflags = min = 0; + max = -1; + break; + case DP_S_DONE: + break; + default: + /* hmm? */ + break; /* some picky compilers need this */ + } + } + if (currlen < maxlen - 1) + buffer[currlen] = '\0'; + else + buffer[maxlen - 1] = '\0'; +} + +static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, + char *value, int flags, int min, int max) +{ + int padlen, strln; /* amount to pad */ + int cnt = 0; + + if (value == 0) + { + value = (char *) ""; + } + + for (strln = 0; value[strln]; ++strln); /* strlen */ + padlen = min - strln; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justify */ + + while ((padlen > 0) && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + ++cnt; + } + while (*value && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, *value++); + ++cnt; + } + while ((padlen < 0) && (cnt < max)) + { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + ++cnt; + } +} + +/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ + +static void fmtint (char *buffer, size_t *currlen, size_t maxlen, + long value, int base, int min, int max, int flags) +{ + int signvalue = 0; + unsigned long uvalue; + char convert[20]; + int place = 0; + int spadlen = 0; /* amount to space pad */ + int zpadlen = 0; /* amount to zero pad */ + int caps = 0; + + if (max < 0) + max = 0; + + uvalue = value; + if( value < 0 ) { + signvalue = '-'; + uvalue = -value; + } + else + if (flags & DP_F_PLUS) /* Do a sign (+/i) */ + signvalue = '+'; + else + if (flags & DP_F_SPACE) + signvalue = ' '; + + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ + + do { + convert[place++] = + (caps? "0123456789ABCDEF":"0123456789abcdef") + [uvalue % (unsigned)base ]; + uvalue = (uvalue / (unsigned)base ); + } while(uvalue && (place < 20)); + if (place == 20) place--; + convert[place] = 0; + + zpadlen = max - place; + spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); + if (zpadlen < 0) zpadlen = 0; + if (spadlen < 0) spadlen = 0; + if (flags & DP_F_ZERO) + { + zpadlen = MAX(zpadlen, spadlen); + spadlen = 0; + } + if (flags & DP_F_MINUS) + spadlen = -spadlen; /* Left Justifty */ + +#ifdef DEBUG_SNPRINTF + dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", + zpadlen, spadlen, min, max, place)); +#endif + + /* Spaces */ + while (spadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --spadlen; + } + + /* Sign */ + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + /* Zeros */ + if (zpadlen > 0) + { + while (zpadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + } + + /* Digits */ + while (place > 0) + dopr_outch (buffer, currlen, maxlen, convert[--place]); + + /* Left Justified spaces */ + while (spadlen < 0) { + dopr_outch (buffer, currlen, maxlen, ' '); + ++spadlen; + } +} + +static long double abs_val (long double value) +{ + long double result = value; + + if (value < 0) + result = -value; + + return result; +} + +static double pow10 (double exp) +{ + long double result = 1; + + while (exp) + { + result *= 10; + exp--; + } + + return result; +} + +static double round (double value) +{ + long intpart; + + intpart = value; + value = value - intpart; + if (value >= 0.5) + intpart++; + + return intpart; +} + +static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, + long double fvalue, int min, int max, int flags) +{ + int signvalue = 0; + long double ufvalue; + char iconvert[20]; + char fconvert[20]; + int iplace = 0; + int fplace = 0; + int padlen = 0; /* amount to pad */ + int zpadlen = 0; + int caps = 0; + long intpart; + long fracpart; + + /* + * AIX manpage says the default is 0, but Solaris says the default + * is 6, and sprintf on AIX defaults to 6 + */ + if (max < 0) + max = 6; + + ufvalue = abs_val (fvalue); + + if (fvalue < 0) + signvalue = '-'; + else + if (flags & DP_F_PLUS) /* Do a sign (+/i) */ + signvalue = '+'; + else + if (flags & DP_F_SPACE) + signvalue = ' '; + +#if 0 + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ +#endif + + intpart = ufvalue; + + /* + * Sorry, we only support 9 digits past the decimal because of our + * conversion method + */ + if (max > 9) + max = 9; + + /* We "cheat" by converting the fractional part to integer by + * multiplying by a factor of 10 + */ + fracpart = round ((pow10 (max)) * (ufvalue - intpart)); + + if (fracpart >= pow10 (max)) + { + intpart++; + fracpart -= pow10 (max); + } + +#ifdef DEBUG_SNPRINTF + dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart)); +#endif + + /* Convert integer part */ + do { + iconvert[iplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10]; + intpart = (intpart / 10); + } while(intpart && (iplace < 20)); + if (iplace == 20) iplace--; + iconvert[iplace] = 0; + + /* Convert fractional part */ + do { + fconvert[fplace++] = + (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10]; + fracpart = (fracpart / 10); + } while(fracpart && (fplace < 20)); + if (fplace == 20) fplace--; + fconvert[fplace] = 0; + + /* -1 for decimal point, another -1 if we are printing a sign */ + padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); + zpadlen = max - fplace; + if (zpadlen < 0) + zpadlen = 0; + if (padlen < 0) + padlen = 0; + if (flags & DP_F_MINUS) + padlen = -padlen; /* Left Justifty */ + + if ((flags & DP_F_ZERO) && (padlen > 0)) + { + if (signvalue) + { + dopr_outch (buffer, currlen, maxlen, signvalue); + --padlen; + signvalue = 0; + } + while (padlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --padlen; + } + } + while (padlen > 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + --padlen; + } + if (signvalue) + dopr_outch (buffer, currlen, maxlen, signvalue); + + while (iplace > 0) + dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); + + /* + * Decimal point. This should probably use locale to find the correct + * char to print out. + */ + dopr_outch (buffer, currlen, maxlen, '.'); + + while (zpadlen > 0) + { + dopr_outch (buffer, currlen, maxlen, '0'); + --zpadlen; + } + + while (fplace > 0) + dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); + + while (padlen < 0) + { + dopr_outch (buffer, currlen, maxlen, ' '); + ++padlen; + } +} + +static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) +{ + if (*currlen < maxlen) + buffer[(*currlen)++] = c; +} + +#ifdef TEST_SNPRINTF +#ifndef LONG_STRING +#define LONG_STRING 1024 +#endif +int main (void) +{ + char buf1[LONG_STRING]; + char buf2[LONG_STRING]; + char *fp_fmt[] = { + "%-1.5f", + "%1.5f", + "%123.9f", + "%10.5f", + "% 10.5f", + "%+22.9f", + "%+4.9f", + "%01.3f", + "%4f", + "%3.1f", + "%3.2f", + NULL + }; + double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, + 0.9996, 1.996, 4.136, 0}; + char *int_fmt[] = { + "%-1.5d", + "%1.5d", + "%123.9d", + "%5.5d", + "%10.5d", + "% 10.5d", + "%+22.33d", + "%01.3d", + "%4d", + NULL + }; + long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; + int x, y; + int fail = 0; + int num = 0; + + printf ("Testing snprintf format codes against system sprintf...\n"); + + for (x = 0; fp_fmt[x] != NULL ; x++) + for (y = 0; fp_nums[y] != 0 ; y++) + { + snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); + sprintf (buf2, fp_fmt[x], fp_nums[y]); + if (strcmp (buf1, buf2)) + { + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + fp_fmt[x], buf1, buf2); + fail++; + } + num++; + } + + for (x = 0; int_fmt[x] != NULL ; x++) + for (y = 0; int_nums[y] != 0 ; y++) + { + snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); + sprintf (buf2, int_fmt[x], int_nums[y]); + if (strcmp (buf1, buf2)) + { + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + int_fmt[x], buf1, buf2); + fail++; + } + num++; + } + printf ("%d tests failed out of %d.\n", fail, num); +} +#endif /* SNPRINTF_TEST */ + +#endif /* !HAVE_SNPRINTF */ diff --git a/libs/ldns/compat/strlcpy.c b/libs/ldns/compat/strlcpy.c new file mode 100644 index 0000000000..d6c34c1d83 --- /dev/null +++ b/libs/ldns/compat/strlcpy.c @@ -0,0 +1,57 @@ +/* from openssh 4.3p2 compat/strlcpy.c */ +/* + * Copyright (c) 1998 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* OPENBSD ORIGINAL: lib/libc/string/strlcpy.c */ + +#include +#ifndef HAVE_STRLCPY + +#include +#include + +/* + * Copy src to string dst of size siz. At most siz-1 characters + * will be copied. Always NUL terminates (unless siz == 0). + * Returns strlen(src); if retval >= siz, truncation occurred. + */ +size_t +strlcpy(char *dst, const char *src, size_t siz) +{ + char *d = dst; + const char *s = src; + size_t n = siz; + + /* Copy as many bytes as will fit */ + if (n != 0 && --n != 0) { + do { + if ((*d++ = *s++) == 0) + break; + } while (--n != 0); + } + + /* Not enough room in dst, add NUL and traverse rest of src */ + if (n == 0) { + if (siz != 0) + *d = '\0'; /* NUL-terminate dst */ + while (*s++) + ; + } + + return(s - src - 1); /* count does not include NUL */ +} + +#endif /* !HAVE_STRLCPY */ diff --git a/libs/ldns/compat/timegm.c b/libs/ldns/compat/timegm.c new file mode 100644 index 0000000000..97e1e54436 --- /dev/null +++ b/libs/ldns/compat/timegm.c @@ -0,0 +1,31 @@ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#ifdef HAVE_STDLIB_H +#include +#endif + +#include + +time_t +timegm (struct tm *tm) { + time_t ret; + char *tz; + + tz = getenv("TZ"); + putenv((char*)"TZ="); + tzset(); + ret = mktime(tm); + if (tz) { + char buf[256]; + snprintf(buf, sizeof(buf), "TZ=%s", tz); + putenv(tz); + } + else + putenv((char*)"TZ"); + tzset(); + return ret; +} diff --git a/libs/ldns/config.guess b/libs/ldns/config.guess new file mode 100755 index 0000000000..0e30d56e94 --- /dev/null +++ b/libs/ldns/config.guess @@ -0,0 +1,1407 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-07-02' + +# 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. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# 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 build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +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 + +# 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. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + 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 + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # 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 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-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 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # 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. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha*:OpenVMS:*:*) + echo alpha-hp-vms + 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-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + 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:*:* | SR8000: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 ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + 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=`(sed 1q /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 ;; + # 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 ;; + 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) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* 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 -o $dummy $dummy.c \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && exit 0 + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + 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 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + 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:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${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=${UNAME_VERSION}.${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:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + 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 -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + # avoid double evaluation of $set_cc_for_build + test -n "$CC_FOR_BUILD" || eval $set_cc_for_build + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + 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 -o $dummy $dummy.c && $dummy && exit 0 + 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:*:* | *3000*: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 ;; + 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*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + 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/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + *:UNICOS/mp:*:*) + echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + 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:*:*|*:GNU/FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + # GNU/FreeBSD systems have a "k" prefix to indicate we are using + # FreeBSD's kernel, but not the complete OS. + case ${LIBC} in gnu) kernel_only='k' ;; esac + echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' + exit 0 ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + 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 i586-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 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips64 + #undef mips64el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mips64el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips64 + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86: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. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # 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. + 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:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + 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:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + 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 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*: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.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-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:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # 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 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + 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 ;; + SX-6:SUPER-UX:*:*) + echo sx6-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:*:*) + case `uname -p` in + *86) UNAME_PROCESSOR=i686 ;; + powerpc) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${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 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#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 + 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) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# 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 -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 + +# 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 + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/libs/ldns/config.sub b/libs/ldns/config.sub new file mode 100755 index 0000000000..9d7f733905 --- /dev/null +++ b/libs/ldns/config.sub @@ -0,0 +1,1504 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + +timestamp='2003-07-04' + +# 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. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# 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. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +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* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + 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 | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + 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. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | msp430 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # 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*86 | x86_64) + 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. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | msp430-* \ + | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ + | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # 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 + ;; + amd64) + basic_machine=x86_64-pc + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + 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 + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + 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 | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + 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 + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + 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*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*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 + ;; + 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 + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + 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 + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + 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 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nv1) + basic_machine=nv1-cray + os=-unicosmp + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + 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 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-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/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-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=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + 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 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + 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 + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + 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 + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + 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* | -kfreebsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|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 + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -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[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -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 + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + 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 + ;; + or32-*) + os=-coff + ;; + *-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 + ;; + f30[01]-fujitsu | f700-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* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/libs/ldns/configure b/libs/ldns/configure new file mode 100755 index 0000000000..4f38261f0e --- /dev/null +++ b/libs/ldns/configure @@ -0,0 +1,17354 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for ldns 1.6.9. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libdns@nlnetlabs.nl about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='ldns' +PACKAGE_TARNAME='libdns' +PACKAGE_VERSION='1.6.9' +PACKAGE_STRING='ldns 1.6.9' +PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' +PACKAGE_URL='' + +ac_unique_file="packet.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +enable_option_checking=no +ac_subst_vars='subdirs +LTLIBOBJS +WINDRES +LIBOBJS +include_unistd_h +include_systypes_h +include_inttypes_h +include_sys_socket_h +INSTALL_LDNS_CONFIG +LIBSSL_LIBS +LIBSSL_LDFLAGS +LIBSSL_CPPFLAGS +RUNTIME_PATH +HAVE_SSL +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +AWK +RANLIB +STRIP +ac_ct_AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +SED +LIBTOOL +AR +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +libtool +swig +PYLDNS +SWIG_LIB +SWIG +PYTHON_EXTRA_LDFLAGS +PYTHON_EXTRA_LIBS +PYTHON_SITE_PKG +PYTHON_LDFLAGS +PYTHON_CPPFLAGS +PYTHON +PYTHON_VERSION +doxygen +SET_MAKE +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +LDNS_VERSION_MICRO +LDNS_VERSION_MINOR +LDNS_VERSION_MAJOR +LIBTOOL_VERSION_INFO +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +with_pyldns +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +with_ssl +enable_sha2 +enable_gost +enable_ecdsa +enable_ldns_config +enable_rpath +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CPPFLAGS +CC +LDFLAGS +LIBS +CPPFLAGS +PYTHON_VERSION' +ac_subdirs_all='drill' + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of ldns 1.6.9:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --disable-sha2 Disable SHA256 and SHA512 RRSIG support + --disable-gost Disable GOST support + --enable-ecdsa Enable ECDSA support, experimental + --disable-ldns-config disable installation of ldns-config (default=enabled) + --disable-rpath disable hardcoded rpath (default=enabled) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pyldns generate python library, or --without-pyldns to + disable Python support. + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl + /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw + /usr) + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + PYTHON_VERSION + The installed Python version to use, for example '2.3'. This + string will be appended to the Python interpreter canonical + name. + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +ldns configure 1.6.9 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------- ## +## Report this to libdns@nlnetlabs.nl ## +## ---------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +$as_echo_n "checking for $2.$3... " >&6; } +if eval \${$4+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main () +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$4=yes" +else + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$4 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# needed to build correct soname +LIBTOOL_VERSION_INFO=1:6:9 + +LDNS_VERSION_MAJOR=1 + +LDNS_VERSION_MINOR=6 + +LDNS_VERSION_MICRO=9 + + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +CFLAGS="$CFLAGS" + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + + + +$as_echo "#define WINVER 0x0502" >>confdefs.h + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 +$as_echo_n "checking whether $CC supports -std=c99... " >&6; } +cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-std=c99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 +$as_echo_n "checking whether $CC supports -xc99... " >&6; } +cache=`echo xc99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-xc99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + +# routine to copy files +# argument 1 is a list of files (relative to the source dir) +# argument 2 is a destination directory (relative to the current +# working directory + + +# copy all .h files in the dir at argument 1 +# (relative to source) to the dir at argument 2 +# (relative to current dir) + + +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if ${ac_cv_c_const+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* NEC SVR4.0.2 mips cc rejects this. */ + struct point {int x, y;}; + static struct point const zero = {0,0}; + /* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in + an arm of an if-expression whose if-part is not a constant + expression */ + const char *g = "string"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 0; + } + { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; + } + { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; + } + { /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; + } + { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g" >&5 +$as_echo_n "checking whether $CC supports -g... " >&6; } +cache=`echo g | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -g -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="-g $CFLAGS" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 +$as_echo_n "checking whether $CC supports -O2... " >&6; } +cache=`echo O2 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="-O2 $CFLAGS" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 +$as_echo_n "checking whether $CC supports -Wall... " >&6; } +cache=`echo Wall | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="-Wall $CFLAGS" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -W" >&5 +$as_echo_n "checking whether $CC supports -W... " >&6; } +cache=`echo W | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -W -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="-W $CFLAGS" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wwrite-strings" >&5 +$as_echo_n "checking whether $CC supports -Wwrite-strings... " >&6; } +cache=`echo Wwrite-strings | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Wwrite-strings -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="-Wwrite-strings $CFLAGS" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + +for ac_header in getopt.h time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# MinGW32 tests +for ac_header in winsock2.h ws2tcpip.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +# end mingw32 tests + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 +$as_echo_n "checking whether $CC supports -Werror... " >&6; } +cache=`echo Werror | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="-Werror" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="-errwarn" +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 +$as_echo_n "checking whether $CC supports -Wall... " >&6; } +cache=`echo Wall | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="$ERRFLAG -Wall" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="$ERRFLAG -errfmt" +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 +$as_echo_n "checking whether $CC supports -std=c99... " >&6; } +cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-std=c99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 +$as_echo_n "checking whether $CC supports -xc99... " >&6; } +cache=`echo xc99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-xc99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + +for ac_header in getopt.h time.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + const char* str = NULL; + struct msghdr msg; + msg.msg_control = 0; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + str = gai_strerror(0); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + const char* str = NULL; + struct msghdr msg; + msg.msg_control = 0; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + str = gai_strerror(0); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include +#include +int test() { + int a = 0; + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_BSD_SOURCE as a flag for $CC" >&5 +$as_echo_n "checking whether we need -D_BSD_SOURCE as a flag for $CC... " >&6; } +cache=_D_BSD_SOURCE +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include + +int test() { + int a; + a = isascii(32); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -D_BSD_SOURCE" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE as a flag for $CC" >&5 +$as_echo_n "checking whether we need -D_GNU_SOURCE as a flag for $CC... " >&6; } +cache=_D_GNU_SOURCE +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include + +int test() { + struct in6_pktinfo inf; + int a = (int)sizeof(inf); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -D_GNU_SOURCE" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + +# check again for GNU_SOURCE for setresgid. May fail if setresgid +# is not available at all. -D_FRSRESGID is to make this check unique. +# otherwise we would get the previous cached result. + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC" >&5 +$as_echo_n "checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC... " >&6; } +cache=_D_GNU_SOURCE__D_FRSRESGID +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include + +int test() { + int a = setresgid(0,0,0); + a = setresuid(0,0,0); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -D_GNU_SOURCE" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC" >&5 +$as_echo_n "checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC... " >&6; } +cache=`$as_echo "-D_POSIX_C_SOURCE=200112" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#ifdef HAVE_TIME_H +#include +#endif +#include + +int test() { + int a = 0; + char *t; + time_t time = 0; + char *buf = NULL; + const char* str = NULL; + t = ctime_r(&time, buf); + str = gai_strerror(0); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D__EXTENSIONS__ as a flag for $CC" >&5 +$as_echo_n "checking whether we need -D__EXTENSIONS__ as a flag for $CC... " >&6; } +cache=_D__EXTENSIONS__ +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -D__EXTENSIONS__" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" +if test "x$ac_cv_type_int8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int8_t char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" +if test "x$ac_cv_type_int16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int16_t short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int32_t int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" +if test "x$ac_cv_type_int64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int64_t long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" +if test "x$ac_cv_type_uint8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint8_t unsigned char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" +if test "x$ac_cv_type_uint16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint16_t unsigned short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" +if test "x$ac_cv_type_uint32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint32_t unsigned int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" +if test "x$ac_cv_type_uint64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint64_t unsigned long long +_ACEOF + +fi + + +# my own checks +# Extract the first word of "doxygen", so it can be a program name with args. +set dummy doxygen; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_doxygen+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$doxygen"; then + ac_cv_prog_doxygen="$doxygen" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_doxygen="doxygen" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +doxygen=$ac_cv_prog_doxygen +if test -n "$doxygen"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doxygen" >&5 +$as_echo "$doxygen" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + +# check to see if libraries are needed for these functions. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break +fi +done +if ${ac_cv_search_socket+:} false; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 +$as_echo_n "checking for library containing inet_pton... " >&6; } +if ${ac_cv_search_inet_pton+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_pton (); +int +main () +{ +return inet_pton (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_inet_pton=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_inet_pton+:} false; then : + break +fi +done +if ${ac_cv_search_inet_pton+:} false; then : + +else + ac_cv_search_inet_pton=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 +$as_echo "$ac_cv_search_inet_pton" >&6; } +ac_res=$ac_cv_search_inet_pton +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + +# check for python + +# Check whether --with-pyldns was given. +if test "${with_pyldns+set}" = set; then : + withval=$with_pyldns; +else + withval="no" +fi + +ldns_have_python=no +if test x_$withval != x_no; then + + + + ac_save_LIBS="$LIBS" + # + # Allow the use of a (user set) custom python version + # + + + # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args. +set dummy python$PYTHON_VERSION; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PYTHON+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PYTHON in + [\\/]* | ?:[\\/]*) + ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +PYTHON=$ac_cv_path_PYTHON +if test -n "$PYTHON"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 +$as_echo "$PYTHON" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$PYTHON"; then + as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5 + PYTHON_VERSION="" + fi + + if test -z "$PYTHON_VERSION"; then + PYTHON_VERSION=`$PYTHON -c "import sys, string; \ + print string.split(sys.version)[0]"` + fi + + # + # Check for a version of Python >= 2.1.0 + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5 +$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; } + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[0]; \ + print ver >= '2.1.0'"` + if test "$ac_supports_python_ver" != "True"; then + if test -z "$PYTHON_NOVERSIONCHECK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? " +This version of the AC_PYTHON_DEVEL macro +doesn't work properly with versions of Python before +2.1.0. You may need to re-run configure, setting the +variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, +PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. +Moreover, to disable this check, set PYTHON_NOVERSIONCHECK +to something else than an empty string. + +See \`config.log' for more details" "$LINENO" 5; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5 +$as_echo "skip at user request" >&6; } + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + fi + + # + # if the macro parameter ``version'' is set, honour it + # + if test -n ""; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5 +$as_echo_n "checking for a version of Python ... " >&6; } + ac_supports_python_ver=`$PYTHON -c "import sys, string; \ + ver = string.split(sys.version)[0]; \ + print ver "` + if test "$ac_supports_python_ver" = "True"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "this package requires Python . +If you have it installed, but it isn't the default Python +interpreter in your system path, please pass the PYTHON_VERSION +variable to configure. See \`\`configure --help'' for reference. +" "$LINENO" 5 + PYTHON_VERSION="" + fi + fi + + # + # Check if you have distutils, else fail + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 +$as_echo_n "checking for the distutils Python package... " >&6; } + ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` + if test -z "$ac_distutils_result"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "cannot import Python module \"distutils\". +Please check your Python installation. The error was: +$ac_distutils_result" "$LINENO" 5 + PYTHON_VERSION="" + fi + + # + # Check for Python include path + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 +$as_echo_n "checking for Python include path... " >&6; } + if test -z "$PYTHON_CPPFLAGS"; then + python_path=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_inc();"` + if test -n "${python_path}"; then + python_path="-I$python_path" + fi + PYTHON_CPPFLAGS=$python_path + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5 +$as_echo "$PYTHON_CPPFLAGS" >&6; } + + + # + # Check for Python library path + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 +$as_echo_n "checking for Python library path... " >&6; } + if test -z "$PYTHON_LDFLAGS"; then + # (makes two attempts to ensure we've got a version number + # from the interpreter) + py_version=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print join(get_config_vars('VERSION'))"` + if test "$py_version" = "None"; then + if test -n "$PYTHON_VERSION"; then + py_version=$PYTHON_VERSION + else + py_version=`$PYTHON -c "import sys; \ + print sys.version[:3]"` + fi + fi + + PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ + from string import join; \ + print '-L' + get_python_lib(0,1), \ + '-L' + os.path.dirname(get_python_lib(0,1)), \ + '-lpython';"`$py_version + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LDFLAGS" >&5 +$as_echo "$PYTHON_LDFLAGS" >&6; } + + + # + # Check for site packages + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5 +$as_echo_n "checking for Python site-packages path... " >&6; } + if test -z "$PYTHON_SITE_PKG"; then + PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ + print distutils.sysconfig.get_python_lib(0,0);"` + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5 +$as_echo "$PYTHON_SITE_PKG" >&6; } + + + # + # libraries which must be linked in when embedding + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 +$as_echo_n "checking python extra libraries... " >&6; } + if test -z "$PYTHON_EXTRA_LIBS"; then + PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LOCALMODLIBS'), conf('LIBS')"` + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 +$as_echo "$PYTHON_EXTRA_LIBS" >&6; } + + + # + # linking flags needed when embedding + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5 +$as_echo_n "checking python extra linking flags... " >&6; } + if test -z "$PYTHON_EXTRA_LDFLAGS"; then + PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ + conf = distutils.sysconfig.get_config_var; \ + print conf('LINKFORSHARED')"` + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5 +$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; } + + + # + # final check to see if everything compiles alright + # + { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5 +$as_echo_n "checking consistency of all components of python development environment... " >&6; } + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + # save current global flags + LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" + CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + +int +main () +{ + + Py_Initialize(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + pythonexists=yes +else + pythonexists=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5 +$as_echo "$pythonexists" >&6; } + + if test ! "$pythonexists" = "yes"; then + as_fn_error $? " + Could not link test program to Python. Maybe the main Python library has been + installed in some non-standard library path. If so, pass it to configure, + via the LDFLAGS environment variable. + Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\" + ============================================================================ + ERROR! + You probably have to install the development version of the Python package + for your distribution. The exact name of this package varies among them. + ============================================================================ + " "$LINENO" 5 + PYTHON_VERSION="" + fi + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + # turn back to default flags + CPPFLAGS="$ac_save_CPPFLAGS" + LIBS="$ac_save_LIBS" + + # + # all done! + # + + if test ! -z "$PYTHON_VERSION"; then + if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then + as_fn_error $? "Python version >= 2.4.0 is required" "$LINENO" 5 + fi + # Have Python + +$as_echo "#define HAVE_PYTHON 1" >>confdefs.h + + ldns_have_python=yes + fi + + # check for swig + if test x_$ldns_have_python != x_no; then + # =========================================================================== +# http://autoconf-archive.cryp.to/ac_pkg_swig.html +# =========================================================================== +# +# SYNOPSIS +# +# AC_PROG_SWIG([major.minor.micro]) +# +# DESCRIPTION +# +# This macro searches for a SWIG installation on your system. If found you +# should call SWIG via $(SWIG). You can use the optional first argument to +# check if the version of the available SWIG is greater than or equal to +# the value of the argument. It should have the format: N[.N[.N]] (N is a +# number between 0 and 999. Only the first N is mandatory.) +# +# If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that +# the swig package is this version number or higher. +# +# In configure.in, use as: +# +# AC_PROG_SWIG(1.3.17) +# SWIG_ENABLE_CXX +# SWIG_MULTI_MODULE_SUPPORT +# SWIG_PYTHON +# +# LAST MODIFICATION +# +# 2008-04-12 +# +# COPYLEFT +# +# Copyright (c) 2008 Sebastian Huber +# Copyright (c) 2008 Alan W. Irwin +# Copyright (c) 2008 Rafael Laboissiere +# Copyright (c) 2008 Andrew Collier +# +# 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, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Macro Archive. When you make and +# distribute a modified version of the Autoconf Macro, you may extend this +# special exception to the GPL to apply to your modified version as well. + + + + + # Extract the first word of "swig", so it can be a program name with args. +set dummy swig; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_SWIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $SWIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +SWIG=$ac_cv_path_SWIG +if test -n "$SWIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 +$as_echo "$SWIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test -z "$SWIG" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&5 +$as_echo "$as_me: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&2;} + SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' + elif test -n "" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG version" >&5 +$as_echo_n "checking for SWIG version... " >&6; } + swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5 +$as_echo "$swig_version" >&6; } + if test -n "$swig_version" ; then + # Calculate the required version number components + required= + required_major=`echo $required | sed 's/[^0-9].*//'` + if test -z "$required_major" ; then + required_major=0 + fi + required=`echo $required | sed 's/[0-9]*[^0-9]//'` + required_minor=`echo $required | sed 's/[^0-9].*//'` + if test -z "$required_minor" ; then + required_minor=0 + fi + required=`echo $required | sed 's/[0-9]*[^0-9]//'` + required_patch=`echo $required | sed 's/[^0-9].*//'` + if test -z "$required_patch" ; then + required_patch=0 + fi + # Calculate the available version number components + available=$swig_version + available_major=`echo $available | sed 's/[^0-9].*//'` + if test -z "$available_major" ; then + available_major=0 + fi + available=`echo $available | sed 's/[0-9]*[^0-9]//'` + available_minor=`echo $available | sed 's/[^0-9].*//'` + if test -z "$available_minor" ; then + available_minor=0 + fi + available=`echo $available | sed 's/[0-9]*[^0-9]//'` + available_patch=`echo $available | sed 's/[^0-9].*//'` + if test -z "$available_patch" ; then + available_patch=0 + fi + if test $available_major -ne $required_major \ + -o $available_minor -ne $required_minor \ + -o $available_patch -lt $required_patch ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= is required. You have $swig_version. You should look at http://www.swig.org" >&5 +$as_echo "$as_me: WARNING: SWIG version >= is required. You have $swig_version. You should look at http://www.swig.org" >&2;} + SWIG='echo "Error: SWIG version >= is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG executable is '$SWIG'" >&5 +$as_echo "$as_me: SWIG executable is '$SWIG'" >&6;} + SWIG_LIB=`$SWIG -swiglib` + { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG library directory is '$SWIG_LIB'" >&5 +$as_echo "$as_me: SWIG library directory is '$SWIG_LIB'" >&6;} + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5 +$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;} + SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' + fi + fi + + + if test ! -x "$SWIG"; then + as_fn_error $? "failed to find swig tool, install it, or do not build pyldns" "$LINENO" 5 + else + +$as_echo "#define HAVE_SWIG 1" >>confdefs.h + + PYLDNS="pyldns" + + swig="$SWIG" + + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: *** don't have Python, skipping Swig, no pyldns ***" >&5 +$as_echo "*** don't have Python, skipping Swig, no pyldns ***" >&6; } + fi +fi + +# Use libtool +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 + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + +# skip these tests, we do not need them. + + + + + + + + +# always use ./libtool unless override from commandline (libtool=mylibtool) +if test -z "$libtool"; then + libtool="./libtool" +fi + +# avoid libtool max commandline length test on systems that fork slowly. + +if echo "$host_os" | grep "sunos4" >/dev/null; then + lt_cv_sys_max_cmd_len=32750; +fi +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_AR="$AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +AR=$ac_cv_path_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_AR"; then + ac_pt_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ac_pt_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ac_pt_AR in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_AR=$ac_cv_path_ac_pt_AR +if test -n "$ac_pt_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_AR" >&5 +$as_echo "$ac_pt_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_pt_AR + fi +else + AR="$ac_cv_path_AR" +fi + +if test $AR = false; then + as_fn_error $? "Cannot find 'ar', please extend PATH to include it" "$LINENO" 5 +fi + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4' +macro_revision='1.3293' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Backslashify metacharacters that are still active within +# double-quoted strings. +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' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-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 "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_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 + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_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 extended 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. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_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]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# 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]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && 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 $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + 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 $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + 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" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&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 + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-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. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +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 + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_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 + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_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 + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + lt_prog_compiler_pic='-Xcompiler -fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # 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 extended regexp 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_|_GLOBAL__F[ID]_.*' + # 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. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # 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 "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_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. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + 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 $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + 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 + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # 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. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''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$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + 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 $linker_flags /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 $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + 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 $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + 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 $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +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" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) 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. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + 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=`func_echo_all "$lib" | $SED '\''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' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + 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" + # 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* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + 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}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + 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" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$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.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent 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 "$_LT_TAGVAR(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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; 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 + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + 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 + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&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 + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + + +tmp_CPPFLAGS=$CPPFLAGS +tmp_LDFLAGS=$LDFLAGS +tmp_LIBS=$LIBS + + + +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; + +else + + withval="yes" + +fi + + + withval=$withval + if test x_$withval != x_no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 +$as_echo_n "checking for SSL... " >&6; } + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" + fi + for dir in $withval; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes" + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSL /**/ +_ACEOF + + if test "$ssldir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" + fi + break; + fi + done + if test x_$found_ssl != x_yes; then + as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 +$as_echo "found in $ssldir" >&6; } + HAVE_SSL=yes + if test "$ssldir" != "/usr" -a "$ssldir" != ""; then + LDFLAGS="$LDFLAGS -L$ssldir/lib" + LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" + + if test "x$enable_rpath" = xyes; then + if echo "$ssldir/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" + fi + fi + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } + LIBS="$LIBS -lcrypto" + LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + # check if -lwsock32 or -lgdi32 are needed. + BAKLIBS="$LIBS" + BAKSSLLIBS="$LIBSSL_LIBS" + LIBS="$LIBS -lgdi32" + LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 +$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 +$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + + + # openssl engine functionality needs dlopen(). + BAKLIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_dlopen+:} false; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + if test "$LIBS" != "$BAKLIBS"; then + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + fi + fi +for ac_header in openssl/ssl.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_SSL_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/err.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_err_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_ERR_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/rand.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_rand_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_RAND_H 1 +_ACEOF + +fi + +done + + + + +for ac_func in EVP_sha256 +do : + ac_fn_c_check_func "$LINENO" "EVP_sha256" "ac_cv_func_EVP_sha256" +if test "x$ac_cv_func_EVP_sha256" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_EVP_SHA256 1 +_ACEOF + +fi +done + + +# for macosx, see if glibtool exists and use that +# BSD's need to know the version... +#AC_CHECK_PROG(glibtool, glibtool, [glibtool], ) +#AC_CHECK_PROGS(libtool, [libtool15 libtool], [./libtool]) + +# Check whether --enable-sha2 was given. +if test "${enable_sha2+set}" = set; then : + enableval=$enable_sha2; +fi + +case "$enable_sha2" in + no) + ;; + yes|*) + if test "x$HAVE_SSL" != "xyes"; then + as_fn_error $? "SHA2 enabled, but no SSL support" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHA256 and SHA512" >&5 +$as_echo_n "checking for SHA256 and SHA512... " >&6; } + ac_fn_c_check_func "$LINENO" "SHA256_Init" "ac_cv_func_SHA256_Init" +if test "x$ac_cv_func_SHA256_Init" = xyes; then : + +else + + as_fn_error $? "No SHA2 functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-sha2" "$LINENO" 5 + +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_SHA2 1 +_ACEOF + + ;; +esac + +# Check whether --enable-gost was given. +if test "${enable_gost+set}" = set; then : + enableval=$enable_gost; +fi + +case "$enable_gost" in + no) + ;; + *) if test "x$HAVE_SSL" != "xyes"; then + as_fn_error $? "GOST enabled, but no SSL support" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOST" >&5 +$as_echo_n "checking for GOST... " >&6; } + ac_fn_c_check_func "$LINENO" "EVP_PKEY_set_type_str" "ac_cv_func_EVP_PKEY_set_type_str" +if test "x$ac_cv_func_EVP_PKEY_set_type_str" = xyes; then : + +else + as_fn_error $? "OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost" "$LINENO" 5 +fi + + ac_fn_c_check_func "$LINENO" "EC_KEY_new" "ac_cv_func_EC_KEY_new" +if test "x$ac_cv_func_EC_KEY_new" = xyes; then : + +else + as_fn_error $? "No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost" "$LINENO" 5 +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_GOST 1 +_ACEOF + + ;; +esac + +# Check whether --enable-ecdsa was given. +if test "${enable_ecdsa+set}" = set; then : + enableval=$enable_ecdsa; +fi + +case "$enable_ecdsa" in + yes) + if test "x$HAVE_SSL" != "xyes"; then + as_fn_error $? "ECDSA enabled, but no SSL support" "$LINENO" 5 + fi + ac_fn_c_check_func "$LINENO" "ECDSA_sign" "ac_cv_func_ECDSA_sign" +if test "x$ac_cv_func_ECDSA_sign" = xyes; then : + +else + as_fn_error $? "OpenSSL does not support ECDSA" "$LINENO" 5 +fi + + ac_fn_c_check_func "$LINENO" "SHA384_Init" "ac_cv_func_SHA384_Init" +if test "x$ac_cv_func_SHA384_Init" = xyes; then : + +else + as_fn_error $? "OpenSSL does not support SHA384" "$LINENO" 5 +fi + + ac_fn_c_check_decl "$LINENO" "NID_X9_62_prime256v1" "ac_cv_have_decl_NID_X9_62_prime256v1" "$ac_includes_default +#include + +" +if test "x$ac_cv_have_decl_NID_X9_62_prime256v1" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_NID_X9_62_PRIME256V1 $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + +else + as_fn_error $? "OpenSSL does not support the ECDSA curve" "$LINENO" 5 +fi +ac_fn_c_check_decl "$LINENO" "NID_secp384r1" "ac_cv_have_decl_NID_secp384r1" "$ac_includes_default +#include + +" +if test "x$ac_cv_have_decl_NID_secp384r1" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_NID_SECP384R1 $ac_have_decl +_ACEOF +if test $ac_have_decl = 1; then : + +else + as_fn_error $? "OpenSSL does not support the ECDSA curve" "$LINENO" 5 +fi + + # we now know we have ECDSA and the required curves. + +cat >>confdefs.h <<_ACEOF +#define USE_ECDSA 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************" >&5 +$as_echo "$as_me: WARNING: + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************" >&2;} + ;; + no) + ;; + *) + ;; +esac + + + + +CPPFLAGS=$tmp_CPPFLAGS +LDFLAGS=$tmp_LDFLAGS +LIBS=$tmp_LIBS + +# add option to disable installation of ldns-config script +# Check whether --enable-ldns-config was given. +if test "${enable_ldns_config+set}" = set; then : + enableval=$enable_ldns_config; enable_ldns_config=$enableval +else + enable_ldns_config=yes +fi + +if test "x$enable_ldns_config" = xyes; then + INSTALL_LDNS_CONFIG="yes" +else + INSTALL_LDNS_CONFIG="no" +fi + + +# add option to disable the evil rpath + +# Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; enable_rpath=$enableval +else + enable_rpath=yes +fi + +if test "x$enable_rpath" = xno; then + ac_config_commands="$ac_config_commands disable-rpath" + +fi + + +#AC_TRY_RUN( +#[ +#int main() +#{ +#short one = 1; +#char *cp = (char*)&one; +#if ( *cp == 0 ) +#return(0); +#else +#return(1); +#} +#], [],[ +#AC_DEFINE(CONFCHECK_LITTLE_ENDIAN, 1, [system appears to be little-endian]) +#],[]) + +# should define WORDS_BIGENDIAN if the system is big-endian + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + + +# Checks for header files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +#AC_HEADER_SYS_WAIT +#AC_CHECK_HEADERS([getopt.h fcntl.h stdlib.h string.h strings.h unistd.h]) +# do the very minimum - we can always extend this +for ac_header in getopt.h stdarg.h stdbool.h openssl/ssl.h netinet/in.h time.h arpa/inet.h netdb.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in sys/param.h sys/mount.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default + + #if HAVE_SYS_PARAM_H + # include + #endif + + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default + + #if HAVE_SYS_PARAM_H + # include + #endif + + +" +if test "x$ac_cv_header_sys_socket_h" = xyes; then : + +include_sys_socket_h='#include ' + +$as_echo "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h + + +else + +include_sys_socket_h='' + +fi + + + +ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default + +" +if test "x$ac_cv_header_inttypes_h" = xyes; then : + +include_inttypes_h='#include ' + +$as_echo "#define HAVE_INTTYPES_H 1" >>confdefs.h + + +else + +include_inttypes_h='' + +fi + + + +ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default + +" +if test "x$ac_cv_header_sys_types_h" = xyes; then : + +include_systypes_h='#include ' + +$as_echo "#define HAVE_SYS_TYPES_H 1" >>confdefs.h + + +else + +include_systypes_h='' + +fi + + + +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default + +" +if test "x$ac_cv_header_unistd_h" = xyes; then : + +include_unistd_h='#include ' + +$as_echo "#define HAVE_UNISTD_H 1" >>confdefs.h + + +else + +include_unistd_h='' + +fi + + + + + +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " +$ac_includes_default +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +" +if test "x$ac_cv_type_socklen_t" = xyes; then : + +else + +$as_echo "#define socklen_t int" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_addr_t" = xyes; then : + +else + +$as_echo "#define in_addr_t uint32_t" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_port_t" = xyes; then : + +else + +$as_echo "#define in_port_t uint16_t" >>confdefs.h + +fi + +ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "$ac_includes_default +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +" +if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes; then : + +else + + ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "__ss_family" "ac_cv_member_struct_sockaddr_storage___ss_family" "$ac_includes_default +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +" +if test "x$ac_cv_member_struct_sockaddr_storage___ss_family" = xyes; then : + + +$as_echo "#define ss_family __ss_family" >>confdefs.h + + +fi + + +fi + + +for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +$as_echo_n "checking for GNU libc compatible malloc... " >&6; } +if ${ac_cv_func_malloc_0_nonnull+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_malloc_0_nonnull=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *malloc (); +#endif + +int +main () +{ +return ! malloc (0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_malloc_0_nonnull=yes +else + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes; then : + +$as_echo "#define HAVE_MALLOC 1" >>confdefs.h + +else + $as_echo "#define HAVE_MALLOC 0" >>confdefs.h + + case " $LIBOBJS " in + *" malloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS malloc.$ac_objext" + ;; +esac + + +$as_echo "#define malloc rpl_malloc" >>confdefs.h + +fi + + +for ac_header in stdlib.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" +if test "x$ac_cv_header_stdlib_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STDLIB_H 1 +_ACEOF + +fi + +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 +$as_echo_n "checking for GNU libc compatible realloc... " >&6; } +if ${ac_cv_func_realloc_0_nonnull+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_realloc_0_nonnull=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined STDC_HEADERS || defined HAVE_STDLIB_H +# include +#else +char *realloc (); +#endif + +int +main () +{ +return ! realloc (0, 0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_realloc_0_nonnull=yes +else + ac_cv_func_realloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 +$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } +if test $ac_cv_func_realloc_0_nonnull = yes; then : + +$as_echo "#define HAVE_REALLOC 1" >>confdefs.h + +else + $as_echo "#define HAVE_REALLOC 0" >>confdefs.h + + case " $LIBOBJS " in + *" realloc.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS realloc.$ac_objext" + ;; +esac + + +$as_echo "#define realloc rpl_realloc" >>confdefs.h + +fi + + + +ac_fn_c_check_func "$LINENO" "b64_pton" "ac_cv_func_b64_pton" +if test "x$ac_cv_func_b64_pton" = xyes; then : + $as_echo "#define HAVE_B64_PTON 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" b64_pton.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS b64_pton.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "b64_ntop" "ac_cv_func_b64_ntop" +if test "x$ac_cv_func_b64_ntop" = xyes; then : + $as_echo "#define HAVE_B64_NTOP 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" b64_ntop.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS b64_ntop.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "b32_pton" "ac_cv_func_b32_pton" +if test "x$ac_cv_func_b32_pton" = xyes; then : + $as_echo "#define HAVE_B32_PTON 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" b32_pton.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS b32_pton.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "b32_ntop" "ac_cv_func_b32_ntop" +if test "x$ac_cv_func_b32_ntop" = xyes; then : + $as_echo "#define HAVE_B32_NTOP 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" b32_ntop.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS b32_ntop.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" +if test "x$ac_cv_func_timegm" = xyes; then : + $as_echo "#define HAVE_TIMEGM 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" timegm.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS timegm.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "gmtime_r" "ac_cv_func_gmtime_r" +if test "x$ac_cv_func_gmtime_r" = xyes; then : + $as_echo "#define HAVE_GMTIME_R 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" gmtime_r.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS gmtime_r.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "ctime_r" "ac_cv_func_ctime_r" +if test "x$ac_cv_func_ctime_r" = xyes; then : + $as_echo "#define HAVE_CTIME_R 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" ctime_r.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS ctime_r.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "isblank" "ac_cv_func_isblank" +if test "x$ac_cv_func_isblank" = xyes; then : + $as_echo "#define HAVE_ISBLANK 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" isblank.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS isblank.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "isascii" "ac_cv_func_isascii" +if test "x$ac_cv_func_isascii" = xyes; then : + $as_echo "#define HAVE_ISASCII 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" isascii.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS isascii.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton" +if test "x$ac_cv_func_inet_aton" = xyes; then : + $as_echo "#define HAVE_INET_ATON 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" inet_aton.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS inet_aton.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" +if test "x$ac_cv_func_inet_pton" = xyes; then : + $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" inet_pton.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS inet_pton.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" +if test "x$ac_cv_func_inet_ntop" = xyes; then : + $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" inet_ntop.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS inet_ntop.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = xyes; then : + $as_echo "#define HAVE_SNPRINTF 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" snprintf.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS snprintf.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" +if test "x$ac_cv_func_strlcpy" = xyes; then : + $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" strlcpy.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS strlcpy.$ac_objext" + ;; +esac + +fi + + +ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" +if test "x$ac_cv_func_memmove" = xyes; then : + $as_echo "#define HAVE_MEMMOVE 1" >>confdefs.h + +else + case " $LIBOBJS " in + *" memmove.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS memmove.$ac_objext" + ;; +esac + +fi + + +for ac_func in endprotoent endservent sleep random fcntl strtoul +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 +$as_echo_n "checking for getaddrinfo... " >&6; } +ac_cv_func_getaddrinfo=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_getaddrinfo="yes" +else + ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +int +main () +{ + + (void)getaddrinfo(NULL, NULL, NULL, NULL); + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +ac_cv_func_getaddrinfo="yes" + +$as_echo "#define USE_WINSOCK 1" >>confdefs.h + +USE_WINSOCK="1" + +else + +ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 +$as_echo "$ac_cv_func_getaddrinfo" >&6; } +if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h + +fi + +if test $ac_cv_func_getaddrinfo = no; then + case " $LIBOBJS " in + *" fake-rfc2553.$ac_objext "* ) ;; + *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext" + ;; +esac + +fi +if test "$USE_WINSOCK" = 1; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. +set dummy ${ac_tool_prefix}windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_WINDRES+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$WINDRES"; then + ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_WINDRES="${ac_tool_prefix}windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +WINDRES=$ac_cv_prog_WINDRES +if test -n "$WINDRES"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5 +$as_echo "$WINDRES" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_WINDRES"; then + ac_ct_WINDRES=$WINDRES + # Extract the first word of "windres", so it can be a program name with args. +set dummy windres; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_WINDRES+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_WINDRES"; then + ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_WINDRES="windres" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES +if test -n "$ac_ct_WINDRES"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_WINDRES" >&5 +$as_echo "$ac_ct_WINDRES" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_WINDRES" = x; then + WINDRES="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + WINDRES=$ac_ct_WINDRES + fi +else + WINDRES="$ac_cv_prog_WINDRES" +fi + +fi + +# check ioctlsocket +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ioctlsocket" >&5 +$as_echo_n "checking for ioctlsocket... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +int +main () +{ + + (void)ioctlsocket(0, 0, NULL); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_IOCTLSOCKET 1" >>confdefs.h + + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + + +#AC_SEARCH_LIBS(RSA_new, [crypto]) + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"format\" attribute" >&5 +$as_echo_n "checking whether the C compiler (${CC-cc}) accepts the \"format\" attribute... " >&6; } +if ${ac_cv_c_format_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_format_attribute=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +void f (char *format, ...) __attribute__ ((format (printf, 1, 2))); +void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2))); + +int +main () +{ + + f ("%s", "str"); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_format_attribute="yes" +else + ac_cv_c_format_attribute="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_format_attribute" >&5 +$as_echo "$ac_cv_c_format_attribute" >&6; } +if test $ac_cv_c_format_attribute = yes; then + +$as_echo "#define HAVE_ATTR_FORMAT 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"unused\" attribute" >&5 +$as_echo_n "checking whether the C compiler (${CC-cc}) accepts the \"unused\" attribute... " >&6; } +if ${ac_cv_c_unused_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_unused_attribute=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +void f (char *u __attribute__((unused))); + +int +main () +{ + + f ("x"); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_unused_attribute="yes" +else + ac_cv_c_unused_attribute="no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_unused_attribute" >&5 +$as_echo "$ac_cv_c_unused_attribute" >&6; } +if test $ac_cv_c_unused_attribute = yes; then + +$as_echo "#define HAVE_ATTR_UNUSED 1" >>confdefs.h + +fi + + +# check OSX deployment target which is needed +if echo $build_os | grep darwin > /dev/null; then + export MACOSX_DEPLOYMENT_TARGET="10.4" +fi + + +$as_echo "#define SYSCONFDIR sysconfdir" >>confdefs.h + + + + + + +ac_config_files="$ac_config_files Makefile ldns/net.h ldns/util.h packaging/libldns.pc packaging/ldns-config" + + +ac_config_headers="$ac_config_headers ldns/config.h" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +ldns config.status 1.6.9 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "disable-rpath") CONFIG_COMMANDS="$CONFIG_COMMANDS disable-rpath" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "ldns/net.h") CONFIG_FILES="$CONFIG_FILES ldns/net.h" ;; + "ldns/util.h") CONFIG_FILES="$CONFIG_FILES ldns/util.h" ;; + "packaging/libldns.pc") CONFIG_FILES="$CONFIG_FILES packaging/libldns.pc" ;; + "packaging/ldns-config") CONFIG_FILES="$CONFIG_FILES packaging/ldns-config" ;; + "ldns/config.h") CONFIG_HEADERS="$CONFIG_HEADERS ldns/config.h" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# 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 + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_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=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$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 + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# 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 + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# 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 +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # 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? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + "disable-rpath":C) + sed < libtool > libtool-2 \ + 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' + mv libtool-2 libtool + chmod 755 libtool + libtool="./libtool" + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + +echo "copying header files" + +for file in $srcdir/ldns//*.h; do + sh $srcdir/install-sh -m 644 $file ldns/ +done + + + + + +subdirs="$subdirs drill" + diff --git a/libs/ldns/configure.ac b/libs/ldns/configure.ac new file mode 100644 index 0000000000..d4aa2b030e --- /dev/null +++ b/libs/ldns/configure.ac @@ -0,0 +1,488 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. +AC_PREREQ(2.56) +sinclude(acx_nlnetlabs.m4) + +# must be numbers. ac_defun because of later processing. +m4_define([VERSION_MAJOR],[1]) +m4_define([VERSION_MINOR],[6]) +m4_define([VERSION_MICRO],[9]) +AC_INIT(ldns, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), libdns@nlnetlabs.nl, libdns) +AC_CONFIG_SRCDIR([packet.c]) +# needed to build correct soname +AC_SUBST(LIBTOOL_VERSION_INFO, VERSION_MAJOR:VERSION_MINOR:VERSION_MICRO) +AC_SUBST(LDNS_VERSION_MAJOR, [VERSION_MAJOR]) +AC_SUBST(LDNS_VERSION_MINOR, [VERSION_MINOR]) +AC_SUBST(LDNS_VERSION_MICRO, [VERSION_MICRO]) + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +CFLAGS="$CFLAGS" + +AC_AIX +# Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET + +AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) + +ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) +ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) + +# routine to copy files +# argument 1 is a list of files (relative to the source dir) +# argument 2 is a destination directory (relative to the current +# working directory +AC_DEFUN([COPY_FILES], +[ +for file in $1; do + sh $srcdir/install-sh -m 644 $file $2 +done +]) + +# copy all .h files in the dir at argument 1 +# (relative to source) to the dir at argument 2 +# (relative to current dir) +AC_DEFUN([COPY_HEADER_FILES], +[ +echo "copying header files" +COPY_FILES($srcdir/$1/*.h, $2) +]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_LANG_C +ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="-g $CFLAGS"]) +ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="-O2 $CFLAGS"]) +ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="-Wall $CFLAGS"]) +ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="-W $CFLAGS"]) +ACX_CHECK_COMPILER_FLAG(Wwrite-strings, [CFLAGS="-Wwrite-strings $CFLAGS"]) + +AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT]) + +# MinGW32 tests +AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) +# end mingw32 tests + +ACX_DETERMINE_EXT_FLAGS_UNBOUND + +AC_C_INLINE +AC_CHECK_TYPE(int8_t, char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(int32_t, int) +AC_CHECK_TYPE(int64_t, long long) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(uint16_t, unsigned short) +AC_CHECK_TYPE(uint32_t, unsigned int) +AC_CHECK_TYPE(uint64_t, unsigned long long) + +# my own checks +AC_CHECK_PROG(doxygen, doxygen, doxygen) + +# check to see if libraries are needed for these functions. +AC_SEARCH_LIBS([socket], [socket]) +AC_SEARCH_LIBS([inet_pton], [nsl]) + +# check for python +AC_ARG_WITH(pyldns, AC_HELP_STRING([--with-pyldns], + [generate python library, or --without-pyldns to disable Python support.]), + [],[ withval="no" ]) +ldns_have_python=no +if test x_$withval != x_no; then + sinclude(acx_python.m4) + ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS + AC_PYTHON_DEVEL + if test ! -z "$PYTHON_VERSION"; then + if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then + AC_ERROR([Python version >= 2.4.0 is required]) + fi + # Have Python + AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.]) + ldns_have_python=yes + fi + + # check for swig + if test x_$ldns_have_python != x_no; then + sinclude(ac_pkg_swig.m4) + AC_PROG_SWIG + if test ! -x "$SWIG"; then + AC_ERROR([failed to find swig tool, install it, or do not build pyldns]) + else + AC_DEFINE(HAVE_SWIG,1,[Define if you have Swig libraries and header files.]) + AC_SUBST(PYLDNS, "pyldns") + AC_SUBST(swig, "$SWIG") + fi + else + AC_MSG_RESULT([*** don't have Python, skipping Swig, no pyldns ***]) + fi +fi + +# Use libtool +ACX_LIBTOOL_C_ONLY + +tmp_CPPFLAGS=$CPPFLAGS +tmp_LDFLAGS=$LDFLAGS +tmp_LIBS=$LIBS + +ACX_WITH_SSL_OPTIONAL + +AC_CHECK_FUNCS([EVP_sha256]) + +# for macosx, see if glibtool exists and use that +# BSD's need to know the version... +#AC_CHECK_PROG(glibtool, glibtool, [glibtool], ) +#AC_CHECK_PROGS(libtool, [libtool15 libtool], [./libtool]) + +AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) +case "$enable_sha2" in + no) + ;; + yes|*) + if test "x$HAVE_SSL" != "xyes"; then + AC_MSG_ERROR([SHA2 enabled, but no SSL support]) + fi + AC_MSG_CHECKING(for SHA256 and SHA512) + AC_CHECK_FUNC(SHA256_Init, [], [ + AC_MSG_ERROR([No SHA2 functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-sha2]) + ]) + AC_DEFINE_UNQUOTED([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) + ;; +esac + +AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) +case "$enable_gost" in + no) + ;; + *) dnl default + if test "x$HAVE_SSL" != "xyes"; then + AC_MSG_ERROR([GOST enabled, but no SSL support]) + fi + AC_MSG_CHECKING(for GOST) + AC_CHECK_FUNC(EVP_PKEY_set_type_str, [],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost])]) + AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost])]) + AC_DEFINE_UNQUOTED([USE_GOST], [1], [Define this to enable GOST support.]) + ;; +esac + +AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--enable-ecdsa], [Enable ECDSA support, experimental])) +case "$enable_ecdsa" in + yes) + if test "x$HAVE_SSL" != "xyes"; then + AC_MSG_ERROR([ECDSA enabled, but no SSL support]) + fi + AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA])]) + AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384])]) + AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curve])], [AC_INCLUDES_DEFAULT +#include + ]) + # we now know we have ECDSA and the required curves. + AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) + AC_WARN([ + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************]) + ;; + no) + ;; + *) + ;; +esac + +AC_SUBST(LIBSSL_CPPFLAGS) +AC_SUBST(LIBSSL_LDFLAGS) +AC_SUBST(LIBSSL_LIBS) +CPPFLAGS=$tmp_CPPFLAGS +LDFLAGS=$tmp_LDFLAGS +LIBS=$tmp_LIBS + +# add option to disable installation of ldns-config script +AC_ARG_ENABLE(ldns-config, [ --disable-ldns-config disable installation of ldns-config (default=enabled)], + enable_ldns_config=$enableval, enable_ldns_config=yes) +if test "x$enable_ldns_config" = xyes; then + INSTALL_LDNS_CONFIG="yes" +else + INSTALL_LDNS_CONFIG="no" +fi +AC_SUBST(INSTALL_LDNS_CONFIG) + +# add option to disable the evil rpath +ACX_ARG_RPATH + +#AC_TRY_RUN( +#[ +#int main() +#{ +#short one = 1; +#char *cp = (char*)&one; +#if ( *cp == 0 ) +#return(0); +#else +#return(1); +#} +#], [],[ +#AC_DEFINE(CONFCHECK_LITTLE_ENDIAN, 1, [system appears to be little-endian]) +#],[]) + +# should define WORDS_BIGENDIAN if the system is big-endian +AC_C_BIGENDIAN + +# Checks for header files. +AC_HEADER_STDC +#AC_HEADER_SYS_WAIT +#AC_CHECK_HEADERS([getopt.h fcntl.h stdlib.h string.h strings.h unistd.h]) +# do the very minimum - we can always extend this +AC_CHECK_HEADERS([getopt.h stdarg.h stdbool.h openssl/ssl.h netinet/in.h time.h arpa/inet.h netdb.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS(sys/param.h sys/mount.h,,, +[AC_INCLUDES_DEFAULT + [ + #if HAVE_SYS_PARAM_H + # include + #endif + ] +]) +AC_CHECK_HEADER(sys/socket.h, +[ +include_sys_socket_h='#include ' +AC_DEFINE(HAVE_SYS_SOCKET_H, 1, [define if you have sys/socket.h]) +],[ +include_sys_socket_h='' +],[AC_INCLUDES_DEFAULT + [ + #if HAVE_SYS_PARAM_H + # include + #endif + ] +]) +AC_SUBST(include_sys_socket_h) +AC_CHECK_HEADER(inttypes.h, +[ +include_inttypes_h='#include ' +AC_DEFINE(HAVE_INTTYPES_H, 1, [define if you have inttypes.h]) +],[ +include_inttypes_h='' +],[AC_INCLUDES_DEFAULT +]) +AC_SUBST(include_inttypes_h) +AC_CHECK_HEADER(sys/types.h, +[ +include_systypes_h='#include ' +AC_DEFINE(HAVE_SYS_TYPES_H, 1, [define if you have sys/types.h]) +],[ +include_systypes_h='' +],[AC_INCLUDES_DEFAULT +]) +AC_SUBST(include_systypes_h) +AC_CHECK_HEADER(unistd.h, +[ +include_unistd_h='#include ' +AC_DEFINE(HAVE_UNISTD_H, 1, [define if you have unistd.h]) +],[ +include_unistd_h='' +],[AC_INCLUDES_DEFAULT +]) +AC_SUBST(include_unistd_h) + +ACX_TYPE_SOCKLEN_T +AC_CHECK_TYPE(ssize_t, int) +AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) +AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) +ACX_CHECK_SS_FAMILY + +AC_FUNC_MALLOC +AC_FUNC_REALLOC + +AC_REPLACE_FUNCS(b64_pton) +AC_REPLACE_FUNCS(b64_ntop) +AC_REPLACE_FUNCS(b32_pton) +AC_REPLACE_FUNCS(b32_ntop) +AC_REPLACE_FUNCS(timegm) +AC_REPLACE_FUNCS(gmtime_r) +AC_REPLACE_FUNCS(ctime_r) +AC_REPLACE_FUNCS(isblank) +AC_REPLACE_FUNCS(isascii) +AC_REPLACE_FUNCS(inet_aton) +AC_REPLACE_FUNCS(inet_pton) +AC_REPLACE_FUNCS(inet_ntop) +AC_REPLACE_FUNCS(snprintf) +AC_REPLACE_FUNCS(strlcpy) +AC_REPLACE_FUNCS(memmove) +AC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul]) + +ACX_CHECK_GETADDRINFO_WITH_INCLUDES +if test $ac_cv_func_getaddrinfo = no; then + AC_LIBOBJ([fake-rfc2553]) +fi +if test "$USE_WINSOCK" = 1; then + AC_CHECK_TOOL(WINDRES, windres) +fi +ACX_FUNC_IOCTLSOCKET + +#AC_SEARCH_LIBS(RSA_new, [crypto]) + +ACX_CHECK_FORMAT_ATTRIBUTE +ACX_CHECK_UNUSED_ATTRIBUTE + +# check OSX deployment target which is needed +if echo $build_os | grep darwin > /dev/null; then + export MACOSX_DEPLOYMENT_TARGET="10.4" +fi + +AC_DEFINE([SYSCONFDIR], [sysconfdir], [System configuration dir]) + +AH_BOTTOM([ +#include +#include +#include +#include + +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + +#ifndef BYTE_ORDER +#ifdef WORDS_BIGENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* WORDS_BIGENDIAN */ +#endif /* BYTE_ORDER */ + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif +] +AHX_CONFIG_W32_FD_SET_T +) + +AH_BOTTOM([ +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef B64_PTON +int ldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b64_ntop + */ +/*@unused@*/ +static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) +{ + return ((((srcsize + 2) / 3) * 4) + 1); +} +#endif /* !B64_PTON */ +#ifndef B64_NTOP +int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of ldns_b64_pton + */ +/*@unused@*/ +static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) +{ + return (((((srcsize + 3) / 4) * 3)) + 1); +} +#endif /* !B64_NTOP */ + +#ifndef HAVE_SLEEP +/* use windows sleep, in millisecs, instead */ +#define sleep(x) Sleep((x)*1000) +#endif + +#ifndef HAVE_RANDOM +#define srandom(x) srand(x) +#define random(x) rand(x) +#endif + +#ifndef HAVE_TIMEGM +#include +time_t timegm (struct tm *tm); +#endif /* !TIMEGM */ +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *timep, struct tm *result); +#endif +#ifndef HAVE_ISBLANK +int isblank(int c); +#endif /* !HAVE_ISBLANK */ +#ifndef HAVE_ISASCII +int isascii(int c); +#endif /* !HAVE_ISASCII */ +#ifndef HAVE_SNPRINTF +#include +int snprintf (char *str, size_t count, const char *fmt, ...); +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); +#endif /* HAVE_SNPRINTF */ +#ifndef HAVE_INET_PTON +int inet_pton(int af, const char* src, void* dst); +#endif /* HAVE_INET_PTON */ +#ifndef HAVE_INET_NTOP +const char *inet_ntop(int af, const void *src, char *dst, size_t size); +#endif +#ifndef HAVE_INET_ATON +int inet_aton(const char *cp, struct in_addr *addr); +#endif +#ifndef HAVE_MEMMOVE +void *memmove(void *dest, const void *src, size_t n); +#endif +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t siz); +#endif +#ifdef __cplusplus +} +#endif +#ifndef HAVE_GETADDRINFO +#include "compat/fake-rfc2553.h" +#endif +#ifndef HAVE_STRTOUL +#define strtoul (unsigned long)strtol +#endif +]) + +AC_CONFIG_FILES([Makefile ldns/net.h ldns/util.h packaging/libldns.pc packaging/ldns-config]) + +AC_CONFIG_HEADER([ldns/config.h]) +AC_OUTPUT +COPY_HEADER_FILES(ldns/, ldns/) + +AC_CONFIG_SUBDIRS([drill]) diff --git a/libs/ldns/configure.gnu b/libs/ldns/configure.gnu new file mode 100644 index 0000000000..2fae4310cd --- /dev/null +++ b/libs/ldns/configure.gnu @@ -0,0 +1,4 @@ +#! /bin/sh +srcpath=$(dirname $0 2>/dev/null ) || srcpath="." +$srcpath/configure "$@" --with-pic --disable-gost + diff --git a/libs/ldns/contrib/NETLDNS.readme.txt b/libs/ldns/contrib/NETLDNS.readme.txt new file mode 100644 index 0000000000..29069b6a3c --- /dev/null +++ b/libs/ldns/contrib/NETLDNS.readme.txt @@ -0,0 +1,10 @@ +NETLDNS is a functionality port of NLnet Labs' LDNS to the .NET +2.0 framework, contributed by Alex Nicoll of the Carnegie Mellon +University Software Engineering Institute. NETLDNS is released +under the BSD license. NETLDNS uses Mihnea Radulescu's BigInteger +Library (http://www.codeproject.com/KB/cs/BigInteger_Library.aspx) +from CodeProject to help with key manipulation. Please contact Alex at +anicoll@cert.org with inquiries or requests for newer versions. + +This project is not supported by NLnet Labs. + diff --git a/libs/ldns/contrib/build-solaris.sh b/libs/ldns/contrib/build-solaris.sh new file mode 100644 index 0000000000..9f35728ea7 --- /dev/null +++ b/libs/ldns/contrib/build-solaris.sh @@ -0,0 +1,50 @@ +#!/bin/ksh +# +# $Id: build-solaris.sh 2597 2008-04-15 08:39:58Z jelte $ + + +PREFIX=/opt/ldns +OPENSSL=/usr/sfw +SUDO=sudo + +MAKE_PROGRAM=gmake +MAKE_ARGS="-j 4" + +OBJ32=obj32 +OBJ64=obj64 + +SRCDIR=`pwd` + + +test -d $OBJ32 && $SUDO rm -fr $OBJ32 +mkdir $OBJ32 + +export CFLAGS="" +export LDFLAGS="-L${OPENSSL}/lib -R${OPENSSL}/lib" + +(cd $OBJ32; \ +${SRCDIR}/configure --with-ssl=${OPENSSL} --prefix=${PREFIX} --libdir=${PREFIX}/lib; \ +$MAKE_PROGRAM $MAKE_ARGS) + +if [ `isainfo -k` = amd64 ]; then + test -d $OBJ64 && $SUDO rm -fr $OBJ64 + mkdir $OBJ64 + + export CFLAGS="-m64" + export LDFLAGS="-L${OPENSSL}/lib/amd64 -R${OPENSSL}/lib/amd64" + + (cd $OBJ64; \ + ${SRCDIR}/configure --with-ssl=${OPENSSL} --prefix=${PREFIX} --libdir=${PREFIX}/lib/amd64; \ + $MAKE_PROGRAM $MAKE_ARGS) +fi + +# optionally install +# +if [ x$1 = xinstall ]; then + (cd $OBJ32; $SUDO $MAKE_PROGRAM install-h) + (cd $OBJ32; $SUDO $MAKE_PROGRAM install-doc) + (cd $OBJ32; $SUDO $MAKE_PROGRAM install-lib) + if [ `isainfo -k` = amd64 ]; then + (cd $OBJ64; $SUDO $MAKE_PROGRAM install-lib) + fi +fi diff --git a/libs/ldns/contrib/python/LICENSE b/libs/ldns/contrib/python/LICENSE new file mode 100644 index 0000000000..1eb01e1216 --- /dev/null +++ b/libs/ldns/contrib/python/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + Karel Slany (slany AT fit.vutbr.cz) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the organization nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/ldns/contrib/python/Makefile b/libs/ldns/contrib/python/Makefile new file mode 100644 index 0000000000..15a5086050 --- /dev/null +++ b/libs/ldns/contrib/python/Makefile @@ -0,0 +1,67 @@ +# Makefile: compilation of sources and documentation, test environment +# +# Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) +# Karel Slany (slany AT fit.vutbr.cz) +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# * Neither the name of the organization nor the names of its +# contributors may be used to endorse or promote products derived from this +# software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. + +help: + @echo "Please use \`make ' where is one of" + @echo " testenv to make test environment and run bash " + @echo " usefull in case you don't want to install ldns but want to test examples" + @echo " doc to make documentation" + @echo " clean clean all" + +../../Makefile: ../../configure + cd ../.. && ./configure --with-python + +_ldns.so: ../../Makefile + $(MAKE) -C ../.. + +../../.libs/ldns.so.1: ../../Makefile + $(MAKE) -C ../.. + +clean: + rm -rdf examples/ldns + rm -f _ldns.so ldns_wrapper.o + $(MAKE) -C ../.. clean + +testenv: ../../.libs/libldns.so.1 _ldns.so + rm -rdf examples/ldns + cd examples && mkdir ldns && ln -s ../../ldns.py ldns/__init__.py && ln -s ../../_ldns.so ldns/_ldns.so && ln -s ../../../../.libs/libldns.so.1 ldns/libldns.so.1 && ls -la + @echo "Run a script by typing ./script_name.py" + cd examples && LD_LIBRARY_PATH=ldns bash + rm -rdf examples/ldns + +doc: ../../.libs/ldns.so.1 _ldns.so + $(MAKE) -C docs html + +#for development only +swig: ldns.i + swig -python -o ldns_wrapper.c -I../.. ldns.i + gcc -c ldns_wrapper.c -O9 -fPIC -I../.. -I../../ldns -I/usr/include/python2.5 -I. -o ldns_wrapper.o + ld -shared ldns_wrapper.o -L../../.libs -lldns -o _ldns.so + diff --git a/libs/ldns/contrib/python/docs/Makefile b/libs/ldns/contrib/python/docs/Makefile new file mode 100644 index 0000000000..856ecd45e1 --- /dev/null +++ b/libs/ldns/contrib/python/docs/Makefile @@ -0,0 +1,70 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source + +.PHONY: help clean html web pickle htmlhelp latex changes linkcheck + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " pickle to make pickle files (usable by e.g. sphinx-web)" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " changes to make an overview over all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + +clean: + -rm -rf build/* + +html: + mkdir -p build/html build/doctrees + LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html + @echo + @echo "Build finished. The HTML pages are in build/html." + +pickle: + mkdir -p build/pickle build/doctrees + LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle + @echo + @echo "Build finished; now you can process the pickle files or run" + @echo " sphinx-web build/pickle" + @echo "to start the sphinx-web server." + +web: pickle + +htmlhelp: + mkdir -p build/htmlhelp build/doctrees + LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in build/htmlhelp." + +latex: + mkdir -p build/latex build/doctrees + LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex + @echo + @echo "Build finished; the LaTeX files are in build/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + mkdir -p build/changes build/doctrees + LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes + @echo + @echo "The overview file is in build/changes." + +linkcheck: + mkdir -p build/linkcheck build/doctrees + LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in build/linkcheck/output.txt." diff --git a/libs/ldns/contrib/python/docs/source/conf.py b/libs/ldns/contrib/python/docs/source/conf.py new file mode 100644 index 0000000000..22b73bcd71 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/conf.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +# +# Unbound documentation build configuration file, created by +# sphinx-quickstart on Fri Jan 2 19:14:13 2009. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# The contents of this file are pickled, so don't put values in the namespace +# that aren't pickleable (module imports are okay, they're removed automatically). +# +# All configuration values have a default value; values that are commented out +# serve to show the default value. + +import sys, os + +# If your extensions are in another directory, add it here. If the directory +# is relative to the documentation root, use os.path.abspath to make it +# absolute, like shown here. +sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'../../'))) +#print sys.path + +# General configuration +# --------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The master toctree document. +master_doc = 'index' + +# General substitutions. +project = 'pyLDNS' +copyright = '2009, Karel Slany, Zdenek Vasicek' + +# The default replacements for |version| and |release|, also used in various +# other places throughout the built documents. +# +# The short X.Y version. +version = '1.0' +# The full version, including alpha/beta/rc tags. +release = '1.0.0' + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directories, that shouldn't be searched +# for source files. +#exclude_dirs = [] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + + +# Options for HTML output +# ----------------------- + +# The style sheet to use for HTML and HTML Help pages. A file of that name +# must exist either in Sphinx' static/ path, or in one of the custom paths +# given in html_static_path. +html_style = 'default.css' + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (within the static path) to place at the top of +# the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +html_use_modindex = False + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +html_split_index = False + +# If true, the reST sources are included in the HTML build as _sources/. +html_copy_source = False + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'ldnsdoc' + + +# Options for LaTeX output +# ------------------------ + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, document class [howto/manual]). +latex_documents = [ + ('index', 'ldns-doc.tex', 'LDNS Documentation', + 'Karel Slany, Zdenek Vasicek', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True diff --git a/libs/ldns/contrib/python/docs/source/examples/example1.rst b/libs/ldns/contrib/python/docs/source/examples/example1.rst new file mode 100644 index 0000000000..b44141759f --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example1.rst @@ -0,0 +1,68 @@ +Resolving the MX records +============================== + +This basic example shows how to create a resolver which asks for MX records which contain the information about mail servers. + +:: + + #!/usr/bin/python + # + # MX is a small program that prints out the mx records for a particular domain + # + import ldns + + resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + + dname = ldns.ldns_dname("nic.cz") + + pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) + if (pkt): + mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) + if (mx): + mx.sort() + print mx + +Resolving step by step +------------------------ + +First of all we import :mod:`ldns` extension module which make LDNS functions and classes accessible:: + + import ldns + +If importing fails, it means that Python cannot find the module or ldns library. + +Then we create the resolver by :meth:`ldns.ldns_resolver.new_frm_file` constructor :: + + resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + +and domain name variable dname:: + + dname = ldns.ldns_dname("nic.cz") + +To create a resolver you may also use:: + + resolver = ldns.ldns_resolver.new_frm_file(None) + +which behaves in the same manner as the command above. + +In the third step we tell the resolver to query for our domain, type MX, of class IN:: + + pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) + +The function should return a packet if everything goes well and this packet will contain resource records we asked for. +Note that there exists a simplier way. Instead of using a dname variable, we can use a string which will be automatically converted. +:: + + pkt = resolver.query("fit.vutbr.cz", ldns.LDNS_RR_TYPE_MX, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) + +Now, we test whether the resolver returns a packet and then get all RRs of type MX from the answer packet and store them in list mx:: + + if (pkt): + mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) + +If this list is not empty, we sort and print the content to stdout:: + + if (mx): + mx.sort() + print mx + diff --git a/libs/ldns/contrib/python/docs/source/examples/example2.py b/libs/ldns/contrib/python/docs/source/examples/example2.py new file mode 100755 index 0000000000..bb2acfdf76 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example2.py @@ -0,0 +1,45 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import ldns +import sys + +debug = True + +# Check args +argc = len(sys.argv) +name = "www.nic.cz" +if argc < 2: + print "Usage:", sys.argv[0], "domain [resolver_addr]" + sys.exit(1) +else: + name = sys.argv[1] + +# Create resolver +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") +resolver.set_dnssec(True) + +# Custom resolver +if argc > 2: + # Clear previous nameservers + ns = resolver.pop_nameserver() + while ns != None: + ns = resolver.pop_nameserver() + ip = ldns.ldns_rdf.new_frm_str(sys.argv[2], ldns.LDNS_RDF_TYPE_A) + resolver.push_nameserver(ip) + +# Resolve DNS name +pkt = resolver.query(name, ldns.LDNS_RR_TYPE_A, ldns.LDNS_RR_CLASS_IN) +if pkt and pkt.answer(): + + # Debug + if debug: + print "NS returned:", pkt.get_rcode(), "(AA: %d AD: %d)" % ( pkt.ad(), pkt.ad() ) + + # SERVFAIL indicated bogus name + if pkt.get_rcode() is ldns.LDNS_RCODE_SERVFAIL: + print name, "is bogus" + + # Check AD (Authenticated) bit + if pkt.get_rcode() is ldns.LDNS_RCODE_NOERROR: + if pkt.ad(): print name, "is secure" + else: print name, "is insecure" diff --git a/libs/ldns/contrib/python/docs/source/examples/example2.rst b/libs/ldns/contrib/python/docs/source/examples/example2.rst new file mode 100644 index 0000000000..b1734386e7 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example2.rst @@ -0,0 +1,100 @@ +.. _ex_dnssec: + +Querying DNS-SEC validators +=========================== + +This basic example shows how to query validating resolver and +evaluate answer. + +Resolving step by step +------------------------ + +For DNS queries, we need to initialize ldns resolver (covered in previous example). + +:: + + # Create resolver + resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + resolver.set_dnssec(True) + + # Custom resolver + if argc > 2: + # Clear previous nameservers + ns = resolver.pop_nameserver() + while ns != None: + ns = resolver.pop_nameserver() + ip = ldns.ldns_rdf.new_frm_str(sys.argv[2], ldns.LDNS_RDF_TYPE_A) + resolver.push_nameserver(ip) + +Note the second line :meth:`resolver.set_dnssec`, which enables DNSSEC OK bit +in queries in order to get meaningful results. + +As we have resolver initialized, we can start querying for domain names : + +:: + + # Resolve DNS name + pkt = resolver.query(name, ldns.LDNS_RR_TYPE_A, ldns.LDNS_RR_CLASS_IN) + if pkt and pkt.answer(): + +Now we evaluate result, where two flags are crucial : + + * Return code + * AD flag (authenticated) + +When return code is `SERVFAIL`, it means that validating resolver marked requested +name as **bogus** (or bad configuration). + +**AD** flag is set if domain name is authenticated **(secure)** or false if +it's insecure. + +Complete source code +-------------------- + + .. literalinclude:: ../../../examples/ldns-dnssec.py + :language: python + + +Testing +------- + +In order to get meaningful results, you have to enter IP address of validating +resolver or setup your own (see howto). + +Execute `./example2.py` with options `domain name` and `resolver IP`, +example: + +:: + + user@localhost# ./example2.py www.dnssec.cz 127.0.0.1 # Secure (Configured Unbound running on localhost) + user@localhost# ./example2.py www.rhybar.cz 127.0.0.1 # Bogus + +Howto setup Unbound as validating resolver +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Install Unbound according to instructions. +Modify following options in `unbound.conf` (located in `/etc` or `/usr/local/etc`)/ + + +Uncomment `module-config` and set `validator` before iterator. + +:: + + module-config: "validator iterator" + +Download DLV keys and update path in `unbound.conf`:: + + # DLV keys + # Download from http://ftp.isc.org/www/dlv/dlv.isc.org.key + dlv-anchor-file: "/usr/local/etc/unbound/dlv.isc.org.key" + +Update trusted keys (`.cz` for example):: + + # Trusted keys + # For current key, see www.dnssec.cz + trusted-keys-file: "/usr/local/etc/unbound/trusted.key" + +Now you should have well configured Unbound, so run it:: + + user@localhost# unbound -dv + diff --git a/libs/ldns/contrib/python/docs/source/examples/example3.rst b/libs/ldns/contrib/python/docs/source/examples/example3.rst new file mode 100644 index 0000000000..91f5e9d144 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example3.rst @@ -0,0 +1,7 @@ +High-level functions +=========================== + +This basic example shows how to get name by addr and vice versa. + +.. literalinclude:: ../../../examples/ldns-higher.py + :language: python diff --git a/libs/ldns/contrib/python/docs/source/examples/example4.rst b/libs/ldns/contrib/python/docs/source/examples/example4.rst new file mode 100644 index 0000000000..2f41f76bde --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example4.rst @@ -0,0 +1,7 @@ +AXFR client with IDN support +=============================== + +This example shows how to get AXFR working and how to get involved Internationalized Domain Names (IDN) + +.. literalinclude:: ../../../examples/ldns-axfr.py + :language: python diff --git a/libs/ldns/contrib/python/docs/source/examples/example5.rst b/libs/ldns/contrib/python/docs/source/examples/example5.rst new file mode 100644 index 0000000000..787c169265 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example5.rst @@ -0,0 +1,14 @@ +Examine the results +=============================== + +This example shows how to go through the obtained results + +.. literalinclude:: ../../../examples/ldns-mx2.py + :language: python + +This snippet of code prints:: + + nic.cz. 1761 IN MX 20 mx.cznic.org. + nic.cz. 1761 IN MX 10 mail.nic.cz. + nic.cz. 1761 IN MX 15 mail4.nic.cz. + diff --git a/libs/ldns/contrib/python/docs/source/examples/example6.rst b/libs/ldns/contrib/python/docs/source/examples/example6.rst new file mode 100644 index 0000000000..d0fd689980 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example6.rst @@ -0,0 +1,12 @@ +Read zone file +=============================== + +This example shows how to read the content of a zone file + +.. literalinclude:: ../../../examples/ldns-zone.py + :language: python + +Zone file ``zone.txt``: + +.. literalinclude:: ../../../examples/zone.txt + diff --git a/libs/ldns/contrib/python/docs/source/examples/example7.rst b/libs/ldns/contrib/python/docs/source/examples/example7.rst new file mode 100644 index 0000000000..3e3e2dc22e --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example7.rst @@ -0,0 +1,8 @@ +Generate public/private key pair +======================================= + +This example shows how generate keys for DNSSEC (i.e. for signing a zone file according DNSSECbis). + +.. literalinclude:: ../../../examples/ldns-keygen.py + :language: python + diff --git a/libs/ldns/contrib/python/docs/source/examples/example8.rst b/libs/ldns/contrib/python/docs/source/examples/example8.rst new file mode 100644 index 0000000000..6fc550a860 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/example8.rst @@ -0,0 +1,17 @@ +Signing of a zone file +=============================== + +This example shows how to sign the content of the given zone file + +.. literalinclude:: ../../../examples/ldns-signzone.py + :language: python + +In order to be able sign a zone file, you have to generate a key-pair using ``ldns-keygen.py``. Don't forget to modify tag number. + +Signing consists of three steps + +1. In the first step, the content of a zone file is readed and parsed. This can be done using :class:`ldns.ldns_zone` class. + +2. In the second step, the private and public key is readed and public key is inserted into zone (as DNSKEY). + +3. In the last step, the DNSSEC zone instace is created and all the RRs from zone file are copied here. Then, all the records are signed using :meth:`ldns.ldns_zone.sign` method. If the signing was successfull, the content of DNSSEC zone is written to a file. diff --git a/libs/ldns/contrib/python/docs/source/examples/index.rst b/libs/ldns/contrib/python/docs/source/examples/index.rst new file mode 100644 index 0000000000..8f7f381c32 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/examples/index.rst @@ -0,0 +1,12 @@ +Tutorials +============================== + +Here you can find a set of simple applications which utilizes the ldns library in Python environment. + +`Tutorials` + +.. toctree:: + :maxdepth: 1 + :glob: + + example* diff --git a/libs/ldns/contrib/python/docs/source/index.rst b/libs/ldns/contrib/python/docs/source/index.rst new file mode 100644 index 0000000000..d00b639d1a --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/index.rst @@ -0,0 +1,22 @@ +PyLDNS documentation +======================================= + +PyLDNS provides an `LDNS`_ wrapper (Python extension module) - the thinnest layer over the library possible. Everything you can do from the C API, you can do from Python, but with less effort. The purpose of porting LDNS library to Python is to simplify DNS programming and usage of LDNS, however, still preserve the performance of this library as the speed represents the main benefit of LDNS. The proposed object approach allows the users to be concentrated at the essential part of application only and don't bother with deallocation of objects and so on. + +.. _LDNS: http://www.nlnetlabs.nl/projects/ldns/ + +Contents +---------- +.. toctree:: + :maxdepth: 2 + + install.rst + examples/index.rst + modules/ldns + +Indices and tables +------------------- + +* :ref:`genindex` +* :ref:`search` + diff --git a/libs/ldns/contrib/python/docs/source/install.rst b/libs/ldns/contrib/python/docs/source/install.rst new file mode 100644 index 0000000000..b3845b6e21 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/install.rst @@ -0,0 +1,46 @@ +Installation +=================================== + +**Prerequisites** + +Python 2.4 or higher, SWIG 1.3 or higher, GNU make + +**Download** + +You can download the source codes `here`_. +The latest release is 1.4.1, Jan 15, 2009. + +.. _here: ldns-1.4.1-py.tar.gz + +**Compiling** + +After downloading, you can compile the library by doing:: + + > tar -xzf ldns-1.4.1-py.tar.gz + > cd ldns-1.4.1 + > ./configure --with-pyldns + > make + +You need GNU make to compile pyLDNS; SWIG and Python development libraries to compile extension module. + + +**Testing** + +If the compilation is successfull, you can test the python LDNS extension module by:: + + > cd contrib/python + > make testenv + > ./ldns-mx.py + +This will start a new shell, during which the symbolic links will be working. +When you exit the shell, then symbolic links will be deleted. + +In ``contrib/examples`` you can find many simple applications in python which demostrates the capabilities of LDNS library. + +**Installation** + +To install libraries and extension type:: + + > cd ldns-1.4.1 + > make install + diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns.rst b/libs/ldns/contrib/python/docs/source/modules/ldns.rst new file mode 100644 index 0000000000..2c5e7b2455 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns.rst @@ -0,0 +1,40 @@ +LDNS module documentation +================================ + +Here you can find the documentation of pyLDNS extension module. This module consists of several classes and a couple of functions. + +.. toctree:: + :maxdepth: 1 + :glob: + + ldns_resolver + ldns_pkt + ldns_rr + ldns_rdf + ldns_dname + ldns_rr_list + ldns_zone + ldns_key + ldns_key_list + ldns_buffer + ldns_dnssec + ldns_func + + + + +**Differences against libLDNS** + +* You don't need to use ldns-compare functions, instances can be compared using standard operators <, >, = :: + + if (some_rr.owner() == another_rr.rdf(1)): + pass + +* Classes contain static methods that create new instances, the name of these methods starts with the new\_ prefix (e.g. :meth:`ldns.ldns_pkt.new_frm_file`). + +* Is it possible to print the content of an object using ``print objinst`` (see :meth:`ldns.ldns_resolver.get_addr_by_name`). + +* Classes contain write_to_buffer method that writes the content into buffer. + +* All the methods that consume parameter of (const ldns_rdf) type allows to use string instead (see :meth:`ldns.ldns_resolver.query`). + diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_buffer.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_buffer.rst new file mode 100644 index 0000000000..7f59e75e3e --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_buffer.rst @@ -0,0 +1,11 @@ +Class ldns_buffer +================================ + + +.. automodule:: ldns + +Class ldns_buffer +------------------------------ +.. autoclass:: ldns_buffer + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_dname.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_dname.rst new file mode 100644 index 0000000000..18373bf8e6 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_dname.rst @@ -0,0 +1,11 @@ +Class ldns_dname +================================ + + +.. automodule:: ldns + +Class ldns_dname +------------------------------ +.. autoclass:: ldns_dname + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_dnssec.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_dnssec.rst new file mode 100644 index 0000000000..bc5719dd55 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_dnssec.rst @@ -0,0 +1,28 @@ +Class ldns_dnssec_zone +================================ + +.. automodule:: ldns + +Class ldns_dnssec_zone +------------------------------ +.. autoclass:: ldns_dnssec_zone + :members: + :undoc-members: + +Class ldns_dnssec_name +------------------------------ +.. autoclass:: ldns_dnssec_name + :members: + :undoc-members: + +Class ldns_dnssec_rrsets +------------------------------ +.. autoclass:: ldns_dnssec_rrsets + :members: + :undoc-members: + +Class ldns_dnssec_rrs +------------------------------ +.. autoclass:: ldns_dnssec_rrs + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_func.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_func.rst new file mode 100644 index 0000000000..7a9b8a8959 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_func.rst @@ -0,0 +1,253 @@ +Various functions +================================ + +Here you can find list of functions that are not assigned to the classes. +These functions have the same parameters as LDNS functions of the same name. +You are encouraged to read the LDNS documentation. + +**List of functions** + + * ldns_algorithm2buffer_str + * ldns_bget_keyword_data + * ldns_bget_token + * ldns_bgetc + * ldns_bskipcs + * ldns_bubblebabble + * ldns_buffer2pkt_wire + * ldns_buffer2str + * ldns_calc_keytag + * ldns_calc_keytag_raw + * ldns_cert_algorithm2buffer_str + * ldns_convert_dsa_rrsig_asn12rdf + * ldns_convert_dsa_rrsig_rdf2asn1 + * ldns_create_nsec + * ldns_create_nsec3 + * ldns_dname2buffer_wire + * ldns_dname2canonical + * ldns_dnssec_build_data_chain + * ldns_dnssec_chain_nsec3_list + * ldns_dnssec_create_nsec + * ldns_dnssec_create_nsec3 + * ldns_dnssec_create_nsec_bitmap + * ldns_dnssec_data_chain_deep_free + * ldns_dnssec_data_chain_free + * ldns_dnssec_data_chain_new + * ldns_dnssec_data_chain_print + * ldns_dnssec_default_add_to_signatures + * ldns_dnssec_default_delete_signatures + * ldns_dnssec_default_leave_signatures + * ldns_dnssec_default_replace_signatures + * ldns_dnssec_derive_trust_tree + * ldns_dnssec_derive_trust_tree_dnskey_rrset + * ldns_dnssec_derive_trust_tree_ds_rrset + * ldns_dnssec_derive_trust_tree_no_sig + * ldns_dnssec_derive_trust_tree_normal_rrset + * ldns_dnssec_get_dnskey_for_rrsig + * ldns_dnssec_get_rrsig_for_name_and_type + * ldns_dnssec_nsec3_closest_encloser + * ldns_dnssec_pkt_get_rrsigs_for_name_and_type + * ldns_dnssec_pkt_get_rrsigs_for_type + * ldns_dnssec_pkt_has_rrsigs + * ldns_dnssec_remove_signatures + * ldns_dnssec_trust_tree_add_parent + * ldns_dnssec_trust_tree_contains_keys + * ldns_dnssec_trust_tree_depth + * ldns_dnssec_trust_tree_free + * ldns_dnssec_trust_tree_new + * ldns_dnssec_trust_tree_print + * ldns_dnssec_verify_denial + * ldns_dnssec_verify_denial_nsec3 + * ldns_fetch_valid_domain_keys + * ldns_fget_keyword_data + * ldns_fget_keyword_data_l + * ldns_fget_token + * ldns_fget_token_l + * ldns_fskipcs + * ldns_fskipcs_l + * ldns_get_bit + * ldns_get_bit_r + * ldns_get_errorstr_by_id + * ldns_get_rr_class_by_name + * ldns_get_rr_list_addr_by_name + * ldns_get_rr_list_hosts_frm_file + * ldns_get_rr_list_hosts_frm_fp + * ldns_get_rr_list_hosts_frm_fp_l + * ldns_get_rr_list_name_by_addr + * ldns_get_rr_type_by_name + * ldns_getaddrinfo + * ldns_hexdigit_to_int + * ldns_hexstring_to_data + * ldns_init_random + * ldns_int_to_hexdigit + * ldns_is_rrset + * ldns_key2buffer_str + * ldns_key2rr + * ldns_key2str + * ldns_lookup_by_id + * ldns_lookup_by_name + * ldns_native2rdf_int16 + * ldns_native2rdf_int16_data + * ldns_native2rdf_int32 + * ldns_native2rdf_int8 + * ldns_nsec3_add_param_rdfs + * ldns_nsec3_algorithm + * ldns_nsec3_bitmap + * ldns_nsec3_flags + * ldns_nsec3_hash_name + * ldns_nsec3_hash_name_frm_nsec3 + * ldns_nsec3_iterations + * ldns_nsec3_next_owner + * ldns_nsec3_optout + * ldns_nsec3_salt + * ldns_nsec3_salt_data + * ldns_nsec3_salt_length + * ldns_nsec_bitmap_covers_type + * ldns_nsec_covers_name + * ldns_nsec_get_bitmap + * ldns_nsec_type_check + * ldns_octet + * ldns_pkt2buffer_str + * ldns_pkt2buffer_wire + * ldns_pkt2str + * ldns_pkt2wire + * ldns_pktheader2buffer_str + * ldns_power + * ldns_print_rr_rdf + * ldns_rbtree_create + * ldns_rbtree_delete + * ldns_rbtree_find_less_equal + * ldns_rbtree_first + * ldns_rbtree_free + * ldns_rbtree_init + * ldns_rbtree_insert + * ldns_rbtree_insert_vref + * ldns_rbtree_last + * ldns_rbtree_next + * ldns_rbtree_previous + * ldns_rbtree_search + * ldns_rdf2buffer_str + * ldns_rdf2buffer_str_a + * ldns_rdf2buffer_str_aaaa + * ldns_rdf2buffer_str_alg + * ldns_rdf2buffer_str_apl + * ldns_rdf2buffer_str_b64 + * ldns_rdf2buffer_str_cert_alg + * ldns_rdf2buffer_str_class + * ldns_rdf2buffer_str_dname + * ldns_rdf2buffer_str_hex + * ldns_rdf2buffer_str_int16 + * ldns_rdf2buffer_str_int16_data + * ldns_rdf2buffer_str_ipseckey + * ldns_rdf2buffer_str_loc + * ldns_rdf2buffer_str_nsap + * ldns_rdf2buffer_str_nsec + * ldns_rdf2buffer_str_period + * ldns_rdf2buffer_str_str + * ldns_rdf2buffer_str_tsig + * ldns_rdf2buffer_str_tsigtime + * ldns_rdf2buffer_str_type + * ldns_rdf2buffer_str_unknown + * ldns_rdf2buffer_str_wks + * ldns_rdf2buffer_wire + * ldns_rdf2buffer_wire_canonical + * ldns_rdf2native_int16 + * ldns_rdf2native_int32 + * ldns_rdf2native_int8 + * ldns_rdf2native_sockaddr_storage + * ldns_rdf2native_time_t + * ldns_rdf2rr_type + * ldns_rdf2str + * ldns_rdf2wire + * ldns_read_anchor_file + * ldns_read_uint16 + * ldns_read_uint32 + * ldns_rr2buffer_str + * ldns_rr2buffer_wire + * ldns_rr2buffer_wire_canonical + * ldns_rr2canonical + * ldns_rr2str + * ldns_rr2wire + * ldns_rrsig2buffer_wire + * ldns_send + * ldns_send_buffer + * ldns_set_bit + * ldns_sign_public + * ldns_sockaddr_storage2rdf + * ldns_str2period + * ldns_str2rdf_a + * ldns_str2rdf_aaaa + * ldns_str2rdf_alg + * ldns_str2rdf_apl + * ldns_str2rdf_b32_ext + * ldns_str2rdf_b64 + * ldns_str2rdf_cert_alg + * ldns_str2rdf_class + * ldns_str2rdf_dname + * ldns_str2rdf_hex + * ldns_str2rdf_int16 + * ldns_str2rdf_int32 + * ldns_str2rdf_int8 + * ldns_str2rdf_loc + * ldns_str2rdf_nsap + * ldns_str2rdf_nsec + * ldns_str2rdf_nsec3_salt + * ldns_str2rdf_period + * ldns_str2rdf_service + * ldns_str2rdf_str + * ldns_str2rdf_time + * ldns_str2rdf_tsig + * ldns_str2rdf_type + * ldns_str2rdf_unknown + * ldns_str2rdf_wks + * ldns_tcp_bgsend + * ldns_tcp_connect + * ldns_tcp_read_wire + * ldns_tcp_send + * ldns_tcp_send_query + * ldns_traverse_postorder + * ldns_tsig_algorithm + * ldns_tsig_keydata + * ldns_tsig_keydata_clone + * ldns_tsig_keyname + * ldns_tsig_keyname_clone + * ldns_udp_bgsend + * ldns_udp_connect + * ldns_udp_read_wire + * ldns_udp_send + * ldns_udp_send_query + * ldns_update_pkt_new + * ldns_update_pkt_tsig_add + * ldns_update_prcount + * ldns_update_set_adcount + * ldns_update_set_prcount + * ldns_update_set_upcount + * ldns_update_soa_mname + * ldns_update_soa_zone_mname + * ldns_update_upcount + * ldns_update_zocount + * ldns_validate_domain_dnskey + * ldns_validate_domain_ds + * ldns_verify + * ldns_verify_rrsig + * ldns_verify_rrsig_buffers + * ldns_verify_rrsig_buffers_raw + * ldns_verify_rrsig_dsa + * ldns_verify_rrsig_dsa_raw + * ldns_verify_rrsig_keylist + * ldns_verify_rrsig_rsamd5 + * ldns_verify_rrsig_rsamd5_raw + * ldns_verify_rrsig_rsasha1 + * ldns_verify_rrsig_rsasha1_raw + * ldns_verify_rrsig_rsasha256_raw + * ldns_verify_rrsig_rsasha512_raw + * ldns_verify_trusted + * ldns_version + * ldns_wire2dname + * ldns_wire2pkt + * ldns_wire2rdf + * ldns_wire2rr + * ldns_write_uint16 + * ldns_write_uint32 + * ldns_write_uint64_as_uint48 + * mktime_from_utc + * qsort_rr_compare_nsec3 diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_key.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_key.rst new file mode 100644 index 0000000000..4d35766b79 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_key.rst @@ -0,0 +1,11 @@ +Class ldns_key +================================ + + +.. automodule:: ldns + +Class ldns_key +------------------------------ +.. autoclass:: ldns_key + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_key_list.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_key_list.rst new file mode 100644 index 0000000000..e8e447452e --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_key_list.rst @@ -0,0 +1,11 @@ +Class ldns_key_list +================================ + + +.. automodule:: ldns + +Class ldns_key_list +------------------------------ +.. autoclass:: ldns_key_list + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_pkt.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_pkt.rst new file mode 100644 index 0000000000..eb00a0bc07 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_pkt.rst @@ -0,0 +1,11 @@ +Class ldns_pkt +================================ + + +.. automodule:: ldns + +Class ldns_pkt +------------------------------ +.. autoclass:: ldns_pkt + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_rdf.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_rdf.rst new file mode 100644 index 0000000000..5ed1799b1b --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_rdf.rst @@ -0,0 +1,47 @@ +Class ldns_rdf +================================ + + +.. automodule:: ldns + +Class ldns_rdf +------------------------------ +.. autoclass:: ldns_rdf + :members: + :undoc-members: + +Predefined constants +------------------------------ + +**RDF TYPE** + * LDNS_RDF_TYPE_NONE, + * LDNS_RDF_TYPE_DNAME, + * LDNS_RDF_TYPE_INT8, + * LDNS_RDF_TYPE_INT16, + * LDNS_RDF_TYPE_INT32, + * LDNS_RDF_TYPE_A, + * LDNS_RDF_TYPE_AAAA, + * LDNS_RDF_TYPE_STR, + * LDNS_RDF_TYPE_APL, + * LDNS_RDF_TYPE_B32_EXT, + * LDNS_RDF_TYPE_B64, + * LDNS_RDF_TYPE_HEX, + * LDNS_RDF_TYPE_NSEC, + * LDNS_RDF_TYPE_TYPE, + * LDNS_RDF_TYPE_CLASS, + * LDNS_RDF_TYPE_CERT_ALG, + * LDNS_RDF_TYPE_ALG, + * LDNS_RDF_TYPE_UNKNOWN, + * LDNS_RDF_TYPE_TIME, + * LDNS_RDF_TYPE_PERIOD, + * LDNS_RDF_TYPE_TSIGTIME, + * LDNS_RDF_TYPE_TSIG, + * LDNS_RDF_TYPE_INT16_DATA, + * LDNS_RDF_TYPE_SERVICE, + * LDNS_RDF_TYPE_LOC, + * LDNS_RDF_TYPE_WKS, + * LDNS_RDF_TYPE_NSAP, + * LDNS_RDF_TYPE_IPSECKEY, + * LDNS_RDF_TYPE_NSEC3_SALT, + * LDNS_RDF_TYPE_NSEC3_NEXT_OWNER + diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_resolver.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_resolver.rst new file mode 100644 index 0000000000..2fda23a2f0 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_resolver.rst @@ -0,0 +1,13 @@ +Class ldns_resolver +================================ + +.. automodule:: ldns + +Class ldns_resolver +------------------------------ +.. autoclass:: ldns_resolver + :members: + :undoc-members: + + + diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_rr.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_rr.rst new file mode 100644 index 0000000000..78404cda0d --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_rr.rst @@ -0,0 +1,18 @@ +Class ldns_rr +================================ + + +.. automodule:: ldns + +Class ldns_rr +------------------------------ +.. autoclass:: ldns_rr + :members: + :undoc-members: + +Class ldns_rr_descriptor +------------------------------ +.. autoclass:: ldns_rr_descriptor + :members: + :undoc-members: + diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_rr_list.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_rr_list.rst new file mode 100644 index 0000000000..f044093790 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_rr_list.rst @@ -0,0 +1,11 @@ +Class ldns_rr_list +================================ + + +.. automodule:: ldns + +Class ldns_rr_list +------------------------------ +.. autoclass:: ldns_rr_list + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_zone.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_zone.rst new file mode 100644 index 0000000000..5331429222 --- /dev/null +++ b/libs/ldns/contrib/python/docs/source/modules/ldns_zone.rst @@ -0,0 +1,11 @@ +Class ldns_zone +================================ + + +.. automodule:: ldns + +Class ldns_zone +------------------------------ +.. autoclass:: ldns_zone + :members: + :undoc-members: diff --git a/libs/ldns/contrib/python/examples/ldns-axfr.py b/libs/ldns/contrib/python/examples/ldns-axfr.py new file mode 100755 index 0000000000..5333484fa1 --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-axfr.py @@ -0,0 +1,56 @@ +#!/usr/bin/python +# vim:fileencoding=utf-8 +# +# AXFR client with IDN (Internationalized Domain Names) support +# + +import ldns +import encodings.idna + +def utf2name(name): + return '.'.join([encodings.idna.ToASCII(a) for a in name.split('.')]) +def name2utf(name): + return '.'.join([encodings.idna.ToUnicode(a) for a in name.split('.')]) + + +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + +#addr = ldns.ldns_get_rr_list_addr_by_name(resolver, "zone.nic.cz", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD); +addr = resolver.get_addr_by_name("zone.nic.cz", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD); +if (not addr): + raise Exception("Can't retrieve server address") + +print "Addr_by_name:",str(addr).replace("\n","; ") + +#remove all nameservers +while resolver.pop_nameserver(): + pass + +#insert server addr +for rr in addr.rrs(): + resolver.push_nameserver_rr(rr) + +#AXFR transfer +status = resolver.axfr_start(utf2name(u"háÄkyÄárky.cz"), ldns.LDNS_RR_CLASS_IN) +if status != ldns.LDNS_STATUS_OK: + raise Exception("Can't start AXFR. Error: %s" % ldns.ldns_get_errorstr_by_id(status)) + +#Print results +while True: + rr = resolver.axfr_next() + if not rr: + break + + rdf = rr.owner() + if (rdf.get_type() == ldns.LDNS_RDF_TYPE_DNAME): + print "RDF owner: type=",rdf.get_type_str(),"data=",name2utf(str(rdf)) + else: + print "RDF owner: type=",rdf.get_type_str(),"data=",str(rdf) + print " RR type=", rr.get_type_str()," ttl=",rr.ttl() + for rdf in rr.rdfs(): + if (rdf.get_type() == ldns.LDNS_RDF_TYPE_DNAME): + print " RDF: type=",rdf.get_type_str(),"data=",name2utf(str(rdf)) + else: + print " RDF: type=",rdf.get_type_str(),"data=",str(rdf) + + print diff --git a/libs/ldns/contrib/python/examples/ldns-buf.py b/libs/ldns/contrib/python/examples/ldns-buf.py new file mode 100755 index 0000000000..73d8a029ff --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-buf.py @@ -0,0 +1,8 @@ +#!/usr/bin/python + +import ldns + +buf = ldns.ldns_buffer(1024) +buf.printf("Test buffer") +print buf + diff --git a/libs/ldns/contrib/python/examples/ldns-dnssec.py b/libs/ldns/contrib/python/examples/ldns-dnssec.py new file mode 100755 index 0000000000..bb2acfdf76 --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-dnssec.py @@ -0,0 +1,45 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +import ldns +import sys + +debug = True + +# Check args +argc = len(sys.argv) +name = "www.nic.cz" +if argc < 2: + print "Usage:", sys.argv[0], "domain [resolver_addr]" + sys.exit(1) +else: + name = sys.argv[1] + +# Create resolver +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") +resolver.set_dnssec(True) + +# Custom resolver +if argc > 2: + # Clear previous nameservers + ns = resolver.pop_nameserver() + while ns != None: + ns = resolver.pop_nameserver() + ip = ldns.ldns_rdf.new_frm_str(sys.argv[2], ldns.LDNS_RDF_TYPE_A) + resolver.push_nameserver(ip) + +# Resolve DNS name +pkt = resolver.query(name, ldns.LDNS_RR_TYPE_A, ldns.LDNS_RR_CLASS_IN) +if pkt and pkt.answer(): + + # Debug + if debug: + print "NS returned:", pkt.get_rcode(), "(AA: %d AD: %d)" % ( pkt.ad(), pkt.ad() ) + + # SERVFAIL indicated bogus name + if pkt.get_rcode() is ldns.LDNS_RCODE_SERVFAIL: + print name, "is bogus" + + # Check AD (Authenticated) bit + if pkt.get_rcode() is ldns.LDNS_RCODE_NOERROR: + if pkt.ad(): print name, "is secure" + else: print name, "is insecure" diff --git a/libs/ldns/contrib/python/examples/ldns-higher.py b/libs/ldns/contrib/python/examples/ldns-higher.py new file mode 100755 index 0000000000..5175ec0e7a --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-higher.py @@ -0,0 +1,36 @@ +#!/usr/bin/python +import ldns + +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + +dnn = ldns.ldns_dname("www.google.com") +print dnn.get_type_str(), dnn + +dna = ldns.ldns_rdf.new_frm_str("74.125.43.99",ldns.LDNS_RDF_TYPE_A) +print dna.get_type_str(), dna + +name = resolver.get_name_by_addr(dna) +if (not name): raise Exception("Can't retrieve server name") +for rr in name.rrs(): + print rr + +name = resolver.get_name_by_addr("74.125.43.99") +if (not name): raise Exception("Can't retrieve server name") +for rr in name.rrs(): + print rr + +addr = resolver.get_addr_by_name(dnn) +if (not addr): raise Exception("Can't retrieve server address") +for rr in addr.rrs(): + print rr + +addr = resolver.get_addr_by_name("www.google.com") +if (not addr): raise Exception("Can't retrieve server address") +for rr in addr.rrs(): + print rr + +hosts = ldns.ldns_rr_list.new_frm_file("/etc/hosts") +if (not hosts): raise Exception("Can't retrieve the content of file") +for rr in hosts.rrs(): + print rr + diff --git a/libs/ldns/contrib/python/examples/ldns-keygen.py b/libs/ldns/contrib/python/examples/ldns-keygen.py new file mode 100755 index 0000000000..3ddf41a946 --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-keygen.py @@ -0,0 +1,46 @@ +#!/usr/bin/python +# +# This example shows how to generate public/private key pair +# +import ldns + +algorithm = ldns.LDNS_SIGN_DSA +bits = 512 + +ldns.ldns_init_random(open("/dev/random","rb"), (bits+7)//8) + +domain = ldns.ldns_dname("example.") + +#generate a new key +key = ldns.ldns_key.new_frm_algorithm(algorithm, bits); +print key + +#set owner +key.set_pubkey_owner(domain) + +#create the public from the ldns_key +pubkey = key.key_to_rr() +#previous command is equivalent to +# pubkey = ldns.ldns_key2rr(key) +print pubkey + +#calculate and set the keytag +key.set_keytag(ldns.ldns_calc_keytag(pubkey)) + +#build the DS record +ds = ldns.ldns_key_rr2ds(pubkey, ldns.LDNS_SHA1) +print ds + +owner, tag = pubkey.owner(), key.keytag() + +#write public key to .key file +fw = open("key-%s-%d.key" % (owner,tag), "wb") +pubkey.print_to_file(fw) + +#write private key to .priv file +fw = open("key-%s-%d.private" % (owner,tag), "wb") +key.print_to_file(fw) + +#write DS to .ds file +fw = open("key-%s-%d.ds" % (owner,tag), "wb") +ds.print_to_file(fw) diff --git a/libs/ldns/contrib/python/examples/ldns-mx.py b/libs/ldns/contrib/python/examples/ldns-mx.py new file mode 100755 index 0000000000..38c3f11c16 --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-mx.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +# +# MX is a small program that prints out the mx records for a particular domain +# +import ldns + +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + +pkt = resolver.query("nic.cz", ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) + +if (pkt): + mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) + if (mx): + mx.sort() + print mx diff --git a/libs/ldns/contrib/python/examples/ldns-mx1.py b/libs/ldns/contrib/python/examples/ldns-mx1.py new file mode 100755 index 0000000000..3dade1ed3d --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-mx1.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +# +# MX is a small program that prints out the mx records for a particular domain +# +import ldns + +dname = ldns.ldns_dname("nic.cz") +print dname + +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + +pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) + +if (pkt): + mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) + if (mx): + mx.sort() + print mx diff --git a/libs/ldns/contrib/python/examples/ldns-mx2.py b/libs/ldns/contrib/python/examples/ldns-mx2.py new file mode 100755 index 0000000000..4fff98a4b1 --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-mx2.py @@ -0,0 +1,19 @@ +#!/usr/bin/python +# +# MX is a small program that prints out the mx records for a particular domain +# +import ldns + +resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + +pkt = resolver.query("nic.cz", ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) +if (pkt) and (pkt.answer()): + + for rr in pkt.answer().rrs(): + if (rr.get_type() != ldns.LDNS_RR_TYPE_MX): + continue + + rdf = rr.owner() + print rdf," ",rr.ttl()," ",rr.get_class_str()," ",rr.get_type_str()," ", + print " ".join(str(rdf) for rdf in rr.rdfs()) + diff --git a/libs/ldns/contrib/python/examples/ldns-newpkt.py b/libs/ldns/contrib/python/examples/ldns-newpkt.py new file mode 100755 index 0000000000..d124a80f80 --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-newpkt.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +import ldns + +pkt = ldns.ldns_pkt.new_query_frm_str("www.google.com",ldns.LDNS_RR_TYPE_ANY, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_QR | ldns.LDNS_AA) + +rra = ldns.ldns_rr.new_frm_str("www.google.com. IN A 192.168.1.1",300) +rrb = ldns.ldns_rr.new_frm_str("www.google.com. IN TXT Some\ Description",300) + +list = ldns.ldns_rr_list() +if (rra): list.push_rr(rra) +if (rrb): list.push_rr(rrb) + +pkt.push_rr_list(ldns.LDNS_SECTION_ANSWER, list) + +print "Packet:" +print pkt diff --git a/libs/ldns/contrib/python/examples/ldns-signzone.py b/libs/ldns/contrib/python/examples/ldns-signzone.py new file mode 100755 index 0000000000..41f76626ea --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-signzone.py @@ -0,0 +1,65 @@ +#!/usr/bin/python +# This example shows how to sign a given zone file with private key + +import ldns +import sys, os, time + +#private key TAG which identifies the private key +#use ldns-keygen.py in order to obtain private key +keytag = 30761 + +# Read zone file +#------------------------------------------------------------- + +zone = ldns.ldns_zone.new_frm_fp(open("zone.txt","r"), None, 0, ldns.LDNS_RR_CLASS_IN) +soa = zone.soa() +origin = soa.owner() + +# Prepare keys +#------------------------------------------------------------- + +#Read private key from file +keyfile = open("key-%s-%d.private" % (origin, keytag), "r"); +key = ldns.ldns_key.new_frm_fp(keyfile) + +#Read public key from file +pubfname = "key-%s-%d.key" % (origin, keytag) +pubkey = None +if os.path.isfile(pubfname): + pubkeyfile = open(pubfname, "r"); + pubkey,_,_,_ = ldns.ldns_rr.new_frm_fp(pubkeyfile) + +if not pubkey: + #Create new public key + pubkey = key.key_to_rr() + +#Set key expiration +key.set_expiration(int(time.time()) + 365*60*60*24) #365 days + +#Set key owner (important step) +key.set_pubkey_owner(origin) + +#Insert DNSKEY RR +zone.push_rr(pubkey) + +# Sign zone +#------------------------------------------------------------- + +#Create keylist and push private key +keys = ldns.ldns_key_list() +keys.push_key(key) + +#Add SOA +signed_zone = ldns.ldns_dnssec_zone() +signed_zone.add_rr(soa) + +#Add RRs +for rr in zone.rrs().rrs(): + print "RR:",str(rr), + signed_zone.add_rr(rr) + +added_rrs = ldns.ldns_rr_list() +status = signed_zone.sign(added_rrs, keys) +if (status == ldns.LDNS_STATUS_OK): + signed_zone.print_to_file(open("zone_signed.txt","w")) + diff --git a/libs/ldns/contrib/python/examples/ldns-zone.py b/libs/ldns/contrib/python/examples/ldns-zone.py new file mode 100755 index 0000000000..266e6e5b47 --- /dev/null +++ b/libs/ldns/contrib/python/examples/ldns-zone.py @@ -0,0 +1,15 @@ +#!/usr/bin/python +import ldns + +#Read zone from file +zone = ldns.ldns_zone.new_frm_fp(open("zone.txt","r"), None, 0, ldns.LDNS_RR_CLASS_IN) +print zone + +print "SOA:", zone.soa() +for r in zone.rrs().rrs(): + print "RR:", r + + +zone = ldns.ldns_zone() +#print zone + diff --git a/libs/ldns/contrib/python/examples/zone.txt b/libs/ldns/contrib/python/examples/zone.txt new file mode 100644 index 0000000000..ffc87263f1 --- /dev/null +++ b/libs/ldns/contrib/python/examples/zone.txt @@ -0,0 +1,15 @@ +$ORIGIN example. +$TTL 600 + +example. IN SOA example. admin.example. ( + 2008022501 ; serial + 28800 ; refresh (8 hours) + 7200 ; retry (2 hours) + 604800 ; expire (1 week) + 18000 ; minimum (5 hours) + ) + +@ IN MX 10 mail.example. +@ IN NS ns1 +@ IN NS ns2 +@ IN A 192.168.1.1 diff --git a/libs/ldns/contrib/python/ldns.i b/libs/ldns/contrib/python/ldns.i new file mode 100644 index 0000000000..ddd0a51bba --- /dev/null +++ b/libs/ldns/contrib/python/ldns.i @@ -0,0 +1,267 @@ +/* + * ldns.i: LDNS interface file + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +%module ldns +%{ + +#include "ldns.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +%} + +//#define LDNS_DEBUG + +%include "stdint.i" // uint_16_t is known type now +%include "file.i" // FILE * +%include "typemaps.i" + +%inline %{ +struct timeval* ldns_make_timeval(uint32_t sec, uint32_t usec) +{ + struct timeval* res = (struct timeval*)malloc(sizeof(*res)); + res->tv_sec = sec; + res->tv_usec = usec; + return res; +} +uint32_t ldns_read_timeval_sec(struct timeval* t) { + return (uint32_t)t->tv_sec; } +uint32_t ldns_read_timeval_usec(struct timeval* t) { + return (uint32_t)t->tv_usec; } +%} + +%immutable ldns_struct_lookup_table::name; +%immutable ldns_struct_rr_descriptor::_name; +%immutable ldns_error_str; +%immutable ldns_signing_algorithms; + +//new_frm_fp_l +%apply int *OUTPUT { int *line_nr}; +%apply uint32_t *OUTPUT { uint32_t *default_ttl}; + +%include "ldns_packet.i" +%include "ldns_resolver.i" +%include "ldns_rr.i" +%include "ldns_rdf.i" +%include "ldns_zone.i" +%include "ldns_key.i" +%include "ldns_buffer.i" +%include "ldns_dnssec.i" + +%include + %include +%include +%include + %include +%include +%include + %include + %include +%include + %include + %include + %include + %include +%include +%include + %include +%include + %include + %include +%include + %include + %include +%include + %include + +typedef struct ldns_dnssec_name { }; +typedef struct ldns_dnssec_rrs { }; +typedef struct ldns_dnssec_rrsets { }; +typedef struct ldns_dnssec_zone { }; +// ================================================================================ + +%include "ldns_dname.i" + +%inline %{ + PyObject* ldns_rr_new_frm_str_(const char *str, uint32_t default_ttl, ldns_rdf* origin, ldns_rdf* prev) + //returns tuple (status, ldns_rr, prev) + { + PyObject* tuple; + + ldns_rdf *p_prev = prev; + ldns_rdf **pp_prev = &p_prev; + if (p_prev == 0) pp_prev = 0; + + ldns_rr *p_rr = 0; + ldns_rr **pp_rr = &p_rr; + + ldns_status st = ldns_rr_new_frm_str(pp_rr, str, default_ttl, origin, pp_prev); + + tuple = PyTuple_New(3); + PyTuple_SetItem(tuple, 0, SWIG_From_int(st)); + PyTuple_SetItem(tuple, 1, (st == LDNS_STATUS_OK) ? + SWIG_NewPointerObj(SWIG_as_voidptr(p_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 ) : + Py_None); + PyTuple_SetItem(tuple, 2, (p_prev != prev) ? + SWIG_NewPointerObj(SWIG_as_voidptr(p_prev), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : + Py_None); + return tuple; + } + + PyObject* ldns_rr_new_frm_fp_l_(FILE *fp, uint32_t default_ttl, ldns_rdf* origin, ldns_rdf* prev, int ret_linenr) + //returns tuple (status, ldns_rr, [line if ret_linenr], ttl, origin, prev) + { + int linenr = 0; + int *p_linenr = &linenr; + + uint32_t defttl = default_ttl; + uint32_t *p_defttl = &defttl; + if (defttl == 0) p_defttl = 0; + + ldns_rdf *p_origin = origin; + ldns_rdf **pp_origin = &p_origin; + if (p_origin == 0) pp_origin = 0; + + ldns_rdf *p_prev = prev; + ldns_rdf **pp_prev = &p_prev; + if (p_prev == 0) pp_prev = 0; + + ldns_rr *p_rr = 0; + ldns_rr **pp_rr = &p_rr; + + ldns_status st = ldns_rr_new_frm_fp_l(pp_rr, fp, p_defttl, pp_origin, pp_prev, p_linenr); + + PyObject* tuple; + tuple = PyTuple_New(ret_linenr ? 6 : 5); + int idx = 0; + PyTuple_SetItem(tuple, idx, SWIG_From_int(st)); + idx++; + PyTuple_SetItem(tuple, idx, (st == LDNS_STATUS_OK) ? + SWIG_NewPointerObj(SWIG_as_voidptr(p_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 ) : + Py_None); + idx++; + if (ret_linenr) { + PyTuple_SetItem(tuple, idx, SWIG_From_int(linenr)); + idx++; + } + PyTuple_SetItem(tuple, idx, (defttl != default_ttl) ? SWIG_From_int(defttl) : Py_None); + idx++; + PyTuple_SetItem(tuple, idx, (p_origin != origin) ? + SWIG_NewPointerObj(SWIG_as_voidptr(p_origin), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : + Py_None); + idx++; + PyTuple_SetItem(tuple, idx, (p_prev != prev) ? + SWIG_NewPointerObj(SWIG_as_voidptr(p_prev), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : + Py_None); + return tuple; + } + + PyObject* ldns_rr_new_question_frm_str_(const char *str, ldns_rdf* origin, ldns_rdf* prev) + //returns tuple (status, ldns_rr, prev) + { + PyObject* tuple; + + ldns_rdf *p_prev = prev; + ldns_rdf **pp_prev = &p_prev; + if (p_prev == 0) pp_prev = 0; + + ldns_rr *p_rr = 0; + ldns_rr **pp_rr = &p_rr; + + ldns_status st = ldns_rr_new_question_frm_str(pp_rr, str, origin, pp_prev); + + tuple = PyTuple_New(3); + PyTuple_SetItem(tuple, 0, SWIG_From_int(st)); + PyTuple_SetItem(tuple, 1, (st == LDNS_STATUS_OK) ? + SWIG_NewPointerObj(SWIG_as_voidptr(p_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 ) : + Py_None); + PyTuple_SetItem(tuple, 2, (p_prev != prev) ? + SWIG_NewPointerObj(SWIG_as_voidptr(p_prev), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : + Py_None); + return tuple; + } + + + +PyObject* ldns_fetch_valid_domain_keys_(const ldns_resolver * res, const ldns_rdf * domain, + const ldns_rr_list * keys) + //returns tuple (status, result) + { + PyObject* tuple; + + ldns_rr_list *rrl = 0; + ldns_status st = 0; + rrl = ldns_fetch_valid_domain_keys(res, domain, keys, &st); + + + tuple = PyTuple_New(2); + PyTuple_SetItem(tuple, 0, SWIG_From_int(st)); + PyTuple_SetItem(tuple, 1, (st == LDNS_STATUS_OK) ? + SWIG_NewPointerObj(SWIG_as_voidptr(rrl), SWIGTYPE_p_ldns_struct_rr_list, SWIG_POINTER_OWN | 0 ) : + Py_None); + return tuple; + } + +%} + +%pythoncode %{ +def ldns_fetch_valid_domain_keys(res, domain, keys): + return _ldns.ldns_fetch_valid_domain_keys_(res, domain, keys) +%} + diff --git a/libs/ldns/contrib/python/ldns_buffer.i b/libs/ldns/contrib/python/ldns_buffer.i new file mode 100644 index 0000000000..ce1740875d --- /dev/null +++ b/libs/ldns/contrib/python/ldns_buffer.i @@ -0,0 +1,560 @@ +/****************************************************************************** + * ldns_buffer.i: LDNS buffer class + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ + +%typemap(in,numinputs=0,noblock=1) (ldns_buffer **) +{ + ldns_buffer *$1_buf; + $1 = &$1_buf; +} + +/* result generation */ +%typemap(argout,noblock=1) (ldns_buffer **) +{ + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_buf), SWIGTYPE_p_ldns_struct_buffer, SWIG_POINTER_OWN | 0 )); +} + +%nodefaultctor ldns_struct_buffer; //no default constructor & destructor +%nodefaultdtor ldns_struct_buffer; + +%delobject ldns_buffer_free; +%newobject ldns_buffer_new; +%newobject ldns_dname_new; +%newobject ldns_dname_new_frm_data; +%newobject ldns_dname_label; + +%rename(ldns_buffer) ldns_struct_buffer; + +#ifdef LDNS_DEBUG +%rename(__ldns_buffer_free) ldns_buffer_free; +%inline %{ +void _ldns_buffer_free (ldns_buffer* b) { + printf("******** LDNS_BUFFER free 0x%lX ************\n", (long unsigned int)b); + ldns_buffer_free(b); +} +%} +#else +%rename(_ldns_buffer_free) ldns_buffer_free; +#endif + +%ignore ldns_struct_buffer::_position; +%ignore ldns_struct_buffer::_limit; +%ignore ldns_struct_buffer::_capacity; +%ignore ldns_struct_buffer::_data; +%ignore ldns_struct_buffer::_fixed; +%ignore ldns_struct_buffer::_status; + +%extend ldns_struct_buffer { + + %pythoncode %{ + def __init__(self, capacity): + """Creates a new buffer with the specified capacity. + + :param capacity: the size (in bytes) to allocate for the buffer + """ + self.this = _ldns.ldns_buffer_new(capacity) + + __swig_destroy__ = _ldns._ldns_buffer_free + + def __str__(self): + """Returns the data in the buffer as a string. Buffer data must be char * type.""" + return _ldns.ldns_buffer2str(self) + + def getc(self): + """returns the next character from a buffer. + + Advances the position pointer with 1. When end of buffer is reached returns EOF. This is the buffer's equivalent for getc(). + + :returns: (int) EOF on failure otherwise return the character + """ + return _ldns.ldns_bgetc(self) + + #LDNS_BUFFER_METHODS_# + def at(self,at): + """returns a pointer to the data at the indicated position. + + :param at: + position + :returns: (uint8_t \*) the pointer to the data + """ + return _ldns.ldns_buffer_at(self,at) + #parameters: const ldns_buffer *,size_t, + #retvals: uint8_t * + + def available(self,count): + """checks if the buffer has count bytes available at the current position + + :param count: + how much is available + :returns: (int) true or false + """ + return _ldns.ldns_buffer_available(self,count) + #parameters: ldns_buffer *,size_t, + #retvals: int + + def available_at(self,at,count): + """checks if the buffer has at least COUNT more bytes available. + + Before reading or writing the caller needs to ensure enough space is available! + + :param at: + indicated position + :param count: + how much is available + :returns: (int) true or false + """ + return _ldns.ldns_buffer_available_at(self,at,count) + #parameters: ldns_buffer *,size_t,size_t, + #retvals: int + + def begin(self): + """returns a pointer to the beginning of the buffer (the data at position 0). + + :returns: (uint8_t \*) the pointer + """ + return _ldns.ldns_buffer_begin(self) + #parameters: const ldns_buffer *, + #retvals: uint8_t * + + def capacity(self): + """returns the number of bytes the buffer can hold. + + :returns: (size_t) the number of bytes + """ + return _ldns.ldns_buffer_capacity(self) + #parameters: ldns_buffer *, + #retvals: size_t + + def clear(self): + """clears the buffer and make it ready for writing. + + The buffer's limit is set to the capacity and the position is set to 0. + """ + _ldns.ldns_buffer_clear(self) + #parameters: ldns_buffer *, + #retvals: + + def copy(self,bfrom): + """Copy contents of the other buffer to this buffer. + + Silently truncated if this buffer is too small. + + :param bfrom: other buffer + """ + _ldns.ldns_buffer_copy(self,bfrom) + #parameters: ldns_buffer *,ldns_buffer *, + #retvals: + + def current(self): + """returns a pointer to the data at the buffer's current position. + + :returns: (uint8_t \*) the pointer + """ + return _ldns.ldns_buffer_current(self) + #parameters: ldns_buffer *, + #retvals: uint8_t * + + def end(self): + """returns a pointer to the end of the buffer (the data at the buffer's limit). + + :returns: (uint8_t \*) the pointer + """ + return _ldns.ldns_buffer_end(self) + #parameters: ldns_buffer *, + #retvals: uint8_t * + + def export(self): + """Makes the buffer fixed and returns a pointer to the data. + + The caller is responsible for free'ing the result. + + :returns: (void \*) void + """ + return _ldns.ldns_buffer_export(self) + #parameters: ldns_buffer *, + #retvals: void * + + def flip(self): + """makes the buffer ready for reading the data that has been written to the buffer. + + The buffer's limit is set to the current position and the position is set to 0. + """ + _ldns.ldns_buffer_flip(self) + #parameters: ldns_buffer *, + + def invariant(self): + _ldns.ldns_buffer_invariant(self) + #parameters: ldns_buffer *, + + def limit(self): + """returns the maximum size of the buffer + + :returns: (size_t) the size + """ + return _ldns.ldns_buffer_limit(self) + #parameters: ldns_buffer *, + #retvals: size_t + + def position(self): + """returns the current position in the buffer (as a number of bytes) + + :returns: (size_t) the current position + """ + return _ldns.ldns_buffer_position(self) + #parameters: ldns_buffer *, + #retvals: size_t + + def printf(self,*str): + """Prints to the buffer, increasing the capacity if required using buffer_reserve(). + + The buffer's position is set to the terminating '\0'. Returns the number of characters written (not including the terminating '\0') or -1 on failure. + :param str: a string + :returns: (int) + """ + return _ldns.ldns_buffer_printf(self,*str) + #parameters: ldns_buffer *,const char *,... + #retvals: int + + def read(self,data,count): + """copies count bytes of data at the current position to the given data-array + + :param data: + buffer to copy to + :param count: + the length of the data to copy + """ + _ldns.ldns_buffer_read(self,data,count) + #parameters: ldns_buffer *,void *,size_t, + #retvals: + + def read_at(self,at,data,count): + """copies count bytes of data at the given position to the given data-array + + :param at: + the position in the buffer to start + :param data: + buffer to copy to + :param count: + the length of the data to copy + """ + _ldns.ldns_buffer_read_at(self,at,data,count) + #parameters: ldns_buffer *,size_t,void *,size_t, + #retvals: + + def read_u16(self): + """returns the 2-byte integer value at the current position in the buffer + + :returns: (uint16_t) 2 byte integer + """ + return _ldns.ldns_buffer_read_u16(self) + #parameters: ldns_buffer *, + #retvals: uint16_t + + def read_u16_at(self,at): + """returns the 2-byte integer value at the given position in the buffer + + :param at: + position in the buffer + :returns: (uint16_t) 2 byte integer + """ + return _ldns.ldns_buffer_read_u16_at(self,at) + #parameters: ldns_buffer *,size_t, + #retvals: uint16_t + + def read_u32(self): + """returns the 4-byte integer value at the current position in the buffer + + :returns: (uint32_t) 4 byte integer + """ + return _ldns.ldns_buffer_read_u32(self) + #parameters: ldns_buffer *, + #retvals: uint32_t + + def read_u32_at(self,at): + """returns the 4-byte integer value at the given position in the buffer + + :param at: + position in the buffer + :returns: (uint32_t) 4 byte integer + """ + return _ldns.ldns_buffer_read_u32_at(self,at) + #parameters: ldns_buffer *,size_t, + #retvals: uint32_t + + def read_u8(self): + """returns the byte value at the current position in the buffer + + :returns: (uint8_t) 1 byte integer + """ + return _ldns.ldns_buffer_read_u8(self) + #parameters: ldns_buffer *, + #retvals: uint8_t + + def read_u8_at(self,at): + """returns the byte value at the given position in the buffer + + :param at: + the position in the buffer + :returns: (uint8_t) 1 byte integer + """ + return _ldns.ldns_buffer_read_u8_at(self,at) + #parameters: ldns_buffer *,size_t, + #retvals: uint8_t + + def remaining(self): + """returns the number of bytes remaining between the buffer's position and limit. + + :returns: (size_t) the number of bytes + """ + return _ldns.ldns_buffer_remaining(self) + #parameters: ldns_buffer *, + #retvals: size_t + + def remaining_at(self,at): + """returns the number of bytes remaining between the indicated position and the limit. + + :param at: + indicated position + :returns: (size_t) number of bytes + """ + return _ldns.ldns_buffer_remaining_at(self,at) + #parameters: ldns_buffer *,size_t, + #retvals: size_t + + def reserve(self,amount): + """ensures BUFFER can contain at least AMOUNT more bytes. + + The buffer's capacity is increased if necessary using buffer_set_capacity(). + + The buffer's limit is always set to the (possibly increased) capacity. + + :param amount: + amount to use + :returns: (bool) whether this failed or succeeded + """ + return _ldns.ldns_buffer_reserve(self,amount) + #parameters: ldns_buffer *,size_t, + #retvals: bool + + def rewind(self): + """make the buffer ready for re-reading the data. + + The buffer's position is reset to 0. + """ + _ldns.ldns_buffer_rewind(self) + #parameters: ldns_buffer *, + #retvals: + + def set_capacity(self,capacity): + """changes the buffer's capacity. + + The data is reallocated so any pointers to the data may become invalid. The buffer's limit is set to the buffer's new capacity. + + :param capacity: + the capacity to use + :returns: (bool) whether this failed or succeeded + """ + return _ldns.ldns_buffer_set_capacity(self,capacity) + #parameters: ldns_buffer *,size_t, + #retvals: bool + + def set_limit(self,limit): + """changes the buffer's limit. + + If the buffer's position is greater than the new limit the position is set to the limit. + + :param limit: + the new limit + """ + _ldns.ldns_buffer_set_limit(self,limit) + #parameters: ldns_buffer *,size_t, + #retvals: + + def set_position(self,mark): + """sets the buffer's position to MARK. + + The position must be less than or equal to the buffer's limit. + + :param mark: + the mark to use + """ + _ldns.ldns_buffer_set_position(self,mark) + #parameters: ldns_buffer *,size_t, + #retvals: + + def skip(self,count): + """changes the buffer's position by COUNT bytes. + + The position must not be moved behind the buffer's limit or before the beginning of the buffer. + + :param count: + the count to use + """ + _ldns.ldns_buffer_skip(self,count) + #parameters: ldns_buffer *,ssize_t, + #retvals: + + def status(self): + """returns the status of the buffer + + :returns: (ldns_status) the status + """ + return _ldns.ldns_buffer_status(self) + #parameters: ldns_buffer *, + #retvals: ldns_status + + def status_ok(self): + """returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise + + :returns: (bool) true or false + """ + return _ldns.ldns_buffer_status_ok(self) + #parameters: ldns_buffer *, + #retvals: bool + + def write(self,data,count): + """writes count bytes of data to the current position of the buffer + + :param data: + the data to write + :param count: + the lenght of the data to write + """ + _ldns.ldns_buffer_write(self,data,count) + #parameters: ldns_buffer *,const void *,size_t, + #retvals: + + def write_at(self,at,data,count): + """writes the given data to the buffer at the specified position + + :param at: + the position (in number of bytes) to write the data at + :param data: + pointer to the data to write to the buffer + :param count: + the number of bytes of data to write + """ + _ldns.ldns_buffer_write_at(self,at,data,count) + #parameters: ldns_buffer *,size_t,const void *,size_t, + #retvals: + + def write_string(self,str): + """copies the given (null-delimited) string to the current position at the buffer + + :param str: + the string to write + """ + _ldns.ldns_buffer_write_string(self,str) + #parameters: ldns_buffer *,const char *, + #retvals: + + def write_string_at(self,at,str): + """copies the given (null-delimited) string to the specified position at the buffer + + :param at: + the position in the buffer + :param str: + the string to write + """ + _ldns.ldns_buffer_write_string_at(self,at,str) + #parameters: ldns_buffer *,size_t,const char *, + #retvals: + + def write_u16(self,data): + """writes the given 2 byte integer at the current position in the buffer + + :param data: + the 16 bits to write + """ + _ldns.ldns_buffer_write_u16(self,data) + #parameters: ldns_buffer *,uint16_t, + #retvals: + + def write_u16_at(self,at,data): + """writes the given 2 byte integer at the given position in the buffer + + :param at: + the position in the buffer + :param data: + the 16 bits to write + """ + _ldns.ldns_buffer_write_u16_at(self,at,data) + #parameters: ldns_buffer *,size_t,uint16_t, + #retvals: + + def write_u32(self,data): + """writes the given 4 byte integer at the current position in the buffer + + :param data: + the 32 bits to write + """ + _ldns.ldns_buffer_write_u32(self,data) + #parameters: ldns_buffer *,uint32_t, + #retvals: + + def write_u32_at(self,at,data): + """writes the given 4 byte integer at the given position in the buffer + + :param at: + the position in the buffer + :param data: + the 32 bits to write + """ + _ldns.ldns_buffer_write_u32_at(self,at,data) + #parameters: ldns_buffer *,size_t,uint32_t, + #retvals: + + def write_u8(self,data): + """writes the given byte of data at the current position in the buffer + + :param data: + the 8 bits to write + """ + _ldns.ldns_buffer_write_u8(self,data) + #parameters: ldns_buffer *,uint8_t, + #retvals: + + def write_u8_at(self,at,data): + """writes the given byte of data at the given position in the buffer + + :param at: + the position in the buffer + :param data: + the 8 bits to write + """ + _ldns.ldns_buffer_write_u8_at(self,at,data) + #parameters: ldns_buffer *,size_t,uint8_t, + #retvals: + + #_LDNS_BUFFER_METHODS# + %} +} + diff --git a/libs/ldns/contrib/python/ldns_dname.i b/libs/ldns/contrib/python/ldns_dname.i new file mode 100644 index 0000000000..0aac54c106 --- /dev/null +++ b/libs/ldns/contrib/python/ldns_dname.i @@ -0,0 +1,196 @@ +/****************************************************************************** + * ldns_dname.i: LDNS domain name class + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ +%pythoncode %{ + class ldns_dname(ldns_rdf): + """Domain name + + This class contains methods to read and manipulate domain names. + Domain names are stored in ldns_rdf structures, with the type LDNS_RDF_TYPE_DNAME + + **Usage** + + >>> import ldns + >>> resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") + >>> dn1 = ldns.ldns_dname("test.nic.cz") + >>> print dn1 + test.nic.cz. + >>> dn2 = ldns.ldns_dname("nic.cz") + >>> if dn2.is_subdomain(dn1): print dn2,"is subdomain of",dn1 + >>> if dn1.is_subdomain(dn2): print dn1,"is subdomain of",dn2 + test.nic.cz. is subdomain of nic.cz. + """ + def __init__(self, str): + """Creates a new dname rdf from a string. + + :parameter str: str string to use + """ + self.this = _ldns.ldns_dname_new_frm_str(str) + + @staticmethod + def new_frm_str(str): + """Creates a new dname rdf instance from a string. + + This static method is equivalent to using of default class constructor. + + :parameter str: str string to use + """ + return ldns_dname(str) + + def absolute(self): + """Checks whether the given dname string is absolute (i.e. ends with a '.') + + :returns: (bool) True or False + """ + return self.endswith(".") + + + def make_canonical(self): + """Put a dname into canonical fmt - ie. lowercase it + """ + _ldns.ldns_dname2canonical(self) + + def __cmp__(self,other): + """Compares the two dname rdf's according to the algorithm for ordering in RFC4034 Section 6. + + :param other: + the second dname rdf to compare + :returns: (int) -1 if dname comes before other, 1 if dname comes after other, and 0 if they are equal. + """ + return _ldns.ldns_dname_compare(self,other) + + def write_to_buffer(self,buffer): + """Copies the dname data to the buffer in wire format. + + :param buffer: buffer to append the result to + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_dname2buffer_wire(buffer,self) + #parameters: ldns_buffer *,const ldns_rdf *, + #retvals: ldns_status + + #LDNS_DNAME_METHODS_# + + def cat(self,rd2): + """concatenates rd2 after this dname (rd2 is copied, this dname is modified) + + :param rd2: + the rightside + :returns: (ldns_status) LDNS_STATUS_OK on success + """ + return _ldns.ldns_dname_cat(self,rd2) + #parameters: ldns_rdf *,ldns_rdf *, + #retvals: ldns_status + + def cat_clone(self,rd2): + """concatenates two dnames together + + :param rd2: + the rightside + :returns: (ldns_rdf \*) a new rdf with leftside/rightside + """ + return _ldns.ldns_dname_cat_clone(self,rd2) + #parameters: const ldns_rdf *,const ldns_rdf *, + #retvals: ldns_rdf * + + def interval(self,middle,next): + """check if middle lays in the interval defined by prev and next prev <= middle < next. + + This is usefull for nsec checking + + :param middle: + the dname to check + :param next: + the next dname return 0 on error or unknown, -1 when middle is in the interval, +1 when not + :returns: (int) + """ + return _ldns.ldns_dname_interval(self,middle,next) + #parameters: const ldns_rdf *,const ldns_rdf *,const ldns_rdf *, + #retvals: int + + def is_subdomain(self,parent): + """Tests wether the name sub falls under parent (i.e. is a subdomain of parent). + + This function will return false if the given dnames are equal. + + :param parent: + (ldns_rdf) the parent's name + :returns: (bool) true if sub falls under parent, otherwise false + """ + return _ldns.ldns_dname_is_subdomain(self,parent) + #parameters: const ldns_rdf *,const ldns_rdf *, + #retvals: bool + + def label(self,labelpos): + """look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label. + + The labels are numbered starting from 0 (left most). + + :param labelpos: + return the label with this number + :returns: (ldns_rdf \*) a ldns_rdf* with the label as name or NULL on error + """ + return _ldns.ldns_dname_label(self,labelpos) + #parameters: const ldns_rdf *,uint8_t, + #retvals: ldns_rdf * + + def label_count(self): + """count the number of labels inside a LDNS_RDF_DNAME type rdf. + + :returns: (uint8_t) the number of labels + """ + return _ldns.ldns_dname_label_count(self) + #parameters: const ldns_rdf *, + #retvals: uint8_t + + def left_chop(self): + """chop one label off the left side of a dname. + + so wwww.nlnetlabs.nl, becomes nlnetlabs.nl + + :returns: (ldns_rdf \*) the remaining dname + """ + return _ldns.ldns_dname_left_chop(self) + #parameters: const ldns_rdf *, + #retvals: ldns_rdf * + + def reverse(self): + """Returns a clone of the given dname with the labels reversed. + + :returns: (ldns_rdf \*) clone of the dname with the labels reversed. + """ + return _ldns.ldns_dname_reverse(self) + #parameters: const ldns_rdf *, + #retvals: ldns_rdf * + + #_LDNS_DNAME_METHODS# +%} + diff --git a/libs/ldns/contrib/python/ldns_dnssec.i b/libs/ldns/contrib/python/ldns_dnssec.i new file mode 100644 index 0000000000..6c06564846 --- /dev/null +++ b/libs/ldns/contrib/python/ldns_dnssec.i @@ -0,0 +1,434 @@ +/****************************************************************************** + * ldns_dnssec.i: DNSSEC zone, name, rrs + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ +%nodefaultctor ldns_dnssec_rrs; //no default constructor & destructor +%nodefaultdtor ldns_dnssec_rrs; + +%newobject ldns_dnssec_rrs_new; +%delobject ldns_dnssec_rrs_free; + +%extend ldns_dnssec_rrs { + %pythoncode %{ + + def __init__(self): + """Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs. + + :returns: (ldns_dnssec_rrs) the allocated data + """ + self.this = _ldns.ldns_dnssec_rrs_new() + if not self.this: + raise Exception("Can't create rrs instance") + + __swig_destroy__ = _ldns.ldns_dnssec_rrs_free + + #LDNS_DNSSEC_RRS_METHODS_# + def add_rr(self,rr): + """Adds an RR to the list of RRs. + + The list will remain ordered + + :param rr: + the RR to add + :returns: (ldns_status) LDNS_STATUS_OK on success + """ + return _ldns.ldns_dnssec_rrs_add_rr(self,rr) + #parameters: ldns_dnssec_rrs *,ldns_rr *, + #retvals: ldns_status + #_LDNS_DNSSEC_RRS_METHODS# + %} +} + +// ================================================================================ +// DNNSEC RRS +// ================================================================================ +%nodefaultctor ldns_dnssec_rrsets; //no default constructor & destructor +%nodefaultdtor ldns_dnssec_rrsets; + +%newobject ldns_dnssec_rrsets_new; +%delobject ldns_dnssec_rrsets_free; + +%extend ldns_dnssec_rrsets { + %pythoncode %{ + def __init__(self): + """Creates a new list (entry) of RRsets. + + :returns: (ldns_dnssec_rrsets \*) instance + """ + self.this = _ldns.ldns_dnssec_rrsets_new() + if not self.this: + raise Exception("Can't create rrsets instance") + + __swig_destroy__ = _ldns.ldns_dnssec_rrsets_free + + def print_to_file(self, file, follow): + """Print the given list of rrsets to the given file descriptor. + + :param file: file pointer + :param follow: if set to false, only print the first RRset + """ + _ldns.ldns_dnssec_rrsets_print(file,self,follow) + #parameters: FILE *,ldns_dnssec_rrsets *,bool, + #retvals: + + #LDNS_DNSSEC_RRSETS_METHODS_# + def add_rr(self,rr): + """Add an ldns_rr to the corresponding RRset in the given list of RRsets. + + If it is not present, add it as a new RRset with 1 record. + + :param rr: + the rr to add to the list of rrsets + :returns: (ldns_status) LDNS_STATUS_OK on success + """ + return _ldns.ldns_dnssec_rrsets_add_rr(self,rr) + #parameters: ldns_dnssec_rrsets *,ldns_rr *, + #retvals: ldns_status + + def set_type(self,atype): + """Sets the RR type of the rrset (that is head of the given list). + + :param atype: + :returns: (ldns_status) LDNS_STATUS_OK on success + """ + return _ldns.ldns_dnssec_rrsets_set_type(self,atype) + #parameters: ldns_dnssec_rrsets *,ldns_rr_type, + #retvals: ldns_status + + def type(self): + """Returns the rr type of the rrset (that is head of the given list). + + :returns: (ldns_rr_type) the rr type + """ + return _ldns.ldns_dnssec_rrsets_type(self) + #parameters: ldns_dnssec_rrsets *, + #retvals: ldns_rr_type + #_LDNS_DNSSEC_RRSETS_METHODS# + %} +} + +// ================================================================================ +// DNNSEC NAME +// ================================================================================ +%nodefaultctor ldns_dnssec_name; //no default constructor & destructor +%nodefaultdtor ldns_dnssec_name; + +%newobject ldns_dnssec_name_new; +%delobject ldns_dnssec_name_free; + +%extend ldns_dnssec_name { + %pythoncode %{ + def __init__(self): + """Create a new instance of dnssec name.""" + self.this = _ldns.ldns_dnssec_name_new() + if not self.this: + raise Exception("Can't create dnssec name instance") + + __swig_destroy__ = _ldns.ldns_dnssec_name_free + + def print_to_file(self,file): + """Prints the RRs in the dnssec name structure to the given file descriptor. + + :param file: file pointer + """ + _ldns.ldns_dnssec_name_print(file, self) + #parameters: FILE *,ldns_dnssec_name *, + + @staticmethod + def new_frm_rr(raiseException=True): + """Create a new instace of dnssec name for the given RR. + + :returns: (ldns_dnssec_name) instance + """ + name = _ldns.ldns_dnssec_name_new_frm_rr(self) + if (not name) and (raiseException): + raise Exception("Can't create dnssec name") + return name + + #LDNS_DNSSEC_NAME_METHODS_# + def add_rr(self,rr): + """Inserts the given rr at the right place in the current dnssec_name No checking is done whether the name matches. + + :param rr: + The RR to add + :returns: (ldns_status) LDNS_STATUS_OK on success, error code otherwise + """ + return _ldns.ldns_dnssec_name_add_rr(self,rr) + #parameters: ldns_dnssec_name *,ldns_rr *, + #retvals: ldns_status + + def find_rrset(self,atype): + """Find the RRset with the given type in within this name structure. + + :param atype: + :returns: (ldns_dnssec_rrsets \*) the RRset, or NULL if not present + """ + return _ldns.ldns_dnssec_name_find_rrset(self,atype) + #parameters: ldns_dnssec_name *,ldns_rr_type, + #retvals: ldns_dnssec_rrsets * + + def name(self): + """Returns the domain name of the given dnssec_name structure. + + :returns: (ldns_rdf \*) the domain name + """ + return _ldns.ldns_dnssec_name_name(self) + #parameters: ldns_dnssec_name *, + #retvals: ldns_rdf * + + def set_name(self,dname): + """Sets the domain name of the given dnssec_name structure. + + :param dname: + the domain name to set it to. This data is *not* copied. + """ + _ldns.ldns_dnssec_name_set_name(self,dname) + #parameters: ldns_dnssec_name *,ldns_rdf *, + #retvals: + + def set_nsec(self,nsec): + """Sets the NSEC(3) RR of the given dnssec_name structure. + + :param nsec: + the nsec rr to set it to. This data is *not* copied. + """ + _ldns.ldns_dnssec_name_set_nsec(self,nsec) + #parameters: ldns_dnssec_name *,ldns_rr *, + #retvals: + #_LDNS_DNSSEC_NAME_METHODS# + %} +} + +// ================================================================================ +// DNNSEC ZONE +// ================================================================================ +%nodefaultctor ldns_dnssec_zone; //no default constructor & destructor +%nodefaultdtor ldns_dnssec_zone; + +%newobject ldns_dnssec_zone_new; +%delobject ldns_dnssec_zone_free; + +%inline %{ +ldns_status ldns_dnssec_zone_sign_defcb(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int cbtype) +{ + if (cbtype == 0) + return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_add_to_signatures, NULL); + if (cbtype == 1) + return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_leave_signatures, NULL); + if (cbtype == 2) + return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_delete_signatures, NULL); + + return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_replace_signatures, NULL); +} +%} + +%extend ldns_dnssec_zone { + %pythoncode %{ + + def __init__(self): + """Creates a new dnssec_zone instance""" + self.this = _ldns.ldns_dnssec_zone_new() + if not self.this: + raise Exception("Can't create dnssec zone instance") + + __swig_destroy__ = _ldns.ldns_dnssec_zone_free + + def print_to_file(self,file): + """Prints the complete zone to the given file descriptor. + + :param file: file pointer + """ + _ldns.ldns_dnssec_zone_print(file, self) + #parameters: FILE *, ldns_dnssec_zone *, + #retvals: + + def create_nsec3s(self,new_rrs,algorithm,flags,iterations,salt_length,salt): + """Adds NSEC3 records to the zone. + + :param new_rrs: + :param algorithm: + :param flags: + :param iterations: + :param salt_length: + :param salt: + :returns: (ldns_status) + """ + return _ldns.ldns_dnssec_zone_create_nsec3s(self,new_rrs,algorithm,flags,iterations,salt_length,salt) + #parameters: ldns_dnssec_zone *,ldns_rr_list *,uint8_t,uint8_t,uint16_t,uint8_t,uint8_t *, + #retvals: ldns_status + + def create_nsecs(self,new_rrs): + """Adds NSEC records to the given dnssec_zone. + + :param new_rrs: + ldns_rr's created by this function are added to this rr list, so the caller can free them later + :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise + """ + return _ldns.ldns_dnssec_zone_create_nsecs(self,new_rrs) + #parameters: ldns_dnssec_zone *,ldns_rr_list *, + #retvals: ldns_status + + def create_rrsigs(self,new_rrs,key_list,func,arg): + """Adds signatures to the zone. + + :param new_rrs: + the RRSIG RRs that are created are also added to this list, so the caller can free them later + :param key_list: + list of keys to sign with. + :param func: + Callback function to decide what keys to use and what to do with old signatures + :param arg: + Optional argument for the callback function + :returns: (ldns_status) LDNS_STATUS_OK on success, error otherwise + """ + return _ldns.ldns_dnssec_zone_create_rrsigs(self,new_rrs,key_list,func,arg) + #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *,int(*)(ldns_rr *, void *),void *, + #retvals: ldns_status + + def sign_cb(self,new_rrs,key_list,func,arg): + """signs the given zone with the given keys (with callback function) + + :param new_rrs: + newly created resource records are added to this list, to free them later + :param key_list: + the list of keys to sign the zone with + :param func: + callback function that decides what to do with old signatures. + This function takes an ldns_rr and an optional arg argument, and returns one of four values: + + * LDNS_SIGNATURE_LEAVE_ADD_NEW - leave the signature and add a new one for the corresponding key + + * LDNS_SIGNATURE_REMOVE_ADD_NEW - remove the signature and replace is with a new one from the same key + + * LDNS_SIGNATURE_LEAVE_NO_ADD - leave the signature and do not add a new one with the corresponding key + + * LDNS_SIGNATURE_REMOVE_NO_ADD - remove the signature and do not replace + + :param arg: + optional argument for the callback function + :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise + """ + return _ldns.ldns_dnssec_zone_sign(self,new_rrs,key_list,func,arg) + #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *,int(*)(ldns_rr *, void *),void *, + #retvals: ldns_status + + def sign(self,new_rrs,key_list, cbtype=3): + """signs the given zone with the given keys + + :param new_rrs: + newly created resource records are added to this list, to free them later + :param key_list: + the list of keys to sign the zone with + :param cb_type: + specifies how to deal with old signatures, possible values: + + * 0 - ldns_dnssec_default_add_to_signatures, + + * 1 - ldns_dnssec_default_leave_signatures, + + * 2 - ldns_dnssec_default_delete_signatures, + + * 3 - ldns_dnssec_default_replace_signatures + + :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise + """ + return _ldns.ldns_dnssec_zone_sign_defcb(self,new_rrs,key_list, cbtype) + #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *, + #retvals: ldns_status + + def sign_nsec3(self,new_rrs,key_list,func,arg,algorithm,flags,iterations,salt_length,salt): + """signs the given zone with the given new zone, with NSEC3 + + :param new_rrs: + newly created resource records are added to this list, to free them later + :param key_list: + the list of keys to sign the zone with + :param func: + callback function that decides what to do with old signatures + :param arg: + optional argument for the callback function + :param algorithm: + the NSEC3 hashing algorithm to use + :param flags: + NSEC3 flags + :param iterations: + the number of NSEC3 hash iterations to use + :param salt_length: + the length (in octets) of the NSEC3 salt + :param salt: + the NSEC3 salt data + :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise + """ + return _ldns.ldns_dnssec_zone_sign_nsec3(self,new_rrs,key_list,func,arg,algorithm,flags,iterations,salt_length,salt) + #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *,int(*)(ldns_rr *, void *),void *,uint8_t,uint8_t,uint16_t,uint8_t,uint8_t *, + #retvals: ldns_status + + #LDNS_DNSSEC_ZONE_METHODS_# + def add_empty_nonterminals(self): + """Adds explicit dnssec_name structures for the empty nonterminals in this zone. + + (this is needed for NSEC3 generation) + + :returns: (ldns_status) + """ + return _ldns.ldns_dnssec_zone_add_empty_nonterminals(self) + #parameters: ldns_dnssec_zone *, + #retvals: ldns_status + + def add_rr(self,rr): + """Adds the given RR to the zone. + + It find whether there is a dnssec_name with that name present. + If so, add it to that, if not create a new one. + Special handling of NSEC and RRSIG provided. + + :param rr: + The RR to add + :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise + """ + return _ldns.ldns_dnssec_zone_add_rr(self,rr) + #parameters: ldns_dnssec_zone *,ldns_rr *, + #retvals: ldns_status + + def find_rrset(self,dname,atype): + """Find the RRset with the given name and type in the zone. + + :param dname: + the domain name of the RRset to find + :param atype: + :returns: (ldns_dnssec_rrsets \*) the RRset, or NULL if not present + """ + return _ldns.ldns_dnssec_zone_find_rrset(self,dname,atype) + #parameters: ldns_dnssec_zone *,ldns_rdf *,ldns_rr_type, + #retvals: ldns_dnssec_rrsets * + + #_LDNS_DNSSEC_ZONE_METHODS# + %} +} diff --git a/libs/ldns/contrib/python/ldns_key.i b/libs/ldns/contrib/python/ldns_key.i new file mode 100644 index 0000000000..26a9b0f57f --- /dev/null +++ b/libs/ldns/contrib/python/ldns_key.i @@ -0,0 +1,536 @@ +/****************************************************************************** + * ldns_key.i: LDNS key class + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ +%typemap(in,numinputs=0,noblock=1) (ldns_key **) +{ + ldns_key *$1_key; + $1 = &$1_key; +} + +/* result generation */ +%typemap(argout,noblock=1) (ldns_key **) +{ + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_key), SWIGTYPE_p_ldns_struct_key, SWIG_POINTER_OWN | 0 )); +} + +%exception ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r) %{ $action Py_INCREF(obj1); %} + +%nodefaultctor ldns_struct_key; //no default constructor & destructor +%nodefaultdtor ldns_struct_key; + +%delobject ldns_key_free; +%delobject ldns_key_deep_free; +%newobject ldns_key_list_pop_key; +%newobject ldns_key2rr; +%newobject ldns_key_new_frm_algorithm; +%newobject ldns_key_new_frm_fp; +%newobject ldns_key_new_frm_fp_l; +%newobject ldns_key_new_frm_engine; + +%rename(ldns_key) ldns_struct_key; + +#ifdef LDNS_DEBUG +%rename(__ldns_key_free) ldns_key_free; +%inline %{ +void _ldns_key_free (ldns_key* k) { + printf("******** LDNS_KEY free 0x%lX ************\n", (long unsigned int)k); + ldns_key_deep_free(k); +} +%} +#else +%rename(_ldns_key_free) ldns_key_deep_free; +%rename(__ldns_key_free) ldns_key_free; +#endif + +%feature("docstring") ldns_struct_key "Key class + +This class can contains all types of keys that are used in DNSSEC. Mostly used to store private keys, since public keys can also be stored in a ldns_rr with type LDNS_RR_TYPE_DNSKEY. This class can also store some variables that influence the signatures generated by signing with this key, for instance the inception date. + +**Usage** + + >>> import ldns + >>> ldns.ldns_init_random(open(\"/dev/random\",\"rb\"), 512/8) + >>> key = ldns.ldns_key.new_frm_algorithm(ldns.LDNS_SIGN_DSA, 512) #generate new DSA key + >>> print key + Private-key-format: v1.2 + Algorithm: 3 (DSA) + Prime(p): XXXXXXXXHRQBGRflHZQriSAoLI2g+LGvZz8BlEesO+ZQg65wrFGs9IC441y/mn3nFnXfCdtX6zbN5bQuabPdlQ== + Subprime(q): XXXXXdnWs/cWsGDglhEyZRLEVA8= + Base(g): XXXXXXXqrd+dm2bcxDBdCsZRzkXQ22FxCk2ycnjgevr+s2HfA57BPk3xwqCrHUwuOBVg3Fvq4bpldrCe0sT6Og== + Private_value(x): XXXXXcVubZF33pj04z4ZoETsQW1Y= + Public_value(y): XXXXXX8t6zfOxJHoy57qteIw9sOZ/Zu0yFiPO083sPm11NlFx3b4m7TJ2k41gYicHXHLUQK1p0xXFToeZEkPGQ== + >>> fw = open(\"key.priv\", \"wb\") + >>> key.print_to_file(fw) #write priv key to file +" + +%extend ldns_struct_key { + + %pythoncode %{ + def __init__(self): + self.this = _ldns.ldns_key_new() + if not self.this: + raise Exception("Can't create instance of this class") + + __swig_destroy__ = _ldns._ldns_key_free + + def __str__(self): + """converts the data to presentation format""" + return _ldns.ldns_key2str(self) + + + def key_to_rr(self): + """converts a ldns_key to a public key rr + + :returns: (ldns_rr \*) ldns_rr representation of the key + """ + return _ldns.ldns_key2rr(self) + #parameters: const ldns_key *, + #retvals: ldns_rr * + + def print_to_file(self, file): + """print a private key to the file ouput + + :param file: output file pointer + """ + _ldns.ldns_key_print(file, self) + #parameters: FILE *, const ldns_key *, + #retvals: + + #LDNS_KEY_CONSTRUCTORS_# + @staticmethod + def new_frm_fp(file, raiseException=True): + """Creates a new priv key based on the contents of the file pointed by fp. + + :param file: a file object + :param raiseException: if True, an exception occurs in case a key instance can't be created + :returns: key instance or None. If the object can't be created and raiseException is True, an exception occurs. + """ + status, key = _ldns.ldns_key_new_frm_fp(file) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create key, error: %s (%d)" % (_ldns.ldns_get_errorstr_by_id(status),status)) + return None + return key + + @staticmethod + def new_frm_fp_l(file, raiseException=True): + """Creates a new private key based on the contents of the file pointed by fp. + + :param file: a file object + :param raiseException: if True, an exception occurs in case a key instance can't be created + :returns: + * key - key instance or None. If an instance can't be created and raiseException is True, an exception occurs. + + * line - the line number (for debugging) + """ + status, key, line = _ldns.ldns_key_new_frm_fp_l(file) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create key, error: %d" % status) + return None + return key, line + + @staticmethod + def new_frm_algorithm(algorithm, size, raiseException=True): + """Creates a new key based on the algorithm. + + :param algorithm: the algorithm to use + :param size: the number of bytes for the keysize + :param raiseException: if True, an exception occurs in case a key instance can't be created + :returns: key instance or None. If the object can't be created and raiseException is True, an exception occurs. + + **Algorithms** + LDNS_SIGN_RSAMD5, LDNS_SIGN_RSASHA1, LDNS_SIGN_DSA, LDNS_SIGN_RSASHA1_NSEC3, LDNS_SIGN_RSASHA256, LDNS_SIGN_RSASHA256_NSEC3, LDNS_SIGN_RSASHA512, LDNS_SIGN_RSASHA512_NSEC3, LDNS_SIGN_DSA_NSEC3, LDNS_SIGN_HMACMD5, LDNS_SIGN_HMACSHA1, LDNS_SIGN_HMACSHA256 + """ + key = _ldns.ldns_key_new_frm_algorithm(algorithm, size) + if (not key) and (raiseException): raise Exception("Can't create key, error: %d" % status) + return key + #_LDNS_KEY_CONSTRUCTORS# + + #LDNS_KEY_METHODS_# + def algorithm(self): + """return the signing alg of the key + + :returns: (ldns_signing_algorithm) the algorithm + """ + return _ldns.ldns_key_algorithm(self) + #parameters: const ldns_key *, + #retvals: ldns_signing_algorithm + + def dsa_key(self): + """returns the (openssl) DSA struct contained in the key + + :returns: (DSA \*) + """ + return _ldns.ldns_key_dsa_key(self) + #parameters: const ldns_key *, + #retvals: DSA * + + def evp_key(self): + """returns the (openssl) EVP struct contained in the key + + :returns: (EVP_PKEY \*) the RSA * structure in the key + """ + return _ldns.ldns_key_evp_key(self) + #parameters: const ldns_key *, + #retvals: EVP_PKEY * + + def expiration(self): + """return the key's expiration date + + :returns: (uint32_t) the experiration date + """ + return _ldns.ldns_key_expiration(self) + #parameters: const ldns_key *, + #retvals: uint32_t + + def flags(self): + """return the flag of the key + + :returns: (uint16_t) the flag + """ + return _ldns.ldns_key_flags(self) + #parameters: const ldns_key *, + #retvals: uint16_t + + def hmac_key(self): + """return the hmac key data + + :returns: (unsigned char \*) the hmac key data + """ + return _ldns.ldns_key_hmac_key(self) + #parameters: const ldns_key *, + #retvals: unsigned char * + + def hmac_size(self): + """return the hmac key size + + :returns: (size_t) the hmac key size + """ + return _ldns.ldns_key_hmac_size(self) + #parameters: const ldns_key *, + #retvals: size_t + + def inception(self): + """return the key's inception date + + :returns: (uint32_t) the inception date + """ + return _ldns.ldns_key_inception(self) + #parameters: const ldns_key *, + #retvals: uint32_t + + def keytag(self): + """return the keytag + + :returns: (uint16_t) the keytag + """ + return _ldns.ldns_key_keytag(self) + #parameters: const ldns_key *, + #retvals: uint16_t + + def origttl(self): + """return the original ttl of the key + + :returns: (uint32_t) the original ttl + """ + return _ldns.ldns_key_origttl(self) + #parameters: const ldns_key *, + #retvals: uint32_t + + def pubkey_owner(self): + """return the public key's owner + + :returns: (ldns_rdf \*) the owner + """ + return _ldns.ldns_key_pubkey_owner(self) + #parameters: const ldns_key *, + #retvals: ldns_rdf * + + def rsa_key(self): + """returns the (openssl) RSA struct contained in the key + + :returns: (RSA \*) the RSA * structure in the key + """ + return _ldns.ldns_key_rsa_key(self) + #parameters: const ldns_key *, + #retvals: RSA * + + def set_algorithm(self,l): + """Set the key's algorithm. + + :param l: + the algorithm + """ + _ldns.ldns_key_set_algorithm(self,l) + #parameters: ldns_key *,ldns_signing_algorithm, + #retvals: + + def set_dsa_key(self,d): + """Set the key's dsa data. + + :param d: + the dsa data + """ + _ldns.ldns_key_set_dsa_key(self,d) + #parameters: ldns_key *,DSA *, + #retvals: + + def set_evp_key(self,e): + """Set the key's evp key. + + :param e: + the evp key + """ + _ldns.ldns_key_set_evp_key(self,e) + #parameters: ldns_key *,EVP_PKEY *, + #retvals: + + def set_expiration(self,e): + """Set the key's expiration date (seconds after epoch). + + :param e: + the expiration + """ + _ldns.ldns_key_set_expiration(self,e) + #parameters: ldns_key *,uint32_t, + #retvals: + + def set_flags(self,flags): + """Set the key's flags. + + :param flags: + the flags + """ + _ldns.ldns_key_set_flags(self,flags) + #parameters: ldns_key *,uint16_t, + #retvals: + + def set_hmac_key(self,hmac): + """Set the key's hmac data. + + :param hmac: + the raw key data + """ + _ldns.ldns_key_set_hmac_key(self,hmac) + #parameters: ldns_key *,unsigned char *, + #retvals: + + def set_hmac_size(self,hmac_size): + """Set the key's hmac size. + + :param hmac_size: + the size of the hmac data + """ + _ldns.ldns_key_set_hmac_size(self,hmac_size) + #parameters: ldns_key *,size_t, + #retvals: + + def set_inception(self,i): + """Set the key's inception date (seconds after epoch). + + :param i: + the inception + """ + _ldns.ldns_key_set_inception(self,i) + #parameters: ldns_key *,uint32_t, + #retvals: + + def set_keytag(self,tag): + """Set the key's key tag. + + :param tag: + the keytag + """ + _ldns.ldns_key_set_keytag(self,tag) + #parameters: ldns_key *,uint16_t, + #retvals: + + def set_origttl(self,t): + """Set the key's original ttl. + + :param t: + the ttl + """ + _ldns.ldns_key_set_origttl(self,t) + #parameters: ldns_key *,uint32_t, + #retvals: + + def set_pubkey_owner(self,r): + """Set the key's pubkey owner. + + :param r: + the owner + """ + _ldns.ldns_key_set_pubkey_owner(self,r) + #parameters: ldns_key *,ldns_rdf *, + #retvals: + + def set_rsa_key(self,r): + """Set the key's rsa data. + + :param r: + the rsa data + """ + _ldns.ldns_key_set_rsa_key(self,r) + #parameters: ldns_key *,RSA *, + #retvals: + + def set_use(self,v): + """set the use flag + + :param v: + the boolean value to set the _use field to + """ + _ldns.ldns_key_set_use(self,v) + #parameters: ldns_key *,bool, + #retvals: + + def use(self): + """return the use flag + + :returns: (bool) the boolean value of the _use field + """ + return _ldns.ldns_key_use(self) + #parameters: const ldns_key *, + #retvals: bool + #_LDNS_KEY_METHODS# + %} +} + +%nodefaultctor ldns_struct_key_list; //no default constructor & destructor +%nodefaultdtor ldns_struct_key_list; + +%newobject ldns_key_list_new; +%newobject ldns_key_list_pop_key; +%delobject ldns_key_list_free; +%delobject ldns_key_list_push_key; + +%rename(ldns_key_list) ldns_struct_key_list; + +#ifdef LDNS_DEBUG +%rename(__ldns_key_list_free) ldns_key_list_free; +%inline %{ +void _ldns_key_list_free (ldns_key_list* k) { + printf("******** LDNS_KEY_LIST free 0x%lX ************\n", (long unsigned int)k); + ldns_key_list_free(k); +} +%} +#else +%rename(_ldns_key_list_free) ldns_key_list_free; +#endif + +%extend ldns_struct_key_list { + + %pythoncode %{ + def __init__(self): + self.this = _ldns.ldns_key_list_new() + if not self.this: + raise Exception("Can't create class") + + __swig_destroy__ = _ldns._ldns_key_list_free + + def keys(self): + """Key list iterator""" + for i in range(0, self.key_count()): + yield self.key(i) + + def __str__(self): + i = 0 + s = "" + for k in self.keys(): + i += 1 + s += "key %d:\n %s\n" % (i, str(k).replace("\n","\n ")) + return s + + #LDNS_KEY_LIST_METHODS_# + def key(self,nr): + """returns a pointer to the key in the list at the given position + + :param nr: + the position in the list + :returns: (ldns_key \*) the key + """ + return _ldns.ldns_key_list_key(self,nr) + #parameters: const ldns_key_list *,size_t, + #retvals: ldns_key * + + def key_count(self): + """returns the number of keys in the key list + + :returns: (size_t) the numbers of keys in the list + """ + return _ldns.ldns_key_list_key_count(self) + #parameters: const ldns_key_list *, + #retvals: size_t + + def pop_key(self): + """pops the last rr from a keylist + + :returns: (ldns_key \*) NULL if nothing to pop. Otherwise the popped RR + """ + return _ldns.ldns_key_list_pop_key(self) + #parameters: ldns_key_list *, + #retvals: ldns_key * + + def push_key(self,key): + """pushes a key to a keylist + + :param key: + the key to push + :returns: (bool) false on error, otherwise true + """ + return _ldns.ldns_key_list_push_key(self,key) + #parameters: ldns_key_list *,ldns_key *, + #retvals: bool + + def set_key_count(self,count): + """Set the keylist's key count to count. + + :param count: + the cuont + """ + _ldns.ldns_key_list_set_key_count(self,count) + #parameters: ldns_key_list *,size_t, + #retvals: + + def set_use(self,v): + """Set the 'use' flag for all keys in the list. + + :param v: + The value to set the use flags to + """ + _ldns.ldns_key_list_set_use(self,v) + #parameters: ldns_key_list *,bool, + #retvals: + + #_LDNS_KEY_LIST_METHODS# + %} +} + diff --git a/libs/ldns/contrib/python/ldns_packet.i b/libs/ldns/contrib/python/ldns_packet.i new file mode 100644 index 0000000000..21f31bd011 --- /dev/null +++ b/libs/ldns/contrib/python/ldns_packet.i @@ -0,0 +1,1036 @@ +/****************************************************************************** + * ldns_packet.i: LDNS packet class + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ +%typemap(in,numinputs=0,noblock=1) (ldns_pkt **) +{ + ldns_pkt *$1_pkt; + $1 = &$1_pkt; +} + +/* result generation */ +%typemap(argout,noblock=1) (ldns_pkt **) +{ + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_pkt), SWIGTYPE_p_ldns_struct_pkt, SWIG_POINTER_OWN | 0 )); +} + +%newobject ldns_pkt_clone; +%newobject ldns_pkt_rr_list_by_type; +%newobject ldns_pkt_rr_list_by_name_and_type; +%newobject ldns_pkt_rr_list_by_name; +%newobject ldns_update_pkt_new; + +%nodefaultctor ldns_struct_pkt; //no default constructor & destructor +%nodefaultdtor ldns_struct_pkt; + +%rename(ldns_pkt) ldns_struct_pkt; +#ifdef LDNS_DEBUG +%rename(__ldns_pkt_free) ldns_pkt_free; +%inline %{ +void _ldns_pkt_free (ldns_pkt* p) { + printf("******** LDNS_PKT free 0x%lX ************\n", (long unsigned int)p); + ldns_pkt_free(p); +} +%} +#else +%rename(_ldns_pkt_free) ldns_pkt_free; +#endif + +%newobject ldns_pkt2str; +%newobject ldns_pkt_opcode2str; +%newobject ldns_pkt_rcode2str; +%newobject ldns_pkt_algorithm2str; +%newobject ldns_pkt_cert_algorithm2str; + +%exception ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr) %{ $action if (result) Py_INCREF(obj2); %} +%exception ldns_pkt_push_rr_list(ldns_pkt *packet, ldns_pkt_section section, ldns_rr_list *list) %{ $action if (result) Py_INCREF(obj2); %} + + +%feature("docstring") ldns_struct_pkt "LDNS packet object. + +The ldns_pkt object contains DNS packed (either a query or an answer). It is the complete representation of what you actually send to a nameserver, and what you get back (see :class:`ldns.ldns_resolver`). + +**Usage** + +>>> import ldns +>>> resolver = ldns.ldns_resolver.new_frm_file(\"/etc/resolv.conf\") +>>> pkt = resolver.query(\"nic.cz\", ldns.LDNS_RR_TYPE_NS,ldns.LDNS_RR_CLASS_IN) +>>> print pkt +;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 63004 +;; flags: qr rd ra ; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 +;; QUESTION SECTION: +;; nic.cz. IN NS +;; ANSWER SECTION: +nic.cz. 758 IN NS a.ns.nic.cz. +nic.cz. 758 IN NS c.ns.nic.cz. +nic.cz. 758 IN NS e.ns.nic.cz. +;; AUTHORITY SECTION: +;; ADDITIONAL SECTION: +;; Query time: 8 msec +;; SERVER: 82.100.38.2 +;; WHEN: Thu Jan 11 12:54:33 2009 +;; MSG SIZE rcvd: 75 + +This simple example instances a resolver in order to resolve NS for nic.cz. +" + +%extend ldns_struct_pkt { + + %pythoncode %{ + def __init__(self): + raise Exception("This class can't be created directly. Please use: ldns_pkt_new(), ldns_pkt_query_new() or ldns_pkt_query_new_frm_str()") + + __swig_destroy__ = _ldns._ldns_pkt_free + + #LDNS_PKT_CONSTRUCTORS_# + @staticmethod + def new_query(rr_name, rr_type, rr_class, flags): + """Creates a packet with a query in it for the given name, type and class. + + :param rr_name: the name to query for + :param rr_type: the type to query for + :param rr_class: the class to query for + :param flags: packet flags + :returns: new ldns_pkt object + """ + return _ldns.ldns_pkt_query_new(rr_name, rr_type, rr_class, flags) + + @staticmethod + def new_query_frm_str(rr_name, rr_type, rr_class, flags, raiseException = True): + """Creates a query packet for the given name, type, class. + + :param rr_name: the name to query for + :param rr_type: the type to query for + :param rr_class: the class to query for + :param flags: packet flags + :param raiseException: if True, an exception occurs in case a resolver object can't be created + :returns: query packet object or None. If the object can't be created and raiseException is True, an exception occurs. + + + **Usage** + + >>> pkt = ldns.ldns_pkt.new_query_frm_str("test.nic.cz",ldns.LDNS_RR_TYPE_ANY, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_QR | ldns.LDNS_AA) + >>> rra = ldns.ldns_rr.new_frm_str("test.nic.cz. IN A 192.168.1.1",300) + >>> list = ldns.ldns_rr_list() + >>> if (rra): list.push_rr(rra) + >>> pkt.push_rr_list(ldns.LDNS_SECTION_ANSWER, list) + >>> print pkt + ;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 0 + ;; flags: qr aa ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 + ;; QUESTION SECTION: + ;; test.nic.cz. IN ANY + ;; ANSWER SECTION: + test.nic.cz. 300 IN A 192.168.1.1 + ;; AUTHORITY SECTION: + ;; ADDITIONAL SECTION: + ;; Query time: 0 msec + ;; WHEN: Thu Jan 1 01:00:00 1970 + ;; MSG SIZE rcvd: 0 + """ + status, pkt = _ldns.ldns_pkt_query_new_frm_str(rr_name, rr_type, rr_class, flags) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create query packet, error: %d" % status) + return None + return pkt + #_LDNS_PKT_CONSTRUCTORS# + + def __str__(self): + """Converts the data in the DNS packet to presentation format""" + return _ldns.ldns_pkt2str(self) + + def opcode2str(self): + """Converts a packet opcode to its mnemonic and returns that as an allocated null-terminated string.""" + return _ldns.ldns_pkt_opcode2str(sefl.get_opcode()) + + def rcode2str(self): + """Converts a packet rcode to its mnemonic and returns that as an allocated null-terminated string.""" + return _ldns.ldns_pkt_rcode2str(self.get_rcode()) + + def print_to_file(self,output): + """Prints the data in the DNS packet to the given file stream (in presentation format).""" + _ldns.ldns_pkt_print(output,self) + #parameters: FILE *,const ldns_pkt *, + + def write_to_buffer(self, buffer): + """Copies the packet data to the buffer in wire format. + + :param buffer: buffer to append the result to + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_pkt2buffer_wire(buffer, self) + #parameters: ldns_buffer *,const ldns_pkt *, + #retvals: ldns_status + + @staticmethod + def algorithm2str(alg): + """Converts a signing algorithms to its mnemonic and returns that as an allocated null-terminated string.""" + return _ldns.ldns_pkt_algorithm2str(alg) + #parameters: ldns_algorithm, + + @staticmethod + def cert_algorithm2str(alg): + """Converts a cert algorithm to its mnemonic and returns that as an allocated null-terminated string.""" + return _ldns.ldns_pkt_cert_algorithm2str(alg) + #parameters: ldns_algorithm, + + #LDNS_PKT_METHODS_# + def aa(self): + """Read the packet's aa bit. + + :returns: (bool) value of the bit + """ + return _ldns.ldns_pkt_aa(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def ad(self): + """Read the packet's ad bit. + + :returns: (bool) value of the bit + """ + return _ldns.ldns_pkt_ad(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def additional(self): + """Return the packet's additional section. + + :returns: (ldns_rr_list \*) the section + """ + return _ldns.ldns_pkt_additional(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rr_list * + + def all(self): + return _ldns.ldns_pkt_all(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rr_list * + + def all_noquestion(self): + return _ldns.ldns_pkt_all_noquestion(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rr_list * + + def ancount(self): + """Return the packet's an count. + + :returns: (uint16_t) the an count + """ + return _ldns.ldns_pkt_ancount(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def answer(self): + """Return the packet's answer section. + + :returns: (ldns_rr_list \*) the section + """ + return _ldns.ldns_pkt_answer(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rr_list * + + def answerfrom(self): + """Return the packet's answerfrom. + + :returns: (ldns_rdf \*) the name of the server + """ + return _ldns.ldns_pkt_answerfrom(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rdf * + + def arcount(self): + """Return the packet's ar count. + + :returns: (uint16_t) the ar count + """ + return _ldns.ldns_pkt_arcount(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def authority(self): + """Return the packet's authority section. + + :returns: (ldns_rr_list \*) the section + """ + return _ldns.ldns_pkt_authority(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rr_list * + + def cd(self): + """Read the packet's cd bit. + + :returns: (bool) value of the bit + """ + return _ldns.ldns_pkt_cd(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def clone(self): + """clones the given packet, creating a fully allocated copy + + :returns: (ldns_pkt \*) ldns_pkt* pointer to the new packet + """ + return _ldns.ldns_pkt_clone(self) + #parameters: ldns_pkt *, + #retvals: ldns_pkt * + + def edns(self): + """returns true if this packet needs and EDNS rr to be sent. + + At the moment the only reason is an expected packet size larger than 512 bytes, but for instance dnssec would be a good reason too. + + :returns: (bool) true if packet needs edns rr + """ + return _ldns.ldns_pkt_edns(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def edns_data(self): + """return the packet's edns data + + :returns: (ldns_rdf \*) the data + """ + return _ldns.ldns_pkt_edns_data(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rdf * + + def edns_do(self): + """return the packet's edns do bit + + :returns: (bool) the bit's value + """ + return _ldns.ldns_pkt_edns_do(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def edns_extended_rcode(self): + """return the packet's edns extended rcode + + :returns: (uint8_t) the rcode + """ + return _ldns.ldns_pkt_edns_extended_rcode(self) + #parameters: const ldns_pkt *, + #retvals: uint8_t + + def edns_udp_size(self): + """return the packet's edns udp size + + :returns: (uint16_t) the size + """ + return _ldns.ldns_pkt_edns_udp_size(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def edns_version(self): + """return the packet's edns version + + :returns: (uint8_t) the version + """ + return _ldns.ldns_pkt_edns_version(self) + #parameters: const ldns_pkt *, + #retvals: uint8_t + + def edns_z(self): + """return the packet's edns z value + + :returns: (uint16_t) the z value + """ + return _ldns.ldns_pkt_edns_z(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def empty(self): + """check if a packet is empty + + :returns: (bool) true: empty, false: empty + """ + return _ldns.ldns_pkt_empty(self) + #parameters: ldns_pkt *, + #retvals: bool + + def get_opcode(self): + """Read the packet's code. + + :returns: (ldns_pkt_opcode) the opcode + """ + return _ldns.ldns_pkt_get_opcode(self) + #parameters: const ldns_pkt *, + #retvals: ldns_pkt_opcode + + def get_rcode(self): + """Return the packet's respons code. + + :returns: (ldns_pkt_rcode) the respons code + """ + return _ldns.ldns_pkt_get_rcode(self) + #parameters: const ldns_pkt *, + #retvals: ldns_pkt_rcode + + def get_section_clone(self,s): + """return all the rr_list's in the packet. + + Clone the lists, instead of returning pointers. + + :param s: + what section(s) to return + :returns: (ldns_rr_list \*) ldns_rr_list with the rr's or NULL if none were found + """ + return _ldns.ldns_pkt_get_section_clone(self,s) + #parameters: const ldns_pkt *,ldns_pkt_section, + #retvals: ldns_rr_list * + + def id(self): + """Read the packet id. + + :returns: (uint16_t) the packet id + """ + return _ldns.ldns_pkt_id(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def nscount(self): + """Return the packet's ns count. + + :returns: (uint16_t) the ns count + """ + return _ldns.ldns_pkt_nscount(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def push_rr(self,section,rr): + """push an rr on a packet + + :param section: + where to put it + :param rr: + rr to push + :returns: (bool) a boolean which is true when the rr was added + """ + return _ldns.ldns_pkt_push_rr(self,section,rr) + #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr *, + #retvals: bool + + def push_rr_list(self,section,list): + """push a rr_list on a packet + + :param section: + where to put it + :param list: + the rr_list to push + :returns: (bool) a boolean which is true when the rr was added + """ + return _ldns.ldns_pkt_push_rr_list(self,section,list) + #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr_list *, + #retvals: bool + + def qdcount(self): + """Return the packet's qd count. + + :returns: (uint16_t) the qd count + """ + return _ldns.ldns_pkt_qdcount(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def qr(self): + """Read the packet's qr bit. + + :returns: (bool) value of the bit + """ + return _ldns.ldns_pkt_qr(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def querytime(self): + """Return the packet's querytime. + + :returns: (uint32_t) the querytime + """ + return _ldns.ldns_pkt_querytime(self) + #parameters: const ldns_pkt *, + #retvals: uint32_t + + def question(self): + """Return the packet's question section. + + :returns: (ldns_rr_list \*) the section + """ + return _ldns.ldns_pkt_question(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rr_list * + + def ra(self): + """Read the packet's ra bit. + + :returns: (bool) value of the bit + """ + return _ldns.ldns_pkt_ra(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def rd(self): + """Read the packet's rd bit. + + :returns: (bool) value of the bit + """ + return _ldns.ldns_pkt_rd(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def reply_type(self): + """looks inside the packet to determine what kind of packet it is, AUTH, NXDOMAIN, REFERRAL, etc. + + :returns: (ldns_pkt_type) the type of packet + """ + return _ldns.ldns_pkt_reply_type(self) + #parameters: ldns_pkt *, + #retvals: ldns_pkt_type + + def rr(self,sec,rr): + """check to see if an rr exist in the packet + + :param sec: + in which section to look + :param rr: + the rr to look for + :returns: (bool) + """ + return _ldns.ldns_pkt_rr(self,sec,rr) + #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr *, + #retvals: bool + + def rr_list_by_name(self,r,s): + """return all the rr with a specific name from a packet. + + Optionally specify from which section in the packet + + :param r: + the name + :param s: + the packet's section + :returns: (ldns_rr_list \*) a list with the rr's or NULL if none were found + """ + return _ldns.ldns_pkt_rr_list_by_name(self,r,s) + #parameters: ldns_pkt *,ldns_rdf *,ldns_pkt_section, + #retvals: ldns_rr_list * + + def rr_list_by_name_and_type(self,ownername,atype,sec): + """return all the rr with a specific type and type from a packet. + + Optionally specify from which section in the packet + + :param ownername: + the name + :param atype: + :param sec: + the packet's section + :returns: (ldns_rr_list \*) a list with the rr's or NULL if none were found + """ + return _ldns.ldns_pkt_rr_list_by_name_and_type(self,ownername,atype,sec) + #parameters: const ldns_pkt *,const ldns_rdf *,ldns_rr_type,ldns_pkt_section, + #retvals: ldns_rr_list * + + def rr_list_by_type(self,t,s): + """return all the rr with a specific type from a packet. + + Optionally specify from which section in the packet + + :param t: + the type + :param s: + the packet's section + :returns: (ldns_rr_list \*) a list with the rr's or NULL if none were found + """ + return _ldns.ldns_pkt_rr_list_by_type(self,t,s) + #parameters: const ldns_pkt *,ldns_rr_type,ldns_pkt_section, + #retvals: ldns_rr_list * + + def safe_push_rr(self,sec,rr): + """push an rr on a packet, provided the RR is not there. + + :param sec: + where to put it + :param rr: + rr to push + :returns: (bool) a boolean which is true when the rr was added + """ + return _ldns.ldns_pkt_safe_push_rr(self,sec,rr) + #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr *, + #retvals: bool + + def safe_push_rr_list(self,sec,list): + """push an rr_list to a packet, provided the RRs are not already there. + + :param sec: + where to put it + :param list: + the rr_list to push + :returns: (bool) a boolean which is true when the rr was added + """ + return _ldns.ldns_pkt_safe_push_rr_list(self,sec,list) + #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr_list *, + #retvals: bool + + def section_count(self,s): + return _ldns.ldns_pkt_section_count(self,s) + #parameters: const ldns_pkt *,ldns_pkt_section, + #retvals: uint16_t + + def set_aa(self,b): + """Set the packet's aa bit. + + :param b: + the value to set (boolean) + """ + _ldns.ldns_pkt_set_aa(self,b) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_ad(self,b): + """Set the packet's ad bit. + + :param b: + the value to set (boolean) + """ + _ldns.ldns_pkt_set_ad(self,b) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_additional(self,rr): + """directly set the additional section + + :param rr: + rrlist to set + """ + _ldns.ldns_pkt_set_additional(self,rr) + #parameters: ldns_pkt *,ldns_rr_list *, + #retvals: + + def set_ancount(self,c): + """Set the packet's an count. + + :param c: + the count + """ + _ldns.ldns_pkt_set_ancount(self,c) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def set_answer(self,rr): + """directly set the answer section + + :param rr: + rrlist to set + """ + _ldns.ldns_pkt_set_answer(self,rr) + #parameters: ldns_pkt *,ldns_rr_list *, + #retvals: + + def set_answerfrom(self,r): + """Set the packet's answering server. + + :param r: + the address + """ + _ldns.ldns_pkt_set_answerfrom(self,r) + #parameters: ldns_pkt *,ldns_rdf *, + #retvals: + + def set_arcount(self,c): + """Set the packet's arcount. + + :param c: + the count + """ + _ldns.ldns_pkt_set_arcount(self,c) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def set_authority(self,rr): + """directly set the auhority section + + :param rr: + rrlist to set + """ + _ldns.ldns_pkt_set_authority(self,rr) + #parameters: ldns_pkt *,ldns_rr_list *, + #retvals: + + def set_cd(self,b): + """Set the packet's cd bit. + + :param b: + the value to set (boolean) + """ + _ldns.ldns_pkt_set_cd(self,b) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_edns_data(self,data): + """Set the packet's edns data. + + :param data: + the data + """ + _ldns.ldns_pkt_set_edns_data(self,data) + #parameters: ldns_pkt *,ldns_rdf *, + #retvals: + + def set_edns_do(self,value): + """Set the packet's edns do bit. + + :param value: + the bit's new value + """ + _ldns.ldns_pkt_set_edns_do(self,value) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_edns_extended_rcode(self,c): + """Set the packet's edns extended rcode. + + :param c: + the code + """ + _ldns.ldns_pkt_set_edns_extended_rcode(self,c) + #parameters: ldns_pkt *,uint8_t, + #retvals: + + def set_edns_udp_size(self,s): + """Set the packet's edns udp size. + + :param s: + the size + """ + _ldns.ldns_pkt_set_edns_udp_size(self,s) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def set_edns_version(self,v): + """Set the packet's edns version. + + :param v: + the version + """ + _ldns.ldns_pkt_set_edns_version(self,v) + #parameters: ldns_pkt *,uint8_t, + #retvals: + + def set_edns_z(self,z): + """Set the packet's edns z value. + + :param z: + the value + """ + _ldns.ldns_pkt_set_edns_z(self,z) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def set_flags(self,flags): + """sets the flags in a packet. + + :param flags: + ORed values: LDNS_QR| LDNS_AR for instance + :returns: (bool) true on success otherwise false + """ + return _ldns.ldns_pkt_set_flags(self,flags) + #parameters: ldns_pkt *,uint16_t, + #retvals: bool + + def set_id(self,id): + """Set the packet's id. + + :param id: + the id to set + """ + _ldns.ldns_pkt_set_id(self,id) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def set_nscount(self,c): + """Set the packet's ns count. + + :param c: + the count + """ + _ldns.ldns_pkt_set_nscount(self,c) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def set_opcode(self,c): + """Set the packet's opcode. + + :param c: + the opcode + """ + _ldns.ldns_pkt_set_opcode(self,c) + #parameters: ldns_pkt *,ldns_pkt_opcode, + #retvals: + + def set_qdcount(self,c): + """Set the packet's qd count. + + :param c: + the count + """ + _ldns.ldns_pkt_set_qdcount(self,c) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def set_qr(self,b): + """Set the packet's qr bit. + + :param b: + the value to set (boolean) + """ + _ldns.ldns_pkt_set_qr(self,b) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_querytime(self,t): + """Set the packet's query time. + + :param t: + the querytime in msec + """ + _ldns.ldns_pkt_set_querytime(self,t) + #parameters: ldns_pkt *,uint32_t, + #retvals: + + def set_question(self,rr): + """directly set the question section + + :param rr: + rrlist to set + """ + _ldns.ldns_pkt_set_question(self,rr) + #parameters: ldns_pkt *,ldns_rr_list *, + #retvals: + + def set_ra(self,b): + """Set the packet's ra bit. + + :param b: + the value to set (boolean) + """ + _ldns.ldns_pkt_set_ra(self,b) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_random_id(self): + """Set the packet's id to a random value. + """ + _ldns.ldns_pkt_set_random_id(self) + #parameters: ldns_pkt *, + #retvals: + + def set_rcode(self,c): + """Set the packet's respons code. + + :param c: + the rcode + """ + _ldns.ldns_pkt_set_rcode(self,c) + #parameters: ldns_pkt *,uint8_t, + #retvals: + + def set_rd(self,b): + """Set the packet's rd bit. + + :param b: + the value to set (boolean) + """ + _ldns.ldns_pkt_set_rd(self,b) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_section_count(self,s,x): + """Set a packet's section count to x. + + :param s: + the section + :param x: + the section count + """ + _ldns.ldns_pkt_set_section_count(self,s,x) + #parameters: ldns_pkt *,ldns_pkt_section,uint16_t, + #retvals: + + def set_size(self,s): + """Set the packet's size. + + :param s: + the size + """ + _ldns.ldns_pkt_set_size(self,s) + #parameters: ldns_pkt *,size_t, + #retvals: + + def set_tc(self,b): + """Set the packet's tc bit. + + :param b: + the value to set (boolean) + """ + _ldns.ldns_pkt_set_tc(self,b) + #parameters: ldns_pkt *,bool, + #retvals: + + def set_timestamp(self,timeval): + _ldns.ldns_pkt_set_timestamp(self,timeval) + #parameters: ldns_pkt *,struct timeval, + #retvals: + + def set_tsig(self,t): + """Set the packet's tsig rr. + + :param t: + the tsig rr + """ + _ldns.ldns_pkt_set_tsig(self,t) + #parameters: ldns_pkt *,ldns_rr *, + #retvals: + + def size(self): + """Return the packet's size in bytes. + + :returns: (size_t) the size + """ + return _ldns.ldns_pkt_size(self) + #parameters: const ldns_pkt *, + #retvals: size_t + + def tc(self): + """Read the packet's tc bit. + + :returns: (bool) value of the bit + """ + return _ldns.ldns_pkt_tc(self) + #parameters: const ldns_pkt *, + #retvals: bool + + def timestamp(self): + """Return the packet's timestamp. + + :returns: (struct timeval) the timestamp + """ + return _ldns.ldns_pkt_timestamp(self) + #parameters: const ldns_pkt *, + #retvals: struct timeval + + def tsig(self): + """Return the packet's tsig pseudo rr's. + + :returns: (ldns_rr \*) the tsig rr + """ + return _ldns.ldns_pkt_tsig(self) + #parameters: const ldns_pkt *, + #retvals: ldns_rr * + + #_LDNS_PKT_METHODS# + + #LDNS update methods + #LDNS_METHODS_# + def update_pkt_tsig_add(self,r): + """add tsig credentials to a packet from a resolver + + :param r: + resolver to copy from + :returns: (ldns_status) status wether successfull or not + """ + return _ldns.ldns_update_pkt_tsig_add(self,r) + #parameters: ldns_pkt *,ldns_resolver *, + #retvals: ldns_status + + def update_prcount(self): + """Get the zo count. + + :returns: (uint16_t) the pr count + """ + return _ldns.ldns_update_prcount(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def update_set_adcount(self,c): + """Set the ad count. + + :param c: + the ad count to set + """ + _ldns.ldns_update_set_adcount(self,c) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def update_set_prcount(self,c): + """Set the pr count. + + :param c: + the pr count to set + """ + _ldns.ldns_update_set_prcount(self,c) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def update_set_upcount(self,c): + """Set the up count. + + :param c: + the up count to set + """ + _ldns.ldns_update_set_upcount(self,c) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def update_set_zo(self,v): + _ldns.ldns_update_set_zo(self,v) + #parameters: ldns_pkt *,uint16_t, + #retvals: + + def update_upcount(self): + """Get the zo count. + + :returns: (uint16_t) the up count + """ + return _ldns.ldns_update_upcount(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + def update_zocount(self): + """Get the zo count. + + :returns: (uint16_t) the zo count + """ + return _ldns.ldns_update_zocount(self) + #parameters: const ldns_pkt *, + #retvals: uint16_t + + #_LDNS_METHODS# + %} +} diff --git a/libs/ldns/contrib/python/ldns_rdf.i b/libs/ldns/contrib/python/ldns_rdf.i new file mode 100644 index 0000000000..045fae974b --- /dev/null +++ b/libs/ldns/contrib/python/ldns_rdf.i @@ -0,0 +1,418 @@ +/****************************************************************************** + * ldns_rdata.i: LDNS record data + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ + +//automatic conversion of const ldns_rdf* parameter from string +%typemap(in,noblock=1) const ldns_rdf * (void* argp, $1_ltype tmp = 0, int res) { + if (PyString_Check($input)) { + tmp = ldns_dname_new_frm_str(PyString_AsString($input)); + if (tmp == NULL) { + %argument_fail(SWIG_TypeError, "char *", $symname, $argnum); + } + $1 = ($1_ltype) tmp; + } else { + res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_ldns_struct_rdf, 0 | 0 ); + if (!SWIG_IsOK(res)) { + %argument_fail(res, "ldns_rdf const *", $symname, $argnum); + } + $1 = ($1_ltype) argp; + } +} + +%typemap(in,numinputs=0,noblock=1) (ldns_rdf **) +{ + ldns_rdf *$1_rdf; + $1 = &$1_rdf; +} + +// result generation +%typemap(argout,noblock=1) (ldns_rdf **) +{ + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_rdf), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 )); +} + +%nodefaultctor ldns_struct_rdf; //no default constructor & destructor +%nodefaultdtor ldns_struct_rdf; + +%newobject ldns_dname_new; +%newobject ldns_dname_new_frm_str; +%newobject ldns_dname_new_frm_data; + +%delobject ldns_rdf_deep_free; +%delobject ldns_rdf_free; + +%rename(ldns_rdf) ldns_struct_rdf; + +%inline %{ + +const char *ldns_rdf_type2str(const ldns_rdf *rdf) +{ + if (rdf) { + switch(ldns_rdf_get_type(rdf)) { + case LDNS_RDF_TYPE_NONE: return 0; + case LDNS_RDF_TYPE_DNAME: return "DNAME"; + case LDNS_RDF_TYPE_INT8: return "INT8"; + case LDNS_RDF_TYPE_INT16: return "INT16"; + case LDNS_RDF_TYPE_INT32: return "INT32"; + case LDNS_RDF_TYPE_PERIOD: return "PERIOD"; + case LDNS_RDF_TYPE_TSIGTIME: return "TSIGTIME"; + case LDNS_RDF_TYPE_A: return "A"; + case LDNS_RDF_TYPE_AAAA: return "AAAA"; + case LDNS_RDF_TYPE_STR: return "STR"; + case LDNS_RDF_TYPE_APL: return "APL"; + case LDNS_RDF_TYPE_B32_EXT: return "B32_EXT"; + case LDNS_RDF_TYPE_B64: return "B64"; + case LDNS_RDF_TYPE_HEX: return "HEX"; + case LDNS_RDF_TYPE_NSEC: return "NSEC"; + case LDNS_RDF_TYPE_NSEC3_SALT: return "NSEC3_SALT"; + case LDNS_RDF_TYPE_TYPE: return "TYPE"; + case LDNS_RDF_TYPE_CLASS: return "CLASS"; + case LDNS_RDF_TYPE_CERT_ALG: return "CER_ALG"; + case LDNS_RDF_TYPE_ALG: return "ALG"; + case LDNS_RDF_TYPE_UNKNOWN: return "UNKNOWN"; + case LDNS_RDF_TYPE_TIME: return "TIME"; + case LDNS_RDF_TYPE_LOC: return "LOC"; + case LDNS_RDF_TYPE_WKS: return "WKS"; + case LDNS_RDF_TYPE_SERVICE: return "SERVICE"; + case LDNS_RDF_TYPE_NSAP: return "NSAP"; + case LDNS_RDF_TYPE_ATMA: return "ATMA"; + case LDNS_RDF_TYPE_IPSECKEY: return "IPSECKEY"; + case LDNS_RDF_TYPE_TSIG: return "TSIG"; + case LDNS_RDF_TYPE_INT16_DATA: return "INT16_DATA"; + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: return "NSEC3_NEXT_OWNER"; + } + } + return 0; +} +%} + +#ifdef LDNS_DEBUG +%rename(__ldns_rdf_deep_free) ldns_rdf_deep_free; +%rename(__ldns_rdf_free) ldns_rdf_free; +%inline %{ +void _ldns_rdf_free (ldns_rdf* r) { + printf("******** LDNS_RDF free 0x%lX ************\n", (long unsigned int)r); + ldns_rdf_free(r); +} +%} +#else +%rename(_ldns_rdf_deep_free) ldns_rdf_deep_free; +%rename(_ldns_rdf_free) ldns_rdf_free; +#endif + +%newobject ldns_rdf2str; + + +%feature("docstring") ldns_struct_rdf "Resource record data field. + +The data is a network ordered array of bytes, which size is specified by the (16-bit) size field. To correctly parse it, use the type specified in the (16-bit) type field with a value from ldns_rdf_type." + +%extend ldns_struct_rdf { + + %pythoncode %{ + def __init__(self): + raise Exception("This class can't be created directly. Please use: ldns_rdf_new, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_new_frm_fp_l") + + __swig_destroy__ = _ldns._ldns_rdf_free + + #LDNS_RDF_CONSTRUCTORS_# + @staticmethod + def new_frm_str(str, rr_type, raiseException = True): + """Creates a new rdf from a string of a given type. + + :param str: string to use + :param rr_type: the type of RDF. See predefined `RDF_TYPE_` constants + :param raiseException: if True, an exception occurs in case a RDF object can't be created + :returns: RDF object or None. If the object can't be created and raiseException is True, an exception occurs. + + **Usage** + >>> rdf = ldns.ldns_rdf.new_frm_str("74.125.43.99",ldns.LDNS_RDF_TYPE_A) + >>> print rdf, rdf.get_type_str() + A 74.125.43.99 + >>> name = ldns.ldns_resolver.new_frm_file().get_name_by_addr(rdf) + >>> if (name): print name + 99.43.125.74.in-addr.arpa. 85277 IN PTR bw-in-f99.google.com. + """ + rr = _ldns.ldns_rdf_new_frm_str(rr_type, str) + if not rr: + if (raiseException): raise Exception("Can't create query packet, error: %d" % status) + return rr + #_LDNS_RDF_CONSTRUCTORS# + + def __str__(self): + """Converts the rdata field to presentation format""" + return _ldns.ldns_rdf2str(self) + + def __cmp__(self,other): + """compares two rdf's on their wire formats. + + (To order dnames according to rfc4034, use ldns_dname_compare) + + :param other: + the second one RDF + :returns: (int) 0 if equal -1 if self comes before other +1 if other comes before self + """ + return _ldns.ldns_rdf_compare(self,other) + + def print_to_file(self,output): + """Prints the data in the rdata field to the given file stream (in presentation format).""" + _ldns.ldns_rdf_print(output,self) + + def get_type_str(self): + """Converts type to string""" + return ldns_rdf_type2str(self) + + def write_to_buffer(self, buffer): + """Copies the rdata data to the buffer in wire format. + + :param buffer: buffer to append the result to + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_rdf2buffer_wire(buffer, self) + #parameters: ldns_buffer *,const ldns_rdf *, + #retvals: ldns_status + + def write_to_buffer_canonical(self, buffer): + """Copies the rdata data to the buffer in wire format If the rdata is a dname, the letters will be lowercased during the conversion. + + :param buffer: LDNS buffer + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_rdf2buffer_wire_canonical(buffer, self) + #parameters: ldns_buffer *,const ldns_rdf *, + #retvals: ldns_status + + #LDNS_RDF_METHODS_# + def address_reverse(self): + """reverses an rdf, only actually useful for AAAA and A records. + + The returned rdf has the type LDNS_RDF_TYPE_DNAME! + + :returns: (ldns_rdf \*) the reversed rdf (a newly created rdf) + """ + return _ldns.ldns_rdf_address_reverse(self) + #parameters: ldns_rdf *, + #retvals: ldns_rdf * + + def clone(self): + """clones a rdf structure. + + The data is copied. + + :returns: (ldns_rdf \*) a new rdf structure + """ + return _ldns.ldns_rdf_clone(self) + #parameters: const ldns_rdf *, + #retvals: ldns_rdf * + + def data(self): + """returns the data of the rdf. + + :returns: (uint8_t \*) uint8_t* pointer to the rdf's data + """ + return _ldns.ldns_rdf_data(self) + #parameters: const ldns_rdf *, + #retvals: uint8_t * + + def get_type(self): + """returns the type of the rdf. + + We need to insert _get_ here to prevent conflict the the rdf_type TYPE. + + :returns: (ldns_rdf_type) ldns_rdf_type with the type + """ + return _ldns.ldns_rdf_get_type(self) + #parameters: const ldns_rdf *, + #retvals: ldns_rdf_type + + def set_data(self,data): + """sets the size of the rdf. + + :param data: + """ + _ldns.ldns_rdf_set_data(self,data) + #parameters: ldns_rdf *,void *, + #retvals: + + def set_size(self,size): + """sets the size of the rdf. + + :param size: + the new size + """ + _ldns.ldns_rdf_set_size(self,size) + #parameters: ldns_rdf *,size_t, + #retvals: + + def set_type(self,atype): + """sets the size of the rdf. + + :param atype: + """ + _ldns.ldns_rdf_set_type(self,atype) + #parameters: ldns_rdf *,ldns_rdf_type, + #retvals: + + def size(self): + """returns the size of the rdf. + + :returns: (size_t) uint16_t with the size + """ + return _ldns.ldns_rdf_size(self) + #parameters: const ldns_rdf *, + #retvals: size_t + + @staticmethod + def dname_new_frm_str(str): + """Creates a new dname rdf instance from a string. + + This static method is equivalent to using of default class constructor. + + :parameter str: str string to use + """ + return _ldns.ldns_dname_new_frm_str(str) + + def absolute(self): + """Checks whether the given dname string is absolute (i.e. ends with a '.') + + :returns: (bool) True or False + """ + return self.endswith(".") + + def make_canonical(self): + """Put a dname into canonical fmt - ie. lowercase it + """ + _ldns.ldns_dname2canonical(self) + + def dname_compare(self,other): + """Compares the two dname rdf's according to the algorithm for ordering in RFC4034 Section 6. + + :param other: + the second dname rdf to compare + :returns: (int) -1 if dname comes before other, 1 if dname comes after other, and 0 if they are equal. + """ + return _ldns.ldns_dname_compare(self,other) + + def cat(self,rd2): + """concatenates rd2 after this dname (rd2 is copied, this dname is modified) + + :param rd2: + the rightside + :returns: (ldns_status) LDNS_STATUS_OK on success + """ + return _ldns.ldns_dname_cat(self,rd2) + #parameters: ldns_rdf *,ldns_rdf *, + #retvals: ldns_status + + def cat_clone(self,rd2): + """concatenates two dnames together + + :param rd2: + the rightside + :returns: (ldns_rdf \*) a new rdf with leftside/rightside + """ + return _ldns.ldns_dname_cat_clone(self,rd2) + #parameters: const ldns_rdf *,const ldns_rdf *, + #retvals: ldns_rdf * + + def interval(self,middle,next): + """check if middle lays in the interval defined by prev and next prev <= middle < next. + + This is usefull for nsec checking + + :param middle: + the dname to check + :param next: + the next dname return 0 on error or unknown, -1 when middle is in the interval, +1 when not + :returns: (int) + """ + return _ldns.ldns_dname_interval(self,middle,next) + #parameters: const ldns_rdf *,const ldns_rdf *,const ldns_rdf *, + #retvals: int + + def is_subdomain(self,parent): + """Tests wether the name sub falls under parent (i.e. is a subdomain of parent). + + This function will return false if the given dnames are equal. + + :param parent: + (ldns_rdf) the parent's name + :returns: (bool) true if sub falls under parent, otherwise false + """ + return _ldns.ldns_dname_is_subdomain(self,parent) + #parameters: const ldns_rdf *,const ldns_rdf *, + #retvals: bool + + def label(self,labelpos): + """look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label. + + The labels are numbered starting from 0 (left most). + + :param labelpos: + return the label with this number + :returns: (ldns_rdf \*) a ldns_rdf* with the label as name or NULL on error + """ + return _ldns.ldns_dname_label(self,labelpos) + #parameters: const ldns_rdf *,uint8_t, + #retvals: ldns_rdf * + + def label_count(self): + """count the number of labels inside a LDNS_RDF_DNAME type rdf. + + :returns: (uint8_t) the number of labels + """ + return _ldns.ldns_dname_label_count(self) + #parameters: const ldns_rdf *, + #retvals: uint8_t + + def left_chop(self): + """chop one label off the left side of a dname. + + so wwww.nlnetlabs.nl, becomes nlnetlabs.nl + + :returns: (ldns_rdf \*) the remaining dname + """ + return _ldns.ldns_dname_left_chop(self) + #parameters: const ldns_rdf *, + #retvals: ldns_rdf * + + def reverse(self): + """Returns a clone of the given dname with the labels reversed. + + :returns: (ldns_rdf \*) clone of the dname with the labels reversed. + """ + return _ldns.ldns_dname_reverse(self) + #parameters: const ldns_rdf *, + #retvals: ldns_rdf * + + #_LDNS_RDF_METHODS# + %} +} diff --git a/libs/ldns/contrib/python/ldns_resolver.i b/libs/ldns/contrib/python/ldns_resolver.i new file mode 100644 index 0000000000..dd3ed55e12 --- /dev/null +++ b/libs/ldns/contrib/python/ldns_resolver.i @@ -0,0 +1,940 @@ +/****************************************************************************** + * ldns_resolver.i: LDNS resolver class + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ + +%typemap(in,numinputs=0,noblock=1) (ldns_resolver **r) +{ + ldns_resolver *$1_res; + $1 = &$1_res; +} + +/* result generation */ +%typemap(argout,noblock=1) (ldns_resolver **r) +{ + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_res), SWIGTYPE_p_ldns_struct_resolver, SWIG_POINTER_OWN | 0 )); +} + +//TODO: pop_nameserver a podobne funkce musi predat objekt do spravy PYTHONU!! +%newobject ldns_resolver_pop_nameserver; +%newobject ldns_resolver_query; +%newobject ldns_axfr_next; + +%delobject ldns_resolver_deep_free; +%delobject ldns_resolver_free; + +%nodefaultctor ldns_struct_resolver; //no default constructor & destructor +%nodefaultdtor ldns_struct_resolver; + +%ignore ldns_struct_resolver::_searchlist; +%ignore ldns_struct_resolver::_nameservers; +%ignore ldns_resolver_set_nameservers; + +%rename(ldns_resolver) ldns_struct_resolver; + +#ifdef LDNS_DEBUG +%rename(__ldns_resolver_deep_free) ldns_resolver_deep_free; +%rename(__ldns_resolver_free) ldns_resolver_free; +%inline %{ +void _ldns_resolver_free (ldns_resolver* r) { + printf("******** LDNS_RESOLVER deep free 0x%lX ************\n", (long unsigned int)r); + ldns_resolver_deep_free(r); +} +%} +#else +%rename(_ldns_resolver_deep_free) ldns_resolver_deep_free; +%rename(_ldns_resolver_free) ldns_resolver_free; +#endif + +%feature("docstring") ldns_struct_resolver "LDNS resolver object. + +The ldns_resolver object keeps a list of nameservers and can perform queries. + +**Usage** + +>>> import ldns +>>> resolver = ldns.ldns_resolver.new_frm_file(\"/etc/resolv.conf\") +>>> pkt = resolver.query(\"www.nic.cz\", ldns.LDNS_RR_TYPE_A,ldns.LDNS_RR_CLASS_IN) +>>> if (pkt) and (pkt.answer()): +>>> print pkt.answer() +www.nic.cz. 1757 IN A 217.31.205.50 + +This simple example instances a resolver in order to resolve www.nic.cz record of A type. +" + +%extend ldns_struct_resolver { + + %pythoncode %{ + def __init__(self): + raise Exception("This class can't be created directly. Please use: new_frm_file(filename), new_frm_fp(file) or new_frm_fp_l(file,line)") + + __swig_destroy__ = _ldns._ldns_resolver_free + + #LDNS_RESOLVER_CONSTRUCTORS_# + @staticmethod + def new_frm_file(filename = "/etc/resolv.conf", raiseException=True): + """Creates a resolver object from given filename + + :param filename: name of file which contains informations (usually /etc/resolv.conf) + :param raiseException: if True, an exception occurs in case a resolver object can't be created + :returns: resolver object or None. If the object can't be created and raiseException is True, an exception occurs. + """ + status, resolver = _ldns.ldns_resolver_new_frm_file(filename) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create resolver, error: %d" % status) + return None + return resolver + + @staticmethod + def new_frm_fp(file, raiseException=True): + """Creates a resolver object from file + + :param file: a file object + :param raiseException: if True, an exception occurs in case a resolver object can't be created + :returns: resolver object or None. If the object can't be created and raiseException is True, an exception occurs. + """ + status, resolver = _ldns.ldns_resolver_new_frm_fp(file) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create resolver, error: %d" % status) + return None + return resolver + + @staticmethod + def new_frm_fp_l(file, raiseException=True): + """Creates a resolver object from file + + :param file: a file object + :param raiseException: if True, an exception occurs in case a resolver instance can't be created + :returns: + * resolver - resolver instance or None. If an instance can't be created and raiseException is True, an exception occurs. + + * line - the line number (for debugging) + """ + status, resolver, line = _ldns.ldns_resolver_new_frm_fp_l(file) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create resolver, error: %d" % status) + return None + return resolver, line + + #_LDNS_RESOLVER_CONSTRUCTORS# + + # High level functions + def get_addr_by_name(self, name, aclass = _ldns.LDNS_RR_CLASS_IN, flags = _ldns.LDNS_RD): + """Ask the resolver about name and return all address records + + :param name: (ldns_rdf) the name to look for + :param aclass: the class to use + :param flags: give some optional flags to the query + + :returns: RR List object or None + + **Usage** + >>> addr = resolver.get_addr_by_name("www.google.com", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) + >>> if (not addr): raise Exception("Can't retrieve server address") + >>> for rr in addr.rrs(): + >>> print rr + www.l.google.com. 300 IN A 74.125.43.99 + www.l.google.com. 300 IN A 74.125.43.103 + www.l.google.com. 300 IN A 74.125.43.104 + www.l.google.com. 300 IN A 74.125.43.147 + + """ + return _ldns.ldns_get_rr_list_addr_by_name(self, name, aclass, flags) + + def get_name_by_addr(self, addr, aclass = _ldns.LDNS_RR_CLASS_IN, flags = _ldns.LDNS_RD): + """Ask the resolver about the address and return the name + + :param name: (ldns_rdf of A or AAAA type) the addr to look for. If a string is given, A or AAAA type is identified automatically + :param aclass: the class to use + :param flags: give some optional flags to the query + + :returns: RR List object or None + + **Usage** + >>> addr = resolver.get_name_by_addr("74.125.43.99", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) + >>> if (not addr): raise Exception("Can't retrieve server address") + >>> for rr in addr.rrs(): + >>> print rr + 99.43.125.74.in-addr.arpa. 85641 IN PTR bw-in-f99.google.com. + + """ + rdf = addr + if isinstance(addr, str): + if (addr.find("::") >= 0): #IPv6 + rdf = _ldns.ldns_rdf_new_frm_str(_ldns.LDNS_RDF_TYPE_AAAA, addr) + else: + rdf = _ldns.ldns_rdf_new_frm_str(_ldns.LDNS_RDF_TYPE_A, addr) + return _ldns.ldns_get_rr_list_name_by_addr(self, rdf, aclass, flags) + + def print_to_file(self,output): + """Print a resolver (in sofar that is possible) state to output.""" + _ldns.ldns_resolver_print(output,self) + + def axfr_start(self, domain, aclass): + """Prepares the resolver for an axfr query. The query is sent and the answers can be read with axfr_next + + **Usage** + :: + + status = resolver.axfr_start("nic.cz", ldns.LDNS_RR_CLASS_IN) + if (status != ldns.LDNS_STATUS_OK): raise Exception("Can't start AXFR, error: %s" % ldns.ldns_get_errorstr_by_id(status)) + #Print the results + while True: + rr = resolver.axfr_next() + if not rr: + break + + print rr + + """ + return _ldns.ldns_axfr_start(self, domain, aclass) + #parameters: ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c + #retvals: int + + def axfr_complete(self): + """returns true if the axfr transfer has completed (i.e. 2 SOA RRs and no errors were encountered)""" + return _ldns.ldns_axfr_complete(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def axfr_last_pkt(self): + """returns a pointer to the last ldns_pkt that was sent by the server in the AXFR transfer uasable for instance to get the error code on failure""" + return _ldns.ldns_axfr_last_pkt(self) + #parameters: const ldns_resolver *, + #retvals: ldns_pkt * + + def axfr_next(self): + """get the next stream of RRs in a AXFR""" + return _ldns.ldns_axfr_next(self) + #parameters: ldns_resolver *, + #retvals: ldns_rr * + + #LDNS_RESOLVER_METHODS_# + def debug(self): + """Get the debug status of the resolver. + + :returns: (bool) true if so, otherwise false + """ + return _ldns.ldns_resolver_debug(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def dec_nameserver_count(self): + """Decrement the resolver's nameserver count. + """ + _ldns.ldns_resolver_dec_nameserver_count(self) + #parameters: ldns_resolver *, + #retvals: + + def defnames(self): + return _ldns.ldns_resolver_defnames(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def dnsrch(self): + return _ldns.ldns_resolver_dnsrch(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def dnssec(self): + """Does the resolver do DNSSEC. + + :returns: (bool) true: yes, false: no + """ + return _ldns.ldns_resolver_dnssec(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def dnssec_anchors(self): + """Get the resolver's DNSSEC anchors. + + :returns: (ldns_rr_list \*) an rr_list containg trusted DNSSEC anchors + """ + return _ldns.ldns_resolver_dnssec_anchors(self) + #parameters: const ldns_resolver *, + #retvals: ldns_rr_list * + + def dnssec_cd(self): + """Does the resolver set the CD bit. + + :returns: (bool) true: yes, false: no + """ + return _ldns.ldns_resolver_dnssec_cd(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def domain(self): + """What is the default dname to add to relative queries. + + :returns: (ldns_rdf \*) the dname which is added + """ + return _ldns.ldns_resolver_domain(self) + #parameters: const ldns_resolver *, + #retvals: ldns_rdf * + + def edns_udp_size(self): + """Get the resolver's udp size. + + :returns: (uint16_t) the udp mesg size + """ + return _ldns.ldns_resolver_edns_udp_size(self) + #parameters: const ldns_resolver *, + #retvals: uint16_t + + def fail(self): + """Does the resolver only try the first nameserver. + + :returns: (bool) true: yes, fail, false: no, try the others + """ + return _ldns.ldns_resolver_fail(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def fallback(self): + """Get the truncation fallback status. + + :returns: (bool) whether the truncation fallback mechanism is used + """ + return _ldns.ldns_resolver_fallback(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def igntc(self): + """Does the resolver ignore the TC bit (truncated). + + :returns: (bool) true: yes, false: no + """ + return _ldns.ldns_resolver_igntc(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def incr_nameserver_count(self): + """Incremental the resolver's nameserver count. + """ + _ldns.ldns_resolver_incr_nameserver_count(self) + #parameters: ldns_resolver *, + #retvals: + + def ip6(self): + """Does the resolver use ip6 or ip4. + + :returns: (uint8_t) 0: both, 1: ip4, 2:ip6 + """ + return _ldns.ldns_resolver_ip6(self) + #parameters: const ldns_resolver *, + #retvals: uint8_t + + def nameserver_count(self): + """How many nameserver are configured in the resolver. + + :returns: (size_t) number of nameservers + """ + return _ldns.ldns_resolver_nameserver_count(self) + #parameters: const ldns_resolver *, + #retvals: size_t + + def nameserver_rtt(self,pos): + """Return the used round trip time for a specific nameserver. + + :param pos: + the index to the nameserver + :returns: (size_t) the rrt, 0: infinite, >0: undefined (as of * yet) + """ + return _ldns.ldns_resolver_nameserver_rtt(self,pos) + #parameters: const ldns_resolver *,size_t, + #retvals: size_t + + def nameservers(self): + """Return the configured nameserver ip address. + + :returns: (ldns_rdf \*\*) a ldns_rdf pointer to a list of the addresses + """ + return _ldns.ldns_resolver_nameservers(self) + #parameters: const ldns_resolver *, + #retvals: ldns_rdf ** + + def nameservers_randomize(self): + """randomize the nameserver list in the resolver + """ + _ldns.ldns_resolver_nameservers_randomize(self) + #parameters: ldns_resolver *, + #retvals: + + def pop_nameserver(self): + """pop the last nameserver from the resolver. + + :returns: (ldns_rdf \*) the popped address or NULL if empty + """ + return _ldns.ldns_resolver_pop_nameserver(self) + #parameters: ldns_resolver *, + #retvals: ldns_rdf * + + def port(self): + """Get the port the resolver should use. + + :returns: (uint16_t) the port number + """ + return _ldns.ldns_resolver_port(self) + #parameters: const ldns_resolver *, + #retvals: uint16_t + + def prepare_query_pkt(self,name,t,c,f): + """Form a query packet from a resolver and name/type/class combo. + + :param name: + :param t: + query for this type (may be 0, defaults to A) + :param c: + query for this class (may be 0, default to IN) + :param f: + the query flags + :returns: * (ldns_status) ldns_pkt* a packet with the reply from the nameserver + * (ldns_pkt \*\*) query packet class + """ + return _ldns.ldns_resolver_prepare_query_pkt(self,name,t,c,f) + #parameters: ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, + #retvals: ldns_status,ldns_pkt ** + + def push_dnssec_anchor(self,rr): + """Push a new trust anchor to the resolver. + + It must be a DS or DNSKEY rr + + :param rr: + the RR to add as a trust anchor. + :returns: (ldns_status) a status + """ + return _ldns.ldns_resolver_push_dnssec_anchor(self,rr) + #parameters: ldns_resolver *,ldns_rr *, + #retvals: ldns_status + + def push_nameserver(self,n): + """push a new nameserver to the resolver. + + It must be an IP address v4 or v6. + + :param n: + the ip address + :returns: (ldns_status) ldns_status a status + """ + return _ldns.ldns_resolver_push_nameserver(self,n) + #parameters: ldns_resolver *,ldns_rdf *, + #retvals: ldns_status + + def push_nameserver_rr(self,rr): + """push a new nameserver to the resolver. + + It must be an A or AAAA RR record type + + :param rr: + the resource record + :returns: (ldns_status) ldns_status a status + """ + return _ldns.ldns_resolver_push_nameserver_rr(self,rr) + #parameters: ldns_resolver *,ldns_rr *, + #retvals: ldns_status + + def push_nameserver_rr_list(self,rrlist): + """push a new nameserver rr_list to the resolver. + + :param rrlist: + the rr_list to push + :returns: (ldns_status) ldns_status a status + """ + return _ldns.ldns_resolver_push_nameserver_rr_list(self,rrlist) + #parameters: ldns_resolver *,ldns_rr_list *, + #retvals: ldns_status + + def push_searchlist(self,rd): + """Push a new rd to the resolver's searchlist. + + :param rd: + to push + """ + _ldns.ldns_resolver_push_searchlist(self,rd) + #parameters: ldns_resolver *,ldns_rdf *, + #retvals: + + def query(self,name,atype=_ldns.LDNS_RR_TYPE_A,aclass=_ldns.LDNS_RR_CLASS_IN,flags=_ldns.LDNS_RD): + """Send a query to a nameserver. + + :param name: (ldns_rdf) the name to look for + :param atype: the RR type to use + :param aclass: the RR class to use + :param flags: give some optional flags to the query + :returns: (ldns_pkt) a packet with the reply from the nameserver if _defnames is true the default domain will be added + """ + return _ldns.ldns_resolver_query(self,name,atype,aclass,flags) + #parameters: const ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, + #retvals: ldns_pkt * + + def random(self): + """Does the resolver randomize the nameserver before usage. + + :returns: (bool) true: yes, false: no + """ + return _ldns.ldns_resolver_random(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def recursive(self): + """Is the resolver set to recurse. + + :returns: (bool) true if so, otherwise false + """ + return _ldns.ldns_resolver_recursive(self) + #parameters: const ldns_resolver *, + #retvals: bool + + def retrans(self): + """Get the retransmit interval. + + :returns: (uint8_t) the retransmit interval + """ + return _ldns.ldns_resolver_retrans(self) + #parameters: const ldns_resolver *, + #retvals: uint8_t + + def retry(self): + """Get the number of retries. + + :returns: (uint8_t) the number of retries + """ + return _ldns.ldns_resolver_retry(self) + #parameters: const ldns_resolver *, + #retvals: uint8_t + + def rtt(self): + """Return the used round trip times for the nameservers. + + :returns: (size_t \*) a size_t* pointer to the list. yet) + """ + return _ldns.ldns_resolver_rtt(self) + #parameters: const ldns_resolver *, + #retvals: size_t * + + def search(self,rdf,t,c,flags): + """Send the query for using the resolver and take the search list into account The search algorithm is as follows: If the name is absolute, try it as-is, otherwise apply the search list. + + :param rdf: + :param t: + query for this type (may be 0, defaults to A) + :param c: + query for this class (may be 0, default to IN) + :param flags: + the query flags + :returns: (ldns_pkt \*) ldns_pkt* a packet with the reply from the nameserver + """ + return _ldns.ldns_resolver_search(self,rdf,t,c,flags) + #parameters: const ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, + #retvals: ldns_pkt * + + def searchlist(self): + """What is the searchlist as used by the resolver. + + :returns: (ldns_rdf \*\*) a ldns_rdf pointer to a list of the addresses + """ + return _ldns.ldns_resolver_searchlist(self) + #parameters: const ldns_resolver *, + #retvals: ldns_rdf \*\* + + def searchlist_count(self): + """Return the resolver's searchlist count. + + :returns: (size_t) the searchlist count + """ + return _ldns.ldns_resolver_searchlist_count(self) + #parameters: const ldns_resolver *, + #retvals: size_t + + def send(self,name,t,c,flags): + """Send the query for name as-is. + + :param name: + :param t: + query for this type (may be 0, defaults to A) + :param c: + query for this class (may be 0, default to IN) + :param flags: + the query flags + :returns: * (ldns_status) ldns_pkt* a packet with the reply from the nameserver + * (ldns_pkt \*\*) + """ + return _ldns.ldns_resolver_send(self,name,t,c,flags) + #parameters: ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, + #retvals: ldns_status,ldns_pkt ** + + def send_pkt(self,query_pkt): + """Send the given packet to a nameserver. + + :param query_pkt: + :returns: * (ldns_status) + * (ldns_pkt \*\*) + """ + return _ldns.ldns_resolver_send_pkt(self,query_pkt) + #parameters: ldns_resolver *,ldns_pkt *, + #retvals: ldns_status,ldns_pkt ** + + def set_debug(self,b): + """Set the resolver debugging. + + :param b: + true: debug on: false debug off + """ + _ldns.ldns_resolver_set_debug(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_defnames(self,b): + """Whether the resolver uses the name set with _set_domain. + + :param b: + true: use the defaults, false: don't use them + """ + _ldns.ldns_resolver_set_defnames(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_dnsrch(self,b): + """Whether the resolver uses the searchlist. + + :param b: + true: use the list, false: don't use the list + """ + _ldns.ldns_resolver_set_dnsrch(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_dnssec(self,b): + """Whether the resolver uses DNSSEC. + + :param b: + true: use DNSSEC, false: don't use DNSSEC + """ + _ldns.ldns_resolver_set_dnssec(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_dnssec_anchors(self,l): + """Set the resolver's DNSSEC anchor list directly. + + RRs should be of type DS or DNSKEY. + + :param l: + the list of RRs to use as trust anchors + """ + _ldns.ldns_resolver_set_dnssec_anchors(self,l) + #parameters: ldns_resolver *,ldns_rr_list *, + #retvals: + + def set_dnssec_cd(self,b): + """Whether the resolver uses the checking disable bit. + + :param b: + true: enable , false: don't use TCP + """ + _ldns.ldns_resolver_set_dnssec_cd(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_domain(self,rd): + """Set the resolver's default domain. + + This gets appended when no absolute name is given + + :param rd: + the name to append + """ + _ldns.ldns_resolver_set_domain(self,rd) + #parameters: ldns_resolver *,ldns_rdf *, + #retvals: + + def set_edns_udp_size(self,s): + """Set maximum udp size. + + :param s: + the udp max size + """ + _ldns.ldns_resolver_set_edns_udp_size(self,s) + #parameters: ldns_resolver *,uint16_t, + #retvals: + + def set_fail(self,b): + """Whether or not to fail after one failed query. + + :param b: + true: yes fail, false: continue with next nameserver + """ + _ldns.ldns_resolver_set_fail(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_fallback(self,fallback): + """Set whether the resolvers truncation fallback mechanism is used when ldns_resolver_query() is called. + + :param fallback: + whether to use the fallback mechanism + """ + _ldns.ldns_resolver_set_fallback(self,fallback) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_igntc(self,b): + """Whether or not to ignore the TC bit. + + :param b: + true: yes ignore, false: don't ignore + """ + _ldns.ldns_resolver_set_igntc(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_ip6(self,i): + """Whether the resolver uses ip6. + + :param i: + 0: no pref, 1: ip4, 2: ip6 + """ + _ldns.ldns_resolver_set_ip6(self,i) + #parameters: ldns_resolver *,uint8_t, + #retvals: + + def set_nameserver_count(self,c): + """Set the resolver's nameserver count directly. + + :param c: + the nameserver count + """ + _ldns.ldns_resolver_set_nameserver_count(self,c) + #parameters: ldns_resolver *,size_t, + #retvals: + + def set_nameserver_rtt(self,pos,value): + """Set round trip time for a specific nameserver. + + Note this currently differentiates between: unreachable and reachable. + + :param pos: + the nameserver position + :param value: + the rtt + """ + _ldns.ldns_resolver_set_nameserver_rtt(self,pos,value) + #parameters: ldns_resolver *,size_t,size_t, + #retvals: + + def set_nameservers(self,rd): + """Set the resolver's nameserver count directly by using an rdf list. + + :param rd: + the resolver addresses + """ + _ldns.ldns_resolver_set_nameservers(self,rd) + #parameters: ldns_resolver *,ldns_rdf **, + #retvals: + + def set_port(self,p): + """Set the port the resolver should use. + + :param p: + the port number + """ + _ldns.ldns_resolver_set_port(self,p) + #parameters: ldns_resolver *,uint16_t, + #retvals: + + def set_random(self,b): + """Should the nameserver list be randomized before each use. + + :param b: + true: randomize, false: don't + """ + _ldns.ldns_resolver_set_random(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_recursive(self,b): + """Set the resolver recursion. + + :param b: + true: set to recurse, false: unset + """ + _ldns.ldns_resolver_set_recursive(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def set_retrans(self,re): + """Set the resolver retrans timeout (in seconds). + + :param re: + the retransmission interval in seconds + """ + _ldns.ldns_resolver_set_retrans(self,re) + #parameters: ldns_resolver *,uint8_t, + #retvals: + + def set_retry(self,re): + """Set the resolver retry interval (in seconds). + + :param re: + the retry interval + """ + _ldns.ldns_resolver_set_retry(self,re) + #parameters: ldns_resolver *,uint8_t, + #retvals: + + def set_rtt(self,rtt): + """Set round trip time for all nameservers. + + Note this currently differentiates between: unreachable and reachable. + + :param rtt: + a list with the times + """ + _ldns.ldns_resolver_set_rtt(self,rtt) + #parameters: ldns_resolver *,size_t *, + #retvals: + + def set_searchlist_count(self,c): + _ldns.ldns_resolver_set_searchlist_count(self,c) + #parameters: ldns_resolver *,size_t, + #retvals: + + def set_timeout(self,timeout): + """Set the resolver's socket time out when talking to remote hosts. + + :param timeout: + the timeout to use + """ + _ldns.ldns_resolver_set_timeout(self,timeout) + #parameters: ldns_resolver *,struct timeval, + #retvals: + + def set_tsig_algorithm(self,tsig_algorithm): + """Set the tsig algorithm. + + :param tsig_algorithm: + the tsig algorithm + """ + _ldns.ldns_resolver_set_tsig_algorithm(self,tsig_algorithm) + #parameters: ldns_resolver *,char *, + #retvals: + + def set_tsig_keydata(self,tsig_keydata): + """Set the tsig key data. + + :param tsig_keydata: + the key data + """ + _ldns.ldns_resolver_set_tsig_keydata(self,tsig_keydata) + #parameters: ldns_resolver *,char *, + #retvals: + + def set_tsig_keyname(self,tsig_keyname): + """Set the tsig key name. + + :param tsig_keyname: + the tsig key name + """ + _ldns.ldns_resolver_set_tsig_keyname(self,tsig_keyname) + #parameters: ldns_resolver *,char *, + #retvals: + + def set_usevc(self,b): + """Whether the resolver uses a virtual circuit (TCP). + + :param b: + true: use TCP, false: don't use TCP + """ + _ldns.ldns_resolver_set_usevc(self,b) + #parameters: ldns_resolver *,bool, + #retvals: + + def timeout(self): + """What is the timeout on socket connections. + + :returns: (struct timeval) the timeout as struct timeval + """ + return _ldns.ldns_resolver_timeout(self) + #parameters: const ldns_resolver *, + #retvals: struct timeval + + def trusted_key(self,keys,trusted_keys): + """Returns true if at least one of the provided keys is a trust anchor. + + :param keys: + the keyset to check + :param trusted_keys: + the subset of trusted keys in the 'keys' rrset + :returns: (bool) true if at least one of the provided keys is a configured trust anchor + """ + return _ldns.ldns_resolver_trusted_key(self,keys,trusted_keys) + #parameters: const ldns_resolver *,ldns_rr_list *,ldns_rr_list *, + #retvals: bool + + def tsig_algorithm(self): + """Return the tsig algorithm as used by the nameserver. + + :returns: (char \*) the algorithm used. + """ + return _ldns.ldns_resolver_tsig_algorithm(self) + #parameters: const ldns_resolver *, + #retvals: char * + + def tsig_keydata(self): + """Return the tsig keydata as used by the nameserver. + + :returns: (char \*) the keydata used. + """ + return _ldns.ldns_resolver_tsig_keydata(self) + #parameters: const ldns_resolver *, + #retvals: char * + + def tsig_keyname(self): + """Return the tsig keyname as used by the nameserver. + + :returns: (char \*) the name used. + """ + return _ldns.ldns_resolver_tsig_keyname(self) + #parameters: const ldns_resolver *, + #retvals: char * + + def usevc(self): + """Does the resolver use tcp or udp. + + :returns: (bool) true: tcp, false: udp + """ + return _ldns.ldns_resolver_usevc(self) + #parameters: const ldns_resolver *, + #retvals: bool + + #_LDNS_RESOLVER_METHODS# + %} +} diff --git a/libs/ldns/contrib/python/ldns_rr.i b/libs/ldns/contrib/python/ldns_rr.i new file mode 100644 index 0000000000..64e8297883 --- /dev/null +++ b/libs/ldns/contrib/python/ldns_rr.i @@ -0,0 +1,1169 @@ +/****************************************************************************** + * ldns_rr.i: LDNS resource records (RR), RR list + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ + +%typemap(in,numinputs=0,noblock=1) (ldns_rr **) +{ + ldns_rr *$1_rr; + $1 = &$1_rr; +} + +/* result generation */ +%typemap(argout,noblock=1) (ldns_rr **) +{ + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 )); +} + +%nodefaultctor ldns_struct_rr; //no default constructor & destructor +%nodefaultdtor ldns_struct_rr; + +%ignore ldns_struct_rr::_rdata_fields; + +%newobject ldns_rr_clone; +%newobject ldns_rr_pop_rdf; +%delobject ldns_rr_free; + +%rename(ldns_rr) ldns_struct_rr; + +#ifdef LDNS_DEBUG +%rename(__ldns_rr_free) ldns_rr_free; +%inline %{ +void _ldns_rr_free (ldns_rr* r) { + printf("******** LDNS_RR free 0x%lX ************\n", (long unsigned int)r); + ldns_rr_free(r); +} +%} +#else +%rename(_ldns_rr_free) ldns_rr_free; +#endif + +%newobject ldns_rr2str; +%newobject ldns_rr_type2str; +%newobject ldns_rr_class2str; +%newobject ldns_read_anchor_file; + +%rename(_ldns_rr_new_frm_str) ldns_rr_new_frm_str; +%rename(_ldns_rr_new_frm_fp_l) ldns_rr_new_frm_fp_l; +%rename(_ldns_rr_new_frm_fp) ldns_rr_new_frm_fp; + +%feature("docstring") ldns_struct_rr "Resource Record (RR) + +The RR is the basic DNS element that contains actual data. This class allows to create RR and manipulate with the content." + +%extend ldns_struct_rr { + + %pythoncode %{ + def __init__(self): + raise Exception("This class can't be created directly. Please use: ldns_rr_new, ldns_rr_new_frm_type, new_frm_fp(), new_frm_fp_l(), new_frm_str() or new_question_frm_str") + + __swig_destroy__ = _ldns._ldns_rr_free + + #LDNS_RR_CONSTRUCTORS_# + @staticmethod + def new_frm_str(str, default_ttl=0, origin=None, prev=None, raiseException=True): + """Creates an rr object from a string. + + The string should be a fully filled-in rr, like ownername [space] TTL [space] CLASS [space] TYPE [space] RDATA. + + :param str: the string to convert + :param default_ttl: default ttl value for the rr. If 0 DEF_TTL will be used + :param origin: when the owner is relative add this + :param prev: the previous ownername + :param raiseException: if True, an exception occurs in case a rr instance can't be created + :returns: + * rr - (ldnsrr) RR instance or None. If the object can't be created and raiseException is True, an exception occurs. + + **Usage** + + >>> import ldns + >>> rr = ldns.ldns_rr.new_frm_str("www.nic.cz. IN A 192.168.1.1",300) + >>> print rr + www.nic.cz. 300 IN A 192.168.1.1 + """ + status, rr, prev = _ldns.ldns_rr_new_frm_str_(str, default_ttl, origin, prev) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create RR, error: %d" % status) + return None + return rr + + @staticmethod + def new_question_frm_str(str, default_ttl=0, origin=None, prev=None, raiseException=True): + """Creates an rr object from a string. + + The string is like new_frm_str but without rdata. + + :param str: the string to convert + :param origin: when the owner is relative add this + :param prev: the previous ownername + :param raiseException: if True, an exception occurs in case a rr instance can't be created + :returns: + * rr - (ldnsrr) RR instance or None. If the object can't be created and raiseException is True, an exception occurs. + """ + status, rr, prev = _ldns.ldns_rr_new_question_frm_str_(str, origin, prev) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create RR, error: %d" % status) + return None + return rr + + @staticmethod + def new_frm_str_prev(str, default_ttl=0, origin=None, prev=None, raiseException=True): + """Creates an rr object from a string. + + The string should be a fully filled-in rr, like ownername [space] TTL [space] CLASS [space] TYPE [space] RDATA. + + :param str: the string to convert + :param default_ttl: default ttl value for the rr. If 0 DEF_TTL will be used + :param origin: when the owner is relative add this + :param prev: the previous ownername + :param raiseException: if True, an exception occurs in case a rr instance can't be created + :returns: + * rr - (ldnsrr) RR instance or None. If the object can't be created and raiseException is True, an exception occurs. + + * prev - (ldns_rdf) ownername found in this string or None + """ + status, rr, prev = _ldns.ldns_rr_new_frm_str_(str, default_ttl, origin, prev) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create RR, error: %d" % status) + return None + return rr, prev + + @staticmethod + def new_frm_fp(file, default_ttl=0, origin=None, prev=None, raiseException=True): + """Creates a new rr from a file containing a string. + + :param file: file pointer + :param default_ttl: If 0 DEF_TTL will be used + :param origin: when the owner is relative add this. + :param prev: when the owner is whitespaces use this. + :param raiseException: if True, an exception occurs in case a resolver object can't be created + :returns: + * rr - (ldns_rr) RR object or None. If the object can't be created and raiseException is True, an exception occurs. + + * ttl - (int) None or TTL if the file contains a $TTL directive + + * origin - (ldns_rdf) None or dname if the file contains a $ORIGIN directive + + * prev - (ldns_rdf) None or updated value of prev parameter + """ + res = _ldns.ldns_rr_new_frm_fp_l_(file, default_ttl, origin, prev, 0) + if res[0] != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create RR, error: %d" % res[0]) + return None + return res[1:] + + @staticmethod + def new_frm_fp_l(file, default_ttl=0, origin=None, prev=None, raiseException=True): + """Creates a new rr from a file containing a string. + + :param file: file pointer + :param default_ttl: If 0 DEF_TTL will be used + :param origin: when the owner is relative add this. + :param prev: when the owner is whitespaces use this. + :param raiseException: if True, an exception occurs in case a resolver object can't be created + :returns: + * rr - (ldns_rr) RR object or None. If the object can't be created and raiseException is True, an exception occurs. + + * line - (int) line number (for debugging) + + * ttl - (int) None or TTL if the file contains a $TTL directive + + * origin - (ldns_rdf) None or dname if the file contains a $ORIGIN directive + + * prev - (ldns_rdf) None or updated value of prev parameter + """ + res = _ldns.ldns_rr_new_frm_fp_l_(file, default_ttl, origin, prev, 1) + if res[0] != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create RR, error: %d" % res[0]) + return None + return res[1:] + #_LDNS_RR_CONSTRUCTORS# + + + def __str__(self): + """converts the data in the resource record to presentation format""" + return _ldns.ldns_rr2str(self) + + def __cmp__(self, other): + """compares two rrs. + + The TTL is not looked at. + + :param other: + the second RR one + :returns: (int) 0 if equal -1 if self comes before other RR +1 if other RR comes before self + """ + return _ldns.ldns_rr_compare(self,other) + + def rdfs(self): + """returns the list of rdata records.""" + for i in range(0,self.rd_count()): + yield self.rdf(i) + + def get_function(self,rtype,pos): + """return a specific rdf""" + return _ldns.ldns_rr_function(rtype,self,pos) + #parameters: ldns_rr_type,const ldns_rr *,size_t, + #retvals: ldns_rdf * + + def set_function(self,rtype,rdf,pos): + """set a specific rdf""" + return _ldns.ldns_rr_set_function(rtype,self,rdf,pos) + #parameters: ldns_rr_type,ldns_rr *,ldns_rdf *,size_t, + #retvals: bool + + def print_to_file(self,output): + """Prints the data in the resource record to the given file stream (in presentation format).""" + _ldns.ldns_rr_print(output,self) + #parameters: FILE *,const ldns_rr *, + + def get_type_str(self): + """Converts an RR type value to its string representation, and returns that string.""" + return _ldns.ldns_rr_type2str(self.get_type()) + #parameters: const ldns_rr_type, + + def get_class_str(self): + """Converts an RR class value to its string representation, and returns that string.""" + return _ldns.ldns_rr_class2str(self.get_class()) + #parameters: const ldns_rr_class, + + @staticmethod + def dnskey_key_size_raw(keydata,len,alg): + """get the length of the keydata in bits""" + return _ldns.ldns_rr_dnskey_key_size_raw(keydata,len,alg) + #parameters: const unsigned char *,const size_t,const ldns_algorithm, + #retvals: size_t + + def write_to_buffer(self,buffer,section): + """Copies the rr data to the buffer in wire format. + + :param buffer: buffer to append the result to buffer + :param section: the section in the packet this rr is supposed to be in (to determine whether to add rdata or not) + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_rr2buffer_wire(buffer,self,section) + #parameters: ldns_buffer *,const ldns_rr *,int, + #retvals: ldns_status + + def write_to_buffer_canonical(self,buffer,section): + """Copies the rr data to the buffer in wire format, in canonical format according to RFC3597 (every dname in rdata fields of RR's mentioned in that RFC will be lowercased). + + :param buffer: buffer to append the result to buffer + :param section: the section in the packet this rr is supposed to be in (to determine whether to add rdata or not) + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_rr2buffer_wire_canonical(buffer,self,section) + #parameters: ldns_buffer *,const ldns_rr *,int, + #retvals: ldns_status + + def write_data_to_buffer(self,buffer): + """Converts an rr's rdata to wireformat, while excluding the ownername and all the stuff before the rdata. + + This is needed in DNSSEC keytag calculation, the ds calcalution from the key and maybe elsewhere. + + :param buffer: buffer to append the result to + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_rr_rdata2buffer_wire(buffer,self) + #parameters: ldns_buffer *,const ldns_rr *, + #retvals: ldns_status + + def write_rrsig_to_buffer(self,buffer): + """Converts a rrsig to wireformat BUT EXCLUDE the rrsig rdata + + This is needed in DNSSEC verification. + + :param buffer: buffer to append the result to + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_rrsig2buffer_wire(buffer,self) + #parameters: ldns_buffer *,const ldns_rr *, + #retvals: ldns_status + + #LDNS_RR_METHODS_# + def a_address(self): + """returns the address of a LDNS_RR_TYPE_A rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the address or NULL on failure + """ + return _ldns.ldns_rr_a_address(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def a_set_address(self,f): + """sets the address of a LDNS_RR_TYPE_A rr + + :param f: + the address to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_a_set_address(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def clone(self): + """clones a rr and all its data + + :returns: (ldns_rr \*) the new rr or NULL on failure + """ + return _ldns.ldns_rr_clone(self) + #parameters: const ldns_rr *, + #retvals: ldns_rr * + + def compare_ds(self,rr2): + """returns true of the given rr's are equal. + + Also returns true if one record is a DS that represents the same DNSKEY record as the other record + + :param rr2: + the second rr + :returns: (bool) true if equal otherwise false + """ + return _ldns.ldns_rr_compare_ds(self,rr2) + #parameters: const ldns_rr *,const ldns_rr *, + #retvals: bool + + def compare_no_rdata(self,rr2): + """compares two rrs, up to the rdata. + + :param rr2: + the second one + :returns: (int) 0 if equal -1 if rr1 comes before rr2 +1 if rr2 comes before rr1 + """ + return _ldns.ldns_rr_compare_no_rdata(self,rr2) + #parameters: const ldns_rr *,const ldns_rr *, + #retvals: int + + def dnskey_algorithm(self): + """returns the algorithm of a LDNS_RR_TYPE_DNSKEY rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the algorithm or NULL on failure + """ + return _ldns.ldns_rr_dnskey_algorithm(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def dnskey_flags(self): + """returns the flags of a LDNS_RR_TYPE_DNSKEY rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the flags or NULL on failure + """ + return _ldns.ldns_rr_dnskey_flags(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def dnskey_key(self): + """returns the key data of a LDNS_RR_TYPE_DNSKEY rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the key data or NULL on failure + """ + return _ldns.ldns_rr_dnskey_key(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def dnskey_key_size(self): + """get the length of the keydata in bits + + :returns: (size_t) the keysize in bits + """ + return _ldns.ldns_rr_dnskey_key_size(self) + #parameters: const ldns_rr *, + #retvals: size_t + + def dnskey_protocol(self): + """returns the protocol of a LDNS_RR_TYPE_DNSKEY rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the protocol or NULL on failure + """ + return _ldns.ldns_rr_dnskey_protocol(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def dnskey_set_algorithm(self,f): + """sets the algorithm of a LDNS_RR_TYPE_DNSKEY rr + + :param f: + the algorithm to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_dnskey_set_algorithm(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def dnskey_set_flags(self,f): + """sets the flags of a LDNS_RR_TYPE_DNSKEY rr + + :param f: + the flags to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_dnskey_set_flags(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def dnskey_set_key(self,f): + """sets the key data of a LDNS_RR_TYPE_DNSKEY rr + + :param f: + the key data to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_dnskey_set_key(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def dnskey_set_protocol(self,f): + """sets the protocol of a LDNS_RR_TYPE_DNSKEY rr + + :param f: + the protocol to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_dnskey_set_protocol(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def get_class(self): + """returns the class of the rr. + + :returns: (ldns_rr_class) the class of the rr + """ + return _ldns.ldns_rr_get_class(self) + #parameters: const ldns_rr *, + #retvals: ldns_rr_class + + def get_type(self): + """returns the type of the rr. + + :returns: (ldns_rr_type) the type of the rr + """ + return _ldns.ldns_rr_get_type(self) + #parameters: const ldns_rr *, + #retvals: ldns_rr_type + + def label_count(self): + """counts the number of labels of the ownername. + + :returns: (uint8_t) the number of labels + """ + return _ldns.ldns_rr_label_count(self) + #parameters: ldns_rr *, + #retvals: uint8_t + + def mx_exchange(self): + """returns the mx host of a LDNS_RR_TYPE_MX rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the name of the MX host or NULL on failure + """ + return _ldns.ldns_rr_mx_exchange(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def mx_preference(self): + """returns the mx pref. + + of a LDNS_RR_TYPE_MX rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the preference or NULL on failure + """ + return _ldns.ldns_rr_mx_preference(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def ns_nsdname(self): + """returns the name of a LDNS_RR_TYPE_NS rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the name or NULL on failure + """ + return _ldns.ldns_rr_ns_nsdname(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def owner(self): + """returns the owner name of an rr structure. + + :returns: (ldns_rdf \*) ldns_rdf * + """ + return _ldns.ldns_rr_owner(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def pop_rdf(self): + """removes a rd_field member, it will be popped from the last position. + + :returns: (ldns_rdf \*) rdf which was popped (null if nothing) + """ + return _ldns.ldns_rr_pop_rdf(self) + #parameters: ldns_rr *, + #retvals: ldns_rdf * + + def push_rdf(self,f): + """sets rd_field member, it will be placed in the next available spot. + + :param f: + :returns: (bool) bool + """ + return _ldns.ldns_rr_push_rdf(self,f) + #parameters: ldns_rr *,const ldns_rdf *, + #retvals: bool + + def rd_count(self): + """returns the rd_count of an rr structure. + + :returns: (size_t) the rd count of the rr + """ + return _ldns.ldns_rr_rd_count(self) + #parameters: const ldns_rr *, + #retvals: size_t + + def rdf(self,nr): + """returns the rdata field member counter. + + :param nr: + the number of the rdf to return + :returns: (ldns_rdf \*) ldns_rdf * + """ + return _ldns.ldns_rr_rdf(self,nr) + #parameters: const ldns_rr *,size_t, + #retvals: ldns_rdf * + + def rrsig_algorithm(self): + """returns the algorithm of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the algorithm or NULL on failure + """ + return _ldns.ldns_rr_rrsig_algorithm(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_expiration(self): + """returns the expiration time of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the expiration time or NULL on failure + """ + return _ldns.ldns_rr_rrsig_expiration(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_inception(self): + """returns the inception time of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the inception time or NULL on failure + """ + return _ldns.ldns_rr_rrsig_inception(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_keytag(self): + """returns the keytag of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the keytag or NULL on failure + """ + return _ldns.ldns_rr_rrsig_keytag(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_labels(self): + """returns the number of labels of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the number of labels or NULL on failure + """ + return _ldns.ldns_rr_rrsig_labels(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_origttl(self): + """returns the original TTL of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the original TTL or NULL on failure + """ + return _ldns.ldns_rr_rrsig_origttl(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_set_algorithm(self,f): + """sets the algorithm of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the algorithm to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_algorithm(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_expiration(self,f): + """sets the expireation date of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the expireation date to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_expiration(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_inception(self,f): + """sets the inception date of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the inception date to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_inception(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_keytag(self,f): + """sets the keytag of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the keytag to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_keytag(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_labels(self,f): + """sets the number of labels of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the number of labels to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_labels(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_origttl(self,f): + """sets the original TTL of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the original TTL to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_origttl(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_sig(self,f): + """sets the signature data of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the signature data to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_sig(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_signame(self,f): + """sets the signers name of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the signers name to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_signame(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_set_typecovered(self,f): + """sets the typecovered of a LDNS_RR_TYPE_RRSIG rr + + :param f: + the typecovered to set + :returns: (bool) true on success, false otherwise + """ + return _ldns.ldns_rr_rrsig_set_typecovered(self,f) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: bool + + def rrsig_sig(self): + """returns the signature data of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the signature data or NULL on failure + """ + return _ldns.ldns_rr_rrsig_sig(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_signame(self): + """returns the signers name of a LDNS_RR_TYPE_RRSIG RR + + :returns: (ldns_rdf \*) a ldns_rdf* with the signers name or NULL on failure + """ + return _ldns.ldns_rr_rrsig_signame(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def rrsig_typecovered(self): + """returns the type covered of a LDNS_RR_TYPE_RRSIG rr + + :returns: (ldns_rdf \*) a ldns_rdf* with the type covered or NULL on failure + """ + return _ldns.ldns_rr_rrsig_typecovered(self) + #parameters: const ldns_rr *, + #retvals: ldns_rdf * + + def set_class(self,rr_class): + """sets the class in the rr. + + :param rr_class: + set to this class + """ + _ldns.ldns_rr_set_class(self,rr_class) + #parameters: ldns_rr *,ldns_rr_class, + #retvals: + + def set_owner(self,owner): + """sets the owner in the rr structure. + + :param owner: + """ + _ldns.ldns_rr_set_owner(self,owner) + #parameters: ldns_rr *,ldns_rdf *, + #retvals: + + def set_rd_count(self,count): + """sets the rd_count in the rr. + + :param count: + set to this count + """ + _ldns.ldns_rr_set_rd_count(self,count) + #parameters: ldns_rr *,size_t, + #retvals: + + def set_rdf(self,f,position): + """sets a rdf member, it will be set on the position given. + + The old value is returned, like pop. + + :param f: + :param position: + the position the set the rdf + :returns: (ldns_rdf \*) the old value in the rr, NULL on failyre + """ + return _ldns.ldns_rr_set_rdf(self,f,position) + #parameters: ldns_rr *,const ldns_rdf *,size_t, + #retvals: ldns_rdf * + + def set_ttl(self,ttl): + """sets the ttl in the rr structure. + + :param ttl: + set to this ttl + """ + _ldns.ldns_rr_set_ttl(self,ttl) + #parameters: ldns_rr *,uint32_t, + #retvals: + + def set_type(self,rr_type): + """sets the type in the rr. + + :param rr_type: + set to this type + """ + _ldns.ldns_rr_set_type(self,rr_type) + #parameters: ldns_rr *,ldns_rr_type, + #retvals: + + def ttl(self): + """returns the ttl of an rr structure. + + :returns: (uint32_t) the ttl of the rr + """ + return _ldns.ldns_rr_ttl(self) + #parameters: const ldns_rr *, + #retvals: uint32_t + + def uncompressed_size(self): + """calculates the uncompressed size of an RR. + + :returns: (size_t) size of the rr + """ + return _ldns.ldns_rr_uncompressed_size(self) + #parameters: const ldns_rr *, + #retvals: size_t + + #_LDNS_RR_METHODS# + %} +} + +%nodefaultctor ldns_struct_rr_list; //no default constructor & destructor +%nodefaultdtor ldns_struct_rr_list; + +%ignore ldns_struct_rr_list::_rrs; + +%newobject ldns_rr_list_clone; +%newobject ldns_rr_list_pop_rr; +%newobject ldns_rr_list_pop_rr_list; +%newobject ldns_rr_list_pop_rrset; +%delobject ldns_rr_list_deep_free; +%delobject ldns_rr_list_free; + +%rename(ldns_rr_list) ldns_struct_rr_list; +#ifdef LDNS_DEBUG +%rename(__ldns_rr_list_deep_free) ldns_rr_list_deep_free; +%rename(__ldns_rr_list_free) ldns_rr_list_free; +%inline %{ +void _ldns_rr_list_free(ldns_rr_list* r) { + printf("******** LDNS_RR_LIST deep free 0x%lX ************\n", (long unsigned int)r); + ldns_rr_list_deep_free(r); +} +%} +#else +%rename(_ldns_rr_list_deep_free) ldns_rr_list_deep_free; +%rename(_ldns_rr_list_free) ldns_rr_list_free; +#endif + +%exception ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr) %{ $action if (result) Py_INCREF(obj1); %} +%exception ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list) %{ $action if (result) Py_INCREF(obj1); %} + +%newobject ldns_rr_list2str; + + + + +%feature("docstring") ldns_struct_rr_list "List of Resource Records. + +This class contains a list of RR's (see :class:`ldns.ldns_rr`). +" + +%extend ldns_struct_rr_list { + + %pythoncode %{ + def __init__(self): + self.this = _ldns.ldns_rr_list_new() + if not self.this: + raise Exception("Can't create new RR_LIST") + + __swig_destroy__ = _ldns._ldns_rr_list_free + + #LDNS_RR_LIST_CONSTRUCTORS_# + @staticmethod + def new_frm_file(filename="/etc/hosts", raiseException=True): + """Creates an RR List object from a file content + + Goes through a file and returns a rr_list containing all the defined hosts in there. + + :param filename: the filename to use + :returns: RR List object or None. If the object can't be created and raiseException is True, an exception occurs. + + **Usage** + >>> alist = ldns.ldns_rr_list.new_frm_file() + >>> print alist + localhost. 3600 IN A 127.0.0.1 + ... + + """ + rr = _ldns.ldns_get_rr_list_hosts_frm_file(filename) + if (not rr) and (raiseException): raise Exception("Can't create RR List, error: %d" % status) + return rr + #_LDNS_RR_LIST_CONSTRUCTORS# + + def __str__(self): + """converts a list of resource records to presentation format""" + return _ldns.ldns_rr_list2str(self) + + def print_to_file(self,output): + """print a rr_list to output param[in] output the fd to print to param[in] list the rr_list to print""" + _ldns.ldns_rr_list_print(output,self) + + + def to_canonical(self): + """converts each dname in each rr in a rr_list to its canonical form.""" + _ldns.ldns_rr_list2canonical(self) + #parameters: ldns_rr_list *, + #retvals: + + def rrs(self): + """returns the list of rr records.""" + for i in range(0,self.rr_count()): + yield self.rr(i) + + def is_rrset(self): + """checks if an rr_list is a rrset.""" + return _ldns.ldns_is_rrset(self) + + def __cmp__(self,rrl2): + """compares two rr listss. + + :param rrl2: + the second one + :returns: (int) 0 if equal -1 if this list comes before rrl2 +1 if rrl2 comes before this list + """ + return _ldns.ldns_rr_list_compare(self,rrl2) + + def write_to_buffer(self, buffer): + """Copies the rr_list data to the buffer in wire format. + + :param buffer: output buffer to append the result to + :returns: (ldns_status) ldns_status + """ + return _ldns.ldns_rr_list2buffer_wire(buffer,self) + + #LDNS_RR_LIST_METHODS_# + def cat(self,right): + """concatenates two ldns_rr_lists together. + + This modifies rr list (to extend it and add the pointers from right). + + :param right: + the rightside + :returns: (bool) a left with right concatenated to it + """ + return _ldns.ldns_rr_list_cat(self,right) + #parameters: ldns_rr_list *,ldns_rr_list *, + #retvals: bool + + def cat_clone(self,right): + """concatenates two ldns_rr_lists together, but makes clones of the rr's (instead of pointer copying). + + :param right: + the rightside + :returns: (ldns_rr_list \*) a new rr_list with leftside/rightside concatenated + """ + return _ldns.ldns_rr_list_cat_clone(self,right) + #parameters: ldns_rr_list *,ldns_rr_list *, + #retvals: ldns_rr_list * + + def clone(self): + """clones an rrlist. + + :returns: (ldns_rr_list \*) the cloned rr list + """ + return _ldns.ldns_rr_list_clone(self) + #parameters: const ldns_rr_list *, + #retvals: ldns_rr_list * + + def contains_rr(self,rr): + """returns true if the given rr is one of the rrs in the list, or if it is equal to one + + :param rr: + the rr to check + :returns: (bool) true if rr_list contains rr, false otherwise + """ + return _ldns.ldns_rr_list_contains_rr(self,rr) + #parameters: const ldns_rr_list *,ldns_rr *, + #retvals: bool + + def owner(self): + """Returns the owner domain name rdf of the first element of the RR If there are no elements present, NULL is returned. + + :returns: (ldns_rdf \*) dname of the first element, or NULL if the list is empty + """ + return _ldns.ldns_rr_list_owner(self) + #parameters: const ldns_rr_list *, + #retvals: ldns_rdf * + + def pop_rr(self): + """pops the last rr from an rrlist. + + :returns: (ldns_rr \*) NULL if nothing to pop. Otherwise the popped RR + """ + return _ldns.ldns_rr_list_pop_rr(self) + #parameters: ldns_rr_list *, + #retvals: ldns_rr * + + def pop_rr_list(self,size): + """pops an rr_list of size s from an rrlist. + + :param size: + the number of rr's to pop + :returns: (ldns_rr_list \*) NULL if nothing to pop. Otherwise the popped rr_list + """ + return _ldns.ldns_rr_list_pop_rr_list(self,size) + #parameters: ldns_rr_list *,size_t, + #retvals: ldns_rr_list * + + def pop_rrset(self): + """pops the first rrset from the list, the list must be sorted, so that all rr's from each rrset are next to each other + + :returns: (ldns_rr_list \*) + """ + return _ldns.ldns_rr_list_pop_rrset(self) + #parameters: ldns_rr_list *, + #retvals: ldns_rr_list * + + def push_rr(self,rr): + """pushes an rr to an rrlist. + + :param rr: + the rr to push + :returns: (bool) false on error, otherwise true + """ + return _ldns.ldns_rr_list_push_rr(self,rr) + #parameters: ldns_rr_list *,const ldns_rr *, + #retvals: bool + + def push_rr_list(self,push_list): + """pushes an rr_list to an rrlist. + + :param push_list: + the rr_list to push + :returns: (bool) false on error, otherwise true + """ + return _ldns.ldns_rr_list_push_rr_list(self,push_list) + #parameters: ldns_rr_list *,const ldns_rr_list *, + #retvals: bool + + def rr(self,nr): + """returns a specific rr of an rrlist. + + :param nr: + return this rr + :returns: (ldns_rr \*) the rr at position nr + """ + return _ldns.ldns_rr_list_rr(self,nr) + #parameters: const ldns_rr_list *,size_t, + #retvals: ldns_rr * + + def rr_count(self): + """returns the number of rr's in an rr_list. + + :returns: (size_t) the number of rr's + """ + return _ldns.ldns_rr_list_rr_count(self) + #parameters: const ldns_rr_list *, + #retvals: size_t + + def set_rr(self,r,count): + """set a rr on a specific index in a ldns_rr_list + + :param r: + the rr to set + :param count: + index into the rr_list + :returns: (ldns_rr \*) the old rr which was stored in the rr_list, or NULL is the index was too large set a specific rr + """ + return _ldns.ldns_rr_list_set_rr(self,r,count) + #parameters: ldns_rr_list *,const ldns_rr *,size_t, + #retvals: ldns_rr * + + def set_rr_count(self,count): + """sets the number of rr's in an rr_list. + + :param count: + the number of rr in this list + """ + _ldns.ldns_rr_list_set_rr_count(self,count) + #parameters: ldns_rr_list *,size_t, + #retvals: + + def sort(self): + """sorts an rr_list (canonical wire format). + + the sorting is done inband. + """ + _ldns.ldns_rr_list_sort(self) + #parameters: ldns_rr_list *, + #retvals: + + def subtype_by_rdf(self,r,pos): + """Return the rr_list which matches the rdf at position field. + + Think type-covered stuff for RRSIG + + :param r: + the rdf to use for the comparison + :param pos: + at which position can we find the rdf + :returns: (ldns_rr_list \*) a new rr list with only the RRs that match + """ + return _ldns.ldns_rr_list_subtype_by_rdf(self,r,pos) + #parameters: ldns_rr_list *,ldns_rdf *,size_t, + #retvals: ldns_rr_list * + + def type(self): + """Returns the type of the first element of the RR If there are no elements present, 0 is returned (LDNS_RR_TYPE_A). + + :returns: (ldns_rr_type) rr_type of the first element, or 0 if the list is empty + """ + return _ldns.ldns_rr_list_type(self) + #parameters: const ldns_rr_list *, + #retvals: ldns_rr_type + #_LDNS_RR_LIST_METHODS# + %} +} + +%newobject ldns_rr_descript; + +%nodefaultctor ldns_struct_rr_descriptor; //no default constructor & destructor +%nodefaultdtor ldns_struct_rr_descriptor; +%rename(ldns_rr_descriptor) ldns_struct_rr_descriptor; + + + + +%feature("docstring") ldns_struct_rr_descriptor "Resource Record descriptor + +This structure contains, for all rr types, the rdata fields that are defined." + +%extend ldns_struct_rr_descriptor { + %pythoncode %{ + def __init__(self): + raise Exception("This class can't be created directly. Please use: ldns_rr_descript") + #LDNS_RR_DESCRIPTOR_METHODS_# + def field_type(self,field): + """returns the rdf type for the given rdata field number of the rr type for the given descriptor. + + :param field: + the field number + :returns: (ldns_rdf_type) the rdf type for the field + """ + return _ldns.ldns_rr_descriptor_field_type(self,field) + #parameters: const ldns_rr_descriptor *,size_t, + #retvals: ldns_rdf_type + + def maximum(self): + """returns the maximum number of rdata fields of the rr type this descriptor describes. + + :returns: (size_t) the maximum number of rdata fields + """ + return _ldns.ldns_rr_descriptor_maximum(self) + #parameters: const ldns_rr_descriptor *, + #retvals: size_t + + def minimum(self): + """returns the minimum number of rdata fields of the rr type this descriptor describes. + + :returns: (size_t) the minimum number of rdata fields + """ + return _ldns.ldns_rr_descriptor_minimum(self) + #parameters: const ldns_rr_descriptor *, + #retvals: size_t + + #_LDNS_RR_DESCRIPTOR_METHODS# + %} +} + diff --git a/libs/ldns/contrib/python/ldns_zone.i b/libs/ldns/contrib/python/ldns_zone.i new file mode 100644 index 0000000000..2afdd96930 --- /dev/null +++ b/libs/ldns/contrib/python/ldns_zone.i @@ -0,0 +1,298 @@ +/****************************************************************************** + * ldns_zone.i: LDNS zone class + * + * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) + * Karel Slany (slany AT fit.vutbr.cz) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the organization nor the names of its + * contributors may be used to endorse or promote products derived from this + * software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + ******************************************************************************/ + +%typemap(in,numinputs=0,noblock=1) (ldns_zone **) +{ + ldns_zone *$1_zone; + $1 = &$1_zone; +} + +/* result generation */ +%typemap(argout,noblock=1) (ldns_zone **) +{ + $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_zone), SWIGTYPE_p_ldns_struct_zone, SWIG_POINTER_OWN | 0 )); +} + +%nodefaultctor ldns_struct_zone; //no default constructor & destructor +%nodefaultdtor ldns_struct_zone; + +%newobject ldns_zone_new_frm_fp; +%newobject ldns_zone_new_frm_fp_l; +%newobject ldns_zone_new; +%delobject ldns_zone_free; +%delobject ldns_zone_deep_free; +%delobject ldns_zone_push_rr; +%delobject ldns_zone_push_rr_list; + +%ignore ldns_struct_zone::_soa; +%ignore ldns_struct_zone::_rrs; + +%rename(ldns_zone) ldns_struct_zone; + +#ifdef LDNS_DEBUG +%rename(__ldns_zone_free) ldns_zone_free; +%rename(__ldns_zone_deep_free) ldns_zone_deep_free; +%inline %{ +void _ldns_zone_free (ldns_zone* z) { + printf("******** LDNS_ZONE free 0x%lX ************\n", (long unsigned int)z); + ldns_zone_deep_free(z); +} +%} +#else +%rename(__ldns_zone_free) ldns_zone_free; +%rename(_ldns_zone_free) ldns_zone_deep_free; +#endif +%feature("docstring") ldns_struct_zone "Zone definitions + +**Usage** + +This class is able to read and parse the content of zone file by doing: + +>>> import ldns +>>> zone = ldns.ldns_zone.new_frm_fp(open(\"zone.txt\",\"r\"), None, 0, ldns.LDNS_RR_CLASS_IN) +>>> print zone.soa() +example. 600 IN SOA example. admin.example. 2008022501 28800 7200 604800 18000 +>>> print zone.rrs() +example. 600 IN MX 10 mail.example. +example. 600 IN NS ns1.example. +example. 600 IN NS ns2.example. +example. 600 IN A 192.168.1.1 + +The ``zone.txt`` file contains the following records:: + + $ORIGIN example. + $TTL 600 + + example. IN SOA example. admin.example. ( + 2008022501 ; serial + 28800 ; refresh (8 hours) + 7200 ; retry (2 hours) + 604800 ; expire (1 week) + 18000 ; minimum (5 hours) + ) + + @ IN MX 10 mail.example. + @ IN NS ns1 + @ IN NS ns2 + @ IN A 192.168.1.1 +" + +%extend ldns_struct_zone { + + %pythoncode %{ + def __init__(self): + self.this = _ldns.ldns_zone_new() + if not self.this: + raise Exception("Can't create zone.") + + __swig_destroy__ = _ldns._ldns_zone_free + + def __str__(self): + return str(self.soa()) + "\n" + str(self.rrs()) + + def print_to_file(self,output): + """Prints the data in the zone to the given file stream (in presentation format).""" + _ldns.ldns_zone_print(output,self) + #parameters: FILE *,const ldns_zone *, + + #LDNS_ZONE_CONSTRUCTORS_# + @staticmethod + def new_frm_fp(file, origin, ttl, rr_class=_ldns.LDNS_RR_CLASS_IN, raiseException=True): + """Creates a new zone object from given file pointer + + :param file: a file object + :param origin: (ldns_rdf) the zones' origin + :param ttl: default ttl to use + :param rr_class: efault class to use (IN) + :param raiseException: if True, an exception occurs in case a zone instance can't be created + :returns: zone instance or None. If an instance can't be created and raiseException is True, an exception occurs. + """ + status, zone = _ldns.ldns_zone_new_frm_fp(file, origin, ttl, rr_class) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create zone, error: %s (%d)" % (_ldns.ldns_get_errorstr_by_id(status),status)) + return None + return zone + + @staticmethod + def new_frm_fp_l(file, origin, ttl, rr_class, raiseException=True): + """Create a new zone from a file, keep track of the line numbering + + :param file: a file object + :param origin: (ldns_rdf) the zones' origin + :param ttl: default ttl to use + :param rr_class: efault class to use (IN) + :param raiseException: if True, an exception occurs in case a zone instance can't be created + :returns: + * zone - zone instance or None. If an instance can't be created and raiseException is True, an exception occurs. + + * line - used for error msg, to get to the line number + """ + status, zone = _ldns.ldns_zone_new_frm_fp_l(file, line) + if status != LDNS_STATUS_OK: + if (raiseException): raise Exception("Can't create zone, error: %d" % status) + return None + return zone + #_LDNS_ZONE_CONSTRUCTORS# + + def sign(self,key_list): + """Signs the zone, and returns a newly allocated signed zone. + + :param key_list: + list of keys to sign with + :returns: (ldns_zone \*) signed zone + """ + return _ldns.ldns_zone_sign(self,key_list) + #parameters: const ldns_zone *,ldns_key_list *, + #retvals: ldns_zone * + + def sign_nsec3(self,key_list,algorithm,flags,iterations,salt_length,salt): + """Signs the zone with NSEC3, and returns a newly allocated signed zone. + + :param key_list: + list of keys to sign with + :param algorithm: + the NSEC3 hashing algorithm to use + :param flags: + NSEC3 flags + :param iterations: + the number of NSEC3 hash iterations to use + :param salt_length: + the length (in octets) of the NSEC3 salt + :param salt: + the NSEC3 salt data + :returns: (ldns_zone \*) signed zone + """ + return _ldns.ldns_zone_sign_nsec3(self,key_list,algorithm,flags,iterations,salt_length,salt) + #parameters: ldns_zone *,ldns_key_list *,uint8_t,uint8_t,uint16_t,uint8_t,uint8_t *, + #retvals: ldns_zone * + + #LDNS_ZONE_METHODS_# + def glue_rr_list(self): + """Retrieve all resource records from the zone that are glue records. + + The resulting list does are pointer references to the zone's data. + + Due to the current zone implementation (as a list of rr's), this function is extremely slow. Another (probably better) way to do this is to use an ldns_dnssec_zone structure and the mark_glue function + + :returns: (ldns_rr_list \*) the rr_list with the glue + """ + return _ldns.ldns_zone_glue_rr_list(self) + #parameters: const ldns_zone *, + #retvals: ldns_rr_list * + + def push_rr(self,rr): + """push an single rr to a zone structure. + + This function use pointer copying, so the rr_list structure inside z is modified! + + :param rr: + the rr to add + :returns: (bool) a true on succes otherwise falsed + """ + return _ldns.ldns_zone_push_rr(self,rr) + #parameters: ldns_zone *,ldns_rr *, + #retvals: bool + + def push_rr_list(self,list): + """push an rrlist to a zone structure. + + This function use pointer copying, so the rr_list structure inside z is modified! + + :param list: + the list to add + :returns: (bool) a true on succes otherwise falsed + """ + return _ldns.ldns_zone_push_rr_list(self,list) + #parameters: ldns_zone *,ldns_rr_list *, + #retvals: bool + + def rr_count(self): + """Returns the number of resource records in the zone, NOT counting the SOA record. + + :returns: (size_t) the number of rr's in the zone + """ + return _ldns.ldns_zone_rr_count(self) + #parameters: const ldns_zone *, + #retvals: size_t + + def rrs(self): + """Get a list of a zone's content. + + Note that the SOA isn't included in this list. You need to get the with ldns_zone_soa. + + :returns: (ldns_rr_list \*) the rrs from this zone + """ + return _ldns.ldns_zone_rrs(self) + #parameters: const ldns_zone *, + #retvals: ldns_rr_list * + + def set_rrs(self,rrlist): + """Set the zone's contents. + + :param rrlist: + the rrlist to use + """ + _ldns.ldns_zone_set_rrs(self,rrlist) + #parameters: ldns_zone *,ldns_rr_list *, + #retvals: + + def set_soa(self,soa): + """Set the zone's soa record. + + :param soa: + the soa to set + """ + _ldns.ldns_zone_set_soa(self,soa) + #parameters: ldns_zone *,ldns_rr *, + #retvals: + + def soa(self): + """Return the soa record of a zone. + + :returns: (ldns_rr \*) the soa record in the zone + """ + return _ldns.ldns_zone_soa(self) + #parameters: const ldns_zone *, + #retvals: ldns_rr * + + def sort(self): + """Sort the rrs in a zone, with the current impl. + + this is slow + """ + _ldns.ldns_zone_sort(self) + #parameters: ldns_zone *, + #retvals: + + #_LDNS_ZONE_METHODS# + %} +} diff --git a/libs/ldns/dname.c b/libs/ldns/dname.c new file mode 100644 index 0000000000..0e63ef2689 --- /dev/null +++ b/libs/ldns/dname.c @@ -0,0 +1,567 @@ +/* + * dname.c + * + * dname specific rdata implementations + * A dname is a rdf structure with type LDNS_RDF_TYPE_DNAME + * It is not a /real/ type! All function must therefor check + * for LDNS_RDF_TYPE_DNAME. + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif + +ldns_rdf * +ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2) +{ + ldns_rdf *new; + uint16_t new_size; + uint8_t *buf; + uint16_t left_size; + + if (ldns_rdf_get_type(rd1) != LDNS_RDF_TYPE_DNAME || + ldns_rdf_get_type(rd2) != LDNS_RDF_TYPE_DNAME) { + return NULL; + } + + /* remove root label if it is present at the end of the left + * rd, by reducing the size with 1 + */ + left_size = ldns_rdf_size(rd1); + if (left_size > 0 &&ldns_rdf_data(rd1)[left_size - 1] == 0) { + left_size--; + } + + /* we overwrite the nullbyte of rd1 */ + new_size = left_size + ldns_rdf_size(rd2); + buf = LDNS_XMALLOC(uint8_t, new_size); + if (!buf) { + return NULL; + } + + /* put the two dname's after each other */ + memcpy(buf, ldns_rdf_data(rd1), left_size); + memcpy(buf + left_size, ldns_rdf_data(rd2), ldns_rdf_size(rd2)); + + new = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, new_size, buf); + + LDNS_FREE(buf); + return new; +} + +ldns_status +ldns_dname_cat(ldns_rdf *rd1, ldns_rdf *rd2) +{ + uint16_t left_size; + uint16_t size; + uint8_t* newd; + + if (ldns_rdf_get_type(rd1) != LDNS_RDF_TYPE_DNAME || + ldns_rdf_get_type(rd2) != LDNS_RDF_TYPE_DNAME) { + return LDNS_STATUS_ERR; + } + + /* remove root label if it is present at the end of the left + * rd, by reducing the size with 1 + */ + left_size = ldns_rdf_size(rd1); + if (left_size > 0 &&ldns_rdf_data(rd1)[left_size - 1] == 0) { + left_size--; + } + if(left_size == 0) { + return LDNS_STATUS_OK; + } + + size = left_size + ldns_rdf_size(rd2); + newd = LDNS_XREALLOC(ldns_rdf_data(rd1), uint8_t, size); + if(!newd) { + return LDNS_STATUS_MEM_ERR; + } + + ldns_rdf_set_data(rd1, newd); + memcpy(ldns_rdf_data(rd1) + left_size, ldns_rdf_data(rd2), + ldns_rdf_size(rd2)); + ldns_rdf_set_size(rd1, size); + + return LDNS_STATUS_OK; +} + +ldns_rdf * +ldns_dname_reverse(const ldns_rdf *d) +{ + ldns_rdf *new; + ldns_rdf *tmp; + ldns_rdf *d_tmp; + ldns_status status; + + d_tmp = ldns_rdf_clone(d); + + new = ldns_dname_new_frm_str("."); + if(!new) + return NULL; + + while(ldns_dname_label_count(d_tmp) > 0) { + tmp = ldns_dname_label(d_tmp, 0); + status = ldns_dname_cat(tmp, new); + if(status != LDNS_STATUS_OK) { + ldns_rdf_deep_free(new); + ldns_rdf_deep_free(d_tmp); + return NULL; + } + ldns_rdf_deep_free(new); + new = tmp; + tmp = ldns_dname_left_chop(d_tmp); + ldns_rdf_deep_free(d_tmp); + d_tmp = tmp; + } + ldns_rdf_deep_free(d_tmp); + + return new; +} + +ldns_rdf * +ldns_dname_clone_from(const ldns_rdf *d, uint16_t n) +{ + uint8_t *data; + uint8_t label_size; + size_t data_size; + + if (!d || + ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME || + ldns_dname_label_count(d) < n) { + return NULL; + } + + data = ldns_rdf_data(d); + data_size = ldns_rdf_size(d); + while (n > 0) { + label_size = data[0] + 1; + data += label_size; + if (data_size < label_size) { + /* this label is very broken */ + return NULL; + } + data_size -= label_size; + n--; + } + + return ldns_dname_new_frm_data(data_size, data); +} + +ldns_rdf * +ldns_dname_left_chop(const ldns_rdf *d) +{ + uint8_t label_pos; + ldns_rdf *chop; + + if (!d) { + return NULL; + } + + if (ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME) { + return NULL; + } + if (ldns_dname_label_count(d) == 0) { + /* root label */ + return NULL; + } + /* 05blaat02nl00 */ + label_pos = ldns_rdf_data(d)[0]; + + chop = ldns_dname_new_frm_data(ldns_rdf_size(d) - label_pos - 1, + ldns_rdf_data(d) + label_pos + 1); + return chop; +} + +uint8_t +ldns_dname_label_count(const ldns_rdf *r) +{ + uint16_t src_pos; + uint16_t len; + uint8_t i; + size_t r_size; + + if (!r) { + return 0; + } + + i = 0; + src_pos = 0; + r_size = ldns_rdf_size(r); + + if (ldns_rdf_get_type(r) != LDNS_RDF_TYPE_DNAME) { + return 0; + } else { + len = ldns_rdf_data(r)[src_pos]; /* start of the label */ + + /* single root label */ + if (1 == r_size) { + return 0; + } else { + while ((len > 0) && src_pos < r_size) { + src_pos++; + src_pos += len; + len = ldns_rdf_data(r)[src_pos]; + i++; + } + } + } + return i; +} + +ldns_rdf * +ldns_dname_new(uint16_t s, void *d) +{ + ldns_rdf *rd; + + rd = LDNS_MALLOC(ldns_rdf); + if (!rd) { + return NULL; + } + ldns_rdf_set_size(rd, s); + ldns_rdf_set_type(rd, LDNS_RDF_TYPE_DNAME); + ldns_rdf_set_data(rd, d); + return rd; +} + +ldns_rdf * +ldns_dname_new_frm_str(const char *str) +{ + return ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, str); +} + +ldns_rdf * +ldns_dname_new_frm_data(uint16_t size, const void *data) +{ + return ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, size, data); +} + +void +ldns_dname2canonical(const ldns_rdf *rd) +{ + uint8_t *rdd; + uint16_t i; + + if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_DNAME) { + return; + } + + rdd = (uint8_t*)ldns_rdf_data(rd); + for (i = 0; i < ldns_rdf_size(rd); i++, rdd++) { + *rdd = (uint8_t)LDNS_DNAME_NORMALIZE((int)*rdd); + } +} + +bool +ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent) +{ + uint8_t sub_lab; + uint8_t par_lab; + int8_t i, j; + ldns_rdf *tmp_sub = NULL; + ldns_rdf *tmp_par = NULL; + ldns_rdf *sub_clone; + ldns_rdf *parent_clone; + bool result = true; + + if (ldns_rdf_get_type(sub) != LDNS_RDF_TYPE_DNAME || + ldns_rdf_get_type(parent) != LDNS_RDF_TYPE_DNAME || + ldns_rdf_compare(sub, parent) == 0) { + return false; + } + + /* would be nicer if we do not have to clone... */ + sub_clone = ldns_dname_clone_from(sub, 0); + parent_clone = ldns_dname_clone_from(parent, 0); + ldns_dname2canonical(sub_clone); + ldns_dname2canonical(parent_clone); + + sub_lab = ldns_dname_label_count(sub_clone); + par_lab = ldns_dname_label_count(parent_clone); + + /* if sub sits above parent, it cannot be a child/sub domain */ + if (sub_lab < par_lab) { + result = false; + } else { + /* check all labels the from the parent labels, from right to left. + * When they /all/ match we have found a subdomain + */ + j = sub_lab - 1; /* we count from zero, thank you */ + for (i = par_lab -1; i >= 0; i--) { + tmp_sub = ldns_dname_label(sub_clone, j); + tmp_par = ldns_dname_label(parent_clone, i); + if (!tmp_sub || !tmp_par) { + /* deep free does null check */ + ldns_rdf_deep_free(tmp_sub); + ldns_rdf_deep_free(tmp_par); + result = false; + break; + } + + if (ldns_rdf_compare(tmp_sub, tmp_par) != 0) { + /* they are not equal */ + ldns_rdf_deep_free(tmp_sub); + ldns_rdf_deep_free(tmp_par); + result = false; + break; + } + ldns_rdf_deep_free(tmp_sub); + ldns_rdf_deep_free(tmp_par); + j--; + } + } + ldns_rdf_deep_free(sub_clone); + ldns_rdf_deep_free(parent_clone); + return result; +} + +int +ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2) +{ + size_t lc1, lc2, lc1f, lc2f; + size_t i; + int result = 0; + uint8_t *lp1, *lp2; + + /* see RFC4034 for this algorithm */ + /* this algorithm assumes the names are normalized to case */ + + /* only when both are not NULL we can say anything about them */ + if (!dname1 && !dname2) { + return 0; + } + if (!dname1 || !dname2) { + return -1; + } + /* asserts must happen later as we are looking in the + * dname, which could be NULL. But this case is handled + * above + */ + assert(ldns_rdf_get_type(dname1) == LDNS_RDF_TYPE_DNAME); + assert(ldns_rdf_get_type(dname2) == LDNS_RDF_TYPE_DNAME); + + lc1 = ldns_dname_label_count(dname1); + lc2 = ldns_dname_label_count(dname2); + + if (lc1 == 0 && lc2 == 0) { + return 0; + } + if (lc1 == 0) { + return -1; + } + if (lc2 == 0) { + return 1; + } + lc1--; + lc2--; + /* we start at the last label */ + while (true) { + /* find the label first */ + lc1f = lc1; + lp1 = ldns_rdf_data(dname1); + while (lc1f > 0) { + lp1 += *lp1 + 1; + lc1f--; + } + + /* and find the other one */ + lc2f = lc2; + lp2 = ldns_rdf_data(dname2); + while (lc2f > 0) { + lp2 += *lp2 + 1; + lc2f--; + } + + /* now check the label character for character. */ + for (i = 1; i < (size_t)(*lp1 + 1); i++) { + if (i > *lp2) { + /* apparently label 1 is larger */ + result = 1; + goto done; + } + if (LDNS_DNAME_NORMALIZE((int) *(lp1 + i)) < + LDNS_DNAME_NORMALIZE((int) *(lp2 + i))) { + result = -1; + goto done; + } else if (LDNS_DNAME_NORMALIZE((int) *(lp1 + i)) > + LDNS_DNAME_NORMALIZE((int) *(lp2 + i))) { + result = 1; + goto done; + } + } + if (*lp1 < *lp2) { + /* apparently label 2 is larger */ + result = -1; + goto done; + } + if (lc1 == 0 && lc2 > 0) { + result = -1; + goto done; + } else if (lc1 > 0 && lc2 == 0) { + result = 1; + goto done; + } else if (lc1 == 0 && lc2 == 0) { + result = 0; + goto done; + } + lc1--; + lc2--; + } + + done: + return result; +} + +int +ldns_dname_is_wildcard(const ldns_rdf* dname) +{ + return ( ldns_dname_label_count(dname) > 0 && + ldns_rdf_data(dname)[0] == 1 && + ldns_rdf_data(dname)[1] == '*'); +} + +int +ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard) +{ + ldns_rdf *wc_chopped; + int result; + /* check whether it really is a wildcard */ + if (ldns_dname_is_wildcard(wildcard)) { + /* ok, so the dname needs to be a subdomain of the wildcard + * without the * + */ + wc_chopped = ldns_dname_left_chop(wildcard); + result = (int) ldns_dname_is_subdomain(dname, wc_chopped); + ldns_rdf_deep_free(wc_chopped); + } else { + result = (ldns_dname_compare(dname, wildcard) == 0); + } + return result; +} + +/* nsec test: does prev <= middle < next + * -1 = yes + * 0 = error/can't tell + * 1 = no + */ +int +ldns_dname_interval(const ldns_rdf *prev, const ldns_rdf *middle, + const ldns_rdf *next) +{ + int prev_check, next_check; + + assert(ldns_rdf_get_type(prev) == LDNS_RDF_TYPE_DNAME); + assert(ldns_rdf_get_type(middle) == LDNS_RDF_TYPE_DNAME); + assert(ldns_rdf_get_type(next) == LDNS_RDF_TYPE_DNAME); + + prev_check = ldns_dname_compare(prev, middle); + next_check = ldns_dname_compare(middle, next); + /* <= next. This cannot be the case for nsec, because then we would + * have gotten the nsec of next... + */ + if (next_check == 0) { + return 0; + } + + /* <= */ + if ((prev_check == -1 || prev_check == 0) && + /* < */ + next_check == -1) { + return -1; + } else { + return 1; + } +} + + +bool +ldns_dname_str_absolute(const char *dname_str) +{ + const char* s; + if(dname_str && strcmp(dname_str, ".") == 0) + return 1; + if(!dname_str || strlen(dname_str) < 2) + return 0; + if(dname_str[strlen(dname_str) - 1] != '.') + return 0; + if(dname_str[strlen(dname_str) - 2] != '\\') + return 1; /* ends in . and no \ before it */ + /* so we have the case of ends in . and there is \ before it */ + for(s=dname_str; *s; s++) { + if(*s == '\\') { + if(s[1] && s[2] && s[3] /* check length */ + && isdigit(s[1]) && isdigit(s[2]) && + isdigit(s[3])) + s += 3; + else if(!s[1] || isdigit(s[1])) /* escape of nul,0-9 */ + return 0; /* parse error */ + else s++; /* another character escaped */ + } + else if(!*(s+1) && *s == '.') + return 1; /* trailing dot, unescaped */ + } + return 0; +} + +ldns_rdf * +ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos) +{ + uint8_t labelcnt; + uint16_t src_pos; + uint16_t len; + ldns_rdf *tmpnew; + size_t s; + + if (ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_DNAME) { + return NULL; + } + + labelcnt = 0; + src_pos = 0; + s = ldns_rdf_size(rdf); + + len = ldns_rdf_data(rdf)[src_pos]; /* label start */ + while ((len > 0) && src_pos < s) { + if (labelcnt == labelpos) { + /* found our label */ + tmpnew = LDNS_MALLOC(ldns_rdf); + if (!tmpnew) { + return NULL; + } + tmpnew->_type = LDNS_RDF_TYPE_DNAME; + tmpnew->_data = LDNS_XMALLOC(uint8_t, len + 2); + if (!tmpnew->_data) { + LDNS_FREE(tmpnew); + return NULL; + } + memset(tmpnew->_data, 0, len + 2); + memcpy(tmpnew->_data, ldns_rdf_data(rdf) + src_pos, len + 1); + tmpnew->_size = len + 2; + return tmpnew; + } + src_pos++; + src_pos += len; + len = ldns_rdf_data(rdf)[src_pos]; + labelcnt++; + } + return NULL; +} diff --git a/libs/ldns/dnssec.c b/libs/ldns/dnssec.c new file mode 100644 index 0000000000..ce02ef36fd --- /dev/null +++ b/libs/ldns/dnssec.c @@ -0,0 +1,1730 @@ +/* + * dnssec.c + * + * contains the cryptographic function needed for DNSSEC in ldns + * The crypto library used is openssl + * + * (c) NLnet Labs, 2004-2008 + * + * See the file LICENSE for the license + */ + +#include + +#include +#include + +#include +#include + +#ifdef HAVE_SSL +#include +#include +#include +#include +#include +#endif + +ldns_rr * +ldns_dnssec_get_rrsig_for_name_and_type(const ldns_rdf *name, + const ldns_rr_type type, + const ldns_rr_list *rrs) +{ + size_t i; + ldns_rr *candidate; + + if (!name || !rrs) { + return NULL; + } + + for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + candidate = ldns_rr_list_rr(rrs, i); + if (ldns_rr_get_type(candidate) == LDNS_RR_TYPE_RRSIG) { + if (ldns_dname_compare(ldns_rr_owner(candidate), + name) == 0 && + ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(candidate)) + == type + ) { + return candidate; + } + } + } + + return NULL; +} + +ldns_rr * +ldns_dnssec_get_dnskey_for_rrsig(const ldns_rr *rrsig, + const ldns_rr_list *rrs) +{ + size_t i; + ldns_rr *candidate; + + if (!rrsig || !rrs) { + return NULL; + } + + for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + candidate = ldns_rr_list_rr(rrs, i); + if (ldns_rr_get_type(candidate) == LDNS_RR_TYPE_DNSKEY) { + if (ldns_dname_compare(ldns_rr_owner(candidate), + ldns_rr_rrsig_signame(rrsig)) == 0 && + ldns_rdf2native_int16(ldns_rr_rrsig_keytag(rrsig)) == + ldns_calc_keytag(candidate) + ) { + return candidate; + } + } + } + + return NULL; +} + +ldns_rdf * +ldns_nsec_get_bitmap(ldns_rr *nsec) { + if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC) { + return ldns_rr_rdf(nsec, 1); + } else if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC3) { + return ldns_rr_rdf(nsec, 5); + } else { + return NULL; + } +} + +/*return the owner name of the closest encloser for name from the list of rrs */ +/* this is NOT the hash, but the original name! */ +ldns_rdf * +ldns_dnssec_nsec3_closest_encloser(ldns_rdf *qname, + ATTR_UNUSED(ldns_rr_type qtype), + ldns_rr_list *nsec3s) +{ + /* remember parameters, they must match */ + uint8_t algorithm; + uint32_t iterations; + uint8_t salt_length; + uint8_t *salt; + + ldns_rdf *sname, *hashed_sname, *tmp; + ldns_rr *ce; + bool flag; + + bool exact_match_found; + bool in_range_found; + + ldns_status status; + ldns_rdf *zone_name; + + size_t nsec_i; + ldns_rr *nsec; + ldns_rdf *result = NULL; + qtype = qtype; + + if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { + return NULL; + } + + nsec = ldns_rr_list_rr(nsec3s, 0); + algorithm = ldns_nsec3_algorithm(nsec); + salt_length = ldns_nsec3_salt_length(nsec); + salt = ldns_nsec3_salt_data(nsec); + iterations = ldns_nsec3_iterations(nsec); + + sname = ldns_rdf_clone(qname); + + ce = NULL; + flag = false; + + zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); + + /* algorithm from nsec3-07 8.3 */ + while (ldns_dname_label_count(sname) > 0) { + exact_match_found = false; + in_range_found = false; + + hashed_sname = ldns_nsec3_hash_name(sname, + algorithm, + iterations, + salt_length, + salt); + + status = ldns_dname_cat(hashed_sname, zone_name); + if(status != LDNS_STATUS_OK) { + LDNS_FREE(salt); + ldns_rdf_deep_free(zone_name); + ldns_rdf_deep_free(sname); + return NULL; + } + + for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { + nsec = ldns_rr_list_rr(nsec3s, nsec_i); + + /* check values of iterations etc! */ + + /* exact match? */ + if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { + exact_match_found = true; + } else if (ldns_nsec_covers_name(nsec, hashed_sname)) { + in_range_found = true; + } + + } + if (!exact_match_found && in_range_found) { + flag = true; + } else if (exact_match_found && flag) { + result = ldns_rdf_clone(sname); + /* RFC 5155: 8.3. 2.** "The proof is complete" */ + ldns_rdf_deep_free(hashed_sname); + goto done; + } else if (exact_match_found && !flag) { + /* error! */ + ldns_rdf_deep_free(hashed_sname); + goto done; + } else { + flag = false; + } + + ldns_rdf_deep_free(hashed_sname); + tmp = sname; + sname = ldns_dname_left_chop(sname); + ldns_rdf_deep_free(tmp); + } + + done: + LDNS_FREE(salt); + ldns_rdf_deep_free(zone_name); + ldns_rdf_deep_free(sname); + + return result; +} + +bool +ldns_dnssec_pkt_has_rrsigs(const ldns_pkt *pkt) +{ + size_t i; + for (i = 0; i < ldns_pkt_ancount(pkt); i++) { + if (ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_answer(pkt), i)) == + LDNS_RR_TYPE_RRSIG) { + return true; + } + } + for (i = 0; i < ldns_pkt_nscount(pkt); i++) { + if (ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_authority(pkt), i)) == + LDNS_RR_TYPE_RRSIG) { + return true; + } + } + return false; +} + +ldns_rr_list * +ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt, + ldns_rdf *name, + ldns_rr_type type) +{ + uint16_t t_netorder; + ldns_rr_list *sigs; + ldns_rr_list *sigs_covered; + ldns_rdf *rdf_t; + + sigs = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_ANY_NOQUESTION + ); + + t_netorder = htons(type); /* rdf are in network order! */ + rdf_t = ldns_rdf_new(LDNS_RDF_TYPE_TYPE, LDNS_RDF_SIZE_WORD, &t_netorder); + sigs_covered = ldns_rr_list_subtype_by_rdf(sigs, rdf_t, 0); + + ldns_rdf_free(rdf_t); + ldns_rr_list_deep_free(sigs); + + return sigs_covered; + +} + +ldns_rr_list * +ldns_dnssec_pkt_get_rrsigs_for_type(const ldns_pkt *pkt, ldns_rr_type type) +{ + uint16_t t_netorder; + ldns_rr_list *sigs; + ldns_rr_list *sigs_covered; + ldns_rdf *rdf_t; + + sigs = ldns_pkt_rr_list_by_type(pkt, + LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_ANY_NOQUESTION + ); + + t_netorder = htons(type); /* rdf are in network order! */ + rdf_t = ldns_rdf_new(LDNS_RDF_TYPE_TYPE, + 2, + &t_netorder); + sigs_covered = ldns_rr_list_subtype_by_rdf(sigs, rdf_t, 0); + + ldns_rdf_free(rdf_t); + ldns_rr_list_deep_free(sigs); + + return sigs_covered; + +} + +/* used only on the public key RR */ +uint16_t +ldns_calc_keytag(const ldns_rr *key) +{ + uint16_t ac16; + ldns_buffer *keybuf; + size_t keysize; + + if (!key) { + return 0; + } + + if (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY && + ldns_rr_get_type(key) != LDNS_RR_TYPE_KEY + ) { + return 0; + } + + /* rdata to buf - only put the rdata in a buffer */ + keybuf = ldns_buffer_new(LDNS_MIN_BUFLEN); /* grows */ + if (!keybuf) { + return 0; + } + (void)ldns_rr_rdata2buffer_wire(keybuf, key); + /* the current pos in the buffer is the keysize */ + keysize= ldns_buffer_position(keybuf); + + ac16 = ldns_calc_keytag_raw(ldns_buffer_begin(keybuf), keysize); + ldns_buffer_free(keybuf); + return ac16; +} + +uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize) +{ + unsigned int i; + uint32_t ac32; + uint16_t ac16; + + if(keysize < 4) { + return 0; + } + /* look at the algorithm field, copied from 2535bis */ + if (key[3] == LDNS_RSAMD5) { + ac16 = 0; + if (keysize > 4) { + memmove(&ac16, key + keysize - 3, 2); + } + ac16 = ntohs(ac16); + return (uint16_t) ac16; + } else { + ac32 = 0; + for (i = 0; (size_t)i < keysize; ++i) { + ac32 += (i & 1) ? key[i] : key[i] << 8; + } + ac32 += (ac32 >> 16) & 0xFFFF; + return (uint16_t) (ac32 & 0xFFFF); + } +} + +#ifdef HAVE_SSL +DSA * +ldns_key_buf2dsa(ldns_buffer *key) +{ + return ldns_key_buf2dsa_raw((unsigned char*)ldns_buffer_begin(key), + ldns_buffer_position(key)); +} + +DSA * +ldns_key_buf2dsa_raw(unsigned char* key, size_t len) +{ + uint8_t T; + uint16_t length; + uint16_t offset; + DSA *dsa; + BIGNUM *Q; BIGNUM *P; + BIGNUM *G; BIGNUM *Y; + + if(len == 0) + return NULL; + T = (uint8_t)key[0]; + length = (64 + T * 8); + offset = 1; + + if (T > 8) { + return NULL; + } + if(len < (size_t)1 + SHA_DIGEST_LENGTH + 3*length) + return NULL; + + Q = BN_bin2bn(key+offset, SHA_DIGEST_LENGTH, NULL); + offset += SHA_DIGEST_LENGTH; + + P = BN_bin2bn(key+offset, (int)length, NULL); + offset += length; + + G = BN_bin2bn(key+offset, (int)length, NULL); + offset += length; + + Y = BN_bin2bn(key+offset, (int)length, NULL); + offset += length; + + /* create the key and set its properties */ + if(!Q || !P || !G || !Y || !(dsa = DSA_new())) { + BN_free(Q); + BN_free(P); + BN_free(G); + BN_free(Y); + return NULL; + } +#ifndef S_SPLINT_S + dsa->p = P; + dsa->q = Q; + dsa->g = G; + dsa->pub_key = Y; +#endif /* splint */ + + return dsa; +} + +RSA * +ldns_key_buf2rsa(ldns_buffer *key) +{ + return ldns_key_buf2rsa_raw((unsigned char*)ldns_buffer_begin(key), + ldns_buffer_position(key)); +} + +RSA * +ldns_key_buf2rsa_raw(unsigned char* key, size_t len) +{ + uint16_t offset; + uint16_t exp; + uint16_t int16; + RSA *rsa; + BIGNUM *modulus; + BIGNUM *exponent; + + if (len == 0) + return NULL; + if (key[0] == 0) { + if(len < 3) + return NULL; + /* need some smart comment here XXX*/ + /* the exponent is too large so it's places + * futher...???? */ + memmove(&int16, key+1, 2); + exp = ntohs(int16); + offset = 3; + } else { + exp = key[0]; + offset = 1; + } + + /* key length at least one */ + if(len < (size_t)offset + exp + 1) + return NULL; + + /* Exponent */ + exponent = BN_new(); + if(!exponent) return NULL; + (void) BN_bin2bn(key+offset, (int)exp, exponent); + offset += exp; + + /* Modulus */ + modulus = BN_new(); + if(!modulus) { + BN_free(exponent); + return NULL; + } + /* length of the buffer must match the key length! */ + (void) BN_bin2bn(key+offset, (int)(len - offset), modulus); + + rsa = RSA_new(); + if(!rsa) { + BN_free(exponent); + BN_free(modulus); + return NULL; + } +#ifndef S_SPLINT_S + rsa->n = modulus; + rsa->e = exponent; +#endif /* splint */ + + return rsa; +} + +int +ldns_digest_evp(unsigned char* data, unsigned int len, unsigned char* dest, + const EVP_MD* md) +{ + EVP_MD_CTX* ctx; + ctx = EVP_MD_CTX_create(); + if(!ctx) + return false; + if(!EVP_DigestInit_ex(ctx, md, NULL) || + !EVP_DigestUpdate(ctx, data, len) || + !EVP_DigestFinal_ex(ctx, dest, NULL)) { + EVP_MD_CTX_destroy(ctx); + return false; + } + EVP_MD_CTX_destroy(ctx); + return true; +} +#endif /* HAVE_SSL */ + +ldns_rr * +ldns_key_rr2ds(const ldns_rr *key, ldns_hash h) +{ + ldns_rdf *tmp; + ldns_rr *ds; + uint16_t keytag; + uint8_t sha1hash; + uint8_t *digest; + ldns_buffer *data_buf; +#ifdef USE_GOST + const EVP_MD* md = NULL; +#endif + + if (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY) { + return NULL; + } + + ds = ldns_rr_new(); + if (!ds) { + return NULL; + } + ldns_rr_set_type(ds, LDNS_RR_TYPE_DS); + ldns_rr_set_owner(ds, ldns_rdf_clone( + ldns_rr_owner(key))); + ldns_rr_set_ttl(ds, ldns_rr_ttl(key)); + ldns_rr_set_class(ds, ldns_rr_get_class(key)); + + switch(h) { + default: + case LDNS_SHA1: + digest = LDNS_XMALLOC(uint8_t, LDNS_SHA1_DIGEST_LENGTH); + if (!digest) { + ldns_rr_free(ds); + return NULL; + } + break; + case LDNS_SHA256: + digest = LDNS_XMALLOC(uint8_t, LDNS_SHA256_DIGEST_LENGTH); + if (!digest) { + ldns_rr_free(ds); + return NULL; + } + break; + case LDNS_HASH_GOST: +#ifdef USE_GOST + (void)ldns_key_EVP_load_gost_id(); + md = EVP_get_digestbyname("md_gost94"); + if(!md) { + ldns_rr_free(ds); + return NULL; + } + digest = LDNS_XMALLOC(uint8_t, EVP_MD_size(md)); + if (!digest) { + ldns_rr_free(ds); + return NULL; + } + break; +#else + /* not implemented */ + ldns_rr_free(ds); + return NULL; +#endif +#ifdef USE_ECDSA + case LDNS_SHA384: + digest = LDNS_XMALLOC(uint8_t, SHA384_DIGEST_LENGTH); + if (!digest) { + ldns_rr_free(ds); + return NULL; + } + break; +#else + /* not implemented */ + ldns_rr_free(ds); + return NULL; +#endif + } + + data_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if (!data_buf) { + LDNS_FREE(digest); + ldns_rr_free(ds); + return NULL; + } + + /* keytag */ + keytag = htons(ldns_calc_keytag((ldns_rr*)key)); + tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT16, + sizeof(uint16_t), + &keytag); + ldns_rr_push_rdf(ds, tmp); + + /* copy the algorithm field */ + ldns_rr_push_rdf(ds, ldns_rdf_clone( ldns_rr_rdf(key, 2))); + + /* digest hash type */ + sha1hash = (uint8_t)h; + tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT8, + sizeof(uint8_t), + &sha1hash); + ldns_rr_push_rdf(ds, tmp); + + /* digest */ + /* owner name */ + tmp = ldns_rdf_clone(ldns_rr_owner(key)); + ldns_dname2canonical(tmp); + if (ldns_rdf2buffer_wire(data_buf, tmp) != LDNS_STATUS_OK) { + LDNS_FREE(digest); + ldns_buffer_free(data_buf); + ldns_rr_free(ds); + ldns_rdf_deep_free(tmp); + return NULL; + } + ldns_rdf_deep_free(tmp); + + /* all the rdata's */ + if (ldns_rr_rdata2buffer_wire(data_buf, + (ldns_rr*)key) != LDNS_STATUS_OK) { + LDNS_FREE(digest); + ldns_buffer_free(data_buf); + ldns_rr_free(ds); + return NULL; + } + switch(h) { + case LDNS_SHA1: + (void) ldns_sha1((unsigned char *) ldns_buffer_begin(data_buf), + (unsigned int) ldns_buffer_position(data_buf), + (unsigned char *) digest); + + tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, + LDNS_SHA1_DIGEST_LENGTH, + digest); + ldns_rr_push_rdf(ds, tmp); + + break; + case LDNS_SHA256: + (void) ldns_sha256((unsigned char *) ldns_buffer_begin(data_buf), + (unsigned int) ldns_buffer_position(data_buf), + (unsigned char *) digest); + tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, + LDNS_SHA256_DIGEST_LENGTH, + digest); + ldns_rr_push_rdf(ds, tmp); + break; + case LDNS_HASH_GOST: +#ifdef USE_GOST + if(!ldns_digest_evp((unsigned char *) ldns_buffer_begin(data_buf), + (unsigned int) ldns_buffer_position(data_buf), + (unsigned char *) digest, md)) { + LDNS_FREE(digest); + ldns_buffer_free(data_buf); + ldns_rr_free(ds); + return NULL; + } + tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, + (size_t)EVP_MD_size(md), + digest); + ldns_rr_push_rdf(ds, tmp); +#endif + break; +#ifdef USE_ECDSA + case LDNS_SHA384: + (void) SHA384((unsigned char *) ldns_buffer_begin(data_buf), + (unsigned int) ldns_buffer_position(data_buf), + (unsigned char *) digest); + tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, + SHA384_DIGEST_LENGTH, + digest); + ldns_rr_push_rdf(ds, tmp); + break; +#endif + } + + LDNS_FREE(digest); + ldns_buffer_free(data_buf); + return ds; +} + +ldns_rdf * +ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[], + size_t size, + ldns_rr_type nsec_type) +{ + size_t i; + uint8_t *bitmap; + uint16_t bm_len = 0; + uint16_t i_type; + ldns_rdf *bitmap_rdf; + + uint8_t *data = NULL; + uint8_t cur_data[32]; + uint8_t cur_window = 0; + uint8_t cur_window_max = 0; + uint16_t cur_data_size = 0; + + if (nsec_type != LDNS_RR_TYPE_NSEC && + nsec_type != LDNS_RR_TYPE_NSEC3) { + return NULL; + } + + i_type = 0; + for (i = 0; i < size; i++) { + if (i_type < rr_type_list[i]) + i_type = rr_type_list[i]; + } + if (i_type < nsec_type) { + i_type = nsec_type; + } + + bm_len = i_type / 8 + 2; + bitmap = LDNS_XMALLOC(uint8_t, bm_len); + if(!bitmap) return NULL; + for (i = 0; i < bm_len; i++) { + bitmap[i] = 0; + } + + for (i = 0; i < size; i++) { + i_type = rr_type_list[i]; + ldns_set_bit(bitmap + (int) i_type / 8, + (int) (7 - (i_type % 8)), + true); + } + + /* fold it into windows TODO: can this be done directly? */ + memset(cur_data, 0, 32); + for (i = 0; i < bm_len; i++) { + if (i / 32 > cur_window) { + /* check, copy, new */ + if (cur_window_max > 0) { + /* this window has stuff, add it */ + data = LDNS_XREALLOC(data, + uint8_t, + cur_data_size + cur_window_max + 3); + if(!data) { + LDNS_FREE(bitmap); + return NULL; + } + data[cur_data_size] = cur_window; + data[cur_data_size + 1] = cur_window_max + 1; + memcpy(data + cur_data_size + 2, + cur_data, + cur_window_max+1); + cur_data_size += cur_window_max + 3; + } + cur_window++; + cur_window_max = 0; + memset(cur_data, 0, 32); + } + cur_data[i%32] = bitmap[i]; + if (bitmap[i] > 0) { + cur_window_max = i%32; + } + } + if (cur_window_max > 0 || cur_data[0] != 0) { + /* this window has stuff, add it */ + data = LDNS_XREALLOC(data, + uint8_t, + cur_data_size + cur_window_max + 3); + if(!data) { + LDNS_FREE(bitmap); + return NULL; + } + data[cur_data_size] = cur_window; + data[cur_data_size + 1] = cur_window_max + 1; + memcpy(data + cur_data_size + 2, cur_data, cur_window_max+1); + cur_data_size += cur_window_max + 3; + } + + bitmap_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC, + cur_data_size, + data); + + LDNS_FREE(bitmap); + LDNS_FREE(data); + + return bitmap_rdf; +} + +int +ldns_dnssec_rrsets_contains_type(ldns_dnssec_rrsets *rrsets, + ldns_rr_type type) +{ + ldns_dnssec_rrsets *cur_rrset = rrsets; + while (cur_rrset) { + if (cur_rrset->type == type) { + return 1; + } + cur_rrset = cur_rrset->next; + } + return 0; +} + +/* returns true if the current dnssec_rrset from the given list of rrsets + * is glue */ +static int +is_glue(ldns_dnssec_rrsets *cur_rrsets, ldns_dnssec_rrsets *orig_rrsets) +{ + /* only glue if a or aaaa if there are no ns, unless there is soa */ + return (cur_rrsets->type == LDNS_RR_TYPE_A || + cur_rrsets->type == LDNS_RR_TYPE_AAAA) && + (ldns_dnssec_rrsets_contains_type(orig_rrsets, + LDNS_RR_TYPE_NS) && + !ldns_dnssec_rrsets_contains_type(orig_rrsets, + LDNS_RR_TYPE_SOA)); +} + +ldns_rr * +ldns_dnssec_create_nsec(ldns_dnssec_name *from, + ldns_dnssec_name *to, + ldns_rr_type nsec_type) +{ + ldns_rr *nsec_rr; + ldns_rr_type types[65536]; + size_t type_count = 0; + ldns_dnssec_rrsets *cur_rrsets; + + if (!from || !to || (nsec_type != LDNS_RR_TYPE_NSEC && + nsec_type != LDNS_RR_TYPE_NSEC3)) { + return NULL; + } + + nsec_rr = ldns_rr_new(); + ldns_rr_set_type(nsec_rr, nsec_type); + ldns_rr_set_owner(nsec_rr, ldns_rdf_clone(ldns_dnssec_name_name(from))); + ldns_rr_push_rdf(nsec_rr, ldns_rdf_clone(ldns_dnssec_name_name(to))); + + cur_rrsets = from->rrsets; + while (cur_rrsets) { + if (is_glue(cur_rrsets, from->rrsets)) { + cur_rrsets = cur_rrsets->next; + continue; + } + if (cur_rrsets->type != LDNS_RR_TYPE_RRSIG && + cur_rrsets->type != LDNS_RR_TYPE_NSEC) { + types[type_count] = cur_rrsets->type; + type_count++; + } + cur_rrsets = cur_rrsets->next; + + } + types[type_count] = LDNS_RR_TYPE_RRSIG; + type_count++; + types[type_count] = LDNS_RR_TYPE_NSEC; + type_count++; + + ldns_rr_push_rdf(nsec_rr, ldns_dnssec_create_nsec_bitmap(types, + type_count, + nsec_type)); + + return nsec_rr; +} + +ldns_rr * +ldns_dnssec_create_nsec3(ldns_dnssec_name *from, + ldns_dnssec_name *to, + ldns_rdf *zone_name, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt) +{ + ldns_rr *nsec_rr; + ldns_rr_type types[65536]; + size_t type_count = 0; + ldns_dnssec_rrsets *cur_rrsets; + ldns_status status; + + flags = flags; + + if (!from) { + return NULL; + } + + nsec_rr = ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3); + ldns_rr_set_owner(nsec_rr, + ldns_nsec3_hash_name(ldns_dnssec_name_name(from), + algorithm, + iterations, + salt_length, + salt)); + status = ldns_dname_cat(ldns_rr_owner(nsec_rr), zone_name); + if(status != LDNS_STATUS_OK) { + ldns_rr_free(nsec_rr); + return NULL; + } + ldns_nsec3_add_param_rdfs(nsec_rr, + algorithm, + flags, + iterations, + salt_length, + salt); + + cur_rrsets = from->rrsets; + while (cur_rrsets) { + if (is_glue(cur_rrsets, from->rrsets)) { + cur_rrsets = cur_rrsets->next; + continue; + } + if (cur_rrsets->type != LDNS_RR_TYPE_RRSIG) { + types[type_count] = cur_rrsets->type; + type_count++; + } + cur_rrsets = cur_rrsets->next; + } + /* always add rrsig type if this is not an unsigned + * delegation + */ + if (type_count > 0 && + !(type_count == 1 && types[0] == LDNS_RR_TYPE_NS)) { + types[type_count] = LDNS_RR_TYPE_RRSIG; + type_count++; + } + + /* leave next rdata empty if they weren't precomputed yet */ + if (to && to->hashed_name) { + (void) ldns_rr_set_rdf(nsec_rr, + ldns_rdf_clone(to->hashed_name), + 4); + } else { + (void) ldns_rr_set_rdf(nsec_rr, NULL, 4); + } + + ldns_rr_push_rdf(nsec_rr, + ldns_dnssec_create_nsec_bitmap(types, + type_count, + LDNS_RR_TYPE_NSEC3)); + + return nsec_rr; +} + +ldns_rr * +ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs) +{ + /* we do not do any check here - garbage in, garbage out */ + + /* the the start and end names - get the type from the + * before rrlist */ + + /* inefficient, just give it a name, a next name, and a list of rrs */ + /* we make 1 big uberbitmap first, then windows */ + /* todo: make something more efficient :) */ + uint16_t i; + ldns_rr *i_rr; + uint16_t i_type; + + ldns_rr *nsec = NULL; + ldns_rr_type i_type_list[65536]; + size_t type_count = 0; + + nsec = ldns_rr_new(); + ldns_rr_set_type(nsec, LDNS_RR_TYPE_NSEC); + ldns_rr_set_owner(nsec, ldns_rdf_clone(cur_owner)); + ldns_rr_push_rdf(nsec, ldns_rdf_clone(next_owner)); + + for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + i_rr = ldns_rr_list_rr(rrs, i); + if (ldns_rdf_compare(cur_owner, + ldns_rr_owner(i_rr)) == 0) { + i_type = ldns_rr_get_type(i_rr); + if (i_type != LDNS_RR_TYPE_RRSIG && i_type != LDNS_RR_TYPE_NSEC) { + if (type_count == 0 || i_type_list[type_count-1] != i_type) { + i_type_list[type_count] = i_type; + type_count++; + } + } + } + } + + i_type_list[type_count] = LDNS_RR_TYPE_RRSIG; + type_count++; + i_type_list[type_count] = LDNS_RR_TYPE_NSEC; + type_count++; + + ldns_rr_push_rdf(nsec, + ldns_dnssec_create_nsec_bitmap(i_type_list, + type_count, LDNS_RR_TYPE_NSEC)); + + return nsec; +} + +ldns_rdf * +ldns_nsec3_hash_name(ldns_rdf *name, + uint8_t algorithm, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt) +{ + size_t hashed_owner_str_len; + ldns_rdf *cann; + ldns_rdf *hashed_owner; + unsigned char *hashed_owner_str; + char *hashed_owner_b32; + size_t hashed_owner_b32_len; + uint32_t cur_it; + /* define to contain the largest possible hash, which is + * sha1 at the moment */ + unsigned char hash[LDNS_SHA1_DIGEST_LENGTH]; + ldns_status status; + + /* TODO: mnemonic list for hash algs SHA-1, default to 1 now (sha1) */ + if (algorithm != LDNS_SHA1) { + return NULL; + } + + /* prepare the owner name according to the draft section bla */ + cann = ldns_rdf_clone(name); + if(!cann) { + fprintf(stderr, "Memory error\n"); + return NULL; + } + ldns_dname2canonical(cann); + + hashed_owner_str_len = salt_length + ldns_rdf_size(cann); + hashed_owner_str = LDNS_XMALLOC(unsigned char, hashed_owner_str_len); + if(!hashed_owner_str) { + ldns_rdf_deep_free(cann); + return NULL; + } + memcpy(hashed_owner_str, ldns_rdf_data(cann), ldns_rdf_size(cann)); + memcpy(hashed_owner_str + ldns_rdf_size(cann), salt, salt_length); + ldns_rdf_deep_free(cann); + + for (cur_it = iterations + 1; cur_it > 0; cur_it--) { + (void) ldns_sha1((unsigned char *) hashed_owner_str, + (unsigned int) hashed_owner_str_len, hash); + + LDNS_FREE(hashed_owner_str); + hashed_owner_str_len = salt_length + LDNS_SHA1_DIGEST_LENGTH; + hashed_owner_str = LDNS_XMALLOC(unsigned char, hashed_owner_str_len); + if (!hashed_owner_str) { + return NULL; + } + memcpy(hashed_owner_str, hash, LDNS_SHA1_DIGEST_LENGTH); + memcpy(hashed_owner_str + LDNS_SHA1_DIGEST_LENGTH, salt, salt_length); + hashed_owner_str_len = LDNS_SHA1_DIGEST_LENGTH + salt_length; + } + + LDNS_FREE(hashed_owner_str); + hashed_owner_str = hash; + hashed_owner_str_len = LDNS_SHA1_DIGEST_LENGTH; + + hashed_owner_b32 = LDNS_XMALLOC(char, + ldns_b32_ntop_calculate_size(hashed_owner_str_len) + 1); + if(!hashed_owner_b32) { + return NULL; + } + hashed_owner_b32_len = (size_t) ldns_b32_ntop_extended_hex( + (uint8_t *) hashed_owner_str, + hashed_owner_str_len, + hashed_owner_b32, + ldns_b32_ntop_calculate_size(hashed_owner_str_len)+1); + if (hashed_owner_b32_len < 1) { + fprintf(stderr, "Error in base32 extended hex encoding "); + fprintf(stderr, "of hashed owner name (name: "); + ldns_rdf_print(stderr, name); + fprintf(stderr, ", return code: %u)\n", + (unsigned int) hashed_owner_b32_len); + LDNS_FREE(hashed_owner_b32); + return NULL; + } + hashed_owner_b32[hashed_owner_b32_len] = '\0'; + + status = ldns_str2rdf_dname(&hashed_owner, hashed_owner_b32); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error creating rdf from %s\n", hashed_owner_b32); + LDNS_FREE(hashed_owner_b32); + return NULL; + } + + LDNS_FREE(hashed_owner_b32); + return hashed_owner; +} + +void +ldns_nsec3_add_param_rdfs(ldns_rr *rr, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt) +{ + ldns_rdf *salt_rdf = NULL; + uint8_t *salt_data = NULL; + ldns_rdf *old; + + old = ldns_rr_set_rdf(rr, + ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT8, + 1, (void*)&algorithm), + 0); + if (old) ldns_rdf_deep_free(old); + + old = ldns_rr_set_rdf(rr, + ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT8, + 1, (void*)&flags), + 1); + if (old) ldns_rdf_deep_free(old); + + old = ldns_rr_set_rdf(rr, + ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, + iterations), + 2); + if (old) ldns_rdf_deep_free(old); + + salt_data = LDNS_XMALLOC(uint8_t, salt_length + 1); + if(!salt_data) { + /* no way to return error */ + return; + } + salt_data[0] = salt_length; + memcpy(salt_data + 1, salt, salt_length); + salt_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC3_SALT, + salt_length + 1, + salt_data); + if(!salt_rdf) { + LDNS_FREE(salt_data); + /* no way to return error */ + return; + } + + old = ldns_rr_set_rdf(rr, salt_rdf, 3); + if (old) ldns_rdf_deep_free(old); + LDNS_FREE(salt_data); +} + +static int +rr_list_delegation_only(ldns_rdf *origin, ldns_rr_list *rr_list) +{ + size_t i; + ldns_rr *cur_rr; + if (!origin || !rr_list) return 0; + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + cur_rr = ldns_rr_list_rr(rr_list, i); + if (ldns_dname_compare(ldns_rr_owner(cur_rr), origin) == 0) { + return 0; + } + if (ldns_rr_get_type(cur_rr) != LDNS_RR_TYPE_NS) { + return 0; + } + } + return 1; +} + +/* this will NOT return the NSEC3 completed, you will have to run the + finalize function on the rrlist later! */ +ldns_rr * +ldns_create_nsec3(ldns_rdf *cur_owner, + ldns_rdf *cur_zone, + ldns_rr_list *rrs, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt, + bool emptynonterminal) +{ + size_t i; + ldns_rr *i_rr; + uint16_t i_type; + + ldns_rr *nsec = NULL; + ldns_rdf *hashed_owner = NULL; + + ldns_status status; + + ldns_rr_type i_type_list[1024]; + size_t type_count = 0; + + hashed_owner = ldns_nsec3_hash_name(cur_owner, + algorithm, + iterations, + salt_length, + salt); + status = ldns_dname_cat(hashed_owner, cur_zone); + if(status != LDNS_STATUS_OK) + return NULL; + + nsec = ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3); + if(!nsec) + return NULL; + ldns_rr_set_type(nsec, LDNS_RR_TYPE_NSEC3); + ldns_rr_set_owner(nsec, hashed_owner); + + ldns_nsec3_add_param_rdfs(nsec, + algorithm, + flags, + iterations, + salt_length, + salt); + (void) ldns_rr_set_rdf(nsec, NULL, 4); + + + for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + i_rr = ldns_rr_list_rr(rrs, i); + if (ldns_rdf_compare(cur_owner, + ldns_rr_owner(i_rr)) == 0) { + i_type = ldns_rr_get_type(i_rr); + if (type_count == 0 || i_type_list[type_count-1] != i_type) { + i_type_list[type_count] = i_type; + type_count++; + } + } + } + + /* add RRSIG anyway, but only if this is not an ENT or + * an unsigned delegation */ + if (!emptynonterminal && !rr_list_delegation_only(cur_zone, rrs)) { + i_type_list[type_count] = LDNS_RR_TYPE_RRSIG; + type_count++; + } + + /* and SOA if owner == zone */ + if (ldns_dname_compare(cur_zone, cur_owner) == 0) { + i_type_list[type_count] = LDNS_RR_TYPE_SOA; + type_count++; + } + + ldns_rr_push_rdf(nsec, + ldns_dnssec_create_nsec_bitmap(i_type_list, + type_count, LDNS_RR_TYPE_NSEC3)); + + return nsec; +} + +uint8_t +ldns_nsec3_algorithm(const ldns_rr *nsec3_rr) +{ + if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 && + ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 0)) > 0 + ) { + return ldns_rdf2native_int8(ldns_rr_rdf(nsec3_rr, 0)); + } + return 0; +} + +uint8_t +ldns_nsec3_flags(const ldns_rr *nsec3_rr) +{ + if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 && + ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 1)) > 0 + ) { + return ldns_rdf2native_int8(ldns_rr_rdf(nsec3_rr, 1)); + } + return 0; +} + +bool +ldns_nsec3_optout(const ldns_rr *nsec3_rr) +{ + return (ldns_nsec3_flags(nsec3_rr) & LDNS_NSEC3_VARS_OPTOUT_MASK); +} + +uint16_t +ldns_nsec3_iterations(const ldns_rr *nsec3_rr) +{ + if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 && + ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 2)) > 0 + ) { + return ldns_rdf2native_int16(ldns_rr_rdf(nsec3_rr, 2)); + } + return 0; + +} + +ldns_rdf * +ldns_nsec3_salt(const ldns_rr *nsec3_rr) +{ + if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3) { + return ldns_rr_rdf(nsec3_rr, 3); + } + return NULL; +} + +uint8_t +ldns_nsec3_salt_length(const ldns_rr *nsec3_rr) +{ + ldns_rdf *salt_rdf = ldns_nsec3_salt(nsec3_rr); + if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) { + return (uint8_t) ldns_rdf_data(salt_rdf)[0]; + } + return 0; +} + +/* allocs data, free with LDNS_FREE() */ +uint8_t * +ldns_nsec3_salt_data(const ldns_rr *nsec3_rr) +{ + uint8_t salt_length; + uint8_t *salt; + + ldns_rdf *salt_rdf = ldns_nsec3_salt(nsec3_rr); + if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) { + salt_length = ldns_rdf_data(salt_rdf)[0]; + salt = LDNS_XMALLOC(uint8_t, salt_length); + if(!salt) return NULL; + memcpy(salt, &ldns_rdf_data(salt_rdf)[1], salt_length); + return salt; + } + return NULL; +} + +ldns_rdf * +ldns_nsec3_next_owner(const ldns_rr *nsec3_rr) +{ + if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) { + return NULL; + } else { + return ldns_rr_rdf(nsec3_rr, 4); + } +} + +ldns_rdf * +ldns_nsec3_bitmap(const ldns_rr *nsec3_rr) +{ + if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) { + return NULL; + } else { + return ldns_rr_rdf(nsec3_rr, 5); + } +} + +ldns_rdf * +ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name) +{ + uint8_t algorithm; + uint16_t iterations; + uint8_t salt_length; + uint8_t *salt = 0; + + ldns_rdf *hashed_owner; + + algorithm = ldns_nsec3_algorithm(nsec); + salt_length = ldns_nsec3_salt_length(nsec); + salt = ldns_nsec3_salt_data(nsec); + iterations = ldns_nsec3_iterations(nsec); + + hashed_owner = ldns_nsec3_hash_name(name, + algorithm, + iterations, + salt_length, + salt); + + LDNS_FREE(salt); + return hashed_owner; +} + +bool +ldns_nsec_bitmap_covers_type(const ldns_rdf *nsec_bitmap, ldns_rr_type type) +{ + uint8_t window_block_nr; + uint8_t bitmap_length; + uint16_t cur_type; + uint16_t pos = 0; + uint16_t bit_pos; + uint8_t *data = ldns_rdf_data(nsec_bitmap); + + while(pos < ldns_rdf_size(nsec_bitmap)) { + window_block_nr = data[pos]; + bitmap_length = data[pos + 1]; + pos += 2; + + for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { + if (ldns_get_bit(&data[pos], bit_pos)) { + cur_type = 256 * (uint16_t) window_block_nr + bit_pos; + if (cur_type == type) { + return true; + } + } + } + + pos += (uint16_t) bitmap_length; + } + return false; +} + +bool +ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name) +{ + ldns_rdf *nsec_owner = ldns_rr_owner(nsec); + ldns_rdf *hash_next; + char *next_hash_str; + ldns_rdf *nsec_next = NULL; + ldns_status status; + ldns_rdf *chopped_dname; + bool result; + + if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC) { + nsec_next = ldns_rdf_clone(ldns_rr_rdf(nsec, 0)); + } else if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC3) { + hash_next = ldns_nsec3_next_owner(nsec); + next_hash_str = ldns_rdf2str(hash_next); + nsec_next = ldns_dname_new_frm_str(next_hash_str); + LDNS_FREE(next_hash_str); + chopped_dname = ldns_dname_left_chop(nsec_owner); + status = ldns_dname_cat(nsec_next, chopped_dname); + ldns_rdf_deep_free(chopped_dname); + if (status != LDNS_STATUS_OK) { + printf("error catting: %s\n", ldns_get_errorstr_by_id(status)); + } + } else { + ldns_rdf_deep_free(nsec_next); + return false; + } + + /* in the case of the last nsec */ + if(ldns_dname_compare(nsec_owner, nsec_next) > 0) { + result = (ldns_dname_compare(nsec_owner, name) <= 0 || + ldns_dname_compare(name, nsec_next) < 0); + } else { + result = (ldns_dname_compare(nsec_owner, name) <= 0 && + ldns_dname_compare(name, nsec_next) < 0); + } + + ldns_rdf_deep_free(nsec_next); + return result; +} + +#ifdef HAVE_SSL +/* sig may be null - if so look in the packet */ +ldns_status +ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, + ldns_rr_list *k, ldns_rr_list *s, ldns_rr_list *good_keys) +{ + ldns_rr_list *rrset; + ldns_rr_list *sigs; + ldns_rr_list *sigs_covered; + ldns_rdf *rdf_t; + ldns_rr_type t_netorder; + + if (!k) { + return LDNS_STATUS_ERR; + /* return LDNS_STATUS_CRYPTO_NO_DNSKEY; */ + } + + if (t == LDNS_RR_TYPE_RRSIG) { + /* we don't have RRSIG(RRSIG) (yet? ;-) ) */ + return LDNS_STATUS_ERR; + } + + if (s) { + /* if s is not NULL, the sigs are given to use */ + sigs = s; + } else { + /* otherwise get them from the packet */ + sigs = ldns_pkt_rr_list_by_name_and_type(p, o, LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_ANY_NOQUESTION); + if (!sigs) { + /* no sigs */ + return LDNS_STATUS_ERR; + /* return LDNS_STATUS_CRYPTO_NO_RRSIG; */ + } + } + + /* rrsig are subtyped, so now we need to find the correct + * sigs for the type t + */ + t_netorder = htons(t); /* rdf are in network order! */ + /* a type identifier is a 16-bit number, so the size is 2 bytes */ + rdf_t = ldns_rdf_new(LDNS_RDF_TYPE_TYPE, + 2, + &t_netorder); + sigs_covered = ldns_rr_list_subtype_by_rdf(sigs, rdf_t, 0); + + rrset = ldns_pkt_rr_list_by_name_and_type(p, + o, + t, + LDNS_SECTION_ANY_NOQUESTION); + + if (!rrset) { + return LDNS_STATUS_ERR; + } + + if (!sigs_covered) { + return LDNS_STATUS_ERR; + } + + return ldns_verify(rrset, sigs, k, good_keys); +} +#endif /* HAVE_SSL */ + +ldns_status +ldns_dnssec_chain_nsec3_list(ldns_rr_list *nsec3_rrs) +{ + size_t i; + char *next_nsec_owner_str; + ldns_rdf *next_nsec_owner_label; + ldns_rdf *next_nsec_rdf; + ldns_status status = LDNS_STATUS_OK; + + for (i = 0; i < ldns_rr_list_rr_count(nsec3_rrs); i++) { + if (i == ldns_rr_list_rr_count(nsec3_rrs) - 1) { + next_nsec_owner_label = + ldns_dname_label(ldns_rr_owner(ldns_rr_list_rr(nsec3_rrs, + 0)), 0); + next_nsec_owner_str = ldns_rdf2str(next_nsec_owner_label); + if (next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] + == '.') { + next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] + = '\0'; + } + status = ldns_str2rdf_b32_ext(&next_nsec_rdf, + next_nsec_owner_str); + if (!ldns_rr_set_rdf(ldns_rr_list_rr(nsec3_rrs, i), + next_nsec_rdf, 4)) { + /* todo: error */ + } + + ldns_rdf_deep_free(next_nsec_owner_label); + LDNS_FREE(next_nsec_owner_str); + } else { + next_nsec_owner_label = + ldns_dname_label(ldns_rr_owner(ldns_rr_list_rr(nsec3_rrs, + i + 1)), + 0); + next_nsec_owner_str = ldns_rdf2str(next_nsec_owner_label); + if (next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] + == '.') { + next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] + = '\0'; + } + status = ldns_str2rdf_b32_ext(&next_nsec_rdf, + next_nsec_owner_str); + ldns_rdf_deep_free(next_nsec_owner_label); + LDNS_FREE(next_nsec_owner_str); + if (!ldns_rr_set_rdf(ldns_rr_list_rr(nsec3_rrs, i), + next_nsec_rdf, 4)) { + /* todo: error */ + } + } + } + return status; +} + +int +qsort_rr_compare_nsec3(const void *a, const void *b) +{ + const ldns_rr *rr1 = * (const ldns_rr **) a; + const ldns_rr *rr2 = * (const ldns_rr **) b; + if (rr1 == NULL && rr2 == NULL) { + return 0; + } + if (rr1 == NULL) { + return -1; + } + if (rr2 == NULL) { + return 1; + } + return ldns_rdf_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)); +} + +void +ldns_rr_list_sort_nsec3(ldns_rr_list *unsorted) +{ + qsort(unsorted->_rrs, + ldns_rr_list_rr_count(unsorted), + sizeof(ldns_rr *), + qsort_rr_compare_nsec3); +} + +int +ldns_dnssec_default_add_to_signatures(ldns_rr *sig, void *n) +{ + sig = sig; + n = n; + return LDNS_SIGNATURE_LEAVE_ADD_NEW; +} + +int +ldns_dnssec_default_leave_signatures(ldns_rr *sig, void *n) +{ + sig = sig; + n = n; + return LDNS_SIGNATURE_LEAVE_NO_ADD; +} + +int +ldns_dnssec_default_delete_signatures(ldns_rr *sig, void *n) +{ + sig = sig; + n = n; + return LDNS_SIGNATURE_REMOVE_NO_ADD; +} + +int +ldns_dnssec_default_replace_signatures(ldns_rr *sig, void *n) +{ + sig = sig; + n = n; + return LDNS_SIGNATURE_REMOVE_ADD_NEW; +} + +#ifdef HAVE_SSL +ldns_rdf * +ldns_convert_dsa_rrsig_asn12rdf(const ldns_buffer *sig, + const long sig_len) +{ + ldns_rdf *sigdata_rdf; + DSA_SIG *dsasig; + unsigned char *dsasig_data = (unsigned char*)ldns_buffer_begin(sig); + size_t byte_offset; + + dsasig = d2i_DSA_SIG(NULL, + (const unsigned char **)&dsasig_data, + sig_len); + if (!dsasig) { + DSA_SIG_free(dsasig); + return NULL; + } + + dsasig_data = LDNS_XMALLOC(unsigned char, 41); + if(!dsasig_data) { + DSA_SIG_free(dsasig); + return NULL; + } + dsasig_data[0] = 0; + byte_offset = (size_t) (20 - BN_num_bytes(dsasig->r)); + if (byte_offset > 20) { + DSA_SIG_free(dsasig); + LDNS_FREE(dsasig_data); + return NULL; + } + memset(&dsasig_data[1], 0, byte_offset); + BN_bn2bin(dsasig->r, &dsasig_data[1 + byte_offset]); + byte_offset = (size_t) (20 - BN_num_bytes(dsasig->s)); + if (byte_offset > 20) { + DSA_SIG_free(dsasig); + LDNS_FREE(dsasig_data); + return NULL; + } + memset(&dsasig_data[21], 0, byte_offset); + BN_bn2bin(dsasig->s, &dsasig_data[21 + byte_offset]); + + sigdata_rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, 41, dsasig_data); + if(!sigdata_rdf) { + LDNS_FREE(dsasig_data); + } + DSA_SIG_free(dsasig); + + return sigdata_rdf; +} + +ldns_status +ldns_convert_dsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, + const ldns_rdf *sig_rdf) +{ + /* the EVP api wants the DER encoding of the signature... */ + BIGNUM *R, *S; + DSA_SIG *dsasig; + unsigned char *raw_sig = NULL; + int raw_sig_len; + + if(ldns_rdf_size(sig_rdf) < 1 + 2*SHA_DIGEST_LENGTH) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + /* extract the R and S field from the sig buffer */ + R = BN_new(); + if(!R) return LDNS_STATUS_MEM_ERR; + (void) BN_bin2bn((unsigned char *) ldns_rdf_data(sig_rdf) + 1, + SHA_DIGEST_LENGTH, R); + S = BN_new(); + if(!S) { + BN_free(R); + return LDNS_STATUS_MEM_ERR; + } + (void) BN_bin2bn((unsigned char *) ldns_rdf_data(sig_rdf) + 21, + SHA_DIGEST_LENGTH, S); + + dsasig = DSA_SIG_new(); + if (!dsasig) { + BN_free(R); + BN_free(S); + return LDNS_STATUS_MEM_ERR; + } + + dsasig->r = R; + dsasig->s = S; + + raw_sig_len = i2d_DSA_SIG(dsasig, &raw_sig); + if (raw_sig_len < 0) { + DSA_SIG_free(dsasig); + free(raw_sig); + return LDNS_STATUS_SSL_ERR; + } + if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) { + ldns_buffer_write(target_buffer, raw_sig, (size_t)raw_sig_len); + } + + DSA_SIG_free(dsasig); + free(raw_sig); + + return ldns_buffer_status(target_buffer); +} + +#ifdef USE_ECDSA +#ifndef S_SPLINT_S +ldns_rdf * +ldns_convert_ecdsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len) +{ + ECDSA_SIG* ecdsa_sig; + unsigned char *data = (unsigned char*)ldns_buffer_begin(sig); + ldns_rdf* rdf; + ecdsa_sig = d2i_ECDSA_SIG(NULL, (const unsigned char **)&data, sig_len); + if(!ecdsa_sig) return NULL; + + /* "r | s". */ + data = LDNS_XMALLOC(unsigned char, + BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s)); + if(!data) { + ECDSA_SIG_free(ecdsa_sig); + return NULL; + } + BN_bn2bin(ecdsa_sig->r, data); + BN_bn2bin(ecdsa_sig->s, data+BN_num_bytes(ecdsa_sig->r)); + rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, (size_t)( + BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s)), data); + ECDSA_SIG_free(ecdsa_sig); + return rdf; +} + +ldns_status +ldns_convert_ecdsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, + const ldns_rdf *sig_rdf) +{ + ECDSA_SIG* sig; + int raw_sig_len; + long bnsize = (long)ldns_rdf_size(sig_rdf) / 2; + /* if too short, or not even length, do not bother */ + if(bnsize < 16 || (size_t)bnsize*2 != ldns_rdf_size(sig_rdf)) + return LDNS_STATUS_ERR; + + /* use the raw data to parse two evenly long BIGNUMs, "r | s". */ + sig = ECDSA_SIG_new(); + if(!sig) return LDNS_STATUS_MEM_ERR; + sig->r = BN_bin2bn((const unsigned char*)ldns_rdf_data(sig_rdf), + bnsize, sig->r); + sig->s = BN_bin2bn((const unsigned char*)ldns_rdf_data(sig_rdf)+bnsize, + bnsize, sig->s); + if(!sig->r || !sig->s) { + ECDSA_SIG_free(sig); + return LDNS_STATUS_MEM_ERR; + } + + raw_sig_len = i2d_ECDSA_SIG(sig, NULL); + if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) { + unsigned char* pp = (unsigned char*) + ldns_buffer_current(target_buffer); + raw_sig_len = i2d_ECDSA_SIG(sig, &pp); + ldns_buffer_skip(target_buffer, (ssize_t) raw_sig_len); + } + ECDSA_SIG_free(sig); + + return ldns_buffer_status(target_buffer); +} + +#endif /* S_SPLINT_S */ +#endif /* USE_ECDSA */ +#endif /* HAVE_SSL */ diff --git a/libs/ldns/dnssec_sign.c b/libs/ldns/dnssec_sign.c new file mode 100644 index 0000000000..b21094465f --- /dev/null +++ b/libs/ldns/dnssec_sign.c @@ -0,0 +1,1269 @@ +#include + +#include + +#include +#include + +#include +#include + +#ifdef HAVE_SSL +/* this entire file is rather useless when you don't have + * crypto... + */ +#include +#include +#include +#include +#include +#endif /* HAVE_SSL */ + +ldns_rr * +ldns_create_empty_rrsig(ldns_rr_list *rrset, + ldns_key *current_key) +{ + uint32_t orig_ttl; + ldns_rr_class orig_class; + time_t now; + ldns_rr *current_sig; + uint8_t label_count; + + label_count = ldns_dname_label_count(ldns_rr_owner(ldns_rr_list_rr(rrset, + 0))); + /* RFC4035 2.2: not counting the leftmost label if it is a wildcard */ + if(ldns_dname_is_wildcard(ldns_rr_owner(ldns_rr_list_rr(rrset, 0)))) + label_count --; + + current_sig = ldns_rr_new_frm_type(LDNS_RR_TYPE_RRSIG); + + /* set the type on the new signature */ + orig_ttl = ldns_rr_ttl(ldns_rr_list_rr(rrset, 0)); + orig_class = ldns_rr_get_class(ldns_rr_list_rr(rrset, 0)); + + ldns_rr_set_ttl(current_sig, orig_ttl); + ldns_rr_set_class(current_sig, orig_class); + ldns_rr_set_owner(current_sig, + ldns_rdf_clone( + ldns_rr_owner( + ldns_rr_list_rr(rrset, + 0)))); + + /* fill in what we know of the signature */ + + /* set the orig_ttl */ + (void)ldns_rr_rrsig_set_origttl( + current_sig, + ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, + orig_ttl)); + /* the signers name */ + (void)ldns_rr_rrsig_set_signame( + current_sig, + ldns_rdf_clone(ldns_key_pubkey_owner(current_key))); + /* label count - get it from the first rr in the rr_list */ + (void)ldns_rr_rrsig_set_labels( + current_sig, + ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, + label_count)); + /* inception, expiration */ + now = time(NULL); + if (ldns_key_inception(current_key) != 0) { + (void)ldns_rr_rrsig_set_inception( + current_sig, + ldns_native2rdf_int32( + LDNS_RDF_TYPE_TIME, + ldns_key_inception(current_key))); + } else { + (void)ldns_rr_rrsig_set_inception( + current_sig, + ldns_native2rdf_int32(LDNS_RDF_TYPE_TIME, now)); + } + if (ldns_key_expiration(current_key) != 0) { + (void)ldns_rr_rrsig_set_expiration( + current_sig, + ldns_native2rdf_int32( + LDNS_RDF_TYPE_TIME, + ldns_key_expiration(current_key))); + } else { + (void)ldns_rr_rrsig_set_expiration( + current_sig, + ldns_native2rdf_int32( + LDNS_RDF_TYPE_TIME, + now + LDNS_DEFAULT_EXP_TIME)); + } + + (void)ldns_rr_rrsig_set_keytag( + current_sig, + ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, + ldns_key_keytag(current_key))); + + (void)ldns_rr_rrsig_set_algorithm( + current_sig, + ldns_native2rdf_int8( + LDNS_RDF_TYPE_ALG, + ldns_key_algorithm(current_key))); + + (void)ldns_rr_rrsig_set_typecovered( + current_sig, + ldns_native2rdf_int16( + LDNS_RDF_TYPE_TYPE, + ldns_rr_get_type(ldns_rr_list_rr(rrset, + 0)))); + return current_sig; +} + +#ifdef HAVE_SSL +ldns_rdf * +ldns_sign_public_buffer(ldns_buffer *sign_buf, ldns_key *current_key) +{ + ldns_rdf *b64rdf = NULL; + + switch(ldns_key_algorithm(current_key)) { + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_dss1()); + break; + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_sha1()); + break; +#ifdef USE_SHA2 + case LDNS_SIGN_RSASHA256: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_sha256()); + break; + case LDNS_SIGN_RSASHA512: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_sha512()); + break; +#endif /* USE_SHA2 */ +#ifdef USE_GOST + case LDNS_SIGN_ECC_GOST: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_get_digestbyname("md_gost94")); + break; +#endif /* USE_GOST */ +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_sha256()); + break; + case LDNS_SIGN_ECDSAP384SHA384: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_sha384()); + break; +#endif + case LDNS_SIGN_RSAMD5: + b64rdf = ldns_sign_public_evp( + sign_buf, + ldns_key_evp_key(current_key), + EVP_md5()); + break; + default: + /* do _you_ know this alg? */ + printf("unknown algorithm, "); + printf("is the one used available on this system?\n"); + break; + } + + return b64rdf; +} + +/** + * use this function to sign with a public/private key alg + * return the created signatures + */ +ldns_rr_list * +ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys) +{ + ldns_rr_list *signatures; + ldns_rr_list *rrset_clone; + ldns_rr *current_sig; + ldns_rdf *b64rdf; + ldns_key *current_key; + size_t key_count; + uint16_t i; + ldns_buffer *sign_buf; + ldns_rdf *new_owner; + + if (!rrset || ldns_rr_list_rr_count(rrset) < 1 || !keys) { + return NULL; + } + + new_owner = NULL; + + signatures = ldns_rr_list_new(); + + /* prepare a signature and add all the know data + * prepare the rrset. Sign this together. */ + rrset_clone = ldns_rr_list_clone(rrset); + if (!rrset_clone) { + return NULL; + } + + /* make it canonical */ + for(i = 0; i < ldns_rr_list_rr_count(rrset_clone); i++) { + ldns_rr_set_ttl(ldns_rr_list_rr(rrset_clone, i), + ldns_rr_ttl(ldns_rr_list_rr(rrset, 0))); + ldns_rr2canonical(ldns_rr_list_rr(rrset_clone, i)); + } + /* sort */ + ldns_rr_list_sort(rrset_clone); + + for (key_count = 0; + key_count < ldns_key_list_key_count(keys); + key_count++) { + if (!ldns_key_use(ldns_key_list_key(keys, key_count))) { + continue; + } + sign_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if (!sign_buf) { + ldns_rr_list_free(rrset_clone); + ldns_rr_list_free(signatures); + ldns_rdf_free(new_owner); + return NULL; + } + b64rdf = NULL; + + current_key = ldns_key_list_key(keys, key_count); + /* sign all RRs with keys that have ZSKbit, !SEPbit. + sign DNSKEY RRs with keys that have ZSKbit&SEPbit */ + if (ldns_key_flags(current_key) & LDNS_KEY_ZONE_KEY) { + current_sig = ldns_create_empty_rrsig(rrset_clone, + current_key); + + /* right now, we have: a key, a semi-sig and an rrset. For + * which we can create the sig and base64 encode that and + * add that to the signature */ + + if (ldns_rrsig2buffer_wire(sign_buf, current_sig) + != LDNS_STATUS_OK) { + ldns_buffer_free(sign_buf); + /* ERROR */ + ldns_rr_list_deep_free(rrset_clone); + return NULL; + } + + /* add the rrset in sign_buf */ + if (ldns_rr_list2buffer_wire(sign_buf, rrset_clone) + != LDNS_STATUS_OK) { + ldns_buffer_free(sign_buf); + ldns_rr_list_deep_free(rrset_clone); + return NULL; + } + + b64rdf = ldns_sign_public_buffer(sign_buf, current_key); + + if (!b64rdf) { + /* signing went wrong */ + ldns_rr_list_deep_free(rrset_clone); + return NULL; + } + + ldns_rr_rrsig_set_sig(current_sig, b64rdf); + + /* push the signature to the signatures list */ + ldns_rr_list_push_rr(signatures, current_sig); + } + ldns_buffer_free(sign_buf); /* restart for the next key */ + } + ldns_rr_list_deep_free(rrset_clone); + + return signatures; +} + +/** + * Sign data with DSA + * + * \param[in] to_sign The ldns_buffer containing raw data that is + * to be signed + * \param[in] key The DSA key structure to sign with + * \return ldns_rdf for the RRSIG ldns_rr + */ +ldns_rdf * +ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key) +{ + unsigned char *sha1_hash; + ldns_rdf *sigdata_rdf; + ldns_buffer *b64sig; + + DSA_SIG *sig; + uint8_t *data; + size_t pad; + + b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if (!b64sig) { + return NULL; + } + + sha1_hash = SHA1((unsigned char*)ldns_buffer_begin(to_sign), + ldns_buffer_position(to_sign), NULL); + if (!sha1_hash) { + ldns_buffer_free(b64sig); + return NULL; + } + + sig = DSA_do_sign(sha1_hash, SHA_DIGEST_LENGTH, key); + if(!sig) { + ldns_buffer_free(b64sig); + return NULL; + } + + data = LDNS_XMALLOC(uint8_t, 1 + 2 * SHA_DIGEST_LENGTH); + if(!data) { + ldns_buffer_free(b64sig); + DSA_SIG_free(sig); + return NULL; + } + + data[0] = 1; + pad = 20 - (size_t) BN_num_bytes(sig->r); + if (pad > 0) { + memset(data + 1, 0, pad); + } + BN_bn2bin(sig->r, (unsigned char *) (data + 1) + pad); + + pad = 20 - (size_t) BN_num_bytes(sig->s); + if (pad > 0) { + memset(data + 1 + SHA_DIGEST_LENGTH, 0, pad); + } + BN_bn2bin(sig->s, (unsigned char *) (data + 1 + SHA_DIGEST_LENGTH + pad)); + + sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, + 1 + 2 * SHA_DIGEST_LENGTH, + data); + + ldns_buffer_free(b64sig); + LDNS_FREE(data); + DSA_SIG_free(sig); + + return sigdata_rdf; +} + +#ifdef USE_ECDSA +#ifndef S_SPLINT_S +static int +ldns_pkey_is_ecdsa(EVP_PKEY* pkey) +{ + EC_KEY* ec; + const EC_GROUP* g; + if(EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) + return 0; + ec = EVP_PKEY_get1_EC_KEY(pkey); + g = EC_KEY_get0_group(ec); + if(!g) { + EC_KEY_free(ec); + return 0; + } + if(EC_GROUP_get_curve_name(g) == NID_secp224r1 || + EC_GROUP_get_curve_name(g) == NID_X9_62_prime256v1 || + EC_GROUP_get_curve_name(g) == NID_secp384r1) { + EC_KEY_free(ec); + return 1; + } + /* downref the eckey, the original is still inside the pkey */ + EC_KEY_free(ec); + return 0; +} +#endif /* splint */ +#endif /* USE_ECDSA */ + +ldns_rdf * +ldns_sign_public_evp(ldns_buffer *to_sign, + EVP_PKEY *key, + const EVP_MD *digest_type) +{ + unsigned int siglen; + ldns_rdf *sigdata_rdf; + ldns_buffer *b64sig; + EVP_MD_CTX ctx; + const EVP_MD *md_type; + int r; + + siglen = 0; + b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if (!b64sig) { + return NULL; + } + + /* initializes a signing context */ + md_type = digest_type; + if(!md_type) { + /* unknown message difest */ + ldns_buffer_free(b64sig); + return NULL; + } + + EVP_MD_CTX_init(&ctx); + r = EVP_SignInit(&ctx, md_type); + if(r == 1) { + r = EVP_SignUpdate(&ctx, (unsigned char*) + ldns_buffer_begin(to_sign), + ldns_buffer_position(to_sign)); + } else { + ldns_buffer_free(b64sig); + return NULL; + } + if(r == 1) { + r = EVP_SignFinal(&ctx, (unsigned char*) + ldns_buffer_begin(b64sig), &siglen, key); + } else { + ldns_buffer_free(b64sig); + return NULL; + } + if(r != 1) { + ldns_buffer_free(b64sig); + return NULL; + } + + /* unfortunately, OpenSSL output is differenct from DNS DSA format */ +#ifndef S_SPLINT_S + if (EVP_PKEY_type(key->type) == EVP_PKEY_DSA) { + sigdata_rdf = ldns_convert_dsa_rrsig_asn12rdf(b64sig, siglen); +#ifdef USE_ECDSA + } else if(EVP_PKEY_type(key->type) == EVP_PKEY_EC && + ldns_pkey_is_ecdsa(key)) { + sigdata_rdf = ldns_convert_ecdsa_rrsig_asn12rdf(b64sig, siglen); +#endif + } else { + /* ok output for other types is the same */ + sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen, + ldns_buffer_begin(b64sig)); + } +#endif /* splint */ + ldns_buffer_free(b64sig); + EVP_MD_CTX_cleanup(&ctx); + return sigdata_rdf; +} + +ldns_rdf * +ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key) +{ + unsigned char *sha1_hash; + unsigned int siglen; + ldns_rdf *sigdata_rdf; + ldns_buffer *b64sig; + int result; + + siglen = 0; + b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if (!b64sig) { + return NULL; + } + + sha1_hash = SHA1((unsigned char*)ldns_buffer_begin(to_sign), + ldns_buffer_position(to_sign), NULL); + if (!sha1_hash) { + ldns_buffer_free(b64sig); + return NULL; + } + + result = RSA_sign(NID_sha1, sha1_hash, SHA_DIGEST_LENGTH, + (unsigned char*)ldns_buffer_begin(b64sig), + &siglen, key); + if (result != 1) { + return NULL; + } + + if (result != 1) { + return NULL; + } + + sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen, + ldns_buffer_begin(b64sig)); + ldns_buffer_free(b64sig); /* can't free this buffer ?? */ + return sigdata_rdf; +} + +ldns_rdf * +ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key) +{ + unsigned char *md5_hash; + unsigned int siglen; + ldns_rdf *sigdata_rdf; + ldns_buffer *b64sig; + + b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if (!b64sig) { + return NULL; + } + + md5_hash = MD5((unsigned char*)ldns_buffer_begin(to_sign), + ldns_buffer_position(to_sign), NULL); + if (!md5_hash) { + ldns_buffer_free(b64sig); + return NULL; + } + + RSA_sign(NID_md5, md5_hash, MD5_DIGEST_LENGTH, + (unsigned char*)ldns_buffer_begin(b64sig), + &siglen, key); + + sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen, + ldns_buffer_begin(b64sig)); + ldns_buffer_free(b64sig); + return sigdata_rdf; +} +#endif /* HAVE_SSL */ + +static int +ldns_dnssec_name_has_only_a(ldns_dnssec_name *cur_name) +{ + ldns_dnssec_rrsets *cur_rrset; + cur_rrset = cur_name->rrsets; + while (cur_rrset) { + if (cur_rrset->type != LDNS_RR_TYPE_A && + cur_rrset->type != LDNS_RR_TYPE_AAAA) { + return 0; + } else { + cur_rrset = cur_rrset->next; + } + } + return 1; +} + +ldns_status +ldns_dnssec_zone_mark_glue(ldns_dnssec_zone *zone) +{ + ldns_rbnode_t *cur_node; + ldns_dnssec_name *cur_name; + ldns_rdf *cur_owner, *cur_parent; + + cur_node = ldns_rbtree_first(zone->names); + while (cur_node != LDNS_RBTREE_NULL) { + cur_name = (ldns_dnssec_name *) cur_node->data; + cur_node = ldns_rbtree_next(cur_node); + if (ldns_dnssec_name_has_only_a(cur_name)) { + /* assume glue XXX check for zone cur */ + cur_owner = ldns_rdf_clone(ldns_rr_owner( + cur_name->rrsets->rrs->rr)); + while (ldns_dname_label_count(cur_owner) > + ldns_dname_label_count(zone->soa->name)) { + if (ldns_dnssec_zone_find_rrset(zone, + cur_owner, + LDNS_RR_TYPE_NS)) { + /* + fprintf(stderr, "[XX] Marking as glue: "); + ldns_rdf_print(stderr, cur_name->name); + fprintf(stderr, "\n"); + */ + cur_name->is_glue = true; + } + cur_parent = ldns_dname_left_chop(cur_owner); + ldns_rdf_deep_free(cur_owner); + cur_owner = cur_parent; + } + ldns_rdf_deep_free(cur_owner); + } + } + return LDNS_STATUS_OK; +} + +ldns_rbnode_t * +ldns_dnssec_name_node_next_nonglue(ldns_rbnode_t *node) +{ + ldns_rbnode_t *next_node = NULL; + ldns_dnssec_name *next_name = NULL; + bool done = false; + + if (node == LDNS_RBTREE_NULL) { + return NULL; + } + next_node = node; + while (!done) { + if (next_node == LDNS_RBTREE_NULL) { + return NULL; + } else { + next_name = (ldns_dnssec_name *)next_node->data; + if (!next_name->is_glue) { + done = true; + } else { + next_node = ldns_rbtree_next(next_node); + } + } + } + return next_node; +} + +ldns_status +ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs) +{ + + ldns_rbnode_t *first_node, *cur_node, *next_node; + ldns_dnssec_name *cur_name, *next_name; + ldns_rr *nsec_rr; + uint32_t nsec_ttl; + ldns_dnssec_rrsets *soa; + + /* the TTL of NSEC rrs should be set to the minimum TTL of + * the zone SOA (RFC4035 Section 2.3) + */ + soa = ldns_dnssec_name_find_rrset(zone->soa, LDNS_RR_TYPE_SOA); + + /* did the caller actually set it? if not, + * fall back to default ttl + */ + if (soa && soa->rrs && soa->rrs->rr) { + nsec_ttl = ldns_rdf2native_int32(ldns_rr_rdf( + soa->rrs->rr, 6)); + } else { + nsec_ttl = LDNS_DEFAULT_TTL; + } + + first_node = ldns_dnssec_name_node_next_nonglue( + ldns_rbtree_first(zone->names)); + cur_node = first_node; + if (cur_node) { + next_node = ldns_dnssec_name_node_next_nonglue( + ldns_rbtree_next(cur_node)); + } else { + next_node = NULL; + } + + while (cur_node && next_node) { + cur_name = (ldns_dnssec_name *)cur_node->data; + next_name = (ldns_dnssec_name *)next_node->data; + nsec_rr = ldns_dnssec_create_nsec(cur_name, + next_name, + LDNS_RR_TYPE_NSEC); + ldns_rr_set_ttl(nsec_rr, nsec_ttl); + if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){ + ldns_rr_free(nsec_rr); + return LDNS_STATUS_ERR; + } + ldns_rr_list_push_rr(new_rrs, nsec_rr); + cur_node = next_node; + if (cur_node) { + next_node = ldns_dnssec_name_node_next_nonglue( + ldns_rbtree_next(cur_node)); + } + } + + if (cur_node && !next_node) { + cur_name = (ldns_dnssec_name *)cur_node->data; + next_name = (ldns_dnssec_name *)first_node->data; + nsec_rr = ldns_dnssec_create_nsec(cur_name, + next_name, + LDNS_RR_TYPE_NSEC); + ldns_rr_set_ttl(nsec_rr, nsec_ttl); + if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){ + ldns_rr_free(nsec_rr); + return LDNS_STATUS_ERR; + } + ldns_rr_list_push_rr(new_rrs, nsec_rr); + } else { + printf("error\n"); + } + + return LDNS_STATUS_OK; +} + +#ifdef HAVE_SSL +ldns_status +ldns_dnssec_zone_create_nsec3s(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt) +{ + ldns_rbnode_t *first_name_node; + ldns_rbnode_t *current_name_node; + ldns_dnssec_name *current_name; + ldns_status result = LDNS_STATUS_OK; + ldns_rr *nsec_rr; + ldns_rr_list *nsec3_list; + uint32_t nsec_ttl; + ldns_dnssec_rrsets *soa; + + if (!zone || !new_rrs || !zone->names) { + return LDNS_STATUS_ERR; + } + + /* the TTL of NSEC rrs should be set to the minimum TTL of + * the zone SOA (RFC4035 Section 2.3) + */ + soa = ldns_dnssec_name_find_rrset(zone->soa, LDNS_RR_TYPE_SOA); + + /* did the caller actually set it? if not, + * fall back to default ttl + */ + if (soa && soa->rrs && soa->rrs->rr) { + nsec_ttl = ldns_rdf2native_int32(ldns_rr_rdf( + soa->rrs->rr, 6)); + } else { + nsec_ttl = LDNS_DEFAULT_TTL; + } + + nsec3_list = ldns_rr_list_new(); + + first_name_node = ldns_dnssec_name_node_next_nonglue( + ldns_rbtree_first(zone->names)); + + current_name_node = first_name_node; + + while (current_name_node && + current_name_node != LDNS_RBTREE_NULL) { + current_name = (ldns_dnssec_name *) current_name_node->data; + nsec_rr = ldns_dnssec_create_nsec3(current_name, + NULL, + zone->soa->name, + algorithm, + flags, + iterations, + salt_length, + salt); + /* by default, our nsec based generator adds rrsigs + * remove the bitmap for empty nonterminals */ + if (!current_name->rrsets) { + ldns_rdf_deep_free(ldns_rr_pop_rdf(nsec_rr)); + } + ldns_rr_set_ttl(nsec_rr, nsec_ttl); + result = ldns_dnssec_name_add_rr(current_name, nsec_rr); + ldns_rr_list_push_rr(new_rrs, nsec_rr); + ldns_rr_list_push_rr(nsec3_list, nsec_rr); + current_name_node = ldns_dnssec_name_node_next_nonglue( + ldns_rbtree_next(current_name_node)); + } + if (result != LDNS_STATUS_OK) { + return result; + } + + ldns_rr_list_sort_nsec3(nsec3_list); + result = ldns_dnssec_chain_nsec3_list(nsec3_list); + if (result != LDNS_STATUS_OK) { + return result; + } + + ldns_rr_list_free(nsec3_list); + return result; +} +#endif /* HAVE_SSL */ + +ldns_dnssec_rrs * +ldns_dnssec_remove_signatures(ldns_dnssec_rrs *signatures, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg) +{ + ldns_dnssec_rrs *base_rrs = signatures; + ldns_dnssec_rrs *cur_rr = base_rrs; + ldns_dnssec_rrs *prev_rr = NULL; + ldns_dnssec_rrs *next_rr; + + uint16_t keytag; + size_t i; + + key_list = key_list; + + if (!cur_rr) { + switch(func(NULL, arg)) { + case LDNS_SIGNATURE_LEAVE_ADD_NEW: + case LDNS_SIGNATURE_REMOVE_ADD_NEW: + break; + case LDNS_SIGNATURE_LEAVE_NO_ADD: + case LDNS_SIGNATURE_REMOVE_NO_ADD: + ldns_key_list_set_use(key_list, false); + break; + default: + fprintf(stderr, "[XX] unknown return value from callback\n"); + break; + } + return NULL; + } + (void)func(cur_rr->rr, arg); + + while (cur_rr) { + next_rr = cur_rr->next; + + switch (func(cur_rr->rr, arg)) { + case LDNS_SIGNATURE_LEAVE_ADD_NEW: + prev_rr = cur_rr; + break; + case LDNS_SIGNATURE_LEAVE_NO_ADD: + keytag = ldns_rdf2native_int16( + ldns_rr_rrsig_keytag(cur_rr->rr)); + for (i = 0; i < ldns_key_list_key_count(key_list); i++) { + if (ldns_key_keytag(ldns_key_list_key(key_list, i)) == + keytag) { + ldns_key_set_use(ldns_key_list_key(key_list, i), + false); + } + } + prev_rr = cur_rr; + break; + case LDNS_SIGNATURE_REMOVE_NO_ADD: + keytag = ldns_rdf2native_int16( + ldns_rr_rrsig_keytag(cur_rr->rr)); + for (i = 0; i < ldns_key_list_key_count(key_list); i++) { + if (ldns_key_keytag(ldns_key_list_key(key_list, i)) + == keytag) { + ldns_key_set_use(ldns_key_list_key(key_list, i), + false); + } + } + if (prev_rr) { + prev_rr->next = next_rr; + } else { + base_rrs = next_rr; + } + LDNS_FREE(cur_rr); + break; + case LDNS_SIGNATURE_REMOVE_ADD_NEW: + if (prev_rr) { + prev_rr->next = next_rr; + } else { + base_rrs = next_rr; + } + LDNS_FREE(cur_rr); + break; + default: + fprintf(stderr, "[XX] unknown return value from callback\n"); + break; + } + cur_rr = next_rr; + } + + return base_rrs; +} + +#ifdef HAVE_SSL +ldns_status +ldns_dnssec_zone_create_rrsigs(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void*), + void *arg) +{ + return ldns_dnssec_zone_create_rrsigs_flg(zone, new_rrs, key_list, + func, arg, 0); +} + +/** If there are KSKs use only them and mark ZSKs unused */ +static void +ldns_key_list_filter_for_dnskey(ldns_key_list *key_list) +{ + int saw_ksk = 0; + size_t i; + for(i=0; inames); + while (cur_node != LDNS_RBTREE_NULL) { + cur_name = (ldns_dnssec_name *) cur_node->data; + + if (!cur_name->is_glue) { + cur_rrset = cur_name->rrsets; + while (cur_rrset) { + /* reset keys to use */ + ldns_key_list_set_use(key_list, true); + + /* walk through old sigs, remove the old, + and mark which keys (not) to use) */ + cur_rrset->signatures = + ldns_dnssec_remove_signatures(cur_rrset->signatures, + key_list, + func, + arg); + if(!(flags&LDNS_SIGN_DNSKEY_WITH_ZSK) && + cur_rrset->type == LDNS_RR_TYPE_DNSKEY) + ldns_key_list_filter_for_dnskey(key_list); + + if(cur_rrset->type != LDNS_RR_TYPE_DNSKEY) + ldns_key_list_filter_for_non_dnskey(key_list); + + /* TODO: just set count to zero? */ + rr_list = ldns_rr_list_new(); + + cur_rr = cur_rrset->rrs; + while (cur_rr) { + ldns_rr_list_push_rr(rr_list, cur_rr->rr); + cur_rr = cur_rr->next; + } + + /* only sign non-delegation RRsets */ + /* (glue should have been marked earlier) */ + if ((ldns_rr_list_type(rr_list) != LDNS_RR_TYPE_NS || + ldns_dname_compare(ldns_rr_list_owner(rr_list), + zone->soa->name) == 0) && + /* OK, there is also the possibility that the record + * is glue, but at the same owner name as other records that + * are not NS nor A/AAAA. Bleh, our current data structure + * doesn't really support that... */ + !((ldns_rr_list_type(rr_list) == LDNS_RR_TYPE_A || + ldns_rr_list_type(rr_list) == LDNS_RR_TYPE_AAAA) && + !ldns_dname_compare(ldns_rr_list_owner(rr_list), zone->soa->name) == 0 && + ldns_dnssec_zone_find_rrset(zone, ldns_rr_list_owner(rr_list), LDNS_RR_TYPE_NS) + )) { + + siglist = ldns_sign_public(rr_list, key_list); + for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) { + if (cur_rrset->signatures) { + result = ldns_dnssec_rrs_add_rr(cur_rrset->signatures, + ldns_rr_list_rr(siglist, + i)); + } else { + cur_rrset->signatures = ldns_dnssec_rrs_new(); + cur_rrset->signatures->rr = + ldns_rr_list_rr(siglist, i); + ldns_rr_list_push_rr(new_rrs, + ldns_rr_list_rr(siglist, + i)); + } + } + ldns_rr_list_free(siglist); + } + + ldns_rr_list_free(rr_list); + + cur_rrset = cur_rrset->next; + } + + /* sign the nsec */ + ldns_key_list_set_use(key_list, true); + cur_name->nsec_signatures = + ldns_dnssec_remove_signatures(cur_name->nsec_signatures, + key_list, + func, + arg); + ldns_key_list_filter_for_non_dnskey(key_list); + + rr_list = ldns_rr_list_new(); + ldns_rr_list_push_rr(rr_list, cur_name->nsec); + siglist = ldns_sign_public(rr_list, key_list); + + for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) { + if (cur_name->nsec_signatures) { + result = ldns_dnssec_rrs_add_rr(cur_name->nsec_signatures, + ldns_rr_list_rr(siglist, i)); + } else { + cur_name->nsec_signatures = ldns_dnssec_rrs_new(); + cur_name->nsec_signatures->rr = + ldns_rr_list_rr(siglist, i); + ldns_rr_list_push_rr(new_rrs, + ldns_rr_list_rr(siglist, i)); + } + } + + ldns_rr_list_free(siglist); + ldns_rr_list_free(rr_list); + } + cur_node = ldns_rbtree_next(cur_node); + } + + ldns_rr_list_deep_free(pubkey_list); + return result; +} + +ldns_status +ldns_dnssec_zone_sign(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg) +{ + return ldns_dnssec_zone_sign_flg(zone, new_rrs, key_list, func, arg, 0); +} + +ldns_status +ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + int flags) +{ + ldns_status result = LDNS_STATUS_OK; + + if (!zone || !new_rrs || !key_list) { + return LDNS_STATUS_ERR; + } + + /* zone is already sorted */ + result = ldns_dnssec_zone_mark_glue(zone); + if (result != LDNS_STATUS_OK) { + return result; + } + + /* check whether we need to add nsecs */ + if (zone->names && !((ldns_dnssec_name *)zone->names->root->data)->nsec) { + result = ldns_dnssec_zone_create_nsecs(zone, new_rrs); + if (result != LDNS_STATUS_OK) { + return result; + } + } + + result = ldns_dnssec_zone_create_rrsigs_flg(zone, + new_rrs, + key_list, + func, + arg, + flags); + + return result; +} + +ldns_status +ldns_dnssec_zone_sign_nsec3(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt) +{ + return ldns_dnssec_zone_sign_nsec3_flg(zone, new_rrs, key_list, + func, arg, algorithm, flags, iterations, salt_length, salt, 0); +} + +ldns_status +ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt, + int signflags) +{ + ldns_rr *nsec3, *nsec3params; + ldns_status result = LDNS_STATUS_OK; + + /* zone is already sorted */ + result = ldns_dnssec_zone_mark_glue(zone); + if (result != LDNS_STATUS_OK) { + return result; + } + + /* TODO if there are already nsec3s presents and their + * parameters are the same as these, we don't have to recreate + */ + if (zone->names) { + /* add empty nonterminals */ + result = ldns_dnssec_zone_add_empty_nonterminals(zone); + if (result != LDNS_STATUS_OK) { + return result; + } + + nsec3 = ((ldns_dnssec_name *)zone->names->root->data)->nsec; + if (nsec3 && ldns_rr_get_type(nsec3) == LDNS_RR_TYPE_NSEC3) { + /* no need to recreate */ + } else { + if (!ldns_dnssec_zone_find_rrset(zone, + zone->soa->name, + LDNS_RR_TYPE_NSEC3PARAMS)) { + /* create and add the nsec3params rr */ + nsec3params = + ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3PARAMS); + ldns_rr_set_owner(nsec3params, + ldns_rdf_clone(zone->soa->name)); + ldns_nsec3_add_param_rdfs(nsec3params, + algorithm, + flags, + iterations, + salt_length, + salt); + /* always set bit 7 of the flags to zero, according to + * rfc5155 section 11 */ + ldns_set_bit(ldns_rdf_data(ldns_rr_rdf(nsec3params, 1)), 7, 0); + result = ldns_dnssec_zone_add_rr(zone, nsec3params); + if (result != LDNS_STATUS_OK) { + return result; + } + ldns_rr_list_push_rr(new_rrs, nsec3params); + } + result = ldns_dnssec_zone_create_nsec3s(zone, + new_rrs, + algorithm, + flags, + iterations, + salt_length, + salt); + if (result != LDNS_STATUS_OK) { + return result; + } + } + + result = ldns_dnssec_zone_create_rrsigs_flg(zone, + new_rrs, + key_list, + func, + arg, + signflags); + } + + return result; +} + + +ldns_zone * +ldns_zone_sign(const ldns_zone *zone, ldns_key_list *key_list) +{ + ldns_dnssec_zone *dnssec_zone; + ldns_zone *signed_zone; + ldns_rr_list *new_rrs; + size_t i; + + signed_zone = ldns_zone_new(); + dnssec_zone = ldns_dnssec_zone_new(); + + (void) ldns_dnssec_zone_add_rr(dnssec_zone, ldns_zone_soa(zone)); + ldns_zone_set_soa(signed_zone, ldns_rr_clone(ldns_zone_soa(zone))); + + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(zone)); i++) { + (void) ldns_dnssec_zone_add_rr(dnssec_zone, + ldns_rr_list_rr(ldns_zone_rrs(zone), + i)); + ldns_zone_push_rr(signed_zone, + ldns_rr_clone(ldns_rr_list_rr(ldns_zone_rrs(zone), + i))); + } + + new_rrs = ldns_rr_list_new(); + (void) ldns_dnssec_zone_sign(dnssec_zone, + new_rrs, + key_list, + ldns_dnssec_default_replace_signatures, + NULL); + + for (i = 0; i < ldns_rr_list_rr_count(new_rrs); i++) { + ldns_rr_list_push_rr(ldns_zone_rrs(signed_zone), + ldns_rr_clone(ldns_rr_list_rr(new_rrs, i))); + } + + ldns_rr_list_deep_free(new_rrs); + ldns_dnssec_zone_free(dnssec_zone); + + return signed_zone; +} + +ldns_zone * +ldns_zone_sign_nsec3(ldns_zone *zone, ldns_key_list *key_list, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt) +{ + ldns_dnssec_zone *dnssec_zone; + ldns_zone *signed_zone; + ldns_rr_list *new_rrs; + size_t i; + + signed_zone = ldns_zone_new(); + dnssec_zone = ldns_dnssec_zone_new(); + + (void) ldns_dnssec_zone_add_rr(dnssec_zone, ldns_zone_soa(zone)); + ldns_zone_set_soa(signed_zone, ldns_rr_clone(ldns_zone_soa(zone))); + + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(zone)); i++) { + (void) ldns_dnssec_zone_add_rr(dnssec_zone, + ldns_rr_list_rr(ldns_zone_rrs(zone), + i)); + ldns_zone_push_rr(signed_zone, + ldns_rr_clone(ldns_rr_list_rr(ldns_zone_rrs(zone), + i))); + } + + new_rrs = ldns_rr_list_new(); + (void) ldns_dnssec_zone_sign_nsec3(dnssec_zone, + new_rrs, + key_list, + ldns_dnssec_default_replace_signatures, + NULL, + algorithm, + flags, + iterations, + salt_length, + salt); + + for (i = 0; i < ldns_rr_list_rr_count(new_rrs); i++) { + ldns_rr_list_push_rr(ldns_zone_rrs(signed_zone), + ldns_rr_clone(ldns_rr_list_rr(new_rrs, i))); + } + + ldns_rr_list_deep_free(new_rrs); + ldns_dnssec_zone_free(dnssec_zone); + + return signed_zone; +} +#endif /* HAVE_SSL */ + diff --git a/libs/ldns/dnssec_verify.c b/libs/ldns/dnssec_verify.c new file mode 100644 index 0000000000..352e44066b --- /dev/null +++ b/libs/ldns/dnssec_verify.c @@ -0,0 +1,2303 @@ +#include + +#include + +#include +#include + +#ifdef HAVE_SSL +/* this entire file is rather useless when you don't have + * crypto... + */ +#include +#include +#include +#include +#include + +ldns_dnssec_data_chain * +ldns_dnssec_data_chain_new() +{ + ldns_dnssec_data_chain *nc = LDNS_XMALLOC(ldns_dnssec_data_chain, 1); + if(!nc) return NULL; + nc->rrset = NULL; + nc->parent_type = 0; + nc->parent = NULL; + nc->signatures = NULL; + nc->packet_rcode = 0; + nc->packet_qtype = 0; + nc->packet_nodata = false; + return nc; +} + +void +ldns_dnssec_data_chain_free(ldns_dnssec_data_chain *chain) +{ + LDNS_FREE(chain); +} + +void +ldns_dnssec_data_chain_deep_free(ldns_dnssec_data_chain *chain) +{ + ldns_rr_list_deep_free(chain->rrset); + ldns_rr_list_deep_free(chain->signatures); + if (chain->parent) { + ldns_dnssec_data_chain_deep_free(chain->parent); + } + LDNS_FREE(chain); +} + +void +ldns_dnssec_data_chain_print(FILE *out, const ldns_dnssec_data_chain *chain) +{ + ldns_lookup_table *rcode; + const ldns_rr_descriptor *rr_descriptor; + if (chain) { + ldns_dnssec_data_chain_print(out, chain->parent); + if (ldns_rr_list_rr_count(chain->rrset) > 0) { + rcode = ldns_lookup_by_id(ldns_rcodes, + (int) chain->packet_rcode); + if (rcode) { + fprintf(out, ";; rcode: %s\n", rcode->name); + } + + rr_descriptor = ldns_rr_descript(chain->packet_qtype); + if (rr_descriptor && rr_descriptor->_name) { + fprintf(out, ";; qtype: %s\n", rr_descriptor->_name); + } else if (chain->packet_qtype != 0) { + fprintf(out, "TYPE%u", + chain->packet_qtype); + } + if (chain->packet_nodata) { + fprintf(out, ";; NODATA response\n"); + } + fprintf(out, "rrset:\n"); + ldns_rr_list_print(out, chain->rrset); + fprintf(out, "sigs:\n"); + ldns_rr_list_print(out, chain->signatures); + fprintf(out, "---\n"); + } else { + fprintf(out, "\n"); + } + } +} + +static void +ldns_dnssec_build_data_chain_dnskey(ldns_resolver *res, + uint16_t qflags, + const ldns_pkt *pkt, + ldns_rr_list *signatures, + ldns_dnssec_data_chain *new_chain, + ldns_rdf *key_name, + ldns_rr_class c) { + ldns_rr_list *keys; + ldns_pkt *my_pkt; + if (signatures && ldns_rr_list_rr_count(signatures) > 0) { + new_chain->signatures = ldns_rr_list_clone(signatures); + new_chain->parent_type = 0; + + keys = ldns_pkt_rr_list_by_name_and_type( + pkt, + key_name, + LDNS_RR_TYPE_DNSKEY, + LDNS_SECTION_ANY_NOQUESTION + ); + if (!keys) { + my_pkt = ldns_resolver_query(res, + key_name, + LDNS_RR_TYPE_DNSKEY, + c, + qflags); + if (my_pkt) { + keys = ldns_pkt_rr_list_by_name_and_type( + my_pkt, + key_name, + LDNS_RR_TYPE_DNSKEY, + LDNS_SECTION_ANY_NOQUESTION + ); + new_chain->parent = ldns_dnssec_build_data_chain(res, + qflags, + keys, + my_pkt, + NULL); + new_chain->parent->packet_qtype = LDNS_RR_TYPE_DNSKEY; + ldns_pkt_free(my_pkt); + } + } else { + new_chain->parent = ldns_dnssec_build_data_chain(res, + qflags, + keys, + pkt, + NULL); + new_chain->parent->packet_qtype = LDNS_RR_TYPE_DNSKEY; + } + ldns_rr_list_deep_free(keys); + } +} + +static void +ldns_dnssec_build_data_chain_other(ldns_resolver *res, + uint16_t qflags, + ldns_dnssec_data_chain *new_chain, + ldns_rdf *key_name, + ldns_rr_class c, + ldns_rr_list *dss) +{ + /* 'self-signed', parent is a DS */ + + /* okay, either we have other keys signing the current one, + * or the current + * one should have a DS record in the parent zone. + * How do we find this out? Try both? + * + * request DNSKEYS for current zone, + * add all signatures to current level + */ + ldns_pkt *my_pkt; + ldns_rr_list *signatures2; + + new_chain->parent_type = 1; + + my_pkt = ldns_resolver_query(res, + key_name, + LDNS_RR_TYPE_DS, + c, + qflags); + if (my_pkt) { + dss = ldns_pkt_rr_list_by_name_and_type(my_pkt, + key_name, + LDNS_RR_TYPE_DS, + LDNS_SECTION_ANY_NOQUESTION + ); + if (dss) { + new_chain->parent = ldns_dnssec_build_data_chain(res, + qflags, + dss, + my_pkt, + NULL); + new_chain->parent->packet_qtype = LDNS_RR_TYPE_DS; + ldns_rr_list_deep_free(dss); + } + ldns_pkt_free(my_pkt); + } + + my_pkt = ldns_resolver_query(res, + key_name, + LDNS_RR_TYPE_DNSKEY, + c, + qflags); + if (my_pkt) { + signatures2 = ldns_pkt_rr_list_by_name_and_type(my_pkt, + key_name, + LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_ANSWER); + if (signatures2) { + if (new_chain->signatures) { + printf("There were already sigs!\n"); + ldns_rr_list_deep_free(new_chain->signatures); + printf("replacing the old sigs\n"); + } + new_chain->signatures = signatures2; + } + ldns_pkt_free(my_pkt); + } +} + +ldns_dnssec_data_chain * +ldns_dnssec_build_data_chain_nokeyname(ldns_resolver *res, + uint16_t qflags, + ldns_rr *orig_rr, + const ldns_rr_list *rrset, + ldns_dnssec_data_chain *new_chain) +{ + ldns_rdf *possible_parent_name; + ldns_pkt *my_pkt; + /* apparently we were not able to find a signing key, so + we assume the chain ends here + */ + /* try parents for auth denial of DS */ + if (orig_rr) { + possible_parent_name = ldns_rr_owner(orig_rr); + } else if (rrset && ldns_rr_list_rr_count(rrset) > 0) { + possible_parent_name = ldns_rr_owner(ldns_rr_list_rr(rrset, 0)); + } else { + /* no information to go on, give up */ + return new_chain; + } + + my_pkt = ldns_resolver_query(res, + possible_parent_name, + LDNS_RR_TYPE_DS, + LDNS_RR_CLASS_IN, + qflags); + if (!my_pkt) { + return new_chain; + } + + if (ldns_pkt_ancount(my_pkt) > 0) { + /* add error, no sigs but DS in parent */ + /*ldns_pkt_print(stdout, my_pkt);*/ + ldns_pkt_free(my_pkt); + } else { + /* are there signatures? */ + new_chain->parent = ldns_dnssec_build_data_chain(res, + qflags, + NULL, + my_pkt, + NULL); + + new_chain->parent->packet_qtype = LDNS_RR_TYPE_DS; + + } + return new_chain; +} + + +ldns_dnssec_data_chain * +ldns_dnssec_build_data_chain(ldns_resolver *res, + uint16_t qflags, + const ldns_rr_list *rrset, + const ldns_pkt *pkt, + ldns_rr *orig_rr) +{ + ldns_rr_list *signatures = NULL; + ldns_rr_list *dss = NULL; + + ldns_rr_list *my_rrset; + + ldns_pkt *my_pkt; + + ldns_rdf *name = NULL, *key_name = NULL; + ldns_rr_type type = 0; + ldns_rr_class c = 0; + + bool other_rrset = false; + + ldns_dnssec_data_chain *new_chain = ldns_dnssec_data_chain_new(); + + if (!ldns_dnssec_pkt_has_rrsigs(pkt)) { + /* hmm. no dnssec data in the packet. go up to try and deny + * DS? */ + return new_chain; + } + + if (orig_rr) { + new_chain->rrset = ldns_rr_list_new(); + ldns_rr_list_push_rr(new_chain->rrset, orig_rr); + new_chain->parent = ldns_dnssec_build_data_chain(res, + qflags, + rrset, + pkt, + NULL); + new_chain->packet_rcode = ldns_pkt_get_rcode(pkt); + new_chain->packet_qtype = ldns_rr_get_type(orig_rr); + if (ldns_pkt_ancount(pkt) == 0) { + new_chain->packet_nodata = true; + } + return new_chain; + } + + if (!rrset || ldns_rr_list_rr_count(rrset) < 1) { + /* hmm, no data, do we have denial? only works if pkt was given, + otherwise caller has to do the check himself */ + new_chain->packet_nodata = true; + if (pkt) { + my_rrset = ldns_pkt_rr_list_by_type(pkt, + LDNS_RR_TYPE_NSEC, + LDNS_SECTION_ANY_NOQUESTION + ); + if (my_rrset) { + if (ldns_rr_list_rr_count(my_rrset) > 0) { + type = LDNS_RR_TYPE_NSEC; + other_rrset = true; + } else { + ldns_rr_list_deep_free(my_rrset); + my_rrset = NULL; + } + } else { + /* nothing, try nsec3 */ + my_rrset = ldns_pkt_rr_list_by_type(pkt, + LDNS_RR_TYPE_NSEC3, + LDNS_SECTION_ANY_NOQUESTION); + if (my_rrset) { + if (ldns_rr_list_rr_count(my_rrset) > 0) { + type = LDNS_RR_TYPE_NSEC3; + other_rrset = true; + } else { + ldns_rr_list_deep_free(my_rrset); + my_rrset = NULL; + } + } else { + /* nothing, stop */ + /* try parent zone? for denied insecure? */ + return new_chain; + } + } + } else { + return new_chain; + } + } else { + my_rrset = (ldns_rr_list *) rrset; + } + + if (my_rrset && ldns_rr_list_rr_count(my_rrset) > 0) { + new_chain->rrset = ldns_rr_list_clone(my_rrset); + name = ldns_rr_owner(ldns_rr_list_rr(my_rrset, 0)); + type = ldns_rr_get_type(ldns_rr_list_rr(my_rrset, 0)); + c = ldns_rr_get_class(ldns_rr_list_rr(my_rrset, 0)); + } + + if (other_rrset) { + ldns_rr_list_deep_free(my_rrset); + } + + /* normally there will only be 1 signature 'set' + but there can be more than 1 denial (wildcards) + so check for NSEC + */ + if (type == LDNS_RR_TYPE_NSEC || type == LDNS_RR_TYPE_NSEC3) { + /* just throw in all signatures, the tree builder must sort + this out */ + if (pkt) { + signatures = ldns_dnssec_pkt_get_rrsigs_for_type(pkt, type); + } else { + my_pkt = ldns_resolver_query(res, name, type, c, qflags); + if (my_pkt) { + signatures = ldns_dnssec_pkt_get_rrsigs_for_type(pkt, type); + ldns_pkt_free(my_pkt); + } + } + } else { + if (pkt) { + signatures = + ldns_dnssec_pkt_get_rrsigs_for_name_and_type(pkt, + name, + type); + } + if (!signatures) { + my_pkt = ldns_resolver_query(res, name, type, c, qflags); + if (my_pkt) { + signatures = + ldns_dnssec_pkt_get_rrsigs_for_name_and_type(my_pkt, + name, + type); + ldns_pkt_free(my_pkt); + } + } + } + + if (signatures && ldns_rr_list_rr_count(signatures) > 0) { + key_name = ldns_rr_rdf(ldns_rr_list_rr(signatures, 0), 7); + } + + if (!key_name) { + return ldns_dnssec_build_data_chain_nokeyname(res, + qflags, + orig_rr, + rrset, + new_chain); + } + + if (type != LDNS_RR_TYPE_DNSKEY) { + ldns_dnssec_build_data_chain_dnskey(res, + qflags, + pkt, + signatures, + new_chain, + key_name, + c + ); + } else { + ldns_dnssec_build_data_chain_other(res, + qflags, + new_chain, + key_name, + c, + dss + + ); + } + if (signatures) { + ldns_rr_list_deep_free(signatures); + } + + return new_chain; +} + +ldns_dnssec_trust_tree * +ldns_dnssec_trust_tree_new() +{ + ldns_dnssec_trust_tree *new_tree = LDNS_XMALLOC(ldns_dnssec_trust_tree, + 1); + if(!new_tree) return NULL; + new_tree->rr = NULL; + new_tree->rrset = NULL; + new_tree->parent_count = 0; + + return new_tree; +} + +void +ldns_dnssec_trust_tree_free(ldns_dnssec_trust_tree *tree) +{ + size_t i; + if (tree) { + for (i = 0; i < tree->parent_count; i++) { + ldns_dnssec_trust_tree_free(tree->parents[i]); + } + } + LDNS_FREE(tree); +} + +size_t +ldns_dnssec_trust_tree_depth(ldns_dnssec_trust_tree *tree) +{ + size_t result = 0; + size_t parent = 0; + size_t i; + + for (i = 0; i < tree->parent_count; i++) { + parent = ldns_dnssec_trust_tree_depth(tree->parents[i]); + if (parent > result) { + result = parent; + } + } + return 1 + result; +} + +/* TODO ldns_ */ +static void +print_tabs(FILE *out, size_t nr, uint8_t *map, size_t treedepth) +{ + size_t i; + for (i = 0; i < nr; i++) { + if (i == nr - 1) { + fprintf(out, "|---"); + } else if (map && i < treedepth && map[i] == 1) { + fprintf(out, "| "); + } else { + fprintf(out, " "); + } + } +} + +void +ldns_dnssec_trust_tree_print_sm(FILE *out, + ldns_dnssec_trust_tree *tree, + size_t tabs, + bool extended, + uint8_t *sibmap, + size_t treedepth) +{ + size_t i; + const ldns_rr_descriptor *descriptor; + bool mapset = false; + + if (!sibmap) { + treedepth = ldns_dnssec_trust_tree_depth(tree); + sibmap = malloc(treedepth); + if(!sibmap) + return; /* mem err */ + memset(sibmap, 0, treedepth); + mapset = true; + } + + if (tree) { + if (tree->rr) { + print_tabs(out, tabs, sibmap, treedepth); + ldns_rdf_print(out, ldns_rr_owner(tree->rr)); + descriptor = ldns_rr_descript(ldns_rr_get_type(tree->rr)); + + if (descriptor->_name) { + fprintf(out, " (%s", descriptor->_name); + } else { + fprintf(out, " (TYPE%d", + ldns_rr_get_type(tree->rr)); + } + if (tabs > 0) { + if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_DNSKEY) { + fprintf(out, " keytag: %u", + (unsigned int) ldns_calc_keytag(tree->rr)); + fprintf(out, " alg: "); + ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 2)); + fprintf(out, " flags: "); + ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 0)); + } else if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_DS) { + fprintf(out, " keytag: "); + ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 0)); + fprintf(out, " digest type: "); + ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 2)); + } + if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_NSEC) { + fprintf(out, " "); + ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 0)); + fprintf(out, " "); + ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 1)); + } + } + + fprintf(out, ")\n"); + for (i = 0; i < tree->parent_count; i++) { + if (tree->parent_count > 1 && i < tree->parent_count - 1) { + sibmap[tabs] = 1; + } else { + sibmap[tabs] = 0; + } + /* only print errors */ + if (ldns_rr_get_type(tree->parents[i]->rr) == + LDNS_RR_TYPE_NSEC || + ldns_rr_get_type(tree->parents[i]->rr) == + LDNS_RR_TYPE_NSEC3) { + if (tree->parent_status[i] == LDNS_STATUS_OK) { + print_tabs(out, tabs + 1, sibmap, treedepth); + if (tabs == 0 && + ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_NS && + ldns_rr_rd_count(tree->rr) > 0) { + fprintf(out, "Existence of DS is denied by:\n"); + } else { + fprintf(out, "Existence is denied by:\n"); + } + } else { + /* NS records aren't signed */ + if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_NS) { + fprintf(out, "Existence of DS is denied by:\n"); + } else { + print_tabs(out, tabs + 1, sibmap, treedepth); + fprintf(out, + "Error in denial of existence: %s\n", + ldns_get_errorstr_by_id( + tree->parent_status[i])); + } + } + } else + if (tree->parent_status[i] != LDNS_STATUS_OK) { + print_tabs(out, tabs + 1, sibmap, treedepth); + fprintf(out, + "%s:\n", + ldns_get_errorstr_by_id( + tree->parent_status[i])); + if (tree->parent_status[i] + == LDNS_STATUS_SSL_ERR) { + printf("; SSL Error: "); + ERR_load_crypto_strings(); + ERR_print_errors_fp(stdout); + printf("\n"); + } + ldns_rr_print(out, tree->parent_signature[i]); + printf("For RRset:\n"); + ldns_rr_list_print(out, tree->rrset); + printf("With key:\n"); + ldns_rr_print(out, tree->parents[i]->rr); + } + ldns_dnssec_trust_tree_print_sm(out, + tree->parents[i], + tabs+1, + extended, + sibmap, + treedepth); + } + } else { + print_tabs(out, tabs, sibmap, treedepth); + fprintf(out, "\n"); + } + } else { + fprintf(out, "\n"); + } + + if (mapset) { + free(sibmap); + } +} + +void +ldns_dnssec_trust_tree_print(FILE *out, + ldns_dnssec_trust_tree *tree, + size_t tabs, + bool extended) +{ + ldns_dnssec_trust_tree_print_sm(out, tree, tabs, extended, NULL, 0); +} + +ldns_status +ldns_dnssec_trust_tree_add_parent(ldns_dnssec_trust_tree *tree, + const ldns_dnssec_trust_tree *parent, + const ldns_rr *signature, + const ldns_status parent_status) +{ + if (tree + && parent + && tree->parent_count < LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS) { + /* + printf("Add parent for: "); + ldns_rr_print(stdout, tree->rr); + printf("parent: "); + ldns_rr_print(stdout, parent->rr); + */ + tree->parents[tree->parent_count] = + (ldns_dnssec_trust_tree *) parent; + tree->parent_status[tree->parent_count] = parent_status; + tree->parent_signature[tree->parent_count] = (ldns_rr *) signature; + tree->parent_count++; + return LDNS_STATUS_OK; + } else { + return LDNS_STATUS_ERR; + } +} + +/* if rr is null, take the first from the rrset */ +ldns_dnssec_trust_tree * +ldns_dnssec_derive_trust_tree(ldns_dnssec_data_chain *data_chain, ldns_rr *rr) +{ + ldns_rr_list *cur_rrset; + ldns_rr_list *cur_sigs; + ldns_rr *cur_rr = NULL; + ldns_rr *cur_sig_rr; + size_t i, j; + + ldns_dnssec_trust_tree *new_tree = ldns_dnssec_trust_tree_new(); + if(!new_tree) + return NULL; + + if (data_chain && data_chain->rrset) { + cur_rrset = data_chain->rrset; + + cur_sigs = data_chain->signatures; + + if (rr) { + cur_rr = rr; + } + + if (!cur_rr && ldns_rr_list_rr_count(cur_rrset) > 0) { + cur_rr = ldns_rr_list_rr(cur_rrset, 0); + } + + if (cur_rr) { + new_tree->rr = cur_rr; + new_tree->rrset = cur_rrset; + /* there are three possibilities: + 1 - 'normal' rrset, signed by a key + 2 - dnskey signed by other dnskey + 3 - dnskey proven by higher level DS + (data denied by nsec is a special case that can + occur in multiple places) + + */ + if (cur_sigs) { + for (i = 0; i < ldns_rr_list_rr_count(cur_sigs); i++) { + /* find the appropriate key in the parent list */ + cur_sig_rr = ldns_rr_list_rr(cur_sigs, i); + + if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_NSEC) { + if (ldns_dname_compare(ldns_rr_owner(cur_sig_rr), + ldns_rr_owner(cur_rr))) + { + /* find first that does match */ + + for (j = 0; + j < ldns_rr_list_rr_count(cur_rrset) && + ldns_dname_compare(ldns_rr_owner(cur_sig_rr),ldns_rr_owner(cur_rr)) != 0; + j++) { + cur_rr = ldns_rr_list_rr(cur_rrset, j); + + } + if (ldns_dname_compare(ldns_rr_owner(cur_sig_rr), + ldns_rr_owner(cur_rr))) + { + break; + } + } + + } + /* option 1 */ + if (data_chain->parent) { + ldns_dnssec_derive_trust_tree_normal_rrset( + new_tree, + data_chain, + cur_sig_rr); + } + + /* option 2 */ + ldns_dnssec_derive_trust_tree_dnskey_rrset( + new_tree, + data_chain, + cur_rr, + cur_sig_rr); + } + + ldns_dnssec_derive_trust_tree_ds_rrset(new_tree, + data_chain, + cur_rr); + } else { + /* no signatures? maybe it's nsec data */ + + /* just add every rr from parent as new parent */ + ldns_dnssec_derive_trust_tree_no_sig(new_tree, data_chain); + } + } + } + + return new_tree; +} + +void +ldns_dnssec_derive_trust_tree_normal_rrset(ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_sig_rr) +{ + size_t i, j; + ldns_rr_list *cur_rrset = ldns_rr_list_clone(data_chain->rrset); + ldns_dnssec_trust_tree *cur_parent_tree; + ldns_rr *cur_parent_rr; + uint16_t cur_keytag; + ldns_rr_list *tmp_rrset = NULL; + ldns_status cur_status; + + cur_keytag = ldns_rdf2native_int16(ldns_rr_rrsig_keytag(cur_sig_rr)); + + for (j = 0; j < ldns_rr_list_rr_count(data_chain->parent->rrset); j++) { + cur_parent_rr = ldns_rr_list_rr(data_chain->parent->rrset, j); + if (ldns_rr_get_type(cur_parent_rr) == LDNS_RR_TYPE_DNSKEY) { + if (ldns_calc_keytag(cur_parent_rr) == cur_keytag) { + + /* TODO: check wildcard nsec too */ + if (cur_rrset && ldns_rr_list_rr_count(cur_rrset) > 0) { + tmp_rrset = cur_rrset; + if (ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) + == LDNS_RR_TYPE_NSEC || + ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) + == LDNS_RR_TYPE_NSEC3) { + /* might contain different names! + sort and split */ + ldns_rr_list_sort(cur_rrset); + if (tmp_rrset && tmp_rrset != cur_rrset) { + ldns_rr_list_deep_free(tmp_rrset); + tmp_rrset = NULL; + } + tmp_rrset = ldns_rr_list_pop_rrset(cur_rrset); + + /* with nsecs, this might be the wrong one */ + while (tmp_rrset && + ldns_rr_list_rr_count(cur_rrset) > 0 && + ldns_dname_compare( + ldns_rr_owner(ldns_rr_list_rr( + tmp_rrset, 0)), + ldns_rr_owner(cur_sig_rr)) != 0) { + ldns_rr_list_deep_free(tmp_rrset); + tmp_rrset = + ldns_rr_list_pop_rrset(cur_rrset); + } + } + cur_status = ldns_verify_rrsig(tmp_rrset, + cur_sig_rr, + cur_parent_rr); + /* avoid dupes */ + for (i = 0; i < new_tree->parent_count; i++) { + if (cur_parent_rr == new_tree->parents[i]->rr) { + goto done; + } + } + + cur_parent_tree = + ldns_dnssec_derive_trust_tree(data_chain->parent, + cur_parent_rr); + (void)ldns_dnssec_trust_tree_add_parent(new_tree, + cur_parent_tree, + cur_sig_rr, + cur_status); + } + } + } + } + done: + if (tmp_rrset && tmp_rrset != cur_rrset) { + ldns_rr_list_deep_free(tmp_rrset); + } + ldns_rr_list_deep_free(cur_rrset); +} + +void +ldns_dnssec_derive_trust_tree_dnskey_rrset(ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_rr, + ldns_rr *cur_sig_rr) +{ + size_t j; + ldns_rr_list *cur_rrset = data_chain->rrset; + ldns_dnssec_trust_tree *cur_parent_tree; + ldns_rr *cur_parent_rr; + uint16_t cur_keytag; + ldns_status cur_status; + + cur_keytag = ldns_rdf2native_int16(ldns_rr_rrsig_keytag(cur_sig_rr)); + + for (j = 0; j < ldns_rr_list_rr_count(cur_rrset); j++) { + cur_parent_rr = ldns_rr_list_rr(cur_rrset, j); + if (cur_parent_rr != cur_rr && + ldns_rr_get_type(cur_parent_rr) == LDNS_RR_TYPE_DNSKEY) { + if (ldns_calc_keytag(cur_parent_rr) == cur_keytag + ) { + cur_parent_tree = ldns_dnssec_trust_tree_new(); + cur_parent_tree->rr = cur_parent_rr; + cur_parent_tree->rrset = cur_rrset; + cur_status = ldns_verify_rrsig(cur_rrset, + cur_sig_rr, + cur_parent_rr); + (void) ldns_dnssec_trust_tree_add_parent(new_tree, + cur_parent_tree, cur_sig_rr, cur_status); + } + } + } +} + +void +ldns_dnssec_derive_trust_tree_ds_rrset(ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_rr) +{ + size_t j, h; + ldns_rr_list *cur_rrset = data_chain->rrset; + ldns_dnssec_trust_tree *cur_parent_tree; + ldns_rr *cur_parent_rr; + + /* try the parent to see whether there are DSs there */ + if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_DNSKEY && + data_chain->parent && + data_chain->parent->rrset + ) { + for (j = 0; + j < ldns_rr_list_rr_count(data_chain->parent->rrset); + j++) { + cur_parent_rr = ldns_rr_list_rr(data_chain->parent->rrset, j); + if (ldns_rr_get_type(cur_parent_rr) == LDNS_RR_TYPE_DS) { + for (h = 0; h < ldns_rr_list_rr_count(cur_rrset); h++) { + cur_rr = ldns_rr_list_rr(cur_rrset, h); + if (ldns_rr_compare_ds(cur_rr, cur_parent_rr)) { + cur_parent_tree = + ldns_dnssec_derive_trust_tree( + data_chain->parent, cur_parent_rr); + (void) ldns_dnssec_trust_tree_add_parent( + new_tree, + cur_parent_tree, + NULL, + LDNS_STATUS_OK); + } else { + /*ldns_rr_print(stdout, cur_parent_rr);*/ + } + } + } + } + } +} + +void +ldns_dnssec_derive_trust_tree_no_sig(ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain) +{ + size_t i; + ldns_rr_list *cur_rrset; + ldns_rr *cur_parent_rr; + ldns_dnssec_trust_tree *cur_parent_tree; + ldns_status result; + + if (data_chain->parent && data_chain->parent->rrset) { + cur_rrset = data_chain->parent->rrset; + /* nsec? */ + if (cur_rrset && ldns_rr_list_rr_count(cur_rrset) > 0) { + if (ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) == + LDNS_RR_TYPE_NSEC3) { + result = ldns_dnssec_verify_denial_nsec3( + new_tree->rr, + cur_rrset, + data_chain->parent->signatures, + data_chain->packet_rcode, + data_chain->packet_qtype, + data_chain->packet_nodata); + } else if (ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) == + LDNS_RR_TYPE_NSEC3) { + result = ldns_dnssec_verify_denial( + new_tree->rr, + cur_rrset, + data_chain->parent->signatures); + } else { + /* unsigned zone, unsigned parent */ + result = LDNS_STATUS_OK; + } + } else { + result = LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED; + } + for (i = 0; i < ldns_rr_list_rr_count(cur_rrset); i++) { + cur_parent_rr = ldns_rr_list_rr(cur_rrset, i); + cur_parent_tree = + ldns_dnssec_derive_trust_tree(data_chain->parent, + cur_parent_rr); + (void) ldns_dnssec_trust_tree_add_parent(new_tree, + cur_parent_tree, NULL, result); + } + } +} + +/* + * returns OK if there is a path from tree to key with only OK + * the (first) error in between otherwise + * or NOT_FOUND if the key wasn't present at all + */ +ldns_status +ldns_dnssec_trust_tree_contains_keys(ldns_dnssec_trust_tree *tree, + ldns_rr_list *trusted_keys) +{ + size_t i; + ldns_status result = LDNS_STATUS_CRYPTO_NO_DNSKEY; + bool equal; + ldns_status parent_result; + + if (tree && trusted_keys && ldns_rr_list_rr_count(trusted_keys) > 0) + { if (tree->rr) { + for (i = 0; i < ldns_rr_list_rr_count(trusted_keys); i++) { + equal = ldns_rr_compare_ds( + tree->rr, + ldns_rr_list_rr(trusted_keys, i)); + if (equal) { + result = LDNS_STATUS_OK; + return result; + } + } + } + for (i = 0; i < tree->parent_count; i++) { + parent_result = + ldns_dnssec_trust_tree_contains_keys(tree->parents[i], + trusted_keys); + if (parent_result != LDNS_STATUS_CRYPTO_NO_DNSKEY) { + if (tree->parent_status[i] != LDNS_STATUS_OK) { + result = tree->parent_status[i]; + } else { + if (ldns_rr_get_type(tree->rr) + == LDNS_RR_TYPE_NSEC && + parent_result == LDNS_STATUS_OK + ) { + result = + LDNS_STATUS_DNSSEC_EXISTENCE_DENIED; + } else { + result = parent_result; + } + } + } + } + } else { + result = LDNS_STATUS_ERR; + } + + return result; +} + +ldns_status +ldns_verify(ldns_rr_list *rrset, ldns_rr_list *rrsig, const ldns_rr_list *keys, + ldns_rr_list *good_keys) +{ + uint16_t i; + ldns_status verify_result = LDNS_STATUS_ERR; + + if (!rrset || !rrsig || !keys) { + return LDNS_STATUS_ERR; + } + + if (ldns_rr_list_rr_count(rrset) < 1) { + return LDNS_STATUS_ERR; + } + + if (ldns_rr_list_rr_count(rrsig) < 1) { + return LDNS_STATUS_CRYPTO_NO_RRSIG; + } + + if (ldns_rr_list_rr_count(keys) < 1) { + verify_result = LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY; + } else { + for (i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { + ldns_status s = ldns_verify_rrsig_keylist(rrset, + ldns_rr_list_rr(rrsig, i), keys, good_keys); + /* try a little to get more descriptive error */ + if(s == LDNS_STATUS_OK) { + verify_result = LDNS_STATUS_OK; + } else if(verify_result == LDNS_STATUS_ERR) + verify_result = s; + else if(s != LDNS_STATUS_ERR && verify_result == + LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY) + verify_result = s; + } + } + return verify_result; +} + +ldns_status +ldns_verify_notime(ldns_rr_list *rrset, ldns_rr_list *rrsig, + const ldns_rr_list *keys, ldns_rr_list *good_keys) +{ + uint16_t i; + ldns_status verify_result = LDNS_STATUS_ERR; + + if (!rrset || !rrsig || !keys) { + return LDNS_STATUS_ERR; + } + + if (ldns_rr_list_rr_count(rrset) < 1) { + return LDNS_STATUS_ERR; + } + + if (ldns_rr_list_rr_count(rrsig) < 1) { + return LDNS_STATUS_CRYPTO_NO_RRSIG; + } + + if (ldns_rr_list_rr_count(keys) < 1) { + verify_result = LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY; + } else { + for (i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { + ldns_status s = ldns_verify_rrsig_keylist_notime(rrset, + ldns_rr_list_rr(rrsig, i), keys, good_keys); + + /* try a little to get more descriptive error */ + if (s == LDNS_STATUS_OK) { + verify_result = LDNS_STATUS_OK; + } else if (verify_result == LDNS_STATUS_ERR) { + verify_result = s; + } else if (s != LDNS_STATUS_ERR && verify_result == + LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY) { + verify_result = s; + } + } + } + return verify_result; +} + +ldns_rr_list * +ldns_fetch_valid_domain_keys(const ldns_resolver *res, + const ldns_rdf *domain, + const ldns_rr_list *keys, + ldns_status *status) +{ + ldns_rr_list * trusted_keys = NULL; + ldns_rr_list * ds_keys = NULL; + + if (res && domain && keys) { + + if ((trusted_keys = ldns_validate_domain_dnskey(res, + domain, + keys))) { + *status = LDNS_STATUS_OK; + } else { + /* No trusted keys in this domain, we'll have to find some in the parent domain */ + *status = LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY; + + if (ldns_rdf_size(domain) > 1) { + /* Fail if we are at the root */ + ldns_rr_list * parent_keys; + ldns_rdf * parent_domain = ldns_dname_left_chop(domain); + + if ((parent_keys = + ldns_fetch_valid_domain_keys(res, + parent_domain, + keys, + status))) { + /* Check DS records */ + if ((ds_keys = + ldns_validate_domain_ds(res, + domain, + parent_keys))) { + trusted_keys = + ldns_fetch_valid_domain_keys(res, + domain, + ds_keys, + status); + ldns_rr_list_deep_free(ds_keys); + } else { + /* No valid DS at the parent -- fail */ + *status = LDNS_STATUS_CRYPTO_NO_TRUSTED_DS ; + } + ldns_rr_list_deep_free(parent_keys); + } + ldns_rdf_deep_free(parent_domain); + } + } + } + return trusted_keys; +} + +ldns_rr_list * +ldns_validate_domain_dnskey(const ldns_resolver * res, + const ldns_rdf * domain, + const ldns_rr_list * keys) +{ + ldns_pkt * keypkt; + ldns_rr * cur_key; + uint16_t key_i; uint16_t key_j; uint16_t key_k; + uint16_t sig_i; ldns_rr * cur_sig; + + ldns_rr_list * domain_keys = NULL; + ldns_rr_list * domain_sigs = NULL; + ldns_rr_list * trusted_keys = NULL; + + /* Fetch keys for the domain */ + keypkt = ldns_resolver_query(res, domain, + LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, LDNS_RD); + if (keypkt) { + domain_keys = ldns_pkt_rr_list_by_type(keypkt, + LDNS_RR_TYPE_DNSKEY, + LDNS_SECTION_ANSWER); + domain_sigs = ldns_pkt_rr_list_by_type(keypkt, + LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_ANSWER); + + /* Try to validate the record using our keys */ + for (key_i=0; key_i< ldns_rr_list_rr_count(domain_keys); key_i++) { + + cur_key = ldns_rr_list_rr(domain_keys, key_i); + for (key_j=0; key_j sizeof(buf)) + return NULL; /* sanity check */ + /* prepend the 0x02 (from docs) (or actually 0x04 from implementation + * of openssl) for uncompressed data */ + buf[0] = POINT_CONVERSION_UNCOMPRESSED; + memmove(buf+1, key, keylen); + if(!o2i_ECPublicKey(&ec, &pp, (int)keylen+1)) { + EC_KEY_free(ec); + return NULL; + } + evp_key = EVP_PKEY_new(); + if(!evp_key) { + EC_KEY_free(ec); + return NULL; + } + EVP_PKEY_assign_EC_KEY(evp_key, ec); + return evp_key; +} + +static ldns_status +ldns_verify_rrsig_ecdsa_raw(unsigned char* sig, size_t siglen, + ldns_buffer* rrset, unsigned char* key, size_t keylen, uint8_t algo) +{ + EVP_PKEY *evp_key; + ldns_status result; + const EVP_MD *d; + + evp_key = ldns_ecdsa2pkey_raw(key, keylen, algo); + if(!evp_key) { + /* could not convert key */ + return LDNS_STATUS_CRYPTO_BOGUS; + } + if(algo == LDNS_ECDSAP256SHA256) + d = EVP_sha256(); + else d = EVP_sha384(); /* LDNS_ECDSAP384SHA384 */ + result = ldns_verify_rrsig_evp_raw(sig, siglen, rrset, evp_key, d); + EVP_PKEY_free(evp_key); + return result; +} +#endif + +ldns_status +ldns_verify_rrsig_buffers(ldns_buffer *rawsig_buf, ldns_buffer *verify_buf, + ldns_buffer *key_buf, uint8_t algo) +{ + return ldns_verify_rrsig_buffers_raw( + (unsigned char*)ldns_buffer_begin(rawsig_buf), + ldns_buffer_position(rawsig_buf), + verify_buf, + (unsigned char*)ldns_buffer_begin(key_buf), + ldns_buffer_position(key_buf), algo); +} + +ldns_status +ldns_verify_rrsig_buffers_raw(unsigned char* sig, size_t siglen, + ldns_buffer *verify_buf, unsigned char* key, size_t keylen, + uint8_t algo) +{ + /* check for right key */ + switch(algo) { + case LDNS_DSA: + case LDNS_DSA_NSEC3: + return ldns_verify_rrsig_dsa_raw(sig, + siglen, + verify_buf, + key, + keylen); + break; + case LDNS_RSASHA1: + case LDNS_RSASHA1_NSEC3: + return ldns_verify_rrsig_rsasha1_raw(sig, + siglen, + verify_buf, + key, + keylen); + break; +#ifdef USE_SHA2 + case LDNS_RSASHA256: + return ldns_verify_rrsig_rsasha256_raw(sig, + siglen, + verify_buf, + key, + keylen); + break; + case LDNS_RSASHA512: + return ldns_verify_rrsig_rsasha512_raw(sig, + siglen, + verify_buf, + key, + keylen); + break; +#endif +#ifdef USE_GOST + case LDNS_ECC_GOST: + return ldns_verify_rrsig_gost_raw(sig, siglen, verify_buf, + key, keylen); + break; +#endif +#ifdef USE_ECDSA + case LDNS_ECDSAP256SHA256: + case LDNS_ECDSAP384SHA384: + return ldns_verify_rrsig_ecdsa_raw(sig, siglen, verify_buf, + key, keylen, algo); + break; +#endif + case LDNS_RSAMD5: + return ldns_verify_rrsig_rsamd5_raw(sig, + siglen, + verify_buf, + key, + keylen); + break; + default: + /* do you know this alg?! */ + return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; + } +} + + +/** + * Reset the ttl in the rrset with the orig_ttl from the sig + * and update owner name if it was wildcard + * Also canonicalizes the rrset. + * @param rrset: rrset to modify + * @param sig: signature to take TTL and wildcard values from + */ +static void +ldns_rrset_use_signature_ttl(ldns_rr_list* rrset_clone, ldns_rr* rrsig) +{ + uint32_t orig_ttl; + uint16_t i; + uint8_t label_count; + ldns_rdf *wildcard_name; + ldns_rdf *wildcard_chopped; + ldns_rdf *wildcard_chopped_tmp; + + orig_ttl = ldns_rdf2native_int32( ldns_rr_rdf(rrsig, 3)); + label_count = ldns_rdf2native_int8(ldns_rr_rdf(rrsig, 2)); + + for(i = 0; i < ldns_rr_list_rr_count(rrset_clone); i++) { + if (label_count < + ldns_dname_label_count( + ldns_rr_owner(ldns_rr_list_rr(rrset_clone, i)))) { + (void) ldns_str2rdf_dname(&wildcard_name, "*"); + wildcard_chopped = ldns_rdf_clone(ldns_rr_owner( + ldns_rr_list_rr(rrset_clone, i))); + while (label_count < ldns_dname_label_count(wildcard_chopped)) { + wildcard_chopped_tmp = ldns_dname_left_chop( + wildcard_chopped); + ldns_rdf_deep_free(wildcard_chopped); + wildcard_chopped = wildcard_chopped_tmp; + } + (void) ldns_dname_cat(wildcard_name, wildcard_chopped); + ldns_rdf_deep_free(wildcard_chopped); + ldns_rdf_deep_free(ldns_rr_owner(ldns_rr_list_rr( + rrset_clone, i))); + ldns_rr_set_owner(ldns_rr_list_rr(rrset_clone, i), + wildcard_name); + } + ldns_rr_set_ttl(ldns_rr_list_rr(rrset_clone, i), orig_ttl); + /* convert to lowercase */ + ldns_rr2canonical(ldns_rr_list_rr(rrset_clone, i)); + } +} + +/** + * Make raw signature buffer out of rrsig + * @param rawsig_buf: raw signature buffer for result + * @param rrsig: signature to convert + * @return OK or more specific error. + */ +static ldns_status +ldns_rrsig2rawsig_buffer(ldns_buffer* rawsig_buf, ldns_rr* rrsig) +{ + uint8_t sig_algo = ldns_rdf2native_int8(ldns_rr_rdf(rrsig, 1)); + /* check for known and implemented algo's now (otherwise + * the function could return a wrong error + */ + /* create a buffer with signature rdata */ + /* for some algorithms we need other data than for others... */ + /* (the DSA API wants DER encoding for instance) */ + + switch(sig_algo) { + case LDNS_RSAMD5: + case LDNS_RSASHA1: + case LDNS_RSASHA1_NSEC3: +#ifdef USE_SHA2 + case LDNS_RSASHA256: + case LDNS_RSASHA512: +#endif +#ifdef USE_GOST + case LDNS_ECC_GOST: +#endif + if (ldns_rdf2buffer_wire(rawsig_buf, + ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { + return LDNS_STATUS_MEM_ERR; + } + break; + case LDNS_DSA: + case LDNS_DSA_NSEC3: + /* EVP takes rfc2459 format, which is a tad longer than dns format */ + if (ldns_convert_dsa_rrsig_rdf2asn1(rawsig_buf, + ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { + /* + if (ldns_rdf2buffer_wire(rawsig_buf, + ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { + */ + return LDNS_STATUS_MEM_ERR; + } + break; +#ifdef USE_ECDSA + case LDNS_ECDSAP256SHA256: + case LDNS_ECDSAP384SHA384: + /* EVP produces an ASN prefix on the signature, which is + * not used in the DNS */ + if (ldns_convert_ecdsa_rrsig_rdf2asn1(rawsig_buf, + ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { + return LDNS_STATUS_MEM_ERR; + } + break; +#endif + case LDNS_DH: + case LDNS_ECC: + case LDNS_INDIRECT: + return LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL; + default: + return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; + } + return LDNS_STATUS_OK; +} + +/** + * Check RRSIG timestamps against the given 'now' time. + * @param rrsig: signature to check. + * @param now: the current time in seconds epoch. + * @return status code LDNS_STATUS_OK if all is fine. + */ +static ldns_status +ldns_rrsig_check_timestamps(ldns_rr* rrsig, int32_t now) +{ + int32_t inception, expiration; + + /* check the signature time stamps */ + inception = (int32_t)ldns_rdf2native_time_t( + ldns_rr_rrsig_inception(rrsig)); + expiration = (int32_t)ldns_rdf2native_time_t( + ldns_rr_rrsig_expiration(rrsig)); + + if (expiration - inception < 0) { + /* bad sig, expiration before inception?? Tsssg */ + return LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION; + } + if (now - inception < 0) { + /* bad sig, inception date has not yet come to pass */ + return LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED; + } + if (expiration - now < 0) { + /* bad sig, expiration date has passed */ + return LDNS_STATUS_CRYPTO_SIG_EXPIRED; + } + return LDNS_STATUS_OK; +} + +/** + * Prepare for verification. + * @param rawsig_buf: raw signature buffer made ready. + * @param verify_buf: data for verification buffer made ready. + * @param rrset_clone: made ready. + * @param rrsig: signature to prepare for. + * @return LDNS_STATUS_OK is all went well. Otherwise specific error. + */ +static ldns_status +ldns_prepare_for_verify(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf, + ldns_rr_list* rrset_clone, ldns_rr* rrsig) +{ + ldns_status result; + + /* canonicalize the sig */ + ldns_dname2canonical(ldns_rr_owner(rrsig)); + + /* check if the typecovered is equal to the type checked */ + if (ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rrsig)) != + ldns_rr_get_type(ldns_rr_list_rr(rrset_clone, 0))) + return LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR; + + /* create a buffer with b64 signature rdata */ + result = ldns_rrsig2rawsig_buffer(rawsig_buf, rrsig); + if(result != LDNS_STATUS_OK) + return result; + + /* use TTL from signature. Use wildcard names for wildcards */ + /* also canonicalizes rrset_clone */ + ldns_rrset_use_signature_ttl(rrset_clone, rrsig); + + /* sort the rrset in canonical order */ + ldns_rr_list_sort(rrset_clone); + + /* put the signature rr (without the b64) to the verify_buf */ + if (ldns_rrsig2buffer_wire(verify_buf, rrsig) != LDNS_STATUS_OK) + return LDNS_STATUS_MEM_ERR; + + /* add the rrset in verify_buf */ + if(ldns_rr_list2buffer_wire(verify_buf, rrset_clone) + != LDNS_STATUS_OK) + return LDNS_STATUS_MEM_ERR; + + return LDNS_STATUS_OK; +} + +/** + * Check if a key matches a signature. + * Checks keytag, sigalgo and signature. + * @param rawsig_buf: raw signature buffer for verify + * @param verify_buf: raw data buffer for verify + * @param rrsig: the rrsig + * @param key: key to attempt. + * @return LDNS_STATUS_OK if OK, else some specific error. + */ +static ldns_status +ldns_verify_test_sig_key(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf, + ldns_rr* rrsig, ldns_rr* key) +{ + uint8_t sig_algo = ldns_rdf2native_int8(ldns_rr_rdf(rrsig, 1)); + + /* before anything, check if the keytags match */ + if (ldns_calc_keytag(key) + == + ldns_rdf2native_int16(ldns_rr_rrsig_keytag(rrsig)) + ) { + ldns_buffer* key_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); + ldns_status result = LDNS_STATUS_ERR; + + /* put the key-data in a buffer, that's the third rdf, with + * the base64 encoded key data */ + if (ldns_rdf2buffer_wire(key_buf, ldns_rr_rdf(key, 3)) + != LDNS_STATUS_OK) { + ldns_buffer_free(key_buf); + /* returning is bad might screw up + good keys later in the list + what to do? */ + return LDNS_STATUS_ERR; + } + + if (sig_algo == ldns_rdf2native_int8(ldns_rr_rdf(key, 2))) { + result = ldns_verify_rrsig_buffers(rawsig_buf, + verify_buf, key_buf, sig_algo); + } else { + /* No keys with the corresponding algorithm are found */ + result = LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY; + } + + ldns_buffer_free(key_buf); + return result; + } + else { + /* No keys with the corresponding keytag are found */ + return LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY; + } +} + +/* + * to verify: + * - create the wire fmt of the b64 key rdata + * - create the wire fmt of the sorted rrset + * - create the wire fmt of the b64 sig rdata + * - create the wire fmt of the sig without the b64 rdata + * - cat the sig data (without b64 rdata) to the rrset + * - verify the rrset+sig, with the b64 data and the b64 key data + */ +ldns_status +ldns_verify_rrsig_keylist(ldns_rr_list *rrset, + ldns_rr *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys) +{ + ldns_status result; + ldns_rr_list *valid = ldns_rr_list_new(); + if (!valid) + return LDNS_STATUS_MEM_ERR; + + result = ldns_verify_rrsig_keylist_notime(rrset, rrsig, keys, valid); + if(result != LDNS_STATUS_OK) { + ldns_rr_list_free(valid); + return result; + } + + /* check timestamps last; its OK except time */ + result = ldns_rrsig_check_timestamps(rrsig, (int32_t)time(NULL)); + if(result != LDNS_STATUS_OK) { + ldns_rr_list_free(valid); + return result; + } + + ldns_rr_list_cat(good_keys, valid); + ldns_rr_list_free(valid); + return LDNS_STATUS_OK; +} + +ldns_status +ldns_verify_rrsig_keylist_notime(ldns_rr_list *rrset, + ldns_rr *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys) +{ + ldns_buffer *rawsig_buf; + ldns_buffer *verify_buf; + uint16_t i; + ldns_status result, status; + ldns_rr_list *rrset_clone; + ldns_rr_list *validkeys; + + if (!rrset) { + return LDNS_STATUS_ERR; + } + + validkeys = ldns_rr_list_new(); + if (!validkeys) { + return LDNS_STATUS_MEM_ERR; + } + + /* clone the rrset so that we can fiddle with it */ + rrset_clone = ldns_rr_list_clone(rrset); + + /* create the buffers which will certainly hold the raw data */ + rawsig_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); + verify_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + result = ldns_prepare_for_verify(rawsig_buf, verify_buf, + rrset_clone, rrsig); + if(result != LDNS_STATUS_OK) { + ldns_buffer_free(verify_buf); + ldns_buffer_free(rawsig_buf); + ldns_rr_list_deep_free(rrset_clone); + ldns_rr_list_free(validkeys); + return result; + } + + result = LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY; + for(i = 0; i < ldns_rr_list_rr_count(keys); i++) { + status = ldns_verify_test_sig_key(rawsig_buf, verify_buf, + rrsig, ldns_rr_list_rr(keys, i)); + if (status == LDNS_STATUS_OK) { + /* one of the keys has matched, don't break + * here, instead put the 'winning' key in + * the validkey list and return the list + * later */ + if (!ldns_rr_list_push_rr(validkeys, + ldns_rr_list_rr(keys,i))) { + /* couldn't push the key?? */ + ldns_buffer_free(rawsig_buf); + ldns_buffer_free(verify_buf); + ldns_rr_list_deep_free(rrset_clone); + ldns_rr_list_free(validkeys); + return LDNS_STATUS_MEM_ERR; + } + + result = status; + } + + if (result == LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY) { + result = status; + } + } + + /* no longer needed */ + ldns_rr_list_deep_free(rrset_clone); + ldns_buffer_free(rawsig_buf); + ldns_buffer_free(verify_buf); + + if (ldns_rr_list_rr_count(validkeys) == 0) { + /* no keys were added, return last error */ + ldns_rr_list_free(validkeys); + return result; + } + + /* do not check timestamps */ + + ldns_rr_list_cat(good_keys, validkeys); + ldns_rr_list_free(validkeys); + return LDNS_STATUS_OK; +} + +ldns_status +ldns_verify_rrsig(ldns_rr_list *rrset, ldns_rr *rrsig, ldns_rr *key) +{ + ldns_buffer *rawsig_buf; + ldns_buffer *verify_buf; + ldns_status result; + ldns_rr_list *rrset_clone; + + if (!rrset) { + return LDNS_STATUS_NO_DATA; + } + /* clone the rrset so that we can fiddle with it */ + rrset_clone = ldns_rr_list_clone(rrset); + /* create the buffers which will certainly hold the raw data */ + rawsig_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); + verify_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + result = ldns_prepare_for_verify(rawsig_buf, verify_buf, + rrset_clone, rrsig); + if(result != LDNS_STATUS_OK) { + ldns_rr_list_deep_free(rrset_clone); + ldns_buffer_free(rawsig_buf); + ldns_buffer_free(verify_buf); + return result; + } + result = ldns_verify_test_sig_key(rawsig_buf, verify_buf, + rrsig, key); + /* no longer needed */ + ldns_rr_list_deep_free(rrset_clone); + ldns_buffer_free(rawsig_buf); + ldns_buffer_free(verify_buf); + + /* check timestamp last, apart from time its OK */ + if(result == LDNS_STATUS_OK) + result = ldns_rrsig_check_timestamps(rrsig, + (int32_t)time(NULL)); + + return result; +} + +ldns_status +ldns_verify_rrsig_evp(ldns_buffer *sig, + ldns_buffer *rrset, + EVP_PKEY *key, + const EVP_MD *digest_type) +{ + return ldns_verify_rrsig_evp_raw( + (unsigned char*)ldns_buffer_begin(sig), + ldns_buffer_position(sig), + rrset, + key, + digest_type); +} + +ldns_status +ldns_verify_rrsig_evp_raw(unsigned char *sig, size_t siglen, + ldns_buffer *rrset, EVP_PKEY *key, const EVP_MD *digest_type) +{ + EVP_MD_CTX ctx; + int res; + + EVP_MD_CTX_init(&ctx); + + EVP_VerifyInit(&ctx, digest_type); + EVP_VerifyUpdate(&ctx, + ldns_buffer_begin(rrset), + ldns_buffer_position(rrset)); + res = EVP_VerifyFinal(&ctx, sig, (unsigned int) siglen, key); + + EVP_MD_CTX_cleanup(&ctx); + + if (res == 1) { + return LDNS_STATUS_OK; + } else if (res == 0) { + return LDNS_STATUS_CRYPTO_BOGUS; + } + /* TODO how to communicate internal SSL error? + let caller use ssl's get_error() */ + return LDNS_STATUS_SSL_ERR; +} + +ldns_status +ldns_verify_rrsig_dsa(ldns_buffer *sig, ldns_buffer *rrset, ldns_buffer *key) +{ + return ldns_verify_rrsig_dsa_raw( + (unsigned char*) ldns_buffer_begin(sig), + ldns_buffer_position(sig), + rrset, + (unsigned char*) ldns_buffer_begin(key), + ldns_buffer_position(key)); +} + +ldns_status +ldns_verify_rrsig_rsasha1(ldns_buffer *sig, ldns_buffer *rrset, ldns_buffer *key) +{ + return ldns_verify_rrsig_rsasha1_raw( + (unsigned char*)ldns_buffer_begin(sig), + ldns_buffer_position(sig), + rrset, + (unsigned char*) ldns_buffer_begin(key), + ldns_buffer_position(key)); +} + +ldns_status +ldns_verify_rrsig_rsamd5(ldns_buffer *sig, ldns_buffer *rrset, ldns_buffer *key) +{ + return ldns_verify_rrsig_rsamd5_raw( + (unsigned char*)ldns_buffer_begin(sig), + ldns_buffer_position(sig), + rrset, + (unsigned char*) ldns_buffer_begin(key), + ldns_buffer_position(key)); +} + +ldns_status +ldns_verify_rrsig_dsa_raw(unsigned char* sig, size_t siglen, + ldns_buffer* rrset, unsigned char* key, size_t keylen) +{ + EVP_PKEY *evp_key; + ldns_status result; + + evp_key = EVP_PKEY_new(); + EVP_PKEY_assign_DSA(evp_key, ldns_key_buf2dsa_raw(key, keylen)); + result = ldns_verify_rrsig_evp_raw(sig, + siglen, + rrset, + evp_key, + EVP_dss1()); + EVP_PKEY_free(evp_key); + return result; + +} + +ldns_status +ldns_verify_rrsig_rsasha1_raw(unsigned char* sig, size_t siglen, + ldns_buffer* rrset, unsigned char* key, size_t keylen) +{ + EVP_PKEY *evp_key; + ldns_status result; + + evp_key = EVP_PKEY_new(); + EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); + result = ldns_verify_rrsig_evp_raw(sig, + siglen, + rrset, + evp_key, + EVP_sha1()); + EVP_PKEY_free(evp_key); + + return result; +} + +ldns_status +ldns_verify_rrsig_rsasha256_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen) +{ +#ifdef USE_SHA2 + EVP_PKEY *evp_key; + ldns_status result; + + evp_key = EVP_PKEY_new(); + EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); + result = ldns_verify_rrsig_evp_raw(sig, + siglen, + rrset, + evp_key, + EVP_sha256()); + EVP_PKEY_free(evp_key); + + return result; +#else + /* touch these to prevent compiler warnings */ + (void) sig; + (void) siglen; + (void) rrset; + (void) key; + (void) keylen; + return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; +#endif +} + +ldns_status +ldns_verify_rrsig_rsasha512_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen) +{ +#ifdef USE_SHA2 + EVP_PKEY *evp_key; + ldns_status result; + + evp_key = EVP_PKEY_new(); + EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); + result = ldns_verify_rrsig_evp_raw(sig, + siglen, + rrset, + evp_key, + EVP_sha512()); + EVP_PKEY_free(evp_key); + + return result; +#else + /* touch these to prevent compiler warnings */ + (void) sig; + (void) siglen; + (void) rrset; + (void) key; + (void) keylen; + return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; +#endif +} + + +ldns_status +ldns_verify_rrsig_rsamd5_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen) +{ + EVP_PKEY *evp_key; + ldns_status result; + + evp_key = EVP_PKEY_new(); + EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); + result = ldns_verify_rrsig_evp_raw(sig, + siglen, + rrset, + evp_key, + EVP_md5()); + EVP_PKEY_free(evp_key); + + return result; +} + +#endif diff --git a/libs/ldns/dnssec_zone.c b/libs/ldns/dnssec_zone.c new file mode 100644 index 0000000000..e2a5fce6ed --- /dev/null +++ b/libs/ldns/dnssec_zone.c @@ -0,0 +1,836 @@ +/* + * special zone file structures and functions for better dnssec handling + */ + +#include + +#include + +ldns_dnssec_rrs * +ldns_dnssec_rrs_new() +{ + ldns_dnssec_rrs *new_rrs; + new_rrs = LDNS_MALLOC(ldns_dnssec_rrs); + if(!new_rrs) return NULL; + new_rrs->rr = NULL; + new_rrs->next = NULL; + return new_rrs; +} + +INLINE void +ldns_dnssec_rrs_free_internal(ldns_dnssec_rrs *rrs, int deep) +{ + ldns_dnssec_rrs *next; + while (rrs) { + next = rrs->next; + if (deep) { + ldns_rr_free(rrs->rr); + } + LDNS_FREE(rrs); + rrs = next; + } +} + +void +ldns_dnssec_rrs_free(ldns_dnssec_rrs *rrs) +{ + ldns_dnssec_rrs_free_internal(rrs, 0); +} + +void +ldns_dnssec_rrs_deep_free(ldns_dnssec_rrs *rrs) +{ + ldns_dnssec_rrs_free_internal(rrs, 1); +} + +ldns_status +ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr) +{ + int cmp; + ldns_dnssec_rrs *new_rrs; + if (!rrs || !rr) { + return LDNS_STATUS_ERR; + } + + /* this could be done more efficiently; name and type should already + be equal */ + cmp = ldns_rr_compare(rrs->rr, + rr); + /* should we error on equal? */ + if (cmp <= 0) { + if (rrs->next) { + return ldns_dnssec_rrs_add_rr(rrs->next, rr); + } else { + new_rrs = ldns_dnssec_rrs_new(); + new_rrs->rr = rr; + rrs->next = new_rrs; + } + } else if (cmp > 0) { + /* put the current old rr in the new next, put the new + rr in the current container */ + new_rrs = ldns_dnssec_rrs_new(); + new_rrs->rr = rrs->rr; + new_rrs->next = rrs->next; + rrs->rr = rr; + rrs->next = new_rrs; + } + return LDNS_STATUS_OK; +} + +void +ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs) +{ + if (!rrs) { + fprintf(out, ""); + } else { + if (rrs->rr) { + ldns_rr_print(out, rrs->rr); + } + if (rrs->next) { + ldns_dnssec_rrs_print(out, rrs->next); + } + } +} + +ldns_dnssec_rrsets * +ldns_dnssec_rrsets_new() +{ + ldns_dnssec_rrsets *new_rrsets; + new_rrsets = LDNS_MALLOC(ldns_dnssec_rrsets); + if(!new_rrsets) return NULL; + new_rrsets->rrs = NULL; + new_rrsets->type = 0; + new_rrsets->signatures = NULL; + new_rrsets->next = NULL; + return new_rrsets; +} + +INLINE void +ldns_dnssec_rrsets_free_internal(ldns_dnssec_rrsets *rrsets, int deep) +{ + if (rrsets) { + if (rrsets->rrs) { + ldns_dnssec_rrs_free_internal(rrsets->rrs, deep); + } + if (rrsets->next) { + ldns_dnssec_rrsets_free_internal(rrsets->next, deep); + } + if (rrsets->signatures) { + ldns_dnssec_rrs_free_internal(rrsets->signatures, deep); + } + LDNS_FREE(rrsets); + } +} + +void +ldns_dnssec_rrsets_free(ldns_dnssec_rrsets *rrsets) +{ + ldns_dnssec_rrsets_free_internal(rrsets, 0); +} + +void +ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets) +{ + ldns_dnssec_rrsets_free_internal(rrsets, 1); +} + +ldns_rr_type +ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets) +{ + if (rrsets) { + return rrsets->type; + } else { + return 0; + } +} + +ldns_status +ldns_dnssec_rrsets_set_type(ldns_dnssec_rrsets *rrsets, + ldns_rr_type type) +{ + if (rrsets) { + rrsets->type = type; + return LDNS_STATUS_OK; + } + return LDNS_STATUS_ERR; +} + +ldns_dnssec_rrsets * +ldns_dnssec_rrsets_new_frm_rr(ldns_rr *rr) +{ + ldns_dnssec_rrsets *new_rrsets; + ldns_rr_type rr_type; + bool rrsig; + + new_rrsets = ldns_dnssec_rrsets_new(); + rr_type = ldns_rr_get_type(rr); + if (rr_type == LDNS_RR_TYPE_RRSIG) { + rrsig = true; + rr_type = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); + } else { + rrsig = false; + } + if (!rrsig) { + new_rrsets->rrs = ldns_dnssec_rrs_new(); + new_rrsets->rrs->rr = rr; + } else { + new_rrsets->signatures = ldns_dnssec_rrs_new(); + new_rrsets->signatures->rr = rr; + } + new_rrsets->type = rr_type; + return new_rrsets; +} + +ldns_status +ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr) +{ + ldns_dnssec_rrsets *new_rrsets; + ldns_rr_type rr_type; + bool rrsig = false; + ldns_status result = LDNS_STATUS_OK; + + if (!rrsets || !rr) { + return LDNS_STATUS_ERR; + } + + rr_type = ldns_rr_get_type(rr); + + if (rr_type == LDNS_RR_TYPE_RRSIG) { + rrsig = true; + rr_type = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); + } + + if (!rrsets->rrs && rrsets->type == 0 && !rrsets->signatures) { + if (!rrsig) { + rrsets->rrs = ldns_dnssec_rrs_new(); + rrsets->rrs->rr = rr; + rrsets->type = rr_type; + } else { + rrsets->signatures = ldns_dnssec_rrs_new(); + rrsets->signatures->rr = rr; + rrsets->type = rr_type; + } + return LDNS_STATUS_OK; + } + + if (rr_type > ldns_dnssec_rrsets_type(rrsets)) { + if (rrsets->next) { + result = ldns_dnssec_rrsets_add_rr(rrsets->next, rr); + } else { + new_rrsets = ldns_dnssec_rrsets_new_frm_rr(rr); + rrsets->next = new_rrsets; + } + } else if (rr_type < ldns_dnssec_rrsets_type(rrsets)) { + /* move the current one into the new next, + replace field of current with data from new rr */ + new_rrsets = ldns_dnssec_rrsets_new(); + new_rrsets->rrs = rrsets->rrs; + new_rrsets->type = rrsets->type; + new_rrsets->signatures = rrsets->signatures; + new_rrsets->next = rrsets->next; + if (!rrsig) { + rrsets->rrs = ldns_dnssec_rrs_new(); + rrsets->rrs->rr = rr; + rrsets->signatures = NULL; + } else { + rrsets->rrs = NULL; + rrsets->signatures = ldns_dnssec_rrs_new(); + rrsets->signatures->rr = rr; + } + rrsets->type = rr_type; + rrsets->next = new_rrsets; + } else { + /* equal, add to current rrsets */ + if (rrsig) { + if (rrsets->signatures) { + result = ldns_dnssec_rrs_add_rr(rrsets->signatures, rr); + } else { + rrsets->signatures = ldns_dnssec_rrs_new(); + rrsets->signatures->rr = rr; + } + } else { + if (rrsets->rrs) { + result = ldns_dnssec_rrs_add_rr(rrsets->rrs, rr); + } else { + rrsets->rrs = ldns_dnssec_rrs_new(); + rrsets->rrs->rr = rr; + } + } + } + + return result; +} + +void +ldns_dnssec_rrsets_print_soa(FILE *out, + ldns_dnssec_rrsets *rrsets, + bool follow, + bool show_soa) +{ + if (!rrsets) { + fprintf(out, "\n"); + } else { + if (rrsets->rrs && + (show_soa || + ldns_rr_get_type(rrsets->rrs->rr) != LDNS_RR_TYPE_SOA + ) + ) { + ldns_dnssec_rrs_print(out, rrsets->rrs); + if (rrsets->signatures) { + ldns_dnssec_rrs_print(out, rrsets->signatures); + } + } + if (follow && rrsets->next) { + ldns_dnssec_rrsets_print_soa(out, rrsets->next, follow, show_soa); + } + } +} + +void +ldns_dnssec_rrsets_print(FILE *out, ldns_dnssec_rrsets *rrsets, bool follow) +{ + ldns_dnssec_rrsets_print_soa(out, rrsets, follow, true); +} + +ldns_dnssec_name * +ldns_dnssec_name_new() +{ + ldns_dnssec_name *new_name; + + new_name = LDNS_MALLOC(ldns_dnssec_name); + if (!new_name) { + return NULL; + } + + new_name->name = NULL; + new_name->rrsets = NULL; + new_name->name_alloced = false; + new_name->nsec = NULL; + new_name->nsec_signatures = NULL; + + new_name->is_glue = false; + new_name->hashed_name = NULL; + + return new_name; +} + +ldns_dnssec_name * +ldns_dnssec_name_new_frm_rr(ldns_rr *rr) +{ + ldns_dnssec_name *new_name = ldns_dnssec_name_new(); + + new_name->name = ldns_rr_owner(rr); + if(ldns_dnssec_name_add_rr(new_name, rr) != LDNS_STATUS_OK) { + ldns_dnssec_name_free(new_name); + return NULL; + } + + return new_name; +} + +INLINE void +ldns_dnssec_name_free_internal(ldns_dnssec_name *name, + int deep) +{ + if (name) { + if (name->name_alloced) { + ldns_rdf_deep_free(name->name); + } + if (name->rrsets) { + ldns_dnssec_rrsets_free_internal(name->rrsets, deep); + } + if (name->nsec && deep) { + ldns_rr_free(name->nsec); + } + if (name->nsec_signatures) { + ldns_dnssec_rrs_free_internal(name->nsec_signatures, deep); + } + if (name->hashed_name) { + if (deep) { + ldns_rdf_deep_free(name->hashed_name); + } + } + LDNS_FREE(name); + } +} + +void +ldns_dnssec_name_free(ldns_dnssec_name *name) +{ + ldns_dnssec_name_free_internal(name, 0); +} + +void +ldns_dnssec_name_deep_free(ldns_dnssec_name *name) +{ + ldns_dnssec_name_free_internal(name, 1); +} + +ldns_rdf * +ldns_dnssec_name_name(ldns_dnssec_name *name) +{ + if (name) { + return name->name; + } + return NULL; +} + +void +ldns_dnssec_name_set_name(ldns_dnssec_name *rrset, + ldns_rdf *dname) +{ + if (rrset && dname) { + rrset->name = dname; + } +} + +ldns_rr * +ldns_dnssec_name_nsec(ldns_dnssec_name *rrset) +{ + if (rrset) { + return rrset->nsec; + } + return NULL; +} + +void +ldns_dnssec_name_set_nsec(ldns_dnssec_name *rrset, ldns_rr *nsec) +{ + if (rrset && nsec) { + rrset->nsec = nsec; + } +} + +int +ldns_dnssec_name_cmp(const void *a, const void *b) +{ + ldns_dnssec_name *na = (ldns_dnssec_name *) a; + ldns_dnssec_name *nb = (ldns_dnssec_name *) b; + + if (na && nb) { + return ldns_dname_compare(ldns_dnssec_name_name(na), + ldns_dnssec_name_name(nb)); + } else if (na) { + return 1; + } else if (nb) { + return -1; + } else { + return 0; + } +} + +ldns_status +ldns_dnssec_name_add_rr(ldns_dnssec_name *name, + ldns_rr *rr) +{ + ldns_status result = LDNS_STATUS_OK; + ldns_rdf *name_name; + bool hashed_name = false; + ldns_rr_type rr_type; + ldns_rr_type typecovered = 0; + + /* special handling for NSEC3 and NSECX covering RRSIGS */ + + if (!name || !rr) { + return LDNS_STATUS_ERR; + } + + rr_type = ldns_rr_get_type(rr); + + if (rr_type == LDNS_RR_TYPE_RRSIG) { + typecovered = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); + } + +#ifdef HAVE_SSL + if (rr_type == LDNS_RR_TYPE_NSEC3 || + typecovered == LDNS_RR_TYPE_NSEC3) { + name_name = ldns_nsec3_hash_name_frm_nsec3(rr, + ldns_dnssec_name_name(name)); + hashed_name = true; + } else { + name_name = ldns_dnssec_name_name(name); + } +#else + name_name = ldns_dnssec_name_name(name); +#endif /* HAVE_SSL */ + + if (rr_type == LDNS_RR_TYPE_NSEC || + rr_type == LDNS_RR_TYPE_NSEC3) { + /* XX check if is already set (and error?) */ + name->nsec = rr; + } else if (typecovered == LDNS_RR_TYPE_NSEC || + typecovered == LDNS_RR_TYPE_NSEC3) { + if (name->nsec_signatures) { + result = ldns_dnssec_rrs_add_rr(name->nsec_signatures, rr); + } else { + name->nsec_signatures = ldns_dnssec_rrs_new(); + name->nsec_signatures->rr = rr; + } + } else { + /* it's a 'normal' RR, add it to the right rrset */ + if (name->rrsets) { + result = ldns_dnssec_rrsets_add_rr(name->rrsets, rr); + } else { + name->rrsets = ldns_dnssec_rrsets_new(); + result = ldns_dnssec_rrsets_add_rr(name->rrsets, rr); + } + } + + if (hashed_name) { + ldns_rdf_deep_free(name_name); + } + + return result; +} + +ldns_dnssec_rrsets * +ldns_dnssec_name_find_rrset(ldns_dnssec_name *name, + ldns_rr_type type) { + ldns_dnssec_rrsets *result; + + result = name->rrsets; + while (result) { + if (result->type == type) { + return result; + } else { + result = result->next; + } + } + return NULL; +} + +ldns_dnssec_rrsets * +ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone, + ldns_rdf *dname, + ldns_rr_type type) +{ + ldns_rbnode_t *node; + + if (!zone || !dname) { + return NULL; + } + + node = ldns_rbtree_search(zone->names, dname); + if (node) { + return ldns_dnssec_name_find_rrset((ldns_dnssec_name *)node->data, + type); + } else { + return NULL; + } +} + +void +ldns_dnssec_name_print_soa(FILE *out, ldns_dnssec_name *name, bool show_soa) +{ + if (name) { + if(name->rrsets) { + ldns_dnssec_rrsets_print_soa(out, name->rrsets, true, show_soa); + } else { + fprintf(out, ";; Empty nonterminal: "); + ldns_rdf_print(out, name->name); + fprintf(out, "\n"); + } + if(name->nsec) { + ldns_rr_print(out, name->nsec); + } + if (name->nsec_signatures) { + ldns_dnssec_rrs_print(out, name->nsec_signatures); + } + } else { + fprintf(out, "\n"); + } +} + +void +ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name) +{ + ldns_dnssec_name_print_soa(out, name, true); +} + +ldns_dnssec_zone * +ldns_dnssec_zone_new() +{ + ldns_dnssec_zone *zone = LDNS_MALLOC(ldns_dnssec_zone); + if(!zone) return NULL; + zone->soa = NULL; + zone->names = NULL; + + return zone; +} + +void +ldns_dnssec_name_node_free(ldns_rbnode_t *node, void *arg) { + (void) arg; + ldns_dnssec_name_free((ldns_dnssec_name *)node->data); + free(node); +} + +void +ldns_dnssec_name_node_deep_free(ldns_rbnode_t *node, void *arg) { + (void) arg; + ldns_dnssec_name_deep_free((ldns_dnssec_name *)node->data); + free(node); +} + +void +ldns_dnssec_zone_free(ldns_dnssec_zone *zone) +{ + if (zone) { + if (zone->names) { + /* destroy all name structures within the tree */ + ldns_traverse_postorder(zone->names, + ldns_dnssec_name_node_free, + NULL); + free(zone->names); + } + LDNS_FREE(zone); + } +} + +void +ldns_dnssec_zone_deep_free(ldns_dnssec_zone *zone) +{ + if (zone) { + if (zone->names) { + /* destroy all name structures within the tree */ + ldns_traverse_postorder(zone->names, + ldns_dnssec_name_node_deep_free, + NULL); + free(zone->names); + } + LDNS_FREE(zone); + } +} + +/* use for dname comparison in tree */ +int +ldns_dname_compare_v(const void *a, const void *b) { + return ldns_dname_compare((ldns_rdf *)a, (ldns_rdf *)b); +} + +#ifdef HAVE_SSL +ldns_rbnode_t * +ldns_dnssec_zone_find_nsec3_original(ldns_dnssec_zone *zone, + ldns_rr *rr) { + ldns_rbnode_t *current_node = ldns_rbtree_first(zone->names); + ldns_dnssec_name *current_name; + ldns_rdf *hashed_name; + + hashed_name = ldns_dname_label(ldns_rr_owner(rr), 0); + + while (current_node != LDNS_RBTREE_NULL) { + current_name = (ldns_dnssec_name *) current_node->data; + if (!current_name->hashed_name) { + current_name->hashed_name = + ldns_nsec3_hash_name_frm_nsec3(rr, current_name->name); + } + if (ldns_dname_compare(hashed_name, + current_name->hashed_name) + == 0) { + ldns_rdf_deep_free(hashed_name); + return current_node; + } + current_node = ldns_rbtree_next(current_node); + } + ldns_rdf_deep_free(hashed_name); + return NULL; +} + +ldns_status +ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr) +{ + ldns_status result = LDNS_STATUS_OK; + ldns_dnssec_name *cur_name; + ldns_rbnode_t *cur_node; + ldns_rr_type type_covered = 0; + + if (!zone || !rr) { + return LDNS_STATUS_ERR; + } + + if (!zone->names) { + zone->names = ldns_rbtree_create(ldns_dname_compare_v); + if(!zone->names) return LDNS_STATUS_MEM_ERR; + } + + /* we need the original of the hashed name if this is + an NSEC3, or an RRSIG that covers an NSEC3 */ + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_RRSIG) { + type_covered = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); + } + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_NSEC3 || + type_covered == LDNS_RR_TYPE_NSEC3) { + cur_node = ldns_dnssec_zone_find_nsec3_original(zone, + rr); + if (!cur_node) { + return LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND; + } + } else { + cur_node = ldns_rbtree_search(zone->names, ldns_rr_owner(rr)); + } + + if (!cur_node) { + /* add */ + cur_name = ldns_dnssec_name_new_frm_rr(rr); + if(!cur_name) return LDNS_STATUS_MEM_ERR; + cur_node = LDNS_MALLOC(ldns_rbnode_t); + if(!cur_node) { + ldns_dnssec_name_free(cur_name); + return LDNS_STATUS_MEM_ERR; + } + cur_node->key = ldns_rr_owner(rr); + cur_node->data = cur_name; + (void)ldns_rbtree_insert(zone->names, cur_node); + } else { + cur_name = (ldns_dnssec_name *) cur_node->data; + result = ldns_dnssec_name_add_rr(cur_name, rr); + } + + if (result != LDNS_STATUS_OK) { + fprintf(stderr, "error adding rr: "); + ldns_rr_print(stderr, rr); + } + + /*TODO ldns_dnssec_name_print_names(stdout, zone->names, 0);*/ + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { + zone->soa = cur_name; + } + + return result; +} +#endif /* HAVE_SSL */ + +void +ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa) +{ + ldns_rbnode_t *node; + ldns_dnssec_name *name; + + node = ldns_rbtree_first(tree); + while (node != LDNS_RBTREE_NULL) { + name = (ldns_dnssec_name *) node->data; + ldns_dnssec_name_print_soa(out, name, print_soa); + fprintf(out, ";\n"); + node = ldns_rbtree_next(node); + } +} + +void +ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone) +{ + if (zone) { + if (zone->soa) { + fprintf(out, ";; Zone: "); + ldns_rdf_print(out, ldns_dnssec_name_name(zone->soa)); + fprintf(out, "\n;\n"); + ldns_dnssec_rrsets_print( + out, + ldns_dnssec_name_find_rrset(zone->soa, + LDNS_RR_TYPE_SOA), + false); + fprintf(out, ";\n"); + } + + if (zone->names) { + ldns_dnssec_zone_names_print(out, zone->names, false); + } + } +} + +ldns_status +ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone) +{ + ldns_dnssec_name *new_name; + ldns_rdf *cur_name; + ldns_rdf *next_name; + ldns_rbnode_t *cur_node, *next_node, *new_node; + + /* for the detection */ + uint16_t i, cur_label_count, next_label_count; + uint16_t soa_label_count = 0; + ldns_rdf *l1, *l2; + int lpos; + + if (!zone) { + return LDNS_STATUS_ERR; + } + if (zone->soa && zone->soa->name) { + soa_label_count = ldns_dname_label_count(zone->soa->name); + } + + cur_node = ldns_rbtree_first(zone->names); + while (cur_node != LDNS_RBTREE_NULL) { + next_node = ldns_rbtree_next(cur_node); + + /* skip glue */ + while (next_node != LDNS_RBTREE_NULL && + next_node->data && + ((ldns_dnssec_name *)next_node->data)->is_glue + ) { + next_node = ldns_rbtree_next(next_node); + } + + if (next_node == LDNS_RBTREE_NULL) { + next_node = ldns_rbtree_first(zone->names); + } + + cur_name = ((ldns_dnssec_name *)cur_node->data)->name; + next_name = ((ldns_dnssec_name *)next_node->data)->name; + cur_label_count = ldns_dname_label_count(cur_name); + next_label_count = ldns_dname_label_count(next_name); + + /* Since the names are in canonical order, we can + * recognize empty non-terminals by their labels; + * every label after the first one on the next owner + * name is a non-terminal if it either does not exist + * in the current name or is different from the same + * label in the current name (counting from the end) + */ + for (i = 1; i < next_label_count - soa_label_count; i++) { + lpos = (int)cur_label_count - (int)next_label_count + (int)i; + if (lpos >= 0) { + l1 = ldns_dname_label(cur_name, (uint8_t)lpos); + } else { + l1 = NULL; + } + l2 = ldns_dname_label(next_name, i); + + if (!l1 || ldns_dname_compare(l1, l2) != 0) { + /* We have an empty nonterminal, add it to the + * tree + */ + new_name = ldns_dnssec_name_new(); + if (!new_name) { + return LDNS_STATUS_MEM_ERR; + } + new_name->name = ldns_dname_clone_from(next_name, + i); + if (!new_name) { + ldns_dnssec_name_free(new_name); + return LDNS_STATUS_MEM_ERR; + } + new_name->name_alloced = true; + new_node = LDNS_MALLOC(ldns_rbnode_t); + if (!new_node) { + ldns_dnssec_name_free(new_name); + return LDNS_STATUS_MEM_ERR; + } + new_node->key = new_name->name; + new_node->data = new_name; + (void)ldns_rbtree_insert(zone->names, new_node); + } + ldns_rdf_deep_free(l1); + ldns_rdf_deep_free(l2); + } + + /* we might have inserted a new node after + * the current one so we can't just use next() + */ + if (next_node != ldns_rbtree_first(zone->names)) { + cur_node = next_node; + } else { + cur_node = LDNS_RBTREE_NULL; + } + } + return LDNS_STATUS_OK; +} diff --git a/libs/ldns/doc/API-header.xml b/libs/ldns/doc/API-header.xml new file mode 100644 index 0000000000..a4cd081bee --- /dev/null +++ b/libs/ldns/doc/API-header.xml @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + +LibDNS API + + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + miek@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + jelte@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + erik@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ +DNS +Elite +Hacking + + +A small abstract will come here, TBD. + + +
+ + + +
+ +LibDNS (or lDNS) is modelled after the Net::DNS perl library. It has +been shown that Net::DNS can be used vefficiently for +programming DNS aware applications. We want to bring the same +level of efficiency to C programmers. + + +The lDNS API consist of two layers. The top-layer, this is +what is actually exported to the application via the library. And the +bottom-layer, this is what lDNS needs to compile and function. + +
+ +
+ +Short intermezzo detailing differences with other libraries. Most important +ones are the libc resolver interface (from BIND8) and the lwres_ interface +from BIND9. + +
+ +
+ +At its lowest level lDNS is only dependent on libc. It uses a +few networking systems calls; socket, bind, send/recv and friends. + + +Further more it is to be expected that lDNS will depend on OpenSSL for +its cryptography. + + +As said, lDNS is modelled after Net::DNS, therefor its application API +looks very much like the one used for Net::DNS. Some modification are made +ofcourse, because not all functionality of Perl can be caught in C. + + + +This API document was written by carefully looking at the documentation +contained in the Net::DNS Perl module. + +
diff --git a/libs/ldns/doc/API.xml b/libs/ldns/doc/API.xml new file mode 100644 index 0000000000..07007b9a29 --- /dev/null +++ b/libs/ldns/doc/API.xml @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + +LibDNS API + + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + miek@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + jelte@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + erik@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ +DNS +Elite +Hacking + + +A small abstract will come here, TBD. + + +
+ + + +
+ +LibDNS (or lDNS) is modelled after the Net::DNS perl library. It has +been shown that Net::DNS can be used vefficiently for +programming DNS aware applications. We want to bring the same +level of efficiency to C programmers. + + +The lDNS API consist of two layers. The top-layer, this is +what is actually exported to the application via the library. And the +bottom-layer, this is what lDNS needs to compile and function. + +
+ +
+ +Short intermezzo detailing differences with other libraries. Most important +ones are the libc resolver interface (from BIND8) and the lwres_ interface +from BIND9. + +
+ +
+ +At its lowest level lDNS is only dependent on libc. It uses a +few networking systems calls; socket, bind, send/recv and friends. + + +Further more it is to be expected that lDNS will depend on OpenSSL for +its cryptography. + + +As said, lDNS is modelled after Net::DNS, therefor its application API +looks very much like the one used for Net::DNS. Some modification are made +ofcourse, because not all functionality of Perl can be caught in C. + + + +This API document was written by carefully looking at the documentation +contained in the Net::DNS Perl module. + +
+ +
+ +The rdf structure, the RData Field, is a type that contains the different +types in the rdata of an RR. Consider the following example: + +example.com. IN MX 10 mx.example.com. + +The "10 mx.example.com." is the rdata in this case. It consists of two +fields, "10" and "mx.example.com". These have the types (in this case) +LDNS_RDF_TYPE_INT8 and LDNS_RDF_TYPE_DNAME. + + +The following functions operate on this structure. + + + + +Create a new rdf structure. Return a pointer to it. + + +Get the size of a rdf structure. + + +Set the size of a rdf structure. + + +Set the type of a rdf structure. + + +Get the type of a rdf structure. + + +Set the (binary/network order) data of a rdf structure. + + +Get a pointer to the data in a rdf structure. + + +Free a rdf structure. + + +Create a new rdf structure from a string and a specific rdf_type. +The type is needed to perform the correct conversion. + + + +
+ +
+ +These functions operate on ldns_rr structures. + + + + +Returns a pointer to the newly created ldns_rr structure. + + +Prints the record to the stream s. + + +Returns a pointer to a ldns_buffer containing with string containing +RR-specific data. + + +Returns the record's owner name as a ldns_rdf type. + + +Returns the record's type. + + +Returns the record's class. + + +Returns the record's time-to-live (TTL). + + + + + +TODO the 'set' functions of the 'get' + +
+ +
+ +In the DNS the atomic data type is an RRset. This is a list +of RRs with the same ownername, type and class. Net::DNS doesn't +have rrsets as a seperate object. + + +In lDNS we have the ldns_rr_list, which just holds a bunch of RR's. +No specific check are made on the RRs that can be put in such a list. +Special wrapper functions exist which allow the usage of ldns_rr_list +of real (RFC compliant) RR sets. + + +TODO: See rr.c + +
+ +
+ + + +Create a new resolver structure and return the pointer to that. + + +Returns the version of lDNS. + + +Returns a ldns_pkt representing the MX records +for the specified dname. Function is documented differently in Net::DNS. +Do we need stuff like this?? XXX + + + Set the default domain for this resolver. This domain is added + when a query is made with a name without a trailing dot. + + + + +Add a new nameserver to the resolver. These nameservers are queried + when a search() or query() is done. + + + + Add a domain to the searchlist of a resolver. + + + Perform a query. Try all the nameservers in the *res structure. Apply + the search list. And default domain. +If type is NULL it defaults to 'A', +If class is NULL it default to 'IN'. + + +Perform a query. Only the default domain is added. +If type is NULL it defaults to 'A', +If class is NULL it default to 'IN'. + + +No search list nor default domain is applied. Return a pointer to a ldns_pkt +structure with the information from the nameserver. +If type is NULL it defaults to 'A', +If class is NULL it default to 'IN'. + + + + +TODO XX Gazillion helper functions to set port, src-port, etc. etc. + +
+ +
+ +A packet structure (ldns_pkt) has five sections: + +The header section, a ldns_hdr structure. +The question section, a ldns_rr_list structure. +The answer section, a ldns_rr_list structure. +The authority section, a ldns_rr_list structure. +The additional section, a ldns_rr_list structure. + + + + + +ldns_hdr represents the header section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + + + + + + +Creates a new empty packet. + + +Returns the packet data in binary format, suitable for sending to a +nameserver. [XXX, suitable for sending to a NS?] + + +Returns a ldns_hdr structure representing the header section of +the packet. + + + Returns a pointer to a ldns_rr_list representing the question section +of the packet. + + + Returns a pointer to a ldns_rr_list representing the answer section of +the packet. + + + +Returns a pointer to a ldns_rr_list representing the authority section +of the packet. + + + +Returns a pointer to a ldns_rr_list of representing the additional +section of the packet. + + + +Prints the packet data on the standard output in an ASCII format similar +to that used in DNS zone files. See RFC1035. + + + +Returns a ldns_buffer containing the string representation of the packet. + + + +Returns the IP address from which we received this packet. User-created +packets will return NULL. + + + +Returns the size of the packet in bytes as it was received from a +nameserver. User-created packets will return 0. [XXX +user-created??] + + + +Adds *rr to the specified section of the packet. Return LDNS_STATUS_OK +on success, LDNS_STATUS_ERR otherwise. + + + +Adds *rr to the specified section of the packet provided that the RR +does not already exist in the packet. Return LDNS_STATUS_OK +on success, LDNS_STATUS_ERR otherwise. + + +Removes a RR from the specified section of the packet. Returns NULL if +no RR's could be popped. + + +Retrieve all RRs in a packet matching certain criteria. XXX function needs +to be specified better. + + +Print packet p to stream s. + + + + +
+ +
+ +Some resource records can have special access function no other RR has. +Those are detailed here. XXX TODO don't exist (yet?). + +
+ +
+ +insert your long list here. + +
+ +
+ +A small example, which queries a nameserver on localhost +to diplay the MX records for miek.nl. + + + +
+ +/** + * An example ldns program + * In semi-C code + * + * Setup a resolver + * Query a nameserver + * Print the result + */ + +#include <ldns.h> + +int +main(void) +{ + ldns_resolver *res; + ldns_rdf *default_dom; + ldns_rdf *nameserver; + ldns_rdf *qname; + ldns_pkt *pkt; + + /* init */ + res = ldns_resolver_new(); + if (!res) + return 1; + + /* create a default domain and add it */ + default_dom = ldns_rdf_new_frm_str("miek.nl.", LDNS_RDF_TYPE_DNAME); + nameserver = ldns_rdf_new_frm_str("127.0.0.1", LDNS_RDF_TYPE_A); + + if (ldns_resolver_domain(res, default_dom) != LDNS_STATUS_OK) + return 1; + if (ldns_resolver_nameserver_push(res, nameserver) != LDNS_STATUS_OK) + return 1; + + /* setup the question */ + qname = ldns_rdf_new_frm_str("www", LDNS_RDF_TYPE_DNAME); + + /* fire it off. "miek.nl." will be added */ + pkt = ldns_resolver_query(res, qname, LDNS_RR_TYPE_MX, NULL); + + /* print the resulting pkt to stdout */ + ldns_pkt_print(stdout, pkt); + + return 0; +} + +
+
+
+ +
+ + +
diff --git a/libs/ldns/doc/CodingStyle b/libs/ldns/doc/CodingStyle new file mode 100644 index 0000000000..a326e5c3f9 --- /dev/null +++ b/libs/ldns/doc/CodingStyle @@ -0,0 +1,64 @@ +The libdns coding style guide + +* Use of tabs (real tabs, 8 positions long) +* Spaces only after comma's, and in between operators. + And after keywords (if, while, for) +* Underscores to make long names readable +* prefix (exported) identifiers with 'ldns_' +* no unneeded parentheses after 'return' +* always curly brackets in if-statements +* use defines for (weird) constants, and masks +* type 'bool', constants 'true'/'false'. Don't compare bools for + equality. +* always use LDNS_MALLOC/FREE etc, or the new/free/deep_free functions +* buffer can scale, so don't alloc the max size, but the min size +* make lint (uses splint) is your friend + + +* Return values: + - status code (structure to fill is usually passed as a first argument) + - new/pointer: return pointer or NULL on error + - 'read' functions: ldns_status wire2thing(uint8_t *p, size_t max, + size_t pos, *thing); + - void functions like ldns_rr_free + - bool functions + +* Parameter sequence: (dest, [dest_meta, ] src, [src_meta] etc) +* structure/union field names start with _ when "private" +* enum for rcode, opcode, types etc, + example: + enum ldns_rcode { + LDNS_RCODE_OK = 0, + ... = ., + LDNS_RCODE_FIRST = LDNS_RCODE_OK, + LDNS_RCODE_LAST = 15, + LDNS_RCODE_COUNT = LDNS_RCODE_LAST + 1 + } +* Everything by reference, all data structures an optional _clone() function +* arrays: ps[] with size_t p_count for the number of elements +* _size for size in bytes +* _free and _clone copies perform deep free/copy. + +* Standard abbreviations, don't abbreviate other names: + + id = identity + rr = resource record + rrset = resource record set + rdata = resource data + rdf = resource data field + rcode = result code + qr = query/resource bit + aa = authoritative answer + tc = truncated + rd = recursion disabled + cd = checking disabled + ra = recursion available + ad = authentic data + qdcount = question section count + ancount = answer section count + nscount = authority section count + arcount = additional section count + +ldns- +* use exit(EXIT_FAILURE)/ exit(SUCCES) +* diff --git a/libs/ldns/doc/TODO b/libs/ldns/doc/TODO new file mode 100644 index 0000000000..52a408c8a4 --- /dev/null +++ b/libs/ldns/doc/TODO @@ -0,0 +1,19 @@ +TODO + +Features: +* Multi-line zone file parsing +* Configure option for not printing DNSSEC RR comments +* HMAC and MD5 without OpenSSL +* HIP RR support +* Parse 'search' attribute in /etc/resolv.conf +* Make use of automake (Bug #173) +* ./configure --with-tools --with-drill (Bug #264) +* Drill: print appropriate DS RRs (relates to Bug #355) +* ldns-signzone optout to be really optout + +Bugfixes: +* Bug #279: fix return values for net.h functions, and related: make return + values for functions that cannot return memory-failure today. Needs medium + version increase because of API change. +* Long out-standing packaging bugs (debian) +* Lazy ABI diff --git a/libs/ldns/doc/design.dox b/libs/ldns/doc/design.dox new file mode 100644 index 0000000000..a4cbeadb8f --- /dev/null +++ b/libs/ldns/doc/design.dox @@ -0,0 +1,124 @@ +/** \page design Design + +The following image shows the various modules of libdns and their +functionality. + +\image html libdnsoverview.png + +\section central_structures Central structures + + - \ref ldns_pkt A DNS Packet, which can contain a query, answers, and additional information. + - \ref ldns_rr A Resource Record, which holds a bit of information about a specific domain name. + - \ref ldns_rdf An RDATA field, every Resource Record contains one or more RDATA fields, depending on the type of RR. These are the 'basic types' of DNS data. + - \ref ldns_rr_list A list of resource records + - \ref ldns_zone A representation of a DNS Zone. + +The actual structure definitions are named \c ldns_struct_ which are all typedeffed to \c ldns_ + + +A DNS Resource record looks like this: + +
+nlnetlabs.nl.   600     IN      MX             10    open.nlnetlabs.nl.
+ \              \       \       \              \                     /
+  owner          ttl     class   type           \        rdf[]      /
+  (rdf)     (uint32_t) (rr_class) (rr_type)
+                                                 10          := rdf[0]
+                                                 open.nlnetlabs.nl. := rdf[1]
+
+ +* Owner: +The owner name is put in an \c ldns_rdf structure, which is a normal rdata field but always +has the type LDNS_RDF_TYPE_DNAME. + +An \ref ldns_rdf structure has 3 members; the size, the type of rdata and a void * +pointer to the data. The data is always in uncompressed wireformat. + +The RSH (rdata) is put in an array of rdf's (in this case 2). + +The entire resource record is put in a RR structure, which has +the fields described above (under the RR): + - owner (nlnetlabs.nl.) + - ttl (600) + - class (LDNS_RR_CLASS_IN: 'IN') + - type (LDNS_RR_TYPE_MX: 'MX') + - rd_count (2) + - rdata_fields[rd_count] + - rdf[0] (10) + - rdf[1] (open.nlnetlabs.nl.) + +* RR list structure: +An RR list structure is simply a structure with a counter +and an array of RR structures. Different kinds of RR's can +be grouped together this way. + +* RRset structure: +An RRset structure is an RR list structure, but its accessor +function checks if the \c ldns_rr structures in there are: + - from the same type + - have the same TTL + - have the same ownername + +This is the RFC definition of an RRset. + +* pkt structure: +A pkt structure consists out of a header structure where +packet specific flags are kept, TC, RD, IP from the server which +sent the packet, etc. +Further more it is divided in 4 sections: question, authority, answer +and additional. + +All four sections have the type RRlist that simply hold a list of RR's + + +\section wire_module Wire module and central structures Interface + +As the WIRE module takes care of the compression/decompression +it needs a buffer which holds all the binary DNS data. +All functions will operate on such a buffer to extract specific +information which is then stored in RR structures. + + +\section resolver_module Resolver module and central structures Interface + +The resolver module always returns a pkt structure. Either with +the answer or a SERVFAIL pkt. + +The exact function-call parameters have not yet been +decided on. + +Also the resolver module will need to access some of the +to_wire and from_wire function to creates ldn_pkt's from +the data it receives (arrow not drawn). + + +\section str_module str module and central structures Interface + +Convert to and from strings. This module could be used +to read in a zone file (list of RRs) and convert the text strings to +the format used by ldns. Or the other way around. + + +\section net_module Net module and resolver module interface + +The resolver module will get a packet and will mold it so that +it can be sent off to a nameserver. +It might need to interface with the wire module (arrow not drawn). + +\section Net module and OS/libc interface +OS/network calls will be used here. The Net module is the only part of +the library where the underlying OS matters. + +\section Client program ldns interface +Any client program will have access to +- Wire module +- Central structures +- Resolver module +- str module (arrow not drawn in the above figure) + +\section dnssec_module DNSSEC module +The DNSSEC types are handled in the RR module, but the crypto +routines are contained in this module. This module will depend +on OpenSSL for the crypto routines. + +*/ diff --git a/libs/ldns/doc/dns-lib-implementations b/libs/ldns/doc/dns-lib-implementations new file mode 100644 index 0000000000..18d01afb30 --- /dev/null +++ b/libs/ldns/doc/dns-lib-implementations @@ -0,0 +1,56 @@ +http://www.posadis.org/projects/poslib.php +Poslib DNS library - Default branch + +http://www.posadis.org/poslib?DokuWiki=2b00f9da090fb9d4ad3d6e98b9c2f61f + +Poslib is the C++ library for applications using the Domain Name System +that is used by all Posadis tools, including the Posadis DNS server and the +Zoneedit and Dnsquery tools. It consists of a library for creating client +applications using DNS, and a server library for DNS servers. + + +FireDNS Library +http://firestuff.org/projects/firedns +FireDNS Library +--------------- +(c) 2002 Ian Gulliver under the GNU Public License, Version 2. +See GPL for more details. + +From libfiredns(3): + +libfiredns is a library for handling asynchronous DNS +requests. It provides a very simple interface for sending +requests and parsing reponses, as well as low-timeout +blocking functions. libfiredns functions have much lower +timeouts than the stock functions and tend to be faster +because they send requests to all configured system +nameservers at the same time. + +If you have questions or comments, you can reach me at +ian@penguinhosting.net. + + + +skadns + + Skadns is Kind of an Asynchronous DNS client software. + + * Kind of: it's small. Really small. But it just works. + * Asynchronous: all DNS operations are non-blocking. + * DNS client software: it's a DNS client, what you may know as a "stub resolver". To perform full DNS resolution, you will still need a full resolver like dnscache. + + Similar work + + * ares is an asynchronous DNS resolver library with a nice interface + * and more configuration options than skadns (and a very reasonable + * size). Use it if you find that skadns lacks configurability (you + * shouldn't need more than it provides, but well, you're the user). + * Yet it doesn't hide the DNS internals as opaquely as skadns does, + * giving you a bunch of fds to select() on instead of just one. + * adns works fine, and is small for a GNU project. Impressive. But + * the interface is still too complex and much too generic - the + * usual problems with GNU software. + + +ADNS; documentation scares - is it still active +simular aims - different ways diff --git a/libs/ldns/doc/doxyparse.pl b/libs/ldns/doc/doxyparse.pl new file mode 100755 index 0000000000..218825fe1b --- /dev/null +++ b/libs/ldns/doc/doxyparse.pl @@ -0,0 +1,288 @@ +#!/usr/bin/perl + +# Doxygen is usefull for html documentation, but sucks +# in making manual pages. Still tool also parses the .h +# files with the doxygen documentation and creates +# the man page we want +# +# 2 way process +# 1. All the .h files are processed to create in file in which: +# filename | API | description | return values +# are documented +# 2. Another file is parsed which states which function should +# be grouped together in which manpage. Symlinks are also created. +# +# With this all in place, all documentation should be autogenerated +# from the doxydoc. + +use Getopt::Std; + +my $state; +my $description; +my $struct_description; +my $key; +my $return; +my $param; +my $api; +my $const; + +my %description; +my %api; +my %return; +my %options; +my %manpages; +my %see_also; + +my $BASE="doc/man"; +my $MAN_SECTION = "3"; +my $MAN_HEADER = ".TH ldns $MAN_SECTION \"30 May 2006\"\n"; +my $MAN_MIDDLE = ".SH AUTHOR +The ldns team at NLnet Labs. Which consists out of +Jelte Jansen and Miek Gieben. + +.SH REPORTING BUGS +Please report bugs to ldns-team\@nlnetlabs.nl or in +our bugzilla at +http://www.nlnetlabs.nl/bugs/index.html + +.SH COPYRIGHT +Copyright (c) 2004 - 2006 NLnet Labs. +.PP +Licensed under the BSD License. There is NO warranty; not even for +MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. +"; +my $MAN_FOOTER = ".SH REMARKS +This manpage was automaticly generated from the ldns source code by +use of Doxygen and some perl. +"; + +getopts("m:",\%options); +# if -m manpage file is given process that file +# parse the file which tells us what manpages go together +my $functions, $see_also; +if (defined $options{'m'}) { + # process + open(MAN, "<$options{'m'}") or die "Cannot open $options{'m'}"; + # it's line based: + # func1, func2, .. | see_also1, see_also2, ... + while() { + chomp; + if (/^#/) { next; } + if (/^$/) { next; } + ($functions, $see_also) = split /[\t ]*\|[\t ]*/, $_; + #print "{$functions}\n"; + #print "{$see_also}\n"; + my @funcs = split /[\t ]*,[\t ]*/, $functions; + my @also = split /[\t ]*,[\t ]*/, $see_also; + $manpages{$funcs[0]} = \@funcs; + $see_also{$funcs[0]} = \@also; + #print "[", $funcs[0], "]\n"; + } + close(MAN); +} else { + print "Need -m file to process the .h files\n"; + exit 1; +} + +# 0 - somewhere in the file +# 1 - in a doxygen par +# 2 - after doxygen, except funcion + +# create our pwd +mkdir "doc"; +mkdir "doc/man"; +mkdir "doc/man/man$MAN_SECTION"; + +$state = 0; +my $i; +my @lines = ; +my $max = @lines; + +while($i < $max) { + $typedef = ""; + if ($lines[$i] =~ /^typedef struct/ and $lines[$i + 1] =~ /^struct/) { + # move typedef to below struct + $typedef = $lines[$i]; + $j = $i; + while ($lines[$j] !~ /}/) { + $lines[$j] = $lines[$j+1]; + $j++; + } + $lines[$j] = $lines[$j+1]; + $lines[$j + 1] = $typedef; + } + + $cur_line = $lines[$i]; + chomp($cur_line); + if ($cur_line =~ /^\/\*\*[\t ]*$/) { + # /** Seen + #print "Comment seen! [$cur_line]\n"; + $state = 1; + undef $description; + undef $struct_description; + $i++; + next; + } + if ($cur_line =~ /\*\// and $state == 1) { + #print "END Comment seen!\n"; + $state = 2; + $i++; + next; + } + + if ($state == 1) { + # inside doxygen + $cur_line =~ s/\\/\\\\/g; + $cur_line =~ s/^[ \t]*\* ?//; + $description = $description . "\n" . $cur_line; + #$description = $description . "\n.br\n" . $cur_line; + } + if ($state == 2 and $cur_line =~ /const/) { + # the const word exists in the function call + #$const = "const"; + #s/[\t ]*const[\t ]*//; + } else { + #undef $const; + } + + if ($cur_line =~ /^INLINE/) { + $cur_line =~ s/^INLINE\s*//; + while ($cur_line !~ /{/) { + $i++; + $cur_line .= " ".$lines[$i]; + $cur_line =~ s/\n//; + } + $cur_line =~ s/{/;/; + } + + if ($cur_line =~ /^[^#*\/ ]([\w\*]+)[\t ]+(.*?)[({](.*)\s*/ and $state == 2) { + while ($cur_line !~ /\)\s*;/) { + $i++; + $cur_line .= $lines[$i]; + chomp($cur_line); + $cur_line =~ s/\n/ /g; + $cur_line =~ s/\s\s*/ /g; + } + $cur_line =~ /([\w\* ]+)[\t ]+(.*?)\((.*)\)\s*;/; + # this should also end the current comment parsing + $return = $1; + $key = $2; + $api = $3; + # sometimes the * is stuck to the function + # name instead to the return type + if ($key =~ /^\*/) { + #print"Name starts with *\n"; + $key =~ s/^\*//; + if (defined($const)) { + $return = $const . " " . $return . '*'; + } else { + $return = $return . '*'; + } + } + $description =~ s/\\param\[in\][ \t]*([\*\w]+)[ \t]+/.br\n\\fB$1\\fR: /g; + $description =~ s/\\param\[out\][ \t]*([\*\w]+)[ \t]+/.br\n\\fB$1\\fR: /g; + $description =~ s/\\return[ \t]*/.br\nReturns /g; + + $description{$key} = $description; + $api{$key} = $api; + $return{$key} = $return; + undef $description; + undef $struct_description; + $state = 0; + } elsif ($state == 2 and ( + $cur_line =~ /^typedef\sstruct\s(\w+)\s(\w+);/ or + $cur_line =~ /^typedef\senum\s(\w+)\s(\w+);/)) { + $struct_description .= "\n.br\n" . $cur_line; + $key = $2; + $struct_description =~ s/\/\*\*\s*(.*?)\s*\*\//\\fB$1:\\fR/g; + $description{$key} = $struct_description; + $api{$key} = "struct"; + $return{$key} = $1; + undef $description; + undef $struct_description; + $state = 0; + } else { + $struct_description .= "\n.br\n" . $cur_line; + } + $i++; +} + +# create the manpages +foreach (keys %manpages) { + $name = $manpages{$_}; + $also = $see_also{$_}; + + $filename = @$name[0]; + $filename = "$BASE/man$MAN_SECTION/$filename.$MAN_SECTION"; + + my $symlink_file = @$name[0] . "." . $MAN_SECTION; + +# print STDOUT $filename,"\n"; + open (MAN, ">$filename") or die "Can not open $filename"; + + print MAN $MAN_HEADER; + print MAN ".SH NAME\n"; + print MAN join ", ", @$name; + print MAN "\n\n"; + print MAN ".SH SYNOPSIS\n"; + + print MAN "#include \n.br\n"; + print MAN "#include \n.br\n"; + + print MAN ".PP\n"; + print MAN "#include \n"; + print MAN ".PP\n"; + + foreach (@$name) { + $b = $return{$_}; + $b =~ s/\s+$//; + if ($api{$_} ne "struct") { + print MAN $b, " ", $_; + print MAN "(", $api{$_},");\n"; + print MAN ".PP\n"; + } + } + + print MAN "\n.SH DESCRIPTION\n"; + foreach (@$name) { + print MAN ".HP\n"; + print MAN "\\fI", $_, "\\fR"; + if ($api{$_} ne "struct") { + print MAN "()"; + } +# print MAN ".br\n"; + print MAN $description{$_}; + print MAN "\n.PP\n"; + } + + print MAN $MAN_MIDDLE; + + if (defined(@$also)) { + print MAN "\n.SH SEE ALSO\n\\fI"; + print MAN join "\\fR, \\fI", @$also; + print MAN "\\fR.\nAnd "; + print MAN "\\fBperldoc Net::DNS\\fR, \\fBRFC1034\\fR, +\\fBRFC1035\\fR, \\fBRFC4033\\fR, \\fBRFC4034\\fR and \\fBRFC4035\\fR.\n"; + } else { + print MAN ".SH SEE ALSO +\\fBperldoc Net::DNS\\fR, \\fBRFC1034\\fR, +\\fBRFC1035\\fR, \\fBRFC4033\\fR, \\fBRFC4034\\fR and \\fBRFC4035\\fR.\n"; + } + + print MAN $MAN_FOOTER; + + # create symlinks + chdir("$BASE/man$MAN_SECTION"); + foreach (@$name) { + print STDERR $_,"\n"; + my $new_file = $_ . "." . $MAN_SECTION; + if ($new_file eq $symlink_file) { + next; + } + #print STDOUT "\t", $new_file, " -> ", $symlink_file, "\n"; + symlink $symlink_file, $new_file; + } + chdir("../../.."); # and back, tricky and fragile... + close(MAN); +} diff --git a/libs/ldns/doc/function_manpages b/libs/ldns/doc/function_manpages new file mode 100644 index 0000000000..15706fada5 --- /dev/null +++ b/libs/ldns/doc/function_manpages @@ -0,0 +1,223 @@ +# first function name will be the real name of the manpage +# other names are aliases (symlinks) +# all functions specified on the same line are included in the +# same manual page. We cannot deal with linebreaks! +# function named after the pipe `|' are put in the "see also" section + +# functions that must be included, separated by commas + +### host2wire.h +# conversion functions +ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire | ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf +# lower level conversions, some are from host2str.h +ldns_pkt2buffer_str, ldns_pktheader2buffer_str, ldns_rr2buffer_str, ldns_rr_list2buffer_str, ldns_rdf2buffer_str, ldns_key2buffer_str, ldns_pkt2buffer_wire, ldns_rr2buffer_wire, ldns_rdf2buffer_wire, ldns_rrsig2buffer_wire, ldns_rr_rdata2buffer_wire | ldns_pkt2str, ldns_rr2str, ldns_rdf2str, ldns_rr_list2str, ldns_key2str +### /host2wire.h + +### host2str.h +ldns_rr2str, ldns_pkt2str, ldns_rdf2str, ldns_rr_list2str, ldns_key2str | ldns_rr_print, ldns_rdf_print, ldns_pkt_print, ldns_rr_list_print, ldns_resolver_print, ldns_zone_print +ldns_rr_print, ldns_rdf_print, ldns_pkt_print, ldns_rr_list_print, ldns_resolver_print, ldns_zone_print | ldns_rr2str, ldns_rdf2str, ldns_pkt2str, ldns_rr_list2str, ldns_key2str +### /host2str.h + +### host2str.h +# and even lower +ldns_rdf2buffer_str_a, ldns_rdf2buffer_str_aaaa, ldns_rdf2buffer_str_str, ldns_rdf2buffer_str_b64, ldns_rdf2buffer_str_hex, ldns_rdf2buffer_str_type, ldns_rdf2buffer_str_class, ldns_rdf2buffer_str_alg, ldns_rdf2buffer_str_loc, ldns_rdf2buffer_str_unknown, ldns_rdf2buffer_str_nsap, ldns_rdf2buffer_str_wks, ldns_rdf2buffer_str_nsec, ldns_rdf2buffer_str_period, ldns_rdf2buffer_str_tsigtime, ldns_rdf2buffer_str_apl, ldns_rdf2buffer_str_int16_data, ldns_rdf2buffer_str_int16, ldns_rdf2buffer_str_ipseckey +### /host2str.h + +### wire2host.h +# wirefunctions +ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf, ldns_wire2dname | ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire, ldns_dname2wire +ldns_buffer2pkt_wire +### /wire2host.h + +### dname.h +ldns_dname_left_chop, ldns_dname_label_count | ldns_dname +ldns_dname2canonical | ldns_dname +ldns_dname_cat_clone, ldns_dname_cat | ldns_dname +ldns_dname_new, ldns_dname_new_frm_str, ldns_dname_new_frm_data | ldns_dname, ldns_pkt_query_new_frm_str, ldns_rdf_new_frm_str, ldns_rr_new_frm_str +ldns_dname_is_subdomain, ldns_dname_str_absolute, ldns_dname_label | ldns_dname +ldns_dname_compare, ldns_dname_interval | ldns_dname_is_subdomain | ldns_dname +ldns_dname | ldns_dname_left_chop, ldns_dname_label_count, ldns_dname2canonical, ldns_dname_cat, ldns_dname_cat_clone, ldns_dname_new, ldns_dname_new_frm_str, ldns_dname_new_frm_data, ldns_dname_is_subdomain, ldns_dname_str_absolute, ldns_dname_label, ldns_dname_compare, ldns_dname_interval +### /dname.h + +### rdata.h +ldns_rdf, ldns_rdf_type | ldns_rdf_set_size, ldns_rdf_set_type, ldns_rdf_set_data, ldns_rdf_size, ldns_rdf_get_type, ldns_rdf_data, ldns_rdf_compare, ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, ldns_rdf_print, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t +ldns_rdf_set_size, ldns_rdf_set_type, ldns_rdf_set_data | ldns_rdf +ldns_rdf_size, ldns_rdf_get_type, ldns_rdf_data, ldns_rdf_compare | ldns_rdf +ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, ldns_rdf_print | ldns_rdf +ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t | ldns_rdf +ldns_rdf_address_reverse | ldns_rdf +ldns_octet | ldns_rdf +# why is this in rdata.h? +ldns_str2period +### /rdata.h + +### higher.h +ldns_get_rr_list_addr_by_name, ldns_get_rr_list_name_by_addr | ldns_rr_list, ldns_rr +ldns_get_rr_list_hosts_frm_fp, ldns_get_rr_list_hosts_frm_file | ldns_rr_list, ldns_rr, ldns_get_rr_list_hosts_frm_fp_l +ldns_get_rr_list_hosts_frm_fp_l | ldns_rr_list +ldns_getaddrinfo +### /higher.h + +# +### dnssec.h +# +ldns_calc_keytag, ldns_verify, ldns_verify_rrsig, ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5, ldns_key_rr2ds, ldns_key_buf2dsa, ldns_key_buf2rsa | ldns_key, ldns_sign_public, ldns_zone_sign, ldns_verify, ldns_verify_rrsig + +# algs +ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5 | ldns_key, ldns_sign_public, ldns_zone_sign, ldns_verify, ldns_verify_rrsig + +# tsig +ldns_pkt_tsig_verify, ldns_pkt_tsig_sign | ldns_key + +# verify +ldns_verify, ldns_verify_rrsig, ldns_verify_rrsig_keylist, ldns_verify_rrsig_keylist_notime, ldns_verify_notime | ldns_verify_rrsig_evp | ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5, ldns_sign_public, ldns_zone_sign, ldns_key + +# convert +ldns_key_buf2dsa, ldns_key_buf2rsa | ldns_key_rr2ds +ldns_key_rr2ds | ldns_key +ldns_create_nsec | ldns_sign_public + +# signing +ldns_sign_public | ldns_sign_public_dsa, ldns_sign_public_rsamd5, ldns_sign_public_rsasha1, ldns_verify, ldns_verify_rrsig, ldns_key +ldns_sign_public_dsa, ldns_sign_public_rsamd5, ldns_sign_public_rsasha1 | ldns_sign_public +ldns_dnssec_zone_sign, ldns_dnssec_zone_sign_nsec3 | ldns_zone_sign, ldns_zone_sign_nsec3 | ldns_sign_public, ldns_key, ldns_init_random +ldns_init_random | ldns_sign_public, ldns_key +ldns_pkt_verify | ldns_verify, ldns_sign_public, ldns_zone_sign + +# new family of dnssec functions +ldns_dnssec_zone, ldns_dnssec_name, ldns_dnssec_rrs, ldns_dnssec_rrsets | ldns_dnssec_zone_new, ldns_dnssec_name_new, ldns_dnssec_rrs_new, ldns_dnssec_rrsets_new +ldns_dnssec_zone_find_rrset, ldns_dnssec_zone_new, ldns_dnssec_zone_free, ldns_dnssec_zone_add_rr, ldns_dnssec_zone_names_print, ldns_dnssec_zone_print, ldns_dnssec_zone_add_empty_nonterminals | ldns_dnssec_zone +ldns_dnssec_name_new, ldns_dnssec_name_new_frm_rr, ldns_dnssec_name_free, ldns_dnssec_name_name, ldns_dnssec_name_set_name, ldns_dnssec_name_set_nsec, ldns_dnssec_name_cmp, ldns_dnssec_name_add_rr, ldns_dnssec_name_find_rrset, ldns_dnssec_name_print | ldns_dnssec_zone +ldns_dnssec_rrsets_new, ldns_dnssec_rrsets_free, ldns_dnssec_rrsets_type, ldns_dnssec_rrsets_set_type, ldns_dnssec_rrsets_add_rr, ldns_dnssec_rrsets_print | ldns_dnssec_zone +ldns_dnssec_rrs_new, ldns_dnssec_rrs_free, ldns_dnssec_rrs_add_rr, ldns_dnssec_rrs_print | ldns_dnssec_zone + +# verification +ldns_dnssec_data_chain, ldns_dnssec_data_chain_struct, ldns_dnssec_trust_tree | ldns_dnssec_data_chain_new, ldns_dnssec_trust_tree_new, ldns_dnssec_verify_denial +ldns_dnssec_data_chain_new, ldns_dnssec_data_chain_free, ldns_dnssec_data_chain_deep_free, ldns_dnssec_build_data_chain, ldns_dnssec_data_chain_print | ldns_dnssec_data_chain +ldns_dnssec_trust_tree_new, ldns_dnssec_trust_tree_free, ldns_dnssec_trust_tree_depth, ldns_dnssec_derive_trust_tree, ldns_dnssec_trust_tree_contains_keys, ldns_dnssec_trust_tree_print, ldns_dnssec_trust_tree_print_sm, ldns_dnssec_trust_tree_add_parent, ldns_dnssec_derive_trust_tree_normal_rrset, ldns_dnssec_derive_trust_tree_dnskey_rrset, ldns_dnssec_derive_trust_tree_ds_rrset, ldns_dnssec_derive_trust_tree_no_sig | ldns_dnssec_data_chain, ldns_dnssec_trust_tree +ldns_dnssec_verify_denial, ldns_dnssec_verify_denial_nsec3 | ldns_dnssec_trust_tree, ldns_dnssec_data_chain + +# new signing functions +ldns_dnssec_zone_sign, ldns_dnssec_zone_sign_nsec3, ldns_dnssec_zone_mark_glue, ldns_dnssec_name_node_next_nonglue, ldns_dnssec_zone_create_nsecs, ldns_dnssec_remove_signatures, ldns_dnssec_zone_create_rrsigs | ldns_dnssec_zone + +### /dnssec.h + +### dnskey.h +ldns_key_new | ldns_key, ldns_key_list_new +ldns_key_new_frm_algorithm, ldns_key_new_frm_fp, ldns_key_new_frm_fp_l | ldns_key +ldns_key_new_frm_fp_rsa, ldns_key_new_frm_fp_rsa_l | ldns_key_new_frm_fp, ldns_key +ldns_key_new_frm_fp_dsa, ldns_key_new_frm_fp_dsa_l | ldns_key_new_frm_fp, ldns_key +ldns_key_list_new | ldns_key_new, ldns_key +# access, write +ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count, ldns_key_algo_supported | ldns_key_push_key, ldns_key +ldns_key_list_push_key | ldns_key_list_pop_key, ldns_key +ldns_key_list_pop_key | ldns_key_list_push_key, ldns_key +# access, read +ldns_key_list_key_count, ldns_key_list_key, ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key, ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags | ldns_key +# convert +ldns_key2rr | ldns_key +ldns_key_free, ldns_key_deep_free, ldns_key_list_free | ldns_key +# +ldns_key_print | ldns_key_new, ldns_key +ldns_key | ldns_key_new, ldns_key_new_frm_algorithm,ldns_key_new_frm_fp,ldns_key_new_frm_fp_l, ldns_key_new_frm_fp_rsa, ldns_key_new_frm_fp_rsa_l, ldns_key_new_frm_fp_dsa, ldns_key_new_frm_fp_dsa_l, ldns_key_list_new, ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count, ldns_key_list_push_key, ldns_key_list_pop_key, ldns_key_list_key_count, ldns_key_list_key, ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key, ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags, ldns_key2rr, ldns_key_free, ldns_key_deep_free, ldns_key_list_free, ldns_key_print +### /dnskey.h + +### MIEK TOT HIER TOT HIER + +# lists +ldns_key_list_new, ldns_key_list_push_key, ldns_key_list_pop_key, ldns_key_list_key_count, ldns_key_list_key | ldns_key_list, ldns_key +ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key | ldns_key_list, ldns_key + +# gets/sets +ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags | ldns_key +ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count | ldns_key + +# errr.h +ldns_get_errorstr_by_id | ldns_status +ldns_status | ldns_get_errorstr_by_id + +### net.h +ldns_send | ldns_pkt, ldns_resolver +ldns_tcp_send_query, ldns_tcp_read_wire, ldns_tcp_connect | ldns_send, ldns_pkt, ldns_resolver +### /net.h + +### buffer.h +# general +ldns_buffer | ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buffer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export, ldns_buffer_flip, ldns_buffer_rewind, ldns_buffer_position, ldns_buffer_set_position, ldns_buffer_skip, ldns_buffer_limit, ldns_buffer_set_limit, ldns_buffer_capacity, ldns_buffer_set_capacity, ldns_buffer_reserve, ldns_buffer_at, ldns_buffer_begin, ldns_buffer_end, ldns_buffer_current, ldns_buffer_remaining_at, ldns_buffer_remaining, ldns_buffer_available_at, ldns_buffer_available, ldns_buffer_status, ldns_buffer_status_ok, ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buffer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buffer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 +ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buffer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export | ldns_buffer +# position +ldns_buffer_flip, ldns_buffer_rewind, ldns_buffer_position, ldns_buffer_set_position, ldns_buffer_skip | ldns_buffer +# values and pointers +ldns_buffer_limit, ldns_buffer_set_limit, ldns_buffer_capacity, ldns_buffer_set_capacity, ldns_buffer_reserve, ldns_buffer_at, ldns_buffer_begin, ldns_buffer_end, ldns_buffer_current | ldns_buffer +# info +ldns_buffer_remaining_at, ldns_buffer_remaining, ldns_buffer_available_at, ldns_buffer_available, ldns_buffer_status, ldns_buffer_status_ok | ldns_buffer +# read and write +ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buffer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buffer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 | ldns_buffer +### /buffer.h + +# parse.h +ldns_bget_token, ldns_bgetc, ldns_bskipcs | ldns_buffer +ldns_fget_token, ldns_fskipcs | ldns_buffer +ldns_str_remove_comment + + +# rr.h and other general rr funcs +ldns_rr, ldns_rr_class, ldns_rr_type, ldns_rr_compress, ldns_rr_list | ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print, ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf, ldns_rr_push_rdf, ldns_rr_pop_rdf, ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class, ldns_rr_list_rr_count, ldns_rr_list_set_rr_count, ldns_rr_list_new, ldns_rr_list_free, ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr, ldns_is_rrset, ldns_rr_set_push_rr, ldns_rr_set_pop_rr, ldns_get_rr_class_by_name, ldns_get_rr_type_by_name, ldns_rr_list_clone, ldns_rr_list_sort, ldns_rr_compare, ldns_rr_compare_ds, ldns_rr_uncompressed_size, ldns_rr2canonical, ldns_rr_label_count, ldns_is_rrset, ldns_rr_descriptor, ldns_rr_descript +ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print | ldns_rr, ldns_rr_list +ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf | ldns_rr, ldns_rr_list +ldns_rr_push_rdf, ldns_rr_pop_rdf | ldns_rr, ldns_rr_list +ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class | ldns_rr, ldns_rr_list +ldns_rr_list_rr_count, ldns_rr_list_set_rr_count | ldns_rr, ldns_rr_list +ldns_rr_list_new, ldns_rr_list_free | ldns_rr, ldns_rr_list +ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr | ldns_rr, ldns_rr_list +ldns_is_rrset | ldns_rr, ldns_rr_list +ldns_rr_set_push_rr, ldns_rr_set_pop_rr | ldns_rr, ldns_rr_list +ldns_get_rr_class_by_name, ldns_get_rr_type_by_name | ldns_rr, ldns_rr_list +ldns_rr_list_clone | ldns_rr, ldns_rr_list +ldns_rr_list_sort | ldns_rr, ldns_rr_list +ldns_rr_compare, ldns_rr_compare_ds | ldns_rr, ldns_rr_list +ldns_rr_uncompressed_size | ldns_rr, ldns_rr_list +ldns_rr2canonical | ldns_rr, ldns_rr_list +ldns_rr_label_count | ldns_rr, ldns_rr_list +ldns_is_rrset | ldns_rr + +# rr descriptors +ldns_rr_descriptor, ldns_rr_descript, ldns_rr_descriptor_minimum, ldns_rr_descriptor_maximum, ldns_rr_descriptor_field_type | ldns_rr, ldns_rdf + +# packet.h +ldns_pkt, ldns_pkt_section, ldns_pkt_type | ldns_pkt_new, ldns_pkt_free, ldns_pkt_print, ldns_pkt_query_new, ldns_pkt_query_new_frm_str, ldns_pkt_reply_type, ldns_pkt_id, ldns_pkt_qr, ldns_pkt_aa, ldns_pkt_tc, ldns_pkt_rd, ldns_pkt_cd, ldns_pkt_ra, ldns_pkt_ad, ldns_pkt_get_opcode, ldns_pkt_get_rcode, ldns_pkt_qdcount, ldns_pkt_ancount, ldns_pkt_nscount, ldns_pkt_arcount, ldns_pkt_answerfrom, ldns_pkt_querytime, ldns_pkt_size, ldns_pkt_tsig, ldns_pkt_question, ldns_pkt_answer, ldns_pkt_authority, ldns_pkt_additional, ldns_pkt_get_section_clone, ldns_pkt_rr_list_by_name, ldns_pkt_rr_list_by_type, ldns_pkt_rr_list_by_name_and_type, ldns_pkt_set_flags, ldns_pkt_set_id, ldns_pkt_set_qr, ldns_pkt_set_aa, ldns_pkt_set_tc, ldns_pkt_set_rd, ldns_pkt_set_cd, ldns_pkt_set_ra, ldns_pkt_set_ad, ldns_pkt_set_opcode, ldns_pkt_set_rcode, ldns_pkt_set_qdcount, ldns_pkt_set_ancount, ldns_pkt_set_nscount, ldns_pkt_set_arcount, ldns_pkt_set_answerfrom, ldns_pkt_set_querytime, ldns_pkt_set_size, ldns_pkt_set_section_count, ldns_pkt_set_tsig, ldns_pkt_edns, ldns_pkt_edns_udp_size, ldns_pkt_edns_extended_rcode, ldns_pkt_edns_version, ldns_pkt_edns_z, ldns_pkt_edns_data, ldns_pkt_set_edns_udp_size, ldns_pkt_set_edns_extended_rcode, ldns_pkt_set_edns_version, ldns_pkt_set_edns_z, ldns_pkt_set_edns_data + +ldns_pkt_new, ldns_pkt_free, ldns_pkt_print, ldns_pkt_query_new, ldns_pkt_query_new_frm_str, ldns_pkt_reply_type | ldns_pkt +# gets +ldns_pkt_id, ldns_pkt_qr, ldns_pkt_aa, ldns_pkt_tc, ldns_pkt_rd, ldns_pkt_cd, ldns_pkt_ra, ldns_pkt_ad, ldns_pkt_get_opcode, ldns_pkt_get_rcode, ldns_pkt_qdcount, ldns_pkt_ancount, ldns_pkt_nscount, ldns_pkt_arcount, ldns_pkt_answerfrom, ldns_pkt_querytime, ldns_pkt_size, ldns_pkt_tsig, ldns_pkt_question, ldns_pkt_answer, ldns_pkt_authority, ldns_pkt_additional, ldns_pkt_get_section_clone, ldns_pkt_rr_list_by_name, ldns_pkt_rr_list_by_type, ldns_pkt_rr_list_by_name_and_type | ldns_pkt +# sets +ldns_pkt_set_flags, ldns_pkt_set_id, ldns_pkt_set_qr, ldns_pkt_set_aa, ldns_pkt_set_tc, ldns_pkt_set_rd, ldns_pkt_set_cd, ldns_pkt_set_ra, ldns_pkt_set_ad, ldns_pkt_set_opcode, ldns_pkt_set_rcode, ldns_pkt_set_qdcount, ldns_pkt_set_ancount, ldns_pkt_set_nscount, ldns_pkt_set_arcount, ldns_pkt_set_answerfrom, ldns_pkt_set_querytime, ldns_pkt_set_size, ldns_pkt_set_section_count, ldns_pkt_set_tsig | ldns_pkt +# EDNS0 +ldns_pkt_edns, ldns_pkt_edns_udp_size, ldns_pkt_edns_extended_rcode, ldns_pkt_edns_version, ldns_pkt_edns_z, ldns_pkt_edns_data, ldns_pkt_set_edns_udp_size, ldns_pkt_set_edns_extended_rcode, ldns_pkt_set_edns_version, ldns_pkt_set_edns_z, ldns_pkt_set_edns_data | ldns_pkt + +# rr_functions.h +ldns_rr_ns_nsdname +# +ldns_rr_mx_preference, ldns_rr_mx_exchange +# +ldns_rr_rrsig_typecovered, ldns_rr_rrsig_set_typecovered, ldns_rr_rrsig_algorithm, ldns_rr_rrsig_set_algorithm, ldns_rr_rrsig_labels, ldns_rr_rrsig_set_labels, ldns_rr_rrsig_origttl, ldns_rr_rrsig_set_origttl, ldns_rr_rrsig_expiration, ldns_rr_rrsig_set_expiration, ldns_rr_rrsig_inception, ldns_rr_rrsig_set_inception, ldns_rr_rrsig_keytag, ldns_rr_rrsig_set_keytag, ldns_rr_rrsig_signame, ldns_rr_rrsig_set_signame, ldns_rr_rrsig_sig, ldns_rr_rrsig_set_sig +# +ldns_rr_dnskey_flags, ldns_rr_dnskey_set_flags, ldns_rr_dnskey_protocol, ldns_rr_dnskey_set_protocol, ldns_rr_dnskey_algorithm, ldns_rr_dnskey_set_algorithm, ldns_rr_dnskey_key, ldns_rr_dnskey_set_key | ldns_rr + +### zone.h +ldns_zone | ldns_zone_new, ldns_zone_deep_free, ldns_zone_new_frm_fp, ldns_zone_new_frm_fp_l, ldns_zone_sort, ldns_zone_glue_rr_list, ldns_zone_push_rr, ldns_zone_push_rr_list, ldns_zone_set_rrs, ldns_zone_set_soa, ldns_zone_rrs, ldns_zone_soa, ldns_zone_rr_count, + + +ldns_zone_new, ldns_zone_deep_free, ldns_zone_new_frm_fp, ldns_zone_new_frm_fp_l | ldns_zone +ldns_zone_sort, ldns_zone_glue_rr_list | ldns_zone +ldns_zone_push_rr, ldns_zone_push_rr_list | ldns_zone +ldns_zone_set_rrs, ldns_zone_set_soa | ldns_zone, ldns_zone_rrs, ldns_zone_soa +ldns_zone_rrs, ldns_zone_soa | ldns_zone ldns_zone_set_rrs +ldns_zone_rr_count | ldns_zone + +### update.h +ldns_update_pkt_new | ldns_update_pkt_tsig_add, ldns_update_pkt_tsig_add, ldns_update_zocount, ldns_update_prcount, ldns_update_upcount, ldns_update_adcount, ldns_update_set_zocount, ldns_update_set_prcount, ldns_update_set_upcount, ldns_update_set_adcount, + +ldns_update_pkt_tsig_add | ldns_update_pkt_new +ldns_update_zocount, ldns_update_prcount, ldns_update_upcount, ldns_update_adcount | ldns_update_pkt_new +ldns_update_set_zocount, ldns_update_set_prcount, ldns_update_set_upcount, ldns_update_set_adcount | ldns_update_pkt_new diff --git a/libs/ldns/doc/header.html b/libs/ldns/doc/header.html new file mode 100644 index 0000000000..5b311bd986 --- /dev/null +++ b/libs/ldns/doc/header.html @@ -0,0 +1,10 @@ + + +ldns documentation + + + + diff --git a/libs/ldns/doc/images/LogoInGradientBar2-y100.png b/libs/ldns/doc/images/LogoInGradientBar2-y100.png new file mode 100644 index 0000000000000000000000000000000000000000..0e753611279d503619e61b5e518ac2b0f8bb03dc GIT binary patch literal 60773 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
+   % ldns-mx nlnetlabs.nl
+   nlnetlabs.nl.   86400   IN      MX      100 omval.tednet.nl.
+   nlnetlabs.nl.   86400   IN      MX      50 open.nlnetlabs.nl.
+   
+ + First of all, we need to include the correct header files, so + that all functions are available to us: + + \skip include + \until dns.h + + In this case we have used a configure script to generate a config.h file + that does all our inclusions for us, so that it can be compiled on + multiple platforms. If your platform supports the include files \c + stdint.h and \c stdlib.h, you can include these instead of using a + configure script. + + The first included files are prerequisites that ldns needs to function. + The last one, of course, includes the functions of ldns itself. + + In our main function, we declare some variables that we are going to use: + + \skipline ldns_resolver + \until ldns_status + + - The \c ldns_resolver structure keeps a list of nameservers, and can perform queries for us + - An \c ldns_rdf is a basic data type of dns, the RDATA. See \ref design for a description about the building blocks of DNS. + In this case, \c domain will be used to store the name the user specifies when calling the program + - An \c ldns_pkt is a DNS packet, for instance a complete query, or an answer + - The \c ldns_rr_list structure contains a list of DNS Resource Records (RRs). In this case, we will store the MX records we find in the list. + - \c ldns_status is the basic type for status messages in ldns. Most functions will return a value of this type. + + First, we parse the command line argument (checks omitted on this page, see full source code), and store it in our \c domain variable: + \skipline ldns_dname_new_frm_str + + This function takes a string containing a domain name (like + "nlnetlabs.nl") and returns an \c ldns_rdf representing that name. If + somehow the given string can not be parsed it returns NULL. + + Then, we create the resolver structure: + \skipline ldns_resolver_new + + Most of the functions work like this, the first argument is a pointer to + the structure where ldns should store its results (which is also a + pointer). The function returns a status code indicating success + (\ref LDNS_STATUS_OK) or an error number. Remember that these types of + functions allocate memory that you should free later (using the + ldns_free_ functions). + + The second argument is the filename that contains information about the + resolver structure that is to be created. If this argument is NULL, + /etc/resolv.conf is used. The syntax of the file is like that of + /etc/resolv.conf. + + + + We tell the resolver to query for our domain, type MX, of class IN: + \skipline ldns_resolver_query + \until ) + + The last argument contains flags to influence the type of query the + resolver structure sends. In this case, we want the nameserver to use + recursion, so that we'll get the final answer. Therefore, we specify the + \ref LDNS_RD (Recursion Desired) flag. + + This should return a packet if everything goes well. + + We get all RRs of type MX from the answer packet and store them in our list: + \skipline ldns_pkt_rr_list_by_type + \until ) + + If this list is not empty, we sort and print it: + \skipline ldns_rr_list_sort + \skipline ldns_rr_list_print + + And finally, just to be proper, we free our allocated data: + \skipline free( + \until resolver_deep_free + + For structures that can contain other ldns structures, there are two types of free() function available + - \c ldns_free_ frees only the allocated data for the structure itself. + - \c ldns_deep_free_ frees the structure, and ALL structures that + are nested in it. For example, of you \c deep_free an ldns_rr_list, + all \c ldns_rr structures that were present in the list are also + freed. + + +*/ diff --git a/libs/ldns/doc/tutorial2_zone.dox b/libs/ldns/doc/tutorial2_zone.dox new file mode 100644 index 0000000000..680ccb46a3 --- /dev/null +++ b/libs/ldns/doc/tutorial2_zone.dox @@ -0,0 +1,111 @@ +/** + \page tutorial2_zone Tutorial 2: Reading a zone file + \dontinclude ldns-read-zone.c + + The full source code can be found in \link examples/ldns-read-zone.c \endlink + + ldns-read-zone reads a zone file, and prints it to stdout, with 1 resource record per line. + +
+% cat example.zone
+$ORIGIN example.
+$TTL 600
+
+example.        IN SOA  example. op.example. (
+                                2004022501 ; serial
+                                28800      ; refresh (8 hours)
+                                7200       ; retry (2 hours)
+                                604800     ; expire (1 week)
+                                18000      ; minimum (5 hours)
+                                )
+
+@       IN      MX      10 mail.example.
+@       IN      NS      ns1
+@       IN      NS      ns2
+@       IN      A       123.123.123.123
+
+% ldns-read-zone example.zone
+example.        600     IN      SOA     example. op.example. 2004022501 28800 7200 604800 18000
+example.        600     IN      MX      10 mail.example.
+example.        600     IN      NS      ns1.example.
+example.        600     IN      NS      ns2.example.
+example.        600     IN      A       123.123.123.123
+   
+ + + +Again, let's start with including some necessary header files: + +\skipline include +\until errno + +In this example, we are going to open a file, if that fails, we'll need errno.h to display an error message. + +Okay, let's declare the variables we are going to need today: + +\skipline filename +\until ldns_status + +The only two ldns-specific types here are \c ldns_zone and \c ldns_status. + - \c ldns_zone is the structure that can contain a complete zone + - \c ldns_status again is used to check return values of ldns functions + + +If we get no filename, we'll read standard input, otherwise, we'll try to +open the given filename: +\skipline if (argc == 0) +\until exit(EXIT_FAILURE) +\until } +\until } + + +With the \c FILE pointer in our hands, we visit ldns to pour it into a zone +structure: +\skipline ldns_zone_new_frm_fp_l + +There is also a \c ldns_zone_new_frm_fp, but this one also remembers the +line number it was on, so we can use that if we encounter a parse error. + +Just like in \ref tutorial1_mx, the first argument is a pointer +to the place ldns should store its creation in, and again, the return value +is the status code. + +The second argument is the file pointer where our zone data should reside. + +The third argument, if not NULL, is a \c dname that contains the zones +origin. It will place this dname after every name in the file that is not a +fully qualified domain name. + +The fourth argument, if not 0, is the default TTL to use. + +Both these values can be specified in the zone file by setting \c $ORIGIN and \c $TTL. + +The fifth argument specifies the default class, which defaults to IN (\ref LDNS_RR_CLASS_IN). + +And finally, every time \c ldns_zone_new_frm_fp_l reads a line from the +input file pointer, it will increment the value pointed to by the last +argument with 1. + + +Okay, with that, we should have a nice zone structure. Of course we need to +check whether it has succeeded. + +\skipline LDNS_STATUS_OK +\until deep_free + +If everything went well, we sort the zone if necessary, print it, and free it. + +Since \c ldns_zone contains other ldns structures, we use \c ldns_deep_free +so that every \c ldns_rr_list, \c ldns_rr et cetera are freed too. + +\until line_nr); +\until } + +If something went wrong, we use \c ldns_get_errorstr_by_id() to get a nice +error string instead of just a status integer. + +And of course, we should play nice and close the file: +\skipline fclose +\until exit + +*/ diff --git a/libs/ldns/doc/tutorial3_signzone.dox b/libs/ldns/doc/tutorial3_signzone.dox new file mode 100644 index 0000000000..1943e557ae --- /dev/null +++ b/libs/ldns/doc/tutorial3_signzone.dox @@ -0,0 +1,206 @@ +/** + \page tutorial3_signzone Tutorial 3: Signing a zone file + \dontinclude ldns-signzone.c + + The full source code can be found in \link examples/ldns-signzone.c \endlink + + Of course, we start by the usual includes. Since we need a bit more here, + we'll add those right away. + + \skipline include + \until define + + Let's skip the boring usage() and sanity check functions, and dive right + into main(). + + \skipline main(int argc + \skipline { + + We'll be reading another zone file, so let's prepare some variables for that. + + \skipline zone + \until argi + + We will create a separate zone structure for the signed zone, so let's have a clear name for the original one. + + \skipline zone + \until zone + + To sign a zone, we need keys, so we need some variables to read and store it; + + \skipline key + \until status + + The \ref ldns_key structure holds (private) keys. These can be of any + supported algorithm type; you can put an RSA key in it, an DSA key, or an + HMAC key. Public keys can simply be put in an \ref ldns_rr structure with + type \ref LDNS_RR_TYPE_DNSKEY. + + The \ref ldns_key_list type is much like the \ref ldns_rr_list, only, you + guessed it, for \c ldns_key entries. + + + The signed zone will be stored in a new file. + + \skipline file + \until file + + And we have some command line options for the output zone. + + \skipline tm + \until class + + \c origin is a domain name, so it can be stored in an \ref ldns_rdf + variable with type \ref LDNS_RDF_TYPE_DNAME. + + The next part is option parsing, which is pretty straightforward using \c + getopt(), so we'll skip this too. U can always look to the source of the + file to check it out. + + Okay that's it for the variables, let's get to work! + + First we'll try to read in the zone that is to be signed. + + \skipline fopen(zone + \until } else { + + If the file exists and can be read, we'll let ldns mold it into a zone + structure: + + \skipline zone_new + + This creates a new (\c new) zone from (\c frm) a filepointer (\c fp), + while remembering the current line (\c l) in the input file (for error + messages). + + A pointer to the zone structure to be filled is passed as the first + argument, like in most \c new_frm functions. + + Like a lot of ldns functions, this one returns a \c ldns_status + indicating success or the type of failure, so let us check that. + + \skipline STATUS + \until } else { + + If everything is ok so far, we check if the zone has a SOA record and contains actual data. + + \skipline orig_soa + \until } + \until } + \until } + + Now that we have the complete zone in our memory, we won't be needing the file anymore. + + \skipline fclose + \until } + + If there was no origin given, we'll use the one derived from the original zone file. + + \skipline origin + \until } + + No signing party can be complete without keys to sign with, let's fetch those. + + Multiple key files can be specified on the command line, by using the + base names of the .key/.private file pairs. + + \skipline key + \until fopen + + As you can see, we append ".private" to the name, which should result in + the complete file name of the private key. Later we'll also form the + ".key" file name, which will be directly included in the signed zone. + + If the file exists, we'll read it and create a \c ldns_key from its + contents, much like the way we read the zone earlier. + + \skipline line_nr + \until STATUS + + If this went ok, we need to set the inception and expiration times, which + are set in the keys, but will eventually end up in the RRSIGs generated + by those keys. + + \skipline expiration + \until } + \skipline inception + \until } + + And now that we have read the private keys, we read the public keys and + add them to the zone. + + Reading them from the files works roughly the same as reading private + keys, but public keys are normal Resource Records, and they can be stored + in general \c ldns_rr structures. + + \skipline FREE + \until } + \until } + + With \c push() we add them to our key list and our zone. This function + clones the data, so we can safely free it after that. + + \skipline push + \until free + + And if we're done, we free the allocated memory for the file name. + + \until FREE + + If the reading did not work, we print an error. Finally, we move on to + the next key in the argument list. + + \skipline } else { + \until } + \until } + \until } + + Just to be sure, we add a little check to see if we actually have any keys now. + + \skipline count + \until } + + So, we have our zone, we have our keys, let's do some signing! + + \skipline sign + + Yes. That's it. We now have a completely signed zone, \c ldns_zone_sign + checks the keys, and uses the zone signing keys to sign the data resource + records. NSEC and RRSIG resource records are generated and added to the + new zone. + + So now that we have a signed zone, all that is left is to store it somewhere. + + If no explicit output file name was given, we'll just append ".signed" to + the original zone file name. + + \skipline outputfile + \until } + + \c ldns_zone_sign returns NULL if the signing did not work, so we must check that. + + \skipline signed_zone + \until } else { + + Writing to a file is no different than normal printing, so we'll print to + the file and close it. + + \skipline print + \until } + + And of course, give an error if the signing failed. + + \skipline } else { + \until } + + Just to be nice, let's free the rest of the data we allocated, and exit + with the right return value. + + \skipline free + \until } + + + + + +*/ \ No newline at end of file diff --git a/libs/ldns/drill/ChangeLog.22-nov-2005 b/libs/ldns/drill/ChangeLog.22-nov-2005 new file mode 100644 index 0000000000..1ce8b0b7c0 --- /dev/null +++ b/libs/ldns/drill/ChangeLog.22-nov-2005 @@ -0,0 +1,105 @@ +--------- Drill now is a subdirectory in ldns. To make life easier +--------- we are using ldns' version numbering for drill from now on. +--------- Sadly this means we GO BACKWARDS in the versions +--------- This ChangeLog will not be updated anymore - all changes are +--------- documented in ldns' ChangeLog + +1.0-pre3: to be released: drill-team + * Secure tracing works + * Added section about DNSSEC in the manual page + * Allow the class information to be given to do_chase() + * Lint fixes for the code + * Bugzilla was setup for drill + * Bug #97 (drill); -S crash was fixed + * Add -Q (quiet) flag was added. This supresses output from drill. + +1.0-pre2: 20 Jun 2005: drill-team + * Second prerelease + * Bugs where fix in the chasing functionality + +1.0-pre1: 1 Jun 2005: drill-team + * First drill release based on ldns + * drill's core code is not much more simple, as + all the difficult stuff is moved to ldns. + * Much saner argument parsing + +---------- Above Newer drill based on ldns -------------- +---------- Below Older drill with it's own DNS handling -------------- + +0.9.2: Feb 3 2005: drill-team + * Added two more options (borrowed from dig) + --rd, don't set the RD bit in queries + --fail, don't query the next nameserver on SERVFAIL + * Fixed handling of obscure data types + * Handle classes other the 'IN' when making a query + + * For people using FreeBSD: drill is now in the ports + (Thanks to Jaap Akkerhuis) + +0.9.1: Jan 5 2005: drill-team + * Makefile tweaks + * drill ns . works + * re-check the root in when tracing + * added handling for some lesser known types (including WKS) + +0.9: Dec 6 2004: drill-team + * big configure.ac and Makefile.in updates (made more general) + * escapes in names argument and txt and dname data + * gcc 2(.95) support + * packet wire data is now checked for dangerous elements (like + looping compression etc) + * (Multiple) Octal char representation + * Responses can be saved to file + * 'Answers' can be read from file instead of server + * Lots and lots of bugfixes and improvements + +0.8.1: Oct 27 2004: Miek + * configure.ac updates + * secure resolving updates (still doesn't work) + * printing additions + - CERT RR supported + - LOC RR support + * All non supported RRs are handled as unknown + * If no namservers found in /etc/resolv.conf + default to 127.0.0.1 + * Various bugs fixed + - Close sockets after using them + - Some memory leaks were plugged + +0.8: Oct 26 2004: Miek + * Lots of features added. Drill is almost feature complete + * Unknown RR's are supported + * Numerous smaller updates in documentation + * Numerous code cleanups + * Dig is no longer needed to build drill + +0.7: Oct 21 2004: Miek + * reworked interal code + * DNSSEC is working, except the secure resolving + * build updates + * more sane options parsing + * more sane argument handling + +0.6-alpha: Oct 2004: Jelte + * No log + +0.5-alpha: Sept 22 2004: Miek + * most of the DNS stuff is working + * moved to configure + * tested on Linux/FreeBSD + * fully IPV6 capable + * new DNSSEC types supported + * DNSSEC somewhat working + * gcc => 3 is needed for building + +0.4-alpha: Sept 9 2004: Miek + * moved to autoconf for building + * lots of various updates + * really a workable program now + +0.3-alpha: Sept 6 2004: Miek + * IPv6 support + * automatic secure resolving + * --trace updates + * --chase updates + * more checks diff --git a/libs/ldns/drill/Makefile.in b/libs/ldns/drill/Makefile.in new file mode 100644 index 0000000000..653cc51bce --- /dev/null +++ b/libs/ldns/drill/Makefile.in @@ -0,0 +1,117 @@ +# Standard installation pathnames +# See the file LICENSE for the license +SHELL = @SHELL@ +VERSION = @PACKAGE_VERSION@ +basesrcdir = $(shell basename `pwd`) +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +mandir = @mandir@ +includedir = @includedir@ + +CC = @CC@ +CFLAGS = -I. @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +INSTALL = $(srcdir)/install-sh -c +INSTALL_PROGRAM = $(INSTALL) +LDNSDIR = @LDNSDIR@ +LIBS_STC = @LIBS_STC@ + +COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) + +LINT = splint +LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list +#-Dglob64=glob -Dglobfree64=globfree +# compat with openssl linux edition. +LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" +# compat with NetBSD +ifeq "$(shell uname)" "NetBSD" +LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ +endif +# compat with OpenBSD +LINTFLAGS+="-Dsigset_t=long" +# FreeBSD8 +LINTFLAGS+="-D__uint16_t=uint16_t" +LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)=" + +OBJ=drill.o drill_util.o error.o root.o work.o chasetrace.o dnssec.o securetrace.o +SRC=$(OBJ:.o=.c) + +HEADER=drill.h $(srcdir)/drill_util.h + +.PHONY: all clean realclean docclean doc release tags install all-static + +all: drill +all-static: drill-stc + +tags: + ctags *.[ch] + +drill: $(OBJ) + $(LINK) -o drill $(OBJ) $(LIBS) + +drill-stc: $(OBJ) + $(LINK) -o drill $(OBJ) $(LIBS_STC) + +## implicit rule +%.o: $(srcdir)/%.c + $(COMPILE) -c $< + +clean: + rm -f ${OBJ} + rm -f drill + rm -f *core + rm -f config.h.in~ + rm -f config.log + rm -f config.guess + rm -f config.status + +docclean: + rm -rf doxydoc + +distclean: clean docclean + rm -f config.h + rm -f drill.h + +realclean: clean docclean + rm -f tags + rm -f config.log + rm -f config.sub + rm -f ltmain.sh + rm -f config.status + rm -rf autom4te.cache + rm -f config.h + rm -f config.h.in + rm -f drill.h + rm -f configure + rm -f Makefile + rm -f aclocal.m4 + +doc: + doxygen drill.doxygen + +install: all + $(INSTALL) -d $(DESTDIR)$(bindir) + $(INSTALL) drill $(DESTDIR)$(bindir)/drill + $(INSTALL) -m 644 $(srcdir)/drill.1 $(DESTDIR)$(mandir)/man1/drill.1 + +uninstall: + @echo + rm -f -- $(DESTDIR)$(bindir)/drill + rm -f -- $(DESTDIR)$(mandir)/man1/drill.1 + rmdir -p $(DESTDIR)$(bindir) + rmdir -p $(DESTDIR)$(mandir)/man1 + @echo + +lint: + @for i in $(SRC) ; do \ + $(LINT) $(LINTFLAGS) $(CPPFLAGS) -I$(srcdir) $(srcdir)/$$i ; \ + if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ + done + +confclean: clean + rm -rf config.log config.status config.h Makefile diff --git a/libs/ldns/drill/README b/libs/ldns/drill/README new file mode 100644 index 0000000000..bbbb816ef4 --- /dev/null +++ b/libs/ldns/drill/README @@ -0,0 +1,12 @@ +QUICK INSTALL GUIDE + +drill is a subdirectory in ldns. + +To compile drill you need: +autoreconf && ./configure && make + +If ldns is installed in a different location, use --with-ldns=directory +See also ./configure --help + +In the first case you must run drill as: +LD_LIBRARY_PATH=../.libs ./drill diff --git a/libs/ldns/drill/REGRESSIONS b/libs/ldns/drill/REGRESSIONS new file mode 100644 index 0000000000..b8f6be9cc9 --- /dev/null +++ b/libs/ldns/drill/REGRESSIONS @@ -0,0 +1,25 @@ +REGRESSIONS + +This version of drill is based on ldns and as such some things +are slightly changed. This file documents the changes. + +o When tracing (-T option) we use the local resolver (as specified + in /etc/resolv.conf) to lookup names. This increases the speed + dramatically, but you obviously need to be able to reach a recursive + server/cache. + Previously drill would try to resolve the names by itself. + +o Printing of DSs after DNSKEY records. Because we don't parse our + own packets anymore, we cannot print the DS directly after the DNSKEY + record. The DSs are now printed AFTER the packet. + +o The long options are removed. + +o The chase function has a different output, and will be subject to change + in the near future. + +o The useless (for jokes only) -I option was dropped. + +FIXED: +o the argument parsing is much smarter, the order doesn't matter (much) + anymore diff --git a/libs/ldns/drill/chasetrace.c b/libs/ldns/drill/chasetrace.c new file mode 100644 index 0000000000..a1dfd44681 --- /dev/null +++ b/libs/ldns/drill/chasetrace.c @@ -0,0 +1,401 @@ +/* + * chasetrace.c + * Where all the hard work concerning chasing + * and tracing is done + * (c) 2005, 2006 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +/** + * trace down from the root to name + */ + +/* same naive method as in drill0.9 + * We resolver _ALL_ the names, which is ofcourse not needed + * We _do_ use the local resolver to do that, so it still is + * fast, but it can be made to run much faster + */ +ldns_pkt * +do_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c) +{ + ldns_resolver *res; + ldns_pkt *p; + ldns_rr_list *new_nss_a; + ldns_rr_list *new_nss_aaaa; + ldns_rr_list *final_answer; + ldns_rr_list *new_nss; + ldns_rr_list *hostnames; + ldns_rr_list *ns_addr; + uint16_t loop_count; + ldns_rdf *pop; + ldns_status status; + size_t i; + + loop_count = 0; + new_nss_a = NULL; + new_nss_aaaa = NULL; + new_nss = NULL; + ns_addr = NULL; + final_answer = NULL; + p = ldns_pkt_new(); + res = ldns_resolver_new(); + + if (!p || !res) { + error("Memory allocation failed"); + return NULL; + } + + /* transfer some properties of local_res to res, + * because they were given on the commandline */ + ldns_resolver_set_ip6(res, + ldns_resolver_ip6(local_res)); + ldns_resolver_set_port(res, + ldns_resolver_port(local_res)); + ldns_resolver_set_debug(res, + ldns_resolver_debug(local_res)); + ldns_resolver_set_dnssec(res, + ldns_resolver_dnssec(local_res)); + ldns_resolver_set_fail(res, + ldns_resolver_fail(local_res)); + ldns_resolver_set_usevc(res, + ldns_resolver_usevc(local_res)); + ldns_resolver_set_random(res, + ldns_resolver_random(local_res)); + ldns_resolver_set_recursive(res, false); + + /* setup the root nameserver in the new resolver */ + status = ldns_resolver_push_nameserver_rr_list(res, global_dns_root); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding root servers to resolver: %s\n", ldns_get_errorstr_by_id(status)); + ldns_rr_list_print(stdout, global_dns_root); + return NULL; + } + + /* this must be a real query to local_res */ + status = ldns_resolver_send(&p, res, ldns_dname_new_frm_str("."), LDNS_RR_TYPE_NS, c, 0); + /* p can still be NULL */ + + + if (ldns_pkt_empty(p)) { + warning("No root server information received"); + } + + if (status == LDNS_STATUS_OK) { + if (!ldns_pkt_empty(p)) { + drill_pkt_print(stdout, local_res, p); + } + } else { + error("cannot use local resolver"); + return NULL; + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + + while(status == LDNS_STATUS_OK && + ldns_pkt_reply_type(p) == LDNS_PACKET_REFERRAL) { + + if (!p) { + /* some error occurred, bail out */ + return NULL; + } + + new_nss_a = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); + new_nss_aaaa = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_AAAA, LDNS_SECTION_ADDITIONAL); + new_nss = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); + + if (verbosity != -1) { + ldns_rr_list_print(stdout, new_nss); + } + /* checks itself for verbosity */ + drill_pkt_print_footer(stdout, local_res, p); + + /* remove the old nameserver from the resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { /* do it */ } + + /* also check for new_nss emptyness */ + + if (!new_nss_aaaa && !new_nss_a) { + /* + * no nameserver found!!! + * try to resolve the names we do got + */ + for(i = 0; i < ldns_rr_list_rr_count(new_nss); i++) { + /* get the name of the nameserver */ + pop = ldns_rr_rdf(ldns_rr_list_rr(new_nss, i), 0); + if (!pop) { + break; + } + + ldns_rr_list_print(stdout, new_nss); + ldns_rdf_print(stdout, pop); + /* retrieve it's addresses */ + ns_addr = ldns_rr_list_cat_clone(ns_addr, + ldns_get_rr_list_addr_by_name(local_res, pop, c, 0)); + } + + if (ns_addr) { + if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != + LDNS_STATUS_OK) { + error("Error adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + ldns_rr_list_free(ns_addr); + } else { + ldns_rr_list_print(stdout, ns_addr); + error("Could not find the nameserver ip addr; abort"); + ldns_pkt_free(p); + return NULL; + } + } + + /* add the new ones */ + if (new_nss_aaaa) { + if (ldns_resolver_push_nameserver_rr_list(res, new_nss_aaaa) != + LDNS_STATUS_OK) { + error("adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + } + if (new_nss_a) { + if (ldns_resolver_push_nameserver_rr_list(res, new_nss_a) != + LDNS_STATUS_OK) { + error("adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + } + + if (loop_count++ > 20) { + /* unlikely that we are doing something usefull */ + error("Looks like we are looping"); + ldns_pkt_free(p); + return NULL; + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + new_nss_aaaa = NULL; + new_nss_a = NULL; + ns_addr = NULL; + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (!p) { + return NULL; + } + + hostnames = ldns_get_rr_list_name_by_addr(local_res, + ldns_pkt_answerfrom(p), 0, 0); + + new_nss = ldns_pkt_authority(p); + final_answer = ldns_pkt_answer(p); + + if (verbosity != -1) { + ldns_rr_list_print(stdout, final_answer); + ldns_rr_list_print(stdout, new_nss); + + } + drill_pkt_print_footer(stdout, local_res, p); + ldns_pkt_free(p); + return NULL; +} + + +/** + * Chase the given rr to a known and trusted key + * + * Based on drill 0.9 + * + * the last argument prev_key_list, if not null, and type == DS, then the ds + * rr list we have must all be a ds for the keys in this list + */ +#ifdef HAVE_SSL +ldns_status +do_chase(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c, + ldns_rr_list *trusted_keys, + ldns_pkt *pkt_o, + uint16_t qflags, + ldns_rr_list *prev_key_list, + int verbosity) +{ + ldns_rr_list *rrset = NULL; + ldns_status result; + ldns_rr *orig_rr = NULL; + + bool cname_followed = false; +/* + ldns_rr_list *sigs; + ldns_rr *cur_sig; + uint16_t sig_i; + ldns_rr_list *keys; +*/ + ldns_pkt *pkt; + ldns_status tree_result; + ldns_dnssec_data_chain *chain; + ldns_dnssec_trust_tree *tree; + + const ldns_rr_descriptor *descriptor; + descriptor = ldns_rr_descript(type); + + ldns_dname2canonical(name); + + pkt = ldns_pkt_clone(pkt_o); + if (!name) { + mesg("No name to chase"); + ldns_pkt_free(pkt); + return LDNS_STATUS_EMPTY_LABEL; + } + if (verbosity != -1) { + printf(";; Chasing: "); + ldns_rdf_print(stdout, name); + if (descriptor && descriptor->_name) { + printf(" %s\n", descriptor->_name); + } else { + printf(" type %d\n", type); + } + } + + if (!trusted_keys || ldns_rr_list_rr_count(trusted_keys) < 1) { + warning("No trusted keys specified"); + } + + if (pkt) { + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + type, + LDNS_SECTION_ANSWER + ); + if (!rrset) { + /* nothing in answer, try authority */ + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + type, + LDNS_SECTION_AUTHORITY + ); + } + /* answer might be a cname, chase that first, then chase + cname target? (TODO) */ + if (!rrset) { + cname_followed = true; + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + LDNS_RR_TYPE_CNAME, + LDNS_SECTION_ANSWER + ); + if (!rrset) { + /* nothing in answer, try authority */ + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + LDNS_RR_TYPE_CNAME, + LDNS_SECTION_AUTHORITY + ); + } + } + } else { + /* no packet? */ + if (verbosity >= 0) { + fprintf(stderr, "%s", ldns_get_errorstr_by_id(LDNS_STATUS_MEM_ERR)); + fprintf(stderr, "\n"); + } + return LDNS_STATUS_MEM_ERR; + } + + if (!rrset) { + /* not found in original packet, try again */ + ldns_pkt_free(pkt); + pkt = NULL; + pkt = ldns_resolver_query(res, name, type, c, qflags); + + if (!pkt) { + if (verbosity >= 0) { + fprintf(stderr, "%s", ldns_get_errorstr_by_id(LDNS_STATUS_NETWORK_ERR)); + fprintf(stderr, "\n"); + } + return LDNS_STATUS_NETWORK_ERR; + } + if (verbosity >= 5) { + ldns_pkt_print(stdout, pkt); + } + + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + type, + LDNS_SECTION_ANSWER + ); + } + + orig_rr = ldns_rr_new(); + +/* if the answer had no answer section, we need to construct our own rr (for instance if + * the rr qe asked for doesn't exist. This rr will be destroyed when the chain is freed */ + if (ldns_pkt_ancount(pkt) < 1) { + ldns_rr_set_type(orig_rr, type); + ldns_rr_set_owner(orig_rr, ldns_rdf_clone(name)); + + chain = ldns_dnssec_build_data_chain(res, qflags, rrset, pkt, ldns_rr_clone(orig_rr)); + } else { + /* chase the first answer */ + chain = ldns_dnssec_build_data_chain(res, qflags, rrset, pkt, NULL); + } + + if (verbosity >= 4) { + printf("\n\nDNSSEC Data Chain:\n"); + ldns_dnssec_data_chain_print(stdout, chain); + } + + result = LDNS_STATUS_OK; + + tree = ldns_dnssec_derive_trust_tree(chain, NULL); + + if (verbosity >= 2) { + printf("\n\nDNSSEC Trust tree:\n"); + ldns_dnssec_trust_tree_print(stdout, tree, 0, true); + } + + if (ldns_rr_list_rr_count(trusted_keys) > 0) { + tree_result = ldns_dnssec_trust_tree_contains_keys(tree, trusted_keys); + + if (tree_result == LDNS_STATUS_DNSSEC_EXISTENCE_DENIED) { + if (verbosity >= 1) { + printf("Existence denied or verifiably insecure\n"); + } + result = LDNS_STATUS_OK; + } else if (tree_result != LDNS_STATUS_OK) { + if (verbosity >= 1) { + printf("No trusted keys found in tree: first error was: %s\n", ldns_get_errorstr_by_id(tree_result)); + } + result = tree_result; + } + + } else { + if (verbosity >= 0) { + printf("You have not provided any trusted keys.\n"); + } + } + + ldns_rr_free(orig_rr); + ldns_dnssec_trust_tree_free(tree); + ldns_dnssec_data_chain_deep_free(chain); + + ldns_rr_list_deep_free(rrset); + ldns_pkt_free(pkt); + /* ldns_rr_free(orig_rr);*/ + + return result; +} +#endif /* HAVE_SSL */ + diff --git a/libs/ldns/drill/config.h.in b/libs/ldns/drill/config.h.in new file mode 100644 index 0000000000..9b2a282a8e --- /dev/null +++ b/libs/ldns/drill/config.h.in @@ -0,0 +1,293 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Whether getaddrinfo is available */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* If you have HMAC_CTX_init */ +#undef HAVE_HMAC_CTX_INIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define to 1 if you have the `ldns' library (-lldns). */ +#undef HAVE_LIBLDNS + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP6_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_UDP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have the SSL libraries installed. */ +#undef HAVE_SSL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Whether the windows socket API is used */ +#undef USE_WINSOCK + +/* the version of the windows API enabled */ +#undef WINVER + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* in_addr_t */ +#undef in_addr_t + +/* in_port_t */ +#undef in_port_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `short' if does not define. */ +#undef int16_t + +/* Define to `int' if does not define. */ +#undef int32_t + +/* Define to `long long' if does not define. */ +#undef int64_t + +/* Define to `char' if does not define. */ +#undef int8_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to 'int' if not defined */ +#undef socklen_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `unsigned short' if does not define. */ +#undef uint16_t + +/* Define to `unsigned int' if does not define. */ +#undef uint32_t + +/* Define to `unsigned long long' if does not define. */ +#undef uint64_t + +/* Define to `unsigned char' if does not define. */ +#undef uint8_t + + + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif + diff --git a/libs/ldns/drill/configure b/libs/ldns/drill/configure new file mode 100755 index 0000000000..2c79eb811b --- /dev/null +++ b/libs/ldns/drill/configure @@ -0,0 +1,6663 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for ldns 1.6.9. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libdns@nlnetlabs.nl about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='ldns' +PACKAGE_TARNAME='libdns' +PACKAGE_VERSION='1.6.9' +PACKAGE_STRING='ldns 1.6.9' +PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' +PACKAGE_URL='' + +ac_unique_file="drill.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +LDNSDIR +LIBS_STC +RUNTIME_PATH +HAVE_SSL +libtool +SET_MAKE +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_rpath +with_ssl +with_ldns +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CPPFLAGS +CC +LDFLAGS +LIBS +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of ldns 1.6.9:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-rpath disable hardcoded rpath (default=enabled) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl + /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw + /usr) + --with-ldns=PATH specify prefix of path of ldns library to use + + + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +ldns configure 1.6.9 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------- ## +## Report this to libdns@nlnetlabs.nl ## +## ---------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# acx_nlnetlabs.m4 - common macros for configure checks +# Copyright 2009, Wouter Wijngaards, NLnet Labs. +# BSD licensed. +# +# Version 11 +# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. +# 2010-07-02 Add check for ss_family (for minix). +# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. +# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. +# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl +# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN +# 2010-01-20 added AHX_COONFIG_STRLCAT +# 2009-07-14 U_CHAR detection improved for windows crosscompile. +# added ACX_FUNC_MALLOC +# fixup some #if to #ifdef +# NONBLOCKING test for mingw crosscompile. +# 2009-07-13 added ACX_WITH_SSL_OPTIONAL +# 2009-07-03 fixup LDFLAGS for empty ssl dir. +# +# Automates some of the checking constructs. Aims at portability for POSIX. +# Documentation for functions is below. +# +# the following macro's are provided in this file: +# (see below for details on each macro). +# +# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. +# ACX_RSRC_VERSION - create windows resource version number. +# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. +# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). +# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. +# ACX_DEPFLAG - find cc dependency flags. +# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. +# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. +# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. +# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. +# ACX_TYPE_U_CHAR - u_char type. +# ACX_TYPE_RLIM_T - rlim_t type. +# ACX_TYPE_SOCKLEN_T - socklen_t type. +# ACX_TYPE_IN_ADDR_T - in_addr_t type. +# ACX_TYPE_IN_PORT_T - in_port_t type. +# ACX_ARG_RPATH - add --disable-rpath option. +# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. +# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, +# where --without-ssl is also accepted +# ACX_LIB_SSL - setup to link -lssl. +# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. +# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. +# ACX_FUNC_DEPRECATED - see if func is deprecated. +# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. +# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. +# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. +# ACX_FUNC_MALLOC - check malloc, define replacement . +# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. +# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. +# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. +# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. +# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. +# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. +# AHX_CONFIG_SNPRINTF - snprintf compat prototype +# AHX_CONFIG_INET_PTON - inet_pton compat prototype +# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype +# AHX_CONFIG_INET_ATON - inet_aton compat prototype +# AHX_CONFIG_MEMMOVE - memmove compat prototype +# AHX_CONFIG_STRLCAT - strlcat compat prototype +# AHX_CONFIG_STRLCPY - strlcpy compat prototype +# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype +# AHX_CONFIG_W32_SLEEP - w32 compat for sleep +# AHX_CONFIG_W32_USLEEP - w32 compat for usleep +# AHX_CONFIG_W32_RANDOM - w32 compat for random +# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom +# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. +# ACX_CFLAGS_STRIP - strip one flag from CFLAGS +# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS +# AHX_CONFIG_FLAG_OMITTED - define omitted flag +# AHX_CONFIG_FLAG_EXT - define omitted extension flag +# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags +# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. +# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. +# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family +# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} + +$as_echo "#define WINVER 0x0502" >>confdefs.h + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +for ac_prog in glibtool libtool15 libtool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_libtool+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$libtool"; then + ac_cv_prog_libtool="$libtool" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_libtool="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +libtool=$ac_cv_prog_libtool +if test -n "$libtool"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libtool" >&5 +$as_echo "$libtool" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$libtool" && break +done +test -n "$libtool" || libtool="../libtool" + + +# add option to disable the evil rpath +# Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; enable_rpath=$enableval +else + enable_rpath=yes +fi + + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 +$as_echo_n "checking whether $CC supports -std=c99... " >&6; } +cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-std=c99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 +$as_echo_n "checking whether $CC supports -xc99... " >&6; } +cache=`echo xc99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-xc99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 +$as_echo_n "checking whether $CC supports -O2... " >&6; } +cache=`echo O2 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -O2" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 +$as_echo_n "checking whether $CC supports -Werror... " >&6; } +cache=`echo Werror | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="-Werror" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="-errwarn" +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 +$as_echo_n "checking whether $CC supports -Wall... " >&6; } +cache=`echo Wall | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="$ERRFLAG -Wall" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="$ERRFLAG -errfmt" +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo '#include ' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" +if test "x$ac_cv_type_int8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int8_t char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" +if test "x$ac_cv_type_int16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int16_t short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int32_t int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" +if test "x$ac_cv_type_int64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int64_t long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" +if test "x$ac_cv_type_uint8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint8_t unsigned char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" +if test "x$ac_cv_type_uint16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint16_t unsigned short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" +if test "x$ac_cv_type_uint32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint32_t unsigned int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" +if test "x$ac_cv_type_uint64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint64_t unsigned long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF + +fi + + +for ac_header in sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +$ac_includes_default +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +# MinGW32 tests +for ac_header in winsock2.h ws2tcpip.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " +$ac_includes_default +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +" +if test "x$ac_cv_type_socklen_t" = xyes; then : + +else + +$as_echo "#define socklen_t int" >>confdefs.h + +fi + +for ac_header in sys/param.h sys/mount.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default + + + #if HAVE_SYS_PARAM_H + # include + #endif + + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_addr_t" = xyes; then : + +else + +$as_echo "#define in_addr_t uint32_t" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_port_t" = xyes; then : + +else + +$as_echo "#define in_port_t uint16_t" >>confdefs.h + +fi + + +# check to see if libraries are needed for these functions. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break +fi +done +if ${ac_cv_search_socket+:} false; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 +$as_echo_n "checking for library containing inet_pton... " >&6; } +if ${ac_cv_search_inet_pton+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_pton (); +int +main () +{ +return inet_pton (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_inet_pton=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_inet_pton+:} false; then : + break +fi +done +if ${ac_cv_search_inet_pton+:} false; then : + +else + ac_cv_search_inet_pton=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 +$as_echo "$ac_cv_search_inet_pton" >&6; } +ac_res=$ac_cv_search_inet_pton +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + + + +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; + +else + + withval="yes" + +fi + + + withval=$withval + if test x_$withval != x_no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 +$as_echo_n "checking for SSL... " >&6; } + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" + fi + for dir in $withval; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes" + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSL /**/ +_ACEOF + + if test "$ssldir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" + fi + break; + fi + done + if test x_$found_ssl != x_yes; then + as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 +$as_echo "found in $ssldir" >&6; } + HAVE_SSL=yes + if test "$ssldir" != "/usr" -a "$ssldir" != ""; then + LDFLAGS="$LDFLAGS -L$ssldir/lib" + LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" + + if test "x$enable_rpath" = xyes; then + if echo "$ssldir/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" + fi + fi + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } + LIBS="$LIBS -lcrypto" + LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + # check if -lwsock32 or -lgdi32 are needed. + BAKLIBS="$LIBS" + BAKSSLLIBS="$LIBSSL_LIBS" + LIBS="$LIBS -lgdi32" + LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 +$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 +$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + + + # openssl engine functionality needs dlopen(). + BAKLIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_dlopen+:} false; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + if test "$LIBS" != "$BAKLIBS"; then + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + fi + fi +for ac_header in openssl/ssl.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_SSL_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/err.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_err_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_ERR_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/rand.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_rand_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_RAND_H 1 +_ACEOF + +fi + +done + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 +$as_echo_n "checking for getaddrinfo... " >&6; } +ac_cv_func_getaddrinfo=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_getaddrinfo="yes" +else + ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +int +main () +{ + + (void)getaddrinfo(NULL, NULL, NULL, NULL); + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +ac_cv_func_getaddrinfo="yes" + +$as_echo "#define USE_WINSOCK 1" >>confdefs.h + +USE_WINSOCK="1" + +else + +ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 +$as_echo "$ac_cv_func_getaddrinfo" >&6; } +if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h + +fi + + +LIBS_STC="$LIBS" + + +# check for ldns + +# Check whether --with-ldns was given. +if test "${with_ldns+set}" = set; then : + withval=$with_ldns; + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + LIBS="-lldns $LIBS" + LIBS_STC="$withval/lib/libldns.a $LIBS_STC" + + +fi + + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +for ac_func in isblank +do : + ac_fn_c_check_func "$LINENO" "isblank" "ac_cv_func_isblank" +if test "x$ac_cv_func_isblank" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ISBLANK 1 +_ACEOF + +fi +done + + +# check for ldns development source tree +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns devel source" >&5 +$as_echo_n "checking for ldns devel source... " >&6; } +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $ldns_dev_dir with $ldns_version" >&5 +$as_echo "using $ldns_dev_dir with $ldns_version" >&6; } + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="-lldns $LIBS" + +$as_echo "#define HAVE_LIBLDNS 1" >>confdefs.h + + LDNSDIR="$ldns_dev_dir" + LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 +$as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } +if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldns $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ldns_rr_new (); +int +main () +{ +return ldns_rr_new (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ldns_ldns_rr_new=yes +else + ac_cv_lib_ldns_ldns_rr_new=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 +$as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } +if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBLDNS 1 +_ACEOF + + LIBS="-lldns $LIBS" + +else + + as_fn_error $? "Can't find ldns library" "$LINENO" 5 + + +fi + +fi + + + + + +ac_config_files="$ac_config_files Makefile drill.h" + +ac_config_headers="$ac_config_headers config.h" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +ldns config.status 1.6.9 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "drill.h") CONFIG_FILES="$CONFIG_FILES drill.h" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/libs/ldns/drill/configure.ac b/libs/ldns/drill/configure.ac new file mode 100644 index 0000000000..3c5a6f2e00 --- /dev/null +++ b/libs/ldns/drill/configure.ac @@ -0,0 +1,261 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.56) +AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns) +AC_CONFIG_SRCDIR([drill.c]) +sinclude(../acx_nlnetlabs.m4) + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} +AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) + +AC_AIX +# Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool]) + +# add option to disable the evil rpath +dnl Check whether to use rpath or not +AC_ARG_ENABLE(rpath, + [ --disable-rpath disable hardcoded rpath (default=enabled)], + enable_rpath=$enableval, enable_rpath=yes) + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + +ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) +ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) + +AC_TYPE_SIZE_T +ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600, +[ +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"]) + + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include ], [CFLAGS="$CFLAGS $C99FLAG"]) + +AC_C_INLINE +AC_CHECK_TYPE(int8_t, char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(int32_t, int) +AC_CHECK_TYPE(int64_t, long long) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(uint16_t, unsigned short) +AC_CHECK_TYPE(uint32_t, unsigned int) +AC_CHECK_TYPE(uint64_t, unsigned long long) +AC_CHECK_TYPE(ssize_t, int) + +AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h],,, [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif]) +# MinGW32 tests +AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) + +ACX_TYPE_SOCKLEN_T +AC_CHECK_HEADERS([sys/param.h sys/mount.h],,, +[AC_INCLUDES_DEFAULT] +[ + [ + #if HAVE_SYS_PARAM_H + # include + #endif + ] +]) +AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) +AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) + +# check to see if libraries are needed for these functions. +AC_SEARCH_LIBS(socket, socket) +AC_SEARCH_LIBS([inet_pton], [nsl]) + +ACX_WITH_SSL_OPTIONAL + +ACX_CHECK_GETADDRINFO_WITH_INCLUDES + +LIBS_STC="$LIBS" +AC_SUBST(LIBS_STC) + +# check for ldns +AC_ARG_WITH(ldns, + AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use]) + , + [ + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + LIBS="-lldns $LIBS" + LIBS_STC="$withval/lib/libldns.a $LIBS_STC" + ] +) + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +AC_CHECK_FUNCS(isblank) + +# check for ldns development source tree +AC_MSG_CHECKING([for ldns devel source]) +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version]) + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="-lldns $LIBS" + AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.]) + LDNSDIR="$ldns_dev_dir" + LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC" +else + AC_MSG_RESULT([no]) + AC_CHECK_LIB(ldns, ldns_rr_new, , [ + AC_MSG_ERROR([Can't find ldns library]) + ] + ) +fi + +AC_SUBST(LDNSDIR) + +AH_BOTTOM([ + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif +]) + +AC_CONFIG_FILES([Makefile + drill.h + ]) +AC_CONFIG_HEADER([config.h]) +AC_OUTPUT diff --git a/libs/ldns/drill/dnssec.c b/libs/ldns/drill/dnssec.c new file mode 100644 index 0000000000..930ac7ce13 --- /dev/null +++ b/libs/ldns/drill/dnssec.c @@ -0,0 +1,509 @@ +/* + * dnssec.c + * Some DNSSEC helper function are defined here + * and tracing is done + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +/* get rr_type from a server from a server */ +ldns_rr_list * +get_rr(ldns_resolver *res, ldns_rdf *zname, ldns_rr_type t, ldns_rr_class c) +{ + /* query, retrieve, extract and return */ + ldns_pkt *p; + ldns_rr_list *found; + + p = ldns_pkt_new(); + found = NULL; + + if (ldns_resolver_send(&p, res, zname, t, c, 0) != LDNS_STATUS_OK) { + /* oops */ + return NULL; + } else { + found = ldns_pkt_rr_list_by_type(p, t, LDNS_SECTION_ANY_NOQUESTION); + } + return found; +} + +void +drill_pkt_print(FILE *fd, ldns_resolver *r, ldns_pkt *p) +{ + ldns_rr_list *new_nss; + ldns_rr_list *hostnames; + + if (verbosity < 5) { + return; + } + + hostnames = ldns_get_rr_list_name_by_addr(r, ldns_pkt_answerfrom(p), 0, 0); + + new_nss = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); + ldns_rr_list_print(fd, new_nss); + + /* new_nss can be empty.... */ + + fprintf(fd, ";; Received %d bytes from %s#%d(", + (int) ldns_pkt_size(p), + ldns_rdf2str(ldns_pkt_answerfrom(p)), + (int) ldns_resolver_port(r)); + /* if we can resolve this print it, other print the ip again */ + if (hostnames) { + ldns_rdf_print(fd, + ldns_rr_rdf(ldns_rr_list_rr(hostnames, 0), 0)); + ldns_rr_list_deep_free(hostnames); + } else { + fprintf(fd, "%s", ldns_rdf2str(ldns_pkt_answerfrom(p))); + } + fprintf(fd, ") in %u ms\n\n", (unsigned int)ldns_pkt_querytime(p)); +} + +void +drill_pkt_print_footer(FILE *fd, ldns_resolver *r, ldns_pkt *p) +{ + ldns_rr_list *hostnames; + + if (verbosity < 5) { + return; + } + + hostnames = ldns_get_rr_list_name_by_addr(r, ldns_pkt_answerfrom(p), 0, 0); + + fprintf(fd, ";; Received %d bytes from %s#%d(", + (int) ldns_pkt_size(p), + ldns_rdf2str(ldns_pkt_answerfrom(p)), + (int) ldns_resolver_port(r)); + /* if we can resolve this print it, other print the ip again */ + if (hostnames) { + ldns_rdf_print(fd, + ldns_rr_rdf(ldns_rr_list_rr(hostnames, 0), 0)); + ldns_rr_list_deep_free(hostnames); + } else { + fprintf(fd, "%s", ldns_rdf2str(ldns_pkt_answerfrom(p))); + } + fprintf(fd, ") in %u ms\n\n", (unsigned int)ldns_pkt_querytime(p)); +} +/* + * generic function to get some RRset from a nameserver + * and possible some signatures too (that would be the day...) + */ +ldns_pkt_type +get_dnssec_rr(ldns_pkt *p, ldns_rdf *name, ldns_rr_type t, + ldns_rr_list **rrlist, ldns_rr_list **sig) +{ + ldns_pkt_type pt = LDNS_PACKET_UNKNOWN; + ldns_rr_list *rr = NULL; + ldns_rr_list *sigs = NULL; + size_t i; + + if (!p) { + if (rrlist) { + *rrlist = NULL; + } + return LDNS_PACKET_UNKNOWN; + } + + pt = ldns_pkt_reply_type(p); + if (name) { + rr = ldns_pkt_rr_list_by_name_and_type(p, name, t, LDNS_SECTION_ANSWER); + if (!rr) { + rr = ldns_pkt_rr_list_by_name_and_type(p, name, t, LDNS_SECTION_AUTHORITY); + } + sigs = ldns_pkt_rr_list_by_name_and_type(p, name, LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_ANSWER); + if (!sigs) { + sigs = ldns_pkt_rr_list_by_name_and_type(p, name, LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_AUTHORITY); + } + } else { + /* A DS-referral - get the DS records if they are there */ + rr = ldns_pkt_rr_list_by_type(p, t, LDNS_SECTION_AUTHORITY); + sigs = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_AUTHORITY); + } + if (sig) { + *sig = ldns_rr_list_new(); + for (i = 0; i < ldns_rr_list_rr_count(sigs); i++) { + /* only add the sigs that cover this type */ + if (ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(ldns_rr_list_rr(sigs, i))) == + t) { + ldns_rr_list_push_rr(*sig, ldns_rr_clone(ldns_rr_list_rr(sigs, i))); + } + } + } + ldns_rr_list_deep_free(sigs); + if (rrlist) { + *rrlist = rr; + } + + if (pt == LDNS_PACKET_NXDOMAIN || pt == LDNS_PACKET_NODATA) { + return pt; + } else { + return LDNS_PACKET_ANSWER; + } +} + + +ldns_status +ldns_verify_denial(ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type, ldns_rr_list **nsec_rrs, ldns_rr_list **nsec_rr_sigs) +{ + uint16_t nsec_i; + + ldns_rr_list *nsecs; + ldns_status result; + + if (verbosity >= 5) { + printf("VERIFY DENIAL FROM:\n"); + ldns_pkt_print(stdout, pkt); + } + + result = LDNS_STATUS_CRYPTO_NO_RRSIG; + /* Try to see if there are NSECS in the packet */ + nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC, LDNS_SECTION_ANY_NOQUESTION); + if (nsecs) { + for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsecs); nsec_i++) { + /* there are four options: + * - name equals ownername and is covered by the type bitmap + * - name equals ownername but is not covered by the type bitmap + * - name falls within nsec coverage but is not equal to the owner name + * - name falls outside of nsec coverage + */ + if (ldns_dname_compare(ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), name) == 0) { + /* + printf("CHECKING NSEC:\n"); + ldns_rr_print(stdout, ldns_rr_list_rr(nsecs, nsec_i)); + printf("DAWASEM\n"); + */ + if (ldns_nsec_bitmap_covers_type( + ldns_nsec_get_bitmap(ldns_rr_list_rr(nsecs, + nsec_i)), + type)) { + /* Error, according to the nsec this rrset is signed */ + result = LDNS_STATUS_CRYPTO_NO_RRSIG; + } else { + /* ok nsec denies existence */ + if (verbosity >= 3) { + printf(";; Existence of data set with this type denied by NSEC\n"); + } + /*printf(";; Verifiably insecure.\n");*/ + if (nsec_rrs && nsec_rr_sigs) { + (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), LDNS_RR_TYPE_NSEC, nsec_rrs, nsec_rr_sigs); + } + ldns_rr_list_deep_free(nsecs); + return LDNS_STATUS_OK; + } + } else if (ldns_nsec_covers_name(ldns_rr_list_rr(nsecs, nsec_i), name)) { + if (verbosity >= 3) { + printf(";; Existence of data set with this name denied by NSEC\n"); + } + if (nsec_rrs && nsec_rr_sigs) { + (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), LDNS_RR_TYPE_NSEC, nsec_rrs, nsec_rr_sigs); + } + ldns_rr_list_deep_free(nsecs); + return LDNS_STATUS_OK; + } else { + /* nsec has nothing to do with this data */ + } + } + ldns_rr_list_deep_free(nsecs); + } else if( (nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC3, LDNS_SECTION_ANY_NOQUESTION)) ) { + ldns_rr_list* sigs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_RRSIG, LDNS_SECTION_ANY_NOQUESTION); + ldns_rr* q = ldns_rr_new(); + if(!sigs) return LDNS_STATUS_MEM_ERR; + if(!q) return LDNS_STATUS_MEM_ERR; + ldns_rr_set_question(q, 1); + ldns_rr_set_ttl(q, 0); + ldns_rr_set_owner(q, ldns_rdf_clone(name)); + if(!ldns_rr_owner(q)) return LDNS_STATUS_MEM_ERR; + ldns_rr_set_type(q, type); + + result = ldns_dnssec_verify_denial_nsec3(q, nsecs, sigs, ldns_pkt_get_rcode(pkt), type, ldns_pkt_ancount(pkt) == 0); + ldns_rr_free(q); + ldns_rr_list_deep_free(nsecs); + ldns_rr_list_deep_free(sigs); + } + return result; +} + +/* NSEC3 draft -07 */ +/*return hash name match*/ +ldns_rr * +ldns_nsec3_exact_match(ldns_rdf *qname, ldns_rr_type qtype, ldns_rr_list *nsec3s) { + uint8_t algorithm; + uint32_t iterations; + uint8_t salt_length; + uint8_t *salt; + + ldns_rdf *sname, *hashed_sname; + + size_t nsec_i; + ldns_rr *nsec; + ldns_rr *result = NULL; + + ldns_status status; + + const ldns_rr_descriptor *descriptor; + + ldns_rdf *zone_name; + + if (verbosity >= 4) { + printf(";; finding exact match for "); + descriptor = ldns_rr_descript(qtype); + if (descriptor && descriptor->_name) { + printf("%s ", descriptor->_name); + } else { + printf("TYPE%d ", qtype); + } + ldns_rdf_print(stdout, qname); + printf("\n"); + } + + if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { + if (verbosity >= 4) { + printf("no qname, nsec3s or list empty\n"); + } + return NULL; + } + + nsec = ldns_rr_list_rr(nsec3s, 0); + algorithm = ldns_nsec3_algorithm(nsec); + salt_length = ldns_nsec3_salt_length(nsec); + salt = ldns_nsec3_salt_data(nsec); + iterations = ldns_nsec3_iterations(nsec); + + sname = ldns_rdf_clone(qname); + + if (verbosity >= 4) { + printf(";; owner name hashes to: "); + } + hashed_sname = ldns_nsec3_hash_name(sname, algorithm, iterations, salt_length, salt); + + zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); + status = ldns_dname_cat(hashed_sname, zone_name); + + if (verbosity >= 4) { + ldns_rdf_print(stdout, hashed_sname); + printf("\n"); + } + + for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { + nsec = ldns_rr_list_rr(nsec3s, nsec_i); + + /* check values of iterations etc! */ + + /* exact match? */ + if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { + result = nsec; + goto done; + } + + } + +done: + ldns_rdf_deep_free(zone_name); + ldns_rdf_deep_free(sname); + ldns_rdf_deep_free(hashed_sname); + LDNS_FREE(salt); + + if (verbosity >= 4) { + if (result) { + printf(";; Found.\n"); + } else { + printf(";; Not foud.\n"); + } + } + return result; +} + +/*return the owner name of the closest encloser for name from the list of rrs */ +/* this is NOT the hash, but the original name! */ +ldns_rdf * +ldns_nsec3_closest_encloser(ldns_rdf *qname, ldns_rr_type qtype, ldns_rr_list *nsec3s) +{ + /* remember parameters, they must match */ + uint8_t algorithm; + uint32_t iterations; + uint8_t salt_length; + uint8_t *salt; + + ldns_rdf *sname, *hashed_sname, *tmp; + ldns_rr *ce; + bool flag; + + bool exact_match_found; + bool in_range_found; + + ldns_status status; + ldns_rdf *zone_name; + + size_t nsec_i; + ldns_rr *nsec; + ldns_rdf *result = NULL; + + if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { + return NULL; + } + + if (verbosity >= 4) { + printf(";; finding closest encloser for type %d ", qtype); + ldns_rdf_print(stdout, qname); + printf("\n"); + } + + nsec = ldns_rr_list_rr(nsec3s, 0); + algorithm = ldns_nsec3_algorithm(nsec); + salt_length = ldns_nsec3_salt_length(nsec); + salt = ldns_nsec3_salt_data(nsec); + iterations = ldns_nsec3_iterations(nsec); + + sname = ldns_rdf_clone(qname); + + ce = NULL; + flag = false; + + zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); + + /* algorithm from nsec3-07 8.3 */ + while (ldns_dname_label_count(sname) > 0) { + exact_match_found = false; + in_range_found = false; + + if (verbosity >= 3) { + printf(";; "); + ldns_rdf_print(stdout, sname); + printf(" hashes to: "); + } + hashed_sname = ldns_nsec3_hash_name(sname, algorithm, iterations, salt_length, salt); + + status = ldns_dname_cat(hashed_sname, zone_name); + + if (verbosity >= 3) { + ldns_rdf_print(stdout, hashed_sname); + printf("\n"); + } + + for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { + nsec = ldns_rr_list_rr(nsec3s, nsec_i); + + /* check values of iterations etc! */ + + /* exact match? */ + if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { + if (verbosity >= 4) { + printf(";; exact match found\n"); + } + exact_match_found = true; + } else if (ldns_nsec_covers_name(nsec, hashed_sname)) { + if (verbosity >= 4) { + printf(";; in range of an nsec\n"); + } + in_range_found = true; + } + + } + if (!exact_match_found && in_range_found) { + flag = true; + } else if (exact_match_found && flag) { + result = ldns_rdf_clone(sname); + } else if (exact_match_found && !flag) { + // error! + if (verbosity >= 4) { + printf(";; the closest encloser is the same name (ie. this is an exact match, ie there is no closest encloser)\n"); + } + ldns_rdf_deep_free(hashed_sname); + goto done; + } else { + flag = false; + } + + ldns_rdf_deep_free(hashed_sname); + tmp = sname; + sname = ldns_dname_left_chop(sname); + ldns_rdf_deep_free(tmp); + } + + done: + LDNS_FREE(salt); + ldns_rdf_deep_free(zone_name); + ldns_rdf_deep_free(sname); + + if (!result) { + if (verbosity >= 4) { + printf(";; no closest encloser found\n"); + } + } + + /* todo checks from end of 6.2. here or in caller? */ + return result; +} + + +/* special case were there was a wildcard expansion match, the exact match must be disproven */ +ldns_status +ldns_verify_denial_wildcard(ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type, ldns_rr_list **nsec_rrs, ldns_rr_list **nsec_rr_sigs) +{ + ldns_rdf *nsec3_ce = NULL; + ldns_rr *nsec3_ex = NULL; + ldns_rdf *wildcard_name = NULL; + ldns_rdf *nsec3_wc_ce = NULL; + ldns_rr *nsec3_wc_ex = NULL; + ldns_rdf *chopped_dname = NULL; + ldns_rr_list *nsecs; + ldns_status result = LDNS_STATUS_ERR; + + nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC3, LDNS_SECTION_ANY_NOQUESTION); + if (nsecs) { + wildcard_name = ldns_dname_new_frm_str("*"); + chopped_dname = ldns_dname_left_chop(name); + result = ldns_dname_cat(wildcard_name, chopped_dname); + ldns_rdf_deep_free(chopped_dname); + + nsec3_ex = ldns_nsec3_exact_match(name, type, nsecs); + nsec3_ce = ldns_nsec3_closest_encloser(name, type, nsecs); + nsec3_wc_ce = ldns_nsec3_closest_encloser(wildcard_name, type, nsecs); + nsec3_wc_ex = ldns_nsec3_exact_match(wildcard_name, type, nsecs); + + if (nsec3_ex) { + if (verbosity >= 3) { + printf(";; Error, exact match for for name found, but should not exist (draft -07 section 8.8)\n"); + } + result = LDNS_STATUS_NSEC3_ERR; + } else if (!nsec3_ce) { + if (verbosity >= 3) { + printf(";; Error, closest encloser for exact match missing in wildcard response (draft -07 section 8.8)\n"); + } + result = LDNS_STATUS_NSEC3_ERR; +/* + } else if (!nsec3_wc_ex) { + printf(";; Error, no wildcard nsec3 match: "); + ldns_rdf_print(stdout, wildcard_name); + printf(" (draft -07 section 8.8)\n"); + result = LDNS_STATUS_NSEC3_ERR; +*/ +/* } else if (!nsec */ + } else { + if (verbosity >= 3) { + printf(";; wilcard expansion proven\n"); + } + result = LDNS_STATUS_OK; + } + } else { + if (verbosity >= 3) { + printf(";; Error: no NSEC or NSEC3 records in answer\n"); + } + result = LDNS_STATUS_CRYPTO_NO_RRSIG; + } + + if (nsecs && nsec_rrs && nsec_rr_sigs) { + (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, 0)), LDNS_RR_TYPE_NSEC3, nsec_rrs, nsec_rr_sigs); + } + return result; +} + + diff --git a/libs/ldns/drill/drill.1 b/libs/ldns/drill/drill.1 new file mode 100644 index 0000000000..24cfd6dabe --- /dev/null +++ b/libs/ldns/drill/drill.1 @@ -0,0 +1,230 @@ +.\" @(#)drill.1 1.7.0 14-Jul-2004 OF; +.TH drill 1 "28 May 2006" +.SH NAME +drill \- get (debug) information out of DNS(SEC) +.SH SYNOPSIS +.B drill +[ +.IR OPTIONS +] +.IR name +[ +.IR @server +] +[ +.IR type +] +[ +.IR class +] + +.SH DESCRIPTION +\fBdrill\fR is a tool to designed to get all sorts of information out of the +DNS. It is specificly designed to be used with DNSSEC. +.PP +The name \fBdrill\fR is a pun on \fBdig\fR. With \fBdrill\fR you should be able +get even more information than with \fBdig\fR. +.PP +If no arguments are given class defaults to 'IN' and type to 'A'. The +server(s) specified in /etc/resolv.conf are used to query against. + +.PP +\fIname\fR +Ask for this name. + +.PP +\fI@server\fR +Send to query to this server. If not specified use the nameservers from +\fI/etc/resolv.conf\fR. + +.PP +\fItype\fR +Ask for this RR type. If type is not given on the command line it defaults +to 'A'. Except when doing to reverse lookup when it defaults to 'PTR'. + +.PP +\fIclass\fR +Use this class when querying. + +.SH SAMPLE USAGE +\fBdrill mx miek.nl\fR +Show the MX records of the domain miek.nl + +.TP +\fBdrill -S jelte.nlnetlabs.nl\fR +Chase any signatures in the jelte.nlnetlab.nl domain. This option is +only available when ldns has been compiled with openssl-support. + +.TP +\fBdrill -TD www.example.com\fR +Do a DNSSEC (-D) trace (-T) from the rootservers down to www.example.com. +This option only works when ldns has been compiled with openssl support. + +.TP +\fBdrill -s dnskey jelte.nlnetlabs.nl\fR +Show the DNSKEY record(s) for jelte.nlnetlabs.nl. For each found DNSKEY +record also print the DS record. + +.SH OPTIONS + +.TP +\fB\-D +Enable DNSSEC in the query. When querying for DNSSEC types (DNSKEY, RRSIG, +DS and NSEC) this is \fInot\fR automaticly enabled. + +.TP +\fB\-T +Trace \fIname\fR from the root down. When using this option the @server and +the type arguments are not used. + +.TP +\fB\-S +Chase the signature(s) of 'name' to a known key or as high up in +the tree as possible. + +.TP +\fB\-V \fIlevel\fR +Be more verbose. Set level to 5 to see the actual query that is sent. + +.TP +\fB\-Q +Quiet mode, this overrules -V. + +.TP +\fB\-f \fIfile\fR +Read the query from a file. The query must be dumped with -w. + +.TP +\fB\-i \fIfile\fR +read the answer from the file instead from the network. This aids +in debugging and can be used to check if a query on disk is valid. +If the file contains binary data it is assumed to be a query in +network order. + +.TP +\fB\-w \fIfile\fR +Write an answer packet to file. + +.TP +\fB\-q \fIfile\fR +Write the query packet to file. + +.TP +\fB\-v +Show drill's version. + +.TP +\fB\-h +Show a short help message. + +.SS QUERY OPTIONS + +.TP +\fB\-4 +Stay on ip4. Only send queries to ip4 enabled nameservers. + +.TP +\fB\-6 +Stay on ip6. Only send queries to ip6 enabled nameservers. + +.TP +\fB\-a +Use the resolver structure's fallback mechanism if the answer +is truncated (TC=1). If a truncated packet is received and this +option is set, drill will first send a new query with EDNS0 +buffer size 4096. + +If the EDNS0 buffer size was already set to 512+ bytes, or the +above retry also results in a truncated answer, the resolver +structure will fall back to TCP. + +.TP +\fB\-b \fIsize\fR +Use size as the buffer size in the EDNS0 pseudo RR. + +.TP +\fB\-c \fIfile\fR +Use file instead of /etc/resolv.conf for nameserver configuration. + +.TP +\fB\-d \fIdomain\fR +When tracing (-T), start from this domain instead of the root. + +.TP +\fB\-t +Use TCP/IP when querying a server + +.TP +\fB\-k \fIkeyfile\fR +Use this file to read a (trusted) key from. When this options is +given \fBdrill\fR tries to validate the current answer with this +key. No chasing is done. When \fBdrill\fR is doing a secure trace, this +key will be used as trust anchor. Can contain a DNSKEY or a DS record. + +.TP +\fB\-o \fImnemonic\fR +Use this option to set or unset specific header bits. A bit is +set by using the bit mnemonic in CAPITAL letters. A bit is unset when +the mnemonic is given in lowercase. The following mnemonics are +understood by \fBdrill\fR: + + QR, qr: set, unset QueRy (default: on) + AA, aa: set, unset Authoritative Answer (default: off) + TC, tc: set, unset TrunCated (default: off) + RD, rd: set, unset Recursion Desired (default: on) + CD, cd: set, unset Checking Disabled (default: off) + RA, ra: set, unset Recursion Available (default: off) + AD, ad: set, unset Authenticated Data (default: off) + +Thus: \fB-o CD\fR, will enable Checking Disabled, which instructs the +cache to not validate the answers it gives out. + +.TP +\fB\-p \fIport\fR +Use this port instead of the default of 53. + +.TP +\fB\-r \fIfile\fR +When tracing (-T), use file as a root servers hint file. + +.TP +\fB\-s +When encountering a DNSKEY print the equivalent DS also. + +.TP +\fB\-u +Use UDP when querying a server. This is the default. + +.TP +\fB\-w \fIfile\fR +write the answer to a file. The file will contain a hexadecimal dump +of the query. This can be used in conjunction with -f. + +.TP +\fB\-x +Do a reverse loopup. The type argument is not used, it is preset to PTR. + +.TP +\fB\-y \fI\fR +specify named base64 tsig key, and optional an algorithm (defaults to hmac-md5.sig-alg.reg.int) + +.TP +\fB\-z \fR +don't randomize the nameserver list before sending queries. + + +.SH AUTHOR +Jelte Jansen and Miek Gieben. Both of NLnet Labs. + +.SH REPORTING BUGS +Report bugs to . + +.SH BUGS + +.SH COPYRIGHT +Copyright (c) 2004-2008 NLnet Labs. +Licensed under the revised BSD license. There is NO warranty; not even for MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. + +.SH SEE ALSO +\fBdig\fR(1), \fIRFC403{3,4,5}\fR. diff --git a/libs/ldns/drill/drill.c b/libs/ldns/drill/drill.c new file mode 100644 index 0000000000..abd0ff6300 --- /dev/null +++ b/libs/ldns/drill/drill.c @@ -0,0 +1,930 @@ +/* + * drill.c + * the main file of drill + * (c) 2005-2008 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +#ifdef HAVE_SSL +#include +#endif + +#define IP6_ARPA_MAX_LEN 65 + +/* query debug, 2 hex dumps */ +int verbosity; + +static void +usage(FILE *stream, const char *progname) +{ + fprintf(stream, " Usage: %s name [@server] [type] [class]\n", progname); + fprintf(stream, "\t can be a domain name or an IP address (-x lookups)\n"); + fprintf(stream, "\t defaults to A\n"); + fprintf(stream, "\t defaults to IN\n"); + fprintf(stream, "\n\targuments may be placed in random order\n"); + fprintf(stream, "\n Options:\n"); + fprintf(stream, "\t-D\t\tenable DNSSEC (DO bit)\n"); +#ifdef HAVE_SSL + fprintf(stream, "\t-T\t\ttrace from the root down to \n"); + fprintf(stream, "\t-S\t\tchase signature(s) from to a know key [*]\n"); +#endif /*HAVE_SSL*/ + fprintf(stream, "\t-V \tverbosity (0-5)\n"); + fprintf(stream, "\t-Q\t\tquiet mode (overrules -V)\n"); + fprintf(stream, "\n"); + fprintf(stream, "\t-f file\t\tread packet from file and send it\n"); + fprintf(stream, "\t-i file\t\tread packet from file and print it\n"); + fprintf(stream, "\t-w file\t\twrite answer packet to file\n"); + fprintf(stream, "\t-q file\t\twrite query packet to file\n"); + fprintf(stream, "\t-h\t\tshow this help\n"); + fprintf(stream, "\t-v\t\tshow version\n"); + fprintf(stream, "\n Query options:\n"); + fprintf(stream, "\t-4\t\tstay on ip4\n"); + fprintf(stream, "\t-6\t\tstay on ip6\n"); + fprintf(stream, "\t-a\t\tfallback to EDNS0 and TCP if the answer is truncated\n"); + fprintf(stream, "\t-b \tuse as the buffer size (defaults to 512 b)\n"); + fprintf(stream, "\t-c \t\tuse file for rescursive nameserver configuration (/etc/resolv.conf)\n"); + fprintf(stream, "\t-k \tspecify a file that contains a trusted DNSSEC key (DNSKEY|DS) [**]\n"); + fprintf(stream, "\t\t\tused to verify any signatures in the current answer\n"); + fprintf(stream, "\t-o \tset flags to: [QR|qr][AA|aa][TC|tc][RD|rd][CD|cd][RA|ra][AD|ad]\n"); + fprintf(stream, "\t\t\tlowercase: unset bit, uppercase: set bit\n"); + fprintf(stream, "\t-p \tuse as remote port number\n"); + fprintf(stream, "\t-s\t\tshow the DS RR for each key in a packet\n"); + fprintf(stream, "\t-u\t\tsend the query with udp (the default)\n"); + fprintf(stream, "\t-x\t\tdo a reverse lookup\n"); + fprintf(stream, "\twhen doing a secure trace:\n"); + fprintf(stream, "\t-r \t\tuse file as root servers hint file\n"); + fprintf(stream, "\t-t\t\tsend the query with tcp (connected)\n"); + fprintf(stream, "\t-d \t\tuse domain as the start point for the trace\n"); + fprintf(stream, "\t-y \tspecify named base64 tsig key, and optional an\n\t\t\talgorithm (defaults to hmac-md5.sig-alg.reg.int)\n"); + fprintf(stream, "\t-z\t\tdon't randomize the nameservers before use\n"); + fprintf(stream, "\n [*] = enables/implies DNSSEC\n"); + fprintf(stream, " [**] = can be given more than once\n"); + fprintf(stream, "\n ldns-team@nlnetlabs.nl | http://www.nlnetlabs.nl/ldns/\n"); +} + +/** + * Prints the drill version to stderr + */ +static void +version(FILE *stream, const char *progname) +{ + fprintf(stream, "%s version %s (ldns version %s)\n", progname, DRILL_VERSION, ldns_version()); + fprintf(stream, "Written by NLnet Labs.\n"); + fprintf(stream, "\nCopyright (c) 2004-2008 NLnet Labs.\n"); + fprintf(stream, "Licensed under the revised BSD license.\n"); + fprintf(stream, "There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"); + fprintf(stream, "FOR A PARTICULAR PURPOSE.\n"); +} + + +/** + * Main function of drill + * parse the arguments and prepare a query + */ +int +main(int argc, char *argv[]) +{ + ldns_resolver *res = NULL; + ldns_resolver *cmdline_res = NULL; /* only used to resolv @name names */ + ldns_rr_list *cmdline_rr_list = NULL; + ldns_rdf *cmdline_dname = NULL; + ldns_rdf *qname, *qname_tmp; + ldns_pkt *pkt; + ldns_pkt *qpkt; + char *serv; + char *name; + char *name2; + char *progname; + char *query_file = NULL; + char *answer_file = NULL; + ldns_buffer *query_buffer = NULL; + ldns_rdf *serv_rdf; + ldns_rr_type type; + ldns_rr_class clas; +#if 0 + ldns_pkt_opcode opcode = LDNS_PACKET_QUERY; +#endif + int i, c; + int int_type; + int int_clas; + int PURPOSE; + char *tsig_name = NULL; + char *tsig_data = NULL; + char *tsig_algorithm = NULL; + size_t tsig_separator; + size_t tsig_separator2; + ldns_rr *axfr_rr; + ldns_status status; + char *type_str; + + /* list of keys used in dnssec operations */ + ldns_rr_list *key_list = ldns_rr_list_new(); + /* what key verify the current answer */ + ldns_rr_list *key_verified; + + /* resolver options */ + uint16_t qflags; + uint16_t qbuf; + uint16_t qport; + uint8_t qfamily; + bool qdnssec; + bool qfallback; + bool qds; + bool qusevc; + bool qrandom; + + char *resolv_conf_file = NULL; + + ldns_rdf *trace_start_name = NULL; + + int result = 0; + +#ifdef USE_WINSOCK + int r; + WSADATA wsa_data; +#endif + + int_type = -1; serv = NULL; type = 0; + int_clas = -1; name = NULL; clas = 0; + qname = NULL; + progname = strdup(argv[0]); + +#ifdef USE_WINSOCK + r = WSAStartup(MAKEWORD(2,2), &wsa_data); + if(r != 0) { + printf("Failed WSAStartup: %d\n", r); + result = EXIT_FAILURE; + goto exit; + } +#endif /* USE_WINSOCK */ + + + PURPOSE = DRILL_QUERY; + qflags = LDNS_RD; + qport = LDNS_PORT; + verbosity = 2; + qdnssec = false; + qfamily = LDNS_RESOLV_INETANY; + qfallback = false; + qds = false; + qbuf = 0; + qusevc = false; + qrandom = true; + key_verified = NULL; + + ldns_init_random(NULL, 0); + + if (argc == 0) { + usage(stdout, progname); + result = EXIT_FAILURE; + goto exit; + } + + /* string from orig drill: "i:w:I46Sk:TNp:b:DsvhVcuaq:f:xr" */ + /* global first, query opt next, option with parm's last + * and sorted */ /* "46DITSVQf:i:w:q:achuvxzy:so:p:b:k:" */ + + while ((c = getopt(argc, argv, "46ab:c:d:Df:hi:Ik:o:p:q:Qr:sStTuvV:w:xy:z")) != -1) { + switch(c) { + /* global options */ + case '4': + qfamily = LDNS_RESOLV_INET; + break; + case '6': + qfamily = LDNS_RESOLV_INET6; + break; + case 'D': + qdnssec = true; + break; + case 'I': + /* reserved for backward compatibility */ + break; + case 'T': + if (PURPOSE == DRILL_CHASE) { + fprintf(stderr, "-T and -S cannot be used at the same time.\n"); + exit(EXIT_FAILURE); + } + PURPOSE = DRILL_TRACE; + break; +#ifdef HAVE_SSL + case 'S': + if (PURPOSE == DRILL_TRACE) { + fprintf(stderr, "-T and -S cannot be used at the same time.\n"); + exit(EXIT_FAILURE); + } + PURPOSE = DRILL_CHASE; + break; +#endif /* HAVE_SSL */ + case 'V': + verbosity = atoi(optarg); + break; + case 'Q': + verbosity = -1; + break; + case 'f': + query_file = optarg; + break; + case 'i': + answer_file = optarg; + PURPOSE = DRILL_AFROMFILE; + break; + case 'w': + answer_file = optarg; + break; + case 'q': + query_file = optarg; + PURPOSE = DRILL_QTOFILE; + break; + case 'r': + if (global_dns_root) { + fprintf(stderr, "There was already a series of root servers set\n"); + exit(EXIT_FAILURE); + } + global_dns_root = read_root_hints(optarg); + if (!global_dns_root) { + fprintf(stderr, "Unable to read root hints file %s, aborting\n", optarg); + exit(EXIT_FAILURE); + } + break; + /* query options */ + case 'a': + qfallback = true; + break; + case 'b': + qbuf = (uint16_t)atoi(optarg); + if (qbuf == 0) { + error("%s", " could not be converted"); + } + break; + case 'c': + resolv_conf_file = optarg; + break; + case 't': + qusevc = true; + break; + case 'k': + status = read_key_file(optarg, key_list); + if (status != LDNS_STATUS_OK) { + error("Could not parse the key file %s: %s", optarg, ldns_get_errorstr_by_id(status)); + } + qdnssec = true; /* enable that too */ + break; + case 'o': + /* only looks at the first hit: capital=ON, lowercase=OFF*/ + if (strstr(optarg, "QR")) { + DRILL_ON(qflags, LDNS_QR); + } + if (strstr(optarg, "qr")) { + DRILL_OFF(qflags, LDNS_QR); + } + if (strstr(optarg, "AA")) { + DRILL_ON(qflags, LDNS_AA); + } + if (strstr(optarg, "aa")) { + DRILL_OFF(qflags, LDNS_AA); + } + if (strstr(optarg, "TC")) { + DRILL_ON(qflags, LDNS_TC); + } + if (strstr(optarg, "tc")) { + DRILL_OFF(qflags, LDNS_TC); + } + if (strstr(optarg, "RD")) { + DRILL_ON(qflags, LDNS_RD); + } + if (strstr(optarg, "rd")) { + DRILL_OFF(qflags, LDNS_RD); + } + if (strstr(optarg, "CD")) { + DRILL_ON(qflags, LDNS_CD); + } + if (strstr(optarg, "cd")) { + DRILL_OFF(qflags, LDNS_CD); + } + if (strstr(optarg, "RA")) { + DRILL_ON(qflags, LDNS_RA); + } + if (strstr(optarg, "ra")) { + DRILL_OFF(qflags, LDNS_RA); + } + if (strstr(optarg, "AD")) { + DRILL_ON(qflags, LDNS_AD); + } + if (strstr(optarg, "ad")) { + DRILL_OFF(qflags, LDNS_AD); + } + break; + case 'p': + qport = (uint16_t)atoi(optarg); + if (qport == 0) { + error("%s", " could not be converted"); + } + break; + case 's': + qds = true; + break; + case 'u': + qusevc = false; + break; + case 'v': + version(stdout, progname); + result = EXIT_SUCCESS; + goto exit; + case 'x': + PURPOSE = DRILL_REVERSE; + break; + case 'y': +#ifdef HAVE_SSL + if (strchr(optarg, ':')) { + tsig_separator = (size_t) (strchr(optarg, ':') - optarg); + if (strchr(optarg + tsig_separator + 1, ':')) { + tsig_separator2 = (size_t) (strchr(optarg + tsig_separator + 1, ':') - optarg); + tsig_algorithm = xmalloc(strlen(optarg) - tsig_separator2); + strncpy(tsig_algorithm, optarg + tsig_separator2 + 1, strlen(optarg) - tsig_separator2); + tsig_algorithm[strlen(optarg) - tsig_separator2 - 1] = '\0'; + } else { + tsig_separator2 = strlen(optarg); + tsig_algorithm = xmalloc(26); + strncpy(tsig_algorithm, "hmac-md5.sig-alg.reg.int.", 25); + tsig_algorithm[25] = '\0'; + } + tsig_name = xmalloc(tsig_separator + 1); + tsig_data = xmalloc(tsig_separator2 - tsig_separator); + strncpy(tsig_name, optarg, tsig_separator); + strncpy(tsig_data, optarg + tsig_separator + 1, tsig_separator2 - tsig_separator - 1); + /* strncpy does not append \0 if source is longer than n */ + tsig_name[tsig_separator] = '\0'; + tsig_data[ tsig_separator2 - tsig_separator - 1] = '\0'; + } +#else + fprintf(stderr, "TSIG requested, but SSL is not supported\n"); + result = EXIT_FAILURE; + goto exit; +#endif /* HAVE_SSL */ + break; + case 'z': + qrandom = false; + break; + case 'd': + trace_start_name = ldns_dname_new_frm_str(optarg); + if (!trace_start_name) { + fprintf(stderr, "Unable to parse argument for -%c\n", c); + result = EXIT_FAILURE; + goto exit; + } + break; + case 'h': + version(stdout, progname); + usage(stdout, progname); + result = EXIT_SUCCESS; + goto exit; + break; + default: + fprintf(stderr, "Unknown argument: -%c, use -h to see usage\n", c); + result = EXIT_FAILURE; + goto exit; + } + } + argc -= optind; + argv += optind; + + /* do a secure trace when requested */ + if (PURPOSE == DRILL_TRACE && qdnssec) { +#ifdef HAVE_SSL + if (ldns_rr_list_rr_count(key_list) == 0) { + warning("%s", "No trusted keys were given. Will not be able to verify authenticity!"); + } + PURPOSE = DRILL_SECTRACE; +#else + fprintf(stderr, "ldns has not been compiled with OpenSSL support. Secure trace not available\n"); + exit(1); +#endif /* HAVE_SSL */ + } + + /* parse the arguments, with multiple arguments, the last argument + * found is used */ + for(i = 0; i < argc; i++) { + + /* if ^@ then it's a server */ + if (argv[i][0] == '@') { + if (strlen(argv[i]) == 1) { + warning("%s", "No nameserver given"); + exit(EXIT_FAILURE); + } + serv = argv[i] + 1; + continue; + } + /* if has a dot, it's a name */ + if (strchr(argv[i], '.')) { + name = argv[i]; + continue; + } + /* if it matches a type, it's a type */ + if (int_type == -1) { + type = ldns_get_rr_type_by_name(argv[i]); + if (type != 0) { + int_type = 0; + continue; + } + } + /* if it matches a class, it's a class */ + if (int_clas == -1) { + clas = ldns_get_rr_class_by_name(argv[i]); + if (clas != 0) { + int_clas = 0; + continue; + } + } + /* it all fails assume it's a name */ + name = argv[i]; + } + /* act like dig and use for . NS */ + if (!name) { + name = "."; + int_type = 0; + type = LDNS_RR_TYPE_NS; + } + + /* defaults if not given */ + if (int_clas == -1) { + clas = LDNS_RR_CLASS_IN; + } + if (int_type == -1) { + if (PURPOSE != DRILL_REVERSE) { + type = LDNS_RR_TYPE_A; + } else { + type = LDNS_RR_TYPE_PTR; + } + } + + /* set the nameserver to use */ + if (!serv) { + /* no server given make a resolver from /etc/resolv.conf */ + status = ldns_resolver_new_frm_file(&res, resolv_conf_file); + if (status != LDNS_STATUS_OK) { + warning("Could not create a resolver structure: %s (%s)\n" + "Try drill @localhost if you have a resolver running on your machine.", + ldns_get_errorstr_by_id(status), resolv_conf_file); + result = EXIT_FAILURE; + goto exit; + } + } else { + res = ldns_resolver_new(); + if (!res || strlen(serv) <= 0) { + warning("Could not create a resolver structure"); + result = EXIT_FAILURE; + goto exit; + } + /* add the nameserver */ + serv_rdf = ldns_rdf_new_addr_frm_str(serv); + if (!serv_rdf) { + /* try to resolv the name if possible */ + status = ldns_resolver_new_frm_file(&cmdline_res, resolv_conf_file); + + if (status != LDNS_STATUS_OK) { + error("%s", "@server ip could not be converted"); + } + ldns_resolver_set_dnssec(cmdline_res, qdnssec); + ldns_resolver_set_ip6(cmdline_res, qfamily); + ldns_resolver_set_fallback(cmdline_res, qfallback); + ldns_resolver_set_usevc(cmdline_res, qusevc); + + cmdline_dname = ldns_dname_new_frm_str(serv); + + cmdline_rr_list = ldns_get_rr_list_addr_by_name( + cmdline_res, + cmdline_dname, + LDNS_RR_CLASS_IN, + qflags); + ldns_rdf_deep_free(cmdline_dname); + if (!cmdline_rr_list) { + /* This error msg is not always accurate */ + error("%s `%s\'", "could not find any address for the name:", serv); + } else { + if (ldns_resolver_push_nameserver_rr_list( + res, + cmdline_rr_list + ) != LDNS_STATUS_OK) { + error("%s", "pushing nameserver"); + } + } + } else { + if (ldns_resolver_push_nameserver(res, serv_rdf) != LDNS_STATUS_OK) { + error("%s", "pushing nameserver"); + } else { + ldns_rdf_deep_free(serv_rdf); + } + } + } + /* set the resolver options */ + ldns_resolver_set_port(res, qport); + if (verbosity >= 5) { + ldns_resolver_set_debug(res, true); + } else { + ldns_resolver_set_debug(res, false); + } + ldns_resolver_set_dnssec(res, qdnssec); +/* ldns_resolver_set_dnssec_cd(res, qdnssec);*/ + ldns_resolver_set_ip6(res, qfamily); + ldns_resolver_set_fallback(res, qfallback); + ldns_resolver_set_usevc(res, qusevc); + ldns_resolver_set_random(res, qrandom); + if (qbuf != 0) { + ldns_resolver_set_edns_udp_size(res, qbuf); + } + + if (!name && + PURPOSE != DRILL_AFROMFILE && + !query_file + ) { + usage(stdout, progname); + result = EXIT_FAILURE; + goto exit; + } + + if (tsig_name && tsig_data) { + ldns_resolver_set_tsig_keyname(res, tsig_name); + ldns_resolver_set_tsig_keydata(res, tsig_data); + ldns_resolver_set_tsig_algorithm(res, tsig_algorithm); + } + + /* main switching part of drill */ + switch(PURPOSE) { + case DRILL_TRACE: + /* do a trace from the root down */ + if (!global_dns_root) { + init_root(); + } + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "parsing query name"); + } + /* don't care about return packet */ + (void)do_trace(res, qname, type, clas); + clear_root(); + break; + case DRILL_SECTRACE: + /* do a secure trace from the root down */ + if (!global_dns_root) { + init_root(); + } + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "making qname"); + } + /* don't care about return packet */ +#ifdef HAVE_SSL + result = do_secure_trace(res, qname, type, clas, key_list, trace_start_name); +#endif /* HAVE_SSL */ + clear_root(); + break; + case DRILL_CHASE: + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "making qname"); + } + + ldns_resolver_set_dnssec(res, true); + ldns_resolver_set_dnssec_cd(res, true); + /* set dnssec implies udp_size of 4096 */ + ldns_resolver_set_edns_udp_size(res, 4096); + pkt = ldns_resolver_query(res, qname, type, clas, qflags); + + if (!pkt) { + error("%s", "error pkt sending"); + result = EXIT_FAILURE; + } else { + if (verbosity >= 3) { + ldns_pkt_print(stdout, pkt); + } + + if (!ldns_pkt_answer(pkt)) { + mesg("No answer in packet"); + } else { +#ifdef HAVE_SSL + ldns_resolver_set_dnssec_anchors(res, ldns_rr_list_clone(key_list)); + result = do_chase(res, qname, type, + clas, key_list, + pkt, qflags, NULL, + verbosity); + if (result == LDNS_STATUS_OK) { + if (verbosity != -1) { + mesg("Chase successful"); + } + result = 0; + } else { + if (verbosity != -1) { + mesg("Chase failed."); + } + } +#endif /* HAVE_SSL */ + } + ldns_pkt_free(pkt); + } + break; + case DRILL_AFROMFILE: + pkt = read_hex_pkt(answer_file); + if (pkt) { + if (verbosity != -1) { + ldns_pkt_print(stdout, pkt); + } + ldns_pkt_free(pkt); + } + + break; + case DRILL_QTOFILE: + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "making qname"); + } + + status = ldns_resolver_prepare_query_pkt(&qpkt, res, qname, type, clas, qflags); + if(status != LDNS_STATUS_OK) { + error("%s", "making query: %s", + ldns_get_errorstr_by_id(status)); + } + dump_hex(qpkt, query_file); + ldns_pkt_free(qpkt); + break; + case DRILL_NSEC: + break; + case DRILL_REVERSE: + /* ipv4 or ipv6 addr? */ + if (strchr(name, ':')) { + if (strchr(name, '.')) { + error("Syntax error: both '.' and ':' seen in address\n"); + } + name2 = malloc(IP6_ARPA_MAX_LEN + 20); + c = 0; + for (i=0; i<(int)strlen(name); i++) { + if (i >= IP6_ARPA_MAX_LEN) { + error("%s", "reverse argument to long"); + } + if (name[i] == ':') { + if (i < (int) strlen(name) && name[i + 1] == ':') { + error("%s", ":: not supported (yet)"); + } else { + if (i + 2 == (int) strlen(name) || name[i + 2] == ':') { + name2[c++] = '0'; + name2[c++] = '.'; + name2[c++] = '0'; + name2[c++] = '.'; + name2[c++] = '0'; + name2[c++] = '.'; + } else if (i + 3 == (int) strlen(name) || name[i + 3] == ':') { + name2[c++] = '0'; + name2[c++] = '.'; + name2[c++] = '0'; + name2[c++] = '.'; + } else if (i + 4 == (int) strlen(name) || name[i + 4] == ':') { + name2[c++] = '0'; + name2[c++] = '.'; + } + } + } else { + name2[c++] = name[i]; + name2[c++] = '.'; + } + } + name2[c++] = '\0'; + + qname = ldns_dname_new_frm_str(name2); + qname_tmp = ldns_dname_reverse(qname); + ldns_rdf_deep_free(qname); + qname = qname_tmp; + qname_tmp = ldns_dname_new_frm_str("ip6.arpa."); + status = ldns_dname_cat(qname, qname_tmp); + if (status != LDNS_STATUS_OK) { + error("%s", "could not create reverse address for ip6: %s\n", ldns_get_errorstr_by_id(status)); + } + ldns_rdf_deep_free(qname_tmp); + + free(name2); + } else { + qname = ldns_dname_new_frm_str(name); + qname_tmp = ldns_dname_reverse(qname); + ldns_rdf_deep_free(qname); + qname = qname_tmp; + qname_tmp = ldns_dname_new_frm_str("in-addr.arpa."); + status = ldns_dname_cat(qname, qname_tmp); + if (status != LDNS_STATUS_OK) { + error("%s", "could not create reverse address for ip4: %s\n", ldns_get_errorstr_by_id(status)); + } + ldns_rdf_deep_free(qname_tmp); + } + if (!qname) { + error("%s", "-x implies an ip address"); + } + + /* create a packet and set the RD flag on it */ + pkt = ldns_resolver_query(res, qname, type, clas, qflags); + if (!pkt) { + error("%s", "pkt sending"); + result = EXIT_FAILURE; + } else { + if (verbosity != -1) { + ldns_pkt_print(stdout, pkt); + } + ldns_pkt_free(pkt); + } + break; + case DRILL_QUERY: + default: + if (query_file) { + /* this old way, the query packet needed + to be parseable, but we want to be able + to send mangled packets, so we need + to do it directly */ + #if 0 + qpkt = read_hex_pkt(query_file); + if (qpkt) { + status = ldns_resolver_send_pkt(&pkt, res, qpkt); + if (status != LDNS_STATUS_OK) { + printf("Error: %s\n", ldns_get_errorstr_by_id(status)); + exit(1); + } + } else { + /* qpkt was bogus, reset pkt */ + pkt = NULL; + } + #endif + query_buffer = read_hex_buffer(query_file); + if (query_buffer) { + status = ldns_send_buffer(&pkt, res, query_buffer, NULL); + ldns_buffer_free(query_buffer); + if (status != LDNS_STATUS_OK) { + printf("Error: %s\n", ldns_get_errorstr_by_id(status)); + exit(1); + } + } else { + printf("NO BUFFER\n"); + pkt = NULL; + } + } else { + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "error in making qname"); + } + + if (type == LDNS_RR_TYPE_AXFR) { + status = ldns_axfr_start(res, qname, clas); + if(status != LDNS_STATUS_OK) { + error("Error starting axfr: %s", + ldns_get_errorstr_by_id(status)); + } + axfr_rr = ldns_axfr_next(res); + if(!axfr_rr) { + fprintf(stderr, "AXFR failed.\n"); + ldns_pkt_print(stdout, + ldns_axfr_last_pkt(res)); + goto exit; + } + while (axfr_rr) { + if (verbosity != -1) { + ldns_rr_print(stdout, axfr_rr); + } + ldns_rr_free(axfr_rr); + axfr_rr = ldns_axfr_next(res); + } + + goto exit; + } else { + /* create a packet and set the RD flag on it */ + pkt = ldns_resolver_query(res, qname, type, clas, qflags); + } + } + + if (!pkt) { + mesg("No packet received"); + result = EXIT_FAILURE; + } else { + if (verbosity != -1) { + ldns_pkt_print(stdout, pkt); + if (ldns_pkt_tc(pkt)) { + fprintf(stdout, + "\n;; WARNING: The answer packet was truncated; you might want to\n"); + fprintf(stdout, + ";; query again with TCP (-t argument), or EDNS0 (-b for buffer size)\n"); + } + } + if (qds) { + if (verbosity != -1) { + print_ds_of_keys(pkt); + printf("\n"); + } + } + + if (ldns_rr_list_rr_count(key_list) > 0) { + /* -k's were given on the cmd line */ + ldns_rr_list *rrset_verified; + uint16_t key_count; + + rrset_verified = ldns_pkt_rr_list_by_name_and_type( + pkt, qname, type, + LDNS_SECTION_ANY_NOQUESTION); + + if (type == LDNS_RR_TYPE_ANY) { + /* don't verify this */ + break; + } + + if (verbosity != -1) { + printf("; "); + ldns_rr_list_print(stdout, rrset_verified); + } + + /* verify */ +#ifdef HAVE_SSL + key_verified = ldns_rr_list_new(); + result = ldns_pkt_verify(pkt, type, qname, key_list, NULL, key_verified); + + if (result == LDNS_STATUS_ERR) { + /* is the existence denied then? */ + result = ldns_verify_denial(pkt, qname, type, NULL, NULL); + if (result == LDNS_STATUS_OK) { + if (verbosity != -1) { + printf("Existence denied for "); + ldns_rdf_print(stdout, qname); + type_str = ldns_rr_type2str(type); + printf("\t%s\n", type_str); + LDNS_FREE(type_str); + } + } else { + if (verbosity != -1) { + printf("Bad data; RR for name and " + "type not found or failed to " + "verify, and denial of " + "existence failed.\n"); + } + } + } else if (result == LDNS_STATUS_OK) { + for(key_count = 0; key_count < ldns_rr_list_rr_count(key_verified); + key_count++) { + if (verbosity != -1) { + printf("; VALIDATED by id = %u, owner = ", + (unsigned int)ldns_calc_keytag( + ldns_rr_list_rr(key_verified, key_count))); + ldns_rdf_print(stdout, ldns_rr_owner( + ldns_rr_list_rr(key_list, key_count))); + printf("\n"); + } + } + } else { + for(key_count = 0; key_count < ldns_rr_list_rr_count(key_list); + key_count++) { + if (verbosity != -1) { + printf("; %s for id = %u, owner = ", + ldns_get_errorstr_by_id(result), + (unsigned int)ldns_calc_keytag( + ldns_rr_list_rr(key_list, key_count))); + ldns_rdf_print(stdout, ldns_rr_owner( + + ldns_rr_list_rr(key_list, + key_count))); + printf("\n"); + } + } + } + ldns_rr_list_free(key_verified); +#else + (void) key_count; +#endif /* HAVE_SSL */ + } + if (answer_file) { + dump_hex(pkt, answer_file); + } + ldns_pkt_free(pkt); + } + + break; + } + + exit: + ldns_rdf_deep_free(qname); + ldns_resolver_deep_free(res); + ldns_resolver_deep_free(cmdline_res); + ldns_rr_list_deep_free(key_list); + ldns_rr_list_deep_free(cmdline_rr_list); + ldns_rdf_deep_free(trace_start_name); + xfree(progname); + xfree(tsig_name); + xfree(tsig_data); + xfree(tsig_algorithm); + +#ifdef HAVE_SSL + ERR_remove_state(0); + CRYPTO_cleanup_all_ex_data(); + ERR_free_strings(); + EVP_cleanup(); +#endif +#ifdef USE_WINSOCK + WSACleanup(); +#endif + + return result; +} diff --git a/libs/ldns/drill/drill.h.in b/libs/ldns/drill/drill.h.in new file mode 100644 index 0000000000..b787b923c2 --- /dev/null +++ b/libs/ldns/drill/drill.h.in @@ -0,0 +1,109 @@ +/* + * drill.h + * the main header file of drill + * (c) 2005, 2006 NLnet Labs + * + * See the file LICENSE for the license + * + */ +#ifndef _DRILL_H_ +#define _DRILL_H_ +#include "config.h" + +#include "drill_util.h" + +#define DRILL_VERSION "@PACKAGE_VERSION@" + +/* what kind of stuff do we allow */ +#define DRILL_QUERY 0 +#define DRILL_TRACE 1 +#define DRILL_CHASE 2 +#define DRILL_AFROMFILE 3 +#define DRILL_QTOFILE 4 +#define DRILL_NSEC 5 +#define DRILL_REVERSE 6 +#define DRILL_SECTRACE 7 + +#define DRILL_ON(VAR, BIT) \ +(VAR) = (VAR) | (BIT) +#define DRILL_OFF(VAR, BIT) \ +(VAR) = (VAR) & ~(BIT) + +extern ldns_rr_list *global_dns_root; +extern bool qds; +extern int verbosity; + +ldns_pkt *do_trace(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c); +ldns_status do_chase(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c, + ldns_rr_list *trusted_keys, + ldns_pkt *pkt_o, + uint16_t qflags, + ldns_rr_list *prev_key_list, + int verbosity); +int do_secure_trace(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c, + ldns_rr_list *trusted_keys, + ldns_rdf *start_name); + +ldns_rr_list * get_rr(ldns_resolver *res, + ldns_rdf *zname, + ldns_rr_type t, + ldns_rr_class c); + +void drill_pkt_print(FILE *fd, ldns_resolver *r, ldns_pkt *p); +void drill_pkt_print_footer(FILE *fd, ldns_resolver *r, ldns_pkt *p); + +ldns_pkt_type get_dnssec_rr(ldns_pkt *p, + ldns_rdf *name, + ldns_rr_type t, + ldns_rr_list **rrlist, + ldns_rr_list **sig); + +ldns_rr *ldns_nsec3_exact_match(ldns_rdf *qname, + ldns_rr_type qtype, + ldns_rr_list *nsec3s); + +ldns_rdf *ldns_nsec3_closest_encloser(ldns_rdf *qname, + ldns_rr_type qtype, + ldns_rr_list *nsec3s); + +/* verifies denial of existence of *name in *pkt (must contain NSEC or NSEC3 records + * if *nsec_rrs and *nsec_rr_sigs are given, pointers to the relevant nsecs and their signatures are + * placed there + */ +ldns_status ldns_verify_denial(ldns_pkt *pkt, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_list **nsec_rrs, + ldns_rr_list **nsec_rr_sigs); +ldns_status ldns_verify_denial_wildcard(ldns_pkt *pkt, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_list **nsec_rrs, + ldns_rr_list **nsec_rr_sigs); + +ldns_status read_key_file(const char *filename, ldns_rr_list *key_list); +ldns_pkt *read_hex_pkt(char *filename); +ldns_buffer *read_hex_buffer(char *filename); +void init_root(void); +ldns_rr_list *read_root_hints(const char *filename); +void clear_root(void); +void dump_hex(const ldns_pkt *pkt, const char *file); +void warning(const char *fmt, ...); +void error(const char *fmt, ...); +void mesg(const char *fmt, ...); + +/* screen.c */ +void resolver_print_nameservers(ldns_resolver *r); +void print_dnskey(ldns_rr_list *key_list); +void print_ds(ldns_rr_list *ds_list); + +#endif /* _DRILL_H_ */ diff --git a/libs/ldns/drill/drill_util.c b/libs/ldns/drill/drill_util.c new file mode 100644 index 0000000000..596be9d541 --- /dev/null +++ b/libs/ldns/drill/drill_util.c @@ -0,0 +1,305 @@ +/* + * util.c + * some handy function needed in drill and not implemented + * in ldns + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +#include + +static int +read_line(FILE *input, char *line) +{ + int i; + + char c; + for (i = 0; i < LDNS_MAX_PACKETLEN; i++) { + c = getc(input); + if (c == EOF) { + return -1; + } else if (c != '\n') { + line[i] = c; + } else { + break; + } + } + line[i] = '\0'; + return i; +} + +/* key_list must be initialized with ldns_rr_list_new() */ +ldns_status +read_key_file(const char *filename, ldns_rr_list *key_list) +{ + int line_len = 0; + int line_nr = 0; + int key_count = 0; + char line[LDNS_MAX_PACKETLEN]; + ldns_status status; + FILE *input_file; + ldns_rr *rr; + + input_file = fopen(filename, "r"); + if (!input_file) { + fprintf(stderr, "Error opening %s: %s\n", + filename, strerror(errno)); + return LDNS_STATUS_ERR; + } + while (line_len >= 0) { + line_len = read_line(input_file, line); + line_nr++; + if (line_len > 0 && line[0] != ';') { + status = ldns_rr_new_frm_str(&rr, line, 0, NULL, NULL); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, + "Error parsing DNSKEY RR in line %d: %s\n", + line_nr, + ldns_get_errorstr_by_id(status)); + } else if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_DNSKEY || + ldns_rr_get_type(rr) == LDNS_RR_TYPE_DS) { + ldns_rr_list_push_rr(key_list, rr); + key_count++; + } else { + ldns_rr_free(rr); + } + } + } + printf(";; Number of trusted keys: %d\n", key_count); + if (key_count > 0) { + return LDNS_STATUS_OK; + } else { + /*fprintf(stderr, "No keys read\n");*/ + return LDNS_STATUS_ERR; + } +} + +ldns_rdf * +ldns_rdf_new_addr_frm_str(char *str) +{ + ldns_rdf *a; + + a = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, str); + if (!a) { + /* maybe ip6 */ + a = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, str); + if (!a) { + return NULL; + } + } + return a; +} + +static inline void +local_print_ds(FILE* out, const char* pre, ldns_rr* ds) +{ + if (out && ds) { + fprintf(out, "%s", pre); + ldns_rr_print(out, ds); + ldns_rr_free(ds); + } +} + +/* + * For all keys in a packet print the DS + */ +void +print_ds_of_keys(ldns_pkt *p) +{ + ldns_rr_list *keys; + uint16_t i; + ldns_rr *ds; + + /* TODO fix the section stuff, here or in ldns */ + keys = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_DNSKEY, + LDNS_SECTION_ANSWER); + + /* this also returns the question section rr, which does not + * have any data.... and this inturn crashes everything */ + + if (keys) { + for (i = 0; i < ldns_rr_list_rr_count(keys); i++) { + fprintf(stdout, ";\n; equivalent DS records for key %u:\n", + (unsigned int)ldns_calc_keytag(ldns_rr_list_rr(keys, i))); + + ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA1); + local_print_ds(stdout, "; sha1: ", ds); + ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA256); + local_print_ds(stdout, "; sha256: ", ds); + } + } +} + +static void +print_class_type(FILE *fp, ldns_rr *r) +{ + ldns_lookup_table *lt; + lt = ldns_lookup_by_id(ldns_rr_classes, ldns_rr_get_class(r)); + if (lt) { + fprintf(fp, " %s", lt->name); + } else { + fprintf(fp, " CLASS%d", ldns_rr_get_class(r)); + } + /* okay not THE way - but the quickest */ + switch (ldns_rr_get_type(r)) { + case LDNS_RR_TYPE_RRSIG: + fprintf(fp, " RRSIG "); + break; + case LDNS_RR_TYPE_DNSKEY: + fprintf(fp, " DNSKEY "); + break; + case LDNS_RR_TYPE_DS: + fprintf(fp, " DS "); + break; + default: + break; + } +} + + +void +print_ds_abbr(FILE *fp, ldns_rr *ds) +{ + if (!ds || (ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS)) { + return; + } + + ldns_rdf_print(fp, ldns_rr_owner(ds)); + fprintf(fp, " %d", (int)ldns_rr_ttl(ds)); + print_class_type(fp, ds); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 0)); fprintf(fp, " "); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 1)); fprintf(fp, " "); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 2)); fprintf(fp, " "); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 3)); fprintf(fp, " "); +} + +/* print some of the elements of a signature */ +void +print_rrsig_abbr(FILE *fp, ldns_rr *sig) { + if (!sig || (ldns_rr_get_type(sig) != LDNS_RR_TYPE_RRSIG)) { + return; + } + + ldns_rdf_print(fp, ldns_rr_owner(sig)); + fprintf(fp, " %d", (int)ldns_rr_ttl(sig)); + print_class_type(fp, sig); + + /* print a number of rdf's */ + /* typecovered */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 0)); fprintf(fp, " "); + /* algo */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 1)); fprintf(fp, " "); + /* labels */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 2)); fprintf(fp, " (\n\t\t\t"); + /* expir */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 4)); fprintf(fp, " "); + /* incep */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 5)); fprintf(fp, " "); + /* key-id */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 6)); fprintf(fp, " "); + /* key owner */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 7)); fprintf(fp, ")"); +} + +void +print_dnskey_abbr(FILE *fp, ldns_rr *key) +{ + if (!key || (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY)) { + return; + } + + ldns_rdf_print(fp, ldns_rr_owner(key)); + fprintf(fp, " %d", (int)ldns_rr_ttl(key)); + print_class_type(fp, key); + + /* print a number of rdf's */ + /* flags */ + ldns_rdf_print(fp, ldns_rr_rdf(key, 0)); fprintf(fp, " "); + /* proto */ + ldns_rdf_print(fp, ldns_rr_rdf(key, 1)); fprintf(fp, " "); + /* algo */ + ldns_rdf_print(fp, ldns_rr_rdf(key, 2)); + + if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 256) { + fprintf(fp, " ;{id = %u (zsk), size = %db}", (unsigned int)ldns_calc_keytag(key), + (int)ldns_rr_dnskey_key_size(key)); + return; + } + if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 257) { + fprintf(fp, " ;{id = %u (ksk), size = %db}", (unsigned int)ldns_calc_keytag(key), + (int)ldns_rr_dnskey_key_size(key)); + return; + } + fprintf(fp, " ;{id = %u, size = %db}", (unsigned int)ldns_calc_keytag(key), + (int)ldns_rr_dnskey_key_size(key)); +} + +void +print_rr_list_abbr(FILE *fp, ldns_rr_list *rrlist, char *usr) +{ + size_t i; + ldns_rr_type tp; + + for(i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { + tp = ldns_rr_get_type(ldns_rr_list_rr(rrlist, i)); + if (i == 0 && tp != LDNS_RR_TYPE_RRSIG) { + if (usr) { + fprintf(fp, "%s ", usr); + } + } + switch(tp) { + case LDNS_RR_TYPE_DNSKEY: + print_dnskey_abbr(fp, ldns_rr_list_rr(rrlist, i)); + break; + case LDNS_RR_TYPE_RRSIG: + print_rrsig_abbr(fp, ldns_rr_list_rr(rrlist, i)); + break; + case LDNS_RR_TYPE_DS: + print_ds_abbr(fp, ldns_rr_list_rr(rrlist, i)); + break; + default: + /* not handled */ + break; + } + fputs("\n", fp); + } +} + +void * +xmalloc(size_t s) +{ + void *p; + + p = malloc(s); + if (!p) { + printf("Mem failure\n"); + exit(EXIT_FAILURE); + } + return p; +} + +void * +xrealloc(void *p, size_t size) +{ + void *q; + + q = realloc(p, size); + if (!q) { + printf("Mem failure\n"); + exit(EXIT_FAILURE); + } + return q; +} + +void +xfree(void *p) +{ + if (p) { + free(p); + } +} diff --git a/libs/ldns/drill/drill_util.h b/libs/ldns/drill/drill_util.h new file mode 100644 index 0000000000..db3a57436a --- /dev/null +++ b/libs/ldns/drill/drill_util.h @@ -0,0 +1,58 @@ +/* + * util.h + * util.c header file + * in ldns + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#ifndef _DRILL_UTIL_H_ +#define _DRILL_UTIL_H_ +#include + +/** + * return a address rdf, either A or AAAA + * NULL if anything goes wrong + */ +ldns_rdf * ldns_rdf_new_addr_frm_str(char *); + +/** + * print all the ds of the keys in the packet + */ +void print_ds_of_keys(ldns_pkt *p); + +/** + * print some rdfs of a signature + */ +void print_rrsig_abbr(FILE *fp, ldns_rr *sig); +/** + * print some rdfs of a dnskey + */ +void print_dnskey_abbr(FILE *fp, ldns_rr *key); +/** + * print some rdfs of a ds + */ +void print_ds_abbr(FILE *fp, ldns_rr *ds); + +/** + * print some rdfs of a rr in a rr_list + */ +void print_rr_list_abbr(FILE *fp, ldns_rr_list *sig, char *usr); + +/** + * Alloc some memory, with error checking + */ +void *xmalloc(size_t s); + +/** + * Realloc some memory, with error checking + */ +void *xrealloc(void *p, size_t s); + +/** + * Free the data + */ +void xfree(void *q); +#endif /* _DRILL_UTIL_H_ */ diff --git a/libs/ldns/drill/error.c b/libs/ldns/drill/error.c new file mode 100644 index 0000000000..e67b7fca02 --- /dev/null +++ b/libs/ldns/drill/error.c @@ -0,0 +1,115 @@ +/** + * error.c + * + * error reporting routines + * basicly wrappers around printf + * + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +static void +warning_va_list(const char *fmt, va_list args) +{ + fprintf(stderr, "Warning: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); +} + +void +warning(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + warning_va_list(fmt, args); + va_end(args); +} + +static void +error_va_list(const char *fmt, va_list args) +{ + fprintf(stderr, "Error: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); +} + +void +error(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + error_va_list(fmt, args); + va_end(args); + exit(EXIT_FAILURE); +} + +static void +verbose_va_list(const char *fmt, va_list args) +{ + vfprintf(stdout, fmt, args); + fprintf(stdout, "\n"); +} + +/* print stuff */ +void +mesg(const char *fmt, ...) +{ + va_list args; + if (verbosity == -1) { + return; + } + fprintf(stdout, ";; "); + va_start(args, fmt); + verbose_va_list(fmt, args); + va_end(args); +} + +/* print stuff when in verbose mode (1) */ +void +verbose(const char *fmt, ...) +{ + va_list args; + if (verbosity < 1) { + return; + } + + va_start(args, fmt); + verbose_va_list(fmt, args); + va_end(args); +} + +/* print stuff when in vverbose mode (2) */ +void +vverbose(const char *fmt, ...) +{ + va_list args; + if (verbosity < 2) { + return; + } + + va_start(args, fmt); + verbose_va_list(fmt, args); + va_end(args); +} + +static void +debug_va_list(const char *fmt, va_list args) +{ + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); +} + +void +debug(const char *fmt, ...) +{ + va_list args; + fprintf(stderr, "[DEBUG] "); + va_start(args, fmt); + debug_va_list(fmt, args); + va_end(args); +} diff --git a/libs/ldns/drill/install-sh b/libs/ldns/drill/install-sh new file mode 100755 index 0000000000..6781b987bd --- /dev/null +++ b/libs/ldns/drill/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# 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. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # 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 $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/libs/ldns/drill/root.c b/libs/ldns/drill/root.c new file mode 100644 index 0000000000..a829935cd5 --- /dev/null +++ b/libs/ldns/drill/root.c @@ -0,0 +1,122 @@ +/* + * root.c + * Function to handle to the rootservers + * and to update and prime them + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include +#include + +/* a global list of the root-servers */ +ldns_rr_list *global_dns_root = NULL; + +/* put a hardcoded list in the root and + * init the root rrlist structure */ +void +init_root(void) +{ + ldns_rr *r; + + global_dns_root = ldns_rr_list_new(); + + (void)ldns_rr_new_frm_str(&r, "A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2F::F", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803F:235", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 ", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7FD::1", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:3::42 ", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "M.ROOT-SERVERS.NET. 3600000 AAAA 2001:DC3::35", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); +} + +/* + * Read a hints file as root + * + * The file with the given path should contain a list of NS RRs + * for the root zone and A records for those NS RRs. + * Read them, check them, and append the a records to the rr list given. + */ +ldns_rr_list * +read_root_hints(const char *filename) +{ + FILE *fp = NULL; + int line_nr = 0; + ldns_zone *z; + ldns_status status; + ldns_rr_list *addresses = NULL; + ldns_rr *rr; + size_t i; + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s for reading: %s\n", filename, strerror(errno)); + return NULL; + } + + status = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, 0, &line_nr); + fclose(fp); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error reading root hints file: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } else { + addresses = ldns_rr_list_new(); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { + rr = ldns_rr_list_rr(ldns_zone_rrs(z), i); + /*if ((address_family == 0 || address_family == 1) && + */ + if ( ldns_rr_get_type(rr) == LDNS_RR_TYPE_A ) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + /*if ((address_family == 0 || address_family == 2) &&*/ + if ( ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + } + ldns_zone_deep_free(z); + return addresses; + } +} + + +void +clear_root(void) +{ + ldns_rr_list_deep_free(global_dns_root); +} diff --git a/libs/ldns/drill/securetrace.c b/libs/ldns/drill/securetrace.c new file mode 100644 index 0000000000..ecc21fdf49 --- /dev/null +++ b/libs/ldns/drill/securetrace.c @@ -0,0 +1,761 @@ +/* + * securechasetrace.c + * Where all the hard work concerning secure tracing is done + * + * (c) 2005, 2006 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +#define SELF "[S]" /* self sig ok */ +#define TRUST "[T]" /* chain from parent */ +#define BOGUS "[B]" /* bogus */ +#define UNSIGNED "[U]" /* no relevant dnssec data found */ + +#if 0 +/* See if there is a key/ds in trusted that matches + * a ds in *ds. + */ +static ldns_rr_list * +ds_key_match(ldns_rr_list *ds, ldns_rr_list *trusted) +{ + size_t i, j; + bool match; + ldns_rr *rr_i, *rr_j; + ldns_rr_list *keys; + + if (!trusted || !ds) { + return NULL; + } + + match = false; + keys = ldns_rr_list_new(); + if (!keys) { + return NULL; + } + + if (!ds || !trusted) { + return NULL; + } + + for (i = 0; i < ldns_rr_list_rr_count(trusted); i++) { + rr_i = ldns_rr_list_rr(trusted, i); + for (j = 0; j < ldns_rr_list_rr_count(ds); j++) { + + rr_j = ldns_rr_list_rr(ds, j); + if (ldns_rr_compare_ds(rr_i, rr_j)) { + match = true; + /* only allow unique RRs to match */ + ldns_rr_set_push_rr(keys, rr_i); + } + } + } + if (match) { + return keys; + } else { + return NULL; + } +} +#endif + +ldns_pkt * +get_dnssec_pkt(ldns_resolver *r, ldns_rdf *name, ldns_rr_type t) +{ + ldns_pkt *p = NULL; + p = ldns_resolver_query(r, name, t, LDNS_RR_CLASS_IN, 0); + if (!p) { + return NULL; + } else { + if (verbosity >= 5) { + ldns_pkt_print(stdout, p); + } + return p; + } +} + +#ifdef HAVE_SSL +/* + * retrieve keys for this zone + */ +static ldns_pkt_type +get_key(ldns_pkt *p, ldns_rdf *apexname, ldns_rr_list **rrlist, ldns_rr_list **opt_sig) +{ + return get_dnssec_rr(p, apexname, LDNS_RR_TYPE_DNSKEY, rrlist, opt_sig); +} + +/* + * check to see if we can find a DS rrset here which we can then follow + */ +static ldns_pkt_type +get_ds(ldns_pkt *p, ldns_rdf *ownername, ldns_rr_list **rrlist, ldns_rr_list **opt_sig) +{ + return get_dnssec_rr(p, ownername, LDNS_RR_TYPE_DS, rrlist, opt_sig); +} +#endif /* HAVE_SSL */ + +void +remove_resolver_nameservers(ldns_resolver *res) +{ + ldns_rdf *pop; + + /* remove the old nameserver from the resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { + ldns_rdf_deep_free(pop); + } + +} + +void +show_current_nameservers(FILE *out, ldns_resolver *res) +{ + size_t i; + fprintf(out, "Current nameservers for resolver object:\n"); + for (i = 0; i < ldns_resolver_nameserver_count(res); i++) { + ldns_rdf_print(out, ldns_resolver_nameservers(res)[i]); + fprintf(out, "\n"); + } +} + +/*ldns_pkt **/ +#ifdef HAVE_SSL +int +do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c, ldns_rr_list *trusted_keys, ldns_rdf *start_name + ) +{ + ldns_resolver *res; + ldns_pkt *p, *local_p; + ldns_rr_list *new_nss_a; + ldns_rr_list *new_nss_aaaa; + ldns_rr_list *new_nss; + ldns_rr_list *ns_addr; + uint16_t loop_count; + ldns_rdf *pop; + ldns_rdf **labels = NULL; + ldns_status status, st; + ssize_t i; + size_t j; + size_t k; + size_t l; + uint8_t labels_count; + ldns_pkt_type pt; + + /* dnssec */ + ldns_rr_list *key_list; + ldns_rr_list *key_sig_list; + ldns_rr_list *ds_list; + ldns_rr_list *ds_sig_list; + ldns_rr_list *correct_key_list; + ldns_rr_list *trusted_ds_rrs; + bool new_keys_trusted = false; + ldns_rr_list *current_correct_keys; + ldns_rr_list *dataset; + + ldns_rr_list *nsec_rrs = NULL; + ldns_rr_list *nsec_rr_sigs = NULL; + + /* empty non-terminal check */ + bool ent; + + /* glue handling */ + ldns_rr_list *new_ns_addr; + ldns_rr_list *old_ns_addr; + ldns_rr *ns_rr; + + int result = 0; + + /* printing niceness */ + const ldns_rr_descriptor *descriptor; + + descriptor = ldns_rr_descript(t); + + loop_count = 0; + new_nss_a = NULL; + new_nss_aaaa = NULL; + new_nss = NULL; + ns_addr = NULL; + key_list = NULL; + ds_list = NULL; + pt = LDNS_PACKET_UNKNOWN; + + p = NULL; + local_p = NULL; + res = ldns_resolver_new(); + key_sig_list = NULL; + ds_sig_list = NULL; + + if (!res) { + error("Memory allocation failed"); + result = -1; + return result; + } + + correct_key_list = ldns_rr_list_new(); + if (!correct_key_list) { + error("Memory allocation failed"); + result = -1; + return result; + } + + trusted_ds_rrs = ldns_rr_list_new(); + if (!trusted_ds_rrs) { + error("Memory allocation failed"); + result = -1; + return result; + } + /* Add all preset trusted DS signatures to the list of trusted DS RRs. */ + for (j = 0; j < ldns_rr_list_rr_count(trusted_keys); j++) { + ldns_rr* one_rr = ldns_rr_list_rr(trusted_keys, j); + if (ldns_rr_get_type(one_rr) == LDNS_RR_TYPE_DS) { + ldns_rr_list_push_rr(trusted_ds_rrs, ldns_rr_clone(one_rr)); + } + } + + /* transfer some properties of local_res to res */ + ldns_resolver_set_ip6(res, + ldns_resolver_ip6(local_res)); + ldns_resolver_set_port(res, + ldns_resolver_port(local_res)); + ldns_resolver_set_debug(res, + ldns_resolver_debug(local_res)); + ldns_resolver_set_fail(res, + ldns_resolver_fail(local_res)); + ldns_resolver_set_usevc(res, + ldns_resolver_usevc(local_res)); + ldns_resolver_set_random(res, + ldns_resolver_random(local_res)); + ldns_resolver_set_recursive(local_res, true); + + ldns_resolver_set_recursive(res, false); + ldns_resolver_set_dnssec_cd(res, false); + ldns_resolver_set_dnssec(res, true); + + /* setup the root nameserver in the new resolver */ + status = ldns_resolver_push_nameserver_rr_list(res, global_dns_root); + if (status != LDNS_STATUS_OK) { + printf("ERRRRR: %s\n", ldns_get_errorstr_by_id(status)); + ldns_rr_list_print(stdout, global_dns_root); + return status; + } + labels_count = ldns_dname_label_count(name); + if (start_name) { + if (ldns_dname_is_subdomain(name, start_name)) { + labels_count -= ldns_dname_label_count(start_name); + } else { + fprintf(stderr, "Error; "); + ldns_rdf_print(stderr, name); + fprintf(stderr, " is not a subdomain of "); + ldns_rdf_print(stderr, start_name); + fprintf(stderr, "\n"); + goto done; + } + } + labels = LDNS_XMALLOC(ldns_rdf*, labels_count + 2); + if (!labels) { + goto done; + } + labels[0] = ldns_dname_new_frm_str(LDNS_ROOT_LABEL_STR); + labels[1] = ldns_rdf_clone(name); + for(i = 2 ; i < (ssize_t)labels_count + 2; i++) { + labels[i] = ldns_dname_left_chop(labels[i - 1]); + } + /* if no servers is given with @, start by asking local resolver */ + /* first part todo :) */ + for (i = 0; i < (ssize_t) ldns_resolver_nameserver_count(local_res); i++) { + (void) ldns_resolver_push_nameserver(res, ldns_resolver_nameservers(local_res)[i]); + } + + /* get the nameserver for the label + * ask: dnskey and ds for the label + */ + for(i = (ssize_t)labels_count + 1; i > 0; i--) { + status = ldns_resolver_send(&local_p, res, labels[i], LDNS_RR_TYPE_NS, c, 0); + + if (verbosity >= 5) { + ldns_pkt_print(stdout, local_p); + } + + new_nss = ldns_pkt_rr_list_by_type(local_p, + LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); + if (!new_nss) { + /* if it's a delegation, servers put them in the auth section */ + new_nss = ldns_pkt_rr_list_by_type(local_p, + LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); + } + + /* if this is the final step there might not be nameserver records + of course if the data is in the apex, there are, so cover both + cases */ + if (new_nss || i > 1) { + for(j = 0; j < ldns_rr_list_rr_count(new_nss); j++) { + ns_rr = ldns_rr_list_rr(new_nss, j); + pop = ldns_rr_rdf(ns_rr, 0); + if (!pop) { + printf("nopo\n"); + break; + } + /* retrieve it's addresses */ + /* trust glue? */ + new_ns_addr = NULL; + if (ldns_dname_is_subdomain(pop, labels[i])) { + new_ns_addr = ldns_pkt_rr_list_by_name_and_type(local_p, pop, LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); + } + if (!new_ns_addr || ldns_rr_list_rr_count(new_ns_addr) == 0) { + new_ns_addr = ldns_get_rr_list_addr_by_name(res, pop, c, 0); + } + if (!new_ns_addr || ldns_rr_list_rr_count(new_ns_addr) == 0) { + new_ns_addr = ldns_get_rr_list_addr_by_name(local_res, pop, c, 0); + } + + if (new_ns_addr) { + old_ns_addr = ns_addr; + ns_addr = ldns_rr_list_cat_clone(ns_addr, new_ns_addr); + ldns_rr_list_deep_free(old_ns_addr); + } + ldns_rr_list_deep_free(new_ns_addr); + } + ldns_rr_list_deep_free(new_nss); + + if (ns_addr) { + remove_resolver_nameservers(res); + + if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != + LDNS_STATUS_OK) { + error("Error adding new nameservers"); + ldns_pkt_free(local_p); + goto done; + } + ldns_rr_list_deep_free(ns_addr); + } else { + status = ldns_verify_denial(local_p, labels[i], LDNS_RR_TYPE_NS, &nsec_rrs, &nsec_rr_sigs); + + /* verify the nsec3 themselves*/ + if (verbosity >= 4) { + printf("NSEC(3) Records to verify:\n"); + ldns_rr_list_print(stdout, nsec_rrs); + printf("With signatures:\n"); + ldns_rr_list_print(stdout, nsec_rr_sigs); + printf("correct keys:\n"); + ldns_rr_list_print(stdout, correct_key_list); + } + + if (status == LDNS_STATUS_OK) { + if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i]); + /* + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + */ fprintf(stdout, " NS\n"); + } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i]); + /* + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + */ + fprintf(stdout, " NS\n"); + } else { + fprintf(stdout, "%s ", BOGUS); + result = 1; + printf(";; Error verifying denial of existence for name "); + ldns_rdf_print(stdout, labels[i]); + /* + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + */ printf("NS: %s\n", ldns_get_errorstr_by_id(st)); + } + } else { + fprintf(stdout, "%s ", BOGUS); + result = 1; + printf(";; Error verifying denial of existence for name "); + ldns_rdf_print(stdout, labels[i]); + printf("NS: %s\n", ldns_get_errorstr_by_id(status)); + } + + /* there might be an empty non-terminal, in which case we need to continue */ + ent = false; + for (j = 0; j < ldns_rr_list_rr_count(nsec_rrs); j++) { + if (ldns_dname_is_subdomain(ldns_rr_rdf(ldns_rr_list_rr(nsec_rrs, j), 0), labels[i])) { + ent = true; + } + } + if (!ent) { + ldns_rr_list_deep_free(nsec_rrs); + ldns_rr_list_deep_free(nsec_rr_sigs); + ldns_pkt_free(local_p); + goto done; + } else { + printf(";; There is an empty non-terminal here, continue\n"); + continue; + } + goto done; + } + + if (ldns_resolver_nameserver_count(res) == 0) { + error("No nameservers found for this node"); + goto done; + } + } + ldns_pkt_free(local_p); + + fprintf(stdout, ";; Domain: "); + ldns_rdf_print(stdout, labels[i]); + fprintf(stdout, "\n"); + + /* retrieve keys for current domain, and verify them + if they match an already trusted DS, or if one of the + keys used to sign these is trusted, add the keys to + the trusted list */ + p = get_dnssec_pkt(res, labels[i], LDNS_RR_TYPE_DNSKEY); + pt = get_key(p, labels[i], &key_list, &key_sig_list); + if (key_sig_list) { + if (key_list) { + current_correct_keys = ldns_rr_list_new(); + if ((st = ldns_verify(key_list, key_sig_list, key_list, current_correct_keys)) == + LDNS_STATUS_OK) { + /* add all signed keys (don't just add current_correct, you'd miss + * the zsk's then */ + for (j = 0; j < ldns_rr_list_rr_count(key_list); j++) { + ldns_rr_list_push_rr(correct_key_list, ldns_rr_clone(ldns_rr_list_rr(key_list, j))); + } + + /* check whether these keys were signed + * by a trusted keys. if so, these + * keys are also trusted */ + new_keys_trusted = false; + for (k = 0; k < ldns_rr_list_rr_count(current_correct_keys); k++) { + for (j = 0; j < ldns_rr_list_rr_count(trusted_ds_rrs); j++) { + if (ldns_rr_compare_ds(ldns_rr_list_rr(current_correct_keys, k), + ldns_rr_list_rr(trusted_ds_rrs, j))) { + new_keys_trusted = true; + } + } + } + + /* also all keys are trusted if one of the current correct keys is trusted */ + for (k = 0; k < ldns_rr_list_rr_count(current_correct_keys); k++) { + for (j = 0; j < ldns_rr_list_rr_count(trusted_keys); j++) { + if (ldns_rr_compare(ldns_rr_list_rr(current_correct_keys, k), + ldns_rr_list_rr(trusted_keys, j)) == 0) { + new_keys_trusted = true; + } + } + } + + + if (new_keys_trusted) { + ldns_rr_list_push_rr_list(trusted_keys, key_list); + print_rr_list_abbr(stdout, key_list, TRUST); + ldns_rr_list_free(key_list); + key_list = NULL; + } else { + if (verbosity >= 2) { + printf(";; Signature ok but no chain to a trusted key or ds record\n"); + } + print_rr_list_abbr(stdout, key_list, SELF); + ldns_rr_list_deep_free(key_list); + key_list = NULL; + } + } else { + print_rr_list_abbr(stdout, key_list, BOGUS); + result = 2; + ldns_rr_list_deep_free(key_list); + key_list = NULL; + } + ldns_rr_list_free(current_correct_keys); + current_correct_keys = NULL; + } else { + printf(";; No DNSKEY record found for "); + ldns_rdf_print(stdout, labels[i]); + printf("\n"); + } + } + + ldns_pkt_free(p); + ldns_rr_list_deep_free(key_sig_list); + key_sig_list = NULL; + + /* check the DS records for the next child domain */ + if (i > 1) { + p = get_dnssec_pkt(res, labels[i-1], LDNS_RR_TYPE_DS); + pt = get_ds(p, labels[i-1], &ds_list, &ds_sig_list); + if (!ds_list) { + ldns_pkt_free(p); + if (ds_sig_list) { + ldns_rr_list_deep_free(ds_sig_list); + } + p = get_dnssec_pkt(res, name, LDNS_RR_TYPE_DNSKEY); + pt = get_ds(p, NULL, &ds_list, &ds_sig_list); + } + if (ds_sig_list) { + if (ds_list) { + if (verbosity >= 4) { + printf("VERIFYING:\n"); + printf("DS LIST:\n"); + ldns_rr_list_print(stdout, ds_list); + printf("SIGS:\n"); + ldns_rr_list_print(stdout, ds_sig_list); + printf("KEYS:\n"); + ldns_rr_list_print(stdout, correct_key_list); + } + + current_correct_keys = ldns_rr_list_new(); + + if ((st = ldns_verify(ds_list, ds_sig_list, correct_key_list, current_correct_keys)) == + LDNS_STATUS_OK) { + /* if the ds is signed by a trusted key and a key from correct keys + matches that ds, add that key to the trusted keys */ + new_keys_trusted = false; + if (verbosity >= 2) { + printf("Checking if signing key is trusted:\n"); + } + for (j = 0; j < ldns_rr_list_rr_count(current_correct_keys); j++) { + if (verbosity >= 2) { + printf("New key: "); + ldns_rr_print(stdout, ldns_rr_list_rr(current_correct_keys, j)); + } + for (k = 0; k < ldns_rr_list_rr_count(trusted_keys); k++) { + if (verbosity >= 2) { + printf("\tTrusted key: "); + ldns_rr_print(stdout, ldns_rr_list_rr(trusted_keys, k)); + } + if (ldns_rr_compare(ldns_rr_list_rr(current_correct_keys, j), + ldns_rr_list_rr(trusted_keys, k)) == 0) { + if (verbosity >= 2) { + printf("Key is now trusted!\n"); + } + for (l = 0; l < ldns_rr_list_rr_count(ds_list); l++) { + ldns_rr_list_push_rr(trusted_ds_rrs, ldns_rr_clone(ldns_rr_list_rr(ds_list, l))); + new_keys_trusted = true; + } + } + } + } + if (new_keys_trusted) { + print_rr_list_abbr(stdout, ds_list, TRUST); + } else { + print_rr_list_abbr(stdout, ds_list, SELF); + } + } else { + result = 3; + print_rr_list_abbr(stdout, ds_list, BOGUS); + } + + ldns_rr_list_free(current_correct_keys); + current_correct_keys = NULL; + } else { + /* wait apparently there were no keys either, go back to the ds packet */ + ldns_pkt_free(p); + ldns_rr_list_deep_free(ds_sig_list); + p = get_dnssec_pkt(res, labels[i-1], LDNS_RR_TYPE_DS); + pt = get_ds(p, labels[i-1], &ds_list, &ds_sig_list); + + status = ldns_verify_denial(p, labels[i-1], LDNS_RR_TYPE_DS, &nsec_rrs, &nsec_rr_sigs); + + if (verbosity >= 4) { + printf("NSEC(3) Records to verify:\n"); + ldns_rr_list_print(stdout, nsec_rrs); + printf("With signatures:\n"); + ldns_rr_list_print(stdout, nsec_rr_sigs); + printf("correct keys:\n"); + ldns_rr_list_print(stdout, correct_key_list); + } + + if (status == LDNS_STATUS_OK) { + if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i-1]); + printf(" DS"); + fprintf(stdout, "\n"); + } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i-1]); + printf(" DS"); + fprintf(stdout, "\n"); + } else { + result = 4; + fprintf(stdout, "%s ", BOGUS); + printf("Error verifying denial of existence for "); + ldns_rdf_print(stdout, labels[i-1]); + printf(" DS"); + printf(": %s\n", ldns_get_errorstr_by_id(st)); + } + + + } else { + if (status == LDNS_STATUS_CRYPTO_NO_RRSIG) { + printf(";; No DS for "); + ldns_rdf_print(stdout, labels[i - 1]); + } else { + printf("[B] Unable to verify denial of existence for "); + ldns_rdf_print(stdout, labels[i - 1]); + printf(" DS: %s\n", ldns_get_errorstr_by_id(status)); + } + } + if (verbosity >= 2) { + printf(";; No ds record for delegation\n"); + } + } + } + ldns_rr_list_deep_free(ds_list); + ldns_pkt_free(p); + } else { + /* if this is the last label, just verify the data and stop */ + p = get_dnssec_pkt(res, labels[i], t); + pt = get_dnssec_rr(p, labels[i], t, &dataset, &key_sig_list); + if (dataset && ldns_rr_list_rr_count(dataset) > 0) { + if (key_sig_list && ldns_rr_list_rr_count(key_sig_list) > 0) { + + /* If this is a wildcard, you must be able to deny exact match */ + if ((st = ldns_verify(dataset, key_sig_list, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + ldns_rr_list_print(stdout, dataset); + } else if ((st = ldns_verify(dataset, key_sig_list, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + ldns_rr_list_print(stdout, dataset); + } else { + result = 5; + fprintf(stdout, "%s ", BOGUS); + ldns_rr_list_print(stdout, dataset); + printf(";; Error: %s\n", ldns_get_errorstr_by_id(st)); + } + } else { + fprintf(stdout, "%s ", UNSIGNED); + ldns_rr_list_print(stdout, dataset); + } + ldns_rr_list_deep_free(dataset); + } else { + status = ldns_verify_denial(p, name, t, &nsec_rrs, &nsec_rr_sigs); + if (status == LDNS_STATUS_OK) { + /* verify the nsec3 themselves*/ + if (verbosity >= 5) { + printf("NSEC(3) Records to verify:\n"); + ldns_rr_list_print(stdout, nsec_rrs); + printf("With signatures:\n"); + ldns_rr_list_print(stdout, nsec_rr_sigs); + printf("correct keys:\n"); + ldns_rr_list_print(stdout, correct_key_list); +/* + printf("trusted keys at %p:\n", trusted_keys); + ldns_rr_list_print(stdout, trusted_keys); +*/ } + + if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, name); + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + fprintf(stdout, "\n"); + } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, name); + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + fprintf(stdout, "\n"); + } else { + result = 6; + fprintf(stdout, "%s ", BOGUS); + printf("Error verifying denial of existence for "); + ldns_rdf_print(stdout, name); + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + printf(": %s\n", ldns_get_errorstr_by_id(st)); + } + + ldns_rr_list_deep_free(nsec_rrs); + ldns_rr_list_deep_free(nsec_rr_sigs); + } else { +/* +*/ + if (status == LDNS_STATUS_CRYPTO_NO_RRSIG) { + printf("%s ", UNSIGNED); + printf("No data found for: "); + ldns_rdf_print(stdout, name); + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + printf("\n"); + } else { + printf("[B] Unable to verify denial of existence for "); + ldns_rdf_print(stdout, name); + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + printf("\n"); + } + + } + } + ldns_pkt_free(p); + } + + new_nss_aaaa = NULL; + new_nss_a = NULL; + new_nss = NULL; + ns_addr = NULL; + ldns_rr_list_deep_free(key_list); + key_list = NULL; + ldns_rr_list_deep_free(key_sig_list); + key_sig_list = NULL; + ds_list = NULL; + ldns_rr_list_deep_free(ds_sig_list); + ds_sig_list = NULL; + } + printf(";;" SELF " self sig OK; " BOGUS " bogus; " TRUST " trusted\n"); + /* verbose mode? + printf("Trusted keys:\n"); + ldns_rr_list_print(stdout, trusted_keys); + printf("trusted dss:\n"); + ldns_rr_list_print(stdout, trusted_ds_rrs); + */ + + done: + ldns_rr_list_deep_free(trusted_ds_rrs); + ldns_rr_list_deep_free(correct_key_list); + ldns_resolver_deep_free(res); + if (labels) { + for(i = 0 ; i < (ssize_t)labels_count + 2; i++) { + ldns_rdf_deep_free(labels[i]); + } + LDNS_FREE(labels); + } + return result; +} +#endif /* HAVE_SSL */ diff --git a/libs/ldns/drill/work.c b/libs/ldns/drill/work.c new file mode 100644 index 0000000000..3a9cb5855d --- /dev/null +++ b/libs/ldns/drill/work.c @@ -0,0 +1,276 @@ +/* + * work.c + * Where all the hard work is done + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +/** + * Converts a hex string to binary data + * len is the length of the string + * buf is the buffer to store the result in + * offset is the starting position in the result buffer + * + * This function returns the length of the result + */ +size_t +hexstr2bin(char *hexstr, int len, uint8_t *buf, size_t offset, size_t buf_len) +{ + char c; + int i; + uint8_t int8 = 0; + int sec = 0; + size_t bufpos = 0; + + if (len % 2 != 0) { + return 0; + } + + for (i=0; i= '0' && c <= '9') { + int8 += c & 0x0f; + } else if (c >= 'a' && c <= 'z') { + int8 += (c & 0x0f) + 9; + } else if (c >= 'A' && c <= 'Z') { + int8 += (c & 0x0f) + 9; + } else { + return 0; + } + + if (sec == 0) { + int8 = int8 << 4; + sec = 1; + } else { + if (bufpos + offset + 1 <= buf_len) { + buf[bufpos+offset] = int8; + int8 = 0; + sec = 0; + bufpos++; + } else { + error("Buffer too small in hexstr2bin"); + } + } + } + } + return bufpos; +} + +size_t +packetbuffromfile(char *filename, uint8_t *wire) +{ + FILE *fp = NULL; + int c; + + /* stat hack + * 0 = normal + * 1 = comment (skip to end of line) + * 2 = unprintable character found, read binary data directly + */ + int state = 0; + uint8_t *hexbuf = xmalloc(LDNS_MAX_PACKETLEN); + int hexbufpos = 0; + size_t wirelen; + + if (strncmp(filename, "-", 2) == 0) { + fp = stdin; + } else { + fp = fopen(filename, "r"); + } + if (fp == NULL) { + perror("Unable to open file for reading"); + xfree(hexbuf); + return 0; + } + + /*verbose("Opened %s\n", filename);*/ + + c = fgetc(fp); + while (c != EOF && hexbufpos < LDNS_MAX_PACKETLEN) { + if (state < 2 && !isascii(c)) { + /*verbose("non ascii character found in file: (%d) switching to raw mode\n", c);*/ + state = 2; + } + switch (state) { + case 0: + if ( (c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F') ) + { + hexbuf[hexbufpos] = (uint8_t) c; + hexbufpos++; + } else if (c == ';') { + state = 1; + } else if (c == ' ' || c == '\t' || c == '\n') { + /* skip whitespace */ + } + break; + case 1: + if (c == '\n' || c == EOF) { + state = 0; + } + break; + case 2: + hexbuf[hexbufpos] = (uint8_t) c; + hexbufpos++; + break; + default: + warning("unknown state while reading %s", filename); + xfree(hexbuf); + return 0; + break; + } + c = fgetc(fp); + } + + if (c == EOF) { + /* + if (have_drill_opt && drill_opt->verbose) { + verbose("END OF FILE REACHED\n"); + if (state < 2) { + verbose("read:\n"); + verbose("%s\n", hexbuf); + } else { + verbose("Not printing wire because it contains non ascii data\n"); + } + } + */ + } + if (hexbufpos >= LDNS_MAX_PACKETLEN) { + /*verbose("packet size reached\n");*/ + } + + /* lenient mode: length must be multiple of 2 */ + if (hexbufpos % 2 != 0) { + hexbuf[hexbufpos] = (uint8_t) '0'; + hexbufpos++; + } + + if (state < 2) { + wirelen = hexstr2bin((char *) hexbuf, + hexbufpos, + wire, + 0, + LDNS_MAX_PACKETLEN); + } else { + memcpy(wire, hexbuf, (size_t) hexbufpos); + wirelen = (size_t) hexbufpos; + } + if (fp != stdin) { + fclose(fp); + } + xfree(hexbuf); + return wirelen; +} + +ldns_buffer * +read_hex_buffer(char *filename) +{ + uint8_t *wire; + size_t wiresize; + ldns_buffer *result_buffer = NULL; + + FILE *fp = NULL; + + if (strncmp(filename, "-", 2) != 0) { + fp = fopen(filename, "r"); + } else { + fp = stdin; + } + + if (fp == NULL) { + perror(""); + warning("Unable to open %s", filename); + return NULL; + } + + wire = xmalloc(LDNS_MAX_PACKETLEN); + + wiresize = packetbuffromfile(filename, wire); + + result_buffer = LDNS_MALLOC(ldns_buffer); + ldns_buffer_new_frm_data(result_buffer, wire, wiresize); + ldns_buffer_set_position(result_buffer, ldns_buffer_capacity(result_buffer)); + + xfree(wire); + return result_buffer; +} + +ldns_pkt * +read_hex_pkt(char *filename) +{ + uint8_t *wire; + size_t wiresize; + + ldns_pkt *pkt = NULL; + + ldns_status status = LDNS_STATUS_ERR; + + wire = xmalloc(LDNS_MAX_PACKETLEN); + + wiresize = packetbuffromfile(filename, wire); + + if (wiresize > 0) { + status = ldns_wire2pkt(&pkt, wire, wiresize); + } + + xfree(wire); + + if (status == LDNS_STATUS_OK) { + return pkt; + } else { + fprintf(stderr, "Error parsing hex file: %s\n", + ldns_get_errorstr_by_id(status)); + return NULL; + } +} + +void +dump_hex(const ldns_pkt *pkt, const char *filename) +{ + uint8_t *wire; + size_t size, i; + FILE *fp; + ldns_status status; + + fp = fopen(filename, "w"); + + if (fp == NULL) { + error("Unable to open %s for writing", filename); + return; + } + + status = ldns_pkt2wire(&wire, pkt, &size); + + if (status != LDNS_STATUS_OK) { + error("Unable to convert packet: error code %u", status); + return; + } + + fprintf(fp, "; 0"); + for (i = 1; i < 20; i++) { + fprintf(fp, " %2u", (unsigned int) i); + } + fprintf(fp, "\n"); + fprintf(fp, ";--"); + for (i = 1; i < 20; i++) { + fprintf(fp, " --"); + } + fprintf(fp, "\n"); + for (i = 0; i < size; i++) { + if (i % 20 == 0 && i > 0) { + fprintf(fp, "\t;\t%4u-%4u\n", (unsigned int) i-19, (unsigned int) i); + } + fprintf(fp, " %02x", (unsigned int)wire[i]); + } + fprintf(fp, "\n"); + fclose(fp); +} diff --git a/libs/ldns/error.c b/libs/ldns/error.c new file mode 100644 index 0000000000..ff240dcc82 --- /dev/null +++ b/libs/ldns/error.c @@ -0,0 +1,105 @@ +/* + * a error2str function to make sense of all the + * error codes we have laying ardoun + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ + +#include + +#include + +ldns_lookup_table ldns_error_str[] = { + { LDNS_STATUS_OK, "All OK" }, + { LDNS_STATUS_EMPTY_LABEL, "Empty label" }, + { LDNS_STATUS_LABEL_OVERFLOW, "Label length overflow" }, + { LDNS_STATUS_DOMAINNAME_OVERFLOW, "Domainname length overflow" }, + { LDNS_STATUS_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" }, + { LDNS_STATUS_DDD_OVERFLOW, "\\DDD sequence overflow (>255)" }, + { LDNS_STATUS_PACKET_OVERFLOW, "Packet size overflow" }, + { LDNS_STATUS_INVALID_POINTER, "Invalid compression pointer" }, + { LDNS_STATUS_MEM_ERR, "General memory error" }, + { LDNS_STATUS_INTERNAL_ERR, "Internal error, this should not happen" }, + { LDNS_STATUS_SSL_ERR, "Error in SSL library" }, + { LDNS_STATUS_ERR, "General LDNS error" }, + { LDNS_STATUS_INVALID_INT, "Conversion error, integer expected" }, + { LDNS_STATUS_INVALID_IP4, "Conversion error, ip4 addr expected" }, + { LDNS_STATUS_INVALID_IP6, "Conversion error, ip6 addr expected" }, + { LDNS_STATUS_INVALID_STR, "Conversion error, string expected" }, + { LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" }, + { LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" }, + { LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" }, + { LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" }, + { LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" }, + { LDNS_STATUS_FILE_ERR, "Could not open the files" }, + { LDNS_STATUS_UNKNOWN_INET, "Uknown address family" }, + { LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." }, + { LDNS_STATUS_NULL, "Supplied value pointer null" }, + { LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" }, + { LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" }, + { LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" }, + { LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" }, + { LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" }, + { LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" }, + { LDNS_STATUS_CRYPTO_NO_DS, "No DS record(s)" }, + { LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, "Could not validate DS record(s)" }, + { LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, "No keys with the keytag and algorithm from the RRSIG found" }, + { LDNS_STATUS_CRYPTO_VALIDATED, "Valid DNSSEC signature" }, + { LDNS_STATUS_CRYPTO_BOGUS, "Bogus DNSSEC signature" }, + { LDNS_STATUS_CRYPTO_SIG_EXPIRED, "DNSSEC signature has expired" }, + { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, "DNSSEC signature not incepted yet" }, + { LDNS_STATUS_CRYPTO_TSIG_BOGUS, "Bogus TSIG signature" }, + { LDNS_STATUS_CRYPTO_TSIG_ERR, "Could not create TSIG signature" }, + { LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, "DNSSEC signature has expiration date earlier than inception date" }, + { LDNS_STATUS_ENGINE_KEY_NOT_LOADED, "Unable to load private key from engine" }, + { LDNS_STATUS_NSEC3_ERR, "Error in NSEC3 denial of existence proof" }, + { LDNS_STATUS_RES_NO_NS, "No (valid) nameservers defined in the resolver" }, + { LDNS_STATUS_RES_QUERY, "No correct query given to resolver" }, + { LDNS_STATUS_WIRE_INCOMPLETE_HEADER, "header section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, "question section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, "answer section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, "authority section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, "additional section incomplete" }, + { LDNS_STATUS_NO_DATA, "No data" }, + { LDNS_STATUS_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" }, + { LDNS_STATUS_SYNTAX_TYPE_ERR, "Syntax error, could not parse the RR's type" }, + { LDNS_STATUS_SYNTAX_CLASS_ERR, "Syntax error, could not parse the RR's class" }, + { LDNS_STATUS_SYNTAX_TTL_ERR, "Syntax error, could not parse the RR's TTL" }, + { LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, "Syntax error, $INCLUDE not implemented" }, + { LDNS_STATUS_SYNTAX_RDATA_ERR, "Syntax error, could not parse the RR's rdata" }, + { LDNS_STATUS_SYNTAX_DNAME_ERR, "Syntax error, could not parse the RR's dname(s)" }, + { LDNS_STATUS_SYNTAX_VERSION_ERR, "Syntax error, version mismatch" }, + { LDNS_STATUS_SYNTAX_ALG_ERR, "Syntax error, algorithm unknown or non parseable" }, + { LDNS_STATUS_SYNTAX_KEYWORD_ERR, "Syntax error, unknown keyword in input" }, + { LDNS_STATUS_SYNTAX_ERR, "Syntax error, could not parse the RR" }, + { LDNS_STATUS_SYNTAX_EMPTY, "Empty line was returned" }, + { LDNS_STATUS_SYNTAX_TTL, "$TTL directive was seen in the zone" }, + { LDNS_STATUS_SYNTAX_ORIGIN, "$ORIGIN directive was seen in the zone" }, + { LDNS_STATUS_SYNTAX_INCLUDE, "$INCLUDE directive was seen in the zone" }, + { LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, "Iterations count for NSEC3 record higher than maximum" }, + { LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, "Syntax error, value expected" }, + { LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer value too large" }, + { LDNS_STATUS_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" }, + { LDNS_STATUS_SOCKET_ERROR, "Error creating socket" }, + { LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, "Existence denied by NSEC" }, + { LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, "RR not covered by the given NSEC RRs" }, + { LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, "wildcard not covered by the given NSEC RRs" }, + { LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND, "original of NSEC3 hashed name could not be found" }, + { 0, NULL } +}; + +const char * +ldns_get_errorstr_by_id(ldns_status err) +{ + ldns_lookup_table *lt; + + lt = ldns_lookup_by_id(ldns_error_str, err); + + if (lt) { + return lt->name; + } + return NULL; +} diff --git a/libs/ldns/examples/Makefile.in b/libs/ldns/examples/Makefile.in new file mode 100644 index 0000000000..659efc0c33 --- /dev/null +++ b/libs/ldns/examples/Makefile.in @@ -0,0 +1,179 @@ +# Standard installation pathnames +# See the file LICENSE for the license +SHELL = @SHELL@ +VERSION = @PACKAGE_VERSION@ +basesrcdir = $(shell basename `pwd`) +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +mandir = @mandir@ +libtool = @libtool@ + +CC = @CC@ +CFLAGS = -I. -I${srcdir} @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBNSL_LIBS = @LIBNSL_LIBS@ +LIBSSL_CPPFLAGS = @LIBSSL_CPPFLAGS@ +LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ +LIBS = @LIBS@ +RUNTIME_PATH = @RUNTIME_PATH@ +LDNSDIR = @LDNSDIR@ + +INSTALL = $(srcdir)/../install-sh + +COMPILE = $(CC) $(CPPFLAGS) $(LIBSSL_CPPFLAGS) $(CFLAGS) +LINK = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(RUNTIME_PATH) +LINK_STATIC = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) -static $(LDFLAGS) $(LIBS) $(RUNTIME_PATH) + +LINT = splint +LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list +#-Dglob64=glob -Dglobfree64=globfree +# compat with openssl linux edition. +LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" +# compat with NetBSD +ifeq "$(shell uname)" "NetBSD" +LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ +endif +# compat with OpenBSD +LINTFLAGS+="-Dsigset_t=long" +# FreeBSD8 +LINTFLAGS+="-D__uint16_t=uint16_t" +LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)=" + +HEADER = config.h +MAIN_SOURCES = ldns-read-zone.c \ + ldns-mx.c \ + ldns-chaos.c \ + ldns-update.c \ + ldns-keygen.c \ + ldns-key2ds.c \ + ldns-version.c \ + ldns-rrsig.c \ + ldns-walk.c \ + ldns-zsplit.c \ + ldns-zcat.c \ + ldns-dpa.c \ + ldns-resolver.c \ + ldns-test-edns.c \ + ldns-keyfetcher.c \ + ldns-notify.c \ + ldns-testns.c \ + ldns-compare-zones.c \ + ldnsd.c + +MAIN_SSL_SOURCES = ldns-signzone.c \ + ldns-verify-zone.c \ + ldns-revoke.c \ + ldns-nsec3-hash.c + +OTHER_SOURCES = ldns-testpkts.c + +PROGRAMS=$(MAIN_SOURCES:.c=) +SSL_PROGRAMS=$(MAIN_SSL_SOURCES:.c=) + +.PHONY: all clean realclean all-static +.SECONDARY: $(MAIN_SOURCES:.c=.o) $(OTHER_SOURCES:.c=.o) $(MAIN_SSL_SOURCES:.c=.o) + +all: $(addsuffix .prg,$(PROGRAMS)) $(addsuffix .prg-ssl,$(SSL_PROGRAMS)) + +all-static: $(addsuffix .stc,$(PROGRAMS)) $(addsuffix .stc-ssl,$(SSL_PROGRAMS)) + +%.o: $(srcdir)/%.c + $(COMPILE) -o $@ -c $< + +# ldns-testns uses more sources. +ldns-testns.o: $(srcdir)/ldns-testns.c $(srcdir)/ldns-testpkts.c $(srcdir)/ldns-testpkts.h +ldns-testns.prg: ldns-testpkts.o +ldns-testns.stc: ldns-testpkts.o + +ldnsd.prg: ldnsd.o + @if test ! -f $(@:.prg=) -o $< -nt $(@:.prg=); then \ + echo $(LINK) $(LIBNSL_LIBS) -o $(@:.prg=) $^ ; \ + $(LINK) $(LIBNSL_LIBS) -o $(@:.prg=) $^ ; \ + fi + +ldnsd.stc: ldnsd.o + @if test ! -f $@ -o $< -nt $@; then \ + echo $(LINK_STATIC) $(LIBNSL_LDFLAGS) -o $@ $^ ; \ + $(LINK_STATIC) $(LIBNSL_LDFLAGS) -o $@ $^ ; \ + fi + +%.prg-ssl: %.o + @if test ! -f $(@:.prg-ssl=) -o $< -nt $(@:.prg-ssl=); then \ + echo $(LINK) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $(@:.prg-ssl=) $^ ; \ + $(LINK) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $(@:.prg-ssl=) $^ ; \ + fi + +%.stc-ssl: %.o + @if test ! -f $@ -o $< -nt $@; then \ + echo $(LINK_STATIC) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $@ $^ ; \ + $(LINK_STATIC) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $@ $^ ; \ + fi + +%.prg: %.o + @if test ! -f $(@:.prg=) -o $< -nt $(@:.prg=); then \ + echo $(LINK) -o $(@:.prg=) $^ ; \ + $(LINK) -o $(@:.prg=) $^ ; \ + fi + +%.stc: %.o + @if test ! -f $@ -o $< -nt $@; then \ + echo $(LINK_STATIC) -o $@ $^ ; \ + $(LINK_STATIC) -o $@ $^ ; \ + fi + +lint: + for i in $(MAIN_SOURCES) $(OTHER_SOURCES); do \ + $(LINT) $(LINTFLAGS) -I. -I$(srcdir) $(srcdir)/$$i $(CPPFLAGS); \ + if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ + done + +clean: + rm -f *.o *.lo + rm -rf .libs + rm -f $(PROGRAMS) $(SSL_PROGRAMS) + rm -f $(addsuffix .stc,$(PROGRAMS)) $(addsuffix .stc-ssl,$(SSL_PROGRAMS)) + +realclean: clean + rm -rf autom4te.cache/ + rm -f config.log config.status aclocal.m4 config.h.in configure Makefile + rm -f config.h + +confclean: clean + rm -rf config.log config.status config.h Makefile + +install: $(PROGRAMS) $(SSL_PROGRAMS) + $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 + for i in $(PROGRAMS) $(SSL_PROGRAMS); do \ + $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i $(DESTDIR)$(bindir) ; \ + $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + exit 0 + +install-static: all-static + $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 + for i in $(PROGRAMS); do \ + $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i.stc $(DESTDIR)$(bindir) ; \ + $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + for i in $(SSL_PROGRAMS); do \ + $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i.stc-ssl $(DESTDIR)$(bindir) ; \ + $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + exit 0 + +uninstall: + for i in $(PROGRAMS) $(SSL_PROGRAMS); do \ + rm -f $(DESTDIR)$(bindir)/$$i ; \ + rm -f $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + exit 0 + rmdir -p $(DESTDIR)$(bindir) + rmdir -p $(DESTDIR)$(mandir) diff --git a/libs/ldns/examples/README b/libs/ldns/examples/README new file mode 100644 index 0000000000..f84fe9d8cf --- /dev/null +++ b/libs/ldns/examples/README @@ -0,0 +1,5 @@ +These tools are examples of ldns usage. They are not meant for production +systems and will not be supported as such. + +Compilation: +autoreconf && ./configure && make diff --git a/libs/ldns/examples/config.h.in b/libs/ldns/examples/config.h.in new file mode 100644 index 0000000000..dad78b17a2 --- /dev/null +++ b/libs/ldns/examples/config.h.in @@ -0,0 +1,363 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Define to 1 if you have the declaration of `in6addr_any', and to 0 if you + don't. */ +#undef HAVE_DECL_IN6ADDR_ANY + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Whether getaddrinfo is available */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* If you have HMAC_CTX_init */ +#undef HAVE_HMAC_CTX_INIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define to 1 if you have the `ldns' library (-lldns). */ +#undef HAVE_LIBLDNS + +/* Define to 1 if you have the `pcap' library (-lpcap). */ +#undef HAVE_LIBPCAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IGMP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP6_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_UDP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PCAP_H + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if you have the `sleep' function. */ +#undef HAVE_SLEEP + +/* Define to 1 if you have the `srandom' function. */ +#undef HAVE_SRANDOM + +/* Define if you have the SSL libraries installed. */ +#undef HAVE_SSL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define this to enable ECDSA support. */ +#undef USE_ECDSA + +/* Define this to enable GOST support. */ +#undef USE_GOST + +/* Define this to enable SHA256 and SHA512 support. */ +#undef USE_SHA2 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* the version of the windows API enabled */ +#undef WINVER + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* in_addr_t */ +#undef in_addr_t + +/* in_port_t */ +#undef in_port_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `short' if does not define. */ +#undef int16_t + +/* Define to `int' if does not define. */ +#undef int32_t + +/* Define to `long long' if does not define. */ +#undef int64_t + +/* Define to `char' if does not define. */ +#undef int8_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to 'int' if not defined */ +#undef socklen_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `unsigned short' if does not define. */ +#undef uint16_t + +/* Define to `unsigned int' if does not define. */ +#undef uint32_t + +/* Define to `unsigned long long' if does not define. */ +#undef uint64_t + +/* Define to `unsigned char' if does not define. */ +#undef uint8_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork + + + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_PCAP_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +#ifndef HAVE_GETADDRINFO +#include +#endif + +#ifndef HAVE_RANDOM +/* random can be replaced by rand for ldnsexamples */ +#define random rand +#endif + +#ifndef HAVE_SRANDOM +/* srandom can be replaced by srand for ldnsexamples */ +#define srandom srand +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif + diff --git a/libs/ldns/examples/configure b/libs/ldns/examples/configure new file mode 100755 index 0000000000..424aa3c78a --- /dev/null +++ b/libs/ldns/examples/configure @@ -0,0 +1,7150 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for ldns 1.6.9. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libdns@nlnetlabs.nl about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='ldns' +PACKAGE_TARNAME='libdns' +PACKAGE_VERSION='1.6.9' +PACKAGE_STRING='ldns 1.6.9' +PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' +PACKAGE_URL='' + +ac_unique_file="ldns-read-zone.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +LDNSDIR +LIBSSL_LIBS +LIBSSL_LDFLAGS +LIBSSL_CPPFLAGS +RUNTIME_PATH +HAVE_SSL +LIBNSL_LIBS +libtool +SET_MAKE +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_rpath +with_ssl +enable_sha2 +enable_gost +enable_ecdsa +with_ldns +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CPPFLAGS +CC +LDFLAGS +LIBS +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of ldns 1.6.9:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-rpath Disable hardcoded rpath (default=enabled) + --disable-sha2 Disable SHA256 and SHA512 RRSIG support + --disable-gost Disable GOST support + --enable-ecdsa Enable ECDSA support, experimental + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl + /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw + /usr) + --with-ldns=PATH specify prefix of path of ldns library to use + + + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +ldns configure 1.6.9 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------- ## +## Report this to libdns@nlnetlabs.nl ## +## ---------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# acx_nlnetlabs.m4 - common macros for configure checks +# Copyright 2009, Wouter Wijngaards, NLnet Labs. +# BSD licensed. +# +# Version 11 +# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. +# 2010-07-02 Add check for ss_family (for minix). +# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. +# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. +# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl +# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN +# 2010-01-20 added AHX_COONFIG_STRLCAT +# 2009-07-14 U_CHAR detection improved for windows crosscompile. +# added ACX_FUNC_MALLOC +# fixup some #if to #ifdef +# NONBLOCKING test for mingw crosscompile. +# 2009-07-13 added ACX_WITH_SSL_OPTIONAL +# 2009-07-03 fixup LDFLAGS for empty ssl dir. +# +# Automates some of the checking constructs. Aims at portability for POSIX. +# Documentation for functions is below. +# +# the following macro's are provided in this file: +# (see below for details on each macro). +# +# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. +# ACX_RSRC_VERSION - create windows resource version number. +# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. +# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). +# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. +# ACX_DEPFLAG - find cc dependency flags. +# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. +# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. +# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. +# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. +# ACX_TYPE_U_CHAR - u_char type. +# ACX_TYPE_RLIM_T - rlim_t type. +# ACX_TYPE_SOCKLEN_T - socklen_t type. +# ACX_TYPE_IN_ADDR_T - in_addr_t type. +# ACX_TYPE_IN_PORT_T - in_port_t type. +# ACX_ARG_RPATH - add --disable-rpath option. +# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. +# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, +# where --without-ssl is also accepted +# ACX_LIB_SSL - setup to link -lssl. +# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. +# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. +# ACX_FUNC_DEPRECATED - see if func is deprecated. +# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. +# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. +# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. +# ACX_FUNC_MALLOC - check malloc, define replacement . +# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. +# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. +# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. +# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. +# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. +# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. +# AHX_CONFIG_SNPRINTF - snprintf compat prototype +# AHX_CONFIG_INET_PTON - inet_pton compat prototype +# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype +# AHX_CONFIG_INET_ATON - inet_aton compat prototype +# AHX_CONFIG_MEMMOVE - memmove compat prototype +# AHX_CONFIG_STRLCAT - strlcat compat prototype +# AHX_CONFIG_STRLCPY - strlcpy compat prototype +# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype +# AHX_CONFIG_W32_SLEEP - w32 compat for sleep +# AHX_CONFIG_W32_USLEEP - w32 compat for usleep +# AHX_CONFIG_W32_RANDOM - w32 compat for random +# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom +# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. +# ACX_CFLAGS_STRIP - strip one flag from CFLAGS +# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS +# AHX_CONFIG_FLAG_OMITTED - define omitted flag +# AHX_CONFIG_FLAG_EXT - define omitted extension flag +# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags +# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. +# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. +# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family +# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} + +$as_echo "#define WINVER 0x0502" >>confdefs.h + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +for ac_prog in glibtool libtool15 libtool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_libtool+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$libtool"; then + ac_cv_prog_libtool="$libtool" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_libtool="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +libtool=$ac_cv_prog_libtool +if test -n "$libtool"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libtool" >&5 +$as_echo "$libtool" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$libtool" && break +done +test -n "$libtool" || libtool="../libtool" + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 +$as_echo_n "checking whether $CC supports -std=c99... " >&6; } +cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-std=c99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 +$as_echo_n "checking whether $CC supports -xc99... " >&6; } +cache=`echo xc99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-xc99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + +# Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; enable_rpath=$enableval +else + enable_rpath=yes +fi + + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 +$as_echo_n "checking whether $CC supports -O2... " >&6; } +cache=`echo O2 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -O2" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 +$as_echo_n "checking whether $CC supports -Werror... " >&6; } +cache=`echo Werror | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="-Werror" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="-errwarn" +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 +$as_echo_n "checking whether $CC supports -Wall... " >&6; } +cache=`echo Wall | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="$ERRFLAG -Wall" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="$ERRFLAG -errfmt" +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo '#include ' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" +if test "x$ac_cv_type_int8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int8_t char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" +if test "x$ac_cv_type_int16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int16_t short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int32_t int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" +if test "x$ac_cv_type_int64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int64_t long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" +if test "x$ac_cv_type_uint8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint8_t unsigned char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" +if test "x$ac_cv_type_uint16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint16_t unsigned short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" +if test "x$ac_cv_type_uint32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint32_t unsigned int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" +if test "x$ac_cv_type_uint64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint64_t unsigned long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF + +fi + + +for ac_header in sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h pcap.h arpa/inet.h sys/time.h sys/socket.h sys/select.h netdb.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in winsock2.h ws2tcpip.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/igmp.h netinet/if_ether.h netinet/ip6.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +$ac_includes_default +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " +$ac_includes_default +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +" +if test "x$ac_cv_type_socklen_t" = xyes; then : + +else + +$as_echo "#define socklen_t int" >>confdefs.h + +fi + +for ac_header in sys/param.h sys/mount.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default + + + #if HAVE_SYS_PARAM_H + # include + #endif + + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_addr_t" = xyes; then : + +else + +$as_echo "#define in_addr_t uint32_t" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_port_t" = xyes; then : + +else + +$as_echo "#define in_port_t uint16_t" >>confdefs.h + +fi + + +# check to see if libraries are needed for these functions. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break +fi +done +if ${ac_cv_search_socket+:} false; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +tmp_LIBS="$LIBS" +LIBS= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 +$as_echo_n "checking for library containing inet_pton... " >&6; } +if ${ac_cv_search_inet_pton+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_pton (); +int +main () +{ +return inet_pton (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_inet_pton=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_inet_pton+:} false; then : + break +fi +done +if ${ac_cv_search_inet_pton+:} false; then : + +else + ac_cv_search_inet_pton=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 +$as_echo "$ac_cv_search_inet_pton" >&6; } +ac_res=$ac_cv_search_inet_pton +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +LIBNSL_LIBS=$LIBS + +LIBS="$tmp_LIBS" + +tmp_CPPFLAGS="$CPPFLAGS" +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" + + + +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; + +else + + withval="yes" + +fi + + + withval=$withval + if test x_$withval != x_no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 +$as_echo_n "checking for SSL... " >&6; } + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" + fi + for dir in $withval; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes" + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSL /**/ +_ACEOF + + if test "$ssldir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" + fi + break; + fi + done + if test x_$found_ssl != x_yes; then + as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 +$as_echo "found in $ssldir" >&6; } + HAVE_SSL=yes + if test "$ssldir" != "/usr" -a "$ssldir" != ""; then + LDFLAGS="$LDFLAGS -L$ssldir/lib" + LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" + + if test "x$enable_rpath" = xyes; then + if echo "$ssldir/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" + fi + fi + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } + LIBS="$LIBS -lcrypto" + LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + # check if -lwsock32 or -lgdi32 are needed. + BAKLIBS="$LIBS" + BAKSSLLIBS="$LIBSSL_LIBS" + LIBS="$LIBS -lgdi32" + LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 +$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 +$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + + + # openssl engine functionality needs dlopen(). + BAKLIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_dlopen+:} false; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + if test "$LIBS" != "$BAKLIBS"; then + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + fi + fi +for ac_header in openssl/ssl.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_SSL_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/err.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_err_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_ERR_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/rand.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_rand_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_RAND_H 1 +_ACEOF + +fi + +done + + + + + + + + +CPPFLAGS="$tmp_CPPFLAGS" +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +# use libcrypto to check the following: +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" +LDFLAGS="$LDFLAGS $LIBSSL_LDFLAGS" +LIBS="$LIBS $LIBSSL_LIBS" +# Check whether --enable-sha2 was given. +if test "${enable_sha2+set}" = set; then : + enableval=$enable_sha2; +fi + +case "$enable_sha2" in + no) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHA256 and SHA512" >&5 +$as_echo_n "checking for SHA256 and SHA512... " >&6; } + ac_fn_c_check_func "$LINENO" "SHA256_Init" "ac_cv_func_SHA256_Init" +if test "x$ac_cv_func_SHA256_Init" = xyes; then : + +else + + as_fn_error $? "SHA2 enabled, but no SHA2 functions found in OpenSSL" "$LINENO" 5 + +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_SHA2 1 +_ACEOF + + ;; +esac + +# Check whether --enable-gost was given. +if test "${enable_gost+set}" = set; then : + enableval=$enable_gost; +fi + +case "$enable_gost" in + no) + ;; + *) + if test "x$HAVE_SSL" != "xyes"; then + as_fn_error $? "GOST enabled, but no SSL support" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOST" >&5 +$as_echo_n "checking for GOST... " >&6; } + ac_fn_c_check_func "$LINENO" "EVP_PKEY_set_type_str" "ac_cv_func_EVP_PKEY_set_type_str" +if test "x$ac_cv_func_EVP_PKEY_set_type_str" = xyes; then : + +else + as_fn_error $? "OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost" "$LINENO" 5 +fi + + ac_fn_c_check_func "$LINENO" "EC_KEY_new" "ac_cv_func_EC_KEY_new" +if test "x$ac_cv_func_EC_KEY_new" = xyes; then : + +else + as_fn_error $? "No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost" "$LINENO" 5 +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_GOST 1 +_ACEOF + + ;; +esac + +# Check whether --enable-ecdsa was given. +if test "${enable_ecdsa+set}" = set; then : + enableval=$enable_ecdsa; +fi + +case "$enable_ecdsa" in + yes) + ac_fn_c_check_func "$LINENO" "ECDSA_sign" "ac_cv_func_ECDSA_sign" +if test "x$ac_cv_func_ECDSA_sign" = xyes; then : + +else + as_fn_error $? "OpenSSL does not support ECDSA" "$LINENO" 5 +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_ECDSA 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************" >&5 +$as_echo "$as_me: WARNING: + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************" >&2;} + ;; + no|*) + ;; +esac + +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_open_offline in -lpcap" >&5 +$as_echo_n "checking for pcap_open_offline in -lpcap... " >&6; } +if ${ac_cv_lib_pcap_pcap_open_offline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcap $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pcap_open_offline (); +int +main () +{ +return pcap_open_offline (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pcap_pcap_open_offline=yes +else + ac_cv_lib_pcap_pcap_open_offline=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_open_offline" >&5 +$as_echo "$ac_cv_lib_pcap_pcap_open_offline" >&6; } +if test "x$ac_cv_lib_pcap_pcap_open_offline" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPCAP 1 +_ACEOF + + LIBS="-lpcap $LIBS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find pcap library (needed for ldns-dpa, will not build dpa now.)" >&5 +$as_echo "$as_me: WARNING: Can't find pcap library (needed for ldns-dpa, will not build dpa now.)" >&2;} + + +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 +$as_echo_n "checking for getaddrinfo... " >&6; } +if ${ac_cv_func_getaddrinfo+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_func_getaddrinfo=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_getaddrinfo="yes" +else + ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +int +main () +{ + + (void)getaddrinfo(NULL, NULL, NULL, NULL); + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_getaddrinfo="yes" +LDFLAGS="$LDFLAGS -lws2_32" + +else + ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 +$as_echo "$ac_cv_func_getaddrinfo" >&6; } +if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h + +fi + + +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +for ac_header in vfork.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" +if test "x$ac_cv_header_vfork_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VFORK_H 1 +_ACEOF + +fi + +done + +for ac_func in fork vfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "x$ac_cv_func_fork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } +if ${ac_cv_func_fork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_fork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* By Ruediger Kuhlmann. */ + return fork () < 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_fork_works=yes +else + ac_cv_func_fork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } +if ${ac_cv_func_vfork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_vfork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include +#ifdef HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_vfork_works=yes +else + ac_cv_func_vfork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h + +else + +$as_echo "#define vfork fork" >>confdefs.h + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h + +fi + +for ac_func in isblank srandom random sleep +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +ac_fn_c_check_decl "$LINENO" "in6addr_any" "ac_cv_have_decl_in6addr_any" "$ac_includes_default +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_UDP_H +#include +#endif +#ifdef HAVE_NETINET_IGMP_H +#include +#endif + +" +if test "x$ac_cv_have_decl_in6addr_any" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IN6ADDR_ANY $ac_have_decl +_ACEOF + + +# check for ldns + +# Check whether --with-ldns was given. +if test "${with_ldns+set}" = set; then : + withval=$with_ldns; + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + + +fi + + +# check for ldns development source tree +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns devel source" >&5 +$as_echo_n "checking for ldns devel source... " >&6; } +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $ldns_dev_dir with $ldns_version" >&5 +$as_echo "using $ldns_dev_dir with $ldns_version" >&6; } + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="$LIBS -lldns" + +$as_echo "#define HAVE_LIBLDNS 1" >>confdefs.h + + LDNSDIR="$ldns_dev_dir" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 +$as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } +if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldns $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ldns_rr_new (); +int +main () +{ +return ldns_rr_new (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ldns_ldns_rr_new=yes +else + ac_cv_lib_ldns_ldns_rr_new=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 +$as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } +if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBLDNS 1 +_ACEOF + + LIBS="-lldns $LIBS" + +else + + as_fn_error $? "Can't find ldns library" "$LINENO" 5 + + +fi + +fi + + + + + + +ac_config_files="$ac_config_files Makefile" + +ac_config_headers="$ac_config_headers config.h" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +ldns config.status 1.6.9 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/libs/ldns/examples/configure.ac b/libs/ldns/examples/configure.ac new file mode 100644 index 0000000000..2bf89d2dc0 --- /dev/null +++ b/libs/ldns/examples/configure.ac @@ -0,0 +1,421 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.56) +AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns) +AC_CONFIG_SRCDIR([ldns-read-zone.c]) +sinclude(../acx_nlnetlabs.m4) + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} +AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) + +AC_AIX +# Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool]) + +ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) +ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) + +AC_ARG_ENABLE(rpath, + [AC_HELP_STRING([--disable-rpath], [Disable hardcoded rpath (default=enabled)])], + enable_rpath=$enableval, enable_rpath=yes) + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + +AC_TYPE_SIZE_T +ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600, +[ +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"]) + + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include ], [CFLAGS="$CFLAGS $C99FLAG"]) + +AC_C_INLINE +AC_CHECK_TYPE(int8_t, char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(int32_t, int) +AC_CHECK_TYPE(int64_t, long long) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(uint16_t, unsigned short) +AC_CHECK_TYPE(uint32_t, unsigned int) +AC_CHECK_TYPE(uint64_t, unsigned long long) +AC_CHECK_TYPE(ssize_t, int) + +AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h pcap.h arpa/inet.h sys/time.h sys/socket.h sys/select.h netdb.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/igmp.h netinet/if_ether.h netinet/ip6.h],,, [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif]) + +ACX_TYPE_SOCKLEN_T +AC_CHECK_HEADERS([sys/param.h sys/mount.h],,, +[AC_INCLUDES_DEFAULT] +[ + [ + #if HAVE_SYS_PARAM_H + # include + #endif + ] +]) +AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) +AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) + +# check to see if libraries are needed for these functions. +AC_SEARCH_LIBS(socket, socket) +tmp_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(inet_pton, nsl) +AC_SUBST(LIBNSL_LIBS,$LIBS) +LIBS="$tmp_LIBS" + +tmp_CPPFLAGS="$CPPFLAGS" +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" + +ACX_WITH_SSL_OPTIONAL + +AC_SUBST(LIBSSL_CPPFLAGS) +AC_SUBST(LIBSSL_LDFLAGS) +AC_SUBST(LIBSSL_LIBS) + +CPPFLAGS="$tmp_CPPFLAGS" +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +# use libcrypto to check the following: +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" +LDFLAGS="$LDFLAGS $LIBSSL_LDFLAGS" +LIBS="$LIBS $LIBSSL_LIBS" +AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) +case "$enable_sha2" in + no) + ;; + *) + AC_MSG_CHECKING(for SHA256 and SHA512) + AC_CHECK_FUNC(SHA256_Init,, [ + AC_MSG_ERROR([SHA2 enabled, but no SHA2 functions found in OpenSSL]) + ]) + AC_DEFINE_UNQUOTED([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) + ;; +esac + +AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) +case "$enable_gost" in + no) + ;; + *) + if test "x$HAVE_SSL" != "xyes"; then + AC_MSG_ERROR([GOST enabled, but no SSL support]) + fi + AC_MSG_CHECKING(for GOST) + AC_CHECK_FUNC(EVP_PKEY_set_type_str, [],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost])]) + AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost])]) + AC_DEFINE_UNQUOTED([USE_GOST], [1], [Define this to enable GOST support.]) + ;; +esac + +AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--enable-ecdsa], [Enable ECDSA support, experimental])) +case "$enable_ecdsa" in + yes) + AC_CHECK_FUNC(ECDSA_sign,,[AC_MSG_ERROR([OpenSSL does not support ECDSA])]) + AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) + AC_WARN([ + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************]) + ;; + no|*) + ;; +esac + +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +AC_CHECK_LIB(pcap, pcap_open_offline,, [ + AC_MSG_WARN([Can't find pcap library (needed for ldns-dpa, will not build dpa now.)]) + ] +) + + +AC_DEFUN([AC_CHECK_GETADDRINFO_WITH_INCLUDES], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(for getaddrinfo) +AC_CACHE_VAL(ac_cv_func_getaddrinfo, +[ac_cv_func_getaddrinfo=no +AC_LINK_IFELSE( +[ +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} +], +dnl this case on linux, solaris, bsd +[ac_cv_func_getaddrinfo="yes"], +dnl no quick getaddrinfo, try mingw32 and winsock2 library. +ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +AC_LINK_IFELSE( +AC_LANG_PROGRAM( +[ +#ifdef HAVE_WS2TCPIP_H +#include +#endif +], +[ + (void)getaddrinfo(NULL, NULL, NULL, NULL); +] +), +[ac_cv_func_getaddrinfo="yes" +LDFLAGS="$LDFLAGS -lws2_32" +], +[ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" +]) +) +]) + +AC_MSG_RESULT($ac_cv_func_getaddrinfo) +if test $ac_cv_func_getaddrinfo = yes; then + AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) +fi +])dnl + +AC_CHECK_GETADDRINFO_WITH_INCLUDES + +AC_FUNC_FORK +AC_CHECK_FUNCS(isblank srandom random sleep) +AC_CHECK_DECLS([in6addr_any],,,[AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_UDP_H +#include +#endif +#ifdef HAVE_NETINET_IGMP_H +#include +#endif +]) + +# check for ldns +AC_ARG_WITH(ldns, + AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use]) + , + [ + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + ] +) + +# check for ldns development source tree +AC_MSG_CHECKING([for ldns devel source]) +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version]) + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="$LIBS -lldns" + AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.]) + LDNSDIR="$ldns_dev_dir" +else + AC_MSG_RESULT([no]) + AC_CHECK_LIB(ldns, ldns_rr_new,, [ + AC_MSG_ERROR([Can't find ldns library]) + ] + ) +fi + +AC_SUBST(LDNSDIR) + + +AH_BOTTOM([ + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_PCAP_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +#ifndef HAVE_GETADDRINFO +#include +#endif + +#ifndef HAVE_RANDOM +/* random can be replaced by rand for ldnsexamples */ +#define random rand +#endif + +#ifndef HAVE_SRANDOM +/* srandom can be replaced by srand for ldnsexamples */ +#define srandom srand +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif +]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_HEADER([config.h]) +AC_OUTPUT diff --git a/libs/ldns/examples/fake-rfc2553.h b/libs/ldns/examples/fake-rfc2553.h new file mode 100644 index 0000000000..1e9add1eb0 --- /dev/null +++ b/libs/ldns/examples/fake-rfc2553.h @@ -0,0 +1,175 @@ +/* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */ +/* + * Copyright (C) 2000-2003 Damien Miller. All rights reserved. + * Copyright (C) 1999 WIDE Project. 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. Neither the name of the project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Pseudo-implementation of RFC2553 name / address resolution functions + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For example, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + */ + +#ifndef _FAKE_RFC2553_H +#define _FAKE_RFC2553_H + +#include +#include +#include +#include + +/* + * First, socket and INET6 related definitions + */ +#ifndef HAVE_STRUCT_SOCKADDR_STORAGE +#ifndef _SS_MAXSIZE +# define _SS_MAXSIZE 128 /* Implementation specific max size */ +# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) +struct sockaddr_storage { + struct sockaddr ss_sa; + char __ss_pad2[_SS_PADSIZE]; +}; +# define ss_family ss_sa.sa_family +#endif /* _SS_MAXSIZE */ +#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ + +#ifndef IN6_IS_ADDR_LOOPBACK +# define IN6_IS_ADDR_LOOPBACK(a) \ + (((uint32_t *)(a))[0] == 0 && ((uint32_t *)(a))[1] == 0 && \ + ((uint32_t *)(a))[2] == 0 && ((uint32_t *)(a))[3] == htonl(1)) +#endif /* !IN6_IS_ADDR_LOOPBACK */ + +#ifndef HAVE_STRUCT_IN6_ADDR +struct in6_addr { + uint8_t s6_addr[16]; +}; +#endif /* !HAVE_STRUCT_IN6_ADDR */ + +#ifndef HAVE_STRUCT_SOCKADDR_IN6 +struct sockaddr_in6 { + unsigned short sin6_family; + uint16_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; +}; +#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ + +#ifndef AF_INET6 +/* Define it to something that should never appear */ +#define AF_INET6 AF_MAX +#endif + +/* + * Next, RFC2553 name / address resolution API + */ + +#ifndef NI_NUMERICHOST +# define NI_NUMERICHOST (1) +#endif +#ifndef NI_NAMEREQD +# define NI_NAMEREQD (1<<1) +#endif +#ifndef NI_NUMERICSERV +# define NI_NUMERICSERV (1<<2) +#endif + +#ifndef AI_PASSIVE +# define AI_PASSIVE (1) +#endif +#ifndef AI_CANONNAME +# define AI_CANONNAME (1<<1) +#endif +#ifndef AI_NUMERICHOST +# define AI_NUMERICHOST (1<<2) +#endif + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif /* !NI_MAXSERV */ +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif /* !NI_MAXHOST */ + +#ifndef INT_MAX +#define INT_MAX 0xffffffff +#endif + +#ifndef EAI_NODATA +# define EAI_NODATA (INT_MAX - 1) +#endif +#ifndef EAI_MEMORY +# define EAI_MEMORY (INT_MAX - 2) +#endif +#ifndef EAI_NONAME +# define EAI_NONAME (INT_MAX - 3) +#endif +#ifndef EAI_SYSTEM +# define EAI_SYSTEM (INT_MAX - 4) +#endif + +#ifndef HAVE_STRUCT_ADDRINFO +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +#endif /* !HAVE_STRUCT_ADDRINFO */ + +#ifndef HAVE_GETADDRINFO +#ifdef getaddrinfo +# undef getaddrinfo +#endif +#define getaddrinfo(a,b,c,d) (ssh_getaddrinfo(a,b,c,d)) +int getaddrinfo(const char *, const char *, + const struct addrinfo *, struct addrinfo **); +#endif /* !HAVE_GETADDRINFO */ + +#if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO) +#define gai_strerror(a) (ssh_gai_strerror(a)) +char *gai_strerror(int); +#endif /* !HAVE_GAI_STRERROR */ + +#ifndef HAVE_FREEADDRINFO +#define freeaddrinfo(a) (ssh_freeaddrinfo(a)) +void freeaddrinfo(struct addrinfo *); +#endif /* !HAVE_FREEADDRINFO */ + +#ifndef HAVE_GETNAMEINFO +#define getnameinfo(a,b,c,d,e,f,g) (ssh_getnameinfo(a,b,c,d,e,f,g)) +int getnameinfo(const struct sockaddr *, size_t, char *, size_t, + char *, size_t, int); +#endif /* !HAVE_GETNAMEINFO */ + +#endif /* !_FAKE_RFC2553_H */ + diff --git a/libs/ldns/examples/ldns-chaos.1 b/libs/ldns/examples/ldns-chaos.1 new file mode 100644 index 0000000000..e9b7bf46dc --- /dev/null +++ b/libs/ldns/examples/ldns-chaos.1 @@ -0,0 +1,26 @@ +.TH ldns-chaos 1 "27 Apr 2005" +.SH NAME +ldns-chaos \- give some information about a nameserver +.SH SYNOPSIS +.B ldns-chaos +.IR NAMESERVER + +.SH DESCRIPTION +\fBldns-chaos\fR retrieves all the addresses of the nameserver and then queries +each address for its \fIversion.bind\fR and \fIhostname.bind\fR. +.PP +\fBldns-chaos\fR is a bit more complex than \fBldns-mx\fR. + +.SH OPTIONS +\fBldns-chaos\fR has no options. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-chaos.c b/libs/ldns/examples/ldns-chaos.c new file mode 100644 index 0000000000..a1e1b796bf --- /dev/null +++ b/libs/ldns/examples/ldns-chaos.c @@ -0,0 +1,125 @@ +/* + * chaos is a small programs that prints some information + * about a nameserver + * + * (c) NLnet Labs, 2005 - 2008 + * + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +static int +usage(FILE *fp, char *prog) { + fprintf(fp, "%s server\n", prog); + fprintf(fp, " print out some information about server\n"); + return 0; +} + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_rdf *name; + ldns_rdf *version, *id; + ldns_pkt *p; + ldns_rr_list *addr; + ldns_rr_list *info; + ldns_status s; + ldns_rdf *pop; + size_t i; + + if (argc != 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + /* create a rdf from the command line arg */ + name = ldns_dname_new_frm_str(argv[1]); + if (!name) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + /* create rdf for what we are going to ask */ + version = ldns_dname_new_frm_str("version.bind"); + id = ldns_dname_new_frm_str("hostname.bind"); + + /* create a new resolver from /etc/resolv.conf */ + s = ldns_resolver_new_frm_file(&res, NULL); + if (s != LDNS_STATUS_OK) { + ldns_rdf_deep_free(name); + exit(EXIT_FAILURE); + } + ldns_resolver_set_retry(res, 1); /* don't want to wait too long */ + + /* use the resolver to send it a query for the a/aaaa of name */ + addr = ldns_get_rr_list_addr_by_name(res, name, LDNS_RR_CLASS_IN, LDNS_RD); + if (!addr) { + fprintf(stderr, " *** could not get an address for %s\n", argv[1]); + ldns_rdf_deep_free(name); + ldns_resolver_deep_free(res); + exit(EXIT_FAILURE); + } + + /* remove current list of nameservers from resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + + /* can be multihomed */ + for(i = 0; i < ldns_rr_list_rr_count(addr); i++) { + if (i > 0) { + fprintf(stdout, "\n"); + } + + if (ldns_resolver_push_nameserver_rr(res, + ldns_rr_list_rr(addr, i)) != LDNS_STATUS_OK) { + printf("Error adding nameserver to resolver\n"); + } + + ldns_rr_print(stdout, ldns_rr_list_rr(addr, i)); + fprintf(stdout, "\n"); + + p = ldns_resolver_query(res, version, LDNS_RR_TYPE_TXT, + LDNS_RR_CLASS_CH, LDNS_RD); + if (p) { + ldns_pkt_print(stdout, p); + info = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_TXT, LDNS_SECTION_ANSWER); + + if (info) { + ldns_rr_list_print(stdout, info); + ldns_rr_list_deep_free(info); + } else { + printf(" *** version retrieval failed\n"); + } + ldns_pkt_free(p); + } else { + printf(" *** query failed\n"); + } + + p = ldns_resolver_query(res, id, LDNS_RR_TYPE_TXT, + LDNS_RR_CLASS_CH, LDNS_RD); + if (p) { + info = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_TXT, LDNS_SECTION_ANSWER); + if (info) { + ldns_rr_list_print(stdout, info); + ldns_rr_list_deep_free(info); + } else { + printf(" *** id retrieval failed\n"); + } + ldns_pkt_free(p); + } else { + printf(" *** query failed for\n"); + } + ldns_rdf_deep_free(ldns_resolver_pop_nameserver(res)); + + } + + ldns_rdf_deep_free(name); + ldns_resolver_deep_free(res); + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-compare-zones.1 b/libs/ldns/examples/ldns-compare-zones.1 new file mode 100644 index 0000000000..facccd8745 --- /dev/null +++ b/libs/ldns/examples/ldns-compare-zones.1 @@ -0,0 +1,57 @@ +.TH ldns-compare-zones 1 "17 Oct 2007" +.SH NAME +ldns-compare-zones \- read and compare two zonefiles and print differences +.SH SYNOPSIS +.B ldns-compare-zones +.IR [-c] +.IR [-i] +.IR [-d] +.IR [-z] +.IR [-s] +.IR ZONEFILE1 +.IR ZONEFILE2 +.SH DESCRIPTION +\fBldns-compare-zones\fR reads two DNS zone files and prints number of differences. +.nf +Output is formated to: + +NUM_INS -NUM_DEL ~NUM_CHG + +.fi +The major comparison is based on the owner name. If an owner name is present in zonefile 1, but not in zonefile 2, the resource records with this owner name are considered deleted, and counted as NUM_DEL. If an owner name is present in zonefile 2, but not in zonefile 1, the resource records with this owner name are considered inserted, and counted as NUM_INS. If an owner name is present in both, but there is a difference in the amount or content of the records, these are considered changed, and counted as NUM_CHG. +.SH OPTIONS +.TP +\fB-c\fR +Print resource records whose owner names are in both zone files, but with different resource records. (a.k.a. changed) +.TP +\fB-i\fR +Print resource records whose owner names are present only in ZONEFILE2 (a.k.a. inserted) +.TP +\fB-d\fR +Print resource records whose owner names are present only in ZONEFILE1 (a.k.a. deleted) +.TP +\fB-a\fR +Print all changes. Specifying this option is the same as specifying -c -i +amd -d. +.TP +\fB-z\fR +Suppress zone sorting; this option is not recommended; it can cause records +to be incorrectly marked as changed, depending of the nature of the changes. +.TP +\fB-s\fR +Do not exclude the SOA record from the comparison. The SOA record may +then show up as changed due to a new serial number. Off by default since +you may be interested to know if (other zone apex elements) have changed. +.TP +\fB-h\fR +Show usage and exit +.TP +\fB-v\fR +Show the version and exit +.SH AUTHOR +Written by Ondřej Surý for CZ.NIC, z.s.p.o. (czech domain registry) +.SH REPORTING BUGS +Report bugs to . +.SH COPYRIGHT +Copyright (C) 2005 CZ.NIC, z.s.p.o.. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-compare-zones.c b/libs/ldns/examples/ldns-compare-zones.c new file mode 100644 index 0000000000..56d36a286c --- /dev/null +++ b/libs/ldns/examples/ldns-compare-zones.c @@ -0,0 +1,283 @@ +/* + * ldns-compare-zones compares two zone files + * + * Written by Ondrej Sury in 2007 + * + * Modified a bit by NLnet Labs. + * + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include +#include +#include + +#include + +#include + +#define OP_INS '+' +#define OP_DEL '-' +#define OP_CHG '~' + +static void +usage(int argc, char **argv) +{ + printf("Usage: %s [-v] [-i] [-d] [-c] [-s] \n", + argv[0]); + printf(" -i - print inserted\n"); + printf(" -d - print deleted\n"); + printf(" -c - print changed\n"); + printf(" -a - print all differences (-i -d -c)\n"); + printf(" -s - do not exclude SOA record from comparison\n"); + printf(" -z - do not sort zones\n"); +} + +int +main(int argc, char **argv) +{ + char *fn1, *fn2; + FILE *fp1, *fp2; + ldns_zone *z1, *z2; + ldns_status s; + size_t i , j; + ldns_rr_list *rrl1, *rrl2; + int rr_cmp, rr_chg = 0; + ldns_rr *rr1 = NULL, *rr2 = NULL, *rrx = NULL; + int line_nr1 = 0, line_nr2 = 0; + size_t rrc1 , rrc2; + size_t num_ins = 0, num_del = 0, num_chg = 0; + int c; + bool opt_deleted = false, opt_inserted = false, opt_changed = false; + bool sort = true, inc_soa = false; + char op = 0; + + while ((c = getopt(argc, argv, "ahvdicsz")) != -1) { + switch (c) { + case 'h': + usage(argc, argv); + exit(EXIT_SUCCESS); + break; + case 'v': + printf("%s version %s (ldns version %s)\n", + argv[0], + LDNS_VERSION, + ldns_version()); + exit(EXIT_SUCCESS); + break; + case 's': + inc_soa = true; + break; + case 'z': + sort = false; + break; + case 'd': + opt_deleted = true; + break; + case 'i': + opt_inserted = true; + break; + case 'c': + opt_changed = true; + break; + case 'a': + opt_deleted = true; + opt_inserted = true; + opt_changed = true; + break; + } + } + + argc -= optind; + argv += optind; + + if (argc != 2) { + argc -= optind; + argv -= optind; + usage(argc, argv); + exit(EXIT_FAILURE); + } + fn1 = argv[0]; + fp1 = fopen(fn1, "r"); + if (!fp1) { + fprintf(stderr, "Unable to open %s: %s\n", fn1, strerror(errno)); + exit(EXIT_FAILURE); + } + /* Read first zone */ + s = ldns_zone_new_frm_fp_l(&z1, fp1, NULL, 0, + LDNS_RR_CLASS_IN, &line_nr1); + if (s != LDNS_STATUS_OK) { + fclose(fp1); + fprintf(stderr, "%s: %s at %d\n", + fn1, + ldns_get_errorstr_by_id(s), + line_nr1); + exit(EXIT_FAILURE); + } + fclose(fp1); + + fn2 = argv[1]; + fp2 = fopen(fn2, "r"); + if (!fp2) { + fprintf(stderr, "Unable to open %s: %s\n", fn2, strerror(errno)); + exit(EXIT_FAILURE); + } + /* Read second zone */ + s = ldns_zone_new_frm_fp_l(&z2, fp2, NULL, 0, + LDNS_RR_CLASS_IN, &line_nr2); + if (s != LDNS_STATUS_OK) { + ldns_zone_deep_free(z1); + fclose(fp2); + fprintf(stderr, "%s: %s at %d\n", + fn2, + ldns_get_errorstr_by_id(s), + line_nr2); + exit(EXIT_FAILURE); + } + fclose(fp2); + + rrl1 = ldns_zone_rrs(z1); + rrc1 = ldns_rr_list_rr_count(rrl1); + + rrl2 = ldns_zone_rrs(z2); + rrc2 = ldns_rr_list_rr_count(rrl2); + + if (sort) { + /* canonicalize zone 1 */ + ldns_rr2canonical(ldns_zone_soa(z1)); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z1)); i++) { + ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z1), i)); + } + /* sort zone 1 */ + ldns_zone_sort(z1); + /* canonicalize zone 2 */ + ldns_rr2canonical(ldns_zone_soa(z2)); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z2)); i++) { + ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z2), i)); + } + /* sort zone 2 */ + ldns_zone_sort(z2); + } + + if(inc_soa) { + ldns_rr_list* wsoa = ldns_rr_list_new(); + ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z1)); + ldns_rr_list_cat(wsoa, rrl1); + rrl1 = wsoa; + rrc1 = ldns_rr_list_rr_count(rrl1); + wsoa = ldns_rr_list_new(); + ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z2)); + ldns_rr_list_cat(wsoa, rrl2); + rrl2 = wsoa; + rrc2 = ldns_rr_list_rr_count(rrl2); + if(sort) { + ldns_rr_list_sort(rrl1); + ldns_rr_list_sort(rrl2); + } + } + + /* + * Walk through both zones. The previously seen resource record is + * kept (in the variable rrx) so that we can recognize when we are + * handling a new owner name. If the owner name changes, we have to + * set the operator again. + */ + for (i = 0, j = 0; i < rrc1 || j < rrc2;) { + rr_cmp = 0; + if (i < rrc1 && j < rrc2) { + rr1 = ldns_rr_list_rr(rrl1, i); + rr2 = ldns_rr_list_rr(rrl2, j); + rr_cmp = ldns_rr_compare(rr1, rr2); + + /* Completely skip if the rrs are equal */ + if (rr_cmp == 0) { + i++; + j++; + continue; + } + rr_chg = ldns_dname_compare(ldns_rr_owner(rr1), + ldns_rr_owner(rr2)); + } else if (i >= rrc1) { + /* we have reached the end of zone 1, so the current record + * from zone 2 automatically sorts higher + */ + rr1 = NULL; + rr2 = ldns_rr_list_rr(rrl2, j); + rr_chg = rr_cmp = 1; + } else if (j >= rrc2) { + /* we have reached the end of zone 2, so the current record + * from zone 1 automatically sorts lower + */ + rr1 = ldns_rr_list_rr(rrl1, i); + rr2 = NULL; + rr_chg = rr_cmp = -1; + } + if (rr_cmp < 0) { + i++; + if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr1), + ldns_rr_owner(rrx) + ) != 0)) { + /* The owner name is different, forget previous rr */ + rrx = NULL; + } + if (rrx == NULL) { + if (rr_chg == 0) { + num_chg++; + op = OP_CHG; + } else { + num_del++; + op = OP_DEL; + } + rrx = rr1; + } + if (((op == OP_DEL) && opt_deleted) || + ((op == OP_CHG) && opt_changed)) { + printf("%c-", op); + ldns_rr_print(stdout, rr1); + } + } else if (rr_cmp > 0) { + j++; + if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr2), + ldns_rr_owner(rrx) + ) != 0)) { + rrx = NULL; + } + if (rrx == NULL) { + if (rr_chg == 0) { + num_chg++; + op = OP_CHG; + } else { + num_ins++; + op = OP_INS; + } + /* remember this rr for it's name in the next iteration */ + rrx = rr2; + } + if (((op == OP_INS) && opt_inserted) || + ((op == OP_CHG) && opt_changed)) { + printf("%c+", op); + ldns_rr_print(stdout, rr2); + } + } + } + + printf("\t%c%u\t%c%u\t%c%u\n", + OP_INS, + (unsigned int) num_ins, + OP_DEL, + (unsigned int) num_del, + OP_CHG, + (unsigned int) num_chg); + + /* Free resources */ + if(inc_soa) { + ldns_rr_list_free(rrl1); + ldns_rr_list_free(rrl2); + } + ldns_zone_deep_free(z2); + ldns_zone_deep_free(z1); + + return 0; +} diff --git a/libs/ldns/examples/ldns-dpa.1 b/libs/ldns/examples/ldns-dpa.1 new file mode 100644 index 0000000000..0b433df661 --- /dev/null +++ b/libs/ldns/examples/ldns-dpa.1 @@ -0,0 +1,151 @@ +.TH dpa 1 "1 Nov 2005" +.SH NAME +dpa \- DNS Packet Analyzer. Analyze DNS packets in ip trace files +.SH SYNOPSIS +.B dpa +[ +.IR OPTION +] +.IR TRACEFILE + +.SH DESCRIPTION +\fBdpa\fR is used to analyze dns packets in trace files. It has 3 main options: count, filter, and count uniques (i.e. count all different occurences). + +.SH OPTIONS +.TP +\fB-c\fR \fIexpressionlist\fR +Count occurrences of matching expressions + +.TP +\fB-f\fR \fIexpression\fR +Filter: only process packets that match the expression + +.TP +\fB-h\fR +Show usage + +.TP +\fB-p\fR +Show the total number of correct DNS packets, and percentage of -u and +-c values (of the total of matching on the -f filter. if no filter is +given, percentages are on all correct dns packets) + +.TP +\fB-of\fR \fIfile\fR +Write all packets that match the -f flag to file, as pcap data. + +.TP +\fB-ofh\fR \fIfile\fR +Write all packets that match the -f flag to file, in hexadecimal format, +readable by drill. + +.TP +\fB-s\fR +Show possible match names + +.TP +\fB-s\fR \fImatchname\fR +show possible match operators and values for name + +.TP +\fB-sf\fR +Only evaluate packets (in representation format) that match the -f filter. +If no -f was given, evaluate all correct dns packets. + +.TP +\fB-u\fR \fImatchnamelist\fR +Count every occurence of every value of the matchname (for instance, count all packetsizes, see EXAMPLES in ldns-dpa(1) ). + +.TP +\fB-ua\fR +For every matchname in -u, show the average value of all matches. Behaviour for match types that do not have an integer value is undefined. + +.TP +\fB-uac\fR +For every matchname in -u, show the average number of times this value was encountered. + +.TP +\fB-um\fR \fInumber\fR +Only show the results from -u for values that occurred more than times. + +.TP +\fB-v\fR \fIlevel\fR +Set verbosity to level (1-5, 5 being the highest). Mostly used for debugging. + +.TP +\fB-notip\fR \fIfile\fR +Write packets that were not recognized as IP packets to file (as pcap data). + +.TP +\fB-baddns\fR \fIfile\fR +Write dns packets that were too mangled to parse to file (as pcap data). + +.TP +\fB-version\fR +Show version and exit + +.SH LIST AND MATCHES + +A is a comma separated list of match names (use -s to see possible match names). +A is a comma separated list of expressions. + +An expression has the following form: +: () + | + & + + +: + +: + = equal to + != not equal to + > greater than + < lesser than + >= greater than or equal to + <= lesser than or equal to + ~= contains + +See the -s option for possible matchnames, operators and values. + +.SH EXAMPLES + +.TP +ldns-dpa -u packetsize -p test.tr +Count all different packetsizes in test.tr and show the precentages. + +.TP +ldns-dpa -f "edns=1&qr=0" -of edns.tr test.tr +Filter out all edns enable queries in test.tr and put them in edns.tr + +.TP +ldns-dpa -f edns=1 -c tc=1 -u rcode test.tr +For all edns packets, count the number of truncated packets and all their rcodes in test.tr. + +.TP +ldns-dpa -c tc=1,qr=0,qr=1,opcode=QUERY test.tr +For all packets, count the number of truncated packets, the number of packets with qr=0, the number of packets with qr=1 and the number of queries in test.tr. + +.TP +ldns-dpa -u packetsize -ua test.tr +Show all packet sizes and the average packet size per packet. + +.TP +ldns-dpa -u srcaddress -uac test.tr +Show all packet source addresses and the average number of packets sent from this address. + +.TP +sudo tcpdump -i eth0 -s 0 -U -w - port 53 | ldns-dpa -f qr=0 -sf +Print all query packets seen on the specified interface. + + +.SH AUTHOR +Written by Jelte Jansen for NLnetLabs. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-dpa.c b/libs/ldns/examples/ldns-dpa.c new file mode 100644 index 0000000000..8d18dd6938 --- /dev/null +++ b/libs/ldns/examples/ldns-dpa.c @@ -0,0 +1,2837 @@ +/* + * ldns-dpa inspects the (udp) DNS packets found in a pcap file + * and provides statistics about them + * + * (C) NLnet Labs 2006 - 2008 + * + * See the file LICENSE for the license + */ +#include "config.h" + +#include + +#ifdef HAVE_PCAP_H +#ifdef HAVE_LIBPCAP + +#ifdef HAVE_NETINET_IP6_H +#include +#endif +#include + +#ifndef IP_OFFMASK +#define IP_OFFMASK 0x1fff +#endif + +int verbosity = 1; + +#define ETHER_HEADER_LENGTH 14 +#define UDP_HEADER_LENGTH 8 +#define IP6_HEADER_LENGTH 40 + +/* some systems don't have this? */ +#ifndef ETHERTYPE_IPV6 +#define ETHERTYPE_IPV6 0x86dd +#endif + +#define MAX_MATCHES 20 +#define MAX_OPERATORS 7 + + +/* global options */ +bool show_filter_matches = false; +size_t total_nr_of_dns_packets = 0; +size_t total_nr_of_filtered_packets = 0; +size_t not_ip_packets = 0; +size_t bad_dns_packets = 0; +size_t arp_packets = 0; +size_t udp_packets = 0; +size_t tcp_packets = 0; +size_t fragmented_packets = 0; +size_t lost_packet_fragments = 0; +FILE *hexdumpfile = NULL; +pcap_dumper_t *dumper = NULL; +pcap_dumper_t *not_ip_dump = NULL; +pcap_dumper_t *bad_dns_dump = NULL; + + +struct +fragment_part { + uint16_t ip_id; + uint8_t data[65536]; + size_t cur_len; +}; + +struct fragment_part *fragment_p; + +/* To add a match, + * - add it to the enum + * - add it to the table_matches const + * - add a handler to value_matches + * - tell in get_string_value() where in the packet the data lies + * - add to parser? + * - add to show_match_ function + */ +enum enum_match_ids { + MATCH_ID, + MATCH_OPCODE, + MATCH_RCODE, + MATCH_PACKETSIZE, + MATCH_QR, + MATCH_TC, + MATCH_AD, + MATCH_CD, + MATCH_RD, + MATCH_EDNS, + MATCH_EDNS_PACKETSIZE, + MATCH_DO, + MATCH_QUESTION_SIZE, + MATCH_ANSWER_SIZE, + MATCH_AUTHORITY_SIZE, + MATCH_ADDITIONAL_SIZE, + MATCH_SRC_ADDRESS, + MATCH_DST_ADDRESS, + MATCH_TIMESTAMP, + MATCH_QUERY, + MATCH_QTYPE, + MATCH_QNAME, + MATCH_ANSWER, + MATCH_AUTHORITY, + MATCH_ADDITIONAL, + MATCH_LAST +}; +typedef enum enum_match_ids match_id; + +enum enum_counter_types { + TYPE_INT, + TYPE_BOOL, + TYPE_OPCODE, + TYPE_RCODE, + TYPE_STRING, + TYPE_TIMESTAMP, + TYPE_ADDRESS, + TYPE_RR, + TYPE_RR_TYPE, + TYPE_LAST +}; +typedef enum enum_counter_types counter_type; + +const ldns_lookup_table lt_types[] = { + {TYPE_INT, "int" }, + {TYPE_BOOL, "bool" }, + {TYPE_OPCODE, "opcode" }, + {TYPE_RCODE, "rcode" }, + {TYPE_STRING, "string" }, + {TYPE_TIMESTAMP, "timestamp" }, + {TYPE_ADDRESS, "address" }, + {TYPE_RR, "rr" }, + { 0, NULL } +}; + +enum enum_type_operators { + OP_EQUAL, + OP_NOTEQUAL, + OP_GREATER, + OP_LESSER, + OP_GREATEREQUAL, + OP_LESSEREQUAL, + OP_CONTAINS, + OP_LAST +}; +typedef enum enum_type_operators type_operator; + +const ldns_lookup_table lt_operators[] = { + { OP_EQUAL, "=" }, + { OP_NOTEQUAL, "!=" }, + { OP_GREATER, ">" }, + { OP_LESSER, "<" }, + { OP_GREATEREQUAL, ">=" }, + { OP_LESSEREQUAL, "<=" }, + { OP_CONTAINS, "~=" }, + { 0, NULL } +}; + +static const char *get_op_str(type_operator op) { + const ldns_lookup_table *lt; + lt = ldns_lookup_by_id((ldns_lookup_table *) lt_operators, op); + if (lt) { + return lt->name; + } else { + fprintf(stderr, "Unknown operator id: %u\n", op); + exit(1); + } +} + +static type_operator +get_op_id(char *op_str) +{ + const ldns_lookup_table *lt; + lt = ldns_lookup_by_name((ldns_lookup_table *) lt_operators, op_str); + if (lt) { + return (type_operator) lt->id; + } else { + fprintf(stderr, "Unknown operator: %s\n", op_str); + exit(1); + } +} + +struct struct_type_operators { + counter_type type; + size_t operator_count; + type_operator operators[10]; +}; +typedef struct struct_type_operators type_operators; + +const type_operators const_type_operators[] = { + { TYPE_INT, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, + { TYPE_BOOL, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_OPCODE, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_RCODE, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_STRING, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_TIMESTAMP, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, + { TYPE_ADDRESS, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_RR, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_RR_TYPE, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, + { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } +}; + +const type_operators * +get_type_operators(counter_type type) { + const type_operators *to = const_type_operators; + while (to) { + if (to->type == type) { + return to; + } + to++; + } + return NULL; +} + +struct struct_match_table { + match_id id; + const char *name; + const char *description; + const counter_type type; +}; +typedef struct struct_match_table match_table; + +/* order of entries has been changed after gprof analysis, and reasoning + * about the uses of -u arguments + */ +const match_table matches[] = { + { MATCH_QUERY, "query", "String representation of the query RR", TYPE_RR }, + { MATCH_QTYPE, "qtype", "RR Type of the question RR, if present", TYPE_RR_TYPE }, + { MATCH_QNAME, "qname", "Owner name of the question RR, if present", TYPE_STRING }, + { MATCH_SRC_ADDRESS, "srcaddress", "address the packet was sent from", TYPE_ADDRESS }, + { MATCH_TIMESTAMP, "timestamp", "time the packet was sent", TYPE_TIMESTAMP }, + { MATCH_DST_ADDRESS, "dstaddress", "address the packet was sent to", TYPE_ADDRESS }, + { MATCH_EDNS_PACKETSIZE, "edns-packetsize", "packets size specified in edns rr", TYPE_INT }, + { MATCH_ID, "id", "id of the packet", TYPE_INT }, + { MATCH_OPCODE, "opcode", "opcode of packet (rfc1035)", TYPE_OPCODE }, + { MATCH_RCODE, "rcode", "response code of packet", TYPE_RCODE }, + { MATCH_PACKETSIZE, "packetsize", "size of packet in bytes", TYPE_INT }, + { MATCH_QR, "qr", "value of qr bit", TYPE_BOOL }, + { MATCH_TC, "tc", "value of tc bit", TYPE_BOOL }, + { MATCH_AD, "ad", "value of ad bit", TYPE_BOOL }, + { MATCH_CD, "cd", "value of cd bit", TYPE_BOOL }, + { MATCH_RD, "rd", "value of rd bit", TYPE_BOOL }, + { MATCH_EDNS, "edns", "existence of edns rr", TYPE_BOOL }, + { MATCH_DO, "do", "value of do bit", TYPE_BOOL }, + { MATCH_QUESTION_SIZE, "questionsize", "number of rrs in the question section", TYPE_INT }, + { MATCH_ANSWER_SIZE, "answersize", "number of rrs in the answer section", TYPE_INT }, + { MATCH_AUTHORITY_SIZE, "authoritysize", "number of rrs in the authority section", TYPE_INT }, + { MATCH_ADDITIONAL_SIZE, "additionalsize", "number of rrs in the additional section", TYPE_INT }, + { MATCH_ANSWER, "answer", "String representation of the answer RRs", TYPE_RR }, + { MATCH_AUTHORITY, "authority", "String representation of the authority RRs", TYPE_RR }, + { MATCH_ADDITIONAL, "additional", "String representation of the additional RRs", TYPE_RR }, + { 0, NULL , NULL, TYPE_INT} +}; + +enum enum_match_expression_operators { + MATCH_EXPR_OR, + MATCH_EXPR_AND, + MATCH_EXPR_LEAF +}; +typedef enum enum_match_expression_operators match_expression_operator; + +struct struct_match_operation { + match_id id; + type_operator operator; + char *value; +}; +typedef struct struct_match_operation match_operation; + +typedef struct struct_match_expression match_expression; +struct struct_match_expression { + /* and or or, or leaf (in which case there are no subtrees, but only a match_table */ + match_expression_operator op; + match_expression *left; + match_expression *right; + match_operation *match; + size_t count; +}; + +typedef struct struct_match_counters match_counters; +struct struct_match_counters { +/* + match_expression **counter; + size_t size; +*/ + match_expression *match; + match_counters *left; + match_counters *right; +}; + +match_table * +get_match_by_name(char *name) { + match_table *mt = (match_table *) matches; + if (name) { + while (mt->name != NULL) { + if (strcasecmp(name, mt->name) == 0) { + return mt; + } + mt++; + } + } + return NULL; +} + +static match_table * +get_match_by_id(match_id id) { + match_table *mt = (match_table *) matches; + + while (mt->name != NULL) { + if (mt->id == id) { + return mt; + } + mt++; + } + return NULL; +} + +static const char * +get_match_name_str(match_id id) { + match_table *mt = get_match_by_id(id); + if (mt) { + return mt->name; + } else { + fprintf(stderr, "Unknown match id: %u\n", id); + exit(1); + return "Unknown match id"; + } +} + +static void +print_match_operation(FILE *output, match_operation *mc) +{ + match_table *mt = NULL; + ldns_lookup_table *lt; + struct timeval time; + time_t time_tt; + int value; + size_t pos; + char *tmp, *tmp2; + + if (mc) { + mt = get_match_by_id(mc->id); + + if (mt) { + fprintf(output, "%s %s ",mt->name, get_op_str(mc->operator)); + + switch (mt->type) { + case TYPE_INT: + case TYPE_STRING: + case TYPE_ADDRESS: + case TYPE_RR: + fprintf(output, "'%s'", mc->value); + break; + case TYPE_BOOL: + if (strncmp(mc->value, "1", 2) == 0) { + fprintf(output,"'true'"); + } else { + fprintf(output,"'false'"); + } + break; + case TYPE_OPCODE: + value = atoi(mc->value); + lt = ldns_lookup_by_id(ldns_opcodes, value); + if (lt) { + fprintf(output, "%s", lt->name); + } else { + fprintf(output, "%s", mc->value); + } + break; + case TYPE_RCODE: + value = atoi(mc->value); + lt = ldns_lookup_by_id(ldns_rcodes, value); + if (lt) { + fprintf(output, "%s", lt->name); + } else { + fprintf(output, "%s", mc->value); + } + break; + case TYPE_TIMESTAMP: +#ifndef S_SPLINT_S + time.tv_sec = (long int) atol(mc->value); +#endif + time_tt = (time_t)time.tv_sec; + tmp = ctime(&time_tt); + tmp2 = malloc(strlen(tmp) + 1); + for (pos = 0; pos < strlen(tmp); pos++) { + if (tmp[pos] == '\n') { + tmp2[pos] = '\0'; + } else { + tmp2[pos] = tmp[pos]; + } + } + tmp2[pos] = '\0'; + fprintf(output, "%s", tmp2); + free(tmp2); + break; + default: + fprintf(output, "'%s'", mc->value); + } + + } else { + fprintf(output, "%u %s '%s'", mc->id, get_op_str(mc->operator), mc->value); + } + } else { + fprintf(output, "(nil)"); + } +} + +static void +print_match_expression(FILE *output, match_expression *expr) +{ + if (expr) { + switch (expr->op) { + case MATCH_EXPR_OR: + fprintf(output, "("); + print_match_expression(output, expr->left); + fprintf(output, " | "); + print_match_expression(output, expr->right); + fprintf(output, ")"); + break; + case MATCH_EXPR_AND: + fprintf(output, "("); + print_match_expression(output, expr->left); + fprintf(output, " & "); + print_match_expression(output, expr->right); + fprintf(output, ")"); + break; + case MATCH_EXPR_LEAF: + print_match_operation(output, expr->match); + break; + default: +/* + fprintf(output, "ERROR PRINTING MATCH: unknown op: %u\n", expr->op); + exit(1); +*/ + fprintf(output, "("); +if (expr->left) { + print_match_expression(output, expr->left); +} + fprintf(output, " ? "); +if (expr->right) { + print_match_expression(output, expr->right); +} + fprintf(output, ") _"); +if (expr->match) { + print_match_operation(output, expr->match); +} +fprintf(output, "_"); + } + } else { + printf("(nil)"); + } +} + +static void +print_counters(FILE *output, match_counters *counters, bool show_percentages, size_t total, int count_minimum) +{ + double percentage; + + if (!counters || !output) { + return; + } + + if (counters->left) { + print_counters(output, counters->left, show_percentages, total, count_minimum); + } + if (counters->match) { + if (count_minimum < (int) counters->match->count) { + print_match_expression(output, counters->match); + printf(": %u", (unsigned int) counters->match->count); + if (show_percentages) { + percentage = (double) counters->match->count / (double) total * 100.0; + printf(" (%.2f%%)", percentage); + } + printf("\n"); + } + } + if (counters->right) { + print_counters(output, counters->right, show_percentages, total, count_minimum); + } + + return; +} + +static void +ldns_pkt2file_hex(FILE *fp, const ldns_pkt *pkt) +{ + uint8_t *wire; + size_t size, i; + ldns_status status; + + status = ldns_pkt2wire(&wire, pkt, &size); + + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Unable to convert packet: error code %u", status); + return; + } + + fprintf(fp, "; 0"); + for (i = 1; i < 20; i++) { + fprintf(fp, " %2u", (unsigned int) i); + } + fprintf(fp, "\n"); + fprintf(fp, ";--"); + for (i = 1; i < 20; i++) { + fprintf(fp, " --"); + } + fprintf(fp, "\n"); + for (i = 0; i < size; i++) { + if (i % 20 == 0 && i > 0) { + fprintf(fp, "\t; %4u-%4u\n", (unsigned int) i-19, (unsigned int) i); + } + fprintf(fp, " %02x", (unsigned int)wire[i]); + } + fprintf(fp, "\n\n"); +} + +/* + * Calculate the total for all match operations with the same id as this one + * (if they are 'under' this one in the tree, which should be the case in + * the unique counter tree + */ +static size_t +calculate_total_value(match_counters *counters, match_operation *cur) +{ + size_t result = 0; + + if (!counters) { + return 0; + } + + if (counters->match->match->id == cur->id) { + result = (size_t) atol(counters->match->match->value) * counters->match->count; + } + + if (counters->left) { + result += calculate_total_value(counters->left, cur); + } + if (counters->right) { + result += calculate_total_value(counters->right, cur); + } + + return result; +} + +static size_t +calculate_total_count_matches(match_counters *counters, match_operation *cur) +{ + size_t result = 0; + + if (!counters) { + return 0; + } + + if (counters->match->match->id == cur->id) { + result = 1; + } + + if (counters->left) { + /* In some cases, you don't want the number of actual + counted matches, for instance when calculating the + average number of queries per second. In this case + you want the number of seconds */ + if (cur->id == MATCH_TIMESTAMP) { + result += (size_t) abs((int) (atol(counters->match->match->value) - atol(counters->left->match->match->value))) - 1; + } + result += calculate_total_count_matches(counters->left, cur); + } + if (counters->right) { + if (cur->id == MATCH_TIMESTAMP) { + result += (size_t) abs((int) (atol(counters->right->match->match->value) - atol(counters->match->match->value))) - 1; + } + result += calculate_total_count_matches(counters->right, cur); + } + + return result; +} + +/** + * Returns true if there is a previous match operation with the given type + * in the counters structure + */ +static bool +has_previous_match(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return false; + } + + if (counters->left) { + if (counters->left->match->match->id == cur->id) { + return true; + } else if (has_previous_match(counters->left, cur)) { + return true; + } else if (counters->left->right) { + if (counters->left->right->match->match->id == cur->id) { + return true; + } else if (has_previous_match(counters->left->right, cur)) { + return true; + } + } + } + return false; +} + +/** + * Returns true if there is a later match operation with the given type + * in the counters structure + */ +static bool +has_next_match(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return false; + } + + if (counters->right) { + if (counters->right->match->match->id == cur->id) { + return true; + } else if (has_next_match(counters->right, cur)) { + return true; + } else if (counters->right->left) { + if (counters->right->left->match->match->id == cur->id) { + return true; + } else if (has_next_match(counters->right->left, cur)) { + return true; + } + } + } + return false; +} + +/** + * Returns the first match with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_first_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_previous_match(counters, cur)) { + return get_first_match_expression(counters->left, cur); + } else if (counters->match->match->id == cur->id) { + return counters->match; + } else if (counters->right) { + return get_first_match_expression(counters->right, cur); + } else { + return NULL; + } +} + +/** + * Returns the second match expression with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_second_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_previous_match(counters, cur)) { + if (has_previous_match(counters->left, cur)) { + return get_second_match_expression(counters->left, cur); + } else { + return counters->left->match; + } +/* + } else if (counters->match->match->id == cur->id) { + return counters->match->match->value; +*/ } else if (counters->right) { + return get_first_match_expression(counters->right, cur); + } else { + return NULL; + } +} + +/** + * Returns the last match expression with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_last_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_next_match(counters, cur)) { + return get_last_match_expression(counters->right, cur); + } else if (counters->match->match->id == cur->id) { + return counters->match; + } else if (counters->left) { + return get_last_match_expression(counters->left, cur); + } else { + return NULL; + } +} + +/** + * Returns the last but one match expression with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_last_but_one_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_next_match(counters, cur)) { + if (has_next_match(counters->right, cur)) { + return get_last_but_one_match_expression(counters->right, cur); + } else { + return counters->match; + } +/* + } else if (counters->match->match->id == cur->id) { + return counters->match->match->value; +*/ } else if (counters->left) { + return get_last_match_expression(counters->right, cur); + } else { + return NULL; + } +} + +static size_t +get_first_count(match_counters *counters, match_operation *cur) +{ + match_expression *o = get_first_match_expression(counters, cur); + if (o) { + return o->count; + } else { + return 0; + } +} + +static size_t +get_last_count(match_counters *counters, match_operation *cur) +{ + match_expression *o = get_last_match_expression(counters, cur); + if (o) { + return o->count; + } else { + return 0; + } +} + + +static size_t +calculate_total_count(match_counters *counters, match_operation *cur) +{ + size_t result = 0; + + if (!counters) { + return 0; + } + + if (counters->match->match->id == cur->id) { + result = counters->match->count; + } + + if (counters->left) { + result += calculate_total_count(counters->left, cur); + } + if (counters->right) { + result += calculate_total_count(counters->right, cur); + } + + return result; +} + +static void +print_counter_averages(FILE *output, match_counters *counters, match_operation *cur) +{ + size_t total_value; + size_t total_count; + match_table *mt; + + if (!counters || !output) { + return; + } + + if (!cur) { + cur = counters->match->match; + mt = get_match_by_id(cur->id); + total_value = calculate_total_value(counters, cur); + total_count = calculate_total_count(counters, cur); + printf("Average for %s: (%u / %u) %.02f\n", mt->name, (unsigned int) total_value, (unsigned int) total_count, (float) total_value / (float) total_count); + if (counters->left) { + print_counter_averages(output, counters->left, cur); + } + if (counters->right) { + print_counter_averages(output, counters->right, cur); + } + } else { + if (counters->left) { + if (counters->left->match->match->id != cur->id) { + print_counter_averages(output, counters->left, NULL); + } + } + if (counters->right) { + if (counters->right->match->match->id != cur->id) { + print_counter_averages(output, counters->right, NULL); + } + } + } + + return; +} + +static void +print_counter_average_count(FILE *output, match_counters *counters, match_operation *cur, bool remove_first_last) +{ + size_t total_matches; + size_t total_count; + match_table *mt; + + if (!counters || !output) { + return; + } + + if (!cur) { + cur = counters->match->match; + mt = get_match_by_id(cur->id); + total_matches = calculate_total_count_matches(counters, cur); + total_count = calculate_total_count(counters, cur); + /* Remove the first and last for instance for timestamp average counts (half seconds drag down the average) */ + if (remove_first_last) { + total_count -= get_first_count(counters, cur); + total_count -= get_last_count(counters, cur); + printf("Removing first count from average: %u\n", (unsigned int) get_first_count(counters,cur)); + printf("Removing last count from average: %u\n", (unsigned int) get_last_count(counters,cur)); + /* in the case where we count the differences between match values too + * (like with timestamps) we need to subtract from the match count too + */ + if (cur->id == MATCH_TIMESTAMP) { + if (get_first_match_expression(counters, cur) && get_second_match_expression(counters, cur)) { + total_matches -= atol(get_second_match_expression(counters, cur)->match->value) - atol(get_first_match_expression(counters, cur)->match->value); + } + if (get_last_match_expression(counters, cur) && get_last_but_one_match_expression(counters, cur)) { + total_matches -= atol(get_last_match_expression(counters, cur)->match->value) - atol(get_last_but_one_match_expression(counters, cur)->match->value); + } + } else { + total_matches -= 2; + } + } + printf("Average count for %s: (%u / %u) %.02f\n", mt->name, (unsigned int) total_count, (unsigned int) total_matches, (float) total_count / (float) total_matches); + if (counters->left) { + print_counter_averages(output, counters->left, cur); + } + if (counters->right) { + print_counter_averages(output, counters->right, cur); + } + } else { + if (counters->left) { + if (counters->left->match->match->id != cur->id) { + print_counter_averages(output, counters->left, NULL); + } + } + if (counters->right) { + if (counters->right->match->match->id != cur->id) { + print_counter_averages(output, counters->right, NULL); + } + } + } + + return; +} + +static bool +match_int(type_operator operator, + char *value, + char *mvalue) +{ + int a, b; + + if (!value || !mvalue) { + return false; + } + + a = atoi(value); + b = atoi(mvalue); + + switch (operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + case OP_GREATER: + return a > b; + break; + case OP_LESSER: + return a < b; + break; + case OP_GREATEREQUAL: + return a >= b; + break; + case OP_LESSEREQUAL: + return a <= b; + break; + default: + fprintf(stderr, "Unknown operator: %u\n", operator); + exit(2); + } +} + +static bool +match_opcode(type_operator operator, + char *value, + char *mvalue) +{ + ldns_pkt_opcode a, b; + int i; + ldns_lookup_table *lt; + + /* try parse name first, then parse as int */ + lt = ldns_lookup_by_name(ldns_opcodes, value); + if (lt) { + a = lt->id; + } else { + i = atoi(value); + if (i >= 0 && !isdigit(value[0]) == 0) { + lt = ldns_lookup_by_id(ldns_opcodes, i); + if (lt) { + a = lt->id; + } else { + fprintf(stderr, "Unknown opcode: %s\n", value); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown opcode: %s\n", value); + exit(1); + return false; + } + } + + lt = ldns_lookup_by_name(ldns_opcodes, mvalue); + if (lt) { + b = lt->id; + } else { + i = atoi(mvalue); + if (i >= 0 && !isdigit(mvalue[0]) == 0) { + lt = ldns_lookup_by_id(ldns_opcodes, i); + if (lt) { + b = lt->id; + } else { + fprintf(stderr, "Unknown opcode: %s\n", mvalue); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown opcode: %s\n", mvalue); + exit(1); + return false; + } + } + + switch(operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + default: + fprintf(stderr, "Error bad operator for opcode: %s\n", get_op_str(operator)); + return false; + break; + } +} + +static bool +match_str(type_operator operator, + char *value, + char *mvalue) +{ + char *valuedup, *mvaluedup; + size_t i; + bool result; + + if (operator == OP_CONTAINS) { + /* strcasestr is not C89 + return strcasestr(value, mvalue) != 0; + */ + valuedup = strdup(value); + mvaluedup = strdup(mvalue); + for (i = 0; i < strlen(valuedup); i++) { + valuedup[i] = tolower(valuedup[i]); + } + for (i = 0; i < strlen(mvaluedup); i++) { + mvaluedup[i] = tolower(mvaluedup[i]); + } + result = strstr(valuedup, mvaluedup) != 0; + free(valuedup); + free(mvaluedup); + return result; + } else if (operator == OP_EQUAL) { + return strcmp(value, mvalue) == 0; + } else { + return strcmp(value, mvalue) != 0; + } +} + +static bool +match_rr_type(type_operator operator, + char *value, + char *mvalue) +{ + ldns_rr_type a,b; + + a = ldns_get_rr_type_by_name(value); + b = ldns_get_rr_type_by_name(mvalue); + + switch (operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + case OP_GREATER: + return a > b; + break; + case OP_LESSER: + return a < b; + break; + case OP_GREATEREQUAL: + return a >= b; + break; + case OP_LESSEREQUAL: + return a <= b; + break; + default: + fprintf(stderr, "Unknown operator: %u\n", operator); + exit(2); + } +} + +static bool +match_rcode(type_operator operator, + char *value, + char *mvalue) +{ + int a, b; + int i; + ldns_lookup_table *lt; + + /* try parse name first, then parse as int */ + lt = ldns_lookup_by_name(ldns_rcodes, value); + if (lt) { + a = lt->id; + } else { + i = atoi(value); + if (i >= 0 && !isdigit(value[0]) == 0) { + lt = ldns_lookup_by_id(ldns_rcodes, i); + if (lt) { + a = lt->id; + } else { + fprintf(stderr, "Unknown rcode: %s\n", value); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown rcode: %s\n", value); + exit(1); + return false; + } + } + + lt = ldns_lookup_by_name(ldns_rcodes, mvalue); + if (lt) { + b = lt->id; + } else { + i = atoi(mvalue); + + if (i >= 0 && !isdigit(mvalue[0]) == 0) { + lt = ldns_lookup_by_id(ldns_rcodes, i); + if (lt) { + b = lt->id; + } else { + fprintf(stderr, "Unknown rcode: %s\n", mvalue); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown rcode: %s\n", mvalue); + exit(1); + return false; + } + } + + switch(operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + default: + fprintf(stderr, "Error bad operator for rcode: %s\n", get_op_str(operator)); + return false; + break; + } +} + +static bool +value_matches(match_id id, + type_operator operator, + char *value, + char *mvalue) +{ + int result; + + if (verbosity >= 5) { + printf("Match %s: %s %s %s: ", get_match_name_str(id), value, get_op_str(operator), mvalue); + } + switch(id) { + case MATCH_OPCODE: + result = match_opcode(operator, value, mvalue); + break; + case MATCH_RCODE: + result = match_rcode(operator, value, mvalue); + break; + case MATCH_ID: + case MATCH_QR: + case MATCH_TC: + case MATCH_AD: + case MATCH_CD: + case MATCH_RD: + case MATCH_DO: + case MATCH_PACKETSIZE: + case MATCH_EDNS: + case MATCH_EDNS_PACKETSIZE: + case MATCH_QUESTION_SIZE: + case MATCH_ANSWER_SIZE: + case MATCH_AUTHORITY_SIZE: + case MATCH_ADDITIONAL_SIZE: + case MATCH_TIMESTAMP: + result = match_int(operator, value, mvalue); + break; + case MATCH_QUERY: + case MATCH_QNAME: + case MATCH_ANSWER: + case MATCH_AUTHORITY: + case MATCH_ADDITIONAL: + result = match_str(operator, value, mvalue); + break; + case MATCH_SRC_ADDRESS: + case MATCH_DST_ADDRESS: + result = match_str(operator, value, mvalue); + break; + case MATCH_QTYPE: + result = match_rr_type(operator, value, mvalue); + break; + default: + fprintf(stderr, "Error: value_matches() for operator %s not implemented yet.\n", get_op_str((type_operator) id)); + exit(3); + } + if (verbosity >= 5) { + if (result) { + printf("true\n"); + } else { + printf("false\n"); + } + } + return result; +} + +static char * +get_string_value(match_id id, ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr) +{ + char *val; + match_table *mt; + size_t valsize = 100; + + val = malloc(valsize); + memset(val, 0, valsize); + + switch(id) { + case MATCH_QR: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_qr(pkt)); + break; + case MATCH_ID: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_id(pkt)); + break; + case MATCH_OPCODE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_get_opcode(pkt)); + break; + case MATCH_RCODE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_get_rcode(pkt)); + break; + case MATCH_PACKETSIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_size(pkt)); + break; + case MATCH_TC: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_tc(pkt)); + break; + case MATCH_AD: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_ad(pkt)); + break; + case MATCH_CD: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_cd(pkt)); + break; + case MATCH_RD: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_rd(pkt)); + break; + case MATCH_EDNS: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns(pkt)); + break; + case MATCH_EDNS_PACKETSIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns_udp_size(pkt)); + break; + case MATCH_DO: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns_do(pkt)); + break; + case MATCH_QUESTION_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_qdcount(pkt)); + break; + case MATCH_ANSWER_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_ancount(pkt)); + break; + case MATCH_AUTHORITY_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_nscount(pkt)); + break; + case MATCH_ADDITIONAL_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_arcount(pkt)); + break; + case MATCH_SRC_ADDRESS: + free(val); + val = ldns_rdf2str(src_addr); + break; + case MATCH_DST_ADDRESS: + free(val); + val = ldns_rdf2str(dst_addr); + break; + case MATCH_TIMESTAMP: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_timestamp(pkt).tv_sec); + break; + case MATCH_QUERY: + if (ldns_pkt_qdcount(pkt) > 0) { + free(val); + val = ldns_rr2str(ldns_rr_list_rr(ldns_pkt_question(pkt), 0)); + /* replace \n for nicer printing later */ + if (strchr(val, '\n')) { + *(strchr(val, '\n')) = '\0'; + } + } else { + val[0] = '\0'; + } + break; + case MATCH_QNAME: + if (ldns_pkt_qdcount(pkt) > 0) { + free(val); + val = ldns_rdf2str(ldns_rr_owner(ldns_rr_list_rr(ldns_pkt_question(pkt), 0))); + /* replace \n for nicer printing later */ + if (strchr(val, '\n')) { + *(strchr(val, '\n')) = '\0'; + } + } else { + val[0] = '\0'; + } + break; + case MATCH_QTYPE: + if (ldns_pkt_qdcount(pkt) > 0) { + free(val); + val = ldns_rr_type2str(ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_question(pkt), 0))); + } else { + val[0] = '\0'; + } + break; + case MATCH_ANSWER: + if (ldns_pkt_ancount(pkt) > 0) { + free(val); + val = ldns_rr_list2str(ldns_pkt_answer(pkt)); + } else { + val[0] = '\0'; + } + break; + case MATCH_AUTHORITY: + if (ldns_pkt_nscount(pkt) > 0) { + free(val); + val = ldns_rr_list2str(ldns_pkt_authority(pkt)); + } else { + val[0] = '\0'; + } + break; + case MATCH_ADDITIONAL: + if (ldns_pkt_arcount(pkt) > 0) { + free(val); + val = ldns_rr_list2str(ldns_pkt_additional(pkt)); + } else { + val[0] = '\0'; + } + break; + default: + mt = get_match_by_id(id); + if (!mt) { + printf("ERROR UNKNOWN MATCH_TABLE ID %u\n", id); + exit(1); + } + printf("Matcher for %s not implemented yet\n", mt->name); + exit(1); + return NULL; + } + + return val; +} + +static bool +match_packet_to_operation(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_operation *operation) +{ + bool result; + char *val; + + if (!pkt || !operation) { + return false; + } else { + val = get_string_value(operation->id, pkt, src_addr, dst_addr); + if (!val) { + return false; + } + result = value_matches(operation->id, operation->operator, val, operation->value); + free(val); + return result; + } +} + +static int +match_operation_compare(const void *a, const void *b) +{ + match_operation *moa, *mob; + match_table *mt; + long ia, ib; + + if (!a) { + return 1; + } else if (!b) { + return -1; + } else { + moa = (match_operation *) a; + mob = (match_operation *) b; + + if (moa->id < mob->id) { + return -1; + } else if (moa->id > mob->id) { + return 1; + } else { + if (moa->operator < mob->operator) { + return -1; + } else if (moa->operator > mob->operator) { + return 1; + } else { + mt = get_match_by_id(moa->id); + if (mt) { + switch (mt->type) { + case TYPE_INT: + case TYPE_TIMESTAMP: + case TYPE_BOOL: + case TYPE_OPCODE: + case TYPE_RCODE: + ia = atol(moa->value); + ib = atol(mob->value); + return ia - ib; + break; + case TYPE_STRING: + case TYPE_ADDRESS: + case TYPE_RR: + default: + return strcmp(moa->value, mob->value); + break; + } + } else { + return strcmp(moa->value, mob->value); + } + } + } + } +} + +static int +match_expression_compare(const void *a, const void *b) +{ + match_expression *mea, *meb; + + if (!a) { + return 1; + } else if (!b) { + return -1; + } else { + mea = (match_expression *) a; + meb = (match_expression *) b; + + if (mea->op < meb->op) { + return -1; + } else if (mea->op > meb->op) { + return 1; + } else { + switch(mea->op) { + case MATCH_EXPR_AND: + case MATCH_EXPR_OR: + if (match_expression_compare(mea->left, meb->left) < 0) { + return -1; + } else if (match_expression_compare(mea->left, meb->left) > 0) { + return 1; + } else { + return match_expression_compare(mea->right, meb->right); + } + break; + case MATCH_EXPR_LEAF: + return match_operation_compare(mea->match, meb->match); + break; + default: + fprintf(stderr, "Unknown Match Expression logic operator: %u\n", mea->op); + exit(1); + } + } + } +} + +/** + * If count is true, and the counter is found, its count is increased by 1 + */ +static int +add_match_counter(match_counters *counters, + match_expression *expr, + bool count) +{ + int cmp; + match_counters *new; + + if (!counters || !expr) { + return -1; + } else { + if (counters->match) { + cmp = match_expression_compare(counters->match, + expr); + if (cmp > 0) { + if (counters->left) { + return add_match_counter(counters->left, + expr, + count); + } else { + new = malloc(sizeof(match_counters)); + new->left = NULL; + new->right = NULL; + new->match = expr; + counters->left = new; + return 0; + } + } else if (cmp < 0) { + if (counters->right) { + return add_match_counter(counters->right, + expr, + count); + } else { + new = malloc(sizeof(match_counters)); + new->left = NULL; + new->right = NULL; + new->match = expr; + counters->right = new; + return 0; + } + } else { + /* already there? */ + if (count) { + counters->match->count++; + } + return 1; + } + } else { + /* shouldn't happen but anyway */ + counters->match = expr; + } + } + return 0; +} + +static bool +match_dns_packet_to_expr(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_expression *expr) +{ + bool result; + + if (!pkt || !expr) { + return false; + } + + switch(expr->op) { + case MATCH_EXPR_OR: + result = (match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->left) || + match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->right)); + break; + case MATCH_EXPR_AND: + result = (match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->left) && + match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->right)); + break; + case MATCH_EXPR_LEAF: + result = match_packet_to_operation(pkt, src_addr, dst_addr, expr->match); + break; + default: + fprintf(stderr, "Error, unknown expression operator %u\n", expr->op); + fprintf(stderr, "full expression:\n"); + print_match_expression(stderr, expr); + fprintf(stderr, "\n"); + exit(1); + } + + if (result) { + if (verbosity >= 5) { + printf("Found Match:\n"); + print_match_expression(stdout, expr); + printf("\nCount now %u\n", (unsigned int) expr->count); + } + expr->count++; + } + + return result; +} + +static void +free_match_operation(match_operation *operation) +{ + if (operation) { + if (operation->value) { + free(operation->value); + } + free(operation); + } +} + +static void +free_match_expression(match_expression *expr) +{ + if (expr) { + switch(expr->op) { + case MATCH_EXPR_OR: + case MATCH_EXPR_AND: + free_match_expression(expr->left); + free_match_expression(expr->right); + break; + case MATCH_EXPR_LEAF: + free_match_operation(expr->match); + break; + } + free(expr); + } +} + +static void +free_counters(match_counters *counters) +{ + if (counters) { + if (counters->left) { + free_counters(counters->left); + } + if (counters->match) { + free_match_expression(counters->match); + } + if (counters->right) { + free_counters(counters->right); + } + free(counters); + } +} + +static void +match_pkt_counters(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_counters *counts) +{ + if (counts->left) { + match_pkt_counters(pkt, src_addr, dst_addr, counts->left); + } + if (counts->match) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, counts->match)) { +/* + counts->match->count++; +*/ + } + } + if (counts->right) { + match_pkt_counters(pkt, src_addr, dst_addr, counts->right); + } +} + +static void +match_pkt_uniques(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_counters *uniques, match_id unique_ids[], size_t unique_id_count) +{ + match_expression *me; + size_t i; + match_operation *mo; + int add_result; + + for (i = 0; i < unique_id_count; i++) { + mo = malloc(sizeof(match_operation)); + mo->id = unique_ids[i]; + mo->operator = OP_EQUAL; + mo->value = get_string_value(mo->id, pkt, src_addr, dst_addr); + + me = malloc(sizeof(match_expression)); + me->op = MATCH_EXPR_LEAF; + me->left = NULL; + me->right = NULL; + me->match = mo; + me->count = 1; + + add_result = add_match_counter(uniques, me, true); + /* if result=1 it was already found, so delete new one */ + if (add_result == 1) { + free_match_expression(me); + } + } + +#if 0 + size_t i, j; + bool found; + match_expression *me; + match_operation *mo; + + /* get the value, match uniques for that, if not match, add new */ + /* all unique values should be MATCH_EXPR_LEAF */ + found = false; + for (j = 0; j < uniques->size; j++) { + if (uniques->counter[j]->match->id == unique_ids[i]) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, uniques->counter[j])) { + found = true; + } + } + } + if (!found) { + mo = malloc(sizeof(match_operation)); + mo->id = unique_ids[i]; + mo->operator = OP_EQUAL; + mo->value = get_string_value(mo->id, pkt, src_addr, dst_addr); + + me = malloc(sizeof(match_expression)); + me->match = mo; + me->op = MATCH_EXPR_LEAF; + me->left = NULL; + me->right = NULL; + me->count = 1; + + add_counter(uniques, me); + } + } +#endif +} + +static match_expression * +parse_match_expression(char *string) +{ + match_expression *expr; + size_t i,j; + size_t leftstart, leftend = 0; + char *left_str, *op, *val; + match_table *mt; + match_operation *mo = NULL; + const type_operators *tos; + match_expression *result; + ldns_lookup_table *lt = NULL; + + /* remove whitespace */ + char *str = malloc(strlen(string) + 1); + + j = 0; + for (i = 0; i < strlen(string); i++) { + if(!isspace(string[i])) { + str[j] = string[i]; + j++; + } + } + str[j] = '\0'; + + expr = malloc(sizeof(match_expression)); + expr->left = NULL; + expr->right = NULL; + expr->match = NULL; + expr->count = 0; + leftstart = 0; + for (i = 0; i < strlen(str); i++) { + if (str[i] == '&') { + expr->op = MATCH_EXPR_AND; + if (!expr->left) { + left_str = malloc(leftend - leftstart + 2); + strncpy(left_str, &str[leftstart], leftend-leftstart+1); + left_str[leftend - leftstart + 1] = '\0'; + expr->left = parse_match_expression(left_str); + free(left_str); + } + expr->right = parse_match_expression(&str[i+1]); + if (expr->left && expr->right) { + result = expr; + goto done; + } else { + result = NULL; + goto done; + } + } else if (str[i] == '|') { + expr->op = MATCH_EXPR_OR; + if (!expr->left) { + left_str = malloc(leftend - leftstart + 2); + strncpy(left_str, &str[leftstart], leftend-leftstart+1); + left_str[leftend - leftstart + 1] = '\0'; + expr->left = parse_match_expression(left_str); + free(left_str); + } + expr->right = parse_match_expression(&str[i+1]); + expr->count = 0; + if (expr->left && expr->right) { + result = expr; + goto done; + } else { + result = NULL; + goto done; + } + } else if (str[i] == '(') { + leftstart = i + 1; + j = 1; + while (j > 0) { + i++; + if (i > strlen(str)) { + printf("parse error: no closing bracket: %s\n", str); + printf(" "); + for (j = 0; j < leftstart - 1; j++) { + printf(" "); + } + printf("^\n"); + result = NULL; + goto done; + } + if (str[i] == ')') { + j--; + } else if (str[i] == '(') { + j++; + } else { + } + } + leftend = i-1; + left_str = malloc(leftend - leftstart + 1); + strncpy(left_str, &str[leftstart], leftend - leftstart + 1); + expr->left = parse_match_expression(left_str); + free(left_str); + if (i >= strlen(str)-1) { + result = expr->left; + goto done; + } + } else if (str[i] == ')') { + printf("parse error: ) without (\n"); + result = NULL; + goto done; + } else { + leftend = i; + } + } + + /* no operators or hooks left, expr should be of the form + now */ + for (i = 0; i < strlen(str); i++) { + if (str[i] == '=' || + str[i] == '>' || + str[i] == '<' || + str[i] == '!' || + str[i] == '~' + ) { + leftend = i-1; + op = malloc(3); + j = 0; + op[j] = str[i]; + i++; + j++; + + if (i > strlen(str)) { + printf("parse error no right hand side: %s\n", str); + result = NULL; + goto done; + } + if (str[i] == '=' || + str[i] == '>' || + str[i] == '<' || + str[i] == '!' || + str[i] == '~' + ) { + op[j] = str[i]; + i++; + j++; + if (i > strlen(str)) { + printf("parse error no right hand side: %s\n", str); + result = NULL; + goto done; + } + } + op[j] = '\0'; + left_str = malloc(leftend - leftstart + 2); + strncpy(left_str, &str[leftstart], leftend - leftstart + 1); + left_str[leftend - leftstart + 1] = '\0'; + mt = get_match_by_name(left_str); + if (!mt) { + printf("parse error: unknown match name: %s\n", left_str); + result = NULL; + goto done; + } else { + /* check if operator is allowed */ + tos = get_type_operators(mt->type); + for (j = 0; j < tos->operator_count; j++) { + if (get_op_id(op) == tos->operators[j]) { + mo = malloc(sizeof(match_operation)); + mo->id = mt->id; + mo->operator = get_op_id(op); + switch (mt->type) { + case TYPE_BOOL: + val = malloc(2); + if (strncmp(&str[i], "true", 5) == 0 || + strncmp(&str[i], "TRUE", 5) == 0 || + strncmp(&str[i], "True", 5) == 0 || + strncmp(&str[i], "1", 2) == 0 + ) { + val[0] = '1'; + val[1] = '\0'; + } else if (strncmp(&str[i], "false", 5) == 0 || + strncmp(&str[i], "FALSE", 5) == 0 || + strncmp(&str[i], "False", 5) == 0 || + strncmp(&str[i], "0", 2) == 0 + ) { + + val[0] = '0'; + } else { + fprintf(stderr, "Bad value for bool: %s\n", &str[i]); + exit(EXIT_FAILURE); + } + val[1] = '\0'; + break; + case TYPE_RR: + /* convert first so we have the same strings for the same rrs in match_ later */ + /* + qrr = ldns_rr_new_frm_str(&str[i], LDNS_DEFAULT_TTL, NULL); + if (!qrr) { + fprintf(stderr, "Bad value for RR: %s\n", &str[i]); + exit(EXIT_FAILURE); + } + val = ldns_rr2str(qrr); + */ + /* remove \n for readability */ + /* + if (strchr(val, '\n')) { + *(strchr(val, '\n')) = '\0'; + } + ldns_rr_free(qrr); + */ + val = strdup(&str[i]); + break; + case TYPE_OPCODE: + lt = ldns_lookup_by_name(ldns_opcodes, &str[i]); + if (lt) { + val = malloc(4); + snprintf(val, 3, "%u", (unsigned int) lt->id); + } else { + val = strdup(&str[i]); + } + break; + case TYPE_RCODE: + lt = ldns_lookup_by_name(ldns_rcodes, &str[i]); + if (lt) { + val = malloc(4); + snprintf(val, 3, "%u", (unsigned int) lt->id); + } else { + val = strdup(&str[i]); + } + break; + default: + val = strdup(&str[i]); + break; + } + mo->value = val; + } + } + if (!mo) { + printf("parse error: operator %s not allowed for match %s\n", op, left_str); + result = NULL; + goto done; + } + } + free(left_str); + free(op); + expr->match = mo; + expr->op = MATCH_EXPR_LEAF; + result = expr; + goto done; + } + } + + result = NULL; + + done: + free(str); + if (!result) { + free_match_expression(expr); + } + return result; + +} +/* end of matches and counts */ +void +usage(FILE *output) +{ + fprintf(output, "Usage: ldns-dpa [OPTIONS] \n"); + fprintf(output, "Options:\n"); + fprintf(output, "\t-c :\tCount occurrences of matching expressions\n"); + fprintf(output, "\t-f :\tFilter occurrences of matching expressions\n"); + fprintf(output, "\t-h:\t\tshow this help\n"); + fprintf(output, "\t-p:\t\tshow percentage of -u and -c values (of the total of\n\t\t\tmatching on the -f filter. if no filter is given,\n\t\t\tpercentages are on all correct dns packets)\n"); + fprintf(output, "\t-of :\tWrite pcap packets that match the -f flag to file\n"); + fprintf(output, "\t-ofh :\tWrite pcap packets that match the -f flag to file\n\t\tin a hexadecimal format readable by drill\n"); + fprintf(output, "\t-s:\t\tshow possible match names\n"); + fprintf(output, "\t-s :\tshow possible match operators and values for \n"); + fprintf(output, "\t-sf:\t\tPrint packet that match -f. If no -f is given, print\n\t\t\tall dns packets\n"); + fprintf(output, "\t-u :\tCount all occurrences of matchname\n"); + fprintf(output, "\t-ua:\t\tShow average value of every -u matchname\n"); + fprintf(output, "\t-uac:\t\tShow average count of every -u matchname\n"); + fprintf(output, "\t-um :\tOnly show -u results that occured more than number times\n"); + fprintf(output, "\t-v :\tbe more verbose\n"); + fprintf(output, "\t-notip :\tDump pcap packets that were not recognized as\n\t\t\tIP packets to file\n"); + fprintf(output, "\t-baddns :\tDump mangled dns packets to file\n"); + fprintf(output, "\t-version:\tShow the version and exit\n"); + fprintf(output, "\n"); + fprintf(output, "The filename '-' stands for stdin or stdout, so you can use \"-of -\" if you want to pipe the output to another process\n"); + fprintf(output, "\n"); + fprintf(output, "A is a comma separated list of items\n"); + fprintf(output, "\n"); + fprintf(output, "An expression has the following form:\n"); + fprintf(output, ":\t()\n"); + fprintf(output, "\t | \n"); + fprintf(output, "\t & \n"); + fprintf(output, "\t\n"); + fprintf(output, "\n"); + fprintf(output, ":\t \n"); + fprintf(output, "\n"); + fprintf(output, "See the -s option for possible matchnames, operators and values.\n"); +} + +void +show_match_names(char *name) +{ + size_t j; + match_table *mt; + ldns_lookup_table *lt; + const type_operators *tos; + char *str; + size_t i; + + if (name) { + mt = get_match_by_name(name); + if (mt) { + printf("%s:\n", mt->name); + printf("\t%s.\n", mt->description); + printf("\toperators: "); + printf("\t"); + tos = get_type_operators(mt->type); + if (tos) { + for (j = 0; j < tos->operator_count; j++) { + printf("%s ", get_op_str(tos->operators[j])); +/* + lt = ldns_lookup_by_id((ldns_lookup_table *) lt_operators, tos->operators[j]); + if (lt) { + printf("%s ", lt->name); + } else { + printf("? "); + } +*/ + } + } else { + printf("unknown type"); + } + + printf("\n"); + printf("\tValues:\n"); + switch (mt->type) { + case TYPE_INT: + printf("\t\t\n"); + break; + case TYPE_BOOL: + printf("\t\t0\n"); + printf("\t\t1\n"); + printf("\t\ttrue\n"); + printf("\t\tfalse\n"); + break; + case TYPE_OPCODE: + printf("\t\t\n"); + lt = ldns_opcodes; + while (lt->name != NULL) { + printf("\t\t%s\n", lt->name); + lt++; + } + break; + case TYPE_RCODE: + printf("\t\t\n"); + lt = ldns_rcodes; + while (lt->name != NULL) { + printf("\t\t%s\n", lt->name); + lt++; + } + break; + case TYPE_STRING: + printf("\t\t\n"); + break; + case TYPE_TIMESTAMP: + printf("\t\t (seconds since epoch)\n"); + break; + case TYPE_ADDRESS: + printf("\t\t\n"); + break; + case TYPE_RR: + printf("\t\t\n"); + break; + default: + break; + } + } else { + printf("Unknown match name: %s\n", name); + } + } else { + mt = (match_table *) matches; + while (mt->name != NULL) { + str = (char *) mt->name; + printf("%s:", str); + i = strlen(str) + 1; + while (i < 24) { + printf(" "); + i++; + } + printf("%s\n", mt->description); + mt++; + } + } +} + +int +handle_ether_packet(const u_char *data, struct pcap_pkthdr cur_hdr, match_counters *count, match_expression *match_expr, match_counters *uniques, match_id unique_ids[], size_t unique_id_count) +{ + struct ether_header *eptr; + struct ip *iptr; + struct ip6_hdr *ip6_hdr; + int ip_hdr_size; + uint8_t protocol; + size_t data_offset = 0; + ldns_rdf *src_addr, *dst_addr; + uint8_t *ap; + char *astr; + bpf_u_int32 len = cur_hdr.caplen; + struct timeval timestamp; + uint16_t ip_flags; + uint16_t ip_len; + uint16_t ip_id; + uint16_t ip_f_offset; + const u_char *newdata = NULL; +/* +printf("timeval: %u ; %u\n", cur_hdr.ts.tv_sec, cur_hdr.ts.tv_usec); +*/ + + uint8_t *dnspkt; + + ldns_pkt *pkt; + ldns_status status; + + /* lets start with the ether header... */ + eptr = (struct ether_header *) data; + /* Do a couple of checks to see what packet type we have..*/ + if (ntohs (eptr->ether_type) == ETHERTYPE_IP) + { + if (verbosity >= 5) { + printf("Ethernet type hex:%x dec:%u is an IP packet\n", + (unsigned int) ntohs(eptr->ether_type), + (unsigned int) ntohs(eptr->ether_type)); + } + + data_offset = ETHER_HEADER_LENGTH; + iptr = (struct ip *) (data + data_offset); + /* + printf("IP_OFF: %u (%04x) %04x %04x (%d) (%d)\n", iptr->ip_off, iptr->ip_off, IP_MF, IP_DF, iptr->ip_off & 0x4000, iptr->ip_off & 0x2000); + */ + ip_flags = ldns_read_uint16(&(iptr->ip_off)); + ip_id = ldns_read_uint16(&(iptr->ip_id)); + ip_len = ldns_read_uint16(&(iptr->ip_len)); + ip_f_offset = (ip_flags & IP_OFFMASK)*8; + if (ip_flags & IP_MF && ip_f_offset == 0) { + /*printf("First Frag id %u len\n", ip_id, ip_len);*/ + fragment_p->ip_id = ip_id; + memset(fragment_p->data, 0, 65535); + memcpy(fragment_p->data, iptr, ip_len); + fragment_p->cur_len = ip_len + 20; +/* + for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", ip_len - 19, ip_len); + } + printf("%02x ", fragment_p->data[ip_len]); + } + printf("\t; ??? - %u\n", ip_len); +*/ + return 0; + } else + if (ip_flags & IP_MF && ip_f_offset != 0) { + /*printf("Next frag\n");*/ + if (ip_id == fragment_p->ip_id) { + /*printf("add fragment to current id %u len %u offset %u\n", ip_id, ip_len, ip_f_offset);*/ + memcpy(fragment_p->data + (ip_f_offset) + 20, data+data_offset+20, ip_len - (iptr->ip_hl)*4); + /*printf("COPIED %u\n", ip_len);*/ + fragment_p->cur_len = fragment_p->cur_len + ip_len - 20; + /*printf("cur len now %u\n", fragment_p->cur_len);*/ +/* + for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", ip_len - 19, ip_len); + } + printf("%02x ", fragment_p->data[ip_len]); + } + printf("\t; ??? - %u\n", ip_len); +*/ + return 0; + } else { + /*printf("Lost fragment %u\n", iptr->ip_id);*/ + lost_packet_fragments++; + return 1; + } + } else + if (!(ip_flags & IP_MF) && ip_f_offset != 0) { + /*printf("Last frag\n");*/ + if (ip_id == fragment_p->ip_id) { + /*printf("add fragment to current id %u len %u offset %u\n", ip_id, ip_len, ip_f_offset);*/ + memcpy(fragment_p->data + ip_f_offset + 20, data+data_offset+20, ip_len - 20); + fragment_p->cur_len = fragment_p->cur_len + ip_len - 20; + iptr = (struct ip *) fragment_p->data; + newdata = malloc(fragment_p->cur_len + data_offset); + if (!newdata) { + printf("Malloc failed, out of mem?\n"); + exit(4); + } + memcpy((char *) newdata, data, data_offset); + memcpy((char *) newdata+data_offset, fragment_p->data, fragment_p->cur_len); + iptr->ip_len = (u_short) ldns_read_uint16(&(fragment_p->cur_len)); + iptr->ip_off = 0; + len = (bpf_u_int32) fragment_p->cur_len; + cur_hdr.caplen = len; + fragment_p->ip_id = 0; + fragmented_packets++; +/* + for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", ip_len - 19, ip_len); + } + printf("%02x ", fragment_p->data[ip_len]); + } + printf("\t; ??? - %u\n", ip_len); +*/ + } else { + /*printf("Lost fragment %u\n", iptr->ip_id);*/ + lost_packet_fragments++; + return 1; + } + } else { + newdata = data; + } +/* + if (iptr->ip_off & 0x0040) { + printf("Don't fragment\n"); + } +*/ + + /* in_addr portability woes, going manual for now */ + /* ipv4 */ + ap = (uint8_t *) &(iptr->ip_src); + astr = malloc(INET_ADDRSTRLEN); + if (inet_ntop(AF_INET, ap, astr, INET_ADDRSTRLEN)) { + if (ldns_str2rdf_a(&src_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + ap = (uint8_t *) &(iptr->ip_dst); + astr = malloc(INET_ADDRSTRLEN); + if (inet_ntop(AF_INET, ap, astr, INET_ADDRSTRLEN)) { + if (ldns_str2rdf_a(&dst_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + + ip_hdr_size = (int) iptr->ip_hl * 4; + protocol = (uint8_t) iptr->ip_p; + + data_offset += ip_hdr_size; + + if (protocol == IPPROTO_UDP) { + udp_packets++; + data_offset += UDP_HEADER_LENGTH; + + dnspkt = (uint8_t *) (newdata + data_offset); + + /*printf("packet starts at byte %u\n", data_offset);*/ + + /*printf("Len: %u\n", len);*/ + + status = ldns_wire2pkt(&pkt, dnspkt, len - data_offset); + + if (status != LDNS_STATUS_OK) { + if (verbosity >= 3) { + printf("No dns packet: %s\n", ldns_get_errorstr_by_id(status)); + } + if (verbosity >= 5) { + for (ip_len = 0; ip_len < len - data_offset; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", (unsigned int) ip_len - 19, (unsigned int) ip_len); + } + printf("%02x ", (unsigned int) dnspkt[ip_len]); + } + printf("\t; ??? - %u\n", (unsigned int) ip_len); + + } + bad_dns_packets++; + if (bad_dns_dump) { + pcap_dump((u_char *)bad_dns_dump, &cur_hdr, newdata); + } + } else { + timestamp.tv_sec = cur_hdr.ts.tv_sec; + timestamp.tv_usec = cur_hdr.ts.tv_usec; + ldns_pkt_set_timestamp(pkt, timestamp); + + if (verbosity >= 4) { + printf("DNS packet\n"); + ldns_pkt_print(stdout, pkt); + printf("\n\n"); + } + + total_nr_of_dns_packets++; + + if (match_expr) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, match_expr)) { + /* if outputfile write */ + if (dumper) { + pcap_dump((u_char *)dumper, &cur_hdr, data); + } + if (hexdumpfile) { + fprintf(hexdumpfile, ";; %u\n", (unsigned int) total_nr_of_dns_packets); + ldns_pkt2file_hex(hexdumpfile, pkt); + } + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } else { + ldns_pkt_free(pkt); + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + return 0; + } + } else { + if (dumper) { + pcap_dump((u_char *)dumper, &cur_hdr, data); + } + if (hexdumpfile) { + fprintf(hexdumpfile, ";; %u\n", (unsigned int) total_nr_of_dns_packets); + ldns_pkt2file_hex(hexdumpfile, pkt); + } + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } + + /* General counters here */ + total_nr_of_filtered_packets++; + + match_pkt_counters(pkt, src_addr, dst_addr, count); + match_pkt_uniques(pkt, src_addr, dst_addr, uniques, unique_ids, unique_id_count); + + ldns_pkt_free(pkt); + pkt = NULL; + } + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + + } else if (protocol == IPPROTO_TCP) { + /* tcp packets are skipped */ + tcp_packets++; + } + /* don't have a define for ethertype ipv6 */ + } else if (ntohs (eptr->ether_type) == ETHERTYPE_IPV6) { + /*printf("IPv6!\n");*/ + + + /* copied from ipv4, move this to function? */ + + data_offset = ETHER_HEADER_LENGTH; + ip6_hdr = (struct ip6_hdr *) (data + data_offset); + + newdata = data; + + /* in_addr portability woes, going manual for now */ + /* ipv6 */ + ap = (uint8_t *) &(ip6_hdr->ip6_src); + astr = malloc(INET6_ADDRSTRLEN); + if (inet_ntop(AF_INET6, ap, astr, INET6_ADDRSTRLEN)) { + if (ldns_str2rdf_aaaa(&src_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + ap = (uint8_t *) &(ip6_hdr->ip6_dst); + astr = malloc(INET6_ADDRSTRLEN); + if (inet_ntop(AF_INET6, ap, astr, INET6_ADDRSTRLEN)) { + if (ldns_str2rdf_aaaa(&dst_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + + ip_hdr_size = IP6_HEADER_LENGTH; + protocol = (uint8_t) ip6_hdr->ip6_ctlun.ip6_un1.ip6_un1_nxt; + + data_offset += ip_hdr_size; + + if (protocol == IPPROTO_UDP) { + udp_packets++; + /*printf("V6 UDP!\n");*/ + data_offset += UDP_HEADER_LENGTH; + + dnspkt = (uint8_t *) (newdata + data_offset); + + /*printf("Len: %u\n", len);*/ + + status = ldns_wire2pkt(&pkt, dnspkt, len - data_offset); + + if (status != LDNS_STATUS_OK) { + if (verbosity >= 3) { + printf("No dns packet: %s\n", ldns_get_errorstr_by_id(status)); + } + bad_dns_packets++; + if (bad_dns_dump) { + pcap_dump((u_char *)bad_dns_dump, &cur_hdr, newdata); + } + } else { + timestamp.tv_sec = cur_hdr.ts.tv_sec; + timestamp.tv_usec = cur_hdr.ts.tv_usec; + ldns_pkt_set_timestamp(pkt, timestamp); + + if (verbosity >= 4) { + printf("DNS packet\n"); + ldns_pkt_print(stdout, pkt); + printf("\n\n"); + } + + total_nr_of_dns_packets++; + + if (match_expr) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, match_expr)) { + /* if outputfile write */ + if (dumper) { + pcap_dump((u_char *)dumper, &cur_hdr, data); + } + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } else { + ldns_pkt_free(pkt); + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + return 0; + } + } else { + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } + + /* General counters here */ + total_nr_of_filtered_packets++; + + match_pkt_counters(pkt, src_addr, dst_addr, count); + match_pkt_uniques(pkt, src_addr, dst_addr, uniques, unique_ids, unique_id_count); + + ldns_pkt_free(pkt); + pkt = NULL; + } + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + + } else if (protocol == IPPROTO_TCP) { + /* tcp packets are skipped */ + tcp_packets++; + } else { + printf("ipv6 unknown next header type: %u\n", (unsigned int) protocol); + } + + + + } else if (ntohs (eptr->ether_type) == ETHERTYPE_ARP) { + if (verbosity >= 5) { + printf("Ethernet type hex:%x dec:%u is an ARP packet\n", + (unsigned int) ntohs(eptr->ether_type), + (unsigned int) ntohs(eptr->ether_type)); + } + arp_packets++; + } else { + printf("Ethernet type %x not IP\n", (unsigned int) ntohs(eptr->ether_type)); + if (verbosity >= 5) { + printf("Ethernet type %x not IP\n", (unsigned int) ntohs(eptr->ether_type)); + } + not_ip_packets++; + if (not_ip_dump) { + pcap_dump((u_char *)not_ip_dump, &cur_hdr, data); + } + } + + return 0; +} + +bool +parse_match_list(match_counters *counters, char *string) +{ + size_t i; + match_expression *expr; +/* match_counter *mc;*/ + size_t lastpos = 0; + char *substring; + + /*printf("Parsing match list: '%s'\n", string);*/ + + for (i = 0; i < strlen(string); i++) { + if (string[i] == ',') { + if (i<2) { + fprintf(stderr, "Matchlist cannot start with ,\n"); + return false; + } else { + substring = malloc(strlen(string)+1); + strncpy(substring, &string[lastpos], i - lastpos + 1); + substring[i - lastpos] = '\0'; + expr = parse_match_expression(substring); + if (!expr) { + return false; + } + free(substring); + /* + if (expr->op != MATCH_EXPR_LEAF) { + fprintf(stderr, "Matchlist can only contain , not a logic expression\n"); + return false; + } + */ + add_match_counter(counters, expr, false); + lastpos = i+1; + } + } + } + substring = malloc(strlen(string) + 1); + strncpy(substring, &string[lastpos], i - lastpos + 1); + substring[i - lastpos] = '\0'; + expr = parse_match_expression(substring); + + if (!expr) { + fprintf(stderr, "Bad match: %s\n", substring); + return false; + } + free(substring); + /* + if (expr->op != MATCH_EXPR_LEAF) { + fprintf(stderr, "Matchlist can only contain , not a logic expression\n"); + return false; + } + */ + add_match_counter(counters, expr, false); + return true; +} + +bool +parse_uniques(match_id ids[], size_t *count, char *string) +{ + size_t i, j, lastpos; + char *str, *strpart; + match_table *mt; + + /*printf("Parsing unique counts: '%s'\n", string);*/ + str = malloc(strlen(string) + 1); + j = 0; + for (i = 0; i < strlen(string); i++) { + if (!isspace(string[i])) { + str[j] = string[i]; + j++; + } + } + str[j] = '\0'; + + lastpos = 0; + for (i = 0; i <= strlen(str); i++) { + if (str[i] == ',' || i >= strlen(str)) { + strpart = malloc(i - lastpos + 1); + strncpy(strpart, &str[lastpos], i - lastpos); + strpart[i - lastpos] = '\0'; + if ((mt = get_match_by_name(strpart))) { + ids[*count] = mt->id; + *count = *count + 1; + } else { + printf("Error parsing match list; unknown match name: %s\n", strpart); + return false; + } + free(strpart); + lastpos = i + 1; + } + } + if (i > lastpos) { + strpart = malloc(i - lastpos + 1); + strncpy(strpart, &str[lastpos], i - lastpos); + strpart[i - lastpos] = '\0'; + if ((mt = get_match_by_name(strpart))) { + ids[*count] = mt->id; + *count = *count + 1; + } else { + printf("Error parsing match list; unknown match name: %s\n", strpart); + return false; + } + free(strpart); + lastpos = i + 1; + } + free(str); + return true; +} + +int main(int argc, char *argv[]) { + + int i; + int status = EXIT_SUCCESS; + match_counters *count = malloc(sizeof(match_counters)); + const char *inputfile = NULL; + char errbuf[PCAP_ERRBUF_SIZE]; + pcap_t *pc = NULL; + const u_char *cur; + struct pcap_pkthdr cur_hdr; + match_expression *expr = NULL; + match_id unique_ids[MAX_MATCHES]; + size_t unique_id_count = 0; /* number of unique counters */ + match_counters *uniques = malloc(sizeof(match_counters)); + char *dumpfile = NULL; + char *hexdumpfilename = NULL; + char *not_ip_dumpfile = NULL; + char *bad_dns_dumpfile = NULL; + + bool show_percentages = false; + bool show_averages = false; + bool show_average_count = false; + int unique_minimum = 0; + + count->left = NULL; + count->match = NULL; + count->right = NULL; + uniques->left = NULL; + uniques->match = NULL; + uniques->right = NULL; + + fragment_p = malloc(sizeof(struct fragment_part)); + fragment_p->ip_id = 0; + fragment_p->cur_len = 0; + + for (i = 1; i < argc; i++) { + + if (strncmp(argv[i], "-baddns", 8) == 0) { + if (i + 1 < argc) { + bad_dns_dumpfile = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-notip", 7) == 0) { + if (i + 1 < argc) { + not_ip_dumpfile = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-c", 3) == 0) { + if (i + 1 < argc) { + if (!parse_match_list(count, argv[i + 1])) { + status = EXIT_FAILURE; + goto exit; + } + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-f", 3) == 0) { + if (i + 1 < argc) { + if (expr || strchr(argv[i+1], ',')) { + fprintf(stderr, "You can only specify 1 filter expression.\n"); + status = EXIT_FAILURE; + goto exit; + } + expr = parse_match_expression(argv[i + 1]); + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-h", 3) == 0) { + usage(stdout); + status = EXIT_SUCCESS; + goto exit; + } else if (strncmp(argv[i], "-p", 3) == 0) { + show_percentages = true; + } else if (strncmp(argv[i], "-of", 4) == 0) { + if (i + 1 < argc) { + dumpfile = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-ofh", 5) == 0) { + if (i + 1 < argc) { + hexdumpfilename = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-s", 3) == 0) { + if (i + 1 < argc) { + show_match_names(argv[i + 1]); + } else { + show_match_names(NULL); + } + status = EXIT_SUCCESS; + goto exit; + } else if (strncmp(argv[i], "-sf", 4) == 0) { + show_filter_matches = true; + } else if (strncmp(argv[i], "-u", 3) == 0) { + if (i + 1 < argc) { + if (!parse_uniques(unique_ids, &unique_id_count, argv[i + 1])) { + status = EXIT_FAILURE; + goto exit; + } + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strcmp("-ua", argv[i]) == 0) { + show_averages = true; + } else if (strcmp("-uac", argv[i]) == 0) { + show_average_count = true; + } else if (strcmp("-um", argv[i]) == 0) { + if (i + 1 < argc) { + unique_minimum = atoi(argv[i+1]); + i++; + } else { + fprintf(stderr, "-um requires an argument"); + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strcmp("-v", argv[i]) == 0) { + i++; + if (i < argc) { + verbosity = atoi(argv[i]); + } + } else if (strcmp("-version", argv[i]) == 0) { + printf("dns packet analyzer, version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); + goto exit; + } else { + if (inputfile) { + fprintf(stderr, "You can only specify 1 input file\n"); + exit(1); + } + inputfile = argv[i]; + } + } + + if (!inputfile) { + inputfile = "-"; + } + + if (verbosity >= 5) { + printf("Filter:\n"); + print_match_expression(stdout, expr); + printf("\n\n"); + } + + pc = pcap_open_offline(inputfile, errbuf); + + if (!pc) { + if (errno != 0) { + printf("Error opening pcap file %s: %s\n", inputfile, errbuf); + exit(1); + } else { + goto showresult; + } + } + + if (dumpfile) { + dumper = pcap_dump_open(pc, dumpfile); + + if (!dumper) { + printf("Error opening pcap dump file %s: %s\n", dumpfile, errbuf); + exit(1); + } + } + + if (hexdumpfilename) { + if (strncmp(hexdumpfilename, "-", 2) != 0) { + printf("hexdump is file\n"); + hexdumpfile = fopen(hexdumpfilename, "w"); + } else { + printf("hexdump is stdout\n"); + hexdumpfile = stdout; + } + + if (!hexdumpfile) { + printf("Error opening hex dump file %s: %s\n", hexdumpfilename, strerror(errno)); + exit(1); + } + } + + if (not_ip_dumpfile) { + not_ip_dump = pcap_dump_open(pc, not_ip_dumpfile); + if (!not_ip_dump) { + printf("Error opening pcap dump file NOT_IP: %s\n", errbuf); + } + } + if (bad_dns_dumpfile) { + bad_dns_dump = pcap_dump_open(pc, bad_dns_dumpfile); + if (!bad_dns_dump) { + printf("Error opening pcap dump file NOT_IP: %s\n", errbuf); + } + } + + while ((cur = pcap_next(pc, &cur_hdr))) { + if (verbosity >= 5) { + printf("\n\n\n[PKT_HDR] caplen: %u \tlen: %u\n", cur_hdr.caplen, cur_hdr.len); + } + handle_ether_packet(cur, cur_hdr, count, expr, uniques, unique_ids, unique_id_count); + } + + if (not_ip_dump) { + pcap_dump_close(not_ip_dump); + } + + if (bad_dns_dump) { + pcap_dump_close(bad_dns_dump); + } + + if (dumper) { + pcap_dump_close(dumper); + } + + if (hexdumpfile && hexdumpfile != stdout) { + fclose(hexdumpfile); + } + + pcap_close(pc); + + showresult: + if (show_percentages) { + fprintf(stdout, "Packets that are not IP: %u\n", (unsigned int) not_ip_packets); + fprintf(stdout, "bad dns packets: %u\n", (unsigned int) bad_dns_packets); + fprintf(stdout, "arp packets: %u\n", (unsigned int) arp_packets); + fprintf(stdout, "udp packets: %u\n", (unsigned int) udp_packets); + fprintf(stdout, "tcp packets (skipped): %u\n", (unsigned int) tcp_packets); + fprintf(stdout, "reassembled fragmented packets: %u\n", (unsigned int) fragmented_packets); + fprintf(stdout, "packet fragments lost: %u\n", (unsigned int) lost_packet_fragments); + fprintf(stdout, "Total number of DNS packets: %u\n", (unsigned int) total_nr_of_dns_packets); + fprintf(stdout, "Total number of DNS packets after filter: %u\n", (unsigned int) total_nr_of_filtered_packets); + } + if (count->match) { + print_counters(stdout, count, show_percentages, total_nr_of_filtered_packets, 0); + } + if (uniques->match) { + print_counters(stdout, uniques, show_percentages, total_nr_of_filtered_packets, unique_minimum); + if (show_averages) { + print_counter_averages(stdout, uniques, NULL); + } + if (show_average_count) { + print_counter_average_count(stdout, uniques, NULL, true); + } + } + + exit: + + free_match_expression(expr); + free_counters(count); + free_counters(uniques); + + return status; +} + +#else +int main() { + fprintf(stderr, "ldns-dpa was not built because there is no pcap library on this system, or there was no pcap header file at compilation time. Please install pcap and rebuild.\n"); + return 1; +} +#endif +#else +int main() { + fprintf(stderr, "ldns-dpa was not built because there is no pcap library on this system, or there was no pcap header file at compilation time. Please install pcap and rebuild.\n"); + return 1; +} +#endif + + diff --git a/libs/ldns/examples/ldns-key2ds.1 b/libs/ldns/examples/ldns-key2ds.1 new file mode 100644 index 0000000000..6fdbee5f1a --- /dev/null +++ b/libs/ldns/examples/ldns-key2ds.1 @@ -0,0 +1,41 @@ +.TH ldns-key2ds 1 "30 May 2005" +.SH NAME +ldns-key2ds \- transform a DNSKEY RR to a DS RR +.SH SYNOPSIS +.B ldns-key2ds +.IR file + +.SH DESCRIPTION +\fBldns-key2ds\fR is used to transform a public DNSKEY RR to a DS RR. +When run it will read \fIfile\fR with a DNSKEY RR in it and +it will create a .ds file with the DS RR in it. + +It prints out the basename for this file (K++). + +By default it takes a pick of algorithm similar to the key algorithm, +SHA1 for RSASHA1, and so on. + +.SH OPTIONS +.TP +\fB-n\fR +Write the result DS Resource Record to stdout instead of a file + +.TP +\fB-1\fR +Use SHA1 as the hash function. + +.TP +\fB-2\fR +Use SHA256 as the hash function + + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-key2ds.c b/libs/ldns/examples/ldns-key2ds.c new file mode 100644 index 0000000000..a3e54383ab --- /dev/null +++ b/libs/ldns/examples/ldns-key2ds.c @@ -0,0 +1,199 @@ +/* + * key2ds transforms a public key into its DS + * It (currently) prints out the public key + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +#include + +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s [-fn] [-1|-2] keyfile\n", prog); + fprintf(fp, " Generate a DS RR from the DNSKEYS in keyfile\n"); + fprintf(fp, " The following file will be created: "); + fprintf(fp, "K++.ds\n"); + fprintf(fp, " The base name (K++ will be printed to stdout\n"); + fprintf(fp, "Options:\n"); + fprintf(fp, " -f: ignore SEP flag (i.e. make DS records for any key)\n"); + fprintf(fp, " -n: do not write DS records to file(s) but to stdout\n"); + fprintf(fp, " (default) use similar hash to the key algorithm.\n"); + fprintf(fp, " -1: use SHA1 for the DS hash\n"); + fprintf(fp, " -2: use SHA256 for the DS hash\n"); +#ifdef USE_GOST + fprintf(fp, " -g: use GOST for the DS hash\n"); +#endif +#ifdef USE_ECDSA + fprintf(fp, " -4: use SHA384 for the DS hash\n"); +#endif +} + +static int +is_suitable_dnskey(ldns_rr *rr, int sep_only) +{ + if (!rr || ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) { + return 0; + } + return !sep_only || + (ldns_rdf2native_int16(ldns_rr_dnskey_flags(rr)) & + LDNS_KEY_SEP_KEY); +} + +static ldns_hash +suitable_hash(ldns_signing_algorithm algorithm) +{ + switch (algorithm) { + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + return LDNS_SHA256; + case LDNS_SIGN_ECC_GOST: +#ifdef USE_GOST + return LDNS_HASH_GOST; +#else + return LDNS_SHA256; +#endif +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + return LDNS_SHA256; + case LDNS_SIGN_ECDSAP384SHA384: + return LDNS_SHA384; +#endif + default: + return LDNS_SHA1; + } + return LDNS_SHA1; +} + +int +main(int argc, char *argv[]) +{ + FILE *keyfp, *dsfp; + char *keyname; + char *dsname; + char *owner; + ldns_rr *k, *ds; + ldns_signing_algorithm alg; + ldns_hash h; + int similar_hash=1; + char *program = argv[0]; + int nofile = 0; + ldns_rdf *origin = NULL; + ldns_status result = LDNS_STATUS_OK; + int sep_only = 1; + + alg = 0; + h = LDNS_SHA1; + + argv++, argc--; + while (argc && argv[0][0] == '-') { + if (strcmp(argv[0], "-1") == 0) { + h = LDNS_SHA1; + similar_hash = 0; + } + if (strcmp(argv[0], "-2") == 0) { + h = LDNS_SHA256; + similar_hash = 0; + } +#ifdef USE_GOST + if (strcmp(argv[0], "-g") == 0) { + if(!ldns_key_EVP_load_gost_id()) { + fprintf(stderr, "error: libcrypto does not provide GOST\n"); + exit(EXIT_FAILURE); + } + h = LDNS_HASH_GOST; + similar_hash = 0; + } +#endif +#ifdef USE_ECDSA + if (strcmp(argv[0], "-4") == 0) { + h = LDNS_SHA384; + similar_hash = 0; + } +#endif + if (strcmp(argv[0], "-f") == 0) { + sep_only = 0; + } + if (strcmp(argv[0], "-n") == 0) { + nofile=1; + } + argv++, argc--; + } + + if (argc != 1) { + usage(stderr, program); + exit(EXIT_FAILURE); + } + keyname = strdup(argv[0]); + + keyfp = fopen(keyname, "r"); + if (!keyfp) { + fprintf(stderr, "Failed to open public key file %s: %s\n", keyname, + strerror(errno)); + exit(EXIT_FAILURE); + } + + while (result == LDNS_STATUS_OK) { + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + while (result == LDNS_STATUS_SYNTAX_ORIGIN || + result == LDNS_STATUS_SYNTAX_TTL || + (result == LDNS_STATUS_OK && !is_suitable_dnskey(k, sep_only)) + ) { + if (result == LDNS_STATUS_OK) { + ldns_rr_free(k); + } + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + } + if (result == LDNS_STATUS_SYNTAX_EMPTY) { + /* we're done */ + break; + } + if (result != LDNS_STATUS_OK) { + fprintf(stderr, "Could not read public key from file %s: %s\n", keyname, ldns_get_errorstr_by_id(result)); + exit(EXIT_FAILURE); + } + + owner = ldns_rdf2str(ldns_rr_owner(k)); + alg = ldns_rdf2native_int8(ldns_rr_dnskey_algorithm(k)); + if(similar_hash) + h = suitable_hash(alg); + + ds = ldns_key_rr2ds(k, h); + if (!ds) { + fprintf(stderr, "Conversion to a DS RR failed\n"); + ldns_rr_free(k); + free(owner); + exit(EXIT_FAILURE); + } + + /* print the public key RR to .key */ + dsname = LDNS_XMALLOC(char, strlen(owner) + 16); + snprintf(dsname, strlen(owner) + 15, "K%s+%03u+%05u.ds", owner, alg, (unsigned int) ldns_calc_keytag(k)); + + if (nofile) + ldns_rr_print(stdout,ds); + else { + dsfp = fopen(dsname, "w"); + if (!dsfp) { + fprintf(stderr, "Unable to open %s: %s\n", dsname, strerror(errno)); + exit(EXIT_FAILURE); + } else { + ldns_rr_print(dsfp, ds); + fclose(dsfp); + fprintf(stdout, "K%s+%03u+%05u\n", owner, alg, (unsigned int) ldns_calc_keytag(k)); + } + } + + ldns_rr_free(ds); + ldns_rr_free(k); + free(owner); + LDNS_FREE(dsname); + } + fclose(keyfp); + free(keyname); + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-keyfetcher.1 b/libs/ldns/examples/ldns-keyfetcher.1 new file mode 100644 index 0000000000..6ddc14eacf --- /dev/null +++ b/libs/ldns/examples/ldns-keyfetcher.1 @@ -0,0 +1,64 @@ +.TH ldns-keyfetcher 1 "4 Apr 2006" +.SH NAME +ldns-keyfetcher \- retrieve the DNSSEC DNSKEYs for a zone +.SH SYNOPSIS +.B ldns-keyfetcher +[ +.IR OPTIONS +] +.IR DOMAIN + +.SH DESCRIPTION +\fBldns-keyfetcher\fR is used to retrieve the DNSKEYs of a zone. + +First it finds all authoritative nameservers of the zone by tracing it from +the root down. All authoritative nameservers are then queried (using TCP) +for the DNSKEY RRset of the zone apex. If the results are all the same, +the key resource record set is printed. + + +.SH OPTIONS +\fB-4\fR \fI\fR +Only use IPv4 + +\fB-6\fR \fI\fR +Only use IPv6 + +\fB-h\fR \fI\fR +Show a help text and exit + +\fB-i\fR +Insecurer mode; there will only be one query for the DNSKEYS. There will not +be crosschecking of all authoritative nameservers. + +\fB-v\fR \fIverbosity\fR + +Set the verbosity level. The following levels are available: + + 0: default, only print the DNSKEY RRset found, or an error on failure. + 1: Show the nameservers that are queried + 2: Show more info on what is checked + 3: Show the intermediate results (authority and dnskey rrsets) + 4: Print the answer packets that are returned + +\fB-r\fR \fIfile\fR + +Use file as the root hints file, should contain A records in presentation +format. The default is /etc/named.root. You can get this file from +http://www.internic.net/zones/named.root. + +\fB-s\fR \fI\fR +Don't print the keys to stdout, but store them in files. + +The filenames will be of the format K.+.+.key + +.SH AUTHOR +Written by Jelte Jansen for NLnet Labs. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2006 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-keyfetcher.c b/libs/ldns/examples/ldns-keyfetcher.c new file mode 100644 index 0000000000..c24f5111fe --- /dev/null +++ b/libs/ldns/examples/ldns-keyfetcher.c @@ -0,0 +1,724 @@ +/* + * ldns-keyfetcher retrieves the DNSKEYS for a certain domain + * It traces the authoritatives nameservers down from the root + * And uses TCP, to minimize spoofing danger. + * + * (c) NLnet Labs, 2006 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include + +int verbosity = 0; +/* 0=use both ip4 and ip6 (default). 1=ip4only. 2=ip6only. */ +uint8_t address_family = 0; +bool store_in_file = false; + +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s domain\n", prog); + fprintf(fp, " retrieve the dnskeys for a domain\n"); + fprintf(fp, "Options:\n"); + fprintf(fp, "-4\t\tUse IPv4 only\n"); + fprintf(fp, "-6\t\tUse IPv6 only\n"); + fprintf(fp, "-h\t\tShow this help\n"); + fprintf(fp, "-i\t\tInsecurer mode; don't do checks, just query for the keys\n"); + fprintf(fp, "-r \tUse file to read root hints from\n"); + fprintf(fp, "-s\t\tDon't print the keys but store them in files\n\t\tcalled K.+.+.key\n"); + fprintf(fp, "-v \tVerbosity level (0-5, not verbose-very verbose)\n"); +} + +static ldns_rr_list * +retrieve_dnskeys(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c, ldns_rr_list *dns_root) +{ + ldns_resolver *res; + ldns_pkt *p; + ldns_rr_list *new_nss_a; + ldns_rr_list *new_nss_aaaa; + ldns_rr_list *final_answer; + ldns_rr_list *new_nss; + ldns_rr_list *ns_addr; + ldns_rr_list *ns_addr2; + uint16_t loop_count; + ldns_rdf *pop; + ldns_status status; + size_t i; + + size_t nss_i; + ldns_rr_list *answer_list = NULL; + ldns_rr_list *authority_list = NULL; + + size_t last_nameserver_count; + ldns_rdf **last_nameservers; + + loop_count = 0; + new_nss_a = NULL; + new_nss_aaaa = NULL; + new_nss = NULL; + ns_addr = NULL; + ns_addr2 = NULL; + final_answer = NULL; + p = ldns_pkt_new(); + res = ldns_resolver_new(); + + if (!p || !res) { + fprintf(stderr, "Memory allocation failed"); + return NULL; + } + + if (verbosity >= 2) { + printf("Finding dnskey data for zone: "); + ldns_rdf_print(stdout, name); + printf("\n\n"); + } + + /* transfer some properties of local_res to res, + * because they were given on the commandline */ + ldns_resolver_set_ip6(res, + ldns_resolver_ip6(local_res)); + ldns_resolver_set_port(res, + ldns_resolver_port(local_res)); + ldns_resolver_set_debug(res, + ldns_resolver_debug(local_res)); + ldns_resolver_set_dnssec(res, + ldns_resolver_dnssec(local_res)); + ldns_resolver_set_fail(res, + ldns_resolver_fail(local_res)); + ldns_resolver_set_usevc(res, + ldns_resolver_usevc(local_res)); + ldns_resolver_set_random(res, + ldns_resolver_random(local_res)); + ldns_resolver_set_recursive(res, false); + + /* setup the root nameserver in the new resolver */ + status = ldns_resolver_push_nameserver_rr_list(res, dns_root); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error setting root nameservers in resolver: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error querying root servers: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } + + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + /* from now on, use TCP */ + ldns_resolver_set_usevc(res, true); + + while(status == LDNS_STATUS_OK && + ldns_pkt_reply_type(p) == LDNS_PACKET_REFERRAL) { + + if (verbosity >= 3) { + printf("This is a delegation!\n\n"); + } + if (address_family == 0 || address_family == 1) { + new_nss_a = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); + } else { + new_nss_a = ldns_rr_list_new(); + } + if (address_family == 0 || address_family == 2) { + new_nss_aaaa = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_AAAA, LDNS_SECTION_ADDITIONAL); + } else { + new_nss_aaaa = ldns_rr_list_new(); + } + new_nss = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); + + /* remove the old nameserver from the resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + /* also check for new_nss emptyness */ + + if (!new_nss_aaaa && !new_nss_a) { + /* + * no nameserver found!!! + * try to resolve the names we do got + */ + if (verbosity >= 3) { + printf("Did not get address record for nameserver, doing seperate query.\n"); + } + ns_addr = ldns_rr_list_new(); + for(i = 0; (size_t) i < ldns_rr_list_rr_count(new_nss); i++) { + /* get the name of the nameserver */ + pop = ldns_rr_rdf(ldns_rr_list_rr(new_nss, i), 0); + if (!pop) { + break; + } + + /* retrieve it's addresses */ + ns_addr2 = ldns_get_rr_list_addr_by_name(local_res, pop, c, 0); + if (!ldns_rr_list_cat(ns_addr, ns_addr2)) { + fprintf(stderr, "Internal error adding nameserver address.\n"); + exit(EXIT_FAILURE); + } + ldns_rr_list_free(ns_addr2); + } + + if (ns_addr) { + if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != + LDNS_STATUS_OK) { + fprintf(stderr, "Error adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + ldns_rr_list_deep_free(ns_addr); + } else { + ldns_rr_list_print(stdout, ns_addr); + fprintf(stderr, "Could not find the nameserver ip addr; abort"); + ldns_pkt_free(p); + return NULL; + } + } + + /* normally, the first working ns is used, but we need all now, so do it one by one + * if the answer is null, take it from the next resolver + * if the answer is not, compare it to that of the next resolver + * error if different, continue if the same + * if answer list null and no resolvers left die. + */ + + ldns_rr_list_deep_free(answer_list); + ldns_rr_list_deep_free(authority_list); + answer_list = NULL; + authority_list = NULL; + for (nss_i = 0; nss_i < ldns_rr_list_rr_count(new_nss_aaaa); nss_i++) { + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + if (verbosity >= 1) { + fprintf(stdout, "Querying nameserver: "); + ldns_rdf_print(stdout, ldns_rr_owner(ldns_rr_list_rr(new_nss_aaaa, nss_i))); + fprintf(stdout, " ("); + ldns_rdf_print(stdout, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); + fprintf(stdout, ")\n"); + } + status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + if (status == LDNS_STATUS_OK && p) { + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + if (answer_list) { + if (verbosity >= 2) { + printf("Comparing answer list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { + fprintf(stderr, "ERROR: different answer answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, answer_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_answer(p)); + exit(EXIT_FAILURE); + } + } else { + answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (verbosity >= 2) { + printf("First answer list for this set, nothing to compare with\n\n"); + } + } + if (authority_list) { + if (verbosity >= 2) { + printf("Comparing authority list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (ldns_rr_list_compare(authority_list, ldns_pkt_authority(p)) != 0) { + fprintf(stderr, "ERROR: different authority answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, authority_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_authority(p)); + exit(EXIT_FAILURE); + } + } else { + authority_list = ldns_rr_list_clone(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (verbosity >= 2) { + printf("First authority list for this set, nothing to compare with\n\n"); + } + if (verbosity >= 3) { + printf("NS RRset:\n"); + ldns_rr_list_print(stdout, authority_list); + printf("\n"); + } + } + } + } + + ldns_rr_list_deep_free(answer_list); + ldns_rr_list_deep_free(authority_list); + answer_list = NULL; + authority_list = NULL; + for (nss_i = 0; nss_i < ldns_rr_list_rr_count(new_nss_a); nss_i++) { + + while((pop = ldns_resolver_pop_nameserver(res))) {ldns_rdf_deep_free(pop); } + + if (verbosity >= 1) { + fprintf(stdout, "Querying nameserver: "); + ldns_rdf_print(stdout, ldns_rr_owner(ldns_rr_list_rr(new_nss_a, nss_i))); + fprintf(stdout, " ("); + ldns_rdf_print(stdout, ldns_rr_rdf(ldns_rr_list_rr(new_nss_a, nss_i), 0)); + fprintf(stdout, ")\n"); + } + status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_a, nss_i), 0)); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (status == LDNS_STATUS_OK) { + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + if (answer_list) { + if (verbosity >= 2) { + printf("Comparing answer list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { + fprintf(stderr, "ERROR: different answer answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, answer_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_answer(p)); + exit(EXIT_FAILURE); + } + } else { + if (verbosity >= 2) { + printf("First answer list for this set, nothing to compare with\n\n"); + } + answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + } + if (authority_list) { + if (verbosity >= 2) { + printf("Comparing authority list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (ldns_rr_list_compare(authority_list, ldns_pkt_authority(p)) != 0) { + fprintf(stderr, "ERROR: different authority answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, authority_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_authority(p)); + exit(EXIT_FAILURE); + } + } else { + if (verbosity >= 2) { + printf("First authority list for this set, nothing to compare with\n\n"); + } + authority_list = ldns_rr_list_clone(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (verbosity >= 3) { + printf("NS RRset:\n"); + ldns_rr_list_print(stdout, authority_list); + printf("\n"); + } + } + } + } + ldns_rr_list_deep_free(authority_list); + authority_list = NULL; + + if (loop_count++ > 20) { + /* unlikely that we are doing something usefull */ + fprintf(stderr, "Looks like we are looping"); + ldns_pkt_free(p); + return NULL; + } + + ldns_pkt_free(p); + + if (verbosity >= 3) { + fprintf(stdout, "This level ok. Continuing to next.\n\n"); + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error querying root servers: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } + + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + + ldns_rr_list_deep_free(new_nss_aaaa); + ldns_rr_list_deep_free(new_nss_a); + ldns_rr_list_deep_free(new_nss); + new_nss_aaaa = NULL; + new_nss_a = NULL; + ns_addr = NULL; + } + + ldns_rr_list_deep_free(answer_list); + answer_list = NULL; + /* clone the nameserver list, we are going to handle them one by one */ + last_nameserver_count = 0; + last_nameservers = LDNS_XMALLOC(ldns_rdf *, ldns_resolver_nameserver_count(res)); + + pop = NULL; + while((pop = ldns_resolver_pop_nameserver(res))) { + last_nameservers[last_nameserver_count] = pop; + last_nameserver_count++; + } + + for (nss_i = 0; nss_i < last_nameserver_count; nss_i++) { + /* remove previous nameserver */ + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + if (verbosity >= 1) { + printf("Querying nameserver: "); + ldns_rdf_print(stdout, last_nameservers[nss_i]); + printf("\n"); + } + status = ldns_resolver_push_nameserver(res, last_nameservers[nss_i]); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (!p) { + fprintf(stderr, "no packet received\n"); + return NULL; + } + + if (status == LDNS_STATUS_RES_NO_NS) { + fprintf(stderr, "Error: nameserver at "); + ldns_rdf_print(stderr, last_nameservers[nss_i]); + fprintf(stderr, " not responding. Unable to check RRset here, aborting.\n"); + return NULL; + } + + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (answer_list) { + if (verbosity >= 2) { + printf("1Comparing answer rr list of answer to previous\n"); + } + ldns_rr_list_sort(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { + printf("ERROR: different answer section in response from nameserver\n"); + fprintf(stderr, "\nI had:\n"); + ldns_rr_list_print(stderr, answer_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_answer(p)); + exit(EXIT_FAILURE); + } + } else { + if (verbosity >= 2) { + printf("First answer rr list for this set, nothing to compare with\n"); + } + answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); + if (verbosity >= 3) { + printf("DNSKEY RRset:\n"); + ldns_rr_list_print(stdout, answer_list); + } + } + + } + + for (nss_i = 0; nss_i < last_nameserver_count; nss_i++) { + ldns_rdf_deep_free(last_nameservers[nss_i]); + } + LDNS_FREE(last_nameservers); + ldns_resolver_deep_free(res); + ldns_pkt_free(p); + return answer_list; +} + + +/* + * The file with the given path should contain a list of NS RRs + * for the root zone and A records for those NS RRs. + * Read them, check them, and append the a records to the rr list given. + */ +ldns_rr_list * +read_root_hints(const char *filename) +{ + FILE *fp = NULL; + int line_nr = 0; + ldns_zone *z; + ldns_status status; + ldns_rr_list *addresses = NULL; + ldns_rr *rr; + size_t i; + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s for reading: %s\n", filename, strerror(errno)); + return NULL; + } + + status = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, 0, &line_nr); + fclose(fp); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error reading root hints file: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } else { + addresses = ldns_rr_list_new(); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { + rr = ldns_rr_list_rr(ldns_zone_rrs(z), i); + if ((address_family == 0 || address_family == 1) && + ldns_rr_get_type(rr) == LDNS_RR_TYPE_A ) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + if ((address_family == 0 || address_family == 2) && + ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + } + ldns_zone_deep_free(z); + return addresses; + } +} + + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_rdf *ns; + ldns_rdf *domain; + ldns_rr_list *l = NULL; + + ldns_rr_list *dns_root = NULL; + const char *root_file = "/etc/named.root"; + + ldns_status status; + + int i; + + char *domain_str; + char *outputfile_str; + ldns_buffer *outputfile_buffer; + FILE *outputfile; + ldns_rr *k; + + bool insecure = false; + ldns_pkt *pkt; + + domain = NULL; + res = NULL; + + if (argc < 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + for (i = 1; i < argc; i++) { + if (strncmp("-4", argv[i], 3) == 0) { + if (address_family != 0) { + fprintf(stderr, "Options -4 and -6 cannot be specified at the same time\n"); + exit(EXIT_FAILURE); + } + address_family = 1; + } else if (strncmp("-6", argv[i], 3) == 0) { + if (address_family != 0) { + fprintf(stderr, "Options -4 and -6 cannot be specified at the same time\n"); + exit(EXIT_FAILURE); + } + address_family = 2; + } else if (strncmp("-h", argv[i], 3) == 0) { + usage(stdout, argv[0]); + exit(EXIT_SUCCESS); + } else if (strncmp("-i", argv[i], 2) == 0) { + insecure = true; + } else if (strncmp("-r", argv[i], 2) == 0) { + if (strlen(argv[i]) > 2) { + root_file = argv[i]+2; + } else if (i+1 >= argc) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + root_file = argv[i+1]; + i++; + } + } else if (strncmp("-s", argv[i], 3) == 0) { + store_in_file = true; + } else if (strncmp("-v", argv[i], 2) == 0) { + if (strlen(argv[i]) > 2) { + verbosity = atoi(argv[i]+2); + } else if (i+1 > argc) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + verbosity = atoi(argv[i+1]); + i++; + } + } else { + /* create a rdf from the command line arg */ + if (domain) { + fprintf(stdout, "You can only specify one domain at a time\n"); + exit(EXIT_FAILURE); + } + + domain = ldns_dname_new_frm_str(argv[i]); + } + + } + if (!domain) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + dns_root = read_root_hints(root_file); + if (!dns_root) { + fprintf(stderr, "cannot read the root hints file\n"); + exit(EXIT_FAILURE); + } + + /* create a new resolver from /etc/resolv.conf */ + status = ldns_resolver_new_frm_file(&res, NULL); + + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Warning: Unable to create stub resolver from /etc/resolv.conf:\n"); + fprintf(stderr, "%s\n", ldns_get_errorstr_by_id(status)); + fprintf(stderr, "defaulting to nameserver at 127.0.0.1 for separate nameserver name lookups\n"); + res = ldns_resolver_new(); + ns = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, "127.0.0.1"); + status = ldns_resolver_push_nameserver(res, ns); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Unable to create stub resolver: %s\n", ldns_get_errorstr_by_id(status)); + exit(EXIT_FAILURE); + } + ldns_rdf_deep_free(ns); + } + + ldns_resolver_set_ip6(res, address_family); + + if (insecure) { + pkt = ldns_resolver_query(res, domain, LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, LDNS_RD); + if (pkt) { + l = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_DNSKEY, LDNS_SECTION_ANY_NOQUESTION); + } + } else { + l = retrieve_dnskeys(res, domain, LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, dns_root); + } + + /* separator for result data and verbosity data */ + if (verbosity > 0) { + fprintf(stdout, "; ---------------------------\n"); + fprintf(stdout, "; Got the following keys:\n"); + } + if (l) { + if (store_in_file) { + /* create filename: + * K.+.+.key + */ + for (i = 0; (size_t) i < ldns_rr_list_rr_count(l); i++) { + k = ldns_rr_list_rr(l, (size_t) i); + + outputfile_buffer = ldns_buffer_new(300); + domain_str = ldns_rdf2str(ldns_rr_owner(k)); + ldns_buffer_printf(outputfile_buffer, "K%s+%03u+%05u.key", domain_str, ldns_rdf2native_int8(ldns_rr_rdf(k, 2)), + (unsigned int) ldns_calc_keytag(k)); + outputfile_str = ldns_buffer_export(outputfile_buffer); + + if (verbosity >= 1) { + fprintf(stdout, "Writing key to file %s\n", outputfile_str); + } + + outputfile = fopen(outputfile_str, "w"); + if (!outputfile) { + fprintf(stderr, "Error writing key to file %s: %s\n", outputfile_str, strerror(errno)); + } else { + ldns_rr_print(outputfile, k); + fclose(outputfile); + } + + LDNS_FREE(domain_str); + LDNS_FREE(outputfile_str); + LDNS_FREE(outputfile_buffer); + } + } else { + ldns_rr_list_print(stdout, l); + } + } else { + fprintf(stderr, "no answer packet received, stub resolver config:\n"); + ldns_resolver_print(stderr, res); + } + printf("\n"); + + ldns_rdf_deep_free(domain); + ldns_resolver_deep_free(res); + ldns_rr_list_deep_free(l); + ldns_rr_list_deep_free(dns_root); + return EXIT_SUCCESS; +} diff --git a/libs/ldns/examples/ldns-keygen.1 b/libs/ldns/examples/ldns-keygen.1 new file mode 100644 index 0000000000..36124d52a4 --- /dev/null +++ b/libs/ldns/examples/ldns-keygen.1 @@ -0,0 +1,53 @@ +.TH ldns-keygen 1 "27 May 2008" +.SH NAME +ldns-keygen \- generate a DNSSEC key pair +.SH SYNOPSIS +.B ldns-keygen +[ +.IR OPTION +] +.IR DOMAIN + +.SH DESCRIPTION +\fBldns-keygen\fR is used to generate a private/public keypair. When run, it +will create 3 files; a .key file with the public DNSKEY, a .private +file with the private keydata and a .ds with the DS record of the +DNSKEY record. + +It prints out the basename for these files: K++ + +.SH OPTIONS +.TP +\fB-a \fI\fR +Create a key with this algorithm. Specifying 'list' here gives a list of supported algorithms. +Several alias names are also accepted (from older versions and other software), +the list gives names from the RFC. Also the plain algo number is accepted. + +.TP +\fB-b \fI\fR +Use this many bits for the key length. + +.TP +\fB-k\fR +When given, generate a key signing key. This just sets the flag field to +257 instead of 256 in the DNSKEY RR in the .key file. + +.TP +\fB-r \fIdevice\fR +Make ldns-keygen use this file to seed the random generator with. This will +default to /dev/random. + +.TP +\fB-v\fR +Show the version and exit + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005-2008 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-keygen.c b/libs/ldns/examples/ldns-keygen.c new file mode 100644 index 0000000000..576541790c --- /dev/null +++ b/libs/ldns/examples/ldns-keygen.c @@ -0,0 +1,307 @@ +/* + * keygen is a small programs that generate a dnskey and private key + * for a particular domain. + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +#include + +#ifdef HAVE_SSL +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s -a [-b bits] [-r /dev/random] [-v] domain\n", + prog); + fprintf(fp, " generate a new key pair for domain\n"); + fprintf(fp, " -a \tuse the specified algorithm (-a list to"); + fprintf(fp, " show a list)\n"); + fprintf(fp, " -k\t\tset the flags to 257; key signing key\n"); + fprintf(fp, " -b \tspecify the keylength\n"); + fprintf(fp, " -r \tspecify a random device (defaults to /dev/random)\n"); + fprintf(fp, "\t\tto seed the random generator with\n"); + fprintf(fp, " -v\t\tshow the version and exit\n"); + fprintf(fp, " The following files will be created:\n"); + fprintf(fp, " K++.key\tPublic key in RR format\n"); + fprintf(fp, " K++.private\tPrivate key in key format\n"); + fprintf(fp, " K++.ds\tDS in RR format (only for DNSSEC keys)\n"); + fprintf(fp, " The base name (K++ will be printed to stdout\n"); +} + +static void +show_algorithms(FILE *out) +{ + ldns_lookup_table *lt = ldns_signing_algorithms; + fprintf(out, "Possible algorithms:\n"); + + while (lt->name) { + fprintf(out, "%s\n", lt->name); + lt++; + } +} + +int +main(int argc, char *argv[]) +{ + int c; + char *prog; + + /* default key size */ + uint16_t def_bits = 1024; + uint16_t bits = def_bits; + bool ksk; + + FILE *file; + FILE *random; + char *filename; + char *owner; + + ldns_signing_algorithm algorithm; + ldns_rdf *domain; + ldns_rr *pubkey; + ldns_key *key; + ldns_rr *ds; + + prog = strdup(argv[0]); + algorithm = 0; + random = NULL; + ksk = false; /* don't create a ksk per default */ + + while ((c = getopt(argc, argv, "a:kb:r:v25")) != -1) { + switch (c) { + case 'a': + if (algorithm != 0) { + fprintf(stderr, "The -a argument can only be used once\n"); + exit(1); + } + if (strncmp(optarg, "list", 5) == 0) { + show_algorithms(stdout); + exit(EXIT_SUCCESS); + } + algorithm = ldns_get_signing_algorithm_by_name(optarg); + if (algorithm == 0) { + fprintf(stderr, "Algorithm %s not found\n", optarg); + show_algorithms(stderr); + exit(EXIT_FAILURE); + } + break; + case 'b': + bits = (uint16_t) atoi(optarg); + if (bits == 0) { + fprintf(stderr, "%s: %s %d", prog, "Can not parse the -b argument, setting it to the default\n", (int) def_bits); + bits = def_bits; + } + break; + case 'k': + ksk = true; + break; + case 'r': + random = fopen(optarg, "r"); + if (!random) { + fprintf(stderr, "Cannot open random file %s: %s\n", optarg, strerror(errno)); + exit(EXIT_FAILURE); + } + break; + case 'v': + printf("DNSSEC key generator version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); + exit(EXIT_SUCCESS); + break; + default: + usage(stderr, prog); + exit(EXIT_FAILURE); + } + } + argc -= optind; + argv += optind; + + if (algorithm == 0) { + printf("Please use the -a argument to provide an algorithm\n"); + exit(1); + } + + if (argc != 1) { + usage(stderr, prog); + exit(EXIT_FAILURE); + } + free(prog); + + /* check whether key size is within RFC boundaries */ + switch (algorithm) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + if (bits < 512 || bits > 4096) { + fprintf(stderr, "For RSA, the key size must be between "); + fprintf(stderr, " 512 and 4096 bytes. Aborting.\n"); + exit(1); + } + break; + case LDNS_SIGN_DSA: + if (bits < 512 || bits > 4096) { + fprintf(stderr, "For DSA, the key size must be between "); + fprintf(stderr, " 512 and 1024 bytes. Aborting.\n"); + exit(1); + } + break; +#ifdef USE_GOST + case LDNS_SIGN_ECC_GOST: + if(!ldns_key_EVP_load_gost_id()) { + fprintf(stderr, "error: libcrypto does not provide GOST\n"); + exit(EXIT_FAILURE); + } + break; +#endif +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: +#endif + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + default: + break; + } + + if (!random) { + random = fopen("/dev/random", "r"); + if (!random) { + fprintf(stderr, "Cannot open random file %s: %s\n", optarg, strerror(errno)); + exit(EXIT_FAILURE); + } + } + + (void)ldns_init_random(random, (unsigned int) bits/8); + fclose(random); + + /* create an rdf from the domain name */ + domain = ldns_dname_new_frm_str(argv[0]); + + /* generate a new key */ + key = ldns_key_new_frm_algorithm(algorithm, bits); + + /* set the owner name in the key - this is a /seperate/ step */ + ldns_key_set_pubkey_owner(key, domain); + + /* ksk flag */ + if (ksk) { + ldns_key_set_flags(key, ldns_key_flags(key) + 1); + } + + /* create the public from the ldns_key */ + pubkey = ldns_key2rr(key); + if (!pubkey) { + fprintf(stderr, "Could not extract the public key from the key structure..."); + ldns_key_deep_free(key); + exit(EXIT_FAILURE); + } + owner = ldns_rdf2str(ldns_rr_owner(pubkey)); + + /* calculate and set the keytag */ + ldns_key_set_keytag(key, ldns_calc_keytag(pubkey)); + + /* build the DS record */ + switch (algorithm) { +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP384SHA384: + ds = ldns_key_rr2ds(pubkey, LDNS_SHA384); + break; + case LDNS_SIGN_ECDSAP256SHA256: +#endif + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + ds = ldns_key_rr2ds(pubkey, LDNS_SHA256); + break; + case LDNS_SIGN_ECC_GOST: +#ifdef USE_GOST + ds = ldns_key_rr2ds(pubkey, LDNS_HASH_GOST); +#else + ds = ldns_key_rr2ds(pubkey, LDNS_SHA256); +#endif + break; + default: + ds = ldns_key_rr2ds(pubkey, LDNS_SHA1); + break; + } + + /* print the public key RR to .key */ + filename = LDNS_XMALLOC(char, strlen(owner) + 17); + snprintf(filename, strlen(owner) + 16, "K%s+%03u+%05u.key", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + file = fopen(filename, "w"); + if (!file) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + LDNS_FREE(filename); + exit(EXIT_FAILURE); + } else { + /* temporarily set question so that TTL is not printed */ + ldns_rr_set_question(pubkey, true); + ldns_rr_print(file, pubkey); + ldns_rr_set_question(pubkey, false); + fclose(file); + LDNS_FREE(filename); + } + + /* print the priv key to stderr */ + filename = LDNS_XMALLOC(char, strlen(owner) + 21); + snprintf(filename, strlen(owner) + 20, "K%s+%03u+%05u.private", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + file = fopen(filename, "w"); + if (!file) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + LDNS_FREE(filename); + exit(EXIT_FAILURE); + } else { + ldns_key_print(file, key); + fclose(file); + LDNS_FREE(filename); + } + + /* print the DS to .ds */ + if (algorithm != LDNS_SIGN_HMACMD5 && + algorithm != LDNS_SIGN_HMACSHA1 && + algorithm != LDNS_SIGN_HMACSHA256) { + filename = LDNS_XMALLOC(char, strlen(owner) + 16); + snprintf(filename, strlen(owner) + 15, "K%s+%03u+%05u.ds", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + file = fopen(filename, "w"); + if (!file) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + LDNS_FREE(filename); + exit(EXIT_FAILURE); + } else { + /* temporarily set question so that TTL is not printed */ + ldns_rr_set_question(ds, true); + ldns_rr_print(file, ds); + ldns_rr_set_question(ds, false); + fclose(file); + LDNS_FREE(filename); + } + } + + fprintf(stdout, "K%s+%03u+%05u\n", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + exit(EXIT_SUCCESS); +} +#else +int +main(int argc, char **argv) +{ + fprintf(stderr, "ldns-keygen needs OpenSSL support, which has not been compiled in\n"); + return 1; +} +#endif /* HAVE_SSL */ diff --git a/libs/ldns/examples/ldns-mx.1 b/libs/ldns/examples/ldns-mx.1 new file mode 100644 index 0000000000..cad97abcd8 --- /dev/null +++ b/libs/ldns/examples/ldns-mx.1 @@ -0,0 +1,23 @@ +.TH ldns-mx 1 "27 Apr 2005" +.SH NAME +ldns-mx \- print out the mx record(s) for a domain +.SH SYNOPSIS +.B ldns-mx +.IR DOMAIN + +.SH DESCRIPTION +\fBldns-mx\fR is used to print out mx information of a domain. + +.SH OPTIONS +\fBldns-mx\fR has no options. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-mx.c b/libs/ldns/examples/ldns-mx.c new file mode 100644 index 0000000000..873cf55f87 --- /dev/null +++ b/libs/ldns/examples/ldns-mx.c @@ -0,0 +1,88 @@ +/* + * mx is a small program that prints out the mx records + * for a particular domain + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +static int +usage(FILE *fp, char *prog) { + fprintf(fp, "%s domain\n", prog); + fprintf(fp, " print out the mx for domain\n"); + return 0; +} + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_rdf *domain; + ldns_pkt *p; + ldns_rr_list *mx; + ldns_status s; + + p = NULL; + mx = NULL; + domain = NULL; + res = NULL; + + if (argc != 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + /* create a rdf from the command line arg */ + domain = ldns_dname_new_frm_str(argv[1]); + if (!domain) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + /* create a new resolver from /etc/resolv.conf */ + s = ldns_resolver_new_frm_file(&res, NULL); + + if (s != LDNS_STATUS_OK) { + exit(EXIT_FAILURE); + } + + /* use the resolver to send a query for the mx + * records of the domain given on the command line + */ + p = ldns_resolver_query(res, + domain, + LDNS_RR_TYPE_MX, + LDNS_RR_CLASS_IN, + LDNS_RD); + + ldns_rdf_deep_free(domain); + + if (!p) { + exit(EXIT_FAILURE); + } else { + /* retrieve the MX records from the answer section of that + * packet + */ + mx = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_MX, + LDNS_SECTION_ANSWER); + if (!mx) { + fprintf(stderr, + " *** invalid answer name %s after MX query for %s\n", + argv[1], argv[1]); + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + exit(EXIT_FAILURE); + } else { + ldns_rr_list_sort(mx); + ldns_rr_list_print(stdout, mx); + ldns_rr_list_deep_free(mx); + } + } + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + return 0; +} diff --git a/libs/ldns/examples/ldns-notify.1 b/libs/ldns/examples/ldns-notify.1 new file mode 100644 index 0000000000..7ae77ac046 --- /dev/null +++ b/libs/ldns/examples/ldns-notify.1 @@ -0,0 +1,66 @@ +.TH ldns-notify 1 "9 Jan 2007" +.SH NAME +ldns-notify \- notify DNS servers that updates are available +.SH SYNOPSIS +.B ldns-notify +[options] +-z zone +.IR servers + +.SH DESCRIPTION + +\fBldns-notify\fR sends a NOTIFY message to DNS servers. This tells them +that an updated zone is available at the master servers. It can perform +TSIG signatures and it can add a SOA serial number of the updated zone. +If a server already has that serial number it will disregard the message. + +.SH OPTIONS +.TP +\fB-z zone\fR +The zone that is updated. + +.TP +\fB-h\fR +Show usage and exit + +.TP +\fB-v\fR +Show the version and exit + +.TP +\fB-s serial\fR +Append a SOA record indicating the serial number of the updated zone. + +.TP +\fB-p port\fR +Use port as destination port (default the DNS port 53) for the UDP packets. + +.TP +\fB-y key:data\fR +Use the given TSIG key and base64-data to sign the NOTIFY. Uses the +hmac-md5 algorithm. + +.TP +\fB-d\fR +Print verbose debug information. The query that is sent and the query +that is received. + +.TP +\fB-r num\fR +Specify the maximum number of retries before notify gives up trying to +send the UDP packet. + +.SH EXIT CODE +The program exits with a 0 exit code if all servers replied an +acknowledgement to the notify message, and a failure exit code otherwise. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-notify.c b/libs/ldns/examples/ldns-notify.c new file mode 100644 index 0000000000..258dc09b26 --- /dev/null +++ b/libs/ldns/examples/ldns-notify.c @@ -0,0 +1,329 @@ +/* + * ldns-notify.c - ldns-notify(8) + * + * Copyright (c) 2001-2008, NLnet Labs, All right reserved + * + * See LICENSE for the license + * + * send a notify packet to a server + */ + +#include "config.h" + +/* ldns */ +#include + +#ifdef HAVE_NETDB_H +#include +#endif +#include + +static int verbose = 1; +static int max_num_retry = 15; /* times to try */ + +static void +usage(void) +{ + fprintf(stderr, "usage: ldns-notify [other options] -z zone \n"); + fprintf(stderr, "Ldns notify utility\n\n"); + fprintf(stderr, " Supported options:\n"); + fprintf(stderr, "\t-z zone\t\tThe zone\n"); + fprintf(stderr, "\t-s version\tSOA version number to include\n"); + fprintf(stderr, "\t-y key:data\tTSIG sign the query\n"); + fprintf(stderr, "\t-p port\t\tport to use to send to\n"); + fprintf(stderr, "\t-v\t\tPrint version information\n"); + fprintf(stderr, "\t-d\t\tPrint verbose debug information\n"); + fprintf(stderr, "\t-r num\t\tmax number of retries (%d)\n", + max_num_retry); + fprintf(stderr, "\t-h\t\tPrint this help information\n\n"); + fprintf(stderr, "Report bugs to \n"); + exit(1); +} + +static void +version(void) +{ + fprintf(stderr, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf(stderr, "Written by NLnet Labs.\n\n"); + fprintf(stderr, + "Copyright (C) 2001-2008 NLnet Labs. This is free software.\n" + "There is NO warranty; not even for MERCHANTABILITY or FITNESS\n" + "FOR A PARTICULAR PURPOSE.\n"); + exit(0); +} + +static void +notify_host(int s, struct addrinfo* res, uint8_t* wire, size_t wiresize, + const char* addrstr) +{ + int timeout_retry = 5; /* seconds */ + int num_retry = max_num_retry; + fd_set rfds; + struct timeval tv; + int retval = 0; + ssize_t received = 0; + int got_ack = 0; + socklen_t addrlen = 0; + uint8_t replybuf[2048]; + ldns_status status; + ldns_pkt* pkt = NULL; + + while(!got_ack) { + /* send it */ + if(sendto(s, (void*)wire, wiresize, 0, + res->ai_addr, res->ai_addrlen) == -1) { + printf("warning: send to %s failed: %s\n", + addrstr, strerror(errno)); +#ifndef USE_WINSOCK + close(s); +#else + closesocket(s); +#endif + return; + } + + /* wait for ACK packet */ + FD_ZERO(&rfds); + FD_SET(s, &rfds); +#ifndef S_SPLINT_S + tv.tv_sec = timeout_retry; /* seconds */ +#endif + tv.tv_usec = 0; /* microseconds */ + retval = select(s + 1, &rfds, NULL, NULL, &tv); + if (retval == -1) { + printf("error waiting for reply from %s: %s\n", + addrstr, strerror(errno)); +#ifndef USE_WINSOCK + close(s); +#else + closesocket(s); +#endif + return; + } + if(retval == 0) { + num_retry--; + if(num_retry == 0) { + printf("error: failed to send notify to %s.\n", + addrstr); + exit(1); + } + printf("timeout (%d s) expired, retry notify to %s.\n", + timeout_retry, addrstr); + } + if (retval == 1) { + got_ack = 1; + } + } + + /* got reply */ + addrlen = res->ai_addrlen; + received = recvfrom(s, (void*)replybuf, sizeof(replybuf), 0, + res->ai_addr, &addrlen); + res->ai_addrlen = addrlen; + +#ifndef USE_WINSOCK + close(s); +#else + closesocket(s); +#endif + if (received == -1) { + printf("recv %s failed: %s\n", addrstr, strerror(errno)); + return; + } + + /* check reply */ + status = ldns_wire2pkt(&pkt, replybuf, (size_t)received); + if(status != LDNS_STATUS_OK) { + ssize_t i; + printf("Could not parse reply packet: %s\n", + ldns_get_errorstr_by_id(status)); + printf("hexdump of reply: "); + for(i=0; iai_next) { + int s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if(s == -1) + continue; + /* send the notify */ + notify_host(s, res, wire, wiresize, argv[i]); + } + freeaddrinfo(res0); + } + + ldns_pkt_free(notify); + free(wire); + return 0; +} diff --git a/libs/ldns/examples/ldns-nsec3-hash.1 b/libs/ldns/examples/ldns-nsec3-hash.1 new file mode 100644 index 0000000000..1b0f70ce39 --- /dev/null +++ b/libs/ldns/examples/ldns-nsec3-hash.1 @@ -0,0 +1,34 @@ +.TH ldns-nsec3-hash.c 1 "10 Dec 2008" +.SH NAME +ldns-nsec3-hash \- print out the NSEC3 hash for a domain name +.SH SYNOPSIS +.B ldns-nsec3-hash +.IR + +.SH DESCRIPTION +\fBldns-nsec3-hash\fR is used to print out the NSEC3 hash for the given domain name. + +.SH OPTIONS +.TP +\fB-a\fR \fInumber\fR +Use the given algorithm number for the hash calculation. Defaults to 1 (SHA-1). + +.TP +\fB-s\fR \fIsalt\fR +Use the given salt for the hash calculation. Salt value should be in hexadecimal format. + +.TP +\fB-t\fR \fIcount\fR +Use count iterations for the hash calculation. + + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2008 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-nsec3-hash.c b/libs/ldns/examples/ldns-nsec3-hash.c new file mode 100644 index 0000000000..0ba2e68aec --- /dev/null +++ b/libs/ldns/examples/ldns-nsec3-hash.c @@ -0,0 +1,127 @@ +/* + * ldns-signzone signs a zone file + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include + +#include + +#include + +#include +#include + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ + +#define MAX_FILENAME_LEN 250 +int verbosity = 1; + +static void +usage(FILE *fp, const char *prog) { + fprintf(fp, "%s [OPTIONS] \n", prog); + fprintf(fp, " prints the NSEC3 hash of the given domain name\n"); + fprintf(fp, "-a [algorithm] hashing algorithm\n"); + fprintf(fp, "-t [number] number of hash iterations\n"); + fprintf(fp, "-s [string] salt\n"); +} + +int +main(int argc, char *argv[]) +{ + ldns_rdf *dname, *hashed_dname; + uint8_t nsec3_algorithm = 1; + size_t nsec3_iterations_cmd = 1; + uint16_t nsec3_iterations = 1; + uint8_t nsec3_salt_length = 0; + uint8_t *nsec3_salt = NULL; + + char *prog = strdup(argv[0]); + + int c; + while ((c = getopt(argc, argv, "a:s:t:")) != -1) { + switch (c) { + case 'a': + nsec3_algorithm = (uint8_t) atoi(optarg); + break; + case 's': + if (strlen(optarg) % 2 != 0) { + fprintf(stderr, "Salt value is not valid hex data, not a multiple of 2 characters\n"); + exit(EXIT_FAILURE); + } + if (strlen(optarg) > 512) { + fprintf(stderr, "Salt too long\n"); + exit(EXIT_FAILURE); + } + nsec3_salt_length = (uint8_t) (strlen(optarg) / 2); + nsec3_salt = LDNS_XMALLOC(uint8_t, nsec3_salt_length); + for (c = 0; c < (int) strlen(optarg); c += 2) { + if (isxdigit((int) optarg[c]) && isxdigit((int) optarg[c+1])) { + nsec3_salt[c/2] = (uint8_t) ldns_hexdigit_to_int(optarg[c]) * 16 + + ldns_hexdigit_to_int(optarg[c+1]); + } else { + fprintf(stderr, "Salt value is not valid hex data.\n"); + exit(EXIT_FAILURE); + } + } + + break; + case 't': + nsec3_iterations_cmd = (size_t) atol(optarg); + if (nsec3_iterations_cmd > LDNS_NSEC3_MAX_ITERATIONS) { + fprintf(stderr, "Iterations count can not exceed %u, quitting\n", LDNS_NSEC3_MAX_ITERATIONS); + exit(EXIT_FAILURE); + } + nsec3_iterations = (uint16_t) nsec3_iterations_cmd; + break; + default: + usage(stderr, prog); + exit(EXIT_SUCCESS); + } + } + + argc -= optind; + argv += optind; + + if (argc < 1) { + printf("Error: not enough arguments\n"); + usage(stdout, prog); + exit(EXIT_FAILURE); + } else { + dname = ldns_dname_new_frm_str(argv[0]); + if (!dname) { + fprintf(stderr, + "Error: unable to parse domain name\n"); + return EXIT_FAILURE; + } + hashed_dname = ldns_nsec3_hash_name(dname, + nsec3_algorithm, + nsec3_iterations, + nsec3_salt_length, + nsec3_salt); + if (!hashed_dname) { + fprintf(stderr, + "Error creating NSEC3 hash\n"); + return EXIT_FAILURE; + } + ldns_rdf_print(stdout, hashed_dname); + printf("\n"); + ldns_rdf_deep_free(dname); + ldns_rdf_deep_free(hashed_dname); + } + + if (nsec3_salt) { + free(nsec3_salt); + } + + free(prog); + + return EXIT_SUCCESS; +} diff --git a/libs/ldns/examples/ldns-read-zone.1 b/libs/ldns/examples/ldns-read-zone.1 new file mode 100644 index 0000000000..31bedaba62 --- /dev/null +++ b/libs/ldns/examples/ldns-read-zone.1 @@ -0,0 +1,56 @@ +.TH ldns-read-zone 1 "30 May 2005" +.SH NAME +ldns-read-zone \- read a zonefile and print it +.SH SYNOPSIS +.B ldns-read-zone +.IR ZONEFILE + +.SH DESCRIPTION + +\fBldns-read-zone\fR reads a DNS zone file and prints it. The output has 1 +resource record per line, and no pretty-printing makeup. + +.SH OPTIONS +.TP +\fB-c\fR +Canonicalize all resource records in the zone before printing + +.TP +\fB-d\fR +Only print DNSSEC data from the zone. This option skips every record +that is not of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are not +printed. + +.TP +\fB-h\fR +Show usage and exit + +.TP +\fB-n\fR +Do not print the SOA record + +.TP +\fB-s\fR +Strip DNSSEC data from the zone. This option skips every record +that is of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are still +printed. + +.TP +\fB-v\fR +Show the version and exit + +.TP +\fB-z\fR +Sort the zone before printing (this implies -c) + + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-read-zone.c b/libs/ldns/examples/ldns-read-zone.c new file mode 100644 index 0000000000..ea35850fc1 --- /dev/null +++ b/libs/ldns/examples/ldns-read-zone.c @@ -0,0 +1,159 @@ +/* + * read a zone file from disk and prints it, one RR per line + * + * (c) NLnetLabs 2005-2008 + * + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include + +#include + +#include + +int +main(int argc, char **argv) +{ + char *filename; + FILE *fp; + ldns_zone *z; + int line_nr = 0; + int c; + bool canonicalize = false; + bool sort = false; + bool strip = false; + bool only_dnssec = false; + bool print_soa = true; + ldns_status s; + size_t i; + ldns_rr_list *stripped_list; + ldns_rr *cur_rr; + ldns_rr_type cur_rr_type; + + while ((c = getopt(argc, argv, "cdhnsvz")) != -1) { + switch(c) { + case 'c': + canonicalize = true; + break; + case 'd': + only_dnssec = true; + if (strip) { + fprintf(stderr, "Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"); + } + break; + case 'h': + printf("Usage: %s [-c] [-v] [-z] \n", argv[0]); + printf("\tReads the zonefile and prints it.\n"); + printf("\tThe RR count of the zone is printed to stderr.\n"); + printf("\t-c canonicalize all rrs in the zone.\n"); + printf("\t-d only show DNSSEC data from the zone\n"); + printf("\t-h show this text\n"); + printf("\t-n do not print the SOA record\n"); + printf("\t-s strip DNSSEC data from the zone\n"); + printf("\t-v shows the version and exits\n"); + printf("\t-z sort the zone (implies -c).\n"); + printf("\nif no file is given standard input is read\n"); + exit(EXIT_SUCCESS); + break; + case 'n': + print_soa = false; + break; + case 's': + strip = true; + if (only_dnssec) { + fprintf(stderr, "Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"); + } + break; + case 'v': + printf("read zone version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); + exit(EXIT_SUCCESS); + break; + case 'z': + canonicalize = true; + sort = true; + break; + } + } + + argc -= optind; + argv += optind; + + if (argc == 0) { + fp = stdin; + } else { + filename = argv[0]; + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + exit(EXIT_FAILURE); + } + } + + s = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, LDNS_RR_CLASS_IN, &line_nr); + + if (strip) { + stripped_list = ldns_rr_list_new(); + while ((cur_rr = ldns_rr_list_pop_rr(ldns_zone_rrs(z)))) { + cur_rr_type = ldns_rr_get_type(cur_rr); + if (cur_rr_type == LDNS_RR_TYPE_RRSIG || + cur_rr_type == LDNS_RR_TYPE_NSEC || + cur_rr_type == LDNS_RR_TYPE_NSEC3 || + cur_rr_type == LDNS_RR_TYPE_NSEC3PARAMS + ) { + ldns_rr_free(cur_rr); + } else { + ldns_rr_list_push_rr(stripped_list, cur_rr); + } + } + ldns_rr_list_free(ldns_zone_rrs(z)); + ldns_zone_set_rrs(z, stripped_list); + } + if (only_dnssec) { + stripped_list = ldns_rr_list_new(); + while ((cur_rr = ldns_rr_list_pop_rr(ldns_zone_rrs(z)))) { + cur_rr_type = ldns_rr_get_type(cur_rr); + if (cur_rr_type == LDNS_RR_TYPE_RRSIG || + cur_rr_type == LDNS_RR_TYPE_NSEC || + cur_rr_type == LDNS_RR_TYPE_NSEC3 || + cur_rr_type == LDNS_RR_TYPE_NSEC3PARAMS + ) { + ldns_rr_list_push_rr(stripped_list, cur_rr); + } else { + ldns_rr_free(cur_rr); + } + } + ldns_rr_list_free(ldns_zone_rrs(z)); + ldns_zone_set_rrs(z, stripped_list); + } + + if (s == LDNS_STATUS_OK) { + if (canonicalize) { + ldns_rr2canonical(ldns_zone_soa(z)); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { + ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z), i)); + } + } + if (sort) { + ldns_zone_sort(z); + } + + if (print_soa && ldns_zone_soa(z)) { + ldns_rr_print(stdout, ldns_zone_soa(z)); + } + ldns_rr_list_print(stdout, ldns_zone_rrs(z)); + + ldns_zone_deep_free(z); + } else { + fprintf(stderr, "%s at %d\n", + ldns_get_errorstr_by_id(s), + line_nr); + exit(EXIT_FAILURE); + } + fclose(fp); + + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-resolver.1 b/libs/ldns/examples/ldns-resolver.1 new file mode 100644 index 0000000000..9552e6860c --- /dev/null +++ b/libs/ldns/examples/ldns-resolver.1 @@ -0,0 +1,26 @@ +.TH ldns-resolver 1 "27 Apr 2005" +.SH NAME +ldns-resolver \- tries to create a resolver from a resolv.conf file. +.SH SYNOPSIS +.B ldns-resolver +.IR file + +.SH DESCRIPTION +\fBldns-resolver\fR tries to create a resolver from a resolv.conf file. +This is only useful to test the library for robusteness with input data. + +.SH OPTIONS +\fBldns-resolver\fR takes a filename of the resolv.conf file as input. +For example \fIldns-resolver /etc/resolv.conf\fR will show if the file can +be parsed successfully. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-resolver.c b/libs/ldns/examples/ldns-resolver.c new file mode 100644 index 0000000000..04dcc35feb --- /dev/null +++ b/libs/ldns/examples/ldns-resolver.c @@ -0,0 +1,47 @@ +/* + * ldns-resolver tries to create a resolver structure from /dev/urandom + * this is only useful to test the library for robusteness with input data + * + * (c) NLnet Labs 2006 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" +#include "errno.h" + +#include + +int +main(int argc, char **argv) { + + ldns_resolver *r; + int line = 1; + FILE *rand; + ldns_status s; + + if (argc != 2 || strncmp(argv[1], "-h", 3) == 0) { + printf("Usage: ldns-resolver \n"); + printf("Tries to create a stub resolver structure from the given file.\n"); + exit(EXIT_FAILURE); + } + + if (!(rand = fopen(argv[1], "r"))) { + printf("Error opening %s: %s\n", argv[1], strerror(errno)); + exit(EXIT_FAILURE); + } + + printf("Trying to read from %s\n", argv[1]); + s = ldns_resolver_new_frm_fp_l(&r, rand, &line); + if (s != LDNS_STATUS_OK) { + printf("Failed: %s at line %d\n", ldns_get_errorstr_by_id(s), line); + exit(EXIT_FAILURE); + } else { + printf("Succes\n"); + ldns_resolver_print(stdout, r); + ldns_resolver_deep_free(r); + } + + fclose(rand); + + return EXIT_SUCCESS; +} diff --git a/libs/ldns/examples/ldns-revoke.1 b/libs/ldns/examples/ldns-revoke.1 new file mode 100644 index 0000000000..5a16244dac --- /dev/null +++ b/libs/ldns/examples/ldns-revoke.1 @@ -0,0 +1,27 @@ +.TH ldns-revoke 1 "23 Jul 2008" +.SH NAME +ldns-revoke \- sets the revoke bit of a DNSKEY +.SH SYNOPSIS +.B ldns-revoke +.IR file + +.SH DESCRIPTION +\fBldns-revoke\fR is used to revoke a public DNSKEY RR. +When run it will read \fIfile\fR with a DNSKEY RR in it, +sets the revoke bit and write back the output to \fIfile\fR . + +.SH OPTIONS +.TP +\fB-n\fR +Write the result to stdout instead of a file + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2008 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-revoke.c b/libs/ldns/examples/ldns-revoke.c new file mode 100644 index 0000000000..f46c98f010 --- /dev/null +++ b/libs/ldns/examples/ldns-revoke.c @@ -0,0 +1,104 @@ +/* + * revoke sets the revoke bit of a public key. + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include +#ifdef HAVE_SSL +#include +#endif /* HAVE_SSL */ + +#include + +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s [-n] keyfile\n", prog); + fprintf(fp, " Revokes a key\n"); + fprintf(fp, "Options:\n"); + fprintf(fp, " -n: do not write to file but to stdout\n"); +} + +int +main(int argc, char *argv[]) +{ + FILE *keyfp; + char *keyname; + ldns_rr *k; + uint16_t flags; + char *program = argv[0]; + int nofile = 0; + ldns_rdf *origin = NULL; + ldns_status result; + + argv++, argc--; + while (argc && argv[0][0] == '-') { + if (strcmp(argv[0], "-n") == 0) { + nofile=1; + } + else { + usage(stderr, program); + exit(EXIT_FAILURE); + } + argv++, argc--; + } + + if (argc != 1) { + usage(stderr, program); + exit(EXIT_FAILURE); + } + keyname = strdup(argv[0]); + + keyfp = fopen(keyname, "r"); + if (!keyfp) { + fprintf(stderr, "Failed to open public key file %s: %s\n", keyname, + strerror(errno)); + exit(EXIT_FAILURE); + } + + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + /* what does this while loop do? */ + while (result == LDNS_STATUS_SYNTAX_ORIGIN) { + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + } + if (result != LDNS_STATUS_OK) { + fprintf(stderr, "Could not read public key from file %s: %s\n", keyname, ldns_get_errorstr_by_id(result)); + exit(EXIT_FAILURE); + } + fclose(keyfp); + + flags = ldns_read_uint16(ldns_rdf_data(ldns_rr_dnskey_flags(k))); + flags |= LDNS_KEY_REVOKE_KEY; + + if (!ldns_rr_dnskey_set_flags(k, + ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, flags))) + { + fprintf(stderr, "Revocation failed\n"); + exit(EXIT_FAILURE); + } + + /* print the public key RR to .key */ + + if (nofile) + ldns_rr_print(stdout,k); + else { + keyfp = fopen(keyname, "w"); + if (!keyfp) { + fprintf(stderr, "Unable to open %s: %s\n", keyname, + strerror(errno)); + exit(EXIT_FAILURE); + } else { + ldns_rr_print(keyfp, k); + fclose(keyfp); + fprintf(stdout, "DNSKEY revoked\n"); + } + } + + free(keyname); + ldns_rr_free(k); + + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-rrsig.1 b/libs/ldns/examples/ldns-rrsig.1 new file mode 100644 index 0000000000..3aee863e05 --- /dev/null +++ b/libs/ldns/examples/ldns-rrsig.1 @@ -0,0 +1,30 @@ +.TH ldns-rrsig 1 "27 Apr 2005" +.SH NAME +ldns-rrsig \- print out the inception and expiration dates in human +readable form +.SH SYNOPSIS +.B ldns-rrsig +.IR domain +[ +.IR type +] + +.SH DESCRIPTION +\fBldns-rrsig\fR is used to print the expiration and inception date of +a RRSIG. The first argument is a domain name. \fBldns-rrsig\fR will +query the authoritative servers for that domain to get a list of RRSIGs. +It will then print out the inception and experiration dates for the RRSIG +covering the SOA record. +.PP +If the second argument \fBtype\fR is given the RRSIG covering that type will be shown. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-rrsig.c b/libs/ldns/examples/ldns-rrsig.c new file mode 100644 index 0000000000..5c565b1d4b --- /dev/null +++ b/libs/ldns/examples/ldns-rrsig.c @@ -0,0 +1,207 @@ +/* + * ldns-rrsig prints out the inception and expiration dates in a more readable + * way than the normal RRSIG presentation format + * + * for a particulary domain + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +static int +usage(FILE *fp, char *prog) { + fprintf(fp, "%s domain [type]\n", prog); + fprintf(fp, " print out the inception and expiration dates\n"); + fprintf(fp, " in a more human readable form\n"); + fprintf(fp, " \tquery for RRSIG(), defaults to SOA\n"); + return 0; +} + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_resolver *localres; + ldns_rdf *domain; + ldns_pkt *p; + ldns_rr_list *rrsig; + ldns_rr_list *rrsig_type; + ldns_rr_list *ns; + ldns_rr_list *ns_ip; + uint8_t i, j; + ldns_rr_type t; + char * type_name; + time_t incep, expir; + char incep_buf[26]; + char expir_buf[26]; + ldns_status s; + + p = NULL; + rrsig = NULL; + rrsig_type = NULL; + domain = NULL; + + /* option parsing */ + + if (argc < 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + /* create a rdf from the command line arg */ + domain = ldns_dname_new_frm_str(argv[1]); + if (!domain) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + if (argc == 3) { + /* optional type arg */ + type_name = strdup(argv[2]); + t = ldns_rdf2rr_type( + ldns_rdf_new_frm_str(LDNS_RDF_TYPE_TYPE, type_name)); + if (t == 0) { + fprintf(stderr, " *** %s is not a valid RR type\n", type_name); + exit(EXIT_FAILURE); + } + } else { + t = LDNS_RR_TYPE_SOA; + type_name = "SOA"; + } + + /* create a new resolver from /etc/resolv.conf */ + s = ldns_resolver_new_frm_file(&localres, NULL); + if (s != LDNS_STATUS_OK) { + exit(EXIT_FAILURE); + } + + /* first get the nameserver of the domain in question */ + p = ldns_resolver_query(localres, domain, LDNS_RR_TYPE_NS, + LDNS_RR_CLASS_IN, LDNS_RD); + if (!p) { + fprintf(stderr," *** Could not find any nameserver for %s", argv[1]); + ldns_resolver_deep_free(localres); + exit(EXIT_FAILURE); + } + ns = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); + + if (!ns) { + fprintf(stderr," *** Could not find any nameserver for %s", argv[1]); + ldns_pkt_free(p); + ldns_resolver_deep_free(localres); + exit(EXIT_FAILURE); + } + + /* use our local resolver to resolv the names in the for usage in our + * new resolver */ + res = ldns_resolver_new(); + if (!res) { + ldns_pkt_free(p); + ldns_resolver_deep_free(localres); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } + for(i = 0; i < ldns_rr_list_rr_count(ns); i++) { + ns_ip = ldns_get_rr_list_addr_by_name(localres, + ldns_rr_ns_nsdname(ldns_rr_list_rr(ns, i)), + LDNS_RR_CLASS_IN, LDNS_RD); + /* add these to new resolver */ + for(j = 0; j < ldns_rr_list_rr_count(ns_ip); j++) { + if (ldns_resolver_push_nameserver(res, + ldns_rr_a_address(ldns_rr_list_rr(ns_ip, j))) != LDNS_STATUS_OK) { + printf("Error adding nameserver to resolver\n"); + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + ldns_resolver_deep_free(localres); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } + } + ldns_rr_list_deep_free(ns_ip); + + } + + /* enable DNSSEC */ + ldns_resolver_set_dnssec(res, true); + /* also set CD, we want EVERYTHING! */ + ldns_resolver_set_dnssec_cd(res, true); + + /* use the resolver to send it a query for the soa + * records of the domain given on the command line + */ + ldns_pkt_free(p); + p = ldns_resolver_query(res, domain, LDNS_RR_TYPE_RRSIG, LDNS_RR_CLASS_IN, LDNS_RD); + + ldns_rdf_deep_free(domain); + + if (!p) { + ldns_resolver_deep_free(localres); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } else { + /* retrieve the RRSIG records from the answer section of that + * packet + */ + rrsig = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_RRSIG, LDNS_SECTION_ANSWER); + if (!rrsig) { + fprintf(stderr, + " *** invalid answer name %s after RRSIG query for %s\n", + argv[1], argv[1]); + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } else { + rrsig_type = ldns_rr_list_new(); + + for(i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { + if (ldns_rdf2rr_type( + ldns_rr_rrsig_typecovered( + ldns_rr_list_rr(rrsig, i))) == t) { + ldns_rr_list_push_rr(rrsig_type, + ldns_rr_list_rr(rrsig, i)); + } + } + if (ldns_rr_list_rr_count(rrsig_type) == 0) { + fprintf(stderr, " *** No RRSIG(%s) type found\n", + type_name); + ldns_resolver_deep_free(localres); + ldns_resolver_deep_free(res); + ldns_pkt_free(p); + ldns_rr_list_deep_free(ns); + ldns_rr_list_free(rrsig); + ldns_rr_list_deep_free(rrsig_type); + exit(EXIT_FAILURE); + } + + for(i = 0; i < ldns_rr_list_rr_count(rrsig_type); i++) { + incep = ldns_rdf2native_time_t( + ldns_rr_rrsig_inception( + ldns_rr_list_rr(rrsig_type, i))); + expir = ldns_rdf2native_time_t( + ldns_rr_rrsig_expiration( + ldns_rr_list_rr(rrsig_type, i))); + + /* convert to human readable */ + ctime_r(&incep, incep_buf); + ctime_r(&expir, expir_buf); + /* kill the newline */ + incep_buf[24] = '\0'; + expir_buf[24] = '\0'; + + fprintf(stdout, "%s RRSIG(%s): %s - %s\n", + argv[1], type_name, incep_buf, expir_buf); + } + ldns_rr_list_free(rrsig); + ldns_rr_list_deep_free(rrsig_type); + } + } + ldns_pkt_free(p); + ldns_resolver_deep_free(localres); + ldns_resolver_deep_free(res); + ldns_rr_list_deep_free(ns); + return 0; +} diff --git a/libs/ldns/examples/ldns-signzone.1 b/libs/ldns/examples/ldns-signzone.1 new file mode 100644 index 0000000000..0ac7c8094f --- /dev/null +++ b/libs/ldns/examples/ldns-signzone.1 @@ -0,0 +1,159 @@ +.TH ldns-signzone 1 "30 May 2005" +.SH NAME +ldns-signzone \- sign a zonefile with DNSSEC data +.SH SYNOPSIS +.B ldns-signzone +[ +.IR OPTIONS +] +.IR ZONEFILE +.IR +KEY +[KEY +[KEY] ... +] + +.SH DESCRIPTION + +\fBldns-signzone\fR is used to generate a DNSSEC signed zone. When run it +will create a new zonefile that contains RRSIG and NSEC resource records, as +specified in RFC 4033, RFC 4034 and RFC 4035. + +Keys must be specified by their base name (i.e. without .private). If +the DNSKEY that belongs to the key in the .private file is not present +in the zone, it will be read from the file .key. If that +file does not exist, the DNSKEY value will be generated from the +private key. + +Multiple keys can be specified, Key Signing Keys are used as such when +they are either already present in the zone, or specified in a .key +file, and have the KSK bit set. + +.SH OPTIONS +.TP +\fB-d\fR +Normally, if the DNSKEY RR for a key that is used to sign the zone is +not found in the zone file, it will be read from .key, or derived from +the private key (in that order). This option turns that feature off, +so that only the signatures are added to the zone. + +.TP +\fB-e\fR \fIdate\fR +Set expiration date of the signatures to this date, the format can be +YYYYMMDD[hhmmss], or a timestamp. + +.TP +\fB-f\fR \fIfile\fR +Use this file to store the signed zone in (default .signed) + +.TP +\fB-i\fR \fIdate\fR +Set inception date of the signatures to this date, the format can be +YYYYMMDD[hhmmss], or a timestamp. + +.TP +\fB-l\fR +Leave old DNSSEC RRSIGS and NSEC records intact (by default, they are +removed from the zone) + +.TP +\fB-o\fR \fIorigin\fR +Use this as the origin of the zone + +.TP +\fB-v\fR +Print the version and exit + +.TP +\fB-A\fR +Sign the DNSKEY record with all keys. By default it is signed with a +minimal number of keys, to keep the response size for the DNSKEY query +small, and only the SEP keys that are passed are used. If there are no +SEP keys, the DNSKEY RRset is signed with the non\-SEP keys. This option +turns off the default and all keys are used to sign the DNSKEY RRset. + +.TP +\fB-E\fR \fIname\fR +Use the EVP cryptographic engine with the given name for signing. This +can have some extra options; see ENGINE OPTIONS for more information. + +.TP +\fB-k\fR \fIid,int\fR +Use the key with the given id as the signing key for algorithm int as +a Zone signing key. This option is used when you use an OpenSSL +engine, see ENGINE OPTIONS for more information. + +.TP +\fB-K\fR \fIid,int\fR + +Use the key with the given id as the signing key for algorithm int as +a Key signing key. This options is used when you use an OpenSSL engine, +see ENGINE OPTIONS for more information. + +.TP +\fB-n\fR +Use NSEC3 instead of NSEC. + +.TP +If you use NSEC3, you can specify the following extra options: + +.TP +\fB-a\fR \fIalgorithm\fR +Algorithm used to create the hashed NSEC3 owner names + +.TP +\fB-p\fR +Opt-out. All NSEC3 records in the zone will have the Opt-out flag set. After signing, you can add insecure delegations to the signed zone. + +.TP +\fB-s\fR \fIstring\fR +Salt + +.TP +\fB-t\fR \fInumber\fR +Number of hash iterations + +.SH ENGINE OPTIONS +You can modify the possible engines, if supported, by setting an +OpenSSL configuration file. This is done through the environment +variable OPENSSL_CONF. If you use -E with a non-existent engine name, +ldns-signzone will print a list of engines supported by your +configuration. + +The key options (-k and -K) work as follows; you specify a key id, and a DNSSEC algorithm number (for instance, 5 for RSASHA1). The key id can be any of the following: + + + : + id_ + slot_-id_ + label_
\n"); + fprintf(output, "Listens on the specified port and answers queries for the given zone\n"); + fprintf(output, "This is NOT a full-fledged authoritative nameserver!\n"); +} + +static int udp_bind(int sock, int port, const char *my_address) +{ + struct sockaddr_in addr; + in_addr_t maddr = INADDR_ANY; + + if (my_address) { +#ifdef AF_INET6 + if (inet_pton(AF_INET6, my_address, &maddr) < 1) { +#else + if (0) { +#endif + if (inet_pton(AF_INET, my_address, &maddr) < 1) { + return -2; + } + } + } + + addr.sin_family = AF_INET; + addr.sin_port = (in_port_t) htons((uint16_t)port); + addr.sin_addr.s_addr = maddr; + return bind(sock, (struct sockaddr *)&addr, (socklen_t) sizeof(addr)); +} + +/* this will probably be moved to a better place in the library itself */ +ldns_rr_list * +get_rrset(const ldns_zone *zone, const ldns_rdf *owner_name, const ldns_rr_type qtype, const ldns_rr_class qclass) +{ + uint16_t i; + ldns_rr_list *rrlist = ldns_rr_list_new(); + ldns_rr *cur_rr; + if (!zone || !owner_name) { + fprintf(stderr, "Warning: get_rrset called with NULL zone or owner name\n"); + return rrlist; + } + + for (i = 0; i < ldns_zone_rr_count(zone); i++) { + cur_rr = ldns_rr_list_rr(ldns_zone_rrs(zone), i); + if (ldns_dname_compare(ldns_rr_owner(cur_rr), owner_name) == 0 && + ldns_rr_get_class(cur_rr) == qclass && + ldns_rr_get_type(cur_rr) == qtype + ) { + ldns_rr_list_push_rr(rrlist, ldns_rr_clone(cur_rr)); + } + } + + printf("Found rrset of %u rrs\n", (unsigned int) ldns_rr_list_rr_count(rrlist)); + + return rrlist; +} + +int +main(int argc, char **argv) +{ + /* arguments */ + int port; + const char *zone_file; + + /* network */ + int sock; + ssize_t nb; + struct sockaddr addr_me; + struct sockaddr addr_him; + socklen_t hislen = (socklen_t) sizeof(addr_him); + uint8_t inbuf[INBUF_SIZE]; + uint8_t *outbuf; + + /* dns */ + ldns_status status; + ldns_pkt *query_pkt; + ldns_pkt *answer_pkt; + size_t answer_size; + ldns_rr *query_rr; + ldns_rr_list *answer_qr; + ldns_rr_list *answer_an; + ldns_rr_list *answer_ns; + ldns_rr_list *answer_ad; + ldns_rdf *origin = NULL; + + /* zone */ + ldns_zone *zone; + int line_nr; + FILE *zone_fp; + + /* use this to listen on specified interfaces later? */ + char *my_address = NULL; + + if (argc < 5) { + usage(stderr); + exit(EXIT_FAILURE); + } else { + my_address = argv[1]; + port = atoi(argv[2]); + if (port < 1) { + usage(stderr); + exit(EXIT_FAILURE); + } + if (ldns_str2rdf_dname(&origin, argv[3]) != LDNS_STATUS_OK) { + fprintf(stderr, "Bad origin, not a correct domain name\n"); + usage(stderr); + exit(EXIT_FAILURE); + } + zone_file = argv[4]; + } + + printf("Reading zone file %s\n", zone_file); + zone_fp = fopen(zone_file, "r"); + if (!zone_fp) { + fprintf(stderr, "Unable to open %s: %s\n", zone_file, strerror(errno)); + exit(EXIT_FAILURE); + } + + line_nr = 0; + status = ldns_zone_new_frm_fp_l(&zone, zone_fp, origin, 0, LDNS_RR_CLASS_IN, &line_nr); + + if (status != LDNS_STATUS_OK) { + printf("Zone reader failed, aborting\n"); + exit(EXIT_FAILURE); + } else { + printf("Read %u resource records in zone file\n", (unsigned int) ldns_zone_rr_count(zone)); + } + fclose(zone_fp); + + printf("Listening on port %d\n", port); + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) { + fprintf(stderr, "%s: socket(): %s\n", argv[0], strerror(errno)); + exit(1); + } + memset(&addr_me, 0, sizeof(addr_me)); + + /* bind: try all ports in that range */ + if (udp_bind(sock, port, my_address)) { + fprintf(stderr, "%s: cannot bind(): %s\n", argv[0], strerror(errno)); + exit(errno); + } + + /* Done. Now receive */ + while (1) { + nb = recvfrom(sock, (void*)inbuf, INBUF_SIZE, 0, + &addr_him, &hislen); + if (nb < 1) { + fprintf(stderr, "%s: recvfrom(): %s\n", + argv[0], strerror(errno)); + exit(1); + } + + /* + show(inbuf, nb, nn, hp, sp, ip, bp); + */ + printf("Got query of %u bytes\n", (unsigned int) nb); + status = ldns_wire2pkt(&query_pkt, inbuf, (size_t) nb); + if (status != LDNS_STATUS_OK) { + printf("Got bad packet: %s\n", ldns_get_errorstr_by_id(status)); + } else { + ldns_pkt_print(stdout, query_pkt); + } + + query_rr = ldns_rr_list_rr(ldns_pkt_question(query_pkt), 0); + printf("QUERY RR: \n"); + ldns_rr_print(stdout, query_rr); + + answer_qr = ldns_rr_list_new(); + ldns_rr_list_push_rr(answer_qr, ldns_rr_clone(query_rr)); + + answer_an = get_rrset(zone, ldns_rr_owner(query_rr), ldns_rr_get_type(query_rr), ldns_rr_get_class(query_rr)); + answer_pkt = ldns_pkt_new(); + answer_ns = ldns_rr_list_new(); + answer_ad = ldns_rr_list_new(); + + ldns_pkt_set_qr(answer_pkt, 1); + ldns_pkt_set_aa(answer_pkt, 1); + ldns_pkt_set_id(answer_pkt, ldns_pkt_id(query_pkt)); + + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_QUESTION, answer_qr); + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_ANSWER, answer_an); + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_AUTHORITY, answer_ns); + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_ADDITIONAL, answer_ad); + + status = ldns_pkt2wire(&outbuf, answer_pkt, &answer_size); + + printf("Answer packet size: %u bytes.\n", (unsigned int) answer_size); + if (status != LDNS_STATUS_OK) { + printf("Error creating answer: %s\n", ldns_get_errorstr_by_id(status)); + } else { + nb = sendto(sock, (void*)outbuf, answer_size, 0, + &addr_him, hislen); + } + + ldns_pkt_free(query_pkt); + ldns_pkt_free(answer_pkt); + LDNS_FREE(outbuf); + ldns_rr_list_free(answer_qr); + ldns_rr_list_free(answer_an); + ldns_rr_list_free(answer_ns); + ldns_rr_list_free(answer_ad); + } + + ldns_rdf_deep_free(origin); + ldns_zone_deep_free(zone); + + return 0; +} diff --git a/libs/ldns/higher.c b/libs/ldns/higher.c new file mode 100644 index 0000000000..1563e821b6 --- /dev/null +++ b/libs/ldns/higher.c @@ -0,0 +1,354 @@ +/* + * higher.c + * + * Specify some higher level functions that would + * be usefull to would be developers + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ + +ldns_rr_list * +ldns_get_rr_list_addr_by_name(ldns_resolver *res, ldns_rdf *name, ldns_rr_class c, + uint16_t flags) +{ + ldns_pkt *pkt; + ldns_rr_list *aaaa; + ldns_rr_list *a; + ldns_rr_list *result = NULL; + ldns_rr_list *hostsfilenames; + size_t i; + uint8_t ip6; + + a = NULL; + aaaa = NULL; + result = NULL; + + if (!res) { + return NULL; + } + if (ldns_rdf_get_type(name) != LDNS_RDF_TYPE_DNAME) { + return NULL; + } + + ip6 = ldns_resolver_ip6(res); /* we use INET_ANY here, save + what was there */ + + ldns_resolver_set_ip6(res, LDNS_RESOLV_INETANY); + + hostsfilenames = ldns_get_rr_list_hosts_frm_file(NULL); + for (i = 0; i < ldns_rr_list_rr_count(hostsfilenames); i++) { + if (ldns_rdf_compare(name, + ldns_rr_owner(ldns_rr_list_rr(hostsfilenames, + i))) == 0) { + if (!result) { + result = ldns_rr_list_new(); + } + ldns_rr_list_push_rr(result, + ldns_rr_clone(ldns_rr_list_rr(hostsfilenames, i))); + } + } + ldns_rr_list_deep_free(hostsfilenames); + + if (result) { + return result; + } + + /* add the RD flags, because we want an answer */ + pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_AAAA, c, flags | LDNS_RD); + if (pkt) { + /* extract the data we need */ + aaaa = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_AAAA, + LDNS_SECTION_ANSWER); + ldns_pkt_free(pkt); + } + + pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_A, c, flags | LDNS_RD); + if (pkt) { + /* extract the data we need */ + a = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_A, LDNS_SECTION_ANSWER); + ldns_pkt_free(pkt); + } + ldns_resolver_set_ip6(res, ip6); + + if (aaaa && a) { + result = ldns_rr_list_cat_clone(aaaa, a); + ldns_rr_list_deep_free(aaaa); + ldns_rr_list_deep_free(a); + return result; + } + + if (aaaa) { + result = ldns_rr_list_clone(aaaa); + } + + if (a) { + result = ldns_rr_list_clone(a); + } + + ldns_rr_list_deep_free(aaaa); + ldns_rr_list_deep_free(a); + return result; +} + +ldns_rr_list * +ldns_get_rr_list_name_by_addr(ldns_resolver *res, ldns_rdf *addr, ldns_rr_class c, + uint16_t flags) +{ + ldns_pkt *pkt; + ldns_rr_list *names; + ldns_rdf *name; + + names = NULL; + + if (!res || !addr) { + return NULL; + } + + if (ldns_rdf_get_type(addr) != LDNS_RDF_TYPE_A && + ldns_rdf_get_type(addr) != LDNS_RDF_TYPE_AAAA) { + return NULL; + } + + name = ldns_rdf_address_reverse(addr); + + /* add the RD flags, because we want an answer */ + pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_PTR, c, flags | LDNS_RD); + if (pkt) { + /* extract the data we need */ + names = ldns_pkt_rr_list_by_type(pkt, + LDNS_RR_TYPE_PTR, LDNS_SECTION_ANSWER); + } + return names; +} + +/* read a line, put it in a buffer, parse the buffer */ +ldns_rr_list * +ldns_get_rr_list_hosts_frm_fp(FILE *fp) +{ + return ldns_get_rr_list_hosts_frm_fp_l(fp, NULL); +} + +ldns_rr_list * +ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr) +{ + ssize_t i, j; + size_t cnt; + char *line; + char *word; + char *addr; + char *rr_str; + ldns_buffer *linebuf; + ldns_rr *rr; + ldns_rr_list *list; + ldns_rdf *tmp; + bool ip6; + ldns_status parse_result; + + line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + word = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + addr = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + rr_str = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + ip6 = false; + list = ldns_rr_list_new(); + rr = NULL; + if(!line || !word || !addr || !rr_str || !list) { + LDNS_FREE(line); + LDNS_FREE(word); + LDNS_FREE(addr); + LDNS_FREE(rr_str); + ldns_rr_list_free(list); + return NULL; + } + + for(i = ldns_fget_token_l(fp, line, "\n", LDNS_MAX_LINELEN, line_nr); + i > 0; i = ldns_fget_token_l(fp, line, "\n", LDNS_MAX_LINELEN, line_nr)) { + /* # is comment */ + if (line[0] == '#') { + continue; + } + /* put it in a buffer for further processing */ + linebuf = LDNS_MALLOC(ldns_buffer); + if(!linebuf) { + LDNS_FREE(line); + LDNS_FREE(word); + LDNS_FREE(addr); + LDNS_FREE(rr_str); + ldns_rr_list_deep_free(list); + return NULL; + } + + ldns_buffer_new_frm_data(linebuf, line, (size_t) i); + for(cnt = 0, j = ldns_bget_token(linebuf, word, LDNS_PARSE_NO_NL, LDNS_MAX_LINELEN); + j > 0; + j = ldns_bget_token(linebuf, word, LDNS_PARSE_NO_NL, LDNS_MAX_LINELEN), cnt++) { + if (cnt == 0) { + /* the address */ + if ((tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, + word))) { + /* ip6 */ + ldns_rdf_deep_free(tmp); + ip6 = true; + } else { + if ((tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, + word))) { + /* ip4 */ + ldns_rdf_deep_free(tmp); + ip6 = false; + } else { + /* kaput */ + break; + } + } + (void)strlcpy(addr, word, LDNS_MAX_LINELEN+1); + } else { + /* la al la la */ + if (ip6) { + snprintf(rr_str, LDNS_MAX_LINELEN, + "%s IN AAAA %s", word, addr); + } else { + snprintf(rr_str, LDNS_MAX_LINELEN, + "%s IN A %s", word, addr); + } + parse_result = ldns_rr_new_frm_str(&rr, rr_str, 0, NULL, NULL); + if (parse_result == LDNS_STATUS_OK && ldns_rr_owner(rr) && ldns_rr_rd_count(rr) > 0) { + ldns_rr_list_push_rr(list, ldns_rr_clone(rr)); + } + ldns_rr_free(rr); + } + } + ldns_buffer_free(linebuf); + } + LDNS_FREE(line); + LDNS_FREE(word); + LDNS_FREE(addr); + LDNS_FREE(rr_str); + return list; +} + +ldns_rr_list * +ldns_get_rr_list_hosts_frm_file(char *filename) +{ + ldns_rr_list *names; + FILE *fp; + + if (!filename) { + fp = fopen(LDNS_RESOLV_HOSTS, "r"); + + } else { + fp = fopen(filename, "r"); + } + if (!fp) { + return NULL; + } + + names = ldns_get_rr_list_hosts_frm_fp(fp); + fclose(fp); + return names; +} + +uint16_t +ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, + ldns_rr_list **ret) +{ + ldns_rdf_type t; + uint16_t names_found; + ldns_resolver *r; + ldns_status s; + + t = ldns_rdf_get_type(node); + names_found = 0; + r = res; + + if (res == NULL) { + /* prepare a new resolver, using /etc/resolv.conf as a guide */ + s = ldns_resolver_new_frm_file(&r, NULL); + if (s != LDNS_STATUS_OK) { + return 0; + } + } + + if (t == LDNS_RDF_TYPE_DNAME) { + /* we're asked to query for a name */ + *ret = ldns_get_rr_list_addr_by_name(r, node, c, 0); + names_found = ldns_rr_list_rr_count(*ret); + } + + if (t == LDNS_RDF_TYPE_A || t == LDNS_RDF_TYPE_AAAA) { + /* an address */ + *ret = ldns_get_rr_list_name_by_addr(r, node, c, 0); + names_found = ldns_rr_list_rr_count(*ret); + } + + if (res == NULL) { + ldns_resolver_deep_free(r); + } + + return names_found; +} + +bool +ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t) +{ + /* does the nsec cover the t given? */ + /* copied from host2str.c line 465: ldns_rdf2buffer_str_nsec */ + uint8_t window_block_nr; + uint8_t bitmap_length; + uint16_t type; + uint16_t pos = 0; + uint16_t bit_pos; + ldns_rdf *nsec_type_list = ldns_rr_rdf(nsec, 1); + uint8_t *data = ldns_rdf_data(nsec_type_list); + + while(pos < ldns_rdf_size(nsec_type_list)) { + window_block_nr = data[pos]; + bitmap_length = data[pos + 1]; + pos += 2; + + for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { + if (ldns_get_bit(&data[pos], bit_pos)) { + type = 256 * (uint16_t) window_block_nr + bit_pos; + + if ((ldns_rr_type)type == t) { + /* we have a winner */ + return true; + } + } + } + pos += (uint16_t) bitmap_length; + } + return false; +} + +void +ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...) +{ + int16_t rdf; + ldns_rdf *rd; + va_list va_rdf; + va_start(va_rdf, rdfnum); + + for (rdf = (int16_t)rdfnum; rdf != -1; rdf = (int16_t)va_arg(va_rdf, int)) + { + rd = ldns_rr_rdf(r, rdf); + if (!rd) { + continue; + } else { + ldns_rdf_print(fp, rd); + fprintf(fp, " "); /* not sure if we want to do this */ + } + } + va_end(va_rdf); +} diff --git a/libs/ldns/host2str.c b/libs/ldns/host2str.c new file mode 100644 index 0000000000..6942f6aa3c --- /dev/null +++ b/libs/ldns/host2str.c @@ -0,0 +1,2084 @@ +/* + * host2str.c + * + * conversion routines from the host format + * to the presentation format (strings) + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ +#include + +#include + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#include +#include + +#ifndef INET_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#endif +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN 46 +#endif + +/* lookup tables for standard DNS stuff */ + +/* Taken from RFC 2535, section 7. */ +ldns_lookup_table ldns_algorithms[] = { + { LDNS_RSAMD5, "RSAMD5" }, + { LDNS_DH, "DH" }, + { LDNS_DSA, "DSA" }, + { LDNS_ECC, "ECC" }, + { LDNS_RSASHA1, "RSASHA1" }, + { LDNS_DSA_NSEC3, "DSA-NSEC3-SHA1" }, + { LDNS_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" }, +#ifdef USE_SHA2 + { LDNS_RSASHA256, "RSASHA256"}, + { LDNS_RSASHA512, "RSASHA512"}, +#endif +#ifdef USE_GOST + { LDNS_ECC_GOST, "ECC-GOST"}, +#endif +#ifdef USE_ECDSA + { LDNS_ECDSAP256SHA256, "ECDSAP256SHA256"}, + { LDNS_ECDSAP384SHA384, "ECDSAP384SHA384"}, +#endif + { LDNS_INDIRECT, "INDIRECT" }, + { LDNS_PRIVATEDNS, "PRIVATEDNS" }, + { LDNS_PRIVATEOID, "PRIVATEOID" }, + { 0, NULL } +}; + +/* Taken from RFC 4398 */ +ldns_lookup_table ldns_cert_algorithms[] = { + { LDNS_CERT_PKIX, "PKIX" }, + { LDNS_CERT_SPKI, "SPKI" }, + { LDNS_CERT_PGP, "PGP" }, + { LDNS_CERT_IPKIX, "IPKIX" }, + { LDNS_CERT_ISPKI, "ISPKI" }, + { LDNS_CERT_IPGP, "IPGP" }, + { LDNS_CERT_ACPKIX, "ACPKIX" }, + { LDNS_CERT_IACPKIX, "IACPKIX" }, + { LDNS_CERT_URI, "URI" }, + { LDNS_CERT_OID, "OID" }, + { 0, NULL } +}; + +/* classes */ +ldns_lookup_table ldns_rr_classes[] = { + { LDNS_RR_CLASS_IN, "IN" }, + { LDNS_RR_CLASS_CH, "CH" }, + { LDNS_RR_CLASS_HS, "HS" }, + { LDNS_RR_CLASS_NONE, "NONE" }, + { LDNS_RR_CLASS_ANY, "ANY" }, + { 0, NULL } +}; + +/* if these are used elsewhere */ +ldns_lookup_table ldns_rcodes[] = { + { LDNS_RCODE_NOERROR, "NOERROR" }, + { LDNS_RCODE_FORMERR, "FORMERR" }, + { LDNS_RCODE_SERVFAIL, "SERVFAIL" }, + { LDNS_RCODE_NXDOMAIN, "NXDOMAIN" }, + { LDNS_RCODE_NOTIMPL, "NOTIMPL" }, + { LDNS_RCODE_REFUSED, "REFUSED" }, + { LDNS_RCODE_YXDOMAIN, "YXDOMAIN" }, + { LDNS_RCODE_YXRRSET, "YXRRSET" }, + { LDNS_RCODE_NXRRSET, "NXRRSET" }, + { LDNS_RCODE_NOTAUTH, "NOTAUTH" }, + { LDNS_RCODE_NOTZONE, "NOTZONE" }, + { 0, NULL } +}; + +ldns_lookup_table ldns_opcodes[] = { + { LDNS_PACKET_QUERY, "QUERY" }, + { LDNS_PACKET_IQUERY, "IQUERY" }, + { LDNS_PACKET_STATUS, "STATUS" }, + { LDNS_PACKET_NOTIFY, "NOTIFY" }, + { LDNS_PACKET_UPDATE, "UPDATE" }, + { 0, NULL } +}; + +ldns_status +ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_opcodes, opcode); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "OPCODE%u", opcode); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_rcodes, rcode); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "RCODE%u", rcode); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_algorithm2buffer_str(ldns_buffer *output, + ldns_algorithm algorithm) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_algorithms, + algorithm); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "ALG%u", algorithm); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_cert_algorithm2buffer_str(ldns_buffer *output, + ldns_cert_algorithm cert_algorithm) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_cert_algorithms, + cert_algorithm); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "CERT_ALG%u", + cert_algorithm); + } + return ldns_buffer_status(output); +} + +char * +ldns_pkt_opcode2str(ldns_pkt_opcode opcode) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(12); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_pkt_opcode2buffer_str(buf, opcode) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + +char * +ldns_pkt_rcode2str(ldns_pkt_rcode rcode) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_pkt_rcode2buffer_str(buf, rcode) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + +char * +ldns_pkt_algorithm2str(ldns_algorithm algorithm) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_algorithm2buffer_str(buf, algorithm) + == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + +char * +ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_cert_algorithm2buffer_str(buf, cert_algorithm) + == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + + +/* do NOT pass compressed data here :p */ +ldns_status +ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname) +{ + /* can we do with 1 pos var? or without at all? */ + uint8_t src_pos = 0; + uint8_t len; + uint8_t *data; + uint8_t i; + unsigned char c; + + data = (uint8_t*)ldns_rdf_data(dname); + len = data[src_pos]; + + if (ldns_rdf_size(dname) > LDNS_MAX_DOMAINLEN) { + /* too large, return */ + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + + /* special case: root label */ + if (1 == ldns_rdf_size(dname)) { + ldns_buffer_printf(output, "."); + } else { + while ((len > 0) && src_pos < ldns_rdf_size(dname)) { + src_pos++; + for(i = 0; i < len; i++) { + /* paranoia check for various 'strange' + characters in dnames + */ + c = (unsigned char) data[src_pos]; + if(c == '.' || c == ';' || + c == '(' || c == ')' || + c == '\\') { + ldns_buffer_printf(output, "\\%c", + data[src_pos]); + } else if (!(isascii(c) && isgraph(c))) { + ldns_buffer_printf(output, "\\%03u", + data[src_pos]); + } else { + ldns_buffer_printf(output, "%c", data[src_pos]); + } + src_pos++; + } + + if (src_pos < ldns_rdf_size(dname)) { + ldns_buffer_printf(output, "."); + } + len = data[src_pos]; + } + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint8_t data = ldns_rdf_data(rdf)[0]; + ldns_buffer_printf(output, "%lu", (unsigned long) data); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int16(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + ldns_buffer_printf(output, "%lu", (unsigned long) data); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint32_t data = ldns_read_uint32(ldns_rdf_data(rdf)); + ldns_buffer_printf(output, "%lu", (unsigned long) data); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* create a YYYYMMDDHHMMSS string if possible */ + time_t data_time = (time_t) ldns_read_uint32(ldns_rdf_data(rdf)); + struct tm tm; + char date_buf[16]; + + memset(&tm, 0, sizeof(tm)); + + if (gmtime_r(&data_time, &tm) && strftime(date_buf, 15, "%Y%m%d%H%M%S", &tm)) { + ldns_buffer_printf(output, "%s", date_buf); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf) +{ + char str[INET_ADDRSTRLEN]; + + if (inet_ntop(AF_INET, ldns_rdf_data(rdf), str, INET_ADDRSTRLEN)) { + ldns_buffer_printf(output, "%s", str); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf) +{ + char str[INET6_ADDRSTRLEN]; + + if (inet_ntop(AF_INET6, ldns_rdf_data(rdf), str, INET6_ADDRSTRLEN)) { + ldns_buffer_printf(output, "%s", str); + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf) +{ + const uint8_t *data = ldns_rdf_data(rdf); + uint8_t length = data[0]; + size_t i; + + ldns_buffer_printf(output, "\""); + for (i = 1; i <= length; ++i) { + char ch = (char) data[i]; + if (isprint((int)ch) || ch=='\t') { + if (ch=='\"'||ch=='\\') + ldns_buffer_printf(output, "\\%c", ch); + else + ldns_buffer_printf(output, "%c", ch); + } else { + ldns_buffer_printf(output, "\\%03u", + (unsigned)(uint8_t) ch); + } + } + ldns_buffer_printf(output, "\""); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_b64(ldns_buffer *output, const ldns_rdf *rdf) +{ + size_t size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf)); + char *b64 = LDNS_XMALLOC(char, size); + if(!b64) return LDNS_STATUS_MEM_ERR; + if (ldns_b64_ntop(ldns_rdf_data(rdf), ldns_rdf_size(rdf), b64, size)) { + ldns_buffer_printf(output, "%s", b64); + } + LDNS_FREE(b64); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf) +{ + size_t size; + char *b32; + if(ldns_rdf_size(rdf) == 0) + return LDNS_STATUS_OK; + /* remove -1 for the b32-hash-len octet */ + size = ldns_b32_ntop_calculate_size(ldns_rdf_size(rdf) - 1); + /* add one for the end nul for the string */ + b32 = LDNS_XMALLOC(char, size + 1); + if(!b32) return LDNS_STATUS_MEM_ERR; + size = (size_t) ldns_b32_ntop_extended_hex(ldns_rdf_data(rdf) + 1, + ldns_rdf_size(rdf) - 1, b32, size+1); + if (size > 0) { + ldns_buffer_printf(output, "%s", b32); + } + LDNS_FREE(b32); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf) +{ + size_t i; + for (i = 0; i < ldns_rdf_size(rdf); i++) { + ldns_buffer_printf(output, "%02x", ldns_rdf_data(rdf)[i]); + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + const ldns_rr_descriptor *descriptor; + + descriptor = ldns_rr_descript(data); + if (descriptor && descriptor->_name) { + ldns_buffer_printf(output, "%s", descriptor->_name); + } else { + ldns_buffer_printf(output, "TYPE%u", data); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_class(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + ldns_lookup_table *lt; + + lt = ldns_lookup_by_id(ldns_rr_classes, (int) data); + if (lt) { + ldns_buffer_printf(output, "\t%s", lt->name); + } else { + ldns_buffer_printf(output, "\tCLASS%d", data); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + ldns_lookup_table *lt; + lt = ldns_lookup_by_id(ldns_cert_algorithms, (int) data); + if (lt) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "%d", data); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_alg(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* don't use algorithm mnemonics in the presentation format + this kind of got sneaked into the rfc's */ + uint8_t data = ldns_rdf_data(rdf)[0]; + ldns_buffer_printf(output, "%d", data); + return ldns_buffer_status(output); +} + +static void +loc_cm_print(ldns_buffer *output, uint8_t mantissa, uint8_t exponent) +{ + uint8_t i; + /* is it 0. ? */ + if(exponent < 2) { + if(exponent == 1) + mantissa *= 10; + ldns_buffer_printf(output, "0.%02ld", (long)mantissa); + return; + } + /* always */ + ldns_buffer_printf(output, "%d", (int)mantissa); + for(i=0; i_name) { + ldns_buffer_printf(output, "%s", descriptor->_name); + } else { + /* exceptions for pseudotypes */ + switch (type) { + case LDNS_RR_TYPE_IXFR: + ldns_buffer_printf(output, "IXFR"); + break; + case LDNS_RR_TYPE_AXFR: + ldns_buffer_printf(output, "AXFR"); + break; + case LDNS_RR_TYPE_MAILA: + ldns_buffer_printf(output, "MAILA"); + break; + case LDNS_RR_TYPE_MAILB: + ldns_buffer_printf(output, "MAILB"); + break; + case LDNS_RR_TYPE_ANY: + ldns_buffer_printf(output, "ANY"); + break; + default: + ldns_buffer_printf(output, "TYPE%u", type); + } + } + return ldns_buffer_status(output); +} + +char * +ldns_rr_type2str(const ldns_rr_type type) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_rr_type2buffer_str(buf, type) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + + +ldns_status +ldns_rr_class2buffer_str(ldns_buffer *output, + const ldns_rr_class klass) +{ + ldns_lookup_table *lt; + + lt = ldns_lookup_by_id(ldns_rr_classes, klass); + if (lt) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "CLASS%d", klass); + } + return ldns_buffer_status(output); +} + +char * +ldns_rr_class2str(const ldns_rr_class klass) +{ + ldns_buffer *buf; + char *str; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_rr_class2buffer_str(buf, klass) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + ldns_buffer_free(buf); + return str; +} + +ldns_status +ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* we could do checking (ie degrees < 90 etc)? */ + uint8_t version = ldns_rdf_data(rdf)[0]; + uint8_t size; + uint8_t horizontal_precision; + uint8_t vertical_precision; + uint32_t longitude; + uint32_t latitude; + uint32_t altitude; + char northerness; + char easterness; + uint32_t h; + uint32_t m; + double s; + + uint32_t equator = (uint32_t) ldns_power(2, 31); + + if (version == 0) { + size = ldns_rdf_data(rdf)[1]; + horizontal_precision = ldns_rdf_data(rdf)[2]; + vertical_precision = ldns_rdf_data(rdf)[3]; + + latitude = ldns_read_uint32(&ldns_rdf_data(rdf)[4]); + longitude = ldns_read_uint32(&ldns_rdf_data(rdf)[8]); + altitude = ldns_read_uint32(&ldns_rdf_data(rdf)[12]); + + if (latitude > equator) { + northerness = 'N'; + latitude = latitude - equator; + } else { + northerness = 'S'; + latitude = equator - latitude; + } + h = latitude / (1000 * 60 * 60); + latitude = latitude % (1000 * 60 * 60); + m = latitude / (1000 * 60); + latitude = latitude % (1000 * 60); + s = (double) latitude / 1000.0; + ldns_buffer_printf(output, "%02u %02u %0.3f %c ", + h, m, s, northerness); + + if (longitude > equator) { + easterness = 'E'; + longitude = longitude - equator; + } else { + easterness = 'W'; + longitude = equator - longitude; + } + h = longitude / (1000 * 60 * 60); + longitude = longitude % (1000 * 60 * 60); + m = longitude / (1000 * 60); + longitude = longitude % (1000 * 60); + s = (double) longitude / (1000.0); + ldns_buffer_printf(output, "%02u %02u %0.3f %c ", + h, m, s, easterness); + + + s = ((double) altitude) / 100; + s -= 100000; + + if(altitude%100 != 0) + ldns_buffer_printf(output, "%.2f", s); + else + ldns_buffer_printf(output, "%.0f", s); + + ldns_buffer_printf(output, "m "); + + loc_cm_print(output, (size & 0xf0) >> 4, size & 0x0f); + ldns_buffer_printf(output, "m "); + + loc_cm_print(output, (horizontal_precision & 0xf0) >> 4, + horizontal_precision & 0x0f); + ldns_buffer_printf(output, "m "); + + loc_cm_print(output, (vertical_precision & 0xf0) >> 4, + vertical_precision & 0x0f); + ldns_buffer_printf(output, "m"); + + return ldns_buffer_status(output); + } else { + return ldns_rdf2buffer_str_hex(output, rdf); + } +} + +ldns_status +ldns_rdf2buffer_str_unknown(ldns_buffer *output, const ldns_rdf *rdf) +{ + ldns_buffer_printf(output, "\\# %u ", ldns_rdf_size(rdf)); + return ldns_rdf2buffer_str_hex(output, rdf); +} + +ldns_status +ldns_rdf2buffer_str_nsap(ldns_buffer *output, const ldns_rdf *rdf) +{ + ldns_buffer_printf(output, "0x"); + return ldns_rdf2buffer_str_hex(output, rdf); +} + +ldns_status +ldns_rdf2buffer_str_atma(ldns_buffer *output, const ldns_rdf *rdf) +{ + return ldns_rdf2buffer_str_hex(output, rdf); +} + +ldns_status +ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* protocol, followed by bitmap of services */ + struct protoent *protocol; + char *proto_name = NULL; + uint8_t protocol_nr; + struct servent *service; + uint16_t current_service; + + protocol_nr = ldns_rdf_data(rdf)[0]; + protocol = getprotobynumber((int) protocol_nr); + if (protocol && (protocol->p_name != NULL)) { + proto_name = protocol->p_name; + ldns_buffer_printf(output, "%s ", protocol->p_name); + } else { + ldns_buffer_printf(output, "%u ", protocol_nr); + } + +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + + for (current_service = 0; + current_service < ldns_rdf_size(rdf) * 7; current_service++) { + if (ldns_get_bit(&(ldns_rdf_data(rdf)[1]), current_service)) { + service = getservbyport((int) htons(current_service), + proto_name); + if (service && service->s_name) { + ldns_buffer_printf(output, "%s ", service->s_name); + } else { + ldns_buffer_printf(output, "%u ", current_service); + } +#ifdef HAVE_ENDSERVENT + endservent(); +#endif + } + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* Note: this code is duplicated in higher.c in + * ldns_nsec_type_check() function + */ + uint8_t window_block_nr; + uint8_t bitmap_length; + uint16_t type; + uint16_t pos = 0; + uint16_t bit_pos; + uint8_t *data = ldns_rdf_data(rdf); + const ldns_rr_descriptor *descriptor; + + while(pos < ldns_rdf_size(rdf)) { + window_block_nr = data[pos]; + bitmap_length = data[pos + 1]; + pos += 2; + + for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { + if (ldns_get_bit(&data[pos], bit_pos)) { + type = 256 * (uint16_t) window_block_nr + bit_pos; + descriptor = ldns_rr_descript(type); + + if (descriptor && descriptor->_name) { + ldns_buffer_printf(output, "%s ", + descriptor->_name); + } else { + ldns_buffer_printf(output, "TYPE%u ", type); + } + } + } + + pos += (uint16_t) bitmap_length; + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint8_t salt_length; + uint8_t salt_pos; + + uint8_t *data = ldns_rdf_data(rdf); + + if(ldns_rdf_size(rdf) == 0) { + output->_status = LDNS_STATUS_ERR; + return ldns_buffer_status(output); + } + salt_length = data[0]; + /* from now there are variable length entries so remember pos */ + if (salt_length == 0 || ((size_t)salt_length)+1 > ldns_rdf_size(rdf)) { + ldns_buffer_printf(output, "- "); + } else { + for (salt_pos = 0; salt_pos < salt_length; salt_pos++) { + ldns_buffer_printf(output, "%02x", data[1 + salt_pos]); + } + ldns_buffer_printf(output, " "); + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* period is the number of seconds */ + uint32_t p = ldns_read_uint32(ldns_rdf_data(rdf)); + ldns_buffer_printf(output, "%u", p); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_tsigtime(ldns_buffer *output,const ldns_rdf *rdf) +{ + /* tsigtime is 48 bits network order unsigned integer */ + uint64_t tsigtime = 0; + uint8_t *data = ldns_rdf_data(rdf); + + if (ldns_rdf_size(rdf) != 6) { + return LDNS_STATUS_ERR; + } + + tsigtime = ldns_read_uint16(data); + tsigtime *= 65536; + tsigtime += ldns_read_uint16(data+2); + tsigtime *= 65536; + + ldns_buffer_printf(output, "%llu ", tsigtime); + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint8_t *data = ldns_rdf_data(rdf); + uint16_t address_family; + uint8_t prefix; + bool negation; + uint8_t adf_length; + size_t i; + size_t pos = 0; + + while (pos < (unsigned int) ldns_rdf_size(rdf)) { + if(pos + 3 >= (unsigned)ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + address_family = ldns_read_uint16(&data[pos]); + prefix = data[pos + 2]; + negation = data[pos + 3] & LDNS_APL_NEGATION; + adf_length = data[pos + 3] & LDNS_APL_MASK; + if (address_family == LDNS_APL_IP4) { + /* check if prefix < 32? */ + if (negation) { + ldns_buffer_printf(output, "!"); + } + ldns_buffer_printf(output, "%u:", address_family); + /* address is variable length 0 - 4 */ + for (i = 0; i < 4; i++) { + if (i > 0) { + ldns_buffer_printf(output, "."); + } + if (i < (unsigned short) adf_length) { + if(pos+i+4 >= ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + ldns_buffer_printf(output, "%d", + data[pos + i + 4]); + } else { + ldns_buffer_printf(output, "0"); + } + } + ldns_buffer_printf(output, "/%u ", prefix); + } else if (address_family == LDNS_APL_IP6) { + /* check if prefix < 128? */ + if (negation) { + ldns_buffer_printf(output, "!"); + } + ldns_buffer_printf(output, "%u:", address_family); + /* address is variable length 0 - 16 */ + for (i = 0; i < 16; i++) { + if (i % 2 == 0 && i > 0) { + ldns_buffer_printf(output, ":"); + } + if (i < (unsigned short) adf_length) { + if(pos+i+4 >= ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + ldns_buffer_printf(output, "%02x", + data[pos + i + 4]); + } else { + ldns_buffer_printf(output, "00"); + } + } + ldns_buffer_printf(output, "/%u ", prefix); + + } else { + /* unknown address family */ + ldns_buffer_printf(output, "Unknown address family: %u data: ", + address_family); + for (i = 1; i < (unsigned short) (4 + adf_length); i++) { + if(pos+i >= ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + ldns_buffer_printf(output, "%02x", data[i]); + } + } + pos += 4 + adf_length; + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* Subtract the size (2) of the number that specifies the length */ + size_t size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf) - 2); + char *b64 = LDNS_XMALLOC(char, size); + if(!b64) + return LDNS_STATUS_MEM_ERR; + + ldns_buffer_printf(output, "%u ", ldns_rdf_size(rdf) - 2); + + if (ldns_rdf_size(rdf) > 2 && + ldns_b64_ntop(ldns_rdf_data(rdf) + 2, + ldns_rdf_size(rdf) - 2, + b64, size)) { + ldns_buffer_printf(output, "%s", b64); + } + LDNS_FREE(b64); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* wire format from + http://www.ietf.org/internet-drafts/draft-ietf-ipseckey-rr-12.txt + */ + uint8_t *data = ldns_rdf_data(rdf); + uint8_t precedence; + uint8_t gateway_type; + uint8_t algorithm; + + ldns_rdf *gateway = NULL; + uint8_t *gateway_data; + + size_t public_key_size; + uint8_t *public_key_data; + ldns_rdf *public_key; + + size_t offset = 0; + ldns_status status; + + precedence = data[0]; + gateway_type = data[1]; + algorithm = data[2]; + offset = 3; + + switch (gateway_type) { + case 0: + /* no gateway */ + break; + case 1: + gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP4ADDRLEN); + if(!gateway_data) + return LDNS_STATUS_MEM_ERR; + memcpy(gateway_data, &data[offset], LDNS_IP4ADDRLEN); + gateway = ldns_rdf_new(LDNS_RDF_TYPE_A, LDNS_IP4ADDRLEN , gateway_data); + offset += LDNS_IP4ADDRLEN; + if(!gateway) { + LDNS_FREE(gateway_data); + return LDNS_STATUS_MEM_ERR; + } + break; + case 2: + gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP6ADDRLEN); + if(!gateway_data) + return LDNS_STATUS_MEM_ERR; + memcpy(gateway_data, &data[offset], LDNS_IP6ADDRLEN); + offset += LDNS_IP6ADDRLEN; + gateway = + ldns_rdf_new(LDNS_RDF_TYPE_AAAA, LDNS_IP6ADDRLEN, gateway_data); + if(!gateway) { + LDNS_FREE(gateway_data); + return LDNS_STATUS_MEM_ERR; + } + break; + case 3: + status = ldns_wire2dname(&gateway, data, ldns_rdf_size(rdf), &offset); + if(status != LDNS_STATUS_OK) + return status; + break; + default: + /* error? */ + break; + } + + public_key_size = ldns_rdf_size(rdf) - offset; + public_key_data = LDNS_XMALLOC(uint8_t, public_key_size); + if(!public_key_data) { + ldns_rdf_free(gateway); + return LDNS_STATUS_MEM_ERR; + } + memcpy(public_key_data, &data[offset], public_key_size); + public_key = ldns_rdf_new(LDNS_RDF_TYPE_B64, public_key_size, public_key_data); + if(!public_key) { + LDNS_FREE(public_key_data); + ldns_rdf_free(gateway); + return LDNS_STATUS_MEM_ERR; + } + + ldns_buffer_printf(output, "%u %u %u ", precedence, gateway_type, algorithm); + if (gateway) + (void) ldns_rdf2buffer_str(output, gateway); + else + ldns_buffer_printf(output, "."); + ldns_buffer_printf(output, " "); + (void) ldns_rdf2buffer_str(output, public_key); + + ldns_rdf_free(gateway); + ldns_rdf_free(public_key); + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* TSIG RRs have no presentation format, make them #size */ + return ldns_rdf2buffer_str_unknown(output, rdf); +} + + +ldns_status +ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) +{ + ldns_status res = LDNS_STATUS_OK; + + /*ldns_buffer_printf(buffer, "%u:", ldns_rdf_get_type(rdf));*/ + if (rdf) { + switch(ldns_rdf_get_type(rdf)) { + case LDNS_RDF_TYPE_NONE: + break; + case LDNS_RDF_TYPE_DNAME: + res = ldns_rdf2buffer_str_dname(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT8: + res = ldns_rdf2buffer_str_int8(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT16: + res = ldns_rdf2buffer_str_int16(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT32: + res = ldns_rdf2buffer_str_int32(buffer, rdf); + break; + case LDNS_RDF_TYPE_PERIOD: + res = ldns_rdf2buffer_str_period(buffer, rdf); + break; + case LDNS_RDF_TYPE_TSIGTIME: + res = ldns_rdf2buffer_str_tsigtime(buffer, rdf); + break; + case LDNS_RDF_TYPE_A: + res = ldns_rdf2buffer_str_a(buffer, rdf); + break; + case LDNS_RDF_TYPE_AAAA: + res = ldns_rdf2buffer_str_aaaa(buffer, rdf); + break; + case LDNS_RDF_TYPE_STR: + res = ldns_rdf2buffer_str_str(buffer, rdf); + break; + case LDNS_RDF_TYPE_APL: + res = ldns_rdf2buffer_str_apl(buffer, rdf); + break; + case LDNS_RDF_TYPE_B32_EXT: + res = ldns_rdf2buffer_str_b32_ext(buffer, rdf); + break; + case LDNS_RDF_TYPE_B64: + res = ldns_rdf2buffer_str_b64(buffer, rdf); + break; + case LDNS_RDF_TYPE_HEX: + res = ldns_rdf2buffer_str_hex(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSEC: + res = ldns_rdf2buffer_str_nsec(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSEC3_SALT: + res = ldns_rdf2buffer_str_nsec3_salt(buffer, rdf); + break; + case LDNS_RDF_TYPE_TYPE: + res = ldns_rdf2buffer_str_type(buffer, rdf); + break; + case LDNS_RDF_TYPE_CLASS: + res = ldns_rdf2buffer_str_class(buffer, rdf); + break; + case LDNS_RDF_TYPE_CERT_ALG: + res = ldns_rdf2buffer_str_cert_alg(buffer, rdf); + break; + case LDNS_RDF_TYPE_ALG: + res = ldns_rdf2buffer_str_alg(buffer, rdf); + break; + case LDNS_RDF_TYPE_UNKNOWN: + res = ldns_rdf2buffer_str_unknown(buffer, rdf); + break; + case LDNS_RDF_TYPE_TIME: + res = ldns_rdf2buffer_str_time(buffer, rdf); + break; + case LDNS_RDF_TYPE_LOC: + res = ldns_rdf2buffer_str_loc(buffer, rdf); + break; + case LDNS_RDF_TYPE_WKS: + case LDNS_RDF_TYPE_SERVICE: + res = ldns_rdf2buffer_str_wks(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSAP: + res = ldns_rdf2buffer_str_nsap(buffer, rdf); + break; + case LDNS_RDF_TYPE_ATMA: + res = ldns_rdf2buffer_str_atma(buffer, rdf); + break; + case LDNS_RDF_TYPE_IPSECKEY: + res = ldns_rdf2buffer_str_ipseckey(buffer, rdf); + break; + case LDNS_RDF_TYPE_TSIG: + res = ldns_rdf2buffer_str_tsig(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT16_DATA: + res = ldns_rdf2buffer_str_int16_data(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + res = ldns_rdf2buffer_str_b32_ext(buffer, rdf); + break; + } + } else { + ldns_buffer_printf(buffer, "(null) "); + res = ldns_buffer_status(buffer); + } + return res; +} + +ldns_status +ldns_rr2buffer_str(ldns_buffer *output, const ldns_rr *rr) +{ + uint16_t i, flags; + ldns_status status = LDNS_STATUS_OK; + if (!rr) { + ldns_buffer_printf(output, "(null)\n"); + } else { + if (ldns_rr_owner(rr)) { + status = ldns_rdf2buffer_str_dname(output, ldns_rr_owner(rr)); + } + if (status != LDNS_STATUS_OK) { + return status; + } + + /* TTL should NOT be printed if it is a question */ + if (!ldns_rr_is_question(rr)) { + ldns_buffer_printf(output, "\t%d", ldns_rr_ttl(rr)); + } + + ldns_buffer_printf(output, "\t"); + status = ldns_rr_class2buffer_str(output, ldns_rr_get_class(rr)); + if (status != LDNS_STATUS_OK) { + return status; + } + ldns_buffer_printf(output, "\t"); + + status = ldns_rr_type2buffer_str(output, ldns_rr_get_type(rr)); + if (status != LDNS_STATUS_OK) { + return status; + } + + if (ldns_rr_rd_count(rr) > 0) { + ldns_buffer_printf(output, "\t"); + } else if (!ldns_rr_is_question(rr)) { + ldns_buffer_printf(output, "\t\\# 0"); + } + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + status = ldns_rdf2buffer_str(output, ldns_rr_rdf(rr, i)); + if(status != LDNS_STATUS_OK) + return status; + if (i < ldns_rr_rd_count(rr) - 1) { + ldns_buffer_printf(output, " "); + } + } + /* per RR special comments - handy for DNSSEC types */ + /* check to prevent question sec. rr from + * getting here */ + if (ldns_rr_rd_count(rr) > 0) { + switch (ldns_rr_get_type(rr)) { + case LDNS_RR_TYPE_DNSKEY: + if (ldns_rr_rdf(rr, 0)) { + flags = ldns_rdf2native_int16(ldns_rr_rdf(rr, 0)); + if (flags == 256 || flags == 384) { + ldns_buffer_printf(output, + " ;{id = %u (zsk), size = %db}", + (unsigned int) ldns_calc_keytag(rr), + ldns_rr_dnskey_key_size(rr)); + break; + } + if (flags == 257 || flags == 385) { + ldns_buffer_printf(output, + " ;{id = %u (ksk), size = %db}", + (unsigned int) ldns_calc_keytag(rr), + ldns_rr_dnskey_key_size(rr)); + break; + } + ldns_buffer_printf(output, " ;{id = %u, size = %db}", + (unsigned int) ldns_calc_keytag(rr), + ldns_rr_dnskey_key_size(rr)); + } + break; + case LDNS_RR_TYPE_RRSIG: + ldns_buffer_printf(output, " ;{id = %d}", + ldns_rdf2native_int16(ldns_rr_rdf(rr, 6))); + break; + case LDNS_RR_TYPE_DS: + { + uint8_t *data = ldns_rdf_data(ldns_rr_rdf(rr, 3)); + size_t len = ldns_rdf_size(ldns_rr_rdf(rr, 3)); + char *babble = ldns_bubblebabble(data, len); + if(babble) + ldns_buffer_printf(output, " ; %s", babble); + LDNS_FREE(babble); + } + break; + case LDNS_RR_TYPE_NSEC3: + if (ldns_nsec3_optout(rr)) { + ldns_buffer_printf(output, " ; flags: optout"); + } + break; + default: + break; + + } + } + /* last */ + ldns_buffer_printf(output, "\n"); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rr_list2buffer_str(ldns_buffer *output, const ldns_rr_list *list) +{ + uint16_t i; + + for(i = 0; i < ldns_rr_list_rr_count(list); i++) { + (void) ldns_rr2buffer_str(output, ldns_rr_list_rr(list, i)); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt) +{ + ldns_lookup_table *opcode = ldns_lookup_by_id(ldns_opcodes, + (int) ldns_pkt_get_opcode(pkt)); + ldns_lookup_table *rcode = ldns_lookup_by_id(ldns_rcodes, + (int) ldns_pkt_get_rcode(pkt)); + + ldns_buffer_printf(output, ";; ->>HEADER<<- "); + if (opcode) { + ldns_buffer_printf(output, "opcode: %s, ", opcode->name); + } else { + ldns_buffer_printf(output, "opcode: ?? (%u), ", + ldns_pkt_get_opcode(pkt)); + } + if (rcode) { + ldns_buffer_printf(output, "rcode: %s, ", rcode->name); + } else { + ldns_buffer_printf(output, "rcode: ?? (%u), ", ldns_pkt_get_rcode(pkt)); + } + ldns_buffer_printf(output, "id: %d\n", ldns_pkt_id(pkt)); + ldns_buffer_printf(output, ";; flags: "); + + if (ldns_pkt_qr(pkt)) { + ldns_buffer_printf(output, "qr "); + } + if (ldns_pkt_aa(pkt)) { + ldns_buffer_printf(output, "aa "); + } + if (ldns_pkt_tc(pkt)) { + ldns_buffer_printf(output, "tc "); + } + if (ldns_pkt_rd(pkt)) { + ldns_buffer_printf(output, "rd "); + } + if (ldns_pkt_cd(pkt)) { + ldns_buffer_printf(output, "cd "); + } + if (ldns_pkt_ra(pkt)) { + ldns_buffer_printf(output, "ra "); + } + if (ldns_pkt_ad(pkt)) { + ldns_buffer_printf(output, "ad "); + } + ldns_buffer_printf(output, "; "); + ldns_buffer_printf(output, "QUERY: %u, ", ldns_pkt_qdcount(pkt)); + ldns_buffer_printf(output, "ANSWER: %u, ", ldns_pkt_ancount(pkt)); + ldns_buffer_printf(output, "AUTHORITY: %u, ", ldns_pkt_nscount(pkt)); + ldns_buffer_printf(output, "ADDITIONAL: %u ", ldns_pkt_arcount(pkt)); + return ldns_buffer_status(output); +} + +ldns_status +ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt) +{ + uint16_t i; + ldns_status status = LDNS_STATUS_OK; + char *tmp; + struct timeval time; + time_t time_tt; + + if (!pkt) { + ldns_buffer_printf(output, "null"); + return LDNS_STATUS_OK; + } + + if (ldns_buffer_status_ok(output)) { + status = ldns_pktheader2buffer_str(output, pkt); + if (status != LDNS_STATUS_OK) { + return status; + } + + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; QUESTION SECTION:\n;; "); + + + for (i = 0; i < ldns_pkt_qdcount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_question(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + } + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; ANSWER SECTION:\n"); + for (i = 0; i < ldns_pkt_ancount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_answer(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + + } + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; AUTHORITY SECTION:\n"); + + for (i = 0; i < ldns_pkt_nscount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_authority(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + } + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; ADDITIONAL SECTION:\n"); + for (i = 0; i < ldns_pkt_arcount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_additional(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + + } + ldns_buffer_printf(output, "\n"); + /* add some futher fields */ + ldns_buffer_printf(output, ";; Query time: %d msec\n", + ldns_pkt_querytime(pkt)); + if (ldns_pkt_edns(pkt)) { + ldns_buffer_printf(output, + ";; EDNS: version %u; flags:", + ldns_pkt_edns_version(pkt)); + if (ldns_pkt_edns_do(pkt)) { + ldns_buffer_printf(output, " do"); + } + /* the extended rcode is the value set, shifted four bits, + * and or'd with the original rcode */ + if (ldns_pkt_edns_extended_rcode(pkt)) { + ldns_buffer_printf(output, " ; ext-rcode: %d", + (ldns_pkt_edns_extended_rcode(pkt) << 4 | ldns_pkt_get_rcode(pkt))); + } + ldns_buffer_printf(output, " ; udp: %u\n", + ldns_pkt_edns_udp_size(pkt)); + + if (ldns_pkt_edns_data(pkt)) { + ldns_buffer_printf(output, ";; Data: "); + (void)ldns_rdf2buffer_str(output, + ldns_pkt_edns_data(pkt)); + ldns_buffer_printf(output, "\n"); + } + } + if (ldns_pkt_tsig(pkt)) { + ldns_buffer_printf(output, ";; TSIG:\n;; "); + (void) ldns_rr2buffer_str(output, ldns_pkt_tsig(pkt)); + ldns_buffer_printf(output, "\n"); + } + if (ldns_pkt_answerfrom(pkt)) { + tmp = ldns_rdf2str(ldns_pkt_answerfrom(pkt)); + ldns_buffer_printf(output, ";; SERVER: %s\n", tmp); + LDNS_FREE(tmp); + } + time = ldns_pkt_timestamp(pkt); + time_tt = (time_t)time.tv_sec; + ldns_buffer_printf(output, ";; WHEN: %s", + (char*)ctime(&time_tt)); + + ldns_buffer_printf(output, ";; MSG SIZE rcvd: %d\n", + (int)ldns_pkt_size(pkt)); + } else { + return ldns_buffer_status(output); + } + return status; +} + +#ifdef HAVE_SSL +static ldns_status +ldns_hmac_key2buffer_str(ldns_buffer *output, const ldns_key *k) +{ + ldns_status status; + size_t i; + ldns_rdf *b64_bignum; + + ldns_buffer_printf(output, "Key: "); + + i = ldns_key_hmac_size(k); + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, ldns_key_hmac_key(k)); + status = ldns_rdf2buffer_str(output, b64_bignum); + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + return status; +} +#endif + +#if defined(HAVE_SSL) && defined(USE_GOST) +static ldns_status +ldns_gost_key2buffer_str(ldns_buffer *output, EVP_PKEY *p) +{ + unsigned char* pp = NULL; + int ret; + ldns_rdf *b64_bignum; + ldns_status status; + + ldns_buffer_printf(output, "GostAsn1: "); + + ret = i2d_PrivateKey(p, &pp); + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, (size_t)ret, pp); + status = ldns_rdf2buffer_str(output, b64_bignum); + + ldns_rdf_deep_free(b64_bignum); + OPENSSL_free(pp); + ldns_buffer_printf(output, "\n"); + return status; +} +#endif + +ldns_status +ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k) +{ + ldns_status status = LDNS_STATUS_OK; + unsigned char *bignum; +#ifndef S_SPLINT_S + uint16_t i; +#endif + +#ifdef HAVE_SSL + /* not used when ssl is not defined */ + ldns_rdf *b64_bignum = NULL; + + RSA *rsa; + DSA *dsa; +#endif /* HAVE_SSL */ + + if (!k) { + return LDNS_STATUS_ERR; + } + + bignum = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bignum) { + return LDNS_STATUS_ERR; + } + + if (ldns_buffer_status_ok(output)) { +#ifdef HAVE_SSL + switch(ldns_key_algorithm(k)) { + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + case LDNS_SIGN_RSAMD5: + /* copied by looking at dnssec-keygen output */ + /* header */ + rsa = ldns_key_rsa_key(k); + + ldns_buffer_printf(output,"Private-key-format: v1.2\n"); + switch(ldns_key_algorithm(k)) { + case LDNS_SIGN_RSAMD5: + ldns_buffer_printf(output, + "Algorithm: %u (RSA)\n", + LDNS_RSAMD5); + break; + case LDNS_SIGN_RSASHA1: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA1)\n", + LDNS_RSASHA1); + break; + case LDNS_SIGN_RSASHA1_NSEC3: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA1_NSEC3)\n", + LDNS_RSASHA1_NSEC3); + break; +#ifdef USE_SHA2 + case LDNS_SIGN_RSASHA256: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA256)\n", + LDNS_RSASHA256); + break; + case LDNS_SIGN_RSASHA512: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA512)\n", + LDNS_RSASHA512); + break; +#endif + default: + fprintf(stderr, "Warning: unknown signature "); + fprintf(stderr, + "algorithm type %u\n", + ldns_key_algorithm(k)); + ldns_buffer_printf(output, + "Algorithm: %u (Unknown)\n", + ldns_key_algorithm(k)); + break; + } + + /* print to buf, convert to bin, convert to b64, + * print to buf */ + ldns_buffer_printf(output, "Modulus: "); +#ifndef S_SPLINT_S + i = (uint16_t)BN_bn2bin(rsa->n, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + ldns_buffer_printf(output, "PublicExponent: "); + i = (uint16_t)BN_bn2bin(rsa->e, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, "PrivateExponent: "); + if (rsa->d) { + i = (uint16_t)BN_bn2bin(rsa->d, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Prime1: "); + if (rsa->p) { + i = (uint16_t)BN_bn2bin(rsa->p, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Prime2: "); + if (rsa->q) { + i = (uint16_t)BN_bn2bin(rsa->q, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Exponent1: "); + if (rsa->dmp1) { + i = (uint16_t)BN_bn2bin(rsa->dmp1, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Exponent2: "); + if (rsa->dmq1) { + i = (uint16_t)BN_bn2bin(rsa->dmq1, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Coefficient: "); + if (rsa->iqmp) { + i = (uint16_t)BN_bn2bin(rsa->iqmp, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } +#endif /* splint */ + + RSA_free(rsa); + break; + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: + dsa = ldns_key_dsa_key(k); + + ldns_buffer_printf(output,"Private-key-format: v1.2\n"); + if (ldns_key_algorithm(k) == LDNS_SIGN_DSA) { + ldns_buffer_printf(output,"Algorithm: 3 (DSA)\n"); + } else if (ldns_key_algorithm(k) == LDNS_SIGN_DSA_NSEC3) { + ldns_buffer_printf(output,"Algorithm: 6 (DSA_NSEC3)\n"); + } + + /* print to buf, convert to bin, convert to b64, + * print to buf */ + ldns_buffer_printf(output, "Prime(p): "); +#ifndef S_SPLINT_S + if (dsa->p) { + i = (uint16_t)BN_bn2bin(dsa->p, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Subprime(q): "); + if (dsa->q) { + i = (uint16_t)BN_bn2bin(dsa->q, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Base(g): "); + if (dsa->g) { + i = (uint16_t)BN_bn2bin(dsa->g, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Private_value(x): "); + if (dsa->priv_key) { + i = (uint16_t)BN_bn2bin(dsa->priv_key, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Public_value(y): "); + if (dsa->pub_key) { + i = (uint16_t)BN_bn2bin(dsa->pub_key, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } +#endif /* splint */ + break; + case LDNS_SIGN_ECC_GOST: + /* no format defined, use blob */ +#if defined(HAVE_SSL) && defined(USE_GOST) + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: %d (ECC-GOST)\n", LDNS_SIGN_ECC_GOST); + status = ldns_gost_key2buffer_str(output, +#ifndef S_SPLINT_S + k->_key.key +#else + NULL +#endif + ); + +#endif + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: %d (", ldns_key_algorithm(k)); + status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k)); +#ifndef S_SPLINT_S + ldns_buffer_printf(output, ")\n"); + if(k->_key.key) { + EC_KEY* ec = EVP_PKEY_get1_EC_KEY(k->_key.key); + const BIGNUM* b = EC_KEY_get0_private_key(ec); + ldns_buffer_printf(output, "PrivateKey: "); + i = (uint16_t)BN_bn2bin(b, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + /* down reference count in EC_KEY + * its still assigned to the PKEY */ + EC_KEY_free(ec); + } +#endif /* splint */ + break; +#endif + case LDNS_SIGN_HMACMD5: + /* there's not much of a format defined for TSIG */ + /* It's just a binary blob, Same for all algorithms */ + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: 157 (HMAC_MD5)\n"); + status = ldns_hmac_key2buffer_str(output, k); + break; + case LDNS_SIGN_HMACSHA1: + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: 158 (HMAC_SHA1)\n"); + status = ldns_hmac_key2buffer_str(output, k); + break; + case LDNS_SIGN_HMACSHA256: + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: 159 (HMAC_SHA256)\n"); + status = ldns_hmac_key2buffer_str(output, k); + break; + } +#endif /* HAVE_SSL */ + } else { +#ifdef HAVE_SSL + LDNS_FREE(b64_bignum); +#endif + LDNS_FREE(bignum); + return ldns_buffer_status(output); + } + LDNS_FREE(bignum); + return status; + +#ifdef HAVE_SSL + /* compiles warn the label isn't used */ +error: + LDNS_FREE(bignum); + return LDNS_STATUS_ERR; +#endif /* HAVE_SSL */ + +} + +/* + * Zero terminate the buffer and fix it to the size of the string. + */ +char * +ldns_buffer2str(ldns_buffer *buffer) +{ + char *tmp_str; + char *str; + + /* check if buffer ends with \0, if not, and + if there is space, add it */ + if (*(ldns_buffer_at(buffer, ldns_buffer_position(buffer))) != 0) { + if (!ldns_buffer_reserve(buffer, 1)) { + return NULL; + } + ldns_buffer_write_u8(buffer, (uint8_t) '\0'); + if (!ldns_buffer_set_capacity(buffer, ldns_buffer_position(buffer))) { + return NULL; + } + } + + tmp_str = ldns_buffer_export(buffer); + str = LDNS_XMALLOC(char, strlen(tmp_str) + 1); + if(!str) { + return NULL; + } + memcpy(str, tmp_str, strlen(tmp_str) + 1); + + return str; +} + +char * +ldns_rdf2str(const ldns_rdf *rdf) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_rdf2buffer_str(tmp_buffer, rdf) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_rr2str(const ldns_rr *rr) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_rr2buffer_str(tmp_buffer, rr) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_pkt2str(const ldns_pkt *pkt) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_pkt2buffer_str(tmp_buffer, pkt) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_key2str(const ldns_key *k) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_key2buffer_str(tmp_buffer, k) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_rr_list2str(const ldns_rr_list *list) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (list) { + if (ldns_rr_list2buffer_str(tmp_buffer, list) == LDNS_STATUS_OK) { + } + } else { + ldns_buffer_printf(tmp_buffer, "(null)\n"); + } + + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + ldns_buffer_free(tmp_buffer); + return result; +} + +void +ldns_rdf_print(FILE *output, const ldns_rdf *rdf) +{ + char *str = ldns_rdf2str(rdf); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert rdf to string\n"); + } + LDNS_FREE(str); +} + +void +ldns_rr_print(FILE *output, const ldns_rr *rr) +{ + char *str = ldns_rr2str(rr); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert rr to string\n"); + } + LDNS_FREE(str); +} + +void +ldns_pkt_print(FILE *output, const ldns_pkt *pkt) +{ + char *str = ldns_pkt2str(pkt); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert packet to string\n"); + } + LDNS_FREE(str); +} + +void +ldns_rr_list_print(FILE *output, const ldns_rr_list *lst) +{ + size_t i; + for (i = 0; i < ldns_rr_list_rr_count(lst); i++) { + ldns_rr_print(output, ldns_rr_list_rr(lst, i)); + } +} + +void +ldns_resolver_print(FILE *output, const ldns_resolver *r) +{ + uint16_t i; + ldns_rdf **n; + ldns_rdf **s; + size_t *rtt; + if (!r) { + return; + } + n = ldns_resolver_nameservers(r); + s = ldns_resolver_searchlist(r); + rtt = ldns_resolver_rtt(r); + + fprintf(output, "port: %d\n", (int)ldns_resolver_port(r)); + fprintf(output, "edns0 size: %d\n", (int)ldns_resolver_edns_udp_size(r)); + fprintf(output, "use ip6: %d\n", (int)ldns_resolver_ip6(r)); + + fprintf(output, "recursive: %d\n", ldns_resolver_recursive(r)); + fprintf(output, "usevc: %d\n", ldns_resolver_usevc(r)); + fprintf(output, "igntc: %d\n", ldns_resolver_igntc(r)); + fprintf(output, "fail: %d\n", ldns_resolver_fail(r)); + fprintf(output, "retry: %d\n", (int)ldns_resolver_retry(r)); + fprintf(output, "retrans: %d\n", (int)ldns_resolver_retrans(r)); + fprintf(output, "fallback: %d\n", ldns_resolver_fallback(r)); + fprintf(output, "random: %d\n", ldns_resolver_random(r)); + fprintf(output, "timeout: %d\n", (int)ldns_resolver_timeout(r).tv_sec); + fprintf(output, "dnssec: %d\n", ldns_resolver_dnssec(r)); + fprintf(output, "dnssec cd: %d\n", ldns_resolver_dnssec_cd(r)); + fprintf(output, "trust anchors (%d listed):\n", + (int)ldns_rr_list_rr_count(ldns_resolver_dnssec_anchors(r))); + ldns_rr_list_print(output, ldns_resolver_dnssec_anchors(r)); + fprintf(output, "tsig: %s %s\n", + ldns_resolver_tsig_keyname(r)?ldns_resolver_tsig_keyname(r):"-", + ldns_resolver_tsig_algorithm(r)?ldns_resolver_tsig_algorithm(r):"-"); + fprintf(output, "debug: %d\n", ldns_resolver_debug(r)); + + fprintf(output, "default domain: "); + ldns_rdf_print(output, ldns_resolver_domain(r)); + fprintf(output, "\n"); + fprintf(output, "apply default domain: %d\n", ldns_resolver_defnames(r)); + + fprintf(output, "searchlist (%d listed):\n", (int)ldns_resolver_searchlist_count(r)); + for (i = 0; i < ldns_resolver_searchlist_count(r); i++) { + fprintf(output, "\t"); + ldns_rdf_print(output, s[i]); + fprintf(output, "\n"); + } + fprintf(output, "apply search list: %d\n", ldns_resolver_dnsrch(r)); + + fprintf(output, "nameservers (%d listed):\n", (int)ldns_resolver_nameserver_count(r)); + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + fprintf(output, "\t"); + ldns_rdf_print(output, n[i]); + + switch ((int)rtt[i]) { + case LDNS_RESOLV_RTT_MIN: + fprintf(output, " - reachable\n"); + break; + case LDNS_RESOLV_RTT_INF: + fprintf(output, " - unreachable\n"); + break; + } + } +} + +void +ldns_zone_print(FILE *output, const ldns_zone *z) +{ + if(ldns_zone_soa(z)) + ldns_rr_print(output, ldns_zone_soa(z)); + ldns_rr_list_print(output, ldns_zone_rrs(z)); +} diff --git a/libs/ldns/host2wire.c b/libs/ldns/host2wire.c new file mode 100644 index 0000000000..1ffb0f5168 --- /dev/null +++ b/libs/ldns/host2wire.c @@ -0,0 +1,433 @@ +/* + * host2wire.c + * + * conversion routines from the host to the wire format. + * This will usually just a re-ordering of the + * data (as we store it in network format) + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +/* TODO Jelte + add a pointer to a 'possiblecompression' structure + to all the needed functions? + something like an array of name, pointer values? + every dname part could be added to it +*/ + +ldns_status +ldns_dname2buffer_wire(ldns_buffer *buffer, const ldns_rdf *name) +{ + if (ldns_buffer_reserve(buffer, ldns_rdf_size(name))) { + ldns_buffer_write(buffer, ldns_rdf_data(name), ldns_rdf_size(name)); + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rdf2buffer_wire(ldns_buffer *buffer, const ldns_rdf *rdf) +{ + if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { + ldns_buffer_write(buffer, ldns_rdf_data(rdf), ldns_rdf_size(rdf)); + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rdf2buffer_wire_canonical(ldns_buffer *buffer, const ldns_rdf *rdf) +{ + size_t i; + uint8_t *rdf_data; + + if (ldns_rdf_get_type(rdf) == LDNS_RDF_TYPE_DNAME) { + if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { + rdf_data = ldns_rdf_data(rdf); + for (i = 0; i < ldns_rdf_size(rdf); i++) { + ldns_buffer_write_u8(buffer, + (uint8_t) LDNS_DNAME_NORMALIZE((int)rdf_data[i])); + } + } + } else { + /* direct copy for all other types */ + if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { + ldns_buffer_write(buffer, + ldns_rdf_data(rdf), + ldns_rdf_size(rdf)); + } + } + return ldns_buffer_status(buffer); +} + +/* convert a rr list to wireformat */ +ldns_status +ldns_rr_list2buffer_wire(ldns_buffer *buffer,const ldns_rr_list *rr_list) +{ + uint16_t rr_count; + uint16_t i; + + rr_count = ldns_rr_list_rr_count(rr_list); + for(i = 0; i < rr_count; i++) { + (void)ldns_rr2buffer_wire(buffer, ldns_rr_list_rr(rr_list, i), + LDNS_SECTION_ANY); + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rr2buffer_wire_canonical(ldns_buffer *buffer, + const ldns_rr *rr, + int section) +{ + uint16_t i; + uint16_t rdl_pos = 0; + bool pre_rfc3597 = false; + switch (ldns_rr_get_type(rr)) { + case LDNS_RR_TYPE_NS: + case LDNS_RR_TYPE_MD: + case LDNS_RR_TYPE_MF: + case LDNS_RR_TYPE_CNAME: + case LDNS_RR_TYPE_SOA: + case LDNS_RR_TYPE_MB: + case LDNS_RR_TYPE_MG: + case LDNS_RR_TYPE_MR: + case LDNS_RR_TYPE_PTR: + case LDNS_RR_TYPE_HINFO: + case LDNS_RR_TYPE_MINFO: + case LDNS_RR_TYPE_MX: + case LDNS_RR_TYPE_RP: + case LDNS_RR_TYPE_AFSDB: + case LDNS_RR_TYPE_RT: + case LDNS_RR_TYPE_SIG: + case LDNS_RR_TYPE_PX: + case LDNS_RR_TYPE_NXT: + case LDNS_RR_TYPE_NAPTR: + case LDNS_RR_TYPE_KX: + case LDNS_RR_TYPE_SRV: + case LDNS_RR_TYPE_DNAME: + case LDNS_RR_TYPE_A6: + pre_rfc3597 = true; + break; + default: + break; + } + + if (ldns_rr_owner(rr)) { + (void) ldns_rdf2buffer_wire_canonical(buffer, ldns_rr_owner(rr)); + } + + if (ldns_buffer_reserve(buffer, 4)) { + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_type(rr)); + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_class(rr)); + } + + if (section != LDNS_SECTION_QUESTION) { + if (ldns_buffer_reserve(buffer, 6)) { + ldns_buffer_write_u32(buffer, ldns_rr_ttl(rr)); + /* remember pos for later */ + rdl_pos = ldns_buffer_position(buffer); + ldns_buffer_write_u16(buffer, 0); + } + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + if (pre_rfc3597) { + (void) ldns_rdf2buffer_wire_canonical(buffer, + ldns_rr_rdf(rr, i)); + } else { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + } + + if (rdl_pos != 0) { + ldns_buffer_write_u16_at(buffer, rdl_pos, + ldns_buffer_position(buffer) + - rdl_pos - 2); + } + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rr2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr, int section) +{ + uint16_t i; + uint16_t rdl_pos = 0; + + if (ldns_rr_owner(rr)) { + (void) ldns_dname2buffer_wire(buffer, ldns_rr_owner(rr)); + } + + if (ldns_buffer_reserve(buffer, 4)) { + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_type(rr)); + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_class(rr)); + } + + if (section != LDNS_SECTION_QUESTION) { + if (ldns_buffer_reserve(buffer, 6)) { + ldns_buffer_write_u32(buffer, ldns_rr_ttl(rr)); + /* remember pos for later */ + rdl_pos = ldns_buffer_position(buffer); + ldns_buffer_write_u16(buffer, 0); + } + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + + if (rdl_pos != 0) { + ldns_buffer_write_u16_at(buffer, rdl_pos, + ldns_buffer_position(buffer) + - rdl_pos - 2); + } + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rrsig2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) +{ + uint16_t i; + + /* it must be a sig RR */ + if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { + return LDNS_STATUS_ERR; + } + + /* Convert all the rdfs, except the actual signature data + * rdf number 8 - the last, hence: -1 */ + for (i = 0; i < ldns_rr_rd_count(rr) - 1; i++) { + if (ldns_rr_rdf(rr, i)) { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + } + + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rr_rdata2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) +{ + uint16_t i; + /* convert all the rdf's */ + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + + return ldns_buffer_status(buffer); +} + +/* + * Copies the packet header data to the buffer in wire format + */ +static ldns_status +ldns_hdr2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet) +{ + uint8_t flags; + uint16_t arcount; + + if (ldns_buffer_reserve(buffer, 12)) { + ldns_buffer_write_u16(buffer, ldns_pkt_id(packet)); + + flags = ldns_pkt_qr(packet) << 7 + | ldns_pkt_get_opcode(packet) << 3 + | ldns_pkt_aa(packet) << 2 + | ldns_pkt_tc(packet) << 1 | ldns_pkt_rd(packet); + ldns_buffer_write_u8(buffer, flags); + + flags = ldns_pkt_ra(packet) << 7 + /*| ldns_pkt_z(packet) << 6*/ + | ldns_pkt_ad(packet) << 5 + | ldns_pkt_cd(packet) << 4 | ldns_pkt_get_rcode(packet); + ldns_buffer_write_u8(buffer, flags); + + ldns_buffer_write_u16(buffer, ldns_pkt_qdcount(packet)); + ldns_buffer_write_u16(buffer, ldns_pkt_ancount(packet)); + ldns_buffer_write_u16(buffer, ldns_pkt_nscount(packet)); + /* add EDNS0 and TSIG to additional if they are there */ + arcount = ldns_pkt_arcount(packet); + if (ldns_pkt_tsig(packet)) { + arcount++; + } + if (ldns_pkt_edns(packet)) { + arcount++; + } + ldns_buffer_write_u16(buffer, arcount); + } + + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_pkt2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet) +{ + ldns_rr_list *rr_list; + uint16_t i; + + /* edns tmp vars */ + ldns_rr *edns_rr; + uint8_t edata[4]; + + (void) ldns_hdr2buffer_wire(buffer, packet); + + rr_list = ldns_pkt_question(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_QUESTION); + } + } + rr_list = ldns_pkt_answer(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_ANSWER); + } + } + rr_list = ldns_pkt_authority(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_AUTHORITY); + } + } + rr_list = ldns_pkt_additional(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_ADDITIONAL); + } + } + + /* add EDNS to additional if it is needed */ + if (ldns_pkt_edns(packet)) { + edns_rr = ldns_rr_new(); + if(!edns_rr) return LDNS_STATUS_MEM_ERR; + ldns_rr_set_owner(edns_rr, + ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, ".")); + ldns_rr_set_type(edns_rr, LDNS_RR_TYPE_OPT); + ldns_rr_set_class(edns_rr, ldns_pkt_edns_udp_size(packet)); + edata[0] = ldns_pkt_edns_extended_rcode(packet); + edata[1] = ldns_pkt_edns_version(packet); + ldns_write_uint16(&edata[2], ldns_pkt_edns_z(packet)); + ldns_rr_set_ttl(edns_rr, ldns_read_uint32(edata)); + /* don't forget to add the edns rdata (if any) */ + if (packet->_edns_data) + ldns_rr_push_rdf (edns_rr, packet->_edns_data); + (void)ldns_rr2buffer_wire(buffer, edns_rr, LDNS_SECTION_ADDITIONAL); + /* take the edns rdata back out of the rr before we free rr */ + if (packet->_edns_data) + (void)ldns_rr_pop_rdf (edns_rr); + ldns_rr_free(edns_rr); + } + + /* add TSIG to additional if it is there */ + if (ldns_pkt_tsig(packet)) { + (void) ldns_rr2buffer_wire(buffer, + ldns_pkt_tsig(packet), LDNS_SECTION_ADDITIONAL); + } + + return LDNS_STATUS_OK; +} + +ldns_status +ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t *result_size) +{ + ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + uint8_t *result = NULL; + ldns_status status; + *result_size = 0; + *dest = NULL; + if(!buffer) return LDNS_STATUS_MEM_ERR; + + status = ldns_rdf2buffer_wire(buffer, rdf); + if (status == LDNS_STATUS_OK) { + *result_size = ldns_buffer_position(buffer); + result = (uint8_t *) ldns_buffer_export(buffer); + } else { + ldns_buffer_free(buffer); + return status; + } + + if (result) { + *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); + if(!*dest) { + ldns_buffer_free(buffer); + return LDNS_STATUS_MEM_ERR; + } + memcpy(*dest, result, ldns_buffer_position(buffer)); + } + + ldns_buffer_free(buffer); + return status; +} + +ldns_status +ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int section, size_t *result_size) +{ + ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + uint8_t *result = NULL; + ldns_status status; + *result_size = 0; + *dest = NULL; + if(!buffer) return LDNS_STATUS_MEM_ERR; + + status = ldns_rr2buffer_wire(buffer, rr, section); + if (status == LDNS_STATUS_OK) { + *result_size = ldns_buffer_position(buffer); + result = (uint8_t *) ldns_buffer_export(buffer); + } else { + ldns_buffer_free(buffer); + return status; + } + + if (result) { + *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); + if(!*dest) { + ldns_buffer_free(buffer); + return LDNS_STATUS_MEM_ERR; + } + memcpy(*dest, result, ldns_buffer_position(buffer)); + } + + ldns_buffer_free(buffer); + return status; +} + +ldns_status +ldns_pkt2wire(uint8_t **dest, const ldns_pkt *packet, size_t *result_size) +{ + ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + uint8_t *result = NULL; + ldns_status status; + *result_size = 0; + *dest = NULL; + if(!buffer) return LDNS_STATUS_MEM_ERR; + + status = ldns_pkt2buffer_wire(buffer, packet); + if (status == LDNS_STATUS_OK) { + *result_size = ldns_buffer_position(buffer); + result = (uint8_t *) ldns_buffer_export(buffer); + } else { + ldns_buffer_free(buffer); + return status; + } + + if (result) { + *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); + if(!*dest) { + ldns_buffer_free(buffer); + return LDNS_STATUS_MEM_ERR; + } + memcpy(*dest, result, ldns_buffer_position(buffer)); + } + + ldns_buffer_free(buffer); + return status; +} diff --git a/libs/ldns/install-sh b/libs/ldns/install-sh new file mode 100755 index 0000000000..3f83ce9b55 --- /dev/null +++ b/libs/ldns/install-sh @@ -0,0 +1,524 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2010-02-06.18; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# 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. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # 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 $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/libs/ldns/keys.c b/libs/ldns/keys.c new file mode 100644 index 0000000000..c224cd6fe4 --- /dev/null +++ b/libs/ldns/keys.c @@ -0,0 +1,1666 @@ +/* + * keys.c handle private keys for use in DNSSEC + * + * This module should hide some of the openSSL complexities + * and give a general interface for private keys and hmac + * handling + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#ifdef HAVE_SSL +#include +#include +#include +#endif /* HAVE_SSL */ + +ldns_lookup_table ldns_signing_algorithms[] = { + { LDNS_SIGN_RSAMD5, "RSAMD5" }, + { LDNS_SIGN_RSASHA1, "RSASHA1" }, + { LDNS_SIGN_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" }, +#ifdef USE_SHA2 + { LDNS_SIGN_RSASHA256, "RSASHA256" }, + { LDNS_SIGN_RSASHA512, "RSASHA512" }, +#endif +#ifdef USE_GOST + { LDNS_SIGN_ECC_GOST, "ECC-GOST" }, +#endif +#ifdef USE_ECDSA + { LDNS_SIGN_ECDSAP256SHA256, "ECDSAP256SHA256" }, + { LDNS_SIGN_ECDSAP384SHA384, "ECDSAP384SHA384" }, +#endif + { LDNS_SIGN_DSA, "DSA" }, + { LDNS_SIGN_DSA_NSEC3, "DSA-NSEC3-SHA1" }, + { LDNS_SIGN_HMACMD5, "hmac-md5.sig-alg.reg.int" }, + { LDNS_SIGN_HMACSHA1, "hmac-sha1" }, + { LDNS_SIGN_HMACSHA256, "hmac-sha256" }, + { 0, NULL } +}; + +ldns_key_list * +ldns_key_list_new() +{ + ldns_key_list *key_list = LDNS_MALLOC(ldns_key_list); + if (!key_list) { + return NULL; + } else { + key_list->_key_count = 0; + key_list->_keys = NULL; + return key_list; + } +} + +ldns_key * +ldns_key_new() +{ + ldns_key *newkey; + + newkey = LDNS_MALLOC(ldns_key); + if (!newkey) { + return NULL; + } else { + /* some defaults - not sure wether to do this */ + ldns_key_set_use(newkey, true); + ldns_key_set_flags(newkey, LDNS_KEY_ZONE_KEY); + ldns_key_set_origttl(newkey, 0); + ldns_key_set_keytag(newkey, 0); + ldns_key_set_inception(newkey, 0); + ldns_key_set_expiration(newkey, 0); + ldns_key_set_pubkey_owner(newkey, NULL); +#ifdef HAVE_SSL + ldns_key_set_evp_key(newkey, NULL); +#endif /* HAVE_SSL */ + ldns_key_set_hmac_key(newkey, NULL); + ldns_key_set_external_key(newkey, NULL); + return newkey; + } +} + +ldns_status +ldns_key_new_frm_fp(ldns_key **k, FILE *fp) +{ + return ldns_key_new_frm_fp_l(k, fp, NULL); +} + +#ifdef HAVE_SSL +ldns_status +ldns_key_new_frm_engine(ldns_key **key, ENGINE *e, char *key_id, ldns_algorithm alg) +{ + ldns_key *k; + + k = ldns_key_new(); + if(!k) return LDNS_STATUS_MEM_ERR; +#ifndef S_SPLINT_S + k->_key.key = ENGINE_load_private_key(e, key_id, UI_OpenSSL(), NULL); + if(!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_algorithm(k, (ldns_signing_algorithm) alg); + if (!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ENGINE_KEY_NOT_LOADED; + } +#endif /* splint */ + *key = k; + return LDNS_STATUS_OK; +} +#endif + +#ifdef USE_GOST +/** store GOST engine reference loaded into OpenSSL library */ +ENGINE* ldns_gost_engine = NULL; + +int +ldns_key_EVP_load_gost_id(void) +{ + static int gost_id = 0; + const EVP_PKEY_ASN1_METHOD* meth; + ENGINE* e; + + if(gost_id) return gost_id; + + /* see if configuration loaded gost implementation from other engine*/ + meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1); + if(meth) { + EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); + return gost_id; + } + + /* see if engine can be loaded already */ + e = ENGINE_by_id("gost"); + if(!e) { + /* load it ourself, in case statically linked */ + ENGINE_load_builtin_engines(); + ENGINE_load_dynamic(); + e = ENGINE_by_id("gost"); + } + if(!e) { + /* no gost engine in openssl */ + return 0; + } + if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { + ENGINE_finish(e); + ENGINE_free(e); + return 0; + } + + meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1); + if(!meth) { + /* algo not found */ + ENGINE_finish(e); + ENGINE_free(e); + return 0; + } + /* Note: do not ENGINE_finish and ENGINE_free the acquired engine + * on some platforms this frees up the meth and unloads gost stuff */ + ldns_gost_engine = e; + + EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); + return gost_id; +} + +void ldns_key_EVP_unload_gost(void) +{ + if(ldns_gost_engine) { + ENGINE_finish(ldns_gost_engine); + ENGINE_free(ldns_gost_engine); + ldns_gost_engine = NULL; + } +} + +/** read GOST private key */ +static EVP_PKEY* +ldns_key_new_frm_fp_gost_l(FILE* fp, int* line_nr) +{ + char token[16384]; + const unsigned char* pp; + int gost_id; + EVP_PKEY* pkey; + ldns_rdf* b64rdf = NULL; + + gost_id = ldns_key_EVP_load_gost_id(); + if(!gost_id) + return NULL; + + if (ldns_fget_keyword_data_l(fp, "GostAsn1", ": ", token, "\n", + sizeof(token), line_nr) == -1) + return NULL; + while(strlen(token) < 96) { + /* read more b64 from the file, b64 split on multiple lines */ + if(ldns_fget_token_l(fp, token+strlen(token), "\n", + sizeof(token)-strlen(token), line_nr) == -1) + return NULL; + } + if(ldns_str2rdf_b64(&b64rdf, token) != LDNS_STATUS_OK) + return NULL; + pp = (unsigned char*)ldns_rdf_data(b64rdf); + pkey = d2i_PrivateKey(gost_id, NULL, &pp, (int)ldns_rdf_size(b64rdf)); + ldns_rdf_deep_free(b64rdf); + return pkey; +} +#endif + +#ifdef USE_ECDSA +/** calculate public key from private key */ +static int +ldns_EC_KEY_calc_public(EC_KEY* ec) +{ + EC_POINT* pub_key; + const EC_GROUP* group; + group = EC_KEY_get0_group(ec); + pub_key = EC_POINT_new(group); + if(!pub_key) return 0; + if(!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group))) { + EC_POINT_free(pub_key); + return 0; + } + if(!EC_POINT_mul(group, pub_key, EC_KEY_get0_private_key(ec), + NULL, NULL, NULL)) { + EC_POINT_free(pub_key); + return 0; + } + if(EC_KEY_set_public_key(ec, pub_key) == 0) { + EC_POINT_free(pub_key); + return 0; + } + EC_POINT_free(pub_key); + return 1; +} + +/** read ECDSA private key */ +static EVP_PKEY* +ldns_key_new_frm_fp_ecdsa_l(FILE* fp, ldns_algorithm alg, int* line_nr) +{ + char token[16384]; + ldns_rdf* b64rdf = NULL; + unsigned char* pp; + BIGNUM* bn; + EVP_PKEY* evp_key; + EC_KEY* ec; + if (ldns_fget_keyword_data_l(fp, "PrivateKey", ": ", token, "\n", + sizeof(token), line_nr) == -1) + return NULL; + if(ldns_str2rdf_b64(&b64rdf, token) != LDNS_STATUS_OK) + return NULL; + pp = (unsigned char*)ldns_rdf_data(b64rdf); + + if(alg == LDNS_ECDSAP256SHA256) + ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); + else if(alg == LDNS_ECDSAP384SHA384) + ec = EC_KEY_new_by_curve_name(NID_secp384r1); + else ec = NULL; + if(!ec) { + ldns_rdf_deep_free(b64rdf); + return NULL; + } + bn = BN_bin2bn(pp, (int)ldns_rdf_size(b64rdf), NULL); + ldns_rdf_deep_free(b64rdf); + if(!bn) { + EC_KEY_free(ec); + return NULL; + } + EC_KEY_set_private_key(ec, bn); + BN_free(bn); + if(!ldns_EC_KEY_calc_public(ec)) { + EC_KEY_free(ec); + return NULL; + } + + evp_key = EVP_PKEY_new(); + if(!evp_key) { + EC_KEY_free(ec); + return NULL; + } + EVP_PKEY_assign_EC_KEY(evp_key, ec); + + return evp_key; +} +#endif + +ldns_status +ldns_key_new_frm_fp_l(ldns_key **key, FILE *fp, int *line_nr) +{ + ldns_key *k; + char *d; + ldns_signing_algorithm alg; + ldns_rr *key_rr; +#ifdef HAVE_SSL + RSA *rsa; + DSA *dsa; + unsigned char *hmac; + size_t hmac_size; +#endif /* HAVE_SSL */ + + k = ldns_key_new(); + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + if (!k || !d) { + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_MEM_ERR; + } + + alg = 0; + + /* the file is highly structured. Do this in sequence */ + /* RSA: + * Private-key-format: v1.2 + * Algorithm: 1 (RSA) + + */ + /* get the key format version number */ + if (ldns_fget_keyword_data_l(fp, "Private-key-format", ": ", d, "\n", + LDNS_MAX_LINELEN, line_nr) == -1) { + /* no version information */ + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_SYNTAX_ERR; + } + if (strncmp(d, "v1.2", strlen(d)) != 0) { + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_SYNTAX_VERSION_ERR; + } + + /* get the algorithm type, our file function strip ( ) so there are + * not in the return string! */ + if (ldns_fget_keyword_data_l(fp, "Algorithm", ": ", d, "\n", + LDNS_MAX_LINELEN, line_nr) == -1) { + /* no alg information */ + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_SYNTAX_ALG_ERR; + } + + if (strncmp(d, "1 RSA", 2) == 0) { + alg = LDNS_SIGN_RSAMD5; + } + if (strncmp(d, "2 DH", 2) == 0) { + alg = (ldns_signing_algorithm)LDNS_DH; + } + if (strncmp(d, "3 DSA", 2) == 0) { + alg = LDNS_SIGN_DSA; + } + if (strncmp(d, "4 ECC", 2) == 0) { + alg = (ldns_signing_algorithm)LDNS_ECC; + } + if (strncmp(d, "5 RSASHA1", 2) == 0) { + alg = LDNS_SIGN_RSASHA1; + } + if (strncmp(d, "6 DSA", 2) == 0) { + alg = LDNS_SIGN_DSA_NSEC3; + } + if (strncmp(d, "7 RSASHA1", 2) == 0) { + alg = LDNS_SIGN_RSASHA1_NSEC3; + } + + if (strncmp(d, "8 RSASHA256", 2) == 0) { +#ifdef USE_SHA2 + alg = LDNS_SIGN_RSASHA256; +#else + fprintf(stderr, "Warning: SHA256 not compiled into this "); + fprintf(stderr, "version of ldns\n"); +#endif + } + if (strncmp(d, "10 RSASHA512", 3) == 0) { +#ifdef USE_SHA2 + alg = LDNS_SIGN_RSASHA512; +#else + fprintf(stderr, "Warning: SHA512 not compiled into this "); + fprintf(stderr, "version of ldns\n"); +#endif + } + if (strncmp(d, "12 ECC-GOST", 3) == 0) { +#ifdef USE_GOST + alg = LDNS_SIGN_ECC_GOST; +#else + fprintf(stderr, "Warning: ECC-GOST not compiled into this "); + fprintf(stderr, "version of ldns, use --enable-gost\n"); +#endif + } +#ifdef USE_ECDSA + if (strncmp(d, "13 ECDSAP256SHA256", 3) == 0) { + alg = LDNS_SIGN_ECDSAP256SHA256; + } + if (strncmp(d, "14 ECDSAP384SHA384", 3) == 0) { + alg = LDNS_SIGN_ECDSAP384SHA384; + } +#endif + if (strncmp(d, "157 HMAC-MD5", 4) == 0) { + alg = LDNS_SIGN_HMACMD5; + } + if (strncmp(d, "158 HMAC-SHA1", 4) == 0) { + alg = LDNS_SIGN_HMACSHA1; + } + if (strncmp(d, "159 HMAC-SHA256", 4) == 0) { + alg = LDNS_SIGN_HMACSHA256; + } + + LDNS_FREE(d); + + switch(alg) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: +#ifdef USE_SHA2 + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: +#endif + ldns_key_set_algorithm(k, alg); +#ifdef HAVE_SSL + rsa = ldns_key_new_frm_fp_rsa_l(fp, line_nr); + if (!rsa) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_rsa_key(k, rsa); + RSA_free(rsa); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: + ldns_key_set_algorithm(k, alg); +#ifdef HAVE_SSL + dsa = ldns_key_new_frm_fp_dsa_l(fp, line_nr); + if (!dsa) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_dsa_key(k, dsa); + DSA_free(dsa); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + ldns_key_set_algorithm(k, alg); +#ifdef HAVE_SSL + hmac = ldns_key_new_frm_fp_hmac_l(fp, line_nr, &hmac_size); + if (!hmac) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_hmac_size(k, hmac_size); + ldns_key_set_hmac_key(k, hmac); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_ECC_GOST: + ldns_key_set_algorithm(k, alg); +#if defined(HAVE_SSL) && defined(USE_GOST) + if(!ldns_key_EVP_load_gost_id()) { + ldns_key_free(k); + return LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL; + } + ldns_key_set_evp_key(k, + ldns_key_new_frm_fp_gost_l(fp, line_nr)); +#ifndef S_SPLINT_S + if(!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } +#endif /* splint */ +#endif + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + ldns_key_set_algorithm(k, alg); + ldns_key_set_evp_key(k, + ldns_key_new_frm_fp_ecdsa_l(fp, (ldns_algorithm)alg, line_nr)); +#ifndef S_SPLINT_S + if(!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } +#endif /* splint */ + break; +#endif + default: + ldns_key_free(k); + return LDNS_STATUS_SYNTAX_ALG_ERR; + } + key_rr = ldns_key2rr(k); + ldns_key_set_keytag(k, ldns_calc_keytag(key_rr)); + ldns_rr_free(key_rr); + + if (key) { + *key = k; + return LDNS_STATUS_OK; + } + return LDNS_STATUS_ERR; +} + +#ifdef HAVE_SSL +RSA * +ldns_key_new_frm_fp_rsa(FILE *f) +{ + return ldns_key_new_frm_fp_rsa_l(f, NULL); +} + +RSA * +ldns_key_new_frm_fp_rsa_l(FILE *f, int *line_nr) +{ + /* we parse + * Modulus: + * PublicExponent: + * PrivateExponent: + * Prime1: + * Prime2: + * Exponent1: + * Exponent2: + * Coefficient: + * + * man 3 RSA: + * + * struct + * { + * BIGNUM *n; // public modulus + * BIGNUM *e; // public exponent + * BIGNUM *d; // private exponent + * BIGNUM *p; // secret prime factor + * BIGNUM *q; // secret prime factor + * BIGNUM *dmp1; // d mod (p-1) + * BIGNUM *dmq1; // d mod (q-1) + * BIGNUM *iqmp; // q^-1 mod p + * // ... + * + */ + char *d; + RSA *rsa; + uint8_t *buf; + int i; + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + buf = LDNS_XMALLOC(uint8_t, LDNS_MAX_LINELEN); + rsa = RSA_new(); + if (!d || !rsa || !buf) { + goto error; + } + + /* I could use functions again, but that seems an overkill, + * allthough this also looks tedious + */ + + /* Modules, rsa->n */ + if (ldns_fget_keyword_data_l(f, "Modulus", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); +#ifndef S_SPLINT_S + rsa->n = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->n) { + goto error; + } + + /* PublicExponent, rsa->e */ + if (ldns_fget_keyword_data_l(f, "PublicExponent", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->e = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->e) { + goto error; + } + + /* PrivateExponent, rsa->d */ + if (ldns_fget_keyword_data_l(f, "PrivateExponent", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->d = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->d) { + goto error; + } + + /* Prime1, rsa->p */ + if (ldns_fget_keyword_data_l(f, "Prime1", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->p = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->p) { + goto error; + } + + /* Prime2, rsa->q */ + if (ldns_fget_keyword_data_l(f, "Prime2", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->q = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->q) { + goto error; + } + + /* Exponent1, rsa->dmp1 */ + if (ldns_fget_keyword_data_l(f, "Exponent1", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->dmp1 = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->dmp1) { + goto error; + } + + /* Exponent2, rsa->dmq1 */ + if (ldns_fget_keyword_data_l(f, "Exponent2", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->dmq1 = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->dmq1) { + goto error; + } + + /* Coefficient, rsa->iqmp */ + if (ldns_fget_keyword_data_l(f, "Coefficient", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->iqmp = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->iqmp) { + goto error; + } +#endif /* splint */ + + LDNS_FREE(buf); + LDNS_FREE(d); + return rsa; + +error: + RSA_free(rsa); + LDNS_FREE(d); + LDNS_FREE(buf); + return NULL; +} + +DSA * +ldns_key_new_frm_fp_dsa(FILE *f) +{ + return ldns_key_new_frm_fp_dsa_l(f, NULL); +} + +DSA * +ldns_key_new_frm_fp_dsa_l(FILE *f, int *line_nr) +{ + int i; + char *d; + DSA *dsa; + uint8_t *buf; + + line_nr = line_nr; + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + buf = LDNS_XMALLOC(uint8_t, LDNS_MAX_LINELEN); + dsa = DSA_new(); + if (!d || !dsa || !buf) { + goto error; + } + + /* the line parser removes the () from the input... */ + + /* Prime, dsa->p */ + if (ldns_fget_keyword_data_l(f, "Primep", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); +#ifndef S_SPLINT_S + dsa->p = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->p) { + goto error; + } + + /* Subprime, dsa->q */ + if (ldns_fget_keyword_data_l(f, "Subprimeq", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->q = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->q) { + goto error; + } + + /* Base, dsa->g */ + if (ldns_fget_keyword_data_l(f, "Baseg", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->g = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->g) { + goto error; + } + + /* Private key, dsa->priv_key */ + if (ldns_fget_keyword_data_l(f, "Private_valuex", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->priv_key = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->priv_key) { + goto error; + } + + /* Public key, dsa->priv_key */ + if (ldns_fget_keyword_data_l(f, "Public_valuey", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->pub_key = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->pub_key) { + goto error; + } +#endif /* splint */ + + LDNS_FREE(buf); + LDNS_FREE(d); + + return dsa; + +error: + LDNS_FREE(d); + LDNS_FREE(buf); + DSA_free(dsa); + return NULL; +} + +unsigned char * +ldns_key_new_frm_fp_hmac(FILE *f, size_t *hmac_size) +{ + return ldns_key_new_frm_fp_hmac_l(f, NULL, hmac_size); +} + +unsigned char * +ldns_key_new_frm_fp_hmac_l(FILE *f, int *line_nr, size_t *hmac_size) +{ + size_t i; + char *d; + unsigned char *buf; + + line_nr = line_nr; + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + buf = LDNS_XMALLOC(unsigned char, LDNS_MAX_LINELEN); + if(!d || !buf) { + goto error; + } + + if (ldns_fget_keyword_data_l(f, "Key", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = (size_t) ldns_b64_pton((const char*)d, + buf, + ldns_b64_ntop_calculate_size(strlen(d))); + + *hmac_size = i; + return buf; + + error: + LDNS_FREE(d); + LDNS_FREE(buf); + *hmac_size = 0; + return NULL; +} +#endif /* HAVE_SSL */ + +#ifdef USE_GOST +static EVP_PKEY* +ldns_gen_gost_key(void) +{ + EVP_PKEY_CTX* ctx; + EVP_PKEY* p = NULL; + int gost_id = ldns_key_EVP_load_gost_id(); + if(!gost_id) + return NULL; + ctx = EVP_PKEY_CTX_new_id(gost_id, NULL); + if(!ctx) { + /* the id should be available now */ + return NULL; + } + if(EVP_PKEY_CTX_ctrl_str(ctx, "paramset", "A") <= 0) { + /* cannot set paramset */ + EVP_PKEY_CTX_free(ctx); + return NULL; + } + + if(EVP_PKEY_keygen_init(ctx) <= 0) { + EVP_PKEY_CTX_free(ctx); + return NULL; + } + if(EVP_PKEY_keygen(ctx, &p) <= 0) { + EVP_PKEY_free(p); + EVP_PKEY_CTX_free(ctx); + return NULL; + } + EVP_PKEY_CTX_free(ctx); + return p; +} +#endif + +ldns_key * +ldns_key_new_frm_algorithm(ldns_signing_algorithm alg, uint16_t size) +{ + ldns_key *k; +#ifdef HAVE_SSL + DSA *d; + RSA *r; +# ifdef USE_ECDSA + EC_KEY *ec = NULL; +# endif +#else + int i; + uint16_t offset = 0; +#endif + unsigned char *hmac; + + k = ldns_key_new(); + if (!k) { + return NULL; + } + switch(alg) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: +#ifdef HAVE_SSL + r = RSA_generate_key((int)size, RSA_F4, NULL, NULL); + if(!r) { + ldns_key_free(k); + return NULL; + } + if (RSA_check_key(r) != 1) { + ldns_key_free(k); + return NULL; + } + + ldns_key_set_rsa_key(k, r); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: +#ifdef HAVE_SSL + d = DSA_generate_parameters((int)size, NULL, 0, NULL, NULL, NULL, NULL); + if (!d) { + ldns_key_free(k); + return NULL; + } + if (DSA_generate_key(d) != 1) { + ldns_key_free(k); + return NULL; + } + ldns_key_set_dsa_key(k, d); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: +#ifdef HAVE_SSL +#ifndef S_SPLINT_S + k->_key.key = NULL; +#endif /* splint */ +#endif /* HAVE_SSL */ + size = size / 8; + ldns_key_set_hmac_size(k, size); + + hmac = LDNS_XMALLOC(unsigned char, size); + if(!hmac) { + ldns_key_free(k); + return NULL; + } +#ifdef HAVE_SSL + if (RAND_bytes(hmac, (int) size) != 1) { + LDNS_FREE(hmac); + ldns_key_free(k); + return NULL; + } +#else + while (offset + sizeof(i) < size) { + i = random(); + memcpy(&hmac[offset], &i, sizeof(i)); + offset += sizeof(i); + } + if (offset < size) { + i = random(); + memcpy(&hmac[offset], &i, size - offset); + } +#endif /* HAVE_SSL */ + ldns_key_set_hmac_key(k, hmac); + + ldns_key_set_flags(k, 0); + break; + case LDNS_SIGN_ECC_GOST: +#if defined(HAVE_SSL) && defined(USE_GOST) + ldns_key_set_evp_key(k, ldns_gen_gost_key()); +#ifndef S_SPLINT_S + if(!k->_key.key) { + ldns_key_free(k); + return NULL; + } +#endif /* splint */ +#endif /* HAVE_SSL and USE_GOST */ + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + if(alg == LDNS_SIGN_ECDSAP256SHA256) + ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); + else if(alg == LDNS_SIGN_ECDSAP384SHA384) + ec = EC_KEY_new_by_curve_name(NID_secp384r1); + if(!ec) { + ldns_key_free(k); + return NULL; + } + if(!EC_KEY_generate_key(ec)) { + ldns_key_free(k); + EC_KEY_free(ec); + return NULL; + } +#ifndef S_SPLINT_S + k->_key.key = EVP_PKEY_new(); + if(!k->_key.key) { + ldns_key_free(k); + EC_KEY_free(ec); + return NULL; + } + EVP_PKEY_assign_EC_KEY(k->_key.key, ec); +#endif /* splint */ + break; +#endif + } + ldns_key_set_algorithm(k, alg); + return k; +} + +void +ldns_key_print(FILE *output, const ldns_key *k) +{ + char *str = ldns_key2str(k); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert private key to string\n"); + } + LDNS_FREE(str); +} + + +void +ldns_key_set_algorithm(ldns_key *k, ldns_signing_algorithm l) +{ + k->_alg = l; +} + +void +ldns_key_set_flags(ldns_key *k, uint16_t f) +{ + k->_extra.dnssec.flags = f; +} + +#ifdef HAVE_SSL +#ifndef S_SPLINT_S +void +ldns_key_set_evp_key(ldns_key *k, EVP_PKEY *e) +{ + k->_key.key = e; +} + +void +ldns_key_set_rsa_key(ldns_key *k, RSA *r) +{ + EVP_PKEY *key = EVP_PKEY_new(); + EVP_PKEY_set1_RSA(key, r); + k->_key.key = key; +} + +void +ldns_key_set_dsa_key(ldns_key *k, DSA *d) +{ + EVP_PKEY *key = EVP_PKEY_new(); + EVP_PKEY_set1_DSA(key, d); + k->_key.key = key; +} +#endif /* splint */ +#endif /* HAVE_SSL */ + +void +ldns_key_set_hmac_key(ldns_key *k, unsigned char *hmac) +{ + k->_key.hmac.key = hmac; +} + +void +ldns_key_set_hmac_size(ldns_key *k, size_t hmac_size) +{ + k->_key.hmac.size = hmac_size; +} + +void +ldns_key_set_external_key(ldns_key *k, void *external_key) +{ + k->_key.external_key = external_key; +} + +void +ldns_key_set_origttl(ldns_key *k, uint32_t t) +{ + k->_extra.dnssec.orig_ttl = t; +} + +void +ldns_key_set_inception(ldns_key *k, uint32_t i) +{ + k->_extra.dnssec.inception = i; +} + +void +ldns_key_set_expiration(ldns_key *k, uint32_t e) +{ + k->_extra.dnssec.expiration = e; +} + +void +ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r) +{ + k->_pubkey_owner = r; +} + +void +ldns_key_set_keytag(ldns_key *k, uint16_t tag) +{ + k->_extra.dnssec.keytag = tag; +} + +/* read */ +size_t +ldns_key_list_key_count(const ldns_key_list *key_list) +{ + return key_list->_key_count; +} + +ldns_key * +ldns_key_list_key(const ldns_key_list *key, size_t nr) +{ + if (nr < ldns_key_list_key_count(key)) { + return key->_keys[nr]; + } else { + return NULL; + } +} + +ldns_signing_algorithm +ldns_key_algorithm(const ldns_key *k) +{ + return k->_alg; +} + +void +ldns_key_set_use(ldns_key *k, bool v) +{ + if (k) { + k->_use = v; + } +} + +bool +ldns_key_use(const ldns_key *k) +{ + if (k) { + return k->_use; + } + return false; +} + +#ifdef HAVE_SSL +#ifndef S_SPLINT_S +EVP_PKEY * +ldns_key_evp_key(const ldns_key *k) +{ + return k->_key.key; +} + +RSA * +ldns_key_rsa_key(const ldns_key *k) +{ + if (k->_key.key) { + return EVP_PKEY_get1_RSA(k->_key.key); + } else { + return NULL; + } +} + +DSA * +ldns_key_dsa_key(const ldns_key *k) +{ + if (k->_key.key) { + return EVP_PKEY_get1_DSA(k->_key.key); + } else { + return NULL; + } +} +#endif /* splint */ +#endif /* HAVE_SSL */ + +unsigned char * +ldns_key_hmac_key(const ldns_key *k) +{ + if (k->_key.hmac.key) { + return k->_key.hmac.key; + } else { + return NULL; + } +} + +size_t +ldns_key_hmac_size(const ldns_key *k) +{ + if (k->_key.hmac.size) { + return k->_key.hmac.size; + } else { + return 0; + } +} + +void * +ldns_key_external_key(const ldns_key *k) +{ + return k->_key.external_key; +} + +uint32_t +ldns_key_origttl(const ldns_key *k) +{ + return k->_extra.dnssec.orig_ttl; +} + +uint16_t +ldns_key_flags(const ldns_key *k) +{ + return k->_extra.dnssec.flags; +} + +uint32_t +ldns_key_inception(const ldns_key *k) +{ + return k->_extra.dnssec.inception; +} + +uint32_t +ldns_key_expiration(const ldns_key *k) +{ + return k->_extra.dnssec.expiration; +} + +uint16_t +ldns_key_keytag(const ldns_key *k) +{ + return k->_extra.dnssec.keytag; +} + +ldns_rdf * +ldns_key_pubkey_owner(const ldns_key *k) +{ + return k->_pubkey_owner; +} + +/* write */ +void +ldns_key_list_set_use(ldns_key_list *keys, bool v) +{ + size_t i; + + for (i = 0; i < ldns_key_list_key_count(keys); i++) { + ldns_key_set_use(ldns_key_list_key(keys, i), v); + } +} + +void +ldns_key_list_set_key_count(ldns_key_list *key, size_t count) +{ + key->_key_count = count; +} + +bool +ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key) +{ + size_t key_count; + ldns_key **keys; + + key_count = ldns_key_list_key_count(key_list); + + /* grow the array */ + keys = LDNS_XREALLOC( + key_list->_keys, ldns_key *, key_count + 1); + if (!keys) { + return false; + } + + /* add the new member */ + key_list->_keys = keys; + key_list->_keys[key_count] = key; + + ldns_key_list_set_key_count(key_list, key_count + 1); + return true; +} + +ldns_key * +ldns_key_list_pop_key(ldns_key_list *key_list) +{ + size_t key_count; + ldns_key** a; + ldns_key *pop; + + if (!key_list) { + return NULL; + } + + key_count = ldns_key_list_key_count(key_list); + if (key_count == 0) { + return NULL; + } + + pop = ldns_key_list_key(key_list, key_count); + + /* shrink the array */ + a = LDNS_XREALLOC(key_list->_keys, ldns_key *, key_count - 1); + if(a) { + key_list->_keys = a; + } + + ldns_key_list_set_key_count(key_list, key_count - 1); + + return pop; +} + +#ifdef HAVE_SSL +#ifndef S_SPLINT_S +/* data pointer must be large enough (LDNS_MAX_KEYLEN) */ +static bool +ldns_key_rsa2bin(unsigned char *data, RSA *k, uint16_t *size) +{ + int i,j; + + if (!k) { + return false; + } + + if (BN_num_bytes(k->e) <= 256) { + /* normally only this path is executed (small factors are + * more common + */ + data[0] = (unsigned char) BN_num_bytes(k->e); + i = BN_bn2bin(k->e, data + 1); + j = BN_bn2bin(k->n, data + i + 1); + *size = (uint16_t) i + j; + } else if (BN_num_bytes(k->e) <= 65536) { + data[0] = 0; + /* BN_bn2bin does bigendian, _uint16 also */ + ldns_write_uint16(data + 1, (uint16_t) BN_num_bytes(k->e)); + + BN_bn2bin(k->e, data + 3); + BN_bn2bin(k->n, data + 4 + BN_num_bytes(k->e)); + *size = (uint16_t) BN_num_bytes(k->n) + 6; + } else { + return false; + } + return true; +} + +/* data pointer must be large enough (LDNS_MAX_KEYLEN) */ +static bool +ldns_key_dsa2bin(unsigned char *data, DSA *k, uint16_t *size) +{ + uint8_t T; + + if (!k) { + return false; + } + + /* See RFC2536 */ + *size = (uint16_t)BN_num_bytes(k->g); + T = (*size - 64) / 8; + memcpy(data, &T, 1); + + if (T > 8) { + fprintf(stderr, "DSA key with T > 8 (ie. > 1024 bits)"); + fprintf(stderr, " not implemented\n"); + return false; + } + + /* size = 64 + (T * 8); */ + data[0] = (unsigned char)T; + BN_bn2bin(k->q, data + 1 ); /* 20 octects */ + BN_bn2bin(k->p, data + 21 ); /* offset octects */ + BN_bn2bin(k->g, data + 21 + *size); /* offset octets */ + BN_bn2bin(k->pub_key, data + 21 + *size + *size); /* offset octets */ + *size = 21 + (*size * 3); + return true; +} + +#ifdef USE_GOST +static bool +ldns_key_gost2bin(unsigned char* data, EVP_PKEY* k, uint16_t* size) +{ + int i; + unsigned char* pp = NULL; + if(i2d_PUBKEY(k, &pp) != 37 + 64) { + /* expect 37 byte(ASN header) and 64 byte(X and Y) */ + CRYPTO_free(pp); + return false; + } + /* omit ASN header */ + for(i=0; i<64; i++) + data[i] = pp[i+37]; + CRYPTO_free(pp); + *size = 64; + return true; +} +#endif /* USE_GOST */ +#endif /* splint */ +#endif /* HAVE_SSL */ + +ldns_rr * +ldns_key2rr(const ldns_key *k) +{ + /* this function will convert a the keydata contained in + * rsa/dsa pointers to a DNSKEY rr. It will fill in as + * much as it can, but it does not know about key-flags + * for instance + */ + ldns_rr *pubkey; + ldns_rdf *keybin; + unsigned char *bin = NULL; + uint16_t size = 0; +#ifdef HAVE_SSL + RSA *rsa = NULL; + DSA *dsa = NULL; +#endif /* HAVE_SSL */ +#ifdef USE_ECDSA + EC_KEY* ec; +#endif + int internal_data = 0; + + pubkey = ldns_rr_new(); + if (!k) { + return NULL; + } + + switch (ldns_key_algorithm(k)) { + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + ldns_rr_set_type(pubkey, LDNS_RR_TYPE_KEY); + break; + default: + ldns_rr_set_type(pubkey, LDNS_RR_TYPE_DNSKEY); + break; + } + /* zero-th rdf - flags */ + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, + ldns_key_flags(k))); + /* first - proto */ + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, LDNS_DNSSEC_KEYPROTO)); + + if (ldns_key_pubkey_owner(k)) { + ldns_rr_set_owner(pubkey, ldns_rdf_clone(ldns_key_pubkey_owner(k))); + } + + /* third - da algorithm */ + switch(ldns_key_algorithm(k)) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); +#ifdef HAVE_SSL + rsa = ldns_key_rsa_key(k); + if (rsa) { + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + if (!ldns_key_rsa2bin(bin, rsa, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } + RSA_free(rsa); + internal_data = 1; + } +#endif + size++; + break; + case LDNS_SIGN_DSA: + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, LDNS_DSA)); +#ifdef HAVE_SSL + dsa = ldns_key_dsa_key(k); + if (dsa) { + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + if (!ldns_key_dsa2bin(bin, dsa, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } + DSA_free(dsa); + internal_data = 1; + } +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_DSA_NSEC3: + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, LDNS_DSA_NSEC3)); +#ifdef HAVE_SSL + dsa = ldns_key_dsa_key(k); + if (dsa) { + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + if (!ldns_key_dsa2bin(bin, dsa, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } + DSA_free(dsa); + internal_data = 1; + } +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_ECC_GOST: + ldns_rr_push_rdf(pubkey, ldns_native2rdf_int8( + LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); +#if defined(HAVE_SSL) && defined(USE_GOST) + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } +#ifndef S_SPLINT_S + if (!ldns_key_gost2bin(bin, k->_key.key, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } +#endif /* splint */ + internal_data = 1; +#endif /* HAVE_SSL and USE_GOST */ + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + ldns_rr_push_rdf(pubkey, ldns_native2rdf_int8( + LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); + bin = NULL; +#ifndef S_SPLINT_S + ec = EVP_PKEY_get1_EC_KEY(k->_key.key); +#endif + EC_KEY_set_conv_form(ec, POINT_CONVERSION_UNCOMPRESSED); + size = (uint16_t)i2o_ECPublicKey(ec, NULL); + if(!i2o_ECPublicKey(ec, &bin)) { + EC_KEY_free(ec); + ldns_rr_free(pubkey); + return NULL; + } + if(size > 1) { + /* move back one byte to shave off the 0x02 + * 'uncompressed' indicator that openssl made + * Actually its 0x04 (from implementation). + */ + assert(bin[0] == POINT_CONVERSION_UNCOMPRESSED); + size -= 1; + memmove(bin, bin+1, size); + } + /* down the reference count for ec, its still assigned + * to the pkey */ + EC_KEY_free(ec); + internal_data = 1; + break; +#endif + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + bin = LDNS_XMALLOC(unsigned char, ldns_key_hmac_size(k)); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, + ldns_key_algorithm(k))); + size = ldns_key_hmac_size(k); + memcpy(bin, ldns_key_hmac_key(k), size); + internal_data = 1; + break; + } + /* fourth the key bin material */ + if (internal_data) { + keybin = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, size, bin); + LDNS_FREE(bin); + ldns_rr_push_rdf(pubkey, keybin); + } + return pubkey; +} + +void +ldns_key_free(ldns_key *key) +{ + LDNS_FREE(key); +} + +void +ldns_key_deep_free(ldns_key *key) +{ + if (ldns_key_pubkey_owner(key)) { + ldns_rdf_deep_free(ldns_key_pubkey_owner(key)); + } +#ifdef HAVE_SSL + if (ldns_key_evp_key(key)) { + EVP_PKEY_free(ldns_key_evp_key(key)); + } +#endif /* HAVE_SSL */ + if (ldns_key_hmac_key(key)) { + free(ldns_key_hmac_key(key)); + } + LDNS_FREE(key); +} + +void +ldns_key_list_free(ldns_key_list *key_list) +{ + size_t i; + for (i = 0; i < ldns_key_list_key_count(key_list); i++) { + ldns_key_deep_free(ldns_key_list_key(key_list, i)); + } + LDNS_FREE(key_list->_keys); + LDNS_FREE(key_list); +} + +ldns_rr * +ldns_read_anchor_file(const char *filename) +{ + FILE *fp; + /*char line[LDNS_MAX_PACKETLEN];*/ + char *line = LDNS_XMALLOC(char, LDNS_MAX_PACKETLEN); + int c; + size_t i = 0; + ldns_rr *r; + ldns_status status; + if(!line) { + return NULL; + } + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + LDNS_FREE(line); + return NULL; + } + + while ((c = fgetc(fp)) && i+1 < LDNS_MAX_PACKETLEN && c != EOF) { + line[i] = c; + i++; + } + line[i] = '\0'; + + fclose(fp); + + if (i <= 0) { + fprintf(stderr, "nothing read from %s", filename); + LDNS_FREE(line); + return NULL; + } else { + status = ldns_rr_new_frm_str(&r, line, 0, NULL, NULL); + if (status == LDNS_STATUS_OK && (ldns_rr_get_type(r) == LDNS_RR_TYPE_DNSKEY || ldns_rr_get_type(r) == LDNS_RR_TYPE_DS)) { + LDNS_FREE(line); + return r; + } else { + fprintf(stderr, "Error creating DNSKEY or DS rr from %s: %s\n", filename, ldns_get_errorstr_by_id(status)); + LDNS_FREE(line); + return NULL; + } + } +} + +char * +ldns_key_get_file_base_name(ldns_key *key) +{ + ldns_buffer *buffer; + char *file_base_name; + + buffer = ldns_buffer_new(255); + ldns_buffer_printf(buffer, "K"); + (void)ldns_rdf2buffer_str_dname(buffer, ldns_key_pubkey_owner(key)); + ldns_buffer_printf(buffer, + "+%03u+%05u", + ldns_key_algorithm(key), + ldns_key_keytag(key)); + file_base_name = strdup(ldns_buffer_export(buffer)); + ldns_buffer_free(buffer); + return file_base_name; +} + +int ldns_key_algo_supported(int algo) +{ + ldns_lookup_table *lt = ldns_signing_algorithms; + while(lt->name) { + if(lt->id == algo) + return 1; + lt++; + } + return 0; +} + +ldns_signing_algorithm ldns_get_signing_algorithm_by_name(const char* name) +{ + /* list of (signing algorithm id, alias_name) */ + ldns_lookup_table aliases[] = { + /* from bind dnssec-keygen */ + {LDNS_SIGN_HMACMD5, "HMAC-MD5"}, + {LDNS_SIGN_DSA_NSEC3, "NSEC3DSA"}, + {LDNS_SIGN_RSASHA1_NSEC3, "NSEC3RSASHA1"}, + /* old ldns usage, now RFC names */ + {LDNS_SIGN_DSA_NSEC3, "DSA_NSEC3" }, + {LDNS_SIGN_RSASHA1_NSEC3, "RSASHA1_NSEC3" }, +#ifdef USE_GOST + {LDNS_SIGN_ECC_GOST, "GOST"}, +#endif + /* compat with possible output */ + {LDNS_DH, "DH"}, + {LDNS_ECC, "ECC"}, + {LDNS_INDIRECT, "INDIRECT"}, + {LDNS_PRIVATEDNS, "PRIVATEDNS"}, + {LDNS_PRIVATEOID, "PRIVATEOID"}, + {0, NULL}}; + ldns_lookup_table* lt = ldns_signing_algorithms; + while(lt->name) { + if(strcasecmp(lt->name, name) == 0) + return lt->id; + lt++; + } + lt = aliases; + while(lt->name) { + if(strcasecmp(lt->name, name) == 0) + return lt->id; + lt++; + } + if(atoi(name) != 0) + return atoi(name); + return 0; +} diff --git a/libs/ldns/ldns/buffer.h b/libs/ldns/ldns/buffer.h new file mode 100644 index 0000000000..65b8bdc4ad --- /dev/null +++ b/libs/ldns/ldns/buffer.h @@ -0,0 +1,644 @@ +/* + * buffer.h -- generic memory buffer. + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + * + * The buffer module implements a generic buffer. The API is based on + * the java.nio.Buffer interface. + */ + +#ifndef LDNS_BUFFER_H +#define LDNS_BUFFER_H + +#include +#include +#include + +#include +#include + +#include "ldns/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * number of initial bytes in buffer of + * which we cannot tell the size before hand + */ +#define LDNS_MIN_BUFLEN 512 + +/** + * \file buffer.h + * + * This file contains the definition of ldns_buffer, and functions to manipulate those. + */ + +/** + * implementation of buffers to ease operations + * + * ldns_buffers can contain arbitrary information, per octet. You can write + * to the current end of a buffer, read from the current position, and + * access any data within it. + * + * Example use of buffers is in the source code of \ref host2str.c + */ +struct ldns_struct_buffer +{ + /** The current position used for reading/writing */ + size_t _position; + + /** The read/write limit */ + size_t _limit; + + /** The amount of data the buffer can contain */ + size_t _capacity; + + /** The data contained in the buffer */ + uint8_t *_data; + + /** If the buffer is fixed it cannot be resized */ + unsigned _fixed : 1; + + /** The current state of the buffer. If writing to the buffer fails + * for any reason, this value is changed. This way, you can perform + * multiple writes in sequence and check for success afterwards. */ + ldns_status _status; +}; +typedef struct ldns_struct_buffer ldns_buffer; + + +#ifdef NDEBUG +INLINE void +ldns_buffer_invariant(ldns_buffer *ATTR_UNUSED(buffer)) +{ +} +#else +INLINE void +ldns_buffer_invariant(ldns_buffer *buffer) +{ + assert(buffer != NULL); + assert(buffer->_position <= buffer->_limit); + assert(buffer->_limit <= buffer->_capacity); + assert(buffer->_data != NULL); +} +#endif + +/** + * creates a new buffer with the specified capacity. + * + * \param[in] capacity the size (in bytes) to allocate for the buffer + * \return the created buffer + */ +ldns_buffer *ldns_buffer_new(size_t capacity); + +/** + * creates a buffer with the specified data. The data IS copied + * and MEMORY allocations are done. The buffer is not fixed and can + * be resized using buffer_reserve(). + * + * \param[in] buffer pointer to the buffer to put the data in + * \param[in] data the data to encapsulate in the buffer + * \param[in] size the size of the data + */ +void ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t size); + +/** + * clears the buffer and make it ready for writing. The buffer's limit + * is set to the capacity and the position is set to 0. + * \param[in] buffer the buffer to clear + */ +INLINE void ldns_buffer_clear(ldns_buffer *buffer) +{ + ldns_buffer_invariant(buffer); + + /* reset status here? */ + + buffer->_position = 0; + buffer->_limit = buffer->_capacity; +} + +/** + * makes the buffer ready for reading the data that has been written to + * the buffer. The buffer's limit is set to the current position and + * the position is set to 0. + * + * \param[in] buffer the buffer to flip + * \return void + */ +INLINE void ldns_buffer_flip(ldns_buffer *buffer) +{ + ldns_buffer_invariant(buffer); + + buffer->_limit = buffer->_position; + buffer->_position = 0; +} + +/** + * make the buffer ready for re-reading the data. The buffer's + * position is reset to 0. + * \param[in] buffer the buffer to rewind + */ +INLINE void ldns_buffer_rewind(ldns_buffer *buffer) +{ + ldns_buffer_invariant(buffer); + + buffer->_position = 0; +} + +/** + * returns the current position in the buffer (as a number of bytes) + * \param[in] buffer the buffer + * \return the current position + */ +INLINE size_t +ldns_buffer_position(ldns_buffer *buffer) +{ + return buffer->_position; +} + +/** + * sets the buffer's position to MARK. The position must be less than + * or equal to the buffer's limit. + * \param[in] buffer the buffer + * \param[in] mark the mark to use + */ +INLINE void +ldns_buffer_set_position(ldns_buffer *buffer, size_t mark) +{ + assert(mark <= buffer->_limit); + buffer->_position = mark; +} + +/** + * changes the buffer's position by COUNT bytes. The position must not + * be moved behind the buffer's limit or before the beginning of the + * buffer. + * \param[in] buffer the buffer + * \param[in] count the count to use + */ +INLINE void +ldns_buffer_skip(ldns_buffer *buffer, ssize_t count) +{ + assert(buffer->_position + count <= buffer->_limit); + buffer->_position += count; +} + +/** + * returns the maximum size of the buffer + * \param[in] buffer + * \return the size + */ +INLINE size_t +ldns_buffer_limit(ldns_buffer *buffer) +{ + return buffer->_limit; +} + +/** + * changes the buffer's limit. If the buffer's position is greater + * than the new limit the position is set to the limit. + * \param[in] buffer the buffer + * \param[in] limit the new limit + */ +INLINE void +ldns_buffer_set_limit(ldns_buffer *buffer, size_t limit) +{ + assert(limit <= buffer->_capacity); + buffer->_limit = limit; + if (buffer->_position > buffer->_limit) + buffer->_position = buffer->_limit; +} + +/** + * returns the number of bytes the buffer can hold. + * \param[in] buffer the buffer + * \return the number of bytes + */ +INLINE size_t +ldns_buffer_capacity(ldns_buffer *buffer) +{ + return buffer->_capacity; +} + +/** + * changes the buffer's capacity. The data is reallocated so any + * pointers to the data may become invalid. The buffer's limit is set + * to the buffer's new capacity. + * \param[in] buffer the buffer + * \param[in] capacity the capacity to use + * \return whether this failed or succeeded + */ +bool ldns_buffer_set_capacity(ldns_buffer *buffer, size_t capacity); + +/** + * ensures BUFFER can contain at least AMOUNT more bytes. The buffer's + * capacity is increased if necessary using buffer_set_capacity(). + * + * The buffer's limit is always set to the (possibly increased) + * capacity. + * \param[in] buffer the buffer + * \param[in] amount amount to use + * \return whether this failed or succeeded + */ +bool ldns_buffer_reserve(ldns_buffer *buffer, size_t amount); + +/** + * returns a pointer to the data at the indicated position. + * \param[in] buffer the buffer + * \param[in] at position + * \return the pointer to the data + */ +INLINE uint8_t * +ldns_buffer_at(const ldns_buffer *buffer, size_t at) +{ + assert(at <= buffer->_limit); + return buffer->_data + at; +} + +/** + * returns a pointer to the beginning of the buffer (the data at + * position 0). + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +ldns_buffer_begin(const ldns_buffer *buffer) +{ + return ldns_buffer_at(buffer, 0); +} + +/** + * returns a pointer to the end of the buffer (the data at the buffer's + * limit). + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +ldns_buffer_end(ldns_buffer *buffer) +{ + return ldns_buffer_at(buffer, buffer->_limit); +} + +/** + * returns a pointer to the data at the buffer's current position. + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +ldns_buffer_current(ldns_buffer *buffer) +{ + return ldns_buffer_at(buffer, buffer->_position); +} + +/** + * returns the number of bytes remaining between the indicated position and + * the limit. + * \param[in] buffer the buffer + * \param[in] at indicated position + * \return number of bytes + */ +INLINE size_t +ldns_buffer_remaining_at(ldns_buffer *buffer, size_t at) +{ + ldns_buffer_invariant(buffer); + assert(at <= buffer->_limit); + return buffer->_limit - at; +} + +/** + * returns the number of bytes remaining between the buffer's position and + * limit. + * \param[in] buffer the buffer + * \return the number of bytes + */ +INLINE size_t +ldns_buffer_remaining(ldns_buffer *buffer) +{ + return ldns_buffer_remaining_at(buffer, buffer->_position); +} + +/** + * checks if the buffer has at least COUNT more bytes available. + * Before reading or writing the caller needs to ensure enough space + * is available! + * \param[in] buffer the buffer + * \param[in] at indicated position + * \param[in] count how much is available + * \return true or false (as int?) + */ +INLINE int +ldns_buffer_available_at(ldns_buffer *buffer, size_t at, size_t count) +{ + return count <= ldns_buffer_remaining_at(buffer, at); +} + +/** + * checks if the buffer has count bytes available at the current position + * \param[in] buffer the buffer + * \param[in] count how much is available + * \return true or false (as int?) + */ +INLINE int +ldns_buffer_available(ldns_buffer *buffer, size_t count) +{ + return ldns_buffer_available_at(buffer, buffer->_position, count); +} + +/** + * writes the given data to the buffer at the specified position + * \param[in] buffer the buffer + * \param[in] at the position (in number of bytes) to write the data at + * \param[in] data pointer to the data to write to the buffer + * \param[in] count the number of bytes of data to write + */ +INLINE void +ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void *data, size_t count) +{ + assert(ldns_buffer_available_at(buffer, at, count)); + memcpy(buffer->_data + at, data, count); +} + +/** + * writes count bytes of data to the current position of the buffer + * \param[in] buffer the buffer + * \param[in] data the data to write + * \param[in] count the lenght of the data to write + */ +INLINE void +ldns_buffer_write(ldns_buffer *buffer, const void *data, size_t count) +{ + ldns_buffer_write_at(buffer, buffer->_position, data, count); + buffer->_position += count; +} + +/** + * copies the given (null-delimited) string to the specified position at the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] str the string to write + */ +INLINE void +ldns_buffer_write_string_at(ldns_buffer *buffer, size_t at, const char *str) +{ + ldns_buffer_write_at(buffer, at, str, strlen(str)); +} + +/** + * copies the given (null-delimited) string to the current position at the buffer + * \param[in] buffer the buffer + * \param[in] str the string to write + */ +INLINE void +ldns_buffer_write_string(ldns_buffer *buffer, const char *str) +{ + ldns_buffer_write(buffer, str, strlen(str)); +} + +/** + * writes the given byte of data at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 8 bits to write + */ +INLINE void +ldns_buffer_write_u8_at(ldns_buffer *buffer, size_t at, uint8_t data) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(data))); + buffer->_data[at] = data; +} + +/** + * writes the given byte of data at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 8 bits to write + */ +INLINE void +ldns_buffer_write_u8(ldns_buffer *buffer, uint8_t data) +{ + ldns_buffer_write_u8_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * writes the given 2 byte integer at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 16 bits to write + */ +INLINE void +ldns_buffer_write_u16_at(ldns_buffer *buffer, size_t at, uint16_t data) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(data))); + ldns_write_uint16(buffer->_data + at, data); +} + +/** + * writes the given 2 byte integer at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 16 bits to write + */ +INLINE void +ldns_buffer_write_u16(ldns_buffer *buffer, uint16_t data) +{ + ldns_buffer_write_u16_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * writes the given 4 byte integer at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 32 bits to write + */ +INLINE void +ldns_buffer_write_u32_at(ldns_buffer *buffer, size_t at, uint32_t data) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(data))); + ldns_write_uint32(buffer->_data + at, data); +} + +/** + * writes the given 4 byte integer at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 32 bits to write + */ +INLINE void +ldns_buffer_write_u32(ldns_buffer *buffer, uint32_t data) +{ + ldns_buffer_write_u32_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * copies count bytes of data at the given position to the given data-array + * \param[in] buffer the buffer + * \param[in] at the position in the buffer to start + * \param[out] data buffer to copy to + * \param[in] count the length of the data to copy + */ +INLINE void +ldns_buffer_read_at(ldns_buffer *buffer, size_t at, void *data, size_t count) +{ + assert(ldns_buffer_available_at(buffer, at, count)); + memcpy(data, buffer->_data + at, count); +} + +/** + * copies count bytes of data at the current position to the given data-array + * \param[in] buffer the buffer + * \param[out] data buffer to copy to + * \param[in] count the length of the data to copy + */ +INLINE void +ldns_buffer_read(ldns_buffer *buffer, void *data, size_t count) +{ + ldns_buffer_read_at(buffer, buffer->_position, data, count); + buffer->_position += count; +} + +/** + * returns the byte value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \return 1 byte integer + */ +INLINE uint8_t +ldns_buffer_read_u8_at(ldns_buffer *buffer, size_t at) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(uint8_t))); + return buffer->_data[at]; +} + +/** + * returns the byte value at the current position in the buffer + * \param[in] buffer the buffer + * \return 1 byte integer + */ +INLINE uint8_t +ldns_buffer_read_u8(ldns_buffer *buffer) +{ + uint8_t result = ldns_buffer_read_u8_at(buffer, buffer->_position); + buffer->_position += sizeof(uint8_t); + return result; +} + +/** + * returns the 2-byte integer value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at position in the buffer + * \return 2 byte integer + */ +INLINE uint16_t +ldns_buffer_read_u16_at(ldns_buffer *buffer, size_t at) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(uint16_t))); + return ldns_read_uint16(buffer->_data + at); +} + +/** + * returns the 2-byte integer value at the current position in the buffer + * \param[in] buffer the buffer + * \return 2 byte integer + */ +INLINE uint16_t +ldns_buffer_read_u16(ldns_buffer *buffer) +{ + uint16_t result = ldns_buffer_read_u16_at(buffer, buffer->_position); + buffer->_position += sizeof(uint16_t); + return result; +} + +/** + * returns the 4-byte integer value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at position in the buffer + * \return 4 byte integer + */ +INLINE uint32_t +ldns_buffer_read_u32_at(ldns_buffer *buffer, size_t at) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(uint32_t))); + return ldns_read_uint32(buffer->_data + at); +} + +/** + * returns the 4-byte integer value at the current position in the buffer + * \param[in] buffer the buffer + * \return 4 byte integer + */ +INLINE uint32_t +ldns_buffer_read_u32(ldns_buffer *buffer) +{ + uint32_t result = ldns_buffer_read_u32_at(buffer, buffer->_position); + buffer->_position += sizeof(uint32_t); + return result; +} + +/** + * returns the status of the buffer + * \param[in] buffer + * \return the status + */ +INLINE ldns_status +ldns_buffer_status(ldns_buffer *buffer) +{ + return buffer->_status; +} + +/** + * returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise + * \param[in] buffer the buffer + * \return true or false + */ +INLINE bool +ldns_buffer_status_ok(ldns_buffer *buffer) +{ + if (buffer) { + return ldns_buffer_status(buffer) == LDNS_STATUS_OK; + } else { + return false; + } +} + +/** + * prints to the buffer, increasing the capacity if required using + * buffer_reserve(). The buffer's position is set to the terminating + * '\\0'. Returns the number of characters written (not including the + * terminating '\\0') or -1 on failure. + */ +int ldns_buffer_printf(ldns_buffer *buffer, const char *format, ...); +/* ATTR_FORMAT(printf, 2, 3);*/ + +/** + * frees the buffer. + * \param[in] *buffer the buffer to be freed + * \return void + */ +void ldns_buffer_free(ldns_buffer *buffer); + +/** + * Makes the buffer fixed and returns a pointer to the data. The + * caller is responsible for free'ing the result. + * \param[in] *buffer the buffer to be exported + * \return void + */ +void *ldns_buffer_export(ldns_buffer *buffer); + +/** + * Copy contents of the other buffer to this buffer. Silently truncated + * if this buffer is too small. + * \param[out] *result resulting buffer which is copied to. + * \param[in] *from what to copy to result. + */ +void ldns_buffer_copy(ldns_buffer* result, ldns_buffer* from); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_BUFFER_H */ diff --git a/libs/ldns/ldns/common.h b/libs/ldns/ldns/common.h new file mode 100644 index 0000000000..cc7dd89d1a --- /dev/null +++ b/libs/ldns/ldns/common.h @@ -0,0 +1,52 @@ +/** + * \file common.h + * + * Common definitions for LDNS + */ + +/** + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_COMMON_H +#define LDNS_COMMON_H + +#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) + +#if defined(HAVE_STDBOOL_H) +#include +#else + +/*@ignore@*/ +/* splint barfs on this construct */ +typedef unsigned int bool; +#define bool bool +#define false 0 +#define true 1 +#define __bool_true_false_are_defined 1 +/*@end@*/ + +#endif + +#endif + +#ifdef HAVE_ATTR_FORMAT +#define ATTR_FORMAT(archetype, string_index, first_to_check) \ + __attribute__ ((format (archetype, string_index, first_to_check))) +#else /* !HAVE_ATTR_FORMAT */ +#define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ +#endif /* !HAVE_ATTR_FORMAT */ + +#if defined(__cplusplus) +#define ATTR_UNUSED(x) +#elif defined(HAVE_ATTR_UNUSED) +#define ATTR_UNUSED(x) x __attribute__((unused)) +#else /* !HAVE_ATTR_UNUSED */ +#define ATTR_UNUSED(x) x +#endif /* !HAVE_ATTR_UNUSED */ + +#endif /* LDNS_COMMON_H */ diff --git a/libs/ldns/ldns/config.h.in b/libs/ldns/ldns/config.h.in new file mode 100644 index 0000000000..473f1ff7c5 --- /dev/null +++ b/libs/ldns/ldns/config.h.in @@ -0,0 +1,470 @@ +/* ldns/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Whether the C compiler accepts the "format" attribute */ +#undef HAVE_ATTR_FORMAT + +/* Whether the C compiler accepts the "unused" attribute */ +#undef HAVE_ATTR_UNUSED + +/* Define to 1 if you have the `b32_ntop' function. */ +#undef HAVE_B32_NTOP + +/* Define to 1 if you have the `b32_pton' function. */ +#undef HAVE_B32_PTON + +/* Define to 1 if you have the `b64_ntop' function. */ +#undef HAVE_B64_NTOP + +/* Define to 1 if you have the `b64_pton' function. */ +#undef HAVE_B64_PTON + +/* Define to 1 if you have the `ctime_r' function. */ +#undef HAVE_CTIME_R + +/* Define to 1 if you have the declaration of `NID_secp384r1', and to 0 if you + don't. */ +#undef HAVE_DECL_NID_SECP384R1 + +/* Define to 1 if you have the declaration of `NID_X9_62_prime256v1', and to 0 + if you don't. */ +#undef HAVE_DECL_NID_X9_62_PRIME256V1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `endprotoent' function. */ +#undef HAVE_ENDPROTOENT + +/* Define to 1 if you have the `endservent' function. */ +#undef HAVE_ENDSERVENT + +/* Define to 1 if you have the `EVP_sha256' function. */ +#undef HAVE_EVP_SHA256 + +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + +/* Whether getaddrinfo is available */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R + +/* If you have HMAC_CTX_init */ +#undef HAVE_HMAC_CTX_INIT + +/* Define to 1 if you have the `inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define to 1 if you have the `inet_ntop' function. */ +#undef HAVE_INET_NTOP + +/* Define to 1 if you have the `inet_pton' function. */ +#undef HAVE_INET_PTON + +/* define if you have inttypes.h */ +#undef HAVE_INTTYPES_H + +/* if the function 'ioctlsocket' is available */ +#undef HAVE_IOCTLSOCKET + +/* Define to 1 if you have the `isascii' function. */ +#undef HAVE_ISASCII + +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have Python libraries and header files. */ +#undef HAVE_PYTHON + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#undef HAVE_REALLOC + +/* Define to 1 if you have the `sleep' function. */ +#undef HAVE_SLEEP + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define if you have the SSL libraries installed. */ +#undef HAVE_SSL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define if you have Swig libraries and header files. */ +#undef HAVE_SWIG + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* define if you have sys/socket.h */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* define if you have sys/types.h */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* define if you have unistd.h */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* System configuration dir */ +#undef SYSCONFDIR + +/* Define this to enable ECDSA support. */ +#undef USE_ECDSA + +/* Define this to enable GOST support. */ +#undef USE_GOST + +/* Define this to enable SHA256 and SHA512 support. */ +#undef USE_SHA2 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Whether the windows socket API is used */ +#undef USE_WINSOCK + +/* the version of the windows API enabled */ +#undef WINVER + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* in_addr_t */ +#undef in_addr_t + +/* in_port_t */ +#undef in_port_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `short' if does not define. */ +#undef int16_t + +/* Define to `int' if does not define. */ +#undef int32_t + +/* Define to `long long' if does not define. */ +#undef int64_t + +/* Define to `char' if does not define. */ +#undef int8_t + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to 'int' if not defined */ +#undef socklen_t + +/* Fallback member name for socket family in struct sockaddr_storage */ +#undef ss_family + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `unsigned short' if does not define. */ +#undef uint16_t + +/* Define to `unsigned int' if does not define. */ +#undef uint32_t + +/* Define to `unsigned long long' if does not define. */ +#undef uint64_t + +/* Define to `unsigned char' if does not define. */ +#undef uint8_t + + +#include +#include +#include +#include + +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + +#ifndef BYTE_ORDER +#ifdef WORDS_BIGENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* WORDS_BIGENDIAN */ +#endif /* BYTE_ORDER */ + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + + +/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */ +#ifdef HAVE_WINSOCK2_H +#define FD_SET_T (u_int) +#else +#define FD_SET_T +#endif + + + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef B64_PTON +int ldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b64_ntop + */ +/*@unused@*/ +static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) +{ + return ((((srcsize + 2) / 3) * 4) + 1); +} +#endif /* !B64_PTON */ +#ifndef B64_NTOP +int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of ldns_b64_pton + */ +/*@unused@*/ +static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) +{ + return (((((srcsize + 3) / 4) * 3)) + 1); +} +#endif /* !B64_NTOP */ + +#ifndef HAVE_SLEEP +/* use windows sleep, in millisecs, instead */ +#define sleep(x) Sleep((x)*1000) +#endif + +#ifndef HAVE_RANDOM +#define srandom(x) srand(x) +#define random(x) rand(x) +#endif + +#ifndef HAVE_TIMEGM +#include +time_t timegm (struct tm *tm); +#endif /* !TIMEGM */ +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *timep, struct tm *result); +#endif +#ifndef HAVE_ISBLANK +int isblank(int c); +#endif /* !HAVE_ISBLANK */ +#ifndef HAVE_ISASCII +int isascii(int c); +#endif /* !HAVE_ISASCII */ +#ifndef HAVE_SNPRINTF +#include +int snprintf (char *str, size_t count, const char *fmt, ...); +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); +#endif /* HAVE_SNPRINTF */ +#ifndef HAVE_INET_PTON +int inet_pton(int af, const char* src, void* dst); +#endif /* HAVE_INET_PTON */ +#ifndef HAVE_INET_NTOP +const char *inet_ntop(int af, const void *src, char *dst, size_t size); +#endif +#ifndef HAVE_INET_ATON +int inet_aton(const char *cp, struct in_addr *addr); +#endif +#ifndef HAVE_MEMMOVE +void *memmove(void *dest, const void *src, size_t n); +#endif +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t siz); +#endif +#ifdef __cplusplus +} +#endif +#ifndef HAVE_GETADDRINFO +#include "compat/fake-rfc2553.h" +#endif +#ifndef HAVE_STRTOUL +#define strtoul (unsigned long)strtol +#endif + diff --git a/libs/ldns/ldns/dname.h b/libs/ldns/ldns/dname.h new file mode 100644 index 0000000000..a91f075257 --- /dev/null +++ b/libs/ldns/ldns/dname.h @@ -0,0 +1,201 @@ +/* + * dname.h + * + * dname definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file dname.h + * + * dname contains function to read and manipulate domain names. + * + * Example domain names are "www.nlnetlabs.nl." and "." (the root) + * + * If a domain name ends with a dot ("."), it is called a Fully Qualified + * Domain Name (FQDN). In certain places (for instance when reading a zone + * file), an origin (which is just another domain name) non-FQDNs will be + * placed after the current. For instance, if i have a zone file where the + * origin has been set to "nl.", and my file contains the name + * "www.nlnetlabs", it will result in "www.nlnetlabs.nl.". Internally, dnames are + * always absolute (the dot is added when it is missing and there is no origin). + * + * An FQDN is also + * known as an absolute domain name, therefore the function to check this is + * called \ref ldns_dname_str_absolute + * + * Domain names are stored in \ref ldns_rdf structures, with the type + * \ref LDNS_RDF_TYPE_DNAME + * + * This module is *NOT* about the RR type called DNAME. + */ + + +#ifndef LDNS_DNAME_H +#define LDNS_DNAME_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_DNAME_NORMALIZE tolower + +/** + * concatenates two dnames together + * \param[in] rd1 the leftside + * \param[in] rd2 the rightside + * \return a new rdf with leftside/rightside + */ +ldns_rdf *ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2); + +/** + * concatenates rd2 after rd1 (rd2 is copied, rd1 is modified) + * \param[in] rd1 the leftside + * \param[in] rd2 the rightside + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dname_cat(ldns_rdf *rd1, ldns_rdf *rd2); + +/** + * Returns a clone of the given dname with the labels + * reversed + * \param[in] d the dname to reverse + * \return clone of the dname with the labels reversed. + */ +ldns_rdf *ldns_dname_reverse(const ldns_rdf *d); + +/** + * Clones the given dname from the nth label on + * \param[in] d The dname to clone + * \param[in] n the label nr to clone from, if this is 0, the complete + * dname is cloned + * \return A newly allocated *rdf structure, containing the cloned dname, + * or NULL if either d was NULL, not a dname, or if n >= + * label_count + */ +ldns_rdf * +ldns_dname_clone_from(const ldns_rdf *d, uint16_t n); + +/** + * chop one label off the left side of a dname. so + * wwww.nlnetlabs.nl, becomes nlnetlabs.nl + * This new name is a clone and must be freed with ldns_deep_free() + * \param[in] d the dname to chop + * \return the remaining dname + */ +ldns_rdf *ldns_dname_left_chop(const ldns_rdf *d); + +/** + * count the number of labels inside a LDNS_RDF_DNAME type rdf. + * \param[in] *r the rdf + * \return the number of labels + */ +uint8_t ldns_dname_label_count(const ldns_rdf *r); + +/** + * creates a new dname rdf from a string. + * \param[in] str string to use + * \return ldns_rdf* or NULL in case of an error + */ +ldns_rdf *ldns_dname_new_frm_str(const char *str); + +/** + * Create a new dname rdf from a string + * \param[in] s the size of the new dname + * \param[in] *data pointer to the actual data + * \return ldns_rdf* + */ +ldns_rdf *ldns_dname_new(uint16_t s, void *data); + +/** + * Create a new dname rdf from data (the data is copied) + * \param[in] size the size of the data + * \param[in] *data pointer to the actual data + * \return ldns_rdf* + */ +ldns_rdf *ldns_dname_new_frm_data(uint16_t size, const void *data); + +/** + * Put a dname into canonical fmt - ie. lowercase it + * \param[in] rdf the dname to lowercase + * \return void + */ +void ldns_dname2canonical(const ldns_rdf *rdf); + +/** + * test wether the name sub falls under parent (i.e. is a subdomain + * of parent). This function will return false if the given dnames are + * equal. + * \param[in] sub the name to test + * \param[in] parent the parent's name + * \return true if sub falls under parent, otherwise false + */ +bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent); + +/** + * Compares the two dname rdf's according to the algorithm for ordering + * in RFC4034 Section 6. + * \param[in] dname1 First dname rdf to compare + * \param[in] dname2 Second dname rdf to compare + * \return -1 if dname1 comes before dname2, 1 if dname1 comes after dname2, and 0 if they are equal. + */ +int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2); + +/** + * Checks whether the dname matches the given wildcard + * \param[in] dname The dname to check + * \param[in] wildcard The wildcard to check with + * \return 1 If the wildcard matches, OR if 'wildcard' is not a wildcard and + * the names are *exactly* the same + * 0 If the wildcard does not match, or if it is not a wildcard and + * the names are not the same + */ +int ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard); + +/** + * check if middle lays in the interval defined by prev and next + * prev <= middle < next. This is usefull for nsec checking + * \param[in] prev the previous dname + * \param[in] middle the dname to check + * \param[in] next the next dname + * return 0 on error or unknown, -1 when middle is in the interval, +1 when not + */ +int ldns_dname_interval(const ldns_rdf *prev, const ldns_rdf *middle, const ldns_rdf *next); + +/** + * Checks whether the given dname string is absolute (i.e. ends with a '.') + * \param[in] *dname_str a string representing the dname + * \return true or false + */ +bool ldns_dname_str_absolute(const char *dname_str); + +/** + * look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME + * try and retrieve a specific label. The labels are numbered + * starting from 0 (left most). + * \param[in] rdf the rdf to look in + * \param[in] labelpos return the label with this number + * \return a ldns_rdf* with the label as name or NULL on error + */ +ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos); + +/** + * Check if dname is a wildcard, starts with *. + * \param[in] dname: the rdf to look in + * \return true if a wildcard, false if not. + */ +int ldns_dname_is_wildcard(const ldns_rdf* dname); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_DNAME_H */ diff --git a/libs/ldns/ldns/dnssec.h b/libs/ldns/ldns/dnssec.h new file mode 100644 index 0000000000..7bfc70b710 --- /dev/null +++ b/libs/ldns/ldns/dnssec.h @@ -0,0 +1,497 @@ +/* + * dnssec.h -- defines for the Domain Name System (SEC) (DNSSEC) + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + * A bunch of defines that are used in the DNS + */ + +/** + * \file dnssec.h + * + * This module contains base functions for DNSSEC operations + * (RFC4033 t/m RFC4035). + * + * Since those functions heavily rely op cryptographic operations, + * this module is dependent on openssl. + * + */ + + +#ifndef LDNS_DNSSEC_H +#define LDNS_DNSSEC_H + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_MAX_KEYLEN 2048 +#define LDNS_DNSSEC_KEYPROTO 3 +/* default time before sigs expire */ +#define LDNS_DEFAULT_EXP_TIME 2419200 /* 4 weeks */ + +/** return values for the old-signature callback */ +#define LDNS_SIGNATURE_LEAVE_ADD_NEW 0 +#define LDNS_SIGNATURE_LEAVE_NO_ADD 1 +#define LDNS_SIGNATURE_REMOVE_ADD_NEW 2 +#define LDNS_SIGNATURE_REMOVE_NO_ADD 3 + +/** + * Returns the first RRSIG rr that corresponds to the rrset + * with the given name and type + * + * \param[in] name The dname of the RRset covered by the RRSIG to find + * \param[in] type The type of the RRset covered by the RRSIG to find + * \param[in] rrs List of rrs to search in + * \returns Pointer to the first RRsig ldns_rr found, or NULL if it is + * not present + */ +ldns_rr *ldns_dnssec_get_rrsig_for_name_and_type(const ldns_rdf *name, + const ldns_rr_type type, + const ldns_rr_list *rrs); + +/** + * Returns the DNSKEY that corresponds to the given RRSIG rr from the list, if + * any + * + * \param[in] rrsig The rrsig to find the DNSKEY for + * \param[in] rrs The rr list to find the key in + * \return The DNSKEY that corresponds to the given RRSIG, or NULL if it was + * not found. + */ +ldns_rr *ldns_dnssec_get_dnskey_for_rrsig(const ldns_rr *rrsig, const ldns_rr_list *rrs); + +/** + * Returns the rdata field that contains the bitmap of the covered types of + * the given NSEC record + * + * \param[in] nsec The nsec to get the covered type bitmap of + * \return An ldns_rdf containing the bitmap, or NULL on error + */ +ldns_rdf *ldns_nsec_get_bitmap(ldns_rr *nsec); + + +#define LDNS_NSEC3_MAX_ITERATIONS 65535 + +/** + * Returns the dname of the closest (provable) encloser + */ +ldns_rdf * +ldns_dnssec_nsec3_closest_encloser(ldns_rdf *qname, + ldns_rr_type qtype, + ldns_rr_list *nsec3s); + +/** + * Checks whether the packet contains rrsigs + */ +bool +ldns_dnssec_pkt_has_rrsigs(const ldns_pkt *pkt); + +/** + * Returns a ldns_rr_list containing the signatures covering the given name + * and type + */ +ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type); + +/** + * Returns a ldns_rr_list containing the signatures covering the given type + */ +ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_type(const ldns_pkt *pkt, ldns_rr_type type); + +/** + * calculates a keytag of a key for use in DNSSEC. + * + * \param[in] key the key as an RR to use for the calc. + * \return the keytag + */ +uint16_t ldns_calc_keytag(const ldns_rr *key); + +/** + * Calculates keytag of DNSSEC key, operates on wireformat rdata. + * \param[in] key the key as uncompressed wireformat rdata. + * \param[in] keysize length of key data. + * \return the keytag + */ +uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize); + +#ifdef HAVE_SSL +/** + * converts a buffer holding key material to a DSA key in openssl. + * + * \param[in] key the key to convert + * \return a DSA * structure with the key material + */ +DSA *ldns_key_buf2dsa(ldns_buffer *key); +/** + * Like ldns_key_buf2dsa, but uses raw buffer. + * \param[in] key the uncompressed wireformat of the key. + * \param[in] len length of key data + * \return a DSA * structure with the key material + */ +DSA *ldns_key_buf2dsa_raw(unsigned char* key, size_t len); + +/** + * Utility function to calculate hash using generic EVP_MD pointer. + * \param[in] data the data to hash. + * \param[in] len length of data. + * \param[out] dest the destination of the hash, must be large enough. + * \param[in] md the message digest to use. + * \return true if worked, false on failure. + */ +int ldns_digest_evp(unsigned char* data, unsigned int len, + unsigned char* dest, const EVP_MD* md); + +/** + * Converts a holding buffer with key material to EVP PKEY in openssl. + * Only available if ldns was compiled with GOST. + * \param[in] key data to convert + * \param[in] keylen length of the key data + * \return the key or NULL on error. + */ +EVP_PKEY* ldns_gost2pkey_raw(unsigned char* key, size_t keylen); + +/** + * Converts a holding buffer with key material to EVP PKEY in openssl. + * Only available if ldns was compiled with ECDSA. + * \param[in] key data to convert + * \param[in] keylen length of the key data + * \param[in] algo precise algorithm to initialize ECC group values. + * \return the key or NULL on error. + */ +EVP_PKEY* ldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo); + +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * converts a buffer holding key material to a RSA key in openssl. + * + * \param[in] key the key to convert + * \return a RSA * structure with the key material + */ +RSA *ldns_key_buf2rsa(ldns_buffer *key); + +/** + * Like ldns_key_buf2rsa, but uses raw buffer. + * \param[in] key the uncompressed wireformat of the key. + * \param[in] len length of key data + * \return a RSA * structure with the key material + */ +RSA *ldns_key_buf2rsa_raw(unsigned char* key, size_t len); +#endif /* HAVE_SSL */ + +/** + * returns a new DS rr that represents the given key rr. + * + * \param[in] *key the key to convert + * \param[in] h the hash to use LDNS_SHA1/LDNS_SHA256 + * \return ldns_rr* a new rr pointer to a DS + */ +ldns_rr *ldns_key_rr2ds(const ldns_rr *key, ldns_hash h); + +/** + * Create the type bitmap for an NSEC(3) record + */ +ldns_rdf * +ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[], + size_t size, + ldns_rr_type nsec_type); + +/** + * Creates NSEC + */ +ldns_rr * +ldns_dnssec_create_nsec(ldns_dnssec_name *from, + ldns_dnssec_name *to, + ldns_rr_type nsec_type); + + +/** + * Creates NSEC3 + */ +ldns_rr * +ldns_dnssec_create_nsec3(ldns_dnssec_name *from, + ldns_dnssec_name *to, + ldns_rdf *zone_name, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/** + * Create a NSEC record + * \param[in] cur_owner the current owner which should be taken as the starting point + * \param[in] next_owner the rrlist which the nsec rr should point to + * \param[in] rrs all rrs from the zone, to find all RR types of cur_owner in + * \return a ldns_rr with the nsec record in it + */ +ldns_rr * ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs); + +/** + * Calculates the hashed name using the given parameters + * \param[in] *name The owner name to calculate the hash for + * \param[in] algorithm The hash algorithm to use + * \param[in] iterations The number of hash iterations to use + * \param[in] salt_length The length of the salt in bytes + * \param[in] salt The salt to use + * \return The hashed owner name rdf, without the domain name + */ +ldns_rdf *ldns_nsec3_hash_name(ldns_rdf *name, uint8_t algorithm, uint16_t iterations, uint8_t salt_length, uint8_t *salt); + +/** + * Sets all the NSEC3 options. The rr to set them in must be initialized with _new() and + * type LDNS_RR_TYPE_NSEC3 + * \param[in] *rr The RR to set the values in + * \param[in] algorithm The NSEC3 hash algorithm + * \param[in] flags The flags field + * \param[in] iterations The number of hash iterations + * \param[in] salt_length The length of the salt in bytes + * \param[in] salt The salt bytes + */ +void ldns_nsec3_add_param_rdfs(ldns_rr *rr, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/* this will NOT return the NSEC3 completed, you will have to run the + finalize function on the rrlist later! */ +ldns_rr * +ldns_create_nsec3(ldns_rdf *cur_owner, + ldns_rdf *cur_zone, + ldns_rr_list *rrs, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt, + bool emptynonterminal); + +/** + * Returns the hash algorithm used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The algorithm identifier, or 0 on error + */ +uint8_t ldns_nsec3_algorithm(const ldns_rr *nsec3_rr); + +/** + * Returns flags field + */ +uint8_t +ldns_nsec3_flags(const ldns_rr *nsec3_rr); + +/** + * Returns true if the opt-out flag has been set in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return true if the RR has type NSEC3 and the opt-out bit has been set, false otherwise + */ +bool ldns_nsec3_optout(const ldns_rr *nsec3_rr); + +/** + * Returns the number of hash iterations used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The number of iterations + */ +uint16_t ldns_nsec3_iterations(const ldns_rr *nsec3_rr); + +/** + * Returns the salt used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The salt rdf, or NULL on error + */ +ldns_rdf *ldns_nsec3_salt(const ldns_rr *nsec3_rr); + +/** + * Returns the length of the salt used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The length of the salt in bytes + */ +uint8_t ldns_nsec3_salt_length(const ldns_rr *nsec3_rr); + +/** + * Returns the salt bytes used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The salt in bytes, this is alloced, so you need to free it + */ +uint8_t *ldns_nsec3_salt_data(const ldns_rr *nsec3_rr); + +/** + * Returns the first label of the next ownername in the NSEC3 chain (ie. without the domain) + * \param[in] nsec3_rr The RR to read from + * \return The first label of the next owner name in the NSEC3 chain, or NULL on error + */ +ldns_rdf *ldns_nsec3_next_owner(const ldns_rr *nsec3_rr); + +/** + * Returns the bitmap specifying the covered types of the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The covered type bitmap rdf + */ +ldns_rdf *ldns_nsec3_bitmap(const ldns_rr *nsec3_rr); + +/** + * Calculates the hashed name using the parameters of the given NSEC3 RR + * \param[in] *nsec The RR to use the parameters from + * \param[in] *name The owner name to calculate the hash for + * \return The hashed owner name rdf, without the domain name + */ +ldns_rdf *ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name); + +/** + * Checks coverage of NSEC RR type bitmap + * \param[in] nsec_bitmap The NSEC bitmap rdata field to check + * \param[in] type The type to check + * \return true if the NSEC RR covers the type + */ +bool ldns_nsec_bitmap_covers_type(const ldns_rdf *nsec_bitmap, ldns_rr_type type); + +/** + * Checks coverage of NSEC(3) RR name span + * Remember that nsec and name must both be in canonical form (ie use + * \ref ldns_rr2canonical and \ref ldns_dname2canonical prior to calling this + * function) + * + * \param[in] nsec The NSEC RR to check + * \param[in] name The owner dname to check, if the nsec record is a NSEC3 record, this should be the hashed name + * \return true if the NSEC RR covers the owner name + */ +bool ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name); + +#ifdef HAVE_SSL +/** + * verify a packet + * \param[in] p the packet + * \param[in] t the rr set type to check + * \param[in] o the rr set name to check + * \param[in] k list of keys + * \param[in] s list of sigs (may be null) + * \param[out] good_keys keys which validated the packet + * \return status + * + */ +ldns_status ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, ldns_rr_list *k, ldns_rr_list *s, ldns_rr_list *good_keys); +#endif + +/** + * chains nsec3 list + */ +ldns_status +ldns_dnssec_chain_nsec3_list(ldns_rr_list *nsec3_rrs); + +/** + * compare for nsec3 sort + */ +int +qsort_rr_compare_nsec3(const void *a, const void *b); + +/** + * sort nsec3 list + */ +void +ldns_rr_list_sort_nsec3(ldns_rr_list *unsorted); + +/** + * Default callback function to always leave present signatures, and + * add new ones + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_LEAVE_ADD_NEW + */ +int ldns_dnssec_default_add_to_signatures(ldns_rr *sig, void *n); +/** + * Default callback function to always leave present signatures, and + * add no new ones for the keys of these signatures + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_LEAVE_NO_ADD + */ +int ldns_dnssec_default_leave_signatures(ldns_rr *sig, void *n); +/** + * Default callback function to always remove present signatures, but + * add no new ones + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_REMOVE_NO_ADD + */ +int ldns_dnssec_default_delete_signatures(ldns_rr *sig, void *n); +/** + * Default callback function to always leave present signatures, and + * add new ones + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_REMOVE_ADD_NEW + */ +int ldns_dnssec_default_replace_signatures(ldns_rr *sig, void *n); + +#ifdef HAVE_SSL +/** + * Converts the DSA signature from ASN1 representation (RFC2459, as + * used by OpenSSL) to raw signature data as used in DNS (rfc2536) + * + * \param[in] sig The signature in RFC2459 format + * \param[in] sig_len The length of the signature + * \return a new rdf with the signature + */ +ldns_rdf * +ldns_convert_dsa_rrsig_asn12rdf(const ldns_buffer *sig, + const long sig_len); + +/** + * Converts the RRSIG signature RDF (in rfc2536 format) to a buffer + * with the signature in rfc2459 format + * + * \param[out] target_buffer buffer to place the signature data + * \param[in] sig_rdf The signature rdf to convert + * \return LDNS_STATUS_OK on success, error code otherwise + */ +ldns_status +ldns_convert_dsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, + const ldns_rdf *sig_rdf); + +/** + * Converts the ECDSA signature from ASN1 representation (as + * used by OpenSSL) to raw signature data as used in DNS + * This routine is only present if ldns is compiled with ecdsa support. + * + * \param[in] sig The signature in ASN1 format + * \param[in] sig_len The length of the signature + * \return a new rdf with the signature + */ +ldns_rdf * +ldns_convert_ecdsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len); + +/** + * Converts the RRSIG signature RDF (from DNS) to a buffer with the + * signature in ASN1 format as openssl uses it. + * This routine is only present if ldns is compiled with ecdsa support. + * + * \param[out] target_buffer buffer to place the signature data in ASN1. + * \param[in] sig_rdf The signature rdf to convert + * \return LDNS_STATUS_OK on success, error code otherwise + */ +ldns_status +ldns_convert_ecdsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, + const ldns_rdf *sig_rdf); + +#endif /* HAVE_SSL */ + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_DNSSEC_H */ diff --git a/libs/ldns/ldns/dnssec_sign.h b/libs/ldns/ldns/dnssec_sign.h new file mode 100644 index 0000000000..5b3921ab20 --- /dev/null +++ b/libs/ldns/ldns/dnssec_sign.h @@ -0,0 +1,318 @@ +/** dnssec_verify */ + +#ifndef LDNS_DNSSEC_SIGN_H +#define LDNS_DNSSEC_SIGN_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* sign functions */ + +/** Sign flag that makes DNSKEY type signed by all keys, not only by SEP keys*/ +#define LDNS_SIGN_DNSKEY_WITH_ZSK 1 + +/** + * Create an empty RRSIG RR (i.e. without the actual signature data) + * \param[in] rrset The RRset to create the signature for + * \param[in] key The key that will create the signature + * \return signature rr + */ +ldns_rr * +ldns_create_empty_rrsig(ldns_rr_list *rrset, + ldns_key *key); + +/** + * Sign the buffer which contains the wiredata of an rrset, and the + * corresponding empty rrsig rr with the given key + * \param[in] sign_buf the buffer with data to sign + * \param[in] key the key to sign with + * \return an rdata field with the signature data + */ +ldns_rdf * +ldns_sign_public_buffer(ldns_buffer *sign_buf, ldns_key *key); + +/** + * Sign an rrset + * \param[in] rrset the rrset + * \param[in] keys the keys to use + * \return a rr_list with the signatures + */ +ldns_rr_list *ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys); + +#ifdef HAVE_SSL +/** + * Sign a buffer with the DSA key (hash with SHA1) + * \param[in] to_sign buffer with the data + * \param[in] key the key to use + * \return a ldns_rdf with the signed data + */ +ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key); + +/** + * Sign data with EVP (general method for different algorithms) + * + * \param[in] to_sign The ldns_buffer containing raw data that is + * to be signed + * \param[in] key The EVP_PKEY key structure to sign with + * \param[in] digest_type The digest algorithm to use in the creation of + * the signature + * \return ldns_rdf for the RRSIG ldns_rr + */ +ldns_rdf *ldns_sign_public_evp(ldns_buffer *to_sign, + EVP_PKEY *key, + const EVP_MD *digest_type); + +/** + * Sign a buffer with the RSA key (hash with SHA1) + * \param[in] to_sign buffer with the data + * \param[in] key the key to use + * \return a ldns_rdf with the signed data + */ +ldns_rdf *ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key); + +/** + * Sign a buffer with the RSA key (hash with MD5) + * \param[in] to_sign buffer with the data + * \param[in] key the key to use + * \return a ldns_rdf with the signed data + */ +ldns_rdf *ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key); +#endif /* HAVE_SSL */ + +/** + * Finds the first dnssec_name node in the rbtree that has not been marked + * as glue, starting at the given node + * + * \param[in] node the first node to check + * \return the first node that has not been marked as glue, or NULL + * if not found (TODO: make that LDNS_RBTREE_NULL?) + */ +ldns_rbnode_t *ldns_dnssec_name_node_next_nonglue(ldns_rbnode_t *node); + +/** + * Adds NSEC records to the given dnssec_zone + * + * \param[in] zone the zone to add the records to + * \param[in] new_rrs ldns_rr's created by this function are + * added to this rr list, so the caller can free them later + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs); + +/** + * Adds NSEC3 records to the zone + */ +ldns_status +ldns_dnssec_zone_create_nsec3s(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/** + * remove signatures if callback function tells to + * + * \param[in] signatures list of signatures to check, and + * possibly remove, depending on the value of the + * callback + * \param[in] key_list these are marked to be used or not, + * on the return value of the callback + * \param[in] func this function is called to specify what to + * do with each signature (and corresponding key) + * \param[in] arg Optional argument for the callback function + * \returns pointer to the new signatures rrs (the original + * passed to this function may have been removed) + */ +ldns_dnssec_rrs *ldns_dnssec_remove_signatures(ldns_dnssec_rrs *signatures, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg); + +/** + * Adds signatures to the zone + * + * \param[in] zone the zone to add RRSIG Resource Records to + * \param[in] new_rrs the RRSIG RRs that are created are also + * added to this list, so the caller can free them + * later + * \param[in] key_list list of keys to sign with. + * \param[in] func Callback function to decide what keys to + * use and what to do with old signatures + * \param[in] arg Optional argument for the callback function + * \param[in] flags option flags for signing process. 0 makes DNSKEY + * RRset signed with the minimal key set, that is only SEP keys are used + * for signing. If there are no SEP keys available, non-SEP keys will + * be used. LDNS_SIGN_DNSKEY_WITH_ZSK makes DNSKEY type signed with all + * keys. 0 is the default. + * \return LDNS_STATUS_OK on success, error otherwise + */ +ldns_status ldns_dnssec_zone_create_rrsigs_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void*), + void *arg, + int flags); + +/** + * Adds signatures to the zone + * + * \param[in] zone the zone to add RRSIG Resource Records to + * \param[in] new_rrs the RRSIG RRs that are created are also + * added to this list, so the caller can free them + * later + * \param[in] key_list list of keys to sign with. + * \param[in] func Callback function to decide what keys to + * use and what to do with old signatures + * \param[in] arg Optional argument for the callback function + * \return LDNS_STATUS_OK on success, error otherwise + */ +ldns_status ldns_dnssec_zone_create_rrsigs(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void*), + void *arg); + +/** + * signs the given zone with the given keys + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * This function takes an ldns_rr* and an optional void *arg argument, and returns one of four values: + * LDNS_SIGNATURE_LEAVE_ADD_NEW: + * leave the signature and add a new one for the corresponding key + * LDNS_SIGNATURE_REMOVE_ADD_NEW: + * remove the signature and replace is with a new one from the same key + * LDNS_SIGNATURE_LEAVE_NO_ADD: + * leave the signature and do not add a new one with the corresponding key + * LDNS_SIGNATURE_REMOVE_NO_ADD: + * remove the signature and do not replace + * + * \param[in] arg optional argument for the callback function + * \param[in] flags option flags for signing process. 0 makes DNSKEY + * RRset signed with the minimal key set, that is only SEP keys are used + * for signing. If there are no SEP keys available, non-SEP keys will + * be used. LDNS_SIGN_DNSKEY_WITH_ZSK makes DNSKEY type signed with all + * keys. 0 is the default. + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + int flags); + +/** + * signs the given zone with the given new zone, with NSEC3 + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * \param[in] arg optional argument for the callback function + * \param[in] algorithm the NSEC3 hashing algorithm to use + * \param[in] flags NSEC3 flags + * \param[in] iterations the number of NSEC3 hash iterations to use + * \param[in] salt_length the length (in octets) of the NSEC3 salt + * \param[in] salt the NSEC3 salt data + * \param[in] signflags option flags for signing process. 0 is the default. + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt, + int signflags); + +/** + * signs the given zone with the given keys + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * This function takes an ldns_rr* and an optional void *arg argument, and returns one of four values: + * LDNS_SIGNATURE_LEAVE_ADD_NEW: + * leave the signature and add a new one for the corresponding key + * LDNS_SIGNATURE_REMOVE_ADD_NEW: + * remove the signature and replace is with a new one from the same key + * LDNS_SIGNATURE_LEAVE_NO_ADD: + * leave the signature and do not add a new one with the corresponding key + * LDNS_SIGNATURE_REMOVE_NO_ADD: + * remove the signature and do not replace + * + * \param[in] arg optional argument for the callback function + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg); + +/** + * signs the given zone with the given new zone, with NSEC3 + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * \param[in] arg optional argument for the callback function + * \param[in] algorithm the NSEC3 hashing algorithm to use + * \param[in] flags NSEC3 flags + * \param[in] iterations the number of NSEC3 hash iterations to use + * \param[in] salt_length the length (in octets) of the NSEC3 salt + * \param[in] salt the NSEC3 salt data + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign_nsec3(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/** + * Signs the zone, and returns a newly allocated signed zone + * \param[in] zone the zone to sign + * \param[in] key_list list of keys to sign with + * \return signed zone + */ +ldns_zone *ldns_zone_sign(const ldns_zone *zone, ldns_key_list *key_list); + +/** + * Signs the zone with NSEC3, and returns a newly allocated signed zone + * \param[in] zone the zone to sign + * \param[in] key_list list of keys to sign with + * \param[in] algorithm the NSEC3 hashing algorithm to use + * \param[in] flags NSEC3 flags + * \param[in] iterations the number of NSEC3 hash iterations to use + * \param[in] salt_length the length (in octets) of the NSEC3 salt + * \param[in] salt the NSEC3 salt data + * \return signed zone + */ +ldns_zone *ldns_zone_sign_nsec3(ldns_zone *zone, ldns_key_list *key_list, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libs/ldns/ldns/dnssec_verify.h b/libs/ldns/ldns/dnssec_verify.h new file mode 100644 index 0000000000..8d380f9cee --- /dev/null +++ b/libs/ldns/ldns/dnssec_verify.h @@ -0,0 +1,612 @@ +/** dnssec_verify */ + +#ifndef LDNS_DNSSEC_VERIFY_H +#define LDNS_DNSSEC_VERIFY_H + +#define LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS 10 + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Chain structure that contains all DNSSEC data needed to + * verify an rrset + */ +typedef struct ldns_dnssec_data_chain_struct ldns_dnssec_data_chain; +struct ldns_dnssec_data_chain_struct +{ + ldns_rr_list *rrset; + ldns_rr_list *signatures; + ldns_rr_type parent_type; + ldns_dnssec_data_chain *parent; + ldns_pkt_rcode packet_rcode; + ldns_rr_type packet_qtype; + bool packet_nodata; +}; + +/** + * Creates a new dnssec_chain structure + * \return ldns_dnssec_data_chain * + */ +ldns_dnssec_data_chain *ldns_dnssec_data_chain_new(); + +/** + * Frees a dnssec_data_chain structure + * + * \param[in] *chain The chain to free + */ +void ldns_dnssec_data_chain_free(ldns_dnssec_data_chain *chain); + +/** + * Frees a dnssec_data_chain structure, and all data + * contained therein + * + * \param[in] *chain The dnssec_data_chain to free + */ +void ldns_dnssec_data_chain_deep_free(ldns_dnssec_data_chain *chain); + +/** + * Prints the dnssec_data_chain to the given file stream + * + * \param[in] *out The file stream to print to + * \param[in] *chain The dnssec_data_chain to print + */ +void ldns_dnssec_data_chain_print(FILE *out, const ldns_dnssec_data_chain *chain); + +/** + * Build an ldns_dnssec_data_chain, which contains all + * DNSSEC data that is needed to derive the trust tree later + * + * The data_set will be cloned + * + * \param[in] *res resolver structure for further needed queries + * \param[in] qflags resolution flags + * \param[in] *data_set The original rrset where the chain ends + * \param[in] *pkt optional, can contain the original packet + * (and hence the sigs and maybe the key) + * \param[in] *orig_rr The original Resource Record + * + * \return the DNSSEC data chain + */ +ldns_dnssec_data_chain *ldns_dnssec_build_data_chain(ldns_resolver *res, + const uint16_t qflags, + const ldns_rr_list *data_set, + const ldns_pkt *pkt, + ldns_rr *orig_rr); + +/** + * Tree structure that contains the relation of DNSSEC data, + * and their cryptographic status. + * + * This tree is derived from a data_chain, and can be used + * to look whether there is a connection between an RRSET + * and a trusted key. The tree only contains pointers to the + * data_chain, and therefore one should *never* free() the + * data_chain when there is still a trust tree derived from + * that chain. + * + * Example tree: + * key key key + * \ | / + * \ | / + * \ | / + * ds + * | + * key + * | + * key + * | + * rr + * + * For each signature there is a parent; if the parent + * pointer is null, it couldn't be found and there was no + * denial; otherwise is a tree which contains either a + * DNSKEY, a DS, or a NSEC rr + */ +typedef struct ldns_dnssec_trust_tree_struct ldns_dnssec_trust_tree; +struct ldns_dnssec_trust_tree_struct +{ + ldns_rr *rr; + /* the complete rrset this rr was in */ + ldns_rr_list *rrset; + ldns_dnssec_trust_tree *parents[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; + ldns_status parent_status[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; + /** for debugging, add signatures too (you might want + those if they contain errors) */ + ldns_rr *parent_signature[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; + size_t parent_count; +}; + +/** + * Creates a new (empty) dnssec_trust_tree structure + * + * \return ldns_dnssec_trust_tree * + */ +ldns_dnssec_trust_tree *ldns_dnssec_trust_tree_new(); + +/** + * Frees the dnssec_trust_tree recursively + * + * There is no deep free; all data in the trust tree + * consists of pointers to a data_chain + * + * \param[in] tree The tree to free + */ +void ldns_dnssec_trust_tree_free(ldns_dnssec_trust_tree *tree); + +/** + * returns the depth of the trust tree + * + * \param[in] tree tree to calculate the depth of + * \return The depth of the tree + */ +size_t ldns_dnssec_trust_tree_depth(ldns_dnssec_trust_tree *tree); + +/** + * Prints the dnssec_trust_tree structure to the given file + * stream. + * + * If a link status is not LDNS_STATUS_OK; the status and + * relevant signatures are printed too + * + * \param[in] *out The file stream to print to + * \param[in] tree The trust tree to print + * \param[in] tabs Prepend each line with tabs*2 spaces + * \param[in] extended If true, add little explanation lines to the output + */ +void ldns_dnssec_trust_tree_print(FILE *out, + ldns_dnssec_trust_tree *tree, + size_t tabs, + bool extended); + +/** + * Adds a trust tree as a parent for the given trust tree + * + * \param[in] *tree The tree to add the parent to + * \param[in] *parent The parent tree to add + * \param[in] *parent_signature The RRSIG relevant to this parent/child + * connection + * \param[in] parent_status The DNSSEC status for this parent, child and RRSIG + * \return LDNS_STATUS_OK if the addition succeeds, error otherwise + */ +ldns_status ldns_dnssec_trust_tree_add_parent(ldns_dnssec_trust_tree *tree, + const ldns_dnssec_trust_tree *parent, + const ldns_rr *parent_signature, + const ldns_status parent_status); + +/** + * Generates a dnssec_trust_ttree for the given rr from the + * given data_chain + * + * This does not clone the actual data; Don't free the + * data_chain before you are done with this tree + * + * \param[in] *data_chain The chain to derive the trust tree from + * \param[in] *rr The RR this tree will be about + * \return ldns_dnssec_trust_tree * + */ +ldns_dnssec_trust_tree *ldns_dnssec_derive_trust_tree( + ldns_dnssec_data_chain *data_chain, + ldns_rr *rr); + +/** + * Sub function for derive_trust_tree that is used for a + * 'normal' rrset + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + * \param[in] cur_sig_rr The currently relevant signature + */ +void ldns_dnssec_derive_trust_tree_normal_rrset( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_sig_rr); + +/** + * Sub function for derive_trust_tree that is used for DNSKEY rrsets + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + * \param[in] cur_rr The currently relevant DNSKEY RR + * \param[in] cur_sig_rr The currently relevant signature + */ +void ldns_dnssec_derive_trust_tree_dnskey_rrset( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_rr, + ldns_rr *cur_sig_rr); + +/** + * Sub function for derive_trust_tree that is used for DS rrsets + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + * \param[in] cur_rr The currently relevant DS RR + */ +void ldns_dnssec_derive_trust_tree_ds_rrset( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_rr); + +/** + * Sub function for derive_trust_tree that is used when there are no + * signatures + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + */ +void ldns_dnssec_derive_trust_tree_no_sig( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain); + +/** + * Returns OK if there is a trusted path in the tree to one of + * the DNSKEY or DS RRs in the given list + * + * \param *tree The trust tree so search + * \param *keys A ldns_rr_list of DNSKEY and DS rrs to look for + * \return LDNS_STATUS_OK if there is a trusted path to one of + * the keys, or the *first* error encountered + * if there were no paths + */ +ldns_status ldns_dnssec_trust_tree_contains_keys( + ldns_dnssec_trust_tree *tree, + ldns_rr_list *keys); + +/** + * Verifies a list of signatures for one rrset. + * + * \param[in] rrset the rrset to verify + * \param[in] rrsig a list of signatures to check + * \param[in] keys a list of keys to check with + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return status LDNS_STATUS_OK if there is at least one correct key + */ +ldns_status ldns_verify(ldns_rr_list *rrset, + ldns_rr_list *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * Verifies a list of signatures for one rrset, but disregard the time. + * Inception and Expiration are not checked. + * + * \param[in] rrset the rrset to verify + * \param[in] rrsig a list of signatures to check + * \param[in] keys a list of keys to check with + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return status LDNS_STATUS_OK if there is at least one correct key + */ +ldns_status ldns_verify_notime(ldns_rr_list *rrset, + ldns_rr_list *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * Tries to build an authentication chain from the given + * keys down to the queried domain. + * + * If we find a valid trust path, return the valid keys for the domain. + * + * \param[in] res the current resolver + * \param[in] domain the domain we want valid keys for + * \param[in] keys the current set of trusted keys + * \param[out] status pointer to the status variable where the result + * code will be stored + * \return the set of trusted keys for the domain, or NULL if no + * trust path could be built. + */ +ldns_rr_list *ldns_fetch_valid_domain_keys(const ldns_resolver * res, + const ldns_rdf * domain, + const ldns_rr_list * keys, + ldns_status *status); + +/** + * Validates the DNSKEY RRset for the given domain using the provided + * trusted keys. + * + * \param[in] res the current resolver + * \param[in] domain the domain we want valid keys for + * \param[in] keys the current set of trusted keys + * \return the set of trusted keys for the domain, or NULL if the RRSET + * could not be validated + */ +ldns_rr_list *ldns_validate_domain_dnskey (const ldns_resolver *res, + const ldns_rdf *domain, + const ldns_rr_list *keys); + +/** + * Validates the DS RRset for the given domain using the provided trusted keys. + * + * \param[in] res the current resolver + * \param[in] domain the domain we want valid keys for + * \param[in] keys the current set of trusted keys + * \return the set of trusted keys for the domain, or NULL if the RRSET could not be validated + */ +ldns_rr_list *ldns_validate_domain_ds(const ldns_resolver *res, + const ldns_rdf * + domain, + const ldns_rr_list * keys); + +/** + * Verifies a list of signatures for one RRset using a valid trust path. + * + * \param[in] res the current resolver + * \param[in] rrset the rrset to verify + * \param[in] rrsigs a list of signatures to check + * \param[out] validating_keys if this is a (initialized) list, the + * keys from keys that validate one of + * the signatures are added to it + * \return status LDNS_STATUS_OK if there is at least one correct key + */ +ldns_status ldns_verify_trusted(ldns_resolver *res, + ldns_rr_list *rrset, + ldns_rr_list *rrsigs, + ldns_rr_list *validating_keys); + +/** + * denial is not just a river in egypt + * + * \param[in] rr The (query) RR to check the denial of existence for + * \param[in] nsecs The list of NSEC RRs that are supposed to deny the + * existence of the RR + * \param[in] rrsigs The RRSIG RR covering the NSEC RRs + * \return LDNS_STATUS_OK if the NSEC RRs deny the existence, error code + * containing the reason they do not otherwise + */ +ldns_status ldns_dnssec_verify_denial(ldns_rr *rr, + ldns_rr_list *nsecs, + ldns_rr_list *rrsigs); + +/** + * Denial of existence using NSEC3 records + * Since NSEC3 is a bit more complicated than normal denial, some + * context arguments are needed + * + * \param[in] rr The (query) RR to check the denial of existence for + * \param[in] nsecs The list of NSEC3 RRs that are supposed to deny the + * existence of the RR + * \param[in] rrsigs The RRSIG rr covering the NSEC RRs + * \param[in] packet_rcode The RCODE value of the packet that provided the + * NSEC3 RRs + * \param[in] packet_qtype The original query RR type + * \param[in] packet_nodata True if the providing packet had an empty ANSWER + * section + * \return LDNS_STATUS_OK if the NSEC3 RRs deny the existence, error code + * containing the reason they do not otherwise + */ +ldns_status ldns_dnssec_verify_denial_nsec3(ldns_rr *rr, + ldns_rr_list *nsecs, + ldns_rr_list *rrsigs, + ldns_pkt_rcode packet_rcode, + ldns_rr_type packet_qtype, + bool packet_nodata); + +/** + * Verifies the already processed data in the buffers + * This function should probably not be used directly. + * + * \param[in] rawsig_buf Buffer containing signature data to use + * \param[in] verify_buf Buffer containing data to verify + * \param[in] key_buf Buffer containing key data to use + * \param[in] algo Signing algorithm + * \return status LDNS_STATUS_OK if the data verifies. Error if not. + */ +ldns_status ldns_verify_rrsig_buffers(ldns_buffer *rawsig_buf, + ldns_buffer *verify_buf, + ldns_buffer *key_buf, + uint8_t algo); + +/** + * Like ldns_verify_rrsig_buffers, but uses raw data. + * + * \param[in] sig signature data to use + * \param[in] siglen length of signature data to use + * \param[in] verify_buf Buffer containing data to verify + * \param[in] key key data to use + * \param[in] keylen length of key data to use + * \param[in] algo Signing algorithm + * \return status LDNS_STATUS_OK if the data verifies. Error if not. + */ +ldns_status ldns_verify_rrsig_buffers_raw(unsigned char* sig, + size_t siglen, + ldns_buffer *verify_buf, + unsigned char* key, + size_t keylen, + uint8_t algo); + +/** + * Verifies an rrsig. All keys in the keyset are tried. + * \param[in] rrset the rrset to check + * \param[in] rrsig the signature of the rrset + * \param[in] keys the keys to try + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return a list of keys which validate the rrsig + rrset. Returns + * status LDNS_STATUS_OK if at least one key matched. Else an error. + */ +ldns_status ldns_verify_rrsig_keylist(ldns_rr_list *rrset, + ldns_rr *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * Verifies an rrsig. All keys in the keyset are tried. Time is not checked. + * \param[in] rrset the rrset to check + * \param[in] rrsig the signature of the rrset + * \param[in] keys the keys to try + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return a list of keys which validate the rrsig + rrset. Returns + * status LDNS_STATUS_OK if at least one key matched. Else an error. + */ +ldns_status ldns_verify_rrsig_keylist_notime(ldns_rr_list *rrset, + ldns_rr *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * verify an rrsig with 1 key + * \param[in] rrset the rrset + * \param[in] rrsig the rrsig to verify + * \param[in] key the key to use + * \return status message wether verification succeeded. + */ +ldns_status ldns_verify_rrsig(ldns_rr_list *rrset, + ldns_rr *rrsig, + ldns_rr *key); + +/** + * verifies a buffer with signature data for a buffer with rrset data + * with an EVP_PKEY + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the EVP key structure + * \param[in] digest_type The digest type of the signature + */ +#ifdef HAVE_SSL +ldns_status ldns_verify_rrsig_evp(ldns_buffer *sig, + ldns_buffer *rrset, + EVP_PKEY *key, + const EVP_MD *digest_type); +#endif + +/** + * Like ldns_verify_rrsig_evp, but uses raw signature data. + * \param[in] sig the signature data, wireformat uncompressed + * \param[in] siglen length of the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the EVP key structure + * \param[in] digest_type The digest type of the signature + */ +#ifdef HAVE_SSL +ldns_status ldns_verify_rrsig_evp_raw(unsigned char *sig, + size_t siglen, + ldns_buffer *rrset, + EVP_PKEY *key, + const EVP_MD *digest_type); +#endif + +/** + * verifies a buffer with signature data (DSA) for a buffer with rrset data + * with a buffer with key data. + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the key data + */ +ldns_status ldns_verify_rrsig_dsa(ldns_buffer *sig, + ldns_buffer *rrset, + ldns_buffer *key); + +/** + * verifies a buffer with signature data (RSASHA1) for a buffer with rrset data + * with a buffer with key data. + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the key data + */ +ldns_status ldns_verify_rrsig_rsasha1(ldns_buffer *sig, + ldns_buffer *rrset, + ldns_buffer *key); + +/** + * verifies a buffer with signature data (RSAMD5) for a buffer with rrset data + * with a buffer with key data. + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the key data + */ +ldns_status ldns_verify_rrsig_rsamd5(ldns_buffer *sig, + ldns_buffer *rrset, + ldns_buffer *key); + +/** + * Like ldns_verify_rrsig_dsa, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_dsa_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsasha1, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_rsasha1_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsasha256, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ + +ldns_status ldns_verify_rrsig_rsasha256_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsasha512, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_rsasha512_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsamd5, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_rsamd5_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/libs/ldns/ldns/dnssec_zone.h b/libs/ldns/ldns/dnssec_zone.h new file mode 100644 index 0000000000..88117dafb3 --- /dev/null +++ b/libs/ldns/ldns/dnssec_zone.h @@ -0,0 +1,366 @@ +/* + * special zone file structures and functions for better dnssec handling + * + * A zone contains a SOA dnssec_zone_rrset, and an AVL tree of 'normal' + * dnssec_zone_rrsets, indexed by name and type + */ + +#ifndef LDNS_DNSSEC_ZONE_H +#define LDNS_DNSSEC_ZONE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Singly linked list of rrs + */ +typedef struct ldns_struct_dnssec_rrs ldns_dnssec_rrs; +struct ldns_struct_dnssec_rrs +{ + ldns_rr *rr; + ldns_dnssec_rrs *next; +}; + +/** + * Singly linked list of RRsets + */ +typedef struct ldns_struct_dnssec_rrsets ldns_dnssec_rrsets; +struct ldns_struct_dnssec_rrsets +{ + ldns_dnssec_rrs *rrs; + ldns_rr_type type; + ldns_dnssec_rrs *signatures; + ldns_dnssec_rrsets *next; +}; + +/** + * Structure containing all resource records for a domain name + * Including the derived NSEC3, if present + */ +typedef struct ldns_struct_dnssec_name ldns_dnssec_name; +struct ldns_struct_dnssec_name +{ + /** + * pointer to a dname containing the name. + * Usually points to the owner name of the first RR of the first RRset + */ + ldns_rdf *name; + /** + * Usually, the name is a pointer to the owner name of the first rr for + * this name, but sometimes there is no actual data to point to, + * for instance in + * names representing empty nonterminals. If so, set alloced to true to + * indicate that this data must also be freed when the name is freed + */ + bool name_alloced; + /** + * The rrsets for this name + */ + ldns_dnssec_rrsets *rrsets; + /** + * NSEC pointing to the next name (or NSEC3 pointing to the next NSEC3) + */ + ldns_rr *nsec; + /** + * signatures for the NSEC record + */ + ldns_dnssec_rrs *nsec_signatures; + /** + * Set to true if this name is glue + * (as marked by ldns_dnssec_zone_mark_glue()) + */ + bool is_glue; + /** + * pointer to store the hashed name (only used when in an NSEC3 zone + */ + ldns_rdf *hashed_name; +}; + +/** + * Structure containing a dnssec zone + */ +struct ldns_struct_dnssec_zone { + /** points to the name containing the SOA RR */ + ldns_dnssec_name *soa; + /** tree of ldns_dnssec_names */ + ldns_rbtree_t *names; +}; +typedef struct ldns_struct_dnssec_zone ldns_dnssec_zone; + +/** + * Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs + * \return the allocated data + */ +ldns_dnssec_rrs *ldns_dnssec_rrs_new(); + +/** + * Frees the list of rrs, but *not* the individual ldns_rr records + * contained in the list + * + * \param[in] rrs the data structure to free + */ +void ldns_dnssec_rrs_free(ldns_dnssec_rrs *rrs); + +/** + * Frees the list of rrs, and the individual ldns_rr records + * contained in the list + * + * \param[in] rrs the data structure to free + */ +void ldns_dnssec_rrs_deep_free(ldns_dnssec_rrs *rrs); + +/** + * Adds an RR to the list of RRs. The list will remain ordered + * + * \param[in] rrs the list to add to + * \param[in] rr the RR to add + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr); + +/** + * Prints the given rrs to the file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] rrs the list of RRs to print + */ +void ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs); + +/** + * Creates a new list (entry) of RRsets + * \return the newly allocated structure + */ +ldns_dnssec_rrsets *ldns_dnssec_rrsets_new(); + +/** + * Frees the list of rrsets and their rrs, but *not* the ldns_rr + * records in the sets + * + * \param[in] rrsets the data structure to free + */ +void ldns_dnssec_rrsets_free(ldns_dnssec_rrsets *rrsets); + +/** + * Frees the list of rrsets and their rrs, and the ldns_rr + * records in the sets + * + * \param[in] rrsets the data structure to free + */ +void ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets); + +/** + * Returns the rr type of the rrset (that is head of the given list) + * + * \param[in] rrsets the rrset to get the type of + * \return the rr type + */ +ldns_rr_type ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets); + +/** + * Sets the RR type of the rrset (that is head of the given list) + * + * \param[in] rrsets the rrset to set the type of + * \param[in] type the type to set + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dnssec_rrsets_set_type(ldns_dnssec_rrsets *rrsets, + ldns_rr_type type); + +/** + * Add an ldns_rr to the corresponding RRset in the given list of RRsets. + * If it is not present, add it as a new RRset with 1 record. + * + * \param[in] rrsets the list of rrsets to add the RR to + * \param[in] rr the rr to add to the list of rrsets + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr); + +/** + * Print the given list of rrsets to the fiven file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] rrsets the list of RRsets to print + * \param[in] follow if set to false, only print the first RRset + */ +void ldns_dnssec_rrsets_print(FILE *out, + ldns_dnssec_rrsets *rrsets, + bool follow); + +/** + * Create a new data structure for a dnssec name + * \return the allocated structure + */ +ldns_dnssec_name *ldns_dnssec_name_new(); + +/** + * Create a new data structure for a dnssec name for the given RR + * + * \param[in] rr the RR to derive properties from, and to add to the name + */ +ldns_dnssec_name *ldns_dnssec_name_new_frm_rr(ldns_rr *rr); + +/** + * Frees the name structure and its rrs and rrsets. + * Individual ldns_rr records therein are not freed + * + * \param[in] name the structure to free + */ +void ldns_dnssec_name_free(ldns_dnssec_name *name); + +/** + * Frees the name structure and its rrs and rrsets. + * Individual ldns_rr records contained in the name are also freed + * + * \param[in] name the structure to free + */ +void ldns_dnssec_name_deep_free(ldns_dnssec_name *name); + +/** + * Returns the domain name of the given dnssec_name structure + * + * \param[in] name the dnssec name to get the domain name from + * \return the domain name + */ +ldns_rdf *ldns_dnssec_name_name(ldns_dnssec_name *name); + + +/** + * Sets the domain name of the given dnssec_name structure + * + * \param[in] name the dnssec name to set the domain name of + * \param[in] dname the domain name to set it to. This data is *not* copied. + */ +void ldns_dnssec_name_set_name(ldns_dnssec_name *name, + ldns_rdf *dname); + +/** + * Sets the NSEC(3) RR of the given dnssec_name structure + * + * \param[in] name the dnssec name to set the domain name of + * \param[in] nsec the nsec rr to set it to. This data is *not* copied. + */ +void ldns_dnssec_name_set_nsec(ldns_dnssec_name *name, ldns_rr *nsec); + +/** + * Compares the domain names of the two arguments in their + * canonical ordening. + * + * \param[in] a The first dnssec_name to compare + * \param[in] b The second dnssec_name to compare + * \return -1 if the domain name of a comes before that of b in canonical + * ordening, 1 if it is the other way around, and 0 if they are + * equal + */ +int ldns_dnssec_name_cmp(const void *a, const void *b); + +/** + * Inserts the given rr at the right place in the current dnssec_name + * No checking is done whether the name matches + * + * \param[in] name The ldns_dnssec_name to add the RR to + * \param[in] rr The RR to add + * \return LDNS_STATUS_OK on success, error code otherwise + */ +ldns_status ldns_dnssec_name_add_rr(ldns_dnssec_name *name, + ldns_rr *rr); + +/** + * Find the RRset with the given type in within this name structure + * + * \param[in] name the name to find the RRset in + * \param[in] type the type of the RRset to find + * \return the RRset, or NULL if not present + */ +ldns_dnssec_rrsets *ldns_dnssec_name_find_rrset(ldns_dnssec_name *name, + ldns_rr_type type); + +/** + * Find the RRset with the given name and type in the zone + * + * \param[in] zone the zone structure to find the RRset in + * \param[in] dname the domain name of the RRset to find + * \param[in] type the type of the RRset to find + * \return the RRset, or NULL if not present + */ +ldns_dnssec_rrsets *ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone, + ldns_rdf *dname, + ldns_rr_type type); + +/** + * Prints the RRs in the dnssec name structure to the given + * file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] name the name structure to print the contents of + */ +void ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name); + +/** + * Creates a new dnssec_zone structure + * \return the allocated structure + */ +ldns_dnssec_zone *ldns_dnssec_zone_new(); + +/** + * Frees the given zone structure, and its rbtree of dnssec_names + * Individual ldns_rr RRs within those names are *not* freed + * \param[in] *zone the zone to free + */ +void ldns_dnssec_zone_free(ldns_dnssec_zone *zone); + +/** + * Frees the given zone structure, and its rbtree of dnssec_names + * Individual ldns_rr RRs within those names are also freed + * \param[in] *zone the zone to free + */ +void ldns_dnssec_zone_deep_free(ldns_dnssec_zone *zone); + +/** + * Adds the given RR to the zone. + * It find whether there is a dnssec_name with that name present. + * If so, add it to that, if not create a new one. + * Special handling of NSEC and RRSIG provided + * + * \param[in] zone the zone to add the RR to + * \param[in] rr The RR to add + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, + ldns_rr *rr); + +/** + * Prints the rbtree of ldns_dnssec_name structures to the file descriptor + * + * \param[in] out the file descriptor to print the names to + * \param[in] tree the tree of ldns_dnssec_name structures to print + * \param[in] print_soa if true, print SOA records, if false, skip them + */ +void ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa); + +/** + * Prints the complete zone to the given file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] zone the dnssec_zone to print + */ +void ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone); + +/** + * Adds explicit dnssec_name structures for the empty nonterminals + * in this zone. (this is needed for NSEC3 generation) + * + * \param[in] zone the zone to check for empty nonterminals + * return LDNS_STATUS_OK on success. + */ +ldns_status ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libs/ldns/ldns/error.h b/libs/ldns/ldns/error.h new file mode 100644 index 0000000000..e17846f38b --- /dev/null +++ b/libs/ldns/ldns/error.h @@ -0,0 +1,119 @@ +/** + * \file error.h + * + * Defines error numbers and functions to translate those to a readable string. + * + */ + +/** + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_ERROR_H +#define LDNS_ERROR_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum ldns_enum_status { + LDNS_STATUS_OK, + LDNS_STATUS_EMPTY_LABEL, + LDNS_STATUS_LABEL_OVERFLOW, + LDNS_STATUS_DOMAINNAME_OVERFLOW, + LDNS_STATUS_DOMAINNAME_UNDERFLOW, + LDNS_STATUS_DDD_OVERFLOW, + LDNS_STATUS_PACKET_OVERFLOW, + LDNS_STATUS_INVALID_POINTER, + LDNS_STATUS_MEM_ERR, + LDNS_STATUS_INTERNAL_ERR, + LDNS_STATUS_SSL_ERR, + LDNS_STATUS_ERR, + LDNS_STATUS_INVALID_INT, + LDNS_STATUS_INVALID_IP4, + LDNS_STATUS_INVALID_IP6, + LDNS_STATUS_INVALID_STR, + LDNS_STATUS_INVALID_B32_EXT, + LDNS_STATUS_INVALID_B64, + LDNS_STATUS_INVALID_HEX, + LDNS_STATUS_INVALID_TIME, + LDNS_STATUS_NETWORK_ERR, + LDNS_STATUS_ADDRESS_ERR, + LDNS_STATUS_FILE_ERR, + LDNS_STATUS_UNKNOWN_INET, + LDNS_STATUS_NOT_IMPL, + LDNS_STATUS_NULL, + LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, + LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, + LDNS_STATUS_CRYPTO_NO_RRSIG, + LDNS_STATUS_CRYPTO_NO_DNSKEY, + LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, + LDNS_STATUS_CRYPTO_NO_DS, + LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, + LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, + LDNS_STATUS_CRYPTO_VALIDATED, + LDNS_STATUS_CRYPTO_BOGUS, + LDNS_STATUS_CRYPTO_SIG_EXPIRED, + LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, + LDNS_STATUS_CRYPTO_TSIG_BOGUS, + LDNS_STATUS_CRYPTO_TSIG_ERR, + LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, + LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, + LDNS_STATUS_ENGINE_KEY_NOT_LOADED, + LDNS_STATUS_NSEC3_ERR, + LDNS_STATUS_RES_NO_NS, + LDNS_STATUS_RES_QUERY, + LDNS_STATUS_WIRE_INCOMPLETE_HEADER, + LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, + LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, + LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, + LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, + LDNS_STATUS_NO_DATA, + LDNS_STATUS_CERT_BAD_ALGORITHM, + LDNS_STATUS_SYNTAX_TYPE_ERR, + LDNS_STATUS_SYNTAX_CLASS_ERR, + LDNS_STATUS_SYNTAX_TTL_ERR, + LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, + LDNS_STATUS_SYNTAX_RDATA_ERR, + LDNS_STATUS_SYNTAX_DNAME_ERR, + LDNS_STATUS_SYNTAX_VERSION_ERR, + LDNS_STATUS_SYNTAX_ALG_ERR, + LDNS_STATUS_SYNTAX_KEYWORD_ERR, + LDNS_STATUS_SYNTAX_TTL, + LDNS_STATUS_SYNTAX_ORIGIN, + LDNS_STATUS_SYNTAX_INCLUDE, + LDNS_STATUS_SYNTAX_EMPTY, + LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, + LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, + LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, + LDNS_STATUS_SYNTAX_BAD_ESCAPE, + LDNS_STATUS_SOCKET_ERROR, + LDNS_STATUS_SYNTAX_ERR, + LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, + LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, + LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, + LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND +}; +typedef enum ldns_enum_status ldns_status; + +extern ldns_lookup_table ldns_error_str[]; + +/** + * look up a descriptive text by each error. This function + * could use a better name + * \param[in] err ldns_status number + * \return the string for that error + */ +const char *ldns_get_errorstr_by_id(ldns_status err); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_ERROR_H */ diff --git a/libs/ldns/ldns/higher.h b/libs/ldns/ldns/higher.h new file mode 100644 index 0000000000..597e1343a9 --- /dev/null +++ b/libs/ldns/ldns/higher.h @@ -0,0 +1,113 @@ +/** + * \file higher.h + * + * Specifies some higher level functions that could + * be useful for certain applications + */ + +/* + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_HIGHER_H +#define LDNS_HIGHER_H + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Ask the resolver about name + * and return all address records + * \param[in] r the resolver to use + * \param[in] name the name to look for + * \param[in] c the class to use + * \param[in] flags give some optional flags to the query + */ +ldns_rr_list *ldns_get_rr_list_addr_by_name(ldns_resolver *r, ldns_rdf *name, ldns_rr_class c, uint16_t flags); + +/** + * ask the resolver about the address + * and return the name + * \param[in] r the resolver to use + * \param[in] addr the addr to look for + * \param[in] c the class to use + * \param[in] flags give some optional flags to the query + */ +ldns_rr_list *ldns_get_rr_list_name_by_addr(ldns_resolver *r, ldns_rdf *addr, ldns_rr_class c, uint16_t flags); + +/** + * wade through fp (a /etc/hosts like file) + * and return a rr_list containing all the + * defined hosts in there + * \param[in] fp the file pointer to use + * \return ldns_rr_list * with the names + */ +ldns_rr_list *ldns_get_rr_list_hosts_frm_fp(FILE *fp); + +/** + * wade through fp (a /etc/hosts like file) + * and return a rr_list containing all the + * defined hosts in there + * \param[in] fp the file pointer to use + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return ldns_rr_list * with the names + */ +ldns_rr_list *ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr); + +/** + * wade through fp (a /etc/hosts like file) + * and return a rr_list containing all the + * defined hosts in there + * \param[in] filename the filename to use (NULL for /etc/hosts) + * \return ldns_rr_list * with the names + */ +ldns_rr_list *ldns_get_rr_list_hosts_frm_file(char *filename); + +/** + * This function is a wrapper function for ldns_get_rr_list_name_by_addr + * and ldns_get_rr_list_addr_by_name. It's name is from the getaddrinfo() + * library call. It tries to mimic that call, but without the lowlevel + * stuff. + * \param[in] res The resolver. If this value is NULL then a resolver will + * be created by ldns_getaddrinfo. + * \param[in] node the name or ip address to look up + * \param[in] c the class to look in + * \param[out] list put the found RR's in this list + * \return the number of RR found. + */ +uint16_t ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, ldns_rr_list **list); + +/** + * Check if t is enumerated in the nsec type rdata + * \param[in] nsec the NSEC Record to look in + * \param[in] t the type to check for + * \return true when t is found, otherwise return false + */ +bool ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t); + +/** + * Print a number of rdf's of the RR. The rdfnum-list must + * be ended by -1, otherwise unpredictable things might happen. + * rdfs may be printed multiple times + * \param[in] fp FILE * to write to + * \param[in] r RR to write + * \param[in] rdfnum a list of rdf to print. + */ +void ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_HIGHER_H */ diff --git a/libs/ldns/ldns/host2str.h b/libs/ldns/ldns/host2str.h new file mode 100644 index 0000000000..07180bbd28 --- /dev/null +++ b/libs/ldns/ldns/host2str.h @@ -0,0 +1,566 @@ +/** + * host2str.h - txt presentation of RRs + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains functions to translate the main structures to their text + * representation, as well as functions to print them. + */ + +#ifndef LDNS_HOST2STR_H +#define LDNS_HOST2STR_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ldns/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_APL_IP4 1 +#define LDNS_APL_IP6 2 +#define LDNS_APL_MASK 0x7f +#define LDNS_APL_NEGATION 0x80 + +/** + * Converts an ldns packet opcode value to its mnemonic, and adds that + * to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] opcode to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode); + +/** + * Converts an ldns packet rcode value to its mnemonic, and adds that + * to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] rcode to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode); + +/** + * Converts an ldns algorithm type to its mnemonic, and adds that + * to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] algorithm to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_algorithm2buffer_str(ldns_buffer *output, + ldns_algorithm algorithm); + +/** + * Converts an ldns certificate algorithm type to its mnemonic, + * and adds that to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] cert_algorithm to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_cert_algorithm2buffer_str(ldns_buffer *output, + ldns_cert_algorithm cert_algorithm); + + +/** + * Converts a packet opcode to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] opcode the opcode to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_opcode2str(ldns_pkt_opcode opcode); + +/** + * Converts a packet rcode to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] rcode the rcode to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_rcode2str(ldns_pkt_rcode rcode); + +/** + * Converts a signing algorithms to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] algorithm the algorithm to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_algorithm2str(ldns_algorithm algorithm); + +/** + * Converts a cert algorithm to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] cert_algorithm to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm); + +/** + * Converts an LDNS_RDF_TYPE_A rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_AAAA rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_STR rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_B64 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_b64(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_B32_EXT rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_HEX rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TYPE rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_CLASS rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_class(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_ALG rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_alg(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an ldns_rr_type value to its string representation, + * and places it in the given buffer + * \param[in] *output The buffer to add the data to + * \param[in] type the ldns_rr_type to convert + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rr_type2buffer_str(ldns_buffer *output, + const ldns_rr_type type); + +/** + * Converts an ldns_rr_type value to its string representation, + * and returns that string. For unknown types, the string + * "TYPE" is returned. This function allocates data that must be + * freed by the caller + * \param[in] type the ldns_rr_type to convert + * \return a newly allocated string + */ +char *ldns_rr_type2str(const ldns_rr_type type); + +/** + * Converts an ldns_rr_class value to its string representation, + * and places it in the given buffer + * \param[in] *output The buffer to add the data to + * \param[in] klass the ldns_rr_class to convert + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rr_class2buffer_str(ldns_buffer *output, + const ldns_rr_class klass); + +/** + * Converts an ldns_rr_class value to its string representation, + * and returns that string. For unknown types, the string + * "CLASS" is returned. This function allocates data that must be + * freed by the caller + * \param[in] klass the ldns_rr_class to convert + * \return a newly allocated string + */ +char *ldns_rr_class2str(const ldns_rr_class klass); + + +/** + * Converts an LDNS_RDF_TYPE_CERT rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_LOC rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_UNKNOWN rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_unknown(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_NSAP rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_nsap(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_ATMA rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_atma(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_WKS rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_NSEC rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_PERIOD rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TSIGTIME rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_tsigtime(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_APL rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_INT16_DATA rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_IPSECKEY rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TSIG rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf); + + +/** + * Converts the data in the rdata field to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] rdf the pointer to the rdafa field containing the data + * \return status + */ +ldns_status ldns_rdf2buffer_str(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts the data in the resource record to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] rr the pointer to the rr field to convert + * \return status + */ +ldns_status ldns_rr2buffer_str(ldns_buffer *output, const ldns_rr *rr); + +/** + * Converts the data in the DNS packet to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] pkt the pointer to the packet to convert + * \return status + */ +ldns_status ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt); + +/** + * Converts an LDNS_RDF_TYPE_NSEC3_SALT rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf); + + +/** + * Converts the data in the DNS packet to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] k the pointer to the private key to convert + * \return status + */ +ldns_status ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k); + +/** + * Converts an LDNS_RDF_TYPE_INT8 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_INT16 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int16(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_INT32 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TIME rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts the data in the rdata field to presentation format and + * returns that as a char *. + * Remember to free it. + * + * \param[in] rdf The rdata field to convert + * \return null terminated char * data, or NULL on error + */ +char *ldns_rdf2str(const ldns_rdf *rdf); + +/** + * Converts the data in the resource record to presentation format and + * returns that as a char *. + * Remember to free it. + * + * \param[in] rr The rdata field to convert + * \return null terminated char * data, or NULL on error + */ +char *ldns_rr2str(const ldns_rr *rr); + +/** + * Converts the data in the DNS packet to presentation format and + * returns that as a char *. + * Remember to free it. + * + * \param[in] pkt The rdata field to convert + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt2str(const ldns_pkt *pkt); + +/** + * Converts a private key to the test presentation fmt and + * returns that as a char *. + * Remember to free it. + * + * \param[in] k the key to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_key2str(const ldns_key *k); + +/** + * Converts a list of resource records to presentation format + * and returns that as a char *. + * Remember to free it. + * + * \param[in] rr_list the rr_list to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_rr_list2str(const ldns_rr_list *rr_list); + +/** + * Returns the data in the buffer as a null terminated char * string + * Buffer data must be char * type, and must be freed by the caller + * + * \param[in] buffer buffer containing char * data + * \return null terminated char * data, or NULL on error + */ +char *ldns_buffer2str(ldns_buffer *buffer); + +/** + * Prints the data in the rdata field to the given file stream + * (in presentation format) + * + * \param[in] output the file stream to print to + * \param[in] rdf the rdata field to print + * \return void + */ +void ldns_rdf_print(FILE *output, const ldns_rdf *rdf); + +/** + * Prints the data in the resource record to the given file stream + * (in presentation format) + * + * \param[in] output the file stream to print to + * \param[in] rr the resource record to print + * \return void + */ +void ldns_rr_print(FILE *output, const ldns_rr *rr); + +/** + * Prints the data in the DNS packet to the given file stream + * (in presentation format) + * + * \param[in] output the file stream to print to + * \param[in] pkt the packet to print + * \return void + */ +void ldns_pkt_print(FILE *output, const ldns_pkt *pkt); + +/** + * Converts a rr_list to presentation format and appends it to + * the output buffer + * \param[in] output the buffer to append output to + * \param[in] list the ldns_rr_list to print + * \return ldns_status + */ +ldns_status ldns_rr_list2buffer_str(ldns_buffer *output, const ldns_rr_list *list); + +/** + * Converts the header of a packet to presentation format and appends it to + * the output buffer + * \param[in] output the buffer to append output to + * \param[in] pkt the packet to convert the header of + * \return ldns_status + */ +ldns_status ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt); + +/** + * print a rr_list to output + * param[in] output the fd to print to + * param[in] list the rr_list to print + */ +void ldns_rr_list_print(FILE *output, const ldns_rr_list *list); + +/** + * Print a resolver (in sofar that is possible) state + * to output. + * \param[in] output the fd to print to + * \param[in] r the resolver to print + */ +void ldns_resolver_print(FILE *output, const ldns_resolver *r); + +/** + * Print a zone structure * to output. Note the SOA record + * is included in this output + * \param[in] output the fd to print to + * \param[in] z the zone to print + */ +void ldns_zone_print(FILE *output, const ldns_zone *z); + +/** + * Print the ldns_rdf containing a dname to the buffer + * \param[in] output the buffer to print to + * \param[in] dname the dname to print + * \return ldns_status message if the printing succeeded + */ +ldns_status ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_HOST2STR_H */ diff --git a/libs/ldns/ldns/host2wire.h b/libs/ldns/ldns/host2wire.h new file mode 100644 index 0000000000..5eafe9ddc4 --- /dev/null +++ b/libs/ldns/ldns/host2wire.h @@ -0,0 +1,164 @@ +/* + * host2wire.h - 2wire conversion routines + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains all functions to translate the main structures to wire format + */ + +#ifndef LDNS_HOST2WIRE_H +#define LDNS_HOST2WIRE_H + +#include +#include +#include +#include +#include +#include +#include + +#include "ldns/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Copies the dname data to the buffer in wire format + * \param[out] *buffer buffer to append the result to + * \param[in] *name rdata dname to convert + * \return ldns_status + */ +ldns_status ldns_dname2buffer_wire(ldns_buffer *buffer, const ldns_rdf *name); + +/** + * Copies the rdata data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *rdf rdata to convert + * \return ldns_status + */ +ldns_status ldns_rdf2buffer_wire(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Copies the rdata data to the buffer in wire format + * If the rdata is a dname, the letters will be lowercased + * during the conversion + * \param[out] *output buffer to append the result to + * \param[in] *rdf rdata to convert + * \return ldns_status + */ +ldns_status ldns_rdf2buffer_wire_canonical(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Copies the rr data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *rr resource record to convert + * \param[in] section the section in the packet this rr is supposed to be in + * (to determine whether to add rdata or not) + * \return ldns_status + */ +ldns_status ldns_rr2buffer_wire(ldns_buffer *output, + const ldns_rr *rr, + int section); + +/** + * Copies the rr data to the buffer in wire format, in canonical format + * according to RFC3597 (every dname in rdata fields of RR's mentioned in + * that RFC will be lowercased) + * \param[out] *output buffer to append the result to + * \param[in] *rr resource record to convert + * \param[in] section the section in the packet this rr is supposed to be in + * (to determine whether to add rdata or not) + * \return ldns_status + */ +ldns_status ldns_rr2buffer_wire_canonical(ldns_buffer *output, + const ldns_rr *rr, + int section); + + +/** + * Converts a rrsig to wireformat BUT EXCLUDE the rrsig rdata + * This is needed in DNSSEC verification + * \param[out] output buffer to append the result to + * \param[in] sigrr signature rr to operate on + * \return ldns_status + */ +ldns_status ldns_rrsig2buffer_wire(ldns_buffer *output, const ldns_rr *sigrr); + +/** + * Converts an rr's rdata to wireformat, while excluding + * the ownername and all the stuff before the rdata. + * This is needed in DNSSEC keytag calculation, the ds + * calcalution from the key and maybe elsewhere. + * + * \param[out] *output buffer where to put the result + * \param[in] *rr rr to operate on + * \return ldns_status + */ +ldns_status ldns_rr_rdata2buffer_wire(ldns_buffer *output, const ldns_rr *rr); + +/** + * Copies the packet data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *pkt packet to convert + * \return ldns_status + */ +ldns_status ldns_pkt2buffer_wire(ldns_buffer *output, const ldns_pkt *pkt); + +/** + * Copies the rr_list data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *rrlist rr_list to to convert + * \return ldns_status + */ +ldns_status ldns_rr_list2buffer_wire(ldns_buffer *output, const ldns_rr_list *rrlist); + +/** + * Allocates an array of uint8_t at dest, and puts the wireformat of the + * given rdf in that array. The result_size value contains the + * length of the array, if it succeeds, and 0 otherwise (in which case + * the function also returns NULL) + * + * \param[out] dest pointer to the array of bytes to be created + * \param[in] rdf the rdata field to convert + * \param[out] size the size of the converted result + */ +ldns_status ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t *size); + +/** + * Allocates an array of uint8_t at dest, and puts the wireformat of the + * given rr in that array. The result_size value contains the + * length of the array, if it succeeds, and 0 otherwise (in which case + * the function also returns NULL) + * + * If the section argument is LDNS_SECTION_QUESTION, data like ttl and rdata + * are not put into the result + * + * \param[out] dest pointer to the array of bytes to be created + * \param[in] rr the rr to convert + * \param[out] size the size of the converted result + */ +ldns_status ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int, size_t *size); + +/** + * Allocates an array of uint8_t at dest, and puts the wireformat of the + * given packet in that array. The result_size value contains the + * length of the array, if it succeeds, and 0 otherwise (in which case + * the function also returns NULL) + */ +ldns_status ldns_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_HOST2WIRE_H */ diff --git a/libs/ldns/ldns/keys.h b/libs/ldns/ldns/keys.h new file mode 100644 index 0000000000..e0f568d8f8 --- /dev/null +++ b/libs/ldns/ldns/keys.h @@ -0,0 +1,614 @@ +/* + * + * keys.h + * + * priv key definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Addendum to \ref dnssec.h, this module contains key and algorithm definitions and functions. + */ + + +#ifndef LDNS_KEYS_H +#define LDNS_KEYS_H + +#ifdef HAVE_SSL +#include +#endif /* HAVE_SSL */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern ldns_lookup_table ldns_signing_algorithms[]; + +#define LDNS_KEY_ZONE_KEY 0x0100 /* rfc 4034 */ +#define LDNS_KEY_SEP_KEY 0x0001 /* rfc 4034 */ +#define LDNS_KEY_REVOKE_KEY 0x0080 /* rfc 5011 */ + +/** + * Algorithms used in dns + */ +enum ldns_enum_algorithm +{ + LDNS_RSAMD5 = 1, /* RFC 4034,4035 */ + LDNS_DH = 2, + LDNS_DSA = 3, + LDNS_ECC = 4, + LDNS_RSASHA1 = 5, + LDNS_DSA_NSEC3 = 6, + LDNS_RSASHA1_NSEC3 = 7, + LDNS_RSASHA256 = 8, /* RFC 5702 */ + LDNS_RSASHA512 = 10, /* RFC 5702 */ + LDNS_ECC_GOST = 12, /* RFC 5933 */ +#ifdef USE_ECDSA + /* this ifdef has to be removed once it is no longer experimental, + * to be able to use these values outside of the ldns library itself */ + LDNS_ECDSAP256SHA256 = 13, /* draft-hoffman-dnssec-ecdsa */ + LDNS_ECDSAP384SHA384 = 14, /* EXPERIMENTAL */ +#endif + LDNS_INDIRECT = 252, + LDNS_PRIVATEDNS = 253, + LDNS_PRIVATEOID = 254 +}; +typedef enum ldns_enum_algorithm ldns_algorithm; + +/** + * Hashing algorithms used in the DS record + */ +enum ldns_enum_hash +{ + LDNS_SHA1 = 1, /* RFC 4034 */ + LDNS_SHA256 = 2, /* RFC 4509 */ + LDNS_HASH_GOST = 3 /* RFC 5933 */ +#ifdef USE_ECDSA + /* this ifdef has to be removed once it is no longer experimental, + * to be able to use these values outside of the ldns library itself */ + ,LDNS_SHA384 = 4 /* draft-hoffman-dnssec-ecdsa EXPERIMENTAL */ +#endif +}; +typedef enum ldns_enum_hash ldns_hash; + +/** + * Algorithms used in dns for signing + */ +enum ldns_enum_signing_algorithm +{ + LDNS_SIGN_RSAMD5 = LDNS_RSAMD5, + LDNS_SIGN_RSASHA1 = LDNS_RSASHA1, + LDNS_SIGN_DSA = LDNS_DSA, + LDNS_SIGN_RSASHA1_NSEC3 = LDNS_RSASHA1_NSEC3, + LDNS_SIGN_RSASHA256 = LDNS_RSASHA256, + LDNS_SIGN_RSASHA512 = LDNS_RSASHA512, + LDNS_SIGN_DSA_NSEC3 = LDNS_DSA_NSEC3, + LDNS_SIGN_ECC_GOST = LDNS_ECC_GOST, +#ifdef USE_ECDSA + /* this ifdef has to be removed once it is no longer experimental, + * to be able to use these values outside of the ldns library itself */ + LDNS_SIGN_ECDSAP256SHA256 = LDNS_ECDSAP256SHA256, + LDNS_SIGN_ECDSAP384SHA384 = LDNS_ECDSAP384SHA384, +#endif + LDNS_SIGN_HMACMD5 = 157, /* not official! This type is for TSIG, not DNSSEC */ + LDNS_SIGN_HMACSHA1 = 158, /* not official! This type is for TSIG, not DNSSEC */ + LDNS_SIGN_HMACSHA256 = 159 /* ditto */ +}; +typedef enum ldns_enum_signing_algorithm ldns_signing_algorithm; + +/** + * General key structure, can contain all types of keys that + * are used in DNSSEC. Mostly used to store private keys, since + * public keys can also be stored in a \ref ldns_rr with type + * \ref LDNS_RR_TYPE_DNSKEY. + * + * This structure can also store some variables that influence the + * signatures generated by signing with this key, for instance the + * inception date. + */ +struct ldns_struct_key { + ldns_signing_algorithm _alg; + /** Whether to use this key when signing */ + bool _use; + /** Storage pointers for the types of keys supported */ + /* TODO remove unions? */ + struct { +#ifdef HAVE_SSL +#ifndef S_SPLINT_S + /* The key can be an OpenSSL EVP Key + */ + EVP_PKEY *key; +#endif +#endif /* HAVE_SSL */ + /** + * The key can be an HMAC key + */ + struct { + unsigned char *key; + size_t size; + } hmac; + /** the key structure can also just point to some external + * key data + */ + void *external_key; + } _key; + /** Depending on the key we can have extra data */ + union { + /** Some values that influence generated signatures */ + struct { + /** The TTL of the rrset that is currently signed */ + uint32_t orig_ttl; + /** The inception date of signatures made with this key. */ + uint32_t inception; + /** The expiration date of signatures made with this key. */ + uint32_t expiration; + /** The keytag of this key. */ + uint16_t keytag; + /** The dnssec key flags as specified in RFC4035, like ZSK and KSK */ + uint16_t flags; + } dnssec; + } _extra; + /** Owner name of the key */ + ldns_rdf *_pubkey_owner; +}; +typedef struct ldns_struct_key ldns_key; + +/** + * Same as rr_list, but now for keys + */ +struct ldns_struct_key_list +{ + size_t _key_count; + ldns_key **_keys; +}; +typedef struct ldns_struct_key_list ldns_key_list; + + +/** + * Creates a new empty key list + * \return a new ldns_key_list structure pointer + */ +ldns_key_list *ldns_key_list_new(); + +/** + * Creates a new empty key structure + * \return a new ldns_key * structure + */ +ldns_key *ldns_key_new(); + +/** + * Creates a new key based on the algorithm + * + * \param[in] a The algorithm to use + * \param[in] size the number of bytes for the keysize + * \return a new ldns_key structure with the key + */ +ldns_key *ldns_key_new_frm_algorithm(ldns_signing_algorithm a, uint16_t size); + +/** + * Creates a new priv key based on the + * contents of the file pointed by fp. + * + * The file should be in Private-key-format v1.2. + * + * \param[out] k the new ldns_key structure + * \param[in] fp the file pointer to use + * \return an error or LDNS_STATUS_OK + */ +ldns_status ldns_key_new_frm_fp(ldns_key **k, FILE *fp); + +/** + * Creates a new private key based on the + * contents of the file pointed by fp + * + * The file should be in Private-key-format v1.2. + * + * \param[out] k the new ldns_key structure + * \param[in] fp the file pointer to use + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return an error or LDNS_STATUS_OK + */ +ldns_status ldns_key_new_frm_fp_l(ldns_key **k, FILE *fp, int *line_nr); + +#ifdef HAVE_SSL +/** + * Read the key with the given id from the given engine and store it + * in the given ldns_key structure. The algorithm type is set + */ +ldns_status ldns_key_new_frm_engine(ldns_key **key, ENGINE *e, char *key_id, ldns_algorithm); + + +/** + * frm_fp helper function. This function parses the + * remainder of the (RSA) priv. key file generated from bind9 + * \param[in] fp the file to parse + * \return NULL on failure otherwise a RSA structure + */ +RSA *ldns_key_new_frm_fp_rsa(FILE *fp); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (RSA) priv. key file generated from bind9 + * \param[in] fp the file to parse + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return NULL on failure otherwise a RSA structure + */ +RSA *ldns_key_new_frm_fp_rsa_l(FILE *fp, int *line_nr); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (DSA) priv. key file + * \param[in] fp the file to parse + * \return NULL on failure otherwise a RSA structure + */ +DSA *ldns_key_new_frm_fp_dsa(FILE *fp); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (DSA) priv. key file + * \param[in] fp the file to parse + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return NULL on failure otherwise a RSA structure + */ +DSA *ldns_key_new_frm_fp_dsa_l(FILE *fp, int *line_nr); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (HMAC-MD5) key file + * This function allocated a buffer that needs to be freed + * \param[in] fp the file to parse + * \param[out] hmac_size the number of bits in the resulting buffer + * \return NULL on failure otherwise a newly allocated char buffer + */ +unsigned char *ldns_key_new_frm_fp_hmac(FILE *fp, size_t *hmac_size); +#endif + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (HMAC-MD5) key file + * This function allocated a buffer that needs to be freed + * \param[in] fp the file to parse + * \param[in] line_nr pointer to an integer containing the current line number (for error reporting purposes) + * \param[out] hmac_size the number of bits in the resulting buffer + * \return NULL on failure otherwise a newly allocated char buffer + */ +unsigned char *ldns_key_new_frm_fp_hmac_l(FILE *fp, int *line_nr, size_t *hmac_size); +#endif /* HAVE_SSL */ + +/* acces write functions */ +/** + * Set the key's algorithm + * \param[in] k the key + * \param[in] l the algorithm + */ +void ldns_key_set_algorithm(ldns_key *k, ldns_signing_algorithm l); +#ifdef HAVE_SSL +/** + * Set the key's evp key + * \param[in] k the key + * \param[in] e the evp key + */ +void ldns_key_set_evp_key(ldns_key *k, EVP_PKEY *e); + +/** + * Set the key's rsa data + * \param[in] k the key + * \param[in] r the rsa data + */ +void ldns_key_set_rsa_key(ldns_key *k, RSA *r); +/** + * Set the key's dsa data + * \param[in] k the key + * \param[in] d the dsa data + */ +void ldns_key_set_dsa_key(ldns_key *k, DSA *d); + +/** + * Get the PKEY id for GOST, loads GOST into openssl as a side effect. + * Only available if GOST is compiled into the library and openssl. + * \return the gost id for EVP_CTX creation. + */ +int ldns_key_EVP_load_gost_id(void); + +/** Release the engine reference held for the GOST engine. */ +void ldns_key_EVP_unload_gost(void); +#endif /* HAVE_SSL */ + +/** + * Set the key's hmac data + * \param[in] k the key + * \param[in] hmac the raw key data + */ +void ldns_key_set_hmac_key(ldns_key *k, unsigned char *hmac); + +/** + * Set the key id data. This is used if the key points to + * some externally stored key data + * + * Only the pointer is set, the data there is not copied, + * and must be freed manually; ldns_key_deep_free() does + * *not* free this data + * \param[in] key the key + * \param[in] external_key key id data + */ +void ldns_key_set_external_key(ldns_key *key, void *external_key); + +/** + * Set the key's hmac size + * \param[in] k the key + * \param[in] hmac_size the size of the hmac data + */ +void ldns_key_set_hmac_size(ldns_key *k, size_t hmac_size); +/** + * Set the key's original ttl + * \param[in] k the key + * \param[in] t the ttl + */ +void ldns_key_set_origttl(ldns_key *k, uint32_t t); +/** + * Set the key's inception date (seconds after epoch) + * \param[in] k the key + * \param[in] i the inception + */ +void ldns_key_set_inception(ldns_key *k, uint32_t i); +/** + * Set the key's expiration date (seconds after epoch) + * \param[in] k the key + * \param[in] e the expiration + */ +void ldns_key_set_expiration(ldns_key *k, uint32_t e); +/** + * Set the key's pubkey owner + * \param[in] k the key + * \param[in] r the owner + */ +void ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r); +/** + * Set the key's key tag + * \param[in] k the key + * \param[in] tag the keytag + */ +void ldns_key_set_keytag(ldns_key *k, uint16_t tag); +/** + * Set the key's flags + * \param[in] k the key + * \param[in] flags the flags + */ +void ldns_key_set_flags(ldns_key *k, uint16_t flags); +/** + * Set the keylist's key count to count + * \param[in] key the key + * \param[in] count the cuont + */ +void ldns_key_list_set_key_count(ldns_key_list *key, size_t count); + +/** + * pushes a key to a keylist + * \param[in] key_list the key_list to push to + * \param[in] key the key to push + * \return false on error, otherwise true + */ +bool ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key); + +/** + * returns the number of keys in the key list + * \param[in] key_list the key_list + * \return the numbers of keys in the list + */ +size_t ldns_key_list_key_count(const ldns_key_list *key_list); + +/** + * returns a pointer to the key in the list at the given position + * \param[in] key the key + * \param[in] nr the position in the list + * \return the key + */ +ldns_key *ldns_key_list_key(const ldns_key_list *key, size_t nr); + +#ifdef HAVE_SSL +/** + * returns the (openssl) RSA struct contained in the key + * \param[in] k the key to look in + * \return the RSA * structure in the key + */ +RSA *ldns_key_rsa_key(const ldns_key *k); +/** + * returns the (openssl) EVP struct contained in the key + * \param[in] k the key to look in + * \return the RSA * structure in the key + */ +EVP_PKEY *ldns_key_evp_key(const ldns_key *k); +#endif /* HAVE_SSL */ + +/** + * returns the (openssl) DSA struct contained in the key + */ +#ifdef HAVE_SSL +DSA *ldns_key_dsa_key(const ldns_key *k); +#endif /* HAVE_SSL */ + +/** + * return the signing alg of the key + * \param[in] k the key + * \return the algorithm + */ +ldns_signing_algorithm ldns_key_algorithm(const ldns_key *k); +/** + * set the use flag + * \param[in] k the key + * \param[in] v the boolean value to set the _use field to + */ +void ldns_key_set_use(ldns_key *k, bool v); +/** + * return the use flag + * \param[in] k the key + * \return the boolean value of the _use field + */ +bool ldns_key_use(const ldns_key *k); +/** + * return the hmac key data + * \param[in] k the key + * \return the hmac key data + */ +unsigned char *ldns_key_hmac_key(const ldns_key *k); +/** + * return the key id key data + * \param[in] k the key + * \return the key id data + */ +void *ldns_key_external_key(const ldns_key *k); +/** + * return the hmac key size + * \param[in] k the key + * \return the hmac key size + */ +size_t ldns_key_hmac_size(const ldns_key *k); +/** + * return the original ttl of the key + * \param[in] k the key + * \return the original ttl + */ +uint32_t ldns_key_origttl(const ldns_key *k); +/** + * return the key's inception date + * \param[in] k the key + * \return the inception date + */ +uint32_t ldns_key_inception(const ldns_key *k); +/** + * return the key's expiration date + * \param[in] k the key + * \return the experiration date + */ +uint32_t ldns_key_expiration(const ldns_key *k); +/** + * return the keytag + * \param[in] k the key + * \return the keytag + */ +uint16_t ldns_key_keytag(const ldns_key *k); +/** + * return the public key's owner + * \param[in] k the key + * \return the owner + */ +ldns_rdf *ldns_key_pubkey_owner(const ldns_key *k); +/** + * Set the 'use' flag for all keys in the list + * \param[in] keys The key_list + * \param[in] v The value to set the use flags to + */ +void +ldns_key_list_set_use(ldns_key_list *keys, bool v); + +/** + * return the flag of the key + * \param[in] k the key + * \return the flag + */ +uint16_t ldns_key_flags(const ldns_key *k); + +/** + * pops the last rr from a keylist + * \param[in] key_list the rr_list to pop from + * \return NULL if nothing to pop. Otherwise the popped RR + */ +ldns_key *ldns_key_list_pop_key(ldns_key_list *key_list); + +/** + * converts a ldns_key to a public key rr + * If the key data exists at an external point, the corresponding + * rdata field must still be added with ldns_rr_rdf_push() to the + * result rr of this function + * + * \param[in] k the ldns_key to convert + * \return ldns_rr representation of the key + */ +ldns_rr *ldns_key2rr(const ldns_key *k); + +/** + * print a private key to the file ouput + * + * \param[in] output the FILE descriptor where to print to + * \param[in] k the ldns_key to print + */ +void ldns_key_print(FILE *output, const ldns_key *k); + +/** + * frees a key structure, but not its internal data structures + * + * \param[in] key the key object to free + */ +void ldns_key_free(ldns_key *key); + +/** + * frees a key structure and all its internal data structures, except + * the data set by ldns_key_set_external_key() + * + * \param[in] key the key object to free + */ +void ldns_key_deep_free(ldns_key *key); + +/** + * Frees a key list structure + * \param[in] key_list the key list object to free + */ +void ldns_key_list_free(ldns_key_list *key_list); + +/** + * Instantiates a DNSKEY or DS RR from file. + * \param[in] filename the file to read the record from + * \return the corresponding RR, or NULL if the parsing failed + */ +ldns_rr * ldns_read_anchor_file(const char *filename); + +/** + * Returns the 'default base name' for key files; + * IE. K\+\+\ + * (without the .key or .private) + * The memory for this is allocated by this function, + * and should be freed by the caller + * + * \param[in] key the key to get the file name from + * \returns A string containing the file base name + */ +char *ldns_key_get_file_base_name(ldns_key *key); + +/** + * See if a key algorithm is supported + * \param[in] algo the signing algorithm number. + * \returns true if supported. + */ +int ldns_key_algo_supported(int algo); + +/** + * Get signing algorithm by name. Comparison is case insensitive. + * \param[in] name string with the name. + * \returns 0 on parse failure or the algorithm number. + */ +ldns_signing_algorithm ldns_get_signing_algorithm_by_name(const char* name); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_KEYS_H */ diff --git a/libs/ldns/ldns/ldns.h b/libs/ldns/ldns/ldns.h new file mode 100644 index 0000000000..6f57733750 --- /dev/null +++ b/libs/ldns/ldns/ldns.h @@ -0,0 +1,155 @@ +/* + * dns.h -- defines for the Domain Name System + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + * This library was created by: + * Jelte Jansen, Erik Rozendaal and Miek Gieben + * + * A bunch of defines that are used in the DNS. + */ + + +/** +\mainpage LDNS Documentation + +\section introduction Introduction + +The goal of ldns is to simplify DNS programming, it supports recent RFCs +like the DNSSEC documents, and allow developers to easily create software +conforming to current RFCs, and experimental software for current Internet +drafts. A secondary benefit of using ldns is speed, because ldns is written +in C, and although it is not optimized for performance, it should be a lot +faster than Perl. + +The first main tool to use ldns is Drill, from which part of the library was +derived. From version 1.0.0 on, drill is included in the ldns release +and will not be distributed seperately anymore. The library also includes some +other examples and tools to show how it can be used. These can be found in the +examples/ directory in the tarball. + +ldns depends on OpenSSL for it's cryptographic functions. +Feature list + + - Transparent IPv4 and IPv6 support (overridable if necessary), + - TSIG support, + - DNSSEC support; signing and verification, + - small size, + - online documentation as well as manual pages. + +If you want to send us patches please use the code from subversion (trunk). + +\section using_ldns Using ldns + +Almost all interaction between an application and ldns goes through the ldns +data structures (\ref ldns_rr, \ref ldns_pkt, etc.). These are input or +output to the functions of ldns. For example, \ref ldns_zone_new_frm_fp +reads a zone from a \c FILE pointer, and returns an \ref ldns_zone +structure. + + +Let's use Drill as an example. Drill is a tool much like dig, whose most +basic function is to send 1 query to a nameserver and print the response. + +To be able to do this, drill uses the resolver module of ldns, which acts as +a stub resolver. The resolver module uses the net module to actually send +the query that drill requested. It then uses the wire2host module to +translate the response and place it in ldns' internal structures. These are +passed back to drill, which then uses the host2str module to print the +response in presentation format. + +\section gettingstarted Getting Started + +See the \ref design page for a very high level description of the design +choices made for ldns. + +For an overview of the functions and types ldns provides, you can check out +the \ref ldns ldns header file descriptions. + +If you want to see some libdns action, you can read our tutorials: + - \ref tutorial1_mx + - \ref tutorial2_zone + - \ref tutorial3_signzone + +Or you can just use the menu above to browse through the API docs. + +
+\image html LogoInGradientBar2-y100.png +
+*/ + +/** + * \file ldns.h + * + * Including this file will include all ldns files, and define some lookup tables. + */ + +#ifndef LDNS_DNS_H +#define LDNS_DNS_H + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_IP4ADDRLEN (32/8) +#define LDNS_IP6ADDRLEN (128/8) +#define LDNS_PORT 53 +#define LDNS_ROOT_LABEL_STR "." +#define LDNS_DEFAULT_TTL 3600 + +/* lookup tables for standard DNS stuff */ + +/** Taken from RFC 2538, section 2.1. */ +extern ldns_lookup_table ldns_certificate_types[]; +/** Taken from RFC 2535, section 7. */ +extern ldns_lookup_table ldns_algorithms[]; +/** Taken from RFC 2538. */ +extern ldns_lookup_table ldns_cert_algorithms[]; +/** rr types */ +extern ldns_lookup_table ldns_rr_classes[]; +/** Response codes */ +extern ldns_lookup_table ldns_rcodes[]; +/** Operation codes */ +extern ldns_lookup_table ldns_opcodes[]; +/** EDNS flags */ +extern ldns_lookup_table ldns_edns_flags[]; + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_DNS_H */ diff --git a/libs/ldns/ldns/net.h.in b/libs/ldns/ldns/net.h.in new file mode 100644 index 0000000000..c3f5a069a6 --- /dev/null +++ b/libs/ldns/ldns/net.h.in @@ -0,0 +1,208 @@ +/* + * net.h + * + * DNS Resolver definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_NET_H +#define LDNS_NET_H + +#include +@include_sys_socket_h@ + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_DEFAULT_TIMEOUT_SEC 2 +#define LDNS_DEFAULT_TIMEOUT_USEC 0 + +/** + * \file + * + * Contains functions to send and receive packets over a network. + */ + +/** + * Sends a buffer to an ip using udp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \param[out] result packet with the answer + * \return status + */ +ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); + +/** + * Send an udp query and don't wait for an answer but return + * the socket + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout *unused*, was the timeout value for the network + * \return the socket used + */ + +int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Send an tcp query and don't wait for an answer but return + * the socket + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the connect attempt + * \return the socket used + */ +int ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Sends a buffer to an ip using tcp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \param[out] result packet with the answer + * \return status + */ +ldns_status ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); + +/** + * Sends ptk to the nameserver at the resolver object. Returns the data + * as a ldns_pkt + * + * \param[out] pkt packet received from the nameserver + * \param[in] r the resolver to use + * \param[in] query_pkt the query to send + * \return status + */ +ldns_status ldns_send(ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt); + +/** + * Sends and ldns_buffer (presumably containing a packet to the nameserver at the resolver object. Returns the data + * as a ldns_pkt + * + * \param[out] pkt packet received from the nameserver + * \param[in] r the resolver to use + * \param[in] qb the buffer to send + * \param[in] tsig_mac the tsig MAC to authenticate the response with (NULL to do no TSIG authentication) + * \return status + */ +ldns_status ldns_send_buffer(ldns_pkt **pkt, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac); + +/** + * Create a tcp socket to the specified address + * \param[in] to ip and family + * \param[in] tolen length of to + * \param[in] timeout timeout for the connect attempt + * \return a socket descriptor + */ +int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Create a udp socket to the specified address + * \param[in] to ip and family + * \param[in] timeout *unused*, was timeout for the socket + * \return a socket descriptor + */ +int ldns_udp_connect(const struct sockaddr_storage *to, struct timeval timeout); + +/** + * send a query via tcp to a server. Don't want for the answer + * + * \param[in] qbin the buffer to send + * \param[in] sockfd the socket to use + * \param[in] to which ip to send it + * \param[in] tolen socketlen + * \return number of bytes sent + */ +ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); + +/** + * send a query via udp to a server. Don;t want for the answer + * + * \param[in] qbin the buffer to send + * \param[in] sockfd the socket to use + * \param[in] to which ip to send it + * \param[in] tolen socketlen + * \return number of bytes sent + */ +ssize_t ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); + +/** + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[out] size the number of bytes that are read + * \param[in] timeout the time allowed between packets. + * \return the data read + */ +uint8_t *ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout); + +/** + * This routine may block. Use ldns_tcp_read_wire_timeout, it checks timeouts. + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[out] size the number of bytes that are read + * \return the data read + */ +uint8_t *ldns_tcp_read_wire(int sockfd, size_t *size); + +/** + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[in] fr the address of the client (if applicable) + * \param[in] *frlen the lenght of the client's addr (if applicable) + * \param[out] size the number of bytes that are read + * \return the data read + */ +uint8_t *ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *fr, socklen_t *frlen); + +/** + * returns the native sockaddr representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \param[in] port what port to use. 0 means; use default (53) + * \param[out] size what is the size of the sockaddr_storage + * \return struct sockaddr* the address in the format so other + * functions can use it (sendto) + */ +struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size); + +/** + * returns an rdf with the sockaddr info. works for ip4 and ip6 + * \param[in] sock the struct sockaddr_storage to convert + * \param[in] port what port was used. When NULL this is not set + * \return ldns_rdf* wth the address + */ +ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port); + +/** + * Prepares the resolver for an axfr query + * The query is sent and the answers can be read with ldns_axfr_next + * \param[in] resolver the resolver to use + * \param[in] domain the domain to exfr + * \param[in] c the class to use + * \return ldns_status the status of the transfer + */ +ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_NET_H */ diff --git a/libs/ldns/ldns/packet.h b/libs/ldns/ldns/packet.h new file mode 100644 index 0000000000..687a6a2595 --- /dev/null +++ b/libs/ldns/ldns/packet.h @@ -0,0 +1,855 @@ +/* + * packet.h + * + * DNS packet definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains the definition of ldns_pkt and its parts, as well + * as functions to manipulate those. + */ + + +#ifndef LDNS_PACKET_H +#define LDNS_PACKET_H + +#define LDNS_MAX_PACKETLEN 65535 + +/* allow flags to be given to mk_query */ +#define LDNS_QR 1 /* QueRy - query flag */ +#define LDNS_AA 2 /* Authoritative Answer - server flag */ +#define LDNS_TC 4 /* TrunCated - server flag */ +#define LDNS_RD 8 /* Recursion Desired - query flag */ +#define LDNS_CD 16 /* Checking Disabled - query flag */ +#define LDNS_RA 32 /* Recursion Available - server flag */ +#define LDNS_AD 64 /* Authenticated Data - server flag */ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* opcodes for pkt's */ +enum ldns_enum_pkt_opcode { + LDNS_PACKET_QUERY = 0, + LDNS_PACKET_IQUERY = 1, + LDNS_PACKET_STATUS = 2, /* there is no 3?? DNS is weird */ + LDNS_PACKET_NOTIFY = 4, + LDNS_PACKET_UPDATE = 5 +}; +typedef enum ldns_enum_pkt_opcode ldns_pkt_opcode; + +/* rcodes for pkts */ +enum ldns_enum_pkt_rcode { + LDNS_RCODE_NOERROR = 0, + LDNS_RCODE_FORMERR = 1, + LDNS_RCODE_SERVFAIL = 2, + LDNS_RCODE_NXDOMAIN = 3, + LDNS_RCODE_NOTIMPL = 4, + LDNS_RCODE_REFUSED = 5, + LDNS_RCODE_YXDOMAIN = 6, + LDNS_RCODE_YXRRSET = 7, + LDNS_RCODE_NXRRSET = 8, + LDNS_RCODE_NOTAUTH = 9, + LDNS_RCODE_NOTZONE = 10 +}; +typedef enum ldns_enum_pkt_rcode ldns_pkt_rcode; + +/** + * Header of a dns packet + * + * Contains the information about the packet itself, as specified in RFC1035 +
+4.1.1. Header section format
+
+The header contains the following fields:
+
+                                    1  1  1  1  1  1
+      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                      ID                       |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    QDCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    ANCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    NSCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    ARCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
+where:
+
+ID              A 16 bit identifier assigned by the program that
+                generates any kind of query.  This identifier is copied
+                the corresponding reply and can be used by the requester
+                to match up replies to outstanding queries.
+
+QR              A one bit field that specifies whether this message is a
+                query (0), or a response (1).
+
+OPCODE          A four bit field that specifies kind of query in this
+                message.  This value is set by the originator of a query
+                and copied into the response.  The values are:
+
+                0               a standard query (QUERY)
+
+                1               an inverse query (IQUERY)
+
+                2               a server status request (STATUS)
+
+                3-15            reserved for future use
+
+AA              Authoritative Answer - this bit is valid in responses,
+                and specifies that the responding name server is an
+                authority for the domain name in question section.
+
+                Note that the contents of the answer section may have
+                multiple owner names because of aliases.  The AA bit
+
+                corresponds to the name which matches the query name, or
+                the first owner name in the answer section.
+
+TC              TrunCation - specifies that this message was truncated
+                due to length greater than that permitted on the
+                transmission channel.
+
+RD              Recursion Desired - this bit may be set in a query and
+                is copied into the response.  If RD is set, it directs
+                the name server to pursue the query recursively.
+                Recursive query support is optional.
+
+RA              Recursion Available - this be is set or cleared in a
+                response, and denotes whether recursive query support is
+                available in the name server.
+
+Z               Reserved for future use.  Must be zero in all queries
+                and responses.
+
+RCODE           Response code - this 4 bit field is set as part of
+                responses.  The values have the following
+                interpretation:
+
+                0               No error condition
+
+                1               Format error - The name server was
+                                unable to interpret the query.
+
+                2               Server failure - The name server was
+                                unable to process this query due to a
+                                problem with the name server.
+
+                3               Name Error - Meaningful only for
+                                responses from an authoritative name
+                                server, this code signifies that the
+                                domain name referenced in the query does
+                                not exist.
+
+                4               Not Implemented - The name server does
+                                not support the requested kind of query.
+
+                5               Refused - The name server refuses to
+                                perform the specified operation for
+                                policy reasons.  For example, a name
+                                server may not wish to provide the
+                                information to the particular requester,
+                                or a name server may not wish to perform
+                                a particular operation (e.g., zone
+
+                                transfer) for particular data.
+
+                6-15            Reserved for future use.
+
+QDCOUNT         an unsigned 16 bit integer specifying the number of
+                entries in the question section.
+
+ANCOUNT         an unsigned 16 bit integer specifying the number of
+                resource records in the answer section.
+
+NSCOUNT         an unsigned 16 bit integer specifying the number of name
+                server resource records in the authority records
+                section.
+
+ARCOUNT         an unsigned 16 bit integer specifying the number of
+                resource records in the additional records section.
+
+
+ */ +struct ldns_struct_hdr +{ + /** Id of a packet */ + uint16_t _id; + /** Query bit (0=query, 1=answer) */ + bool _qr; + /** Authoritative answer */ + bool _aa; + /** Packet truncated */ + bool _tc; + /** Recursion desired */ + bool _rd; + /** Checking disabled */ + bool _cd; + /** Recursion available */ + bool _ra; + /** Authentic data */ + bool _ad; + /** Query type */ + ldns_pkt_opcode _opcode; /* XXX 8 bits? */ + /** Response code */ + uint8_t _rcode; + /** question sec */ + uint16_t _qdcount; + /** answer sec */ + uint16_t _ancount; + /** auth sec */ + uint16_t _nscount; + /** add sec */ + uint16_t _arcount; +}; +typedef struct ldns_struct_hdr ldns_hdr; + +/** + * DNS packet + * + * This structure contains a complete DNS packet (either a query or an answer) + * + * It is the complete representation of what you actually send to a + * nameserver, and what it sends back (assuming you are the client here). + */ +struct ldns_struct_pkt +{ + /** Header section */ + ldns_hdr *_header; + /* extra items needed in a packet */ + /** The size of the wire format of the packet in octets */ + ldns_rdf *_answerfrom; + /** Timestamp of the time the packet was sent or created */ + struct timeval timestamp; + /** The duration of the query this packet is an answer to */ + uint32_t _querytime; + /** The size of the wire format of the packet in octets */ + size_t _size; + /** Optional tsig rr */ + ldns_rr *_tsig_rr; + /** EDNS0 available buffer size, see RFC2671 */ + uint16_t _edns_udp_size; + /** EDNS0 Extended rcode */ + uint8_t _edns_extended_rcode; + /** EDNS Version */ + uint8_t _edns_version; + /** Reserved EDNS data bits */ + uint16_t _edns_z; + /** Arbitrary EDNS rdata */ + ldns_rdf *_edns_data; + /** Question section */ + ldns_rr_list *_question; + /** Answer section */ + ldns_rr_list *_answer; + /** Authority section */ + ldns_rr_list *_authority; + /** Additional section */ + ldns_rr_list *_additional; +}; +typedef struct ldns_struct_pkt ldns_pkt; + +/** + * The sections of a packet + */ +enum ldns_enum_pkt_section { + LDNS_SECTION_QUESTION = 0, + LDNS_SECTION_ANSWER = 1, + LDNS_SECTION_AUTHORITY = 2, + LDNS_SECTION_ADDITIONAL = 3, + /** bogus section, if not interested */ + LDNS_SECTION_ANY = 4, + /** used to get all non-question rrs from a packet */ + LDNS_SECTION_ANY_NOQUESTION = 5 +}; +typedef enum ldns_enum_pkt_section ldns_pkt_section; + +/** + * The different types of packets + */ +enum ldns_enum_pkt_type { + LDNS_PACKET_QUESTION, + LDNS_PACKET_REFERRAL, + LDNS_PACKET_ANSWER, + LDNS_PACKET_NXDOMAIN, + LDNS_PACKET_NODATA, + LDNS_PACKET_UNKNOWN +}; +typedef enum ldns_enum_pkt_type ldns_pkt_type; + +/* prototypes */ + +/* read */ + +/** + * Read the packet id + * \param[in] p the packet + * \return the packet id + */ +uint16_t ldns_pkt_id(const ldns_pkt *p); +/** + * Read the packet's qr bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_qr(const ldns_pkt *p); +/** + * Read the packet's aa bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_aa(const ldns_pkt *p); +/** + * Read the packet's tc bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_tc(const ldns_pkt *p); +/** + * Read the packet's rd bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_rd(const ldns_pkt *p); +/** + * Read the packet's cd bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_cd(const ldns_pkt *p); +/** + * Read the packet's ra bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_ra(const ldns_pkt *p); +/** + * Read the packet's ad bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_ad(const ldns_pkt *p); +/** + * Read the packet's code + * \param[in] p the packet + * \return the opcode + */ +ldns_pkt_opcode ldns_pkt_get_opcode(const ldns_pkt *p); +/** + * Return the packet's respons code + * \param[in] p the packet + * \return the respons code + */ +ldns_pkt_rcode ldns_pkt_get_rcode(const ldns_pkt *p); +/** + * Return the packet's qd count + * \param[in] p the packet + * \return the qd count + */ +uint16_t ldns_pkt_qdcount(const ldns_pkt *p); +/** + * Return the packet's an count + * \param[in] p the packet + * \return the an count + */ +uint16_t ldns_pkt_ancount(const ldns_pkt *p); +/** + * Return the packet's ns count + * \param[in] p the packet + * \return the ns count + */ +uint16_t ldns_pkt_nscount(const ldns_pkt *p); +/** + * Return the packet's ar count + * \param[in] p the packet + * \return the ar count + */ +uint16_t ldns_pkt_arcount(const ldns_pkt *p); + +/** + * Return the packet's answerfrom + * \param[in] p packet + * \return the name of the server + */ +ldns_rdf *ldns_pkt_answerfrom(const ldns_pkt *p); + +/** + * Return the packet's timestamp + * \param[in] p the packet + * \return the timestamp + */ +struct timeval ldns_pkt_timestamp(const ldns_pkt *p); +/** + * Return the packet's querytime + * \param[in] p the packet + * \return the querytime + */ +uint32_t ldns_pkt_querytime(const ldns_pkt *p); + +/** + * Return the packet's size in bytes + * \param[in] p the packet + * \return the size + */ +size_t ldns_pkt_size(const ldns_pkt *p); + +/** + * Return the packet's tsig pseudo rr's + * \param[in] p the packet + * \return the tsig rr + */ +ldns_rr *ldns_pkt_tsig(const ldns_pkt *p); + +/** + * Return the packet's question section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_question(const ldns_pkt *p); +/** + * Return the packet's answer section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_answer(const ldns_pkt *p); +/** + * Return the packet's authority section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_authority(const ldns_pkt *p); +/** + * Return the packet's additional section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_additional(const ldns_pkt *p); +/** + * Return the packet's question, answer, authority and additional sections + * concatenated, in a new rr_list clone. + * \param[in] p the packet + * \return the rrs + */ +ldns_rr_list *ldns_pkt_all(const ldns_pkt *p); +/** + * Return the packet's answer, authority and additional sections concatenated, + * in a new rr_list clone. Like ldns_pkt_all but without the questions. + * \param[in] p the packet + * \return the rrs except the question rrs + */ +ldns_rr_list *ldns_pkt_all_noquestion(const ldns_pkt *p); + +/** + * return all the rr_list's in the packet. Clone the lists, instead + * of returning pointers. + * \param[in] p the packet to look in + * \param[in] s what section(s) to return + * \return ldns_rr_list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_get_section_clone(const ldns_pkt *p, ldns_pkt_section s); + +/** + * return all the rr with a specific name from a packet. Optionally + * specify from which section in the packet + * \param[in] p the packet + * \param[in] r the name + * \param[in] s the packet's section + * \return a list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_rr_list_by_name(ldns_pkt *p, ldns_rdf *r, ldns_pkt_section s); +/** + * return all the rr with a specific type from a packet. Optionally + * specify from which section in the packet + * \param[in] p the packet + * \param[in] t the type + * \param[in] s the packet's section + * \return a list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_rr_list_by_type(const ldns_pkt *p, ldns_rr_type t, ldns_pkt_section s); +/** + * return all the rr with a specific type and type from a packet. Optionally + * specify from which section in the packet + * \param[in] packet the packet + * \param[in] ownername the name + * \param[in] type the type + * \param[in] sec the packet's section + * \return a list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, const ldns_rdf *ownername, ldns_rr_type type, ldns_pkt_section sec); + + +/** + * check to see if an rr exist in the packet + * \param[in] pkt the packet to examine + * \param[in] sec in which section to look + * \param[in] rr the rr to look for + */ +bool ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr); + + +/** + * sets the flags in a packet. + * \param[in] pkt the packet to operate on + * \param[in] flags ORed values: LDNS_QR| LDNS_AR for instance + * \return true on success otherwise false + */ +bool ldns_pkt_set_flags(ldns_pkt *pkt, uint16_t flags); + +/** + * Set the packet's id + * \param[in] p the packet + * \param[in] id the id to set + */ +void ldns_pkt_set_id(ldns_pkt *p, uint16_t id); +/** + * Set the packet's id to a random value + * \param[in] p the packet + */ +void ldns_pkt_set_random_id(ldns_pkt *p); +/** + * Set the packet's qr bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_qr(ldns_pkt *p, bool b); +/** + * Set the packet's aa bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_aa(ldns_pkt *p, bool b); +/** + * Set the packet's tc bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_tc(ldns_pkt *p, bool b); +/** + * Set the packet's rd bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_rd(ldns_pkt *p, bool b); +/** + * Set the packet's cd bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_cd(ldns_pkt *p, bool b); +/** + * Set the packet's ra bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_ra(ldns_pkt *p, bool b); +/** + * Set the packet's ad bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_ad(ldns_pkt *p, bool b); + +/** + * Set the packet's opcode + * \param[in] p the packet + * \param[in] c the opcode + */ +void ldns_pkt_set_opcode(ldns_pkt *p, ldns_pkt_opcode c); +/** + * Set the packet's respons code + * \param[in] p the packet + * \param[in] c the rcode + */ +void ldns_pkt_set_rcode(ldns_pkt *p, uint8_t c); +/** + * Set the packet's qd count + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_qdcount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's an count + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_ancount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's ns count + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_nscount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's arcount + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_arcount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's answering server + * \param[in] p the packet + * \param[in] r the address + */ +void ldns_pkt_set_answerfrom(ldns_pkt *p, ldns_rdf *r); +/** + * Set the packet's query time + * \param[in] p the packet + * \param[in] t the querytime in msec + */ +void ldns_pkt_set_querytime(ldns_pkt *p, uint32_t t); +/** + * Set the packet's size + * \param[in] p the packet + * \param[in] s the size + */ +void ldns_pkt_set_size(ldns_pkt *p, size_t s); + +/** + * Set the packet's timestamp + * \param[in] p the packet + * \param[in] timeval the timestamp + */ +void ldns_pkt_set_timestamp(ldns_pkt *p, struct timeval timeval); +/** + * Set a packet's section count to x + * \param[in] p the packet + * \param[in] s the section + * \param[in] x the section count + */ +void ldns_pkt_set_section_count(ldns_pkt *p, ldns_pkt_section s, uint16_t x); +/** + * Set the packet's tsig rr + * \param[in] p the packet + * \param[in] t the tsig rr + */ +void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t); + +/** + * looks inside the packet to determine + * what kind of packet it is, AUTH, NXDOMAIN, REFERRAL, etc. + * \param[in] p the packet to examine + * \return the type of packet + */ +ldns_pkt_type ldns_pkt_reply_type(ldns_pkt *p); + +/** + * return the packet's edns udp size + * \param[in] packet the packet + * \return the size + */ +uint16_t ldns_pkt_edns_udp_size(const ldns_pkt *packet); +/** + * return the packet's edns extended rcode + * \param[in] packet the packet + * \return the rcode + */ +uint8_t ldns_pkt_edns_extended_rcode(const ldns_pkt *packet); +/** + * return the packet's edns version + * \param[in] packet the packet + * \return the version + */ +uint8_t ldns_pkt_edns_version(const ldns_pkt *packet); +/** + * return the packet's edns z value + * \param[in] packet the packet + * \return the z value + */ +uint16_t ldns_pkt_edns_z(const ldns_pkt *packet); +/** + * return the packet's edns data + * \param[in] packet the packet + * \return the data + */ +ldns_rdf *ldns_pkt_edns_data(const ldns_pkt *packet); + +/** + * return the packet's edns do bit + * \param[in] packet the packet + * \return the bit's value + */ +bool ldns_pkt_edns_do(const ldns_pkt *packet); +/** + * Set the packet's edns do bit + * \param[in] packet the packet + * \param[in] value the bit's new value + */ +void ldns_pkt_set_edns_do(ldns_pkt *packet, bool value); + +/** + * returns true if this packet needs and EDNS rr to be sent. + * At the moment the only reason is an expected packet + * size larger than 512 bytes, but for instance dnssec would + * be a good reason too. + * + * \param[in] packet the packet to check + * \return true if packet needs edns rr + */ +bool ldns_pkt_edns(const ldns_pkt *packet); + +/** + * Set the packet's edns udp size + * \param[in] packet the packet + * \param[in] s the size + */ +void ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s); +/** + * Set the packet's edns extended rcode + * \param[in] packet the packet + * \param[in] c the code + */ +void ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c); +/** + * Set the packet's edns version + * \param[in] packet the packet + * \param[in] v the version + */ +void ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v); +/** + * Set the packet's edns z value + * \param[in] packet the packet + * \param[in] z the value + */ +void ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z); +/** + * Set the packet's edns data + * \param[in] packet the packet + * \param[in] data the data + */ +void ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data); + +/** + * allocates and initializes a ldns_pkt structure. + * \return pointer to the new packet + */ +ldns_pkt *ldns_pkt_new(); + +/** + * frees the packet structure and all data that it contains. + * \param[in] packet The packet structure to free + * \return void + */ +void ldns_pkt_free(ldns_pkt *packet); + +/** + * creates a query packet for the given name, type, class. + * \param[out] p the packet to be returned + * \param[in] rr_name the name to query for (as string) + * \param[in] rr_type the type to query for + * \param[in] rr_class the class to query for + * \param[in] flags packet flags + * \return LDNS_STATUS_OK or a ldns_status mesg with the error + */ +ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags); + +/** + * creates a packet with a query in it for the given name, type and class. + * \param[in] rr_name the name to query for + * \param[in] rr_type the type to query for + * \param[in] rr_class the class to query for + * \param[in] flags packet flags + * \return ldns_pkt* a pointer to the new pkt + */ +ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags); + +/** + * clones the given packet, creating a fully allocated copy + * + * \param[in] pkt the packet to clone + * \return ldns_pkt* pointer to the new packet + */ +ldns_pkt *ldns_pkt_clone(ldns_pkt *pkt); + +/** + * directly set the additional section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_additional(ldns_pkt *p, ldns_rr_list *rr); + +/** + * directly set the answer section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_answer(ldns_pkt *p, ldns_rr_list *rr); + +/** + * directly set the question section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_question(ldns_pkt *p, ldns_rr_list *rr); + +/** + * directly set the auhority section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_authority(ldns_pkt *p, ldns_rr_list *rr); + +/** + * push an rr on a packet + * \param[in] packet packet to operate on + * \param[in] section where to put it + * \param[in] rr rr to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr); + +/** + * push an rr on a packet, provided the RR is not there. + * \param[in] pkt packet to operate on + * \param[in] sec where to put it + * \param[in] rr rr to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_safe_push_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr); + +/** + * push a rr_list on a packet + * \param[in] packet packet to operate on + * \param[in] section where to put it + * \param[in] list the rr_list to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_push_rr_list(ldns_pkt *packet, ldns_pkt_section section, ldns_rr_list *list); + +/** + * push an rr_list to a packet, provided the RRs are not already there. + * \param[in] pkt packet to operate on + * \param[in] sec where to put it + * \param[in] list the rr_list to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_safe_push_rr_list(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr_list *list); + +/** + * check if a packet is empty + * \param[in] p packet + * \return true: empty, false: not empty + */ +bool ldns_pkt_empty(ldns_pkt *p); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_PACKET_H */ diff --git a/libs/ldns/ldns/parse.h b/libs/ldns/ldns/parse.h new file mode 100644 index 0000000000..0e9034c341 --- /dev/null +++ b/libs/ldns/ldns/parse.h @@ -0,0 +1,167 @@ +/* + * parse.h + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ + +#ifndef LDNS_PARSE_H +#define LDNS_PARSE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_PARSE_SKIP_SPACE "\f\n\r\v" +#define LDNS_PARSE_NORMAL " \f\n\r\t\v" +#define LDNS_PARSE_NO_NL " \t" +#define LDNS_MAX_LINELEN 10230 +#define LDNS_MAX_KEYWORDLEN 32 + + +/** + * \file + * + * Contains some low-level parsing functions, mostly used in the _frm_str + * family of functions. + */ + +/** + * different type of directives in zone files + * We now deal with $TTL, $ORIGIN and $INCLUDE. + * The latter is not implemented in ldns (yet) + */ +enum ldns_enum_directive +{ + LDNS_DIR_TTL, + LDNS_DIR_ORIGIN, + LDNS_DIR_INCLUDE +}; +typedef enum ldns_enum_directive ldns_directive; + +/** + * returns a token/char from the stream F. + * This function deals with ( and ) in the stream, + * and ignores them when encountered + * \param[in] *f the file to read from + * \param[out] *token the read token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 the builtin maximum is used + * \return 0 on error of EOF of the stream F. Otherwise return the length of what is read + */ +ssize_t ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit); + +/** + * returns a token/char from the stream F. + * This function deals with ( and ) in the stream, + * and ignores when it finds them. + * \param[in] *f the file to read from + * \param[out] *token the token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 use builtin maximum + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return 0 on error of EOF of F otherwise return the length of what is read + */ +ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr); + +/** + * returns a token/char from the buffer b. + * This function deals with ( and ) in the buffer, + * and ignores when it finds them. + * \param[in] *b the buffer to read from + * \param[out] *token the token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 the builtin maximum is used + * \returns 0 on error of EOF of b. Otherwise return the length of what is read + */ +ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit); + +/* + * searches for keyword and delim in a file. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] f file pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \return the number of character read + */ +ssize_t ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); + +/* + * searches for keyword and delim. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] f file pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \param[in] line_nr pointer to an integer containing the current line number (for +debugging purposes) + * \return the number of character read + */ +ssize_t ldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr); + +/* + * searches for keyword and delim in a buffer. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] b buffer pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \return the number of character read + */ +ssize_t ldns_bget_keyword_data(ldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); + +/** + * returns the next character from a buffer. Advances the position pointer with 1. + * When end of buffer is reached returns EOF. This is the buffer's equivalent + * for getc(). + * \param[in] *buffer buffer to read from + * \return EOF on failure otherwise return the character + */ +int ldns_bgetc(ldns_buffer *buffer); + +/** + * skips all of the characters in the given string in the buffer, moving + * the position to the first character that is not in *s. + * \param[in] *buffer buffer to use + * \param[in] *s characters to skip + * \return void + */ +void ldns_bskipcs(ldns_buffer *buffer, const char *s); + +/** + * skips all of the characters in the given string in the fp, moving + * the position to the first character that is not in *s. + * \param[in] *fp file to use + * \param[in] *s characters to skip + * \return void + */ +void ldns_fskipcs(FILE *fp, const char *s); + + +/** + * skips all of the characters in the given string in the fp, moving + * the position to the first character that is not in *s. + * \param[in] *fp file to use + * \param[in] *s characters to skip + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return void + */ +void ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_PARSE_H */ diff --git a/libs/ldns/ldns/rbtree.h b/libs/ldns/ldns/rbtree.h new file mode 100644 index 0000000000..98bd880329 --- /dev/null +++ b/libs/ldns/ldns/rbtree.h @@ -0,0 +1,230 @@ +/* + * rbtree.h -- generic red-black tree + * + * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the NLNET LABS nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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. + * + */ + +/** + * \file + * Red black tree. Implementation taken from NSD 3.0.5, adjusted for use + * in unbound (memory allocation, logging and so on). + */ + +#ifndef LDNS_RBTREE_H_ +#define LDNS_RBTREE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This structure must be the first member of the data structure in + * the rbtree. This allows easy casting between an rbnode_t and the + * user data (poor man's inheritance). + * Or you can use the data pointer member to get to your data item. + */ +typedef struct ldns_rbnode_t ldns_rbnode_t; +/** + * The rbnode_t struct definition. + */ +struct ldns_rbnode_t { + /** parent in rbtree, RBTREE_NULL for root */ + ldns_rbnode_t *parent; + /** left node (smaller items) */ + ldns_rbnode_t *left; + /** right node (larger items) */ + ldns_rbnode_t *right; + /** pointer to sorting key */ + const void *key; + /** pointer to data */ + const void *data; + /** colour of this node */ + uint8_t color; +}; + +/** The nullpointer, points to empty node */ +#define LDNS_RBTREE_NULL &ldns_rbtree_null_node +/** the global empty node */ +extern ldns_rbnode_t ldns_rbtree_null_node; + +/** An entire red black tree */ +typedef struct ldns_rbtree_t ldns_rbtree_t; +/** definition for tree struct */ +struct ldns_rbtree_t { + /** The root of the red-black tree */ + ldns_rbnode_t *root; + + /** The number of the nodes in the tree */ + size_t count; + + /** + * Key compare function. <0,0,>0 like strcmp. + * Return 0 on two NULL ptrs. + */ + int (*cmp) (const void *, const void *); +}; + +/** + * Create new tree (malloced) with given key compare function. + * @param cmpf: compare function (like strcmp) takes pointers to two keys. + * @return: new tree, empty. + */ +ldns_rbtree_t *ldns_rbtree_create(int (*cmpf)(const void *, const void *)); + +/** + * Free the complete tree (but not its keys) + * @param rbtree The tree to free + */ +void ldns_rbtree_free(ldns_rbtree_t *rbtree); + +/** + * Init a new tree (malloced by caller) with given key compare function. + * @param rbtree: uninitialised memory for new tree, returned empty. + * @param cmpf: compare function (like strcmp) takes pointers to two keys. + */ +void ldns_rbtree_init(ldns_rbtree_t *rbtree, int (*cmpf)(const void *, const void *)); + +/** + * Insert data into the tree. + * @param rbtree: tree to insert to. + * @param data: element to insert. + * @return: data ptr or NULL if key already present. + */ +ldns_rbnode_t *ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data); + +/** + * Insert data into the tree (reversed arguments, for use as callback) + * \param[in] data element to insert + * \param[out] rbtree tree to insert in to + * \return data ptr or NULL if key is already present + */ +void ldns_rbtree_insert_vref(ldns_rbnode_t *data, void *rbtree); + +/** + * Delete element from tree. + * @param rbtree: tree to delete from. + * @param key: key of item to delete. + * @return: node that is now unlinked from the tree. User to delete it. + * returns 0 if node not present + */ +ldns_rbnode_t *ldns_rbtree_delete(ldns_rbtree_t *rbtree, const void *key); + +/** + * Find key in tree. Returns NULL if not found. + * @param rbtree: tree to find in. + * @param key: key that must match. + * @return: node that fits or NULL. + */ +ldns_rbnode_t *ldns_rbtree_search(ldns_rbtree_t *rbtree, const void *key); + +/** + * Find, but match does not have to be exact. + * @param rbtree: tree to find in. + * @param key: key to find position of. + * @param result: set to the exact node if present, otherwise to element that + * precedes the position of key in the tree. NULL if no smaller element. + * @return: true if exact match in result. Else result points to <= element, + * or NULL if key is smaller than the smallest key. + */ +int ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key, + ldns_rbnode_t **result); + +/** + * Returns first (smallest) node in the tree + * @param rbtree: tree + * @return: smallest element or NULL if tree empty. + */ +ldns_rbnode_t *ldns_rbtree_first(ldns_rbtree_t *rbtree); + +/** + * Returns last (largest) node in the tree + * @param rbtree: tree + * @return: largest element or NULL if tree empty. + */ +ldns_rbnode_t *ldns_rbtree_last(ldns_rbtree_t *rbtree); + +/** + * Returns next larger node in the tree + * @param rbtree: tree + * @return: next larger element or NULL if no larger in tree. + */ +ldns_rbnode_t *ldns_rbtree_next(ldns_rbnode_t *rbtree); + +/** + * Returns previous smaller node in the tree + * @param rbtree: tree + * @return: previous smaller element or NULL if no previous in tree. + */ +ldns_rbnode_t *ldns_rbtree_previous(ldns_rbnode_t *rbtree); + +/** + * split off 'elements' number of elements from the start + * of the name tree and return a new tree containing those + * elements + */ +ldns_rbtree_t *ldns_rbtree_split(ldns_rbtree_t *tree, size_t elements); + +/** + * add all node from the second tree to the first (removing them from the + * second), and fix up nsec(3)s if present + */ +void ldns_rbtree_join(ldns_rbtree_t *tree1, ldns_rbtree_t *tree2); + +/** + * Call with node=variable of struct* with rbnode_t as first element. + * with type is the type of a pointer to that struct. + */ +#define LDNS_RBTREE_FOR(node, type, rbtree) \ + for(node=(type)ldns_rbtree_first(rbtree); \ + (ldns_rbnode_t*)node != LDNS_RBTREE_NULL; \ + node = (type)ldns_rbtree_next((ldns_rbnode_t*)node)) + +/** + * Call function for all elements in the redblack tree, such that + * leaf elements are called before parent elements. So that all + * elements can be safely free()d. + * Note that your function must not remove the nodes from the tree. + * Since that may trigger rebalances of the rbtree. + * @param tree: the tree + * @param func: function called with element and user arg. + * The function must not alter the rbtree. + * @param arg: user argument. + */ +void ldns_traverse_postorder(ldns_rbtree_t* tree, + void (*func)(ldns_rbnode_t*, void*), void* arg); + +#ifdef __cplusplus +} +#endif + +#endif /* UTIL_RBTREE_H_ */ diff --git a/libs/ldns/ldns/rdata.h b/libs/ldns/ldns/rdata.h new file mode 100644 index 0000000000..90dcbf1381 --- /dev/null +++ b/libs/ldns/ldns/rdata.h @@ -0,0 +1,385 @@ +/* + * rdata.h + * + * rdata definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + + +/** + * \file + * + * Defines ldns_rdf and functions to manipulate those. + */ + + +#ifndef LDNS_RDATA_H +#define LDNS_RDATA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_MAX_RDFLEN 8192 + +#define LDNS_RDF_SIZE_BYTE 1 +#define LDNS_RDF_SIZE_WORD 2 +#define LDNS_RDF_SIZE_DOUBLEWORD 4 +#define LDNS_RDF_SIZE_6BYTES 6 +#define LDNS_RDF_SIZE_16BYTES 16 + +#define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01 + +/** + * The different types of RDATA fields. + */ +enum ldns_enum_rdf_type +{ + /** none */ + LDNS_RDF_TYPE_NONE, + /** domain name */ + LDNS_RDF_TYPE_DNAME, + /** 8 bits */ + LDNS_RDF_TYPE_INT8, + /** 16 bits */ + LDNS_RDF_TYPE_INT16, + /** 32 bits */ + LDNS_RDF_TYPE_INT32, + /** A record */ + LDNS_RDF_TYPE_A, + /** AAAA record */ + LDNS_RDF_TYPE_AAAA, + /** txt string */ + LDNS_RDF_TYPE_STR, + /** apl data */ + LDNS_RDF_TYPE_APL, + /** b32 string */ + LDNS_RDF_TYPE_B32_EXT, + /** b64 string */ + LDNS_RDF_TYPE_B64, + /** hex string */ + LDNS_RDF_TYPE_HEX, + /** nsec type codes */ + LDNS_RDF_TYPE_NSEC, + /** a RR type */ + LDNS_RDF_TYPE_TYPE, + /** a class */ + LDNS_RDF_TYPE_CLASS, + /** certificate algorithm */ + LDNS_RDF_TYPE_CERT_ALG, + /** a key algorithm */ + LDNS_RDF_TYPE_ALG, + /** unknown types */ + LDNS_RDF_TYPE_UNKNOWN, + /** time (32 bits) */ + LDNS_RDF_TYPE_TIME, + /** period */ + LDNS_RDF_TYPE_PERIOD, + /** tsig time 48 bits */ + LDNS_RDF_TYPE_TSIGTIME, + LDNS_RDF_TYPE_TSIG, + /** variable length any type rdata where the length + is specified by the first 2 bytes */ + LDNS_RDF_TYPE_INT16_DATA, + /** protocol and port bitmaps */ + LDNS_RDF_TYPE_SERVICE, + /** location data */ + LDNS_RDF_TYPE_LOC, + /** well known services */ + LDNS_RDF_TYPE_WKS, + /** NSAP */ + LDNS_RDF_TYPE_NSAP, + /** ATMA */ + LDNS_RDF_TYPE_ATMA, + /** IPSECKEY */ + LDNS_RDF_TYPE_IPSECKEY, + /** nsec3 hash salt */ + LDNS_RDF_TYPE_NSEC3_SALT, + /** nsec3 base32 string (with length byte on wire */ + LDNS_RDF_TYPE_NSEC3_NEXT_OWNER +}; +typedef enum ldns_enum_rdf_type ldns_rdf_type; + +/** + * algorithms used in CERT rrs + */ +enum ldns_enum_cert_algorithm +{ + LDNS_CERT_PKIX = 1, + LDNS_CERT_SPKI = 2, + LDNS_CERT_PGP = 3, + LDNS_CERT_IPKIX = 4, + LDNS_CERT_ISPKI = 5, + LDNS_CERT_IPGP = 6, + LDNS_CERT_ACPKIX = 7, + LDNS_CERT_IACPKIX = 8, + LDNS_CERT_URI = 253, + LDNS_CERT_OID = 254 +}; +typedef enum ldns_enum_cert_algorithm ldns_cert_algorithm; + + + +/** + * Resource record data field. + * + * The data is a network ordered array of bytes, which size is specified by + * the (16-bit) size field. To correctly parse it, use the type + * specified in the (16-bit) type field with a value from \ref ldns_rdf_type. + */ +struct ldns_struct_rdf +{ + /** The size of the data (in octets) */ + size_t _size; + /** The type of the data */ + ldns_rdf_type _type; + /** Pointer to the data (raw octets) */ + void *_data; +}; +typedef struct ldns_struct_rdf ldns_rdf; + +/* prototypes */ + +/* write access functions */ + +/** + * sets the size of the rdf. + * \param[in] *rd the rdf to operate on + * \param[in] size the new size + * \return void + */ +void ldns_rdf_set_size(ldns_rdf *rd, size_t size); + +/** + * sets the size of the rdf. + * \param[in] *rd the rdf to operate on + * \param[in] type the new type + * \return void + */ +void ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type); + +/** + * sets the size of the rdf. + * \param[in] *rd the rdf to operate on + * \param[in] *data pointer to the new data + * \return void + */ +void ldns_rdf_set_data(ldns_rdf *rd, void *data); + +/* read access */ + +/** + * returns the size of the rdf. + * \param[in] *rd the rdf to read from + * \return uint16_t with the size + */ +size_t ldns_rdf_size(const ldns_rdf *rd); + +/** + * returns the type of the rdf. We need to insert _get_ + * here to prevent conflict the the rdf_type TYPE. + * \param[in] *rd the rdf to read from + * \return ldns_rdf_type with the type + */ +ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd); + +/** + * returns the data of the rdf. + * \param[in] *rd the rdf to read from + * \return uint8_t* pointer to the rdf's data + */ +uint8_t *ldns_rdf_data(const ldns_rdf *rd); + +/* creator functions */ + +/** + * allocates a new rdf structure and fills it. + * This function DOES NOT copy the contents from + * the buffer, unlinke ldns_rdf_new_frm_data() + * \param[in] type type of the rdf + * \param[in] size size of the buffer + * \param[in] data pointer to the buffer to be copied + * \return the new rdf structure or NULL on failure + */ +ldns_rdf *ldns_rdf_new(ldns_rdf_type type, size_t size, void *data); + +/** + * allocates a new rdf structure and fills it. + * This function _does_ copy the contents from + * the buffer, unlinke ldns_rdf_new() + * \param[in] type type of the rdf + * \param[in] size size of the buffer + * \param[in] data pointer to the buffer to be copied + * \return the new rdf structure or NULL on failure + */ +ldns_rdf *ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data); + +/** + * creates a new rdf from a string. + * \param[in] type type to use + * \param[in] str string to use + * \return ldns_rdf* or NULL in case of an error + */ +ldns_rdf *ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str); + +/** + * creates a new rdf from a file containing a string. + * \param[out] r the new rdf + * \param[in] type type to use + * \param[in] fp the file pointer to use + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_rdf_new_frm_fp(ldns_rdf **r, ldns_rdf_type type, FILE *fp); + +/** + * creates a new rdf from a file containing a string. + * \param[out] r the new rdf + * \param[in] type type to use + * \param[in] fp the file pointer to use + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_rdf_new_frm_fp_l(ldns_rdf **r, ldns_rdf_type type, FILE *fp, int *line_nr); + +/* destroy functions */ + +/** + * frees a rdf structure, leaving the + * data pointer intact. + * \param[in] rd the pointer to be freed + * \return void + */ +void ldns_rdf_free(ldns_rdf *rd); + +/** + * frees a rdf structure _and_ frees the + * data. rdf should be created with _new_frm_data + * \param[in] rd the rdf structure to be freed + * \return void + */ +void ldns_rdf_deep_free(ldns_rdf *rd); + +/* conversion functions */ + +/** + * returns the rdf containing the native uint8_t repr. + * \param[in] type the ldns_rdf type to use + * \param[in] value the uint8_t to use + * \return ldns_rdf* with the converted value + */ +ldns_rdf *ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value); + +/** + * returns the rdf containing the native uint16_t representation. + * \param[in] type the ldns_rdf type to use + * \param[in] value the uint16_t to use + * \return ldns_rdf* with the converted value + */ +ldns_rdf *ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value); + +/** + * returns an rdf that contains the given int32 value. + * + * Because multiple rdf types can contain an int32, the + * type must be specified + * \param[in] type the ldns_rdf type to use + * \param[in] value the uint32_t to use + * \return ldns_rdf* with the converted value + */ +ldns_rdf *ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value); + +/** + * returns an int16_data rdf that contains the data in the + * given array, preceded by an int16 specifying the length. + * + * The memory is copied, and an LDNS_RDF_TYPE_INT16DATA is returned + * \param[in] size the size of the data + * \param[in] *data pointer to the actual data + * \return ldns_rd* the rdf with the data + */ +ldns_rdf *ldns_native2rdf_int16_data(size_t size, uint8_t *data); + +/** + * reverses an rdf, only actually useful for AAAA and A records. + * The returned rdf has the type LDNS_RDF_TYPE_DNAME! + * \param[in] *rd rdf to be reversed + * \return the reversed rdf (a newly created rdf) + */ +ldns_rdf *ldns_rdf_address_reverse(ldns_rdf *rd); + +/** + * returns the native uint8_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return uint8_t the value extracted + */ +uint8_t ldns_rdf2native_int8(const ldns_rdf *rd); + +/** + * returns the native uint16_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return uint16_t the value extracted + */ +uint16_t ldns_rdf2native_int16(const ldns_rdf *rd); + +/** + * returns the native uint32_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return uint32_t the value extracted + */ +uint32_t ldns_rdf2native_int32(const ldns_rdf *rd); + +/** + * returns the native time_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return time_t the value extracted (32 bits currently) + */ +time_t ldns_rdf2native_time_t(const ldns_rdf *rd); + +/** + * converts a ttl value (like 5d2h) to a long. + * \param[in] nptr the start of the string + * \param[out] endptr points to the last char in case of error + * \return the convert duration value + */ +uint32_t ldns_str2period(const char *nptr, const char **endptr); + +/** + * removes \\DDD, \\[space] and other escapes from the input. + * See RFC 1035, section 5.1. + * \param[in] word what to check + * \param[in] length the string + * \return ldns_status mesg + */ +ldns_status ldns_octet(char *word, size_t *length); + +/** + * clones a rdf structure. The data is copied. + * \param[in] rd rdf to be copied + * \return a new rdf structure + */ +ldns_rdf *ldns_rdf_clone(const ldns_rdf *rd); + +/** + * compares two rdf's on their wire formats. + * (To order dnames according to rfc4034, use ldns_dname_compare) + * \param[in] rd1 the first one + * \param[in] rd2 the second one + * \return 0 if equal + * \return -1 if rd1 comes before rd2 + * \return +1 if rd2 comes before rd1 + */ +int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RDATA_H */ diff --git a/libs/ldns/ldns/resolver.h b/libs/ldns/ldns/resolver.h new file mode 100644 index 0000000000..f887aaf676 --- /dev/null +++ b/libs/ldns/ldns/resolver.h @@ -0,0 +1,721 @@ +/* + * resolver.h + * + * DNS Resolver definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Defines the ldns_resolver structure, a stub resolver that can send queries and parse answers. + * + */ + +#ifndef LDNS_RESOLVER_H +#define LDNS_RESOLVER_H + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Default location of the resolv.conf file */ +#define LDNS_RESOLV_CONF "/etc/resolv.conf" +/** Default location of the hosts file */ +#define LDNS_RESOLV_HOSTS "/etc/hosts" + +#define LDNS_RESOLV_KEYWORD -1 +#define LDNS_RESOLV_DEFDOMAIN 0 +#define LDNS_RESOLV_NAMESERVER 1 +#define LDNS_RESOLV_SEARCH 2 +#define LDNS_RESOLV_SORTLIST 3 +#define LDNS_RESOLV_OPTIONS 4 +#define LDNS_RESOLV_ANCHOR 5 +#define LDNS_RESOLV_KEYWORDS 6 + +#define LDNS_RESOLV_INETANY 0 +#define LDNS_RESOLV_INET 1 +#define LDNS_RESOLV_INET6 2 + +#define LDNS_RESOLV_RTT_INF 0 /* infinity */ +#define LDNS_RESOLV_RTT_MIN 1 /* reachable */ + +/** + * DNS stub resolver structure + */ +struct ldns_struct_resolver +{ + /** Port to send queries to */ + uint16_t _port; + + /** Array of nameservers to query (IP addresses or dnames) */ + ldns_rdf **_nameservers; + /** Number of nameservers in \c _nameservers */ + size_t _nameserver_count; /* how many do we have */ + + /** Round trip time; 0 -> infinity. Unit: ms? */ + size_t *_rtt; + + /** Wether or not to be recursive */ + bool _recursive; + + /** Print debug information */ + bool _debug; + + /** Default domain to add to non fully qualified domain names */ + ldns_rdf *_domain; + + /** Searchlist array, add the names in this array if a query cannot be found */ + ldns_rdf **_searchlist; + + /** Number of entries in the searchlist array */ + size_t _searchlist_count; + + /** Number of times to retry before giving up */ + uint8_t _retry; + /** Time to wait before retrying */ + uint8_t _retrans; + /** Use new fallback mechanism (try EDNS, then do TCP) */ + bool _fallback; + + /** Whether to do DNSSEC */ + bool _dnssec; + /** Whether to set the CD bit on DNSSEC requests */ + bool _dnssec_cd; + /** Optional trust anchors for complete DNSSEC validation */ + ldns_rr_list * _dnssec_anchors; + /** Whether to use tcp or udp (tcp if the value is true)*/ + bool _usevc; + /** Whether to ignore the tc bit */ + bool _igntc; + /** Whether to use ip6, 0->does not matter, 1 is IPv4, 2 is IPv6 */ + uint8_t _ip6; + /** If true append the default domain */ + bool _defnames; + /** If true apply the search list */ + bool _dnsrch; + /** Timeout for socket connections */ + struct timeval _timeout; + /** Only try the first nameserver, and return with an error directly if it fails */ + bool _fail; + /** Randomly choose a nameserver */ + bool _random; + /** Keep some things to make AXFR possible */ + int _socket; + /** Count the number of LDNS_RR_TYPE_SOA RRs we have seen so far + * (the second one signifies the end of the AXFR) + */ + int _axfr_soa_count; + /* when axfring we get complete packets from the server + but we want to give the caller 1 rr at a time, so + keep the current pkt */ + /** Packet currently handled when doing part of an AXFR */ + ldns_pkt *_cur_axfr_pkt; + /** Counter for within the AXFR packets */ + uint16_t _axfr_i; + /* EDNS0 available buffer size */ + uint16_t _edns_udp_size; + + /* Optional tsig key for signing queries, + outgoing messages are signed if and only if both are set + */ + /** Name of the key to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values, outgoing messages are automatically signed with TSIG. */ + char *_tsig_keyname; + /** Secret key data to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values, outgoing messages are automatically signed with TSIG. */ + char *_tsig_keydata; + /** TSIG signing algorithm */ + char *_tsig_algorithm; +}; +typedef struct ldns_struct_resolver ldns_resolver; + +/* prototypes */ +/* read access functions */ + +/** + * Get the port the resolver should use + * \param[in] r the resolver + * \return the port number + */ +uint16_t ldns_resolver_port(const ldns_resolver *r); + +/** + * Is the resolver set to recurse + * \param[in] r the resolver + * \return true if so, otherwise false + */ +bool ldns_resolver_recursive(const ldns_resolver *r); + +/** + * Get the debug status of the resolver + * \param[in] r the resolver + * \return true if so, otherwise false + */ +bool ldns_resolver_debug(const ldns_resolver *r); + +/** + * Get the number of retries + * \param[in] r the resolver + * \return the number of retries + */ +uint8_t ldns_resolver_retry(const ldns_resolver *r); + +/** + * Get the retransmit interval + * \param[in] r the resolver + * \return the retransmit interval + */ +uint8_t ldns_resolver_retrans(const ldns_resolver *r); + +/** + * Get the truncation fallback status + * \param[in] r the resolver + * \return whether the truncation fallback mechanism is used + */ +bool ldns_resolver_fallback(const ldns_resolver *r); + +/** + * Does the resolver use ip6 or ip4 + * \param[in] r the resolver + * \return 0: both, 1: ip4, 2:ip6 + */ +uint8_t ldns_resolver_ip6(const ldns_resolver *r); + +/** + * Get the resolver's udp size + * \param[in] r the resolver + * \return the udp mesg size + */ +uint16_t ldns_resolver_edns_udp_size(const ldns_resolver *r); +/** + * Does the resolver use tcp or udp + * \param[in] r the resolver + * \return true: tcp, false: udp + */ +bool ldns_resolver_usevc(const ldns_resolver *r); +/** + * Does the resolver only try the first nameserver + * \param[in] r the resolver + * \return true: yes, fail, false: no, try the others + */ +bool ldns_resolver_fail(const ldns_resolver *r); +/** + * Does the resolver apply default domain name + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_defnames(const ldns_resolver *r); +/** + * Does the resolver apply search list + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_dnsrch(const ldns_resolver *r); +/** + * Does the resolver do DNSSEC + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_dnssec(const ldns_resolver *r); +/** + * Does the resolver set the CD bit + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_dnssec_cd(const ldns_resolver *r); +/** + * Get the resolver's DNSSEC anchors + * \param[in] r the resolver + * \return an rr_list containg trusted DNSSEC anchors + */ +ldns_rr_list * ldns_resolver_dnssec_anchors(const ldns_resolver *r); +/** + * Does the resolver ignore the TC bit (truncated) + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_igntc(const ldns_resolver *r); +/** + * Does the resolver randomize the nameserver before usage + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_random(const ldns_resolver *r); +/** + * How many nameserver are configured in the resolver + * \param[in] r the resolver + * \return number of nameservers + */ +size_t ldns_resolver_nameserver_count(const ldns_resolver *r); +/** + * What is the default dname to add to relative queries + * \param[in] r the resolver + * \return the dname which is added + */ +ldns_rdf *ldns_resolver_domain(const ldns_resolver *r); +/** + * What is the timeout on socket connections + * \param[in] r the resolver + * \return the timeout as struct timeval + */ +struct timeval ldns_resolver_timeout(const ldns_resolver *r); +/** + * What is the searchlist as used by the resolver + * \param[in] r the resolver + * \return a ldns_rdf pointer to a list of the addresses + */ +ldns_rdf** ldns_resolver_searchlist(const ldns_resolver *r); +/** + * Return the configured nameserver ip address + * \param[in] r the resolver + * \return a ldns_rdf pointer to a list of the addresses + */ +ldns_rdf** ldns_resolver_nameservers(const ldns_resolver *r); +/** + * Return the used round trip times for the nameservers + * \param[in] r the resolver + * \return a size_t* pointer to the list. + * yet) + */ +size_t * ldns_resolver_rtt(const ldns_resolver *r); +/** + * Return the used round trip time for a specific nameserver + * \param[in] r the resolver + * \param[in] pos the index to the nameserver + * \return the rrt, 0: infinite, >0: undefined (as of * yet) + */ +size_t ldns_resolver_nameserver_rtt(const ldns_resolver *r, size_t pos); +/** + * Return the tsig keyname as used by the nameserver + * \param[in] r the resolver + * \return the name used. + */ +char *ldns_resolver_tsig_keyname(const ldns_resolver *r); +/** + * Return the tsig algorithm as used by the nameserver + * \param[in] r the resolver + * \return the algorithm used. + */ +char *ldns_resolver_tsig_algorithm(const ldns_resolver *r); +/** + * Return the tsig keydata as used by the nameserver + * \param[in] r the resolver + * \return the keydata used. + */ +char *ldns_resolver_tsig_keydata(const ldns_resolver *r); +/** + * pop the last nameserver from the resolver. + * \param[in] r the resolver + * \return the popped address or NULL if empty + */ +ldns_rdf* ldns_resolver_pop_nameserver(ldns_resolver *r); + +/** + * Return the resolver's searchlist count + * \param[in] r the resolver + * \return the searchlist count + */ +size_t ldns_resolver_searchlist_count(const ldns_resolver *r); + +/* write access function */ +/** + * Set the port the resolver should use + * \param[in] r the resolver + * \param[in] p the port number + */ +void ldns_resolver_set_port(ldns_resolver *r, uint16_t p); + +/** + * Set the resolver recursion + * \param[in] r the resolver + * \param[in] b true: set to recurse, false: unset + */ +void ldns_resolver_set_recursive(ldns_resolver *r, bool b); + +/** + * Set the resolver debugging + * \param[in] r the resolver + * \param[in] b true: debug on: false debug off + */ +void ldns_resolver_set_debug(ldns_resolver *r, bool b); + +/** + * Incremental the resolver's nameserver count. + * \param[in] r the resolver + */ +void ldns_resolver_incr_nameserver_count(ldns_resolver *r); + +/** + * Decrement the resolver's nameserver count. + * \param[in] r the resolver + */ +void ldns_resolver_dec_nameserver_count(ldns_resolver *r); + +/** + * Set the resolver's nameserver count directly. + * \param[in] r the resolver + * \param[in] c the nameserver count + */ +void ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c); + +/** + * Set the resolver's nameserver count directly by using an rdf list + * \param[in] r the resolver + * \param[in] rd the resolver addresses + */ +void ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **rd); + +/** + * Set the resolver's default domain. This gets appended when no + * absolute name is given + * \param[in] r the resolver + * \param[in] rd the name to append + */ +void ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *rd); + +/** + * Set the resolver's socket time out when talking to remote hosts + * \param[in] r the resolver + * \param[in] timeout the timeout to use + */ +void ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout); + +/** + * Push a new rd to the resolver's searchlist + * \param[in] r the resolver + * \param[in] rd to push + */ +void ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *rd); + +/** + * Whether the resolver uses the name set with _set_domain + * \param[in] r the resolver + * \param[in] b true: use the defaults, false: don't use them + */ +void ldns_resolver_set_defnames(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses a virtual circuit (TCP) + * \param[in] r the resolver + * \param[in] b true: use TCP, false: don't use TCP + */ +void ldns_resolver_set_usevc(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses the searchlist + * \param[in] r the resolver + * \param[in] b true: use the list, false: don't use the list + */ +void ldns_resolver_set_dnsrch(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses DNSSEC + * \param[in] r the resolver + * \param[in] b true: use DNSSEC, false: don't use DNSSEC + */ +void ldns_resolver_set_dnssec(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses the checking disable bit + * \param[in] r the resolver + * \param[in] b true: enable , false: don't use TCP + */ +void ldns_resolver_set_dnssec_cd(ldns_resolver *r, bool b); +/** + * Set the resolver's DNSSEC anchor list directly. RRs should be of type DS or DNSKEY. + * \param[in] r the resolver + * \param[in] l the list of RRs to use as trust anchors + */ +void ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list * l); + +/** + * Push a new trust anchor to the resolver. It must be a DS or DNSKEY rr + * \param[in] r the resolver. + * \param[in] rr the RR to add as a trust anchor. + * \return a status + */ +ldns_status ldns_resolver_push_dnssec_anchor(ldns_resolver *r, ldns_rr *rr); + +/** + * Set the resolver retrans timeout (in seconds) + * \param[in] r the resolver + * \param[in] re the retransmission interval in seconds + */ +void ldns_resolver_set_retrans(ldns_resolver *r, uint8_t re); + +/** + * Set whether the resolvers truncation fallback mechanism is used + * when ldns_resolver_query() is called. + * \param[in] r the resolver + * \param[in] fallback whether to use the fallback mechanism + */ +void ldns_resolver_set_fallback(ldns_resolver *r, bool fallback); + +/** + * Set the resolver retry interval (in seconds) + * \param[in] r the resolver + * \param[in] re the retry interval + */ +void ldns_resolver_set_retry(ldns_resolver *r, uint8_t re); + +/** + * Whether the resolver uses ip6 + * \param[in] r the resolver + * \param[in] i 0: no pref, 1: ip4, 2: ip6 + */ +void ldns_resolver_set_ip6(ldns_resolver *r, uint8_t i); + +/** + * Whether or not to fail after one failed query + * \param[in] r the resolver + * \param[in] b true: yes fail, false: continue with next nameserver + */ +void ldns_resolver_set_fail(ldns_resolver *r, bool b); + +/** + * Whether or not to ignore the TC bit + * \param[in] r the resolver + * \param[in] b true: yes ignore, false: don't ignore + */ +void ldns_resolver_set_igntc(ldns_resolver *r, bool b); + +/** + * Set maximum udp size + * \param[in] r the resolver + * \param[in] s the udp max size + */ +void ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s); + +/** + * Set the tsig key name + * \param[in] r the resolver + * \param[in] tsig_keyname the tsig key name + */ +void ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname); + +/** + * Set the tsig algorithm + * \param[in] r the resolver + * \param[in] tsig_algorithm the tsig algorithm + */ +void ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm); + +/** + * Set the tsig key data + * \param[in] r the resolver + * \param[in] tsig_keydata the key data + */ +void ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata); + +/** + * Set round trip time for all nameservers. Note this currently + * differentiates between: unreachable and reachable. + * \param[in] r the resolver + * \param[in] rtt a list with the times + */ +void ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt); + +/** + * Set round trip time for a specific nameserver. Note this + * currently differentiates between: unreachable and reachable. + * \param[in] r the resolver + * \param[in] pos the nameserver position + * \param[in] value the rtt + */ +void ldns_resolver_set_nameserver_rtt(ldns_resolver *r, size_t pos, size_t value); + +/** + * Should the nameserver list be randomized before each use + * \param[in] r the resolver + * \param[in] b: true: randomize, false: don't + */ +void ldns_resolver_set_random(ldns_resolver *r, bool b); + +/** + * Push a new nameserver to the resolver. It must be an IP + * address v4 or v6. + * \param[in] r the resolver + * \param[in] n the ip address + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n); + +/** + * Push a new nameserver to the resolver. It must be an + * A or AAAA RR record type + * \param[in] r the resolver + * \param[in] rr the resource record + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr); + +/** + * Push a new nameserver rr_list to the resolver. + * \param[in] r the resolver + * \param[in] rrlist the rr_list to push + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist); + +/** + * Send the query for using the resolver and take the search list into account + * The search algorithm is as follows: + * If the name is absolute, try it as-is, otherwise apply the search list + * \param[in] *r operate using this resolver + * \param[in] *rdf query for this name + * \param[in] t query for this type (may be 0, defaults to A) + * \param[in] c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + */ +ldns_pkt* ldns_resolver_search(const ldns_resolver *r, const ldns_rdf *rdf, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + +/** + * Form a query packet from a resolver and name/type/class combo + * \param[out] **q a pointer to a ldns_pkt pointer (initialized by this function) + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] t query for this type (may be 0, defaults to A) + * \param[in] c query for this class (may be 0, default to IN) + * \param[in] f the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + */ +ldns_status ldns_resolver_prepare_query_pkt(ldns_pkt **q, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t f); + +/** + * Send the query for name as-is + * \param[out] **answer a pointer to a ldns_pkt pointer (initialized by this function) + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] t query for this type (may be 0, defaults to A) + * \param[in] c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + */ +ldns_status ldns_resolver_send(ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + +/** + * Send the given packet to a nameserver + * \param[out] **answer a pointer to a ldns_pkt pointer (initialized by this function) + * \param[in] *r operate using this resolver + * \param[in] *query_pkt query + */ +ldns_status ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, ldns_pkt *query_pkt); + +/** + * Send a query to a nameserver + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] *t query for this type (may be 0, defaults to A) + * \param[in] *c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + * if _defnames is true the default domain will be added + */ +ldns_pkt* ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + + +/** + * Create a new resolver structure + * \return ldns_resolver* pointer to new strcture + */ +ldns_resolver* ldns_resolver_new(void); + +/** + * Create a resolver structure from a file like /etc/resolv.conf + * \param[out] r the new resolver + * \param[in] fp file pointer to create new resolver from + * if NULL use /etc/resolv.conf + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_resolver_new_frm_fp(ldns_resolver **r, FILE *fp); + +/** + * Create a resolver structure from a file like /etc/resolv.conf + * \param[out] r the new resolver + * \param[in] fp file pointer to create new resolver from + * if NULL use /etc/resolv.conf + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_resolver_new_frm_fp_l(ldns_resolver **r, FILE *fp, int *line_nr); + +/** + * Configure a resolver by means of a resolv.conf file + * The file may be NULL in which case there will be + * looked the RESOLV_CONF (defaults to /etc/resolv.conf + * \param[out] r the new resolver + * \param[in] filename the filename to use + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_resolver_new_frm_file(ldns_resolver **r, const char *filename); + +/** + * Frees the allocated space for this resolver. Only frees the resolver pionter! You should probably be using _deep_free. + * \param res resolver to free + */ +void ldns_resolver_free(ldns_resolver *res); + +/** + * Frees the allocated space for this resolver and all it's data + * \param res resolver to free + */ +void ldns_resolver_deep_free(ldns_resolver *res); + +/** + * Get the next stream of RRs in a AXFR + * \param[in] resolver the resolver to use. First ldns_axfr_start() must be + * called + * \return ldns_rr the next RR from the AXFR stream + * After you get this returned RR (not NULL: on error), then check if + * ldns_axfr_complete() is true to see if the zone transfer has completed. + */ +ldns_rr* ldns_axfr_next(ldns_resolver *resolver); + +/** + * Returns true if the axfr transfer has completed (i.e. 2 SOA RRs and no errors were encountered + * \param[in] resolver the resolver that is used + * \return bool true if axfr transfer was completed without error + */ +bool ldns_axfr_complete(const ldns_resolver *resolver); + +/** + * Returns a pointer to the last ldns_pkt that was sent by the server in the AXFR transfer + * uasable for instance to get the error code on failure + * \param[in] res the resolver that was used in the axfr transfer + * \return ldns_pkt the last packet sent + */ +ldns_pkt *ldns_axfr_last_pkt(const ldns_resolver *res); + +/** + * Randomize the nameserver list in the resolver + * \param[in] r the resolver + */ +void ldns_resolver_nameservers_randomize(ldns_resolver *r); + +/** + * Returns true if at least one of the provided keys is a trust anchor + * \param[in] r the current resolver + * \param[in] keys the keyset to check + * \param[out] trusted_keys the subset of trusted keys in the 'keys' rrset + * \return true if at least one of the provided keys is a configured trust anchor + */ +bool ldns_resolver_trusted_key(const ldns_resolver *r, ldns_rr_list * keys, ldns_rr_list * trusted_keys); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RESOLVER_H */ diff --git a/libs/ldns/ldns/rr.h b/libs/ldns/ldns/rr.h new file mode 100644 index 0000000000..86e31de1f2 --- /dev/null +++ b/libs/ldns/ldns/rr.h @@ -0,0 +1,885 @@ +/* + * rr.h - resource record definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains the definition of ldns_rr and functions to manipulate those. + */ + + +#ifndef LDNS_RR_H +#define LDNS_RR_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Maximum length of a dname label */ +#define LDNS_MAX_LABELLEN 63 +/** Maximum length of a complete dname */ +#define LDNS_MAX_DOMAINLEN 255 +/** Maximum number of pointers in 1 dname */ +#define LDNS_MAX_POINTERS 65535 +/** The bytes TTL, CLASS and length use up in an rr */ +#define LDNS_RR_OVERHEAD 10 + +/* The first fields are 'common' and can be referenced instantly */ +#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 52 + + + +/** + * The different RR classes. + */ +enum ldns_enum_rr_class +{ + /** the Internet */ + LDNS_RR_CLASS_IN = 1, + /** Chaos class */ + LDNS_RR_CLASS_CH = 3, + /** Hesiod (Dyer 87) */ + LDNS_RR_CLASS_HS = 4, + /** None class, dynamic update */ + LDNS_RR_CLASS_NONE = 254, + /** Any class */ + LDNS_RR_CLASS_ANY = 255, + + LDNS_RR_CLASS_FIRST = 0, + LDNS_RR_CLASS_LAST = 65535, + LDNS_RR_CLASS_COUNT = LDNS_RR_CLASS_LAST - LDNS_RR_CLASS_FIRST + 1 +}; +typedef enum ldns_enum_rr_class ldns_rr_class; + +/** + * Used to specify whether compression is allowed. + */ +enum ldns_enum_rr_compress +{ + /** compression is allowed */ + LDNS_RR_COMPRESS, + LDNS_RR_NO_COMPRESS +}; +typedef enum ldns_enum_rr_compress ldns_rr_compress; + +/** + * The different RR types. + */ +enum ldns_enum_rr_type +{ + /** a host address */ + LDNS_RR_TYPE_A = 1, + /** an authoritative name server */ + LDNS_RR_TYPE_NS = 2, + /** a mail destination (Obsolete - use MX) */ + LDNS_RR_TYPE_MD = 3, + /** a mail forwarder (Obsolete - use MX) */ + LDNS_RR_TYPE_MF = 4, + /** the canonical name for an alias */ + LDNS_RR_TYPE_CNAME = 5, + /** marks the start of a zone of authority */ + LDNS_RR_TYPE_SOA = 6, + /** a mailbox domain name (EXPERIMENTAL) */ + LDNS_RR_TYPE_MB = 7, + /** a mail group member (EXPERIMENTAL) */ + LDNS_RR_TYPE_MG = 8, + /** a mail rename domain name (EXPERIMENTAL) */ + LDNS_RR_TYPE_MR = 9, + /** a null RR (EXPERIMENTAL) */ + LDNS_RR_TYPE_NULL = 10, + /** a well known service description */ + LDNS_RR_TYPE_WKS = 11, + /** a domain name pointer */ + LDNS_RR_TYPE_PTR = 12, + /** host information */ + LDNS_RR_TYPE_HINFO = 13, + /** mailbox or mail list information */ + LDNS_RR_TYPE_MINFO = 14, + /** mail exchange */ + LDNS_RR_TYPE_MX = 15, + /** text strings */ + LDNS_RR_TYPE_TXT = 16, + /** RFC1183 */ + LDNS_RR_TYPE_RP = 17, + /** RFC1183 */ + LDNS_RR_TYPE_AFSDB = 18, + /** RFC1183 */ + LDNS_RR_TYPE_X25 = 19, + /** RFC1183 */ + LDNS_RR_TYPE_ISDN = 20, + /** RFC1183 */ + LDNS_RR_TYPE_RT = 21, + /** RFC1706 */ + LDNS_RR_TYPE_NSAP = 22, + /** RFC1348 */ + LDNS_RR_TYPE_NSAP_PTR = 23, + /** 2535typecode */ + LDNS_RR_TYPE_SIG = 24, + /** 2535typecode */ + LDNS_RR_TYPE_KEY = 25, + /** RFC2163 */ + LDNS_RR_TYPE_PX = 26, + /** RFC1712 */ + LDNS_RR_TYPE_GPOS = 27, + /** ipv6 address */ + LDNS_RR_TYPE_AAAA = 28, + /** LOC record RFC1876 */ + LDNS_RR_TYPE_LOC = 29, + /** 2535typecode */ + LDNS_RR_TYPE_NXT = 30, + /** draft-ietf-nimrod-dns-01.txt */ + LDNS_RR_TYPE_EID = 31, + /** draft-ietf-nimrod-dns-01.txt */ + LDNS_RR_TYPE_NIMLOC = 32, + /** SRV record RFC2782 */ + LDNS_RR_TYPE_SRV = 33, + /** http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */ + LDNS_RR_TYPE_ATMA = 34, + /** RFC2915 */ + LDNS_RR_TYPE_NAPTR = 35, + /** RFC2230 */ + LDNS_RR_TYPE_KX = 36, + /** RFC2538 */ + LDNS_RR_TYPE_CERT = 37, + /** RFC2874 */ + LDNS_RR_TYPE_A6 = 38, + /** RFC2672 */ + LDNS_RR_TYPE_DNAME = 39, + /** dnsind-kitchen-sink-02.txt */ + LDNS_RR_TYPE_SINK = 40, + /** Pseudo OPT record... */ + LDNS_RR_TYPE_OPT = 41, + /** RFC3123 */ + LDNS_RR_TYPE_APL = 42, + /** draft-ietf-dnsext-delegation */ + LDNS_RR_TYPE_DS = 43, + /** SSH Key Fingerprint */ + LDNS_RR_TYPE_SSHFP = 44, + /** draft-richardson-ipseckey-rr-11.txt */ + LDNS_RR_TYPE_IPSECKEY = 45, + /** draft-ietf-dnsext-dnssec-25 */ + LDNS_RR_TYPE_RRSIG = 46, + LDNS_RR_TYPE_NSEC = 47, + LDNS_RR_TYPE_DNSKEY = 48, + LDNS_RR_TYPE_DHCID = 49, + + LDNS_RR_TYPE_NSEC3 = 50, + LDNS_RR_TYPE_NSEC3PARAMS = 51, + + /** draft-ietf-dnsop-trust-history */ + LDNS_RR_TYPE_TALINK = 58, + + LDNS_RR_TYPE_SPF = 99, + + LDNS_RR_TYPE_UINFO = 100, + LDNS_RR_TYPE_UID = 101, + LDNS_RR_TYPE_GID = 102, + LDNS_RR_TYPE_UNSPEC = 103, + + LDNS_RR_TYPE_TSIG = 250, + LDNS_RR_TYPE_IXFR = 251, + LDNS_RR_TYPE_AXFR = 252, + /** A request for mailbox-related records (MB, MG or MR) */ + LDNS_RR_TYPE_MAILB = 253, + /** A request for mail agent RRs (Obsolete - see MX) */ + LDNS_RR_TYPE_MAILA = 254, + /** any type (wildcard) */ + LDNS_RR_TYPE_ANY = 255, + + /* RFC 4431, 5074, DNSSEC Lookaside Validation */ + LDNS_RR_TYPE_DLV = 32769, + + /* type codes from nsec3 experimental phase + LDNS_RR_TYPE_NSEC3 = 65324, + LDNS_RR_TYPE_NSEC3PARAMS = 65325, */ + LDNS_RR_TYPE_FIRST = 0, + LDNS_RR_TYPE_LAST = 65535, + LDNS_RR_TYPE_COUNT = LDNS_RR_TYPE_LAST - LDNS_RR_TYPE_FIRST + 1 +}; +typedef enum ldns_enum_rr_type ldns_rr_type; + +/** + * Resource Record + * + * This is the basic DNS element that contains actual data + * + * From RFC1035: + *
+3.2.1. Format
+
+All RRs have the same top level format shown below:
+
+                                    1  1  1  1  1  1
+      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                                               |
+    /                                               /
+    /                      NAME                     /
+    |                                               |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                      TYPE                     |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                     CLASS                     |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                      TTL                      |
+    |                                               |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                   RDLENGTH                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
+    /                     RDATA                     /
+    /                                               /
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
+where:
+
+NAME            an owner name, i.e., the name of the node to which this
+                resource record pertains.
+
+TYPE            two octets containing one of the RR TYPE codes.
+
+CLASS           two octets containing one of the RR CLASS codes.
+
+TTL             a 32 bit signed integer that specifies the time interval
+                that the resource record may be cached before the source
+                of the information should again be consulted.  Zero
+                values are interpreted to mean that the RR can only be
+                used for the transaction in progress, and should not be
+                cached.  For example, SOA records are always distributed
+                with a zero TTL to prohibit caching.  Zero values can
+                also be used for extremely volatile data.
+
+RDLENGTH        an unsigned 16 bit integer that specifies the length in
+                octets of the RDATA field.
+
+RDATA           a variable length string of octets that describes the
+                resource.  The format of this information varies
+                according to the TYPE and CLASS of the resource record.
+ * 
+ * + * The actual amount and type of rdata fields depend on the RR type of the + * RR, and can be found by using \ref ldns_rr_descriptor functions. + */ +struct ldns_struct_rr +{ + /** Owner name, uncompressed */ + ldns_rdf *_owner; + /** Time to live */ + uint32_t _ttl; + /** Number of data fields */ + size_t _rd_count; + /** the type of the RR. A, MX etc. */ + ldns_rr_type _rr_type; + /** Class of the resource record. */ + ldns_rr_class _rr_class; + /* everything in the rdata is in network order */ + /** The array of rdata's */ + ldns_rdf **_rdata_fields; + /** question rr [it would be nicer if thous is after _rd_count] + ABI change: Fix this in next major release + */ + bool _rr_question; +}; +typedef struct ldns_struct_rr ldns_rr; + +/** + * List or Set of Resource Records + * + * Contains a list of rr's
+ * No official RFC-like checks are made + */ +struct ldns_struct_rr_list +{ + size_t _rr_count; + size_t _rr_capacity; + ldns_rr **_rrs; +}; +typedef struct ldns_struct_rr_list ldns_rr_list; + +/** + * Contains all information about resource record types. + * + * This structure contains, for all rr types, the rdata fields that are defined. + */ +struct ldns_struct_rr_descriptor +{ + /** Type of the RR that is described here */ + ldns_rr_type _type; + /** Textual name of the RR type. */ + const char *_name; + /** Minimum number of rdata fields in the RRs of this type. */ + uint8_t _minimum; + /** Maximum number of rdata fields in the RRs of this type. */ + uint8_t _maximum; + /** Wireformat specification for the rr, i.e. the types of rdata fields in their respective order. */ + const ldns_rdf_type *_wireformat; + /** Special rdf types */ + ldns_rdf_type _variable; + /** Specifies whether compression can be used for dnames in this RR type. */ + ldns_rr_compress _compress; + /** The number of DNAMEs in the _wireformat string, for parsing. */ + uint8_t _dname_count; +}; +typedef struct ldns_struct_rr_descriptor ldns_rr_descriptor; + +/** + * creates a new rr structure. + * \return ldns_rr * + */ +ldns_rr* ldns_rr_new(void); + +/** + * creates a new rr structure, based on the given type. + * alloc enough space to hold all the rdf's + */ +ldns_rr* ldns_rr_new_frm_type(ldns_rr_type t); + +/** + * frees an RR structure + * \param[in] *rr the RR to be freed + * \return void + */ +void ldns_rr_free(ldns_rr *rr); + +/** + * creates an rr from a string. + * The string should be a fully filled-in rr, like + * ownername <space> TTL <space> CLASS <space> + * TYPE <space> RDATA. + * \param[out] n the rr to return + * \param[in] str the string to convert + * \param[in] default_ttl default ttl value for the rr. + * If 0 DEF_TTL will be used + * \param[in] origin when the owner is relative add this. + * The caller must ldns_rdf_deep_free it. + * \param[out] prev the previous ownername. if this value is not NULL, + * the function overwrites this with the ownername found in this + * string. The caller must then ldns_rdf_deep_free it. + * \return a status msg describing an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_frm_str(ldns_rr **n, const char *str, + uint32_t default_ttl, ldns_rdf *origin, + ldns_rdf **prev); + +/** + * creates an rr for the question section from a string, i.e. + * without RDATA fields + * Origin and previous RR functionality are the same as in + * ldns_rr_new_frm_str() + * \param[out] n the rr to return + * \param[in] str the string to convert + * \param[in] origin when the owner is relative add this. + * The caller must ldns_rdf_deep_free it. + * \param prev the previous ownername. the function overwrite this with + * the current found ownername. The caller must ldns_rdf_deep_free it. + * \return a status msg describing an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_question_frm_str(ldns_rr **n, const char *str, + ldns_rdf *origin, ldns_rdf **prev); + +/** + * creates a new rr from a file containing a string. + * \param[out] rr the new rr + * \param[in] fp the file pointer to use + * \param[in] default_ttl pointer to a default ttl for the rr. If NULL DEF_TTL will be used + * the pointer will be updated if the file contains a $TTL directive + * \param[in] origin when the owner is relative add this + * the pointer will be updated if the file contains a $ORIGIN directive + * The caller must ldns_rdf_deep_free it. + * \param[in] prev when the owner is whitespaces use this as the * ownername + * the pointer will be updated after the call + * The caller must ldns_rdf_deep_free it. + * \return a ldns_status with an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_frm_fp(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev); + +/** + * creates a new rr from a file containing a string. + * \param[out] rr the new rr + * \param[in] fp the file pointer to use + * \param[in] default_ttl a default ttl for the rr. If NULL DEF_TTL will be used + * the pointer will be updated if the file contains a $TTL directive + * \param[in] origin when the owner is relative add this + * the pointer will be updated if the file contains a $ORIGIN directive + * The caller must ldns_rdf_deep_free it. + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \param[in] prev when the owner is whitespaces use this as the * ownername + * the pointer will be updated after the call + * The caller must ldns_rdf_deep_free it. + * \return a ldns_status with an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_frm_fp_l(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr); + +/** + * sets the owner in the rr structure. + * \param[in] *rr rr to operate on + * \param[in] *owner set to this owner + * \return void + */ +void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner); + +/** + * sets the question flag in the rr structure. + * \param[in] *rr rr to operate on + * \param[in] question question flag + * \return void + */ +void ldns_rr_set_question(ldns_rr *rr, bool question); + +/** + * sets the ttl in the rr structure. + * \param[in] *rr rr to operate on + * \param[in] ttl set to this ttl + * \return void + */ +void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl); + +/** + * sets the rd_count in the rr. + * \param[in] *rr rr to operate on + * \param[in] count set to this count + * \return void + */ +void ldns_rr_set_rd_count(ldns_rr *rr, size_t count); + +/** + * sets the type in the rr. + * \param[in] *rr rr to operate on + * \param[in] rr_type set to this type + * \return void + */ +void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type); + +/** + * sets the class in the rr. + * \param[in] *rr rr to operate on + * \param[in] rr_class set to this class + * \return void + */ +void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class); + +/** + * sets a rdf member, it will be set on the + * position given. The old value is returned, like pop. + * \param[in] *rr the rr to operate on + * \param[in] *f the rdf to set + * \param[in] position the position the set the rdf + * \return the old value in the rr, NULL on failyre + */ +ldns_rdf* ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position); + +/** + * sets rd_field member, it will be + * placed in the next available spot. + * \param[in] *rr rr to operate on + * \param[in] *f the data field member to set + * \return bool + */ +bool ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f); + +/** + * removes a rd_field member, it will be + * popped from the last position. + * \param[in] *rr rr to operate on + * \return rdf which was popped (null if nothing) + */ +ldns_rdf* ldns_rr_pop_rdf(ldns_rr *rr); + +/** + * returns the rdata field member counter. + * \param[in] *rr rr to operate on + * \param[in] nr the number of the rdf to return + * \return ldns_rdf * + */ +ldns_rdf* ldns_rr_rdf(const ldns_rr *rr, size_t nr); + +/** + * returns the owner name of an rr structure. + * \param[in] *rr rr to operate on + * \return ldns_rdf * + */ +ldns_rdf* ldns_rr_owner(const ldns_rr *rr); + +/** + * returns the question flag of an rr structure. + * \param[in] *rr rr to operate on + * \return bool true if question + */ +bool ldns_rr_is_question(const ldns_rr *rr); + +/** + * returns the ttl of an rr structure. + * \param[in] *rr the rr to read from + * \return the ttl of the rr + */ +uint32_t ldns_rr_ttl(const ldns_rr *rr); + +/** + * returns the rd_count of an rr structure. + * \param[in] *rr the rr to read from + * \return the rd count of the rr + */ +size_t ldns_rr_rd_count(const ldns_rr *rr); + +/** + * returns the type of the rr. + * \param[in] *rr the rr to read from + * \return the type of the rr + */ +ldns_rr_type ldns_rr_get_type(const ldns_rr *rr); + +/** + * returns the class of the rr. + * \param[in] *rr the rr to read from + * \return the class of the rr + */ +ldns_rr_class ldns_rr_get_class(const ldns_rr *rr); + +/* rr_lists */ + +/** + * returns the number of rr's in an rr_list. + * \param[in] rr_list the rr_list to read from + * \return the number of rr's + */ +size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list); + +/** + * sets the number of rr's in an rr_list. + * \param[in] rr_list the rr_list to set the count on + * \param[in] count the number of rr in this list + * \return void + */ +void ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count); + +/** + * set a rr on a specific index in a ldns_rr_list + * \param[in] rr_list the rr_list to use + * \param[in] r the rr to set + * \param[in] count index into the rr_list + * \return the old rr which was stored in the rr_list, or + * NULL is the index was too large + * set a specific rr */ +ldns_rr * ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count); + +/** + * returns a specific rr of an rrlist. + * \param[in] rr_list the rr_list to read from + * \param[in] nr return this rr + * \return the rr at position nr + */ +ldns_rr* ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr); + +/** + * creates a new rr_list structure. + * \return a new rr_list structure + */ +ldns_rr_list* ldns_rr_list_new(); + +/** + * frees an rr_list structure. + * \param[in] rr_list the list to free + */ +void ldns_rr_list_free(ldns_rr_list *rr_list); + +/** + * frees an rr_list structure and all rrs contained therein. + * \param[in] rr_list the list to free + */ +void ldns_rr_list_deep_free(ldns_rr_list *rr_list); + +/** + * concatenates two ldns_rr_lists together. This modifies + * *left (to extend it and add the pointers from *right). + * \param[in] left the leftside + * \param[in] right the rightside + * \return a left with right concatenated to it + */ +bool ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right); + +/** + * concatenates two ldns_rr_lists together, but makes clones of the rr's + * (instead of pointer copying). + * \param[in] left the leftside + * \param[in] right the rightside + * \return a new rr_list with leftside/rightside concatenated + */ +ldns_rr_list* ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right); + +/** + * pushes an rr to an rrlist. + * \param[in] rr_list the rr_list to push to + * \param[in] rr the rr to push + * \return false on error, otherwise true + */ +bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr); + +/** + * pushes an rr_list to an rrlist. + * \param[in] rr_list the rr_list to push to + * \param[in] push_list the rr_list to push + * \return false on error, otherwise true + */ +bool ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list); + +/** + * pops the last rr from an rrlist. + * \param[in] rr_list the rr_list to pop from + * \return NULL if nothing to pop. Otherwise the popped RR + */ +ldns_rr* ldns_rr_list_pop_rr(ldns_rr_list *rr_list); + +/** + * pops an rr_list of size s from an rrlist. + * \param[in] rr_list the rr_list to pop from + * \param[in] size the number of rr's to pop + * \return NULL if nothing to pop. Otherwise the popped rr_list + */ +ldns_rr_list* ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t size); + +/** + * returns true if the given rr is one of the rrs in the + * list, or if it is equal to one + * \param[in] rr_list the rr_list to check + * \param[in] rr the rr to check + * \return true if rr_list contains rr, false otherwise + */ +bool ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr); + +/** + * checks if an rr_list is a rrset. + * \param[in] rr_list the rr_list to check + * \return true if it is an rrset otherwise false + */ +bool ldns_is_rrset(ldns_rr_list *rr_list); + +/** + * pushes an rr to an rrset (which really are rr_list's). + * \param[in] *rr_list the rrset to push the rr to + * \param[in] *rr the rr to push + * \return true if the push succeeded otherwise false + */ +bool ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr); + +/** + * pops the last rr from an rrset. This function is there only + * for the symmetry. + * \param[in] rr_list the rr_list to pop from + * \return NULL if nothing to pop. Otherwise the popped RR + * + */ +ldns_rr* ldns_rr_set_pop_rr(ldns_rr_list *rr_list); + +/** + * pops the first rrset from the list, + * the list must be sorted, so that all rr's from each rrset + * are next to each other + */ +ldns_rr_list *ldns_rr_list_pop_rrset(ldns_rr_list *rr_list); + + +/** + * retrieves a rrtype by looking up its name. + * \param[in] name a string with the name + * \return the type which corresponds with the name + */ +ldns_rr_type ldns_get_rr_type_by_name(const char *name); + +/** + * retrieves a class by looking up its name. + * \param[in] name string with the name + * \return the cass which corresponds with the name + */ +ldns_rr_class ldns_get_rr_class_by_name(const char *name); + +/** + * clones a rr and all its data + * \param[in] rr the rr to clone + * \return the new rr or NULL on failure + */ +ldns_rr* ldns_rr_clone(const ldns_rr *rr); + +/** + * clones an rrlist. + * \param[in] rrlist the rrlist to clone + * \return the cloned rr list + */ +ldns_rr_list* ldns_rr_list_clone(const ldns_rr_list *rrlist); + +/** + * sorts an rr_list (canonical wire format). the sorting is done inband. + * \param[in] unsorted the rr_list to be sorted + * \return void + */ +void ldns_rr_list_sort(ldns_rr_list *unsorted); + +/** + * compares two rrs. The TTL is not looked at. + * \param[in] rr1 the first one + * \param[in] rr2 the second one + * \return 0 if equal + * -1 if rr1 comes before rr2 + * +1 if rr2 comes before rr1 + */ +int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2); + +/** + * compares two rrs, up to the rdata. + * \param[in] rr1 the first one + * \param[in] rr2 the second one + * \return 0 if equal + * -1 if rr1 comes before rr2 + * +1 if rr2 comes before rr1 + */ +int ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2); + +/** + * compares the wireformat of two rrs, contained in the given buffers. + * \param[in] rr1_buf the first one + * \param[in] rr2_buf the second one + * \return 0 if equal + * -1 if rr1_buf comes before rr2_buf + * +1 if rr2_buf comes before rr1_buf + */ +int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf); + +/** + * returns true of the given rr's are equal. + * Also returns true if one record is a DS that represents the + * same DNSKEY record as the other record + * \param[in] rr1 the first rr + * \param[in] rr2 the second rr + * \return true if equal otherwise false + */ +bool ldns_rr_compare_ds(const ldns_rr *rr1, const ldns_rr *rr2); + +/** + * compares two rr listss. + * \param[in] rrl1 the first one + * \param[in] rrl2 the second one + * \return 0 if equal + * -1 if rrl1 comes before rrl2 + * +1 if rrl2 comes before rrl1 + */ +int ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2); + +/** + * calculates the uncompressed size of an RR. + * \param[in] r the rr to operate on + * \return size of the rr + */ +size_t ldns_rr_uncompressed_size(const ldns_rr *r); + +/** + * converts each dname in a rr to its canonical form. + * \param[in] rr the rr to work on + * \return void + */ +void ldns_rr2canonical(ldns_rr *rr); + +/** + * converts each dname in each rr in a rr_list to its canonical form. + * \param[in] rr_list the rr_list to work on + * \return void + */ +void ldns_rr_list2canonical(ldns_rr_list *rr_list); + +/** + * counts the number of labels of the ownername. + * \param[in] rr count the labels of this rr + * \return the number of labels + */ +uint8_t ldns_rr_label_count(ldns_rr *rr); + +/** + * returns the resource record descriptor for the given rr type. + * + * \param[in] type the type value of the rr type + *\return the ldns_rr_descriptor for this type + */ +const ldns_rr_descriptor *ldns_rr_descript(uint16_t type); + +/** + * returns the minimum number of rdata fields of the rr type this descriptor describes. + * + * \param[in] descriptor for an rr type + * \return the minimum number of rdata fields + */ +size_t ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor); + +/** + * returns the maximum number of rdata fields of the rr type this descriptor describes. + * + * \param[in] descriptor for an rr type + * \return the maximum number of rdata fields + */ +size_t ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor); + +/** + * returns the rdf type for the given rdata field number of the rr type for the given descriptor. + * + * \param[in] descriptor for an rr type + * \param[in] field the field number + * \return the rdf type for the field + */ +ldns_rdf_type ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, size_t field); + +/** + * Return the rr_list which matches the rdf at position field. Think + * type-covered stuff for RRSIG + * + * \param[in] l the rr_list to look in + * \param[in] r the rdf to use for the comparison + * \param[in] pos at which position can we find the rdf + * + * \return a new rr list with only the RRs that match + * + */ +ldns_rr_list *ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos); + +/** + * convert an rdf of type LDNS_RDF_TYPE_TYPE to an actual + * LDNS_RR_TYPE. This is usefull in the case when inspecting + * the rrtype covered field of an RRSIG. + * \param[in] rd the rdf to look at + * \return a ldns_rr_type with equivalent LDNS_RR_TYPE + * + */ +ldns_rr_type ldns_rdf2rr_type(const ldns_rdf *rd); + +/** + * Returns the type of the first element of the RR + * If there are no elements present, 0 is returned + * + * \param[in] rr_list The rr list + * \return rr_type of the first element, or 0 if the list is empty + */ +ldns_rr_type +ldns_rr_list_type(const ldns_rr_list *rr_list); + +/** + * Returns the owner domain name rdf of the first element of the RR + * If there are no elements present, NULL is returned + * + * \param[in] rr_list The rr list + * \return dname of the first element, or NULL if the list is empty + */ +ldns_rdf * +ldns_rr_list_owner(const ldns_rr_list *rr_list); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RR_H */ diff --git a/libs/ldns/ldns/rr_functions.h b/libs/ldns/ldns/rr_functions.h new file mode 100644 index 0000000000..635a1256f3 --- /dev/null +++ b/libs/ldns/ldns/rr_functions.h @@ -0,0 +1,259 @@ +/* + * rr_functions.h + * + * the .h file with defs for the per rr + * functions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ +#ifndef LDNS_RR_FUNCTIONS_H +#define LDNS_RR_FUNCTIONS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file + * + * Defines some extra convenience functions for ldns_rr structures + */ + +/* A / AAAA */ +/** + * returns the address of a LDNS_RR_TYPE_A rr + * \param[in] r the resource record + * \return a ldns_rdf* with the address or NULL on failure + */ +ldns_rdf* ldns_rr_a_address(const ldns_rr *r); + +/** + * sets the address of a LDNS_RR_TYPE_A rr + * \param[in] r the rr to use + * \param[in] f the address to set + * \return true on success, false otherwise + */ +bool ldns_rr_a_set_address(ldns_rr *r, ldns_rdf *f); + +/* NS */ +/** + * returns the name of a LDNS_RR_TYPE_NS rr + * \param[in] r the resource record + * \return a ldns_rdf* with the name or NULL on failure + */ +ldns_rdf* ldns_rr_ns_nsdname(const ldns_rr *r); + +/* MX */ +/** + * returns the mx pref. of a LDNS_RR_TYPE_MX rr + * \param[in] r the resource record + * \return a ldns_rdf* with the preference or NULL on failure + */ +ldns_rdf* ldns_rr_mx_preference(const ldns_rr *r); +/** + * returns the mx host of a LDNS_RR_TYPE_MX rr + * \param[in] r the resource record + * \return a ldns_rdf* with the name of the MX host or NULL on failure + */ +ldns_rdf* ldns_rr_mx_exchange(const ldns_rr *r); + +/* RRSIG */ +/** + * returns the type covered of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the resource record + * \return a ldns_rdf* with the type covered or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_typecovered(const ldns_rr *r); +/** + * sets the typecovered of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the typecovered to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_typecovered(ldns_rr *r, ldns_rdf *f); +/** + * returns the algorithm of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the algorithm or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_algorithm(const ldns_rr *r); +/** + * sets the algorithm of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the algorithm to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_algorithm(ldns_rr *r, ldns_rdf *f); +/** + * returns the number of labels of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the number of labels or NULL on failure + */ +ldns_rdf *ldns_rr_rrsig_labels(const ldns_rr *r); +/** + * sets the number of labels of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the number of labels to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_labels(ldns_rr *r, ldns_rdf *f); +/** + * returns the original TTL of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the original TTL or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_origttl(const ldns_rr *r); +/** + * sets the original TTL of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the original TTL to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_origttl(ldns_rr *r, ldns_rdf *f); +/** + * returns the expiration time of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the expiration time or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_expiration(const ldns_rr *r); +/** + * sets the expireation date of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the expireation date to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_expiration(ldns_rr *r, ldns_rdf *f); +/** + * returns the inception time of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the inception time or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_inception(const ldns_rr *r); +/** + * sets the inception date of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the inception date to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_inception(ldns_rr *r, ldns_rdf *f); +/** + * returns the keytag of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the keytag or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_keytag(const ldns_rr *r); +/** + * sets the keytag of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the keytag to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_keytag(ldns_rr *r, ldns_rdf *f); +/** + * returns the signers name of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the signers name or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_signame(const ldns_rr *r); +/** + * sets the signers name of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the signers name to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_signame(ldns_rr *r, ldns_rdf *f); +/** + * returns the signature data of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the signature data or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_sig(const ldns_rr *r); +/** + * sets the signature data of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the signature data to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_sig(ldns_rr *r, ldns_rdf *f); + +/* DNSKEY */ +/** + * returns the flags of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the flags or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_flags(const ldns_rr *r); +/** + * sets the flags of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the flags to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_flags(ldns_rr *r, ldns_rdf *f); +/** + * returns the protocol of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the protocol or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_protocol(const ldns_rr *r); +/** + * sets the protocol of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the protocol to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_protocol(ldns_rr *r, ldns_rdf *f); +/** + * returns the algorithm of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the algorithm or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_algorithm(const ldns_rr *r); +/** + * sets the algorithm of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the algorithm to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_algorithm(ldns_rr *r, ldns_rdf *f); +/** + * returns the key data of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the key data or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_key(const ldns_rr *r); +/** + * sets the key data of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the key data to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_key(ldns_rr *r, ldns_rdf *f); + +/** + * get the length of the keydata in bits + * \param[in] keydata the raw key data + * \param[in] len the length of the keydata + * \param[in] alg the cryptographic algorithm this is a key for + * \return the keysize in bits, or 0 on error + */ +size_t ldns_rr_dnskey_key_size_raw(const unsigned char *keydata, + const size_t len, + const ldns_algorithm alg); + +/** + * get the length of the keydata in bits + * \param[in] key the key rr to use + * \return the keysize in bits + */ +size_t ldns_rr_dnskey_key_size(const ldns_rr *key); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RR_FUNCTIONS_H */ diff --git a/libs/ldns/ldns/sha1.h b/libs/ldns/ldns/sha1.h new file mode 100644 index 0000000000..d5b1082e67 --- /dev/null +++ b/libs/ldns/ldns/sha1.h @@ -0,0 +1,38 @@ +#ifndef LDNS_SHA1_H +#define LDNS_SHA1_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_SHA1_BLOCK_LENGTH 64 +#define LDNS_SHA1_DIGEST_LENGTH 20 + +typedef struct { + uint32_t state[5]; + uint64_t count; + unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]; +} ldns_sha1_ctx; + +void ldns_sha1_init(ldns_sha1_ctx * context); +void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]); +void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len); +void ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA1_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha1(unsigned char *data, unsigned int data_len, unsigned char *digest); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_SHA1_H */ diff --git a/libs/ldns/ldns/sha2.h b/libs/ldns/ldns/sha2.h new file mode 100644 index 0000000000..beb0b6f368 --- /dev/null +++ b/libs/ldns/ldns/sha2.h @@ -0,0 +1,152 @@ +/* + * FILE: sha2.h + * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ + * + * Copyright (c) 2000-2001, Aaron D. Gifford + * All rights reserved. + * + * Modified by Jelte Jansen to fit in ldns, and not clash with any + * system-defined SHA code. + * Changes: + * - Renamed (external) functions and constants to fit ldns style + * - Removed uintXX vs. u_intXX smartness, since ldns needs uintXX + * anyway + * - BYTE ORDER check replaced by simple ifdef as defined or not by + * configure.ac + * - Removed _End and _Data functions + * - Added ldns_shaX(data, len, digest) functions + * + * 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. Neither the name of the copyright holder nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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. + * + * $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ + */ + +#ifndef __LDNS_SHA2_H__ +#define __LDNS_SHA2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Import u_intXX_t size_t type definitions from system headers. You + * may need to change this, or define these things yourself in this + * file. + * + * (include ldns/config.h so HAVE_INTTYPES is defined (or not, depending + * on the system)) + */ +#include + +#ifdef HAVE_INTTYPES_H + +#include + +#endif /* HAVE_INTTYPES_H */ + + +/*** SHA-256/384/512 Various Length Definitions ***********************/ +#define LDNS_SHA256_BLOCK_LENGTH 64 +#define LDNS_SHA256_DIGEST_LENGTH 32 +#define LDNS_SHA256_DIGEST_STRING_LENGTH (LDNS_SHA256_DIGEST_LENGTH * 2 + 1) +#define LDNS_SHA384_BLOCK_LENGTH 128 +#define LDNS_SHA384_DIGEST_LENGTH 48 +#define LDNS_SHA384_DIGEST_STRING_LENGTH (LDNS_SHA384_DIGEST_LENGTH * 2 + 1) +#define LDNS_SHA512_BLOCK_LENGTH 128 +#define LDNS_SHA512_DIGEST_LENGTH 64 +#define LDNS_SHA512_DIGEST_STRING_LENGTH (LDNS_SHA512_DIGEST_LENGTH * 2 + 1) + + +/*** SHA-256/384/512 Context Structures *******************************/ + +typedef struct _ldns_sha256_CTX { + uint32_t state[8]; + uint64_t bitcount; + uint8_t buffer[LDNS_SHA256_BLOCK_LENGTH]; +} ldns_sha256_CTX; +typedef struct _ldns_sha512_CTX { + uint64_t state[8]; + uint64_t bitcount[2]; + uint8_t buffer[LDNS_SHA512_BLOCK_LENGTH]; +} ldns_sha512_CTX; + +typedef ldns_sha512_CTX ldns_sha384_CTX; + + +/*** SHA-256/384/512 Function Prototypes ******************************/ +void ldns_sha256_init(ldns_sha256_CTX *); +void ldns_sha256_update(ldns_sha256_CTX*, const uint8_t*, size_t); +void ldns_sha256_final(uint8_t[LDNS_SHA256_DIGEST_LENGTH], ldns_sha256_CTX*); + +void ldns_sha384_init(ldns_sha384_CTX*); +void ldns_sha384_update(ldns_sha384_CTX*, const uint8_t*, size_t); +void ldns_sha384_final(uint8_t[LDNS_SHA384_DIGEST_LENGTH], ldns_sha384_CTX*); + +void ldns_sha512_init(ldns_sha512_CTX*); +void ldns_sha512_update(ldns_sha512_CTX*, const uint8_t*, size_t); +void ldns_sha512_final(uint8_t[LDNS_SHA512_DIGEST_LENGTH], ldns_sha512_CTX*); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA256_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha256(unsigned char *data, unsigned int data_len, unsigned char *digest); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA384_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha384(unsigned char *data, unsigned int data_len, unsigned char *digest); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA512_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha512(unsigned char *data, unsigned int data_len, unsigned char *digest); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LDNS_SHA2_H__ */ diff --git a/libs/ldns/ldns/str2host.h b/libs/ldns/ldns/str2host.h new file mode 100644 index 0000000000..09416cd225 --- /dev/null +++ b/libs/ldns/ldns/str2host.h @@ -0,0 +1,251 @@ +/** + * str2host.h - conversion from str to the host fmt + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_2HOST_H +#define LDNS_2HOST_H + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file + * + * Defines functions to convert dns data in presentation format or text files + * to internal structures. + */ + +/** + * convert a byte into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] bytestr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr); + +/** + * convert a string to a int16 in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] shortstr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr); + +/** + * convert a strings into a 4 byte int in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] longstr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr); + +/** + * convert a time string to a time value in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] time the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_time(ldns_rdf **rd, const char *time); + +/* convert string with NSEC3 salt to wireformat) + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * return ldns_status + */ +ldns_status ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *nsec3_salt); + +/* convert a time period (think TTL's) to wireformat) + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * return ldns_status + */ +ldns_status ldns_str2rdf_period(ldns_rdf **rd, const char *str); + +/** + * convert str with an A record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_a(ldns_rdf **rd, const char *str); + +/** + * convert the str with an AAAA record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str); + +/** + * convert a string into wireformat (think txt record) + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted (NULL terminated) + * \return ldns_status + */ +ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str); + +/** + * convert str with the apl record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_apl(ldns_rdf **rd, const char *str); + +/** + * convert the string with the b64 data into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_b64(ldns_rdf **rd, const char *str); + +/** + * convert the string with the b32 ext hex data into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str); + +/** + * convert a hex value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_hex(ldns_rdf **rd, const char *str); + +/** + * convert string with nsec into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_nsec(ldns_rdf **rd, const char *str); + +/** + * convert a rrtype into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_type(ldns_rdf **rd, const char *str); + +/** + * convert string with a classname into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_class(ldns_rdf **rd, const char *str); + +/** + * convert an certificate algorithm value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str); + +/** + * convert and algorithm value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_alg(ldns_rdf **rd, const char *str); + +/** + * convert a string with a unknown RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str); + +/** + * convert string with a tsig? RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str); + +/** + * convert string with a protocol service into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_service(ldns_rdf **rd, const char *str); + +/** + * convert a string with a LOC RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_loc(ldns_rdf **rd, const char *str); + +/** + * convert string with a WKS RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_wks(ldns_rdf **rd, const char *str); + +/** + * convert a str with a NSAP RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str); + +/** + * convert a str with a ATMA RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_atma(ldns_rdf **rd, const char *str); + +/** + * convert a str with a IPSECKEY RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str); + +/** + * convert a dname string into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_2HOST_H */ diff --git a/libs/ldns/ldns/tsig.h b/libs/ldns/ldns/tsig.h new file mode 100644 index 0000000000..676045fbb6 --- /dev/null +++ b/libs/ldns/ldns/tsig.h @@ -0,0 +1,101 @@ +/* + * tsig.h -- defines for TSIG [RFC2845] + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + */ + +#ifndef LDNS_TSIG_H +#define LDNS_TSIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file + * + * Defines functions for TSIG usage + */ + + +/** + * Contains credentials for TSIG +*/ +typedef struct ldns_tsig_credentials_struct +{ + char *algorithm; + char *keyname; + char *keydata; + /* XXX More eventually. */ +} ldns_tsig_credentials; + +char *ldns_tsig_algorithm(ldns_tsig_credentials *); +char *ldns_tsig_keyname(ldns_tsig_credentials *); +char *ldns_tsig_keydata(ldns_tsig_credentials *); +char *ldns_tsig_keyname_clone(ldns_tsig_credentials *); +char *ldns_tsig_keydata_clone(ldns_tsig_credentials *); + +/** + * verifies the tsig rr for the given packet and key. + * The wire must be given too because tsig does not sign normalized packets. + * \param[in] pkt the packet to verify + * \param[in] wire needed to verify the mac + * \param[in] wire_size size of wire + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] mac original mac + * \return true if tsig is correct, false if not, or if tsig is not set + */ +bool ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac); + +/** + * verifies the tsig rr for the given packet and key. + * The wire must be given too because tsig does not sign normalized packets. + * \param[in] pkt the packet to verify + * \param[in] wire needed to verify the mac + * \param[in] wire_size size of wire + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] mac original mac + * \param[in] tsig_timers_only must be zero for the first packet and positive for subsequent packets. If zero, all digest + components are used to verify the _mac. If non-zero, only the TSIG timers are used to verify the mac. + * \return true if tsig is correct, false if not, or if tsig is not set + */ +bool ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac, + int tsig_timers_only); + +/** + * creates a tsig rr for the given packet and key. + * \param[in] pkt the packet to sign + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] fudge seconds of error permitted in time signed + * \param[in] algorithm_name the name of the algorithm used + * \param[in] query_mac is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers) + * \return status (OK if success) + */ +ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, + const char *algorithm_name, ldns_rdf *query_mac); + +/** + * creates a tsig rr for the given packet and key. + * \param[in] pkt the packet to sign + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] fudge seconds of error permitted in time signed + * \param[in] algorithm_name the name of the algorithm used + * \param[in] query_mac is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers) + * \param[in] tsig_timers_only must be zero for the first packet and positive for subsequent packets. If zero, all digest + components are used to create the query_mac. If non-zero, only the TSIG timers are used to create the query_mac. + * \return status (OK if success) + */ +ldns_status ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, + const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_TSIG_H */ diff --git a/libs/ldns/ldns/update.h b/libs/ldns/ldns/update.h new file mode 100644 index 0000000000..d3459d325e --- /dev/null +++ b/libs/ldns/ldns/update.h @@ -0,0 +1,115 @@ +/* + * update.h + * + * Functions for RFC 2136 Dynamic Update + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + */ + +/** + * \file + * + * Defines functions to perform UPDATE queries + */ + + +#ifndef LDNS_UPDATE_H +#define LDNS_UPDATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * create an update packet from zone name, class and the rr lists + * \param[in] zone_rdf name of the zone + * \param[in] clas zone class + * \param[in] pr_rrlist list of Prerequisite Section RRs + * \param[in] up_rrlist list of Updates Section RRs + * \param[in] ad_rrlist list of Additional Data Section RRs (currently unused) + * \return the new packet + */ +ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist); + +/** + * add tsig credentials to + * a packet from a resolver + * \param[in] p packet to copy to + * \param[in] r resolver to copy from + * + * \return status wether successfull or not + */ +ldns_status ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r); + +/* access functions */ + +/** + * Get the zo count + * \param[in] p the packet + * \return the zo count + */ +uint16_t ldns_update_zocount(const ldns_pkt *p); +/** + * Get the zo count + * \param[in] p the packet + * \return the pr count + */ +uint16_t ldns_update_prcount(const ldns_pkt *p); +/** + * Get the zo count + * \param[in] p the packet + * \return the up count + */ +uint16_t ldns_update_upcount(const ldns_pkt *p); +/** + * Get the zo count + * \param[in] p the packet + * \return the ad count + */ +uint16_t ldns_update_ad(const ldns_pkt *p); +/** + * Set the zo count + * \param[in] p the packet + * \param[in] c the zo count to set + */ +void ldns_update_set_zo(ldns_pkt *p, uint16_t c); +/** + * Set the pr count + * \param[in] p the packet + * \param[in] c the pr count to set + */ +void ldns_update_set_prcount(ldns_pkt *p, uint16_t c); +/** + * Set the up count + * \param[in] p the packet + * \param[in] c the up count to set + */ +void ldns_update_set_upcount(ldns_pkt *p, uint16_t c); +/** + * Set the ad count + * \param[in] p the packet + * \param[in] c the ad count to set + */ +void ldns_update_set_adcount(ldns_pkt *p, uint16_t c); + +/* soa functions that need to be configured */ +/* + * Not sure if we want to keep these like this, therefore + * not documented + */ +ldns_status ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, ldns_rr_class c, ldns_rdf **mname); +/* + * Not sure if we want to keep these like this, therefore + * not documented + */ +ldns_status ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, ldns_rr_class c, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_UPDATE_H */ diff --git a/libs/ldns/ldns/util.h.in b/libs/ldns/ldns/util.h.in new file mode 100644 index 0000000000..e9af95f673 --- /dev/null +++ b/libs/ldns/ldns/util.h.in @@ -0,0 +1,347 @@ +/* + * util.h + * + * helper function header file + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004 + * + * See the file LICENSE for the license + */ + +#ifndef _UTIL_H +#define _UTIL_H + +@include_inttypes_h@ +@include_systypes_h@ +@include_unistd_h@ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define dprintf(X,Y) fprintf(stderr, (X), (Y)) +/* #define dprintf(X, Y) */ + +#define LDNS_VERSION "@PACKAGE_VERSION@" +#define LDNS_REVISION ((@LDNS_VERSION_MAJOR@<<16)|(@LDNS_VERSION_MINOR@<<8)|(@LDNS_VERSION_MICRO@)) + +/** + * splint static inline workaround + */ +#ifdef S_SPLINT_S +# define INLINE +#else +# ifdef SWIG +# define INLINE static +# else +# define INLINE static inline +# endif +#endif + +/** + * Memory management macros + */ +#define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1) + +#define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type))) + +#define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1) + +#define LDNS_XREALLOC(ptr, type, count) \ + ((type *) realloc((ptr), (count) * sizeof(type))) + +#define LDNS_FREE(ptr) \ + do { free((ptr)); (ptr) = NULL; } while (0) + +#define LDNS_DEP printf("DEPRECATED FUNCTION!\n"); + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE uint16_t +ldns_read_uint16(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohs(*(uint16_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; +#endif +} + +INLINE uint32_t +ldns_read_uint32(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohl(*(uint32_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ( ((uint32_t) p[0] << 24) + | ((uint32_t) p[1] << 16) + | ((uint32_t) p[2] << 8) + | (uint32_t) p[3]); +#endif +} + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE void +ldns_write_uint16(void *dst, uint16_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint16_t *) dst = htons(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 8) & 0xff); + p[1] = (uint8_t) (data & 0xff); +#endif +} + +INLINE void +ldns_write_uint32(void *dst, uint32_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint32_t *) dst = htonl(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 24) & 0xff); + p[1] = (uint8_t) ((data >> 16) & 0xff); + p[2] = (uint8_t) ((data >> 8) & 0xff); + p[3] = (uint8_t) (data & 0xff); +#endif +} + +/* warning. */ +INLINE void +ldns_write_uint64_as_uint48(void *dst, uint64_t data) +{ + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 40) & 0xff); + p[1] = (uint8_t) ((data >> 32) & 0xff); + p[2] = (uint8_t) ((data >> 24) & 0xff); + p[3] = (uint8_t) ((data >> 16) & 0xff); + p[4] = (uint8_t) ((data >> 8) & 0xff); + p[5] = (uint8_t) (data & 0xff); +} + + +/** + * Structure to do a Schwartzian-like transformation, for instance when + * sorting. If you need a transformation on the objects that are sorted, + * you can sue this to store the transformed values, so you do not + * need to do the transformation again for each comparison + */ +struct ldns_schwartzian_compare_struct { + void *original_object; + void *transformed_object; +}; + +/** A general purpose lookup table + * + * Lookup tables are arrays of (id, name) pairs, + * So you can for instance lookup the RCODE 3, which is "NXDOMAIN", + * and vice versa. The lookup tables themselves are defined wherever needed, + * for instance in \ref host2str.c + */ +struct ldns_struct_lookup_table { + int id; + const char *name; +}; +typedef struct ldns_struct_lookup_table ldns_lookup_table; + +/** + * Looks up the table entry by name, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] name what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[], + const char *name); + +/** + * Looks up the table entry by id, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] id what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id); + +/** + * Returns the value of the specified bit + * The bits are counted from left to right, so bit #0 is the + * left most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return + */ +int ldns_get_bit(uint8_t bits[], size_t index); + + +/** + * Returns the value of the specified bit + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return 1 or 0 depending no the bit state + */ +int ldns_get_bit_r(uint8_t bits[], size_t index); + +/** + * sets the specified bit in the specified byte to + * 1 if value is true, 0 if false + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] byte the bit to set the bit in + * \param[in] bit_nr the bit to set (0 <= n <= 7) + * \param[in] value whether to set the bit to 1 or 0 + * \return 1 or 0 depending no the bit state + */ +void ldns_set_bit(uint8_t *byte, int bit_nr, bool value); + +/** + * Returns the value of a to the power of b + * (or 1 of b < 1) + */ +/*@unused@*/ +INLINE long +ldns_power(long a, long b) { + long result = 1; + while (b > 0) { + if (b & 1) { + result *= a; + if (b == 1) { + return result; + } + } + a *= a; + b /= 2; + } + return result; +} + +/** + * Returns the int value of the given (hex) digit + * \param[in] ch the hex char to convert + * \return the converted decimal value + */ +int ldns_hexdigit_to_int(char ch); + +/** + * Returns the char (hex) representation of the given int + * \param[in] ch the int to convert + * \return the converted hex char + */ +char ldns_int_to_hexdigit(int ch); + +/** + * Converts a hex string to binary data + * + * \param[out] data The binary result is placed here. + * At least strlen(str)/2 bytes should be allocated + * \param[in] str The hex string to convert. + * This string should not contain spaces + * \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number + */ +int +ldns_hexstring_to_data(uint8_t *data, const char *str); + +/** + * Show the internal library version + * \return a string with the version in it + */ +const char * ldns_version(void); + +/** + * Convert TM to seconds since epoch (midnight, January 1st, 1970). + * Like timegm(3), which is not always available. + * \param[in] tm a struct tm* with the date + * \return the seconds since epoch + */ +time_t mktime_from_utc(const struct tm *tm); + +/** + * Seed the random function. + * If the file descriptor is specified, the random generator is seeded with + * data from that file. If not, /dev/urandom is used. + * + * applications should call this if they need entropy data within ldns + * If openSSL is available, it is automatically seeded from /dev/urandom + * or /dev/random. + * + * If you need more entropy, or have no openssl available, this function + * MUST be called at the start of the program + * + * If openssl *is* available, this function just adds more entropy + * + * \param[in] fd a file providing entropy data for the seed + * \param[in] size the number of bytes to use as entropy data. If this is 0, + * only the minimal amount is taken (usually 4 bytes) + * \return 0 if seeding succeeds, 1 if it fails + */ +int ldns_init_random(FILE *fd, unsigned int size); + +/** + * Get random number. + * \return random number. + * + */ +uint16_t ldns_get_random(void); + +/** + * Encode data as BubbleBabble + * + * \param[in] data a pointer to data to be encoded + * \param[in] len size the number of bytes of data + * \return a string of BubbleBabble + */ +char *ldns_bubblebabble(uint8_t *data, size_t len); + +#ifndef B32_NTOP +int ldns_b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_ntop + */ +/*@unused@*/ +INLINE size_t ldns_b32_ntop_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize / 5) * 8) - 2) + 2); + return result; +} +#endif /* !B32_NTOP */ +#ifndef B32_PTON +int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_pton + */ +/*@unused@*/ +INLINE size_t ldns_b32_pton_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize) / 8) * 5)); + return result; +} +#endif /* !B32_PTON */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_UTIL_H */ diff --git a/libs/ldns/ldns/wire2host.h b/libs/ldns/ldns/wire2host.h new file mode 100644 index 0000000000..53155b3066 --- /dev/null +++ b/libs/ldns/ldns/wire2host.h @@ -0,0 +1,197 @@ +/* + * wire2host.h - from wire conversion routines + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains functions that translate dns data from the wire format (as sent + * by servers and clients) to the internal structures. + */ + +#ifndef LDNS_WIRE2HOST_H +#define LDNS_WIRE2HOST_H + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* The length of the header */ +#define LDNS_HEADER_SIZE 12 + +/* First octet of flags */ +#define LDNS_RD_MASK 0x01U +#define LDNS_RD_SHIFT 0 +#define LDNS_RD_WIRE(wirebuf) (*(wirebuf+2) & LDNS_RD_MASK) +#define LDNS_RD_SET(wirebuf) (*(wirebuf+2) |= LDNS_RD_MASK) +#define LDNS_RD_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_RD_MASK) + +#define LDNS_TC_MASK 0x02U +#define LDNS_TC_SHIFT 1 +#define LDNS_TC_WIRE(wirebuf) (*(wirebuf+2) & LDNS_TC_MASK) +#define LDNS_TC_SET(wirebuf) (*(wirebuf+2) |= LDNS_TC_MASK) +#define LDNS_TC_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_TC_MASK) + +#define LDNS_AA_MASK 0x04U +#define LDNS_AA_SHIFT 2 +#define LDNS_AA_WIRE(wirebuf) (*(wirebuf+2) & LDNS_AA_MASK) +#define LDNS_AA_SET(wirebuf) (*(wirebuf+2) |= LDNS_AA_MASK) +#define LDNS_AA_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_AA_MASK) + +#define LDNS_OPCODE_MASK 0x78U +#define LDNS_OPCODE_SHIFT 3 +#define LDNS_OPCODE_WIRE(wirebuf) ((*(wirebuf+2) & LDNS_OPCODE_MASK) >> LDNS_OPCODE_SHIFT) +#define LDNS_OPCODE_SET(wirebuf, opcode) \ + (*(wirebuf+2) = ((*(wirebuf+2)) & ~LDNS_OPCODE_MASK) | ((opcode) << LDNS_OPCODE_SHIFT)) + +#define LDNS_QR_MASK 0x80U +#define LDNS_QR_SHIFT 7 +#define LDNS_QR_WIRE(wirebuf) (*(wirebuf+2) & LDNS_QR_MASK) +#define LDNS_QR_SET(wirebuf) (*(wirebuf+2) |= LDNS_QR_MASK) +#define LDNS_QR_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_QR_MASK) + +/* Second octet of flags */ +#define LDNS_RCODE_MASK 0x0fU +#define LDNS_RCODE_SHIFT 0 +#define LDNS_RCODE_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RCODE_MASK) +#define LDNS_RCODE_SET(wirebuf, rcode) \ + (*(wirebuf+3) = ((*(wirebuf+3)) & ~LDNS_RCODE_MASK) | (rcode)) + +#define LDNS_CD_MASK 0x10U +#define LDNS_CD_SHIFT 4 +#define LDNS_CD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_CD_MASK) +#define LDNS_CD_SET(wirebuf) (*(wirebuf+3) |= LDNS_CD_MASK) +#define LDNS_CD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_CD_MASK) + +#define LDNS_AD_MASK 0x20U +#define LDNS_AD_SHIFT 5 +#define LDNS_AD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_AD_MASK) +#define LDNS_AD_SET(wirebuf) (*(wirebuf+3) |= LDNS_AD_MASK) +#define LDNS_AD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_AD_MASK) + +#define LDNS_Z_MASK 0x40U +#define LDNS_Z_SHIFT 6 +#define LDNS_Z_WIRE(wirebuf) (*(wirebuf+3) & LDNS_Z_MASK) +#define LDNS_Z_SET(wirebuf) (*(wirebuf+3) |= LDNS_Z_MASK) +#define LDNS_Z_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_Z_MASK) + +#define LDNS_RA_MASK 0x80U +#define LDNS_RA_SHIFT 7 +#define LDNS_RA_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RA_MASK) +#define LDNS_RA_SET(wirebuf) (*(wirebuf+3) |= LDNS_RA_MASK) +#define LDNS_RA_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_RA_MASK) + +/* Query ID */ +#define LDNS_ID_WIRE(wirebuf) (ldns_read_uint16(wirebuf)) +#define LDNS_ID_SET(wirebuf, id) (ldns_write_uint16(wirebuf, id)) + +/* Counter of the question section */ +#define LDNS_QDCOUNT_OFF 4 +/* +#define QDCOUNT(wirebuf) (ntohs(*(uint16_t *)(wirebuf+QDCOUNT_OFF))) +*/ +#define LDNS_QDCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_QDCOUNT_OFF)) + +/* Counter of the answer section */ +#define LDNS_ANCOUNT_OFF 6 +#define LDNS_ANCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ANCOUNT_OFF)) + +/* Counter of the authority section */ +#define LDNS_NSCOUNT_OFF 8 +#define LDNS_NSCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_NSCOUNT_OFF)) + +/* Counter of the additional section */ +#define LDNS_ARCOUNT_OFF 10 +#define LDNS_ARCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF)) + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS packet. + * This function will initialize and allocate memory space for the packet + * structure. + * + * \param[in] packet pointer to the structure to hold the packet + * \param[in] data pointer to the buffer with the data + * \param[in] len the length of the data buffer (in bytes) + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t len); + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS packet. + * This function will initialize and allocate memory space for the packet + * structure. + * + * \param[in] packet pointer to the structure to hold the packet + * \param[in] buffer the buffer with the data + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer); + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS + * dname rdata field. This function will initialize and allocate memory + * space for the dname structure. The length of the wiredata of this rdf + * is added to the *pos value. + * + * \param[in] dname pointer to the structure to hold the rdata value + * \param[in] wire pointer to the buffer with the data + * \param[in] max the length of the data buffer (in bytes) + * \param[in] pos the position of the rdf in the buffer (ie. the number of bytes + * from the start of the buffer) + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos); + +/** + * converts the data on the uint8_t bytearray (in wire format) to DNS + * rdata fields, and adds them to the list of rdfs of the given rr. + * This function will initialize and allocate memory space for the dname + * structures. + * The length of the wiredata of these rdfs is added to the *pos value. + * + * All rdfs belonging to the RR are read; the rr should have no rdfs + * yet. An error is returned if the format cannot be parsed. + * + * \param[in] rr pointer to the ldns_rr structure to hold the rdata value + * \param[in] wire pointer to the buffer with the data + * \param[in] max the length of the data buffer (in bytes) + * \param[in] pos the position of the rdf in the buffer (ie. the number of bytes + * from the start of the buffer) + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos); + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS + * resource record. + * This function will initialize and allocate memory space for the rr + * structure. + * The length of the wiredata of this rr is added to the *pos value. + * + * \param[in] rr pointer to the structure to hold the rdata value + * \param[in] wire pointer to the buffer with the data + * \param[in] max the length of the data buffer (in bytes) + * \param[in] pos the position of the rr in the buffer (ie. the number of bytes + * from the start of the buffer) + * \param[in] section the section in the packet the rr is meant for + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_WIRE2HOST_H */ diff --git a/libs/ldns/ldns/zone.h b/libs/ldns/ldns/zone.h new file mode 100644 index 0000000000..a683ea87e0 --- /dev/null +++ b/libs/ldns/ldns/zone.h @@ -0,0 +1,175 @@ +/** + * zone.h + * + * zone definitions + * - what is it + * - get_glue function + * - search etc + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Defines the ldns_zone structure and functions to manipulate it. + */ + + +#ifndef LDNS_ZONE_H +#define LDNS_ZONE_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * DNS Zone + * + * A list of RR's with some + * extra information which comes from the SOA RR + * Note: nothing has been done to make this efficient (yet). + */ +struct ldns_struct_zone +{ + /** the soa defines a zone */ + ldns_rr *_soa; + /* basicly a zone is a list of rr's */ + ldns_rr_list *_rrs; + /* we could change this to be a b-tree etc etc todo */ +}; +typedef struct ldns_struct_zone ldns_zone; + +/** + * create a new ldns_zone structure + * \return a pointer to a ldns_zone structure + */ +ldns_zone * ldns_zone_new(void); + +/** + * Return the soa record of a zone + * \param[in] z the zone to read from + * \return the soa record in the zone + */ +ldns_rr * ldns_zone_soa(const ldns_zone *z); + +/** + * Returns the number of resource records in the zone, NOT counting the SOA record + * \param[in] z the zone to read from + * \return the number of rr's in the zone + */ +size_t ldns_zone_rr_count(const ldns_zone *z); + +/** + * Set the zone's soa record + * \param[in] z the zone to put the new soa in + * \param[in] soa the soa to set + */ +void ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa); + +/** + * Get a list of a zone's content. Note that the SOA + * isn't included in this list. You need to get the + * with ldns_zone_soa. + * \param[in] z the zone to read from + * \return the rrs from this zone + */ +ldns_rr_list * ldns_zone_rrs(const ldns_zone *z); + +/** + * Set the zone's contents + * \param[in] z the zone to put the new soa in + * \param[in] rrlist the rrlist to use + */ +void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist); + +/** + * push an rrlist to a zone structure. This function use pointer + * copying, so the rr_list structure inside z is modified! + * \param[in] z the zone to add to + * \param[in] list the list to add + * \return a true on succes otherwise falsed + */ +bool ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list); + +/** + * push an single rr to a zone structure. This function use pointer + * copying, so the rr_list structure inside z is modified! + * \param[in] z the zone to add to + * \param[in] rr the rr to add + * \return a true on succes otherwise falsed + */ +bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr); + +/** + * Retrieve all resource records from the zone that are glue + * records. The resulting list does are pointer references + * to the zone's data. + * + * Due to the current zone implementation (as a list of rr's), this + * function is extremely slow. Another (probably better) way to do this + * is to use an ldns_dnssec_zone structure and the mark_glue function + * + * \param[in] z the zone to look for glue + * \return the rr_list with the glue + */ +ldns_rr_list *ldns_zone_glue_rr_list(const ldns_zone *z); + +/** + * Create a new zone from a file + * \param[out] z the new zone + * \param[in] *fp the filepointer to use + * \param[in] *origin the zones' origin + * \param[in] ttl default ttl to use + * \param[in] c default class to use (IN) + * + * \return ldns_status mesg with an error or LDNS_STATUS_OK + */ +ldns_status ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c); + +/** + * Create a new zone from a file, keep track of the line numbering + * \param[out] z the new zone + * \param[in] *fp the filepointer to use + * \param[in] *origin the zones' origin + * \param[in] ttl default ttl to use + * \param[in] c default class to use (IN) + * \param[out] line_nr used for error msg, to get to the line number + * + * \return ldns_status mesg with an error or LDNS_STATUS_OK + */ +ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c, int *line_nr); + +/** + * Frees the allocated memory for the zone, and the rr_list structure in it + * \param[in] zone the zone to free + */ +void ldns_zone_free(ldns_zone *zone); + +/** + * Frees the allocated memory for the zone, the soa rr in it, + * and the rr_list structure in it, including the rr's in that. etc. + * \param[in] zone the zone to free + */ +void ldns_zone_deep_free(ldns_zone *zone); + +/** + * Sort the rrs in a zone, with the current impl. this is slow + * \param[in] zone the zone to sort + */ +void ldns_zone_sort(ldns_zone *zone); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_ZONE_H */ diff --git a/libs/ldns/ldns_symbols.def b/libs/ldns/ldns_symbols.def new file mode 100644 index 0000000000..7b80bf6952 --- /dev/null +++ b/libs/ldns/ldns_symbols.def @@ -0,0 +1,733 @@ +ldns_algorithm2buffer_str +ldns_algorithms +ldns_axfr_complete +ldns_axfr_last_pkt +ldns_axfr_next +ldns_axfr_start +ldns_b32_ntop +ldns_b32_ntop_ar +ldns_b32_ntop_extended_hex +ldns_b32_pton +ldns_b32_pton_ar +ldns_b32_pton_extended_hex +ldns_b64_ntop +ldns_b64_pton +ldns_bgetc +ldns_bget_keyword_data +ldns_bget_token +ldns_bskipc +ldns_bskipcs +ldns_bubblebabble +ldns_buffer2pkt_wire +ldns_buffer2str +ldns_buffer_copy +ldns_buffer_export +ldns_buffer_free +ldns_buffer_new +ldns_buffer_new_frm_data +ldns_buffer_printf +ldns_buffer_reserve +ldns_buffer_set_capacity +ldns_calc_keytag +ldns_calc_keytag_raw +ldns_cert_algorithm2buffer_str +ldns_cert_algorithms +ldns_convert_ecdsa_rrsig_asn12rdf +ldns_convert_ecdsa_rrsig_rdf2asn1 +ldns_convert_dsa_rrsig_asn12rdf +ldns_convert_dsa_rrsig_rdf2asn1 +ldns_create_empty_rrsig +ldns_create_nsec +ldns_create_nsec3 +ldns_directive_types +ldns_dname2buffer_wire +ldns_dname2canonical +ldns_dname_cat +ldns_dname_cat_clone +ldns_dname_clone_from +ldns_dname_compare +ldns_dname_compare_v +ldns_dname_interval +ldns_dname_is_subdomain +ldns_dname_is_wildcard +ldns_dname_label +ldns_dname_label_count +ldns_dname_left_chop +ldns_dname_match_wildcard +ldns_dname_new +ldns_dname_new_frm_data +ldns_dname_new_frm_str +ldns_dname_reverse +ldns_dname_str_absolute +ldns_dnssec_build_data_chain +ldns_dnssec_build_data_chain_nokeyname +ldns_dnssec_chain_nsec3_list +ldns_dnssec_create_nsec +ldns_dnssec_create_nsec3 +ldns_dnssec_create_nsec_bitmap +ldns_dnssec_data_chain_deep_free +ldns_dnssec_data_chain_free +ldns_dnssec_data_chain_new +ldns_dnssec_data_chain_print +ldns_dnssec_default_add_to_signatures +ldns_dnssec_default_delete_signatures +ldns_dnssec_default_leave_signatures +ldns_dnssec_default_replace_signatures +ldns_dnssec_derive_trust_tree +ldns_dnssec_derive_trust_tree_dnskey_rrset +ldns_dnssec_derive_trust_tree_ds_rrset +ldns_dnssec_derive_trust_tree_normal_rrset +ldns_dnssec_derive_trust_tree_no_sig +ldns_dnssec_get_dnskey_for_rrsig +ldns_dnssec_get_rrsig_for_name_and_type +ldns_dnssec_name_add_rr +ldns_dnssec_name_cmp +ldns_dnssec_name_deep_free +ldns_dnssec_name_find_rrset +ldns_dnssec_name_free +ldns_dnssec_name_name +ldns_dnssec_name_new +ldns_dnssec_name_new_frm_rr +ldns_dnssec_name_node_deep_free +ldns_dnssec_name_node_free +ldns_dnssec_name_node_next_nonglue +ldns_dnssec_name_nsec +ldns_dnssec_name_print +ldns_dnssec_name_print_soa +ldns_dnssec_name_set_name +ldns_dnssec_name_set_nsec +ldns_dnssec_nsec3_closest_encloser +ldns_dnssec_pkt_get_rrsigs_for_name_and_type +ldns_dnssec_pkt_get_rrsigs_for_type +ldns_dnssec_pkt_has_rrsigs +ldns_dnssec_remove_signatures +ldns_dnssec_rrs_add_rr +ldns_dnssec_rrs_deep_free +ldns_dnssec_rrsets_add_rr +ldns_dnssec_rrsets_contains_type +ldns_dnssec_rrsets_deep_free +ldns_dnssec_rrsets_free +ldns_dnssec_rrsets_new +ldns_dnssec_rrsets_new_frm_rr +ldns_dnssec_rrsets_print +ldns_dnssec_rrsets_print_soa +ldns_dnssec_rrsets_set_type +ldns_dnssec_rrsets_type +ldns_dnssec_rrs_free +ldns_dnssec_rrs_new +ldns_dnssec_rrs_print +ldns_dnssec_trust_tree_add_parent +ldns_dnssec_trust_tree_contains_keys +ldns_dnssec_trust_tree_depth +ldns_dnssec_trust_tree_free +ldns_dnssec_trust_tree_new +ldns_dnssec_trust_tree_print +ldns_dnssec_trust_tree_print_sm +ldns_dnssec_verify_denial +ldns_dnssec_verify_denial_nsec3 +ldns_dnssec_zone_add_empty_nonterminals +ldns_dnssec_zone_add_rr +ldns_dnssec_zone_create_nsec3s +ldns_dnssec_zone_create_nsecs +ldns_dnssec_zone_create_rrsigs +ldns_dnssec_zone_create_rrsigs_flg +ldns_dnssec_zone_deep_free +ldns_dnssec_zone_find_nsec3_original +ldns_dnssec_zone_find_rrset +ldns_dnssec_zone_free +ldns_dnssec_zone_mark_glue +ldns_dnssec_zone_names_print +ldns_dnssec_zone_new +ldns_dnssec_zone_print +ldns_dnssec_zone_sign +ldns_dnssec_zone_sign_flg +ldns_dnssec_zone_sign_nsec3 +ldns_dnssec_zone_sign_nsec3_flg +ldns_ecdsa2pkey_raw +ldns_edns_flags +ldns_error_str +ldns_fetch_valid_domain_keys +ldns_fget_keyword_data +ldns_fget_keyword_data_l +ldns_fget_token +ldns_fget_token_l +ldns_fskipc +ldns_fskipcs +ldns_fskipcs_l +ldns_getaddrinfo +ldns_get_bit +ldns_get_bit_r +ldns_get_errorstr_by_id +ldns_get_random +ldns_get_rr_class_by_name +ldns_get_rr_list_addr_by_name +ldns_get_rr_list_hosts_frm_file +ldns_get_rr_list_hosts_frm_fp +ldns_get_rr_list_hosts_frm_fp_l +ldns_get_rr_list_name_by_addr +ldns_get_rr_type_by_name +ldns_get_signing_algorithm_by_name +ldns_gost2pkey_raw +ldns_digest_evp +ldns_key_EVP_load_gost_id +ldns_key_EVP_unload_gost +ldns_hexdigit_to_int +ldns_hexstring_to_data +ldns_init_random +ldns_int_to_hexdigit +ldns_is_rrset +ldns_key2buffer_str +ldns_key2rr +ldns_key2str +ldns_key_algo_supported +ldns_key_algorithm +ldns_key_buf2dsa +ldns_key_buf2dsa_raw +ldns_key_buf2rsa +ldns_key_buf2rsa_raw +ldns_key_deep_free +ldns_key_dsa_key +ldns_key_evp_key +ldns_key_expiration +ldns_key_external_key +ldns_key_flags +ldns_key_free +ldns_key_get_file_base_name +ldns_key_hmac_key +ldns_key_hmac_size +ldns_key_inception +ldns_key_keytag +ldns_key_list_free +ldns_key_list_key +ldns_key_list_key_count +ldns_key_list_new +ldns_key_list_pop_key +ldns_key_list_push_key +ldns_key_list_set_key_count +ldns_key_list_set_use +ldns_key_new +ldns_key_new_frm_algorithm +ldns_key_new_frm_engine +ldns_key_new_frm_fp +ldns_key_new_frm_fp_dsa +ldns_key_new_frm_fp_dsa_l +ldns_key_new_frm_fp_hmac +ldns_key_new_frm_fp_hmac_l +ldns_key_new_frm_fp_l +ldns_key_new_frm_fp_rsa +ldns_key_new_frm_fp_rsa_l +ldns_key_origttl +ldns_key_print +ldns_key_pubkey_owner +ldns_key_rr2ds +ldns_key_rsa_key +ldns_key_set_algorithm +ldns_key_set_dsa_key +ldns_key_set_evp_key +ldns_key_set_expiration +ldns_key_set_external_key +ldns_key_set_flags +ldns_key_set_hmac_key +ldns_key_set_hmac_size +ldns_key_set_inception +ldns_key_set_keytag +ldns_key_set_origttl +ldns_key_set_pubkey_owner +ldns_key_set_rsa_key +ldns_key_set_use +ldns_key_use +ldns_lookup_by_id +ldns_lookup_by_name +ldns_native2rdf_int16 +ldns_native2rdf_int16_data +ldns_native2rdf_int32 +ldns_native2rdf_int8 +ldns_nsec3_add_param_rdfs +ldns_nsec3_algorithm +ldns_nsec3_bitmap +ldns_nsec3_flags +ldns_nsec3_hash_name +ldns_nsec3_hash_name_frm_nsec3 +ldns_nsec3_iterations +ldns_nsec3_next_owner +ldns_nsec3_optout +ldns_nsec3_salt +ldns_nsec3_salt_data +ldns_nsec3_salt_length +ldns_nsec_bitmap_covers_type +ldns_nsec_covers_name +ldns_nsec_get_bitmap +ldns_nsec_type_check +ldns_octet +ldns_opcodes +ldns_pkt2buffer_str +ldns_pkt2buffer_wire +ldns_pkt2str +ldns_pkt2wire +ldns_pkt_aa +ldns_pkt_ad +ldns_pkt_additional +ldns_pkt_algorithm2str +ldns_pkt_all +ldns_pkt_all_noquestion +ldns_pkt_ancount +ldns_pkt_answer +ldns_pkt_answerfrom +ldns_pkt_arcount +ldns_pkt_authority +ldns_pkt_cd +ldns_pkt_cert_algorithm2str +ldns_pkt_clone +ldns_pkt_edns +ldns_pkt_edns_data +ldns_pkt_edns_do +ldns_pkt_edns_extended_rcode +ldns_pkt_edns_udp_size +ldns_pkt_edns_version +ldns_pkt_edns_z +ldns_pkt_empty +ldns_pkt_free +ldns_pkt_get_opcode +ldns_pkt_get_rcode +ldns_pkt_get_section_clone +ldns_pktheader2buffer_str +ldns_pkt_id +ldns_pkt_new +ldns_pkt_nscount +ldns_pkt_opcode2buffer_str +ldns_pkt_opcode2str +ldns_pkt_print +ldns_pkt_push_rr +ldns_pkt_push_rr_list +ldns_pkt_qdcount +ldns_pkt_qr +ldns_pkt_query_new +ldns_pkt_query_new_frm_str +ldns_pkt_querytime +ldns_pkt_question +ldns_pkt_ra +ldns_pkt_rcode2buffer_str +ldns_pkt_rcode2str +ldns_pkt_rd +ldns_pkt_reply_type +ldns_pkt_rr +ldns_pkt_rr_list_by_name +ldns_pkt_rr_list_by_name_and_type +ldns_pkt_rr_list_by_type +ldns_pkt_safe_push_rr +ldns_pkt_safe_push_rr_list +ldns_pkt_section_count +ldns_pkt_set_aa +ldns_pkt_set_ad +ldns_pkt_set_additional +ldns_pkt_set_ancount +ldns_pkt_set_answer +ldns_pkt_set_answerfrom +ldns_pkt_set_arcount +ldns_pkt_set_authority +ldns_pkt_set_cd +ldns_pkt_set_edns_data +ldns_pkt_set_edns_do +ldns_pkt_set_edns_extended_rcode +ldns_pkt_set_edns_udp_size +ldns_pkt_set_edns_version +ldns_pkt_set_edns_z +ldns_pkt_set_flags +ldns_pkt_set_id +ldns_pkt_set_nscount +ldns_pkt_set_opcode +ldns_pkt_set_qdcount +ldns_pkt_set_qr +ldns_pkt_set_querytime +ldns_pkt_set_question +ldns_pkt_set_ra +ldns_pkt_set_random_id +ldns_pkt_set_rcode +ldns_pkt_set_rd +ldns_pkt_set_section_count +ldns_pkt_set_size +ldns_pkt_set_tc +ldns_pkt_set_timestamp +ldns_pkt_set_tsig +ldns_pkt_size +ldns_pkt_tc +ldns_pkt_timestamp +ldns_pkt_tsig +ldns_pkt_tsig_sign +ldns_pkt_tsig_sign_next +ldns_pkt_tsig_verify +ldns_pkt_tsig_verify_next +ldns_pkt_verify +ldns_print_rr_rdf +ldns_rbtree_create +ldns_rbtree_delete +ldns_rbtree_find_less_equal +ldns_rbtree_first +ldns_rbtree_free +ldns_rbtree_init +ldns_rbtree_insert +ldns_rbtree_insert_vref +ldns_rbtree_join +ldns_rbtree_last +ldns_rbtree_next +ldns_rbtree_null_node +ldns_rbtree_previous +ldns_rbtree_search +ldns_rbtree_split +ldns_rcodes +ldns_rdf2buffer_str +ldns_rdf2buffer_str_a +ldns_rdf2buffer_str_aaaa +ldns_rdf2buffer_str_alg +ldns_rdf2buffer_str_apl +ldns_rdf2buffer_str_b32_ext +ldns_rdf2buffer_str_b64 +ldns_rdf2buffer_str_cert_alg +ldns_rdf2buffer_str_class +ldns_rdf2buffer_str_dname +ldns_rdf2buffer_str_hex +ldns_rdf2buffer_str_int16 +ldns_rdf2buffer_str_int16_data +ldns_rdf2buffer_str_int32 +ldns_rdf2buffer_str_int8 +ldns_rdf2buffer_str_ipseckey +ldns_rdf2buffer_str_loc +ldns_rdf2buffer_str_nsap +ldns_rdf2buffer_str_nsec +ldns_rdf2buffer_str_nsec3_salt +ldns_rdf2buffer_str_period +ldns_rdf2buffer_str_str +ldns_rdf2buffer_str_time +ldns_rdf2buffer_str_tsig +ldns_rdf2buffer_str_tsigtime +ldns_rdf2buffer_str_type +ldns_rdf2buffer_str_unknown +ldns_rdf2buffer_str_wks +ldns_rdf2buffer_wire +ldns_rdf2buffer_wire_canonical +ldns_rdf2native_int16 +ldns_rdf2native_int32 +ldns_rdf2native_int8 +ldns_rdf2native_sockaddr_storage +ldns_rdf2native_time_t +ldns_rdf2rr_type +ldns_rdf2str +ldns_rdf2wire +ldns_rdf_address_reverse +ldns_rdf_clone +ldns_rdf_compare +ldns_rdf_data +ldns_rdf_deep_free +ldns_rdf_free +ldns_rdf_get_type +ldns_rdf_new +ldns_rdf_new_frm_data +ldns_rdf_new_frm_fp +ldns_rdf_new_frm_fp_l +ldns_rdf_new_frm_str +ldns_rdf_print +ldns_rdf_set_data +ldns_rdf_set_size +ldns_rdf_set_type +ldns_rdf_size +ldns_read_anchor_file +ldns_resolver_debug +ldns_resolver_dec_nameserver_count +ldns_resolver_deep_free +ldns_resolver_defnames +ldns_resolver_dnsrch +ldns_resolver_dnssec +ldns_resolver_dnssec_anchors +ldns_resolver_dnssec_cd +ldns_resolver_domain +ldns_resolver_edns_udp_size +ldns_resolver_fail +ldns_resolver_fallback +ldns_resolver_free +ldns_resolver_igntc +ldns_resolver_incr_nameserver_count +ldns_resolver_ip6 +ldns_resolver_nameserver_count +ldns_resolver_nameserver_rtt +ldns_resolver_nameservers +ldns_resolver_nameservers_randomize +ldns_resolver_new +ldns_resolver_new_frm_file +ldns_resolver_new_frm_fp +ldns_resolver_new_frm_fp_l +ldns_resolver_pop_nameserver +ldns_resolver_port +ldns_resolver_prepare_query_pkt +ldns_resolver_print +ldns_resolver_push_dnssec_anchor +ldns_resolver_push_nameserver +ldns_resolver_push_nameserver_rr +ldns_resolver_push_nameserver_rr_list +ldns_resolver_push_searchlist +ldns_resolver_query +ldns_resolver_random +ldns_resolver_recursive +ldns_resolver_retrans +ldns_resolver_retry +ldns_resolver_rtt +ldns_resolver_search +ldns_resolver_searchlist +ldns_resolver_searchlist_count +ldns_resolver_send +ldns_resolver_send_pkt +ldns_resolver_set_debug +ldns_resolver_set_defnames +ldns_resolver_set_dnsrch +ldns_resolver_set_dnssec +ldns_resolver_set_dnssec_anchors +ldns_resolver_set_dnssec_cd +ldns_resolver_set_domain +ldns_resolver_set_edns_udp_size +ldns_resolver_set_fail +ldns_resolver_set_fallback +ldns_resolver_set_igntc +ldns_resolver_set_ip6 +ldns_resolver_set_nameserver_count +ldns_resolver_set_nameserver_rtt +ldns_resolver_set_nameservers +ldns_resolver_set_port +ldns_resolver_set_random +ldns_resolver_set_recursive +ldns_resolver_set_retrans +ldns_resolver_set_retry +ldns_resolver_set_rtt +ldns_resolver_set_searchlist_count +ldns_resolver_set_timeout +ldns_resolver_set_tsig_algorithm +ldns_resolver_set_tsig_keydata +ldns_resolver_set_tsig_keyname +ldns_resolver_set_usevc +ldns_resolver_timeout +ldns_resolver_trusted_key +ldns_resolver_tsig_algorithm +ldns_resolver_tsig_keydata +ldns_resolver_tsig_keyname +ldns_resolver_usevc +ldns_rr2buffer_str +ldns_rr2buffer_wire +ldns_rr2buffer_wire_canonical +ldns_rr2canonical +ldns_rr2str +ldns_rr2wire +ldns_rr_a_address +ldns_rr_a_set_address +ldns_rr_class2buffer_str +ldns_rr_class2str +ldns_rr_classes +ldns_rr_clone +ldns_rr_compare +ldns_rr_compare_ds +ldns_rr_compare_no_rdata +ldns_rr_compare_wire +ldns_rr_descript +ldns_rr_descriptor_field_type +ldns_rr_descriptor_maximum +ldns_rr_descriptor_minimum +ldns_rr_dnskey_algorithm +ldns_rr_dnskey_flags +ldns_rr_dnskey_key +ldns_rr_dnskey_key_size +ldns_rr_dnskey_key_size_raw +ldns_rr_dnskey_protocol +ldns_rr_dnskey_set_algorithm +ldns_rr_dnskey_set_flags +ldns_rr_dnskey_set_key +ldns_rr_dnskey_set_protocol +ldns_rr_free +ldns_rr_get_class +ldns_rr_get_type +ldns_rr_label_count +ldns_rr_list2buffer_str +ldns_rr_list2buffer_wire +ldns_rr_list2canonical +ldns_rr_list2str +ldns_rr_list_cat +ldns_rr_list_cat_clone +ldns_rr_list_clone +ldns_rr_list_compare +ldns_rr_list_contains_rr +ldns_rr_list_deep_free +ldns_rr_list_free +ldns_rr_list_new +ldns_rr_list_owner +ldns_rr_list_pop_rr +ldns_rr_list_pop_rr_list +ldns_rr_list_pop_rrset +ldns_rr_list_print +ldns_rr_list_push_rr +ldns_rr_list_push_rr_list +ldns_rr_list_rr +ldns_rr_list_rr_count +ldns_rr_list_set_rr +ldns_rr_list_set_rr_count +ldns_rr_list_sort +ldns_rr_list_sort_nsec3 +ldns_rr_list_subtype_by_rdf +ldns_rr_list_type +ldns_rr_mx_exchange +ldns_rr_mx_preference +ldns_rr_new +ldns_rr_new_frm_fp +ldns_rr_new_frm_fp_l +ldns_rr_new_frm_str +ldns_rr_new_frm_type +ldns_rr_new_question_frm_str +ldns_rr_ns_nsdname +ldns_rr_owner +ldns_rr_pop_rdf +ldns_rr_print +ldns_rr_push_rdf +ldns_rr_rdata2buffer_wire +ldns_rr_rd_count +ldns_rr_rdf +ldns_rr_rrsig_algorithm +ldns_rr_rrsig_expiration +ldns_rr_rrsig_inception +ldns_rr_rrsig_keytag +ldns_rr_rrsig_labels +ldns_rr_rrsig_origttl +ldns_rr_rrsig_set_algorithm +ldns_rr_rrsig_set_expiration +ldns_rr_rrsig_set_inception +ldns_rr_rrsig_set_keytag +ldns_rr_rrsig_set_labels +ldns_rr_rrsig_set_origttl +ldns_rr_rrsig_set_sig +ldns_rr_rrsig_set_signame +ldns_rr_rrsig_set_typecovered +ldns_rr_rrsig_sig +ldns_rr_rrsig_signame +ldns_rr_rrsig_typecovered +ldns_rr_set_class +ldns_rr_set_owner +ldns_rr_set_pop_rr +ldns_rr_set_push_rr +ldns_rr_set_rd_count +ldns_rr_set_rdf +ldns_rr_set_ttl +ldns_rr_set_type +ldns_rrsig2buffer_wire +ldns_rr_ttl +ldns_rr_type2buffer_str +ldns_rr_type2str +ldns_rr_uncompressed_size +ldns_send +ldns_send_buffer +ldns_set_bit +ldns_sha1 +ldns_sha1_final +ldns_sha1_init +ldns_sha1_transform +ldns_sha1_update +ldns_signing_algorithms +ldns_sign_public +ldns_sign_public_buffer +ldns_sign_public_dsa +ldns_sign_public_evp +ldns_sign_public_rsamd5 +ldns_sign_public_rsasha1 +ldns_sockaddr_storage2rdf +ldns_str2period +ldns_str2rdf_a +ldns_str2rdf_aaaa +ldns_str2rdf_alg +ldns_str2rdf_apl +ldns_str2rdf_b32_ext +ldns_str2rdf_b64 +ldns_str2rdf_cert_alg +ldns_str2rdf_class +ldns_str2rdf_dname +ldns_str2rdf_hex +ldns_str2rdf_int16 +ldns_str2rdf_int32 +ldns_str2rdf_int8 +ldns_str2rdf_loc +ldns_str2rdf_nsap +ldns_str2rdf_nsec +ldns_str2rdf_nsec3_salt +ldns_str2rdf_period +ldns_str2rdf_service +ldns_str2rdf_str +ldns_str2rdf_time +ldns_str2rdf_tsig +ldns_str2rdf_type +ldns_str2rdf_unknown +ldns_str2rdf_wks +ldns_tcp_bgsend +ldns_tcp_connect +ldns_tcp_read_wire +ldns_tcp_read_wire_timeout +ldns_tcp_send +ldns_tcp_send_query +ldns_traverse_postorder +ldns_tsig_algorithm +ldns_tsig_keydata +ldns_tsig_keydata_clone +ldns_tsig_keyname +ldns_tsig_keyname_clone +ldns_tsig_prepare_pkt_wire +ldns_udp_bgsend +ldns_udp_connect +ldns_udp_read_wire +ldns_udp_send +ldns_udp_send_query +ldns_update_ad +ldns_update_pkt_new +ldns_update_pkt_tsig_add +ldns_update_prcount +ldns_update_set_adcount +ldns_update_set_prcount +ldns_update_set_upcount +ldns_update_set_zo +ldns_update_soa_mname +ldns_update_soa_zone_mname +ldns_update_upcount +ldns_update_zocount +ldns_validate_domain_dnskey +ldns_validate_domain_ds +ldns_verify +ldns_verify_notime +ldns_verify_rrsig +ldns_verify_rrsig_buffers +ldns_verify_rrsig_buffers_raw +ldns_verify_rrsig_dsa +ldns_verify_rrsig_dsa_raw +ldns_verify_rrsig_evp +ldns_verify_rrsig_evp_raw +ldns_verify_rrsig_keylist +ldns_verify_rrsig_keylist_notime +ldns_verify_rrsig_rsamd5 +ldns_verify_rrsig_rsamd5_raw +ldns_verify_rrsig_rsasha1 +ldns_verify_rrsig_rsasha1_raw +ldns_verify_rrsig_rsasha256_raw +ldns_verify_rrsig_rsasha512_raw +ldns_verify_trusted +ldns_version +ldns_wire2dname +ldns_wire2pkt +ldns_wire2rdf +ldns_wire2rr +ldns_zone_deep_free +ldns_zone_free +ldns_zone_glue_rr_list +ldns_zone_new +ldns_zone_new_frm_fp +ldns_zone_new_frm_fp_l +ldns_zone_print +ldns_zone_push_rr +ldns_zone_push_rr_list +ldns_zone_rr_count +ldns_zone_rrs +ldns_zone_set_rrs +ldns_zone_set_soa +ldns_zone_sign +ldns_zone_sign_nsec3 +ldns_zone_soa +ldns_zone_sort +ldns_zone_strip_glue_rrs diff --git a/libs/ldns/libdns.doxygen b/libs/ldns/libdns.doxygen new file mode 100644 index 0000000000..b81c7362bb --- /dev/null +++ b/libs/ldns/libdns.doxygen @@ -0,0 +1,1130 @@ +# Doxyfile 1.3.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = ldns + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 1.6.7 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of source +# files, where putting all generated files in the same directory would otherwise +# cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is used +# as the annotated text. Otherwise, the brief description is used as-is. If left +# blank, the following values are used ("$name" is automatically replaced with the +# name of the entity): "The $name class" "The $name widget" "The $name file" +# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited +# members of a class in the documentation of that class as if those members were +# ordinary class members. Constructors, destructors and assignment operators of +# the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = NO + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. + +SHOW_DIRECTORIES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "doxygen: $file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = . ldns/ doc/ examples/ldns-mx.c examples/ldns-read-zone.c examples/ldns-signzone.c + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp +# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm + +#FILE_PATTERNS = *.h *.c *.dox +#FILE_PATTERNS = *.h *.dox + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories +# that are symbolic links (a Unix filesystem feature) are excluded from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = examples + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = doc/images + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = ldns_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = doc/header.html + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +#HTML_STYLESHEET = doc/libdns.css + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = YES + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = HAVE_SSL + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse the +# parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. Note that this +# option is superseded by the HAVE_DOT option below. This is only a fallback. It is +# recommended to install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = YES +SOURCE_BROWSER = YES +REFERENCES_RELATION = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/libs/ldns/libdns.vim b/libs/ldns/libdns.vim new file mode 100644 index 0000000000..69ec067150 --- /dev/null +++ b/libs/ldns/libdns.vim @@ -0,0 +1,332 @@ +" Vim syntax file +" Language: C libdns +" Maintainer: miekg +" Last change: 2004-12-15 + +" util.h +syn keyword ldnsMacro LDNS_MALLOC +syn keyword ldnsMacro LDNS_XMALLOC +syn keyword ldnsMacro LDNS_REALLOC +syn keyword ldnsMacro LDNS_XREALLOC +syn keyword ldnsMacro LDNS_FREE +syn keyword ldnsMacro LDNS_DEP + +" ldns/tsig.h +syn keyword ldnsType ldns_tsig_credentials + +" ldns/rdata.h +syn keyword ldnsType ldns_rdf +syn keyword ldnsType ldns_rdf_type +syn keyword ldnsType ldns_hdr +syn keyword ldnsType ldns_status +syn keyword ldnsType ldns_rrset +syn keyword ldnsType ldns_dname +syn keyword ldnsConstant true +syn keyword ldnsConstant false +syn keyword ldnsFunction ldns_rdf_get_type + +syn keyword ldnsConstant LDNS_RDF_TYPE_NONE +syn keyword ldnsConstant LDNS_RDF_TYPE_DNAME +syn keyword ldnsConstant LDNS_RDF_TYPE_INT8 +syn keyword ldnsConstant LDNS_RDF_TYPE_INT16 +syn keyword ldnsConstant LDNS_RDF_TYPE_INT16_DATA +syn keyword ldnsConstant LDNS_RDF_TYPE_INT32 +syn keyword ldnsConstant LDNS_RDF_TYPE_A +syn keyword ldnsConstant LDNS_RDF_TYPE_AAAA +syn keyword ldnsConstant LDNS_RDF_TYPE_STR +syn keyword ldnsConstant LDNS_RDF_TYPE_APL +syn keyword ldnsConstant LDNS_RDF_TYPE_B64 +syn keyword ldnsConstant LDNS_RDF_TYPE_HEX +syn keyword ldnsConstant LDNS_RDF_TYPE_NSEC +syn keyword ldnsConstant LDNS_RDF_TYPE_TYPE +syn keyword ldnsConstant LDNS_RDF_TYPE_CLASS +syn keyword ldnsConstant LDNS_RDF_TYPE_CERT +syn keyword ldnsConstant LDNS_RDF_TYPE_CERT_ALG +syn keyword ldnsConstant LDNS_RDF_TYPE_ALG +syn keyword ldnsConstant LDNS_RDF_TYPE_UNKNOWN +syn keyword ldnsConstant LDNS_RDF_TYPE_TIME +syn keyword ldnsConstant LDNS_RDF_TYPE_PERIOD +syn keyword ldnsConstant LDNS_RDF_TYPE_TSIGTIME +syn keyword ldnsConstant LDNS_RDF_TYPE_SERVICE +syn keyword ldnsConstant LDNS_RDF_TYPE_LOC +syn keyword ldnsConstant LDNS_RDF_TYPE_WKS +syn keyword ldnsConstant LDNS_RDF_TYPE_NSAP +syn keyword ldnsConstant LDNS_RDF_TYPE_IPSECKEY +syn keyword ldnsConstant LDNS_RDF_TYPE_TSIG +syn keyword ldnsConstant LDNS_MAX_RDFLEN +syn keyword ldnsConstant LDNS_RDF_SIZE_BYTE +syn keyword ldnsConstant LDNS_RDF_SIZE_WORD +syn keyword ldnsConstant LDNS_RDF_SIZE_DOUBLEWORD +syn keyword ldnsConstant LDNS_RDF_SIZE_6BYTES +syn keyword ldnsConstant LDNS_RDF_SIZE_16BYTES + +" ldns/ldns.h +syn keyword ldnsConstant LDNS_PORT +syn keyword ldnsConstant LDNS_IP4ADDRLEN +syn keyword ldnsConstant LDNS_IP6ADDRLEN +syn keyword ldnsConstant LDNS_ROOT_LABEL +syn keyword ldnsConstant LDNS_DEFAULT_TTL + +" ldns/packet.h +syn keyword ldnsType ldns_pkt +syn keyword ldnsType ldns_pkt_section +syn keyword ldnsType ldns_pkt_type +syn keyword ldnsType ldns_pkt_opcode +syn keyword ldnsType ldns_pkt_rcode +syn keyword ldnsConstant LDNS_QR +syn keyword ldnsConstant LDNS_AA +syn keyword ldnsConstant LDNS_TC +syn keyword ldnsConstant LDNS_CD +syn keyword ldnsConstant LDNS_RA +syn keyword ldnsConstant LDNS_AD +syn keyword ldnsConstant LDNS_PACKET_QUESTION +syn keyword ldnsConstant LDNS_PACKET_REFERRAL +syn keyword ldnsConstant LDNS_PACKET_ANSWER +syn keyword ldnsConstant LDNS_PACKET_NXDOMAIN +syn keyword ldnsConstant LDNS_PACKET_NODATA +syn keyword ldnsConstant LDNS_PACKET_UNKNOWN +syn keyword ldnsConstant LDNS_SECTION_QUESTION +syn keyword ldnsConstant LDNS_SECTION_ANSWER +syn keyword ldnsConstant LDNS_SECTION_AUTHORITY +syn keyword ldnsConstant LDNS_SECTION_ADDITIONAL +syn keyword ldnsConstant LDNS_SECTION_ANY +syn keyword ldnsConstant LDNS_SECTION_ANY_NOQUESTION +syn keyword ldnsConstant LDNS_MAX_PACKETLEN +syn keyword ldnsConstant LDNS_PACKET_QUERY +syn keyword ldnsConstant LDNS_PACKET_IQUERY +syn keyword ldnsConstant LDNS_PACKET_STATUS +syn keyword ldnsConstant LDNS_PACKET_NOTIFY +syn keyword ldnsConstant LDNS_PACKET_UPDATE + +syn keyword ldnsConstant LDNS_RCODE_NOERROR +syn keyword ldnsConstant LDNS_RCODE_FORMERR +syn keyword ldnsConstant LDNS_RCODE_SERVFAIL +syn keyword ldnsConstant LDNS_RCODE_NXDOMAIN +syn keyword ldnsConstant LDNS_RCODE_NOTIMPL +syn keyword ldnsConstant LDNS_RCODE_REFUSED +syn keyword ldnsConstant LDNS_RCODE_YXDOMAIN +syn keyword ldnsConstant LDNS_RCODE_YXRRSET +syn keyword ldnsConstant LDNS_RCODE_NXRRSET +syn keyword ldnsConstant LDNS_RCODE_NOTAUTH +syn keyword ldnsConstant LDNS_RCODE_NOTZONE + +" dns/error.h +syn keyword ldnsMacro LDNS_STATUS_OK +syn keyword ldnsMacro LDNS_STATUS_EMPTY_LABEL +syn keyword ldnsMacro LDNS_STATUS_LABEL_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_LABEL_UNDERFLOW +syn keyword ldnsMacro LDNS_STATUS_DOMAINNAME_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_DOMAINNAME_UNDERFLOW +syn keyword ldnsMacro LDNS_STATUS_DDD_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_PACKET_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_MEM_ERR +syn keyword ldnsMacro LDNS_STATUS_INTERNAL_ERR +syn keyword ldnsMacro LDNS_STATUS_ERR +syn keyword ldnsMacro LDNS_STATUS_ADDRESS_ERR +syn keyword ldnsMacro LDNS_STATUS_NETWORK_ERR +syn keyword ldnsMacro LDNS_STATUS_NO_NAMESERVERS_ERR +syn keyword ldnsMacro LDNS_STATUS_INVALID_POINTER +syn keyword ldnsMacro LDNS_STATUS_INVALID_INT +syn keyword ldnsMacro LDNS_STATUS_INVALID_IP4 +syn keyword ldnsMacro LDNS_STATUS_INVALID_IP6 +syn keyword ldnsMacro LDNS_STATUS_INVALID_STR +syn keyword ldnsMacro LDNS_STATUS_INVALID_B64 +syn keyword ldnsMacro LDNS_STATUS_INVALID_HEX +syn keyword ldnsMacro LDNS_STATUS_UNKNOWN_INET +syn keyword ldnsMacro LDNS_STATUS_NOT_IMPL +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_UNKNOWN_ALGO +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_VALIDATED +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_BOGUS +syn keyword ldnsMacro LDNS_STATUS_INVALID_INT +syn keyword ldnsMacro LDNS_STATUS_INVALID_TIME +syn keyword ldnsMacro LDNS_STATUS_NETWORK_ERR +syn keyword ldnsMacro LDNS_STATUS_ADDRESS_ERR +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_RRSIG +syn keyword ldnsMacro LDNS_STATUS_NULL +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_DNSKEY +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_SIG_EXPIRED +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_ERR +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_BOGUS +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_ERR +syn keyword ldnsMacro LDNS_STATUS_RES_NO_NS +syn keyword ldnsMacro LDNS_STATUS_RES_QUERY +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_HEADER +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_QUESTION +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_ANSWER +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL +syn keyword ldnsMacro LDNS_STATUS_NO_DATA +syn keyword ldnsMacro LDNS_STATUS_CERT_BAD_ALGORITHM + +" ldns/resolver.h +syn keyword ldnsType ldns_resolver + +" ldns/zone.h +syn keyword ldnsType ldns_zone + +" ldns/rr.h +syn keyword ldnsType ldns_rr_list +syn keyword ldnsType ldns_rr_descriptor +syn keyword ldnsType ldns_rr +syn keyword ldnsType ldns_rr_type +syn keyword ldnsType ldns_rr_class +syn keyword ldnsType ldns_rr_compress + +syn keyword ldnsConstant LDNS_RR_CLASS_IN +syn keyword ldnsConstant LDNS_RR_CLASS_CH +syn keyword ldnsConstant LDNS_RR_CLASS_HS +syn keyword ldnsConstant LDNS_RR_CLASS_NONE +syn keyword ldnsConstant LDNS_RR_CLASS_ANY + +syn keyword ldnsConstant LDNS_RR_TYPE_A +syn keyword ldnsConstant LDNS_RR_TYPE_NS +syn keyword ldnsConstant LDNS_RR_TYPE_MD +syn keyword ldnsConstant LDNS_RR_TYPE_MF +syn keyword ldnsConstant LDNS_RR_TYPE_CNAME +syn keyword ldnsConstant LDNS_RR_TYPE_SOA +syn keyword ldnsConstant LDNS_RR_TYPE_MB +syn keyword ldnsConstant LDNS_RR_TYPE_MG +syn keyword ldnsConstant LDNS_RR_TYPE_MR +syn keyword ldnsConstant LDNS_RR_TYPE_NULL +syn keyword ldnsConstant LDNS_RR_TYPE_WKS +syn keyword ldnsConstant LDNS_RR_TYPE_PTR +syn keyword ldnsConstant LDNS_RR_TYPE_HINFO +syn keyword ldnsConstant LDNS_RR_TYPE_MINFO +syn keyword ldnsConstant LDNS_RR_TYPE_MX +syn keyword ldnsConstant LDNS_RR_TYPE_TXT +syn keyword ldnsConstant LDNS_RR_TYPE_RP +syn keyword ldnsConstant LDNS_RR_TYPE_AFSDB +syn keyword ldnsConstant LDNS_RR_TYPE_X25 +syn keyword ldnsConstant LDNS_RR_TYPE_ISDN +syn keyword ldnsConstant LDNS_RR_TYPE_RT +syn keyword ldnsConstant LDNS_RR_TYPE_NSAP +syn keyword ldnsConstant LDNS_RR_TYPE_SIG +syn keyword ldnsConstant LDNS_RR_TYPE_KEY +syn keyword ldnsConstant LDNS_RR_TYPE_PX +syn keyword ldnsConstant LDNS_RR_TYPE_GPOS +syn keyword ldnsConstant LDNS_RR_TYPE_AAAA +syn keyword ldnsConstant LDNS_RR_TYPE_LOC +syn keyword ldnsConstant LDNS_RR_TYPE_NXT +syn keyword ldnsConstant LDNS_RR_TYPE_SRV +syn keyword ldnsConstant LDNS_RR_TYPE_NAPTR +syn keyword ldnsConstant LDNS_RR_TYPE_KX +syn keyword ldnsConstant LDNS_RR_TYPE_CERT +syn keyword ldnsConstant LDNS_RR_TYPE_DNAME +syn keyword ldnsConstant LDNS_RR_TYPE_OPT +syn keyword ldnsConstant LDNS_RR_TYPE_APL +syn keyword ldnsConstant LDNS_RR_TYPE_DS +syn keyword ldnsConstant LDNS_RR_TYPE_SSHFP +syn keyword ldnsConstant LDNS_RR_TYPE_RRSIG +syn keyword ldnsConstant LDNS_RR_TYPE_NSEC +syn keyword ldnsConstant LDNS_RR_TYPE_DNSKEY +syn keyword ldnsConstant LDNS_RR_TYPE_EID +syn keyword ldnsConstant LDNS_RR_TYPE_NIMLOC +syn keyword ldnsConstant LDNS_RR_TYPE_ATMA +syn keyword ldnsConstant LDNS_RR_TYPE_A6 +syn keyword ldnsConstant LDNS_RR_TYPE_SINK +syn keyword ldnsConstant LDNS_RR_TYPE_IPSECKEY +syn keyword ldnsConstant LDNS_RR_TYPE_UINFO +syn keyword ldnsConstant LDNS_RR_TYPE_UID +syn keyword ldnsConstant LDNS_RR_TYPE_GID +syn keyword ldnsConstant LDNS_RR_TYPE_UNSPEC +syn keyword ldnsConstant LDNS_RR_TYPE_TSIG +syn keyword ldnsConstant LDNS_RR_TYPE_IXFR +syn keyword ldnsConstant LDNS_RR_TYPE_AXFR +syn keyword ldnsConstant LDNS_RR_TYPE_MAILB +syn keyword ldnsConstant LDNS_RR_TYPE_MAILA +syn keyword ldnsConstant LDNS_RR_TYPE_ANY +syn keyword ldnsConstant LDNS_MAX_LABELLEN +syn keyword ldnsConstant LDNS_MAX_DOMAINLEN +syn keyword ldnsConstant LDNS_RR_COMPRESS +syn keyword ldnsConstant LDNS_RR_NO_COMPRESS + +syn keyword ldnsMacro QHEADERSZ +syn keyword ldnsMacro RD_MASK +syn keyword ldnsMacro RD_SHIFT +syn keyword ldnsMacro LDNS_RD +syn keyword ldnsMacro RD_SET +syn keyword ldnsMacro RD_CLR +syn keyword ldnsMacro TC_MASK +syn keyword ldnsMacro TC_SHIFT +syn keyword ldnsMacro LDNS_TC +syn keyword ldnsMacro TC_SET +syn keyword ldnsMacro TC_CLR +syn keyword ldnsMacro AA_MASK +syn keyword ldnsMacro AA_SHIFT +syn keyword ldnsMacro LDNS_AA +syn keyword ldnsMacro AA_SET +syn keyword ldnsMacro AA_CLR +syn keyword ldnsMacro OPCODE_MASK +syn keyword ldnsMacro OPCODE_SHIFT +syn keyword ldnsMacro OPCODE +syn keyword ldnsMacro OPCODE_SET +syn keyword ldnsMacro QR_MASK +syn keyword ldnsMacro QR_SHIFT +syn keyword ldnsMacro LDNS_QR +syn keyword ldnsMacro QR_SET +syn keyword ldnsMacro QR_CLR +syn keyword ldnsMacro RCODE_MASK +syn keyword ldnsMacro RCODE_SHIFT +syn keyword ldnsMacro RCODE +syn keyword ldnsMacro RCODE_SET +syn keyword ldnsMacro CD_MASK +syn keyword ldnsMacro CD_SHIFT +syn keyword ldnsMacro LDNS_CD +syn keyword ldnsMacro CD_SET +syn keyword ldnsMacro CD_CLR +syn keyword ldnsMacro AD_MASK +syn keyword ldnsMacro AD_SHIFT +syn keyword ldnsMacro LDNS_AD +syn keyword ldnsMacro AD_SET +syn keyword ldnsMacro AD_CLR +syn keyword ldnsMacro Z_MASK +syn keyword ldnsMacro Z_SHIFT +syn keyword ldnsMacro LDNS_Z +syn keyword ldnsMacro Z_SET +syn keyword ldnsMacro Z_CLR +syn keyword ldnsMacro RA_MASK +syn keyword ldnsMacro RA_SHIFT +syn keyword ldnsMacro LDNS_RA +syn keyword ldnsMacro RA_SET +syn keyword ldnsMacro RA_CLR +syn keyword ldnsMacro LDNS_ID +syn keyword ldnsMacro QDCOUNT_OFF +syn keyword ldnsMacro QDCOUNT +syn keyword ldnsMacro ANCOUNT_OFF +syn keyword ldnsMacro ANCOUNT +syn keyword ldnsMacro NSCOUNT_OFF +syn keyword ldnsMacro NSCOUNT +syn keyword ldnsMacro ARCOUNT_OFF +syn keyword ldnsMacro ARCOUNT + +" ldns/buffer.h +syn keyword ldnsType ldns_buffer +syn keyword ldnsConstant LDNS_MIN_BUFLEN + +" ldns/host2str.h +syn keyword ldnsType ldns_lookup_table +syn keyword ldnsConstant LDNS_APL_IP4 +syn keyword ldnsConstant LDNS_APL_IP6 + +" ldns/keys.h +syn keyword ldnsType ldns_key +syn keyword ldnsType ldns_key_list +syn keyword ldnsType ldns_signing_algorithm +syn keyword ldnsType ldns_hash + +" ldns/dnssec.h +syn keyword ldnsConstant LDNS_MAX_KEYLEN + +" Default highlighting +command -nargs=+ HiLink hi def link +HiLink ldnsType Type +HiLink ldnsFunction Function +HiLink ldnsMacro Macro +HiLink ldnsConstant Constant +delcommand HiLink diff --git a/libs/ldns/linktest.c b/libs/ldns/linktest.c new file mode 100644 index 0000000000..c21753a53f --- /dev/null +++ b/libs/ldns/linktest.c @@ -0,0 +1,13 @@ + +#include "ldns/config.h" +#include + +int +main(void) +{ + ldns_rr *rr = ldns_rr_new(); + + ldns_rr_free(rr); + return 0; +} + diff --git a/libs/ldns/ltmain.sh b/libs/ldns/ltmain.sh new file mode 100755 index 0000000000..6dfcfd58a9 --- /dev/null +++ b/libs/ldns/ltmain.sh @@ -0,0 +1,9687 @@ + +# libtool (GNU libtool) 2.4 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [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 +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# 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. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4 +TIMESTAMP="" +package_revision=1.3293 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${EGREP="grep -E"} +: ${FGREP="grep -F"} +: ${GREP="grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# 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' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_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 $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + + # FreeBSD-specific: where we install compilers with non-standard names + tag_compilers_CC="*cc cc* *gcc gcc* clang" + tag_compilers_CXX="*c++ c++* *g++ g++* clang++" + base_compiler=`set -- "$@"; echo $1` + + # If $tagname isn't set, then try to infer if the default "CC" tag applies + if test -z "$tagname"; then + for zp in $tag_compilers_CC; do + case $base_compiler in + $zp) tagname="CC"; break;; + esac + done + fi + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + + # FreeBSD-specific: try compilers based on inferred tag + if test -z "$tagname"; then + eval "tag_compilers=\$tag_compilers_${z}" + if test -n "$tag_compilers"; then + for zp in $tag_compilers; do + case $base_compiler in + $zp) tagname=$z; break;; + esac + done + if test -n "$tagname"; then + break + fi + fi + fi + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # 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 "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + 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 $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "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." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # 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 + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + 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." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + 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." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build 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, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [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 + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [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 + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -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-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -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 + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +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: $progname [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." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + 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 + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + 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 $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + 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 the \`-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" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # 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 || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + 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 + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append 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 + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # 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" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + 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/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + 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*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *-*-freebsd*) + # FreeBSD doesn't need this... + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + 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 "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# 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. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED '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 \"\$file\" | $SED '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 \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + 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 "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $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 "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${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\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' + + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # 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 invocation. + # 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 + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_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 + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append 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 + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + 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 + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + deplibs="$deplibs $arg" + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + fi + + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + ;; + esac # linkmode + + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $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" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # 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_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + 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." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + 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 + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + 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 + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # 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 behavior. + 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. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + 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 "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $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" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $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" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + 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 + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + 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." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + 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 + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # 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 + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + 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"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_apped 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" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_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 + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_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 and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${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" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + 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 "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append 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"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + 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"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append 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" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + 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 + func_append 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 + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + 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" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED '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 "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + 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 $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/libs/ldns/net.c b/libs/ldns/net.c new file mode 100644 index 0000000000..bf8766b990 --- /dev/null +++ b/libs/ldns/net.c @@ -0,0 +1,884 @@ +/* + * net.c + * + * Network implementation + * All network related functions are grouped here + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#include +#include +#include + +ldns_status +ldns_send(ldns_pkt **result_packet, ldns_resolver *r, const ldns_pkt *query_pkt) +{ + ldns_buffer *qb; + ldns_status result; + ldns_rdf *tsig_mac = NULL; + + qb = ldns_buffer_new(LDNS_MIN_BUFLEN); + + if (query_pkt && ldns_pkt_tsig(query_pkt)) { + tsig_mac = ldns_rr_rdf(ldns_pkt_tsig(query_pkt), 3); + } + + if (!query_pkt || + ldns_pkt2buffer_wire(qb, query_pkt) != LDNS_STATUS_OK) { + result = LDNS_STATUS_ERR; + } else { + result = ldns_send_buffer(result_packet, r, qb, tsig_mac); + } + + ldns_buffer_free(qb); + + return result; +} + +ldns_status +ldns_send_buffer(ldns_pkt **result, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac) +{ + uint8_t i; + + struct sockaddr_storage *ns; + size_t ns_len; + struct timeval tv_s; + struct timeval tv_e; + + ldns_rdf **ns_array; + size_t *rtt; + ldns_pkt *reply; + bool all_servers_rtt_inf; + uint8_t retries; + + uint8_t *reply_bytes = NULL; + size_t reply_size = 0; + ldns_status status, send_status; + + assert(r != NULL); + + status = LDNS_STATUS_OK; + rtt = ldns_resolver_rtt(r); + ns_array = ldns_resolver_nameservers(r); + reply = NULL; + ns_len = 0; + + all_servers_rtt_inf = true; + + if (ldns_resolver_random(r)) { + ldns_resolver_nameservers_randomize(r); + } + + /* loop through all defined nameservers */ + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + if (rtt[i] == LDNS_RESOLV_RTT_INF) { + /* not reachable nameserver! */ + continue; + } + + /* maybe verbosity setting? + printf("Sending to "); + ldns_rdf_print(stdout, ns_array[i]); + printf("\n"); + */ + ns = ldns_rdf2native_sockaddr_storage(ns_array[i], + ldns_resolver_port(r), &ns_len); + + if ((ns->ss_family == AF_INET) && + (ldns_resolver_ip6(r) == LDNS_RESOLV_INET6)) { + /* not reachable */ + continue; + } + + if ((ns->ss_family == AF_INET6) && + (ldns_resolver_ip6(r) == LDNS_RESOLV_INET)) { + /* not reachable */ + continue; + } + + all_servers_rtt_inf = false; + + gettimeofday(&tv_s, NULL); + + send_status = LDNS_STATUS_ERR; + + /* reply_bytes implicitly handles our error */ + if (1 == ldns_resolver_usevc(r)) { + for (retries = ldns_resolver_retry(r); retries > 0; retries--) { + send_status = + ldns_tcp_send(&reply_bytes, qb, ns, + (socklen_t)ns_len, ldns_resolver_timeout(r), + &reply_size); + if (send_status == LDNS_STATUS_OK) { + break; + } + } + } else { + for (retries = ldns_resolver_retry(r); retries > 0; retries--) { + /* ldns_rdf_print(stdout, ns_array[i]); */ + send_status = + ldns_udp_send(&reply_bytes, qb, ns, + (socklen_t)ns_len, ldns_resolver_timeout(r), + &reply_size); + + if (send_status == LDNS_STATUS_OK) { + break; + } + } + } + + if (send_status != LDNS_STATUS_OK) { + ldns_resolver_set_nameserver_rtt(r, i, LDNS_RESOLV_RTT_INF); + status = send_status; + } + + /* obey the fail directive */ + if (!reply_bytes) { + /* the current nameserver seems to have a problem, blacklist it */ + if (ldns_resolver_fail(r)) { + LDNS_FREE(ns); + return LDNS_STATUS_ERR; + } else { + LDNS_FREE(ns); + continue; + } + } + + status = ldns_wire2pkt(&reply, reply_bytes, reply_size); + if (status != LDNS_STATUS_OK) { + LDNS_FREE(reply_bytes); + LDNS_FREE(ns); + return status; + } + + LDNS_FREE(ns); + gettimeofday(&tv_e, NULL); + + if (reply) { + ldns_pkt_set_querytime(reply, (uint32_t) + ((tv_e.tv_sec - tv_s.tv_sec) * 1000) + + (tv_e.tv_usec - tv_s.tv_usec) / 1000); + ldns_pkt_set_answerfrom(reply, ns_array[i]); + ldns_pkt_set_timestamp(reply, tv_s); + ldns_pkt_set_size(reply, reply_size); + break; + } else { + if (ldns_resolver_fail(r)) { + /* if fail is set bail out, after the first + * one */ + break; + } + } + + /* wait retrans seconds... */ + sleep((unsigned int) ldns_resolver_retrans(r)); + } + + if (all_servers_rtt_inf) { + LDNS_FREE(reply_bytes); + return LDNS_STATUS_RES_NO_NS; + } +#ifdef HAVE_SSL + if (tsig_mac && reply_bytes) { + if (!ldns_pkt_tsig_verify(reply, + reply_bytes, + reply_size, + ldns_resolver_tsig_keyname(r), + ldns_resolver_tsig_keydata(r), tsig_mac)) { + status = LDNS_STATUS_CRYPTO_TSIG_BOGUS; + } + } +#else + (void)tsig_mac; +#endif /* HAVE_SSL */ + + LDNS_FREE(reply_bytes); + if (result) { + *result = reply; + } + + return status; +} + +/** best effort to set nonblocking */ +static void +ldns_sock_nonblock(int sockfd) +{ +#ifdef HAVE_FCNTL + int flag; + if((flag = fcntl(sockfd, F_GETFL)) != -1) { + flag |= O_NONBLOCK; + if(fcntl(sockfd, F_SETFL, flag) == -1) { + /* ignore error, continue blockingly */ + } + } +#elif defined(HAVE_IOCTLSOCKET) + unsigned long on = 1; + if(ioctlsocket(sockfd, FIONBIO, &on) != 0) { + /* ignore error, continue blockingly */ + } +#endif +} + +/** best effort to set blocking */ +static void +ldns_sock_block(int sockfd) +{ +#ifdef HAVE_FCNTL + int flag; + if((flag = fcntl(sockfd, F_GETFL)) != -1) { + flag &= ~O_NONBLOCK; + if(fcntl(sockfd, F_SETFL, flag) == -1) { + /* ignore error, continue */ + } + } +#elif defined(HAVE_IOCTLSOCKET) + unsigned long off = 0; + if(ioctlsocket(sockfd, FIONBIO, &off) != 0) { + /* ignore error, continue */ + } +#endif +} + +/** wait for a socket to become ready */ +static int +ldns_sock_wait(int sockfd, struct timeval timeout, int write) +{ + fd_set fds; + int ret; +#ifndef S_SPLINT_S + FD_ZERO(&fds); + FD_SET(FD_SET_T sockfd, &fds); +#endif + if(write) + ret = select(sockfd+1, NULL, &fds, NULL, &timeout); + else + ret = select(sockfd+1, &fds, NULL, NULL, &timeout); + if(ret == 0) + /* timeout expired */ + return 0; + else if(ret == -1) + /* error */ + return 0; + return 1; +} + +ldns_status +ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, + socklen_t tolen, struct timeval timeout, size_t *answer_size) +{ + int sockfd; + uint8_t *answer; + + sockfd = ldns_udp_bgsend(qbin, to, tolen, timeout); + + if (sockfd == 0) { + return LDNS_STATUS_SOCKET_ERROR; + } + + /* wait for an response*/ + if(!ldns_sock_wait(sockfd, timeout, 0)) { +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + return LDNS_STATUS_NETWORK_ERR; + } + + /* set to nonblocking, so if the checksum is bad, it becomes + * an EGAIN error and the ldns_udp_send function does not block, + * but returns a 'NETWORK_ERROR' much like a timeout. */ + ldns_sock_nonblock(sockfd); + + answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL); +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + + if (*answer_size == 0) { + /* oops */ + return LDNS_STATUS_NETWORK_ERR; + } + + *result = answer; + return LDNS_STATUS_OK; +} + +int +ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + int sockfd; + + sockfd = ldns_udp_connect(to, timeout); + + if (sockfd == 0) { + return 0; + } + + if (ldns_udp_send_query(qbin, sockfd, to, tolen) == 0) { + return 0; + } + return sockfd; +} + +int +ldns_udp_connect(const struct sockaddr_storage *to, struct timeval ATTR_UNUSED(timeout)) +{ + int sockfd; + + if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM, + IPPROTO_UDP)) + == -1) { + return 0; + } + return sockfd; +} + +int +ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + int sockfd; + + if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_STREAM, + IPPROTO_TCP)) == -1) { + return 0; + } + + /* perform nonblocking connect, to be able to wait with select() */ + ldns_sock_nonblock(sockfd); + if (connect(sockfd, (struct sockaddr*)to, tolen) == -1) { +#ifndef USE_WINSOCK +#ifdef EINPROGRESS + if(errno != EINPROGRESS) { +#else + if(1) { +#endif + close(sockfd); + return 0; + } +#else /* USE_WINSOCK */ + if(WSAGetLastError() != WSAEINPROGRESS && + WSAGetLastError() != WSAEWOULDBLOCK) { + closesocket(sockfd); + return 0; + } +#endif + /* error was only telling us that it would block */ + } + + /* wait(write) until connected or error */ + while(1) { + int error = 0; + socklen_t len = (socklen_t)sizeof(error); + + if(!ldns_sock_wait(sockfd, timeout, 1)) { +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + return 0; + } + + /* check if there is a pending error for nonblocking connect */ + if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void*)&error, + &len) < 0) { +#ifndef USE_WINSOCK + error = errno; /* on solaris errno is error */ +#else + error = WSAGetLastError(); +#endif + } +#ifndef USE_WINSOCK +#if defined(EINPROGRESS) && defined(EWOULDBLOCK) + if(error == EINPROGRESS || error == EWOULDBLOCK) + continue; /* try again */ +#endif + else if(error != 0) { + close(sockfd); + /* error in errno for our user */ + errno = error; + return 0; + } +#else /* USE_WINSOCK */ + if(error == WSAEINPROGRESS) + continue; + else if(error == WSAEWOULDBLOCK) + continue; + else if(error != 0) { + closesocket(sockfd); + errno = error; + return 0; + } +#endif /* USE_WINSOCK */ + /* connected */ + break; + } + + /* set the socket blocking again */ + ldns_sock_block(sockfd); + + return sockfd; +} + +ssize_t +ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, + const struct sockaddr_storage *to, socklen_t tolen) +{ + uint8_t *sendbuf; + ssize_t bytes; + + /* add length of packet */ + sendbuf = LDNS_XMALLOC(uint8_t, ldns_buffer_position(qbin) + 2); + if(!sendbuf) return 0; + ldns_write_uint16(sendbuf, ldns_buffer_position(qbin)); + memcpy(sendbuf + 2, ldns_buffer_export(qbin), ldns_buffer_position(qbin)); + + bytes = sendto(sockfd, (void*)sendbuf, + ldns_buffer_position(qbin) + 2, 0, (struct sockaddr *)to, tolen); + + LDNS_FREE(sendbuf); + + if (bytes == -1 || (size_t) bytes != ldns_buffer_position(qbin) + 2 ) { + return 0; + } + return bytes; +} + +/* don't wait for an answer */ +ssize_t +ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, + socklen_t tolen) +{ + ssize_t bytes; + + bytes = sendto(sockfd, (void*)ldns_buffer_begin(qbin), + ldns_buffer_position(qbin), 0, (struct sockaddr *)to, tolen); + + if (bytes == -1 || (size_t)bytes != ldns_buffer_position(qbin)) { + return 0; + } + if ((size_t) bytes != ldns_buffer_position(qbin)) { + return 0; + } + return bytes; +} + +uint8_t * +ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *from, + socklen_t *fromlen) +{ + uint8_t *wire, *wireout; + ssize_t wire_size; + + wire = LDNS_XMALLOC(uint8_t, LDNS_MAX_PACKETLEN); + if (!wire) { + *size = 0; + return NULL; + } + + wire_size = recvfrom(sockfd, (void*)wire, LDNS_MAX_PACKETLEN, 0, + (struct sockaddr *)from, fromlen); + + /* recvfrom can also return 0 */ + if (wire_size == -1 || wire_size == 0) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + + *size = (size_t)wire_size; + wireout = LDNS_XREALLOC(wire, uint8_t, (size_t)wire_size); + if(!wireout) LDNS_FREE(wire); + + return wireout; +} + +uint8_t * +ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout) +{ + uint8_t *wire; + uint16_t wire_size; + ssize_t bytes = 0, rc = 0; + + wire = LDNS_XMALLOC(uint8_t, 2); + if (!wire) { + *size = 0; + return NULL; + } + + while (bytes < 2) { + if(!ldns_sock_wait(sockfd, timeout, 0)) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (2 - bytes), 0); + if (rc == -1 || rc == 0) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + bytes += rc; + } + + wire_size = ldns_read_uint16(wire); + + LDNS_FREE(wire); + wire = LDNS_XMALLOC(uint8_t, wire_size); + if (!wire) { + *size = 0; + return NULL; + } + bytes = 0; + + while (bytes < (ssize_t) wire_size) { + if(!ldns_sock_wait(sockfd, timeout, 0)) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (wire_size - bytes), 0); + if (rc == -1 || rc == 0) { + LDNS_FREE(wire); + *size = 0; + return NULL; + } + bytes += rc; + } + + *size = (size_t) bytes; + return wire; +} + +uint8_t * +ldns_tcp_read_wire(int sockfd, size_t *size) +{ + uint8_t *wire; + uint16_t wire_size; + ssize_t bytes = 0, rc = 0; + + wire = LDNS_XMALLOC(uint8_t, 2); + if (!wire) { + *size = 0; + return NULL; + } + + while (bytes < 2) { + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (2 - bytes), 0); + if (rc == -1 || rc == 0) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + bytes += rc; + } + + wire_size = ldns_read_uint16(wire); + + LDNS_FREE(wire); + wire = LDNS_XMALLOC(uint8_t, wire_size); + if (!wire) { + *size = 0; + return NULL; + } + bytes = 0; + + while (bytes < (ssize_t) wire_size) { + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (wire_size - bytes), 0); + if (rc == -1 || rc == 0) { + LDNS_FREE(wire); + *size = 0; + return NULL; + } + bytes += rc; + } + + *size = (size_t) bytes; + return wire; +} + +/* keep in mind that in DNS tcp messages the first 2 bytes signal the + * amount data to expect + */ +ldns_status +ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, + socklen_t tolen, struct timeval timeout, size_t *answer_size) +{ + int sockfd; + uint8_t *answer; + + sockfd = ldns_tcp_bgsend(qbin, to, tolen, timeout); + + if (sockfd == 0) { + return LDNS_STATUS_ERR; + } + + answer = ldns_tcp_read_wire_timeout(sockfd, answer_size, timeout); +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + + if (*answer_size == 0) { + /* oops */ + return LDNS_STATUS_NETWORK_ERR; + } + + /* resize accordingly */ + *result = (uint8_t*)LDNS_XREALLOC(answer, uint8_t *, (size_t)*answer_size); + if(!*result) { + LDNS_FREE(answer); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +int +ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + int sockfd; + + sockfd = ldns_tcp_connect(to, tolen, timeout); + + if (sockfd == 0) { + return 0; + } + + if (ldns_tcp_send_query(qbin, sockfd, to, tolen) == 0) { + return 0; + } + + return sockfd; +} + +/* code from rdata.c */ +struct sockaddr_storage * +ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size) +{ + struct sockaddr_storage *data; + struct sockaddr_in *data_in; + struct sockaddr_in6 *data_in6; + + data = LDNS_MALLOC(struct sockaddr_storage); + if (!data) { + return NULL; + } + /* zero the structure for portability */ + memset(data, 0, sizeof(struct sockaddr_storage)); + if (port == 0) { + port = LDNS_PORT; + } + + switch(ldns_rdf_get_type(rd)) { + case LDNS_RDF_TYPE_A: + data->ss_family = AF_INET; + data_in = (struct sockaddr_in*) data; + data_in->sin_port = (in_port_t)htons(port); + memcpy(&(data_in->sin_addr), ldns_rdf_data(rd), ldns_rdf_size(rd)); + *size = sizeof(struct sockaddr_in); + return data; + case LDNS_RDF_TYPE_AAAA: + data->ss_family = AF_INET6; + data_in6 = (struct sockaddr_in6*) data; + data_in6->sin6_port = (in_port_t)htons(port); + memcpy(&data_in6->sin6_addr, ldns_rdf_data(rd), ldns_rdf_size(rd)); + *size = sizeof(struct sockaddr_in6); + return data; + default: + LDNS_FREE(data); + return NULL; + } +} + +ldns_rdf * +ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port) +{ + ldns_rdf *addr; + struct sockaddr_in *data_in; + struct sockaddr_in6 *data_in6; + + switch(sock->ss_family) { + case AF_INET: + data_in = (struct sockaddr_in*)sock; + if (port) { + *port = ntohs((uint16_t)data_in->sin_port); + } + addr = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_A, + LDNS_IP4ADDRLEN, &data_in->sin_addr); + break; + case AF_INET6: + data_in6 = (struct sockaddr_in6*)sock; + if (port) { + *port = ntohs((uint16_t)data_in6->sin6_port); + } + addr = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_AAAA, + LDNS_IP6ADDRLEN, &data_in6->sin6_addr); + break; + default: + if (port) { + *port = 0; + } + return NULL; + } + return addr; +} + +/* code from resolver.c */ +ldns_status +ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) +{ + ldns_pkt *query; + ldns_buffer *query_wire; + + struct sockaddr_storage *ns = NULL; + size_t ns_len = 0; + size_t ns_i; + ldns_status status; + + if (!resolver || ldns_resolver_nameserver_count(resolver) < 1) { + return LDNS_STATUS_ERR; + } + + query = ldns_pkt_query_new(ldns_rdf_clone(domain), LDNS_RR_TYPE_AXFR, class, 0); + + if (!query) { + return LDNS_STATUS_ADDRESS_ERR; + } + /* For AXFR, we have to make the connection ourselves */ + /* try all nameservers (which usually would mean v4 fallback if + * @hostname is used */ + for (ns_i = 0; + ns_i < ldns_resolver_nameserver_count(resolver) && + resolver->_socket == 0; + ns_i++) { + ns = ldns_rdf2native_sockaddr_storage( + resolver->_nameservers[ns_i], + ldns_resolver_port(resolver), &ns_len); + + resolver->_socket = ldns_tcp_connect(ns, (socklen_t)ns_len, + ldns_resolver_timeout(resolver)); + } + + if (resolver->_socket == 0) { + ldns_pkt_free(query); + LDNS_FREE(ns); + return LDNS_STATUS_NETWORK_ERR; + } + +#ifdef HAVE_SSL + if (ldns_resolver_tsig_keyname(resolver) && ldns_resolver_tsig_keydata(resolver)) { + status = ldns_pkt_tsig_sign(query, + ldns_resolver_tsig_keyname(resolver), + ldns_resolver_tsig_keydata(resolver), + 300, ldns_resolver_tsig_algorithm(resolver), NULL); + if (status != LDNS_STATUS_OK) { + /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start + we have to close the socket here! */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return LDNS_STATUS_CRYPTO_TSIG_ERR; + } + } +#endif /* HAVE_SSL */ + + /* Convert the query to a buffer + * Is this necessary? + */ + query_wire = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if(!query_wire) { + ldns_pkt_free(query); + LDNS_FREE(ns); +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return LDNS_STATUS_MEM_ERR; + } + status = ldns_pkt2buffer_wire(query_wire, query); + if (status != LDNS_STATUS_OK) { + ldns_pkt_free(query); + ldns_buffer_free(query_wire); + LDNS_FREE(ns); + + /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start + we have to close the socket here! */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return status; + } + /* Send the query */ + if (ldns_tcp_send_query(query_wire, resolver->_socket, ns, + (socklen_t)ns_len) == 0) { + ldns_pkt_free(query); + ldns_buffer_free(query_wire); + LDNS_FREE(ns); + + /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start + we have to close the socket here! */ + +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return LDNS_STATUS_NETWORK_ERR; + } + + ldns_pkt_free(query); + ldns_buffer_free(query_wire); + LDNS_FREE(ns); + + /* + * The AXFR is done once the second SOA record is sent + */ + resolver->_axfr_soa_count = 0; + return LDNS_STATUS_OK; +} diff --git a/libs/ldns/packaging/fedora/ldns.spec b/libs/ldns/packaging/fedora/ldns.spec new file mode 100644 index 0000000000..abcdc81308 --- /dev/null +++ b/libs/ldns/packaging/fedora/ldns.spec @@ -0,0 +1,276 @@ +%{?!with_python: %global with_python 1} + +%if %{with_python} +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%endif + +Summary: Lowlevel DNS(SEC) library with API +Name: ldns +Version: 1.6.9 +Release: 2%{?dist} +License: BSD +Url: http://www.nlnetlabs.nl/%{name}/ +Source: http://www.nlnetlabs.nl/downloads/%{name}-%{version}.tar.gz +Group: System Environment/Libraries +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: libtool, autoconf, automake, gcc-c++, doxygen, +BuildRequires: perl, libpcap-devel, openssl-devel + +%if %{with_python} +BuildRequires: python-devel, swig +%endif + +%description +ldns is a library with the aim to simplify DNS programing in C. All +lowlevel DNS/DNSSEC operations are supported. We also define a higher +level API which allows a programmer to (for instance) create or sign +packets. + +%package devel +Summary: Development package that includes the ldns header files +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +The devel package contains the ldns library and the include files + +%if %{with_python} +%package python +Summary: Python extensions for ldns +Group: Applications/System +Requires: %{name} = %{version}-%{release} + +%description python +Python extensions for ldns +%endif + + +%prep +%setup -q +# To built svn snapshots +#rm config.guess config.sub ltmain.sh +#aclocal +#libtoolize -c --install +#autoreconf --install + +%build +%configure --disable-rpath --disable-static --with-sha2 \ +%if %{with_python} + --with-pyldns +%endif + +(cd drill ; %configure --disable-rpath --disable-static --with-ldns=%{buildroot}/lib/ ) +(cd examples ; %configure --disable-rpath --disable-static --with-ldns=%{buildroot}/lib/ ) + +make %{?_smp_mflags} +( cd drill ; make %{?_smp_mflags} ) +( cd examples ; make %{?_smp_mflags} ) +make %{?_smp_mflags} doc + +%install +rm -rf %{buildroot} + +make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install +make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install-doc + +# don't package building script in doc +rm doc/doxyparse.pl +#remove doc stubs +rm -rf doc/.svn +#remove double set of man pages +rm -rf doc/man + +# remove .la files +rm -rf %{buildroot}%{_libdir}/*.la %{buildroot}%{python_sitelib}/*.la +(cd drill ; make DESTDIR=%{buildroot} install) +(cd examples; make DESTDIR=%{buildroot} install) + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_libdir}/libldns*so.* +%{_bindir}/drill +%{_bindir}/ldnsd +#%{_bindir}/ldns-* +%{_bindir}/ldns-chaos +%{_bindir}/ldns-compare-zones +%{_bindir}/ldns-[d-z]* +%doc README LICENSE +%{_mandir}/*/* + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libldns*so +%{_bindir}/ldns-config +%dir %{_includedir}/ldns +%{_includedir}/ldns/*.h +%doc doc Changelog README + +%if %{with_python} +%files python +%defattr(-,root,root) +%{python_sitelib}/* +%endif + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%changelog +* Wed Mar 16 2011 Willem Toorop - 1.6.9 +- Upgraded to 1.6.9. + +* Mon Nov 8 2010 Matthijs Mekking - 1.6.8 +- Upgraded to 1.6.8. + +* Tue Aug 24 2010 Matthijs Mekking - 1.6.7 +- Upgraded to 1.6.7. + +* Fri Jan 22 2010 Paul Wouters - 1.6.4-2 +- Fix missing _ldns.so causing ldns-python to not work +- Patch for installing ldns-python files +- Patch for rpath in ldns-python +- Don't install .a file for ldns-python + +* Wed Jan 20 2010 Paul Wouters - 1.6.4-1 +- Upgraded to 1.6.4. +- Added ldns-python sub package + +* Fri Dec 04 2009 Paul Wouters - 1.6.3-1 +- Upgraded to 1.6.3, which has minor bugfixes + +* Fri Nov 13 2009 Paul Wouters - 1.6.2-1 +- Upgraded to 1.6.2. This fixes various bugs. + (upstream released mostly to default with sha2 for the imminent + signed root, but we already enabled that in our builds) + +* Tue Aug 25 2009 Tomas Mraz - 1.6.1-3 +- rebuilt with new openssl + +* Sun Aug 16 2009 Paul Wouters - 1.6.1-2 +- Added openssl dependancy back in, since we get more functionality + when using openssl. Especially in 'drill'. + +* Sun Aug 16 2009 Paul Wouters - 1.6.1-1 +- Updated to 1.6.1 + +* Fri Jul 24 2009 Fedora Release Engineering - 1.6.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 13 2009 Paul Wouters - 1.6.0-4 +- Fixed the ssl patch so it can now compile --without-ssl + +* Sat Jul 11 2009 Paul Wouters - 1.6.0-3 +- Added patch to compile with --without-ssl +- Removed openssl dependancies +- Recompiled with --without-ssl + +* Sat Jul 11 2009 Paul Wouters - 1.6.0-2 +- Updated to 1.6.0 +- (did not yet compile with --without-ssl due to compile failures) + +* Fri Jul 10 2009 Paul Wouters - 1.6.0-1 +- Updated to 1.6.0 +- Compile without openssl + +* Thu Apr 16 2009 Paul Wouters - 1.5.1-4 +- Memory management bug when generating a sha256 key, see: + https://bugzilla.redhat.com/show_bug.cgi?id=493953 + +* Wed Feb 25 2009 Fedora Release Engineering - 1.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 10 2009 Paul Wouters - 1.5.1-1 +- Updated to new version, 1.5.0 had a bug preventing + zone signing. + +* Mon Feb 9 2009 Paul Wouters - 1.5.0-1 +- Updated to new version + +* Thu Feb 05 2009 Adam Tkac - 1.4.0-3 +- fixed configure flags + +* Sat Jan 17 2009 Tomas Mraz - 1.4.0-2 +- rebuild with new openssl + +* Fri Nov 7 2008 Paul Wouters - 1.4.0-1 +- Updated to 1.4.0 + +* Wed May 28 2008 Paul Wouters - 1.3.0-3 +- enable SHA2 functionality + +* Wed May 28 2008 Paul Wouters - 1.3.0-2 +- re-tag (don't do builds while renaming local repo dirs) + +* Wed May 28 2008 Paul Wouters - 1.3.0-1 +- Updated to latest release + +* Tue Feb 19 2008 Fedora Release Engineering - 1.2.2-3 +- Autorebuild for GCC 4.3 + +* Wed Dec 5 2007 Paul Wouters - 1.2.2-2 +- Rebuild for new libcrypto + +* Thu Nov 29 2007 Paul Wouters - 1.2.2-1 +- Upgraded to 1.2.2. Removed no longer needed race workaround + +* Tue Nov 13 2007 Paul Wouters - 1.2.1-4 +- Try to fix racing ln -s statements in parallel builds + +* Fri Nov 9 2007 Paul Wouters - 1.2.1-3 +- Added patch for ldns-read-zone that does not put @. in RRDATA + +* Fri Oct 19 2007 Paul Wouters - 1.2.1-2 +- Use install -p to work around multilib conflicts for .h files + +* Wed Oct 10 2007 Paul Wouters - 1.2.1-1 +- Updated to 1.2.1 +- Removed patches that got moved into upstream + +* Wed Aug 8 2007 Paul Wouters 1.2.0-11 +- Patch for ldns-key2ds to write to stdout +- Again remove extra set of man pages from doc +- own /usr/include/ldns (bug 233858) + +* Wed Aug 8 2007 Paul Wouters 1.2.0-10 +- Added sha256 DS record patch to ldns-key2ds +- Minor tweaks for proper doc/man page installation. +- Workaround for parallel builds + +* Mon Aug 6 2007 Paul Wouters 1.2.0-2 +- Own the /usr/include/ldns directory (bug #233858) +- Removed obsoleted patch +- Remove files form previous libtool run accidentally packages by upstream + +* Mon Sep 11 2006 Paul Wouters 1.0.1-4 +- Commented out 1.1.0 make targets, put make 1.0.1 targets. + +* Mon Sep 11 2006 Paul Wouters 1.0.1-3 +- Fixed changelog typo in date +- Rebuild requested for PT_GNU_HASH support from gcc +- Did not upgrade to 1.1.0 due to compile issues on x86_64 + +* Fri Jan 6 2006 Paul Wouters 1.0.1-1 +- Upgraded to 1.0.1. Removed temporary clean hack from spec file. + +* Sun Dec 18 2005 Paul Wouters 1.0.0-8 +- Cannot use make clean because there are no Makefiles. Use hardcoded rm. + +* Sun Dec 18 2005 Paul Wouters 1.0.0-7 +- Patched 'make clean' target to get rid of object files shipped with 1.0.0 + +* Sun Dec 13 2005 Paul Wouters 1.0.0-6 +- added a make clean for 2.3.3 since .o files were left behind upstream, + causing failure on ppc platform + +* Sun Dec 11 2005 Tom "spot" Callaway 1.0.0-5 +- minor cleanups + +* Wed Oct 5 2005 Paul Wouters 0.70_1205 +- reworked for svn version + +* Sun Sep 25 2005 Paul Wouters - 0.70 +- Initial version diff --git a/libs/ldns/packaging/ldns-config.in b/libs/ldns/packaging/ldns-config.in new file mode 100755 index 0000000000..b728ba544e --- /dev/null +++ b/libs/ldns/packaging/ldns-config.in @@ -0,0 +1,31 @@ +#!/bin/sh + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +VERSION="@PACKAGE_VERSION@" +CFLAGS="@CFLAGS@" +CPPFLAGS="@CPPFLAGS@ @LIBSSL_CPPFLAGS@ @PYTHON_CPPFLAGS@" +LDFLAGS="@LDFLAGS@ @LIBSSL_LDFLAGS@ @PYTHON_LDFLAGS@" +LIBS="@LIBS@ @LIBSSL_LIBS@" +LIBDIR="@libdir@" +INCLUDEDIR="@includedir@" + +for arg in $@ +do + if [ $arg = "--cflags" ] + then + echo "-I${INCLUDEDIR}" + fi + if [ $arg = "--libs" ] + then + echo "${LDFLAGS} -L${LIBDIR} ${LIBS} -lldns" + fi + if [ $arg = "-h" ] || [ $arg = "--help" ] + then + echo "Usage: $0 [--cflags] [--libs] [--version]" + fi + if [ $arg = "--version" ] + then + echo "${VERSION}" + fi +done diff --git a/libs/ldns/packaging/libldns.pc.in b/libs/ldns/packaging/libldns.pc.in new file mode 100644 index 0000000000..923b688379 --- /dev/null +++ b/libs/ldns/packaging/libldns.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: ldns +Description: Library for DNS programming +URL: http://www.nlnetlabs.nl/projects/ldns +Version: @PACKAGE_VERSION@ +Requires: +Libs: -L${libdir} -lldns +Libs.private: @LDFLAGS@ +Cflags: -I${includedir} diff --git a/libs/ldns/packet.c b/libs/ldns/packet.c new file mode 100644 index 0000000000..0ac5ca8ba3 --- /dev/null +++ b/libs/ldns/packet.c @@ -0,0 +1,1007 @@ +/* + * packet.c + * + * dns packet implementation + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#include +#include + +#ifdef HAVE_SSL +#include +#endif + +/* Access functions + * do this as functions to get type checking + */ + +#define LDNS_EDNS_MASK_DO_BIT 0x8000 + +/* TODO defines for 3600 */ +/* convert to and from numerical flag values */ +ldns_lookup_table ldns_edns_flags[] = { + { 3600, "do"}, + { 0, NULL} +}; + +/* read */ +uint16_t +ldns_pkt_id(const ldns_pkt *packet) +{ + return packet->_header->_id; +} + +bool +ldns_pkt_qr(const ldns_pkt *packet) +{ + return packet->_header->_qr; +} + +bool +ldns_pkt_aa(const ldns_pkt *packet) +{ + return packet->_header->_aa; +} + +bool +ldns_pkt_tc(const ldns_pkt *packet) +{ + return packet->_header->_tc; +} + +bool +ldns_pkt_rd(const ldns_pkt *packet) +{ + return packet->_header->_rd; +} + +bool +ldns_pkt_cd(const ldns_pkt *packet) +{ + return packet->_header->_cd; +} + +bool +ldns_pkt_ra(const ldns_pkt *packet) +{ + return packet->_header->_ra; +} + +bool +ldns_pkt_ad(const ldns_pkt *packet) +{ + return packet->_header->_ad; +} + +ldns_pkt_opcode +ldns_pkt_get_opcode(const ldns_pkt *packet) +{ + return packet->_header->_opcode; +} + +ldns_pkt_rcode +ldns_pkt_get_rcode(const ldns_pkt *packet) +{ + return packet->_header->_rcode; +} + +uint16_t +ldns_pkt_qdcount(const ldns_pkt *packet) +{ + return packet->_header->_qdcount; +} + +uint16_t +ldns_pkt_ancount(const ldns_pkt *packet) +{ + return packet->_header->_ancount; +} + +uint16_t +ldns_pkt_nscount(const ldns_pkt *packet) +{ + return packet->_header->_nscount; +} + +uint16_t +ldns_pkt_arcount(const ldns_pkt *packet) +{ + return packet->_header->_arcount; +} + +ldns_rr_list * +ldns_pkt_question(const ldns_pkt *packet) +{ + return packet->_question; +} + +ldns_rr_list * +ldns_pkt_answer(const ldns_pkt *packet) +{ + return packet->_answer; +} + +ldns_rr_list * +ldns_pkt_authority(const ldns_pkt *packet) +{ + return packet->_authority; +} + +ldns_rr_list * +ldns_pkt_additional(const ldns_pkt *packet) +{ + return packet->_additional; +} + +/* return ALL section concatenated */ +ldns_rr_list * +ldns_pkt_all(const ldns_pkt *packet) +{ + ldns_rr_list *all, *prev_all; + + all = ldns_rr_list_cat_clone( + ldns_pkt_question(packet), + ldns_pkt_answer(packet)); + prev_all = all; + all = ldns_rr_list_cat_clone(all, + ldns_pkt_authority(packet)); + ldns_rr_list_deep_free(prev_all); + prev_all = all; + all = ldns_rr_list_cat_clone(all, + ldns_pkt_additional(packet)); + ldns_rr_list_deep_free(prev_all); + return all; +} + +ldns_rr_list * +ldns_pkt_all_noquestion(const ldns_pkt *packet) +{ + ldns_rr_list *all, *all2; + + all = ldns_rr_list_cat_clone( + ldns_pkt_answer(packet), + ldns_pkt_authority(packet)); + all2 = ldns_rr_list_cat_clone(all, + ldns_pkt_additional(packet)); + + ldns_rr_list_deep_free(all); + return all2; +} + +size_t +ldns_pkt_size(const ldns_pkt *packet) +{ + return packet->_size; +} + +uint32_t +ldns_pkt_querytime(const ldns_pkt *packet) +{ + return packet->_querytime; +} + +ldns_rdf * +ldns_pkt_answerfrom(const ldns_pkt *packet) +{ + return packet->_answerfrom; +} + +struct timeval +ldns_pkt_timestamp(const ldns_pkt *packet) +{ + return packet->timestamp; +} + +uint16_t +ldns_pkt_edns_udp_size(const ldns_pkt *packet) +{ + return packet->_edns_udp_size; +} + +uint8_t +ldns_pkt_edns_extended_rcode(const ldns_pkt *packet) +{ + return packet->_edns_extended_rcode; +} + +uint8_t +ldns_pkt_edns_version(const ldns_pkt *packet) +{ + return packet->_edns_version; +} + +uint16_t +ldns_pkt_edns_z(const ldns_pkt *packet) +{ + return packet->_edns_z; +} + +bool +ldns_pkt_edns_do(const ldns_pkt *packet) +{ + return (packet->_edns_z & LDNS_EDNS_MASK_DO_BIT); +} + +void +ldns_pkt_set_edns_do(ldns_pkt *packet, bool value) +{ + if (value) { + packet->_edns_z = packet->_edns_z | LDNS_EDNS_MASK_DO_BIT; + } else { + packet->_edns_z = packet->_edns_z & ~LDNS_EDNS_MASK_DO_BIT; + } +} + +ldns_rdf * +ldns_pkt_edns_data(const ldns_pkt *packet) +{ + return packet->_edns_data; +} + +/* return only those rr that share the ownername */ +ldns_rr_list * +ldns_pkt_rr_list_by_name(ldns_pkt *packet, + ldns_rdf *ownername, + ldns_pkt_section sec) +{ + ldns_rr_list *rrs; + ldns_rr_list *new; + ldns_rr_list *ret; + uint16_t i; + + if (!packet) { + return NULL; + } + + rrs = ldns_pkt_get_section_clone(packet, sec); + new = ldns_rr_list_new(); + ret = NULL; + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + if (ldns_rdf_compare(ldns_rr_owner( + ldns_rr_list_rr(rrs, i)), + ownername) == 0) { + /* owner names match */ + ldns_rr_list_push_rr(new, ldns_rr_list_rr(rrs, i)); + ret = new; + } + } + return ret; +} + +/* return only those rr that share a type */ +ldns_rr_list * +ldns_pkt_rr_list_by_type(const ldns_pkt *packet, + ldns_rr_type type, + ldns_pkt_section sec) +{ + ldns_rr_list *rrs; + ldns_rr_list *new; + uint16_t i; + + if(!packet) { + return NULL; + } + + rrs = ldns_pkt_get_section_clone(packet, sec); + new = ldns_rr_list_new(); + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + if (type == ldns_rr_get_type(ldns_rr_list_rr(rrs, i))) { + /* types match */ + ldns_rr_list_push_rr(new, + ldns_rr_clone( + ldns_rr_list_rr(rrs, i)) + ); + } + } + ldns_rr_list_deep_free(rrs); + + if (ldns_rr_list_rr_count(new) == 0) { + ldns_rr_list_free(new); + return NULL; + } else { + return new; + } +} + +/* return only those rrs that share name and type */ +ldns_rr_list * +ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, + const ldns_rdf *ownername, + ldns_rr_type type, + ldns_pkt_section sec) +{ + ldns_rr_list *rrs; + ldns_rr_list *new; + ldns_rr_list *ret; + uint16_t i; + + if(!packet) { + return NULL; + } + + rrs = ldns_pkt_get_section_clone(packet, sec); + new = ldns_rr_list_new(); + ret = NULL; + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + if (type == ldns_rr_get_type(ldns_rr_list_rr(rrs, i)) && + ldns_rdf_compare(ldns_rr_owner(ldns_rr_list_rr(rrs, i)), + ownername + ) == 0 + ) { + /* types match */ + ldns_rr_list_push_rr(new, ldns_rr_clone(ldns_rr_list_rr(rrs, i))); + ret = new; + } + } + ldns_rr_list_deep_free(rrs); + if (!ret) { + ldns_rr_list_free(new); + } + return ret; +} + +bool +ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr) +{ + bool result = false; + + switch (sec) { + case LDNS_SECTION_QUESTION: + return ldns_rr_list_contains_rr(ldns_pkt_question(pkt), rr); + case LDNS_SECTION_ANSWER: + return ldns_rr_list_contains_rr(ldns_pkt_answer(pkt), rr); + case LDNS_SECTION_AUTHORITY: + return ldns_rr_list_contains_rr(ldns_pkt_authority(pkt), rr); + case LDNS_SECTION_ADDITIONAL: + return ldns_rr_list_contains_rr(ldns_pkt_additional(pkt), rr); + case LDNS_SECTION_ANY: + result = ldns_rr_list_contains_rr(ldns_pkt_question(pkt), rr); + case LDNS_SECTION_ANY_NOQUESTION: + result = result + || ldns_rr_list_contains_rr(ldns_pkt_answer(pkt), rr) + || ldns_rr_list_contains_rr(ldns_pkt_authority(pkt), rr) + || ldns_rr_list_contains_rr(ldns_pkt_additional(pkt), rr); + } + + return result; +} + +uint16_t +ldns_pkt_section_count(const ldns_pkt *packet, ldns_pkt_section s) +{ + switch(s) { + case LDNS_SECTION_QUESTION: + return ldns_pkt_qdcount(packet); + case LDNS_SECTION_ANSWER: + return ldns_pkt_ancount(packet); + case LDNS_SECTION_AUTHORITY: + return ldns_pkt_nscount(packet); + case LDNS_SECTION_ADDITIONAL: + return ldns_pkt_arcount(packet); + case LDNS_SECTION_ANY: + return ldns_pkt_qdcount(packet) + + ldns_pkt_ancount(packet) + + ldns_pkt_nscount(packet) + + ldns_pkt_arcount(packet); + case LDNS_SECTION_ANY_NOQUESTION: + return ldns_pkt_ancount(packet) + + ldns_pkt_nscount(packet) + + ldns_pkt_arcount(packet); + default: + return 0; + } +} + +bool +ldns_pkt_empty(ldns_pkt *p) +{ + if (!p) { + return true; /* NULL is empty? */ + } + if (ldns_pkt_section_count(p, LDNS_SECTION_ANY) > 0) { + return false; + } else { + return true; + } +} + + +ldns_rr_list * +ldns_pkt_get_section_clone(const ldns_pkt *packet, ldns_pkt_section s) +{ + switch(s) { + case LDNS_SECTION_QUESTION: + return ldns_rr_list_clone(ldns_pkt_question(packet)); + case LDNS_SECTION_ANSWER: + return ldns_rr_list_clone(ldns_pkt_answer(packet)); + case LDNS_SECTION_AUTHORITY: + return ldns_rr_list_clone(ldns_pkt_authority(packet)); + case LDNS_SECTION_ADDITIONAL: + return ldns_rr_list_clone(ldns_pkt_additional(packet)); + case LDNS_SECTION_ANY: + /* these are already clones */ + return ldns_pkt_all(packet); + case LDNS_SECTION_ANY_NOQUESTION: + return ldns_pkt_all_noquestion(packet); + default: + return NULL; + } +} + +ldns_rr *ldns_pkt_tsig(const ldns_pkt *pkt) { + return pkt->_tsig_rr; +} + +/* write */ +void +ldns_pkt_set_id(ldns_pkt *packet, uint16_t id) +{ + packet->_header->_id = id; +} + +void +ldns_pkt_set_random_id(ldns_pkt *packet) +{ + uint16_t rid = ldns_get_random(); + ldns_pkt_set_id(packet, rid); +} + + +void +ldns_pkt_set_qr(ldns_pkt *packet, bool qr) +{ + packet->_header->_qr = qr; +} + +void +ldns_pkt_set_aa(ldns_pkt *packet, bool aa) +{ + packet->_header->_aa = aa; +} + +void +ldns_pkt_set_tc(ldns_pkt *packet, bool tc) +{ + packet->_header->_tc = tc; +} + +void +ldns_pkt_set_rd(ldns_pkt *packet, bool rd) +{ + packet->_header->_rd = rd; +} + +void +ldns_pkt_set_additional(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_additional = rr; +} + +void +ldns_pkt_set_question(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_question = rr; +} + +void +ldns_pkt_set_answer(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_answer = rr; +} + +void +ldns_pkt_set_authority(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_authority = rr; +} + +void +ldns_pkt_set_cd(ldns_pkt *packet, bool cd) +{ + packet->_header->_cd = cd; +} + +void +ldns_pkt_set_ra(ldns_pkt *packet, bool ra) +{ + packet->_header->_ra = ra; +} + +void +ldns_pkt_set_ad(ldns_pkt *packet, bool ad) +{ + packet->_header->_ad = ad; +} + +void +ldns_pkt_set_opcode(ldns_pkt *packet, ldns_pkt_opcode opcode) +{ + packet->_header->_opcode = opcode; +} + +void +ldns_pkt_set_rcode(ldns_pkt *packet, uint8_t rcode) +{ + packet->_header->_rcode = rcode; +} + +void +ldns_pkt_set_qdcount(ldns_pkt *packet, uint16_t qdcount) +{ + packet->_header->_qdcount = qdcount; +} + +void +ldns_pkt_set_ancount(ldns_pkt *packet, uint16_t ancount) +{ + packet->_header->_ancount = ancount; +} + +void +ldns_pkt_set_nscount(ldns_pkt *packet, uint16_t nscount) +{ + packet->_header->_nscount = nscount; +} + +void +ldns_pkt_set_arcount(ldns_pkt *packet, uint16_t arcount) +{ + packet->_header->_arcount = arcount; +} + +void +ldns_pkt_set_querytime(ldns_pkt *packet, uint32_t time) +{ + packet->_querytime = time; +} + +void +ldns_pkt_set_answerfrom(ldns_pkt *packet, ldns_rdf *answerfrom) +{ + packet->_answerfrom = answerfrom; +} + +void +ldns_pkt_set_timestamp(ldns_pkt *packet, struct timeval timeval) +{ + packet->timestamp.tv_sec = timeval.tv_sec; + packet->timestamp.tv_usec = timeval.tv_usec; +} + +void +ldns_pkt_set_size(ldns_pkt *packet, size_t s) +{ + packet->_size = s; +} + +void +ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s) +{ + packet->_edns_udp_size = s; +} + +void +ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c) +{ + packet->_edns_extended_rcode = c; +} + +void +ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v) +{ + packet->_edns_version = v; +} + +void +ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z) +{ + packet->_edns_z = z; +} + +void +ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data) +{ + packet->_edns_data = data; +} + +void +ldns_pkt_set_section_count(ldns_pkt *packet, ldns_pkt_section s, uint16_t count) +{ + switch(s) { + case LDNS_SECTION_QUESTION: + ldns_pkt_set_qdcount(packet, count); + break; + case LDNS_SECTION_ANSWER: + ldns_pkt_set_ancount(packet, count); + break; + case LDNS_SECTION_AUTHORITY: + ldns_pkt_set_nscount(packet, count); + break; + case LDNS_SECTION_ADDITIONAL: + ldns_pkt_set_arcount(packet, count); + break; + case LDNS_SECTION_ANY: + case LDNS_SECTION_ANY_NOQUESTION: + break; + } +} + +void ldns_pkt_set_tsig(ldns_pkt *pkt, ldns_rr *rr) +{ + pkt->_tsig_rr = rr; +} + +bool +ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr) +{ + switch(section) { + case LDNS_SECTION_QUESTION: + ldns_rr_list_push_rr(ldns_pkt_question(packet), rr); + ldns_pkt_set_qdcount(packet, ldns_pkt_qdcount(packet) + 1); + break; + case LDNS_SECTION_ANSWER: + ldns_rr_list_push_rr(ldns_pkt_answer(packet), rr); + ldns_pkt_set_ancount(packet, ldns_pkt_ancount(packet) + 1); + break; + case LDNS_SECTION_AUTHORITY: + ldns_rr_list_push_rr(ldns_pkt_authority(packet), rr); + ldns_pkt_set_nscount(packet, ldns_pkt_nscount(packet) + 1); + break; + case LDNS_SECTION_ADDITIONAL: + ldns_rr_list_push_rr(ldns_pkt_additional(packet), rr); + ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) + 1); + break; + case LDNS_SECTION_ANY: + case LDNS_SECTION_ANY_NOQUESTION: + /* shouldn't this error? */ + break; + } + return true; +} + +bool +ldns_pkt_safe_push_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr) +{ + + /* check to see if its there */ + if (ldns_pkt_rr(pkt, sec, rr)) { + /* already there */ + return false; + } + return ldns_pkt_push_rr(pkt, sec, rr); +} + +bool +ldns_pkt_push_rr_list(ldns_pkt *p, ldns_pkt_section s, ldns_rr_list *list) +{ + size_t i; + for(i = 0; i < ldns_rr_list_rr_count(list); i++) { + if (!ldns_pkt_push_rr(p, s, ldns_rr_list_rr(list, i))) { + return false; + } + } + return true; +} + +bool +ldns_pkt_safe_push_rr_list(ldns_pkt *p, ldns_pkt_section s, ldns_rr_list *list) +{ + size_t i; + for(i = 0; i < ldns_rr_list_rr_count(list); i++) { + if (!ldns_pkt_safe_push_rr(p, s, ldns_rr_list_rr(list, i))) { + return false; + } + } + return true; +} + +bool +ldns_pkt_edns(const ldns_pkt *pkt) { + return (ldns_pkt_edns_udp_size(pkt) > 0 || + ldns_pkt_edns_extended_rcode(pkt) > 0 || + ldns_pkt_edns_data(pkt) || + ldns_pkt_edns_do(pkt) + ); +} + + +/* Create/destroy/convert functions + */ +ldns_pkt * +ldns_pkt_new() +{ + ldns_pkt *packet; + packet = LDNS_MALLOC(ldns_pkt); + if (!packet) { + return NULL; + } + + packet->_header = LDNS_MALLOC(ldns_hdr); + if (!packet->_header) { + LDNS_FREE(packet); + return NULL; + } + + packet->_question = ldns_rr_list_new(); + packet->_answer = ldns_rr_list_new(); + packet->_authority = ldns_rr_list_new(); + packet->_additional = ldns_rr_list_new(); + + /* default everything to false */ + ldns_pkt_set_qr(packet, false); + ldns_pkt_set_aa(packet, false); + ldns_pkt_set_tc(packet, false); + ldns_pkt_set_rd(packet, false); + ldns_pkt_set_ra(packet, false); + ldns_pkt_set_ad(packet, false); + ldns_pkt_set_cd(packet, false); + + ldns_pkt_set_opcode(packet, LDNS_PACKET_QUERY); + ldns_pkt_set_rcode(packet, 0); + ldns_pkt_set_id(packet, 0); + ldns_pkt_set_size(packet, 0); + ldns_pkt_set_querytime(packet, 0); + memset(&packet->timestamp, 0, sizeof(packet->timestamp)); + ldns_pkt_set_answerfrom(packet, NULL); + ldns_pkt_set_section_count(packet, LDNS_SECTION_QUESTION, 0); + ldns_pkt_set_section_count(packet, LDNS_SECTION_ANSWER, 0); + ldns_pkt_set_section_count(packet, LDNS_SECTION_AUTHORITY, 0); + ldns_pkt_set_section_count(packet, LDNS_SECTION_ADDITIONAL, 0); + + ldns_pkt_set_edns_udp_size(packet, 0); + ldns_pkt_set_edns_extended_rcode(packet, 0); + ldns_pkt_set_edns_version(packet, 0); + ldns_pkt_set_edns_z(packet, 0); + ldns_pkt_set_edns_data(packet, NULL); + + ldns_pkt_set_tsig(packet, NULL); + + return packet; +} + +void +ldns_pkt_free(ldns_pkt *packet) +{ + if (packet) { + LDNS_FREE(packet->_header); + ldns_rr_list_deep_free(packet->_question); + ldns_rr_list_deep_free(packet->_answer); + ldns_rr_list_deep_free(packet->_authority); + ldns_rr_list_deep_free(packet->_additional); + ldns_rr_free(packet->_tsig_rr); + ldns_rdf_deep_free(packet->_edns_data); + LDNS_FREE(packet); + } +} + +bool +ldns_pkt_set_flags(ldns_pkt *packet, uint16_t flags) +{ + if (!packet) { + return false; + } + if ((flags & LDNS_QR) == LDNS_QR) { + ldns_pkt_set_qr(packet, true); + } + if ((flags & LDNS_AA) == LDNS_AA) { + ldns_pkt_set_aa(packet, true); + } + if ((flags & LDNS_RD) == LDNS_RD) { + ldns_pkt_set_rd(packet, true); + } + if ((flags & LDNS_TC) == LDNS_TC) { + ldns_pkt_set_tc(packet, true); + } + if ((flags & LDNS_CD) == LDNS_CD) { + ldns_pkt_set_cd(packet, true); + } + if ((flags & LDNS_RA) == LDNS_RA) { + ldns_pkt_set_ra(packet, true); + } + if ((flags & LDNS_AD) == LDNS_AD) { + ldns_pkt_set_ad(packet, true); + } + return true; +} + +ldns_status +ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type, + ldns_rr_class rr_class, uint16_t flags) +{ + ldns_pkt *packet; + ldns_rr *question_rr; + ldns_rdf *name_rdf; + + packet = ldns_pkt_new(); + if (!packet) { + return LDNS_STATUS_MEM_ERR; + } + + if (!ldns_pkt_set_flags(packet, flags)) { + return LDNS_STATUS_ERR; + } + + question_rr = ldns_rr_new(); + if (!question_rr) { + return LDNS_STATUS_MEM_ERR; + } + + if (rr_type == 0) { + rr_type = LDNS_RR_TYPE_A; + } + if (rr_class == 0) { + rr_class = LDNS_RR_CLASS_IN; + } + + if (ldns_str2rdf_dname(&name_rdf, name) == LDNS_STATUS_OK) { + ldns_rr_set_owner(question_rr, name_rdf); + ldns_rr_set_type(question_rr, rr_type); + ldns_rr_set_class(question_rr, rr_class); + ldns_rr_set_question(question_rr, true); + + ldns_pkt_push_rr(packet, LDNS_SECTION_QUESTION, question_rr); + } else { + ldns_rr_free(question_rr); + ldns_pkt_free(packet); + return LDNS_STATUS_ERR; + } + + packet->_tsig_rr = NULL; + + ldns_pkt_set_answerfrom(packet, NULL); + if (p) { + *p = packet; + return LDNS_STATUS_OK; + } else { + return LDNS_STATUS_NULL; + } +} + +ldns_pkt * +ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, + uint16_t flags) +{ + ldns_pkt *packet; + ldns_rr *question_rr; + + packet = ldns_pkt_new(); + if (!packet) { + return NULL; + } + + if (!ldns_pkt_set_flags(packet, flags)) { + return NULL; + } + + question_rr = ldns_rr_new(); + if (!question_rr) { + return NULL; + } + + if (rr_type == 0) { + rr_type = LDNS_RR_TYPE_A; + } + if (rr_class == 0) { + rr_class = LDNS_RR_CLASS_IN; + } + + ldns_rr_set_owner(question_rr, rr_name); + ldns_rr_set_type(question_rr, rr_type); + ldns_rr_set_class(question_rr, rr_class); + ldns_rr_set_question(question_rr, true); + + packet->_tsig_rr = NULL; + + ldns_pkt_push_rr(packet, LDNS_SECTION_QUESTION, question_rr); + + return packet; +} + +ldns_pkt_type +ldns_pkt_reply_type(ldns_pkt *p) +{ + ldns_rr_list *tmp; + + if (!p) { + return LDNS_PACKET_UNKNOWN; + } + + if (ldns_pkt_get_rcode(p) == LDNS_RCODE_NXDOMAIN) { + return LDNS_PACKET_NXDOMAIN; + } + + if (ldns_pkt_ancount(p) == 0 && ldns_pkt_arcount(p) == 0 + && ldns_pkt_nscount(p) == 1) { + + /* check for SOA */ + tmp = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_SOA, + LDNS_SECTION_AUTHORITY); + if (tmp) { + ldns_rr_list_deep_free(tmp); + return LDNS_PACKET_NODATA; + } else { + /* I have no idea ... */ + } + } + + if (ldns_pkt_ancount(p) == 0 && ldns_pkt_nscount(p) > 0) { + tmp = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NS, + LDNS_SECTION_AUTHORITY); + if (tmp) { + /* there are nameservers here */ + ldns_rr_list_deep_free(tmp); + return LDNS_PACKET_REFERRAL; + } else { + /* I have no idea */ + } + ldns_rr_list_deep_free(tmp); + } + + /* if we cannot determine the packet type, we say it's an + * answer... + */ + return LDNS_PACKET_ANSWER; +} + +ldns_pkt * +ldns_pkt_clone(ldns_pkt *pkt) +{ + ldns_pkt *new_pkt; + + if (!pkt) { + return NULL; + } + new_pkt = ldns_pkt_new(); + + ldns_pkt_set_id(new_pkt, ldns_pkt_id(pkt)); + ldns_pkt_set_qr(new_pkt, ldns_pkt_qr(pkt)); + ldns_pkt_set_aa(new_pkt, ldns_pkt_aa(pkt)); + ldns_pkt_set_tc(new_pkt, ldns_pkt_tc(pkt)); + ldns_pkt_set_rd(new_pkt, ldns_pkt_rd(pkt)); + ldns_pkt_set_cd(new_pkt, ldns_pkt_cd(pkt)); + ldns_pkt_set_ra(new_pkt, ldns_pkt_ra(pkt)); + ldns_pkt_set_ad(new_pkt, ldns_pkt_ad(pkt)); + ldns_pkt_set_opcode(new_pkt, ldns_pkt_get_opcode(pkt)); + ldns_pkt_set_rcode(new_pkt, ldns_pkt_get_rcode(pkt)); + ldns_pkt_set_qdcount(new_pkt, ldns_pkt_qdcount(pkt)); + ldns_pkt_set_ancount(new_pkt, ldns_pkt_ancount(pkt)); + ldns_pkt_set_nscount(new_pkt, ldns_pkt_nscount(pkt)); + ldns_pkt_set_arcount(new_pkt, ldns_pkt_arcount(pkt)); + ldns_pkt_set_answerfrom(new_pkt, ldns_pkt_answerfrom(pkt)); + ldns_pkt_set_querytime(new_pkt, ldns_pkt_querytime(pkt)); + ldns_pkt_set_size(new_pkt, ldns_pkt_size(pkt)); + ldns_pkt_set_tsig(new_pkt, ldns_rr_clone(ldns_pkt_tsig(pkt))); + + ldns_pkt_set_edns_udp_size(new_pkt, ldns_pkt_edns_udp_size(pkt)); + ldns_pkt_set_edns_extended_rcode(new_pkt, + ldns_pkt_edns_extended_rcode(pkt)); + ldns_pkt_set_edns_version(new_pkt, ldns_pkt_edns_version(pkt)); + ldns_pkt_set_edns_z(new_pkt, ldns_pkt_edns_z(pkt)); + if(ldns_pkt_edns_data(pkt)) + ldns_pkt_set_edns_data(new_pkt, + ldns_rdf_clone(ldns_pkt_edns_data(pkt))); + ldns_pkt_set_edns_do(new_pkt, ldns_pkt_edns_do(pkt)); + + ldns_rr_list_deep_free(new_pkt->_question); + ldns_rr_list_deep_free(new_pkt->_answer); + ldns_rr_list_deep_free(new_pkt->_authority); + ldns_rr_list_deep_free(new_pkt->_additional); + new_pkt->_question = ldns_rr_list_clone(ldns_pkt_question(pkt)); + new_pkt->_answer = ldns_rr_list_clone(ldns_pkt_answer(pkt)); + new_pkt->_authority = ldns_rr_list_clone(ldns_pkt_authority(pkt)); + new_pkt->_additional = ldns_rr_list_clone(ldns_pkt_additional(pkt)); + return new_pkt; +} diff --git a/libs/ldns/parse.c b/libs/ldns/parse.c new file mode 100644 index 0000000000..0487873520 --- /dev/null +++ b/libs/ldns/parse.c @@ -0,0 +1,445 @@ +/* + * a generic (simple) parser. Use to parse rr's, private key + * information and /etc/resolv.conf files + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ +#include +#include + +#include +#include + +ldns_lookup_table ldns_directive_types[] = { + { LDNS_DIR_TTL, "$TTL" }, + { LDNS_DIR_ORIGIN, "$ORIGIN" }, + { LDNS_DIR_INCLUDE, "$INCLUDE" }, + { 0, NULL } +}; + +/* add max_limit here? */ +ssize_t +ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit) +{ + return ldns_fget_token_l(f, token, delim, limit, NULL); +} + +ssize_t +ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr) +{ + int c, prev_c; + int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ + int com, quoted; + char *t; + size_t i; + const char *d; + const char *del; + + /* standard delimeters */ + if (!delim) { + /* from isspace(3) */ + del = LDNS_PARSE_NORMAL; + } else { + del = delim; + } + + p = 0; + i = 0; + com = 0; + quoted = 0; + prev_c = 0; + t = token; + if (del[0] == '"') { + quoted = 1; + } + while ((c = getc(f)) != EOF) { + if (c == '(' && prev_c != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p++; + } + prev_c = c; + continue; + } + + if (c == ')' && prev_c != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p--; + } + prev_c = c; + continue; + } + + if (p < 0) { + /* more ) then ( - close off the string */ + *t = '\0'; + return 0; + } + + /* do something with comments ; */ + if (c == ';' && quoted == 0) { + if (prev_c != '\\') { + com = 1; + } + } + if (c == '\"' && com == 0 && prev_c != '\\') { + quoted = 1 - quoted; + } + + if (c == '\n' && com != 0) { + /* comments */ + com = 0; + *t = ' '; + if (line_nr) { + *line_nr = *line_nr + 1; + } + if (p == 0 && i > 0) { + goto tokenread; + } else { + prev_c = c; + continue; + } + } + + if (com == 1) { + *t = ' '; + prev_c = c; + continue; + } + + + if (c == '\n' && p != 0 && t > token) { + /* in parentheses */ + if (line_nr) { + *line_nr = *line_nr + 1; + } + *t++ = ' '; + prev_c = c; + continue; + } + + /* check if we hit the delim */ + for (d = del; *d; d++) { + if (c == *d && i > 0 && prev_c != '\\') { + if (c == '\n' && line_nr) { + *line_nr = *line_nr + 1; + } + goto tokenread; + } + } + if (c != '\0' && c != '\n') { + *t++ = c; + i++; + } + if (limit > 0 && i >= limit) { + *t = '\0'; + return -1; + } + if (c == '\\' && prev_c == '\\') + prev_c = 0; + else prev_c = c; + } + *t = '\0'; + if (c == EOF) { + return (ssize_t)i; + } + + if (i == 0) { + /* nothing read */ + return -1; + } + if (p != 0) { + return -1; + } + return (ssize_t)i; + +tokenread: + ldns_fskipcs_l(f, delim, line_nr); + *t = '\0'; + if (p != 0) { + return -1; + } + + return (ssize_t)i; +} + +ssize_t +ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, + const char *d_del, size_t data_limit) +{ + return ldns_fget_keyword_data_l(f, keyword, k_del, data, d_del, + data_limit, NULL); +} + +ssize_t +ldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, + const char *d_del, size_t data_limit, int *line_nr) +{ + /* we assume: keyword|sep|data */ + char *fkeyword; + ssize_t i; + + if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) + return -1; + fkeyword = LDNS_XMALLOC(char, LDNS_MAX_KEYWORDLEN); + if(!fkeyword) + return -1; + + i = ldns_fget_token(f, fkeyword, k_del, LDNS_MAX_KEYWORDLEN); + if(i==0 || i==-1) { + LDNS_FREE(fkeyword); + return -1; + } + + /* case??? i instead of strlen? */ + if (strncmp(fkeyword, keyword, LDNS_MAX_KEYWORDLEN - 1) == 0) { + /* whee! */ + /* printf("%s\n%s\n", "Matching keyword", fkeyword); */ + i = ldns_fget_token_l(f, data, d_del, data_limit, line_nr); + LDNS_FREE(fkeyword); + return i; + } else { + /*printf("no match for %s (read: %s)\n", keyword, fkeyword);*/ + LDNS_FREE(fkeyword); + return -1; + } +} + + +ssize_t +ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit) +{ + int c, lc; + int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ + int com, quoted; + char *t; + size_t i; + const char *d; + const char *del; + + /* standard delimiters */ + if (!delim) { + /* from isspace(3) */ + del = LDNS_PARSE_NORMAL; + } else { + del = delim; + } + + p = 0; + i = 0; + com = 0; + quoted = 0; + t = token; + lc = 0; + if (del[0] == '"') { + quoted = 1; + } + + while ((c = ldns_bgetc(b)) != EOF) { + if (c == '(' && lc != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p++; + } + lc = c; + continue; + } + + if (c == ')' && lc != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p--; + } + lc = c; + continue; + } + + if (p < 0) { + /* more ) then ( */ + *t = '\0'; + return 0; + } + + /* do something with comments ; */ + if (c == ';' && quoted == 0) { + if (lc != '\\') { + com = 1; + } + } + if (c == '"' && com == 0 && lc != '\\') { + quoted = 1 - quoted; + } + + if (c == '\n' && com != 0) { + /* comments */ + com = 0; + *t = ' '; + lc = c; + continue; + } + + if (com == 1) { + *t = ' '; + lc = c; + continue; + } + + if (c == '\n' && p != 0) { + /* in parentheses */ + *t++ = ' '; + lc = c; + continue; + } + + /* check if we hit the delim */ + for (d = del; *d; d++) { + if (c == *d && lc != '\\') { + goto tokenread; + } + } + + *t++ = c; + i++; + if (limit > 0 && i >= limit) { + *t = '\0'; + return -1; + } + + if (c == '\\' && lc == '\\') { + lc = 0; + } else { + lc = c; + } + } + *t = '\0'; + if (i == 0) { + /* nothing read */ + return -1; + } + if (p != 0) { + return -1; + } + return (ssize_t)i; + +tokenread: + ldns_bskipcs(b, delim); + *t = '\0'; + + if (p != 0) { + return -1; + } + return (ssize_t)i; +} + +void +ldns_bskipc(ldns_buffer *buffer, char c) +{ + while (c == (char) ldns_buffer_read_u8_at(buffer, ldns_buffer_position(buffer))) { + if (ldns_buffer_available_at(buffer, + buffer->_position + sizeof(char), sizeof(char))) { + buffer->_position += sizeof(char); + } else { + return; + } + } +} + +void +ldns_bskipcs(ldns_buffer *buffer, const char *s) +{ + bool found; + char c; + const char *d; + + while(ldns_buffer_available_at(buffer, buffer->_position, sizeof(char))) { + c = (char) ldns_buffer_read_u8_at(buffer, buffer->_position); + found = false; + for (d = s; *d; d++) { + if (*d == c) { + found = true; + } + } + if (found && buffer->_limit > buffer->_position) { + buffer->_position += sizeof(char); + } else { + return; + } + } +} + +void +ldns_fskipc(FILE *fp, char c) +{ + fp = fp; + c = c; +} + + +void +ldns_fskipcs(FILE *fp, const char *s) +{ + ldns_fskipcs_l(fp, s, NULL); +} + +void +ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr) +{ + bool found; + int c; + const char *d; + + while ((c = fgetc(fp)) != EOF) { + if (line_nr && c == '\n') { + *line_nr = *line_nr + 1; + } + found = false; + for (d = s; *d; d++) { + if (*d == c) { + found = true; + } + } + if (!found) { + /* with getc, we've read too far */ + ungetc(c, fp); + return; + } + } +} + +ssize_t +ldns_bget_keyword_data(ldns_buffer *b, const char *keyword, const char *k_del, char +*data, const char *d_del, size_t data_limit) +{ + /* we assume: keyword|sep|data */ + char *fkeyword; + ssize_t i; + + if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) + return -1; + fkeyword = LDNS_XMALLOC(char, LDNS_MAX_KEYWORDLEN); + if(!fkeyword) + return -1; /* out of memory */ + + i = ldns_bget_token(b, fkeyword, k_del, data_limit); + if(i==0 || i==-1) { + LDNS_FREE(fkeyword); + return -1; /* nothing read */ + } + + /* case??? */ + if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) { + LDNS_FREE(fkeyword); + /* whee, the match! */ + /* retrieve it's data */ + i = ldns_bget_token(b, data, d_del, 0); + return i; + } else { + LDNS_FREE(fkeyword); + return -1; + } +} + diff --git a/libs/ldns/rbtree.c b/libs/ldns/rbtree.c new file mode 100644 index 0000000000..217e61d275 --- /dev/null +++ b/libs/ldns/rbtree.c @@ -0,0 +1,669 @@ +/* + * rbtree.c -- generic red black tree + * + * Taken from Unbound, modified for ldns + * + * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the NLNET LABS nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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. + * + */ + +/** + * \file + * Implementation of a redblack tree. + */ + +#include +#include +#include + +/** Node colour black */ +#define BLACK 0 +/** Node colour red */ +#define RED 1 + +/** the NULL node, global alloc */ +ldns_rbnode_t ldns_rbtree_null_node = { + LDNS_RBTREE_NULL, /* Parent. */ + LDNS_RBTREE_NULL, /* Left. */ + LDNS_RBTREE_NULL, /* Right. */ + NULL, /* Key. */ + NULL, /* Data. */ + BLACK /* Color. */ +}; + +/** rotate subtree left (to preserve redblack property) */ +static void ldns_rbtree_rotate_left(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); +/** rotate subtree right (to preserve redblack property) */ +static void ldns_rbtree_rotate_right(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); +/** Fixup node colours when insert happened */ +static void ldns_rbtree_insert_fixup(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); +/** Fixup node colours when delete happened */ +static void ldns_rbtree_delete_fixup(ldns_rbtree_t* rbtree, ldns_rbnode_t* child, ldns_rbnode_t* child_parent); + +/* + * Creates a new red black tree, intializes and returns a pointer to it. + * + * Return NULL on failure. + * + */ +ldns_rbtree_t * +ldns_rbtree_create (int (*cmpf)(const void *, const void *)) +{ + ldns_rbtree_t *rbtree; + + /* Allocate memory for it */ + rbtree = (ldns_rbtree_t *) malloc(sizeof(ldns_rbtree_t)); + if (!rbtree) { + return NULL; + } + + /* Initialize it */ + ldns_rbtree_init(rbtree, cmpf); + + return rbtree; +} + +void +ldns_rbtree_init(ldns_rbtree_t *rbtree, int (*cmpf)(const void *, const void *)) +{ + /* Initialize it */ + rbtree->root = LDNS_RBTREE_NULL; + rbtree->count = 0; + rbtree->cmp = cmpf; +} + +void +ldns_rbtree_free(ldns_rbtree_t *rbtree) +{ + free(rbtree); +} + +/* + * Rotates the node to the left. + * + */ +static void +ldns_rbtree_rotate_left(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) +{ + ldns_rbnode_t *right = node->right; + node->right = right->left; + if (right->left != LDNS_RBTREE_NULL) + right->left->parent = node; + + right->parent = node->parent; + + if (node->parent != LDNS_RBTREE_NULL) { + if (node == node->parent->left) { + node->parent->left = right; + } else { + node->parent->right = right; + } + } else { + rbtree->root = right; + } + right->left = node; + node->parent = right; +} + +/* + * Rotates the node to the right. + * + */ +static void +ldns_rbtree_rotate_right(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) +{ + ldns_rbnode_t *left = node->left; + node->left = left->right; + if (left->right != LDNS_RBTREE_NULL) + left->right->parent = node; + + left->parent = node->parent; + + if (node->parent != LDNS_RBTREE_NULL) { + if (node == node->parent->right) { + node->parent->right = left; + } else { + node->parent->left = left; + } + } else { + rbtree->root = left; + } + left->right = node; + node->parent = left; +} + +static void +ldns_rbtree_insert_fixup(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) +{ + ldns_rbnode_t *uncle; + + /* While not at the root and need fixing... */ + while (node != rbtree->root && node->parent->color == RED) { + /* If our parent is left child of our grandparent... */ + if (node->parent == node->parent->parent->left) { + uncle = node->parent->parent->right; + + /* If our uncle is red... */ + if (uncle->color == RED) { + /* Paint the parent and the uncle black... */ + node->parent->color = BLACK; + uncle->color = BLACK; + + /* And the grandparent red... */ + node->parent->parent->color = RED; + + /* And continue fixing the grandparent */ + node = node->parent->parent; + } else { /* Our uncle is black... */ + /* Are we the right child? */ + if (node == node->parent->right) { + node = node->parent; + ldns_rbtree_rotate_left(rbtree, node); + } + /* Now we're the left child, repaint and rotate... */ + node->parent->color = BLACK; + node->parent->parent->color = RED; + ldns_rbtree_rotate_right(rbtree, node->parent->parent); + } + } else { + uncle = node->parent->parent->left; + + /* If our uncle is red... */ + if (uncle->color == RED) { + /* Paint the parent and the uncle black... */ + node->parent->color = BLACK; + uncle->color = BLACK; + + /* And the grandparent red... */ + node->parent->parent->color = RED; + + /* And continue fixing the grandparent */ + node = node->parent->parent; + } else { /* Our uncle is black... */ + /* Are we the right child? */ + if (node == node->parent->left) { + node = node->parent; + ldns_rbtree_rotate_right(rbtree, node); + } + /* Now we're the right child, repaint and rotate... */ + node->parent->color = BLACK; + node->parent->parent->color = RED; + ldns_rbtree_rotate_left(rbtree, node->parent->parent); + } + } + } + rbtree->root->color = BLACK; +} + +void +ldns_rbtree_insert_vref(ldns_rbnode_t *data, void *rbtree) +{ + (void) ldns_rbtree_insert((ldns_rbtree_t *) rbtree, + data); +} + +/* + * Inserts a node into a red black tree. + * + * Returns NULL on failure or the pointer to the newly added node + * otherwise. + */ +ldns_rbnode_t * +ldns_rbtree_insert (ldns_rbtree_t *rbtree, ldns_rbnode_t *data) +{ + /* XXX Not necessary, but keeps compiler quiet... */ + int r = 0; + + /* We start at the root of the tree */ + ldns_rbnode_t *node = rbtree->root; + ldns_rbnode_t *parent = LDNS_RBTREE_NULL; + + /* Lets find the new parent... */ + while (node != LDNS_RBTREE_NULL) { + /* Compare two keys, do we have a duplicate? */ + if ((r = rbtree->cmp(data->key, node->key)) == 0) { + return NULL; + } + parent = node; + + if (r < 0) { + node = node->left; + } else { + node = node->right; + } + } + + /* Initialize the new node */ + data->parent = parent; + data->left = data->right = LDNS_RBTREE_NULL; + data->color = RED; + rbtree->count++; + + /* Insert it into the tree... */ + if (parent != LDNS_RBTREE_NULL) { + if (r < 0) { + parent->left = data; + } else { + parent->right = data; + } + } else { + rbtree->root = data; + } + + /* Fix up the red-black properties... */ + ldns_rbtree_insert_fixup(rbtree, data); + + return data; +} + +/* + * Searches the red black tree, returns the data if key is found or NULL otherwise. + * + */ +ldns_rbnode_t * +ldns_rbtree_search (ldns_rbtree_t *rbtree, const void *key) +{ + ldns_rbnode_t *node; + + if (ldns_rbtree_find_less_equal(rbtree, key, &node)) { + return node; + } else { + return NULL; + } +} + +/** helpers for delete: swap node colours */ +static void swap_int8(uint8_t* x, uint8_t* y) +{ + uint8_t t = *x; *x = *y; *y = t; +} + +/** helpers for delete: swap node pointers */ +static void swap_np(ldns_rbnode_t** x, ldns_rbnode_t** y) +{ + ldns_rbnode_t* t = *x; *x = *y; *y = t; +} + +/** Update parent pointers of child trees of 'parent' */ +static void change_parent_ptr(ldns_rbtree_t* rbtree, ldns_rbnode_t* parent, ldns_rbnode_t* old, ldns_rbnode_t* new) +{ + if(parent == LDNS_RBTREE_NULL) + { + if(rbtree->root == old) rbtree->root = new; + return; + } + if(parent->left == old) parent->left = new; + if(parent->right == old) parent->right = new; +} +/** Update parent pointer of a node 'child' */ +static void change_child_ptr(ldns_rbnode_t* child, ldns_rbnode_t* old, ldns_rbnode_t* new) +{ + if(child == LDNS_RBTREE_NULL) return; + if(child->parent == old) child->parent = new; +} + +ldns_rbnode_t* +ldns_rbtree_delete(ldns_rbtree_t *rbtree, const void *key) +{ + ldns_rbnode_t *to_delete; + ldns_rbnode_t *child; + if((to_delete = ldns_rbtree_search(rbtree, key)) == 0) return 0; + rbtree->count--; + + /* make sure we have at most one non-leaf child */ + if(to_delete->left != LDNS_RBTREE_NULL && + to_delete->right != LDNS_RBTREE_NULL) + { + /* swap with smallest from right subtree (or largest from left) */ + ldns_rbnode_t *smright = to_delete->right; + while(smright->left != LDNS_RBTREE_NULL) + smright = smright->left; + /* swap the smright and to_delete elements in the tree, + * but the ldns_rbnode_t is first part of user data struct + * so cannot just swap the keys and data pointers. Instead + * readjust the pointers left,right,parent */ + + /* swap colors - colors are tied to the position in the tree */ + swap_int8(&to_delete->color, &smright->color); + + /* swap child pointers in parents of smright/to_delete */ + change_parent_ptr(rbtree, to_delete->parent, to_delete, smright); + if(to_delete->right != smright) + change_parent_ptr(rbtree, smright->parent, smright, to_delete); + + /* swap parent pointers in children of smright/to_delete */ + change_child_ptr(smright->left, smright, to_delete); + change_child_ptr(smright->left, smright, to_delete); + change_child_ptr(smright->right, smright, to_delete); + change_child_ptr(smright->right, smright, to_delete); + change_child_ptr(to_delete->left, to_delete, smright); + if(to_delete->right != smright) + change_child_ptr(to_delete->right, to_delete, smright); + if(to_delete->right == smright) + { + /* set up so after swap they work */ + to_delete->right = to_delete; + smright->parent = smright; + } + + /* swap pointers in to_delete/smright nodes */ + swap_np(&to_delete->parent, &smright->parent); + swap_np(&to_delete->left, &smright->left); + swap_np(&to_delete->right, &smright->right); + + /* now delete to_delete (which is at the location where the smright previously was) */ + } + + if(to_delete->left != LDNS_RBTREE_NULL) child = to_delete->left; + else child = to_delete->right; + + /* unlink to_delete from the tree, replace to_delete with child */ + change_parent_ptr(rbtree, to_delete->parent, to_delete, child); + change_child_ptr(child, to_delete, to_delete->parent); + + if(to_delete->color == RED) + { + /* if node is red then the child (black) can be swapped in */ + } + else if(child->color == RED) + { + /* change child to BLACK, removing a RED node is no problem */ + if(child!=LDNS_RBTREE_NULL) child->color = BLACK; + } + else ldns_rbtree_delete_fixup(rbtree, child, to_delete->parent); + + /* unlink completely */ + to_delete->parent = LDNS_RBTREE_NULL; + to_delete->left = LDNS_RBTREE_NULL; + to_delete->right = LDNS_RBTREE_NULL; + to_delete->color = BLACK; + return to_delete; +} + +static void ldns_rbtree_delete_fixup(ldns_rbtree_t* rbtree, ldns_rbnode_t* child, ldns_rbnode_t* child_parent) +{ + ldns_rbnode_t* sibling; + int go_up = 1; + + /* determine sibling to the node that is one-black short */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + + while(go_up) + { + if(child_parent == LDNS_RBTREE_NULL) + { + /* removed parent==black from root, every path, so ok */ + return; + } + + if(sibling->color == RED) + { /* rotate to get a black sibling */ + child_parent->color = RED; + sibling->color = BLACK; + if(child_parent->right == child) + ldns_rbtree_rotate_right(rbtree, child_parent); + else ldns_rbtree_rotate_left(rbtree, child_parent); + /* new sibling after rotation */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + + if(child_parent->color == BLACK + && sibling->color == BLACK + && sibling->left->color == BLACK + && sibling->right->color == BLACK) + { /* fixup local with recolor of sibling */ + if(sibling != LDNS_RBTREE_NULL) + sibling->color = RED; + + child = child_parent; + child_parent = child_parent->parent; + /* prepare to go up, new sibling */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + else go_up = 0; + } + + if(child_parent->color == RED + && sibling->color == BLACK + && sibling->left->color == BLACK + && sibling->right->color == BLACK) + { + /* move red to sibling to rebalance */ + if(sibling != LDNS_RBTREE_NULL) + sibling->color = RED; + child_parent->color = BLACK; + return; + } + + /* get a new sibling, by rotating at sibling. See which child + of sibling is red */ + if(child_parent->right == child + && sibling->color == BLACK + && sibling->right->color == RED + && sibling->left->color == BLACK) + { + sibling->color = RED; + sibling->right->color = BLACK; + ldns_rbtree_rotate_left(rbtree, sibling); + /* new sibling after rotation */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + else if(child_parent->left == child + && sibling->color == BLACK + && sibling->left->color == RED + && sibling->right->color == BLACK) + { + sibling->color = RED; + sibling->left->color = BLACK; + ldns_rbtree_rotate_right(rbtree, sibling); + /* new sibling after rotation */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + + /* now we have a black sibling with a red child. rotate and exchange colors. */ + sibling->color = child_parent->color; + child_parent->color = BLACK; + if(child_parent->right == child) + { + sibling->left->color = BLACK; + ldns_rbtree_rotate_right(rbtree, child_parent); + } + else + { + sibling->right->color = BLACK; + ldns_rbtree_rotate_left(rbtree, child_parent); + } +} + +int +ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key, ldns_rbnode_t **result) +{ + int r; + ldns_rbnode_t *node; + + /* We start at root... */ + node = rbtree->root; + + *result = NULL; + + /* While there are children... */ + while (node != LDNS_RBTREE_NULL) { + r = rbtree->cmp(key, node->key); + if (r == 0) { + /* Exact match */ + *result = node; + return 1; + } + if (r < 0) { + node = node->left; + } else { + /* Temporary match */ + *result = node; + node = node->right; + } + } + return 0; +} + +/* + * Finds the first element in the red black tree + * + */ +ldns_rbnode_t * +ldns_rbtree_first (ldns_rbtree_t *rbtree) +{ + ldns_rbnode_t *node = rbtree->root; + + if (rbtree->root != LDNS_RBTREE_NULL) { + for (node = rbtree->root; node->left != LDNS_RBTREE_NULL; node = node->left); + } + return node; +} + +ldns_rbnode_t * +ldns_rbtree_last (ldns_rbtree_t *rbtree) +{ + ldns_rbnode_t *node = rbtree->root; + + if (rbtree->root != LDNS_RBTREE_NULL) { + for (node = rbtree->root; node->right != LDNS_RBTREE_NULL; node = node->right); + } + return node; +} + +/* + * Returns the next node... + * + */ +ldns_rbnode_t * +ldns_rbtree_next (ldns_rbnode_t *node) +{ + ldns_rbnode_t *parent; + + if (node->right != LDNS_RBTREE_NULL) { + /* One right, then keep on going left... */ + for (node = node->right; + node->left != LDNS_RBTREE_NULL; + node = node->left); + } else { + parent = node->parent; + while (parent != LDNS_RBTREE_NULL && node == parent->right) { + node = parent; + parent = parent->parent; + } + node = parent; + } + return node; +} + +ldns_rbnode_t * +ldns_rbtree_previous(ldns_rbnode_t *node) +{ + ldns_rbnode_t *parent; + + if (node->left != LDNS_RBTREE_NULL) { + /* One left, then keep on going right... */ + for (node = node->left; + node->right != LDNS_RBTREE_NULL; + node = node->right); + } else { + parent = node->parent; + while (parent != LDNS_RBTREE_NULL && node == parent->left) { + node = parent; + parent = parent->parent; + } + node = parent; + } + return node; +} + +/** + * split off elements number of elements from the start + * of the name tree and return a new tree + */ +ldns_rbtree_t * +ldns_rbtree_split(ldns_rbtree_t *tree, + size_t elements) +{ + ldns_rbtree_t *new_tree; + ldns_rbnode_t *cur_node; + ldns_rbnode_t *move_node; + size_t count = 0; + + new_tree = ldns_rbtree_create(tree->cmp); + + cur_node = ldns_rbtree_first(tree); + while (count < elements && cur_node != LDNS_RBTREE_NULL) { + move_node = ldns_rbtree_delete(tree, cur_node->key); + (void)ldns_rbtree_insert(new_tree, move_node); + cur_node = ldns_rbtree_first(tree); + count++; + } + + return new_tree; +} + +/* + * add all node from the second tree to the first (removing them from the + * second), and fix up nsec(3)s if present + */ +void +ldns_rbtree_join(ldns_rbtree_t *tree1, ldns_rbtree_t *tree2) +{ + ldns_traverse_postorder(tree2, ldns_rbtree_insert_vref, tree1); +} + +/** recursive descent traverse */ +static void +traverse_post(void (*func)(ldns_rbnode_t*, void*), void* arg, + ldns_rbnode_t* node) +{ + if(!node || node == LDNS_RBTREE_NULL) + return; + /* recurse */ + traverse_post(func, arg, node->left); + traverse_post(func, arg, node->right); + /* call user func */ + (*func)(node, arg); +} + +void +ldns_traverse_postorder(ldns_rbtree_t* tree, + void (*func)(ldns_rbnode_t*, void*), void* arg) +{ + traverse_post(func, arg, tree->root); +} diff --git a/libs/ldns/rdata.c b/libs/ldns/rdata.c new file mode 100644 index 0000000000..8af16a13a1 --- /dev/null +++ b/libs/ldns/rdata.c @@ -0,0 +1,675 @@ +/* + * rdata.c + * + * rdata implementation + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +/* + * Access functions + * do this as functions to get type checking + */ + +/* read */ +size_t +ldns_rdf_size(const ldns_rdf *rd) +{ + assert(rd != NULL); + return rd->_size; +} + +ldns_rdf_type +ldns_rdf_get_type(const ldns_rdf *rd) +{ + assert(rd != NULL); + return rd->_type; +} + +uint8_t * +ldns_rdf_data(const ldns_rdf *rd) +{ + assert(rd != NULL); + return rd->_data; +} + +/* write */ +void +ldns_rdf_set_size(ldns_rdf *rd, size_t size) +{ + assert(rd != NULL); + rd->_size = size; +} + +void +ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type) +{ + assert(rd != NULL); + rd->_type = type; +} + +void +ldns_rdf_set_data(ldns_rdf *rd, void *data) +{ + /* only copy the pointer */ + assert(rd != NULL); + rd->_data = data; +} + +/* for types that allow it, return + * the native/host order type */ +uint8_t +ldns_rdf2native_int8(const ldns_rdf *rd) +{ + uint8_t data; + + /* only allow 8 bit rdfs */ + if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_BYTE) { + return 0; + } + + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return data; +} + +uint16_t +ldns_rdf2native_int16(const ldns_rdf *rd) +{ + uint16_t data; + + /* only allow 16 bit rdfs */ + if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_WORD) { + return 0; + } + + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return ntohs(data); +} + +uint32_t +ldns_rdf2native_int32(const ldns_rdf *rd) +{ + uint32_t data; + + /* only allow 32 bit rdfs */ + if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_DOUBLEWORD) { + return 0; + } + + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return ntohl(data); +} + +time_t +ldns_rdf2native_time_t(const ldns_rdf *rd) +{ + uint32_t data; + + switch(ldns_rdf_get_type(rd)) { + case LDNS_RDF_TYPE_TIME: + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return (time_t)ntohl(data); + default: + return 0; + } +} + +ldns_rdf * +ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value) +{ + return ldns_rdf_new_frm_data(type, LDNS_RDF_SIZE_BYTE, &value); +} + +ldns_rdf * +ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value) +{ + uint16_t *rdf_data = LDNS_XMALLOC(uint16_t, 1); + ldns_rdf* rdf; + if (!rdf_data) { + return NULL; + } + ldns_write_uint16(rdf_data, value); + rdf = ldns_rdf_new(type, LDNS_RDF_SIZE_WORD, rdf_data); + if(!rdf) + LDNS_FREE(rdf_data); + return rdf; +} + +ldns_rdf * +ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value) +{ + uint32_t *rdf_data = LDNS_XMALLOC(uint32_t, 1); + ldns_rdf* rdf; + if (!rdf_data) { + return NULL; + } + ldns_write_uint32(rdf_data, value); + rdf = ldns_rdf_new(type, LDNS_RDF_SIZE_DOUBLEWORD, rdf_data); + if(!rdf) + LDNS_FREE(rdf_data); + return rdf; +} + +ldns_rdf * +ldns_native2rdf_int16_data(size_t size, uint8_t *data) +{ + uint8_t *rdf_data = LDNS_XMALLOC(uint8_t, size + 2); + ldns_rdf* rdf; + if (!rdf_data) { + return NULL; + } + ldns_write_uint16(rdf_data, size); + memcpy(rdf_data + 2, data, size); + rdf = ldns_rdf_new(LDNS_RDF_TYPE_INT16_DATA, size + 2, rdf_data); + if(!rdf) + LDNS_FREE(rdf_data); + return rdf; +} + +/* note: data must be allocated memory */ +ldns_rdf * +ldns_rdf_new(ldns_rdf_type type, size_t size, void *data) +{ + ldns_rdf *rd; + rd = LDNS_MALLOC(ldns_rdf); + if (!rd) { + return NULL; + } + ldns_rdf_set_size(rd, size); + ldns_rdf_set_type(rd, type); + ldns_rdf_set_data(rd, data); + return rd; +} + +ldns_rdf * +ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data) +{ + ldns_rdf *rdf; + + /* if the size is too big, fail */ + if (size > LDNS_MAX_RDFLEN) { + return NULL; + } + + /* allocate space */ + rdf = LDNS_MALLOC(ldns_rdf); + if (!rdf) { + return NULL; + } + rdf->_data = LDNS_XMALLOC(uint8_t, size); + if (!rdf->_data) { + LDNS_FREE(rdf); + return NULL; + } + + /* set the values */ + ldns_rdf_set_type(rdf, type); + ldns_rdf_set_size(rdf, size); + memcpy(rdf->_data, data, size); + + return rdf; +} + +ldns_rdf * +ldns_rdf_clone(const ldns_rdf *rd) +{ + assert(rd != NULL); + return (ldns_rdf_new_frm_data( ldns_rdf_get_type(rd), + ldns_rdf_size(rd), ldns_rdf_data(rd))); +} + +void +ldns_rdf_deep_free(ldns_rdf *rd) +{ + if (rd) { + if (rd->_data) { + LDNS_FREE(rd->_data); + } + LDNS_FREE(rd); + } +} + +void +ldns_rdf_free(ldns_rdf *rd) +{ + if (rd) { + LDNS_FREE(rd); + } +} + +ldns_rdf * +ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str) +{ + ldns_rdf *rdf = NULL; + ldns_status status; + + switch (type) { + case LDNS_RDF_TYPE_DNAME: + status = ldns_str2rdf_dname(&rdf, str); + break; + case LDNS_RDF_TYPE_INT8: + status = ldns_str2rdf_int8(&rdf, str); + break; + case LDNS_RDF_TYPE_INT16: + status = ldns_str2rdf_int16(&rdf, str); + break; + case LDNS_RDF_TYPE_INT32: + status = ldns_str2rdf_int32(&rdf, str); + break; + case LDNS_RDF_TYPE_A: + status = ldns_str2rdf_a(&rdf, str); + break; + case LDNS_RDF_TYPE_AAAA: + status = ldns_str2rdf_aaaa(&rdf, str); + break; + case LDNS_RDF_TYPE_STR: + status = ldns_str2rdf_str(&rdf, str); + break; + case LDNS_RDF_TYPE_APL: + status = ldns_str2rdf_apl(&rdf, str); + break; + case LDNS_RDF_TYPE_B64: + status = ldns_str2rdf_b64(&rdf, str); + break; + case LDNS_RDF_TYPE_B32_EXT: + status = ldns_str2rdf_b32_ext(&rdf, str); + break; + case LDNS_RDF_TYPE_HEX: + status = ldns_str2rdf_hex(&rdf, str); + break; + case LDNS_RDF_TYPE_NSEC: + status = ldns_str2rdf_nsec(&rdf, str); + break; + case LDNS_RDF_TYPE_TYPE: + status = ldns_str2rdf_type(&rdf, str); + break; + case LDNS_RDF_TYPE_CLASS: + status = ldns_str2rdf_class(&rdf, str); + break; + case LDNS_RDF_TYPE_CERT_ALG: + status = ldns_str2rdf_cert_alg(&rdf, str); + break; + case LDNS_RDF_TYPE_ALG: + status = ldns_str2rdf_alg(&rdf, str); + break; + case LDNS_RDF_TYPE_UNKNOWN: + status = ldns_str2rdf_unknown(&rdf, str); + break; + case LDNS_RDF_TYPE_TIME: + status = ldns_str2rdf_time(&rdf, str); + break; + case LDNS_RDF_TYPE_PERIOD: + status = ldns_str2rdf_period(&rdf, str); + break; + case LDNS_RDF_TYPE_TSIG: + status = ldns_str2rdf_tsig(&rdf, str); + break; + case LDNS_RDF_TYPE_SERVICE: + status = ldns_str2rdf_service(&rdf, str); + break; + case LDNS_RDF_TYPE_LOC: + status = ldns_str2rdf_loc(&rdf, str); + break; + case LDNS_RDF_TYPE_WKS: + status = ldns_str2rdf_wks(&rdf, str); + break; + case LDNS_RDF_TYPE_NSAP: + status = ldns_str2rdf_nsap(&rdf, str); + break; + case LDNS_RDF_TYPE_ATMA: + status = ldns_str2rdf_atma(&rdf, str); + break; + case LDNS_RDF_TYPE_IPSECKEY: + status = ldns_str2rdf_ipseckey(&rdf, str); + break; + case LDNS_RDF_TYPE_NSEC3_SALT: + status = ldns_str2rdf_nsec3_salt(&rdf, str); + break; + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + status = ldns_str2rdf_b32_ext(&rdf, str); + break; + case LDNS_RDF_TYPE_NONE: + default: + /* default default ??? */ + status = LDNS_STATUS_ERR; + break; + } + if (LDNS_STATUS_OK == status) { + ldns_rdf_set_type(rdf, type); + return rdf; + } + if (rdf) { + LDNS_FREE(rdf); + } + return NULL; +} + +ldns_status +ldns_rdf_new_frm_fp(ldns_rdf **rdf, ldns_rdf_type type, FILE *fp) +{ + return ldns_rdf_new_frm_fp_l(rdf, type, fp, NULL); +} + +ldns_status +ldns_rdf_new_frm_fp_l(ldns_rdf **rdf, ldns_rdf_type type, FILE *fp, int *line_nr) +{ + char *line; + ldns_rdf *r; + ssize_t t; + + line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + if (!line) { + return LDNS_STATUS_MEM_ERR; + } + + /* read an entire line in from the file */ + if ((t = ldns_fget_token_l(fp, line, LDNS_PARSE_SKIP_SPACE, 0, line_nr)) == -1 || t == 0) { + LDNS_FREE(line); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + r = ldns_rdf_new_frm_str(type, (const char*) line); + LDNS_FREE(line); + if (rdf) { + *rdf = r; + return LDNS_STATUS_OK; + } else { + return LDNS_STATUS_NULL; + } +} + +ldns_rdf * +ldns_rdf_address_reverse(ldns_rdf *rd) +{ + uint8_t buf_4[LDNS_IP4ADDRLEN]; + uint8_t buf_6[LDNS_IP6ADDRLEN * 2]; + ldns_rdf *rev; + ldns_rdf *in_addr; + ldns_rdf *ret_dname; + uint8_t octet; + uint8_t nnibble; + uint8_t nibble; + uint8_t i, j; + + char *char_dname; + int nbit; + + if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_A && + ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_AAAA) { + return NULL; + } + + in_addr = NULL; + ret_dname = NULL; + + switch(ldns_rdf_get_type(rd)) { + case LDNS_RDF_TYPE_A: + /* the length of the buffer is 4 */ + buf_4[3] = ldns_rdf_data(rd)[0]; + buf_4[2] = ldns_rdf_data(rd)[1]; + buf_4[1] = ldns_rdf_data(rd)[2]; + buf_4[0] = ldns_rdf_data(rd)[3]; + in_addr = ldns_dname_new_frm_str("in-addr.arpa."); + if (!in_addr) { + return NULL; + } + /* make a new rdf and convert that back */ + rev = ldns_rdf_new_frm_data( LDNS_RDF_TYPE_A, + LDNS_IP4ADDRLEN, (void*)&buf_4); + if (!rev) { + LDNS_FREE(in_addr); + return NULL; + } + + /* convert rev to a string */ + char_dname = ldns_rdf2str(rev); + if (!char_dname) { + LDNS_FREE(in_addr); + ldns_rdf_deep_free(rev); + return NULL; + } + /* transform back to rdf with type dname */ + ret_dname = ldns_dname_new_frm_str(char_dname); + if (!ret_dname) { + LDNS_FREE(in_addr); + ldns_rdf_deep_free(rev); + LDNS_FREE(char_dname); + return NULL; + } + /* not needed anymore */ + ldns_rdf_deep_free(rev); + LDNS_FREE(char_dname); + break; + case LDNS_RDF_TYPE_AAAA: + /* some foo magic to reverse the nibbles ... */ + + for (nbit = 127; nbit >= 0; nbit = nbit - 4) { + /* calculate octett (8 bit) */ + octet = ( ((unsigned int) nbit) & 0x78) >> 3; + /* calculate nibble */ + nnibble = ( ((unsigned int) nbit) & 0x04) >> 2; + /* extract nibble */ + nibble = (ldns_rdf_data(rd)[octet] & ( 0xf << (4 * (1 - + nnibble)) ) ) >> ( 4 * (1 - + nnibble)); + + buf_6[(LDNS_IP6ADDRLEN * 2 - 1) - + (octet * 2 + nnibble)] = + (uint8_t)ldns_int_to_hexdigit((int)nibble); + } + + char_dname = LDNS_XMALLOC(char, (LDNS_IP6ADDRLEN * 4)); + if (!char_dname) { + return NULL; + } + char_dname[LDNS_IP6ADDRLEN * 4 - 1] = '\0'; /* closure */ + + /* walk the string and add . 's */ + for (i = 0, j = 0; i < LDNS_IP6ADDRLEN * 2; i++, j = j + 2) { + char_dname[j] = (char)buf_6[i]; + if (i != LDNS_IP6ADDRLEN * 2 - 1) { + char_dname[j + 1] = '.'; + } + } + in_addr = ldns_dname_new_frm_str("ip6.arpa."); + if (!in_addr) { + LDNS_FREE(char_dname); + return NULL; + } + + /* convert rev to a string */ + ret_dname = ldns_dname_new_frm_str(char_dname); + LDNS_FREE(char_dname); + if (!ret_dname) { + ldns_rdf_deep_free(in_addr); + return NULL; + } + break; + default: + break; + } + /* add the suffix */ + rev = ldns_dname_cat_clone(ret_dname, in_addr); + + ldns_rdf_deep_free(ret_dname); + ldns_rdf_deep_free(in_addr); + return rev; +} + +ldns_status +ldns_octet(char *word, size_t *length) +{ + char *s; + char *p; + *length = 0; + + for (s = p = word; *s != '\0'; s++,p++) { + switch (*s) { + case '.': + if (s[1] == '.') { + return LDNS_STATUS_EMPTY_LABEL; + } + *p = *s; + (*length)++; + break; + case '\\': + if ('0' <= s[1] && s[1] <= '9' && + '0' <= s[2] && s[2] <= '9' && + '0' <= s[3] && s[3] <= '9') { + /* \DDD seen */ + int val = ((s[1] - '0') * 100 + + (s[2] - '0') * 10 + (s[3] - '0')); + + if (0 <= val && val <= 255) { + /* this also handles \0 */ + s += 3; + *p = val; + (*length)++; + } else { + return LDNS_STATUS_DDD_OVERFLOW; + } + } else { + /* an espaced character, like \ ? + * remove the '\' keep the rest */ + *p = *++s; + (*length)++; + } + break; + case '\"': + /* non quoted " Is either first or the last character in + * the string */ + + *p = *++s; /* skip it */ + (*length)++; + /* I'm not sure if this is needed in libdns... MG */ + if ( *s == '\0' ) { + /* ok, it was the last one */ + *p = '\0'; + return LDNS_STATUS_OK; + } + break; + default: + *p = *s; + (*length)++; + break; + } + } + *p = '\0'; + return LDNS_STATUS_OK; +} + +int +ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2) +{ + uint16_t i1, i2, i; + uint8_t *d1, *d2; + + /* only when both are not NULL we can say anything about them */ + if (!rd1 && !rd2) { + return 0; + } + if (!rd1 || !rd2) { + return -1; + } + i1 = ldns_rdf_size(rd1); + i2 = ldns_rdf_size(rd2); + + if (i1 < i2) { + return -1; + } else if (i1 > i2) { + return +1; + } else { + d1 = (uint8_t*)ldns_rdf_data(rd1); + d2 = (uint8_t*)ldns_rdf_data(rd2); + for(i = 0; i < i1; i++) { + if (d1[i] < d2[i]) { + return -1; + } else if (d1[i] > d2[i]) { + return +1; + } + } + } + return 0; +} + +uint32_t +ldns_str2period(const char *nptr, const char **endptr) +{ + int sign = 0; + uint32_t i = 0; + uint32_t seconds = 0; + + for(*endptr = nptr; **endptr; (*endptr)++) { + switch (**endptr) { + case ' ': + case '\t': + break; + case '-': + if(sign == 0) { + sign = -1; + } else { + return seconds; + } + break; + case '+': + if(sign == 0) { + sign = 1; + } else { + return seconds; + } + break; + case 's': + case 'S': + seconds += i; + i = 0; + break; + case 'm': + case 'M': + seconds += i * 60; + i = 0; + break; + case 'h': + case 'H': + seconds += i * 60 * 60; + i = 0; + break; + case 'd': + case 'D': + seconds += i * 60 * 60 * 24; + i = 0; + break; + case 'w': + case 'W': + seconds += i * 60 * 60 * 24 * 7; + i = 0; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + i *= 10; + i += (**endptr - '0'); + break; + default: + seconds += i; + /* disregard signedness */ + return seconds; + } + } + seconds += i; + /* disregard signedness */ + return seconds; +} diff --git a/libs/ldns/resolver.c b/libs/ldns/resolver.c new file mode 100644 index 0000000000..735e6f147d --- /dev/null +++ b/libs/ldns/resolver.c @@ -0,0 +1,1309 @@ +/* + * resolver.c + * + * resolver implementation + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include +#include + +/* Access function for reading + * and setting the different Resolver + * options */ + +/* read */ +uint16_t +ldns_resolver_port(const ldns_resolver *r) +{ + return r->_port; +} + +uint16_t +ldns_resolver_edns_udp_size(const ldns_resolver *r) +{ + return r->_edns_udp_size; +} + +uint8_t +ldns_resolver_retry(const ldns_resolver *r) +{ + return r->_retry; +} + +uint8_t +ldns_resolver_retrans(const ldns_resolver *r) +{ + return r->_retrans; +} + +bool +ldns_resolver_fallback(const ldns_resolver *r) +{ + return r->_fallback; +} + +uint8_t +ldns_resolver_ip6(const ldns_resolver *r) +{ + return r->_ip6; +} + +bool +ldns_resolver_recursive(const ldns_resolver *r) +{ + return r->_recursive; +} + +bool +ldns_resolver_debug(const ldns_resolver *r) +{ + return r->_debug; +} + +bool +ldns_resolver_dnsrch(const ldns_resolver *r) +{ + return r->_dnsrch; +} + +bool +ldns_resolver_fail(const ldns_resolver *r) +{ + return r->_fail; +} + +bool +ldns_resolver_defnames(const ldns_resolver *r) +{ + return r->_defnames; +} + +ldns_rdf * +ldns_resolver_domain(const ldns_resolver *r) +{ + return r->_domain; +} + +ldns_rdf ** +ldns_resolver_searchlist(const ldns_resolver *r) +{ + return r->_searchlist; +} + +ldns_rdf ** +ldns_resolver_nameservers(const ldns_resolver *r) +{ + return r->_nameservers; +} + +size_t +ldns_resolver_nameserver_count(const ldns_resolver *r) +{ + return r->_nameserver_count; +} + +bool +ldns_resolver_dnssec(const ldns_resolver *r) +{ + return r->_dnssec; +} + +bool +ldns_resolver_dnssec_cd(const ldns_resolver *r) +{ + return r->_dnssec_cd; +} + +ldns_rr_list * +ldns_resolver_dnssec_anchors(const ldns_resolver *r) +{ + return r->_dnssec_anchors; +} + +bool +ldns_resolver_trusted_key(const ldns_resolver *r, ldns_rr_list * keys, ldns_rr_list * trusted_keys) +{ + size_t i; + bool result = false; + + ldns_rr_list * trust_anchors; + ldns_rr * cur_rr; + + if (!r || !keys) { return false; } + + trust_anchors = ldns_resolver_dnssec_anchors(r); + + if (!trust_anchors) { return false; } + + for (i = 0; i < ldns_rr_list_rr_count(keys); i++) { + + cur_rr = ldns_rr_list_rr(keys, i); + if (ldns_rr_list_contains_rr(trust_anchors, cur_rr)) { + if (trusted_keys) { ldns_rr_list_push_rr(trusted_keys, cur_rr); } + result = true; + } + } + + return result; +} + +bool +ldns_resolver_igntc(const ldns_resolver *r) +{ + return r->_igntc; +} + +bool +ldns_resolver_usevc(const ldns_resolver *r) +{ + return r->_usevc; +} + +size_t * +ldns_resolver_rtt(const ldns_resolver *r) +{ + return r->_rtt; +} + +size_t +ldns_resolver_nameserver_rtt(const ldns_resolver *r, size_t pos) +{ + size_t *rtt; + + assert(r != NULL); + + rtt = ldns_resolver_rtt(r); + + if (pos >= ldns_resolver_nameserver_count(r)) { + /* error ?*/ + return 0; + } else { + return rtt[pos]; + } + +} + +struct timeval +ldns_resolver_timeout(const ldns_resolver *r) +{ + return r->_timeout; +} + +char * +ldns_resolver_tsig_keyname(const ldns_resolver *r) +{ + return r->_tsig_keyname; +} + +char * +ldns_resolver_tsig_algorithm(const ldns_resolver *r) +{ + return r->_tsig_algorithm; +} + +char * +ldns_resolver_tsig_keydata(const ldns_resolver *r) +{ + return r->_tsig_keydata; +} + +bool +ldns_resolver_random(const ldns_resolver *r) +{ + return r->_random; +} + +size_t +ldns_resolver_searchlist_count(const ldns_resolver *r) +{ + return r->_searchlist_count; +} + +/* write */ +void +ldns_resolver_set_port(ldns_resolver *r, uint16_t p) +{ + r->_port = p; +} + +ldns_rdf * +ldns_resolver_pop_nameserver(ldns_resolver *r) +{ + ldns_rdf **nameservers; + ldns_rdf *pop; + size_t ns_count; + size_t *rtt; + + assert(r != NULL); + + ns_count = ldns_resolver_nameserver_count(r); + nameservers = ldns_resolver_nameservers(r); + rtt = ldns_resolver_rtt(r); + if (ns_count == 0 || !nameservers) { + return NULL; + } + + pop = nameservers[ns_count - 1]; + + nameservers = LDNS_XREALLOC(nameservers, ldns_rdf *, (ns_count - 1)); + rtt = LDNS_XREALLOC(rtt, size_t, (ns_count - 1)); + + if(nameservers) + ldns_resolver_set_nameservers(r, nameservers); + if(rtt) + ldns_resolver_set_rtt(r, rtt); + /* decr the count */ + ldns_resolver_dec_nameserver_count(r); + return pop; +} + +ldns_status +ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n) +{ + ldns_rdf **nameservers; + size_t ns_count; + size_t *rtt; + + if (ldns_rdf_get_type(n) != LDNS_RDF_TYPE_A && + ldns_rdf_get_type(n) != LDNS_RDF_TYPE_AAAA) { + return LDNS_STATUS_ERR; + } + + ns_count = ldns_resolver_nameserver_count(r); + nameservers = ldns_resolver_nameservers(r); + rtt = ldns_resolver_rtt(r); + + /* make room for the next one */ + if (ns_count == 0) { + nameservers = LDNS_XMALLOC(ldns_rdf *, 1); + } else { + nameservers = LDNS_XREALLOC(nameservers, ldns_rdf *, (ns_count + 1)); + } + if(!nameservers) + return LDNS_STATUS_MEM_ERR; + + /* set the new value in the resolver */ + ldns_resolver_set_nameservers(r, nameservers); + + /* don't forget the rtt */ + if (ns_count == 0) { + rtt = LDNS_XMALLOC(size_t, 1); + } else { + rtt = LDNS_XREALLOC(rtt, size_t, (ns_count + 1)); + } + if(!rtt) + return LDNS_STATUS_MEM_ERR; + + /* slide n in its slot. */ + /* we clone it here, because then we can free the original + * rr's where it stood */ + nameservers[ns_count] = ldns_rdf_clone(n); + rtt[ns_count] = LDNS_RESOLV_RTT_MIN; + ldns_resolver_incr_nameserver_count(r); + ldns_resolver_set_rtt(r, rtt); + return LDNS_STATUS_OK; +} + +ldns_status +ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr) +{ + ldns_rdf *address; + if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_A && + ldns_rr_get_type(rr) != LDNS_RR_TYPE_AAAA)) { + return LDNS_STATUS_ERR; + } + address = ldns_rr_rdf(rr, 0); /* extract the ip number */ + if (address) { + return ldns_resolver_push_nameserver(r, address); + } else { + return LDNS_STATUS_ERR; + } +} + +ldns_status +ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist) +{ + ldns_rr *rr; + ldns_status stat; + size_t i; + + stat = LDNS_STATUS_OK; + if (rrlist) { + for(i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { + rr = ldns_rr_list_rr(rrlist, i); + if (ldns_resolver_push_nameserver_rr(r, rr) != LDNS_STATUS_OK) { + stat = LDNS_STATUS_ERR; + break; + } + } + return stat; + } else { + return LDNS_STATUS_ERR; + } +} + +void +ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s) +{ + r->_edns_udp_size = s; +} + +void +ldns_resolver_set_recursive(ldns_resolver *r, bool re) +{ + r->_recursive = re; +} + +void +ldns_resolver_set_dnssec(ldns_resolver *r, bool d) +{ + r->_dnssec = d; +} + +void +ldns_resolver_set_dnssec_cd(ldns_resolver *r, bool d) +{ + r->_dnssec_cd = d; +} + +void +ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list * l) +{ + r->_dnssec_anchors = l; +} + +ldns_status +ldns_resolver_push_dnssec_anchor(ldns_resolver *r, ldns_rr *rr) +{ + ldns_rr_list * trust_anchors; + + if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY)) { + return LDNS_STATUS_ERR; + } + + if (!(trust_anchors = ldns_resolver_dnssec_anchors(r))) { /* Initialize */ + trust_anchors = ldns_rr_list_new(); + ldns_resolver_set_dnssec_anchors(r, trust_anchors); + } + + return (ldns_rr_list_push_rr(trust_anchors, ldns_rr_clone(rr))) ? LDNS_STATUS_OK : LDNS_STATUS_ERR; +} + +void +ldns_resolver_set_igntc(ldns_resolver *r, bool i) +{ + r->_igntc = i; +} + +void +ldns_resolver_set_usevc(ldns_resolver *r, bool vc) +{ + r->_usevc = vc; +} + +void +ldns_resolver_set_debug(ldns_resolver *r, bool d) +{ + r->_debug = d; +} + +void +ldns_resolver_set_ip6(ldns_resolver *r, uint8_t ip6) +{ + r->_ip6 = ip6; +} + +void +ldns_resolver_set_fail(ldns_resolver *r, bool f) +{ + r->_fail =f; +} + +void +ldns_resolver_set_searchlist_count(ldns_resolver *r, size_t c) +{ + r->_searchlist_count = c; +} + +void +ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c) +{ + r->_nameserver_count = c; +} + +void +ldns_resolver_set_dnsrch(ldns_resolver *r, bool d) +{ + r->_dnsrch = d; +} + +void +ldns_resolver_set_retry(ldns_resolver *r, uint8_t retry) +{ + r->_retry = retry; +} + +void +ldns_resolver_set_retrans(ldns_resolver *r, uint8_t retrans) +{ + r->_retrans = retrans; +} + +void +ldns_resolver_set_fallback(ldns_resolver *r, bool fallback) +{ + r->_fallback = fallback; +} + +void +ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **n) +{ + r->_nameservers = n; +} + +void +ldns_resolver_set_defnames(ldns_resolver *r, bool d) +{ + r->_defnames = d; +} + +void +ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt) +{ + r->_rtt = rtt; +} + +void +ldns_resolver_set_nameserver_rtt(ldns_resolver *r, size_t pos, size_t value) +{ + size_t *rtt; + + assert(r != NULL); + + rtt = ldns_resolver_rtt(r); + + if (pos >= ldns_resolver_nameserver_count(r)) { + /* error ?*/ + } else { + rtt[pos] = value; + } + +} + +void +ldns_resolver_incr_nameserver_count(ldns_resolver *r) +{ + size_t c; + + c = ldns_resolver_nameserver_count(r); + ldns_resolver_set_nameserver_count(r, ++c); +} + +void +ldns_resolver_dec_nameserver_count(ldns_resolver *r) +{ + size_t c; + + c = ldns_resolver_nameserver_count(r); + if (c == 0) { + return; + } else { + ldns_resolver_set_nameserver_count(r, --c); + } +} + +void +ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *d) +{ + r->_domain = d; +} + +void +ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout) +{ + r->_timeout.tv_sec = timeout.tv_sec; + r->_timeout.tv_usec = timeout.tv_usec; +} + +void +ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *d) +{ + ldns_rdf **searchlist; + size_t list_count; + + if (ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME) { + return; + } + + list_count = ldns_resolver_searchlist_count(r); + searchlist = ldns_resolver_searchlist(r); + + searchlist = LDNS_XREALLOC(searchlist, ldns_rdf *, (list_count + 1)); + if (searchlist) { + r->_searchlist = searchlist; + + searchlist[list_count] = ldns_rdf_clone(d); + ldns_resolver_set_searchlist_count(r, list_count + 1); + } /* no way to report mem err */ +} + +void +ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname) +{ + LDNS_FREE(r->_tsig_keyname); + r->_tsig_keyname = strdup(tsig_keyname); +} + +void +ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm) +{ + LDNS_FREE(r->_tsig_algorithm); + r->_tsig_algorithm = strdup(tsig_algorithm); +} + +void +ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata) +{ + LDNS_FREE(r->_tsig_keydata); + r->_tsig_keydata = strdup(tsig_keydata); +} + +void +ldns_resolver_set_random(ldns_resolver *r, bool b) +{ + r->_random = b; +} + +/* more sophisticated functions */ +ldns_resolver * +ldns_resolver_new(void) +{ + ldns_resolver *r; + + r = LDNS_MALLOC(ldns_resolver); + if (!r) { + return NULL; + } + + r->_searchlist = NULL; + r->_nameservers = NULL; + r->_rtt = NULL; + + /* defaults are filled out */ + ldns_resolver_set_searchlist_count(r, 0); + ldns_resolver_set_nameserver_count(r, 0); + ldns_resolver_set_usevc(r, 0); + ldns_resolver_set_port(r, LDNS_PORT); + ldns_resolver_set_domain(r, NULL); + ldns_resolver_set_defnames(r, false); + ldns_resolver_set_retry(r, 3); + ldns_resolver_set_retrans(r, 2); + ldns_resolver_set_fallback(r, true); + ldns_resolver_set_fail(r, false); + ldns_resolver_set_edns_udp_size(r, 0); + ldns_resolver_set_dnssec(r, false); + ldns_resolver_set_dnssec_cd(r, false); + ldns_resolver_set_dnssec_anchors(r, NULL); + ldns_resolver_set_ip6(r, LDNS_RESOLV_INETANY); + ldns_resolver_set_igntc(r, false); + ldns_resolver_set_recursive(r, false); + ldns_resolver_set_dnsrch(r, true); + + /* randomize the nameserver to be queried + * when there are multiple + */ + ldns_resolver_set_random(r, true); + + ldns_resolver_set_debug(r, 0); + + r->_timeout.tv_sec = LDNS_DEFAULT_TIMEOUT_SEC; + r->_timeout.tv_usec = LDNS_DEFAULT_TIMEOUT_USEC; + + /* TODO: fd=0 is actually a valid socket (stdin), + replace with -1 */ + r->_socket = 0; + r->_axfr_soa_count = 0; + r->_axfr_i = 0; + r->_cur_axfr_pkt = NULL; + + r->_tsig_keyname = NULL; + r->_tsig_keydata = NULL; + r->_tsig_algorithm = NULL; + return r; +} + +ldns_status +ldns_resolver_new_frm_fp(ldns_resolver **res, FILE *fp) +{ + return ldns_resolver_new_frm_fp_l(res, fp, NULL); +} + +ldns_status +ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) +{ + ldns_resolver *r; + const char *keyword[LDNS_RESOLV_KEYWORDS]; + char word[LDNS_MAX_LINELEN + 1]; + int8_t expect; + uint8_t i; + ldns_rdf *tmp; +#ifdef HAVE_SSL + ldns_rr *tmp_rr; +#endif + ssize_t gtr, bgtr; + ldns_buffer *b; + int lnr = 0, oldline; + if(!line_nr) line_nr = &lnr; + + /* do this better + * expect = + * 0: keyword + * 1: default domain dname + * 2: NS aaaa or a record + */ + + /* recognized keywords */ + keyword[LDNS_RESOLV_NAMESERVER] = "nameserver"; + keyword[LDNS_RESOLV_DEFDOMAIN] = "domain"; + keyword[LDNS_RESOLV_SEARCH] = "search"; + /* these two are read but not used atm TODO */ + keyword[LDNS_RESOLV_SORTLIST] = "sortlist"; + keyword[LDNS_RESOLV_OPTIONS] = "options"; + keyword[LDNS_RESOLV_ANCHOR] = "anchor"; + expect = LDNS_RESOLV_KEYWORD; + + r = ldns_resolver_new(); + if (!r) { + return LDNS_STATUS_MEM_ERR; + } + + gtr = 1; + word[0] = 0; + oldline = *line_nr; + expect = LDNS_RESOLV_KEYWORD; + while (gtr > 0) { + /* check comments */ + if (word[0] == '#') { + word[0]='x'; + if(oldline == *line_nr) { + /* skip until end of line */ + int c; + do { + c = fgetc(fp); + } while(c != EOF && c != '\n'); + if(c=='\n' && line_nr) (*line_nr)++; + } + /* and read next to prepare for further parsing */ + oldline = *line_nr; + continue; + } + oldline = *line_nr; + switch(expect) { + case LDNS_RESOLV_KEYWORD: + /* keyword */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr != 0) { + if(word[0] == '#') continue; + for(i = 0; i < LDNS_RESOLV_KEYWORDS; i++) { + if (strcasecmp(keyword[i], word) == 0) { + /* chosen the keyword and + * expect values carefully + */ + expect = i; + break; + } + } + /* no keyword recognized */ + if (expect == LDNS_RESOLV_KEYWORD) { + /* skip line */ + /* + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_KEYWORD_ERR; + */ + } + } + break; + case LDNS_RESOLV_DEFDOMAIN: + /* default domain dname */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr == 0) { + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + continue; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word); + if (!tmp) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_DNAME_ERR; + } + + /* DOn't free, because we copy the pointer */ + ldns_resolver_set_domain(r, tmp); + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_NAMESERVER: + /* NS aaaa or a record */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr == 0) { + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + continue; + } + if(strchr(word, '%')) { + /* snip off interface labels, + * fe80::222:19ff:fe31:4222%eth0 */ + strchr(word, '%')[0]=0; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, word); + if (!tmp) { + /* try ip4 */ + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, word); + } + /* could not parse it, exit */ + if (!tmp) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_ERR; + } + (void)ldns_resolver_push_nameserver(r, tmp); + ldns_rdf_deep_free(tmp); + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_SEARCH: + /* search list domain dname */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + b = LDNS_MALLOC(ldns_buffer); + if(!b) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_MEM_ERR; + } + + ldns_buffer_new_frm_data(b, word, (size_t) gtr); + if(ldns_buffer_status(b) != LDNS_STATUS_OK) { + LDNS_FREE(b); + ldns_resolver_deep_free(r); + return LDNS_STATUS_MEM_ERR; + } + bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, (size_t) gtr + 1); + while (bgtr > 0) { + gtr -= bgtr; + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + ldns_buffer_free(b); + continue; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word); + if (!tmp) { + ldns_resolver_deep_free(r); + ldns_buffer_free(b); + return LDNS_STATUS_SYNTAX_DNAME_ERR; + } + + ldns_resolver_push_searchlist(r, tmp); + + ldns_rdf_deep_free(tmp); + bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, + (size_t) gtr + 1); + } + ldns_buffer_free(b); + gtr = 1; + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_SORTLIST: + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + /* sortlist not implemented atm */ + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_OPTIONS: + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + /* options not implemented atm */ + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_ANCHOR: + /* a file containing a DNSSEC trust anchor */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr == 0) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + continue; + } + +#ifdef HAVE_SSL + tmp_rr = ldns_read_anchor_file(word); + (void) ldns_resolver_push_dnssec_anchor(r, tmp_rr); + ldns_rr_free(tmp_rr); +#endif + expect = LDNS_RESOLV_KEYWORD; + break; + } + } + + if (res) { + *res = r; + return LDNS_STATUS_OK; + } else { + ldns_resolver_deep_free(r); + return LDNS_STATUS_NULL; + } +} + +ldns_status +ldns_resolver_new_frm_file(ldns_resolver **res, const char *filename) +{ + ldns_resolver *r; + FILE *fp; + ldns_status s; + + if (!filename) { + fp = fopen(LDNS_RESOLV_CONF, "r"); + + } else { + fp = fopen(filename, "r"); + } + if (!fp) { + return LDNS_STATUS_FILE_ERR; + } + + s = ldns_resolver_new_frm_fp(&r, fp); + fclose(fp); + if (s == LDNS_STATUS_OK) { + if (res) { + *res = r; + return LDNS_STATUS_OK; + } else { + return LDNS_STATUS_NULL; + } + } + return s; +} + +void +ldns_resolver_free(ldns_resolver *res) +{ + LDNS_FREE(res); +} + +void +ldns_resolver_deep_free(ldns_resolver *res) +{ + size_t i; + + if (res) { + if (res->_searchlist) { + for (i = 0; i < ldns_resolver_searchlist_count(res); i++) { + ldns_rdf_deep_free(res->_searchlist[i]); + } + LDNS_FREE(res->_searchlist); + } + if (res->_nameservers) { + for (i = 0; i < res->_nameserver_count; i++) { + ldns_rdf_deep_free(res->_nameservers[i]); + } + LDNS_FREE(res->_nameservers); + } + if (ldns_resolver_domain(res)) { + ldns_rdf_deep_free(ldns_resolver_domain(res)); + } + if (res->_tsig_keyname) { + LDNS_FREE(res->_tsig_keyname); + } + if (res->_tsig_keydata) { + LDNS_FREE(res->_tsig_keydata); + } + if (res->_tsig_algorithm) { + LDNS_FREE(res->_tsig_algorithm); + } + + if (res->_cur_axfr_pkt) { + ldns_pkt_free(res->_cur_axfr_pkt); + } + + if (res->_rtt) { + LDNS_FREE(res->_rtt); + } + if (res->_dnssec_anchors) { + ldns_rr_list_deep_free(res->_dnssec_anchors); + } + LDNS_FREE(res); + } +} + +ldns_pkt * +ldns_resolver_search(const ldns_resolver *r,const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + + char *str_dname; + ldns_rdf *new_name; + ldns_rdf **search_list; + size_t i; + ldns_pkt *p; + + str_dname = ldns_rdf2str(name); + + if (ldns_dname_str_absolute(str_dname)) { + /* query as-is */ + return ldns_resolver_query(r, name, t, c, flags); + } else if (ldns_resolver_dnsrch(r)) { + search_list = ldns_resolver_searchlist(r); + for (i = 0; i < ldns_resolver_searchlist_count(r); i++) { + new_name = ldns_dname_cat_clone(name, search_list[i]); + + p = ldns_resolver_query(r, new_name, t, c, flags); + ldns_rdf_free(new_name); + if (p) { + if (ldns_pkt_get_rcode(p) == LDNS_RCODE_NOERROR) { + return p; + } else { + ldns_pkt_free(p); + p = NULL; + } + } + } + } + return NULL; +} + +ldns_pkt * +ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + ldns_rdf *newname; + ldns_pkt *pkt; + ldns_status status; + + pkt = NULL; + + if (!ldns_resolver_defnames(r)) { + status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, + t, c, flags); + if (status == LDNS_STATUS_OK) { + return pkt; + } else { + if (pkt) { + ldns_pkt_free(pkt); + } + return NULL; + } + } + + if (!ldns_resolver_domain(r)) { + /* _defnames is set, but the domain is not....?? */ + status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, + t, c, flags); + if (status == LDNS_STATUS_OK) { + return pkt; + } else { + if (pkt) { + ldns_pkt_free(pkt); + } + return NULL; + } + } + + newname = ldns_dname_cat_clone((const ldns_rdf*)name, ldns_resolver_domain(r)); + if (!newname) { + if (pkt) { + ldns_pkt_free(pkt); + } + return NULL; + } + + (void)ldns_resolver_send(&pkt, (ldns_resolver *)r, newname, t, c, + flags); + + ldns_rdf_free(newname); + + return pkt; +} + +ldns_status +ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, + ldns_pkt *query_pkt) +{ + ldns_pkt *answer_pkt = NULL; + ldns_status stat = LDNS_STATUS_OK; + + stat = ldns_send(&answer_pkt, (ldns_resolver *)r, query_pkt); + if (stat != LDNS_STATUS_OK) { + if(answer_pkt) { + ldns_pkt_free(answer_pkt); + answer_pkt = NULL; + } + } else { + /* if tc=1 fall back to EDNS and/or TCP */ + /* check for tcp first (otherwise we don't care about tc=1) */ + if (!ldns_resolver_usevc(r) && ldns_resolver_fallback(r)) { + if (ldns_pkt_tc(answer_pkt)) { + /* was EDNS0 set? */ + if (ldns_pkt_edns_udp_size(query_pkt) == 0) { + ldns_pkt_set_edns_udp_size(query_pkt, 4096); + ldns_pkt_free(answer_pkt); + stat = ldns_send(&answer_pkt, r, query_pkt); + } + /* either way, if it is still truncated, use TCP */ + if (stat != LDNS_STATUS_OK || + ldns_pkt_tc(answer_pkt)) { + ldns_resolver_set_usevc(r, true); + ldns_pkt_free(answer_pkt); + stat = ldns_send(&answer_pkt, r, query_pkt); + ldns_resolver_set_usevc(r, false); + } + } + } + } + + if (answer) { + *answer = answer_pkt; + } + + return stat; +} + +ldns_status +ldns_resolver_prepare_query_pkt(ldns_pkt **query_pkt, ldns_resolver *r, + const ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c, uint16_t flags) +{ + struct timeval now; + + /* prepare a question pkt from the parameters + * and then send this */ + *query_pkt = ldns_pkt_query_new(ldns_rdf_clone(name), t, c, flags); + if (!*query_pkt) { + return LDNS_STATUS_ERR; + } + + /* set DO bit if necessary */ + if (ldns_resolver_dnssec(r)) { + if (ldns_resolver_edns_udp_size(r) == 0) { + ldns_resolver_set_edns_udp_size(r, 4096); + } + ldns_pkt_set_edns_do(*query_pkt, true); + if (ldns_resolver_dnssec_cd(r) || (flags & LDNS_CD)) { + ldns_pkt_set_cd(*query_pkt, true); + } + } + + /* transfer the udp_edns_size from the resolver to the packet */ + if (ldns_resolver_edns_udp_size(r) != 0) { + ldns_pkt_set_edns_udp_size(*query_pkt, ldns_resolver_edns_udp_size(r)); + } + + /* set the timestamp */ + now.tv_sec = time(NULL); + now.tv_usec = 0; + ldns_pkt_set_timestamp(*query_pkt, now); + + + if (ldns_resolver_debug(r)) { + ldns_pkt_print(stdout, *query_pkt); + } + + /* only set the id if it is not set yet */ + if (ldns_pkt_id(*query_pkt) == 0) { + ldns_pkt_set_random_id(*query_pkt); + } + + return LDNS_STATUS_OK; +} + + +ldns_status +ldns_resolver_send(ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + ldns_pkt *query_pkt; + ldns_pkt *answer_pkt; + ldns_status status; + + assert(r != NULL); + assert(name != NULL); + + answer_pkt = NULL; + + /* do all the preprocessing here, then fire of an query to + * the network */ + + if (0 == t) { + t= LDNS_RR_TYPE_A; + } + if (0 == c) { + c= LDNS_RR_CLASS_IN; + } + if (0 == ldns_resolver_nameserver_count(r)) { + return LDNS_STATUS_RES_NO_NS; + } + if (ldns_rdf_get_type(name) != LDNS_RDF_TYPE_DNAME) { + return LDNS_STATUS_RES_QUERY; + } + + status = ldns_resolver_prepare_query_pkt(&query_pkt, r, name, + t, c, flags); + if (status != LDNS_STATUS_OK) { + return status; + } + + /* if tsig values are set, tsign it */ + /* TODO: make last 3 arguments optional too? maybe make complete + rr instead of seperate values in resolver (and packet) + Jelte + should this go in pkt_prepare? + */ + if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) { +#ifdef HAVE_SSL + status = ldns_pkt_tsig_sign(query_pkt, + ldns_resolver_tsig_keyname(r), + ldns_resolver_tsig_keydata(r), + 300, ldns_resolver_tsig_algorithm(r), NULL); + if (status != LDNS_STATUS_OK) { + return LDNS_STATUS_CRYPTO_TSIG_ERR; + } +#else + return LDNS_STATUS_CRYPTO_TSIG_ERR; +#endif /* HAVE_SSL */ + } + + status = ldns_resolver_send_pkt(&answer_pkt, r, query_pkt); + ldns_pkt_free(query_pkt); + + /* allows answer to be NULL when not interested in return value */ + if (answer) { + *answer = answer_pkt; + } + return status; +} + +ldns_rr * +ldns_axfr_next(ldns_resolver *resolver) +{ + ldns_rr *cur_rr; + uint8_t *packet_wire; + size_t packet_wire_size; + ldns_lookup_table *rcode; + ldns_status status; + + /* check if start() has been called */ + if (!resolver || resolver->_socket == 0) { + return NULL; + } + + if (resolver->_cur_axfr_pkt) { + if (resolver->_axfr_i == ldns_pkt_ancount(resolver->_cur_axfr_pkt)) { + ldns_pkt_free(resolver->_cur_axfr_pkt); + resolver->_cur_axfr_pkt = NULL; + return ldns_axfr_next(resolver); + } + cur_rr = ldns_rr_clone(ldns_rr_list_rr( + ldns_pkt_answer(resolver->_cur_axfr_pkt), + resolver->_axfr_i)); + resolver->_axfr_i++; + if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) { + resolver->_axfr_soa_count++; + if (resolver->_axfr_soa_count >= 2) { +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + ldns_pkt_free(resolver->_cur_axfr_pkt); + resolver->_cur_axfr_pkt = NULL; + } + } + return cur_rr; + } else { + packet_wire = ldns_tcp_read_wire(resolver->_socket, &packet_wire_size); + if(!packet_wire) + return NULL; + + status = ldns_wire2pkt(&resolver->_cur_axfr_pkt, packet_wire, + packet_wire_size); + free(packet_wire); + + resolver->_axfr_i = 0; + if (status != LDNS_STATUS_OK) { + /* TODO: make status return type of this function (...api change) */ + fprintf(stderr, "Error parsing rr during AXFR: %s\n", ldns_get_errorstr_by_id(status)); + + /* RoRi: we must now also close the socket, otherwise subsequent uses of the + same resolver structure will fail because the link is still open or + in an undefined state */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return NULL; + } else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) { + rcode = ldns_lookup_by_id(ldns_rcodes, (int) ldns_pkt_get_rcode(resolver->_cur_axfr_pkt)); + fprintf(stderr, "Error in AXFR: %s\n", rcode->name); + + /* RoRi: we must now also close the socket, otherwise subsequent uses of the + same resolver structure will fail because the link is still open or + in an undefined state */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return NULL; + } else { + return ldns_axfr_next(resolver); + } + + } + +} + +bool +ldns_axfr_complete(const ldns_resolver *res) +{ + /* complete when soa count is 2? */ + return res->_axfr_soa_count == 2; +} + +ldns_pkt * +ldns_axfr_last_pkt(const ldns_resolver *res) +{ + return res->_cur_axfr_pkt; +} + +/* random isn't really that good */ +void +ldns_resolver_nameservers_randomize(ldns_resolver *r) +{ + uint16_t i, j; + ldns_rdf **ns, *tmp; + + /* should I check for ldns_resolver_random?? */ + assert(r != NULL); + + ns = ldns_resolver_nameservers(r); + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + j = ldns_get_random() % ldns_resolver_nameserver_count(r); + tmp = ns[i]; + ns[i] = ns[j]; + ns[j] = tmp; + } + ldns_resolver_set_nameservers(r, ns); +} + diff --git a/libs/ldns/rr.c b/libs/ldns/rr.c new file mode 100644 index 0000000000..7b799b9b56 --- /dev/null +++ b/libs/ldns/rr.c @@ -0,0 +1,2403 @@ +/* rr.c + * + * access functions for ldns_rr - + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * + * (c) NLnet Labs, 2004-2006 + * See the file LICENSE for the license + */ +#include + +#include + +#include +#include + +#include + +#define LDNS_SYNTAX_DATALEN 16 +#define LDNS_TTL_DATALEN 21 +#define LDNS_RRLIST_INIT 8 + +ldns_rr * +ldns_rr_new(void) +{ + ldns_rr *rr; + rr = LDNS_MALLOC(ldns_rr); + if (!rr) { + return NULL; + } + + ldns_rr_set_owner(rr, NULL); + ldns_rr_set_question(rr, false); + ldns_rr_set_rd_count(rr, 0); + rr->_rdata_fields = NULL; + ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); + ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); + return rr; +} + +ldns_rr * +ldns_rr_new_frm_type(ldns_rr_type t) +{ + ldns_rr *rr; + const ldns_rr_descriptor *desc; + size_t i; + + rr = LDNS_MALLOC(ldns_rr); + if (!rr) { + return NULL; + } + + desc = ldns_rr_descript(t); + + rr->_rdata_fields = LDNS_XMALLOC(ldns_rdf *, ldns_rr_descriptor_minimum(desc)); + if(!rr->_rdata_fields) { + LDNS_FREE(rr); + return NULL; + } + for (i = 0; i < ldns_rr_descriptor_minimum(desc); i++) { + rr->_rdata_fields[i] = NULL; + } + + ldns_rr_set_owner(rr, NULL); + ldns_rr_set_question(rr, false); + /* set the count to minimum */ + ldns_rr_set_rd_count(rr, ldns_rr_descriptor_minimum(desc)); + ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); + ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); + ldns_rr_set_type(rr, t); + return rr; +} + +void +ldns_rr_free(ldns_rr *rr) +{ + size_t i; + if (rr) { + if (ldns_rr_owner(rr)) { + ldns_rdf_deep_free(ldns_rr_owner(rr)); + } + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + ldns_rdf_deep_free(ldns_rr_rdf(rr, i)); + } + LDNS_FREE(rr->_rdata_fields); + LDNS_FREE(rr); + } +} + +/* + * trailing spaces are allowed + * leading spaces are not allowed + * allow ttl to be optional + * class is optional too + * if ttl is missing, and default_ttl is 0, use DEF_TTL + * allow ttl to be written as 1d3h + * So the RR should look like. e.g. + * miek.nl. 3600 IN MX 10 elektron.atoom.net + * or + * miek.nl. 1h IN MX 10 elektron.atoom.net + * or + * miek.nl. IN MX 10 elektron.atoom.net + */ +static ldns_status +ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, + uint32_t default_ttl, ldns_rdf *origin, + ldns_rdf **prev, bool question) +{ + ldns_rr *new; + const ldns_rr_descriptor *desc; + ldns_rr_type rr_type; + ldns_buffer *rr_buf = NULL; + ldns_buffer *rd_buf = NULL; + uint32_t ttl_val; + char *owner = NULL; + char *ttl = NULL; + ldns_rr_class clas_val; + char *clas = NULL; + char *type = NULL; + char *rdata = NULL; + char *rd = NULL; + char *b64 = NULL; + size_t rd_strlen; + const char *delimiters; + ssize_t c; + ldns_rdf *owner_dname; + const char* endptr; + int was_unknown_rr_format = 0; + ldns_status status = LDNS_STATUS_OK; + + /* used for types with unknown number of rdatas */ + bool done; + bool quoted; + + ldns_rdf *r = NULL; + uint16_t r_cnt; + uint16_t r_min; + uint16_t r_max; + size_t pre_data_pos; + + new = ldns_rr_new(); + + owner = LDNS_XMALLOC(char, LDNS_MAX_DOMAINLEN + 1); + ttl = LDNS_XMALLOC(char, LDNS_TTL_DATALEN); + clas = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); + rdata = LDNS_XMALLOC(char, LDNS_MAX_PACKETLEN + 1); + rr_buf = LDNS_MALLOC(ldns_buffer); + rd_buf = LDNS_MALLOC(ldns_buffer); + rd = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); + b64 = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); + if (!new || !owner || !ttl || !clas || !rdata || !rr_buf || !rd_buf || !rd || !b64 ) { + status = LDNS_STATUS_MEM_ERR; + LDNS_FREE(rr_buf); + goto ldnserror; + } + + ldns_buffer_new_frm_data(rr_buf, (char*)str, strlen(str)); + + /* split the rr in its parts -1 signals trouble */ + if (ldns_bget_token(rr_buf, owner, "\t\n ", LDNS_MAX_DOMAINLEN) == -1) { + status = LDNS_STATUS_SYNTAX_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + + if (ldns_bget_token(rr_buf, ttl, "\t\n ", LDNS_TTL_DATALEN) == -1) { + status = LDNS_STATUS_SYNTAX_TTL_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + ttl_val = (uint32_t) ldns_str2period(ttl, &endptr); + + if (strlen(ttl) > 0 && !isdigit((int) ttl[0])) { + /* ah, it's not there or something */ + if (default_ttl == 0) { + ttl_val = LDNS_DEFAULT_TTL; + } else { + ttl_val = default_ttl; + } + /* we not ASSUMING the TTL is missing and that + * the rest of the RR is still there. That is + * CLASS TYPE RDATA + * so ttl value we read is actually the class + */ + clas_val = ldns_get_rr_class_by_name(ttl); + /* class can be left out too, assume IN, current + * token must be type + */ + if (clas_val == 0) { + clas_val = LDNS_RR_CLASS_IN; + type = LDNS_XMALLOC(char, strlen(ttl) + 1); + if(!type) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + strncpy(type, ttl, strlen(ttl) + 1); + } + } else { + if (ldns_bget_token(rr_buf, clas, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { + status = LDNS_STATUS_SYNTAX_CLASS_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + clas_val = ldns_get_rr_class_by_name(clas); + /* class can be left out too, assume IN, current + * token must be type + */ + if (clas_val == 0) { + clas_val = LDNS_RR_CLASS_IN; + type = LDNS_XMALLOC(char, strlen(clas) + 1); + if(!type) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + strncpy(type, clas, strlen(clas) + 1); + } + } + /* the rest should still be waiting for us */ + + if (!type) { + type = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); + if(!type) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + if (ldns_bget_token(rr_buf, type, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { + status = LDNS_STATUS_SYNTAX_TYPE_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + + if (ldns_bget_token(rr_buf, rdata, "\0", LDNS_MAX_PACKETLEN) == -1) { + /* apparently we are done, and it's only a question RR + * so do not set status and go to ldnserror here + */ + } + + ldns_buffer_new_frm_data(rd_buf, rdata, strlen(rdata)); + + if (strlen(owner) <= 1 && strncmp(owner, "@", 1) == 0) { + if (origin) { + ldns_rr_set_owner(new, ldns_rdf_clone(origin)); + } else if (prev && *prev) { + ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); + } else { + /* default to root */ + ldns_rr_set_owner(new, ldns_dname_new_frm_str(".")); + } + + /* @ also overrides prev */ + if (prev) { + ldns_rdf_deep_free(*prev); + *prev = ldns_rdf_clone(ldns_rr_owner(new)); + if (!*prev) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + } else { + if (strlen(owner) == 0) { + /* no ownername was given, try prev, if that fails + * origin, else default to root */ + if (prev && *prev) { + ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); + } else if (origin) { + ldns_rr_set_owner(new, ldns_rdf_clone(origin)); + } else { + ldns_rr_set_owner(new, ldns_dname_new_frm_str(".")); + } + if(!ldns_rr_owner(new)) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } else { + owner_dname = ldns_dname_new_frm_str(owner); + if (!owner_dname) { + status = LDNS_STATUS_SYNTAX_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + + ldns_rr_set_owner(new, owner_dname); + if (!ldns_dname_str_absolute(owner) && origin) { + if(ldns_dname_cat(ldns_rr_owner(new), + origin) != LDNS_STATUS_OK) { + status = LDNS_STATUS_SYNTAX_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + if (prev) { + ldns_rdf_deep_free(*prev); + *prev = ldns_rdf_clone(ldns_rr_owner(new)); + if(!*prev) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + } + } + LDNS_FREE(owner); + owner = NULL; + + ldns_rr_set_question(new, question); + + ldns_rr_set_ttl(new, ttl_val); + LDNS_FREE(ttl); + ttl = NULL; + + ldns_rr_set_class(new, clas_val); + LDNS_FREE(clas); + clas = NULL; + + rr_type = ldns_get_rr_type_by_name(type); + LDNS_FREE(type); + type = NULL; + + desc = ldns_rr_descript((uint16_t)rr_type); + ldns_rr_set_type(new, rr_type); + if (desc) { + /* only the rdata remains */ + r_max = ldns_rr_descriptor_maximum(desc); + r_min = ldns_rr_descriptor_minimum(desc); + } else { + r_min = 0; + r_max = 1; + } + + /* depending on the rr_type we need to extract + * the rdata differently, e.g. NSEC/NSEC3 */ + switch(rr_type) { + default: + done = false; + + for (r_cnt = 0; !done && r_cnt < r_max; r_cnt++) { + quoted = false; + /* if type = B64, the field may contain spaces */ + if (ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_B64 || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_HEX || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_LOC || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_WKS || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_IPSECKEY || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_NSEC) { + delimiters = "\n\t"; + } else { + delimiters = "\n\t "; + } + + if (ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_STR && + ldns_buffer_remaining(rd_buf) > 0) { + /* skip spaces */ + while (*(ldns_buffer_current(rd_buf)) == ' ') { + ldns_buffer_skip(rd_buf, 1); + } + + if (*(ldns_buffer_current(rd_buf)) == '\"') { + delimiters = "\"\0"; + ldns_buffer_skip(rd_buf, 1); + quoted = true; + } + } + + /* because number of fields can be variable, we can't + rely on _maximum() only */ + /* skip spaces */ + while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf) && + *(ldns_buffer_current(rd_buf)) == ' ' && !quoted + ) { + ldns_buffer_skip(rd_buf, 1); + } + + pre_data_pos = ldns_buffer_position(rd_buf); + if ((c = ldns_bget_token(rd_buf, rd, delimiters, + LDNS_MAX_RDFLEN)) != -1) { + /* hmmz, rfc3597 specifies that any type can be represented with + * \# method, which can contain spaces... + * it does specify size though... + */ + rd_strlen = strlen(rd); + + /* unknown RR data */ + if (strncmp(rd, "\\#", 2) == 0 && !quoted && (rd_strlen == 2 || rd[2]==' ')) { + uint16_t hex_data_size; + char *hex_data_str; + uint16_t cur_hex_data_size; + + was_unknown_rr_format = 1; + /* go back to before \# and skip it while setting delimiters better */ + ldns_buffer_set_position(rd_buf, pre_data_pos); + delimiters = "\n\t "; + (void)ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); + /* read rdata octet length */ + c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); + if (c == -1) { + /* something goes very wrong here */ + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + hex_data_size = (uint16_t) atoi(rd); + /* copy the hex chars into hex str (which is 2 chars per byte) */ + hex_data_str = LDNS_XMALLOC(char, 2 * hex_data_size + 1); + if (!hex_data_str) { + /* malloc error */ + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + cur_hex_data_size = 0; + while(cur_hex_data_size < 2 * hex_data_size) { + c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); + rd_strlen = strlen(rd); + strncpy(hex_data_str + cur_hex_data_size, rd, rd_strlen); + cur_hex_data_size += rd_strlen; + } + hex_data_str[cur_hex_data_size] = '\0'; + + /* correct the rdf type */ + /* if *we* know the type, interpret it as wireformat */ + if (desc) { + size_t hex_pos = 0; + uint8_t *hex_data = LDNS_XMALLOC(uint8_t, hex_data_size + 2); + ldns_status s; + if(!hex_data) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_MEM_ERR; + } + ldns_write_uint16(hex_data, hex_data_size); + ldns_hexstring_to_data(hex_data + 2, hex_data_str); + s = ldns_wire2rdf(new, hex_data, + hex_data_size+2, &hex_pos); + if(s != LDNS_STATUS_OK) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return s; + } + LDNS_FREE(hex_data); + } else { + r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, hex_data_str); + if(!r) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_MEM_ERR; + } + ldns_rdf_set_type(r, LDNS_RDF_TYPE_UNKNOWN); + if(!ldns_rr_push_rdf(new, r)) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_MEM_ERR; + } + } + LDNS_FREE(hex_data_str); + } else { + /* Normal RR */ + switch(ldns_rr_descriptor_field_type(desc, r_cnt)) { + case LDNS_RDF_TYPE_HEX: + case LDNS_RDF_TYPE_B64: + /* can have spaces, and will always be the last + * record of the rrdata. Read in the rest */ + if ((c = ldns_bget_token(rd_buf, + b64, + "\n", + LDNS_MAX_RDFLEN)) + != -1) { + rd = strncat(rd, + b64, + LDNS_MAX_RDFLEN + - strlen(rd) - 1); + } + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type(desc, r_cnt), + rd); + break; + case LDNS_RDF_TYPE_DNAME: + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type(desc, r_cnt), + rd); + + /* check if the origin should be used or concatenated */ + if (r && ldns_rdf_size(r) > 1 && ldns_rdf_data(r)[0] == 1 + && ldns_rdf_data(r)[1] == '@') { + ldns_rdf_deep_free(r); + if (origin) { + r = ldns_rdf_clone(origin); + } else { + /* if this is the SOA, use its own owner name */ + if (rr_type == LDNS_RR_TYPE_SOA) { + r = ldns_rdf_clone(ldns_rr_owner(new)); + } else { + r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "."); + } + } + } else if (r && rd_strlen >= 1 && !ldns_dname_str_absolute(rd) && origin) { + if (ldns_dname_cat(r, origin) != LDNS_STATUS_OK) { + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_ERR; + } + } + break; + default: + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type(desc, r_cnt), + rd); + break; + } + if (r) { + ldns_rr_push_rdf(new, r); + } else { + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + } + if (quoted) { + if (ldns_buffer_available(rd_buf, 1)) { + ldns_buffer_skip(rd_buf, 1); + } else { + done = true; + } + } + } else { + done = true; + } + } + } + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + + if (!question && desc && !was_unknown_rr_format && ldns_rr_rd_count(new) < r_min) { + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + + if (newrr) { + *newrr = new; + } + return LDNS_STATUS_OK; + +ldnserror: + LDNS_FREE(type); + LDNS_FREE(owner); + LDNS_FREE(ttl); + LDNS_FREE(clas); + LDNS_FREE(rdata); + LDNS_FREE(rd); + LDNS_FREE(rd_buf); + LDNS_FREE(b64); + ldns_rr_free(new); + return status; +} + +ldns_status +ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, + uint32_t default_ttl, ldns_rdf *origin, + ldns_rdf **prev) +{ + return ldns_rr_new_frm_str_internal(newrr, + str, + default_ttl, + origin, + prev, + false); +} + +ldns_status +ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str, + ldns_rdf *origin, ldns_rdf **prev) +{ + return ldns_rr_new_frm_str_internal(newrr, + str, + 0, + origin, + prev, + true); +} + +ldns_status +ldns_rr_new_frm_fp(ldns_rr **newrr, FILE *fp, uint32_t *ttl, ldns_rdf **origin, ldns_rdf **prev) +{ + return ldns_rr_new_frm_fp_l(newrr, fp, ttl, origin, prev, NULL); +} + +ldns_status +ldns_rr_new_frm_fp_l(ldns_rr **newrr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr) +{ + char *line; + const char *endptr; /* unused */ + ldns_rr *rr; + uint32_t ttl; + ldns_rdf *tmp; + ldns_status s; + ssize_t size; + int offset = 0; + + if (default_ttl) { + ttl = *default_ttl; + } else { + ttl = 0; + } + + line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + if (!line) { + return LDNS_STATUS_MEM_ERR; + } + + /* read an entire line in from the file */ + if ((size = ldns_fget_token_l(fp, line, LDNS_PARSE_SKIP_SPACE, LDNS_MAX_LINELEN, line_nr)) == -1) { + LDNS_FREE(line); + /* if last line was empty, we are now at feof, which is not + * always a parse error (happens when for instance last line + * was a comment) + */ + return LDNS_STATUS_SYNTAX_ERR; + } + + /* we can have the situation, where we've read ok, but still got + * no bytes to play with, in this case size is 0 + */ + if (size == 0) { + LDNS_FREE(line); + return LDNS_STATUS_SYNTAX_EMPTY; + } + + if (strncmp(line, "$ORIGIN", 7) == 0 && isspace(line[7])) { + if (*origin) { + ldns_rdf_deep_free(*origin); + *origin = NULL; + } + offset = 8; + while (isspace(line[offset])) { + offset++; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, line + offset); + if (!tmp) { + /* could not parse what next to $ORIGIN */ + LDNS_FREE(line); + return LDNS_STATUS_SYNTAX_DNAME_ERR; + } + *origin = tmp; + s = LDNS_STATUS_SYNTAX_ORIGIN; + } else if (strncmp(line, "$TTL", 4) == 0 && isspace(line[4])) { + offset = 5; + while (isspace(line[offset])) { + offset++; + } + if (default_ttl) { + *default_ttl = ldns_str2period(line + offset, &endptr); + } + s = LDNS_STATUS_SYNTAX_TTL; + } else if (strncmp(line, "$INCLUDE", 8) == 0) { + s = LDNS_STATUS_SYNTAX_INCLUDE; + } else { + if (origin && *origin) { + s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, *origin, prev); + } else { + s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, NULL, prev); + } + } + LDNS_FREE(line); + if (newrr && s == LDNS_STATUS_OK) { + *newrr = rr; + } + return s; +} + +void +ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner) +{ + rr->_owner = owner; +} + +void +ldns_rr_set_question(ldns_rr *rr, bool question) +{ + rr->_rr_question = question; +} + +void +ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl) +{ + rr->_ttl = ttl; +} + +void +ldns_rr_set_rd_count(ldns_rr *rr, size_t count) +{ + rr->_rd_count = count; +} + +void +ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type) +{ + rr->_rr_type = rr_type; +} + +void +ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class) +{ + rr->_rr_class = rr_class; +} + +ldns_rdf * +ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position) +{ + size_t rd_count; + ldns_rdf *pop; + + rd_count = ldns_rr_rd_count(rr); + if (position < rd_count) { + /* dicard the old one */ + pop = rr->_rdata_fields[position]; + rr->_rdata_fields[position] = (ldns_rdf*)f; + return pop; + } else { + return NULL; + } +} + +bool +ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f) +{ + size_t rd_count; + ldns_rdf **rdata_fields; + + rd_count = ldns_rr_rd_count(rr); + + /* grow the array */ + rdata_fields = LDNS_XREALLOC( + rr->_rdata_fields, ldns_rdf *, rd_count + 1); + if (!rdata_fields) { + return false; + } + + /* add the new member */ + rr->_rdata_fields = rdata_fields; + rr->_rdata_fields[rd_count] = (ldns_rdf*)f; + + ldns_rr_set_rd_count(rr, rd_count + 1); + return true; +} + +ldns_rdf * +ldns_rr_pop_rdf(ldns_rr *rr) +{ + size_t rd_count; + ldns_rdf *pop; + ldns_rdf** newrd; + + rd_count = ldns_rr_rd_count(rr); + + if (rd_count == 0) { + return NULL; + } + + pop = rr->_rdata_fields[rd_count - 1]; + + /* try to shrink the array */ + if(rd_count > 1) { + newrd = LDNS_XREALLOC( + rr->_rdata_fields, ldns_rdf *, rd_count - 1); + if(newrd) + rr->_rdata_fields = newrd; + } else { + LDNS_FREE(rr->_rdata_fields); + } + + ldns_rr_set_rd_count(rr, rd_count - 1); + return pop; +} + +ldns_rdf * +ldns_rr_rdf(const ldns_rr *rr, size_t nr) +{ + if (nr < ldns_rr_rd_count(rr)) { + return rr->_rdata_fields[nr]; + } else { + return NULL; + } +} + +ldns_rdf * +ldns_rr_owner(const ldns_rr *rr) +{ + return rr->_owner; +} + +bool +ldns_rr_is_question(const ldns_rr *rr) +{ + return rr->_rr_question; +} + +uint32_t +ldns_rr_ttl(const ldns_rr *rr) +{ + return rr->_ttl; +} + +size_t +ldns_rr_rd_count(const ldns_rr *rr) +{ + return rr->_rd_count; +} + +ldns_rr_type +ldns_rr_get_type(const ldns_rr *rr) +{ + return rr->_rr_type; +} + +ldns_rr_class +ldns_rr_get_class(const ldns_rr *rr) +{ + return rr->_rr_class; +} + +/* rr_lists */ + +size_t +ldns_rr_list_rr_count(const ldns_rr_list *rr_list) +{ + if (rr_list) { + return rr_list->_rr_count; + } else { + return 0; + } +} + +ldns_rr * +ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count) +{ + ldns_rr *old; + + if (count > ldns_rr_list_rr_count(rr_list)) { + return NULL; + } + + old = ldns_rr_list_rr(rr_list, count); + + /* overwrite old's pointer */ + rr_list->_rrs[count] = (ldns_rr*)r; + return old; +} + +void +ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count) +{ + assert(count <= rr_list->_rr_capacity); + rr_list->_rr_count = count; +} + +ldns_rr * +ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr) +{ + if (nr < ldns_rr_list_rr_count(rr_list)) { + return rr_list->_rrs[nr]; + } else { + return NULL; + } +} + +ldns_rr_list * +ldns_rr_list_new() +{ + ldns_rr_list *rr_list = LDNS_MALLOC(ldns_rr_list); + if(!rr_list) return NULL; + rr_list->_rr_count = 0; + rr_list->_rr_capacity = 0; + rr_list->_rrs = NULL; + return rr_list; +} + +void +ldns_rr_list_free(ldns_rr_list *rr_list) +{ + if (rr_list) { + LDNS_FREE(rr_list->_rrs); + LDNS_FREE(rr_list); + } +} + +void +ldns_rr_list_deep_free(ldns_rr_list *rr_list) +{ + size_t i; + + if (rr_list) { + for (i=0; i < ldns_rr_list_rr_count(rr_list); i++) { + ldns_rr_free(ldns_rr_list_rr(rr_list, i)); + } + LDNS_FREE(rr_list->_rrs); + LDNS_FREE(rr_list); + } +} + + +/* add right to left. So we modify *left! */ +bool +ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right) +{ + size_t r_rr_count; + size_t i; + + if (!left) { + return false; + } + + if (right) { + r_rr_count = ldns_rr_list_rr_count(right); + } else { + r_rr_count = 0; + } + + /* push right to left */ + for(i = 0; i < r_rr_count; i++) { + ldns_rr_list_push_rr(left, ldns_rr_list_rr(right, i)); + } + return true; +} + +ldns_rr_list * +ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right) +{ + size_t l_rr_count; + size_t r_rr_count; + size_t i; + ldns_rr_list *cat; + + if (left) { + l_rr_count = ldns_rr_list_rr_count(left); + } else { + return ldns_rr_list_clone(right); + } + + if (right) { + r_rr_count = ldns_rr_list_rr_count(right); + } else { + r_rr_count = 0; + } + + cat = ldns_rr_list_new(); + + if (!cat) { + return NULL; + } + + /* left */ + for(i = 0; i < l_rr_count; i++) { + ldns_rr_list_push_rr(cat, + ldns_rr_clone(ldns_rr_list_rr(left, i))); + } + /* right */ + for(i = 0; i < r_rr_count; i++) { + ldns_rr_list_push_rr(cat, + ldns_rr_clone(ldns_rr_list_rr(right, i))); + } + return cat; +} + +ldns_rr_list * +ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos) +{ + size_t i; + ldns_rr_list *subtyped; + ldns_rdf *list_rdf; + + subtyped = ldns_rr_list_new(); + + for(i = 0; i < ldns_rr_list_rr_count(l); i++) { + list_rdf = ldns_rr_rdf( + ldns_rr_list_rr(l, i), + pos); + if (!list_rdf) { + /* pos is too large or any other error */ + ldns_rr_list_deep_free(subtyped); + return NULL; + } + + if (ldns_rdf_compare(list_rdf, r) == 0) { + /* a match */ + ldns_rr_list_push_rr(subtyped, + ldns_rr_clone(ldns_rr_list_rr(l, i))); + } + } + + if (ldns_rr_list_rr_count(subtyped) > 0) { + return subtyped; + } else { + ldns_rr_list_free(subtyped); + return NULL; + } +} + +bool +ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr) +{ + size_t rr_count; + size_t cap; + + rr_count = ldns_rr_list_rr_count(rr_list); + cap = rr_list->_rr_capacity; + + /* grow the array */ + if(rr_count+1 > cap) { + ldns_rr **rrs; + + if(cap == 0) + cap = LDNS_RRLIST_INIT; /* initial list size */ + else cap *= 2; + rrs = LDNS_XREALLOC(rr_list->_rrs, ldns_rr *, cap); + if (!rrs) { + return false; + } + rr_list->_rrs = rrs; + rr_list->_rr_capacity = cap; + } + + /* add the new member */ + rr_list->_rrs[rr_count] = (ldns_rr*)rr; + + ldns_rr_list_set_rr_count(rr_list, rr_count + 1); + return true; +} + +bool +ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list) +{ + size_t i; + + for(i = 0; i < ldns_rr_list_rr_count(push_list); i++) { + if (!ldns_rr_list_push_rr(rr_list, + ldns_rr_list_rr(push_list, i))) { + return false; + } + } + return true; +} + +ldns_rr * +ldns_rr_list_pop_rr(ldns_rr_list *rr_list) +{ + size_t rr_count; + size_t cap; + ldns_rr *pop; + + rr_count = ldns_rr_list_rr_count(rr_list); + + if (rr_count == 0) { + return NULL; + } + + cap = rr_list->_rr_capacity; + pop = ldns_rr_list_rr(rr_list, rr_count - 1); + + /* shrink the array */ + if(cap > LDNS_RRLIST_INIT && rr_count-1 <= cap/2) { + ldns_rr** a; + cap /= 2; + a = LDNS_XREALLOC(rr_list->_rrs, ldns_rr *, cap); + if(a) { + rr_list->_rrs = a; + rr_list->_rr_capacity = cap; + } + } + + ldns_rr_list_set_rr_count(rr_list, rr_count - 1); + + return pop; +} + +ldns_rr_list * +ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t howmany) +{ + /* pop a number of rr's and put them in a rr_list */ + ldns_rr_list *popped; + ldns_rr *p; + size_t i = howmany; + + popped = ldns_rr_list_new(); + + if (!popped) { + return NULL; + } + + + while(i > 0 && + (p = ldns_rr_list_pop_rr(rr_list)) != NULL) { + ldns_rr_list_push_rr(popped, p); + i--; + } + + if (i == howmany) { + return NULL; + } else { + return popped; + } +} + + +bool +ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr) +{ + size_t i; + + if (!rr_list || !rr || ldns_rr_list_rr_count(rr_list) == 0) { + return false; + } + + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + if (rr == ldns_rr_list_rr(rr_list, i)) { + return true; + } else if (ldns_rr_compare(rr, ldns_rr_list_rr(rr_list, i)) == 0) { + return true; + } + } + return false; +} + +bool +ldns_is_rrset(ldns_rr_list *rr_list) +{ + ldns_rr_type t; + ldns_rr_class c; + ldns_rdf *o; + ldns_rr *tmp; + size_t i; + + if (!rr_list || ldns_rr_list_rr_count(rr_list) == 0) { + return false; + } + + tmp = ldns_rr_list_rr(rr_list, 0); + + t = ldns_rr_get_type(tmp); + c = ldns_rr_get_class(tmp); + o = ldns_rr_owner(tmp); + + /* compare these with the rest of the rr_list, start with 1 */ + for (i = 1; i < ldns_rr_list_rr_count(rr_list); i++) { + tmp = ldns_rr_list_rr(rr_list, i); + if (t != ldns_rr_get_type(tmp)) { + return false; + } + if (c != ldns_rr_get_class(tmp)) { + return false; + } + if (ldns_rdf_compare(o, ldns_rr_owner(tmp)) != 0) { + return false; + } + } + return true; +} + +bool +ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr) +{ + size_t rr_count; + size_t i; + ldns_rr *last; + + assert(rr != NULL); + + rr_count = ldns_rr_list_rr_count(rr_list); + + if (rr_count == 0) { + /* nothing there, so checking it is + * not needed */ + return ldns_rr_list_push_rr(rr_list, rr); + } else { + /* check with the final rr in the rr_list */ + last = ldns_rr_list_rr(rr_list, rr_count - 1); + + if (ldns_rr_get_class(last) != ldns_rr_get_class(rr)) { + return false; + } + if (ldns_rr_get_type(last) != ldns_rr_get_type(rr)) { + return false; + } + /* only check if not equal to RRSIG */ + if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { + if (ldns_rr_ttl(last) != ldns_rr_ttl(rr)) { + return false; + } + } + if (ldns_rdf_compare(ldns_rr_owner(last), + ldns_rr_owner(rr)) != 0) { + return false; + } + /* ok, still alive - check if the rr already + * exists - if so, dont' add it */ + for(i = 0; i < rr_count; i++) { + if(ldns_rr_compare( + ldns_rr_list_rr(rr_list, i), rr) == 0) { + return false; + } + } + /* it's safe, push it */ + return ldns_rr_list_push_rr(rr_list, rr); + } +} + +ldns_rr * +ldns_rr_set_pop_rr(ldns_rr_list *rr_list) +{ + return ldns_rr_list_pop_rr(rr_list); +} + +ldns_rr_list * +ldns_rr_list_pop_rrset(ldns_rr_list *rr_list) +{ + ldns_rr_list *rrset; + ldns_rr *last_rr = NULL; + ldns_rr *next_rr; + + if (!rr_list) { + return NULL; + } + + rrset = ldns_rr_list_new(); + if (!last_rr) { + last_rr = ldns_rr_list_pop_rr(rr_list); + if (!last_rr) { + ldns_rr_list_free(rrset); + return NULL; + } else { + ldns_rr_list_push_rr(rrset, last_rr); + } + } + + if (ldns_rr_list_rr_count(rr_list) > 0) { + next_rr = ldns_rr_list_rr(rr_list, ldns_rr_list_rr_count(rr_list) - 1); + } else { + next_rr = NULL; + } + + while (next_rr) { + if ( + ldns_rdf_compare(ldns_rr_owner(next_rr), + ldns_rr_owner(last_rr)) == 0 + && + ldns_rr_get_type(next_rr) == ldns_rr_get_type(last_rr) + && + ldns_rr_get_class(next_rr) == ldns_rr_get_class(last_rr) + ) { + ldns_rr_list_push_rr(rrset, ldns_rr_list_pop_rr(rr_list)); + if (ldns_rr_list_rr_count(rr_list) > 0) { + last_rr = next_rr; + next_rr = ldns_rr_list_rr(rr_list, ldns_rr_list_rr_count(rr_list) - 1); + } else { + next_rr = NULL; + } + } else { + next_rr = NULL; + } + } + + return rrset; +} + +ldns_rr * +ldns_rr_clone(const ldns_rr *rr) +{ + size_t i; + ldns_rr *new_rr; + + if (!rr) { + return NULL; + } + + new_rr = ldns_rr_new(); + if (!new_rr) { + return NULL; + } + if (ldns_rr_owner(rr)) { + ldns_rr_set_owner(new_rr, ldns_rdf_clone(ldns_rr_owner(rr))); + } + ldns_rr_set_ttl(new_rr, ldns_rr_ttl(rr)); + ldns_rr_set_type(new_rr, ldns_rr_get_type(rr)); + ldns_rr_set_class(new_rr, ldns_rr_get_class(rr)); + ldns_rr_set_question(new_rr, ldns_rr_is_question(rr)); + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + if (ldns_rr_rdf(rr,i)) { + ldns_rr_push_rdf(new_rr, ldns_rdf_clone(ldns_rr_rdf(rr, i))); + } + } + + return new_rr; +} + +ldns_rr_list * +ldns_rr_list_clone(const ldns_rr_list *rrlist) +{ + size_t i; + ldns_rr_list *new_list; + ldns_rr *r; + + if (!rrlist) { + return NULL; + } + + new_list = ldns_rr_list_new(); + if (!new_list) { + return NULL; + } + for (i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { + r = ldns_rr_clone( + ldns_rr_list_rr(rrlist, i) + ); + if (!r) { + /* huh, failure in cloning */ + ldns_rr_list_deep_free(new_list); + return NULL; + } + ldns_rr_list_push_rr(new_list, r); + } + return new_list; +} + + +int +qsort_rr_compare(const void *a, const void *b) +{ + const ldns_rr *rr1 = * (const ldns_rr **) a; + const ldns_rr *rr2 = * (const ldns_rr **) b; + + if (rr1 == NULL && rr2 == NULL) { + return 0; + } + if (rr1 == NULL) { + return -1; + } + if (rr2 == NULL) { + return 1; + } + return ldns_rr_compare(rr1, rr2); +} + +int +qsort_schwartz_rr_compare(const void *a, const void *b) +{ + int result = 0; + ldns_rr *rr1, *rr2; + ldns_buffer *rr1_buf, *rr2_buf; + struct ldns_schwartzian_compare_struct *sa = *(struct ldns_schwartzian_compare_struct **) a; + struct ldns_schwartzian_compare_struct *sb = *(struct ldns_schwartzian_compare_struct **) b; + /* if we are doing 2wire, we need to do lowercasing on the dname (and maybe on the rdata) + * this must be done for comparison only, so we need to have a temp var for both buffers, + * which is only used when the transformed object value isn't there yet + */ + ldns_rr *canonical_a, *canonical_b; + + rr1 = (ldns_rr *) sa->original_object; + rr2 = (ldns_rr *) sb->original_object; + + result = ldns_rr_compare_no_rdata(rr1, rr2); + + if (result == 0) { + if (!sa->transformed_object) { + canonical_a = ldns_rr_clone(sa->original_object); + ldns_rr2canonical(canonical_a); + sa->transformed_object = ldns_buffer_new(ldns_rr_uncompressed_size(canonical_a)); + if (ldns_rr2buffer_wire(sa->transformed_object, canonical_a, LDNS_SECTION_ANY) != LDNS_STATUS_OK) { + ldns_buffer_free((ldns_buffer *)sa->transformed_object); + sa->transformed_object = NULL; + ldns_rr_free(canonical_a); + return 0; + } + ldns_rr_free(canonical_a); + } + if (!sb->transformed_object) { + canonical_b = ldns_rr_clone(sb->original_object); + ldns_rr2canonical(canonical_b); + sb->transformed_object = ldns_buffer_new(ldns_rr_uncompressed_size(canonical_b)); + if (ldns_rr2buffer_wire(sb->transformed_object, canonical_b, LDNS_SECTION_ANY) != LDNS_STATUS_OK) { + ldns_buffer_free((ldns_buffer *)sa->transformed_object); + ldns_buffer_free((ldns_buffer *)sb->transformed_object); + sa->transformed_object = NULL; + sb->transformed_object = NULL; + ldns_rr_free(canonical_b); + return 0; + } + ldns_rr_free(canonical_b); + } + rr1_buf = (ldns_buffer *) sa->transformed_object; + rr2_buf = (ldns_buffer *) sb->transformed_object; + + result = ldns_rr_compare_wire(rr1_buf, rr2_buf); + } + + return result; +} + +void +ldns_rr_list_sort(ldns_rr_list *unsorted) +{ + struct ldns_schwartzian_compare_struct **sortables; + size_t item_count; + size_t i; + + if (unsorted) { + item_count = ldns_rr_list_rr_count(unsorted); + + sortables = LDNS_XMALLOC(struct ldns_schwartzian_compare_struct *, + item_count); + if(!sortables) return; /* no way to return error */ + for (i = 0; i < item_count; i++) { + sortables[i] = LDNS_XMALLOC(struct ldns_schwartzian_compare_struct, 1); + if(!sortables[i]) { + /* free the allocated parts */ + while(i>0) { + i--; + LDNS_FREE(sortables[i]); + } + /* no way to return error */ + return; + } + sortables[i]->original_object = ldns_rr_list_rr(unsorted, i); + sortables[i]->transformed_object = NULL; + } + qsort(sortables, + item_count, + sizeof(struct ldns_schwartzian_compare_struct *), + qsort_schwartz_rr_compare); + for (i = 0; i < item_count; i++) { + unsorted->_rrs[i] = sortables[i]->original_object; + if (sortables[i]->transformed_object) { + ldns_buffer_free(sortables[i]->transformed_object); + } + LDNS_FREE(sortables[i]); + } + LDNS_FREE(sortables); + } +} + +int +ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2) +{ + size_t rr1_len; + size_t rr2_len; + size_t offset; + + assert(rr1 != NULL); + assert(rr2 != NULL); + + rr1_len = ldns_rr_uncompressed_size(rr1); + rr2_len = ldns_rr_uncompressed_size(rr2); + + if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) < 0) { + return -1; + } else if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) > 0) { + return 1; + } + + /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */ + if (ldns_rr_get_class(rr1) != ldns_rr_get_class(rr2)) { + return ldns_rr_get_class(rr1) - ldns_rr_get_class(rr2); + } + + /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */ + if (ldns_rr_get_type(rr1) != ldns_rr_get_type(rr2)) { + return ldns_rr_get_type(rr1) - ldns_rr_get_type(rr2); + } + + /* offset is the owername length + ttl + type + class + rdlen == start of wire format rdata */ + offset = ldns_rdf_size(ldns_rr_owner(rr1)) + 4 + 2 + 2 + 2; + /* if either record doesn't have any RDATA... */ + if (offset > rr1_len || offset > rr2_len) { + if (rr1_len == rr2_len) { + return 0; + } + return ((int) rr2_len - (int) rr1_len); + } + + return 0; +} + +int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf) +{ + size_t rr1_len, rr2_len, min_len, i, offset; + + rr1_len = ldns_buffer_capacity(rr1_buf); + rr2_len = ldns_buffer_capacity(rr2_buf); + + /* jump past dname (checked in earlier part) + * and especially past TTL */ + offset = 0; + while (offset < rr1_len && *ldns_buffer_at(rr1_buf, offset) != 0) { + offset += *ldns_buffer_at(rr1_buf, offset) + 1; + } + /* jump to rdata section (PAST the rdata length field, otherwise + rrs with different lengths might be sorted erroneously */ + offset += 11; + min_len = (rr1_len < rr2_len) ? rr1_len : rr2_len; + /* Compare RRs RDATA byte for byte. */ + for(i = offset; i < min_len; i++) { + if (*ldns_buffer_at(rr1_buf,i) < *ldns_buffer_at(rr2_buf,i)) { + return -1; + } else if (*ldns_buffer_at(rr1_buf,i) > *ldns_buffer_at(rr2_buf,i)) { + return +1; + } + } + + /* If both RDATAs are the same up to min_len, then the shorter one sorts first. */ + if (rr1_len < rr2_len) { + return -1; + } else if (rr1_len > rr2_len) { + return +1; + } + /* The RDATAs are equal. */ + return 0; + +} + +int +ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2) +{ + int result; + size_t rr1_len, rr2_len; + + ldns_buffer *rr1_buf; + ldns_buffer *rr2_buf; + + result = ldns_rr_compare_no_rdata(rr1, rr2); + if (result == 0) { + rr1_len = ldns_rr_uncompressed_size(rr1); + rr2_len = ldns_rr_uncompressed_size(rr2); + + rr1_buf = ldns_buffer_new(rr1_len); + rr2_buf = ldns_buffer_new(rr2_len); + + if (ldns_rr2buffer_wire_canonical(rr1_buf, + rr1, + LDNS_SECTION_ANY) + != LDNS_STATUS_OK) { + ldns_buffer_free(rr1_buf); + ldns_buffer_free(rr2_buf); + return 0; + } + if (ldns_rr2buffer_wire_canonical(rr2_buf, + rr2, + LDNS_SECTION_ANY) + != LDNS_STATUS_OK) { + ldns_buffer_free(rr1_buf); + ldns_buffer_free(rr2_buf); + return 0; + } + + result = ldns_rr_compare_wire(rr1_buf, rr2_buf); + + ldns_buffer_free(rr1_buf); + ldns_buffer_free(rr2_buf); + } + + return result; +} + +/* convert dnskey to a ds with the given algorithm, + * then compare the result with the given ds */ +static int +ldns_rr_compare_ds_dnskey(ldns_rr *ds, + ldns_rr *dnskey) +{ + ldns_rr *ds_gen; + bool result = false; + ldns_hash algo; + + if (!dnskey || !ds || + ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS || + ldns_rr_get_type(dnskey) != LDNS_RR_TYPE_DNSKEY) { + return false; + } + +algo = ldns_rdf2native_int8(ldns_rr_rdf(ds, 2)); + + ds_gen = ldns_key_rr2ds(dnskey, algo); + if (ds_gen) { + result = ldns_rr_compare(ds, ds_gen) == 0; + ldns_rr_free(ds_gen); + } + return result; +} + +bool +ldns_rr_compare_ds(const ldns_rr *orr1, const ldns_rr *orr2) +{ + bool result; + ldns_rr *rr1 = ldns_rr_clone(orr1); + ldns_rr *rr2 = ldns_rr_clone(orr2); + + /* set ttls to zero */ + ldns_rr_set_ttl(rr1, 0); + ldns_rr_set_ttl(rr2, 0); + + if (ldns_rr_get_type(rr1) == LDNS_RR_TYPE_DS && + ldns_rr_get_type(rr2) == LDNS_RR_TYPE_DNSKEY) { + result = ldns_rr_compare_ds_dnskey(rr1, rr2); + } else if (ldns_rr_get_type(rr1) == LDNS_RR_TYPE_DNSKEY && + ldns_rr_get_type(rr2) == LDNS_RR_TYPE_DS) { + result = ldns_rr_compare_ds_dnskey(rr2, rr1); + } else { + result = (ldns_rr_compare(rr1, rr2) == 0); + } + + ldns_rr_free(rr1); + ldns_rr_free(rr2); + + return result; +} + +int +ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2) +{ + size_t i = 0; + int rr_cmp; + + assert(rrl1 != NULL); + assert(rrl2 != NULL); + + for (i = 0; i < ldns_rr_list_rr_count(rrl1) && i < ldns_rr_list_rr_count(rrl2); i++) { + rr_cmp = ldns_rr_compare(ldns_rr_list_rr(rrl1, i), ldns_rr_list_rr(rrl2, i)); + if (rr_cmp != 0) { + return rr_cmp; + } + } + + if (i == ldns_rr_list_rr_count(rrl1) && + i != ldns_rr_list_rr_count(rrl2)) { + return 1; + } else if (i == ldns_rr_list_rr_count(rrl2) && + i != ldns_rr_list_rr_count(rrl1)) { + return -1; + } else { + return 0; + } +} + +size_t +ldns_rr_uncompressed_size(const ldns_rr *r) +{ + size_t rrsize; + size_t i; + + rrsize = 0; + /* add all the rdf sizes */ + for(i = 0; i < ldns_rr_rd_count(r); i++) { + rrsize += ldns_rdf_size(ldns_rr_rdf(r, i)); + } + /* ownername */ + rrsize += ldns_rdf_size(ldns_rr_owner(r)); + rrsize += LDNS_RR_OVERHEAD; + return rrsize; +} + +void +ldns_rr2canonical(ldns_rr *rr) +{ + uint16_t i; + + if (!rr) { + return; + } + + ldns_dname2canonical(ldns_rr_owner(rr)); + + /* + * lowercase the rdata dnames if the rr type is one + * of the list in chapter 7 of RFC3597 + */ + switch(ldns_rr_get_type(rr)) { + case LDNS_RR_TYPE_NS: + case LDNS_RR_TYPE_MD: + case LDNS_RR_TYPE_MF: + case LDNS_RR_TYPE_CNAME: + case LDNS_RR_TYPE_SOA: + case LDNS_RR_TYPE_MB: + case LDNS_RR_TYPE_MG: + case LDNS_RR_TYPE_MR: + case LDNS_RR_TYPE_PTR: + case LDNS_RR_TYPE_HINFO: + case LDNS_RR_TYPE_MINFO: + case LDNS_RR_TYPE_MX: + case LDNS_RR_TYPE_RP: + case LDNS_RR_TYPE_AFSDB: + case LDNS_RR_TYPE_RT: + case LDNS_RR_TYPE_SIG: + case LDNS_RR_TYPE_PX: + case LDNS_RR_TYPE_NXT: + case LDNS_RR_TYPE_NAPTR: + case LDNS_RR_TYPE_KX: + case LDNS_RR_TYPE_SRV: + case LDNS_RR_TYPE_DNAME: + case LDNS_RR_TYPE_A6: + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + ldns_dname2canonical(ldns_rr_rdf(rr, i)); + } + return; + default: + /* do nothing */ + return; + } +} + +void +ldns_rr_list2canonical(ldns_rr_list *rr_list) +{ + size_t i; + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + ldns_rr2canonical(ldns_rr_list_rr(rr_list, i)); + } +} + +uint8_t +ldns_rr_label_count(ldns_rr *rr) +{ + if (!rr) { + return 0; + } + return ldns_dname_label_count( + ldns_rr_owner(rr)); +} + +/** \cond */ +static const ldns_rdf_type type_0_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; +static const ldns_rdf_type type_a_wireformat[] = { LDNS_RDF_TYPE_A }; +static const ldns_rdf_type type_ns_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_md_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_mf_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_cname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_soa_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, + LDNS_RDF_TYPE_PERIOD +}; +static const ldns_rdf_type type_mb_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_mg_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_mr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_wks_wireformat[] = { + LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_WKS +}; +static const ldns_rdf_type type_ptr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_hinfo_wireformat[] = { + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_minfo_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_mx_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_rp_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_afsdb_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_x25_wireformat[] = { LDNS_RDF_TYPE_STR }; +static const ldns_rdf_type type_isdn_wireformat[] = { + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_rt_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_nsap_wireformat[] = { + LDNS_RDF_TYPE_NSAP +}; +static const ldns_rdf_type type_nsap_ptr_wireformat[] = { + LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_sig_wireformat[] = { + LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_key_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_px_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_gpos_wireformat[] = { + LDNS_RDF_TYPE_STR, + LDNS_RDF_TYPE_STR, + LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA }; +static const ldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC }; +static const ldns_rdf_type type_nxt_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_UNKNOWN +}; +static const ldns_rdf_type type_eid_wireformat[] = { + LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_nimloc_wireformat[] = { + LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_srv_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_atma_wireformat[] = { + LDNS_RDF_TYPE_ATMA +}; +static const ldns_rdf_type type_naptr_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_kx_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_cert_wireformat[] = { + LDNS_RDF_TYPE_CERT_ALG, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_a6_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; +static const ldns_rdf_type type_dname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_sink_wireformat[] = { LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_apl_wireformat[] = { + LDNS_RDF_TYPE_APL +}; +static const ldns_rdf_type type_ds_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_sshfp_wireformat[] = { + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_ipseckey_wireformat[] = { + LDNS_RDF_TYPE_IPSECKEY +}; +static const ldns_rdf_type type_rrsig_wireformat[] = { + LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_nsec_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_NSEC +}; +static const ldns_rdf_type type_dhcid_wireformat[] = { + LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_talink_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +/* nsec3 is some vars, followed by same type of data of nsec */ +static const ldns_rdf_type type_nsec3_wireformat[] = { +/* LDNS_RDF_TYPE_NSEC3_VARS, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC*/ + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_NSEC3_SALT, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC +}; + +static const ldns_rdf_type type_nsec3params_wireformat[] = { +/* LDNS_RDF_TYPE_NSEC3_PARAMS_VARS*/ + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_NSEC3_SALT +}; + +static const ldns_rdf_type type_dnskey_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_ALG, + LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_tsig_wireformat[] = { + LDNS_RDF_TYPE_DNAME, + LDNS_RDF_TYPE_TSIGTIME, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA +}; +/** \endcond */ + +/** \cond */ +/* All RR's defined in 1035 are well known and can thus + * be compressed. See RFC3597. These RR's are: + * CNAME HINFO MB MD MF MG MINFO MR MX NULL NS PTR SOA TXT + */ +static ldns_rr_descriptor rdata_field_descriptors[] = { + /* 0 */ + { 0, NULL, 0, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 1 */ + {LDNS_RR_TYPE_A, "A", 1, 1, type_a_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 2 */ + {LDNS_RR_TYPE_NS, "NS", 1, 1, type_ns_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 3 */ + {LDNS_RR_TYPE_MD, "MD", 1, 1, type_md_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 4 */ + {LDNS_RR_TYPE_MF, "MF", 1, 1, type_mf_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 5 */ + {LDNS_RR_TYPE_CNAME, "CNAME", 1, 1, type_cname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 6 */ + {LDNS_RR_TYPE_SOA, "SOA", 7, 7, type_soa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, + /* 7 */ + {LDNS_RR_TYPE_MB, "MB", 1, 1, type_mb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 8 */ + {LDNS_RR_TYPE_MG, "MG", 1, 1, type_mg_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 9 */ + {LDNS_RR_TYPE_MR, "MR", 1, 1, type_mr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 10 */ + {LDNS_RR_TYPE_NULL, "NULL", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 11 */ + {LDNS_RR_TYPE_WKS, "WKS", 2, 2, type_wks_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 12 */ + {LDNS_RR_TYPE_PTR, "PTR", 1, 1, type_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 13 */ + {LDNS_RR_TYPE_HINFO, "HINFO", 2, 2, type_hinfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 14 */ + {LDNS_RR_TYPE_MINFO, "MINFO", 2, 2, type_minfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, + /* 15 */ + {LDNS_RR_TYPE_MX, "MX", 2, 2, type_mx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 16 */ + {LDNS_RR_TYPE_TXT, "TXT", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, + /* 17 */ + {LDNS_RR_TYPE_RP, "RP", 2, 2, type_rp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + /* 18 */ + {LDNS_RR_TYPE_AFSDB, "AFSDB", 2, 2, type_afsdb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 19 */ + {LDNS_RR_TYPE_X25, "X25", 1, 1, type_x25_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 20 */ + {LDNS_RR_TYPE_ISDN, "ISDN", 1, 2, type_isdn_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 21 */ + {LDNS_RR_TYPE_RT, "RT", 2, 2, type_rt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 22 */ + {LDNS_RR_TYPE_NSAP, "NSAP", 1, 1, type_nsap_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 23 */ + {LDNS_RR_TYPE_NSAP_PTR, "NSAP-PTR", 1, 1, type_nsap_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 24 */ + {LDNS_RR_TYPE_SIG, "SIG", 9, 9, type_sig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 25 */ + {LDNS_RR_TYPE_KEY, "KEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 26 */ + {LDNS_RR_TYPE_PX, "PX", 3, 3, type_px_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + /* 27 */ + {LDNS_RR_TYPE_GPOS, "GPOS", 1, 1, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 28 */ + {LDNS_RR_TYPE_AAAA, "AAAA", 1, 1, type_aaaa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 29 */ + {LDNS_RR_TYPE_LOC, "LOC", 1, 1, type_loc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 30 */ + {LDNS_RR_TYPE_NXT, "NXT", 2, 2, type_nxt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 31 */ + {LDNS_RR_TYPE_EID, "EID", 1, 1, type_eid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 32 */ + {LDNS_RR_TYPE_NIMLOC, "NIMLOC", 1, 1, type_nimloc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 33 */ + {LDNS_RR_TYPE_SRV, "SRV", 4, 4, type_srv_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 34 */ + {LDNS_RR_TYPE_ATMA, "ATMA", 1, 1, type_atma_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 35 */ + {LDNS_RR_TYPE_NAPTR, "NAPTR", 6, 6, type_naptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 36 */ + {LDNS_RR_TYPE_KX, "KX", 2, 2, type_kx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 37 */ + {LDNS_RR_TYPE_CERT, "CERT", 4, 4, type_cert_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 38 */ + {LDNS_RR_TYPE_A6, "A6", 1, 1, type_a6_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 39 */ + {LDNS_RR_TYPE_DNAME, "DNAME", 1, 1, type_dname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 40 */ + {LDNS_RR_TYPE_SINK, "SINK", 1, 1, type_sink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 41 */ + {LDNS_RR_TYPE_OPT, "OPT", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 42 */ + {LDNS_RR_TYPE_APL, "APL", 0, 0, type_apl_wireformat, LDNS_RDF_TYPE_APL, LDNS_RR_NO_COMPRESS, 0 }, + /* 43 */ + {LDNS_RR_TYPE_DS, "DS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 44 */ + {LDNS_RR_TYPE_SSHFP, "SSHFP", 3, 3, type_sshfp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 45 */ + {LDNS_RR_TYPE_IPSECKEY, "IPSECKEY", 1, 1, type_ipseckey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 46 */ + {LDNS_RR_TYPE_RRSIG, "RRSIG", 9, 9, type_rrsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 47 */ + {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NSEC, LDNS_RR_NO_COMPRESS, 1 }, + /* 48 */ + {LDNS_RR_TYPE_DNSKEY, "DNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 49 */ +{LDNS_RR_TYPE_DHCID, "DHCID", 1, 1, type_dhcid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 50 */ + {LDNS_RR_TYPE_NSEC3, "NSEC3", 5, 6, type_nsec3_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 51 */ +{LDNS_RR_TYPE_NSEC3PARAMS, "NSEC3PARAM", 4, 4, type_nsec3params_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 52 */ +{LDNS_RR_TYPE_NULL, "TYPE52", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE55", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, +{LDNS_RR_TYPE_NULL, "TYPE59", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE60", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE61", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE62", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE63", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE64", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE65", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE66", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE67", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE68", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE69", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE70", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE71", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE72", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE73", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE74", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE75", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE76", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE77", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE78", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE79", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE80", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE81", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE82", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE83", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE84", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE85", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE86", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE87", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE88", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE89", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE90", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE91", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE92", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE93", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE94", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE95", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE104", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE105", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE106", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE107", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE108", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE109", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE113", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE114", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE115", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE116", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE117", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE118", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE119", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE120", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE121", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE122", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE123", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE124", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE125", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE126", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE127", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE128", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE129", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE130", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE131", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE132", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE133", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE134", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE135", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE136", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE137", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE138", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE139", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE140", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE141", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE142", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE143", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE144", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE145", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE146", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE147", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE148", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE149", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE150", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE151", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE152", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE153", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE154", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE155", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE156", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE157", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE158", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE159", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE160", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE161", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE162", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE163", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE164", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE165", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE166", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE167", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE168", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE169", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE170", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE171", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE172", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE173", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE174", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE175", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE176", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE177", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE178", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE179", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE180", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE181", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE182", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE183", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE184", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE185", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE186", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE187", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE188", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE189", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE190", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE191", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE192", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE193", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE194", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE195", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE196", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE197", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE198", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE199", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE200", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE201", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE202", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE203", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE204", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE205", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE206", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE207", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE208", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE209", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE210", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE211", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE212", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE213", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE214", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE215", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE216", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE217", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE218", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE219", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE220", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE221", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE222", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE223", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE224", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE225", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE226", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE227", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE228", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE229", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE230", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE231", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE232", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE233", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE234", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE235", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE236", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE237", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE238", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE239", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE240", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE241", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE242", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE243", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE244", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE245", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE249", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_TSIG, "TSIG", 8, 9, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +/* split in array, no longer contiguous */ +{LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 } +}; +/** \endcond */ + +/** + * \def LDNS_RDATA_FIELD_DESCRIPTORS_COUNT + * computes the number of rdata fields + */ +#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \ + (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0])) + +const ldns_rr_descriptor * +ldns_rr_descript(uint16_t type) +{ + size_t i; + if (type <= LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) { + return &rdata_field_descriptors[type]; + } else { + /* because not all array index equals type code */ + for (i = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON; + i < LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; + i++) { + if (rdata_field_descriptors[i]._type == type) { + return &rdata_field_descriptors[i]; + } + } + return &rdata_field_descriptors[0]; + } +} + +size_t +ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor) +{ + if (descriptor) { + return descriptor->_minimum; + } else { + return 0; + } +} + +size_t +ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor) +{ + if (descriptor) { + if (descriptor->_variable != LDNS_RDF_TYPE_NONE) { + /* Should really be SIZE_MAX... bad FreeBSD. */ + return UINT_MAX; + } else { + return descriptor->_maximum; + } + } else { + return 0; + } +} + +ldns_rdf_type +ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, + size_t index) +{ + assert(descriptor != NULL); + assert(index < descriptor->_maximum + || descriptor->_variable != LDNS_RDF_TYPE_NONE); + if (index < descriptor->_maximum) { + return descriptor->_wireformat[index]; + } else { + return descriptor->_variable; + } +} + +ldns_rr_type +ldns_get_rr_type_by_name(const char *name) +{ + unsigned int i; + const char *desc_name; + const ldns_rr_descriptor *desc; + + /* TYPEXX representation */ + if (strlen(name) > 4 && strncasecmp(name, "TYPE", 4) == 0) { + return atoi(name + 4); + } + + /* Normal types */ + for (i = 0; i < (unsigned int) LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; i++) { + desc = &rdata_field_descriptors[i]; + desc_name = desc->_name; + if(desc_name && + strlen(name) == strlen(desc_name) && + strncasecmp(name, desc_name, strlen(desc_name)) == 0) { + /* because not all array index equals type code */ + return desc->_type; + } + } + + /* special cases for query types */ + if (strlen(name) == 4 && strncasecmp(name, "IXFR", 4) == 0) { + return 251; + } else if (strlen(name) == 4 && strncasecmp(name, "AXFR", 4) == 0) { + return 252; + } else if (strlen(name) == 5 && strncasecmp(name, "MAILB", 5) == 0) { + return 253; + } else if (strlen(name) == 5 && strncasecmp(name, "MAILA", 5) == 0) { + return 254; + } else if (strlen(name) == 3 && strncasecmp(name, "ANY", 3) == 0) { + return 255; + } + + return 0; +} + +ldns_rr_class +ldns_get_rr_class_by_name(const char *name) +{ + ldns_lookup_table *lt; + + /* CLASSXX representation */ + if (strlen(name) > 5 && strncasecmp(name, "CLASS", 5) == 0) { + return atoi(name + 5); + } + + /* Normal types */ + lt = ldns_lookup_by_name(ldns_rr_classes, name); + + if (lt) { + return lt->id; + } + return 0; +} + + +ldns_rr_type +ldns_rdf2rr_type(const ldns_rdf *rd) +{ + ldns_rr_type r; + + if (!rd) { + return 0; + } + + if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_TYPE) { + return 0; + } + + r = (ldns_rr_type) ldns_rdf2native_int16(rd); + return r; +} + +ldns_rr_type +ldns_rr_list_type(const ldns_rr_list *rr_list) +{ + if (rr_list && ldns_rr_list_rr_count(rr_list) > 0) { + return ldns_rr_get_type(ldns_rr_list_rr(rr_list, 0)); + } else { + return 0; + } +} + +ldns_rdf * +ldns_rr_list_owner(const ldns_rr_list *rr_list) +{ + if (rr_list && ldns_rr_list_rr_count(rr_list) > 0) { + return ldns_rr_owner(ldns_rr_list_rr(rr_list, 0)); + } else { + return NULL; + } +} diff --git a/libs/ldns/rr_functions.c b/libs/ldns/rr_functions.c new file mode 100644 index 0000000000..700372b91c --- /dev/null +++ b/libs/ldns/rr_functions.c @@ -0,0 +1,341 @@ +/* + * rr_function.c + * + * function that operate on specific rr types + * + * (c) NLnet Labs, 2004-2006 + * See the file LICENSE for the license + */ + +/* + * These come strait from perldoc Net::DNS::RR::xxx + * first the read variant, then the write. This is + * not complete. + */ + +#include + +#include + +#include +#include + +/** + * return a specific rdf + * \param[in] type type of RR + * \param[in] rr the rr itself + * \param[in] pos at which postion to get it + * \return the rdf sought + */ +static ldns_rdf * +ldns_rr_function(ldns_rr_type type, const ldns_rr *rr, size_t pos) +{ + if (!rr || ldns_rr_get_type(rr) != type) { + return NULL; + } + return ldns_rr_rdf(rr, pos); +} + +/** + * set a specific rdf + * \param[in] type type of RR + * \param[in] rr the rr itself + * \param[in] rdf the rdf to set + * \param[in] pos at which postion to set it + * \return true or false + */ +static bool +ldns_rr_set_function(ldns_rr_type type, ldns_rr *rr, ldns_rdf *rdf, size_t pos) +{ + ldns_rdf *pop; + if (!rr || ldns_rr_get_type(rr) != type) { + return false; + } + pop = ldns_rr_set_rdf(rr, rdf, pos); + ldns_rdf_deep_free(pop); + return true; +} + +/* A/AAAA records */ +ldns_rdf * +ldns_rr_a_address(const ldns_rr *r) +{ + /* 2 types to check, cannot use the macro */ + if (!r || (ldns_rr_get_type(r) != LDNS_RR_TYPE_A && + ldns_rr_get_type(r) != LDNS_RR_TYPE_AAAA)) { + return NULL; + } + return ldns_rr_rdf(r, 0); +} + +bool +ldns_rr_a_set_address(ldns_rr *r, ldns_rdf *f) +{ + /* 2 types to check, cannot use the macro... */ + ldns_rdf *pop; + if (!r || (ldns_rr_get_type(r) != LDNS_RR_TYPE_A && + ldns_rr_get_type(r) != LDNS_RR_TYPE_AAAA)) { + return false; + } + pop = ldns_rr_set_rdf(r, f, 0); + if (pop) { + LDNS_FREE(pop); + return true; + } else { + return false; + } +} + +/* NS record */ +ldns_rdf * +ldns_rr_ns_nsdname(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_NS, r, 0); +} + +/* MX record */ +ldns_rdf * +ldns_rr_mx_preference(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_MX, r, 0); +} + +ldns_rdf * +ldns_rr_mx_exchange(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_MX, r, 1); +} + +/* RRSIG record */ +ldns_rdf * +ldns_rr_rrsig_typecovered(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 0); +} + +bool +ldns_rr_rrsig_set_typecovered(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 0); +} + +ldns_rdf * +ldns_rr_rrsig_algorithm(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 1); +} + +bool +ldns_rr_rrsig_set_algorithm(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 1); +} + +ldns_rdf * +ldns_rr_rrsig_labels(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 2); +} + +bool +ldns_rr_rrsig_set_labels(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 2); +} + +ldns_rdf * +ldns_rr_rrsig_origttl(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 3); +} + +bool +ldns_rr_rrsig_set_origttl(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 3); +} + +ldns_rdf * +ldns_rr_rrsig_expiration(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 4); +} + +bool +ldns_rr_rrsig_set_expiration(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 4); +} + +ldns_rdf * +ldns_rr_rrsig_inception(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 5); +} + +bool +ldns_rr_rrsig_set_inception(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 5); +} + +ldns_rdf * +ldns_rr_rrsig_keytag(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 6); +} + +bool +ldns_rr_rrsig_set_keytag(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 6); +} + +ldns_rdf * +ldns_rr_rrsig_signame(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 7); +} + +bool +ldns_rr_rrsig_set_signame(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 7); +} + +ldns_rdf * +ldns_rr_rrsig_sig(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 8); +} + +bool +ldns_rr_rrsig_set_sig(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 8); +} + +/* DNSKEY record */ +ldns_rdf * +ldns_rr_dnskey_flags(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 0); +} + +bool +ldns_rr_dnskey_set_flags(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 0); +} + +ldns_rdf * +ldns_rr_dnskey_protocol(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 1); +} + +bool +ldns_rr_dnskey_set_protocol(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 1); +} + +ldns_rdf * +ldns_rr_dnskey_algorithm(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 2); +} + +bool +ldns_rr_dnskey_set_algorithm(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 2); +} + +ldns_rdf * +ldns_rr_dnskey_key(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 3); +} + +bool +ldns_rr_dnskey_set_key(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 3); +} + +size_t +ldns_rr_dnskey_key_size_raw(const unsigned char* keydata, + const size_t len, + const ldns_algorithm alg) +{ + /* for DSA keys */ + uint8_t t; + + /* for RSA keys */ + uint16_t exp; + uint16_t int16; + + switch ((ldns_signing_algorithm)alg) { + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: + if (len > 0) { + t = keydata[0]; + return (64 + t*8)*8; + } else { + return 0; + } + break; + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: +#ifdef USE_SHA2 + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: +#endif + if (len > 0) { + if (keydata[0] == 0) { + /* big exponent */ + if (len > 3) { + memmove(&int16, keydata + 1, 2); + exp = ntohs(int16); + return (len - exp - 3)*8; + } else { + return 0; + } + } else { + exp = keydata[0]; + return (len-exp-1)*8; + } + } else { + return 0; + } + break; +#ifdef USE_GOST + case LDNS_SIGN_ECC_GOST: + return 512; +#endif +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + return 256; + case LDNS_SIGN_ECDSAP384SHA384: + return 384; +#endif + case LDNS_SIGN_HMACMD5: + return len; + default: + return 0; + } +} + +size_t +ldns_rr_dnskey_key_size(const ldns_rr *key) +{ + if (!key) { + return 0; + } + return ldns_rr_dnskey_key_size_raw((unsigned char*)ldns_rdf_data(ldns_rr_dnskey_key(key)), + ldns_rdf_size(ldns_rr_dnskey_key(key)), + ldns_rdf2native_int8(ldns_rr_dnskey_algorithm(key)) + ); +} diff --git a/libs/ldns/sha1.c b/libs/ldns/sha1.c new file mode 100644 index 0000000000..5dec680a1b --- /dev/null +++ b/libs/ldns/sha1.c @@ -0,0 +1,177 @@ +/* + * modified for ldns by Jelte Jansen, original taken from OpenBSD: + * + * SHA-1 in C + * By Steve Reid + * 100% Public Domain + * + * Test Vectors (from FIPS PUB 180-1) + * "abc" + * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D + * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" + * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 + * A million repetitions of "a" + * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */ +/* #define SHA1HANDSOFF * Copies data before messing with it. */ + +#include +#include +#include + +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +/* blk0() and blk() perform the initial expand. */ +/* I got the idea of expanding during the round function from SSLeay */ +#if BYTE_ORDER == LITTLE_ENDIAN +#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ + |(rol(block->l[i],8)&0x00FF00FF)) +#else +#define blk0(i) block->l[i] +#endif +#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ + ^block->l[(i+2)&15]^block->l[i&15],1)) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); +#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); +#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); + +/* Hash a single 512-bit block. This is the core of the algorithm. */ + +void +ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]) +{ + uint32_t a, b, c, d, e; + typedef union { + unsigned char c[64]; + unsigned int l[16]; + } CHAR64LONG16; + CHAR64LONG16* block; +#ifdef SHA1HANDSOFF + unsigned char workspace[LDNS_SHA1_BLOCK_LENGTH]; + + block = (CHAR64LONG16 *)workspace; + memmove(block, buffer, LDNS_SHA1_BLOCK_LENGTH); +#else + block = (CHAR64LONG16 *)buffer; +#endif + /* Copy context->state[] to working vars */ + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + /* 4 rounds of 20 operations each. Loop unrolled. */ + R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); + R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); + R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); + R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); + R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); + R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); + R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); + R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); + R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); + R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); + R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); + R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); + R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); + R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); + R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); + R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); + R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); + R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); + R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); + + /* Add the working vars back into context.state[] */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + /* Wipe variables */ + a = b = c = d = e = 0; +} + + +/* SHA1Init - Initialize new context */ + +void +ldns_sha1_init(ldns_sha1_ctx *context) +{ + /* SHA1 initialization constants */ + context->count = 0; + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; +} + + +/* Run your data through this. */ + +void +ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len) +{ + unsigned int i; + unsigned int j; + + j = (unsigned)(uint32_t)((context->count >> 3) & 63); + context->count += (len << 3); + if ((j + len) > 63) { + memmove(&context->buffer[j], data, (i = 64 - j)); + ldns_sha1_transform(context->state, context->buffer); + for ( ; i + 63 < len; i += 64) { + ldns_sha1_transform(context->state, &data[i]); + } + j = 0; + } + else i = 0; + memmove(&context->buffer[j], &data[i], len - i); +} + + +/* Add padding and return the message digest. */ + +void +ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context) +{ + unsigned int i; + unsigned char finalcount[8]; + + for (i = 0; i < 8; i++) { + finalcount[i] = (unsigned char)((context->count >> + ((7 - (i & 7)) * 8)) & 255); /* Endian independent */ + } + ldns_sha1_update(context, (unsigned char *)"\200", 1); + while ((context->count & 504) != 448) { + ldns_sha1_update(context, (unsigned char *)"\0", 1); + } + ldns_sha1_update(context, finalcount, 8); /* Should cause a SHA1Transform() */ + + if (digest != NULL) + for (i = 0; i < LDNS_SHA1_DIGEST_LENGTH; i++) { + digest[i] = (unsigned char)((context->state[i >> 2] >> + ((3 - (i & 3)) * 8)) & 255); + } +#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite its own static vars */ + ldns_sha1_transform(context->state, context->buffer); +#endif +} + +unsigned char * +ldns_sha1(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha1_ctx ctx; + ldns_sha1_init(&ctx); + ldns_sha1_update(&ctx, data, data_len); + ldns_sha1_final(digest, &ctx); + return digest; +} diff --git a/libs/ldns/sha2.c b/libs/ldns/sha2.c new file mode 100644 index 0000000000..26b7716a66 --- /dev/null +++ b/libs/ldns/sha2.c @@ -0,0 +1,982 @@ +/* + * FILE: sha2.c + * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ + * + * Copyright (c) 2000-2001, Aaron D. Gifford + * All rights reserved. + * + * Modified by Jelte Jansen to fit in ldns, and not clash with any + * system-defined SHA code. + * Changes: + * - Renamed (external) functions and constants to fit ldns style + * - Removed _End and _Data functions + * - Added ldns_shaX(data, len, digest) convenience functions + * - Removed prototypes of _Transform functions and made those static + * + * 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. Neither the name of the copyright holder nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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. + * + * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ + */ + +#include +#include /* memcpy()/memset() or bcopy()/bzero() */ +#include /* assert() */ +#include + +/* + * ASSERT NOTE: + * Some sanity checking code is included using assert(). On my FreeBSD + * system, this additional code can be removed by compiling with NDEBUG + * defined. Check your own systems manpage on assert() to see how to + * compile WITHOUT the sanity checking code on your system. + * + * UNROLLED TRANSFORM LOOP NOTE: + * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform + * loop version for the hash transform rounds (defined using macros + * later in this file). Either define on the command line, for example: + * + * cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c + * + * or define below: + * + * #define SHA2_UNROLL_TRANSFORM + * + */ + + +/*** SHA-256/384/512 Machine Architecture Definitions *****************/ +/* + * BYTE_ORDER NOTE: + * + * Please make sure that your system defines BYTE_ORDER. If your + * architecture is little-endian, make sure it also defines + * LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are + * equivilent. + * + * If your system does not define the above, then you can do so by + * hand like this: + * + * #define LITTLE_ENDIAN 1234 + * #define BIG_ENDIAN 4321 + * + * And for little-endian machines, add: + * + * #define BYTE_ORDER LITTLE_ENDIAN + * + * Or for big-endian machines: + * + * #define BYTE_ORDER BIG_ENDIAN + * + * The FreeBSD machine this was written on defines BYTE_ORDER + * appropriately by including (which in turn includes + * where the appropriate definitions are actually + * made). + */ +#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) +#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN +#endif + +typedef uint8_t sha2_byte; /* Exactly 1 byte */ +typedef uint32_t sha2_word32; /* Exactly 4 bytes */ +#ifdef S_SPLINT_S +typedef unsigned long long sha2_word64; /* lint 8 bytes */ +#else +typedef uint64_t sha2_word64; /* Exactly 8 bytes */ +#endif + +/*** SHA-256/384/512 Various Length Definitions ***********************/ +/* NOTE: Most of these are in sha2.h */ +#define ldns_sha256_SHORT_BLOCK_LENGTH (LDNS_SHA256_BLOCK_LENGTH - 8) +#define ldns_sha384_SHORT_BLOCK_LENGTH (LDNS_SHA384_BLOCK_LENGTH - 16) +#define ldns_sha512_SHORT_BLOCK_LENGTH (LDNS_SHA512_BLOCK_LENGTH - 16) + + +/*** ENDIAN REVERSAL MACROS *******************************************/ +#if BYTE_ORDER == LITTLE_ENDIAN +#define REVERSE32(w,x) { \ + sha2_word32 tmp = (w); \ + tmp = (tmp >> 16) | (tmp << 16); \ + (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ +} +#ifndef S_SPLINT_S +#define REVERSE64(w,x) { \ + sha2_word64 tmp = (w); \ + tmp = (tmp >> 32) | (tmp << 32); \ + tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \ + ((tmp & 0x00ff00ff00ff00ffULL) << 8); \ + (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \ + ((tmp & 0x0000ffff0000ffffULL) << 16); \ +} +#else /* splint */ +#define REVERSE64(w,x) /* splint */ +#endif /* splint */ +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* + * Macro for incrementally adding the unsigned 64-bit integer n to the + * unsigned 128-bit integer (represented using a two-element array of + * 64-bit words): + */ +#define ADDINC128(w,n) { \ + (w)[0] += (sha2_word64)(n); \ + if ((w)[0] < (n)) { \ + (w)[1]++; \ + } \ +} +#ifdef S_SPLINT_S +#undef ADDINC128 +#define ADDINC128(w,n) /* splint */ +#endif + +/* + * Macros for copying blocks of memory and for zeroing out ranges + * of memory. Using these macros makes it easy to switch from + * using memset()/memcpy() and using bzero()/bcopy(). + * + * Please define either SHA2_USE_MEMSET_MEMCPY or define + * SHA2_USE_BZERO_BCOPY depending on which function set you + * choose to use: + */ +#if !defined(SHA2_USE_MEMSET_MEMCPY) && !defined(SHA2_USE_BZERO_BCOPY) +/* Default to memset()/memcpy() if no option is specified */ +#define SHA2_USE_MEMSET_MEMCPY 1 +#endif +#if defined(SHA2_USE_MEMSET_MEMCPY) && defined(SHA2_USE_BZERO_BCOPY) +/* Abort with an error if BOTH options are defined */ +#error Define either SHA2_USE_MEMSET_MEMCPY or SHA2_USE_BZERO_BCOPY, not both! +#endif + +#ifdef SHA2_USE_MEMSET_MEMCPY +#define MEMSET_BZERO(p,l) memset((p), 0, (l)) +#define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l)) +#endif +#ifdef SHA2_USE_BZERO_BCOPY +#define MEMSET_BZERO(p,l) bzero((p), (l)) +#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l)) +#endif + + +/*** THE SIX LOGICAL FUNCTIONS ****************************************/ +/* + * Bit shifting and rotation (used by the six SHA-XYZ logical functions: + * + * NOTE: The naming of R and S appears backwards here (R is a SHIFT and + * S is a ROTATION) because the SHA-256/384/512 description document + * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this + * same "backwards" definition. + */ +/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ +#define R(b,x) ((x) >> (b)) +/* 32-bit Rotate-right (used in SHA-256): */ +#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) +/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ +#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) + +/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */ +#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +/* Four of six logical functions used in SHA-256: */ +#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) +#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) +#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) +#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) + +/* Four of six logical functions used in SHA-384 and SHA-512: */ +#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) +#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) +#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) +#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) + +/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ +/* Hash constant words K for SHA-256: */ +static const sha2_word32 K256[64] = { + 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, + 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, + 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, + 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, + 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, + 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, + 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, + 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, + 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, + 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, + 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, + 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, + 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, + 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, + 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, + 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL +}; + +/* initial hash value H for SHA-256: */ +static const sha2_word32 ldns_sha256_initial_hash_value[8] = { + 0x6a09e667UL, + 0xbb67ae85UL, + 0x3c6ef372UL, + 0xa54ff53aUL, + 0x510e527fUL, + 0x9b05688cUL, + 0x1f83d9abUL, + 0x5be0cd19UL +}; + +/* Hash constant words K for SHA-384 and SHA-512: */ +static const sha2_word64 K512[80] = { + 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, + 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, + 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, + 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, + 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, + 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, + 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, + 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, + 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, + 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, + 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, + 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, + 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, + 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, + 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, + 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, + 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, + 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, + 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, + 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, + 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, + 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, + 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, + 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, + 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, + 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, + 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, + 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, + 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, + 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, + 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, + 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, + 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, + 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, + 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, + 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, + 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, + 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, + 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, + 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL +}; + +/* initial hash value H for SHA-384 */ +static const sha2_word64 sha384_initial_hash_value[8] = { + 0xcbbb9d5dc1059ed8ULL, + 0x629a292a367cd507ULL, + 0x9159015a3070dd17ULL, + 0x152fecd8f70e5939ULL, + 0x67332667ffc00b31ULL, + 0x8eb44a8768581511ULL, + 0xdb0c2e0d64f98fa7ULL, + 0x47b5481dbefa4fa4ULL +}; + +/* initial hash value H for SHA-512 */ +static const sha2_word64 sha512_initial_hash_value[8] = { + 0x6a09e667f3bcc908ULL, + 0xbb67ae8584caa73bULL, + 0x3c6ef372fe94f82bULL, + 0xa54ff53a5f1d36f1ULL, + 0x510e527fade682d1ULL, + 0x9b05688c2b3e6c1fULL, + 0x1f83d9abfb41bd6bULL, + 0x5be0cd19137e2179ULL +}; + +/*** SHA-256: *********************************************************/ +void ldns_sha256_init(ldns_sha256_CTX* context) { + if (context == (ldns_sha256_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, ldns_sha256_initial_hash_value, LDNS_SHA256_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, LDNS_SHA256_BLOCK_LENGTH); + context->bitcount = 0; +} + +#ifdef SHA2_UNROLL_TRANSFORM + +/* Unrolled SHA-256 round macros: */ + +#if BYTE_ORDER == LITTLE_ENDIAN + +#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + REVERSE32(*data++, W256[j]); \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ + K256[j] + W256[j]; \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + + +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ + K256[j] + (W256[j] = *data++); \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND256(a,b,c,d,e,f,g,h) \ + s0 = W256[(j+1)&0x0f]; \ + s0 = sigma0_256(s0); \ + s1 = W256[(j+14)&0x0f]; \ + s1 = sigma1_256(s1); \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \ + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + +static void ldns_sha256_Transform(ldns_sha256_CTX* context, + const sha2_word32* data) { + sha2_word32 a, b, c, d, e, f, g, h, s0, s1; + sha2_word32 T1, *W256; + int j; + + W256 = (sha2_word32*)context->buffer; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { + /* Rounds 0 to 15 (unrolled): */ + ROUND256_0_TO_15(a,b,c,d,e,f,g,h); + ROUND256_0_TO_15(h,a,b,c,d,e,f,g); + ROUND256_0_TO_15(g,h,a,b,c,d,e,f); + ROUND256_0_TO_15(f,g,h,a,b,c,d,e); + ROUND256_0_TO_15(e,f,g,h,a,b,c,d); + ROUND256_0_TO_15(d,e,f,g,h,a,b,c); + ROUND256_0_TO_15(c,d,e,f,g,h,a,b); + ROUND256_0_TO_15(b,c,d,e,f,g,h,a); + } while (j < 16); + + /* Now for the remaining rounds to 64: */ + do { + ROUND256(a,b,c,d,e,f,g,h); + ROUND256(h,a,b,c,d,e,f,g); + ROUND256(g,h,a,b,c,d,e,f); + ROUND256(f,g,h,a,b,c,d,e); + ROUND256(e,f,g,h,a,b,c,d); + ROUND256(d,e,f,g,h,a,b,c); + ROUND256(c,d,e,f,g,h,a,b); + ROUND256(b,c,d,e,f,g,h,a); + } while (j < 64); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = 0; +} + +#else /* SHA2_UNROLL_TRANSFORM */ + +static void ldns_sha256_Transform(ldns_sha256_CTX* context, + const sha2_word32* data) { + sha2_word32 a, b, c, d, e, f, g, h, s0, s1; + sha2_word32 T1, T2, *W256; + int j; + + W256 = (sha2_word32*)context->buffer; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { +#if BYTE_ORDER == LITTLE_ENDIAN + /* Copy data while converting to host byte order */ + REVERSE32(*data++,W256[j]); + /* Apply the SHA-256 compression function to update a..h */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j]; +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* Apply the SHA-256 compression function to update a..h with copy */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++); +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + T2 = Sigma0_256(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 16); + + do { + /* Part of the message block expansion: */ + s0 = W256[(j+1)&0x0f]; + s0 = sigma0_256(s0); + s1 = W256[(j+14)&0x0f]; + s1 = sigma1_256(s1); + + /* Apply the SHA-256 compression function to update a..h */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); + T2 = Sigma0_256(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 64); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = T2 = 0; +} + +#endif /* SHA2_UNROLL_TRANSFORM */ + +void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t len) { + size_t freespace, usedspace; + + if (len == 0) { + /* Calling with no data is valid - we do nothing */ + return; + } + + /* Sanity check: */ + assert(context != (ldns_sha256_CTX*)0 && data != (sha2_byte*)0); + + usedspace = (context->bitcount >> 3) % LDNS_SHA256_BLOCK_LENGTH; + if (usedspace > 0) { + /* Calculate how much free space is available in the buffer */ + freespace = LDNS_SHA256_BLOCK_LENGTH - usedspace; + + if (len >= freespace) { + /* Fill the buffer completely and process it */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); + context->bitcount += freespace << 3; + len -= freespace; + data += freespace; + ldns_sha256_Transform(context, (sha2_word32*)context->buffer); + } else { + /* The buffer is not yet full */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, len); + context->bitcount += len << 3; + /* Clean up: */ + usedspace = freespace = 0; + return; + } + } + while (len >= LDNS_SHA256_BLOCK_LENGTH) { + /* Process as many complete blocks as we can */ + ldns_sha256_Transform(context, (sha2_word32*)data); + context->bitcount += LDNS_SHA256_BLOCK_LENGTH << 3; + len -= LDNS_SHA256_BLOCK_LENGTH; + data += LDNS_SHA256_BLOCK_LENGTH; + } + if (len > 0) { + /* There's left-overs, so save 'em */ + MEMCPY_BCOPY(context->buffer, data, len); + context->bitcount += len << 3; + } + /* Clean up: */ + usedspace = freespace = 0; +} + +void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) { + sha2_word32 *d = (sha2_word32*)digest; + size_t usedspace; + + /* Sanity check: */ + assert(context != (ldns_sha256_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + usedspace = (context->bitcount >> 3) % LDNS_SHA256_BLOCK_LENGTH; +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert FROM host byte order */ + REVERSE64(context->bitcount,context->bitcount); +#endif + if (usedspace > 0) { + /* Begin padding with a 1 bit: */ + context->buffer[usedspace++] = 0x80; + + if (usedspace <= ldns_sha256_SHORT_BLOCK_LENGTH) { + /* Set-up for the last transform: */ + MEMSET_BZERO(&context->buffer[usedspace], ldns_sha256_SHORT_BLOCK_LENGTH - usedspace); + } else { + if (usedspace < LDNS_SHA256_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA256_BLOCK_LENGTH - usedspace); + } + /* Do second-to-last transform: */ + ldns_sha256_Transform(context, (sha2_word32*)context->buffer); + + /* And set-up for the last transform: */ + MEMSET_BZERO(context->buffer, ldns_sha256_SHORT_BLOCK_LENGTH); + } + } else { + /* Set-up for the last transform: */ + MEMSET_BZERO(context->buffer, ldns_sha256_SHORT_BLOCK_LENGTH); + + /* Begin padding with a 1 bit: */ + *context->buffer = 0x80; + } + /* Set the bit count: */ + *(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount; + + /* final transform: */ + ldns_sha256_Transform(context, (sha2_word32*)context->buffer); + +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 8; j++) { + REVERSE32(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, LDNS_SHA256_DIGEST_LENGTH); +#endif + } + + /* Clean up state data: */ + MEMSET_BZERO(context, sizeof(context)); + usedspace = 0; +} + +unsigned char * +ldns_sha256(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha256_CTX ctx; + ldns_sha256_init(&ctx); + ldns_sha256_update(&ctx, data, data_len); + ldns_sha256_final(digest, &ctx); + return digest; +} + +/*** SHA-512: *********************************************************/ +void ldns_sha512_init(ldns_sha512_CTX* context) { + if (context == (ldns_sha512_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, sha512_initial_hash_value, LDNS_SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH); + context->bitcount[0] = context->bitcount[1] = 0; +} + +#ifdef SHA2_UNROLL_TRANSFORM + +/* Unrolled SHA-512 round macros: */ +#if BYTE_ORDER == LITTLE_ENDIAN + +#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + REVERSE64(*data++, W512[j]); \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ + K512[j] + W512[j]; \ + (d) += T1, \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \ + j++ + + +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ + K512[j] + (W512[j] = *data++); \ + (d) += T1; \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ + j++ + +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND512(a,b,c,d,e,f,g,h) \ + s0 = W512[(j+1)&0x0f]; \ + s0 = sigma0_512(s0); \ + s1 = W512[(j+14)&0x0f]; \ + s1 = sigma1_512(s1); \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \ + (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ + (d) += T1; \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ + j++ + +static void ldns_sha512_Transform(ldns_sha512_CTX* context, + const sha2_word64* data) { + sha2_word64 a, b, c, d, e, f, g, h, s0, s1; + sha2_word64 T1, *W512 = (sha2_word64*)context->buffer; + int j; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { + ROUND512_0_TO_15(a,b,c,d,e,f,g,h); + ROUND512_0_TO_15(h,a,b,c,d,e,f,g); + ROUND512_0_TO_15(g,h,a,b,c,d,e,f); + ROUND512_0_TO_15(f,g,h,a,b,c,d,e); + ROUND512_0_TO_15(e,f,g,h,a,b,c,d); + ROUND512_0_TO_15(d,e,f,g,h,a,b,c); + ROUND512_0_TO_15(c,d,e,f,g,h,a,b); + ROUND512_0_TO_15(b,c,d,e,f,g,h,a); + } while (j < 16); + + /* Now for the remaining rounds up to 79: */ + do { + ROUND512(a,b,c,d,e,f,g,h); + ROUND512(h,a,b,c,d,e,f,g); + ROUND512(g,h,a,b,c,d,e,f); + ROUND512(f,g,h,a,b,c,d,e); + ROUND512(e,f,g,h,a,b,c,d); + ROUND512(d,e,f,g,h,a,b,c); + ROUND512(c,d,e,f,g,h,a,b); + ROUND512(b,c,d,e,f,g,h,a); + } while (j < 80); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = 0; +} + +#else /* SHA2_UNROLL_TRANSFORM */ + +static void ldns_sha512_Transform(ldns_sha512_CTX* context, + const sha2_word64* data) { + sha2_word64 a, b, c, d, e, f, g, h, s0, s1; + sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer; + int j; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert TO host byte order */ + REVERSE64(*data++, W512[j]); + /* Apply the SHA-512 compression function to update a..h */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j]; +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* Apply the SHA-512 compression function to update a..h with copy */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++); +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + T2 = Sigma0_512(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 16); + + do { + /* Part of the message block expansion: */ + s0 = W512[(j+1)&0x0f]; + s0 = sigma0_512(s0); + s1 = W512[(j+14)&0x0f]; + s1 = sigma1_512(s1); + + /* Apply the SHA-512 compression function to update a..h */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + + (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); + T2 = Sigma0_512(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 80); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = T2 = 0; +} + +#endif /* SHA2_UNROLL_TRANSFORM */ + +void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t len) { + size_t freespace, usedspace; + + if (len == 0) { + /* Calling with no data is valid - we do nothing */ + return; + } + + /* Sanity check: */ + assert(context != (ldns_sha512_CTX*)0 && data != (sha2_byte*)0); + + usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; + if (usedspace > 0) { + /* Calculate how much free space is available in the buffer */ + freespace = LDNS_SHA512_BLOCK_LENGTH - usedspace; + + if (len >= freespace) { + /* Fill the buffer completely and process it */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); + ADDINC128(context->bitcount, freespace << 3); + len -= freespace; + data += freespace; + ldns_sha512_Transform(context, (sha2_word64*)context->buffer); + } else { + /* The buffer is not yet full */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, len); + ADDINC128(context->bitcount, len << 3); + /* Clean up: */ + usedspace = freespace = 0; + return; + } + } + while (len >= LDNS_SHA512_BLOCK_LENGTH) { + /* Process as many complete blocks as we can */ + ldns_sha512_Transform(context, (sha2_word64*)data); + ADDINC128(context->bitcount, LDNS_SHA512_BLOCK_LENGTH << 3); + len -= LDNS_SHA512_BLOCK_LENGTH; + data += LDNS_SHA512_BLOCK_LENGTH; + } + if (len > 0) { + /* There's left-overs, so save 'em */ + MEMCPY_BCOPY(context->buffer, data, len); + ADDINC128(context->bitcount, len << 3); + } + /* Clean up: */ + usedspace = freespace = 0; +} + +static void ldns_sha512_Last(ldns_sha512_CTX* context) { + size_t usedspace; + + usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert FROM host byte order */ + REVERSE64(context->bitcount[0],context->bitcount[0]); + REVERSE64(context->bitcount[1],context->bitcount[1]); +#endif + if (usedspace > 0) { + /* Begin padding with a 1 bit: */ + context->buffer[usedspace++] = 0x80; + + if (usedspace <= ldns_sha512_SHORT_BLOCK_LENGTH) { + /* Set-up for the last transform: */ + MEMSET_BZERO(&context->buffer[usedspace], ldns_sha512_SHORT_BLOCK_LENGTH - usedspace); + } else { + if (usedspace < LDNS_SHA512_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA512_BLOCK_LENGTH - usedspace); + } + /* Do second-to-last transform: */ + ldns_sha512_Transform(context, (sha2_word64*)context->buffer); + + /* And set-up for the last transform: */ + MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH - 2); + } + } else { + /* Prepare for final transform: */ + MEMSET_BZERO(context->buffer, ldns_sha512_SHORT_BLOCK_LENGTH); + + /* Begin padding with a 1 bit: */ + *context->buffer = 0x80; + } + /* Store the length of input data (in bits): */ + *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; + *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + + /* final transform: */ + ldns_sha512_Transform(context, (sha2_word64*)context->buffer); +} + +void ldns_sha512_final(sha2_byte digest[], ldns_sha512_CTX* context) { + sha2_word64 *d = (sha2_word64*)digest; + + /* Sanity check: */ + assert(context != (ldns_sha512_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + ldns_sha512_Last(context); + + /* Save the hash data for output: */ +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 8; j++) { + REVERSE64(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, LDNS_SHA512_DIGEST_LENGTH); +#endif + } + + /* Zero out state data */ + MEMSET_BZERO(context, sizeof(context)); +} + +unsigned char * +ldns_sha512(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha512_CTX ctx; + ldns_sha512_init(&ctx); + ldns_sha512_update(&ctx, data, data_len); + ldns_sha512_final(digest, &ctx); + return digest; +} + +/*** SHA-384: *********************************************************/ +void ldns_sha384_init(ldns_sha384_CTX* context) { + if (context == (ldns_sha384_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, sha384_initial_hash_value, LDNS_SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, LDNS_SHA384_BLOCK_LENGTH); + context->bitcount[0] = context->bitcount[1] = 0; +} + +void ldns_sha384_update(ldns_sha384_CTX* context, const sha2_byte* data, size_t len) { + ldns_sha512_update((ldns_sha512_CTX*)context, data, len); +} + +void ldns_sha384_final(sha2_byte digest[], ldns_sha384_CTX* context) { + sha2_word64 *d = (sha2_word64*)digest; + + /* Sanity check: */ + assert(context != (ldns_sha384_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + ldns_sha512_Last((ldns_sha512_CTX*)context); + + /* Save the hash data for output: */ +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 6; j++) { + REVERSE64(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, LDNS_SHA384_DIGEST_LENGTH); +#endif + } + + /* Zero out state data */ + MEMSET_BZERO(context, sizeof(context)); +} + +unsigned char * +ldns_sha384(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha384_CTX ctx; + ldns_sha384_init(&ctx); + ldns_sha384_update(&ctx, data, data_len); + ldns_sha384_final(digest, &ctx); + return digest; +} diff --git a/libs/ldns/str2host.c b/libs/ldns/str2host.c new file mode 100644 index 0000000000..2eda2f805b --- /dev/null +++ b/libs/ldns/str2host.c @@ -0,0 +1,1313 @@ +/* + * str2host.c + * + * conversion routines from the presentation format + * to the host format + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ +#include + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#include + +#include +#ifdef HAVE_NETDB_H +#include +#endif + +#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +ldns_status +ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr) +{ + char *end = NULL; + uint16_t *r; + r = LDNS_MALLOC(uint16_t); + if(!r) return LDNS_STATUS_MEM_ERR; + + *r = htons((uint16_t)strtol((char *)shortstr, &end, 10)); + + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_INVALID_INT; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT16, sizeof(uint16_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } +} + +ldns_status +ldns_str2rdf_time(ldns_rdf **rd, const char *time) +{ + /* convert a time YYYYDDMMHHMMSS to wireformat */ + uint16_t *r = NULL; + struct tm tm; + uint32_t l; + char *end; + + /* Try to scan the time... */ + r = (uint16_t*)LDNS_MALLOC(uint32_t); + if(!r) return LDNS_STATUS_MEM_ERR; + + memset(&tm, 0, sizeof(tm)); + + if (strlen(time) == 14 && + sscanf(time, "%4d%2d%2d%2d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6 + ) { + tm.tm_year -= 1900; + tm.tm_mon--; + /* Check values */ + if (tm.tm_year < 70) { + goto bad_format; + } + if (tm.tm_mon < 0 || tm.tm_mon > 11) { + goto bad_format; + } + if (tm.tm_mday < 1 || tm.tm_mday > 31) { + goto bad_format; + } + + if (tm.tm_hour < 0 || tm.tm_hour > 23) { + goto bad_format; + } + + if (tm.tm_min < 0 || tm.tm_min > 59) { + goto bad_format; + } + + if (tm.tm_sec < 0 || tm.tm_sec > 59) { + goto bad_format; + } + + l = htonl(mktime_from_utc(&tm)); + memcpy(r, &l, sizeof(uint32_t)); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_TIME, sizeof(uint32_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } else { + /* handle it as 32 bits timestamp */ + l = htonl((uint32_t)strtol((char*)time, &end, 10)); + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_ERR; + } else { + memcpy(r, &l, sizeof(uint32_t)); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT32, sizeof(uint32_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } + } + + bad_format: + LDNS_FREE(r); + return LDNS_STATUS_INVALID_TIME; +} + +ldns_status +ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *salt_str) +{ + uint8_t salt_length; + int c; + int salt_length_str; + + uint8_t *salt; + uint8_t *data; + if(rd == NULL) { + return LDNS_STATUS_NULL; + } + + salt_length_str = (int)strlen(salt_str); + if (salt_length_str == 1 && salt_str[0] == '-') { + salt_length_str = 0; + } else if (salt_length_str % 2 != 0) { + return LDNS_STATUS_INVALID_HEX; + } + if (salt_length_str > 512) { + return LDNS_STATUS_INVALID_HEX; + } + + salt = LDNS_XMALLOC(uint8_t, salt_length_str / 2); + if(!salt) { + return LDNS_STATUS_MEM_ERR; + } + for (c = 0; c < salt_length_str; c += 2) { + if (isxdigit((int) salt_str[c]) && isxdigit((int) salt_str[c+1])) { + salt[c/2] = (uint8_t) ldns_hexdigit_to_int(salt_str[c]) * 16 + + ldns_hexdigit_to_int(salt_str[c+1]); + } else { + LDNS_FREE(salt); + return LDNS_STATUS_INVALID_HEX; + } + } + salt_length = (uint8_t) (salt_length_str / 2); + + data = LDNS_XMALLOC(uint8_t, 1 + salt_length); + if(!data) { + LDNS_FREE(salt); + return LDNS_STATUS_MEM_ERR; + } + data[0] = salt_length; + memcpy(&data[1], salt, salt_length); + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC3_SALT, 1 + salt_length, data); + LDNS_FREE(data); + LDNS_FREE(salt); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_period(ldns_rdf **rd,const char *period) +{ + uint32_t p; + const char *end; + + /* Allocate required space... */ + p = ldns_str2period(period, &end); + + if (*end != 0) { + return LDNS_STATUS_ERR; + } else { + p = (uint32_t) htonl(p); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_PERIOD, sizeof(uint32_t), &p); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr) +{ + char *end; + uint16_t *r = NULL; + uint32_t l; + + r = (uint16_t*)LDNS_MALLOC(uint32_t); + if(!r) return LDNS_STATUS_MEM_ERR; + errno = 0; /* must set to zero before call, + note race condition on errno */ + if(*longstr == '-') + l = htonl((uint32_t)strtol((char*)longstr, &end, 10)); + else l = htonl((uint32_t)strtoul((char*)longstr, &end, 10)); + + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_ERR; + } else { + if (errno == ERANGE) { + LDNS_FREE(r); + return LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW; + } + memcpy(r, &l, sizeof(uint32_t)); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT32, sizeof(uint32_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } +} + +ldns_status +ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr) +{ + char *end; + uint8_t *r = NULL; + + r = LDNS_MALLOC(uint8_t); + if(!r) return LDNS_STATUS_MEM_ERR; + + *r = (uint8_t)strtol((char*)bytestr, &end, 10); + + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_ERR; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT8, sizeof(uint8_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } +} + + +/* + * Checks whether the escaped value at **s is an octal value or + * a 'normally' escaped character (and not eos) + * + * The string pointer at *s is increased by either 0 (on error), 1 (on + * normal escapes), or 3 (on octals) + * + * Returns the number of bytes read from the escaped string, or + * 0 on error + */ +static int +parse_escape(uint8_t *s, uint8_t *q) { + uint8_t val; + if (strlen((char *)s) > 3 && + isdigit((int) s[1]) && + isdigit((int) s[2]) && + isdigit((int) s[3])) { + /* cast this so it fits */ + val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 100 + + ldns_hexdigit_to_int((char) s[2]) * 10 + + ldns_hexdigit_to_int((char) s[3]); + *q = val; + return 3; + } else { + s++; + if (*s == '\0' || isdigit((int) *s)) { + /* apparently the string terminator + * or a digit has been escaped... + */ + return 0; + } + *q = *s; + return 1; + } +} + +/* + * No special care is taken, all dots are translated into + * label seperators. + * Could be made more efficient....we do 3 memcpy's in total... + */ +ldns_status +ldns_str2rdf_dname(ldns_rdf **d, const char *str) +{ + size_t len; + + int esc; + uint8_t *s, *q, *pq, label_len; + uint8_t buf[LDNS_MAX_DOMAINLEN + 1]; + *d = NULL; + + len = strlen((char*)str); + /* octet representation can make strings a lot longer than actual length */ + if (len > LDNS_MAX_DOMAINLEN * 4) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + if (0 == len) { + return LDNS_STATUS_DOMAINNAME_UNDERFLOW; + } + + /* root label */ + if (1 == len && *str == '.') { + *d = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, 1, "\0"); + return LDNS_STATUS_OK; + } + + /* get on with the rest */ + + /* s is on the current character in the string + * pq points to where the labellength is going to go + * label_len keeps track of the current label's length + * q builds the dname inside the buf array + */ + len = 0; + q = buf+1; + pq = buf; + label_len = 0; + for (s = (uint8_t *)str; *s; s++, q++) { + if (q > buf + LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + *q = 0; + switch (*s) { + case '.': + if (label_len > LDNS_MAX_LABELLEN) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + if (label_len == 0) { + return LDNS_STATUS_EMPTY_LABEL; + } + len += label_len + 1; + *pq = label_len; + label_len = 0; + pq = q; + break; + case '\\': + /* octet value or literal char */ + esc = parse_escape(s, q); + if (esc > 0) { + s += esc; + label_len++; + } else { + return LDNS_STATUS_SYNTAX_BAD_ESCAPE; + } + break; + default: + *q = *s; + label_len++; + } + } + + /* add root label if last char was not '.' */ + if (!ldns_dname_str_absolute(str)) { + if (q > buf + LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + if (label_len > LDNS_MAX_LABELLEN) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + if (label_len == 0) { /* label_len 0 but not . at end? */ + return LDNS_STATUS_EMPTY_LABEL; + } + len += label_len + 1; + *pq = label_len; + *q = 0; + } + len++; + + *d = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, len, buf); + return LDNS_STATUS_OK; +} + +ldns_status +ldns_str2rdf_a(ldns_rdf **rd, const char *str) +{ + in_addr_t address; + if (inet_pton(AF_INET, (char*)str, &address) != 1) { + return LDNS_STATUS_INVALID_IP4; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_A, sizeof(address), &address); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str) +{ + uint8_t address[LDNS_IP6ADDRLEN + 1]; + + if (inet_pton(AF_INET6, (char*)str, address) != 1) { + return LDNS_STATUS_INVALID_IP6; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_AAAA, sizeof(address) - 1, &address); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_str(ldns_rdf **rd, const char *str) +{ + uint8_t *data; + size_t i, str_i, esc_i; + + if (strlen(str) > 255) { + return LDNS_STATUS_INVALID_STR; + } + + data = LDNS_XMALLOC(uint8_t, strlen(str) + 1); + if(!data) return LDNS_STATUS_MEM_ERR; + i = 1; + + for (str_i = 0; str_i < strlen(str); str_i++) { + if (str[str_i] == '\\') { + /* octet value or literal char */ + esc_i = (size_t) parse_escape((uint8_t*) &str[str_i], (uint8_t*) &data[i]); + if (esc_i == 0) { + LDNS_FREE(data); + return LDNS_STATUS_SYNTAX_BAD_ESCAPE; + } + str_i += esc_i; + } else { + data[i] = (uint8_t) str[str_i]; + } + i++; + } + data[0] = i - 1; + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_STR, i, data); + + LDNS_FREE(data); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_apl(ldns_rdf **rd, const char *str) +{ + const char *my_str = str; + + char *my_ip_str; + size_t ip_str_len; + + uint16_t family; + bool negation; + uint8_t afdlength = 0; + uint8_t *afdpart; + uint8_t prefix; + + uint8_t *data; + + size_t i = 0; + + /* [!]afi:address/prefix */ + if (strlen(my_str) < 2) { + return LDNS_STATUS_INVALID_STR; + } + + if (my_str[0] == '!') { + negation = true; + my_str += 1; + } else { + negation = false; + } + + family = (uint16_t) atoi(my_str); + + my_str = strchr(my_str, ':') + 1; + + /* need ip addr and only ip addr for inet_pton */ + ip_str_len = (size_t) (strchr(my_str, '/') - my_str); + my_ip_str = LDNS_XMALLOC(char, ip_str_len + 1); + if(!my_ip_str) return LDNS_STATUS_MEM_ERR; + strncpy(my_ip_str, my_str, ip_str_len + 1); + my_ip_str[ip_str_len] = '\0'; + + if (family == 1) { + /* ipv4 */ + afdpart = LDNS_XMALLOC(uint8_t, 4); + if(!afdpart) { + LDNS_FREE(my_ip_str); + return LDNS_STATUS_MEM_ERR; + } + if (inet_pton(AF_INET, my_ip_str, afdpart) == 0) { + LDNS_FREE(my_ip_str); + LDNS_FREE(afdpart); + return LDNS_STATUS_INVALID_STR; + } + for (i = 0; i < 4; i++) { + if (afdpart[i] != 0) { + afdlength = i + 1; + } + } + } else if (family == 2) { + /* ipv6 */ + afdpart = LDNS_XMALLOC(uint8_t, 16); + if(!afdpart) { + LDNS_FREE(my_ip_str); + return LDNS_STATUS_MEM_ERR; + } + if (inet_pton(AF_INET6, my_ip_str, afdpart) == 0) { + LDNS_FREE(my_ip_str); + LDNS_FREE(afdpart); + return LDNS_STATUS_INVALID_STR; + } + for (i = 0; i < 16; i++) { + if (afdpart[i] != 0) { + afdlength = i + 1; + } + } + } else { + /* unknown family */ + LDNS_FREE(my_ip_str); + return LDNS_STATUS_INVALID_STR; + } + + my_str = strchr(my_str, '/') + 1; + prefix = (uint8_t) atoi(my_str); + + data = LDNS_XMALLOC(uint8_t, 4 + afdlength); + if(!data) { + LDNS_FREE(my_ip_str); + return LDNS_STATUS_INVALID_STR; + } + ldns_write_uint16(data, family); + data[2] = prefix; + data[3] = afdlength; + if (negation) { + /* set bit 1 of byte 3 */ + data[3] = data[3] | 0x80; + } + + memcpy(data + 4, afdpart, afdlength); + + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_APL, afdlength + 4, data); + LDNS_FREE(afdpart); + LDNS_FREE(data); + LDNS_FREE(my_ip_str); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_b64(ldns_rdf **rd, const char *str) +{ + uint8_t *buffer; + int16_t i; + + buffer = LDNS_XMALLOC(uint8_t, ldns_b64_ntop_calculate_size(strlen(str))); + if(!buffer) { + return LDNS_STATUS_MEM_ERR; + } + + i = (uint16_t)ldns_b64_pton((const char*)str, buffer, + ldns_b64_ntop_calculate_size(strlen(str))); + if (-1 == i) { + LDNS_FREE(buffer); + return LDNS_STATUS_INVALID_B64; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_B64, (uint16_t) i, buffer); + } + LDNS_FREE(buffer); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str) +{ + uint8_t *buffer; + int i; + /* first byte contains length of actual b32 data */ + uint8_t len = ldns_b32_pton_calculate_size(strlen(str)); + buffer = LDNS_XMALLOC(uint8_t, len + 1); + if(!buffer) { + return LDNS_STATUS_MEM_ERR; + } + buffer[0] = len; + + i = ldns_b32_pton_extended_hex((const char*)str, strlen(str), buffer + 1, + ldns_b32_ntop_calculate_size(strlen(str))); + if (i < 0) { + LDNS_FREE(buffer); + return LDNS_STATUS_INVALID_B32_EXT; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_B32_EXT, (uint16_t) i + 1, buffer); + } + LDNS_FREE(buffer); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_hex(ldns_rdf **rd, const char *str) +{ + uint8_t *t, *t_orig; + int i; + size_t len; + + len = strlen(str); + + if (len > LDNS_MAX_RDFLEN * 2) { + return LDNS_STATUS_LABEL_OVERFLOW; + } else { + t = LDNS_XMALLOC(uint8_t, (len / 2) + 1); + if(!t) { + return LDNS_STATUS_MEM_ERR; + } + t_orig = t; + /* Now process octet by octet... */ + while (*str) { + *t = 0; + if (isspace((int) *str)) { + str++; + } else { + for (i = 16; i >= 1; i -= 15) { + while (*str && isspace((int) *str)) { str++; } + if (*str) { + if (isxdigit((int) *str)) { + *t += ldns_hexdigit_to_int(*str) * i; + } else { + LDNS_FREE(t_orig); + return LDNS_STATUS_ERR; + } + ++str; + } + } + ++t; + } + } + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, + (size_t) (t - t_orig), + t_orig); + LDNS_FREE(t_orig); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_nsec(ldns_rdf **rd, const char *str) +{ + const char *delimiters = "\n\t "; + char *token = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); + ldns_buffer *str_buf; + ssize_t c; + uint16_t cur_type; + size_t type_count = 0; + ldns_rr_type type_list[65536]; + if(!token) return LDNS_STATUS_MEM_ERR; + if(rd == NULL) { + LDNS_FREE(token); + return LDNS_STATUS_NULL; + } + + str_buf = LDNS_MALLOC(ldns_buffer); + if(!str_buf) { + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); + if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + + while ((c = ldns_bget_token(str_buf, token, delimiters, LDNS_MAX_RDFLEN)) != -1 && c != 0) { + if(type_count >= sizeof(type_list)) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_ERR; + } + cur_type = ldns_get_rr_type_by_name(token); + type_list[type_count] = cur_type; + type_count++; + } + + *rd = ldns_dnssec_create_nsec_bitmap(type_list, + type_count, + LDNS_RR_TYPE_NSEC); + + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_type(ldns_rdf **rd, const char *str) +{ + uint16_t type; + type = htons(ldns_get_rr_type_by_name(str)); + /* ldns_rr_type is a 16 bit value */ + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_TYPE, sizeof(uint16_t), &type); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_class(ldns_rdf **rd, const char *str) +{ + uint16_t klass; + klass = htons(ldns_get_rr_class_by_name(str)); + /* class is 16 bit */ + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_CLASS, sizeof(uint16_t), &klass); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +/* An certificate alg field can either be specified as a 8 bits number + * or by its symbolic name. Handle both + */ +ldns_status +ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str) +{ + ldns_lookup_table *lt; + ldns_status st; + uint8_t idd[2]; + lt = ldns_lookup_by_name(ldns_cert_algorithms, str); + st = LDNS_STATUS_OK; + + if (lt) { + ldns_write_uint16(idd, (uint16_t) lt->id); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT16, sizeof(uint16_t), idd); + if (!*rd) { + st = LDNS_STATUS_ERR; + } + } else { + /* try as-is (a number) */ + st = ldns_str2rdf_int16(rd, str); + if (st == LDNS_STATUS_OK && + ldns_rdf2native_int16(*rd) == 0) { + st = LDNS_STATUS_CERT_BAD_ALGORITHM; + } + } + + return st; +} + +/* An alg field can either be specified as a 8 bits number + * or by its symbolic name. Handle both + */ +ldns_status +ldns_str2rdf_alg(ldns_rdf **rd, const char *str) +{ + ldns_lookup_table *lt; + ldns_status st; + + lt = ldns_lookup_by_name(ldns_algorithms, str); + st = LDNS_STATUS_OK; + + if (lt) { + /* it was given as a integer */ + *rd = ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, (uint8_t) lt->id); + if (!*rd) { + st = LDNS_STATUS_ERR; + } + } else { + /* try as-is (a number) */ + st = ldns_str2rdf_int8(rd, str); + } + return st; +} + +ldns_status +ldns_str2rdf_unknown(ldns_rdf **rd, const char *str) +{ + /* this should be caught in an earlier time (general str2host for + rr's */ + rd = rd; + str = str; + return LDNS_STATUS_NOT_IMPL; +} + +ldns_status +ldns_str2rdf_tsig(ldns_rdf **rd, const char *str) +{ + /* there is no strign representation for TSIG rrs */ + rd = rd; + str = str; + return LDNS_STATUS_NOT_IMPL; +} + +ldns_status +ldns_str2rdf_service(ldns_rdf **rd, const char *str) +{ + /* is this used? is this actually WKS? or SRV? */ + rd = rd; + str = str; + return LDNS_STATUS_NOT_IMPL; +} + +static int +loc_parse_cm(char* my_str, char** endstr, uint8_t* m, uint8_t* e) +{ + /* read [.][mM] */ + /* into mantissa exponent format for LOC type */ + uint32_t meters = 0, cm = 0, val; + while (isblank(*my_str)) { + my_str++; + } + meters = (uint32_t)strtol(my_str, &my_str, 10); + if (*my_str == '.') { + my_str++; + cm = (uint32_t)strtol(my_str, &my_str, 10); + } + if (meters >= 1) { + *e = 2; + val = meters; + } else { + *e = 0; + val = cm; + } + while(val >= 10) { + (*e)++; + val /= 10; + } + *m = (uint8_t)val; + + if (*e > 9) + return 0; + if (*my_str == 'm' || *my_str == 'M') { + my_str++; + } + *endstr = my_str; + return 1; +} + +ldns_status +ldns_str2rdf_loc(ldns_rdf **rd, const char *str) +{ + uint32_t latitude = 0; + uint32_t longitude = 0; + uint32_t altitude = 0; + + uint8_t *data; + uint32_t equator = (uint32_t) ldns_power(2, 31); + + uint32_t h = 0; + uint32_t m = 0; + uint8_t size_b = 1, size_e = 2; + uint8_t horiz_pre_b = 1, horiz_pre_e = 6; + uint8_t vert_pre_b = 1, vert_pre_e = 3; + + double s = 0.0; + bool northerness; + bool easterness; + + char *my_str = (char *) str; + + /* only support version 0 */ + if (isdigit((int) *my_str)) { + h = (uint32_t) strtol(my_str, &my_str, 10); + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + m = (uint32_t) strtol(my_str, &my_str, 10); + } else if (*my_str == 'N' || *my_str == 'S') { + goto north; + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + s = strtod(my_str, &my_str); + } +north: + while (isblank((int) *my_str)) { + my_str++; + } + + if (*my_str == 'N') { + northerness = true; + } else if (*my_str == 'S') { + northerness = false; + } else { + return LDNS_STATUS_INVALID_STR; + } + + my_str++; + + /* store number */ + s = 1000.0 * s; + /* add a little to make floor in conversion a round */ + s += 0.0005; + latitude = (uint32_t) s; + latitude += 1000 * 60 * m; + latitude += 1000 * 60 * 60 * h; + if (northerness) { + latitude = equator + latitude; + } else { + latitude = equator - latitude; + } + while (isblank(*my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + h = (uint32_t) strtol(my_str, &my_str, 10); + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + m = (uint32_t) strtol(my_str, &my_str, 10); + } else if (*my_str == 'E' || *my_str == 'W') { + goto east; + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank(*my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + s = strtod(my_str, &my_str); + } + +east: + while (isblank(*my_str)) { + my_str++; + } + + if (*my_str == 'E') { + easterness = true; + } else if (*my_str == 'W') { + easterness = false; + } else { + return LDNS_STATUS_INVALID_STR; + } + + my_str++; + + /* store number */ + s *= 1000.0; + /* add a little to make floor in conversion a round */ + s += 0.0005; + longitude = (uint32_t) s; + longitude += 1000 * 60 * m; + longitude += 1000 * 60 * 60 * h; + + if (easterness) { + longitude += equator; + } else { + longitude = equator - longitude; + } + + altitude = (uint32_t)(strtod(my_str, &my_str)*100.0 + + 10000000.0 + 0.5); + if (*my_str == 'm' || *my_str == 'M') { + my_str++; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &size_b, &size_e)) + return LDNS_STATUS_INVALID_STR; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &horiz_pre_b, &horiz_pre_e)) + return LDNS_STATUS_INVALID_STR; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &vert_pre_b, &vert_pre_e)) + return LDNS_STATUS_INVALID_STR; + } + + data = LDNS_XMALLOC(uint8_t, 16); + if(!data) { + return LDNS_STATUS_MEM_ERR; + } + data[0] = 0; + data[1] = 0; + data[1] = ((size_b << 4) & 0xf0) | (size_e & 0x0f); + data[2] = ((horiz_pre_b << 4) & 0xf0) | (horiz_pre_e & 0x0f); + data[3] = ((vert_pre_b << 4) & 0xf0) | (vert_pre_e & 0x0f); + ldns_write_uint32(data + 4, latitude); + ldns_write_uint32(data + 8, longitude); + ldns_write_uint32(data + 12, altitude); + + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_LOC, 16, data); + + LDNS_FREE(data); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_wks(ldns_rdf **rd, const char *str) +{ + uint8_t *bitmap = NULL; + uint8_t *data; + int bm_len = 0; + + struct protoent *proto = NULL; + struct servent *serv = NULL; + int serv_port; + + ldns_buffer *str_buf; + + char *proto_str = NULL; + char *token; + if(strlen(str) == 0) + token = LDNS_XMALLOC(char, 50); + else token = LDNS_XMALLOC(char, strlen(str)+2); + if(!token) return LDNS_STATUS_MEM_ERR; + + str_buf = LDNS_MALLOC(ldns_buffer); + if(!str_buf) {LDNS_FREE(token); return LDNS_STATUS_MEM_ERR;} + ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); + if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + + while(ldns_bget_token(str_buf, token, "\t\n ", strlen(str)) > 0) { + if (!proto_str) { + proto_str = strdup(token); + if (!proto_str) { + LDNS_FREE(bitmap); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + } else { + serv = getservbyname(token, proto_str); + if (serv) { + serv_port = (int) ntohs((uint16_t) serv->s_port); + } else { + serv_port = atoi(token); + } + if (serv_port / 8 >= bm_len) { + uint8_t *b2 = LDNS_XREALLOC(bitmap, uint8_t, (serv_port / 8) + 1); + if(!b2) { + LDNS_FREE(bitmap); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + free(proto_str); + return LDNS_STATUS_INVALID_STR; + } + bitmap = b2; + /* set to zero to be sure */ + for (; bm_len <= serv_port / 8; bm_len++) { + bitmap[bm_len] = 0; + } + } + ldns_set_bit(bitmap + (serv_port / 8), 7 - (serv_port % 8), true); + } + } + + if (!proto_str || !bitmap) { + LDNS_FREE(bitmap); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + free(proto_str); + return LDNS_STATUS_INVALID_STR; + } + + data = LDNS_XMALLOC(uint8_t, bm_len + 1); + if(!data) { + LDNS_FREE(token); + ldns_buffer_free(str_buf); + LDNS_FREE(bitmap); + free(proto_str); + return LDNS_STATUS_INVALID_STR; + } + if (proto_str) + proto = getprotobyname(proto_str); + if (proto) { + data[0] = (uint8_t) proto->p_proto; + } else if (proto_str) { + data[0] = (uint8_t) atoi(proto_str); + } else { + data[0] = 0; + } + memcpy(data + 1, bitmap, (size_t) bm_len); + + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_WKS, (uint16_t) (bm_len + 1), data); + + LDNS_FREE(data); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + LDNS_FREE(bitmap); + free(proto_str); +#ifdef HAVE_ENDSERVENT + endservent(); +#endif +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + + if(!*rd) return LDNS_STATUS_MEM_ERR; + + return LDNS_STATUS_OK; +} + +ldns_status +ldns_str2rdf_nsap(ldns_rdf **rd, const char *str) +{ + size_t len, i; + char* nsap_str = (char*) str; + + /* just a hex string with optional dots? */ + if (str[0] != '0' || str[1] != 'x') { + return LDNS_STATUS_INVALID_STR; + } else { + len = strlen(str); + for (i=0; i < len; i++) { + if (nsap_str[i] == '.') + nsap_str[i] = ' '; + } + return ldns_str2rdf_hex(rd, str+2); + } +} + +ldns_status +ldns_str2rdf_atma(ldns_rdf **rd, const char *str) +{ + size_t len, i; + char* atma_str = (char*) str; + ldns_status status; + + /* just a hex string with optional dots? */ + len = strlen(str); + for (i=0; i < len; i++) { + if (atma_str[i] == '.') + atma_str[i] = ' '; + } + status = ldns_str2rdf_hex(rd, str); + if (status != LDNS_STATUS_OK) { + ; /* probably in e.164 format than */ + } + return status; +} + +ldns_status +ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str) +{ + uint8_t precedence = 0; + uint8_t gateway_type = 0; + uint8_t algorithm = 0; + char* gateway = NULL; + char* publickey = NULL; + uint8_t *data; + ldns_buffer *str_buf; + char *token; + int token_count = 0; + int ipseckey_len = 0; + ldns_rdf* gateway_rdf = NULL; + ldns_rdf* publickey_rdf = NULL; + ldns_status status = LDNS_STATUS_OK; + + if(strlen(str) == 0) + token = LDNS_XMALLOC(char, 256); + else token = LDNS_XMALLOC(char, strlen(str)+2); + if(!token) return LDNS_STATUS_MEM_ERR; + + str_buf = LDNS_MALLOC(ldns_buffer); + if(!str_buf) {LDNS_FREE(token); return LDNS_STATUS_MEM_ERR;} + ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); + if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + while(ldns_bget_token(str_buf, token, "\t\n ", strlen(str)) > 0) { + switch (token_count) { + case 0: + precedence = (uint8_t)atoi(token); + break; + case 1: + gateway_type = (uint8_t)atoi(token); + break; + case 2: + algorithm = (uint8_t)atoi(token); + break; + case 3: + gateway = strdup(token); + if (!gateway || (gateway_type == 0 && + (token[0] != '.' || token[1] != '\0'))) { + LDNS_FREE(gateway); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + break; + case 4: + publickey = strdup(token); + break; + default: + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + break; + } + token_count++; + } + + if (!gateway || !publickey) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + + if (gateway_type == 1) { + status = ldns_str2rdf_a(&gateway_rdf, gateway); + } else if (gateway_type == 2) { + status = ldns_str2rdf_aaaa(&gateway_rdf, gateway); + } else if (gateway_type == 3) { + status = ldns_str2rdf_dname(&gateway_rdf, gateway); + } + + if (status != LDNS_STATUS_OK) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + + status = ldns_str2rdf_b64(&publickey_rdf, publickey); + + if (status != LDNS_STATUS_OK) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + if (gateway_rdf) ldns_rdf_free(gateway_rdf); + return LDNS_STATUS_INVALID_STR; + } + + /* now copy all into one ipseckey rdf */ + if (gateway_type) + ipseckey_len = 3 + (int)ldns_rdf_size(gateway_rdf) + (int)ldns_rdf_size(publickey_rdf); + else + ipseckey_len = 3 + (int)ldns_rdf_size(publickey_rdf); + + data = LDNS_XMALLOC(uint8_t, ipseckey_len); + if(!data) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + if (gateway_rdf) ldns_rdf_free(gateway_rdf); + if (publickey_rdf) ldns_rdf_free(publickey_rdf); + return LDNS_STATUS_MEM_ERR; + } + + data[0] = precedence; + data[1] = gateway_type; + data[2] = algorithm; + + if (gateway_type) { + memcpy(data + 3, + ldns_rdf_data(gateway_rdf), ldns_rdf_size(gateway_rdf)); + memcpy(data + 3 + ldns_rdf_size(gateway_rdf), + ldns_rdf_data(publickey_rdf), ldns_rdf_size(publickey_rdf)); + } else { + memcpy(data + 3, + ldns_rdf_data(publickey_rdf), ldns_rdf_size(publickey_rdf)); + } + + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_IPSECKEY, (uint16_t) ipseckey_len, data); + + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + ldns_rdf_free(gateway_rdf); + ldns_rdf_free(publickey_rdf); + LDNS_FREE(data); + if(!*rd) return LDNS_STATUS_MEM_ERR; + return LDNS_STATUS_OK; +} diff --git a/libs/ldns/tsig.c b/libs/ldns/tsig.c new file mode 100644 index 0000000000..7fcf21da0e --- /dev/null +++ b/libs/ldns/tsig.c @@ -0,0 +1,458 @@ +/* + * tsig.c + * + * contains the functions needed for TSIG [RFC2845] + * + * (c) 2005-2006 NLnet Labs + * See the file LICENSE for the license + */ + +#include + +#include + +#include + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ + +char * +ldns_tsig_algorithm(ldns_tsig_credentials *tc) +{ + return tc->algorithm; +} + +char * +ldns_tsig_keyname(ldns_tsig_credentials *tc) +{ + return tc->keyname; +} + +char * +ldns_tsig_keydata(ldns_tsig_credentials *tc) +{ + return tc->keydata; +} + +char * +ldns_tsig_keyname_clone(ldns_tsig_credentials *tc) +{ + return strdup(tc->keyname); +} + +char * +ldns_tsig_keydata_clone(ldns_tsig_credentials *tc) +{ + return strdup(tc->keydata); +} + +/* + * Makes an exact copy of the wire, but with the tsig rr removed + */ +uint8_t * +ldns_tsig_prepare_pkt_wire(uint8_t *wire, size_t wire_len, size_t *result_len) +{ + uint8_t *wire2 = NULL; + uint16_t qd_count; + uint16_t an_count; + uint16_t ns_count; + uint16_t ar_count; + ldns_rr *rr; + + size_t pos; + uint16_t i; + + ldns_status status; + + if(wire_len < LDNS_HEADER_SIZE) { + return NULL; + } + /* fake parse the wire */ + qd_count = LDNS_QDCOUNT(wire); + an_count = LDNS_ANCOUNT(wire); + ns_count = LDNS_NSCOUNT(wire); + ar_count = LDNS_ARCOUNT(wire); + + if (ar_count > 0) { + ar_count--; + } else { + return NULL; + } + + pos = LDNS_HEADER_SIZE; + + for (i = 0; i < qd_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_QUESTION); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + for (i = 0; i < an_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_ANSWER); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + for (i = 0; i < ns_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_AUTHORITY); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + for (i = 0; i < ar_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, + LDNS_SECTION_ADDITIONAL); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + *result_len = pos; + wire2 = LDNS_XMALLOC(uint8_t, *result_len); + if(!wire2) { + return NULL; + } + memcpy(wire2, wire, *result_len); + + ldns_write_uint16(wire2 + LDNS_ARCOUNT_OFF, ar_count); + + return wire2; +} + +#ifdef HAVE_SSL +static const EVP_MD * +ldns_digest_function(char *name) +{ + /* these are the mandatory algorithms from RFC4635 */ + /* The optional algorithms are not yet implemented */ + if (strlen(name) == 12 && strncasecmp(name, "hmac-sha256.", 11) == 0) { +#ifdef HAVE_EVP_SHA256 + return EVP_sha256(); +#else + return NULL; +#endif + } else if (strlen(name) == 10 && strncasecmp(name, "hmac-sha1.", 9) == 0) + return EVP_sha1(); + else if (strlen(name) == 25 && strncasecmp(name, + "hmac-md5.sig-alg.reg.int.", 25) == 0) + return EVP_md5(); + else + return NULL; +} +#endif + +#ifdef HAVE_SSL +static ldns_status +ldns_tsig_mac_new(ldns_rdf **tsig_mac, uint8_t *pkt_wire, size_t pkt_wire_size, + const char *key_data, ldns_rdf *key_name_rdf, ldns_rdf *fudge_rdf, + ldns_rdf *algorithm_rdf, ldns_rdf *time_signed_rdf, ldns_rdf *error_rdf, + ldns_rdf *other_data_rdf, ldns_rdf *orig_mac_rdf, int tsig_timers_only) +{ + char *wireformat; + int wiresize; + unsigned char *mac_bytes; + unsigned char *key_bytes; + int key_size; + const EVP_MD *digester; + char *algorithm_name; + unsigned int md_len = EVP_MAX_MD_SIZE; + ldns_rdf *result = NULL; + ldns_buffer *data_buffer = NULL; + + /* + * prepare the digestable information + */ + data_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if(!data_buffer) { + return LDNS_STATUS_MEM_ERR; + } + /* if orig_mac is not NULL, add it too */ + if (orig_mac_rdf) { + (void) ldns_rdf2buffer_wire(data_buffer, orig_mac_rdf); + } + ldns_buffer_write(data_buffer, pkt_wire, pkt_wire_size); + if (!tsig_timers_only) { + (void)ldns_rdf2buffer_wire(data_buffer, key_name_rdf); + ldns_buffer_write_u16(data_buffer, LDNS_RR_CLASS_ANY); + ldns_buffer_write_u32(data_buffer, 0); + (void)ldns_rdf2buffer_wire(data_buffer, algorithm_rdf); + } + (void)ldns_rdf2buffer_wire(data_buffer, time_signed_rdf); + (void)ldns_rdf2buffer_wire(data_buffer, fudge_rdf); + if (!tsig_timers_only) { + (void)ldns_rdf2buffer_wire(data_buffer, error_rdf); + (void)ldns_rdf2buffer_wire(data_buffer, other_data_rdf); + } + + wireformat = (char *) data_buffer->_data; + wiresize = (int) ldns_buffer_position(data_buffer); + + algorithm_name = ldns_rdf2str(algorithm_rdf); + if(!algorithm_name) { + ldns_buffer_free(data_buffer); + return LDNS_STATUS_MEM_ERR; + } + + /* prepare the key */ + key_bytes = LDNS_XMALLOC(unsigned char, + ldns_b64_pton_calculate_size(strlen(key_data))); + if(!key_bytes) { + LDNS_FREE(algorithm_name); + ldns_buffer_free(data_buffer); + return LDNS_STATUS_MEM_ERR; + } + key_size = ldns_b64_pton(key_data, key_bytes, + ldns_b64_pton_calculate_size(strlen(key_data))); + if (key_size < 0) { + LDNS_FREE(algorithm_name); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + /* LDNS_STATUS_INVALID_B64 */ + return LDNS_STATUS_INVALID_B64; + } + /* hmac it */ + /* 2 spare bytes for the length */ + mac_bytes = LDNS_XMALLOC(unsigned char, md_len+2); + if(!mac_bytes) { + LDNS_FREE(algorithm_name); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + return LDNS_STATUS_MEM_ERR; + } + memset(mac_bytes, 0, md_len+2); + + digester = ldns_digest_function(algorithm_name); + + if (digester) { + (void) HMAC(digester, key_bytes, key_size, (void *)wireformat, + (size_t) wiresize, mac_bytes + 2, &md_len); + + ldns_write_uint16(mac_bytes, md_len); + result = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT16_DATA, md_len + 2, + mac_bytes); + } else { + LDNS_FREE(algorithm_name); + LDNS_FREE(mac_bytes); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; + } + + LDNS_FREE(algorithm_name); + LDNS_FREE(mac_bytes); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + + *tsig_mac = result; + + return LDNS_STATUS_OK; +} +#endif /* HAVE_SSL */ + + +#ifdef HAVE_SSL +bool +ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char *key_name, + const char *key_data, ldns_rdf *orig_mac_rdf) +{ + return ldns_pkt_tsig_verify_next(pkt, wire, wirelen, key_name, key_data, orig_mac_rdf, 0); +} + +bool +ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char* key_name, + const char *key_data, ldns_rdf *orig_mac_rdf, int tsig_timers_only) +{ + ldns_rdf *fudge_rdf; + ldns_rdf *algorithm_rdf; + ldns_rdf *time_signed_rdf; + ldns_rdf *orig_id_rdf; + ldns_rdf *error_rdf; + ldns_rdf *other_data_rdf; + ldns_rdf *pkt_mac_rdf; + ldns_rdf *my_mac_rdf; + ldns_rdf *key_name_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, key_name); + uint16_t pkt_id, orig_pkt_id; + ldns_status status; + + uint8_t *prepared_wire = NULL; + size_t prepared_wire_size = 0; + + ldns_rr *orig_tsig = ldns_pkt_tsig(pkt); + + if (!orig_tsig) { + ldns_rdf_deep_free(key_name_rdf); + return false; + } + algorithm_rdf = ldns_rr_rdf(orig_tsig, 0); + time_signed_rdf = ldns_rr_rdf(orig_tsig, 1); + fudge_rdf = ldns_rr_rdf(orig_tsig, 2); + pkt_mac_rdf = ldns_rr_rdf(orig_tsig, 3); + orig_id_rdf = ldns_rr_rdf(orig_tsig, 4); + error_rdf = ldns_rr_rdf(orig_tsig, 5); + other_data_rdf = ldns_rr_rdf(orig_tsig, 6); + + /* remove temporarily */ + ldns_pkt_set_tsig(pkt, NULL); + /* temporarily change the id to the original id */ + pkt_id = ldns_pkt_id(pkt); + orig_pkt_id = ldns_rdf2native_int16(orig_id_rdf); + ldns_pkt_set_id(pkt, orig_pkt_id); + + prepared_wire = ldns_tsig_prepare_pkt_wire(wire, wirelen, &prepared_wire_size); + + status = ldns_tsig_mac_new(&my_mac_rdf, prepared_wire, prepared_wire_size, + key_data, key_name_rdf, fudge_rdf, algorithm_rdf, + time_signed_rdf, error_rdf, other_data_rdf, orig_mac_rdf, tsig_timers_only); + + LDNS_FREE(prepared_wire); + + if (status != LDNS_STATUS_OK) { + ldns_rdf_deep_free(key_name_rdf); + return false; + } + /* Put back the values */ + ldns_pkt_set_tsig(pkt, orig_tsig); + ldns_pkt_set_id(pkt, pkt_id); + + ldns_rdf_deep_free(key_name_rdf); + + if (ldns_rdf_compare(pkt_mac_rdf, my_mac_rdf) == 0) { + ldns_rdf_deep_free(my_mac_rdf); + return true; + } else { + ldns_rdf_deep_free(my_mac_rdf); + return false; + } +} +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +ldns_status +ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, + uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac) +{ + return ldns_pkt_tsig_sign_next(pkt, key_name, key_data, fudge, algorithm_name, query_mac, 0); +} + +ldns_status +ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data, + uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only) +{ + ldns_rr *tsig_rr; + ldns_rdf *key_name_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, key_name); + ldns_rdf *fudge_rdf = NULL; + ldns_rdf *orig_id_rdf = NULL; + ldns_rdf *algorithm_rdf; + ldns_rdf *error_rdf = NULL; + ldns_rdf *mac_rdf = NULL; + ldns_rdf *other_data_rdf = NULL; + + ldns_status status = LDNS_STATUS_OK; + + uint8_t *pkt_wire = NULL; + size_t pkt_wire_len; + + struct timeval tv_time_signed; + uint8_t *time_signed = NULL; + ldns_rdf *time_signed_rdf = NULL; + + algorithm_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, algorithm_name); + if(!key_name_rdf || !algorithm_rdf) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + + /* eww don't have create tsigtime rdf yet :( */ + /* bleh :p */ + if (gettimeofday(&tv_time_signed, NULL) == 0) { + time_signed = LDNS_XMALLOC(uint8_t, 6); + if(!time_signed) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + ldns_write_uint64_as_uint48(time_signed, + (uint64_t)tv_time_signed.tv_sec); + } else { + status = LDNS_STATUS_INTERNAL_ERR; + goto clean; + } + + time_signed_rdf = ldns_rdf_new(LDNS_RDF_TYPE_TSIGTIME, 6, time_signed); + if(!time_signed_rdf) { + LDNS_FREE(time_signed); + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + + fudge_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, fudge); + + orig_id_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, ldns_pkt_id(pkt)); + + error_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, 0); + + other_data_rdf = ldns_native2rdf_int16_data(0, NULL); + + if(!fudge_rdf || !orig_id_rdf || !error_rdf || !other_data_rdf) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + + if (ldns_pkt2wire(&pkt_wire, pkt, &pkt_wire_len) != LDNS_STATUS_OK) { + status = LDNS_STATUS_ERR; + goto clean; + } + + status = ldns_tsig_mac_new(&mac_rdf, pkt_wire, pkt_wire_len, + key_data, key_name_rdf, fudge_rdf, algorithm_rdf, + time_signed_rdf, error_rdf, other_data_rdf, query_mac, tsig_timers_only); + + if (!mac_rdf) { + goto clean; + } + + LDNS_FREE(pkt_wire); + + /* Create the TSIG RR */ + tsig_rr = ldns_rr_new(); + if(!tsig_rr) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + ldns_rr_set_owner(tsig_rr, key_name_rdf); + ldns_rr_set_class(tsig_rr, LDNS_RR_CLASS_ANY); + ldns_rr_set_type(tsig_rr, LDNS_RR_TYPE_TSIG); + ldns_rr_set_ttl(tsig_rr, 0); + + ldns_rr_push_rdf(tsig_rr, algorithm_rdf); + ldns_rr_push_rdf(tsig_rr, time_signed_rdf); + ldns_rr_push_rdf(tsig_rr, fudge_rdf); + ldns_rr_push_rdf(tsig_rr, mac_rdf); + ldns_rr_push_rdf(tsig_rr, orig_id_rdf); + ldns_rr_push_rdf(tsig_rr, error_rdf); + ldns_rr_push_rdf(tsig_rr, other_data_rdf); + + ldns_pkt_set_tsig(pkt, tsig_rr); + + return status; + + clean: + LDNS_FREE(pkt_wire); + ldns_rdf_free(key_name_rdf); + ldns_rdf_free(algorithm_rdf); + ldns_rdf_free(time_signed_rdf); + ldns_rdf_free(fudge_rdf); + ldns_rdf_free(orig_id_rdf); + ldns_rdf_free(error_rdf); + ldns_rdf_free(other_data_rdf); + return status; +} +#endif /* HAVE_SSL */ diff --git a/libs/ldns/update.c b/libs/ldns/update.c new file mode 100644 index 0000000000..01e67aa069 --- /dev/null +++ b/libs/ldns/update.c @@ -0,0 +1,315 @@ +/* update.c + * + * Functions for RFC 2136 Dynamic Update + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + */ + +#include + +#include + +#include +#include +#include + +/* + * RFC 2136 sections mapped to RFC 1035: + * zone/ZO -- QD/question + * prerequisites/PR -- AN/answers + * updates/UP -- NS/authority records + * additional data/AD -- AR/additional records + */ + +ldns_pkt * +ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class c, + ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist) +{ + ldns_pkt *p; + + if (!zone_rdf || !up_rrlist) { + return NULL; + } + + if (c == 0) { + c = LDNS_RR_CLASS_IN; + } + + /* Create packet, fill in Zone Section. */ + p = ldns_pkt_query_new(zone_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); + if (!p) { + return NULL; + } + zone_rdf = NULL; /* No longer safe to use. */ + + ldns_pkt_set_opcode(p, LDNS_PACKET_UPDATE); + + ldns_rr_list_deep_free(p->_authority); + + ldns_pkt_set_authority(p, ldns_rr_list_clone(up_rrlist)); + + ldns_update_set_upcount(p, ldns_rr_list_rr_count(up_rrlist)); + + if (pr_rrlist) { + ldns_rr_list_deep_free(p->_answer); /*XXX access function */ + ldns_pkt_set_answer(p, ldns_rr_list_clone(pr_rrlist)); + ldns_update_set_prcount(p, ldns_rr_list_rr_count(pr_rrlist)); + } + + if (ad_rrlist) { + ldns_rr_list_deep_free(p->_additional); + ldns_pkt_set_additional(p, ldns_rr_list_clone(ad_rrlist)); + ldns_update_set_adcount(p, ldns_rr_list_rr_count(ad_rrlist)); + } + return p; +} + +ldns_status +ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r) +{ +#ifdef HAVE_SSL + uint16_t fudge = 300; /* Recommended fudge. [RFC2845 6.4] */ + if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) + return ldns_pkt_tsig_sign(p, ldns_resolver_tsig_keyname(r), + ldns_resolver_tsig_keydata(r), fudge, + ldns_resolver_tsig_algorithm(r), NULL); +#else + /* do nothing */ + (void)p; + (void)r; +#endif /* HAVE_SSL */ + /* No TSIG to do. */ + return LDNS_STATUS_OK; +} + +/* Move to higher.c or similar? */ +/* XXX doc */ +ldns_status +ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, + ldns_rr_class c, ldns_rdf **mname) +{ + ldns_rr *soa_rr; + ldns_pkt *query, *resp; + + /* Nondestructive, so clone 'zone' here */ + query = ldns_pkt_query_new(ldns_rdf_clone(zone), LDNS_RR_TYPE_SOA, + c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + /* Expect a SOA answer. */ + *mname = NULL; + while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_answer(resp)))) { + if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) + continue; + /* [RFC1035 3.3.13] */ + *mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); + break; + } + ldns_pkt_free(resp); + + return *mname ? LDNS_STATUS_OK : LDNS_STATUS_ERR; +} + +/* Try to get zone and MNAME from SOA queries. */ +ldns_status +ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, + ldns_rr_class c, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf) +{ + ldns_rr *soa_rr, *rr; + ldns_rdf *soa_zone = NULL, *soa_mname = NULL; + ldns_rdf *ipaddr, *fqdn_rdf, *tmp; + ldns_rdf **nslist; + ldns_pkt *query, *resp; + size_t i; + + /* + * XXX Ok, this cannot be the best way to find this...? + * XXX (I run into weird cache-related stuff here) + */ + + /* Step 1 - first find a nameserver that should know *something* */ + fqdn_rdf = ldns_dname_new_frm_str(fqdn); + query = ldns_pkt_query_new(fqdn_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + fqdn_rdf = NULL; + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + /* XXX Is it safe to only look in authority section here? */ + while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_authority(resp)))) { + if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) + continue; + /* [RFC1035 3.3.13] */ + soa_mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); + break; + } + ldns_pkt_free(resp); + if (!soa_rr) { + return LDNS_STATUS_ERR; + } + + /* Step 2 - find SOA MNAME IP address, add to resolver */ + query = ldns_pkt_query_new(soa_mname, LDNS_RR_TYPE_A, c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + soa_mname = NULL; + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + if (ldns_pkt_ancount(resp) == 0) { + ldns_pkt_free(resp); + return LDNS_STATUS_ERR; + } + + /* XXX There may be more than one answer RR here. */ + rr = ldns_rr_list_pop_rr(ldns_pkt_answer(resp)); + ipaddr = ldns_rr_rdf(rr, 0); + + /* Put the SOA mname IP first in the nameserver list. */ + nslist = ldns_resolver_nameservers(r); + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + if (ldns_rdf_compare(ipaddr, nslist[i]) == 0) { + if (i) { + tmp = nslist[0]; + nslist[0] = nslist[i]; + nslist[i] = tmp; + } + break; + } + } + if (i >= ldns_resolver_nameserver_count(r)) { + /* SOA mname was not part of the resolver so add it first. */ + (void) ldns_resolver_push_nameserver(r, ipaddr); + nslist = ldns_resolver_nameservers(r); + i = ldns_resolver_nameserver_count(r) - 1; + tmp = nslist[0]; + nslist[0] = nslist[i]; + nslist[i] = tmp; + } + ldns_pkt_free(resp); + + /* Make sure to ask the first in the list, i.e SOA mname */ + ldns_resolver_set_random(r, false); + + /* Step 3 - Redo SOA query, sending to SOA MNAME directly. */ + fqdn_rdf = ldns_dname_new_frm_str(fqdn); + query = ldns_pkt_query_new(fqdn_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + fqdn_rdf = NULL; + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + /* XXX Is it safe to only look in authority section here, too? */ + while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_authority(resp)))) { + if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) + continue; + /* [RFC1035 3.3.13] */ + soa_mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); + soa_zone = ldns_rdf_clone(ldns_rr_owner(soa_rr)); + break; + } + ldns_pkt_free(resp); + if (!soa_rr) { + return LDNS_STATUS_ERR; + } + + /* That seems to have worked, pass results to caller. */ + *zone_rdf = soa_zone; + *mname_rdf = soa_mname; + return LDNS_STATUS_OK; +} + +/* + * ldns_update_{get,set}_{zo,pr,up,ad}count + */ + +uint16_t +ldns_update_zocount(const ldns_pkt *p) +{ + return ldns_pkt_qdcount(p); +} + +uint16_t +ldns_update_prcount(const ldns_pkt *p) +{ + return ldns_pkt_ancount(p); +} + +uint16_t +ldns_update_upcount(const ldns_pkt *p) +{ + return ldns_pkt_nscount(p); +} + +uint16_t +ldns_update_ad(const ldns_pkt *p) +{ + return ldns_pkt_arcount(p); +} + +void +ldns_update_set_zo(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_qdcount(p, v); +} + +void +ldns_update_set_prcount(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_ancount(p, v); +} + +void +ldns_update_set_upcount(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_nscount(p, v); +} + +void +ldns_update_set_adcount(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_arcount(p, v); +} diff --git a/libs/ldns/util.c b/libs/ldns/util.c new file mode 100644 index 0000000000..eb24f81dbe --- /dev/null +++ b/libs/ldns/util.c @@ -0,0 +1,391 @@ +/* + * util.c + * + * some general memory functions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SSL +#include +#endif + +/* put this here tmp. for debugging */ +void +xprintf_rdf(ldns_rdf *rd) +{ + /* assume printable string */ + fprintf(stderr, "size\t:%u\n", (unsigned int)ldns_rdf_size(rd)); + fprintf(stderr, "type\t:%u\n", (unsigned int)ldns_rdf_get_type(rd)); + fprintf(stderr, "data\t:[%.*s]\n", (int)ldns_rdf_size(rd), + (char*)ldns_rdf_data(rd)); +} + +void +xprintf_rr(ldns_rr *rr) +{ + /* assume printable string */ + uint16_t count, i; + + count = ldns_rr_rd_count(rr); + + for(i = 0; i < count; i++) { + fprintf(stderr, "print rd %u\n", (unsigned int) i); + xprintf_rdf(rr->_rdata_fields[i]); + } +} + +void xprintf_hex(uint8_t *data, size_t len) +{ + size_t i; + for (i = 0; i < len; i++) { + if (i > 0 && i % 20 == 0) { + printf("\t; %u - %u\n", (unsigned int) i - 19, (unsigned int) i); + } + printf("%02x ", (unsigned int) data[i]); + } + printf("\n"); +} + +ldns_lookup_table * +ldns_lookup_by_name(ldns_lookup_table *table, const char *name) +{ + while (table->name != NULL) { + if (strcasecmp(name, table->name) == 0) + return table; + table++; + } + return NULL; +} + +ldns_lookup_table * +ldns_lookup_by_id(ldns_lookup_table *table, int id) +{ + while (table->name != NULL) { + if (table->id == id) + return table; + table++; + } + return NULL; +} + +int +ldns_get_bit(uint8_t bits[], size_t index) +{ + /* + * The bits are counted from left to right, so bit #0 is the + * left most bit. + */ + return (int) (bits[index / 8] & (1 << (7 - index % 8))); +} + +int +ldns_get_bit_r(uint8_t bits[], size_t index) +{ + /* + * The bits are counted from right to left, so bit #0 is the + * right most bit. + */ + return (int) bits[index / 8] & (1 << (index % 8)); +} + +void +ldns_set_bit(uint8_t *byte, int bit_nr, bool value) +{ + if (bit_nr >= 0 && bit_nr < 8) { + if (value) { + *byte = *byte | (0x01 << bit_nr); + } else { + *byte = *byte & ~(0x01 << bit_nr); + } + } +} + +int +ldns_hexdigit_to_int(char ch) +{ + switch (ch) { + case '0': return 0; + case '1': return 1; + case '2': return 2; + case '3': return 3; + case '4': return 4; + case '5': return 5; + case '6': return 6; + case '7': return 7; + case '8': return 8; + case '9': return 9; + case 'a': case 'A': return 10; + case 'b': case 'B': return 11; + case 'c': case 'C': return 12; + case 'd': case 'D': return 13; + case 'e': case 'E': return 14; + case 'f': case 'F': return 15; + default: + return -1; + } +} + +char +ldns_int_to_hexdigit(int i) +{ + switch (i) { + case 0: return '0'; + case 1: return '1'; + case 2: return '2'; + case 3: return '3'; + case 4: return '4'; + case 5: return '5'; + case 6: return '6'; + case 7: return '7'; + case 8: return '8'; + case 9: return '9'; + case 10: return 'a'; + case 11: return 'b'; + case 12: return 'c'; + case 13: return 'd'; + case 14: return 'e'; + case 15: return 'f'; + default: + abort(); + } +} + +int +ldns_hexstring_to_data(uint8_t *data, const char *str) +{ + size_t i; + + if (!str || !data) { + return -1; + } + + if (strlen(str) % 2 != 0) { + return -2; + } + + for (i = 0; i < strlen(str) / 2; i++) { + data[i] = + 16 * (uint8_t) ldns_hexdigit_to_int(str[i*2]) + + (uint8_t) ldns_hexdigit_to_int(str[i*2 + 1]); + } + + return (int) i; +} + +const char * +ldns_version(void) +{ + return (char*)LDNS_VERSION; +} + +/* Number of days per month (except for February in leap years). */ +static const int mdays[] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +static int +is_leap_year(int year) +{ + return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); +} + +static int +leap_days(int y1, int y2) +{ + --y1; + --y2; + return (y2/4 - y1/4) - (y2/100 - y1/100) + (y2/400 - y1/400); +} + +/* + * Code adapted from Python 2.4.1 sources (Lib/calendar.py). + */ +time_t +mktime_from_utc(const struct tm *tm) +{ + int year = 1900 + tm->tm_year; + time_t days = 365 * ((time_t) year - 1970) + leap_days(1970, year); + time_t hours; + time_t minutes; + time_t seconds; + int i; + + for (i = 0; i < tm->tm_mon; ++i) { + days += mdays[i]; + } + if (tm->tm_mon > 1 && is_leap_year(year)) { + ++days; + } + days += tm->tm_mday - 1; + + hours = days * 24 + tm->tm_hour; + minutes = hours * 60 + tm->tm_min; + seconds = minutes * 60 + tm->tm_sec; + + return seconds; +} + +/** + * Init the random source + * applications should call this if they need entropy data within ldns + * If openSSL is available, it is automatically seeded from /dev/urandom + * or /dev/random + * + * If you need more entropy, or have no openssl available, this function + * MUST be called at the start of the program + * + * If openssl *is* available, this function just adds more entropy + **/ +int +ldns_init_random(FILE *fd, unsigned int size) +{ + /* if fp is given, seed srandom with data from file + otherwise use /dev/urandom */ + FILE *rand_f; + uint8_t *seed; + size_t read = 0; + unsigned int seed_i; + struct timeval tv; + + /* we'll need at least sizeof(unsigned int) bytes for the + standard prng seed */ + if (size < (unsigned int) sizeof(seed_i)){ + size = (unsigned int) sizeof(seed_i); + } + + seed = LDNS_XMALLOC(uint8_t, size); + if(!seed) { + return 1; + } + + if (!fd) { + if ((rand_f = fopen("/dev/urandom", "r")) == NULL) { + /* no readable /dev/urandom, try /dev/random */ + if ((rand_f = fopen("/dev/random", "r")) == NULL) { + /* no readable /dev/random either, and no entropy + source given. we'll have to improvise */ + for (read = 0; read < size; read++) { + gettimeofday(&tv, NULL); + seed[read] = (uint8_t) (tv.tv_usec % 256); + } + } else { + read = fread(seed, 1, size, rand_f); + } + } else { + read = fread(seed, 1, size, rand_f); + } + } else { + rand_f = fd; + read = fread(seed, 1, size, rand_f); + } + + if (read < size) { + LDNS_FREE(seed); + return 1; + } else { +#ifdef HAVE_SSL + /* Seed the OpenSSL prng (most systems have it seeded + automatically, in that case this call just adds entropy */ + RAND_seed(seed, (int) size); +#else + /* Seed the standard prng, only uses the first + * unsigned sizeof(unsiged int) bytes found in the entropy pool + */ + memcpy(&seed_i, seed, sizeof(seed_i)); + srandom(seed_i); +#endif + LDNS_FREE(seed); + } + + if (!fd) { + if (rand_f) fclose(rand_f); + } + + return 0; +} + +/** + * Get random number. + * + */ +uint16_t +ldns_get_random(void) +{ + uint16_t rid = 0; +#ifdef HAVE_SSL + if (RAND_bytes((unsigned char*)&rid, 2) != 1) { + rid = (uint16_t) random(); + } +#else + rid = (uint16_t) random(); +#endif + return rid; +} + +/* + * BubbleBabble code taken from OpenSSH + * Copyright (c) 2001 Carsten Raskgaard. All rights reserved. + */ +char * +ldns_bubblebabble(uint8_t *data, size_t len) +{ + char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' }; + char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', + 'n', 'p', 'r', 's', 't', 'v', 'z', 'x' }; + size_t i, j = 0, rounds, seed = 1; + char *retval; + + rounds = (len / 2) + 1; + retval = LDNS_XMALLOC(char, rounds * 6); + if(!retval) return NULL; + retval[j++] = 'x'; + for (i = 0; i < rounds; i++) { + size_t idx0, idx1, idx2, idx3, idx4; + if ((i + 1 < rounds) || (len % 2 != 0)) { + idx0 = (((((size_t)(data[2 * i])) >> 6) & 3) + + seed) % 6; + idx1 = (((size_t)(data[2 * i])) >> 2) & 15; + idx2 = ((((size_t)(data[2 * i])) & 3) + + (seed / 6)) % 6; + retval[j++] = vowels[idx0]; + retval[j++] = consonants[idx1]; + retval[j++] = vowels[idx2]; + if ((i + 1) < rounds) { + idx3 = (((size_t)(data[(2 * i) + 1])) >> 4) & 15; + idx4 = (((size_t)(data[(2 * i) + 1]))) & 15; + retval[j++] = consonants[idx3]; + retval[j++] = '-'; + retval[j++] = consonants[idx4]; + seed = ((seed * 5) + + ((((size_t)(data[2 * i])) * 7) + + ((size_t)(data[(2 * i) + 1])))) % 36; + } + } else { + idx0 = seed % 6; + idx1 = 16; + idx2 = seed / 6; + retval[j++] = vowels[idx0]; + retval[j++] = consonants[idx1]; + retval[j++] = vowels[idx2]; + } + } + retval[j++] = 'x'; + retval[j++] = '\0'; + return retval; +} diff --git a/libs/ldns/version b/libs/ldns/version new file mode 100644 index 0000000000..15d45d4b47 --- /dev/null +++ b/libs/ldns/version @@ -0,0 +1 @@ +1.6.9 diff --git a/libs/ldns/wire2host.c b/libs/ldns/wire2host.c new file mode 100644 index 0000000000..e87fcdf5df --- /dev/null +++ b/libs/ldns/wire2host.c @@ -0,0 +1,456 @@ +/* + * wire2host.c + * + * conversion routines from the wire to the host + * format. + * This will usually just a re-ordering of the + * data (as we store it in network format) + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + + +#include + +#include +/*#include */ + +#include +#include + + + +/* + * Set of macro's to deal with the dns message header as specified + * in RFC1035 in portable way. + * + */ + +/* + * + * 1 1 1 1 1 1 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ID | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * |QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | QDCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ANCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | NSCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ARCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * + */ + + +/* allocates memory to *dname! */ +ldns_status +ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos) +{ + uint8_t label_size; + uint16_t pointer_target; + uint8_t pointer_target_buf[2]; + size_t dname_pos = 0; + size_t uncompressed_length = 0; + size_t compression_pos = 0; + uint8_t tmp_dname[LDNS_MAX_DOMAINLEN]; + unsigned int pointer_count = 0; + + if (*pos >= max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + + label_size = wire[*pos]; + while (label_size > 0) { + /* compression */ + while (label_size >= 192) { + if (compression_pos == 0) { + compression_pos = *pos + 2; + } + + pointer_count++; + + /* remove first two bits */ + if (*pos + 2 > max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + pointer_target_buf[0] = wire[*pos] & 63; + pointer_target_buf[1] = wire[*pos + 1]; + pointer_target = ldns_read_uint16(pointer_target_buf); + + if (pointer_target == 0) { + return LDNS_STATUS_INVALID_POINTER; + } else if (pointer_target >= max) { + return LDNS_STATUS_INVALID_POINTER; + } else if (pointer_count > LDNS_MAX_POINTERS) { + return LDNS_STATUS_INVALID_POINTER; + } + *pos = pointer_target; + label_size = wire[*pos]; + } + if(label_size == 0) + break; /* break from pointer to 0 byte */ + if (label_size > LDNS_MAX_LABELLEN) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + if (*pos + 1 + label_size > max) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + + /* check space for labelcount itself */ + if (dname_pos + 1 > LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + tmp_dname[dname_pos] = label_size; + if (label_size > 0) { + dname_pos++; + } + *pos = *pos + 1; + if (dname_pos + label_size > LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + memcpy(&tmp_dname[dname_pos], &wire[*pos], label_size); + uncompressed_length += label_size + 1; + dname_pos += label_size; + *pos = *pos + label_size; + + if (*pos < max) { + label_size = wire[*pos]; + } + } + + if (compression_pos > 0) { + *pos = compression_pos; + } else { + *pos = *pos + 1; + } + + if (dname_pos >= LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + + tmp_dname[dname_pos] = 0; + dname_pos++; + + *dname = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, + (uint16_t) dname_pos, tmp_dname); + if (!*dname) { + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +/* maybe make this a goto error so data can be freed or something/ */ +#define LDNS_STATUS_CHECK_RETURN(st) {if (st != LDNS_STATUS_OK) { return st; }} +#define LDNS_STATUS_CHECK_GOTO(st, label) {if (st != LDNS_STATUS_OK) { /*printf("STG %s:%d: status code %d\n", __FILE__, __LINE__, st);*/ goto label; }} + +ldns_status +ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) +{ + size_t end; + size_t cur_rdf_length; + uint8_t rdf_index; + uint8_t *data; + uint16_t rd_length; + ldns_rdf *cur_rdf = NULL; + ldns_rdf_type cur_rdf_type; + const ldns_rr_descriptor *descriptor = ldns_rr_descript(ldns_rr_get_type(rr)); + ldns_status status; + + if (*pos + 2 > max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + + rd_length = ldns_read_uint16(&wire[*pos]); + *pos = *pos + 2; + + if (*pos + rd_length > max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + + end = *pos + (size_t) rd_length; + + for (rdf_index = 0; + rdf_index < ldns_rr_descriptor_maximum(descriptor); rdf_index++) { + if (*pos >= end) { + break; + } + cur_rdf_length = 0; + + cur_rdf_type = ldns_rr_descriptor_field_type(descriptor, rdf_index); + /* handle special cases immediately, set length + for fixed length rdata and do them below */ + switch (cur_rdf_type) { + case LDNS_RDF_TYPE_DNAME: + status = ldns_wire2dname(&cur_rdf, wire, max, pos); + LDNS_STATUS_CHECK_RETURN(status); + break; + case LDNS_RDF_TYPE_CLASS: + case LDNS_RDF_TYPE_ALG: + case LDNS_RDF_TYPE_INT8: + cur_rdf_length = LDNS_RDF_SIZE_BYTE; + break; + case LDNS_RDF_TYPE_TYPE: + case LDNS_RDF_TYPE_INT16: + case LDNS_RDF_TYPE_CERT_ALG: + cur_rdf_length = LDNS_RDF_SIZE_WORD; + break; + case LDNS_RDF_TYPE_TIME: + case LDNS_RDF_TYPE_INT32: + case LDNS_RDF_TYPE_A: + case LDNS_RDF_TYPE_PERIOD: + cur_rdf_length = LDNS_RDF_SIZE_DOUBLEWORD; + break; + case LDNS_RDF_TYPE_TSIGTIME: + cur_rdf_length = LDNS_RDF_SIZE_6BYTES; + break; + case LDNS_RDF_TYPE_AAAA: + cur_rdf_length = LDNS_RDF_SIZE_16BYTES; + break; + case LDNS_RDF_TYPE_STR: + case LDNS_RDF_TYPE_NSEC3_SALT: + /* len is stored in first byte + * it should be in the rdf too, so just + * copy len+1 from this position + */ + cur_rdf_length = ((size_t) wire[*pos]) + 1; + break; + case LDNS_RDF_TYPE_INT16_DATA: + cur_rdf_length = (size_t) ldns_read_uint16(&wire[*pos]) + 2; + break; + case LDNS_RDF_TYPE_B32_EXT: + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + /* length is stored in first byte */ + cur_rdf_length = ((size_t) wire[*pos]) + 1; + break; + case LDNS_RDF_TYPE_APL: + case LDNS_RDF_TYPE_B64: + case LDNS_RDF_TYPE_HEX: + case LDNS_RDF_TYPE_NSEC: + case LDNS_RDF_TYPE_UNKNOWN: + case LDNS_RDF_TYPE_SERVICE: + case LDNS_RDF_TYPE_LOC: + case LDNS_RDF_TYPE_WKS: + case LDNS_RDF_TYPE_NSAP: + case LDNS_RDF_TYPE_ATMA: + case LDNS_RDF_TYPE_IPSECKEY: + case LDNS_RDF_TYPE_TSIG: + case LDNS_RDF_TYPE_NONE: + /* + * Read to end of rr rdata + */ + cur_rdf_length = end - *pos; + break; + } + + /* fixed length rdata */ + if (cur_rdf_length > 0) { + if (cur_rdf_length + *pos > end) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + data = LDNS_XMALLOC(uint8_t, rd_length); + if (!data) { + return LDNS_STATUS_MEM_ERR; + } + memcpy(data, &wire[*pos], cur_rdf_length); + + cur_rdf = ldns_rdf_new(cur_rdf_type, cur_rdf_length, data); + *pos = *pos + cur_rdf_length; + } + + if (cur_rdf) { + ldns_rr_push_rdf(rr, cur_rdf); + cur_rdf = NULL; + } + } + + return LDNS_STATUS_OK; +} + + +/* TODO: + can *pos be incremented at READ_INT? or maybe use something like + RR_CLASS(wire)? + uhhm Jelte?? +*/ +ldns_status +ldns_wire2rr(ldns_rr **rr_p, const uint8_t *wire, size_t max, + size_t *pos, ldns_pkt_section section) +{ + ldns_rdf *owner = NULL; + ldns_rr *rr = ldns_rr_new(); + ldns_status status; + + status = ldns_wire2dname(&owner, wire, max, pos); + LDNS_STATUS_CHECK_GOTO(status, status_error); + + ldns_rr_set_owner(rr, owner); + + if (*pos + 4 > max) { + status = LDNS_STATUS_PACKET_OVERFLOW; + goto status_error; + } + + ldns_rr_set_type(rr, ldns_read_uint16(&wire[*pos])); + *pos = *pos + 2; + + ldns_rr_set_class(rr, ldns_read_uint16(&wire[*pos])); + *pos = *pos + 2; + + if (section != LDNS_SECTION_QUESTION) { + if (*pos + 4 > max) { + status = LDNS_STATUS_PACKET_OVERFLOW; + goto status_error; + } + ldns_rr_set_ttl(rr, ldns_read_uint32(&wire[*pos])); + + *pos = *pos + 4; + status = ldns_wire2rdf(rr, wire, max, pos); + + LDNS_STATUS_CHECK_GOTO(status, status_error); + ldns_rr_set_question(rr, false); + } else { + ldns_rr_set_question(rr, true); + } + + *rr_p = rr; + return LDNS_STATUS_OK; + +status_error: + ldns_rr_free(rr); + return status; +} + +static ldns_status +ldns_wire2pkt_hdr(ldns_pkt *packet, const uint8_t *wire, size_t max, size_t *pos) +{ + if (*pos + LDNS_HEADER_SIZE > max) { + return LDNS_STATUS_WIRE_INCOMPLETE_HEADER; + } else { + ldns_pkt_set_id(packet, LDNS_ID_WIRE(wire)); + ldns_pkt_set_qr(packet, LDNS_QR_WIRE(wire)); + ldns_pkt_set_opcode(packet, LDNS_OPCODE_WIRE(wire)); + ldns_pkt_set_aa(packet, LDNS_AA_WIRE(wire)); + ldns_pkt_set_tc(packet, LDNS_TC_WIRE(wire)); + ldns_pkt_set_rd(packet, LDNS_RD_WIRE(wire)); + ldns_pkt_set_ra(packet, LDNS_RA_WIRE(wire)); + ldns_pkt_set_ad(packet, LDNS_AD_WIRE(wire)); + ldns_pkt_set_cd(packet, LDNS_CD_WIRE(wire)); + ldns_pkt_set_rcode(packet, LDNS_RCODE_WIRE(wire)); + + ldns_pkt_set_qdcount(packet, LDNS_QDCOUNT(wire)); + ldns_pkt_set_ancount(packet, LDNS_ANCOUNT(wire)); + ldns_pkt_set_nscount(packet, LDNS_NSCOUNT(wire)); + ldns_pkt_set_arcount(packet, LDNS_ARCOUNT(wire)); + + *pos += LDNS_HEADER_SIZE; + + return LDNS_STATUS_OK; + } +} + +ldns_status +ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer) +{ + /* lazy */ + return ldns_wire2pkt(packet, ldns_buffer_begin(buffer), + ldns_buffer_limit(buffer)); + +} + +ldns_status +ldns_wire2pkt(ldns_pkt **packet_p, const uint8_t *wire, size_t max) +{ + size_t pos = 0; + uint16_t i; + ldns_rr *rr; + ldns_pkt *packet = ldns_pkt_new(); + ldns_status status = LDNS_STATUS_OK; + int have_edns = 0; + + uint8_t data[4]; + + status = ldns_wire2pkt_hdr(packet, wire, max, &pos); + LDNS_STATUS_CHECK_GOTO(status, status_error); + + for (i = 0; i < ldns_pkt_qdcount(packet); i++) { + + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_QUESTION); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_QUESTION; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + if (!ldns_rr_list_push_rr(ldns_pkt_question(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + for (i = 0; i < ldns_pkt_ancount(packet); i++) { + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_ANSWER); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_ANSWER; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + if (!ldns_rr_list_push_rr(ldns_pkt_answer(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + for (i = 0; i < ldns_pkt_nscount(packet); i++) { + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_AUTHORITY); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + if (!ldns_rr_list_push_rr(ldns_pkt_authority(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + for (i = 0; i < ldns_pkt_arcount(packet); i++) { + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_ADDITIONAL); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_OPT) { + ldns_pkt_set_edns_udp_size(packet, ldns_rr_get_class(rr)); + ldns_write_uint32(data, ldns_rr_ttl(rr)); + ldns_pkt_set_edns_extended_rcode(packet, data[0]); + ldns_pkt_set_edns_version(packet, data[1]); + ldns_pkt_set_edns_z(packet, ldns_read_uint16(&data[2])); + /* edns might not have rdfs */ + if (ldns_rr_rdf(rr, 0)) { + ldns_pkt_set_edns_data(packet, ldns_rdf_clone(ldns_rr_rdf(rr, 0))); + } + ldns_rr_free(rr); + have_edns += 1; + } else if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_TSIG) { + ldns_pkt_set_tsig(packet, rr); + ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) - 1); + } else if (!ldns_rr_list_push_rr(ldns_pkt_additional(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + ldns_pkt_set_size(packet, max); + if(have_edns) + ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) + - have_edns); + + *packet_p = packet; + return status; + +status_error: + ldns_pkt_free(packet); + return status; +} diff --git a/libs/ldns/zone.c b/libs/ldns/zone.c new file mode 100644 index 0000000000..917af8befc --- /dev/null +++ b/libs/ldns/zone.c @@ -0,0 +1,430 @@ +/* zone.c + * + * Functions for ldns_zone structure + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ +#include + +#include + +#include +#include + +ldns_rr * +ldns_zone_soa(const ldns_zone *z) +{ + return z->_soa; +} + +size_t +ldns_zone_rr_count(const ldns_zone *z) +{ + return ldns_rr_list_rr_count(z->_rrs); +} + +void +ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa) +{ + z->_soa = soa; +} + +ldns_rr_list * +ldns_zone_rrs(const ldns_zone *z) +{ + return z->_rrs; +} + +void +ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist) +{ + z->_rrs = rrlist; +} + +bool +ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list) +{ + return ldns_rr_list_cat(ldns_zone_rrs(z), list); + +} + +bool +ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr) +{ + return ldns_rr_list_push_rr( ldns_zone_rrs(z), rr); +} + +/* return a clone of the given rr list, without the glue records + * rr list should be the complete zone + * if present, stripped records are added to the list *glue_records + */ +ldns_rr_list * +ldns_zone_strip_glue_rrs(const ldns_rdf *zone_name, const ldns_rr_list *rrs, ldns_rr_list *glue_rrs) +{ + ldns_rr_list *new_list; + + /* when do we find glue? It means we find an IP address + * (AAAA/A) for a nameserver listed in the zone + * + * Alg used here: + * first find all the zonecuts (NS records) + * find all the AAAA or A records (can be done it the + * above loop). + * + * Check if the aaaa/a list are subdomains under the + * NS domains. + * If yes -> glue, if no -> not glue + */ + + ldns_rr_list *zone_cuts; + ldns_rr_list *addr; + ldns_rr *r, *ns, *a; + ldns_rdf *dname_a, *ns_owner; + uint16_t i,j; + + new_list = NULL; + zone_cuts = NULL; + addr = NULL; + + new_list = ldns_rr_list_new(); + if (!new_list) goto memory_error; + zone_cuts = ldns_rr_list_new(); + if (!zone_cuts) goto memory_error; + addr = ldns_rr_list_new(); + if (!addr) goto memory_error; + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + r = ldns_rr_list_rr(rrs, i); + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_A || + ldns_rr_get_type(r) == LDNS_RR_TYPE_AAAA) { + /* possibly glue */ + if (!ldns_rr_list_push_rr(addr, r)) goto memory_error; + continue; + } + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_NS) { + /* multiple zones will end up here - + * for now; not a problem + */ + /* don't add NS records for the current zone itself */ + if (ldns_rdf_compare(ldns_rr_owner(r), + zone_name) != 0) { + if (!ldns_rr_list_push_rr(zone_cuts, r)) goto memory_error; + } + continue; + } + } + + /* will sorting make it quicker ?? */ + for(i = 0; i < ldns_rr_list_rr_count(zone_cuts); i++) { + ns = ldns_rr_list_rr(zone_cuts, i); + ns_owner = ldns_rr_owner(ns); + for(j = 0; j < ldns_rr_list_rr_count(addr); j++) { + a = ldns_rr_list_rr(addr, j); + dname_a = ldns_rr_owner(a); + + if (ldns_dname_is_subdomain(dname_a, ns_owner)) { + /* GLUE! */ + if (glue_rrs) { + if (!ldns_rr_list_push_rr(glue_rrs, a)) goto memory_error; + } + break; + } else { + if (!ldns_rr_list_push_rr(new_list, a)) goto memory_error; + } + } + } + + ldns_rr_list_free(addr); + ldns_rr_list_free(zone_cuts); + + return new_list; + +memory_error: + if (new_list) { + ldns_rr_list_free(new_list); + } + if (zone_cuts) { + ldns_rr_list_free(zone_cuts); + } + if (addr) { + ldns_rr_list_free(addr); + } + return NULL; +} + +/* + * Get the list of glue records in a zone + * XXX: there should be a way for this to return error, other than NULL, + * since NULL is a valid return + */ +ldns_rr_list * +ldns_zone_glue_rr_list(const ldns_zone *z) +{ + /* when do we find glue? It means we find an IP address + * (AAAA/A) for a nameserver listed in the zone + * + * Alg used here: + * first find all the zonecuts (NS records) + * find all the AAAA or A records (can be done it the + * above loop). + * + * Check if the aaaa/a list are subdomains under the + * NS domains. + * If yes -> glue, if no -> not glue + */ + + ldns_rr_list *zone_cuts; + ldns_rr_list *addr; + ldns_rr_list *glue; + ldns_rr *r, *ns, *a; + ldns_rdf *dname_a, *ns_owner; + size_t i,j; + + zone_cuts = NULL; + addr = NULL; + glue = NULL; + + /* we cannot determine glue in a 'zone' without a SOA */ + if (!ldns_zone_soa(z)) { + return NULL; + } + + zone_cuts = ldns_rr_list_new(); + if (!zone_cuts) goto memory_error; + addr = ldns_rr_list_new(); + if (!addr) goto memory_error; + glue = ldns_rr_list_new(); + if (!glue) goto memory_error; + + for(i = 0; i < ldns_zone_rr_count(z); i++) { + r = ldns_rr_list_rr(ldns_zone_rrs(z), i); + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_A || + ldns_rr_get_type(r) == LDNS_RR_TYPE_AAAA) { + /* possibly glue */ + if (!ldns_rr_list_push_rr(addr, r)) goto memory_error; + continue; + } + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_NS) { + /* multiple zones will end up here - + * for now; not a problem + */ + /* don't add NS records for the current zone itself */ + if (ldns_rdf_compare(ldns_rr_owner(r), + ldns_rr_owner(ldns_zone_soa(z))) != 0) { + if (!ldns_rr_list_push_rr(zone_cuts, r)) goto memory_error; + } + continue; + } + } + + /* will sorting make it quicker ?? */ + for(i = 0; i < ldns_rr_list_rr_count(zone_cuts); i++) { + ns = ldns_rr_list_rr(zone_cuts, i); + ns_owner = ldns_rr_owner(ns); + + for(j = 0; j < ldns_rr_list_rr_count(addr); j++) { + a = ldns_rr_list_rr(addr, j); + dname_a = ldns_rr_owner(a); + + if (ldns_dname_is_subdomain(dname_a, ns_owner)) { + /* GLUE! */ + if (!ldns_rr_list_push_rr(glue, a)) goto memory_error; + } + } + } + + ldns_rr_list_free(addr); + ldns_rr_list_free(zone_cuts); + + if (ldns_rr_list_rr_count(glue) == 0) { + ldns_rr_list_free(glue); + return NULL; + } else { + return glue; + } + +memory_error: + if (zone_cuts) { + LDNS_FREE(zone_cuts); + } + if (addr) { + ldns_rr_list_free(addr); + } + if (glue) { + ldns_rr_list_free(glue); + } + return NULL; +} + +ldns_zone * +ldns_zone_new(void) +{ + ldns_zone *z; + + z = LDNS_MALLOC(ldns_zone); + if (!z) { + return NULL; + } + + z->_rrs = ldns_rr_list_new(); + if (!z->_rrs) { + LDNS_FREE(z); + return NULL; + } + ldns_zone_set_soa(z, NULL); + return z; +} + +/* we regocnize: + * $TTL, $ORIGIN + */ +ldns_status +ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c) +{ + return ldns_zone_new_frm_fp_l(z, fp, origin, ttl, c, NULL); +} + +/* XXX: class is never used */ +ldns_status +ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, + ldns_rr_class ATTR_UNUSED(c), int *line_nr) +{ + ldns_zone *newzone; + ldns_rr *rr; + uint32_t my_ttl; + ldns_rdf *my_origin; + ldns_rdf *my_prev; + bool soa_seen = false; /* 2 soa are an error */ + ldns_status s; + ldns_status ret; + + /* most cases of error are memory problems */ + ret = LDNS_STATUS_MEM_ERR; + + newzone = NULL; + my_origin = NULL; + my_prev = NULL; + + my_ttl = ttl; + + if (origin) { + my_origin = ldns_rdf_clone(origin); + if (!my_origin) goto error; + /* also set the prev */ + my_prev = ldns_rdf_clone(origin); + if (!my_prev) goto error; + } + + newzone = ldns_zone_new(); + if (!newzone) goto error; + + while(!feof(fp)) { + s = ldns_rr_new_frm_fp_l(&rr, fp, &my_ttl, &my_origin, &my_prev, line_nr); + switch (s) { + case LDNS_STATUS_OK: + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { + if (soa_seen) { + /* second SOA + * just skip, maybe we want to say + * something??? */ + ldns_rr_free(rr); + continue; + } + soa_seen = true; + ldns_zone_set_soa(newzone, rr); + /* set origin to soa if not specified */ + if (!my_origin) { + my_origin = ldns_rdf_clone(ldns_rr_owner(rr)); + } + continue; + } + + /* a normal RR - as sofar the DNS is normal */ + if (!ldns_zone_push_rr(newzone, rr)) goto error; + + case LDNS_STATUS_SYNTAX_EMPTY: + /* empty line was seen */ + case LDNS_STATUS_SYNTAX_TTL: + /* the function set the ttl */ + break; + case LDNS_STATUS_SYNTAX_ORIGIN: + /* the function set the origin */ + break; + case LDNS_STATUS_SYNTAX_INCLUDE: + ret = LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL; + break; + default: + ret = s; + goto error; + } + } + + if (my_origin) { + ldns_rdf_deep_free(my_origin); + } + if (my_prev) { + ldns_rdf_deep_free(my_prev); + } + if (z) { + *z = newzone; + } else { + ldns_zone_free(newzone); + } + + return LDNS_STATUS_OK; + +error: + if (my_origin) { + ldns_rdf_deep_free(my_origin); + } + if (my_prev) { + ldns_rdf_deep_free(my_prev); + } + if (newzone) { + ldns_zone_free(newzone); + } + return ret; +} + +void +ldns_zone_sort(ldns_zone *zone) +{ + ldns_rr_list *zrr; + assert(zone != NULL); + + zrr = ldns_zone_rrs(zone); + ldns_rr_list_sort(zrr); +} + +#if 0 +/** + * ixfr function. Work on a ldns_zone and remove and add + * the rrs from the rrlist + * \param[in] z the zone to work on + * \param[in] del rr_list to remove from the zone + * \param[in] add rr_list to add to the zone + * \return Tja, wat zouden we eens returnen TODO + */ +void +ldns_zone_ixfr_del_add(ldns_zone *z, ldns_rr_list *del, ldns_rr_list *add) +{ + +} +#endif + +void +ldns_zone_free(ldns_zone *zone) +{ + ldns_rr_list_free(zone->_rrs); + LDNS_FREE(zone); +} + +void +ldns_zone_deep_free(ldns_zone *zone) +{ + ldns_rr_free(zone->_soa); + ldns_rr_list_deep_free(zone->_rrs); + LDNS_FREE(zone); +} diff --git a/libs/udns/.update b/libs/udns/.update deleted file mode 100644 index 70a01cf8aa..0000000000 --- a/libs/udns/.update +++ /dev/null @@ -1 +0,0 @@ -Fri Mar 16 17:20:44 EDT 2007 diff --git a/libs/udns/COPYING.LGPL b/libs/udns/COPYING.LGPL deleted file mode 100644 index b1e3f5a263..0000000000 --- a/libs/udns/COPYING.LGPL +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/libs/udns/Makefile b/libs/udns/Makefile deleted file mode 100755 index 2fcb20a5fd..0000000000 --- a/libs/udns/Makefile +++ /dev/null @@ -1,132 +0,0 @@ -#! /usr/bin/make -rf -# $Id: Makefile,v 1.42 2006/11/29 21:27:01 mjt Exp $ -# libudns Makefile -# -# Copyright (C) 2005 Michael Tokarev -# This file is part of UDNS library, an async DNS stub resolver. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library 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 -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library, in file named COPYING.LGPL; if not, -# write to the Free Software Foundation, Inc., 59 Temple Place, -# Suite 330, Boston, MA 02111-1307 USA - -VERS = 0.0.9pre -SRCS = udns_dn.c udns_dntosp.c udns_parse.c udns_resolver.c udns_misc.c \ - udns_rr_a.c udns_rr_ptr.c udns_rr_mx.c udns_rr_txt.c udns_bl.c \ - udns_rr_srv.c udns_rr_naptr.c udns_codes.c -USRCS = dnsget.c rblcheck.c ex-rdns.c -DEB = debian/copyright debian/changelog debian/control debian/rules -DIST = COPYING.LGPL udns.h udns.3 dnsget.1 rblcheck.1 $(SRCS) $(USRCS) \ - Makefile TODO NOTES - -OBJS = $(SRCS:.c=.o) $(GEN:.c=.o) -LIB = libudns.a - -SOVER = 0 -SOBJS = $(OBJS:.o=.lo) -SOLIB = libudns.so -SOLIBV = $(SOLIB).$(SOVER) - -LIBS = $(LIB) $(SOLIBV) - -UTILS = $(USRCS:.c=) -SOUTILS = $(USRCS:.c=.shared) - -NAMEPFX = udns-$(VERS) - -CC = gcc -CFLAGS = -Wall -W -Wmissing-prototypes -O2 -fPIC -CDEFS = -DHAVE_POLL -PICFLAGS = -fPIC -AWK = awk - -all: static - -.SUFFIXES: .c .o .lo .shared - -static: $(LIB) $(UTILS) -staticlib: $(LIB) -$(LIB): $(OBJS) - -rm -f $@ - $(AR) rv $@ $(OBJS) -.c.o: - $(CC) $(CFLAGS) $(CDEFS) -c $< -$(OBJS): udns.h - -$(UTILS): udns.h $(LIB) -.c: - $(CC) $(CFLAGS) $(CDEFS) -o $@ $< $(LIB) - -shared: $(SOLIBV) $(SOUTILS) -sharedlib: $(SOLIBV) - -$(SOLIBV): $(SOBJS) - $(CC) -shared -Wl,--soname,$(SOLIBV) -o $@ $(SOBJS) - rm -f $(SOLIB) - ln -s $(SOLIBV) $(SOLIB) -.c.lo: - $(CC) $(CFLAGS) $(PICFLAGS) $(CDEFS) -o $@ -c $< -$(SOBJS): udns.h - -$(SOUTILS): udns.h $(SOLIB) -.c.shared: - $(CC) $(CFLAGS) $(CDEFS) -o $@ $< $(SOLIB) - -# udns_codes.c is generated from udns.h -udns_codes.c: udns.h Makefile - @echo Generating $@ - @set -e; exec >$@.tmp; \ - set T type C class R rcode; \ - echo "/* Automatically generated. */"; \ - echo "#include \"udns.h\""; \ - while [ "$$1" ]; do \ - echo; \ - echo "const struct dns_nameval dns_$${2}tab[] = {"; \ - $(AWK) "/^ DNS_$${1}_[A-Z0-9_]+[ ]*=/ \ - { printf \" {%s,\\\"%s\\\"},\\n\", \$$1, substr(\$$1,7) }" \ - udns.h ; \ - echo " {0,0}};"; \ - echo "const char *dns_$${2}name(enum dns_$${2} code) {"; \ - echo " static char nm[20];"; \ - echo " switch(code) {"; \ - $(AWK) "BEGIN{i=0} \ - /^ DNS_$${1}_[A-Z0-9_]+[ ]*=/ \ - {printf \" case %s: return dns_$${2}tab[%d].name;\\n\",\$$1,i++}\ - " udns.h ; \ - echo " }"; \ - echo " return _dns_format_code(nm,\"$$2\",code);"; \ - echo "}"; \ - shift 2; \ - done - @mv $@.tmp $@ - -udns.3.html: udns.3 - groff -man -Thtml udns.3 > $@.tmp - mv $@.tmp $@ - -dist: $(NAMEPFX).tar.gz -$(NAMEPFX).tar.gz: $(DIST) $(DEB) - mkdir $(NAMEPFX) $(NAMEPFX)/debian - ln $(DIST) $(NAMEPFX) - ln $(DEB) $(NAMEPFX)/debian - tar cvfz $@ $(NAMEPFX) - rm -rf $(NAMEPFX) -subdist: - cp -p $(DIST) $(TARGET)/ - -clean: - rm -f $(OBJS) $(SOBJS) build-stamp -distclean: clean - rm -f $(LIBS) libudns.so udns.3.html $(UTILS) $(SOUTILS) - -.PHONY: all static staticlib shared sharedlib dist clean distclean subdist diff --git a/libs/udns/NOTES b/libs/udns/NOTES deleted file mode 100644 index 3fe75c1f32..0000000000 --- a/libs/udns/NOTES +++ /dev/null @@ -1,193 +0,0 @@ -Assorted notes about udns (library). - -UDP-only mode -~~~~~~~~~~~~~ - -First of all, since udns is (currently) UDP-only, there are some -shortcomings. - -It assumes that a reply will fit into a UDP buffer. With adoption of EDNS0, -and general robustness of IP stacks, in most cases it's not an issue. But -in some cases there may be problems: - - - if an RRset is "very large" so it does not fit even in buffer of size - requested by the library (current default is 4096; some servers limits - it further), we will not see the reply, or will only see "damaged" - reply (depending on the server) - - - many DNS servers ignores EDNS0 option requests. In this case, no matter - which buffer size udns library will request, such servers reply is limited - to 512 bytes (standard pre-EDNS0 DNS packet size). - - - some DNS servers, notable the ones used by Verisign for certain top-level - domains, chokes on EDNS0-enabled queries, returning FORMERR. Such - behavior isn't prohibited by DNS standards, but in my opinion it's at - least weird - the server can easily ignore EDNS0 options and send a - reply, instead of sending error. - Currently, udns does nothing in this situation, completely ignoring the - error returned by the server, and continue waiting for reply. It probably - should grok that this server does not understand EDNS0 and retry w/o the - options, but it does not. The end result - esp. if your local DNS - server or - worse - broken firewall which inspects DNS packets and drops - the ones which - from its point of view - are "broken" - is that you - see only TEMPFAIL errors from the library trying to resolve ANY names. - -Implementing TCP mode (together with non-EDNS0 fall-back as above) isn't -difficult, but it complicates API significantly. Currently udns uses only -single UDP socket (or - maybe in the future - two, see below), but in case of -TCP, it will need to open and close sockets for TCP connections left and -right, and that have to be integrated into an application's event loop in -an easy and efficient way. Plus all the timeouts - different for connect(), -write, and several stages of read. - -IPv6 vs IPv4 usage -~~~~~~~~~~~~~~~~~~ - -This is only relevant for nameservers reachable over IPv6, NOT for IPv6 -queries. I.e., if you've IPv6 addresses in 'nameservers' line in your -/etc/resolv.conf file. Even more: if you have BOTH IPv6 AND IPv4 addresses -there. Or pass them to udns initialization routines. - -Since udns uses a single UDP socket to communicate with all nameservers, -it should support both v4 and v6 communications. Most current platforms -supports this mode - using PF_INET6 socket and V4MAPPED addresses, i.e, -"tunnelling" IPv4 inside IPv6. But not all systems supports this. And -more, it has been said that such mode is deprecated. - -So, list only IPv4 or only IPv6 addresses, but don't mix them, in your -/etc/resolv.conf. - -An alternative is to use two sockets instead of 1 - one for IPv6 and one -for IPv4. For now I'm not sure if it's worth the complexity - again, of -the API, not the library itself (but this will not simplify library either). - -Single socket for all queries -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Using single UDP socket for sending queries to all nameservers has obvious -advantages. First it's, again, trivial, simple to use API. And simple -library too. Also, after sending queries to all nameservers (in case first -didn't reply in time), we will be able to receive late reply from first -nameserver and accept it. - -But this mode has disadvantages too. Most important is that it's much easier -to send fake reply to us, as the UDP port where we expects the reply to come -to is constant during the whole lifetime of an application. More secure -implementations uses random port for every single query. While port number -(16 bits integer) can not hold much randomness, it's still of some help. -Ok, udns is a stub resolver, so it expects sorta friendly environment, but -on LAN it's usually much easier to fire an attack, due to the speed of local -network, where a bad guy can generate alot of packets in a short time. - -Choosing of DNS QueryID -~~~~~~~~~~~~~~~~~~~~~~~ - -This is more a TODO item really. Currently, udns uses sequential number for -query IDs. Which simplifies attacks even more (c.f. the previous item about -single UDP port), making them nearly trivial. The library should use random -number for query ID. But there's no portable way to get random numbers, even -on various flavors of Unix. It's possible to use low bits from tv_nsec field -returned by gettimeofday() (current time, nanoseconds), but I wrote the library -in a way to avoid making system calls where possible, because many syscalls -means many context switches and slow processes as a result. Maybe use some -application-supplied callback to get random values will be a better way, -defaulting to gettimeofday() method. - -Note that a single query - even if (re)sent to different nameservers, several -times (due to no reply received in time), uses the same qID assigned when it -was first dispatched. So we have: single UDP socket (fixed port number), -sequential (= trivially predictable) qIDs, and long lifetime of those qIDs. -This all makes (local) attacks against the library really trivial. - -Assumptions about RRs returned -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Currently udns processes records in the reply it received sequentially. -This means that order of the records is significant. For example, if -we asked for foo.bar A, but the server returned that foo.bar is a CNAME -(alias) for bar.baz, and bar.baz, in turn, has address 1.2.3.4, when -the CNAME should come first in reply, followed by A. While DNS specs -does not say anything about order of records - it's an rrSET - unordered, - -I think an implementation which returns the records in "wrong" order is -somewhat insane... Well ok, to be fair, I don't really remember how -udns handles this now - need to check this in source... ;) - -CNAME recursion -~~~~~~~~~~~~~~~ - -Another dark point of udns is the handling of CNAMEs returned as replies -to non-CNAME queries. If we asked for foo.bar A, but it's a CNAME, udns -expects BOTH the CNAME itself and the target DN to be present in the reply. -In other words, udns DOES NOT RECURSE CNAMES. If we asked for foo.bar A, -but only record in reply was that foo.bar is a CNAME for bar.baz, udns will -return no records to an application (NXDOMAIN). Strictly speaking, udns -should repeat the query asking for bar.baz A, and recurse. But since it's -stub resolver, recursive resolver should recurse for us instead. - -It's not very difficult to implement, however. Probably with some (global?) -flag to en/dis-able the feature. Provided there's some demand for it. - -To clarify: udns handles CNAME recursion in a single reply packet just fine. - -Error reporting -~~~~~~~~~~~~~~~ - -Too many places in the code (various failure paths) sets generic "TEMPFAIL" -error condition. For example, if no nameserver replied to our query, an -application will get generic TEMPFAIL, instead of something like TIMEDOUT. -This probably should be fixed, but most applications don't care about the -exact reasons of failure - 4 common cases are already too much: - - query returned some valid data - - NXDOMAIN - - valid domain but no data of requested type - =NXDOMAIN in most cases - - temporary error - this one sometimes (incorrectly!) treated as NXDOMAIN - by (naive) applications. -DNS isn't yes/no, it's at least 3 variants, temp err being the 3rd important -case! And adding more variations for the temp error case is complicating things -even more - again, from an application writer standpoint. For diagnostics, -such more specific error cases are of good help. - -Planned API changes -~~~~~~~~~~~~~~~~~~~ - -At least one thing I want to change for 0.1 version is a way how queries are -submitted. - -I want to made dns_query object to be owned by an application. So that instead -of udns library allocating it for the lifetime of query, it will be pre- -allocated by an application. This simplifies and enhances query submitting -interface, and complicates it a bit too, in simplest cases. - -Currently, we have: - -dns_submit_dn(dn, cls, typ, flags, parse, cbck, data) -dns_submit_p(name, cls, typ, flags, parse, cbck, data) -dns_submit_a4(ctx, name, flags, cbck, data) - -and so on -- with many parameters missed for type-specific cases, but generic -cases being too complex for most common usage. - -Instead, with dns_query being owned by an app, we will be able to separately -set up various parts of the query - domain name (various forms), type&class, -parser, flags, callback... and even change them at runtime. And we will also -be able to reuse query structures, instead of allocating/freeing them every -time. So the whole thing will look something like: - - q = dns_alloc_query(); - dns_submit(dns_q_flags(dns_q_a4(q, name, cbck), DNS_F_NOSRCH), data); - -The idea is to have a set of functions accepting struct dns_query* and -returning it (so the calls can be "nested" like the above), to set up -relevant parts of the query - specific type of callback, conversion from -(type-specific) query parameters into a domain name (this is for type- -specific query initializers), and setting various flags and options and -type&class things. - -One example where this is almost essential - if we want to support -per-query set of nameservers (which isn't at all useless: imagine a -high-volume mail server, were we want to direct DNSBL queries to a separate -set of nameservers, and rDNS queries to their own set and so on). Adding -another argument (set of nameservers to use) to EVERY query submitting -routine is.. insane. Especially since in 99% cases it will be set to -default NULL. But with such "nesting" of query initializers, it becomes -trivial. diff --git a/libs/udns/TODO b/libs/udns/TODO deleted file mode 100644 index ce5bba1272..0000000000 --- a/libs/udns/TODO +++ /dev/null @@ -1,74 +0,0 @@ -$Id: TODO,v 1.10 2005/04/19 21:48:09 mjt Exp $ - -The following is mostly an internal, not user-visible stuff. - -* rearrange an API to make dns_query object owned by application, - so that it'll look like this: - struct dns_query *q; - q = udns_query_alloc(ctx); - udns_query_set(q, options, domain_name, flags, ...); - udns_query_submit(ctx, q); - or - udns_query_resolve(ctx, q); - -* allow NULL callbacks? Or provide separate resolver - context list of queries which are done but wich did not - have callback, and dns_pick() routine to retrieve results - from this query, i.e. allow non-callback usage? The - non-callback usage may be handy sometimes (any *good* - example?), but it will be difficult to provide type-safe - non-callback interface due to various RR-specific types - in use. - -* DNS_OPT_FLAGS should be DNS_OPT_ADDFLAGS and DNS_OPT_SETFLAGS. - Currently one can't add a single flag bit but preserve - existing bits... at least not without retrieving all current - flags before, which isn't that bad anyway. - -* dns_set_opts() may process flags too (such as aaonly etc) - -* a way to disable $NSCACHEIP et al processing? - -* initialize/open the context automatically, and be more - liberal about initialization in general? - -* dns_init(do_open) - make the parameter opposite, aka - dns_init(skip_open) ? - -* for the above. Use separate routine for initializing the context - from system files, to not link stuff reading resolv.conf if it's - not needed. So that automatic init will not be possible. - -* allow TCP queue? - -* detect servers which don't understand EDNS0 (returning FORMERR), - and fall back to pre-EDNS0 for them. - -* for the above to work, we have to be able to find query object by - only ID, not ID + qdn. - -* And oh, qID should really be random. - -* more accurate error reporting. Currently, udns always returns TEMPFAIL, - but don't specify why it happened (ENOMEM, timeout, etc). - -* check the error value returned by recvfrom() and - sendto() and determine which errors to ignore. - -* maybe merge dns_timeouts() and dns_ioevent(), to have - only one entry point for everything? For traditional - select-loop-based eventloop it may be easier, but for - callback-driven event loops the two should be separate. - Provide an option, or a single dns_events() entry point - for select-loop approach, or just call dns_ioevent() - from within dns_timeouts() (probably after renaming - it to be dns_events()) ? - -* implement /etc/hosts lookup too, ala [c-]ares?? - -* sortlist support? - -* windows port? Oh no please!.. At least, I can't do it myself - because of the lack of platform. - Ok ok, the Windows port is in progress. Christian Prahauser - from cosy.sbg.ac.at is helping with that. diff --git a/libs/udns/debian/changelog b/libs/udns/debian/changelog deleted file mode 100644 index c393fea06a..0000000000 --- a/libs/udns/debian/changelog +++ /dev/null @@ -1,94 +0,0 @@ -udns (0.0.9pre) unstable; urgency=low - - * s/EOVERFLOW/ENFILE, partly to make win32 happy - - * several win32 fixes - - * don't use `class' in udns.h, to make C++ happy - (thanks Markus Koetter for pointing this out) - - * fixed CNAME handling in dnsget tool. Another Thank You! goes - to Markus Koetter. - - * NAPTR (RFC3403) support, thanks to Mikael Magnusson - for this. - - * more Win32 fixes from Mikael Magnusson. I have to admit - I never tried to compile it on Win32. - - * added NOTES file - - -- Michael Tokarev Wed, 29 Nov 2006 04:16:21 +0300 - -udns (0.0.8) unstable; urgency=low - - * don't compare sockaddr_in's, but individual parts only - (on some OSes, there are additional fields in this structure - so memcmp() does not quite work) - - * use dnsc_t instead of unsigned char for DNs everywhere - - * SRV records (rfc2782) parsing, thanks to - Thadeu Lima de Souza Cascardo. - - * manpage fixes - - -- Michael Tokarev Mon, 12 Sep 2005 16:06:45 +0400 - -udns (0.0.7) unstable; urgency=low - - * added dnsget.1 and rblcheck.1 manpages. - - * internal: use generic list implementation in udns_resolver.c - - * don't assume only backward DN pointers in replies, allow forward - pointers too. This is quite large change, involves changing - parsing API all over the places. - - * internal: typedef dnsc_t and dnscc_t for [const] unsigned char, to - make function prototypes shorter to better fit on a single line. - - * in parsing routines, verify (assert) that the query type - is the one we can handle. - - * recognize names (and resolve them) as nameservers in dnsget. - - * when new request is submitted, don't send it immediately, but - add it into the head of the active queue with deadline=0. - This will allow us to tweak some query settings before it will - be processed. - Note API change: removed `now' argument from all dns_submit_*() - routines. - - * use single per-context user timer, not per-query. - Note API change: different user timer callback - - * add dnsc_salen field -- length of the socket address used - - * fix dns_set_opt(DNS_OPT_FLAGS) which didn't work before - - * allow to set some options for a context wich is open but with no - active queries - - -- Michael Tokarev Thu, 5 May 2005 23:14:29 +0400 - -udns (0.0.6) unstable; urgency=low - - * 0.0.6 release. - ALOT of changes all over. Keep 'em in CVS logs! - - -- Michael Tokarev Fri, 8 Apr 2005 19:51:38 +0400 - -udns (0.0.5) unstable; urgency=low - - * Initial Release. - * Provides 3 packages: - libudns0 - shared library - libudns-dev - development files and static library - udns-utils - dnsget, rblcheck - - -- Michael Tokarev Thu, 7 Apr 2005 00:05:24 +0400 - -Local variables: -mode: debian-changelog -End: diff --git a/libs/udns/debian/control b/libs/udns/debian/control deleted file mode 100644 index f7234f54ac..0000000000 --- a/libs/udns/debian/control +++ /dev/null @@ -1,33 +0,0 @@ -Source: udns -Priority: optional -Maintainer: Michael Tokarev -Build-Depends: debhelper (>= 4.0.0) -Standards-Version: 3.6.1 - -Package: libudns0 -Section: lib -Architecture: any -Depends: ${shlibs:Depends} -Description: async-capable DNS stub resolver library - libudns0 package provides libudns shared library needed - to run programs using it - -Package: libudns-dev -Section: libdev -Architecture: any -Depends: libudns0 (= ${Source-Version}) -Description: async-capable DNS stub resolver library, development files - This package provides development files needed - to build programs using udns library - -Package: udns-utils -Section: net -Architecture: any -Depends: ${shlibs:Depends} -Conflicts: rblcheck -Description: Several DNS-related utilities built on top of udns library - This package includes the following utilities: - dnsget - a simple DNS query tool, like `host' or `dig' for usage from - a command line, and dnsip, dnsname etc for usage in scripts - rblcheck - DNSBL (rbl) checker - All the utilities are built using udns library diff --git a/libs/udns/debian/copyright b/libs/udns/debian/copyright deleted file mode 100644 index 089491bc69..0000000000 --- a/libs/udns/debian/copyright +++ /dev/null @@ -1,24 +0,0 @@ -This is udns, written and maintained by Michael Tokarev - -The original source can always be found at: - http://www.corpit.ru/mjt/udns.html - -Copyright (C) 2005 Michael Tokarev - - 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 package; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. - -On Debian systems, the complete text of the GNU General -Public License can be found in `/usr/share/common-licenses/GPL'. diff --git a/libs/udns/debian/rules b/libs/udns/debian/rules deleted file mode 100755 index 07dc8b874f..0000000000 --- a/libs/udns/debian/rules +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/make -f -# -*- makefile -*- -# This file was originally written by Joey Hess and Craig Small. -# As a special exception, when this file is copied by dh-make into a -# dh-make output file, you may use that output file without restriction. -# This special exception was added by Craig Small in version 0.37 of dh-make. - -# Uncomment this to turn on verbose mode. -#export DH_VERBOSE=1 -export DH_COMPAT=4 - -CFLAGS = -Wall -W -Wmissing-prototypes -g -CDEFS = -DHAVE_POOL - -INSTALL = install -INSTALL_PROGRAM = $(INSTALL) -p -INSTALL_DATA = $(INSTALL) -p -m0644 - -ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) - CFLAGS += -O0 -else - CFLAGS += -O2 -endif -ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) - INSTALL_PROGRAM += -s -endif -ifeq (,$(findstring debug,$(DEB_BUILD_OPTIONS))) -# CDEFS += -DNDEBUG -endif - -SOVER = 0 - -configure: # nothing - dh_testdir - -build: build-stamp -build-stamp: - dh_testdir - $(MAKE) CFLAGS="$(CFLAGS)" CDEFS="$(CDEFS)" SOVER=$(SOVER) \ - staticlib sharedlib rblcheck.shared dnsget.shared - mv -f rblcheck.shared rblcheck - mv -f dnsget.shared dnsget - touch $@ - -clean: - dh_testdir - rm -f build-stamp - $(MAKE) distclean - dh_clean - -install: build - dh_testdir - dh_testroot - dh_clean - dh_installdirs - dh_installdocs -A NEWS - -# libudns - dh_install -plibudns$(SOVER) libudns.so.$(SOVER) usr/lib - -# libudns-dev - dh_install -plibudns-dev libudns.a libudns.so usr/lib - dh_install -plibudns-dev udns.h usr/include - dh_installman -plibudns-dev udns.3 - dh_installdocs -plibudns-dev TODO NOTES - dh_installexamples -plibudns-dev ex-rdns.c - -# udns-utils - dh_installdirs -pudns-utils usr/bin - dh_install -pudns-utils dnsget rblcheck usr/bin - dh_installman -pudns-utils dnsget.1 rblcheck.1 - -binary-indep: build install - -binary-arch: build install - dh_testdir - dh_testroot - dh_installchangelogs - dh_installdocs - dh_strip - dh_compress - dh_fixperms - dh_makeshlibs - dh_installdeb - dh_shlibdeps -L libudns$(SOVER) -l debian/libudns$(SOVER)/usr/lib - dh_gencontrol - dh_md5sums - dh_builddeb - -binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install configure diff --git a/libs/udns/dnsget.1 b/libs/udns/dnsget.1 deleted file mode 100644 index 711f29769e..0000000000 --- a/libs/udns/dnsget.1 +++ /dev/null @@ -1,182 +0,0 @@ -.\" $Id: dnsget.1,v 1.3 2005/04/20 00:55:34 mjt Exp $ -.\" dnsget manpage -.\" -.\" Copyright (C) 2005 Michael Tokarev -.\" This file is part of UDNS library, an async DNS stub resolver. -.\" -.\" This library is free software; you can redistribute it and/or -.\" modify it under the terms of the GNU Lesser General Public -.\" License as published by the Free Software Foundation; either -.\" version 2.1 of the License, or (at your option) any later version. -.\" -.\" This library 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 -.\" Lesser General Public License for more details. -.\" -.\" You should have received a copy of the GNU Lesser General Public -.\" License along with this library, in file named COPYING.LGPL; if not, -.\" write to the Free Software Foundation, Inc., 59 Temple Place, -.\" Suite 330, Boston, MA 02111-1307 USA - -.TH dnsget 1 "Apr 2005" "User Utilities" - -.SH NAME -dnsget \- DNS lookup utility - -.SH SYNOPSYS -.B dnsget -.RB [\| \-v \||\| \-q \|] -.RB [\| \-c -.IR class \|] -.RB [\| \-t -.IR type \|] -.RB [\| \-o -.IR option : value \] -.IR name \|.\|.\|. - -.SH DESCRIPTION -.B dnsget -is a simple command-line to perform DNS lookups, similar to -.BR host (1) -and -.BR dig (1). -It is useable for both interactive/debugging scenarious and -in scripts. -The program is implemented using -.BR udns (3) -library. - -.PP -By default, -.B dnsget -produces a human-readable output, similar to -.RS -.nf -alias.example.com. CNAME www.example.com. -www.example.com. A 192.168.1.1 -www.example.com. MX 10 mx.example.com. -.fi -.RE -which is just sufficient to see how a given name resolves. -Output format is controllable with -.B \-v -and -.B \-q -options -- the former increases verbosity level up to printing -the whole DNS contents of all packets sent and received, which -is suitable for debugging DNS problems, while the latter reduces -the level, making output more quiet, up to bare result with no -error messages, which is good for scripts. - -.SH OPTIONS - -The following options are recognized by -.BR dnsget : - -.TP -.B \-v -produce more detailed output. More -.BR \-v 's -means more details will be produced. With single -.BR \-v , dnsget -will print contents of all received DNS packets (in a readable format), -while with -.BR \-vv , -it will output all outgoing DNS packets too. - -.TP -.B \-q -the opposite for \fB\-v\fR -- produce less detailed output. -With single -.BR \-q , dnsget -will only show (decoded) data from final DNS resource records (RR), -while -.B \-qq -also suppresses error messages. - -.TP -\fB\-t \fItype\fR -request record(s) of the given type \fItype\fR. By default, -.B dnsget -will ask for IPv4 address (A) record, or for PTR record if the -argument in question is an IPv4 or IPv6 address. Recognized -types include A, AAAA, MX, TXT, CNAME, PTR, NS, SOA, ANY and -others. - -.TP -\fB\-c \fIclass\fR -request DNS record(s) of the given class \fIclass\fR. By -default -.B dnsget -uses IN class. Valid classes include IN, CH, HS, ANY. - -.TP -.B \-a -(compatibility option). Equivalent to setting query type to -.B ANY -and increasing verbosity level -.RB ( \-v ). - -.TP -.B \-C -(planned) - -.TP -.B \-x -(planned) - -.TP -\fB\-o \fIoption\fR:\fIvalue\fR -Set resolver option \fIoption\fR to the value \fIvalue\fR -(may be specified several times). The same as setting -.RB $ RES_OPTIONS -environment variable. The following options are recognized: -.RS -.TP -\fBtimeout\fR:\fIsec\fR -Set initial query timeout to \fIsec\fR. -.TP -\fBattempts\fR:\fInum\fR -(re)try every query \fInum\fR times before failing. -.TP -\fBudpbuf\fR:\fIbytes\fR -set DNS UDP buffer size to \fIbytes\fR bytes. Valid values -are from 512 to 65535. If \fIbytes\fR is greather than 512, -EDNS0 (RFC 2671) extensions will be used. -.TP -\fBport\fR:\fInum\fR -Use given UDP port number \fInum\fR instead of the default port 53 (domain). -.RE - -.TP -\fB\-n \fInameserver\fR -Use the given nameserver(s) (may be specified more than once) -instead of the default. Using this option has the same same effect as -.RB $ NSCACHEIP -or -.RB $ NAMESERVERS -environment variables, with the only difference that only IPv4 addresses -are recognized for now, and it is possible to specify names (which will -be resolved using default settings) instead of IP addresses. - -.TP -.B \-h -print short help and exit. - -.SH "RETURN VALUE" -When all names where resovled successefully, -.B dnsget -exits with zero exit status. If at least one name was not found, -.B dnsget -will exit with return code 100. If some other error occured during -name resolution, it will exit with code 99. In case of usage or -initialization error, -.B dnsget -will return 1. - -.SH "SEE ALSO" -.BR host (1) -.BR dig (1) -.BR resolv.conf (5) -.BR udns (3). diff --git a/libs/udns/dnsget.c b/libs/udns/dnsget.c deleted file mode 100644 index 1d89a52808..0000000000 --- a/libs/udns/dnsget.c +++ /dev/null @@ -1,709 +0,0 @@ -/* $Id: dnsget.c,v 1.22 2006/11/29 21:28:49 mjt Exp $ - simple host/dig-like application using UDNS library - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "udns.h" - -static char *progname; -static int verbose = 1; -static int errors; -static int notfound; - -/* verbosity level: - * <0 - bare result - * 0 - bare result and error messages - * 1 - readable result - * 2 - received packet contents and `trying ...' stuff - * 3 - sent and received packet contents - */ - -static void die(int errnum, const char *fmt, ...) { - va_list ap; - fprintf(stderr, "%s: ", progname); - va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - if (errnum) fprintf(stderr, ": %s\n", strerror(errnum)); - else putc('\n', stderr); - fflush(stderr); - exit(1); -} - -struct query { - const char *name; /* original query string */ - unsigned char *dn; /* the DN being looked up */ - enum dns_type qtyp; /* type of the query */ -}; - -static void query_free(struct query *q) { - free(q->dn); - free(q); -} - -static struct query * -query_new(const char *name, const unsigned char *dn, enum dns_type qtyp) { - struct query *q = malloc(sizeof(*q)); - unsigned l = dns_dnlen(dn); - unsigned char *cdn = malloc(l); - if (!q || !cdn) die(0, "out of memory"); - memcpy(cdn, dn, l); - q->name = name; - q->dn = cdn; - q->qtyp = qtyp; - return q; -} - -static enum dns_class qcls = DNS_C_IN; - -static void -dnserror(struct query *q, int errnum) { - if (verbose >= 0) - fprintf(stderr, "%s: unable to lookup %s record for %s: %s\n", progname, - dns_typename(q->qtyp), dns_dntosp(q->dn), dns_strerror(errnum)); - if (errnum == DNS_E_NXDOMAIN || errnum == DNS_E_NODATA) - ++notfound; - else - ++errors; - query_free(q); -} - -static const unsigned char * -printtxt(const unsigned char *c) { - unsigned n = *c++; - const unsigned char *e = c + n; - if (verbose > 0) while(c < e) { - if (*c < ' ' || *c >= 127) printf("\\%02x", *c); - else if (*c == '\\' || *c == '"') printf("\\%c", *c); - else putchar(*c); - ++c; - } - else - fwrite(c, n, 1, stdout); - return e; -} - -static void -printhex(const unsigned char *c, const unsigned char *e) { - while(c < e) - printf("%02x", *c++); -} - -static unsigned char to_b64[] = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -static void -printb64(const unsigned char *c, const unsigned char *e) { - while(c < e) { - putchar(to_b64[c[0] >> 2]); - if (c+1 < e) { - putchar(to_b64[(c[0] & 0x3) << 4 | c[1] >> 4]); - if (c+2 < e) { - putchar(to_b64[(c[1] & 0xf) << 2 | c[2] >> 6]); - putchar(to_b64[c[2] & 0x3f]); - } - else { - putchar(to_b64[(c[1] & 0xf) << 2]); - putchar('='); - break; - } - } - else { - putchar(to_b64[(c[0] & 0x3) << 4]); - putchar('='); - putchar('='); - break; - } - c += 3; - } -} - -static void -printdate(time_t time) { - struct tm *tm = gmtime(&time); - printf("%04d%02d%02d%02d%02d%02d", - tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, - tm->tm_hour, tm->tm_min, tm->tm_sec); -} - -static void -printrr(const struct dns_parse *p, struct dns_rr *rr) { - const unsigned char *pkt = p->dnsp_pkt; - const unsigned char *end = p->dnsp_end; - const unsigned char *dptr = rr->dnsrr_dptr; - const unsigned char *dend = rr->dnsrr_dend; - unsigned char *dn = rr->dnsrr_dn; - const unsigned char *c; - unsigned n; - - if (verbose > 0) { - if (verbose > 1) { - if (!p->dnsp_rrl && !rr->dnsrr_dn[0] && rr->dnsrr_typ == DNS_T_OPT) { - printf(";EDNS0 OPT record (UDPsize: %d): %d bytes\n", - rr->dnsrr_cls, rr->dnsrr_dsz); - return; - } - n = printf("%s.", dns_dntosp(rr->dnsrr_dn)); - printf("%s%u\t%s\t%s\t", - n > 15 ? "\t" : n > 7 ? "\t\t" : "\t\t\t", - rr->dnsrr_ttl, - dns_classname(rr->dnsrr_cls), - dns_typename(rr->dnsrr_typ)); - } - else - printf("%s. %s ", dns_dntosp(rr->dnsrr_dn), dns_typename(rr->dnsrr_typ)); - } - - switch(rr->dnsrr_typ) { - - case DNS_T_CNAME: - case DNS_T_PTR: - case DNS_T_NS: - case DNS_T_MB: - case DNS_T_MD: - case DNS_T_MF: - case DNS_T_MG: - case DNS_T_MR: - if (dns_getdn(pkt, &dptr, end, dn, DNS_MAXDN) <= 0) goto xperr; - printf("%s.", dns_dntosp(dn)); - break; - - case DNS_T_A: - if (rr->dnsrr_dsz != 4) goto xperr; - printf("%d.%d.%d.%d", dptr[0], dptr[1], dptr[2], dptr[3]); - break; - - case DNS_T_AAAA: - if (rr->dnsrr_dsz != 16) goto xperr; - printf("%s", inet_ntop(AF_INET6, dptr, (char*)dn, DNS_MAXDN)); - break; - - case DNS_T_MX: - c = dptr + 2; - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || c != dend) goto xperr; - printf("%d %s.", dns_get16(dptr), dns_dntosp(dn)); - break; - - case DNS_T_TXT: - /* first verify it */ - for(c = dptr; c < dend; c += n) { - n = *c++; - if (c + n > dend) goto xperr; - } - c = dptr; n = 0; - while (c < dend) { - if (verbose > 0) printf(n++ ? "\" \"":"\""); - c = printtxt(c); - } - if (verbose > 0) putchar('"'); - break; - - case DNS_T_HINFO: /* CPU, OS */ - c = dptr; - n = *c++; if ((c += n) >= dend) goto xperr; - n = *c++; if ((c += n) != dend) goto xperr; - c = dptr; - if (verbose > 0) putchar('"'); - c = printtxt(c); - if (verbose > 0) printf("\" \""); else putchar(' '); - printtxt(c); - if (verbose > 0) putchar('"'); - break; - - case DNS_T_WKS: - c = dptr; - if (dptr + 4 + 2 >= end) goto xperr; - printf("%s %d", inet_ntoa(*((struct in_addr*)dptr)), dptr[4]); - c = dptr + 5; - for (n = 0; c < dend; ++c, n += 8) { - if (*c) { - unsigned b; - for (b = 0; b < 8; ++b) - if (*c & (1 << (7-b))) printf(" %d", n + b); - } - } - break; - - case DNS_T_SRV: /* prio weight port targetDN */ - c = dptr; - c += 2 + 2 + 2; - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || c != dend) goto xperr; - c = dptr; - printf("%d %d %d %s.", - dns_get16(c+0), dns_get16(c+2), dns_get16(c+4), - dns_dntosp(dn)); - break; - - case DNS_T_NAPTR: /* order pref flags serv regexp repl */ - c = dptr; - c += 4; /* order, pref */ - for (n = 0; n < 3; ++n) - if (c >= dend) goto xperr; - else c += *c + 1; - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || c != dend) goto xperr; - c = dptr; - printf("%u %u", dns_get16(c+0), dns_get16(c+2)); - c += 4; - for(n = 0; n < 3; ++n) { - putchar(' '); - if (verbose > 0) putchar('"'); - c = printtxt(c); - if (verbose > 0) putchar('"'); - } - printf(" %s.", dns_dntosp(dn)); - break; - - case DNS_T_KEY: /* flags(2) proto(1) algo(1) pubkey */ - c = dptr; - if (c + 2 + 1 + 1 > dend) goto xperr; - printf("%d %d %d", dns_get16(c), c[2], c[3]); - c += 2 + 1 + 1; - if (c < dend) { - putchar(' '); - printb64(c, dend); - } - break; - - case DNS_T_SIG: - /* type(2) algo(1) labels(1) ottl(4) sexp(4) sinc(4) tag(2) sdn sig */ - c = dptr; - c += 2 + 1 + 1 + 4 + 4 + 4 + 2; - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0) goto xperr; - printf("%d %u %u %u ", - dns_get16(dptr), dptr[2], dptr[3], dns_get32(dptr+4)); - printdate(dns_get32(dptr+8)); - putchar(' '); - printdate(dns_get32(dptr+12)); - printf(" %d %s. ", dns_get16(dptr+10), dns_dntosp(dn)); - printb64(c, dend); - break; - -#if 0 /* unused RR types? */ - case DNS_T_DS: - c = dptr; - if (c + 2 + 2 >= dend) goto xperr; - printf("%u %u %u ", dns_get16(c), c[2], c[3]); - printhex(c + 4, dend); - break; - - case DNS_T_NSEC: - c = dptr; - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0) goto xperr; - printf("%s.", dns_dntosp(dn)); - unfinished. - break; -#endif - - - case DNS_T_SOA: - c = dptr; - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || - dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || - c + 4*5 != dend) - goto xperr; - dns_getdn(pkt, &dptr, end, dn, DNS_MAXDN); - printf("%s. ", dns_dntosp(dn)); - dns_getdn(pkt, &dptr, end, dn, DNS_MAXDN); - printf("%s. ", dns_dntosp(dn)); - printf("%u %u %u %u %u", - dns_get32(dptr), dns_get32(dptr+4), dns_get32(dptr+8), - dns_get32(dptr+12), dns_get32(dptr+16)); - break; - - case DNS_T_MINFO: - c = dptr; - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || - dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || - c != dend) - goto xperr; - dns_getdn(pkt, &dptr, end, dn, DNS_MAXDN); - printf("%s. ", dns_dntosp(dn)); - dns_getdn(pkt, &dptr, end, dn, DNS_MAXDN); - printf("%s.", dns_dntosp(dn)); - break; - - case DNS_T_NULL: - default: - printhex(dptr, dend); - break; - } - putchar('\n'); - return; - -xperr: - printf("\n"); - ++errors; -} - -static int -printsection(struct dns_parse *p, int nrr, const char *sname) { - struct dns_rr rr; - int r; - if (!nrr) return 0; - if (verbose > 1) printf("\n;; %s section (%d):\n", sname, nrr); - - p->dnsp_rrl = nrr; - while((r = dns_nextrr(p, &rr)) > 0) - printrr(p, &rr); - if (r < 0) printf("<>\n"); - return r; -} - -/* dbgcb will only be called if verbose > 1 */ -static void -dbgcb(int code, const struct sockaddr *sa, unsigned slen, - const unsigned char *pkt, int r, - const struct dns_query *unused_q, void *unused_data) { - struct dns_parse p; - const unsigned char *cur, *end; - int numqd; - - if (code > 0) { - printf(";; trying %s.\n", dns_dntosp(dns_payload(pkt))); - printf(";; sending %d bytes query to ", r); - } - else - printf(";; received %d bytes response from ", r); - if (sa->sa_family == AF_INET && slen >= sizeof(struct sockaddr_in)) { - char buf[4*4]; - printf("%s port %d\n", - inet_ntop(AF_INET, &((struct sockaddr_in*)sa)->sin_addr, - buf, sizeof(buf)), - htons(((struct sockaddr_in*)sa)->sin_port)); - } -#ifdef AF_INET6 - else if (sa->sa_family == AF_INET6 && slen >= sizeof(struct sockaddr_in6)) { - char buf[6*5+4*4]; - printf("%s port %d\n", - inet_ntop(AF_INET6, &((struct sockaddr_in6*)sa)->sin6_addr, - buf, sizeof(buf)), - htons(((struct sockaddr_in6*)sa)->sin6_port)); - } -#endif - else - printf("<>\n", sa->sa_family); - if (code > 0 && verbose < 3) { - putchar('\n'); - return; - } - - if (code == -2) printf(";; reply from unexpected source\n"); - if (code == -5) printf(";; reply to a query we didn't sent (or old)\n"); - if (r < DNS_HSIZE) { - printf(";; short packet (%d bytes)\n", r); - return; - } - if (dns_opcode(pkt) != 0) - printf(";; unexpected opcode %d\n", dns_opcode(pkt)); - if (dns_tc(pkt) != 0) - printf(";; warning: TC bit set, probably incomplete reply\n"); - - printf(";; ->>HEADER<<- opcode: "); - switch(dns_opcode(pkt)) { - case 0: printf("QUERY"); break; - case 1: printf("IQUERY"); break; - case 2: printf("STATUS"); break; - default: printf("UNKNOWN(%u)", dns_opcode(pkt)); break; - } - printf(", status: %s, id: %d, size: %d\n;; flags:", - dns_rcodename(dns_rcode(pkt)), dns_qid(pkt), r); - if (dns_qr(pkt)) printf(" qr"); - if (dns_rd(pkt)) printf(" rd"); - if (dns_ra(pkt)) printf(" ra"); - if (dns_aa(pkt)) printf(" aa"); - if (dns_tc(pkt)) printf(" tc"); - numqd = dns_numqd(pkt); - printf("; QUERY: %d, ANSWER: %d, AUTHORITY: %d, ADDITIONAL: %d\n", - numqd, dns_numan(pkt), dns_numns(pkt), dns_numar(pkt)); - if (numqd != 1) - printf(";; unexpected number of entries in QUERY section: %d\n", - numqd); - printf("\n;; QUERY SECTION (%d):\n", numqd); - cur = dns_payload(pkt); - end = pkt + r; - while(numqd--) { - if (dns_getdn(pkt, &cur, end, p.dnsp_dnbuf, DNS_MAXDN) <= 0 || - cur + 4 > end) { - printf("; invalid query section\n"); - return; - } - r = printf(";%s.", dns_dntosp(p.dnsp_dnbuf)); - printf("%s%s\t%s\n", - r > 23 ? "\t" : r > 15 ? "\t\t" : r > 7 ? "\t\t\t" : "\t\t\t\t", - dns_classname(dns_get16(cur+2)), dns_typename(dns_get16(cur))); - cur += 4; - } - - p.dnsp_pkt = pkt; - p.dnsp_cur = p.dnsp_ans = cur; - p.dnsp_end = end; - p.dnsp_qdn = NULL; - p.dnsp_qcls = p.dnsp_qtyp = 0; - p.dnsp_ttl = 0xffffffffu; - p.dnsp_nrr = 0; - - r = printsection(&p, dns_numan(pkt), "ANSWER"); - if (r == 0) - r = printsection(&p, dns_numns(pkt), "AUTHORITY"); - if (r == 0) - r = printsection(&p, dns_numar(pkt), "ADDITIONAL"); - putchar('\n'); -} - -static void dnscb(struct dns_ctx *ctx, void *result, void *data) { - int r = dns_status(ctx); - struct query *q = data; - struct dns_parse p; - struct dns_rr rr; - unsigned nrr; - unsigned char dn[DNS_MAXDN]; - const unsigned char *pkt, *cur, *end; - if (!result) { - dnserror(q, r); - return; - } - pkt = result; end = pkt + r; cur = dns_payload(pkt); - dns_getdn(pkt, &cur, end, dn, sizeof(dn)); - dns_initparse(&p, NULL, pkt, cur, end); - p.dnsp_qcls = p.dnsp_qtyp = 0; - nrr = 0; - while((r = dns_nextrr(&p, &rr)) > 0) { - if (!dns_dnequal(dn, rr.dnsrr_dn)) continue; - if ((qcls == DNS_C_ANY || qcls == rr.dnsrr_cls) && - (q->qtyp == DNS_T_ANY || q->qtyp == rr.dnsrr_typ)) - ++nrr; - else if (rr.dnsrr_typ == DNS_T_CNAME && !nrr) { - if (dns_getdn(pkt, &rr.dnsrr_dptr, end, - p.dnsp_dnbuf, sizeof(p.dnsp_dnbuf)) <= 0 || - rr.dnsrr_dptr != rr.dnsrr_dend) { - r = DNS_E_PROTOCOL; - break; - } - else { - if (verbose == 1) { - printf("%s.", dns_dntosp(dn)); - printf(" CNAME %s.\n", dns_dntosp(p.dnsp_dnbuf)); - } - dns_dntodn(p.dnsp_dnbuf, dn, sizeof(dn)); - } - } - } - if (!r && !nrr) - r = DNS_E_NODATA; - if (r < 0) { - dnserror(q, r); - free(result); - return; - } - if (verbose < 2) { /* else it is already printed by dbgfn */ - dns_rewind(&p, NULL); - p.dnsp_qtyp = q->qtyp; - p.dnsp_qcls = qcls; - while(dns_nextrr(&p, &rr)) - printrr(&p, &rr); - } - free(result); - query_free(q); -} - -int main(int argc, char **argv) { - int i; - int fd; - fd_set fds; - struct timeval tv; - time_t now; - char *ns[DNS_MAXSERV]; - int nns = 0; - struct query *q; - enum dns_type qtyp = 0; - struct dns_ctx *nctx = NULL; - - if (!(progname = strrchr(argv[0], '/'))) progname = argv[0]; - else argv[0] = ++progname; - - if (argc <= 1) - die(0, "try `%s -h' for help", progname); - - if (dns_init(0) < 0 || !(nctx = dns_new(NULL))) - die(errno, "unable to initialize dns library"); - /* we keep two dns contexts: one may be needed to resolve - * nameservers if given as names, using default options. - */ - - while((i = getopt(argc, argv, "vqt:c:an:o:h")) != EOF) switch(i) { - case 'v': ++verbose; break; - case 'q': --verbose; break; - case 't': - if (optarg[0] == '*' && !optarg[1]) - i = DNS_T_ANY; - else if ((i = dns_findtypename(optarg)) <= 0) - die(0, "unrecognized query type `%s'", optarg); - qtyp = i; - break; - case 'c': - if (optarg[0] == '*' && !optarg[1]) - i = DNS_C_ANY; - else if ((i = dns_findclassname(optarg)) < 0) - die(0, "unrecognized query class `%s'", optarg); - qcls = i; - break; - case 'a': - qtyp = DNS_T_ANY; - ++verbose; - break; - case 'n': - if (nns >= DNS_MAXSERV) - die(0, "too many nameservers, %d max", DNS_MAXSERV); - ns[nns++] = optarg; - break; - case 'o': - if (dns_set_opts(NULL, optarg) != 0) - die(0, "invalid option string: `%s'", optarg); - break; - case 'h': - printf( -"%s: simple DNS query tool (using udns version %s)\n" -"Usage: %s [options] domain-name...\n" -"where options are:\n" -" -h - print this help and exit\n" -" -v - be more verbose\n" -" -q - be less verbose\n" -" -t type - set query type (A, AA, PTR etc)\n" -" -c class - set query class (IN (default), CH, HS, *)\n" -" -a - equivalent to -t ANY -v\n" -" -n ns - use given nameserver(s) instead of default\n" -" (may be specified multiple times)\n" -" -o option:value - set resovler option (the same as setting $RES_OPTIONS):\n" -" timeout:sec - initial query timeout\n" -" attempts:num - number of attempt to resovle a query\n" -" ndots:num - if name has more than num dots, lookup it before search\n" -" port:num - port number for queries instead of default 53\n" -" udpbuf:num - size of UDP buffer (use EDNS0 if >512)\n" -" (may be specified more than once)\n" - , progname, dns_version(), progname); - return 0; - default: - die(0, "try `%s -h' for help", progname); - } - - argc -= optind; argv += optind; - if (!argc) - die(0, "no name(s) to query specified"); - - if (nns) { - /* if nameservers given as names, resolve them. - * We only allow IPv4 nameservers as names for now. - * Ok, it is easy enouth to try both AAAA and A, - * but the question is what to do by default. - */ - struct sockaddr_in sin; - int j, r = 0, opened = 0; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_port = htons(dns_set_opt(NULL, DNS_OPT_PORT, -1)); - dns_add_serv(NULL, NULL); - for(i = 0; i < nns; ++i) { - if (!inet_aton(ns[i], &sin.sin_addr)) { - struct dns_rr_a4 *rr; - if (!opened) { - if (dns_open(nctx) < 0) - die(errno, "unable to initialize dns context"); - opened = 1; - } - rr = dns_resolve_a4(nctx, ns[i], 0); - if (!rr) - die(0, "unable to resolve nameserver %s: %s", - ns[i], dns_strerror(dns_status(nctx))); - for(j = 0; j < rr->dnsa4_nrr; ++j) { - sin.sin_addr = rr->dnsa4_addr[j]; - if ((r = dns_add_serv_s(NULL, (struct sockaddr *)&sin)) < 0) - break; - } - free(rr); - } - else - r = dns_add_serv_s(NULL, (struct sockaddr *)&sin); - if (r < 0) - die(errno, "unable to add nameserver %s", inet_ntoa(sin.sin_addr)); - } - } - dns_free(nctx); - - fd = dns_open(NULL); - if (fd < 0) - die(errno, "unable to initialize dns context"); - - if (verbose > 1) - dns_set_dbgfn(NULL, dbgcb); - - for (i = 0; i < argc; ++i) { - char *name = argv[i]; - union { - struct in_addr addr; - struct in6_addr addr6; - } a; - unsigned char dn[DNS_MAXDN]; - enum dns_type l_qtyp = 0; - int abs; - if (inet_pton(AF_INET, name, &a.addr) > 0) { - dns_a4todn(&a.addr, 0, dn, sizeof(dn)); - l_qtyp = DNS_T_PTR; - abs = 1; - } - else if (inet_pton(AF_INET6, name, &a.addr6) > 0) { - dns_a6todn(&a.addr6, 0, dn, sizeof(dn)); - l_qtyp = DNS_T_PTR; - abs = 1; - } - else if (!dns_ptodn(name, strlen(name), dn, sizeof(dn), &abs)) - die(0, "invalid name `%s'\n", name); - else - l_qtyp = DNS_T_A; - if (qtyp) l_qtyp = qtyp; - q = query_new(name, dn, l_qtyp); - if (abs) abs = DNS_NOSRCH; - if (!dns_submit_dn(NULL, dn, qcls, l_qtyp, abs, 0, dnscb, q)) - dnserror(q, dns_status(NULL)); - } - - FD_ZERO(&fds); - now = 0; - while((i = dns_timeouts(NULL, -1, now)) > 0) { - FD_SET(fd, &fds); - tv.tv_sec = i; - tv.tv_usec = 0; - i = select(fd+1, &fds, 0, 0, &tv); - now = time(NULL); - if (i > 0) dns_ioevent(NULL, now); - } - - return errors ? 1 : notfound ? 100 : 0; -} diff --git a/libs/udns/ex-rdns.c b/libs/udns/ex-rdns.c deleted file mode 100644 index bc705c74d7..0000000000 --- a/libs/udns/ex-rdns.c +++ /dev/null @@ -1,111 +0,0 @@ -/* $Id: ex-rdns.c,v 1.6 2005/05/07 12:21:42 mjt Exp $ - parallel rDNS resolver example - read IP addresses from stdin, - write domain names to stdout - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "udns.h" - -static int curq; - -static const char *n2ip(const unsigned char *c) { - static char b[sizeof("255.255.255.255")]; - sprintf(b, "%u.%u.%u.%u", c[0], c[1], c[2], c[3]); - return b; -} -static void dnscb(struct dns_ctx *ctx, struct dns_rr_ptr *rr, void *data) { - const char *ip = n2ip((unsigned char *)&data); - int i; - --curq; - if (rr) { - printf("%s", ip); - for(i = 0; i < rr->dnsptr_nrr; ++i) - printf(" %s", rr->dnsptr_ptr[i]); - putchar('\n'); - free(rr); - } - else - fprintf(stderr, "%s: %s\n", ip, dns_strerror(dns_status(ctx))); -} - -int main(int argc, char **argv) { - int c, t; - time_t now; - int maxq = 10; - struct pollfd pfd; - char linebuf[1024]; - char *eol; - int eof; - - if (dns_init(1) < 0) return 1; - while((c = getopt(argc, argv, "m:r")) != EOF) switch(c) { - case 'm': maxq = atoi(optarg); break; - case 'r': - dns_set_opt(0, DNS_OPT_FLAGS, - dns_set_opt(0, DNS_OPT_FLAGS, -1) | DNS_NORD); - break; - default: return 1; - } - if (argc != optind) return 1; - - pfd.fd = dns_sock(0); - pfd.events = POLLIN; - now = time(NULL); - c = optind; - eof = 0; - while(curq || !eof) { - if (!eof && curq < maxq) { - union { struct in_addr a; void *p; } pa; - if (!fgets(linebuf, sizeof(linebuf), stdin)) { - eof = 1; - continue; - } - eol = strchr(linebuf, '\n'); - if (eol) *eol = '\0'; - if (!linebuf[0]) continue; - if (!inet_aton(linebuf, &pa.a)) - fprintf(stderr, "%s: invalid address\n", linebuf); - else if (dns_submit_a4ptr(0, &pa.a, dnscb, pa.p) == 0) - fprintf(stderr, "%s: unable to submit query: %s\n", - linebuf, dns_strerror(dns_status(0))); - else - ++curq; - continue; - } - if (curq) { - t = dns_timeouts(0, -1, now); - t = poll(&pfd, 1, c * 1000); - now = time(NULL); - if (t) dns_ioevent(0, now); - } - } - return 0; -} diff --git a/libs/udns/inet_pton.c b/libs/udns/inet_pton.c deleted file mode 100644 index 654357adb0..0000000000 --- a/libs/udns/inet_pton.c +++ /dev/null @@ -1,240 +0,0 @@ -/* This is from the BIND 4.9.4 release, modified to compile by itself */ - -/* Copyright (c) 1996 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 HAVE_INET_PTON - -#ifdef HAVE_SYS_PARAM_H -#include -#endif -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#include -#include - -#include "inet_pton.h" - -#define IN6ADDRSZ 16 -#define INADDRSZ 4 -#define INT16SZ 2 - -#ifdef WIN32 -#include -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#endif - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static int inet_pton4(const char *src, unsigned char *dst); -#ifdef ENABLE_IPV6 -static int inet_pton6(const char *src, unsigned char *dst); -#endif - -/* int - * inet_pton(af, src, dst) - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * return: - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * author: - * Paul Vixie, 1996. - */ -int -udns_inet_pton(int af, const char *src, void *dst) -{ - switch (af) { - case AF_INET: - return (inet_pton4(src, (unsigned char *)dst)); -#ifdef ENABLE_IPV6 -#ifndef AF_INET6 -#define AF_INET6 (AF_MAX+1) /* just to let this compile */ -#endif - case AF_INET6: - return (inet_pton6(src, (unsigned char *)dst)); -#endif - default: - errno = EAFNOSUPPORT; - return (-1); - } - /* NOTREACHED */ -} - -/* int - * inet_pton4(src, dst) - * like inet_aton() but without all the hexadecimal and shorthand. - * return: - * 1 if `src' is a valid dotted quad, else 0. - * notice: - * does not touch `dst' unless it's returning 1. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton4(const char *src, unsigned char *dst) -{ - static const char digits[] = "0123456789"; - int saw_digit, octets, ch; - unsigned char tmp[INADDRSZ], *tp; - - saw_digit = 0; - octets = 0; - tp = tmp; - *tp = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr(digits, ch)) != NULL) { - unsigned int val = *tp * 10 + (unsigned int)(pch - digits); - - if (val > 255) - return (0); - *tp = val; - if (! saw_digit) { - if (++octets > 4) - return (0); - saw_digit = 1; - } - } else if (ch == '.' && saw_digit) { - if (octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } else - return (0); - } - if (octets < 4) - return (0); - /* bcopy(tmp, dst, INADDRSZ); */ - memcpy(dst, tmp, INADDRSZ); - return (1); -} - -#ifdef ENABLE_IPV6 -/* int - * inet_pton6(src, dst) - * convert presentation level address to network order binary form. - * return: - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. - * credit: - * inspired by Mark Andrews. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton6(const char *src, unsigned char *dst) -{ - static const char xdigits_l[] = "0123456789abcdef", - xdigits_u[] = "0123456789ABCDEF"; - unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, saw_xdigit; - unsigned int val; - - memset((tp = tmp), 0, IN6ADDRSZ); - endp = tp + IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - if (pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - if (val > 0xffff) - return (0); - saw_xdigit = 1; - continue; - } - if (ch == ':') { - curtok = src; - if (!saw_xdigit) { - if (colonp) - return (0); - colonp = tp; - continue; - } - if (tp + INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + INADDRSZ) <= endp) && - inet_pton4(curtok, tp) > 0) { - tp += INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if (saw_xdigit) { - if (tp + INT16SZ > endp) - return (0); - *tp++ = (unsigned char) (val >> 8) & 0xff; - *tp++ = (unsigned char) val & 0xff; - } - if (colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - for (i = 1; i <= n; i++) { - endp[- i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); - /* bcopy(tmp, dst, IN6ADDRSZ); */ - memcpy(dst, tmp, IN6ADDRSZ); - return (1); -} -#endif /* ENABLE_IPV6 */ - -#endif /* HAVE_INET_PTON */ diff --git a/libs/udns/inet_pton.h b/libs/udns/inet_pton.h deleted file mode 100644 index ec4558fa67..0000000000 --- a/libs/udns/inet_pton.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef __INET_PTON_H -#define __INET_PTON_H -/*************************************************************************** - * _ _ ____ _ - * Project ___| | | | _ \| | - * / __| | | | |_) | | - * | (__| |_| | _ <| |___ - * \___|\___/|_| \_\_____| - * - * Copyright (C) 1998 - 2005, Daniel Stenberg, , et al. - * - * This software is licensed as described in the file COPYING, which - * you should have received as part of this distribution. The terms - * are also available at http://curl.haxx.se/docs/copyright.html. - * - * You may opt to use, copy, modify, merge, publish, distribute and/or sell - * copies of the Software, and permit persons to whom the Software is - * furnished to do so, under the terms of the COPYING file. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - * $Id: inet_pton.h,v 1.7 2005/11/28 20:21:36 bagder Exp $ - ***************************************************************************/ - -int udns_inet_pton(int, const char *, void *); - -#endif /* __INET_PTON_H */ diff --git a/libs/udns/rblcheck.1 b/libs/udns/rblcheck.1 deleted file mode 100644 index 0e427e4395..0000000000 --- a/libs/udns/rblcheck.1 +++ /dev/null @@ -1,151 +0,0 @@ -.\" $Id: rblcheck.1,v 1.1 2005/04/24 23:14:23 mjt Exp $ -.\" rblckeck manpage -.\" -.\" Copyright (C) 2005 Michael Tokarev -.\" This file is part of UDNS library, an async DNS stub resolver. -.\" -.\" This library is free software; you can redistribute it and/or -.\" modify it under the terms of the GNU Lesser General Public -.\" License as published by the Free Software Foundation; either -.\" version 2.1 of the License, or (at your option) any later version. -.\" -.\" This library 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 -.\" Lesser General Public License for more details. -.\" -.\" You should have received a copy of the GNU Lesser General Public -.\" License along with this library, in file named COPYING.LGPL; if not, -.\" write to the Free Software Foundation, Inc., 59 Temple Place, -.\" Suite 330, Boston, MA 02111-1307 USA - -.TH rblckeck 1 "Apr 2005" "User Utilities" - -.SH NAME -rblckeck \- DNSBL lookup utility - -.SH SYNOPSYS -.B rblcheck -.RB [\| \-s -.IR zone \|] -.RB [\| \-S -.IR zone\-file \|] -.RB [\| \-c \|] -.RB [\| \-tmvq \|] -.RB [\| \-n -.IR nsaddr \|] -.IR address \|.\|.\|. - -.SH DESCRIPTION -.B rblcheck -is a simple command-line to perform DNSBL (DNS-based blocklists) lookups. -For every IP address (or a name, in which case it will be resolved to an -address first), the utility verifies whenever it is listed in a (list of) -DNS blocklists specified with -.B \-s -or -.B \-S -options, optionally obtains text assotiated with the listing (usually it -is either some description about the reason of the listing or an URL -referring to such a description), and displays results on standard output. -.PP -The program is implemented on top of -.BR udns (3) -library. - -.SH OPTIONS - -The following options are recognized by -.BR rblcheck : - -.TP -.B \-s \fIzone\fR -add the given \fIzone\fR DNSBL name to the list of active zones. -.TP -.B \-S \fIzone-file\fR -add list of zones from the named \fIzone-file\fR to the list of -active zones (the file specifies one zone as the first word on a -line, empty lines and lines starting with `#' character are ignored). -.TP -.B \-c -reset active zone list. -.TP -.B \-v -be more verbose, produce more detailed output. -.TP -.B \-q -the opposite for \fB\-v\fR -- produce less detailed output. -.TP -.B \-t -obtain text for listed addresses. -.TP -.B \-n \fInsaddr\fR -Use the given nameserver (given as IPv4 or IPv6 address) instead of the -default. The same effect may be achieved by setting $NSCACHEIP environment -variable. -.TP -.B \-m -stop after first hit, ie after the first address which is found to be -listed. - -.TP -.B \-h -print short help and exit. - -.PP -If no -.BR \-s , -.BR \-S -and -.B \-c -options are given, -.B rblcheck -will try to obtain list of zones using $RBLCHECK_ZONES environment variable, -or ~/.rblcheckrc, or /etc/rblckechrc files, in that order. If no zones are -found, it will exit unsuccessefully. - -.SH "RETURN VALUE" -When no addresses given are listed and no errors occured, -.B rblcheck -exits with code 0. If at least one address is listed, -.B rblcheck -returns 100. In case of DNS errors, -.B rblcheck -returns 2. - -.SH ENVIRONMENT - -.TP -.B $RBLCHECK_ZONES -if no -.BR \-s , -.B \-S -or -.B \-c -option is given, -.B rblcheck -tries this variable to obtain list of DNSBL zones to check against. - -.SH FILES - -.TP -$HOME/.rblcheckrc and /etc/rblcheckrc -if no -.BR \-s , -.B \-S -or -.B \-c -option is given, and no $RBLCHECK_ZONES environment variable is set, -.B rblcheck -will try the two files (the first one that exists) to obtain list of -DNSBL zones to check against. -Each line specifies one zone (only first word in each line is used). -Empty lines and lines starting with `#' character are ignored. - -.SH "SEE ALSO" -.BR dnsget (1) -.BR resolv.conf (5) -.BR udns (3). - -.SH AUTHOR -This program and manual pages are written by Michael Tokarev. diff --git a/libs/udns/rblcheck.c b/libs/udns/rblcheck.c deleted file mode 100644 index 77bc1bfd7f..0000000000 --- a/libs/udns/rblcheck.c +++ /dev/null @@ -1,364 +0,0 @@ -/* $Id: rblcheck.c,v 1.9 2005/04/24 22:49:10 mjt Exp $ - dnsbl (rbl) checker application - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "udns.h" - -static const char *version = "udns-rblcheck 0.1"; -static char *progname; - -struct rblookup { - struct ipcheck *parent; - struct in_addr key; - const char *zone; - struct dns_rr_a4 *addr; - struct dns_rr_txt *txt; -}; - -struct ipcheck { - const char *name; - int naddr; - int listed; - struct rblookup *lookup; -}; - -#define notlisted ((void*)1) - -static int nzones, nzalloc; -static const char **zones; - -static int do_txt; -static int stopfirst; -static int verbose = 1; -/* verbosity level: - * <0 - only bare As/TXTs - * 0 - what RBL result - * 1(default) - what is listed by RBL: result - * 2 - what is[not ]listed by RBL: result, name lookups - */ - -static int listed; -static int failures; - -static void *ecalloc(int size, int cnt) { - void *t = calloc(size, cnt); - if (!t) { - fprintf(stderr, "%s: out of memory\n", progname); - exit(1); - } - return t; -} - -static void addzone(const char *zone) { - if (nzones >= nzalloc) { - const char **zs = (const char**)ecalloc(sizeof(char*), (nzalloc += 16)); - if (zones) { - memcpy(zs, zones, nzones * sizeof(char*)); - free(zones); - } - zones = zs; - } - zones[nzones++] = zone; -} - -static int addzonefile(const char *fname) { - FILE *f = fopen(fname, "r"); - char linebuf[2048]; - if (!f) - return 0; - while(fgets(linebuf, sizeof(linebuf), f)) { - char *p = linebuf, *e; - while(*p == ' ' || *p == '\t') ++p; - if (*p == '#' || *p == '\n') continue; - e = p; - while(*e && *e != ' ' && *e != '\t' && *e != '\n') - ++e; - *e = '\0'; - addzone(p); - } - fclose(f); - return 1; -} - -static void dnserror(struct rblookup *ipl, const char *what) { - fprintf(stderr, "%s: unable to %s for %s (%s): %s\n", - progname, what, inet_ntoa(ipl->key), ipl->zone, - dns_strerror(dns_status(0))); - ++failures; -} - -static void display_result(struct ipcheck *ipc) { - int j; - struct rblookup *l, *le; - if (!ipc->naddr) return; - for (l = ipc->lookup, le = l + nzones * ipc->naddr; l < le; ++l) { - if (!l->addr) continue; - if (verbose < 2 && l->addr == notlisted) continue; - if (verbose >= 0) { - if (ipc->name) printf("%s[%s]", ipc->name, inet_ntoa(l->key)); - else printf("%s", inet_ntoa(l->key)); - } - if (l->addr == notlisted) { - printf(" is NOT listed by %s\n", l->zone); - continue; - } - else if (verbose >= 1) - printf(" is listed by %s: ", l->zone); - else if (verbose >= 0) - printf(" %s ", l->zone); - if (verbose >= 1 || !do_txt) - for (j = 0; j < l->addr->dnsa4_nrr; ++j) - printf("%s%s", j ? " " : "", inet_ntoa(l->addr->dnsa4_addr[j])); - if (!do_txt) ; - else if (l->txt) { - for(j = 0; j < l->txt->dnstxt_nrr; ++j) { - unsigned char *t = l->txt->dnstxt_txt[j].txt; - unsigned char *e = t + l->txt->dnstxt_txt[j].len; - printf("%s\"", verbose > 0 ? "\n\t" : j ? " " : ""); - while(t < e) { - if (*t < ' ' || *t >= 127) printf("\\x%02x", *t); - else if (*t == '\\' || *t == '"') printf("\\%c", *t); - else putchar(*t); - ++t; - } - putchar('"'); - } - free(l->txt); - } - else - printf("%s", verbose > 0 ? "\n\t" : ""); - free(l->addr); - putchar('\n'); - } - free(ipc->lookup); -} - -static void txtcb(struct dns_ctx *ctx, struct dns_rr_txt *r, void *data) { - struct rblookup *ipl = data; - if (r) { - ipl->txt = r; - ++ipl->parent->listed; - } - else if (dns_status(ctx) != DNS_E_NXDOMAIN) - dnserror(ipl, "lookup DNSBL TXT record"); -} - -static void a4cb(struct dns_ctx *ctx, struct dns_rr_a4 *r, void *data) { - struct rblookup *ipl = data; - if (r) { - ipl->addr = r; - ++listed; - if (do_txt) { - if (dns_submit_a4dnsbl_txt(0, &ipl->key, ipl->zone, txtcb, ipl)) - return; - dnserror(ipl, "submit DNSBL TXT record"); - } - ++ipl->parent->listed; - } - else if (dns_status(ctx) != DNS_E_NXDOMAIN) - dnserror(ipl, "lookup DNSBL A record"); - else - ipl->addr = notlisted; -} - -static int -submit_a_queries(struct ipcheck *ipc, - int naddr, const struct in_addr *addr) { - int z, a; - struct rblookup *rl = ecalloc(sizeof(*rl), nzones * naddr); - ipc->lookup = rl; - ipc->naddr = naddr; - for(a = 0; a < naddr; ++a) { - for(z = 0; z < nzones; ++z) { - rl->key = addr[a]; - rl->zone = zones[z]; - rl->parent = ipc; - if (!dns_submit_a4dnsbl(0, &rl->key, rl->zone, a4cb, rl)) - dnserror(rl, "submit DNSBL A query"); - ++rl; - } - } - return 0; -} - -static void namecb(struct dns_ctx *ctx, struct dns_rr_a4 *rr, void *data) { - struct ipcheck *ipc = data; - if (rr) { - submit_a_queries(ipc, rr->dnsa4_nrr, rr->dnsa4_addr); - free(rr); - } - else - fprintf(stderr, "%s: unable to lookup %s: %s\n", - progname, ipc->name, dns_strerror(dns_status(ctx))); -} - -static int submit(struct ipcheck *ipc) { - struct in_addr addr; - if (inet_aton(ipc->name, &addr)) { - submit_a_queries(ipc, 1, &addr); - ipc->name = NULL; - } - else if (!dns_submit_a4(0, ipc->name, 0, namecb, ipc)) - fprintf(stderr, "%s: unable to submit name query for %s: %s\n", - progname, ipc->name, dns_strerror(dns_status(0))); - return 0; -} - -static void waitdns(struct ipcheck *ipc) { - struct timeval tv; - fd_set fds; - int c; - int fd = dns_sock(NULL); - time_t now = 0; - FD_ZERO(&fds); - while((c = dns_timeouts(NULL, -1, now)) > 0) { - FD_SET(fd, &fds); - tv.tv_sec = c; - tv.tv_usec = 0; - c = select(fd+1, &fds, NULL, NULL, &tv); - now = time(NULL); - if (c > 0) - dns_ioevent(NULL, now); - if (stopfirst && ipc->listed) - break; - } -} - -int main(int argc, char **argv) { - int c; - struct ipcheck ipc; - char *nameserver = NULL; - int zgiven = 0; - - if (!(progname = strrchr(argv[0], '/'))) progname = argv[0]; - else argv[0] = ++progname; - - while((c = getopt(argc, argv, "hqtvms:S:cn:")) != EOF) switch(c) { - case 's': ++zgiven; addzone(optarg); break; - case 'S': - ++zgiven; - if (addzonefile(optarg)) break; - fprintf(stderr, "%s: unable to read %s\n", progname, optarg); - return 1; - case 'c': ++zgiven; nzones = 0; break; - case 'q': --verbose; break; - case 'v': ++verbose; break; - case 't': do_txt = 1; break; - case 'n': nameserver = optarg; break; - case 'm': ++stopfirst; break; - case 'h': - printf("%s: %s.\n", progname, version); - printf("Usage is: %s [options] address..\n", progname); - printf( -"Where options are:\n" -" -h - print this help and exit\n" -" -s service - add the service (DNSBL zone) to the serice list\n" -" -S service-file - add the DNSBL zone(s) read from the given file\n" -" -c - clear service list\n" -" -v - increase verbosity level (more -vs => more verbose)\n" -" -q - decrease verbosity level (opposite of -v)\n" -" -t - obtain and print TXT records if any\n" -" -m - stop checking after first address match in any list\n" -" -n ipaddr - use the given nameserver instead of the default\n" -"(if no -s or -S option is given, use $RBLCHECK_ZONES, ~/.rblcheckrc\n" -"or /etc/rblcheckrc in that order)\n" - ); - return 0; - default: - fprintf(stderr, "%s: use `%s -h' for help\n", progname, progname); - return 1; - } - - if (!zgiven) { - char *s = getenv("RBLCHECK_ZONES"); - if (s) { - char *k; - s = strdup(s); - k = strtok(s, " \t"); - while(k) { - addzone(k); - k = strtok(NULL, " \t"); - } - free(s); - } - else { - char *path; - char *home = getenv("HOME"); - if (!home) home = "."; - path = malloc(strlen(home) + 1 + sizeof(".rblcheckrc")); - sprintf(path, "%s/.rblcheckrc", home); - if (!addzonefile(path)) - addzonefile("/etc/rblcheckrc"); - free(path); - } - } - if (!nzones) { - fprintf(stderr, "%s: no service (zone) list specified (-s or -S option)\n", - progname); - return 1; - } - - argv += optind; - argc -= optind; - - if (!argc) - return 0; - - if (dns_init(0) < 0) { - fprintf(stderr, "%s: unable to initialize DNS library: %s\n", - progname, strerror(errno)); - return 1; - } - if (nameserver) { - dns_add_serv(NULL, NULL); - if (dns_add_serv(NULL, nameserver) < 0) - fprintf(stderr, "%s: unable to use nameserver %s: %s\n", - progname, nameserver, strerror(errno)); - } - if (dns_open(NULL) < 0) { - fprintf(stderr, "%s: unable to initialize DNS library: %s\n", - progname, strerror(errno)); - return 1; - } - - for (c = 0; c < argc; ++c) { - if (c && (verbose > 1 || (verbose == 1 && do_txt))) putchar('\n'); - ipc.name = argv[c]; - submit(&ipc); - waitdns(&ipc); - display_result(&ipc); - if (stopfirst > 1 && listed) break; - } - - return listed ? 100 : failures ? 2 : 0; -} diff --git a/libs/udns/udns.3 b/libs/udns/udns.3 deleted file mode 100644 index 06d2a146c4..0000000000 --- a/libs/udns/udns.3 +++ /dev/null @@ -1,1284 +0,0 @@ -.\" $Id: udns.3,v 1.26 2006/11/28 22:58:04 mjt Exp $ -.\" udns library manpage -.\" -.\" Copyright (C) 2005 Michael Tokarev -.\" This file is part of UDNS library, an async DNS stub resolver. -.\" -.\" This library is free software; you can redistribute it and/or -.\" modify it under the terms of the GNU Lesser General Public -.\" License as published by the Free Software Foundation; either -.\" version 2.1 of the License, or (at your option) any later version. -.\" -.\" This library 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 -.\" Lesser General Public License for more details. -.\" -.\" You should have received a copy of the GNU Lesser General Public -.\" License along with this library, in file named COPYING.LGPL; if not, -.\" write to the Free Software Foundation, Inc., 59 Temple Place, -.\" Suite 330, Boston, MA 02111-1307 USA - -.TH udns 3 "Apr 2005" "Library Functions" - -.SH NAME -udns \- stub DNS resolver library - -.SH SYNOPSYS -.nf -#include -struct \fBdns_ctx\fR; -struct \fBdns_query\fR; -extern struct dns_ctx \fBdns_defctx\fR; -struct dns_ctx *\fIctx\fR; -typedef void \fBdns_query_fn\fR(\fIctx\fR, void *\fIresult\fR, void *\fIdata\fR); -typedef int -\fBdns_parse_fn\fR(const unsigned char *\fIqnd\fR, - const unsigned char *\fIpkt\fR, - const unsigned char *\fIcur\fR, - const unsigned char *\fIend\fR, - void **\fIresultp\fR); - -\fBcc\fR ... -l\fBudns\fR -.fi - -.SH DESCRIPTION - -.PP -The DNS library, \fBudns\fR, implements thread-safe stub DNS resolver -functionality, which may be used both traditional, syncronous way -and asyncronously, with application-supplied event loop. - -.PP -While DNS works with both TCP and UDP, performing UDP query first and -if the result does not fit in UDP buffer (512 bytes max for original -DNS protocol), retrying the query over TCP, the library uses UDP only, -but uses EDNS0 (RFC2671) extensions which allows larger UDP buffers. - -.PP -The library uses single UDP socket to perform all operations even when -asking multiple nameservers. This way, it is very simple to use the -library in asyncronous event-loop applications: an application should -add only single socket to the set of filedescriptors it monitors for I/O. - -.PP -The library uses two main objects, \fIresolver context\fR of type -\fBstruct\ dns_ctx\fR, and \fIquery structure\fR of type -\fBstruct\ dns_query\fR, both are opaque for an application. -Resolver context holds global information about the resolver, -such as list of nameservers to use, list of active requests and the like. -Query objects holds information about a single DNS query in progress and -are allocated/processed/freed by the library. Pointer to query structure -may be treated as an identifier of an in-progress query and may be used -to cancel the asyncronous query or to wait for it to complete. - -.PP -Asyncronous interface works as follows. An application initializes -resolver context, submits any number of queries for it using one of -supplied \fBdns_submit_\fIXXX\fR() routines (each return the query -identifier as pointer to query structure), waits for input on the -UDP socket used by the library, and gives some control to the library -by calling \fBdns_ioevent\fR() and \fBdns_timeouts\fR() routines when -appropriate. The library performs all necessary processing and executes -application supplied callback routine when a query completes (either -successefully or not), giving it the result if any, pointer to the -resolver context (from which completion status may be obtained), and -the data pointer supplied by an application when the query has been -submitted. When submitting a query, an application requests how to -handle the reply -- to either return raw DNS reply packet for its -own low-level processing, or it may provide an address of \fIparsing -routine\fR of type \fBdns_parse_fn\fR to perform conversion of on-wire -format into easy to use data structure (the library provides parsing -routines for several commonly used resource record types, as well as -type-safe higher-level inteface that requests parsing automatically). -The I/O monitoring and timeout handling may be either traditional -select() or poll() based, or any callback-driven technique may be -used. - -.PP -Additionally, the library provides traditional syncronous interface, -which may be intermixed with asyncronous calls (during syncronous -query processing, other asyncronous queries for the same resolver -context continued to be processed as usual). An application uses -one of numerous \fBdns_resolve_\fIXXX\fR() routines provided by the -library to perform a query. As with asyncronous interface, an -application may either request to return raw DNS packet or type-specific -data structure by providing the parsing routine to handle the reply. -Every routine from \fBdns_resolve_\fIXXX\fR() series return pointer -to result or NULL in case of any error. Query completion status -(or length of the raw DNS packet) is available from the resolver -context using \fBdns_status\fR() routine, the same way as for the -asyncronous interface. - -.PP -Internally, library uses on-wire format of domain names, referred -to as \fIDN format\fR in this manual page. This is a series of domain -\fIlabels\fR whith preceeding length byte, terminated by zero-length -label wich is integral part of the DN format. There are several routines -provided to convert from traditional asciiz string to DN and back. -Higher-level type-specific query interface hides the DN format from -an application. - -.SH "COMMON DEFINITIONS" - -.PP -Every DNS Resource Record (RR) has a \fItype\fR and a \fIclass\fR. -The library defines several integer constants, \fBDNS_C_\fIXXX\fR and -\fBDNS_T_\fIXXX\fR, to use as symbolic names for RR classes and types, -such as \fBDNS_C_IN\fR for Internet class, \fBDNS_T_A\fR for IPv4 -address record type and so on. See udns.h header file for complete list -of all such constants. - -.PP -The following constants are defined in dns.h header file: -.IP "\fBDNS_MAXDN\fR (255 bytes)" -Maximum length of the domain name in internal (on-wire) DN format. -.IP "\fBDNS_MAXLABEL\fR (63 bytes)" -Maximum length of a single label in DN format. -.IP "\fBDNS_MAXNAME\fR (1024 bytes)" -Maximum length of asciiz format of a domain name. -.IP "\fBDNS_HSIZE\fR (12 bytes)" -Size of header in DNS packet. -.IP "\fBDNS_PORT\fR (53)" -Default port to use when contacting a DNS server. -.IP "\fBDNS_MAXSERV\fR (6 servers)" -Maximum number of DNS servers to use. -.IP "\fBDNS_MAXSRCH\fR (5 search list entries)" -Maximum number of domain search list -.IP "\fBDNS_MAXPACKET\fR (512 bytes)" -Maximum length of DNS UDP packet as specified by original DNS protocol -.IP "\fBDNS_EDNS0PACKET\fR (4096 bytes)" -Default length of DNS UDP packet (with EDNS0 extensions) the library uses. -Note that recursive nameservers usually resides near the client asking them -to resolve names, e.g. on the same LAN segment or even on the same host, so -UDP packet fragmentation isn't a problem in most cases. Note also that -the size of actual packets will be as many bytes as actual reply size requires, -which is smaller than this value in almost all cases. - -.PP -Additionally, several constants are defined to simplify work with raw DNS -packets, such as DNS response codes (\fBDNS_R_\fIXXX\fR), DNS header layout -(\fBDNS_H_\fIXXX\fR) and others. Again, see udns.h for complete list. -Library error codes (\fBDNS_E_\fIXXX\fR) are described later in this -manual page. - -.SH "RESOLVER CONTEXT" - -.PP -Resolver context, of type \fBstruct\ dns_ctx\fR, is an object which is -opaque to an application. Several routines provided by the library -to initialize, copy and free resolver contexts. Most other high-level -routines in this library expects a pointer to resolver context, \fIctx\fR, -as the first argument. There is a default resolver context available, -named \fBdns_defctx\fR. When the context pointer \fIctx\fR passed to -a routine is NULL, \fBdns_defctx\fR is used. Several resolver contexts -may be active at the same time, for example, when an application is -multi-threaded and each thread uses resolver. -.PP -When initializing resolver context, the library uses information from -system file /etc/resolv.conf (see \fBresolv.conf\fR(5)), consults -environment variables \fB$LOCALDOMAIN\fR, \fB$DNSCACHEIP\fR, -\fB$NAMESERVERS\fR and \fB$RES_OPTIONS\fR, and local host name to obtain -list of local nameservers, domain name search list and various resolver -options. -.PP -The following routines to initialize resolver context are available: -.PP -.nf -int \fBdns_init\fR(int \fIdo_open\fR) -struct dns_ctx *\fBdns_new\fR(struct dns_ctx *\fIcopy\fR) -void \fBdns_free\fR(\fIctx\fR) -.fi -.RS -\fBdns_init\fR() initializes default resolver context, \fBdns_defctx\fR, -and optionally opens it (if \fIdo_open\fR is true) using \fBdns_open\fR(), -returning negative value on error. -\fBdns_new\fR() makes a copy of a given resolver context \fIcopy\fR, or -default context if \fIcopy\fR is NULL, and returns pointer to it. -\fBdns_new\fR() may fail if there's no memory available to make a copy -of \fIcopy\fR, in which case the routine will return NULL pointer. -\fBdns_free\fR() is used to close assotiated socket and free resolver -context resources and cancelling (abandoming) all active queries -assotiated with it. It's ok to free \fBdns_defctx\fR as well as -dynamically allocated contexts returned by \fBdns_new\fR(). -.RE -.PP -.nf -int \fBdns_add_serv\fR(\fIctx\fR, const char *\fIserv\fR) -int \fBdns_add_serv_s\fR(\fIctx\fR, const struct sockaddr *\fIsa\fR) -int \fBdns_add_srch\fR(\fIctx\fR, const char *\fIsrch\fR) -.fi -.RS -Add an element to list of nameservers (\fBdns_add_serv\fR(), as -asciiz-string \fIserv\fR with an IP address of the nameserver, -and \fBdns_add_serv_s\fR(), as initialized socket address \fIsa\fR), -or search list (\fBdns_add_srch\fR(), as a pointer to domain name) -for the given context \fIctx\fR. If the last argument is a NULL -pointer, the corresponding list (search or nameserver) is reset -instead. Upon successeful completion, each routine returns new -number of elements in the list in question. On error, negative -value is returned and global variable \fBerrno\fR is set appropriately. -It is an error to call any of this functions if the context is -opened (after \fBdns_open\fR() or \fBdns_init\fR() with non-zero argument). -.RE -.PP -.nf -int \fBdns_set_opts\fR(\fIctx\fR, const char *\fIopts\fR) -.fi -.RS -set resolver context options from \fIopts\fR string, in the same way as -processing \fBoptions\fR statement in resolv.conf and \fB$RES_OPTIONS\fR -environment variable. -.RE -.PP -.nf -void \fBdns_set_opt\fR(\fIctx\fR, int \fIopt\fR, \fIval\fR) -.fi -.RS -.B TODO -The \fIflags\fR argument is a bitmask with the following bits defined: -.IP \fBDNS_NOSRCH\fR -do not perform domain name search in search list. -.IP \fBDNS_NORD\fR -do not request recursion when performing queries -(i.e. don't set RD flag in querues). -.IP \fBDNS_AAONLY\fR -request authoritative answers only (i.e. set AA -flag in queries). -.RE - -.PP -.nf -int \fBdns_open\fR(\fIctx\fR) -int \fBdns_sock\fR(const \fIctx\fR) -void \fBdns_close\fR(\fIctx\fR) -.fi -.RS -\fBdns_open\fR() opens the UDP socket used for queries if not already -open, and return assotiated filedescriptor (or negative value in case -of error). -\fBdns_sock\fR() return the UDP socket if open, or -1 if not. -\fBdns_close\fR() closes the UDP socket if it was open. -.RE - -.PP -.nf -int \fBdns_active\fR(const \fIctx\fR) -.fi -.RS -return number of active queries queued for the given context -\fIctx\fR, or zero if none. -.RE - -.PP -.nf -int \fBdns_status\fR(const \fIctx\fR) -.fi -.RS -return status code from last operation. When using syncronous -interface, this is the query completion status of the last query. -With asyncronous interface, from within the callback routine, -this is the query completion status of the query for which the -callback is being called. When query submission fails, this -is the error code indicating failure reason. All error codes -are negative and are represented by \fBDNS_E_\fIXXX\fR constants -described below. -.RE - -.PP -.nf -void \fBdns_ioevent\fR(\fIctx\fR, time_t \fInow\fR) -.fi -.RS -this routine may be called by an application to process I/O -events on the UDP socket used by the library, as returned -by \fBdns_sock\fR(). The routine tries to receive incoming -UDP datagram from the socket and process it. The socket is -set up to be non-blocking, so it is safe to call the routine -even if there's no data to read. The routine will process -as many datagrams as are queued for the socket, so it is -safe to use it with either level-triggered or edge-triggered -I/O monitoring model. The \fInow\fR argument is either a -current time as returned by \fBtime\fR(), or 0, in which -case the routine will obtain current time by it's own. -.RE - -.PP -.nf -int \fBdns_timeouts\fR(\fIctx\fR, int \fImaxwait\fR, time_t \fInow\fR) -.fi -.RS -process any pending timeouts and return number of secounds -from current time (\fInow\fR if it is not 0) to the time when -the library wants the application to pass it control to process -more queued requests. In case when there are no requests pending, -this time is -1. The routine will not request a time larger than -\fImaxwait\fR secounds if it is greather or equal to zero. If -\fInow\fR is 0, the routine will obtain current time by it's own; -when it is not 0, it should contain current time as returned by -\fBtime\fR(). -.RE - -.PP -.nf -typedef void \fBdns_utm_fn\fR(\fIctx\fR, int \fItimeout\fR, void *\fIdata\fR) -void \fBdns_set_cbck\fR(\fIctx\fR, dns_utm_fn *\fIutmfn\fR, void *\fIdata\fR) -.fi -.RS -An application may use custom callback-based I/O multiplexing mechanism. -Usually such a mechanism have concept of a \fItimer\fR, and an ability -to register a timer event in a form of a callback routine which will -be executed after certain amount of time. In order to use such an -event mechanism, udns provides an ability to register and de-register -timer events necessary for internal processing using whatever event -mechanism an application uses. For this to work, it is possible to -assotiate a pointer to a routine that will perform necessary work for -(de)registering timer events with a given resolver context, and -udns will call that routine at appropriate times. Prototype of -such a routine is shown by \fBdns_utm_fn\fR typedef above. Libudns -assotiates single timer with resolver context. User-supplied \fIutmfn\fR -routine will be called by the library with the following arguments: -.IP "\fIctx\fR == NULL" -delete user timer, at context free time or when an application changes -user timer request routine using \fBdns_set_cbck\fR(); -.IP "\fIctx\fR != NULL, \fItimeout\fR < 0" -don't fire timer anymore, when there are no active requests; -.IP "\fIctx\fR != NULL, \fItimeout\fR == 0" -fire timer at the next possibility, but not immediately; -.IP "\fIctx\fR != NULL, \fItimeout\fR > 0" -fire timer after \fItimeout\fR seconds after now. -.PP -The \fIdata\fR argument passed to the routine will be the same -as passed to \fBdns_set_cbck\fR(). -.PP -When a timer expires, an application should call \fBdns_tmeouts\fR() -routine (see below). Non-callback timer usage is provided too. -.RE - -.PP -.B XXXX TODO: some more resolver context routines, like dns_set_dbgfn() etc. - -.SH "QUERY INTERFACE" - -.PP -There are two ways to perform DNS queries: traditional syncronous -way, when udns performs all the necessary processing and return -control to the application only when the query completes, and -asyncronous way, when an application submits one or more queries -to the library using given resolver context, and waits for completion -by monitoring filedescriptor used by library and calling library -routines to process input on that filedescriptor. Asyncronous mode -works with callback routines: an application supplies an address of -a routine to execute when the query completes, and a data pointer, -which is passed to the callback routine. - -.PP -Queries are submitted to the library in a form of \fBstruct\ dns_query\fR. -To perform asyncronous query, an application allocates memory for the -\fIquery structure\fR and passes it to the library using \fBdns_submit\fR() -routines, together with all the query parameters. When the query completes, -library will call application-supplied callback routine, giving it the -resolver context (wich holds query completion status), dynamically allocated -result (which will be either raw DNS packet or, if applicatin requested parsing -the result by specifying non-NULL parse routine, ready-to-use type-specific -structure), and a data pointer provided by an application when it submitted the -query. It is the application who's responsible for freeing the result memory. -.PP -Generic query callback routine looks like this: -.nf -typedef void -\fBdns_query_fn\fR(\fIctx\fR, void *\fIresult\fR, void *\fIdata\fR) -.fi -Type-specific query interface expects similar form of callback -routine with the only difference in type of \fBresult\fR argument, -which will be pointer to specific data structure (decoded reply) -instead of this void pointer to raw DNS packet data. - -.PP -Result parsing routine looks like this: -.nf -typedef int -\fBdns_parse_fn\fR(const unsigned char *\fIqdn\fR, - const unsigned char *\fIpkt\fR, - const unsigned char *\fIcur\fR, - const unsigned char *\fIend\fR, - void **\fIresultp\fR); -.fi -When called by the library, the arguments are as follows: -\fIpkt\fR points to the start of the packet received; -\fIend\fR points past the end of the packet received; -\fIcur\fR points past the query DN in the query section of the -packet; -\fIqdn\fR points to the original query DN. -The routine should allocate a single buffer to hold the result, -parse the reply filling in the buffer, and return the buffer -using \fIresultp\fR argument. It returns 0 in case of error, -or udns error code (\fBDNS_E_\fIXXX\fR constants) in case of -error. -Note that by the time when the parse routine is called by the -library, packet is already verified to be a reply to the -original query, by matching query DN, query class and query type. - -.PP -Type-specific query inteface supplies necessary parsing routines -automatically. - -.PP -In case of error, query completion status as returned by -\fBdns_status\fR(\fIctx\fR), will contain one of the following values: -.IP "positive value" -length of raw DNS packet if parsing is not requested. -.IP 0 -the query was successeful and the \fIreply\fR points to type-specific -data structure. -.IP \fBDNS_E_TEMPFAIL\fR -temporary error, the resolver nameserver was not able to -process our query or timed out. -.IP \fBDNS_E_PROTOCOL\fR -protocol error, a nameserver returned malformed reply. -.IP \fBDNS_E_NXDOMAIN\fR -the domain name does not exist. -.IP \fBDNS_E_NODATA\fR -there is no data of requested type found. -.IP \fBDNS_E_NOMEM\fR -out of memory while processing request. -.IP \fBDNS_E_BADQUERY\fR -some aspect of the query (most common is the domain name in question) -is invalid, and the library can't even start a query. - -.PP -Library provides two series of routines which uses similar interface -- -one for asyncronous queries and another for syncronous queries. There -are two general low-level routines in each series to submit (asyncronous -interface) and resolve (syncronous interface) queries, as well as several -type-specific routines with more easy-to-use interfaces. To submit -an asyncronous query, use one of \fBdns_submit_\fIXXX\fR() routine, each -of which accepts query parameters, pointers to callback routine and to -callback data, and optional current time hint. Note type-specific -\fBdns_submit_\fIXXX\fR() routines expects specific type of the callback -routine as well, which accepts reply as a pointer to corresponding -structure, not a void pointer). Every \fBdns_submit_\fIXXX\fR() routine -return pointer to internal query structure of type struct\ dns_query, -used as an identifier for the given query. - -.PP -To resolve a query syncronously, use one of \fBdns_resolve_\fIXXX\fR() -routines, which accepts the same query parameters (but not the -callback pointers) as corresponding \fBdns_submit_\fIXXX\fR(), and -return the query result, which is the same as passed to the callback -routine in case of asyncronous interface. - -.PP -In either case, the result memory (if the query completed successefully) -is dynamically allocated and should be freed by an application. If -the query failed for any reason, the result will be NULL, and error -status will be available from \fBdns_status\fR(\fIctx\fR) routine -as shown above. - -.PP -.nf -struct dns_query * -\fBdns_submit_dn\fR(\fIctx\fR, - const unsigned char *\fIdn\fR, \fIqcls\fR, \fIqtyp\fR, \fIflags\fR, - \fIparse\fR, \fIcbck\fR, \fIdata\fR) -struct dns_query * -\fBdns_submit_p\fR(\fIctx\fR, - const char *\fIname\fR, \fIqcls\fR, \fIqtyp\fR, \fIflags\fR, - \fIparse\fR, \fIcbck\fR, \fIdata\fR) - enum dns_class \fIqcls\fR; - enum dns_type \fIqtyp\fR; - int \fIflags\fR; - dns_parse_fn *\fIparse\fR; - dns_query_fn *\fIcbck\fR; - void *\fIdata\fR; -.fi -.RS -submit a query for processing for the given resolver context \fIctx\fR. -Two routines differs only in 3rd argument, which is domain name in -DN format (\fIdn\fR) or asciiz string (\fIname\fR). The query will be -performed for the given domain name, with type \fIqtyp\fR in class \fIqcls\fR, -using option bits in \fIflags\fR, using RR parsing routine pointed by -\fIparse\fR if not-NULL, and upon completion, \fIcbck\fR function will -be called with the \fIdata\fR argument. -In case of successeful query submission, -the routine return pointer to internal query structure which may be treated -as an identifier of the query as used by the library, and may be used as an -argument for \fBdns_cancel\fR() routine. In case of error, NULL will be -returned, and context error status (available using \fIdns_status\fR() routine) -will be set to corresponding error code, which in this case may be -DNS_E_BADQUERY if the \fIname\fR of \fIdn\fR is invalid, DNS_E_NOMEM if -there's no memory available to allocate query structure, or DNS_E_TEMPFAIL -if an internal error occured. -.RE - -.PP -.nf -void *\fBdns_resolve_dn\fR(\fIctx\fR, - const unsigned char *\fIdn\fR, \fIqcls\fR, \fIqtyp\fR, \fIflags\fR, \fIparse\fR); -void *\fBdns_resolve_p\fR(\fIctx\fR, - const char *\fIname\fR, \fIqcls\fR, \fIqtyp\fR, \fIflags\fR, \fIparse\fR) - enum dns_class \fIqcls\fR; - enum dns_type \fIqtyp\fR; - int \fIflags\fR; - dns_parse_fn *\fIparse\fR; -.fi -.RS -syncronous interface. The routines perform all the steps necessary to resolve -the given query and return the result. If there's no positive result for any -reason, all the routines return NULL, and set context error status (available -using \fBdns_status\fR() routine) to indicate the error code. If the query -was successeful, context status code will contain either the length of the -raw DNS reply packet if \fIparse\fR argument was NULL (in which case the return -value is pointer to the reply DNS packet), or 0 (in which case the return value -is the result of \fIparse\fR routine). If the query successeful (return value -is not NULL), the memory returned was dynamically allocated by the library -and should be free()d by application after use. -.RE - -.PP -.nf -void *\fBdns_resolve\fR(\fIctx\fR, struct dns_query *\fIq\fR) -.fi -.RS -wait for the given query \fIq\fR, as returned by one of -\fBdns_submit_\fIXXX\fR() routines, for completion, and -return the result. The callback routine will not be called -for this query. After completion, the query identifier \fIq\fI -is not valid. Both \fBdns_resolve_dn\fR() and \fBdns_resolve_p\fR() -are just wrappers around corresponding submit routines and this -\fBdns_resolve\fR() routine. -.RE - -.PP -.nf -void \fBdns_cancel\fR(\fIctx\fR, struct dns_query *\fIq\fR) -.fi -.RS -cancel an active query \fIq\fR, without calling a callback routine. -After completion, the query identifier \fIq\fR is not valid. -.RE - -.SH "TYPE-SPECIFIC QUERIES" - -.PP -In addition to the generic low-level query interface, the library provides -a set of routines to perform specific queries in a type-safe manner, as -well as parsers for several well-known resource record types. The library -implements high-level interface for A, AAAA, PTR, MX and TXT records -and DNSBL and RHSBL functionality. These routines returns specific types -as result of a query, instead of raw DNS packets. The following types -and routines are available. - -.PP -.nf -struct \fBdns_rr_null\fR { - char *\fBdnsn_qname\fR; /* original query name */ - char *\fBdnsn_cname\fR; /* canonical name */ - unsigned \fBdnsn_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnsn_nrr\fR; /* number of records in the set */ -}; -.fi -.PP -NULL RR set, used as a base for all other RR type structures. -Every RR structure as used by the library have four standard -fields as in struct\ \fBdns_rr_null\fR. - -.SS "IN A Queries" -.PP -.nf -struct \fBdns_rr_a4\fR { /* IN A RRset */ - char *\fBdnsa4_qname\fR; /* original query name */ - char *\fBdnsa4_cname\fR; /* canonical name */ - unsigned \fBdnsa4_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnsa4_nrr\fR; /* number of addresses in the set */ - struct in_addr \fBdnsa4_addr\fR[]; /* array of addresses */ -}; -typedef void - \fBdns_query_a4_fn\fR(\fIctx\fR, struct dns_rr_a4 *\fIresult\fR, \fIdata\fR) -dns_parse_fn \fBdns_parse_a4\fB; -struct dns_query * -\fBdns_submit_a4\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR, - dns_query_a4_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_a4 * -\fBdns_resolve_a4\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR); -.fi -.PP -The \fBdns_rr_a4\fR structure holds a result of an \fBIN A\fR query, -which is an array of IPv4 addresses. Callback routine for IN A queries -expected to be of type \fBdns_query_a4_fn\fR, which expects pointer to -\fBdns_rr_a4\fR structure as query result instead of raw DNS packet. -The \fBdns_parse_a4\fR() is used to convert raw DNS reply packet into -\fBdns_rr_a4\fR structure (it is used internally and may be used directly too -with generic query interface). Routines \fBdns_submit_a4\fR() and -\fBdns_resolve_a4\fR() are used to perform A IN queries in a type-safe -manner. The \fIname\fR parameter is the domain name in question, and -\fIflags\fR is query flags bitmask, with one bit, DNS_NOSRCH, of practical -interest (if the \fIname\fR is absolute, that is, it ends up with a dot, -DNS_NOSRCH flag will be set automatically). - -.SS "IN AAAA Queries" -.PP -.nf -struct \fBdns_rr_a6\fR { /* IN AAAA RRset */ - char *\fBdnsa6_qname\fR; /* original query name */ - char *\fBdnsa6_cname\fR; /* canonical name */ - unsigned \fBdnsa6_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnsa6_nrr\fR; /* number of addresses in the set */ - struct in6_addr \fBdnsa6_addr\fR[]; /* array of addresses */ -}; -typedef void - \fBdns_query_a6_fn\fR(\fIctx\fR, struct dns_rr_a6 *\fIresult\fR, \fIdata\fR) -dns_parse_fn \fBdns_parse_a6\fB; -struct dns_query * -\fBdns_submit_a6\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR, - dns_query_a6_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_a6 * -\fBdns_resolve_a6\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR); -.fi -.PP -The \fBdns_rr_a6\fR structure holds a result of an \fBIN AAAA\fR query, -which is an array of IPv6 addresses. Callback routine for IN AAAA queries -expected to be of type \fBdns_query_a6_fn\fR, which expects pointer to -\fBdns_rr_a6\fR structure as query result instead of raw DNS packet. -The \fBdns_parse_a6\fR() is used to convert raw DNS reply packet into -\fBdns_rr_a6\fR structure (it is used internally and may be used directly too -with generic query interface). Routines \fBdns_submit_a6\fR() and -\fBdns_resolve_a6\fR() are used to perform AAAA IN queries in a type-safe -manner. The \fIname\fR parameter is the domain name in question, and -\fIflags\fR is query flags bitmask, with one bit, DNS_NOSRCH, of practical -interest (if the \fIname\fR is absolute, that is, it ends up with a dot, -DNS_NOSRCH flag will be set automatically). - -.SS "IN PTR Queries" -.PP -.nf -struct \fBdns_rr_ptr\fR { /* IN PTR RRset */ - char *\fBdnsptr_qname\fR; /* original query name */ - char *\fBdnsptr_cname\fR; /* canonical name */ - unsigned \fBdnsptr_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnsptr_nrr\fR; /* number of domain name pointers */ - char *\fBdnsptr_ptr\fR[]; /* array of domain name pointers */ -}; -typedef void - \fBdns_query_ptr_fn\fR(\fIctx\fR, struct dns_rr_ptr *\fIresult\fR, \fIdata\fR) -dns_parse_fn \fBdns_parse_ptr\fB; -struct dns_query * -\fBdns_submit_a4ptr\fB(\fIctx\fR, const struct in_addr *\fBaddr\fR, - dns_query_ptr_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_ptr * -\fBdns_resolve_a4ptr\fB(\fIctx\fR, const struct in_addr *\fBaddr\fR); -struct dns_query * -\fBdns_submit_a6ptr\fB(\fIctx\fR, const struct in6_addr *\fBaddr\fR, - dns_query_ptr_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_ptr * -\fBdns_resolve_a6ptr\fB(\fIctx\fR, const struct in6_addr *\fBaddr\fR); -.fi -.PP -The \fBdns_rr_ptr\fR structure holds a result of an IN PTR query, which -is an array of domain name pointers for a given IPv4 or IPv6 address. -Callback routine for IN PTR queries expected to be of type -\fBdns_query_ptr_fn\fR, which expects pointer to \fBdns_rr_ptr\fR -structure as query result instead of raw DNS packet. The \fBdns_parse_ptr\fR() -is used to convert raw DNS reply packet into \fBdns_rr_ptr\fR structure -(it is used internally and may be used directly too with generic query -interface). Routines \fBdns_submit_a4ptr\fR() and \fBdns_resolve_a4ptr\fR() -are used to perform IN PTR queries for IPv4 addresses in a type-safe -manner. Routines \fBdns_submit_a6ptr\fR() and \fBdns_resolve_a6ptr\fR() -are used to perform IN PTR queries for IPv6 addresses. - -.SS "IN MX Queries" -.PP -.nf -struct \fBdns_mx\fR { /* single MX record */ - int \fBpriority\fR; /* priority value of this MX */ - char *\fBname\fR; /* domain name of this MX */ -}; -struct \fBdns_rr_mx\fR { /* IN MX RRset */ - char *\fBdnsmx_qname\fR; /* original query name */ - char *\fBdnsmx_cname\fR; /* canonical name */ - unsigned \fBdnsmx_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnsmx_nrr\fR; /* number of mail exchangers in the set */ - struct dns_mx \fBdnsmx_mx\fR[]; /* array of mail exchangers */ -}; -typedef void - \fBdns_query_mx_fn\fR(\fIctx\fR, struct dns_rr_mx *\fIresult\fR, \fIdata\fR) -dns_parse_fn \fBdns_parse_mx\fB; -struct dns_query * -\fBdns_submit_mx\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR, - dns_query_mx_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_mx * -\fBdns_resolve_mx\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR); -.fi -.PP -The \fBdns_rr_mx\fR structure holds a result of an IN MX query, which -is an array of mail exchangers for a given domain. Callback routine for IN MX -queries expected to be of type \fBdns_query_mx_fn\fR, which expects pointer to -\fBdns_rr_mx\fR structure as query result instead of raw DNS packet. -The \fBdns_parse_mx\fR() is used to convert raw DNS reply packet into -\fBdns_rr_mx\fR structure (it is used internally and may be used directly too -with generic query interface). Routines \fBdns_submit_mx\fR() and -\fBdns_resolve_mx\fR() are used to perform IN MX queries in a type-safe -manner. The \fIname\fR parameter is the domain name in question, and -\fIflags\fR is query flags bitmask, with one bit, DNS_NOSRCH, of practical -interest (if the \fIname\fR is absolute, that is, it ends up with a dot, -DNS_NOSRCH flag will be set automatically). - -.SS "TXT Queries" -.PP -.nf -struct \fBdns_txt\fR { /* single TXT record */ - int \fBlen\fR; /* length of the text */ - unsigned char *\fBtxt\fR; /* pointer to the text */ -}; -struct \fBdns_rr_txt\fR { /* TXT RRset */ - char *\fBdnstxt_qname\fR; /* original query name */ - char *\fBdnstxt_cname\fR; /* canonical name */ - unsigned \fBdnstxt_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnstxt_nrr\fR; /* number of text records in the set */ - struct dns_txt \fBdnstxt_txt\fR[]; /* array of TXT records */ -}; -typedef void - \fBdns_query_txt_fn\fR(\fIctx\fR, struct dns_rr_txt *\fIresult\fR, \fIdata\fR) -dns_parse_fn \fBdns_parse_txt\fB; -struct dns_query * -\fBdns_submit_txt\fB(\fIctx\fR, const char *\fIname\fR, enum dns_class \fIqcls\fR, - int \fIflags\fR, dns_query_txt_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_txt * -\fBdns_resolve_txt\fB(\fIctx\fR, const char *\fIname\fR, - enum dns_class \fIqcls\fR, int \fIflags\fR); -.fi -.PP -The \fBdns_rr_txt\fR structure holds a result of a TXT query, which is an -array of text records for a given domain name. Callback routine for TXT -queries expected to be of type \fBdns_query_txt_fn\fR, which expects pointer -to \fBdns_rr_txt\fR structure as query result instead of raw DNS packet. -The \fBdns_parse_txt\fR() is used to convert raw DNS reply packet into -\fBdns_rr_txt\fR structure (it is used internally and may be used directly too -with generic query interface). Routines \fBdns_submit_txt\fR() and -\fBdns_resolve_txt\fR() are used to perform IN MX queries in a type-safe -manner. The \fIname\fR parameter is the domain name in question, and -\fIflags\fR is query flags bitmask, with one bit, DNS_NOSRCH, of practical -interest (if the \fIname\fR is absolute, that is, it ends up with a dot, -DNS_NOSRCH flag will be set automatically). Note that each TXT string -is represented by \fBstruct\ dns_txt\fR, while zero-terminated (and the -len field of the structure does not include the terminator), may contain -embedded null characters -- content of TXT records is not interpreted -by the library in any way. - -.SS "SRV Queries" -.PP -.nf -struct \fBdns_srv\fR { /* single SRV record */ - int \fBpriority\fR; /* priority of the record */ - int \fBweight\fR; /* weight of the record */ - int \fBport\fR; /* the port number to connect to */ - char *\fBname\fR; /* target host name */ -}; -struct \fBdns_rr_srv\fR { /* SRV RRset */ - char *\fBdnssrv_qname\fR; /* original query name */ - char *\fBdnssrv_cname\fR; /* canonical name */ - unsigned \fBdnssrv_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnssrv_nrr\fR; /* number of text records in the set */ - struct dns_srv \fBdnssrv_srv\fR[]; /* array of SRV records */ -}; -typedef void - \fBdns_query_srv_fn\fR(\fIctx\fR, struct dns_rr_srv *\fIresult\fR, \fIdata\fR) -dns_parse_fn \fBdns_parse_srv\fB; -struct dns_query * -\fBdns_submit_srv\fB(\fIctx\fR, const char *\fIname\fR, const char *\fIservice\fR, const char *\fIprotocol\fR, - int \fIflags\fR, dns_query_txt_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_srv * -\fBdns_resolve_srv\fB(\fIctx\fR, const char *\fIname\fR, const char *\fIservice\fR, const char *\fIprotocol\fR, - int \fIflags\fR); -.fi -.PP -The \fBdns_rr_srv\fR structure holds a result of an IN SRV (rfc2782) query, -which is an array of servers (together with port numbers) which are performing -operations for a given \fIservice\fR using given \fIprotocol\fR on a target -domain \fIname\fR. Callback routine for IN SRV queries expected to be of type -\fBdns_query_srv_fn\fR, which expects pointer to \fBdns_rr_srv\fR structure as -query result instead of raw DNS packet. The \fBdns_parse_srv\fR() is used to -convert raw DNS reply packet into \fBdns_rr_srv\fR structure (it is used -internally and may be used directly too with generic query interface). -Routines \fBdns_submit_srv\fR() and \fBdns_resolve_srv\fR() are used to -perform IN SRV queries in a type-safe manner. The \fIname\fR parameter -is the domain name in question, \fIservice\fR and \fRprotocl\fR specifies the -service and the protocol in question (the library will construct query DN -according to rfc2782 rules) and may be NULL (in this case the library -assumes \fIname\fR parameter holds the complete SRV query), and -\fIflags\fR is query flags bitmask, with one bit, DNS_NOSRCH, of practical -interest (if the \fIname\fR is absolute, that is, it ends up with a dot, -DNS_NOSRCH flag will be set automatically). - -.SS "NAPTR Queries" -.PP -.nf -struct \fBdns_naptr\fR { /* single NAPTR record */ - int \fBorder\fR; /* record order */ - int \fBpreference\fR; /* preference of this record */ - char *\fBflags\fR; /* application-specific flags */ - char *\fBservices\fR; /* service parameters */ - char *\fBregexp\fR; /* substitutional regular expression */ - char *\fBreplacement\fR; /* replacement string */ -}; -struct \fBdns_rr_naptr\fR { /* NAPTR RRset */ - char *\fBdnsnaptr_qname\fR; /* original query name */ - char *\fBdnsnaptr_cname\fR; /* canonical name */ - unsigned \fBdnsnaptr_ttl\fR; /* Time-To-Live (TTL) value */ - int \fBdnsnaptr_nrr\fR; /* number of text records in the set */ - struct dns_naptr \fBdnsnaptr_naptr\fR[]; /* array of NAPTR records */ -}; -typedef void - \fBdns_query_naptr_fn\fR(\fIctx\fR, struct dns_rr_naptr *\fIresult\fR, \fIdata\fR) -dns_parse_fn \fBdns_parse_naptr\fB; -struct dns_query * -\fBdns_submit_naptr\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR, - dns_query_txt_fn *\fIcbck\fR, \fIdata\fR); -struct dns_rr_naptr * -\fBdns_resolve_naptr\fB(\fIctx\fR, const char *\fIname\fR, int \fIflags\fR); -.fi -.PP -The \fBdns_rr_naptr\fR structure holds a result of an IN NAPTR (rfc3403) query. -Callback routine for IN NAPTR queries expected to be of type -\fBdns_query_naptr_fn\fR, expects pointer to \fBdns_rr_naptr\fR -structure as query result instead of raw DNS packet. -The \fBdns_parse_naptr\fR() is used to convert raw DNS reply packet into -\fBdns_rr_naptr\fR structure (it is used -internally and may be used directly too with generic query interface). -Routines \fBdns_submit_naptr\fR() and \fBdns_resolve_naptr\fR() are used to -perform IN NAPTR queries in a type-safe manner. The \fIname\fR parameter -is the domain name in question, and \fIflags\fR is query flags bitmask, -with one bit, DNS_NOSRCH, of practical interest (if the \fIname\fR is -absolute, that is, it ends up with a dot, DNS_NOSRCH flag will be set -automatically). - -.SS "DNSBL Interface" -.PP -A DNS-based blocklists, or a DNSBLs, are in wide use nowadays, especially -to protect mailservers from spammers. The library provides DNSBL interface, -a set of routines to perform queries against DNSBLs. Routines accepts an -IP address (IPv4 and IPv6 are both supported) and a base DNSBL zone as -query parameters, and returns either \fBdns_rr_a4\fR or \fBdns_rr_txt\fR -structure. Note that IPv6 interface return IPv4 RRset. -.PP -.nf -struct dns_query * -\fBdns_submit_a4dnsbl\fR(\fIctx\fR, - const struct in_addr *\fIaddr\fR, const char *\fIdnsbl\fR, - dns_query_a4_fn *\fIcbck\fR, void *\fIdata\fR); -struct dns_query * -\fBdns_submit_a4dnsbl_txt\fR(\fIctx\fR, - const struct in_addr *\fIaddr\fR, const char *\fIdnsbl\fR, - dns_query_txt_fn *\fIcbck\fR, void *\fIdata\fR); -struct dns_query * -\fBdns_submit_a6dnsbl\fR(\fIctx\fR, - const struct in6_addr *\fIaddr\fR, const char *\fIdnsbl\fR, - dns_query_a4_fn *\fIcbck\fR, void *\fIdata\fR); -struct dns_query * -\fBdns_submit_a6dnsbl_txt\fR(\fIctx\fR, - const struct in6_addr *\fIaddr\fR, const char *\fIdnsbl\fR, - dns_query_txt_fn *\fIcbck\fR, void *\fIdata\fR); -struct dns_rr_a4 *\fBdns_resolve_a4dnsbl\fR(\fIctx\fR, - const struct in_addr *\fIaddr\fR, const char *\fIdnsbl\fR) -struct dns_rr_txt *\fBdns_resolve_a4dnsbl_txt\fR(\fIctx\fR, - const struct in_addr *\fIaddr\fR, const char *\fIdnsbl\fR) -struct dns_rr_a4 *\fBdns_resolve_a6dnsbl\fR(\fIctx\fR, - const struct in6_addr *\fIaddr\fR, const char *\fIdnsbl\fR) -struct dns_rr_txt *\fBdns_resolve_a6dnsbl_txt\fR(\fIctx\fR, - const struct in6_addr *\fIaddr\fR, const char *\fIdnsbl\fR) -.fi -Perform (submit or resolve) a DNSBL query for the given \fIdnsbl\fR -domain and an IP \fIaddr\fR in question, requesting either A or TXT -records. - -.SS "RHSBL Interface" -.PP -RHSBL is similar to DNSBL, but instead of an IP address, the -parameter is a domain name. -.PP -.nf -struct dns_query * -\fBdns_submit_rhsbl\fR(\fIctx\fR, const char *\fIname\fR, const char *\fIrhsbl\fR, - dns_query_a4_fn *\fIcbck\fR, void *\fIdata\fR); -struct dns_query * -\fBdns_submit_rhsbl_txt\fR(\fIctx\fR, const char *\fIname\fR, const char *\fIrhsbl\fR, - dns_query_txt_fn *\fIcbck\fR, void *\fIdata\fR); -struct dns_rr_a4 * -\fBdns_resolve_rhsbl\fR(\fIctx\fR, const char *\fIname\fR, const char *\fIrhsbl\fR); -struct dns_rr_txt * -\fBdns_resolve_rhsbl_txt\fR(\fIctx\fR, const char *\fIname\fR, const char *\fIrhsbl\fR); -.fi -Perform (submit or resolve) a RHSBL query for the given \fIrhsbl\fR -domain and \fIname\fR in question, requesting either A or TXT records. - - -.SH "LOW-LEVEL INTERFACE" - -.SS "Domain Names (DNs)" - -.PP -A DN is a series of domain name labels each starts with length byte, -followed by empty label (label with zero length). The following -routines to work with DNs are provided. - -.PP -.nf -unsigned \fBdns_dnlen\fR(const unsigned char *\fIdn\fR) -.fi -.RS -return length of the domain name \fIdn\fR, including the terminating label. -.RE - -.PP -.nf -unsigned \fBdns_dnlabels\fR(const unsigned char *\fIdn\fR) -.fi -.RS -return number of non-zero labels in domain name \fIdn\fR. -.RE - -.PP -.nf -unsigned \fBdns_dnequal\fR(\fIdn1\fR, \fIdn2\fR) - const unsigned char *\fIdn1\fR, *\fIdn2\fR; -.fi -.RS -test whenever the two domain names, \fIdn1\fR and \fIdn2\fR, are -equal (case-insensitive). Return domain name length if equal -or 0 if not. -.RE - -.PP -.nf -unsigned \fBdns_dntodn\fR(\fIsdn\fR, \fIddn\fR, \fIdnsiz\fR) - const unsigned char *\fIsdn\fR; - unsigned char *\fIddn\fR; - unsigned \fIdnsiz\fR; -.fi -.RS -copies the source domain name \fIsdn\fR to destination buffer \fIddn\fR -of size \fIdnsiz\fR. Return domain name length or 0 if \fIddn\fR is -too small. -.RE - -.PP -.nf -int \fBdns_ptodn\fR(\fIname\fR, \fInamelen\fR, \fIdn\fR, \fIdnsiz\fR, \fIisabs\fR) -int \fBdns_sptodn\fR(\fIname\fR, \fIdn\fR, \fIdnsiz\fR) - const char *\fIname\fR; unsigned \fInamelen\fR; - unsigned char *\fIdn\fR; unsigned \fIdnsiz\fR; - int *\fIisabs\fR; -.fi -.RS -convert asciiz name \fIname\fR of length \fInamelen\fR to DN format, -placing result into buffer \fIdn\fR of size \fIdnsiz\fR. Return -length of the DN if successeful, 0 if the \fIdn\fR buffer supplied is -too small, or negative value if \fIname\fR is invalid. If \fIisabs\fR -is non-NULL and conversion was successeful, *\fIisabs\fR will be set to -either 1 or 0 depending whenever \fIname\fR was absolute (i.e. ending with -a dot) or not. Name length, \fInamelength\fR, may be zero, in which case -strlen(\fIname\fR) will be used. Second form, \fBdns_sptodn\fR(), is a -simplified form of \fBdns_ptodn\fR(), equivalent to -.br -.nf -\fBdns_ptodn\fR(\fIname\fR, 0, \fIdn\fR, \fIdnlen\fR, 0). -.fi -.RE - -.PP -.nf -extern const unsigned char \fBdns_inaddr_arpa_dn\fR[] -int \fBdns_a4todn\fR(const struct in_addr *\fIaddr\fR, const unsigned char *\fItdn\fR, - unsigned char *\fIdn\fR, unsigned \fIdnsiz\fR) -int \fBdns_a4ptodn\fR(const struct in_addr *\fIaddr\fR, const char *\fItname\fR, - unsigned char *\fIdn\fR, unsigned \fIdnsiz\fR) -extern const unsigned char \fBdns_ip6_arpa_dn\fR[] -int \fBdns_a6todn\fR(const struct in6_addr *\fIaddr\fR, const unsigned char *\fItdn\fR, - unsigned char *\fIdn\fR, unsigned \fIdnsiz\fR) -int \fBdns_a6ptodn\fR(const struct in6_addr *\fIaddr\fR, const char *\fItname\fR, - unsigned char *\fIdn\fR, unsigned \fIdnsiz\fR) -.fi -.RS -several variants of routines to convert IPv4 and IPv6 address \fIaddr\fR -into reverseDNS-like domain name in DN format, storing result in \fIdn\fR -of size \fIdnsiz\fR. \fItdn\fR (or \fItname\fR) is the base zone name, -like in-addr.arpa for IPv4 or in6.arpa for IPv6. If \fItdn\fR (or \fItname\fR) -is NULL, \fBdns_inaddr_arpa_dn\fR (or \fBdns_ip6_arpa_dn\fR) will be used. -The routines may be used to construct a DN for a DNSBL lookup for example. -All routines return length of the resulting DN on success, -1 if resulting -DN is invalid, or 0 if the \fIdn\fR buffer (\fIdnsiz\fR) is too small. -To hold standard rDNS DN, a buffer of size \fBDNS_A4RSIZE\fR (30 bytes) for -IPv4 address, or \fBDNS_A6RSIZE\fR (74 bytes) for IPv6 address, is sufficient. -.RE - -.PP -.nf -int \fBdns_dntop\fR(\fIdn\fR, \fIname\fR, \fInamesiz\fR) - const unsigned char *\fIdn\fR; - const char *\fIname\fR; unsigned \fInamesiz\fR; -.fi -.RS -convert domain name \fIdn\fR in DN format to asciiz string, placing result -into \fIname\fR buffer of size \fInamesiz\fR. Maximum length of asciiz -representation of domain name is \fBDNS_MAXNAME\fR (1024) bytes. Root -domain is represented as empty string. Return length of the resulting name -(including terminating character, i.e. strlen(name)+1) on success, 0 if the -\fIname\fR buffer is too small, or negative value if \fIdn\fR is invalid -(last case should never happen since all routines in this library which -produce domain names ensure the DNs generated are valid). -.RE - -.PP -.nf -const char *\fBdns_dntosp\fR(const unsigned char *\fIdn\fR) -.fi -.RS -convert domain name \fIdn\fR in DN format to asciiz string using static -buffer. Return the resulting asciiz string on success or NULL on failure. -Note since this routine uses static buffer, it is not thread-safe. -.RE - -.PP -.nf -unsigned \fBdns_dntop_size\fR(const unsigned char *\fIdn\fR) -.fi -.RS -return the buffer size needed to convert the \fIdn\fR domain name -in DN format to asciiz string, for \fBdns_dntop\fR(). The routine -return either the size of buffer required, including the trailing -zero byte, or 0 if \fIdn\fR is invalid. -.RE - -.SS "Working with DNS Packets" - -.PP -The following routines are provided to encode and decode DNS on-wire -packets. This is low-level interface. - -.PP -DNS response codes (returned by \fBdns_rcode\fR() routine) are -defined as constants prefixed with \fBDNS_R_\fR. See dns.h -header file for the complete list. In particular, constants -\fBDNS_R_NOERROR\fR (0), \fBDNS_R_SERVFAIL\fR, \fBDNS_R_NXDOMAIN\fR -may be of interest to an application. - -.PP -.nf -unsigned \fBdns_get16\fR(const unsigned char *\fIp\fR) -unsigned \fBdns_get32\fR(const unsigned char *\fIp\fR) -.fi -.RS -helper routines, convert 16-bit or 32-bit integer in on-wire -format pointed to by \fIp\fR to unsigned. -.RE - -.PP -.nf -unsigned char *\fBdns_put16\fR(unsigned char *\fId\fR, unsigned \fIn\fR) -unsigned char *\fBdns_put32\fR(unsigned char *\fId\fR, unsigned \fIn\fR) -.fi -.RS -helper routine, convert unsigned 16-bit or 32-bit integer \fIn\fR to -on-wire format to buffer pointed to by \fId\fR, return \fId\fR+2 or -\fId\fR+4. -.RE - -.PP -.nf -\fBDNS_HSIZE\fR (12) -.fi -.RS -defines size of DNS header. Data section -in the DNS packet immediately follows the header. In the header, -there are query identifier (id), various flags and codes, -and number of resource records in various data sections. -See dns.h header file for complete list of DNS header definitions. -.RE - -.PP -.nf -unsigned \fBdns_qid\fR(const unsigned char *\fIpkt\fR) -int \fBdns_rd\fR(const unsigned char *\fIpkt\fR) -int \fBdns_tc\fR(const unsigned char *\fIpkt\fR) -int \fBdns_aa\fR(const unsigned char *\fIpkt\fR) -int \fBdns_qr\fR(const unsigned char *\fIpkt\fR) -int \fBdns_ra\fR(const unsigned char *\fIpkt\fR) -unsigned \fBdns_opcode\fR(const unsigned char *\fIpkt\fR) -unsigned \fBdns_rcode\fR(const unsigned char *\fIpkt\fR) -unsigned \fBdns_numqd\fR(const unsigned char *\fIpkt\fR) -unsigned \fBdns_numan\fR(const unsigned char *\fIpkt\fR) -unsigned \fBdns_numns\fR(const unsigned char *\fIpkt\fR) -unsigned \fBdns_numar\fR(const unsigned char *\fIpkt\fR) -const unsigned char *\fBdns_payload\fR(const unsigned char *\fIpkt\fR) -.fi -.RS -return various parts from the DNS packet header \fIpkt\fR: -query identifier (qid), -recursion desired (rd) flag, -truncation occured (tc) flag, -authoritative answer (aa) flag, -query response (qr) flag, -recursion available (ra) flag, -operation code (opcode), -result code (rcode), -number of entries in question section (numqd), -number of answers (numan), -number of authority records (numns), -number of additional records (numar), -and the pointer to the packet data (payload). -.RE - -.PP -.nf -int \fBdns_getdn\fR(\fIpkt\fR, \fIcurp\fR, \fIpkte\fR, \fIdn\fR, \fIdnsiz\fR) -const unsigned char *\fBdns_skipdn\fR(\fIcur\fR, \fIpkte\fR) - const unsigned char *\fIpkt\fR, *\fIpkte\fR, **\fIcurp\fR, *\fIcur\fR; - unsigned char *\fIdn\fR; unsigned \fIdnsiz\fR; -.fi -.RS -\fBdns_getdn\fR() extract DN from DNS packet \fIpkt\fR which ends before -\fIpkte\fR starting at position *\fIcurp\fR into buffer pointed to by -\fIdn\fR of size \fIdnsiz\fR. Upon successeful completion, *\fIcurp\fR -will point to the next byte in the packet after the extracted domain name. -It return positive number (length of the DN if \fIdn\fR) upon successeful -completion, negative value on error (when the packet contains invalid data), -or zero if the \fIdnsiz\fR is too small (maximum length of a domain name is -\fBDNS_MAXDN\fR). \fBdns_skipdn\fR() return pointer to the next byte in -DNS packet which ends up before \fIpkte\fR after a domain name which starts -at the \fIcur\fP byte, or NULL if the packet is invalid. \fBdns_skipdn\fR() -is more or less equivalent to what \fBdns_getdn\fR() does, except it does not -actually extract the domain name in question, and uses simpler interface. -.RE - -.PP -.nf -struct \fBdns_rr\fR { - unsigned char \fBdnsrr_dn\fR[DNS_MAXDN]; /* the RR DN name */ - enum dns_class \fBdnsrr_cls\fR; /* class of the RR */ - enum dns_type \fBdnsrr_typ\fR; /* type of the RR */ - unsigned \fBdnsrr_ttl\fR; /* TTL value */ - unsigned \fBdnsrr_dsz\fR; /* size of data in bytes */ - const unsigned char *\fBdnsrr_dptr\fR; /* pointer to the first data byte */ - const unsigned char *\fBdnsrr_dend\fR; /* next byte after RR */ -}; -.fi -.RS -The \fBdns_rr\fR structure is used to hold information about -single DNS Resource Record (RR) in an easy to use form. -.RE - -.PP -.nf -struct \fBdns_parse\fR { - const unsigned char *\fBdnsp_pkt\fR; /* pointer to the packet being parsed */ - const unsigned char *\fBdnsp_end\fR; /* end of the packet pointer */ - const unsigned char *\fBdnsp_cur\fR; /* current packet positionn */ - const unsigned char *\fBdnsp_ans\fR; /* pointer to the answer section */ - int \fBdnsp_rrl\fR; /* number of RRs left */ - int \fBdnsp_nrr\fR; /* number of relevant RRs seen so far */ - unsigned \fBdnsp_ttl\fR; /* TTL value so far */ - const unsigned char *\fBdnsp_qdn\fR; /* the domain of interest or NULL */ - enum dns_class \fBdnsp_qcls\fR; /* class of interest or 0 for any */ - enum dns_type \fBdnsp_qtyp\fR; /* type of interest or 0 for any */ - unsigned char \fBdnsp_dnbuf\fR[DNS_MAXDN]; /* domain name buffer */ -}; -.fi -.RS -The \fBdns_parse\fR structure is used to parse DNS reply packet. -It holds information about the packet being parsed (dnsp_pkt, dnsp_end and -dnsp_cur fields), number of RRs in the current section left to do, and -the information about specific RR which we're looking for (dnsp_qdn, -dnsp_qcls and dnsp_qtyp fields). -.RE - -.PP -.nf -int \fBdns_initparse\fR(struct dns_parse *\fIp\fR, - const unsigned char *\fIqdn\fR, - const unsigned char *\fIpkt\fR, - const unsigned char *\fIcur\fR, - const unsigned char *\fIend\fR) -.fi -.RS -initializes the RR parsing structure \fIp\fR. Arguments \fIpkt\fR, \fIcur\fR -and \fIend\fR should describe the received packet: \fIpkt\fR is the start of -the packet, \fIend\fR points to the next byte after the end of the packet, -and \fIcur\fR points past the query DN in query section (to query class+type -information). And \fIqdn\fR points to the query DN. This is the arguments -passed to \fBdns_parse_fn\fR() routine. \fBdns_initparse\fR() initializes -\fBdnsp_pkt\fR, \fBdnsp_end\fR and \fBdnsp_qdn\fR fields to the corresponding -arguments, extracts and initializes \fBdnsp_qcls\fR and \fBdnsp_qtyp\fR -fields to the values found at \fIcur\fR pointer, initializes -\fBdnsp_cur\fR and \fBdnsp_ans\fR fields to be \fIcur\fR+4 (to the start of -answer section), and initializes \fBdnsp_rrl\fR field to be number of entries -in answer section. \fBdnsp_ttl\fR will be set to max TTL value, 0xffffffff, -and \fBdnsp_nrr\fR to 0. -.RE - -.PP -.nf -int \fBdns_nextrr\fR(struct dns_parse *\fIp\fR, struct dns_rr *\fIrr\fR); -.fi -.RS -searches for next RR in the packet based on the criteria provided in -the \fIp\fR structure, filling in the \fIrr\fR structure and -advancing \fIp\fR->\fBdnsp_cur\fR to the next RR in the packet. -RR selection is based on dnsp_qdn, dnsp_qcls and dnsp_qtyp fields in -the dns_parse structure. Any (or all) of the 3 fields may be 0, -which means any actual value from the packet is acceptable. In case -the field isn't 0 (or NULL for dnsp_qdn), only RRs with corresponding -characteristics are acceptable. Additionally, when dnsp_qdn is non-NULL, -\fBdns_nextrr\fR() performs automatic CNAME expansion. -Routine will return positive value on success, 0 in case it reached the end -of current section in the packet (\fIp\fR->\fBdnsp_rrl\fR is zero), or -negative value if next RR can not be decoded (packet format is invalid). -The routine updates \fIp\fR->\fBdnsp_qdn\fR automatically when this -field is non-NULL and it encounters appropriate CNAME RRs (saving CNAME -target in \fIp\fR->\fBdnsp_dnbuf\fR), so after end of the process, -\fIp\fR->\fBdnsp_qdn\fR will point to canonical name of the domain -in question. The routine updates \fIp\fR->\fBdnsp_ttl\fR value to -be the minimum TTL of all RRs found. -.RE - -.PP -.nf -void \fBdns_rewind\fR(struct dns_parse *\fIp\fR, const unsigned char *\fIqdn\fR) -.fi -.RS -this routine "rewinds" the packet parse state structure to be at the -same state as after a call to \fBdns_initparse\fR(), i.e. reposition -the parse structure \fIp\fR to the start of answer section and -initialize \fIp\fR->\fBdnsp_rrl\fR to the number of entries in -answer section. -.RE - -.PP -.nf -int \fBdns_stdrr_size\fR(const struct dns_parse *\fIp\fR); -.fi -.RS -return size to hold standard RRset structure information, as shown -in \fBdns_rr_null\fR structure (for the query and canonical -names). Used to calculate amount of memory to allocate for common -part of type-specific RR structures in parsing routines. -.RE - -.PP -.nf -void *\fBdns_stdrr_finish\fR(struct dns_rr_null *\fIret\fR, char *\fIcp\fR, - const struct dns_parse *\fIp\fR); -.fi -.RS -initializes standard RRset fields in \fIret\fR structure using buffer -pointed to by \fIcp\fR, which should have at least as many bytes -as \fBdns_stdrr_size\fR(\fIp\fR) returned. Used to finalize common -part of type-specific RR structures in parsing routines. -.RE - -.PP -See library source for usage examples of all the above low-level routines, -especially source of the parsing routines. - -.SH AUTHOR -.PP -The \fBudns\fR library has been written by Michael Tokarev, mjt@corpit.ru. diff --git a/libs/udns/udns.h b/libs/udns/udns.h deleted file mode 100644 index c77f4e9115..0000000000 --- a/libs/udns/udns.h +++ /dev/null @@ -1,747 +0,0 @@ -/* $Id: udns.h,v 1.41 2006/11/29 01:20:30 mjt Exp $ - header file for the UDNS library. - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#ifndef UDNS_VERSION /* include guard */ - -#define UDNS_VERSION "0.0.9pre" - -#ifdef WIN32 -# ifdef UDNS_DYNAMIC_LIBRARY -# ifdef DNS_LIBRARY_BUILD -# define UDNS_API __declspec(dllexport) -# define UDNS_DATA_API __declspec(dllexport) -# else -# define UDNS_API __declspec(dllimport) -# define UDNS_DATA_API __declspec(dllimport) -# endif -# endif -#ifdef _MSC_VER -#undef inline -#define inline __inline -#endif -#endif - -#ifndef UDNS_API -# define UDNS_API -#endif -#ifndef UDNS_DATA_API -# define UDNS_DATA_API -#endif - -#include /* for time_t */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* forward declarations if sockets stuff isn't #include'd */ -struct in_addr; -struct in6_addr; -struct sockaddr; - -/**************************************************************************/ -/**************** Common definitions **************************************/ - -#ifdef WIN32 -#include "winsock2.h" -typedef SOCKET dns_socket; -#else -typedef int dns_socket; -#endif - -UDNS_API const char * -dns_version(void); - -struct dns_ctx; -struct dns_query; - -/* shorthand for [const] unsigned char */ -typedef unsigned char dnsc_t; -typedef const unsigned char dnscc_t; - -#define DNS_MAXDN 255 /* max DN length */ -#define DNS_MAXLABEL 63 /* max DN label length */ -#define DNS_MAXNAME 1024 /* max asciiz domain name length */ -#define DNS_HSIZE 12 /* DNS packet header size */ -#define DNS_PORT 53 /* default domain port */ -#define DNS_MAXSERV 6 /* max servers to consult */ -#define DNS_MAXSRCH 5 /* max searchlist entries */ -#define DNS_MAXPACKET 512 /* max traditional-DNS UDP packet size */ -#define DNS_EDNS0PACKET 4096 /* EDNS0 packet size to use */ - -enum dns_class { /* DNS RR Classes */ - DNS_C_INVALID = 0, /* invalid class */ - DNS_C_IN = 1, /* Internet */ - DNS_C_CH = 3, /* CHAOS */ - DNS_C_HS = 4, /* HESIOD */ - DNS_C_ANY = 255 /* wildcard */ -}; - -enum dns_type { /* DNS RR Types */ - DNS_T_INVALID = 0, /* Cookie. */ - DNS_T_A = 1, /* Host address. */ - DNS_T_NS = 2, /* Authoritative server. */ - DNS_T_MD = 3, /* Mail destination. */ - DNS_T_MF = 4, /* Mail forwarder. */ - DNS_T_CNAME = 5, /* Canonical name. */ - DNS_T_SOA = 6, /* Start of authority zone. */ - DNS_T_MB = 7, /* Mailbox domain name. */ - DNS_T_MG = 8, /* Mail group member. */ - DNS_T_MR = 9, /* Mail rename name. */ - DNS_T_NULL = 10, /* Null resource record. */ - DNS_T_WKS = 11, /* Well known service. */ - DNS_T_PTR = 12, /* Domain name pointer. */ - DNS_T_HINFO = 13, /* Host information. */ - DNS_T_MINFO = 14, /* Mailbox information. */ - DNS_T_MX = 15, /* Mail routing information. */ - DNS_T_TXT = 16, /* Text strings. */ - DNS_T_RP = 17, /* Responsible person. */ - DNS_T_AFSDB = 18, /* AFS cell database. */ - DNS_T_X25 = 19, /* X_25 calling address. */ - DNS_T_ISDN = 20, /* ISDN calling address. */ - DNS_T_RT = 21, /* Router. */ - DNS_T_NSAP = 22, /* NSAP address. */ - DNS_T_NSAP_PTR = 23, /* Reverse NSAP lookup (deprecated). */ - DNS_T_SIG = 24, /* Security signature. */ - DNS_T_KEY = 25, /* Security key. */ - DNS_T_PX = 26, /* X.400 mail mapping. */ - DNS_T_GPOS = 27, /* Geographical position (withdrawn). */ - DNS_T_AAAA = 28, /* Ip6 Address. */ - DNS_T_LOC = 29, /* Location Information. */ - DNS_T_NXT = 30, /* Next domain (security). */ - DNS_T_EID = 31, /* Endpoint identifier. */ - DNS_T_NIMLOC = 32, /* Nimrod Locator. */ - DNS_T_SRV = 33, /* Server Selection. */ - DNS_T_ATMA = 34, /* ATM Address */ - DNS_T_NAPTR = 35, /* Naming Authority PoinTeR */ - DNS_T_KX = 36, /* Key Exchange */ - DNS_T_CERT = 37, /* Certification record */ - DNS_T_A6 = 38, /* IPv6 address (deprecates AAAA) */ - DNS_T_DNAME = 39, /* Non-terminal DNAME (for IPv6) */ - DNS_T_SINK = 40, /* Kitchen sink (experimentatl) */ - DNS_T_OPT = 41, /* EDNS0 option (meta-RR) */ - DNS_T_DS = 43, /* DNSSEC */ - DNS_T_NSEC = 47, /* DNSSEC */ - DNS_T_TSIG = 250, /* Transaction signature. */ - DNS_T_IXFR = 251, /* Incremental zone transfer. */ - DNS_T_AXFR = 252, /* Transfer zone of authority. */ - DNS_T_MAILB = 253, /* Transfer mailbox records. */ - DNS_T_MAILA = 254, /* Transfer mail agent records. */ - DNS_T_ANY = 255, /* Wildcard match. */ - DNS_T_ZXFR = 256, /* BIND-specific, nonstandard. */ - DNS_T_MAX = 65536 -}; - -/**************************************************************************/ -/**************** Domain Names (DNs) **************************************/ - -/* return length of the DN */ -UDNS_API unsigned -dns_dnlen(dnscc_t *dn); - -/* return #of labels in a DN */ -UDNS_API unsigned -dns_dnlabels(dnscc_t *dn); - -/* lower- and uppercase single DN char */ -#define DNS_DNLC(c) ((c) >= 'A' && (c) <= 'Z' ? (c) - 'A' + 'a' : (c)) -#define DNS_DNUC(c) ((c) >= 'a' && (c) <= 'z' ? (c) - 'a' + 'A' : (c)) - -/* compare the DNs, return dnlen of equal or 0 if not */ -UDNS_API unsigned -dns_dnequal(dnscc_t *dn1, dnscc_t *dn2); - -/* copy one DN to another, size checking */ -UDNS_API unsigned -dns_dntodn(dnscc_t *sdn, dnsc_t *ddn, unsigned ddnsiz); - -/* convert asciiz string of length namelen (0 to use strlen) to DN */ -UDNS_API int -dns_ptodn(const char *name, unsigned namelen, - dnsc_t *dn, unsigned dnsiz, int *isabs); - -/* simpler form of dns_ptodn() */ -#define dns_sptodn(name,dn,dnsiz) dns_ptodn((name),0,(dn),(dnsiz),0) - -UDNS_DATA_API extern dnscc_t dns_inaddr_arpa_dn[14]; -#define DNS_A4RSIZE 30 -UDNS_API int -dns_a4todn(const struct in_addr *addr, dnscc_t *tdn, - dnsc_t *dn, unsigned dnsiz); -UDNS_API int -dns_a4ptodn(const struct in_addr *addr, const char *tname, - dnsc_t *dn, unsigned dnsiz); -UDNS_API dnsc_t * -dns_a4todn_(const struct in_addr *addr, dnsc_t *dn, dnsc_t *dne); - -UDNS_DATA_API extern dnscc_t dns_ip6_arpa_dn[10]; -#define DNS_A6RSIZE 74 -UDNS_API int -dns_a6todn(const struct in6_addr *addr, dnscc_t *tdn, - dnsc_t *dn, unsigned dnsiz); -UDNS_API int -dns_a6ptodn(const struct in6_addr *addr, const char *tname, - dnsc_t *dn, unsigned dnsiz); -UDNS_API dnsc_t * -dns_a6todn_(const struct in6_addr *addr, dnsc_t *dn, dnsc_t *dne); - -/* convert DN into asciiz string */ -UDNS_API int -dns_dntop(dnscc_t *dn, char *name, unsigned namesiz); - -/* convert DN into asciiz string, using static buffer (NOT thread-safe!) */ -UDNS_API const char * -dns_dntosp(dnscc_t *dn); - -/* return buffer size (incl. null byte) required for asciiz form of a DN */ -UDNS_API unsigned -dns_dntop_size(dnscc_t *dn); - -/**************************************************************************/ -/**************** DNS raw packet layout ***********************************/ - -enum dns_rcode { /* reply codes */ - DNS_R_NOERROR = 0, /* ok, no error */ - DNS_R_FORMERR = 1, /* format error */ - DNS_R_SERVFAIL = 2, /* server failed */ - DNS_R_NXDOMAIN = 3, /* domain does not exists */ - DNS_R_NOTIMPL = 4, /* not implemented */ - DNS_R_REFUSED = 5, /* query refused */ - /* these are for BIND_UPDATE */ - DNS_R_YXDOMAIN = 6, /* Name exists */ - DNS_R_YXRRSET = 7, /* RRset exists */ - DNS_R_NXRRSET = 8, /* RRset does not exist */ - DNS_R_NOTAUTH = 9, /* Not authoritative for zone */ - DNS_R_NOTZONE = 10, /* Zone of record different from zone section */ - /*ns_r_max = 11,*/ - /* The following are TSIG extended errors */ - DNS_R_BADSIG = 16, - DNS_R_BADKEY = 17, - DNS_R_BADTIME = 18 -}; - -static inline unsigned dns_get16(dnscc_t *s) { - return ((unsigned)s[0]<<8) | s[1]; -} -static inline unsigned dns_get32(dnscc_t *s) { - return ((unsigned)s[0]<<24) | ((unsigned)s[1]<<16) - | ((unsigned)s[2]<<8) | s[3]; -} -static inline dnsc_t *dns_put16(dnsc_t *d, unsigned n) { - *d++ = (dnsc_t)((n >> 8) & 255); *d++ = (dnsc_t)(n & 255); return d; -} -static inline dnsc_t *dns_put32(dnsc_t *d, unsigned n) { - *d++ = (dnsc_t)((n >> 24) & 255); *d++ = (dnsc_t)((n >> 16) & 255); - *d++ = (dnsc_t)((n >> 8) & 255); *d++ = (dnsc_t)(n & 255); - return d; -} - -/* DNS Header layout */ -enum { - /* bytes 0:1 - query ID */ - DNS_H_QID1 = 0, - DNS_H_QID2 = 1, - DNS_H_QID = DNS_H_QID1, -#define dns_qid(pkt) dns_get16((pkt)+DNS_H_QID) - /* byte 2: flags1 */ - DNS_H_F1 = 2, - DNS_HF1_QR = 0x80, /* query response flag */ -#define dns_qr(pkt) ((pkt)[DNS_H_F1]&DNS_HF1_QR) - DNS_HF1_OPCODE = 0x78, /* opcode, 0 = query */ -#define dns_opcode(pkt) (((pkt)[DNS_H_F1]&DNS_HF1_OPCODE)>>3) - DNS_HF1_AA = 0x04, /* auth answer */ -#define dns_aa(pkt) ((pkt)[DNS_H_F1]&DNS_HF1_AA) - DNS_HF1_TC = 0x02, /* truncation flag */ -#define dns_tc(pkt) ((pkt)[DNS_H_F1]&DNS_HF1_TC) - DNS_HF1_RD = 0x01, /* recursion desired (may be set in query) */ -#define dns_rd(pkt) ((pkt)[DNS_H_F1]&DNS_HF1_RD) - /* byte 3: flags2 */ - DNS_H_F2 = 3, - DNS_HF2_RA = 0x80, /* recursion available */ -#define dns_ra(pkt) ((pkt)[DNS_H_F2]&DNS_HF2_RA) - DNS_HF2_Z = 0x70, /* reserved */ - DNS_HF2_RCODE = 0x0f, /* response code, DNS_R_XXX above */ -#define dns_rcode(pkt) ((pkt)[DNS_H_F2]&DNS_HF2_RCODE) - /* bytes 4:5: qdcount, numqueries */ - DNS_H_QDCNT1 = 4, - DNS_H_QDCNT2 = 5, - DNS_H_QDCNT = DNS_H_QDCNT1, -#define dns_numqd(pkt) dns_get16((pkt)+4) - /* bytes 6:7: ancount, numanswers */ - DNS_H_ANCNT1 = 6, - DNS_H_ANCNT2 = 7, - DNS_H_ANCNT = DNS_H_ANCNT1, -#define dns_numan(pkt) dns_get16((pkt)+6) - /* bytes 8:9: nscount, numauthority */ - DNS_H_NSCNT1 = 8, - DNS_H_NSCNT2 = 9, - DNS_H_NSCNT = DNS_H_NSCNT1, -#define dns_numns(pkt) dns_get16((pkt)+8) - /* bytes 10:11: arcount, numadditional */ - DNS_H_ARCNT1 = 10, - DNS_H_ARCNT2 = 11, - DNS_H_ARCNT = DNS_H_ARCNT1, -#define dns_numar(pkt) dns_get16((pkt)+10) -#define dns_payload(pkt) ((pkt)+DNS_HSIZE) -}; - -/* packet buffer: start at pkt, end before pkte, current pos *curp. - * extract a DN and set *curp to the next byte after DN in packet. - * return -1 on error, 0 if dnsiz is too small, or dnlen on ok. - */ -UDNS_API int -dns_getdn(dnscc_t *pkt, dnscc_t **curp, dnscc_t *end, - dnsc_t *dn, unsigned dnsiz); - -/* skip the DN at position cur in packet ending before pkte, - * return pointer to the next byte after the DN or NULL on error */ -UDNS_API dnscc_t * -dns_skipdn(dnscc_t *end, dnscc_t *cur); - -struct dns_rr { /* DNS Resource Record */ - dnsc_t dnsrr_dn[DNS_MAXDN]; /* the DN of the RR */ - enum dns_class dnsrr_cls; /* Class */ - enum dns_type dnsrr_typ; /* Type */ - unsigned dnsrr_ttl; /* Time-To-Live (TTL) */ - unsigned dnsrr_dsz; /* data size */ - dnscc_t *dnsrr_dptr; /* pointer to start of data */ - dnscc_t *dnsrr_dend; /* past end of data */ -}; - -struct dns_parse { /* RR/packet parsing state */ - dnscc_t *dnsp_pkt; /* start of the packet */ - dnscc_t *dnsp_end; /* end of the packet */ - dnscc_t *dnsp_cur; /* current packet position */ - dnscc_t *dnsp_ans; /* start of answer section */ - int dnsp_rrl; /* number of RRs left to go */ - int dnsp_nrr; /* RR count so far */ - unsigned dnsp_ttl; /* TTL value so far */ - dnscc_t *dnsp_qdn; /* the RR DN we're looking for */ - enum dns_class dnsp_qcls; /* RR class we're looking for or 0 */ - enum dns_type dnsp_qtyp; /* RR type we're looking for or 0 */ - dnsc_t dnsp_dnbuf[DNS_MAXDN]; /* domain buffer */ -}; - -/* initialize the parse structure */ -UDNS_API void -dns_initparse(struct dns_parse *p, dnscc_t *qdn, - dnscc_t *pkt, dnscc_t *cur, dnscc_t *end); - -/* search next RR, <0=error, 0=no more RRs, >0 = found. */ -UDNS_API int -dns_nextrr(struct dns_parse *p, struct dns_rr *rr); - -UDNS_API void -dns_rewind(struct dns_parse *p, dnscc_t *qdn); - - -/**************************************************************************/ -/**************** Resolver Context ****************************************/ - -/* default resolver context */ -UDNS_DATA_API extern struct dns_ctx dns_defctx; - -/* initialize default resolver context and open it if do_open is true. - * <0 on failure. */ -UDNS_API dns_socket -dns_init(int do_open); - -/* return new resolver context with the same settings as copy */ -UDNS_API struct dns_ctx * -dns_new(const struct dns_ctx *copy); - -/* free resolver context; all queries are dropped */ -UDNS_API void -dns_free(struct dns_ctx *ctx); - -/* add nameserver for a resolver context (or reset nslist if serv==NULL) */ -UDNS_API int -dns_add_serv(struct dns_ctx *ctx, const char *serv); - -/* add nameserver using struct sockaddr array (with ports etc) */ -UDNS_API int -dns_add_serv_s(struct dns_ctx *ctx, const struct sockaddr *sa); - -/* add search list element for a resolver context (or reset it if srch==NULL) */ -UDNS_API int -dns_add_srch(struct dns_ctx *ctx, const char *srch); - -/* set options for a resolver context */ -UDNS_API int -dns_set_opts(struct dns_ctx *ctx, const char *opts); - -enum dns_opt { /* options */ - DNS_OPT_FLAGS, /* flags, DNS_F_XXX */ - DNS_OPT_TIMEOUT, /* timeout in secounds */ - DNS_OPT_NTRIES, /* number of retries */ - DNS_OPT_NDOTS, /* ndots */ - DNS_OPT_UDPSIZE, /* EDNS0 UDP size */ - DNS_OPT_PORT, /* port to use */ -}; - -/* set or get (if val<0) an option */ -UDNS_API int -dns_set_opt(struct dns_ctx *ctx, enum dns_opt opt, int val); - -enum dns_flags { - DNS_NOSRCH = 0x00010000, /* do not perform search */ - DNS_NORD = 0x00020000, /* request no recursion */ - DNS_AAONLY = 0x00040000, /* set AA flag in queries */ - DNS_PASSALL = 0x00080000, /* pass all replies to application */ -}; - -/* set the debug function pointer */ -typedef void -(dns_dbgfn)(int code, const struct sockaddr *sa, unsigned salen, - dnscc_t *pkt, int plen, - const struct dns_query *q, void *data); -UDNS_API void -dns_set_dbgfn(struct dns_ctx *ctx, dns_dbgfn *dbgfn); - -/* open and return UDP socket */ -UDNS_API dns_socket -dns_open(struct dns_ctx *ctx); - -/* return UDP socket or -1 if not open */ -UDNS_API dns_socket -dns_sock(const struct dns_ctx *ctx); - -/* close the UDP socket */ -UDNS_API void -dns_close(struct dns_ctx *ctx); - -/* return number of requests queued */ -UDNS_API int -dns_active(const struct dns_ctx *ctx); - -/* return status of the last operation */ -UDNS_API int -dns_status(const struct dns_ctx *ctx); -UDNS_API void -dns_setstatus(struct dns_ctx *ctx, int status); - -/* handle I/O event on UDP socket */ -UDNS_API void -dns_ioevent(struct dns_ctx *ctx, time_t now); - -/* process any timeouts, return time in secounds to the - * next timeout (or -1 if none) but not greather than maxwait */ -UDNS_API int -dns_timeouts(struct dns_ctx *ctx, int maxwait, time_t now); - -/* define timer requesting routine to use */ -typedef void dns_utm_fn(struct dns_ctx *ctx, int timeout, void *data); -UDNS_API void -dns_set_tmcbck(struct dns_ctx *ctx, dns_utm_fn *fn, void *data); - -/**************************************************************************/ -/**************** Making Queries ******************************************/ - -/* query callback routine */ -typedef void dns_query_fn(struct dns_ctx *ctx, void *result, void *data); - -/* query parse routine: raw DNS => application structure */ -typedef int -dns_parse_fn(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **res); - -enum dns_status { - DNS_E_NOERROR = 0, /* ok, not an error */ - DNS_E_TEMPFAIL = -1, /* timeout, SERVFAIL or similar */ - DNS_E_PROTOCOL = -2, /* got garbled reply */ - DNS_E_NXDOMAIN = -3, /* domain does not exists */ - DNS_E_NODATA = -4, /* domain exists but no data of reqd type */ - DNS_E_NOMEM = -5, /* out of memory while processing */ - DNS_E_BADQUERY = -6 /* the query is malformed */ -}; - -/* submit generic DN query */ -UDNS_API struct dns_query * -dns_submit_dn(struct dns_ctx *ctx, - dnscc_t *dn, int qcls, int qtyp, int flags, - dns_parse_fn *parse, dns_query_fn *cbck, void *data); -/* submit generic name query */ -UDNS_API struct dns_query * -dns_submit_p(struct dns_ctx *ctx, - const char *name, int qcls, int qtyp, int flags, - dns_parse_fn *parse, dns_query_fn *cbck, void *data); - -/* cancel the given async query in progress */ -UDNS_API int -dns_cancel(struct dns_ctx *ctx, struct dns_query *q); - -/* resolve a generic query, return the answer */ -UDNS_API void * -dns_resolve_dn(struct dns_ctx *ctx, - dnscc_t *qdn, int qcls, int qtyp, int flags, - dns_parse_fn *parse); -UDNS_API void * -dns_resolve_p(struct dns_ctx *ctx, - const char *qname, int qcls, int qtyp, int flags, - dns_parse_fn *parse); -UDNS_API void * -dns_resolve(struct dns_ctx *ctx, struct dns_query *q); - - -/* Specific RR handlers */ - -#define dns_rr_common(prefix) \ - char *prefix##_cname; /* canonical name */ \ - char *prefix##_qname; /* original query name */ \ - unsigned prefix##_ttl; /* TTL value */ \ - int prefix##_nrr /* number of records */ - -struct dns_rr_null { /* NULL RRset, aka RRset template */ - dns_rr_common(dnsn); -}; - -UDNS_API int -dns_stdrr_size(const struct dns_parse *p); -UDNS_API void * -dns_stdrr_finish(struct dns_rr_null *ret, char *cp, const struct dns_parse *p); - -struct dns_rr_a4 { /* the A RRset */ - dns_rr_common(dnsa4); - struct in_addr *dnsa4_addr; /* array of addresses, naddr elements */ -}; - -UDNS_API dns_parse_fn dns_parse_a4; /* A RR parsing routine */ -typedef void /* A query callback routine */ -dns_query_a4_fn(struct dns_ctx *ctx, struct dns_rr_a4 *result, void *data); - -/* submit A IN query */ -UDNS_API struct dns_query * -dns_submit_a4(struct dns_ctx *ctx, const char *name, int flags, - dns_query_a4_fn *cbck, void *data); - -/* resolve A IN query */ -UDNS_API struct dns_rr_a4 * -dns_resolve_a4(struct dns_ctx *ctx, const char *name, int flags); - - -struct dns_rr_a6 { /* the AAAA RRset */ - dns_rr_common(dnsa6); - struct in6_addr *dnsa6_addr; /* array of addresses, naddr elements */ -}; - -UDNS_API dns_parse_fn dns_parse_a6; /* A RR parsing routine */ -typedef void /* A query callback routine */ -dns_query_a6_fn(struct dns_ctx *ctx, struct dns_rr_a6 *result, void *data); - -/* submit AAAA IN query */ -UDNS_API struct dns_query * -dns_submit_a6(struct dns_ctx *ctx, const char *name, int flags, - dns_query_a6_fn *cbck, void *data); - -/* resolve AAAA IN query */ -UDNS_API struct dns_rr_a6 * -dns_resolve_a6(struct dns_ctx *ctx, const char *name, int flags); - - -struct dns_rr_ptr { /* the PTR RRset */ - dns_rr_common(dnsptr); - char **dnsptr_ptr; /* array of PTRs */ -}; - -UDNS_API dns_parse_fn dns_parse_ptr; /* PTR RR parsing routine */ -typedef void /* PTR query callback */ -dns_query_ptr_fn(struct dns_ctx *ctx, struct dns_rr_ptr *result, void *data); -/* submit PTR IN in-addr.arpa query */ -UDNS_API struct dns_query * -dns_submit_a4ptr(struct dns_ctx *ctx, const struct in_addr *addr, - dns_query_ptr_fn *cbck, void *data); -/* resolve PTR IN in-addr.arpa query */ -UDNS_API struct dns_rr_ptr * -dns_resolve_a4ptr(struct dns_ctx *ctx, const struct in_addr *addr); - -/* the same as above, but for ip6.arpa */ -UDNS_API struct dns_query * -dns_submit_a6ptr(struct dns_ctx *ctx, const struct in6_addr *addr, - dns_query_ptr_fn *cbck, void *data); -UDNS_API struct dns_rr_ptr * -dns_resolve_a6ptr(struct dns_ctx *ctx, const struct in6_addr *addr); - - -struct dns_mx { /* single MX RR */ - int priority; /* MX priority */ - char *name; /* MX name */ -}; -struct dns_rr_mx { /* the MX RRset */ - dns_rr_common(dnsmx); - struct dns_mx *dnsmx_mx; /* array of MXes */ -}; -UDNS_API dns_parse_fn dns_parse_mx; /* MX RR parsing routine */ -typedef void /* MX RR callback */ -dns_query_mx_fn(struct dns_ctx *ctx, struct dns_rr_mx *result, void *data); -/* submit MX IN query */ -UDNS_API struct dns_query * -dns_submit_mx(struct dns_ctx *ctx, const char *name, int flags, - dns_query_mx_fn *cbck, void *data); -/* resolve MX IN query */ -UDNS_API struct dns_rr_mx * -dns_resolve_mx(struct dns_ctx *ctx, const char *name, int flags); - - -struct dns_txt { /* single TXT record */ - int len; /* length of the text */ - dnsc_t *txt; /* pointer to text buffer. May contain nulls. */ -}; -struct dns_rr_txt { /* the TXT RRset */ - dns_rr_common(dnstxt); - struct dns_txt *dnstxt_txt; /* array of TXT records */ -}; -UDNS_API dns_parse_fn dns_parse_txt; /* TXT RR parsing routine */ -typedef void /* TXT RR callback */ -dns_query_txt_fn(struct dns_ctx *ctx, struct dns_rr_txt *result, void *data); -/* submit TXT query */ -UDNS_API struct dns_query * -dns_submit_txt(struct dns_ctx *ctx, const char *name, int qcls, int flags, - dns_query_txt_fn *cbck, void *data); -/* resolve TXT query */ -UDNS_API struct dns_rr_txt * -dns_resolve_txt(struct dns_ctx *ctx, const char *name, int qcls, int flags); - - -struct dns_srv { /* single SRV RR */ - int priority; /* SRV priority */ - int weight; /* SRV weight */ - int port; /* SRV port */ - char *name; /* SRV name */ -}; -struct dns_rr_srv { /* the SRV RRset */ - dns_rr_common(dnssrv); - struct dns_srv *dnssrv_srv; /* array of SRVes */ -}; -UDNS_API dns_parse_fn dns_parse_srv; /* SRV RR parsing routine */ -typedef void /* SRV RR callback */ -dns_query_srv_fn(struct dns_ctx *ctx, struct dns_rr_srv *result, void *data); -/* submit SRV IN query */ -UDNS_API struct dns_query * -dns_submit_srv(struct dns_ctx *ctx, - const char *name, const char *srv, const char *proto, - int flags, dns_query_srv_fn *cbck, void *data); -/* resolve SRV IN query */ -UDNS_API struct dns_rr_srv * -dns_resolve_srv(struct dns_ctx *ctx, - const char *name, const char *srv, const char *proto, - int flags); - -/* NAPTR (RFC3403) RR type */ -struct dns_naptr { /* single NAPTR RR */ - int order; /* NAPTR order */ - int preference; /* NAPTR preference */ - char *flags; /* NAPTR flags */ - char *service; /* NAPTR service */ - char *regexp; /* NAPTR regexp */ - char *replacement; /* NAPTR replacement */ -}; - -struct dns_rr_naptr { /* the NAPTR RRset */ - dns_rr_common(dnsnaptr); - struct dns_naptr *dnsnaptr_naptr; /* array of NAPTRes */ -}; -UDNS_API dns_parse_fn dns_parse_naptr; /* NAPTR RR parsing routine */ -typedef void /* NAPTR RR callback */ -dns_query_naptr_fn(struct dns_ctx *ctx, - struct dns_rr_naptr *result, void *data); -/* submit NAPTR IN query */ -UDNS_API struct dns_query * -dns_submit_naptr(struct dns_ctx *ctx, const char *name, int flags, - dns_query_naptr_fn *cbck, void *data); -/* resolve NAPTR IN query */ -UDNS_API struct dns_rr_naptr * -dns_resolve_naptr(struct dns_ctx *ctx, const char *name, int flags); - - -UDNS_API struct dns_query * -dns_submit_a4dnsbl(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl, - dns_query_a4_fn *cbck, void *data); -UDNS_API struct dns_query * -dns_submit_a4dnsbl_txt(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl, - dns_query_txt_fn *cbck, void *data); -UDNS_API struct dns_rr_a4 * -dns_resolve_a4dnsbl(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl); -UDNS_API struct dns_rr_txt * -dns_resolve_a4dnsbl_txt(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl); - -UDNS_API struct dns_query * -dns_submit_a6dnsbl(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl, - dns_query_a4_fn *cbck, void *data); -UDNS_API struct dns_query * -dns_submit_a6dnsbl_txt(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl, - dns_query_txt_fn *cbck, void *data); -UDNS_API struct dns_rr_a4 * -dns_resolve_a6dnsbl(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl); -UDNS_API struct dns_rr_txt * -dns_resolve_a6dnsbl_txt(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl); - -UDNS_API struct dns_query * -dns_submit_rhsbl(struct dns_ctx *ctx, - const char *name, const char *rhsbl, - dns_query_a4_fn *cbck, void *data); -UDNS_API struct dns_query * -dns_submit_rhsbl_txt(struct dns_ctx *ctx, - const char *name, const char *rhsbl, - dns_query_txt_fn *cbck, void *data); -UDNS_API struct dns_rr_a4 * -dns_resolve_rhsbl(struct dns_ctx *ctx, const char *name, const char *rhsbl); -UDNS_API struct dns_rr_txt * -dns_resolve_rhsbl_txt(struct dns_ctx *ctx, const char *name, const char *rhsbl); - -/**************************************************************************/ -/**************** Names, Names ********************************************/ - -struct dns_nameval { - int val; - const char *name; -}; - -UDNS_DATA_API extern const struct dns_nameval dns_classtab[]; -UDNS_DATA_API extern const struct dns_nameval dns_typetab[]; -UDNS_DATA_API extern const struct dns_nameval dns_rcodetab[]; -UDNS_API int -dns_findname(const struct dns_nameval *nv, const char *name); -#define dns_findclassname(cls) dns_findname(dns_classtab, (cls)) -#define dns_findtypename(type) dns_findname(dns_typetab, (type)) -#define dns_findrcodename(rcode) dns_findname(dns_rcodetab, (rcode)) - -UDNS_API const char *dns_classname(enum dns_class cls); -UDNS_API const char *dns_typename(enum dns_type type); -UDNS_API const char *dns_rcodename(enum dns_rcode rcode); -const char *_dns_format_code(char *buf, const char *prefix, int code); - -UDNS_API const char *dns_strerror(int errnum); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* include guard */ diff --git a/libs/udns/udns_bl.c b/libs/udns/udns_bl.c deleted file mode 100644 index dc6f53b164..0000000000 --- a/libs/udns/udns_bl.c +++ /dev/null @@ -1,160 +0,0 @@ -/* $Id: udns_bl.c,v 1.10 2005/09/12 10:55:21 mjt Exp $ - DNSBL stuff - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include "udns.h" -#ifndef NULL -# define NULL 0 -#endif - -struct dns_query * -dns_submit_a4dnsbl(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl, - dns_query_a4_fn *cbck, void *data) { - dnsc_t dn[DNS_MAXDN]; - if (dns_a4ptodn(addr, dnsbl, dn, sizeof(dn)) <= 0) { - dns_setstatus(ctx, DNS_E_BADQUERY); - return NULL; - } - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_A, DNS_NOSRCH, - dns_parse_a4, (dns_query_fn*)cbck, data); -} - -struct dns_query * -dns_submit_a4dnsbl_txt(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl, - dns_query_txt_fn *cbck, void *data) { - dnsc_t dn[DNS_MAXDN]; - if (dns_a4ptodn(addr, dnsbl, dn, sizeof(dn)) <= 0) { - dns_setstatus(ctx, DNS_E_BADQUERY); - return NULL; - } - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_TXT, DNS_NOSRCH, - dns_parse_txt, (dns_query_fn*)cbck, data); -} - -struct dns_rr_a4 * -dns_resolve_a4dnsbl(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl) { - return (struct dns_rr_a4 *) - dns_resolve(ctx, dns_submit_a4dnsbl(ctx, addr, dnsbl, 0, 0)); -} - -struct dns_rr_txt * -dns_resolve_a4dnsbl_txt(struct dns_ctx *ctx, - const struct in_addr *addr, const char *dnsbl) { - return (struct dns_rr_txt *) - dns_resolve(ctx, dns_submit_a4dnsbl_txt(ctx, addr, dnsbl, 0, 0)); -} - - -struct dns_query * -dns_submit_a6dnsbl(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl, - dns_query_a4_fn *cbck, void *data) { - dnsc_t dn[DNS_MAXDN]; - if (dns_a6ptodn(addr, dnsbl, dn, sizeof(dn)) <= 0) { - dns_setstatus(ctx, DNS_E_BADQUERY); - return NULL; - } - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_A, DNS_NOSRCH, - dns_parse_a4, (dns_query_fn*)cbck, data); -} - -struct dns_query * -dns_submit_a6dnsbl_txt(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl, - dns_query_txt_fn *cbck, void *data) { - dnsc_t dn[DNS_MAXDN]; - if (dns_a6ptodn(addr, dnsbl, dn, sizeof(dn)) <= 0) { - dns_setstatus(ctx, DNS_E_BADQUERY); - return NULL; - } - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_TXT, DNS_NOSRCH, - dns_parse_txt, (dns_query_fn*)cbck, data); -} - -struct dns_rr_a4 * -dns_resolve_a6dnsbl(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl) { - return (struct dns_rr_a4 *) - dns_resolve(ctx, dns_submit_a6dnsbl(ctx, addr, dnsbl, 0, 0)); -} - -struct dns_rr_txt * -dns_resolve_a6dnsbl_txt(struct dns_ctx *ctx, - const struct in6_addr *addr, const char *dnsbl) { - return (struct dns_rr_txt *) - dns_resolve(ctx, dns_submit_a6dnsbl_txt(ctx, addr, dnsbl, 0, 0)); -} - -static int -dns_rhsbltodn(const char *name, const char *rhsbl, dnsc_t dn[DNS_MAXDN]) -{ - int l = dns_sptodn(name, dn, DNS_MAXDN); - if (l <= 0) return 0; - l = dns_sptodn(rhsbl, dn+l-1, DNS_MAXDN-l+1); - if (l <= 0) return 0; - return 1; -} - -struct dns_query * -dns_submit_rhsbl(struct dns_ctx *ctx, const char *name, const char *rhsbl, - dns_query_a4_fn *cbck, void *data) { - dnsc_t dn[DNS_MAXDN]; - if (!dns_rhsbltodn(name, rhsbl, dn)) { - dns_setstatus(ctx, DNS_E_BADQUERY); - return NULL; - } - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_A, DNS_NOSRCH, - dns_parse_a4, (dns_query_fn*)cbck, data); -} -struct dns_query * -dns_submit_rhsbl_txt(struct dns_ctx *ctx, const char *name, const char *rhsbl, - dns_query_txt_fn *cbck, void *data) { - dnsc_t dn[DNS_MAXDN]; - if (!dns_rhsbltodn(name, rhsbl, dn)) { - dns_setstatus(ctx, DNS_E_BADQUERY); - return NULL; - } - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_TXT, DNS_NOSRCH, - dns_parse_txt, (dns_query_fn*)cbck, data); -} - -struct dns_rr_a4 * -dns_resolve_rhsbl(struct dns_ctx *ctx, const char *name, const char *rhsbl) { - return (struct dns_rr_a4*) - dns_resolve(ctx, dns_submit_rhsbl(ctx, name, rhsbl, 0, 0)); -} - -struct dns_rr_txt * -dns_resolve_rhsbl_txt(struct dns_ctx *ctx, const char *name, const char *rhsbl) -{ - return (struct dns_rr_txt*) - dns_resolve(ctx, dns_submit_rhsbl_txt(ctx, name, rhsbl, 0, 0)); -} diff --git a/libs/udns/udns_codes.c b/libs/udns/udns_codes.c deleted file mode 100644 index a5ffce7eda..0000000000 --- a/libs/udns/udns_codes.c +++ /dev/null @@ -1,171 +0,0 @@ -/* Automatically generated. */ -#include "udns.h" - -const struct dns_nameval dns_typetab[] = { - {DNS_T_INVALID,"INVALID"}, - {DNS_T_A,"A"}, - {DNS_T_NS,"NS"}, - {DNS_T_MD,"MD"}, - {DNS_T_MF,"MF"}, - {DNS_T_CNAME,"CNAME"}, - {DNS_T_SOA,"SOA"}, - {DNS_T_MB,"MB"}, - {DNS_T_MG,"MG"}, - {DNS_T_MR,"MR"}, - {DNS_T_NULL,"NULL"}, - {DNS_T_WKS,"WKS"}, - {DNS_T_PTR,"PTR"}, - {DNS_T_HINFO,"HINFO"}, - {DNS_T_MINFO,"MINFO"}, - {DNS_T_MX,"MX"}, - {DNS_T_TXT,"TXT"}, - {DNS_T_RP,"RP"}, - {DNS_T_AFSDB,"AFSDB"}, - {DNS_T_X25,"X25"}, - {DNS_T_ISDN,"ISDN"}, - {DNS_T_RT,"RT"}, - {DNS_T_NSAP,"NSAP"}, - {DNS_T_NSAP_PTR,"NSAP_PTR"}, - {DNS_T_SIG,"SIG"}, - {DNS_T_KEY,"KEY"}, - {DNS_T_PX,"PX"}, - {DNS_T_GPOS,"GPOS"}, - {DNS_T_AAAA,"AAAA"}, - {DNS_T_LOC,"LOC"}, - {DNS_T_NXT,"NXT"}, - {DNS_T_EID,"EID"}, - {DNS_T_NIMLOC,"NIMLOC"}, - {DNS_T_SRV,"SRV"}, - {DNS_T_ATMA,"ATMA"}, - {DNS_T_NAPTR,"NAPTR"}, - {DNS_T_KX,"KX"}, - {DNS_T_CERT,"CERT"}, - {DNS_T_A6,"A6"}, - {DNS_T_DNAME,"DNAME"}, - {DNS_T_SINK,"SINK"}, - {DNS_T_OPT,"OPT"}, - {DNS_T_DS,"DS"}, - {DNS_T_NSEC,"NSEC"}, - {DNS_T_TSIG,"TSIG"}, - {DNS_T_IXFR,"IXFR"}, - {DNS_T_AXFR,"AXFR"}, - {DNS_T_MAILB,"MAILB"}, - {DNS_T_MAILA,"MAILA"}, - {DNS_T_ANY,"ANY"}, - {DNS_T_ZXFR,"ZXFR"}, - {DNS_T_MAX,"MAX"}, - {0,0}}; -const char *dns_typename(enum dns_type code) { - static char nm[20]; - switch(code) { - case DNS_T_INVALID: return dns_typetab[0].name; - case DNS_T_A: return dns_typetab[1].name; - case DNS_T_NS: return dns_typetab[2].name; - case DNS_T_MD: return dns_typetab[3].name; - case DNS_T_MF: return dns_typetab[4].name; - case DNS_T_CNAME: return dns_typetab[5].name; - case DNS_T_SOA: return dns_typetab[6].name; - case DNS_T_MB: return dns_typetab[7].name; - case DNS_T_MG: return dns_typetab[8].name; - case DNS_T_MR: return dns_typetab[9].name; - case DNS_T_NULL: return dns_typetab[10].name; - case DNS_T_WKS: return dns_typetab[11].name; - case DNS_T_PTR: return dns_typetab[12].name; - case DNS_T_HINFO: return dns_typetab[13].name; - case DNS_T_MINFO: return dns_typetab[14].name; - case DNS_T_MX: return dns_typetab[15].name; - case DNS_T_TXT: return dns_typetab[16].name; - case DNS_T_RP: return dns_typetab[17].name; - case DNS_T_AFSDB: return dns_typetab[18].name; - case DNS_T_X25: return dns_typetab[19].name; - case DNS_T_ISDN: return dns_typetab[20].name; - case DNS_T_RT: return dns_typetab[21].name; - case DNS_T_NSAP: return dns_typetab[22].name; - case DNS_T_NSAP_PTR: return dns_typetab[23].name; - case DNS_T_SIG: return dns_typetab[24].name; - case DNS_T_KEY: return dns_typetab[25].name; - case DNS_T_PX: return dns_typetab[26].name; - case DNS_T_GPOS: return dns_typetab[27].name; - case DNS_T_AAAA: return dns_typetab[28].name; - case DNS_T_LOC: return dns_typetab[29].name; - case DNS_T_NXT: return dns_typetab[30].name; - case DNS_T_EID: return dns_typetab[31].name; - case DNS_T_NIMLOC: return dns_typetab[32].name; - case DNS_T_SRV: return dns_typetab[33].name; - case DNS_T_ATMA: return dns_typetab[34].name; - case DNS_T_NAPTR: return dns_typetab[35].name; - case DNS_T_KX: return dns_typetab[36].name; - case DNS_T_CERT: return dns_typetab[37].name; - case DNS_T_A6: return dns_typetab[38].name; - case DNS_T_DNAME: return dns_typetab[39].name; - case DNS_T_SINK: return dns_typetab[40].name; - case DNS_T_OPT: return dns_typetab[41].name; - case DNS_T_DS: return dns_typetab[42].name; - case DNS_T_NSEC: return dns_typetab[43].name; - case DNS_T_TSIG: return dns_typetab[44].name; - case DNS_T_IXFR: return dns_typetab[45].name; - case DNS_T_AXFR: return dns_typetab[46].name; - case DNS_T_MAILB: return dns_typetab[47].name; - case DNS_T_MAILA: return dns_typetab[48].name; - case DNS_T_ANY: return dns_typetab[49].name; - case DNS_T_ZXFR: return dns_typetab[50].name; - case DNS_T_MAX: return dns_typetab[51].name; - } - return _dns_format_code(nm,"type",code); -} - -const struct dns_nameval dns_classtab[] = { - {DNS_C_INVALID,"INVALID"}, - {DNS_C_IN,"IN"}, - {DNS_C_CH,"CH"}, - {DNS_C_HS,"HS"}, - {DNS_C_ANY,"ANY"}, - {0,0}}; -const char *dns_classname(enum dns_class code) { - static char nm[20]; - switch(code) { - case DNS_C_INVALID: return dns_classtab[0].name; - case DNS_C_IN: return dns_classtab[1].name; - case DNS_C_CH: return dns_classtab[2].name; - case DNS_C_HS: return dns_classtab[3].name; - case DNS_C_ANY: return dns_classtab[4].name; - } - return _dns_format_code(nm,"class",code); -} - -const struct dns_nameval dns_rcodetab[] = { - {DNS_R_NOERROR,"NOERROR"}, - {DNS_R_FORMERR,"FORMERR"}, - {DNS_R_SERVFAIL,"SERVFAIL"}, - {DNS_R_NXDOMAIN,"NXDOMAIN"}, - {DNS_R_NOTIMPL,"NOTIMPL"}, - {DNS_R_REFUSED,"REFUSED"}, - {DNS_R_YXDOMAIN,"YXDOMAIN"}, - {DNS_R_YXRRSET,"YXRRSET"}, - {DNS_R_NXRRSET,"NXRRSET"}, - {DNS_R_NOTAUTH,"NOTAUTH"}, - {DNS_R_NOTZONE,"NOTZONE"}, - {DNS_R_BADSIG,"BADSIG"}, - {DNS_R_BADKEY,"BADKEY"}, - {DNS_R_BADTIME,"BADTIME"}, - {0,0}}; -const char *dns_rcodename(enum dns_rcode code) { - static char nm[20]; - switch(code) { - case DNS_R_NOERROR: return dns_rcodetab[0].name; - case DNS_R_FORMERR: return dns_rcodetab[1].name; - case DNS_R_SERVFAIL: return dns_rcodetab[2].name; - case DNS_R_NXDOMAIN: return dns_rcodetab[3].name; - case DNS_R_NOTIMPL: return dns_rcodetab[4].name; - case DNS_R_REFUSED: return dns_rcodetab[5].name; - case DNS_R_YXDOMAIN: return dns_rcodetab[6].name; - case DNS_R_YXRRSET: return dns_rcodetab[7].name; - case DNS_R_NXRRSET: return dns_rcodetab[8].name; - case DNS_R_NOTAUTH: return dns_rcodetab[9].name; - case DNS_R_NOTZONE: return dns_rcodetab[10].name; - case DNS_R_BADSIG: return dns_rcodetab[11].name; - case DNS_R_BADKEY: return dns_rcodetab[12].name; - case DNS_R_BADTIME: return dns_rcodetab[13].name; - } - return _dns_format_code(nm,"rcode",code); -} diff --git a/libs/udns/udns_dn.c b/libs/udns/udns_dn.c deleted file mode 100644 index 32cd8fd52e..0000000000 --- a/libs/udns/udns_dn.c +++ /dev/null @@ -1,382 +0,0 @@ -/* $Id: udns_dn.c,v 1.7 2006/11/28 22:45:20 mjt Exp $ - domain names manipulation routines - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include "udns.h" - -unsigned dns_dnlen(dnscc_t *dn) { - register dnscc_t *d = dn; - while(*d) - d += 1 + *d; - return (unsigned)(d - dn) + 1; -} - -unsigned dns_dnlabels(register dnscc_t *dn) { - register unsigned l = 0; - while(*dn) - ++l, dn += 1 + *dn; - return l; -} - -unsigned dns_dnequal(register dnscc_t *dn1, register dnscc_t *dn2) { - register unsigned c; - dnscc_t *dn = dn1; - for(;;) { - if ((c = *dn1++) != *dn2++) - return 0; - if (!c) - return (unsigned)(dn1 - dn); - while(c--) { - if (DNS_DNLC(*dn1) != DNS_DNLC(*dn2)) - return 0; - ++dn1; ++dn2; - } - } -} - -unsigned -dns_dntodn(dnscc_t *sdn, dnsc_t *ddn, unsigned ddnsiz) { - unsigned sdnlen = dns_dnlen(sdn); - if (ddnsiz < sdnlen) - return 0; - memcpy(ddn, sdn, sdnlen); - return sdnlen; -} - -int -dns_ptodn(const char *name, unsigned namelen, - dnsc_t *dn, unsigned dnsiz, int *isabs) -{ - dnsc_t *dp; /* current position in dn (len byte first) */ - dnsc_t *const de /* end of dn: last byte that can be filled up */ - = dn + (dnsiz >= DNS_MAXDN ? DNS_MAXDN : dnsiz) - 1; - dnscc_t *np = (dnscc_t *)name; - dnscc_t *ne = np + (namelen ? namelen : strlen((char*)np)); - dnsc_t *llab; /* start of last label (llab[-1] will be length) */ - unsigned c; /* next input character, or length of last label */ - - if (!dnsiz) - return 0; - dp = llab = dn + 1; - - while(np < ne) { - - if (*np == '.') { /* label delimiter */ - c = (unsigned)(dp - llab); /* length of the label */ - if (!c) { /* empty label */ - if (np == (dnscc_t *)name && np + 1 == ne) { - /* special case for root dn, aka `.' */ - ++np; - break; - } - return -1; /* zero label */ - } - if (c > DNS_MAXLABEL) - return -1; /* label too long */ - llab[-1] = (dnsc_t)c; /* update len of last label */ - llab = ++dp; /* start new label, llab[-1] will be len of it */ - ++np; - continue; - } - - /* check whenever we may put out one more byte */ - if (dp >= de) /* too long? */ - return dnsiz >= DNS_MAXDN ? -1 : 0; - if (*np != '\\') { /* non-escape, simple case */ - *dp++ = *np++; - continue; - } - /* handle \-style escape */ - /* note that traditionally, domain names (gethostbyname etc) - * used decimal \dd notation, not octal \ooo (RFC1035), so - * we're following this tradition here. - */ - if (++np == ne) - return -1; /* bad escape */ - else if (*np >= '0' && *np <= '9') { /* decimal number */ - /* we allow not only exactly 3 digits as per RFC1035, - * but also 2 or 1, for better usability. */ - c = *np++ - '0'; - if (np < ne && *np >= '0' && *np <= '9') { /* 2digits */ - c = c * 10 + *np++ - '0'; - if (np < ne && *np >= '0' && *np <= '9') { - c = c * 10 + *np++ - '0'; - if (c > 255) - return -1; /* bad escape */ - } - } - } - else - c = *np++; - *dp++ = (dnsc_t)c; /* place next out byte */ - } - - if ((c = (unsigned)(dp - llab)) > DNS_MAXLABEL) - return -1; /* label too long */ - if ((llab[-1] = (dnsc_t)c) != 0) { - *dp++ = 0; - if (isabs) - *isabs = 0; - } - else if (isabs) - *isabs = 1; - - return (int)(dp - dn); -} - -dnscc_t dns_inaddr_arpa_dn[14] = "\07in-addr\04arpa"; - -dnsc_t * -dns_a4todn_(const struct in_addr *addr, dnsc_t *dn, dnsc_t *dne) { - dnsc_t *p; - unsigned n; - dnscc_t *s = ((dnscc_t *)addr) + 4; - while(--s >= (dnscc_t *)addr) { - n = *s; - p = dn + 1; - if (n > 99) { - if (p + 2 > dne) return 0; - *p++ = n / 100 + '0'; - *p++ = (n % 100 / 10) + '0'; - *p = n % 10 + '0'; - } - else if (n > 9) { - if (p + 1 > dne) return 0; - *p++ = n / 10 + '0'; - *p = n % 10 + '0'; - } - else { - if (p > dne) return 0; - *p = n + '0'; - } - *dn = (dnsc_t)(p - dn); - dn = p + 1; - } - return dn; -} - -int dns_a4todn(const struct in_addr *addr, dnscc_t *tdn, - dnsc_t *dn, unsigned dnsiz) { - dnsc_t *dne = dn + (dnsiz > DNS_MAXDN ? DNS_MAXDN : dnsiz); - dnsc_t *p; - unsigned l; - p = dns_a4todn_(addr, dn, dne); - if (!p) return 0; - if (!tdn) - tdn = dns_inaddr_arpa_dn; - l = dns_dnlen(tdn); - if (p + l > dne) return dnsiz >= DNS_MAXDN ? -1 : 0; - memcpy(p, tdn, l); - return (int)((p + l) - dn); -} - -int dns_a4ptodn(const struct in_addr *addr, const char *tname, - dnsc_t *dn, unsigned dnsiz) { - dnsc_t *p; - int r; - if (!tname) - return dns_a4todn(addr, NULL, dn, dnsiz); - p = dns_a4todn_(addr, dn, dn + dnsiz); - if (!p) return 0; - r = dns_sptodn(tname, p, dnsiz - (p - dn)); - return r != 0 ? r : dnsiz >= DNS_MAXDN ? -1 : 0; -} - -dnscc_t dns_ip6_arpa_dn[10] = "\03ip6\04arpa"; - -dnsc_t * -dns_a6todn_(const struct in6_addr *addr, dnsc_t *dn, dnsc_t *dne) { - unsigned n; - dnscc_t *s = ((dnscc_t *)addr) + 16; - if (dn + 64 > dne) return 0; - while(--s >= (dnscc_t *)addr) { - *dn++ = 1; - n = *s & 0x0f; - *dn++ = n > 9 ? n + 'a' - 10 : n + '0'; - *dn++ = 1; - n = *s >> 4; - *dn++ = n > 9 ? n + 'a' - 10 : n + '0'; - } - return dn; -} - -int dns_a6todn(const struct in6_addr *addr, dnscc_t *tdn, - dnsc_t *dn, unsigned dnsiz) { - dnsc_t *dne = dn + (dnsiz > DNS_MAXDN ? DNS_MAXDN : dnsiz); - dnsc_t *p; - unsigned l; - p = dns_a6todn_(addr, dn, dne); - if (!p) return 0; - if (!tdn) - tdn = dns_ip6_arpa_dn; - l = dns_dnlen(tdn); - if (p + l > dne) return dnsiz >= DNS_MAXDN ? -1 : 0; - memcpy(p, tdn, l); - return (int)((p + l) - dn); -} - -int dns_a6ptodn(const struct in6_addr *addr, const char *tname, - dnsc_t *dn, unsigned dnsiz) { - dnsc_t *p; - int r; - if (!tname) - return dns_a6todn(addr, NULL, dn, dnsiz); - p = dns_a6todn_(addr, dn, dn + dnsiz); - if (!p) return 0; - r = dns_sptodn(tname, p, dnsiz - (p - dn)); - return r != 0 ? r : dnsiz >= DNS_MAXDN ? -1 : 0; -} - -/* return size of buffer required to convert the dn into asciiz string. - * Keep in sync with dns_dntop() below. - */ -unsigned dns_dntop_size(dnscc_t *dn) { - unsigned size = 0; /* the size reqd */ - dnscc_t *le; /* label end */ - - while(*dn) { - /* *dn is the length of the next label, non-zero */ - if (size) - ++size; /* for the dot */ - le = dn + *dn + 1; - ++dn; - do { - switch(*dn) { - case '.': - case '\\': - /* Special modifiers in zone files. */ - case '"': - case ';': - case '@': - case '$': - size += 2; - break; - default: - if (*dn <= 0x20 || *dn >= 0x7f) - /* \ddd decimal notation */ - size += 4; - else - size += 1; - } - } while(++dn < le); - } - size += 1; /* zero byte at the end - string terminator */ - return size > DNS_MAXNAME ? 0 : size; -} - -/* Convert the dn into asciiz string. - * Keep in sync with dns_dntop_size() above. - */ -int dns_dntop(dnscc_t *dn, char *name, unsigned namesiz) { - char *np = name; /* current name ptr */ - char *const ne = name + namesiz; /* end of name */ - dnscc_t *le; /* label end */ - - while(*dn) { - /* *dn is the length of the next label, non-zero */ - if (np != name) { - if (np >= ne) goto toolong; - *np++ = '.'; - } - le = dn + *dn + 1; - ++dn; - do { - switch(*dn) { - case '.': - case '\\': - /* Special modifiers in zone files. */ - case '"': - case ';': - case '@': - case '$': - if (np + 2 > ne) goto toolong; - *np++ = '\\'; - *np++ = *dn; - break; - default: - if (*dn <= 0x20 || *dn >= 0x7f) { - /* \ddd decimal notation */ - if (np + 4 >= ne) goto toolong; - *np++ = '\\'; - *np++ = '0' + (*dn / 100); - *np++ = '0' + ((*dn % 100) / 10); - *np++ = '0' + (*dn % 10); - } - else { - if (np >= ne) goto toolong; - *np++ = *dn; - } - } - } while(++dn < le); - } - if (np >= ne) goto toolong; - *np++ = '\0'; - return (int)(np - name); -toolong: - return namesiz >= DNS_MAXNAME ? -1 : 0; -} - -#ifdef TEST -#include -#include - -int main(int argc, char **argv) { - int i; - int sz; - dnsc_t dn[DNS_MAXDN+10]; - dnsc_t *dl, *dp; - int isabs; - - sz = (argc > 1) ? atoi(argv[1]) : 0; - - for(i = 2; i < argc; ++i) { - int r = dns_ptodn(argv[i], 0, dn, sz, &isabs); - printf("%s: ", argv[i]); - if (r < 0) printf("error\n"); - else if (!r) printf("buffer too small\n"); - else { - printf("len=%d dnlen=%d size=%d name:", - r, dns_dnlen(dn), dns_dntop_size(dn)); - dl = dn; - while(*dl) { - printf(" %d=", *dl); - dp = dl + 1; - dl = dp + *dl; - while(dp < dl) { - if (*dp <= ' ' || *dp >= 0x7f) - printf("\\%03d", *dp); - else if (*dp == '.' || *dp == '\\') - printf("\\%c", *dp); - else - putchar(*dp); - ++dp; - } - } - if (isabs) putchar('.'); - putchar('\n'); - } - } - return 0; -} - -#endif /* TEST */ diff --git a/libs/udns/udns_dntosp.c b/libs/udns/udns_dntosp.c deleted file mode 100644 index 933463e05a..0000000000 --- a/libs/udns/udns_dntosp.c +++ /dev/null @@ -1,30 +0,0 @@ -/* $Id: udns_dntosp.c,v 1.5 2005/04/19 21:48:09 mjt Exp $ - dns_dntosp() = convert DN to asciiz string using static buffer - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include "udns.h" - -static char name[DNS_MAXNAME]; - -const char *dns_dntosp(dnscc_t *dn) { - return dns_dntop(dn, name, sizeof(name)) > 0 ? name : 0; -} diff --git a/libs/udns/udns_misc.c b/libs/udns/udns_misc.c deleted file mode 100644 index 0db7ffd145..0000000000 --- a/libs/udns/udns_misc.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $Id: udns_misc.c,v 1.8 2005/04/05 22:51:32 mjt Exp $ - miscellaneous routines - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include "udns.h" - -int dns_findname(const struct dns_nameval *nv, const char *name) { - register const char *a, *b; - for(; nv->name; ++nv) - for(a = name, b = nv->name; ; ++a, ++b) - if (DNS_DNUC(*a) != *b) break; - else if (!*a) return nv->val; - return -1; -} - -const char *_dns_format_code(char *buf, const char *prefix, int code) { - char *bp = buf; - unsigned c, n; - do *bp++ = DNS_DNUC(*prefix); - while(*++prefix); - *bp++ = '#'; - if (code < 0) code = -code, *bp++ = '-'; - n = 0; c = code; - do ++n; - while((c /= 10)); - c = code; - bp[n--] = '\0'; - do bp[n--] = c % 10 + '0'; - while((c /= 10)); - return buf; -} - -const char *dns_strerror(int err) { - if (err >= 0) return "successeful completion"; - switch(err) { - case DNS_E_TEMPFAIL: return "temporary failure in name resolution"; - case DNS_E_PROTOCOL: return "protocol error"; - case DNS_E_NXDOMAIN: return "domain name does not exist"; - case DNS_E_NODATA: return "valid domain but no data of requested type"; - case DNS_E_NOMEM: return "out of memory"; - case DNS_E_BADQUERY: return "malformed query"; - default: return "unknown error"; - } -} - -const char *dns_version(void) { - return UDNS_VERSION; -} diff --git a/libs/udns/udns_parse.c b/libs/udns/udns_parse.c deleted file mode 100644 index 198f5eea66..0000000000 --- a/libs/udns/udns_parse.c +++ /dev/null @@ -1,169 +0,0 @@ -/* $Id: udns_parse.c,v 1.14 2005/09/12 10:55:21 mjt Exp $ - raw DNS packet parsing routines - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include "udns.h" - -dnscc_t *dns_skipdn(dnscc_t *cur, dnscc_t *end) { - unsigned c; - for(;;) { - if (cur >= end) - return NULL; - c = *cur++; - if (!c) - return cur; - if (c & 192) /* jump */ - return cur + 1 >= end ? NULL : cur + 1; - cur += c; - } -} - -int -dns_getdn(dnscc_t *pkt, dnscc_t **cur, dnscc_t *end, - register dnsc_t *dn, unsigned dnsiz) { - unsigned c; - dnscc_t *pp = *cur; /* current packet pointer */ - dnsc_t *dp = dn; /* current dn pointer */ - dnsc_t *const de /* end of the DN dest */ - = dn + (dnsiz < DNS_MAXDN ? dnsiz : DNS_MAXDN); - dnscc_t *jump = NULL; /* ptr after first jump if any */ - unsigned loop = 100; /* jump loop counter */ - - for(;;) { /* loop by labels */ - if (pp >= end) /* reached end of packet? */ - return -1; - c = *pp++; /* length of the label */ - if (!c) { /* empty label: terminate */ - if (dn >= de) /* can't fit terminator */ - goto noroom; - *dp++ = 0; - /* return next pos: either after the first jump or current */ - *cur = jump ? jump : pp; - return (int)(dp - dn); - } - if (c & 192) { /* jump */ - if (pp >= end) /* eop instead of jump pos */ - return -1; - if (!jump) jump = pp + 1; /* remember first jump */ - else if (!--loop) return -1; /* too many jumps */ - c = ((c & ~192) << 8) | *pp; /* new pos */ - if (c < DNS_HSIZE) /* don't allow jump into the header */ - return -1; - pp = pkt + c; - continue; - } - if (c > DNS_MAXLABEL) /* too long label? */ - return -1; - if (pp + c > end) /* label does not fit in packet? */ - return -1; - if (dp + c + 1 > de) /* if enouth room for the label */ - goto noroom; - *dp++ = c; /* label length */ - memcpy(dp, pp, c); /* and the label itself */ - dp += c; - pp += c; /* advance to the next label */ - } -noroom: - return dnsiz < DNS_MAXDN ? 0 : -1; -} - -void dns_rewind(struct dns_parse *p, dnscc_t *qdn) { - p->dnsp_qdn = qdn; - p->dnsp_cur = p->dnsp_ans; - p->dnsp_rrl = dns_numan(p->dnsp_pkt); - p->dnsp_ttl = 0xffffffffu; - p->dnsp_nrr = 0; -} - -void -dns_initparse(struct dns_parse *p, dnscc_t *qdn, - dnscc_t *pkt, dnscc_t *cur, dnscc_t *end) { - p->dnsp_pkt = pkt; - p->dnsp_end = end; - p->dnsp_rrl = dns_numan(pkt); - p->dnsp_qdn = qdn; - assert(cur + 4 <= end); - if ((p->dnsp_qtyp = dns_get16(cur+0)) == DNS_T_ANY) p->dnsp_qtyp = 0; - if ((p->dnsp_qcls = dns_get16(cur+2)) == DNS_C_ANY) p->dnsp_qcls = 0; - p->dnsp_cur = p->dnsp_ans = cur + 4; - p->dnsp_ttl = 0xffffffffu; - p->dnsp_nrr = 0; -} - -int dns_nextrr(struct dns_parse *p, struct dns_rr *rr) { - dnscc_t *cur = p->dnsp_cur; - while(p->dnsp_rrl > 0) { - --p->dnsp_rrl; - if (dns_getdn(p->dnsp_pkt, &cur, p->dnsp_end, - rr->dnsrr_dn, sizeof(rr->dnsrr_dn)) <= 0) - return -1; - if (cur + 10 > p->dnsp_end) - return -1; - rr->dnsrr_typ = dns_get16(cur); - rr->dnsrr_cls = dns_get16(cur+2); - rr->dnsrr_ttl = dns_get32(cur+4); - rr->dnsrr_dsz = dns_get16(cur+8); - rr->dnsrr_dptr = cur = cur + 10; - rr->dnsrr_dend = cur = cur + rr->dnsrr_dsz; - if (cur > p->dnsp_end) - return -1; - if (p->dnsp_qdn && !dns_dnequal(p->dnsp_qdn, rr->dnsrr_dn)) - continue; - if ((!p->dnsp_qcls || p->dnsp_qcls == rr->dnsrr_cls) && - (!p->dnsp_qtyp || p->dnsp_qtyp == rr->dnsrr_typ)) { - p->dnsp_cur = cur; - ++p->dnsp_nrr; - if (p->dnsp_ttl > rr->dnsrr_ttl) p->dnsp_ttl = rr->dnsrr_ttl; - return 1; - } - if (p->dnsp_qdn && rr->dnsrr_typ == DNS_T_CNAME && !p->dnsp_nrr) { - if (dns_getdn(p->dnsp_pkt, &rr->dnsrr_dptr, p->dnsp_end, - p->dnsp_dnbuf, sizeof(p->dnsp_dnbuf)) <= 0 || - rr->dnsrr_dptr != rr->dnsrr_dend) - return -1; - p->dnsp_qdn = p->dnsp_dnbuf; - if (p->dnsp_ttl > rr->dnsrr_ttl) p->dnsp_ttl = rr->dnsrr_ttl; - } - } - p->dnsp_cur = cur; - return 0; -} - -int dns_stdrr_size(const struct dns_parse *p) { - return - dns_dntop_size(p->dnsp_qdn) + - (p->dnsp_qdn == dns_payload(p->dnsp_pkt) ? 0 : - dns_dntop_size(dns_payload(p->dnsp_pkt))); -} - -void *dns_stdrr_finish(struct dns_rr_null *ret, char *cp, - const struct dns_parse *p) { - cp += dns_dntop(p->dnsp_qdn, (ret->dnsn_cname = cp), DNS_MAXNAME); - if (p->dnsp_qdn == dns_payload(p->dnsp_pkt)) - ret->dnsn_qname = ret->dnsn_cname; - else - dns_dntop(dns_payload(p->dnsp_pkt), (ret->dnsn_qname = cp), DNS_MAXNAME); - ret->dnsn_ttl = p->dnsp_ttl; - return ret; -} diff --git a/libs/udns/udns_resolver.c b/libs/udns/udns_resolver.c deleted file mode 100644 index acb3ca4dd7..0000000000 --- a/libs/udns/udns_resolver.c +++ /dev/null @@ -1,1373 +0,0 @@ -/* $Id: udns_resolver.c,v 1.57 2006/11/29 01:17:43 mjt Exp $ - resolver stuff (main module) - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#ifdef WIN32 -#ifdef _MSC_VER -#undef inline -#define inline __inline -#pragma warning(disable:4133) -#if (_MSC_VER >= 1400) // VC8+ -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE -#endif -#ifndef _CRT_NONSTDC_NO_DEPRECATE -#define _CRT_NONSTDC_NO_DEPRECATE -#endif -#endif // VC8+ -int udns_inet_pton(int, const char *, void *); -#include "process.h" -#else -#define udns_inet_pton inet_pton -#endif -# include /* includes */ -# include /* needed for struct in6_addr */ -# include /* for dns server addresses etc */ -# undef HAVE_POLL -#else -#define udns_inet_pton inet_pton -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif -# include -# include -# include -# include /* for inet_pton() */ -# include -# include -# include -# ifdef HAVE_POLL -# include -# endif -# define closesocket(sock) close(sock) -#endif /* !WIN32 */ - -#include -#include -#include -#include -#include -#include -#include "udns.h" - -#define DNS_QEXTRA 16 /* size of extra buffer space */ -#define DNS_QBUF DNS_HSIZE+DNS_MAXDN+DNS_QEXTRA - -#if !defined(HAVE_INET6) && defined(AF_INET6) -# define HAVE_INET6 1 -#endif -#ifdef NO_INET6 -# undef HAVE_INET6 -#endif - -#ifndef EAFNOSUPPORT -# define EAFNOSUPPORT EINVAL -#endif - -union usockaddr_ns { - struct sockaddr sa; - struct sockaddr_in sin; -#if HAVE_INET6 - struct sockaddr_in6 sin6; -#endif -}; - -struct dns_qlink { - struct dns_query *next, *prev; -}; - -struct dns_query { - struct dns_qlink dnsq_link; /* list entry (should be first) */ - dnsc_t dnsq_buf[DNS_QBUF]; /* the query buffer */ - enum dns_class dnsq_cls; /* requested RR class */ - enum dns_type dnsq_typ; /* requested RR type */ - unsigned dnsq_len; /* length of the query packet */ - unsigned dnsq_origdnl; /* original length of the dnsq_dn */ - unsigned dnsq_flags; /* control flags for this query */ - unsigned dnsq_servi; /* index of next server to try */ - unsigned dnsq_servwait; /* bitmask: servers left to wait */ - unsigned dnsq_servskip; /* bitmask: servers to skip */ - unsigned dnsq_try; /* number of tries made so far */ - unsigned dnsq_srchi; /* current search index */ - time_t dnsq_deadline; /* when current try will expire */ - dns_parse_fn *dnsq_parse; /* parse: raw => application */ - dns_query_fn *dnsq_cbck; /* the callback to call when done */ - void *dnsq_cbdata; /* user data for the callback */ -#ifndef NDEBUG - struct dns_ctx *dnsq_ctx; /* the resolver context */ -#endif -}; - -/* working with dns_query lists */ - -static inline void qlist_init(struct dns_qlink *list) { - list->next = list->prev = (struct dns_query *)list; -} - -static inline int qlist_empty(const struct dns_qlink *list) { - return list->next == (const struct dns_query *)list ? 1 : 0; -} - -static inline struct dns_query *qlist_first(struct dns_qlink *list) { - return list->next == (struct dns_query *)list ? 0 : list->next; -} - -static inline void qlist_remove(struct dns_query *q) { - q->dnsq_link.next->dnsq_link.prev = q->dnsq_link.prev; - q->dnsq_link.prev->dnsq_link.next = q->dnsq_link.next; -} - -static inline struct dns_query *qlist_pop(struct dns_qlink *list) { - struct dns_query *q = list->next; - if (q == (struct dns_query *)list) - return NULL; - qlist_remove(q); - return q; -} - -/* insert q between prev and next */ -static inline void -qlist_insert(struct dns_query *q, - struct dns_query *prev, struct dns_query *next) { - q->dnsq_link.next = next; - q->dnsq_link.prev = prev; - prev->dnsq_link.next = next->dnsq_link.prev = q; -} - -static inline void -qlist_insert_after(struct dns_query *q, struct dns_query *prev) { - qlist_insert(q, prev, prev->dnsq_link.next); -} - -static inline void -qlist_insert_before(struct dns_query *q, struct dns_query *next) { - qlist_insert(q, next->dnsq_link.prev, next); -} - -static inline void -qlist_add_tail(struct dns_query *q, struct dns_qlink *top) { - qlist_insert_before(q, (struct dns_query *)top); -} - -static inline void -qlist_add_head(struct dns_query *q, struct dns_qlink *top) { - qlist_insert_after(q, (struct dns_query *)top); -} - -#define QLIST_FIRST(list, direction) ((list)->direction) -#define QLIST_ISLAST(list, q) ((q) == (struct dns_query*)(list)) -#define QLIST_NEXT(q, direction) ((q)->dnsq_link.direction) - -#define QLIST_FOR_EACH(list, q, direction) \ - for(q = QLIST_FIRST(list, direction); \ - !QLIST_ISLAST(list, q); q = QLIST_NEXT(q, direction)) - -struct dns_ctx { /* resolver context */ - /* settings */ - unsigned dnsc_flags; /* various flags */ - unsigned dnsc_timeout; /* timeout (base value) for queries */ - unsigned dnsc_ntries; /* number of retries */ - unsigned dnsc_ndots; /* ndots to assume absolute name */ - unsigned dnsc_port; /* default port (DNS_PORT) */ - unsigned dnsc_udpbuf; /* size of UDP buffer */ - /* array of nameserver addresses */ - union usockaddr_ns dnsc_serv[DNS_MAXSERV]; - unsigned dnsc_nserv; /* number of nameservers */ - unsigned dnsc_salen; /* length of socket addresses */ - /* search list for unqualified names */ - dnsc_t dnsc_srch[DNS_MAXSRCH][DNS_MAXDN]; - unsigned dnsc_nsrch; /* number of srch[] */ - - dns_utm_fn *dnsc_utmfn; /* register/cancel timer events */ - void *dnsc_utmctx; /* user timer context for utmfn() */ - time_t dnsc_utmexp; /* when user timer expires */ - - dns_dbgfn *dnsc_udbgfn; /* debugging function */ - - /* dynamic data */ - unsigned short dnsc_nextid; /* next queue ID to use */ - dns_socket dnsc_udpsock; /* UDP socket */ - struct dns_qlink dnsc_qactive; /* active list sorted by deadline */ - int dnsc_nactive; /* number entries in dnsc_qactive */ - dnsc_t *dnsc_pbuf; /* packet buffer (udpbuf size) */ - int dnsc_qstatus; /* last query status value */ -}; - -static const struct { - const char *name; - enum dns_opt opt; - unsigned offset; - unsigned min, max; -} dns_opts[] = { -#define opt(name,opt,field,min,max) \ - {name,opt,offsetof(struct dns_ctx,field),min,max} - opt("retrans", DNS_OPT_TIMEOUT, dnsc_timeout, 1,300), - opt("timeout", DNS_OPT_TIMEOUT, dnsc_timeout, 1,300), - opt("retry", DNS_OPT_NTRIES, dnsc_ntries, 1,50), - opt("attempts", DNS_OPT_NTRIES, dnsc_ntries, 1,50), - opt("ndots", DNS_OPT_NDOTS, dnsc_ndots, 0,1000), - opt("port", DNS_OPT_PORT, dnsc_port, 1,0xffff), - opt("udpbuf", DNS_OPT_UDPSIZE, dnsc_udpbuf, DNS_MAXPACKET,65536), -#undef opt -}; -#define dns_ctxopt(ctx,offset) (*((unsigned*)(((char*)ctx)+offset))) - -#define ISSPACE(x) (x == ' ' || x == '\t' || x == '\r' || x == '\n') - -static const char space[] = " \t\r\n"; - -struct dns_ctx dns_defctx; - -#define SETCTX(ctx) if (!ctx) ctx = &dns_defctx -#define SETCTXINITED(ctx) SETCTX(ctx); assert(CTXINITED(ctx)) -#define CTXINITED(ctx) (ctx->dnsc_flags & DNS_INITED) -#define SETCTXFRESH(ctx) SETCTXINITED(ctx); assert(!CTXOPEN(ctx)) -#define SETCTXINACTIVE(ctx) SETCTXINITED(ctx); assert(qlist_empty(&ctx->dnsc_qactive)) -#define SETCTXOPEN(ctx) SETCTXINITED(ctx); assert(CTXOPEN(ctx)) -#ifdef WIN32 -#define CTXOPEN(ctx) (ctx->dnsc_udpsock != INVALID_SOCKET ) -#else -#define CTXOPEN(ctx) (ctx->dnsc_udpsock >= 0) -#ifndef INVALID_SOCKET -#define INVALID_SOCKET -1 -#endif -#endif - -#if defined(NDEBUG) || !defined(DEBUG) -#define dns_assert_ctx(ctx) -#else -static void dns_assert_ctx(const struct dns_ctx *ctx) { - int nactive = 0; - const struct dns_query *q; - QLIST_FOR_EACH(&ctx->dnsc_qactive, q, next) { - assert(q->dnsq_ctx == ctx); - assert(q->dnsq_link.next->dnsq_link.prev == q); - assert(q->dnsq_link.prev->dnsq_link.next == q); - ++nactive; - } - assert(nactive == ctx->dnsc_nactive); -} -#endif - -enum { - DNS_INTERNAL = 0xffff, /* internal flags mask */ - DNS_INITED = 0x0001, /* the context is initialized */ - DNS_ASIS_DONE = 0x0002, /* search: skip the last as-is query */ - DNS_SEEN_NODATA = 0x0004, /* search: NODATA has been received */ - DNS_SEEN_FAIL = 0x0008, /* search: SERVFAIL has been received */ - DNS_SEEN_WRONG = 0x0010, /* search: something wrong happened */ -}; - -static int dns_add_serv_internal(struct dns_ctx *ctx, const char *serv) { - union usockaddr_ns *sns; - if (!serv) - return (ctx->dnsc_nserv = 0); - if (ctx->dnsc_nserv >= DNS_MAXSERV) - return errno = ENFILE, -1; - sns = &ctx->dnsc_serv[ctx->dnsc_nserv]; - memset(sns, 0, sizeof(*sns)); -#if HAVE_INET6 - { struct in_addr addr; - struct in6_addr addr6; - if (udns_inet_pton(AF_INET, serv, &addr) > 0) { - sns->sin.sin_family = AF_INET; - sns->sin.sin_addr = addr; - return ++ctx->dnsc_nserv; - } - if (udns_inet_pton(AF_INET6, serv, &addr6) > 0) { - sns->sin6.sin6_family = AF_INET6; - sns->sin6.sin6_addr = addr6; - return ++ctx->dnsc_nserv; - } - } -#else - { struct in_addr addr; - if (inet_aton(serv, &addr) > 0) { - sns->sin.sin_family = AF_INET; - sns->sin.sin_addr = addr; - return ++ctx->dnsc_nserv; - } - } -#endif - errno = EINVAL; - return -1; -} - -int dns_add_serv(struct dns_ctx *ctx, const char *serv) { - SETCTXFRESH(ctx); - return dns_add_serv_internal(ctx, serv); -} - -static void dns_set_serv_internal(struct dns_ctx *ctx, char *serv) { - ctx->dnsc_nserv = 0; - for(serv = strtok(serv, space); serv; serv = strtok(NULL, space)) - dns_add_serv_internal(ctx, serv); -} - -static int -dns_add_serv_s_internal(struct dns_ctx *ctx, const struct sockaddr *sa) { - if (!sa) - return (ctx->dnsc_nserv = 0); - if (ctx->dnsc_nserv >= DNS_MAXSERV) - return errno = ENFILE, -1; -#if HAVE_INET6 - else if (sa->sa_family == AF_INET6) - ctx->dnsc_serv[ctx->dnsc_nserv].sin6 = *(struct sockaddr_in6*)sa; -#endif - else if (sa->sa_family == AF_INET) - ctx->dnsc_serv[ctx->dnsc_nserv].sin = *(struct sockaddr_in*)sa; - else - return errno = EAFNOSUPPORT, -1; - return ++ctx->dnsc_nserv; -} - -int dns_add_serv_s(struct dns_ctx *ctx, const struct sockaddr *sa) { - SETCTXFRESH(ctx); - return dns_add_serv_s_internal(ctx, sa); -} - -static void dns_set_opts_internal(struct dns_ctx *ctx, const char *opts) { - size_t i, v; - for(;;) { - while(ISSPACE(*opts)) ++opts; - if (!*opts) break; - for(i = 0; i < sizeof(dns_opts)/sizeof(dns_opts[0]); ++i) { - v = strlen(dns_opts[i].name); - if (strncmp(dns_opts[i].name, opts, v) != 0 || - (opts[v] != ':' && opts[v] != '=')) - continue; - opts += v + 1; - v = 0; - if (*opts < '0' || *opts > '9') break; - do v = v * 10 + (*opts++ - '0'); - while (*opts >= '0' && *opts <= '9'); - if (dns_opts[i].min && v < dns_opts[i].min) v = dns_opts[i].min; - else if (v > dns_opts[i].max) v = dns_opts[i].max; - dns_ctxopt(ctx, dns_opts[i].offset) = (unsigned)v; - break; - } - while(*opts && !ISSPACE(*opts)) ++opts; - } -} - -int dns_set_opts(struct dns_ctx *ctx, const char *opts) { - SETCTXINACTIVE(ctx); - dns_set_opts_internal(ctx, opts); - return 0; -} - -int dns_set_opt(struct dns_ctx *ctx, enum dns_opt opt, int val) { - int prev; - unsigned i; - SETCTXINACTIVE(ctx); - for(i = 0; i < sizeof(dns_opts)/sizeof(dns_opts[0]); ++i) { - if (dns_opts[i].opt != opt) continue; - prev = dns_ctxopt(ctx, dns_opts[i].offset); - if (val >= 0) { - unsigned v = val; - if (v < dns_opts[i].min || v > dns_opts[i].max) { - errno = EINVAL; - return -1; - } - dns_ctxopt(ctx, dns_opts[i].offset) = v; - } - return prev; - } - if (opt == DNS_OPT_FLAGS) { - prev = ctx->dnsc_flags & ~DNS_INTERNAL; - if (val >= 0) - ctx->dnsc_flags = - (ctx->dnsc_flags & DNS_INTERNAL) | (val & ~DNS_INTERNAL); - return prev; - } - errno = ENOSYS; - return -1; -} - -static int dns_add_srch_internal(struct dns_ctx *ctx, const char *srch) { - if (!srch) - return (ctx->dnsc_nsrch = 0); - else if (ctx->dnsc_nsrch >= DNS_MAXSRCH) - return errno = ENFILE, -1; - else if (dns_sptodn(srch, ctx->dnsc_srch[ctx->dnsc_nsrch], DNS_MAXDN) <= 0) - return errno = EINVAL, -1; - else - return ++ctx->dnsc_nsrch; -} - -int dns_add_srch(struct dns_ctx *ctx, const char *srch) { - SETCTXINACTIVE(ctx); - return dns_add_srch_internal(ctx, srch); -} - -static void dns_set_srch_internal(struct dns_ctx *ctx, char *srch) { - ctx->dnsc_nsrch = 0; - for(srch = strtok(srch, space); srch; srch = strtok(NULL, space)) - dns_add_srch_internal(ctx, srch); -} - -static void dns_drop_utm(struct dns_ctx *ctx) { - if (ctx->dnsc_utmfn) - ctx->dnsc_utmfn(NULL, -1, ctx->dnsc_utmctx); - ctx->dnsc_utmctx = NULL; - ctx->dnsc_utmexp = -1; -} - -static void -dns_request_utm(struct dns_ctx *ctx, time_t now) { - struct dns_query *q; - time_t deadline; - int timeout; - if (!ctx->dnsc_utmfn) - return; - q = QLIST_FIRST(&ctx->dnsc_qactive, next); - if (QLIST_ISLAST(&ctx->dnsc_qactive, q)) - deadline = -1, timeout = -1; - else if (!now || q->dnsq_deadline <= now) - deadline = 0, timeout = 0; - else - deadline = q->dnsq_deadline, timeout = (int)(deadline - now); - if (ctx->dnsc_utmexp == deadline) - return; - ctx->dnsc_utmfn(ctx, timeout, ctx->dnsc_utmctx); - ctx->dnsc_utmexp = deadline; -} - -void dns_set_dbgfn(struct dns_ctx *ctx, dns_dbgfn *dbgfn) { - SETCTXINITED(ctx); - ctx->dnsc_udbgfn = dbgfn; -} - -void -dns_set_tmcbck(struct dns_ctx *ctx, dns_utm_fn *fn, void *data) { - SETCTXINITED(ctx); - dns_drop_utm(ctx); - ctx->dnsc_utmfn = fn; - ctx->dnsc_utmctx = data; -} - -#ifdef WIN32 - -typedef DWORD (WINAPI *GetAdaptersAddressesFunc)( - ULONG Family, DWORD Flags, PVOID Reserved, - PIP_ADAPTER_ADDRESSES pAdapterAddresses, - PULONG pOutBufLen); - -static int dns_initns_iphlpapi(struct dns_ctx *ctx) { - HANDLE h_iphlpapi; - GetAdaptersAddressesFunc pfnGetAdAddrs; - PIP_ADAPTER_ADDRESSES pAddr, pAddrBuf; - PIP_ADAPTER_DNS_SERVER_ADDRESS pDnsAddr; - ULONG ulOutBufLen; - DWORD dwRetVal; - int ret = -1; - - h_iphlpapi = LoadLibrary("iphlpapi.dll"); - if (!h_iphlpapi) - return -1; - pfnGetAdAddrs = (GetAdaptersAddressesFunc) - GetProcAddress(h_iphlpapi, "GetAdaptersAddresses"); - if (!pfnGetAdAddrs) goto freelib; - ulOutBufLen = 0; - dwRetVal = pfnGetAdAddrs(AF_UNSPEC, 0, NULL, NULL, &ulOutBufLen); - if (dwRetVal != ERROR_BUFFER_OVERFLOW) goto freelib; - pAddrBuf = malloc(ulOutBufLen); - if (!pAddrBuf) goto freelib; - dwRetVal = pfnGetAdAddrs(AF_UNSPEC, 0, NULL, pAddrBuf, &ulOutBufLen); - if (dwRetVal != ERROR_SUCCESS) goto freemem; - for (pAddr = pAddrBuf; - pAddr && ctx->dnsc_nserv <= DNS_MAXSERV; - pAddr = pAddr->Next) - for (pDnsAddr = pAddr->FirstDnsServerAddress; - pDnsAddr && ctx->dnsc_nserv <= DNS_MAXSERV; - pDnsAddr = pDnsAddr->Next) - dns_add_serv_s_internal(ctx, pDnsAddr->Address.lpSockaddr); - ret = 0; -freemem: - free(pAddrBuf); -freelib: - FreeLibrary(h_iphlpapi); - return ret; -} - -static int dns_initns_registry(struct dns_ctx *ctx) { - LONG res; - HKEY hk; - DWORD type = REG_EXPAND_SZ | REG_SZ; - DWORD len; - char valBuf[1024]; - -#define REGKEY_WINNT "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters" -#define REGKEY_WIN9x "SYSTEM\\CurrentControlSet\\Services\\VxD\\MSTCP" - res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY_WINNT, 0, KEY_QUERY_VALUE, &hk); - if (res != ERROR_SUCCESS) - res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, REGKEY_WIN9x, - 0, KEY_QUERY_VALUE, &hk); - if (res != ERROR_SUCCESS) - return -1; - len = sizeof(valBuf) - 1; - res = RegQueryValueEx(hk, "NameServer", NULL, &type, valBuf, &len); - if (res != ERROR_SUCCESS || !len || !valBuf[0]) { - len = sizeof(valBuf) - 1; - res = RegQueryValueEx(hk, "DhcpNameServer", NULL, &type, valBuf, &len); - } - RegCloseKey(hk); - if (res != ERROR_SUCCESS || !len || !valBuf[0]) - return -1; - valBuf[len] = '\0'; - /* nameservers are stored as a whitespace-seperate list: - * "192.168.1.1 123.21.32.12" */ - dns_set_serv_internal(ctx, valBuf); - return 0; -} - -static int dns_init_internal(struct dns_ctx *ctx) { - if (dns_initns_iphlpapi(ctx) != 0) - dns_initns_registry(ctx); - /*XXX WIN32: probably good to get default domain and search list too... - * And options. Something is in registry. */ - /*XXX WIN32: maybe environment variables are also useful? */ - return 0; -} - -#ifdef _MSC_VER -#pragma warning(disable:4100) - -#include "windows.h" - -void gettimeofday(struct timeval *tv, void *tz) -{ - long int l = GetTickCount(); - - tv->tv_sec = l / 1000; - tv->tv_usec = (l % 1000) * 1000; - return; -} -#endif -#else /* !WIN32 */ - -static int dns_init_internal(struct dns_ctx *ctx) { - char *v; - char buf[2049]; /* this buffer is used to hold /etc/resolv.conf */ - - /* read resolv.conf... */ - { int fd = open("/etc/resolv.conf", O_RDONLY); - if (fd >= 0) { - int l = read(fd, buf, sizeof(buf) - 1); - close(fd); - buf[l < 0 ? 0 : l] = '\0'; - } - else - buf[0] = '\0'; - } - if (buf[0]) { /* ...and parse it */ - char *line, *nextline; - line = buf; - do { - nextline = strchr(line, '\n'); - if (nextline) *nextline++ = '\0'; - v = line; - while(*v && !ISSPACE(*v)) ++v; - if (!*v) continue; - *v++ = '\0'; - while(ISSPACE(*v)) ++v; - if (!*v) continue; - if (strcmp(line, "domain") == 0) - dns_set_srch_internal(ctx, strtok(v, space)); - else if (strcmp(line, "search") == 0) - dns_set_srch_internal(ctx, v); - else if (strcmp(line, "nameserver") == 0) - dns_add_serv_internal(ctx, strtok(v, space)); - else if (strcmp(line, "options") == 0) - dns_set_opts_internal(ctx, v); - } while((line = nextline) != NULL); - } - - buf[sizeof(buf)-1] = '\0'; - - /* get list of nameservers from env. vars. */ - if ((v = getenv("NSCACHEIP")) != NULL || - (v = getenv("NAMESERVERS")) != NULL) { - strncpy(buf, v, sizeof(buf) - 1); - dns_set_serv_internal(ctx, buf); - } - /* if $LOCALDOMAIN is set, use it for search list */ - if ((v = getenv("LOCALDOMAIN")) != NULL) { - strncpy(buf, v, sizeof(buf) - 1); - dns_set_srch_internal(ctx, buf); - } - if ((v = getenv("RES_OPTIONS")) != NULL) - dns_set_opts_internal(ctx, v); - - /* if still no search list, use local domain name */ - if (!ctx->dnsc_nsrch && - gethostname(buf, sizeof(buf) - 1) == 0 && - (v = strchr(buf, '.')) != NULL && - *++v != '\0') - dns_add_srch_internal(ctx, v); - - return 0; -} - -#endif /* dns_init_internal() for !WIN32 */ - -static void dns_firstid(struct dns_ctx *ctx) { - struct timeval tv; - gettimeofday(&tv, NULL); - ctx->dnsc_nextid = (unsigned short)((tv.tv_usec ^ getpid()) & 0xffff); -} - -dns_socket dns_init(int do_open) { - struct dns_ctx *ctx = &dns_defctx; - assert(!CTXINITED(ctx)); - memset(ctx, 0, sizeof(*ctx)); - ctx->dnsc_timeout = 4; - ctx->dnsc_ntries = 3; - ctx->dnsc_ndots = 1; - ctx->dnsc_udpbuf = DNS_EDNS0PACKET; - ctx->dnsc_port = DNS_PORT; - ctx->dnsc_udpsock = INVALID_SOCKET; - qlist_init(&ctx->dnsc_qactive); - if (dns_init_internal(ctx) != 0) - return -1; - dns_firstid(ctx); - ctx->dnsc_flags |= DNS_INITED; - return do_open ? dns_open(ctx) : 0; -} - -struct dns_ctx *dns_new(const struct dns_ctx *ctx) { - struct dns_ctx *n; - SETCTXINITED(ctx); - dns_assert_ctx(ctx); - n = malloc(sizeof(*n)); - if (!n) - return NULL; - *n = *ctx; - n->dnsc_udpsock = INVALID_SOCKET; - qlist_init(&n->dnsc_qactive); - n->dnsc_nactive = 0; - n->dnsc_pbuf = NULL; - n->dnsc_qstatus = 0; - n->dnsc_utmfn = NULL; - n->dnsc_utmctx = NULL; - dns_firstid(n); - return n; -} - -void dns_free(struct dns_ctx *ctx) { - struct dns_query *q; - SETCTXINITED(ctx); - dns_assert_ctx(ctx); - dns_drop_utm(ctx); - if (ctx->dnsc_udpsock >= 0) - closesocket(ctx->dnsc_udpsock); - if (ctx->dnsc_pbuf) - free(ctx->dnsc_pbuf); - while((q = qlist_pop(&ctx->dnsc_qactive))) - free(q); - if (ctx != &dns_defctx) - free(ctx); - else - memset(ctx, 0, sizeof(*ctx)); -} - -dns_socket dns_open(struct dns_ctx *ctx) { - dns_socket sock; - unsigned i; - int port; - union usockaddr_ns *sns; -#if HAVE_INET6 - unsigned have_inet6 = 0; -#endif - - SETCTXINITED(ctx); - assert(!CTXOPEN(ctx)); - - port = htons(ctx->dnsc_port); - /* ensure we have at least one server */ - if (!ctx->dnsc_nserv) { - sns = ctx->dnsc_serv; - sns->sin.sin_family = AF_INET; - sns->sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - ctx->dnsc_nserv = 1; - } - - for (i = 0; i < ctx->dnsc_nserv; ++i) { - sns = &ctx->dnsc_serv[i]; - /* set port for each sockaddr */ -#if HAVE_INET6 - if (sns->sa.sa_family == AF_INET6) { - if (!sns->sin6.sin6_port) sns->sin6.sin6_port = port; - ++have_inet6; - } - else -#endif - { - assert(sns->sa.sa_family == AF_INET); - if (!sns->sin.sin_port) sns->sin.sin_port = port; - } - } - -#if !HAVE_INET6 - ctx->dnsc_salen = sizeof(struct sockaddr_in); -#else - if (have_inet6 && have_inet6 < ctx->dnsc_nserv) { - /* convert all IPv4 addresses to IPv6 V4MAPPED */ - struct sockaddr_in6 sin6; - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_family = AF_INET6; - /* V4MAPPED: ::ffff:1.2.3.4 */ - sin6.sin6_addr.s6_addr[10] = 0xff; - sin6.sin6_addr.s6_addr[11] = 0xff; - for(i = 0; i < ctx->dnsc_nserv; ++i) { - sns = &ctx->dnsc_serv[i]; - if (sns->sa.sa_family == AF_INET) { - sin6.sin6_port = sns->sin.sin_port; - memcpy(&sin6.sin6_addr.s6_addr[12], &sns->sin.sin_addr, sizeof(struct in_addr)); - sns->sin6 = sin6; - } - } - } - - ctx->dnsc_salen = have_inet6 ? - sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); - - if (have_inet6) - sock = socket(PF_INET6, SOCK_DGRAM, IPPROTO_UDP); - else -#endif /* HAVE_INET6 */ - sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP); - - if (sock < 0) { - ctx->dnsc_qstatus = DNS_E_TEMPFAIL; - return -1; - } -#ifdef WIN32 - { unsigned long on = 1; - if (ioctlsocket(sock, FIONBIO, &on) == SOCKET_ERROR) { - closesocket(sock); - ctx->dnsc_qstatus = DNS_E_TEMPFAIL; - return -1; - } - } -#else /* !WIN32 */ - if (fcntl(sock, F_SETFL, fcntl(sock, F_GETFL) | O_NONBLOCK) < 0 || - fcntl(sock, F_SETFD, FD_CLOEXEC) < 0) { - closesocket(sock); - ctx->dnsc_qstatus = DNS_E_TEMPFAIL; - return -1; - } -#endif /* WIN32 */ - /* allocate the packet buffer */ - if (!(ctx->dnsc_pbuf = malloc(ctx->dnsc_udpbuf))) { - closesocket(sock); - ctx->dnsc_qstatus = DNS_E_NOMEM; - errno = ENOMEM; - return -1; - } - - ctx->dnsc_udpsock = sock; - return sock; -} - -void dns_close(struct dns_ctx *ctx) { - SETCTXINITED(ctx); - if (ctx->dnsc_udpsock < 0) return; - closesocket(ctx->dnsc_udpsock); - ctx->dnsc_udpsock = INVALID_SOCKET; - free(ctx->dnsc_pbuf); - ctx->dnsc_pbuf = NULL; -} - -dns_socket dns_sock(const struct dns_ctx *ctx) { - SETCTXINITED(ctx); - return ctx->dnsc_udpsock; -} - -int dns_active(const struct dns_ctx *ctx) { - SETCTXINITED(ctx); - dns_assert_ctx(ctx); - return ctx->dnsc_nactive; -} - -int dns_status(const struct dns_ctx *ctx) { - SETCTX(ctx); - return ctx->dnsc_qstatus; -} -void dns_setstatus(struct dns_ctx *ctx, int status) { - SETCTX(ctx); - ctx->dnsc_qstatus = status; -} - -/* End the query and return the result to the caller. - */ -static void -dns_end_query(struct dns_ctx *ctx, struct dns_query *q, - int status, void *result) { - dns_query_fn *cbck = q->dnsq_cbck; - void *cbdata = q->dnsq_cbdata; - ctx->dnsc_qstatus = status; - assert((status < 0 && result == 0) || (status >= 0 && result != 0)); - assert(cbck != 0); /*XXX callback may be NULL */ - assert(ctx->dnsc_nactive > 0); - --ctx->dnsc_nactive; - /* force the query to be unconnected */ - /*memset(q, 0, sizeof(*q));*/ -#ifndef NDEBUG - q->dnsq_ctx = NULL; -#endif - free(q); - cbck(ctx, result, cbdata); -} - -#define DNS_DBG(ctx, code, sa, slen, pkt, plen) \ - do { \ - if (ctx->dnsc_udbgfn) \ - ctx->dnsc_udbgfn(code, (sa), slen, pkt, plen, 0, 0); \ - } while(0) -#define DNS_DBGQ(ctx, q, code, sa, slen, pkt, plen) \ - do { \ - if (ctx->dnsc_udbgfn) \ - ctx->dnsc_udbgfn(code, (sa), slen, pkt, plen, q, q->dnsq_cbdata); \ - } while(0) - -/* Try next search, filling in qDN in query. - * Return new qDN len or 0 if no more to search. - * Caller should fill up the rest of the query. - */ -static unsigned dns_next_srch(const struct dns_ctx *ctx, struct dns_query *q) { - unsigned ol = q->dnsq_origdnl - 1; /* origdnl is at least 1 */ - dnsc_t *p = dns_payload(q->dnsq_buf) + ol; - dnscc_t *dn; - int n; - while (q->dnsq_srchi < ctx->dnsc_nsrch) { - dn = ctx->dnsc_srch[q->dnsq_srchi++]; - if (!*dn) { /* root dn */ - if (!(q->dnsq_flags & DNS_ASIS_DONE)) - break; - } - else if ((n = dns_dntodn(dn, p, DNS_MAXDN - ol)) > 0) - return n + ol; - } - if (q->dnsq_flags & DNS_ASIS_DONE) - return 0; - q->dnsq_flags |= DNS_ASIS_DONE; - *p = '\0'; - return ol + 1; -} - -/* find the next server which isn't skipped starting from current. - * return 0 if ok, >0 if ok but we started next cycle, or <0 if - * number of tries exceeded or no more servers. - */ -static int dns_find_serv(const struct dns_ctx *ctx, struct dns_query *q) { - int cycle; - if (q->dnsq_try < ctx->dnsc_ntries) for(cycle = 0;;) { - if (q->dnsq_servi < ctx->dnsc_nserv) { - if (!(q->dnsq_servskip & (1 << q->dnsq_servi))) - return cycle; - ++q->dnsq_servi; - } - else if (cycle || ++q->dnsq_try >= ctx->dnsc_ntries) - break; - else { - cycle = 1; - q->dnsq_servi = 0; - } - } - return -1; -} - -/* send the query out and add it to the active list. */ -static void dns_send(struct dns_ctx *ctx, struct dns_query *q, time_t now) { - int n; - struct dns_query *p; - - /* if we can't send the query, return TEMPFAIL even when searching: - * we can't be sure whenever the name we tried to search exists or not, - * so don't continue searching, or we may find the wrong name. */ - - /* if there's no more servers, fail the query */ - n = dns_find_serv(ctx, q); - if (n < 0) { - dns_end_query(ctx, q, DNS_E_TEMPFAIL, 0); - return; - } - - /* send the query */ - n = 10; - while (sendto(ctx->dnsc_udpsock, q->dnsq_buf, q->dnsq_len, 0, - &ctx->dnsc_serv[q->dnsq_servi].sa, ctx->dnsc_salen) < 0) { - /*XXX just ignore the sendto() error for now and try again. - * In the future, it may be possible to retrieve the error code - * and find which operation/query failed. - *XXX try the next server too? - */ - if (--n) continue; - /* if we can't send the query, fail it. */ - dns_end_query(ctx, q, DNS_E_TEMPFAIL, 0); - return; - } - DNS_DBGQ(ctx, q, 1, - &ctx->dnsc_serv[q->dnsq_servi].sa, sizeof(union usockaddr_ns), - q->dnsq_buf, q->dnsq_len); - q->dnsq_servwait |= 1 << q->dnsq_servi; /* expect reply from this ns */ - - /* advance to the next server, and choose a timeout. - * we will try next server in 1 secound, but start next - * cycle waiting for proper timeout. */ - ++q->dnsq_servi; - n = dns_find_serv(ctx, q) ? ctx->dnsc_timeout << (q->dnsq_try - 1) : 1; - - q->dnsq_deadline = now = now + n; - - /* insert the query to the tail of the list */ - QLIST_FOR_EACH(&ctx->dnsc_qactive, p, prev) - if (p->dnsq_deadline <= now) - break; - qlist_insert_after(q, p); - -} - -static void dns_dummy_cb(struct dns_ctx *ctx, void *result, void *data) { - if (result) free(result); - data = ctx = 0; /* used */ -} - -struct dns_query * -dns_submit_dn(struct dns_ctx *ctx, - dnscc_t *dn, int qcls, int qtyp, int flags, - dns_parse_fn *parse, dns_query_fn *cbck, void *data) { - dnsc_t *p; - unsigned dnl; - struct dns_query *q; - SETCTXOPEN(ctx); - dns_assert_ctx(ctx); - - q = calloc(sizeof(*q), 1); - if (!q) { - ctx->dnsc_qstatus = DNS_E_NOMEM; - return NULL; - } - -#ifndef NDEBUG - q->dnsq_ctx = ctx; -#endif - q->dnsq_parse = parse; - q->dnsq_cbck = cbck ? cbck : dns_dummy_cb; - q->dnsq_cbdata = data; - - flags = (flags | ctx->dnsc_flags) & ~DNS_INTERNAL; - if (!ctx->dnsc_nsrch) q->dnsq_flags |= DNS_NOSRCH; - if (!(flags & DNS_NORD)) q->dnsq_buf[DNS_H_F1] |= DNS_HF1_RD; - if (flags & DNS_AAONLY) q->dnsq_buf[DNS_H_F1] |= DNS_HF1_AA; - q->dnsq_buf[DNS_H_QDCNT2] = 1; - dns_put16(q->dnsq_buf + DNS_H_QID, ctx->dnsc_nextid++); - - q->dnsq_origdnl = dns_dnlen(dn); - assert(q->dnsq_origdnl > 0 && q->dnsq_origdnl <= DNS_MAXDN); - memcpy(dns_payload(q->dnsq_buf), dn, q->dnsq_origdnl); - p = dns_payload(q->dnsq_buf) + q->dnsq_origdnl; - if (flags & DNS_NOSRCH || dns_dnlabels(dn) > ctx->dnsc_ndots) - flags |= DNS_ASIS_DONE; - else if ((dnl = dns_next_srch(ctx, q)) > 0) - p = dns_payload(q->dnsq_buf) + dnl; - else - p[-1] = '\0'; - q->dnsq_flags = flags; - q->dnsq_typ = qtyp; - p = dns_put16(p, qtyp); - q->dnsq_cls = qcls; - p = dns_put16(p, qcls); - if (ctx->dnsc_udpbuf > DNS_MAXPACKET) { - p++; /* empty (root) DN */ - p = dns_put16(p, DNS_T_OPT); - p = dns_put16(p, ctx->dnsc_udpbuf); - p += 2; /* EDNS0 RCODE & VERSION */ - p += 2; /* rest of the TTL field */ - p += 2; /* RDLEN */ - q->dnsq_buf[DNS_H_ARCNT2] = 1; - } - assert(p <= q->dnsq_buf + DNS_QBUF); - q->dnsq_len = (unsigned)(p - q->dnsq_buf); - - qlist_add_head(q, &ctx->dnsc_qactive); - ++ctx->dnsc_nactive; - dns_request_utm(ctx, 0); - - return q; -} - -struct dns_query * -dns_submit_p(struct dns_ctx *ctx, - const char *name, int qcls, int qtyp, int flags, - dns_parse_fn *parse, dns_query_fn *cbck, void *data) { - int isabs; - SETCTXOPEN(ctx); - if (dns_ptodn(name, 0, ctx->dnsc_pbuf, DNS_MAXDN, &isabs) <= 0) { - ctx->dnsc_qstatus = DNS_E_BADQUERY; - return NULL; - } - if (isabs) - flags |= DNS_NOSRCH; - return - dns_submit_dn(ctx, ctx->dnsc_pbuf, qcls, qtyp, flags, parse, cbck, data); -} - -/* process readable fd condition. - * To be usable in edge-triggered environment, the routine - * should consume all input so it should loop over. - * Note it isn't really necessary to loop here, because - * an application may perform the loop just fine by it's own, - * but in this case we should return some sensitive result, - * to indicate when to stop calling and error conditions. - * Note also we may encounter all sorts of recvfrom() - * errors which aren't fatal, and at the same time we may - * loop forever if an error IS fatal. - * Current loop/goto looks just terrible... */ -void dns_ioevent(struct dns_ctx *ctx, time_t now) { - int r; - unsigned servi, l; - struct dns_query *q; - dnsc_t *pbuf; - dnscc_t *pend, *pcur; - void *result; - union usockaddr_ns sns; - socklen_t slen; - - SETCTX(ctx); - if (!CTXOPEN(ctx)) - return; - dns_assert_ctx(ctx); - pbuf = ctx->dnsc_pbuf; - - if (!now) now = time(NULL); - -again: - - for(;;) { /* receive the reply */ - dnsc_t dn[DNS_MAXDN]; - - slen = sizeof(sns); - r = recvfrom(ctx->dnsc_udpsock, pbuf, ctx->dnsc_udpbuf, 0, &sns.sa, &slen); - if (r < 0) { - /*XXX just ignore recvfrom() errors for now. - * in the future it may be possible to determine which - * query failed and requeue it. - * Note there may be various error conditions, triggered - * by both local problems and remote problems. It isn't - * quite trivial to determine whenever an error is local - * or remote. On local errors, we should stop, while - * remote errors should be ignored (for now anyway). - */ -#ifdef WIN32 - if (WSAGetLastError() == WSAEWOULDBLOCK) -#else - if (errno == EAGAIN) -#endif - { - dns_request_utm(ctx, now); - return; - } - continue; - } - /* ignore replies from wrong server */ -#if HAVE_INET6 - if (sns.sa.sa_family == AF_INET6 && slen >= sizeof(sns.sin6)) { - for (servi = 0; servi < ctx->dnsc_nserv; ++servi) - if (ctx->dnsc_serv[servi].sin6.sin6_port == sns.sin6.sin6_port && - memcmp(&ctx->dnsc_serv[servi].sin6.sin6_addr, - &sns.sin6.sin6_addr, sizeof(sns.sin6.sin6_addr)) == 0) - break; - } - else -#endif - if (sns.sa.sa_family == AF_INET && slen >= sizeof(sns.sin)) { - for (servi = 0; servi < ctx->dnsc_nserv; ++servi) - if (ctx->dnsc_serv[servi].sin.sin_addr.s_addr == sns.sin.sin_addr.s_addr && - ctx->dnsc_serv[servi].sin.sin_port == sns.sin.sin_port) - break; - } - else { - DNS_DBG(ctx, -1, &sns.sa, slen, pbuf, r); - continue; - } - if (servi >= ctx->dnsc_nserv) { - DNS_DBG(ctx, -2, &sns.sa, slen, pbuf, r); - continue; - } - - pend = pbuf + r; - pcur = dns_payload(pbuf); - if (pcur >= pend || dns_numqd(pbuf) != 1 || dns_opcode(pbuf) != 0 || - dns_getdn(pbuf, &pcur, pend, dn, sizeof(dn)) < 0 || - pcur + 4 > pend) { - /*XXX ignore non-query replies and replies with numqd!=1? */ - DNS_DBG(ctx, -3, &sns.sa, slen, pbuf, r); - continue; - } - - /* truncation bit (TC). Ooh, we don't handle TCP (yet?), - * but we do handle larger UDP sizes. - * Note that e.g. djbdns will only send header if resp. - * does not fit, not whatever is fit in 512 bytes. */ - if (dns_tc(pbuf)) { - DNS_DBG(ctx, -4, &sns.sa, slen, pbuf, r); - continue; /* just ignore response for now.. any hope? */ - } - - /* find the request for this reply in active queue - * Note we pick any request, even queued for another - * server - in case first server replies a bit later - * than we expected. */ - for (q = QLIST_FIRST(&ctx->dnsc_qactive, next);; q = QLIST_NEXT(q, next)) { - if (QLIST_ISLAST(&ctx->dnsc_qactive, q)) { - /* no more requests: old reply? */ - DNS_DBG(ctx, -5, &sns.sa, slen, pbuf, r); - goto again; - } - /* ignore replies that has not been sent to this server. - * Note dnsq_servi is the *next* server to try. */ - if (!q->dnsq_try && q->dnsq_servi <= servi) - continue; - /*XXX ignore replies from servers we're ignoring? o/ - if (q->dnsq_servskip & (1 << servi)) - continue; */ - /* check qID */ - if (q->dnsq_buf[DNS_H_QID1] != pbuf[DNS_H_QID1] || - q->dnsq_buf[DNS_H_QID2] != pbuf[DNS_H_QID2]) - continue; - /* check qDN, qCLS and qTYP */ - if (!(l = dns_dnequal(dn, dns_payload(q->dnsq_buf))) || - memcmp(pcur, dns_payload(q->dnsq_buf) + l, 4) != 0) - continue; - /* ok, this is expected reply with matching query. */ - break; - } - - break; - - } - - DNS_DBGQ(ctx, q, 0, &sns.sa, slen, pbuf, r); - - /* we got a reply for our query */ - q->dnsq_servwait &= ~(1 << servi); /* don't expect reply from this serv */ - - /* process the RCODE */ - switch(dns_rcode(pbuf)) { - - case DNS_R_NOERROR: - qlist_remove(q); - if (!dns_numan(pbuf)) { /* no data of requested type */ - q->dnsq_flags |= DNS_SEEN_NODATA; - r = DNS_E_NODATA; - break; - } - /* the only case where we may succeed */ - if (q->dnsq_parse) { - r = q->dnsq_parse(dns_payload(q->dnsq_buf), pbuf, pcur, pend, &result); - if (r < 0) - result = NULL; - } - else if ((result = malloc(r)) != NULL) - memcpy(result, pbuf, r); - else - r = DNS_E_NOMEM; - /* (maybe) successeful answer (modulo nomem and parsing probs) */ - /* note we pass DNS_E_NODATA here */ - dns_end_query(ctx, q, r, result); - goto again; - - case DNS_R_NXDOMAIN: - qlist_remove(q); - r = DNS_E_NXDOMAIN; - break; - - case DNS_R_SERVFAIL: - q->dnsq_flags |= DNS_SEEN_FAIL; - case DNS_R_NOTIMPL: - case DNS_R_REFUSED: - /* for these rcodes, advance this request - * to the next server and reschedule */ - default: /* unknown rcode? hmmm... */ - /* try next server */ - q->dnsq_servskip |= 1 << servi; /* don't retry this server */ - if (!q->dnsq_servwait) { - qlist_remove(q); - dns_send(ctx, q, now); - } - else { - /* else this is the only place where q will be left unconnected - * if we will move qlist_remove() before the switch{}. */ - } - goto again; - - } - - /* here we have either NODATA or NXDOMAIN */ - if (!(q->dnsq_flags & DNS_NOSRCH)) { - /* try next element from search list */ - unsigned sl; - - l = dns_dnlen(dns_payload(q->dnsq_buf)) + DNS_HSIZE; /* past qDN */ - /* save qcls, qtyp and EDNS0 stuff (of len sl) in pbuf */ - sl = q->dnsq_len - l; - memcpy(pbuf, q->dnsq_buf + l, sl); - /* try next search list */ - l = dns_next_srch(ctx, q); - if (l) { /* something else to try, of len l */ - l += DNS_HSIZE; - memcpy(q->dnsq_buf + l, pbuf, sl); - q->dnsq_len = l + sl; - q->dnsq_try = 0; q->dnsq_servi = 0; - q->dnsq_servwait = q->dnsq_servskip = 0; - dns_send(ctx, q, now); - goto again; - } - /* else we have nothing more to search, end the query. */ - if (q->dnsq_flags & DNS_SEEN_FAIL) - /* at least one server/query failed, fail the query */ - r = DNS_E_TEMPFAIL; - else if (q->dnsq_flags & DNS_SEEN_NODATA) - /* for one domain we have seen NODATA, return it */ - r = DNS_E_NODATA; - else /* else all should be NXDOMAINs */ - r = DNS_E_NXDOMAIN; - } - - dns_end_query(ctx, q, r, 0); - goto again; -} - -/* handle all timeouts */ -int dns_timeouts(struct dns_ctx *ctx, int maxwait, time_t now) { - struct dns_query *q; - int w; - SETCTX(ctx); - dns_assert_ctx(ctx); - if (!now) now = time(NULL); - while((q = qlist_first(&ctx->dnsc_qactive)) && q->dnsq_deadline <= now) { - qlist_remove(q); - dns_send(ctx, q, now); - } - dns_request_utm(ctx, now); - if (!q) - return maxwait; - w = (int)(q->dnsq_deadline - now); - return maxwait < 0 || maxwait > w ? w : maxwait; -} - -struct dns_resolve_data { - int dnsrd_done; - void *dnsrd_result; -}; - -static void dns_resolve_cb(struct dns_ctx *ctx, void *result, void *data) { - struct dns_resolve_data *d = data; - d->dnsrd_result = result; - d->dnsrd_done = 1; - ctx = ctx; -} - -void *dns_resolve(struct dns_ctx *ctx, struct dns_query *q) { - time_t now; -#ifdef HAVE_POLL - struct pollfd pfd; -#else - fd_set rfd; - struct timeval tv; -#endif - struct dns_resolve_data d; - int n; - SETCTXOPEN(ctx); - - if (!q) - return NULL; - - assert(ctx == q->dnsq_ctx); - dns_assert_ctx(ctx); - /* do not allow re-resolving syncronous queries */ - assert(q->dnsq_cbck != dns_resolve_cb && "can't resolve syncronous query"); - if (q->dnsq_cbck == dns_resolve_cb) { - ctx->dnsc_qstatus = DNS_E_BADQUERY; - return NULL; - } - q->dnsq_cbck = dns_resolve_cb; - q->dnsq_cbdata = &d; - d.dnsrd_done = 0; - -#ifdef HAVE_POLL - pfd.fd = ctx->dnsc_udpsock; - pfd.events = POLLIN; -#else - FD_ZERO(&rfd); -#endif - - now = time(NULL); - while(!d.dnsrd_done && (n = dns_timeouts(ctx, -1, now)) >= 0) { -#ifdef HAVE_POLL - n = poll(&pfd, 1, n * 1000); -#else - tv.tv_sec = n; - tv.tv_usec = 0; - FD_SET(ctx->dnsc_udpsock, &rfd); - n = select((int)(ctx->dnsc_udpsock + 1), &rfd, NULL, NULL, &tv); -#endif - now = time(NULL); - if (n > 0) - dns_ioevent(ctx, now); - } - - return d.dnsrd_result; -} - -void *dns_resolve_dn(struct dns_ctx *ctx, - dnscc_t *dn, int qcls, int qtyp, int flags, - dns_parse_fn *parse) { - return - dns_resolve(ctx, - dns_submit_dn(ctx, dn, qcls, qtyp, flags, parse, NULL, NULL)); -} - -void *dns_resolve_p(struct dns_ctx *ctx, - const char *name, int qcls, int qtyp, int flags, - dns_parse_fn *parse) { - return - dns_resolve(ctx, - dns_submit_p(ctx, name, qcls, qtyp, flags, parse, NULL, NULL)); -} - -int dns_cancel(struct dns_ctx *ctx, struct dns_query *q) { - SETCTX(ctx); - dns_assert_ctx(ctx); - assert(q->dnsq_ctx == ctx); - /* do not allow cancelling syncronous queries */ - assert(q->dnsq_cbck != dns_resolve_cb && "can't cancel syncronous query"); - if (q->dnsq_cbck == dns_resolve_cb) - return (ctx->dnsc_qstatus = DNS_E_BADQUERY); - qlist_remove(q); - --ctx->dnsc_nactive; - dns_request_utm(ctx, 0); - return 0; -} - diff --git a/libs/udns/udns_rr_a.c b/libs/udns/udns_rr_a.c deleted file mode 100644 index c45897323a..0000000000 --- a/libs/udns/udns_rr_a.c +++ /dev/null @@ -1,126 +0,0 @@ -/* $Id: udns_rr_a.c,v 1.14 2005/04/20 06:44:34 mjt Exp $ - parse/query A/AAAA IN records - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include -#ifdef WIN32 -# include /* includes */ -# include /* needed for struct in6_addr */ -#else -# include -# include -#endif -#include "udns.h" - -/* here, we use common routine to parse both IPv4 and IPv6 addresses. - */ - -/* this structure should match dns_rr_a[46] */ -struct dns_rr_a { - dns_rr_common(dnsa); - unsigned char *dnsa_addr; -}; - -static int -dns_parse_a(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result, unsigned dsize) { - struct dns_rr_a *ret; - struct dns_parse p; - struct dns_rr rr; - int r; - - /* first, validate and count number of addresses */ - dns_initparse(&p, qdn, pkt, cur, end); - while((r = dns_nextrr(&p, &rr)) > 0) - if (rr.dnsrr_dsz != dsize) - return DNS_E_PROTOCOL; - if (r < 0) - return DNS_E_PROTOCOL; - else if (!p.dnsp_nrr) - return DNS_E_NODATA; - - ret = malloc(sizeof(*ret) + dsize * p.dnsp_nrr + dns_stdrr_size(&p)); - if (!ret) - return DNS_E_NOMEM; - - ret->dnsa_nrr = p.dnsp_nrr; - ret->dnsa_addr = (unsigned char*)(ret+1); - - /* copy the RRs */ - for (dns_rewind(&p, qdn), r = 0; dns_nextrr(&p, &rr); ++r) - memcpy(ret->dnsa_addr + dsize * r, rr.dnsrr_dptr, dsize); - - dns_stdrr_finish((struct dns_rr_null *)ret, - (char *)(ret->dnsa_addr + dsize * p.dnsp_nrr), &p); - *result = ret; - return 0; -} - -int -dns_parse_a4(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result) { -#ifndef __OpenBSD__ /* Openbsd likes to patch compilers to bitch about stupid things */ - assert(sizeof(struct in_addr) == 4); -#endif - assert(dns_get16(cur+2) == DNS_C_IN && dns_get16(cur+0) == DNS_T_A); - return dns_parse_a(qdn, pkt, cur, end, result, 4); -} - -struct dns_query * -dns_submit_a4(struct dns_ctx *ctx, const char *name, int flags, - dns_query_a4_fn *cbck, void *data) { - return - dns_submit_p(ctx, name, DNS_C_IN, DNS_T_A, flags, - dns_parse_a4, (dns_query_fn*)cbck, data); -} - -struct dns_rr_a4 * -dns_resolve_a4(struct dns_ctx *ctx, const char *name, int flags) { - return (struct dns_rr_a4 *) - dns_resolve_p(ctx, name, DNS_C_IN, DNS_T_A, flags, dns_parse_a4); -} - -int -dns_parse_a6(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result) { -#ifdef AF_INET6 - assert(sizeof(struct in6_addr) == 16); -#endif - assert(dns_get16(cur+2) == DNS_C_IN && dns_get16(cur+0) == DNS_T_AAAA); - return dns_parse_a(qdn, pkt, cur, end, result, 16); -} - -struct dns_query * -dns_submit_a6(struct dns_ctx *ctx, const char *name, int flags, - dns_query_a6_fn *cbck, void *data) { - return - dns_submit_p(ctx, name, DNS_C_IN, DNS_T_AAAA, flags, - dns_parse_a6, (dns_query_fn*)cbck, data); -} - -struct dns_rr_a6 * -dns_resolve_a6(struct dns_ctx *ctx, const char *name, int flags) { - return (struct dns_rr_a6 *) - dns_resolve_p(ctx, name, DNS_C_IN, DNS_T_AAAA, flags, dns_parse_a6); -} diff --git a/libs/udns/udns_rr_mx.c b/libs/udns/udns_rr_mx.c deleted file mode 100644 index cf8348354f..0000000000 --- a/libs/udns/udns_rr_mx.c +++ /dev/null @@ -1,91 +0,0 @@ -/* $Id: udns_rr_mx.c,v 1.13 2005/04/20 06:44:34 mjt Exp $ - parse/query MX IN records - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include -#include "udns.h" - -int -dns_parse_mx(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result) { - struct dns_rr_mx *ret; - struct dns_parse p; - struct dns_rr rr; - int r, l; - char *sp; - dnsc_t mx[DNS_MAXDN]; - - assert(dns_get16(cur+2) == DNS_C_IN && dns_get16(cur+0) == DNS_T_MX); - - /* first, validate the answer and count size of the result */ - l = 0; - dns_initparse(&p, qdn, pkt, cur, end); - while((r = dns_nextrr(&p, &rr)) > 0) { - cur = rr.dnsrr_dptr + 2; - r = dns_getdn(pkt, &cur, end, mx, sizeof(mx)); - if (r <= 0 || cur != rr.dnsrr_dend) - return DNS_E_PROTOCOL; - l += dns_dntop_size(mx); - } - if (r < 0) - return DNS_E_PROTOCOL; - if (!p.dnsp_nrr) - return DNS_E_NODATA; - - /* next, allocate and set up result */ - l += dns_stdrr_size(&p); - ret = malloc(sizeof(*ret) + sizeof(struct dns_mx) * p.dnsp_nrr + l); - if (!ret) - return DNS_E_NOMEM; - ret->dnsmx_nrr = p.dnsp_nrr; - ret->dnsmx_mx = (struct dns_mx *)(ret+1); - - /* and 3rd, fill in result, finally */ - sp = (char*)(ret->dnsmx_mx + p.dnsp_nrr); - for (dns_rewind(&p, qdn), r = 0; dns_nextrr(&p, &rr); ++r) { - ret->dnsmx_mx[r].name = sp; - cur = rr.dnsrr_dptr; - ret->dnsmx_mx[r].priority = dns_get16(cur); - cur += 2; - dns_getdn(pkt, &cur, end, mx, sizeof(mx)); - sp += dns_dntop(mx, sp, DNS_MAXNAME); - } - dns_stdrr_finish((struct dns_rr_null *)ret, sp, &p); - *result = ret; - return 0; -} - -struct dns_query * -dns_submit_mx(struct dns_ctx *ctx, const char *name, int flags, - dns_query_mx_fn *cbck, void *data) { - return - dns_submit_p(ctx, name, DNS_C_IN, DNS_T_MX, flags, - dns_parse_mx, (dns_query_fn *)cbck, data); -} - -struct dns_rr_mx * -dns_resolve_mx(struct dns_ctx *ctx, const char *name, int flags) { - return (struct dns_rr_mx *) - dns_resolve_p(ctx, name, DNS_C_IN, DNS_T_MX, flags, dns_parse_mx); -} diff --git a/libs/udns/udns_rr_naptr.c b/libs/udns/udns_rr_naptr.c deleted file mode 100644 index ec4f514601..0000000000 --- a/libs/udns/udns_rr_naptr.c +++ /dev/null @@ -1,128 +0,0 @@ -/* $Id: udns_rr_naptr.c,v 1.1 2006/11/28 22:58:04 mjt Exp $ - parse/query NAPTR IN records - - Copyright (C) 2005 Michael Tokarev - Copyright (C) 2006 Mikael Magnusson - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include -#include "udns.h" - -/* Get a single string for NAPTR record, pretty much like a DN label. - * String length is in first byte in *cur, so it can't be >255. - */ -static int dns_getstr(dnscc_t **cur, dnscc_t *ep, char *buf) -{ - unsigned l; - dnscc_t *cp = *cur; - - l = *cp++; - if (cp + l > ep) - return DNS_E_PROTOCOL; - if (buf) { - memcpy(buf, cp, l); - buf[l] = '\0'; - } - cp += l; - - *cur = cp; - return l + 1; -} - -int -dns_parse_naptr(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result) { - struct dns_rr_naptr *ret; - struct dns_parse p; - struct dns_rr rr; - int r, l; - char *sp; - dnsc_t dn[DNS_MAXDN]; - - assert(dns_get16(cur+2) == DNS_C_IN && dns_get16(cur+0) == DNS_T_NAPTR); - - /* first, validate the answer and count size of the result */ - l = 0; - dns_initparse(&p, qdn, pkt, cur, end); - while((r = dns_nextrr(&p, &rr)) > 0) { - int i; - dnscc_t *ep = rr.dnsrr_dend; - - /* first 4 bytes: order & preference */ - cur = rr.dnsrr_dptr + 4; - - /* flags, services and regexp */ - for (i = 0; i < 3; i++) { - r = dns_getstr(&cur, ep, NULL); - if (r < 0) - return r; - l += r; - } - /* replacement */ - r = dns_getdn(pkt, &cur, end, dn, sizeof(dn)); - if (r <= 0 || cur != rr.dnsrr_dend) - return DNS_E_PROTOCOL; - l += dns_dntop_size(dn); - } - if (r < 0) - return DNS_E_PROTOCOL; - if (!p.dnsp_nrr) - return DNS_E_NODATA; - - /* next, allocate and set up result */ - l += dns_stdrr_size(&p); - ret = malloc(sizeof(*ret) + sizeof(struct dns_naptr) * p.dnsp_nrr + l); - if (!ret) - return DNS_E_NOMEM; - ret->dnsnaptr_nrr = p.dnsp_nrr; - ret->dnsnaptr_naptr = (struct dns_naptr *)(ret+1); - - /* and 3rd, fill in result, finally */ - sp = (char*)(&ret->dnsnaptr_naptr[p.dnsp_nrr]); - for (dns_rewind(&p, qdn), r = 0; dns_nextrr(&p, &rr); ++r) { - cur = rr.dnsrr_dptr; - ret->dnsnaptr_naptr[r].order = dns_get16(cur); cur += 2; - ret->dnsnaptr_naptr[r].preference = dns_get16(cur); cur += 2; - sp += dns_getstr(&cur, end, (ret->dnsnaptr_naptr[r].flags = sp)); - sp += dns_getstr(&cur, end, (ret->dnsnaptr_naptr[r].service = sp)); - sp += dns_getstr(&cur, end, (ret->dnsnaptr_naptr[r].regexp = sp)); - dns_getdn(pkt, &cur, end, dn, sizeof(dn)); - sp += dns_dntop(dn, (ret->dnsnaptr_naptr[r].replacement = sp), DNS_MAXNAME); - } - dns_stdrr_finish((struct dns_rr_null *)ret, sp, &p); - *result = ret; - return 0; -} - -struct dns_query * -dns_submit_naptr(struct dns_ctx *ctx, const char *name, int flags, - dns_query_naptr_fn *cbck, void *data) { - return - dns_submit_p(ctx, name, DNS_C_IN, DNS_T_NAPTR, flags, - dns_parse_naptr, (dns_query_fn *)cbck, data); -} - -struct dns_rr_naptr * -dns_resolve_naptr(struct dns_ctx *ctx, const char *name, int flags) { - return (struct dns_rr_naptr *) - dns_resolve_p(ctx, name, DNS_C_IN, DNS_T_NAPTR, flags, dns_parse_naptr); -} diff --git a/libs/udns/udns_rr_ptr.c b/libs/udns/udns_rr_ptr.c deleted file mode 100644 index 410af656a5..0000000000 --- a/libs/udns/udns_rr_ptr.c +++ /dev/null @@ -1,109 +0,0 @@ -/* $Id: udns_rr_ptr.c,v 1.15 2005/09/12 11:21:06 mjt Exp $ - parse/query PTR records - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include "udns.h" - -int -dns_parse_ptr(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result) { - struct dns_rr_ptr *ret; - struct dns_parse p; - struct dns_rr rr; - int r, l, c; - char *sp; - dnsc_t ptr[DNS_MAXDN]; - - assert(dns_get16(cur+2) == DNS_C_IN && dns_get16(cur+0) == DNS_T_PTR); - - /* first, validate the answer and count size of the result */ - l = c = 0; - dns_initparse(&p, qdn, pkt, cur, end); - while((r = dns_nextrr(&p, &rr)) > 0) { - cur = rr.dnsrr_dptr; - r = dns_getdn(pkt, &cur, end, ptr, sizeof(ptr)); - if (r <= 0 || cur != rr.dnsrr_dend) - return DNS_E_PROTOCOL; - l += dns_dntop_size(ptr); - ++c; - } - if (r < 0) - return DNS_E_PROTOCOL; - if (!c) - return DNS_E_NODATA; - - /* next, allocate and set up result */ - ret = malloc(sizeof(*ret) + sizeof(char **) * c + l + dns_stdrr_size(&p)); - if (!ret) - return DNS_E_NOMEM; - ret->dnsptr_nrr = c; - ret->dnsptr_ptr = (char **)(ret+1); - - /* and 3rd, fill in result, finally */ - sp = (char*)(ret->dnsptr_ptr + c); - c = 0; - dns_rewind(&p, qdn); - while((r = dns_nextrr(&p, &rr)) > 0) { - ret->dnsptr_ptr[c] = sp; - cur = rr.dnsrr_dptr; - dns_getdn(pkt, &cur, end, ptr, sizeof(ptr)); - sp += dns_dntop(ptr, sp, DNS_MAXNAME); - ++c; - } - dns_stdrr_finish((struct dns_rr_null *)ret, sp, &p); - *result = ret; - return 0; -} - -struct dns_query * -dns_submit_a4ptr(struct dns_ctx *ctx, const struct in_addr *addr, - dns_query_ptr_fn *cbck, void *data) { - dnsc_t dn[DNS_A4RSIZE]; - dns_a4todn(addr, 0, dn, sizeof(dn)); - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_PTR, DNS_NOSRCH, - dns_parse_ptr, (dns_query_fn *)cbck, data); -} - -struct dns_rr_ptr * -dns_resolve_a4ptr(struct dns_ctx *ctx, const struct in_addr *addr) { - return (struct dns_rr_ptr *) - dns_resolve(ctx, dns_submit_a4ptr(ctx, addr, NULL, NULL)); -} - -struct dns_query * -dns_submit_a6ptr(struct dns_ctx *ctx, const struct in6_addr *addr, - dns_query_ptr_fn *cbck, void *data) { - dnsc_t dn[DNS_A6RSIZE]; - dns_a6todn(addr, 0, dn, sizeof(dn)); - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_PTR, DNS_NOSRCH, - dns_parse_ptr, (dns_query_fn *)cbck, data); -} - -struct dns_rr_ptr * -dns_resolve_a6ptr(struct dns_ctx *ctx, const struct in6_addr *addr) { - return (struct dns_rr_ptr *) - dns_resolve(ctx, dns_submit_a6ptr(ctx, addr, NULL, NULL)); -} diff --git a/libs/udns/udns_rr_srv.c b/libs/udns/udns_rr_srv.c deleted file mode 100644 index 56bbbf7f78..0000000000 --- a/libs/udns/udns_rr_srv.c +++ /dev/null @@ -1,154 +0,0 @@ -/* $Id: udns_rr_srv.c,v 1.2 2005/09/12 12:26:22 mjt Exp $ - parse/query SRV IN (rfc2782) records - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - Copyright 2005 Thadeu Lima de Souza Cascardo - - 2005-09-11: - Changed MX parser file into a SRV parser file - - */ - -#include -#include -#include -#include "udns.h" - -int -dns_parse_srv(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result) { - struct dns_rr_srv *ret; - struct dns_parse p; - struct dns_rr rr; - int r, l; - char *sp; - dnsc_t srv[DNS_MAXDN]; - - assert(dns_get16(cur+2) == DNS_C_IN && dns_get16(cur+0) == DNS_T_SRV); - - /* first, validate the answer and count size of the result */ - l = 0; - dns_initparse(&p, qdn, pkt, cur, end); - while((r = dns_nextrr(&p, &rr)) > 0) { - cur = rr.dnsrr_dptr + 6; - r = dns_getdn(pkt, &cur, end, srv, sizeof(srv)); - if (r <= 0 || cur != rr.dnsrr_dend) - return DNS_E_PROTOCOL; - l += dns_dntop_size(srv); - } - if (r < 0) - return DNS_E_PROTOCOL; - if (!p.dnsp_nrr) - return DNS_E_NODATA; - - /* next, allocate and set up result */ - l += dns_stdrr_size(&p); - ret = malloc(sizeof(*ret) + sizeof(struct dns_srv) * p.dnsp_nrr + l); - if (!ret) - return DNS_E_NOMEM; - ret->dnssrv_nrr = p.dnsp_nrr; - ret->dnssrv_srv = (struct dns_srv *)(ret+1); - - /* and 3rd, fill in result, finally */ - sp = (char*)(ret->dnssrv_srv + p.dnsp_nrr); - for (dns_rewind(&p, qdn), r = 0; dns_nextrr(&p, &rr); ++r) { - ret->dnssrv_srv[r].name = sp; - cur = rr.dnsrr_dptr; - ret->dnssrv_srv[r].priority = dns_get16(cur); - ret->dnssrv_srv[r].weight = dns_get16(cur+2); - ret->dnssrv_srv[r].port = dns_get16(cur+4); - cur += 6; - dns_getdn(pkt, &cur, end, srv, sizeof(srv)); - sp += dns_dntop(srv, sp, DNS_MAXNAME); - } - dns_stdrr_finish((struct dns_rr_null *)ret, sp, &p); - *result = ret; - return 0; -} - -/* Add a single service or proto name prepending an undescore (_), - * according to rfc2782 rules. - * Return 0 or the label length. - * Routing assumes dn holds enouth space for a single DN label. */ -static unsigned add_sname(dnsc_t *dn, const char *sn) { - unsigned l; - l = dns_ptodn(sn, 0, dn + 1, DNS_MAXLABEL-1, NULL); - if (l <= 1 || l - 2 != dn[1]) - /* Should we really check if sn is exactly one label? Do we care? */ - return 0; - dn[0] = l - 1; - dn[1] = '_'; - return l; -} - -/* Construct a domain name for SRV query from the given name, service and - * protocol (service may be NULL in which case protocol isn't used). - * Return negative value on error (malformed query), - * or addition query flag(s) to use. - */ -static int -build_srv_dn(dnsc_t *dn, const char *name, const char *srv, const char *proto) -{ - unsigned p = 0, l; - int isabs; - if (srv) { - l = add_sname(dn + p, srv); - if (!l) - return -1; - p += l; - l = add_sname(dn + p, proto); - if (!l) - return -1; - p += l; - } - l = dns_ptodn(name, 0, dn + p, DNS_MAXDN - p, &isabs); - if (!l) - return -1; - return isabs ? DNS_NOSRCH : 0; -} - -struct dns_query * -dns_submit_srv(struct dns_ctx *ctx, - const char *name, const char *srv, const char *proto, - int flags, dns_query_srv_fn *cbck, void *data) { - dnsc_t dn[DNS_MAXDN]; - int r = build_srv_dn(dn, name, srv, proto); - if (r < 0) { - dns_setstatus (ctx, DNS_E_BADQUERY); - return NULL; - } - return - dns_submit_dn(ctx, dn, DNS_C_IN, DNS_T_SRV, flags | r, - dns_parse_srv, (dns_query_fn *)cbck, data); -} - -struct dns_rr_srv * -dns_resolve_srv(struct dns_ctx *ctx, - const char *name, const char *srv, const char *proto, int flags) -{ - dnsc_t dn[DNS_MAXDN]; - int r = build_srv_dn(dn, name, srv, proto); - if (r < 0) { - dns_setstatus(ctx, DNS_E_BADQUERY); - return NULL; - } - return (struct dns_rr_srv *) - dns_resolve_dn(ctx, dn, DNS_C_IN, DNS_T_SRV, flags | r, dns_parse_srv); -} diff --git a/libs/udns/udns_rr_txt.c b/libs/udns/udns_rr_txt.c deleted file mode 100644 index 68c0b3a380..0000000000 --- a/libs/udns/udns_rr_txt.c +++ /dev/null @@ -1,98 +0,0 @@ -/* $Id: udns_rr_txt.c,v 1.15 2006/11/28 22:45:20 mjt Exp $ - parse/query TXT records - - Copyright (C) 2005 Michael Tokarev - This file is part of UDNS library, an async DNS stub resolver. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library, in file named COPYING.LGPL; if not, - write to the Free Software Foundation, Inc., 59 Temple Place, - Suite 330, Boston, MA 02111-1307 USA - - */ - -#include -#include -#include -#include "udns.h" - -int -dns_parse_txt(dnscc_t *qdn, dnscc_t *pkt, dnscc_t *cur, dnscc_t *end, - void **result) { - struct dns_rr_txt *ret; - struct dns_parse p; - struct dns_rr rr; - int r, l; - dnsc_t *sp; - dnscc_t *cp, *ep; - - assert(dns_get16(cur+0) == DNS_T_TXT); - - /* first, validate the answer and count size of the result */ - l = 0; - dns_initparse(&p, qdn, pkt, cur, end); - while((r = dns_nextrr(&p, &rr)) > 0) { - cp = rr.dnsrr_dptr; ep = rr.dnsrr_dend; - while(cp < ep) { - r = *cp++; - if (cp + r > ep) - return DNS_E_PROTOCOL; - l += r; - cp += r; - } - } - if (r < 0) - return DNS_E_PROTOCOL; - if (!p.dnsp_nrr) - return DNS_E_NODATA; - - /* next, allocate and set up result */ - l += (sizeof(struct dns_txt) + 1) * p.dnsp_nrr + dns_stdrr_size(&p); - ret = malloc(sizeof(*ret) + l); - if (!ret) - return DNS_E_NOMEM; - ret->dnstxt_nrr = p.dnsp_nrr; - ret->dnstxt_txt = (struct dns_txt *)(ret+1); - - /* and 3rd, fill in result, finally */ - sp = (dnsc_t*)(ret->dnstxt_txt + p.dnsp_nrr); - for(dns_rewind(&p, qdn), r = 0; dns_nextrr(&p, &rr) > 0; ++r) { - ret->dnstxt_txt[r].txt = sp; - cp = rr.dnsrr_dptr; ep = rr.dnsrr_dend; - while(cp < ep) { - l = *cp++; - memcpy(sp, cp, l); - sp += l; - cp += l; - } - ret->dnstxt_txt[r].len = (int)(sp - ret->dnstxt_txt[r].txt); - *sp++ = '\0'; - } - dns_stdrr_finish((struct dns_rr_null *)ret, (char*)sp, &p); - *result = ret; - return 0; -} - -struct dns_query * -dns_submit_txt(struct dns_ctx *ctx, const char *name, int qcls, int flags, - dns_query_txt_fn *cbck, void *data) { - return - dns_submit_p(ctx, name, qcls, DNS_T_TXT, flags, - dns_parse_txt, (dns_query_fn *)cbck, data); -} - -struct dns_rr_txt * -dns_resolve_txt(struct dns_ctx *ctx, const char *name, int qcls, int flags) { - return (struct dns_rr_txt *) - dns_resolve_p(ctx, name, qcls, DNS_T_TXT, flags, dns_parse_txt); -} diff --git a/src/mod/applications/mod_enum/Makefile.am b/src/mod/applications/mod_enum/Makefile.am index c512f7691d..c0bdd11a3a 100644 --- a/src/mod/applications/mod_enum/Makefile.am +++ b/src/mod/applications/mod_enum/Makefile.am @@ -1,13 +1,45 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_enum -UDNS_DIR=$(switch_srcdir)/libs/udns -mod_enum_la_CFLAGS = -I$(UDNS_DIR) -DHAVE_POLL $(AM_CFLAGS) +LDNS_DIR=$(switch_srcdir)/libs/ldns +mod_enum_la_CFLAGS = -I$(LDNS_DIR) -I$(LDNS_DIR)/include -DHAVE_POLL $(AM_CFLAGS) mod_LTLIBRARIES = mod_enum.la -mod_enum_la_SOURCES = mod_enum.c -mod_enum_la_SOURCES += $(UDNS_DIR)/udns_dn.c $(UDNS_DIR)/udns_dntosp.c $(UDNS_DIR)/udns_parse.c $(UDNS_DIR)/udns_misc.c -mod_enum_la_SOURCES += $(UDNS_DIR)/udns_rr_a.c $(UDNS_DIR)/udns_rr_ptr.c $(UDNS_DIR)/udns_rr_mx.c $(UDNS_DIR)/udns_rr_txt.c $(UDNS_DIR)/udns_bl.c -mod_enum_la_SOURCES += $(UDNS_DIR)/udns_rr_srv.c $(UDNS_DIR)/udns_rr_naptr.c $(UDNS_DIR)/udns_codes.c $(UDNS_DIR)/udns_resolver.c +mod_enum_la_SOURCES = mod_enum.c + +mod_enum_la_SOURCES += $(LDNS_DIR)/buffer.c\ +$(LDNS_DIR)/dname.c\ +$(LDNS_DIR)/dnssec.c\ +$(LDNS_DIR)/dnssec_sign.c\ +$(LDNS_DIR)/dnssec_verify.c\ +$(LDNS_DIR)/dnssec_zone.c\ +$(LDNS_DIR)/error.c\ +$(LDNS_DIR)/higher.c\ +$(LDNS_DIR)/host2str.c\ +$(LDNS_DIR)/host2wire.c\ +$(LDNS_DIR)/keys.c\ +$(LDNS_DIR)/linktest.c\ +$(LDNS_DIR)/net.c\ +$(LDNS_DIR)/packet.c\ +$(LDNS_DIR)/parse.c\ +$(LDNS_DIR)/rbtree.c\ +$(LDNS_DIR)/rdata.c\ +$(LDNS_DIR)/resolver.c\ +$(LDNS_DIR)/rr.c\ +$(LDNS_DIR)/rr_functions.c\ +$(LDNS_DIR)/sha1.c\ +$(LDNS_DIR)/sha2.c\ +$(LDNS_DIR)/str2host.c\ +$(LDNS_DIR)/tsig.c\ +$(LDNS_DIR)/update.c\ +$(LDNS_DIR)/util.c\ +$(LDNS_DIR)/wire2host.c\ +$(LDNS_DIR)/compat/strlcpy.c\ +$(LDNS_DIR)/compat/b64_pton.c\ +$(LDNS_DIR)/compat/b32_pton.c\ +$(LDNS_DIR)/compat/b64_ntop.c\ +$(LDNS_DIR)/compat/b32_ntop.c\ +$(LDNS_DIR)/zone.c + mod_enum_la_LIBADD = $(switch_builddir)/libfreeswitch.la mod_enum_la_LDFLAGS = -avoid-version -module -no-undefined -shared diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 378c336810..3cbe6b1d59 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -30,11 +30,7 @@ */ #include -#include - -#ifndef WIN32 -#define closesocket close -#endif +#include SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown); @@ -49,19 +45,10 @@ struct enum_record { char *route; int supported; struct enum_record *next; + struct enum_record *tail; }; typedef struct enum_record enum_record_t; -struct query { - const char *name; /* original query string */ - char *number; - unsigned char dn[DNS_MAXDN]; - enum dns_type qtyp; /* type of the query */ - enum_record_t *results; - int errs; -}; -typedef struct query enum_query_t; - struct route { char *service; char *regex; @@ -70,12 +57,11 @@ struct route { }; typedef struct route enum_route_t; -static enum dns_class qcls = DNS_C_IN; - static switch_event_node_t *NODE = NULL; static struct { char *root; + char *server; char *isn_root; enum_route_t *route_order; switch_memory_pool_t *pool; @@ -84,6 +70,7 @@ static struct { } globals; SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_root, globals.root); +SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_server, globals.server); SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_isn_root, globals.isn_root); static void add_route(char *service, char *regex, char *replace) @@ -125,6 +112,8 @@ static switch_status_t load_config(void) const char *val = switch_xml_attr_soft(param, "value"); if (!strcasecmp(var, "default-root")) { set_global_root(val); + } else if (!strcasecmp(var, "use-server")) { + set_global_server(val); } else if (!strcasecmp(var, "auto-reload")) { globals.auto_reload = switch_true(val); } else if (!strcasecmp(var, "query-timeout")) { @@ -168,11 +157,12 @@ static switch_status_t load_config(void) return status; } -static char *reverse_number(char *in, char *root) +static char *reverse_number(const char *in, const char *root) { switch_size_t len; char *out = NULL; - char *y, *z; + const char *y; + char *z; if (!(in && root)) { return NULL; @@ -198,59 +188,33 @@ static char *reverse_number(char *in, char *root) return out; } -static void dnserror(enum_query_t *q, int errnum) -{ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Unable to lookup %s record for %s: %s\n", - dns_typename(q->qtyp), dns_dntosp(q->dn), dns_strerror(errnum)); - q->errs++; -} - -static void add_result(enum_query_t *q, int order, int preference, char *service, char *route, int supported) +static void add_result(enum_record_t **results, int order, int preference, char *service, char *route, int supported) { - enum_record_t *new_result, *rp, *prev = NULL; + enum_record_t *new_result; new_result = malloc(sizeof(*new_result)); switch_assert(new_result); - memset(new_result, 0, sizeof(*new_result)); + memset(new_result, 0, sizeof(*new_result)); new_result->order = order; new_result->preference = preference; new_result->service = strdup(service); new_result->route = strdup(route); new_result->supported = supported; + - if (!q->results) { - q->results = new_result; - return; - } - - rp = q->results; - - while (rp && strcasecmp(rp->service, new_result->service)) { - prev = rp; - rp = rp->next; - } - - while (rp && !strcasecmp(rp->service, new_result->service) && new_result->order > rp->order) { - prev = rp; - rp = rp->next; - } - - while (rp && !strcasecmp(rp->service, new_result->service) && new_result->preference > rp->preference) { - prev = rp; - rp = rp->next; - } - - if (prev) { - new_result->next = rp; - prev->next = new_result; + if (!*results) { + *results = new_result; + (*results)->tail = new_result; } else { - new_result->next = rp; - q->results = new_result; + (*results)->tail->next = new_result; + (*results)->tail = new_result; } + } + static void free_results(enum_record_t ** results) { enum_record_t *fp, *rp; @@ -265,201 +229,234 @@ static void free_results(enum_record_t ** results) *results = NULL; } -static void parse_rr(const struct dns_parse *p, enum_query_t *q, struct dns_rr *rr) + +static ldns_rdf *ldns_rdf_new_addr_frm_str(const char *str) { - const unsigned char *pkt = p->dnsp_pkt; - const unsigned char *end = p->dnsp_end; - const unsigned char *dptr = rr->dnsrr_dptr; - const unsigned char *dend = rr->dnsrr_dend; - unsigned char *dn = rr->dnsrr_dn; - const unsigned char *c; - char flags; - int order; - int preference; + ldns_rdf *a; + + ldns_str2rdf_a(&a, str); + + if (!a) { + /* maybe ip6 */ + ldns_str2rdf_aaaa(&a, str); + if (!a) { + return NULL; + } + } + return a; +} + +#define strip_quotes(_s) if (*_s == '"') _s++; if (end_of(_s) == '"') end_of(_s) = '\0' + +static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t **results) +{ + char *str = ldns_rr2str(naptr); + char *argv[11] = { 0 }; + int i, argc; + char *pack[4] = { 0 }; + int packc; + + char *p; + int order = 10; + int preference = 100; char *service = NULL; - char *regex = NULL; - char *replace = NULL; - char *ptr; - int argc = 0; - char *argv[4] = { 0 }; - int n; - char string_arg[3][256] = { {0} }; + char *packstr; - switch (rr->dnsrr_typ) { - case DNS_T_NAPTR: /* prio weight port targetDN */ - c = dptr; - c += 4; /* order, pref */ - - for (n = 0; n < 3; ++n) { - if (c >= dend) { - goto xperr; - } else { - c += *c + 1; - } - } - - if (dns_getdn(pkt, &c, end, dn, DNS_MAXDN) <= 0 || c != dend) { - goto xperr; - } - - c = dptr; - order = dns_get16(c + 0); - preference = dns_get16(c + 2); - flags = (char) dns_get16(c + 4); - c += 4; - - for (n = 0; n < 3; n++) { - uint32_t len = *c++, cpylen = len; - switch_assert(string_arg[n]); - if (len > sizeof(string_arg[n]) - 1) { - cpylen = sizeof(string_arg[n]) - 1; - } - strncpy(string_arg[n], (char *) c, cpylen); - *(string_arg[n] + len) = '\0'; - c += len; - } - - service = string_arg[1]; - - if ((argc = switch_separate_string(string_arg[2], '!', argv, (sizeof(argv) / sizeof(argv[0]))))) { - regex = argv[1]; - replace = argv[2]; - } else { - goto xperr; - } - - for (ptr = replace; ptr && *ptr; ptr++) { - if (*ptr == '\\') { - *ptr = '$'; - } - } - - if (flags && service && regex && replace) { - switch_regex_t *re = NULL; - int proceed = 0, ovector[30]; - char substituted[1024] = ""; - char rbuf[1024] = ""; - char *uri; - enum_route_t *route; - int supported = 0; - switch_regex_safe_free(re); - - if ((proceed = switch_regex_perform(q->number, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { - if (strchr(regex, '(')) { - switch_perform_substitution(re, proceed, replace, q->number, substituted, sizeof(substituted), ovector); - uri = substituted; - } else { - uri = replace; - } - - switch_mutex_lock(MUTEX); - for (route = globals.route_order; route; route = route->next) { - if (strcasecmp(service, route->service)) { - continue; - } - switch_regex_safe_free(re); - if ((proceed = switch_regex_perform(uri, route->regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { - if (strchr(route->regex, '(')) { - switch_perform_substitution(re, proceed, route->replace, uri, rbuf, sizeof(rbuf), ovector); - uri = rbuf; - } else { - uri = route->replace; - } - supported++; - add_result(q, order, preference, service, uri, supported); - } - } - - if (!supported) { - add_result(q, order, preference, service, uri, 0); - } - } - switch_mutex_unlock(MUTEX); - - - switch_regex_safe_free(re); - } - - break; - - default: - break; + char *regex, *replace; + + if (zstr(str)) { + return; } - return; + for (p = str; p && *p; p++) { + if (*p == '\t') *p = ' '; + if (*p == ' ' && *(p+1) == '.') *p = '\0'; + } - xperr: + argc = switch_split(str, ' ', argv); + + for (i = 0; i < argc; i++) { + if (i > 0) { + strip_quotes(argv[i]); + } + } + + service = argv[7]; + packstr = argv[8]; + + if (zstr(service) || zstr(packstr)) { + goto end; + } + + if (!zstr(argv[4])) { + order = atoi(argv[4]); + } + + if (!zstr(argv[5])) { + preference = atoi(argv[5]); + } + + + if ((packc = switch_split(packstr, '!', pack))) { + regex = pack[1]; + replace = pack[2]; + } else { + goto end; + } + + for (p = replace; p && *p; p++) { + if (*p == '\\') { + *p = '$'; + } + } + + if (service && regex && replace) { + switch_regex_t *re = NULL, *re2 = NULL; + int proceed = 0, ovector[30]; + char substituted[1024] = ""; + char rbuf[1024] = ""; + char *uri; + enum_route_t *route; + int supported = 0; + + if ((proceed = switch_regex_perform(number, regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if (strchr(regex, '(')) { + switch_perform_substitution(re, proceed, replace, number, substituted, sizeof(substituted), ovector); + uri = substituted; + } else { + uri = replace; + } + + switch_mutex_lock(MUTEX); + for (route = globals.route_order; route; route = route->next) { + if (strcasecmp(service, route->service)) { + continue; + } + + if ((proceed = switch_regex_perform(uri, route->regex, &re2, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if (strchr(route->regex, '(')) { + switch_perform_substitution(re2, proceed, route->replace, uri, rbuf, sizeof(rbuf), ovector); + uri = rbuf; + } else { + uri = route->replace; + } + supported++; + add_result(results, order, preference, service, uri, supported); + } + switch_regex_safe_free(re2); + } + switch_mutex_unlock(MUTEX); + + if (!supported) { + add_result(results, order, preference, service, uri, 0); + } + + switch_regex_safe_free(re); + } + } + + end: + + switch_safe_free(str); + return; } -static void dnscb(struct dns_ctx *ctx, void *result, void *data) + +switch_status_t ldns_lookup(const char *number, const char *root, const char *server_name, enum_record_t **results) { - int r = dns_status(ctx); - enum_query_t *q = data; - struct dns_parse p; - struct dns_rr rr; - unsigned nrr; - unsigned char dn[DNS_MAXDN]; - const unsigned char *pkt, *cur, *end, *qdn; - if (!result) { - dnserror(q, r); - return; + ldns_resolver *res = NULL; + ldns_rdf *domain = NULL; + ldns_pkt *p = NULL; + ldns_rr_list *naptr = NULL; + ldns_status s = LDNS_STATUS_ERR; + ldns_rdf *serv_rdf; + switch_status_t status = SWITCH_STATUS_FALSE; + char *name = NULL; + + if (!(name = reverse_number(number, root))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n"); + goto end; } - pkt = result; - end = pkt + r; - cur = dns_payload(pkt); - dns_getdn(pkt, &cur, end, dn, sizeof(dn)); - dns_initparse(&p, NULL, pkt, cur, end); - p.dnsp_qcls = 0; - p.dnsp_qtyp = 0; - qdn = dn; - nrr = 0; - while ((r = dns_nextrr(&p, &rr)) > 0) { - if (!dns_dnequal(qdn, rr.dnsrr_dn)) - continue; - if ((qcls == DNS_C_ANY || qcls == rr.dnsrr_cls) && (q->qtyp == DNS_T_ANY || q->qtyp == rr.dnsrr_typ)) - ++nrr; - else if (rr.dnsrr_typ == DNS_T_CNAME && !nrr) { - if (dns_getdn(pkt, &rr.dnsrr_dptr, end, p.dnsp_dnbuf, sizeof(p.dnsp_dnbuf)) <= 0 || rr.dnsrr_dptr != rr.dnsrr_dend) { - r = DNS_E_PROTOCOL; - break; - } else { - qdn = p.dnsp_dnbuf; + + domain = ldns_dname_new_frm_str(name); + + if (!domain) { + goto end; + } + + if (!zstr(server_name)) { + res = ldns_resolver_new(); + switch_assert(res); + + if ((serv_rdf = ldns_rdf_new_addr_frm_str(server_name))) { + s = ldns_resolver_push_nameserver(res, serv_rdf); + ldns_rdf_deep_free(serv_rdf); + } + } else { + /* create a new resolver from /etc/resolv.conf */ + s = ldns_resolver_new_frm_file(&res, NULL); + } + + if (s != LDNS_STATUS_OK) { + goto end; + } + + /* use the resolver to send a query for the naptr + * records of the domain given on the command line + */ + + + + if ((p = ldns_resolver_query(res, + domain, + LDNS_RR_TYPE_NAPTR, + LDNS_RR_CLASS_IN, + LDNS_RD))) { + /* retrieve the NAPTR records from the answer section of that + * packet + */ + + if ((naptr = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NAPTR, LDNS_SECTION_ANSWER))) { + size_t i; + + ldns_rr_list_sort(naptr); + + for (i = 0; i < ldns_rr_list_rr_count(naptr); i++) { + parse_naptr(ldns_rr_list_rr(naptr, i), number, results); } + + //ldns_rr_list_print(stdout, naptr); + ldns_rr_list_deep_free(naptr); + status = SWITCH_STATUS_SUCCESS; } } - if (!r && !nrr) - r = DNS_E_NODATA; - if (r < 0) { - dnserror(q, r); - free(result); - return; + + end: + + switch_safe_free(name); + + if (domain) { + ldns_rdf_deep_free(domain); } - dns_rewind(&p, NULL); - p.dnsp_qtyp = q->qtyp; - p.dnsp_qcls = qcls; - while (dns_nextrr(&p, &rr)) { - parse_rr(&p, q, &rr); + if (p) { + ldns_pkt_free(p); } - free(result); + if (res) { + ldns_resolver_deep_free(res); + } + + return status; } -static switch_status_t enum_lookup(char *root, char *in, enum_record_t ** results) +static switch_status_t enum_lookup(char *root, char *in, enum_record_t **results) { switch_status_t sstatus = SWITCH_STATUS_SUCCESS; - char *name = NULL; - enum_query_t query = { 0 }; - enum dns_type l_qtyp = DNS_T_NAPTR; - int i = 0, abs = 0, j = 0; - dns_socket fd = (dns_socket) - 1; - fd_set fds; - struct timeval tv = { 0 }; - time_t now = 0; - struct dns_ctx *nctx = NULL; - char *num, *mnum = NULL, *mroot = NULL, *p; + char *mnum = NULL, *mroot = NULL, *p; + char *server = NULL; *results = NULL; @@ -475,87 +472,14 @@ static switch_status_t enum_lookup(char *root, char *in, enum_record_t ** result root = globals.root; } - num = mnum; - if (!(name = reverse_number(num, root))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n"); - sstatus = SWITCH_STATUS_FALSE; - goto done; +#if 0 + if (!(server = switch_core_get_variable("enum-server"))) { + server = globals.server; } - - if (!(nctx = dns_new(NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Memory Error!\n"); - sstatus = SWITCH_STATUS_MEMERR; - goto done; - } - - fd = dns_open(nctx); - - if (fd < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "FD Error!\n"); - sstatus = SWITCH_STATUS_FALSE; - goto done; - } - - dns_ptodn(name, (unsigned int) strlen(name), query.dn, sizeof(query.dn), &abs); - query.name = name; - query.number = num; - query.qtyp = l_qtyp; - - if (abs) { - abs = DNS_NOSRCH; - } - - if (!dns_submit_dn(nctx, query.dn, qcls, l_qtyp, abs, 0, dnscb, &query)) { - dnserror(&query, dns_status(nctx)); - } - - FD_ZERO(&fds); - now = 0; - - while ((i = dns_timeouts(nctx, 1, now)) > 0) { -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable: 4389 4127) -#endif - FD_SET(fd, &fds); -#ifdef _MSC_VER -#pragma warning(pop) #endif - j += i; + ldns_lookup(mnum, root, server, results); - if (j > globals.timeout || query.results || query.errs) { - break; - } - - tv.tv_sec = i; - tv.tv_usec = 0; - i = select((int) (fd + 1), &fds, 0, 0, &tv); - now = switch_epoch_time_now(NULL); - if (i > 0) { - dns_ioevent(nctx, now); - } - } - - if (!query.results) { - sstatus = SWITCH_STATUS_FALSE; - } - - *results = query.results; - query.results = NULL; - - done: - - if (fd > -1) { - closesocket(fd); - fd = (dns_socket) - 1; - } - - if (nctx) { - dns_free(nctx); - } - - switch_safe_free(name); switch_safe_free(mnum); switch_safe_free(mroot); @@ -623,15 +547,17 @@ SWITCH_STANDARD_APP(enum_app_function) dest = argv[0]; root = argv[1]; if (enum_lookup(root, dest, &results) == SWITCH_STATUS_SUCCESS) { - switch_event_header_t *hi; - if ((hi = switch_channel_variable_first(channel))) { - for (; hi; hi = hi->next) { + switch_event_t *vars; + + if (switch_channel_get_variables(channel, &vars) == SWITCH_STATUS_SUCCESS) { + switch_event_header_t *hi; + for (hi = vars->headers; hi; hi = hi->next) { char *vvar = hi->name; if (vvar && !strncmp(vvar, "enum_", 5)) { switch_channel_set_variable(channel, (char *) vvar, NULL); } } - switch_channel_variable_last(channel); + switch_event_destroy(&vars); } for (rp = results; rp; rp = rp->next) { @@ -823,9 +749,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load) return SWITCH_STATUS_TERM; } - if (dns_init(0) < 0) { - return SWITCH_STATUS_FALSE; - } memset(&globals, 0, sizeof(globals)); do_load(); From eec9d939a8fa61b5f17a6486f58162ae3a0fc8f0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 16:27:00 -0500 Subject: [PATCH 122/558] FS-3110 --comment-only phase 1 to replace udns with ldns in mod_enum may need to rerun bootstrap --- bootstrap.sh | 2 +- configure.in | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/bootstrap.sh b/bootstrap.sh index 2dd76c409c..0dd37b925f 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -15,7 +15,7 @@ done BASEDIR=`pwd`; LIBDIR=${BASEDIR}/libs; -SUBDIRS="ilbc curl iksemel js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \ +SUBDIRS="ilbc curl iksemel js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip ldns \ speex sqlite srtp openzap freetdm spandsp libg722_1 portaudio unimrcp tiff-3.8.2 broadvoice silk libcodec2"; if [ ! -f modules.conf ]; then diff --git a/configure.in b/configure.in index cb5319c152..492093c1be 100644 --- a/configure.in +++ b/configure.in @@ -1024,6 +1024,7 @@ AC_CONFIG_SUBDIRS([libs/broadvoice]) AC_CONFIG_SUBDIRS([libs/libg722_1]) AC_CONFIG_SUBDIRS([libs/silk]) AC_CONFIG_SUBDIRS([libs/libcodec2]) +AC_CONFIG_SUBDIRS([libs/ldns]) case $host in *-openbsd*) From 0290bdc34ab36b1df70509bf10587da8c46e0616 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 16:37:29 -0500 Subject: [PATCH 123/558] FS-3110 --comment-only phase 1 to replace udns with ldns in mod_enum may need to rerun bootstrap --- libs/ldns/util.h | 347 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 347 insertions(+) create mode 100644 libs/ldns/util.h diff --git a/libs/ldns/util.h b/libs/ldns/util.h new file mode 100644 index 0000000000..8ce850a33d --- /dev/null +++ b/libs/ldns/util.h @@ -0,0 +1,347 @@ +/* + * util.h + * + * helper function header file + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004 + * + * See the file LICENSE for the license + */ + +#ifndef _UTIL_H +#define _UTIL_H + +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define dprintf(X,Y) fprintf(stderr, (X), (Y)) +/* #define dprintf(X, Y) */ + +#define LDNS_VERSION "1.6.9" +#define LDNS_REVISION ((1<<16)|(6<<8)|(9)) + +/** + * splint static inline workaround + */ +#ifdef S_SPLINT_S +# define INLINE +#else +# ifdef SWIG +# define INLINE static +# else +# define INLINE static inline +# endif +#endif + +/** + * Memory management macros + */ +#define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1) + +#define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type))) + +#define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1) + +#define LDNS_XREALLOC(ptr, type, count) \ + ((type *) realloc((ptr), (count) * sizeof(type))) + +#define LDNS_FREE(ptr) \ + do { free((ptr)); (ptr) = NULL; } while (0) + +#define LDNS_DEP printf("DEPRECATED FUNCTION!\n"); + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE uint16_t +ldns_read_uint16(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohs(*(uint16_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; +#endif +} + +INLINE uint32_t +ldns_read_uint32(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohl(*(uint32_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ( ((uint32_t) p[0] << 24) + | ((uint32_t) p[1] << 16) + | ((uint32_t) p[2] << 8) + | (uint32_t) p[3]); +#endif +} + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE void +ldns_write_uint16(void *dst, uint16_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint16_t *) dst = htons(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 8) & 0xff); + p[1] = (uint8_t) (data & 0xff); +#endif +} + +INLINE void +ldns_write_uint32(void *dst, uint32_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint32_t *) dst = htonl(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 24) & 0xff); + p[1] = (uint8_t) ((data >> 16) & 0xff); + p[2] = (uint8_t) ((data >> 8) & 0xff); + p[3] = (uint8_t) (data & 0xff); +#endif +} + +/* warning. */ +INLINE void +ldns_write_uint64_as_uint48(void *dst, uint64_t data) +{ + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 40) & 0xff); + p[1] = (uint8_t) ((data >> 32) & 0xff); + p[2] = (uint8_t) ((data >> 24) & 0xff); + p[3] = (uint8_t) ((data >> 16) & 0xff); + p[4] = (uint8_t) ((data >> 8) & 0xff); + p[5] = (uint8_t) (data & 0xff); +} + + +/** + * Structure to do a Schwartzian-like transformation, for instance when + * sorting. If you need a transformation on the objects that are sorted, + * you can sue this to store the transformed values, so you do not + * need to do the transformation again for each comparison + */ +struct ldns_schwartzian_compare_struct { + void *original_object; + void *transformed_object; +}; + +/** A general purpose lookup table + * + * Lookup tables are arrays of (id, name) pairs, + * So you can for instance lookup the RCODE 3, which is "NXDOMAIN", + * and vice versa. The lookup tables themselves are defined wherever needed, + * for instance in \ref host2str.c + */ +struct ldns_struct_lookup_table { + int id; + const char *name; +}; +typedef struct ldns_struct_lookup_table ldns_lookup_table; + +/** + * Looks up the table entry by name, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] name what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[], + const char *name); + +/** + * Looks up the table entry by id, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] id what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id); + +/** + * Returns the value of the specified bit + * The bits are counted from left to right, so bit #0 is the + * left most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return + */ +int ldns_get_bit(uint8_t bits[], size_t index); + + +/** + * Returns the value of the specified bit + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return 1 or 0 depending no the bit state + */ +int ldns_get_bit_r(uint8_t bits[], size_t index); + +/** + * sets the specified bit in the specified byte to + * 1 if value is true, 0 if false + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] byte the bit to set the bit in + * \param[in] bit_nr the bit to set (0 <= n <= 7) + * \param[in] value whether to set the bit to 1 or 0 + * \return 1 or 0 depending no the bit state + */ +void ldns_set_bit(uint8_t *byte, int bit_nr, bool value); + +/** + * Returns the value of a to the power of b + * (or 1 of b < 1) + */ +/*@unused@*/ +INLINE long +ldns_power(long a, long b) { + long result = 1; + while (b > 0) { + if (b & 1) { + result *= a; + if (b == 1) { + return result; + } + } + a *= a; + b /= 2; + } + return result; +} + +/** + * Returns the int value of the given (hex) digit + * \param[in] ch the hex char to convert + * \return the converted decimal value + */ +int ldns_hexdigit_to_int(char ch); + +/** + * Returns the char (hex) representation of the given int + * \param[in] ch the int to convert + * \return the converted hex char + */ +char ldns_int_to_hexdigit(int ch); + +/** + * Converts a hex string to binary data + * + * \param[out] data The binary result is placed here. + * At least strlen(str)/2 bytes should be allocated + * \param[in] str The hex string to convert. + * This string should not contain spaces + * \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number + */ +int +ldns_hexstring_to_data(uint8_t *data, const char *str); + +/** + * Show the internal library version + * \return a string with the version in it + */ +const char * ldns_version(void); + +/** + * Convert TM to seconds since epoch (midnight, January 1st, 1970). + * Like timegm(3), which is not always available. + * \param[in] tm a struct tm* with the date + * \return the seconds since epoch + */ +time_t mktime_from_utc(const struct tm *tm); + +/** + * Seed the random function. + * If the file descriptor is specified, the random generator is seeded with + * data from that file. If not, /dev/urandom is used. + * + * applications should call this if they need entropy data within ldns + * If openSSL is available, it is automatically seeded from /dev/urandom + * or /dev/random. + * + * If you need more entropy, or have no openssl available, this function + * MUST be called at the start of the program + * + * If openssl *is* available, this function just adds more entropy + * + * \param[in] fd a file providing entropy data for the seed + * \param[in] size the number of bytes to use as entropy data. If this is 0, + * only the minimal amount is taken (usually 4 bytes) + * \return 0 if seeding succeeds, 1 if it fails + */ +int ldns_init_random(FILE *fd, unsigned int size); + +/** + * Get random number. + * \return random number. + * + */ +uint16_t ldns_get_random(void); + +/** + * Encode data as BubbleBabble + * + * \param[in] data a pointer to data to be encoded + * \param[in] len size the number of bytes of data + * \return a string of BubbleBabble + */ +char *ldns_bubblebabble(uint8_t *data, size_t len); + +#ifndef B32_NTOP +int ldns_b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_ntop + */ +/*@unused@*/ +INLINE size_t ldns_b32_ntop_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize / 5) * 8) - 2) + 2); + return result; +} +#endif /* !B32_NTOP */ +#ifndef B32_PTON +int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_pton + */ +/*@unused@*/ +INLINE size_t ldns_b32_pton_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize) / 8) * 5)); + return result; +} +#endif /* !B32_PTON */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_UTIL_H */ From 822ea8f654883af868c418abcb03badd47837345 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 16:44:22 -0500 Subject: [PATCH 124/558] FS-3110 --comment-only phase 2 --- libs/ldns/Changelog | 584 - libs/ldns/LICENSE | 26 - libs/ldns/Makefile.in | 368 - libs/ldns/README | 129 - libs/ldns/README.snapshots | 8 - libs/ldns/README.svn | 26 - libs/ldns/ac_pkg_swig.m4 | 122 - libs/ldns/acx_nlnetlabs.m4 | 1310 -- libs/ldns/acx_python.m4 | 200 - libs/ldns/buffer.c | 176 - libs/ldns/compat/b32_ntop.c | 333 - libs/ldns/compat/b32_pton.c | 387 - libs/ldns/compat/b64_ntop.c | 202 - libs/ldns/compat/b64_pton.c | 260 - libs/ldns/compat/ctime_r.c | 16 - libs/ldns/compat/fake-rfc2553.c | 229 - libs/ldns/compat/fake-rfc2553.h | 183 - libs/ldns/compat/gmtime_r.c | 14 - libs/ldns/compat/inet_aton.c | 182 - libs/ldns/compat/inet_ntop.c | 216 - libs/ldns/compat/inet_pton.c | 230 - libs/ldns/compat/isascii.c | 15 - libs/ldns/compat/isblank.c | 15 - libs/ldns/compat/malloc.c | 22 - libs/ldns/compat/memmove.c | 43 - libs/ldns/compat/realloc.c | 30 - libs/ldns/compat/snprintf.c | 770 - libs/ldns/compat/strlcpy.c | 57 - libs/ldns/compat/timegm.c | 31 - libs/ldns/config.guess | 1407 -- libs/ldns/config.sub | 1504 -- libs/ldns/configure | 17354 ---------------- libs/ldns/configure.ac | 488 - libs/ldns/configure.gnu | 4 - libs/ldns/contrib/NETLDNS.readme.txt | 10 - libs/ldns/contrib/build-solaris.sh | 50 - libs/ldns/contrib/python/LICENSE | 27 - libs/ldns/contrib/python/Makefile | 67 - libs/ldns/contrib/python/docs/Makefile | 70 - libs/ldns/contrib/python/docs/source/conf.py | 180 - .../python/docs/source/examples/example1.rst | 68 - .../python/docs/source/examples/example2.py | 45 - .../python/docs/source/examples/example2.rst | 100 - .../python/docs/source/examples/example3.rst | 7 - .../python/docs/source/examples/example4.rst | 7 - .../python/docs/source/examples/example5.rst | 14 - .../python/docs/source/examples/example6.rst | 12 - .../python/docs/source/examples/example7.rst | 8 - .../python/docs/source/examples/example8.rst | 17 - .../python/docs/source/examples/index.rst | 12 - .../ldns/contrib/python/docs/source/index.rst | 22 - .../contrib/python/docs/source/install.rst | 46 - .../python/docs/source/modules/ldns.rst | 40 - .../docs/source/modules/ldns_buffer.rst | 11 - .../python/docs/source/modules/ldns_dname.rst | 11 - .../docs/source/modules/ldns_dnssec.rst | 28 - .../python/docs/source/modules/ldns_func.rst | 253 - .../python/docs/source/modules/ldns_key.rst | 11 - .../docs/source/modules/ldns_key_list.rst | 11 - .../python/docs/source/modules/ldns_pkt.rst | 11 - .../python/docs/source/modules/ldns_rdf.rst | 47 - .../docs/source/modules/ldns_resolver.rst | 13 - .../python/docs/source/modules/ldns_rr.rst | 18 - .../docs/source/modules/ldns_rr_list.rst | 11 - .../python/docs/source/modules/ldns_zone.rst | 11 - .../ldns/contrib/python/examples/ldns-axfr.py | 56 - libs/ldns/contrib/python/examples/ldns-buf.py | 8 - .../contrib/python/examples/ldns-dnssec.py | 45 - .../contrib/python/examples/ldns-higher.py | 36 - .../contrib/python/examples/ldns-keygen.py | 46 - libs/ldns/contrib/python/examples/ldns-mx.py | 15 - libs/ldns/contrib/python/examples/ldns-mx1.py | 18 - libs/ldns/contrib/python/examples/ldns-mx2.py | 19 - .../contrib/python/examples/ldns-newpkt.py | 17 - .../contrib/python/examples/ldns-signzone.py | 65 - .../ldns/contrib/python/examples/ldns-zone.py | 15 - libs/ldns/contrib/python/examples/zone.txt | 15 - libs/ldns/contrib/python/ldns.i | 267 - libs/ldns/contrib/python/ldns_buffer.i | 560 - libs/ldns/contrib/python/ldns_dname.i | 196 - libs/ldns/contrib/python/ldns_dnssec.i | 434 - libs/ldns/contrib/python/ldns_key.i | 536 - libs/ldns/contrib/python/ldns_packet.i | 1036 - libs/ldns/contrib/python/ldns_rdf.i | 418 - libs/ldns/contrib/python/ldns_resolver.i | 940 - libs/ldns/contrib/python/ldns_rr.i | 1169 -- libs/ldns/contrib/python/ldns_zone.i | 298 - libs/ldns/dname.c | 567 - libs/ldns/dnssec.c | 1730 -- libs/ldns/dnssec_sign.c | 1269 -- libs/ldns/dnssec_verify.c | 2303 -- libs/ldns/dnssec_zone.c | 836 - libs/ldns/doc/API-header.xml | 109 - libs/ldns/doc/API.xml | 462 - libs/ldns/doc/CodingStyle | 64 - libs/ldns/doc/TODO | 19 - libs/ldns/doc/design.dox | 124 - libs/ldns/doc/dns-lib-implementations | 56 - libs/ldns/doc/doxyparse.pl | 288 - libs/ldns/doc/function_manpages | 223 - libs/ldns/doc/header.html | 10 - .../doc/images/LogoInGradientBar2-y100.png | Bin 60773 -> 0 bytes libs/ldns/doc/images/libdnsoverview.png | Bin 43646 -> 0 bytes libs/ldns/doc/images/libdnsoverview.svg | 475 - libs/ldns/doc/libdns.css | 425 - libs/ldns/doc/tutorial1_mx.dox | 98 - libs/ldns/doc/tutorial2_zone.dox | 111 - libs/ldns/doc/tutorial3_signzone.dox | 206 - libs/ldns/drill/ChangeLog.22-nov-2005 | 105 - libs/ldns/drill/Makefile.in | 117 - libs/ldns/drill/README | 12 - libs/ldns/drill/REGRESSIONS | 25 - libs/ldns/drill/chasetrace.c | 401 - libs/ldns/drill/config.h.in | 293 - libs/ldns/drill/configure | 6663 ------ libs/ldns/drill/configure.ac | 261 - libs/ldns/drill/dnssec.c | 509 - libs/ldns/drill/drill.1 | 230 - libs/ldns/drill/drill.c | 930 - libs/ldns/drill/drill.h.in | 109 - libs/ldns/drill/drill_util.c | 305 - libs/ldns/drill/drill_util.h | 58 - libs/ldns/drill/error.c | 115 - libs/ldns/drill/install-sh | 520 - libs/ldns/drill/root.c | 122 - libs/ldns/drill/securetrace.c | 761 - libs/ldns/drill/work.c | 276 - libs/ldns/error.c | 105 - libs/ldns/examples/Makefile.in | 179 - libs/ldns/examples/README | 5 - libs/ldns/examples/config.h.in | 363 - libs/ldns/examples/configure | 7150 ------- libs/ldns/examples/configure.ac | 421 - libs/ldns/examples/fake-rfc2553.h | 175 - libs/ldns/examples/ldns-chaos.1 | 26 - libs/ldns/examples/ldns-chaos.c | 125 - libs/ldns/examples/ldns-compare-zones.1 | 57 - libs/ldns/examples/ldns-compare-zones.c | 283 - libs/ldns/examples/ldns-dpa.1 | 151 - libs/ldns/examples/ldns-dpa.c | 2837 --- libs/ldns/examples/ldns-key2ds.1 | 41 - libs/ldns/examples/ldns-key2ds.c | 199 - libs/ldns/examples/ldns-keyfetcher.1 | 64 - libs/ldns/examples/ldns-keyfetcher.c | 724 - libs/ldns/examples/ldns-keygen.1 | 53 - libs/ldns/examples/ldns-keygen.c | 307 - libs/ldns/examples/ldns-mx.1 | 23 - libs/ldns/examples/ldns-mx.c | 88 - libs/ldns/examples/ldns-notify.1 | 66 - libs/ldns/examples/ldns-notify.c | 329 - libs/ldns/examples/ldns-nsec3-hash.1 | 34 - libs/ldns/examples/ldns-nsec3-hash.c | 127 - libs/ldns/examples/ldns-read-zone.1 | 56 - libs/ldns/examples/ldns-read-zone.c | 159 - libs/ldns/examples/ldns-resolver.1 | 26 - libs/ldns/examples/ldns-resolver.c | 47 - libs/ldns/examples/ldns-revoke.1 | 27 - libs/ldns/examples/ldns-revoke.c | 104 - libs/ldns/examples/ldns-rrsig.1 | 30 - libs/ldns/examples/ldns-rrsig.c | 207 - libs/ldns/examples/ldns-signzone.1 | 159 - libs/ldns/examples/ldns-signzone.c | 836 - libs/ldns/examples/ldns-test-edns.1 | 41 - libs/ldns/examples/ldns-test-edns.c | 246 - libs/ldns/examples/ldns-testns.1 | 131 - libs/ldns/examples/ldns-testns.c | 576 - libs/ldns/examples/ldns-testpkts.c | 881 - libs/ldns/examples/ldns-testpkts.h | 255 - libs/ldns/examples/ldns-update.1 | 44 - libs/ldns/examples/ldns-update.c | 310 - libs/ldns/examples/ldns-verify-zone.1 | 49 - libs/ldns/examples/ldns-verify-zone.c | 713 - libs/ldns/examples/ldns-version.1 | 22 - libs/ldns/examples/ldns-version.c | 16 - libs/ldns/examples/ldns-walk.1 | 49 - libs/ldns/examples/ldns-walk.c | 671 - libs/ldns/examples/ldns-zcat.1 | 30 - libs/ldns/examples/ldns-zcat.c | 171 - libs/ldns/examples/ldns-zsplit.1 | 39 - libs/ldns/examples/ldns-zsplit.c | 272 - libs/ldns/examples/ldnsd.1 | 26 - libs/ldns/examples/ldnsd.c | 241 - libs/ldns/higher.c | 354 - libs/ldns/host2str.c | 2084 -- libs/ldns/host2wire.c | 433 - libs/ldns/install-sh | 524 - libs/ldns/keys.c | 1666 -- libs/ldns/ldns/buffer.h | 644 - libs/ldns/ldns/common.h | 52 - libs/ldns/ldns/config.h.in | 470 - libs/ldns/ldns/dname.h | 201 - libs/ldns/ldns/dnssec.h | 497 - libs/ldns/ldns/dnssec_sign.h | 318 - libs/ldns/ldns/dnssec_verify.h | 612 - libs/ldns/ldns/dnssec_zone.h | 366 - libs/ldns/ldns/error.h | 119 - libs/ldns/ldns/higher.h | 113 - libs/ldns/ldns/host2str.h | 566 - libs/ldns/ldns/host2wire.h | 164 - libs/ldns/ldns/keys.h | 614 - libs/ldns/ldns/ldns.h | 155 - libs/ldns/ldns/net.h.in | 208 - libs/ldns/ldns/packet.h | 855 - libs/ldns/ldns/parse.h | 167 - libs/ldns/ldns/rbtree.h | 230 - libs/ldns/ldns/rdata.h | 385 - libs/ldns/ldns/resolver.h | 721 - libs/ldns/ldns/rr.h | 885 - libs/ldns/ldns/rr_functions.h | 259 - libs/ldns/ldns/sha1.h | 38 - libs/ldns/ldns/sha2.h | 152 - libs/ldns/ldns/str2host.h | 251 - libs/ldns/ldns/tsig.h | 101 - libs/ldns/ldns/update.h | 115 - libs/ldns/ldns/util.h.in | 347 - libs/ldns/ldns/wire2host.h | 197 - libs/ldns/ldns/zone.h | 175 - libs/ldns/ldns_symbols.def | 733 - libs/ldns/libdns.doxygen | 1130 - libs/ldns/libdns.vim | 332 - libs/ldns/linktest.c | 13 - libs/ldns/ltmain.sh | 9687 --------- libs/ldns/net.c | 884 - libs/ldns/packaging/fedora/ldns.spec | 276 - libs/ldns/packaging/ldns-config.in | 31 - libs/ldns/packaging/libldns.pc.in | 13 - libs/ldns/packet.c | 1007 - libs/ldns/parse.c | 445 - libs/ldns/rbtree.c | 669 - libs/ldns/rdata.c | 675 - libs/ldns/resolver.c | 1309 -- libs/ldns/rr.c | 2403 --- libs/ldns/rr_functions.c | 341 - libs/ldns/sha1.c | 177 - libs/ldns/sha2.c | 982 - libs/ldns/str2host.c | 1313 -- libs/ldns/tsig.c | 458 - libs/ldns/update.c | 315 - libs/ldns/util.c | 391 - libs/ldns/util.h | 347 - libs/ldns/version | 1 - libs/ldns/wire2host.c | 456 - libs/ldns/zone.c | 430 - 243 files changed, 115797 deletions(-) delete mode 100644 libs/ldns/Changelog delete mode 100644 libs/ldns/LICENSE delete mode 100644 libs/ldns/Makefile.in delete mode 100644 libs/ldns/README delete mode 100644 libs/ldns/README.snapshots delete mode 100644 libs/ldns/README.svn delete mode 100644 libs/ldns/ac_pkg_swig.m4 delete mode 100644 libs/ldns/acx_nlnetlabs.m4 delete mode 100644 libs/ldns/acx_python.m4 delete mode 100644 libs/ldns/buffer.c delete mode 100644 libs/ldns/compat/b32_ntop.c delete mode 100644 libs/ldns/compat/b32_pton.c delete mode 100644 libs/ldns/compat/b64_ntop.c delete mode 100644 libs/ldns/compat/b64_pton.c delete mode 100644 libs/ldns/compat/ctime_r.c delete mode 100644 libs/ldns/compat/fake-rfc2553.c delete mode 100644 libs/ldns/compat/fake-rfc2553.h delete mode 100644 libs/ldns/compat/gmtime_r.c delete mode 100644 libs/ldns/compat/inet_aton.c delete mode 100644 libs/ldns/compat/inet_ntop.c delete mode 100644 libs/ldns/compat/inet_pton.c delete mode 100644 libs/ldns/compat/isascii.c delete mode 100644 libs/ldns/compat/isblank.c delete mode 100644 libs/ldns/compat/malloc.c delete mode 100644 libs/ldns/compat/memmove.c delete mode 100644 libs/ldns/compat/realloc.c delete mode 100644 libs/ldns/compat/snprintf.c delete mode 100644 libs/ldns/compat/strlcpy.c delete mode 100644 libs/ldns/compat/timegm.c delete mode 100755 libs/ldns/config.guess delete mode 100755 libs/ldns/config.sub delete mode 100755 libs/ldns/configure delete mode 100644 libs/ldns/configure.ac delete mode 100644 libs/ldns/configure.gnu delete mode 100644 libs/ldns/contrib/NETLDNS.readme.txt delete mode 100644 libs/ldns/contrib/build-solaris.sh delete mode 100644 libs/ldns/contrib/python/LICENSE delete mode 100644 libs/ldns/contrib/python/Makefile delete mode 100644 libs/ldns/contrib/python/docs/Makefile delete mode 100644 libs/ldns/contrib/python/docs/source/conf.py delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example1.rst delete mode 100755 libs/ldns/contrib/python/docs/source/examples/example2.py delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example2.rst delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example3.rst delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example4.rst delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example5.rst delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example6.rst delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example7.rst delete mode 100644 libs/ldns/contrib/python/docs/source/examples/example8.rst delete mode 100644 libs/ldns/contrib/python/docs/source/examples/index.rst delete mode 100644 libs/ldns/contrib/python/docs/source/index.rst delete mode 100644 libs/ldns/contrib/python/docs/source/install.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_buffer.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_dname.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_dnssec.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_func.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_key.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_key_list.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_pkt.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_rdf.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_resolver.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_rr.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_rr_list.rst delete mode 100644 libs/ldns/contrib/python/docs/source/modules/ldns_zone.rst delete mode 100755 libs/ldns/contrib/python/examples/ldns-axfr.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-buf.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-dnssec.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-higher.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-keygen.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-mx.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-mx1.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-mx2.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-newpkt.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-signzone.py delete mode 100755 libs/ldns/contrib/python/examples/ldns-zone.py delete mode 100644 libs/ldns/contrib/python/examples/zone.txt delete mode 100644 libs/ldns/contrib/python/ldns.i delete mode 100644 libs/ldns/contrib/python/ldns_buffer.i delete mode 100644 libs/ldns/contrib/python/ldns_dname.i delete mode 100644 libs/ldns/contrib/python/ldns_dnssec.i delete mode 100644 libs/ldns/contrib/python/ldns_key.i delete mode 100644 libs/ldns/contrib/python/ldns_packet.i delete mode 100644 libs/ldns/contrib/python/ldns_rdf.i delete mode 100644 libs/ldns/contrib/python/ldns_resolver.i delete mode 100644 libs/ldns/contrib/python/ldns_rr.i delete mode 100644 libs/ldns/contrib/python/ldns_zone.i delete mode 100644 libs/ldns/dname.c delete mode 100644 libs/ldns/dnssec.c delete mode 100644 libs/ldns/dnssec_sign.c delete mode 100644 libs/ldns/dnssec_verify.c delete mode 100644 libs/ldns/dnssec_zone.c delete mode 100644 libs/ldns/doc/API-header.xml delete mode 100644 libs/ldns/doc/API.xml delete mode 100644 libs/ldns/doc/CodingStyle delete mode 100644 libs/ldns/doc/TODO delete mode 100644 libs/ldns/doc/design.dox delete mode 100644 libs/ldns/doc/dns-lib-implementations delete mode 100755 libs/ldns/doc/doxyparse.pl delete mode 100644 libs/ldns/doc/function_manpages delete mode 100644 libs/ldns/doc/header.html delete mode 100644 libs/ldns/doc/images/LogoInGradientBar2-y100.png delete mode 100644 libs/ldns/doc/images/libdnsoverview.png delete mode 100644 libs/ldns/doc/images/libdnsoverview.svg delete mode 100644 libs/ldns/doc/libdns.css delete mode 100644 libs/ldns/doc/tutorial1_mx.dox delete mode 100644 libs/ldns/doc/tutorial2_zone.dox delete mode 100644 libs/ldns/doc/tutorial3_signzone.dox delete mode 100644 libs/ldns/drill/ChangeLog.22-nov-2005 delete mode 100644 libs/ldns/drill/Makefile.in delete mode 100644 libs/ldns/drill/README delete mode 100644 libs/ldns/drill/REGRESSIONS delete mode 100644 libs/ldns/drill/chasetrace.c delete mode 100644 libs/ldns/drill/config.h.in delete mode 100755 libs/ldns/drill/configure delete mode 100644 libs/ldns/drill/configure.ac delete mode 100644 libs/ldns/drill/dnssec.c delete mode 100644 libs/ldns/drill/drill.1 delete mode 100644 libs/ldns/drill/drill.c delete mode 100644 libs/ldns/drill/drill.h.in delete mode 100644 libs/ldns/drill/drill_util.c delete mode 100644 libs/ldns/drill/drill_util.h delete mode 100644 libs/ldns/drill/error.c delete mode 100755 libs/ldns/drill/install-sh delete mode 100644 libs/ldns/drill/root.c delete mode 100644 libs/ldns/drill/securetrace.c delete mode 100644 libs/ldns/drill/work.c delete mode 100644 libs/ldns/error.c delete mode 100644 libs/ldns/examples/Makefile.in delete mode 100644 libs/ldns/examples/README delete mode 100644 libs/ldns/examples/config.h.in delete mode 100755 libs/ldns/examples/configure delete mode 100644 libs/ldns/examples/configure.ac delete mode 100644 libs/ldns/examples/fake-rfc2553.h delete mode 100644 libs/ldns/examples/ldns-chaos.1 delete mode 100644 libs/ldns/examples/ldns-chaos.c delete mode 100644 libs/ldns/examples/ldns-compare-zones.1 delete mode 100644 libs/ldns/examples/ldns-compare-zones.c delete mode 100644 libs/ldns/examples/ldns-dpa.1 delete mode 100644 libs/ldns/examples/ldns-dpa.c delete mode 100644 libs/ldns/examples/ldns-key2ds.1 delete mode 100644 libs/ldns/examples/ldns-key2ds.c delete mode 100644 libs/ldns/examples/ldns-keyfetcher.1 delete mode 100644 libs/ldns/examples/ldns-keyfetcher.c delete mode 100644 libs/ldns/examples/ldns-keygen.1 delete mode 100644 libs/ldns/examples/ldns-keygen.c delete mode 100644 libs/ldns/examples/ldns-mx.1 delete mode 100644 libs/ldns/examples/ldns-mx.c delete mode 100644 libs/ldns/examples/ldns-notify.1 delete mode 100644 libs/ldns/examples/ldns-notify.c delete mode 100644 libs/ldns/examples/ldns-nsec3-hash.1 delete mode 100644 libs/ldns/examples/ldns-nsec3-hash.c delete mode 100644 libs/ldns/examples/ldns-read-zone.1 delete mode 100644 libs/ldns/examples/ldns-read-zone.c delete mode 100644 libs/ldns/examples/ldns-resolver.1 delete mode 100644 libs/ldns/examples/ldns-resolver.c delete mode 100644 libs/ldns/examples/ldns-revoke.1 delete mode 100644 libs/ldns/examples/ldns-revoke.c delete mode 100644 libs/ldns/examples/ldns-rrsig.1 delete mode 100644 libs/ldns/examples/ldns-rrsig.c delete mode 100644 libs/ldns/examples/ldns-signzone.1 delete mode 100644 libs/ldns/examples/ldns-signzone.c delete mode 100644 libs/ldns/examples/ldns-test-edns.1 delete mode 100644 libs/ldns/examples/ldns-test-edns.c delete mode 100644 libs/ldns/examples/ldns-testns.1 delete mode 100644 libs/ldns/examples/ldns-testns.c delete mode 100644 libs/ldns/examples/ldns-testpkts.c delete mode 100644 libs/ldns/examples/ldns-testpkts.h delete mode 100644 libs/ldns/examples/ldns-update.1 delete mode 100644 libs/ldns/examples/ldns-update.c delete mode 100644 libs/ldns/examples/ldns-verify-zone.1 delete mode 100644 libs/ldns/examples/ldns-verify-zone.c delete mode 100644 libs/ldns/examples/ldns-version.1 delete mode 100644 libs/ldns/examples/ldns-version.c delete mode 100644 libs/ldns/examples/ldns-walk.1 delete mode 100644 libs/ldns/examples/ldns-walk.c delete mode 100644 libs/ldns/examples/ldns-zcat.1 delete mode 100644 libs/ldns/examples/ldns-zcat.c delete mode 100644 libs/ldns/examples/ldns-zsplit.1 delete mode 100644 libs/ldns/examples/ldns-zsplit.c delete mode 100644 libs/ldns/examples/ldnsd.1 delete mode 100644 libs/ldns/examples/ldnsd.c delete mode 100644 libs/ldns/higher.c delete mode 100644 libs/ldns/host2str.c delete mode 100644 libs/ldns/host2wire.c delete mode 100755 libs/ldns/install-sh delete mode 100644 libs/ldns/keys.c delete mode 100644 libs/ldns/ldns/buffer.h delete mode 100644 libs/ldns/ldns/common.h delete mode 100644 libs/ldns/ldns/config.h.in delete mode 100644 libs/ldns/ldns/dname.h delete mode 100644 libs/ldns/ldns/dnssec.h delete mode 100644 libs/ldns/ldns/dnssec_sign.h delete mode 100644 libs/ldns/ldns/dnssec_verify.h delete mode 100644 libs/ldns/ldns/dnssec_zone.h delete mode 100644 libs/ldns/ldns/error.h delete mode 100644 libs/ldns/ldns/higher.h delete mode 100644 libs/ldns/ldns/host2str.h delete mode 100644 libs/ldns/ldns/host2wire.h delete mode 100644 libs/ldns/ldns/keys.h delete mode 100644 libs/ldns/ldns/ldns.h delete mode 100644 libs/ldns/ldns/net.h.in delete mode 100644 libs/ldns/ldns/packet.h delete mode 100644 libs/ldns/ldns/parse.h delete mode 100644 libs/ldns/ldns/rbtree.h delete mode 100644 libs/ldns/ldns/rdata.h delete mode 100644 libs/ldns/ldns/resolver.h delete mode 100644 libs/ldns/ldns/rr.h delete mode 100644 libs/ldns/ldns/rr_functions.h delete mode 100644 libs/ldns/ldns/sha1.h delete mode 100644 libs/ldns/ldns/sha2.h delete mode 100644 libs/ldns/ldns/str2host.h delete mode 100644 libs/ldns/ldns/tsig.h delete mode 100644 libs/ldns/ldns/update.h delete mode 100644 libs/ldns/ldns/util.h.in delete mode 100644 libs/ldns/ldns/wire2host.h delete mode 100644 libs/ldns/ldns/zone.h delete mode 100644 libs/ldns/ldns_symbols.def delete mode 100644 libs/ldns/libdns.doxygen delete mode 100644 libs/ldns/libdns.vim delete mode 100644 libs/ldns/linktest.c delete mode 100755 libs/ldns/ltmain.sh delete mode 100644 libs/ldns/net.c delete mode 100644 libs/ldns/packaging/fedora/ldns.spec delete mode 100755 libs/ldns/packaging/ldns-config.in delete mode 100644 libs/ldns/packaging/libldns.pc.in delete mode 100644 libs/ldns/packet.c delete mode 100644 libs/ldns/parse.c delete mode 100644 libs/ldns/rbtree.c delete mode 100644 libs/ldns/rdata.c delete mode 100644 libs/ldns/resolver.c delete mode 100644 libs/ldns/rr.c delete mode 100644 libs/ldns/rr_functions.c delete mode 100644 libs/ldns/sha1.c delete mode 100644 libs/ldns/sha2.c delete mode 100644 libs/ldns/str2host.c delete mode 100644 libs/ldns/tsig.c delete mode 100644 libs/ldns/update.c delete mode 100644 libs/ldns/util.c delete mode 100644 libs/ldns/util.h delete mode 100644 libs/ldns/version delete mode 100644 libs/ldns/wire2host.c delete mode 100644 libs/ldns/zone.c diff --git a/libs/ldns/Changelog b/libs/ldns/Changelog deleted file mode 100644 index ffbcb3fe92..0000000000 --- a/libs/ldns/Changelog +++ /dev/null @@ -1,584 +0,0 @@ -1.6.9 2011-03-16 - * Fix creating NSEC(3) bitmaps: make array size 65536, - don't add doubles. - * Fix printout of escaped binary in TXT records. - * Parsing TXT records: don't skip starting whitespace that is quoted. - * bugfix #358: Check if memory was successfully allocated in - ldns_rdf2str(). - * Added more memory allocation checks in host2str.c - * python wrapper for ldns_fetch_valid_domain_keys by Bedrich Kosata. - * fix to compile python wrapper with swig 2.0.2. - * Don't fallback to SHA-1 when creating NSEC3 hash with another - algorithm identifier, fail instead (no other algorithm identifiers - are assigned yet). - -1.6.8 2011-01-24 - * Fix ldns zone, so that $TTL definition match RFC 2308. - * Fix lots of missing checks on allocation failures and parse of - NSEC with many types and max parse length in hosts_frm_fp routine - and off by one in read_anchor_file routine (thanks Dan Kaminsky and - Justin Ferguson). - * bugfix #335: Drill: Print both SHA-1 and SHA-256 corresponding DS - records. - * Print correct WHEN in query packet (is not always 1-1-1970) - * ldns-test-edns: new example tool that detects EDNS support. - * fix ldns_resolver_send without openssl. - * bugfix #342: patch for support for more CERT key types (RFC4398). - * bugfix #351: fix udp_send hang if UDP checksum error. - * fix set_bit (from NSEC3 sign) patch from Jan Komissar. - -1.6.7 2010-11-08 - * EXPERIMENTAL ecdsa implementation, please do not enable on real - servers. - * GOST code enabled by default (RFC 5933). - * bugfix #326: ignore whitespace between directives and their values. - * Header comment to advertise ldns_axfr_complete to check for - successfully completed zone transfers. - * read resolv.conf skips interface labels, e.g. %eth0. - * Fix drill verify NSEC3 denials. - * Use closesocket() on windows. - * Add ldns_get_signing_algorithm_by_name that understand aliases, - names changed to RFC names and aliases for compatibility added. - * bugfix: don't print final dot if the domain is relative. - * bugfix: resolver search continue when packet rcode != NOERROR. - * bugfix: resolver push all domains in search directive to list. - * bugfix: resolver search by default includes the root domain. - * bugfix: tcp read could fail on single octet recv. - * bugfix: read of RR in unknown syntax with missing fields. - * added ldns_pkt_tsig_sign_next() and ldns_pkt_tsig_verify_next() - to sign and verify TSIG RRs on subsequent messages - (section 4.4, RFC 2845, thanks to Michael Sheldon). - * bugfix: signer sigs nsecs with zsks only. - * bugfix #333: fix ldns_dname_absolute for name ending with backslash. - -1.6.6 2010-08-09 - * Fix ldns_rr_clone to copy question rrs properly. - * Fix ldns_sign_zone(_nsec3) to clone the soa for the new zone. - * Fix ldns_wire2dname size check from reading 1 byte beyond buffer end. - * Fix ldns_wire2dname from reading 1 byte beyond end for pointer. - * Fix crash using GOST for particular platform configurations. - * extern C declarations used in the header file. - * Removed debug fprintf from resolver.c. - * ldns-signzone checks if public key file is for the right zone. - * NETLDNS, .NET port of ldns functionality, by Alex Nicoll, in contrib. - * Fix handling of comments in resolv.conf parse. - * GOST code enabled if SSL recent, RFC 5933. - * bugfix #317: segfault util.c ldns_init_random() fixed. - * Fix ldns_tsig_mac_new: allocate enough memory for the hash, fix use of - b64_pton_calculate_size. - * Fix ldns_dname_cat: size calculation and handling of realloc(). - * Fix ldns_rr_pop_rdf: fix handling of realloc(). - * Fix ldns-signzone for single type key scheme: sign whole zone if there - are only KSKs. - * Fix ldns_resolver: also close socket if AXFR failed (if you don't, - it would block subsequent transfers (thanks Roland van Rijswijk). - * Fix drill: allow for a secure trace if you use DS records as trust - anchors (thanks Jan Komissar). - -1.6.5 2010-06-15 - * Catch \X where X is a digit as an error. - * Fix segfault when ip6 ldns resolver only has ip4 servers. - * Fix NSEC record after DNSKEY at zone apex not properly signed. - * Fix syntax error if last label too long and no dot at end of domain. - * Fix parse of \# syntax with space for type LOC. - * Fix ldns_dname_absolute for escape sequences, fixes some parse errs. - * bugfix #297: linking ssl, bug due to patch submitted as #296. - * bugfix #299: added missing declarations to host2str.h - * ldns-compare-zones -s to not exclude SOA record from comparison. - * --disable-rpath fix - * fix ldns_pkt_empty(), reported by Alex Nicoll. - * fix ldns_resolver_new_frm_fp not ignore lines after a comment. - * python code for ldns_rr.new_question_frm_str() - * Fix ldns_dnssec_verify_denial: the signature selection routine. - * Type TALINK parsed (draft-ietf-dnsop-trust-history). - * bugfix #304: fixed dead loop in ldns_tcp_read_wire() and - ldns_tcp_read_wire_timeout(). - * GOST support with correct algorithm numbers. The plan is to make it - enabled if openssl support is detected, but it is disabled by - default in this release because the RFC is not ready. - * Fixed comment in rbtree.h about being first member and data ptr. - * Fixed possibly leak in case of out of memory in ldns_native2rdf... - * ldns_dname_is_wildcard added. - * Fixed: signatures over wildcards had the wrong labelcount. - * Fixed ldns_verify() inconsistent return values. - * Fixed ldns_resolver to copy and free tsig name, data and algorithm. - * Fixed ldns_resolver to push search onto searchlist. - * A ldns resolver now defaults to a non-recursive resolver that handles - the TC bit. - * ldns_resolver_print() prints more details. - * Fixed ldns_rdf2buffer_str_time(), which did not print timestamps - on 64bit systems. - * Make ldns_resolver_nameservers_randomize() more random. - * bugfix #310: POSIX specifies NULL second argument of gettimeofday. - * fix compiler warnings from llvm clang compiler. - * bugfix #309: ldns_pkt_clone did not clone the tsig_rr. - * Fix gentoo ebuild for drill, 'no m4 directory'. - * bugfix #313: drill trace on an empty nonterminal continuation. - -1.6.4 2010-01-20 - * Imported pyldns contribution by Zdenek Vasicek and Karel Slany. - Changed its configure and Makefile to fit into ldns. - Added its dname_* methods to the rdf_* class (as is the ldns API). - Changed swig destroy of ldns_buffer class to ldns_buffer_free. - Declared ldns_pkt_all and ldns_pkt_all_noquestion so swig sees them. - * Bugfix: parse PTR target of .tomhendrikx.nl with error not crash. - * Bugfix: handle escaped characters in TXT rdata. - * bug292: no longer crash on malformed domain names where a label is - on position 255, which was a buffer overflow by one. - * Fix ldns_get_rr_list_hosts_frm_fp_l (strncpy to strlcpy change), - which fixes resolv.conf reading badly terminated string buffers. - * Fix ldns_pkt_set_random_id to be more random, and a little faster, - it did not do value 0 statistically correctly. - * Fix ldns_rdf2native_sockaddr_storage to set sockaddr type to zeroes, - for portability. - * bug295: nsec3-hash routine no longer case sensitive. - * bug298: drill failed nsec3 denial of existence proof. - -1.6.3 2009-12-04 - * Bugfix: allow for unknown resource records in zonefile with rdlen=0. - * Bugfix: also mark an RR as question if it comes from the wire - * Bugfix: NSEC3 bitmap contained NSEC - * Bugfix: Inherit class when creating signatures - -1.6.2 2009-11-12 - * Fix Makefile patch from Havard Eidnes, better install.sh usage. - * Fix parse error on SOA serial of 2910532839. - Fix print of ';' and readback of '\;' in names, also for '\\'. - Fix parse of '\(' and '\)' in names. Also for file read. Also '\.' - * Fix signature creation when TTLs are different for RRs in RRset. - * bug273: fix so EDNS rdata is included in pkt to wire conversion. - * bug274: fix use of c++ keyword 'class' for RR class in the code. - * bug275: fix memory leak of packet edns rdata. - * Fix timeout procedure for TCP and AXFR on Solaris. - * Fix occasional NSEC bitmap bogus - * Fix rr comparing (was in reversed order since 1.6.0) - * bug278: fix parsing HINFO rdata (and other cases). - * Fix previous owner name: also pick up if owner name is @. - * RFC5702: enabled sha2 functions by default. This requires OpenSSL 0.9.8 or higher. - Reason for this default is the root to be signed with RSASHA256. - * Fix various LDNS RR parsing issues: IPSECKEY, WKS, NSAP, very long lines - * Fix: Make ldns_dname_is_subdomain case insensitive. - * Fix ldns-verify-zone so that address records at zone NS set are not considered glue - (Or glue records fall below delegation) - * Fix LOC RR altitude printing. - * Feature: Added period (e.g. '3m6d') support at explicit TTLs. - * Feature: DNSKEY rrset by default signed with minimal signatures - but -A option for ldns-signzone to sign it with all keys. - This makes the DNSKEY responses smaller for signed domains. - -1.6.1 2009-09-14 - * --enable-gost : use the GOST algorithm (experimental). - * Added some missing options to drill manpage - * Some fixes to --without-ssl option - * Fixed quote parsing withing strings - * Bitmask fix in EDNS handling - * Fixed non-fqdn domain name completion for rdata field domain - names of length 1 - * Fixed chain validation with SHA256 DS records - -1.6.0 - Additions: - * Addition of an ldns-config script which gives cflags and libs - values, for use in configure scripts for applications that use - use ldns. Can be disabled with ./configure --disable-ldns-config - * Added direct sha1, sha256, and sha512 support in ldns. - With these functions, all NSEC3 functionality can still be - used, even if ldns is built without OpenSSL. Thanks to OpenBSD, - Steve Reid, and Aaron D. Gifford for the code. - * Added reading/writing support for the SPF Resource Record - * Base32 functions are now exported - Bugfixes: - * ldns_is_rrset did not go through the complete rrset, but - only compared the first two records. Thanks to Olafur - Gudmundsson for report and patch - * Fixed a small memory bug in ldns_rr_list_subtype_by_rdf(), - thanks to Marius Rieder for finding an patching this. - * --without-ssl should now work. Make sure that examples/ and - drill also get the --without-ssl flag on their configure, if - this is used. - * Some malloc() return value checks have been added - * NSEC3 creation has been improved wrt to empty nonterminals, - and opt-out. - * Fixed a bug in the parser when reading large NSEC3 salt - values. - * Made the allowed length for domain names on wire - and presentation format the same. - Example tools: - * ldns-key2ds can now also generate DS records for keys without - the SEP flag - * ldns-signzone now equalizes the TTL of the DNSKEY RRset (to - the first non-default DNSKEY TTL value it sees) - -1.5.1 - Example tools: - * ldns-signzone was broken in 1.5.0 for multiple keys, this - has been repaired - - Build system: - * Removed a small erroneous output warning in - examples/configure and drill/configure - -1.5.0 - Bug fixes: - * fixed a possible memory overflow in the RR parser - * build flag fix for Sun Studio - * fixed a building race condition in the copying of header - files - * EDNS0 extended rcode; the correct assembled code number - is now printed (still in the EDNS0 field, though) - * ldns_pkt_rr no longer leaks memory (in fact, it no longer - copies anything all) - - API addition: - * ldns_key now has support for 'external' data, in which - case the OpenSSL EVP structures are not used; - ldns_key_set_external_key() and ldns_key_external_key() - * added ldns_key_get_file_base_name() which creates a - 'default' filename base string for key storage, of the - form "K++" - * the ldns_dnssec_* family of structures now have deep_free() - functions, which also free the ldns_rr's contained in them - * there is now an ldns_match_wildcard() function, which checks - whether a domain name matches a wildcard name - * ldns_sign_public has been split up; this resulted in the - addition of ldns_create_empty_rrsig() and - ldns_sign_public_buffer() - - Examples: - * ldns-signzone can now automatically add DNSKEY records when - using an OpenSSL engine, as it already did when using key - files - * added new example tool: ldns-nsec3-hash - * ldns-dpa can now filter on specific query name and types - * ldnsd has fixes for the zone name, a fix for the return - value of recvfrom(), and an memory initialization fix - (Thanks to Colm MacCárthaigh for the patch) - * Fixed memory leaks in ldnsd - - - -1.4.1 - Bug fixes: - * fixed a build issue where ldns lib existence was done too early - * removed unnecessary check for pcap.h - * NSEC3 optout flag now correctly printed in string output - * inttypes.h moved to configured inclusion - * fixed NSEC3 type bitmaps for empty nonterminals and unsigned - delegations - - API addition: - * for that last fix, we added a new function - ldns_dname_add_from() that can clone parts of a dname - -1.4.0 - Bug fixes: - * sig chase return code fix (patch from Rafael Justo, bug id 189) - * rdata.c memory leaks on error and allocation checks fixed (patch - from Shane Kerr, bug id 188) - * zone.c memory leaks on error and allocation checks fixed (patch - from Shane Kerr, bug id 189) - * ldns-zplit output and error messages fixed (patch from Shane Kerr, - bug id 190) - * Fixed potential buffer overflow in ldns_str2rdf_dname - * Signing code no longer signs delegation NS rrsets - * Some minor configure/makefile updates - * Fixed a bug in the randomness initialization - * Fixed a bug in the reading of resolv.conf - * Fixed a bug concerning whitespace in zone data (with patch from Ondrej - Sury, bug 213) - * Fixed a small fallback problem in axfr client code - - API CHANGES: - * added 2str convenience functions: - - ldns_rr_type2str - - ldns_rr_class2str - - ldns_rr_type2buffer_str - - ldns_rr_class2buffer_str - * buffer2str() is now called ldns_buffer2str - * base32 and base64 function names are now also prepended with ldns_ - * ldns_rr_new_frm_str() now returns an error on missing RDATA fields. - Since you cannot read QUESTION section RRs with this anymore, - there is now a function called ldns_rr_new_question_frm_str() - - LIBRARY FEATURES: - * DS RRs string representation now add bubblebabble in a comment - (patch from Jakob Schlyter) - * DLV RR type added - * TCP fallback system has been improved - * HMAC-SHA256 TSIG support has been added. - * TTLS are now correcly set in NSEC(3) records when signing zones - - EXAMPLE TOOLS: - * New example: ldns-revoke to revoke DNSKEYs according to RFC5011 - * ldns-testpkts has been fixed and updated - * ldns-signzone now has the option to not add the DNSKEY - * ldns-signzone now has an (full zone only) opt-out option for - NSEC3 - * ldns-keygen can create HMAC-SHA1 and HMAC-SHA256 symmetric keys - * ldns-walk output has been fixed - * ldns-compare-zones has been fixed, and now has an option - to show all differences (-a) - * ldns-read-zone now has an option to print DNSSEC records only - -1.3 - Base library: - - * Added a new family of functions based around ldns_dnssec_zone, - which is a new structure that keeps a zone sorted through an - rbtree and links signatures and NSEC(3) records directly to their - RRset. These functions all start with ldns_dnssec_ - - * ldns_zone_sign and ldns_zone_sign_nsec3 are now deprecated, but - have been changed to internally use the new - ldns_dnssec_zone_sign(_nsec3) - - * Moved some ldns_buffer functions inline, so a clean rebuild of - applications relying on those is needed (otherwise you'll get - linker errors) - * ldns_dname_label now returns one extra (zero) - byte, so it can be seen as an fqdn. - * NSEC3 type code update for signing algorithms. - * DSA key generation of DNSKEY RRs fixed (one byte too small). - - * Added support for RSA/SHA256 and RSA/SHA512, as specified in - draft-ietf-dnsext-dnssec-rsasha256-04. The typecodes are not - final, and this feature is not enabled by default. It can be - enabled at compilation time with the flag --with-sha2 - - * Added 2wire_canonical family of functions that lowercase dnames - in rdata fields in resource records of the types in the list in - rfc3597 - - * Added base32 conversion functions. - - * Fixed DSA RRSIG conversion when calling OpenSSL - - Drill: - - * Chase output is completely different, it shows, in ascii, the - relations in the trust hierarchy. - - Examples: - * Added ldns-verify-zone, that can verify the internal DNSSEC records - of a signed BIND-style zone file - - * ldns-keygen now takes an -a argument specifying the algorithm, - instead of -R or -D. -a list show a list of supported algorithms - - * ldns-keygen now defaults to the exponent RSA_F4 instead of RSA_3 - for RSA key generation - - * ldns-signzone now has support for HSMs - * ldns-signzone uses the new ldns_dnssec_ structures and functions - which improves its speed, and output; RRSIGS are now placed - directly after their RRset, NSEC(3) records directly after the - name they handle - - Contrib: - * new contrib/ dir with user contributions - * added compilation script for solaris (thanks to Jakob Schlyter) - -28 Nov 2007 1.2.2: - * Added support for HMAC-MD5 keys in generator - * Added a new example tool (written by Ondrej Sury): ldns-compare-zones - * ldns-keygen now checks key sizes for rfc conformancy - * ldns-signzone outputs SSL error if present - * Fixed manpages (thanks to Ondrej Sury) - * Fixed Makefile for -j - * Fixed a $ORIGIN error when reading zones - * Fixed another off-by-one error - -03 Oct 2007 1.2.1: - * Fixed an offset error in rr comparison - * Fixed ldns-read-zone exit code - * Added check for availability of SHA256 hashing algorithm - * Fixed ldns-key2ds -2 argument - * Fixed $ORIGIN bug in .key files - * Output algorithms as an integer instead of their mnemonic - * Fixed a memory leak in dnssec code when SHA256 is not available - * Updated fedora .spec file - -11 Apr 2007 1.2.0: - * canonicalization of rdata in DNSSEC functions now adheres to the - rr type list in rfc3597, not rfc4035, which will be updated - (see http://www.ops.ietf.org/lists/namedroppers/namedroppers.2007/msg00183.html) - * ldns-walk now support dnames with maximum label length - * ldnsd now takes an extra argument containing the address to listen on - * signing no longer signs every rrset with KSK's, but only the DNSKEY rrset - * ported to Solaris 10 - * added ldns_send_buffer() function - * added ldns-testpkts fake packet server - * added ldns-notify to send NOTIFY packets - * ldns-dpa can now accurately calculate the number of matches per - second - * libtool is now used for compilation too (still gcc, but not directly) - * Bugfixes: - - TSIG signing buffer size - - resolv.conf reading (comments) - - dname comparison off by one error - - typo in keyfetchers output file name fixed (a . too much) - - fixed zone file parser when comments contain ( or ) - - fixed LOC RR type - - fixed CERT RR type - - Drill: - * drill prints error on failed axfr. - * drill now accepts mangled packets with -f - * old -c option (use tcp) changed to -t - * -c option to specify alternative resolv.conf file added - * feedback of signature chase improved - * chaser now stops at root when no trusted keys are found - instead of looping forever trying to find the DS for . - * Fixed bugs: - - wildcard on multiple labels signature verification - - error in -f packet writing for malformed packets - - made KSK check more resilient - -7 Jul 2006: 1.1.0: ldns-team - * Added tutorials and an introduction to the documentation - * Added include/ and lib/ dirs so that you can compile against ldns - without installing ldns on your system - * Makefile updates - * Starting usage of assert throughout the library to catch illegal calls - * Solaris 9 testing was carried out. Ldns now compiles on that - platform; some gnuism were identified and fixed. - * The ldns_zone structure was stress tested. The current setup - (ie. just a list of rrs) can scale to zone file in order of - megabytes. Sorting such zone is still difficult. - * Reading multiline b64 encoded rdata works. - * OpenSSL was made optional, configure --without-ssl. - Ofcourse all dnssec/tsig related functions are disabled - * Building of examples and drill now happens with the same - defines as the building of ldns itself. - * Preliminary sha-256 support was added. Currently is your - OpenSSL supports it, it is supported in the DS creation. - * ldns_resolver_search was implemented - * Fixed a lot of bugs - - Drill: - * -r was killed in favor of -o
which - allows for a header bits setting (and maybe more in the - future) - * DNSSEC is never automaticaly set, even when you query - for DNSKEY/RRSIG or DS. - * Implement a crude RTT check, it now distinguishes between - reachable and unreachable. - * A form of secure tracing was added - * Secure Chasing has been improved - * -x does a reverse lookup for the given IP address - - Examples: - * ldns-dpa was added to the examples - this is the Dns Packet - Analyzer tool. - * ldnsd - as very, very simple nameserver impl. - * ldns-zsplit - split zones for parrallel signing - * ldns-zcat - cat split zones back together - * ldns-keyfetcher - Fetches DNSKEY records with a few (non-strong, - non-DNSSEC) anti-spoofing techniques. - * ldns-walk - 'Walks' a DNSSEC signed zone - * Added an all-static target to the makefile so you can use examples - without installing the library - * When building in the source tree or in a direct subdirectory of - the build dir, configure does not need --with-ldns=../ anymore - - Code: - * All networking code was moved to net.c - * rdata.c: added asserts to the rdf set/get functions - * const keyword was added to pointer arguments that - aren't changed - - API: - Changed: - * renamed ldns/dns.h to ldns/ldns.h - * ldns_rr_new_frm_str() is extented with an extra variable which - in common use may be NULL. This trickles through to: - o ldns_rr_new_frm_fp - o ldns_rr_new_frm_fp_l - Which also get an extra variable - Also the function has been changed to return a status message. - The compiled RR is returned in the first argument. - * ldns_zone_new_frm_fp_l() and ldns_zone_new_frm_fp() are - changed to return a status msg. - * ldns_key_new_frm_fp is changed to return ldns_status and - the actual key list in the first argument - * ldns_rdata_new_frm_fp[_l]() are changed to return a status. - the rdf is return in the first argument - * ldns_resolver_new_frm_fp: same treatment: return status and - the new resolver in the first argument - * ldns_pkt_query_new_frm_str(): same: return status and the - packet in the first arg - * tsig.h: internal used functions are now static: - ldns_digest_name and ldns_tsig_mac_new - * ldns_key_rr2ds has an extra argument to specify the hash to - use. - * ldns_pkt_rcode() is renamed to ldns_pkt_get_rcode, ldns_pkt_rcode - is now the rcode type, like ldns_pkt_opcode - New: - * ldns_resolver_searchlist_count: return the searchlist counter - * ldns_zone_sort: Sort a zone - * ldns_bgsend(): background send, returns a socket. - * ldns_pkt_empty(): check is a packet is empty - * ldns_rr_list_pop_rr_list(): pop multiple rr's from another rr_list - * ldns_rr_list_push_rr_list(): push multiple rr's to an rr_list - * ldns_rr_list_compare(): compare 2 ldns_rr_lists - * ldns_pkt_push_rr_list: rr_list equiv for rr - * ldns_pkt_safe_push_rr_list: rr_list equiv for rr - Removed: - * ldns_resolver_bgsend(): was not used in 1.0.0 and is not used now - * ldns_udp_server_connect(): was faulty and isn't really part of - the core ldns idea any how. - * ldns_rr_list_insert_rr(): obsoleted, because not used. - * char *_when was removed from the ldns_pkt structure - -18 Oct 2005: 1.0.0: ldns-team - * Commited a patch from HÃ¥kan Olsson - * Added UPDATE support (Jakob Schlyter and HÃ¥kan Olsson) - * License change: ldns is now BSD licensed - * ldns now depends on SSL - * Networking code cleanup, added (some) server udp/tcp support - * A zone type is introduced. Currently this is a list - of RRs, so it will not scale well. - * [beta] Zonefile parsing was added - * [tools] Drill was added to ldns - see drill/ - * [tools] experimental signer was added - * [building] better check for ssl - * [building] major revision of build system - * [building] added rpm .spec in packaging/ (thanks to Paul Wouters) - * [building] A lot of cleanup in the build scripts (thanks to Jakob Schlyter - and Paul Wouters) - -28 Jul 2005: 0.70: ldns-team - * [func] ldns_pkt_get_section now returns copies from the rrlists - in the packet. This can be freed by the user program - * [code] added ldns_ prefixes to function from util.h - * [inst] removed documentation from default make install - * Usual fixes in documentation and code - -20 Jun 2005: 0.66: ldns-team - Rel. Focus: drill-pre2 uses some functions which are - not in 0.65 - * dnssec_cd bit function was added - * Zone infrastructure was added - * Usual fixes in documentation and code - -13 Jun 2005: 0.65: ldns-team - * Repository is online at: - http://www.nlnetlabs.nl/ldns/svn/ - * Apply reference copying throuhgout ldns, except in 2 - places in the ldns_resolver structure (._domain and - ._nameservers) - * Usual array of bugfixes - * Documentation added - * keygen.c added as an example for DNSSEC programming - -23 May 2005: 0.60: ldns-team - * Removed config.h from the header installed files - (you're not supposed to include that in a libary) - * Further tweaking - - DNSSEC signing/verification works - - Assorted bug fixes and tweaks (memory management) - -May 2005: 0.50: ldns-team - * First usable release - * Basic DNS functionality works - * DNSSEC validation works diff --git a/libs/ldns/LICENSE b/libs/ldns/LICENSE deleted file mode 100644 index 6d4c6be096..0000000000 --- a/libs/ldns/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2005,2006, NLnetLabs -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of NLnetLabs nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/ldns/Makefile.in b/libs/ldns/Makefile.in deleted file mode 100644 index 6e0ce40641..0000000000 --- a/libs/ldns/Makefile.in +++ /dev/null @@ -1,368 +0,0 @@ -# Standard installation pathnames -# See the file LICENSE for the license -SHELL = @SHELL@ -VERSION = @PACKAGE_VERSION@ -version_info = @LIBTOOL_VERSION_INFO@ -srcdir = @srcdir@ -basesrcdir = $(shell basename `pwd`) -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -mandir = @mandir@ -datarootdir = @datarootdir@ -datadir = @datadir@ -libdir = @libdir@ -includedir = @includedir@ -doxygen = @doxygen@ -pywrapdir = ${srcdir}/contrib/python -swig = @swig@ -python_site =@PYTHON_SITE_PKG@ -pyldns_inst =@PYLDNS@ -pyldns_uninst =@PYLDNS@ -ifeq "$(pyldns_inst)" "pyldns" - pyldns_inst=install-@PYLDNS@ - pyldns_uninst=uninstall-@PYLDNS@ -else - pyldns_inst= - pyldns_uninst= -endif -glibtool = @libtool@ -libtool = ./libtool -ifdef glibtool -libtool = $(glibtool) -endif - -CC = @CC@ -ifeq "$(srcdir)" "." - CPPFLAGS = $(strip -I. @CPPFLAGS@ @DEFS@) -else - CPPFLAGS = $(strip -I. -I$(srcdir) @CPPFLAGS@ @DEFS@) -endif -CFLAGS = $(strip @CFLAGS@) -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -LIBOBJS = @LIBOBJS@ -PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ -PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ -LIBSSL_CPPFLAGS = @LIBSSL_CPPFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ -LIBSSL_LIBS = @LIBSSL_LIBS@ -RUNTIME_PATH = @RUNTIME_PATH@ -DATE = $(shell date +%Y%m%d) -LIBTOOL = $(libtool) --tag=CC --quiet -INSTALL_LDNS_CONFIG = @INSTALL_LDNS_CONFIG@ - -LINT = splint -LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -#-Dglob64=glob -Dglobfree64=globfree -# compat with openssl linux edition. -LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -D"EC_KEY=unsigned" -D"EC_POINT=unsigned" -D"EC_GROUP=unsigned" -# compat with NetBSD -ifeq "$(shell uname)" "NetBSD" -LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ -endif -# compat with OpenBSD -LINTFLAGS+="-Dsigset_t=long" -# FreeBSD8 -LINTFLAGS+="-D__uint16_t=uint16_t" - -INSTALL = $(srcdir)/install-sh - -LIBDNS_SOURCES = rdata.c util.c rr.c packet.c wire2host.c \ - host2str.c buffer.c str2host.c tsig.c resolver.c \ - net.c host2wire.c dname.c dnssec.c dnssec_verify.c \ - keys.c higher.c rr_functions.c parse.c update.c \ - error.c zone.c dnssec_zone.c dnssec_sign.c rbtree.c \ - sha1.c sha2.c -LIBDNS_HEADERS = $(srcdir)/ldns/error.h \ - $(srcdir)/ldns/packet.h \ - $(srcdir)/ldns/common.h \ - $(srcdir)/ldns/rdata.h \ - $(srcdir)/ldns/rr.h \ - $(srcdir)/ldns/wire2host.h \ - $(srcdir)/ldns/host2str.h \ - $(srcdir)/ldns/host2wire.h \ - $(srcdir)/ldns/str2host.h \ - $(srcdir)/ldns/buffer.h \ - $(srcdir)/ldns/resolver.h \ - $(srcdir)/ldns/dname.h \ - $(srcdir)/ldns/dnssec.h \ - $(srcdir)/ldns/dnssec_verify.h \ - $(srcdir)/ldns/dnssec_sign.h \ - $(srcdir)/ldns/keys.h \ - $(srcdir)/ldns/higher.h \ - $(srcdir)/ldns/parse.h \ - $(srcdir)/ldns/rr_functions.h \ - $(srcdir)/ldns/ldns.h \ - $(srcdir)/ldns/zone.h \ - $(srcdir)/ldns/dnssec_zone.h \ - $(srcdir)/ldns/update.h \ - $(srcdir)/ldns/tsig.h \ - $(srcdir)/ldns/rbtree.h \ - $(srcdir)/ldns/sha1.h \ - $(srcdir)/ldns/sha2.h -LIBDNS_OBJECTS = $(LIBDNS_SOURCES:.c=.o) $(LIBOBJS) -LIBDNS_LOBJECTS = $(LIBDNS_SOURCES:.c=.lo) $(LIBOBJS:.o=.lo) - -ALL_SOURCES = $(LIBDNS_SOURCES) - -COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) -COMP_LIB = $(LIBTOOL) --mode=compile $(CC) $(CPPFLAGS) $(CFLAGS) -LINK = $(CC) $(strip $(CFLAGS) $(LDFLAGS) $(LIBS)) -LINK_LIB = $(LIBTOOL) --mode=link $(CC) $(strip $(CFLAGS) $(LDFLAGS) $(LIBS) -version-number $(version_info) -no-undefined) - -%.o: $(srcdir)/%.c $(LIBDNS_HEADERS) ldns/net.h ldns/util.h ldns/config.h - $(COMP_LIB) $(LIBSSL_CPPFLAGS) -c $< - -.PHONY: clean realclean docclean manpages doc lint all lib pyldns test -.PHONY: install uninstall install-doc uninstall-doc uninstall-pyldns -.PHONY: install-h uninstall-h install-lib uninstall-lib install-pyldns - -all: copy-headers lib linktest manpages @PYLDNS@ - -linktest: $(srcdir)/linktest.c $(LIBDNS_HEADERS) ldns/net.h ldns/util.h ldns/config.h libldns.la - $(LIBTOOL) --mode=link $(CC) $(srcdir)/linktest.c $(CPPFLAGS) $(LIBSSL_CPPFLAGS) $(CFLAGS) -lldns $(LIBS) -o linktest - -lib: libldns.la - if [ ! -d lib ] ; then ln -s .libs lib ; fi ; - -lib-export-all: libldns.la-export-all - if [ ! -d lib ] ; then ln -s .libs lib ; fi ; - -libldns.la: $(LIBDNS_OBJECTS) - $(LINK_LIB) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) --export-symbols $(srcdir)/ldns_symbols.def -o libldns.la $(LIBDNS_LOBJECTS) -rpath $(libdir) $(RUNTIME_PATH) - -libldns.la-export-all: $(LIBDNS_OBJECTS) - $(LINK_LIB) -o libldns.la $(LIBDNS_LOBJECTS) -rpath $(libdir) $(RUNTIME_PATH) - -$(addprefix include/ldns/, $(notdir $(LIBDNS_HEADERS))): include/ldns/%.h: $(srcdir)/ldns/%.h - @if [ ! -d include ] ; then ($(INSTALL) -d include || echo "include exists") ; fi ; - @if [ ! -d include/ldns ] ; then (cd include; ln -s ../ldns ./ldns || echo "include/ldns exists") ; fi ; - $(INSTALL) -c -m 644 $< ./include/ldns/ - -include/ldns/util.h include/ldns/net.h include/ldns/config.h: include/ldns/%.h: ./ldns/%.h - @if [ ! -d include ] ; then ($(INSTALL) -d include || echo "include exists") ; fi ; - @if [ ! -d include/ldns ] ; then (cd include; ln -s ../ldns ./ldns || echo "include/ldns exists") ; fi ; - $(INSTALL) -c -m 644 $< ./include/ldns/ - -copy-headers: $(addprefix include/ldns/, $(notdir $(LIBDNS_HEADERS))) include/ldns/util.h include/ldns/net.h include/ldns/config.h - -mancheck: - sh -c 'find . -name \*.\[13\] -exec troff -z {} \;' 2>&1 | sed "s/^\.\///" | sed "s/\(:[0\-9]\+:\)/\1 warning:/g" - -doxygen: manpages - $(INSTALL) -d doc -ifdef doxygen -# if we are not in base we need to copy some html files too - if [ ! -e doc/header.html ] ; then \ - $(INSTALL) -c -m 644 $(srcdir)/doc/header.html doc/ ; \ - fi ; - $(doxygen) $(srcdir)/libdns.doxygen -endif - -manpages: $(srcdir)/doc/function_manpages - $(INSTALL) -d doc - cat $(srcdir)/ldns/*.h | $(srcdir)/doc/doxyparse.pl -m $(srcdir)/doc/function_manpages 2>&1 | \ - grep -v ^doxygen | grep -v ^cat > doc/ldns_manpages - -pyldns: _ldns.la - -$(pywrapdir)/ldns_wrapper.c: $(pywrapdir)/ldns.i $(wildcard $(pywrapdir)/*.i) $(LIBDNS_HEADERS) ldns/util.h ldns/config.h - $(swig) -python -o $@ $(CPPFLAGS) $(PYTHON_CPPFLAGS) $< - -ldns_wrapper.lo: $(pywrapdir)/ldns_wrapper.c $(LIBDNS_HEADERS) ldns/util.h ldns/config.h - $(COMP_LIB) -I./include/ldns $(PYTHON_CPPFLAGS) -c $< -o $@ - -_ldns.la: ldns_wrapper.lo libldns.la - $(LIBTOOL) --tag=CC --mode=link $(CC) $(strip $(CFLAGS) $(PYTHON_CFLAGS) $(LDFLAGS) $(PYTHON_LDFLAGS) -module -version-number $(version_info) -no-undefined -o $@ $< -rpath $(python_site) -L. -L.libs -lldns $(LIBS)) - -install: install-h install-lib install-config install-manpages $(pyldns_inst) - -uninstall: uninstall-manpages uninstall-h uninstall-lib $(pyldns_uninst) - -destclean: uninstall - -install-config: - if [ $(INSTALL_LDNS_CONFIG) = "yes" ] ; then \ - $(INSTALL) -d $(DESTDIR)$(bindir); \ - $(INSTALL) -c -m 755 packaging/ldns-config $(DESTDIR)$(bindir)/; \ - fi - -install-manpages: manpages - ${INSTALL} -d $(DESTDIR)$(mandir)/man3 - for f in doc/man/man3/*; do \ - ${INSTALL} -c -m 444 $$f $(DESTDIR)$(mandir)/man3/; \ - done - -uninstall-manpages: - for i in `cat doc/ldns_manpages`; do \ - rm -f $(DESTDIR)$(mandir)/man3/$$i.3 ; done - rmdir -p $(DESTDIR)$(mandir)/man3 || echo "ok, dir already gone" - -install-h: lib - $(INSTALL) -m 755 -d $(DESTDIR)$(includedir)/ldns - for i in $(LIBDNS_HEADERS); do \ - $(INSTALL) -c -m 644 $$i $(DESTDIR)$(includedir)/ldns/; done - $(INSTALL) -c -m 644 include/ldns/util.h $(DESTDIR)$(includedir)/ldns/ - $(INSTALL) -c -m 644 include/ldns/net.h $(DESTDIR)$(includedir)/ldns/ - -uninstall-h: - for i in $(LIBDNS_HEADERS); do \ - rm -f $(DESTDIR)$(includedir)/$$i; done - [ ! -d $(DESTDIR)$(includedir)/ldns ] || rmdir -p $(DESTDI)$(includedir)/ldns || echo "ok, dir already gone" - exit 0 - -install-lib: lib - $(INSTALL) -m 755 -d $(DESTDIR)$(libdir) - $(LIBTOOL) --mode=install cp libldns.la $(DESTDIR)$(libdir) - $(LIBTOOL) --mode=finish $(DESTDIR)$(libdir) - -uninstall-lib: - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/libldns.la - rmdir -p $(DESTDIR)$(libdir) || echo "ok, dir already gone" - -install-pyldns: @PYLDNS@ - $(INSTALL) -m 755 -d $(DESTDIR)$(python_site)/ldns - $(INSTALL) -c -m 644 $(pywrapdir)/ldns.py $(DESTDIR)$(python_site)/ldns.py - $(LIBTOOL) --mode=install cp _ldns.la $(DESTDIR)$(python_site) - $(LIBTOOL) --mode=finish $(DESTDIR)$(python_site) - -uninstall-pyldns: - rm -f $(DESTDIR)$(python_site)/ldns/* - rmdir -p $(DESTDIR)$(python_site)/ldns - -clean: - rm -f *.o *.d *.lo - rm -f *~ - rm -rf autom4te.cache/ - rm -f tags - rm -f *.key - rm -f *.ds - rm -f *.private - rm -rf include/ - rm -rf lib - rm -rf .libs - rm -f linktest - rm -f $(pywrapdir)/ldns_wrapper.c $(pywrapdir)/ldns.py - -distclean: clean docclean libclean - rm -f ltmain.sh - -realclean: clean docclean libclean - rm -f config.status - rm -f config.log - rm -f Makefile - rm -f ldns/config.h.in - rm -f ldns/config.h - rm -f ldns/util.h - rm -f config.h.in - rm -f configure - rm -f config.sub - rm -f config.guess - rm -f ltmain.sh - -docclean: - rm -rf doc/html/ - rm -rf doc/man/ - rm -rf doc/latex/ - rm -f doc/*.txt - rm -f doc/*.tex - rm -f doc/ldns_manpages - -libclean: - $(LIBTOOL) --mode clean rm -f libldns.la - $(LIBTOOL) --mode clean rm -f libldns.a - $(LIBTOOL) --mode clean rm -f libldns.so - $(LIBTOOL) --mode clean rm -f libldns.so.* - $(LIBTOOL) --mode clean rm -f _ldns.la - rm -rf ldns/net.h ldns/util.h ldns/config.h - rm -rf *.lo - rm -rf .libs - rm -rf libtool - -## No need for changes here - -lint: - for i in $(LIBDNS_SOURCES); do \ - $(LINT) $(LINTFLAGS) -I. -I$(srcdir) $(srcdir)/$$i ; \ - if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ - done - -tags: $(srcdir)/*.c ldns/*.[ch] - ctags -f $(srcdir)/tags $(srcdir)/*.[ch] ldns/*.[ch] - -b64_pton$U.o: $(srcdir)/compat/b64_pton.c - $(COMP_LIB) -c $(srcdir)/compat/b64_pton.c -o $@ - -b64_ntop$U.o: $(srcdir)/compat/b64_ntop.c - $(COMP_LIB) -c $(srcdir)/compat/b64_ntop.c -o $@ - -b32_pton$U.o: $(srcdir)/compat/b32_pton.c - $(COMP_LIB) -c $(srcdir)/compat/b32_pton.c -o $@ - -b32_ntop$U.o: $(srcdir)/compat/b32_ntop.c - $(COMP_LIB) -c $(srcdir)/compat/b32_ntop.c -o $@ - -malloc$U.o: $(srcdir)/compat/malloc.c - $(COMP_LIB) -c $(srcdir)/compat/malloc.c -o $@ - -realloc$U.o: $(srcdir)/compat/realloc.c - $(COMP_LIB) -c $(srcdir)/compat/realloc.c -o $@ - -timegm$U.o: $(srcdir)/compat/timegm.c - $(COMP_LIB) -c $(srcdir)/compat/timegm.c -o $@ - -isblank$U.o: $(srcdir)/compat/isblank.c - $(COMP_LIB) -c $(srcdir)/compat/isblank.c -o $@ - -isasciik$U.o: $(srcdir)/compat/isascii.c - $(COMP_LIB) -c $(srcdir)/compat/isascii.c -o $@ - -strlcpy$U.o: $(srcdir)/compat/strlcpy.c - $(COMP_LIB) -c $(srcdir)/compat/strlcpy.c -o $@ - -memmove$U.o: $(srcdir)/compat/memmove.c - $(COMP_LIB) -c $(srcdir)/compat/memmove.c -o $@ - -inet_pton$U.o: $(srcdir)/compat/inet_pton.c - $(COMP_LIB) -c $(srcdir)/compat/inet_pton.c -o $@ - -inet_aton$U.o: $(srcdir)/compat/inet_aton.c - $(COMP_LIB) -c $(srcdir)/compat/inet_aton.c -o $@ - -inet_ntop$U.o: $(srcdir)/compat/inet_ntop.c - $(COMP_LIB) -c $(srcdir)/compat/inet_ntop.c -o $@ - -snprintf$U.o: $(srcdir)/compat/snprintf.c - $(COMP_LIB) -c $(srcdir)/compat/snprintf.c -o $@ - -fake-rfc2553$U.o: $(srcdir)/compat/fake-rfc2553.c - $(COMP_LIB) -c $(srcdir)/compat/fake-rfc2553.c -o $@ - -gmtime_r$U.o: $(srcdir)/compat/gmtime_r.c - $(COMP_LIB) -c $(srcdir)/compat/gmtime_r.c -o $@ - -ctime_r$U.o: $(srcdir)/compat/ctime_r.c - $(COMP_LIB) -c $(srcdir)/compat/ctime_r.c -o $@ - -# Automatic dependencies. -%.d: $(srcdir)/%.c - $(SHELL) -ec '$(CC) -MM $(CPPFLAGS) $< \ - | sed '\''s!\(.*\)\.o[ :]*!$(dir $@)\1.o $@ : !g'\'' > $@; \ - [ -s $@ ] || rm -f $@' - -allclean: test-clean clean - -test-clean: - tpkg -b test clean - -test: - if test -x "`which bash`"; then bash test/test_all.sh; else sh test/test_all.sh; fi - -#-include $(ALL_SOURCES:.c=.d) - -# Recreate symbols file, only needed when API changes -# make clean first (and after this make clean; make again) -symbols: lib-export-all - nm -g lib/libldns.so | cut -d " " -f 3 | grep ldns | sort > $(srcdir)/ldns_symbols.def - diff --git a/libs/ldns/README b/libs/ldns/README deleted file mode 100644 index 74e470a03d..0000000000 --- a/libs/ldns/README +++ /dev/null @@ -1,129 +0,0 @@ - -Contents: - REQUIREMENTS - INSTALLATION - libdns - examples - drill - INFORMATION FOR SPECIFIC OPERATING SYSTEMS - Mac OS X - Solaris - Your Support - -Project page: -http://www.nlnetlabs.nl/ldns/ -On that page you can also subscribe to the ldns mailing list. - -* Development -ldns is mainly developed on Linux and FreeBSD. It is regularly tested to -compile on other systems like Solaris and Mac OS X. - -REQUIREMENTS -- OpenSSL (Optional, but needed for features like DNSSEC) -- libpcap (Optional, but needed for examples/ldns-dpa) -- (GNU) libtool (in OSX, that's glibtool, not libtool) -- GNU make - -INSTALLATION -1. Unpack the tarball -2. cd ldns- -3. ./configure -4. gmake (it needs gnu make to compile, on systems where GNU make is the - default you can just use 'make') -5. sudo gmake install -6. Optional. (cd examples; ./configure; gmake), make example programs included. -7. Optional. (cd drill; ./configure; gmake; gmake install), to build drill. - -You can configure and compile it in a separate build directory. - -* Examples -There are some examples and dns related tools in the examples/ directory. -These can be built with: -1. cd examples/ -2. ./configure [--with-ldns=] -3. gmake - -* Drill -Drill can be built with: -1. cd drill/ -2. ./configure [--with-ldns=] -3. gmake - -Note that you need to set LD_LIBRARY_PATH if you want to run the binaries -and you have not installed the library to a system directory. You can use -the make target all-static for the examples to run them if you don't want to -install the library. - - -* Building from subversion repository - -If you are building from the repository you will need to have (gnu) -autotools like libtool and autoreconf installed. A list of all the commands -needed to build everything can be found in README.svn. Note that the actual -commands may be a little bit different on your machine. Most notable, you'll need to run libtoolize (or glibtoolize), if you skip this step, you'll get an error about missing config.sub. - -* Developers -ldns is developed by the ldns team at NLnet Labs. This team currently -consists of: - o Wouter Wijngaards - o Matthijs Mekking - -Former main developers: - o Jelte Jansen - o Miek Gieben - -* Credits -We have received patches from the following people, thanks! - o Erik Rozendaal - o HÃ¥kan Olsson - o Jakob Schlyter - o Paul Wouters - o Simon Vallet - o OndÅ™ej Surý - - -IFORMATION FOR SPECIFIC OPERATING SYSTEMS - -MAC OS X - -For MACOSX 10.4 and later, it seems that you have to set the -MACOSX_DEPLOYMENT_TARGET environment variable to 10.4 before running -make. Apparently it defaults to 10.1. - -This appears to be a known problem in 10.2 to 10.4, see: -http://developer.apple.com/qa/qa2001/qa1233.html -for more information. - - -SOLARIS - -In Solaris multi-architecture systems (that have both 32-bit and -64-bit support), it can be a bit taxing to convince the system to -compile in 64-bit mode. Jakob Schlyter has kindly contributed a build -script that sets the right build and link options. You can find it in -contrib/build-solaris.sh - - -Your Support -NLnet Labs offers all of its software products as open source, most are -published under a BDS license. You can download them, not only from the -NLnet Labs website but also through the various OS distributions for -which NSD, ldns, and Unbound are packaged. We therefore have little idea -who uses our software in production environments and have no direct ties -with 'our customers'. - -Therefore, we ask you to contact us at users@NLnetLabs.nl and tell us -whether you use one of our products in your production environment, -what that environment looks like, and maybe even share some praise. -We would like to refer to the fact that your organization is using our -products. We will only do that if you explicitly allow us. In all other -cases we will keep the information you share with us to ourselves. - -In addition to the moral support you can also support us -financially. NLnet Labs is a recognized not-for-profit charity foundation -that is chartered to develop open-source software and open-standards -for the Internet. If you use our software to satisfaction please express -that by giving us a donation. For small donations PayPal can be used. For -larger and regular donations please contact us at users@NLnetLabs.nl. Also -see http://www.nlnetlabs.nl/labs/contributors/. - diff --git a/libs/ldns/README.snapshots b/libs/ldns/README.snapshots deleted file mode 100644 index 891fcca1d6..0000000000 --- a/libs/ldns/README.snapshots +++ /dev/null @@ -1,8 +0,0 @@ -ldns - snapshot releases - -Snapshot releases are not official released. They can be released to -interested parties for development. - -Snapshots can be recognized from the date in the the tar file name. - -They should not be used for packaging in distributions. diff --git a/libs/ldns/README.svn b/libs/ldns/README.svn deleted file mode 100644 index 10f7cb4163..0000000000 --- a/libs/ldns/README.svn +++ /dev/null @@ -1,26 +0,0 @@ - -# The ldns subversion repository can found at: -# www.nlnetlabs.nl/ldns/svn/ - -# small list of commands to build all on a linux system -# libtoolize is needed for most other targets - -# on Solaris, and other systems that may not have -# the default 'automake' and 'aclocal' script aliases, -# the correct versions may need to be set. On those -# systems, the 'autoreconf' line should be changed to: -# AUTOMAKE=automake-1.10 ACLOCAL=aclocal-1.10 autoreconf -# (and these systems probably need gmake instead of make) - -# older versions of libtoolize do not support --install -# so you might need to remove that (with newer versions -# it is needed) -libtoolize -c --install -autoreconf --install -./configure -make -make doc # needs doxygen for the html pages -(cd examples && autoreconf && ./configure && make) -(cd drill && autoreconf && ./configure && make) -(cd pcat && autoreconf && ./configure && make) -(cd examples/nsd-test && autoreconf && ./configure && make) diff --git a/libs/ldns/ac_pkg_swig.m4 b/libs/ldns/ac_pkg_swig.m4 deleted file mode 100644 index 738f69d45e..0000000000 --- a/libs/ldns/ac_pkg_swig.m4 +++ /dev/null @@ -1,122 +0,0 @@ -# =========================================================================== -# http://autoconf-archive.cryp.to/ac_pkg_swig.html -# =========================================================================== -# -# SYNOPSIS -# -# AC_PROG_SWIG([major.minor.micro]) -# -# DESCRIPTION -# -# This macro searches for a SWIG installation on your system. If found you -# should call SWIG via $(SWIG). You can use the optional first argument to -# check if the version of the available SWIG is greater than or equal to -# the value of the argument. It should have the format: N[.N[.N]] (N is a -# number between 0 and 999. Only the first N is mandatory.) -# -# If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that -# the swig package is this version number or higher. -# -# In configure.in, use as: -# -# AC_PROG_SWIG(1.3.17) -# SWIG_ENABLE_CXX -# SWIG_MULTI_MODULE_SUPPORT -# SWIG_PYTHON -# -# LAST MODIFICATION -# -# 2008-04-12 -# -# COPYLEFT -# -# Copyright (c) 2008 Sebastian Huber -# Copyright (c) 2008 Alan W. Irwin -# Copyright (c) 2008 Rafael Laboissiere -# Copyright (c) 2008 Andrew Collier -# -# 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, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Macro Archive. When you make and -# distribute a modified version of the Autoconf Macro, you may extend this -# special exception to the GPL to apply to your modified version as well. - -AC_DEFUN([AC_PROG_SWIG],[ - AC_PATH_PROG([SWIG],[swig]) - if test -z "$SWIG" ; then - AC_MSG_WARN([cannot find 'swig' program. You should look at http://www.swig.org]) - SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' - elif test -n "$1" ; then - AC_MSG_CHECKING([for SWIG version]) - [swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'`] - AC_MSG_RESULT([$swig_version]) - if test -n "$swig_version" ; then - # Calculate the required version number components - [required=$1] - [required_major=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_major" ; then - [required_major=0] - fi - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] - [required_minor=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_minor" ; then - [required_minor=0] - fi - [required=`echo $required | sed 's/[0-9]*[^0-9]//'`] - [required_patch=`echo $required | sed 's/[^0-9].*//'`] - if test -z "$required_patch" ; then - [required_patch=0] - fi - # Calculate the available version number components - [available=$swig_version] - [available_major=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_major" ; then - [available_major=0] - fi - [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] - [available_minor=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_minor" ; then - [available_minor=0] - fi - [available=`echo $available | sed 's/[0-9]*[^0-9]//'`] - [available_patch=`echo $available | sed 's/[^0-9].*//'`] - if test -z "$available_patch" ; then - [available_patch=0] - fi - if test $available_major -ne $required_major \ - -o $available_minor -ne $required_minor \ - -o $available_patch -lt $required_patch ; then - AC_MSG_WARN([SWIG version >= $1 is required. You have $swig_version. You should look at http://www.swig.org]) - SWIG='echo "Error: SWIG version >= $1 is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' - else - AC_MSG_NOTICE([SWIG executable is '$SWIG']) - SWIG_LIB=`$SWIG -swiglib` - AC_MSG_NOTICE([SWIG library directory is '$SWIG_LIB']) - fi - else - AC_MSG_WARN([cannot determine SWIG version]) - SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' - fi - fi - AC_SUBST([SWIG_LIB]) -]) diff --git a/libs/ldns/acx_nlnetlabs.m4 b/libs/ldns/acx_nlnetlabs.m4 deleted file mode 100644 index 147af7f9ad..0000000000 --- a/libs/ldns/acx_nlnetlabs.m4 +++ /dev/null @@ -1,1310 +0,0 @@ -# acx_nlnetlabs.m4 - common macros for configure checks -# Copyright 2009, Wouter Wijngaards, NLnet Labs. -# BSD licensed. -# -# Version 11 -# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. -# 2010-07-02 Add check for ss_family (for minix). -# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. -# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. -# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl -# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN -# 2010-01-20 added AHX_COONFIG_STRLCAT -# 2009-07-14 U_CHAR detection improved for windows crosscompile. -# added ACX_FUNC_MALLOC -# fixup some #if to #ifdef -# NONBLOCKING test for mingw crosscompile. -# 2009-07-13 added ACX_WITH_SSL_OPTIONAL -# 2009-07-03 fixup LDFLAGS for empty ssl dir. -# -# Automates some of the checking constructs. Aims at portability for POSIX. -# Documentation for functions is below. -# -# the following macro's are provided in this file: -# (see below for details on each macro). -# -# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. -# ACX_RSRC_VERSION - create windows resource version number. -# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. -# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). -# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. -# ACX_DEPFLAG - find cc dependency flags. -# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. -# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. -# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. -# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. -# ACX_TYPE_U_CHAR - u_char type. -# ACX_TYPE_RLIM_T - rlim_t type. -# ACX_TYPE_SOCKLEN_T - socklen_t type. -# ACX_TYPE_IN_ADDR_T - in_addr_t type. -# ACX_TYPE_IN_PORT_T - in_port_t type. -# ACX_ARG_RPATH - add --disable-rpath option. -# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. -# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, -# where --without-ssl is also accepted -# ACX_LIB_SSL - setup to link -lssl. -# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. -# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. -# ACX_FUNC_DEPRECATED - see if func is deprecated. -# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. -# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. -# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. -# ACX_FUNC_MALLOC - check malloc, define replacement . -# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. -# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. -# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. -# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. -# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. -# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. -# AHX_CONFIG_SNPRINTF - snprintf compat prototype -# AHX_CONFIG_INET_PTON - inet_pton compat prototype -# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype -# AHX_CONFIG_INET_ATON - inet_aton compat prototype -# AHX_CONFIG_MEMMOVE - memmove compat prototype -# AHX_CONFIG_STRLCAT - strlcat compat prototype -# AHX_CONFIG_STRLCPY - strlcpy compat prototype -# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype -# AHX_CONFIG_W32_SLEEP - w32 compat for sleep -# AHX_CONFIG_W32_USLEEP - w32 compat for usleep -# AHX_CONFIG_W32_RANDOM - w32 compat for random -# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom -# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. -# ACX_CFLAGS_STRIP - strip one flag from CFLAGS -# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS -# AHX_CONFIG_FLAG_OMITTED - define omitted flag -# AHX_CONFIG_FLAG_EXT - define omitted extension flag -# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags -# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. -# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. -# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family -# - -dnl Escape backslashes as \\, for C:\ paths, for the C preprocessor defines. -dnl for example, ACX_ESCAPE_BACKSLASH($from_var, to_var) -dnl $1: the text to change. -dnl $2: the result. -AC_DEFUN([ACX_ESCAPE_BACKSLASH], [$2="`echo $1 | sed -e 's/\\\\/\\\\\\\\/g'`" -]) - -dnl Calculate comma separated windows-resource numbers from package version. -dnl Picks the first three(,0) or four numbers out of the name. -dnl $1: variable for the result -AC_DEFUN([ACX_RSRC_VERSION], -[$1=[`echo $PACKAGE_VERSION | sed -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\).*$/\1,\2,\3,\4/' -e 's/^[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*\([0-9]\)[^0-9]*$/\1,\2,\3,0/' `] -]) - -dnl Routine to help check for compiler flags. -dnl Checks if the compiler will accept the flag. -dnl $1: the flag without a - in front, so g to check -g. -dnl $2: executed if yes -dnl $3: executed if no -AC_DEFUN([ACX_CHECK_COMPILER_FLAG], -[ -AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(whether $CC supports -$1) -cache=`echo $1 | sed 'y%.=/+-%___p_%'` -AC_CACHE_VAL(cv_prog_cc_flag_$cache, -[ -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -$1 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c -]) -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -AC_MSG_RESULT(yes) -: -$2 -else -AC_MSG_RESULT(no) -: -$3 -fi -]) - -dnl setup flags for ACX_CHECK_COMPILER_FLAG_NEEDED -dnl ERRFLAG: result, compiler flag to turn warnings into errors -AC_DEFUN([ACX_CHECK_ERROR_FLAGS], -[ -ACX_CHECK_COMPILER_FLAG(Werror, [ERRFLAG="-Werror"], [ERRFLAG="-errwarn"]) -ACX_CHECK_COMPILER_FLAG(Wall, [ERRFLAG="$ERRFLAG -Wall"], - [ERRFLAG="$ERRFLAG -errfmt"]) -]) - -dnl Routine to help check for needed compiler flags. -dnl $1: flags for CC -dnl $2: the includes and code -dnl $3: if the given code only compiles with the flag, execute argument 3 -dnl $4: if the given code compiles without the flag, execute argument 4 -dnl $5: with and without flag the compile fails, execute argument 5. -AC_DEFUN([ACX_CHECK_COMPILER_FLAG_NEEDED], -[ -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([ACX_CHECK_ERROR_FLAGS]) -AC_MSG_CHECKING(whether we need $1 as a flag for $CC) -cache=AS_TR_SH($1) -dnl cache=`echo $1 | sed 'y%.=/+- %___p__%'` -AC_CACHE_VAL(cv_prog_cc_flag_needed_$cache, -[ -echo '$2' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else -[ -if test -z "`$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi -] -fi -rm -f conftest conftest.c conftest.o -]) -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -AC_MSG_RESULT(yes) -: -$3 -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -AC_MSG_RESULT(no) -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $1 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: -$4 -else -AC_MSG_RESULT(failed) -: -$5 -fi -fi -]) - -dnl Check for CC dependency flag -dnl DEPFLAG: set to flag that generates dependencies. -AC_DEFUN([ACX_DEPFLAG], -[ -AC_MSG_CHECKING([$CC dependency flag]) -echo 'void f(){}' >conftest.c -if test "`$CC -MM conftest.c 2>&1`" = "conftest.o: conftest.c"; then - DEPFLAG="-MM" -else - if test "`$CC -xM1 conftest.c 2>&1`" = "conftest.o: conftest.c"; then - DEPFLAG="-xM1" - else - DEPFLAG="-MM" # dunno do something - fi -fi -AC_MSG_RESULT($DEPFLAG) -rm -f conftest.c -AC_SUBST(DEPFLAG) -]) - -dnl Determine flags that gives POSIX and BSD functionality. -dnl CFLAGS is modified for the result. -AC_DEFUN([ACX_DETERMINE_EXT_FLAGS_UNBOUND], -[ -ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) -ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) - -AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT]) - -ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE, -[ -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - const char* str = NULL; - struct msghdr msg; - msg.msg_control = 0; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - str = gai_strerror(0); - return a; -} -], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE, -[ -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - const char* str = NULL; - struct msghdr msg; - msg.msg_control = 0; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - str = gai_strerror(0); - return a; -} -], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, -[ -#include -#include -int test() { - int a = 0; - return a; -} -], [CFLAGS="$CFLAGS $C99FLAG"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED(-D_BSD_SOURCE, -[ -#include - -int test() { - int a; - a = isascii(32); - return a; -} -], [CFLAGS="$CFLAGS -D_BSD_SOURCE"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE, -[ -#include - -int test() { - struct in6_pktinfo inf; - int a = (int)sizeof(inf); - return a; -} -], [CFLAGS="$CFLAGS -D_GNU_SOURCE"]) - -# check again for GNU_SOURCE for setresgid. May fail if setresgid -# is not available at all. -D_FRSRESGID is to make this check unique. -# otherwise we would get the previous cached result. -ACX_CHECK_COMPILER_FLAG_NEEDED(-D_GNU_SOURCE -D_FRSRESGID, -[ -#include - -int test() { - int a = setresgid(0,0,0); - a = setresuid(0,0,0); - return a; -} -], [CFLAGS="$CFLAGS -D_GNU_SOURCE"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED(-D_POSIX_C_SOURCE=200112, -[ -#include "confdefs.h" -#ifdef HAVE_TIME_H -#include -#endif -#include - -int test() { - int a = 0; - char *t; - time_t time = 0; - char *buf = NULL; - const char* str = NULL; - t = ctime_r(&time, buf); - str = gai_strerror(0); - return a; -} -], [CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED(-D__EXTENSIONS__, -[ -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - return a; -} -], [CFLAGS="$CFLAGS -D__EXTENSIONS__"]) - -])dnl End of ACX_DETERMINE_EXT_FLAGS_UNBOUND - -dnl Check the printf-format attribute (if any) -dnl result in HAVE_ATTR_FORMAT. -dnl Make sure you also include the AHX_CONFIG_FORMAT_ATTRIBUTE. -AC_DEFUN([ACX_CHECK_FORMAT_ATTRIBUTE], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "format" attribute) -AC_CACHE_VAL(ac_cv_c_format_attribute, -[ac_cv_c_format_attribute=no -AC_TRY_COMPILE( -[#include -void f (char *format, ...) __attribute__ ((format (printf, 1, 2))); -void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2))); -], [ - f ("%s", "str"); -], -[ac_cv_c_format_attribute="yes"], -[ac_cv_c_format_attribute="no"]) -]) - -AC_MSG_RESULT($ac_cv_c_format_attribute) -if test $ac_cv_c_format_attribute = yes; then - AC_DEFINE(HAVE_ATTR_FORMAT, 1, [Whether the C compiler accepts the "format" attribute]) -fi -])dnl End of ACX_CHECK_FORMAT_ATTRIBUTE - -dnl Setup ATTR_FORMAT config.h parts. -dnl make sure you call ACX_CHECK_FORMAT_ATTRIBUTE also. -AC_DEFUN([AHX_CONFIG_FORMAT_ATTRIBUTE], -[ -#ifdef HAVE_ATTR_FORMAT -# define ATTR_FORMAT(archetype, string_index, first_to_check) \ - __attribute__ ((format (archetype, string_index, first_to_check))) -#else /* !HAVE_ATTR_FORMAT */ -# define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ -#endif /* !HAVE_ATTR_FORMAT */ -]) - -dnl Check how to mark function arguments as unused. -dnl result in HAVE_ATTR_UNUSED. -dnl Make sure you include AHX_CONFIG_UNUSED_ATTRIBUTE also. -AC_DEFUN([ACX_CHECK_UNUSED_ATTRIBUTE], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(whether the C compiler (${CC-cc}) accepts the "unused" attribute) -AC_CACHE_VAL(ac_cv_c_unused_attribute, -[ac_cv_c_unused_attribute=no -AC_TRY_COMPILE( -[#include -void f (char *u __attribute__((unused))); -], [ - f ("x"); -], -[ac_cv_c_unused_attribute="yes"], -[ac_cv_c_unused_attribute="no"]) -]) - -dnl Setup ATTR_UNUSED config.h parts. -dnl make sure you call ACX_CHECK_UNUSED_ATTRIBUTE also. -AC_DEFUN([AHX_CONFIG_UNUSED_ATTRIBUTE], -[ -#if defined(DOXYGEN) -# define ATTR_UNUSED(x) x -#elif defined(__cplusplus) -# define ATTR_UNUSED(x) -#elif defined(HAVE_ATTR_UNUSED) -# define ATTR_UNUSED(x) x __attribute__((unused)) -#else /* !HAVE_ATTR_UNUSED */ -# define ATTR_UNUSED(x) x -#endif /* !HAVE_ATTR_UNUSED */ -]) - -AC_MSG_RESULT($ac_cv_c_unused_attribute) -if test $ac_cv_c_unused_attribute = yes; then - AC_DEFINE(HAVE_ATTR_UNUSED, 1, [Whether the C compiler accepts the "unused" attribute]) -fi -])dnl - -dnl Pre-fun for ACX_LIBTOOL_C_ONLY -AC_DEFUN([ACX_LIBTOOL_C_PRE], [ -# skip these tests, we do not need them. -AC_DEFUN([AC_PROG_F77], [:]) -AC_DEFUN([AC_PROG_FC], [:]) -AC_DEFUN([AC_PROG_CXX], [:]) -AC_DEFUN([AC_PROG_CXXCPP], [:]) -AC_DEFUN([AC_PROG_OBJC], [:]) -AC_DEFUN([AC_PROG_OBJCCPP], [:]) -AC_DEFUN([AC_LIBTOOL_CXX], [:]) -AC_DEFUN([AC_LIBTOOL_F77], [:]) -# always use ./libtool unless override from commandline (libtool=mylibtool) -if test -z "$libtool"; then - libtool="./libtool" -fi -AC_SUBST(libtool) -# avoid libtool max commandline length test on systems that fork slowly. -AC_CANONICAL_HOST -if echo "$host_os" | grep "sunos4" >/dev/null; then - lt_cv_sys_max_cmd_len=32750; -fi -AC_PATH_TOOL(AR, ar, [false]) -if test $AR = false; then - AC_MSG_ERROR([Cannot find 'ar', please extend PATH to include it]) -fi -]) - -dnl Perform libtool check, portably, only for C -AC_DEFUN([ACX_LIBTOOL_C_ONLY], [ -dnl as a requirement so that is gets called before LIBTOOL -dnl because libtools 'AC_REQUIRE' names are right after this one, before -dnl this function contents. -AC_REQUIRE([ACX_LIBTOOL_C_PRE]) -AC_PROG_LIBTOOL -]) - -dnl Detect if u_char type is defined, otherwise define it. -AC_DEFUN([ACX_TYPE_U_CHAR], -[AC_CHECK_TYPE([u_char], , - [AC_DEFINE([u_char], [unsigned char], [Define to 'unsigned char if not defined])], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_WINSOCK2_H -# include -#endif -]) ]) - -dnl Detect if rlim_t type is defined, otherwise define it. -AC_DEFUN([ACX_TYPE_RLIM_T], -[AC_CHECK_TYPE(rlim_t, , - [AC_DEFINE([rlim_t], [unsigned long], [Define to 'int' if not defined])], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_RESOURCE_H -# include -#endif -]) ]) - -dnl Detect if socklen_t type is defined, otherwise define it. -AC_DEFUN([ACX_TYPE_SOCKLEN_T], -[ -AC_CHECK_TYPE(socklen_t, , - [AC_DEFINE([socklen_t], [int], [Define to 'int' if not defined])], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_WS2TCPIP_H -# include -#endif -]) ]) - -dnl Detect if in_addr_t type is defined, otherwise define it. -AC_DEFUN([ACX_TYPE_IN_ADDR_T], -[ AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -]) ]) - -dnl Detect if in_port_t type is defined, otherwise define it. -AC_DEFUN([ACX_TYPE_IN_PORT_T], -[ AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -]) ]) - -dnl Add option to disable the evil rpath. Check whether to use rpath or not. -dnl Adds the --disable-rpath option. Uses trick to edit the ./libtool. -AC_DEFUN([ACX_ARG_RPATH], -[ -AC_ARG_ENABLE(rpath, - [ --disable-rpath disable hardcoded rpath (default=enabled)], - enable_rpath=$enableval, enable_rpath=yes) -if test "x$enable_rpath" = xno; then - dnl AC_MSG_RESULT([Fixing libtool for -rpath problems.]) - AC_CONFIG_COMMANDS([disable-rpath], [ - sed < libtool > libtool-2 \ - 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' - mv libtool-2 libtool - chmod 755 libtool - libtool="./libtool" - ]) -fi -]) - -dnl Add a -R to the RUNTIME_PATH. Only if rpath is enabled and it is -dnl an absolute path. -dnl $1: the pathname to add. -AC_DEFUN([ACX_RUNTIME_PATH_ADD], [ - if test "x$enable_rpath" = xyes; then - if echo "$1" | grep "^/" >/dev/null; then - RUNTIME_PATH="$RUNTIME_PATH -R$1" - fi - fi -]) - -dnl Common code for both ACX_WITH_SSL and ACX_WITH_SSL_OPTIONAL -dnl Takes one argument; the withval checked in those 2 functions -dnl sets up the environment for the given openssl path -AC_DEFUN([ACX_SSL_CHECKS], [ - withval=$1 - if test x_$withval != x_no; then - AC_MSG_CHECKING(for SSL) - if test x_$withval = x_ -o x_$withval = x_yes; then - withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" - fi - for dir in $withval; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl="yes" - AC_DEFINE_UNQUOTED([HAVE_SSL], [], [Define if you have the SSL libraries installed.]) - dnl assume /usr/include is already in the include-path. - if test "$ssldir" != "/usr"; then - CPPFLAGS="$CPPFLAGS -I$ssldir/include" - LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" - fi - break; - fi - done - if test x_$found_ssl != x_yes; then - AC_MSG_ERROR(Cannot find the SSL libraries in $withval) - else - AC_MSG_RESULT(found in $ssldir) - HAVE_SSL=yes - dnl assume /usr is already in the lib and dynlib paths. - if test "$ssldir" != "/usr" -a "$ssldir" != ""; then - LDFLAGS="$LDFLAGS -L$ssldir/lib" - LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" - ACX_RUNTIME_PATH_ADD([$ssldir/lib]) - fi - - AC_MSG_CHECKING([for HMAC_CTX_init in -lcrypto]) - LIBS="$LIBS -lcrypto" - LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" - AC_TRY_LINK(, [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ], [ - AC_MSG_RESULT(yes) - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - ], [ - AC_MSG_RESULT(no) - # check if -lwsock32 or -lgdi32 are needed. - BAKLIBS="$LIBS" - BAKSSLLIBS="$LIBSSL_LIBS" - LIBS="$LIBS -lgdi32" - LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" - AC_MSG_CHECKING([if -lcrypto needs -lgdi32]) - AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - AC_MSG_RESULT(yes) - ],[ - AC_MSG_RESULT(no) - LIBS="$BAKLIBS" - LIBSSL_LIBS="$BAKSSLLIBS" - LIBS="$LIBS -ldl" - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - AC_MSG_CHECKING([if -lcrypto needs -ldl]) - AC_TRY_LINK([], [ - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - ],[ - AC_DEFINE([HAVE_HMAC_CTX_INIT], 1, - [If you have HMAC_CTX_init]) - AC_MSG_RESULT(yes) - ],[ - AC_MSG_RESULT(no) - AC_MSG_ERROR([OpenSSL found in $ssldir, but version 0.9.7 or higher is required]) - ]) - ]) - ]) - fi - AC_SUBST(HAVE_SSL) - AC_SUBST(RUNTIME_PATH) - # openssl engine functionality needs dlopen(). - BAKLIBS="$LIBS" - AC_SEARCH_LIBS([dlopen], [dl]) - if test "$LIBS" != "$BAKLIBS"; then - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - fi - fi -AC_CHECK_HEADERS([openssl/ssl.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/err.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([openssl/rand.h],,, [AC_INCLUDES_DEFAULT]) -])dnl End of ACX_SSL_CHECKS - -dnl Check for SSL, where SSL is mandatory -dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found -dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. -dnl Checks main header files of SSL. -dnl -AC_DEFUN([ACX_WITH_SSL], -[ -AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], - [enable SSL (will check /usr/local/ssl - /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ - ],[ - withval="yes" - ]) - if test x_$withval = x_no; then - AC_MSG_ERROR([Need SSL library to do digital signature cryptography]) - fi - ACX_SSL_CHECKS($withval) -])dnl End of ACX_WITH_SSL - -dnl Check for SSL, where ssl is optional (--without-ssl is allowed) -dnl Adds --with-ssl option, searches for openssl and defines HAVE_SSL if found -dnl Setup of CPPFLAGS, CFLAGS. Adds -lcrypto to LIBS. -dnl Checks main header files of SSL. -dnl -AC_DEFUN([ACX_WITH_SSL_OPTIONAL], -[ -AC_ARG_WITH(ssl, AC_HELP_STRING([--with-ssl=pathname], - [enable SSL (will check /usr/local/ssl - /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr)]),[ - ],[ - withval="yes" - ]) - ACX_SSL_CHECKS($withval) -])dnl End of ACX_WITH_SSL_OPTIONAL - -dnl Setup to use -lssl -dnl To use -lcrypto, use the ACX_WITH_SSL setup (before this one). -AC_DEFUN([ACX_LIB_SSL], -[ -# check if libssl needs libdl -BAKLIBS="$LIBS" -LIBS="-lssl $LIBS" -AC_MSG_CHECKING([if libssl needs libdl]) -AC_TRY_LINK_FUNC([SSL_CTX_new], [ - AC_MSG_RESULT([no]) - LIBS="$BAKLIBS" -] , [ - AC_MSG_RESULT([yes]) - LIBS="$BAKLIBS" - AC_SEARCH_LIBS([dlopen], [dl]) -]) ])dnl End of ACX_LIB_SSL - -dnl Setup to use very large files (>2Gb). -dnl setups fseeko and its own -AC_DEFUN([ACX_SYS_LARGEFILE], -[ -AC_SYS_LARGEFILE -dnl try to see if an additional _LARGEFILE_SOURCE 1 is needed to get fseeko -ACX_CHECK_COMPILER_FLAG_NEEDED(-D_LARGEFILE_SOURCE=1, -[ -#include -int test() { - int a = fseeko(stdin, 0, 0); - return a; -} -], [CFLAGS="$CFLAGS -D_LARGEFILE_SOURCE=1"]) -]) - -dnl Check getaddrinfo. -dnl Works on linux, solaris, bsd and windows(links winsock). -dnl defines HAVE_GETADDRINFO, USE_WINSOCK. -AC_DEFUN([ACX_CHECK_GETADDRINFO_WITH_INCLUDES], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(for getaddrinfo) -ac_cv_func_getaddrinfo=no -AC_LINK_IFELSE( -[ -#ifdef __cplusplus -extern "C" -{ -#endif -char* getaddrinfo(); -char* (*f) () = getaddrinfo; -#ifdef __cplusplus -} -#endif -int main() { - ; - return 0; -} -], -dnl this case on linux, solaris, bsd -[ac_cv_func_getaddrinfo="yes"], -dnl no quick getaddrinfo, try mingw32 and winsock2 library. -ORIGLIBS="$LIBS" -LIBS="$LIBS -lws2_32" -AC_LINK_IFELSE( -AC_LANG_PROGRAM( -[ -#ifdef HAVE_WS2TCPIP_H -#include -#endif -], -[ - (void)getaddrinfo(NULL, NULL, NULL, NULL); -] -), -[ -ac_cv_func_getaddrinfo="yes" -dnl already: LIBS="$LIBS -lws2_32" -AC_DEFINE(USE_WINSOCK, 1, [Whether the windows socket API is used]) -USE_WINSOCK="1" -], -[ -ac_cv_func_getaddrinfo="no" -LIBS="$ORIGLIBS" -]) -) - -AC_MSG_RESULT($ac_cv_func_getaddrinfo) -if test $ac_cv_func_getaddrinfo = yes; then - AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) -fi -])dnl Endof AC_CHECK_GETADDRINFO_WITH_INCLUDES - -dnl check if a function is deprecated. defines DEPRECATED_func in config.h. -dnl $1: function name -dnl $2: C-statement that calls the function. -dnl $3: includes for the program. -dnl $4: executes if yes -dnl $5: executes if no -AC_DEFUN([ACX_FUNC_DEPRECATED], -[ -AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(if $1 is deprecated) -cache=`echo $1 | sed 'y%.=/+-%___p_%'` -AC_CACHE_VAL(cv_cc_deprecated_$cache, -[ -echo '$3' >conftest.c -echo 'void f(){ $2 }' >>conftest.c -if test -z "`$CC -c conftest.c 2>&1 | grep deprecated`"; then -eval "cv_cc_deprecated_$cache=no" -else -eval "cv_cc_deprecated_$cache=yes" -fi -rm -f conftest conftest.o conftest.c -]) -if eval "test \"`echo '$cv_cc_deprecated_'$cache`\" = yes"; then -AC_MSG_RESULT(yes) -AC_DEFINE_UNQUOTED(AS_TR_CPP([DEPRECATED_$1]), 1, [Whether $1 is deprecated]) -: -$4 -else -AC_MSG_RESULT(no) -: -$5 -fi -])dnl end of ACX_FUNC_DEPRECATED - -dnl check if select and nonblocking sockets actually work. -dnl Needs fork(2) and select(2). -dnl defines NONBLOCKING_IS_BROKEN, and if that is true multiple reads from -dnl a nonblocking socket do not work, a new call to select is necessary. -AC_DEFUN([ACX_CHECK_NONBLOCKING_BROKEN], -[ -AC_MSG_CHECKING([if nonblocking sockets work]) -if echo $target | grep mingw32 >/dev/null; then - AC_MSG_RESULT([no (windows)]) - AC_DEFINE([NONBLOCKING_IS_BROKEN], 1, [Define if the network stack does not fully support nonblocking io (causes lower performance).]) -else -AC_RUN_IFELSE(AC_LANG_PROGRAM([ -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif -],[[ - int port; - int sfd, cfd; - int num = 10; - int i, p; - struct sockaddr_in a; - /* test if select and nonblocking reads work well together */ - /* open port. - fork child to send 10 messages. - select to read. - then try to nonblocking read the 10 messages - then, nonblocking read must give EAGAIN - */ - - port = 12345 + (time(0)%32); - sfd = socket(PF_INET, SOCK_DGRAM, 0); - if(sfd == -1) { - perror("socket"); - return 1; - } - memset(&a, 0, sizeof(a)); - a.sin_family = AF_INET; - a.sin_port = htons(port); - a.sin_addr.s_addr = inet_addr("127.0.0.1"); - if(bind(sfd, (struct sockaddr*)&a, sizeof(a)) < 0) { - perror("bind"); - return 1; - } - if(fcntl(sfd, F_SETFL, O_NONBLOCK) == -1) { - perror("fcntl"); - return 1; - } - - cfd = socket(PF_INET, SOCK_DGRAM, 0); - if(cfd == -1) { - perror("client socket"); - return 1; - } - a.sin_port = 0; - if(bind(cfd, (struct sockaddr*)&a, sizeof(a)) < 0) { - perror("client bind"); - return 1; - } - a.sin_port = htons(port); - - /* no handler, causes exit in 10 seconds */ - alarm(10); - - /* send and receive on the socket */ - if((p=fork()) == 0) { - for(i=0; i -#include -#ifdef HAVE_WINSOCK2_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -], [ - (void)mkdir("directory"); -], -AC_MSG_RESULT(yes) -AC_DEFINE(MKDIR_HAS_ONE_ARG, 1, [Define if mkdir has one argument.]) -, -AC_MSG_RESULT(no) -) -])dnl end of ACX_MKDIR_ONE_ARG - -dnl Check for ioctlsocket function. works on mingw32 too. -AC_DEFUN([ACX_FUNC_IOCTLSOCKET], -[ -# check ioctlsocket -AC_MSG_CHECKING(for ioctlsocket) -AC_LINK_IFELSE(AC_LANG_PROGRAM([ -#ifdef HAVE_WINSOCK2_H -#include -#endif -], [ - (void)ioctlsocket(0, 0, NULL); -]), [ -AC_MSG_RESULT(yes) -AC_DEFINE(HAVE_IOCTLSOCKET, 1, [if the function 'ioctlsocket' is available]) -],[AC_MSG_RESULT(no)]) -])dnl end of ACX_FUNC_IOCTLSOCKET - -dnl detect malloc and provide malloc compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([ACX_FUNC_MALLOC], -[ - AC_FUNC_MALLOC - if test "$ac_cv_func_malloc_0_nonnull" = no; then - AC_DEFINE_UNQUOTED([malloc], [rpl_malloc_$1], [Define if replacement function should be used.]) - fi -]) - -dnl Define fallback for fseeko and ftello if needed. -AC_DEFUN([AHX_CONFIG_FSEEKO], -[ -#ifndef HAVE_FSEEKO -#define fseeko fseek -#define ftello ftell -#endif /* HAVE_FSEEKO */ -]) - -dnl Define RAND_MAX if not defined -AC_DEFUN([AHX_CONFIG_RAND_MAX], -[ -#ifndef RAND_MAX -#define RAND_MAX 2147483647 -#endif -]) - -dnl Define MAXHOSTNAMELEN if not defined -AC_DEFUN([AHX_CONFIG_MAXHOSTNAMELEN], -[ -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 256 -#endif -]) - -dnl Define IPV6_MIN_MTU if not defined -AC_DEFUN([AHX_CONFIG_IPV6_MIN_MTU], -[ -#ifndef IPV6_MIN_MTU -#define IPV6_MIN_MTU 1280 -#endif /* IPV6_MIN_MTU */ -]) - -dnl provide snprintf, vsnprintf compat prototype -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_SNPRINTF], -[ -#ifndef HAVE_SNPRINTF -#define snprintf snprintf_$1 -#define vsnprintf vsnprintf_$1 -#include -int snprintf (char *str, size_t count, const char *fmt, ...); -int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); -#endif /* HAVE_SNPRINTF */ -]) - -dnl provide inet_pton compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_INET_PTON], -[ -#ifndef HAVE_INET_PTON -#define inet_pton inet_pton_$1 -int inet_pton(int af, const char* src, void* dst); -#endif /* HAVE_INET_PTON */ -]) - -dnl provide inet_ntop compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_INET_NTOP], -[ -#ifndef HAVE_INET_NTOP -#define inet_ntop inet_ntop_$1 -const char *inet_ntop(int af, const void *src, char *dst, size_t size); -#endif -]) - -dnl provide inet_aton compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_INET_ATON], -[ -#ifndef HAVE_INET_ATON -#define inet_aton inet_aton_$1 -int inet_aton(const char *cp, struct in_addr *addr); -#endif -]) - -dnl provide memmove compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_MEMMOVE], -[ -#ifndef HAVE_MEMMOVE -#define memmove memmove_$1 -void *memmove(void *dest, const void *src, size_t n); -#endif -]) - -dnl provide strlcat compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_STRLCAT], -[ -#ifndef HAVE_STRLCAT -#define strlcat strlcat_$1 -size_t strlcat(char *dst, const char *src, size_t siz); -#endif -]) - -dnl provide strlcpy compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_STRLCPY], -[ -#ifndef HAVE_STRLCPY -#define strlcpy strlcpy_$1 -size_t strlcpy(char *dst, const char *src, size_t siz); -#endif -]) - -dnl provide gmtime_r compat prototype. -dnl $1: unique name for compat code -AC_DEFUN([AHX_CONFIG_GMTIME_R], -[ -#ifndef HAVE_GMTIME_R -#define gmtime_r gmtime_r_$1 -struct tm *gmtime_r(const time_t *timep, struct tm *result); -#endif -]) - -dnl provide w32 compat definition for sleep -AC_DEFUN([AHX_CONFIG_W32_SLEEP], -[ -#ifndef HAVE_SLEEP -#define sleep(x) Sleep((x)*1000) /* on win32 */ -#endif /* HAVE_SLEEP */ -]) - -dnl provide w32 compat definition for usleep -AC_DEFUN([AHX_CONFIG_W32_USLEEP], -[ -#ifndef HAVE_USLEEP -#define usleep(x) Sleep((x)/1000 + 1) /* on win32 */ -#endif /* HAVE_USLEEP */ -]) - -dnl provide w32 compat definition for random -AC_DEFUN([AHX_CONFIG_W32_RANDOM], -[ -#ifndef HAVE_RANDOM -#define random rand /* on win32, for tests only (bad random) */ -#endif /* HAVE_RANDOM */ -]) - -dnl provide w32 compat definition for srandom -AC_DEFUN([AHX_CONFIG_W32_SRANDOM], -[ -#ifndef HAVE_SRANDOM -#define srandom(x) srand(x) /* on win32, for tests only (bad random) */ -#endif /* HAVE_SRANDOM */ -]) - -dnl provide w32 compat definition for FD_SET_T -AC_DEFUN([AHX_CONFIG_W32_FD_SET_T], -[ -/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */ -#ifdef HAVE_WINSOCK2_H -#define FD_SET_T (u_int) -#else -#define FD_SET_T -#endif -]) - -dnl Remove an extension flag from CFLAGS, define replacement to be made. -dnl Used by ACX_STRIP_EXT_FLAGS. -dnl $1: the name of the flag, for example -D_GNU_SOURCE. -AC_DEFUN([ACX_CFLAGS_STRIP], -[ - if echo $CFLAGS | grep " $1" >/dev/null 2>&1; then - CFLAGS="`echo $CFLAGS | sed -e 's/ $1//g'`" - AC_DEFINE(m4_bpatsubst(OMITTED_$1,[[-=]],_), 1, Put $1 define in config.h) - fi -]) - -dnl Remove EXT flags from the CFLAGS and set them to be defined in config.h -dnl use with ACX_DETERMINE_EXT_FLAGS. -AC_DEFUN([ACX_STRIP_EXT_FLAGS], -[ - AC_MSG_NOTICE([Stripping extension flags...]) - ACX_CFLAGS_STRIP(-D_GNU_SOURCE) - ACX_CFLAGS_STRIP(-D_BSD_SOURCE) - ACX_CFLAGS_STRIP(-D__EXTENSIONS__) - ACX_CFLAGS_STRIP(-D_POSIX_C_SOURCE=200112) - ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE=600) - ACX_CFLAGS_STRIP(-D_XOPEN_SOURCE_EXTENDED=1) - ACX_CFLAGS_STRIP(-D_ALL_SOURCE) - ACX_CFLAGS_STRIP(-D_LARGEFILE_SOURCE=1) -]) dnl End of ACX_STRIP_EXT_FLAGS - -dnl define one omitted flag for config.h -dnl $1: flag name. -D_GNU_SOURCE -dnl $2: replacement define. _GNU_SOURCE -dnl $3: define value, 1 -AC_DEFUN([AHX_CONFIG_FLAG_OMITTED], -[#if defined($1) && !defined($2) -#define $2 $3 -[#]endif ]) - -dnl Wrapper for AHX_CONFIG_FLAG_OMITTED for -D style flags -dnl $1: the -DNAME or -DNAME=value string. -AC_DEFUN([AHX_CONFIG_FLAG_EXT], -[AHX_CONFIG_FLAG_OMITTED(m4_bpatsubst(OMITTED_$1,[[-=]],_),m4_bpatsubst(m4_bpatsubst($1,-D,),=.*$,),m4_if(m4_bregexp($1,=),-1,1,m4_bpatsubst($1,^.*=,))) -]) - -dnl config.h part to define omitted cflags, use with ACX_STRIP_EXT_FLAGS. -AC_DEFUN([AHX_CONFIG_EXT_FLAGS], -[AHX_CONFIG_FLAG_EXT(-D_GNU_SOURCE) -AHX_CONFIG_FLAG_EXT(-D_BSD_SOURCE) -AHX_CONFIG_FLAG_EXT(-D__EXTENSIONS__) -AHX_CONFIG_FLAG_EXT(-D_POSIX_C_SOURCE=200112) -AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE=600) -AHX_CONFIG_FLAG_EXT(-D_XOPEN_SOURCE_EXTENDED=1) -AHX_CONFIG_FLAG_EXT(-D_ALL_SOURCE) -AHX_CONFIG_FLAG_EXT(-D_LARGEFILE_SOURCE=1) -]) - -dnl check if memcmp is using signed characters and replace if so. -AC_DEFUN([ACX_CHECK_MEMCMP_SIGNED], -[AC_MSG_CHECKING([if memcmp compares unsigned]) -AC_RUN_IFELSE([AC_LANG_SOURCE([[ -#include -#include -#include -int main(void) -{ - char a = 255, b = 0; - if(memcmp(&a, &b, 1) < 0) - return 1; - return 0; -} -]])], [AC_MSG_RESULT([yes]) ], -[ AC_MSG_RESULT([no]) - AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes]) - AC_LIBOBJ([memcmp]) -], [ AC_MSG_RESULT([cross-compile no]) - AC_DEFINE([MEMCMP_IS_BROKEN], [1], [Define if memcmp() does not compare unsigned bytes]) - AC_LIBOBJ([memcmp]) -]) ]) - -dnl define memcmp to its replacement, pass unique id for program as arg -AC_DEFUN([AHX_MEMCMP_BROKEN], [ -#ifdef MEMCMP_IS_BROKEN -# ifdef memcmp -# undef memcmp -# endif -#define memcmp memcmp_$1 -int memcmp(const void *x, const void *y, size_t n); -#endif -]) - -dnl ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family -AC_DEFUN([ACX_CHECK_SS_FAMILY], -[AC_CHECK_MEMBER([struct sockaddr_storage.ss_family], [], [ - AC_CHECK_MEMBER([struct sockaddr_storage.__ss_family], [ - AC_DEFINE([ss_family], [__ss_family], [Fallback member name for socket family in struct sockaddr_storage]) - ],, [AC_INCLUDES_DEFAULT -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - ]) -], [AC_INCLUDES_DEFAULT -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -]) ]) - -dnl End of file diff --git a/libs/ldns/acx_python.m4 b/libs/ldns/acx_python.m4 deleted file mode 100644 index f4bf421f86..0000000000 --- a/libs/ldns/acx_python.m4 +++ /dev/null @@ -1,200 +0,0 @@ -AC_DEFUN([AC_PYTHON_DEVEL],[ - # - # Allow the use of a (user set) custom python version - # - AC_ARG_VAR([PYTHON_VERSION],[The installed Python - version to use, for example '2.3'. This string - will be appended to the Python interpreter - canonical name.]) - - AC_PATH_PROG([PYTHON],[python[$PYTHON_VERSION]]) - if test -z "$PYTHON"; then - AC_MSG_ERROR([Cannot find python$PYTHON_VERSION in your system path]) - PYTHON_VERSION="" - fi - - if test -z "$PYTHON_VERSION"; then - PYTHON_VERSION=`$PYTHON -c "import sys, string; \ - print string.split(sys.version)[[0]]"` - fi - - # - # Check for a version of Python >= 2.1.0 - # - AC_MSG_CHECKING([for a version of Python >= '2.1.0']) - ac_supports_python_ver=`$PYTHON -c "import sys, string; \ - ver = string.split(sys.version)[[0]]; \ - print ver >= '2.1.0'"` - if test "$ac_supports_python_ver" != "True"; then - if test -z "$PYTHON_NOVERSIONCHECK"; then - AC_MSG_RESULT([no]) - AC_MSG_FAILURE([ -This version of the AC@&t@_PYTHON_DEVEL macro -doesn't work properly with versions of Python before -2.1.0. You may need to re-run configure, setting the -variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, -PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. -Moreover, to disable this check, set PYTHON_NOVERSIONCHECK -to something else than an empty string. -]) - else - AC_MSG_RESULT([skip at user request]) - fi - else - AC_MSG_RESULT([yes]) - fi - - # - # if the macro parameter ``version'' is set, honour it - # - if test -n "$1"; then - AC_MSG_CHECKING([for a version of Python $1]) - ac_supports_python_ver=`$PYTHON -c "import sys, string; \ - ver = string.split(sys.version)[[0]]; \ - print ver $1"` - if test "$ac_supports_python_ver" = "True"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_ERROR([this package requires Python $1. -If you have it installed, but it isn't the default Python -interpreter in your system path, please pass the PYTHON_VERSION -variable to configure. See ``configure --help'' for reference. -]) - PYTHON_VERSION="" - fi - fi - - # - # Check if you have distutils, else fail - # - AC_MSG_CHECKING([for the distutils Python package]) - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` - if test -z "$ac_distutils_result"; then - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - AC_MSG_ERROR([cannot import Python module "distutils". -Please check your Python installation. The error was: -$ac_distutils_result]) - PYTHON_VERSION="" - fi - - # - # Check for Python include path - # - AC_MSG_CHECKING([for Python include path]) - if test -z "$PYTHON_CPPFLAGS"; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print distutils.sysconfig.get_python_inc();"` - if test -n "${python_path}"; then - python_path="-I$python_path" - fi - PYTHON_CPPFLAGS=$python_path - fi - AC_MSG_RESULT([$PYTHON_CPPFLAGS]) - AC_SUBST([PYTHON_CPPFLAGS]) - - # - # Check for Python library path - # - AC_MSG_CHECKING([for Python library path]) - if test -z "$PYTHON_LDFLAGS"; then - # (makes two attempts to ensure we've got a version number - # from the interpreter) - py_version=`$PYTHON -c "from distutils.sysconfig import *; \ - from string import join; \ - print join(get_config_vars('VERSION'))"` - if test "$py_version" = "[None]"; then - if test -n "$PYTHON_VERSION"; then - py_version=$PYTHON_VERSION - else - py_version=`$PYTHON -c "import sys; \ - print sys.version[[:3]]"` - fi - fi - - PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ - from string import join; \ - print '-L' + get_python_lib(0,1), \ - '-L' + os.path.dirname(get_python_lib(0,1)), \ - '-lpython';"`$py_version - fi - AC_MSG_RESULT([$PYTHON_LDFLAGS]) - AC_SUBST([PYTHON_LDFLAGS]) - - # - # Check for site packages - # - AC_MSG_CHECKING([for Python site-packages path]) - if test -z "$PYTHON_SITE_PKG"; then - PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ - print distutils.sysconfig.get_python_lib(0,0);"` - fi - AC_MSG_RESULT([$PYTHON_SITE_PKG]) - AC_SUBST([PYTHON_SITE_PKG]) - - # - # libraries which must be linked in when embedding - # - AC_MSG_CHECKING(python extra libraries) - if test -z "$PYTHON_EXTRA_LIBS"; then - PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print conf('LOCALMODLIBS'), conf('LIBS')"` - fi - AC_MSG_RESULT([$PYTHON_EXTRA_LIBS]) - AC_SUBST(PYTHON_EXTRA_LIBS) - - # - # linking flags needed when embedding - # - AC_MSG_CHECKING(python extra linking flags) - if test -z "$PYTHON_EXTRA_LDFLAGS"; then - PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print conf('LINKFORSHARED')"` - fi - AC_MSG_RESULT([$PYTHON_EXTRA_LDFLAGS]) - AC_SUBST(PYTHON_EXTRA_LDFLAGS) - - # - # final check to see if everything compiles alright - # - AC_MSG_CHECKING([consistency of all components of python development environment]) - AC_LANG_PUSH([C]) - # save current global flags - LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" - CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" - AC_TRY_LINK([ - #include - ],[ - Py_Initialize(); - ],[pythonexists=yes],[pythonexists=no]) - - AC_MSG_RESULT([$pythonexists]) - - if test ! "$pythonexists" = "yes"; then - AC_MSG_ERROR([ - Could not link test program to Python. Maybe the main Python library has been - installed in some non-standard library path. If so, pass it to configure, - via the LDFLAGS environment variable. - Example: ./configure LDFLAGS="-L/usr/non-standard-path/python/lib" - ============================================================================ - ERROR! - You probably have to install the development version of the Python package - for your distribution. The exact name of this package varies among them. - ============================================================================ - ]) - PYTHON_VERSION="" - fi - AC_LANG_POP - # turn back to default flags - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - - # - # all done! - # -]) - diff --git a/libs/ldns/buffer.c b/libs/ldns/buffer.c deleted file mode 100644 index 5a6b0ba74c..0000000000 --- a/libs/ldns/buffer.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * buffer.c -- generic memory buffer . - * - * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. - * - */ - -#include - -#include -#include - -ldns_buffer * -ldns_buffer_new(size_t capacity) -{ - ldns_buffer *buffer = LDNS_MALLOC(ldns_buffer); - - if (!buffer) { - return NULL; - } - - buffer->_data = (uint8_t *) LDNS_XMALLOC(uint8_t, capacity); - if (!buffer->_data) { - LDNS_FREE(buffer); - return NULL; - } - - buffer->_position = 0; - buffer->_limit = buffer->_capacity = capacity; - buffer->_fixed = 0; - buffer->_status = LDNS_STATUS_OK; - - ldns_buffer_invariant(buffer); - - return buffer; -} - -void -ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t size) -{ - assert(data != NULL); - - buffer->_position = 0; - buffer->_limit = buffer->_capacity = size; - buffer->_fixed = 0; - buffer->_data = LDNS_XMALLOC(uint8_t, size); - if(!buffer->_data) { - buffer->_status = LDNS_STATUS_MEM_ERR; - return; - } - memcpy(buffer->_data, data, size); - buffer->_status = LDNS_STATUS_OK; - - ldns_buffer_invariant(buffer); -} - -bool -ldns_buffer_set_capacity(ldns_buffer *buffer, size_t capacity) -{ - void *data; - - ldns_buffer_invariant(buffer); - assert(buffer->_position <= capacity); - - data = (uint8_t *) LDNS_XREALLOC(buffer->_data, uint8_t, capacity); - if (!data) { - buffer->_status = LDNS_STATUS_MEM_ERR; - return false; - } else { - buffer->_data = data; - buffer->_limit = buffer->_capacity = capacity; - return true; - } -} - -bool -ldns_buffer_reserve(ldns_buffer *buffer, size_t amount) -{ - ldns_buffer_invariant(buffer); - assert(!buffer->_fixed); - if (buffer->_capacity < buffer->_position + amount) { - size_t new_capacity = buffer->_capacity * 3 / 2; - - if (new_capacity < buffer->_position + amount) { - new_capacity = buffer->_position + amount; - } - if (!ldns_buffer_set_capacity(buffer, new_capacity)) { - buffer->_status = LDNS_STATUS_MEM_ERR; - return false; - } - } - buffer->_limit = buffer->_capacity; - return true; -} - -int -ldns_buffer_printf(ldns_buffer *buffer, const char *format, ...) -{ - va_list args; - int written = 0; - size_t remaining; - - if (ldns_buffer_status_ok(buffer)) { - ldns_buffer_invariant(buffer); - assert(buffer->_limit == buffer->_capacity); - - remaining = ldns_buffer_remaining(buffer); - va_start(args, format); - written = vsnprintf((char *) ldns_buffer_current(buffer), remaining, - format, args); - va_end(args); - if (written == -1) { - buffer->_status = LDNS_STATUS_INTERNAL_ERR; - return -1; - } else if ((size_t) written >= remaining) { - if (!ldns_buffer_reserve(buffer, (size_t) written + 1)) { - buffer->_status = LDNS_STATUS_MEM_ERR; - return -1; - } - va_start(args, format); - written = vsnprintf((char *) ldns_buffer_current(buffer), - ldns_buffer_remaining(buffer), format, args); - va_end(args); - if (written == -1) { - buffer->_status = LDNS_STATUS_INTERNAL_ERR; - return -1; - } - } - buffer->_position += written; - } - return written; -} - -void -ldns_buffer_free(ldns_buffer *buffer) -{ - if (!buffer) { - return; - } - - LDNS_FREE(buffer->_data); - - LDNS_FREE(buffer); -} - -void * -ldns_buffer_export(ldns_buffer *buffer) -{ - buffer->_fixed = 1; - return buffer->_data; -} - -int -ldns_bgetc(ldns_buffer *buffer) -{ - if (!ldns_buffer_available_at(buffer, buffer->_position, sizeof(uint8_t))) { - ldns_buffer_set_position(buffer, ldns_buffer_limit(buffer)); - /* ldns_buffer_rewind(buffer);*/ - return EOF; - } - return (int)ldns_buffer_read_u8(buffer); -} - -void -ldns_buffer_copy(ldns_buffer* result, ldns_buffer* from) -{ - size_t tocopy = ldns_buffer_limit(from); - - if(tocopy > ldns_buffer_capacity(result)) - tocopy = ldns_buffer_capacity(result); - ldns_buffer_clear(result); - ldns_buffer_write(result, ldns_buffer_begin(from), tocopy); - ldns_buffer_flip(result); -} diff --git a/libs/ldns/compat/b32_ntop.c b/libs/ldns/compat/b32_ntop.c deleted file mode 100644 index 038ebdc958..0000000000 --- a/libs/ldns/compat/b32_ntop.c +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 1996, 1998 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. - */ - -/* - * Portions Copyright (c) 1995 by International Business Machines, Inc. - * - * International Business Machines, Inc. (hereinafter called IBM) grants - * permission under its copyrights to use, copy, modify, and distribute this - * Software with or without fee, provided that the above copyright notice and - * all paragraphs of this notice appear in all copies, and that the name of IBM - * not be used in connection with the marketing of any product incorporating - * the Software or modifications thereof, without specific, written prior - * permission. - * - * To the extent it has a right to do so, IBM grants an immunity from suit - * under its patents, if any, for the use, sale or manufacture of products to - * the extent that such products are used for performing Domain Name System - * dynamic updates in TCP/IP networks by means of the Software. No immunity is - * granted for any product per se or for any other function of any product. - * - * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, - * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN - * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ -#include - -#include -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#include -#include -#include -#include - -#include - -static const char Base32[] = - "abcdefghijklmnopqrstuvwxyz234567"; -/* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/ -/* 00000000001111111111222222222233 - 01234567890123456789012345678901*/ -static const char Base32_extended_hex[] = -/* "0123456789ABCDEFGHIJKLMNOPQRSTUV";*/ - "0123456789abcdefghijklmnopqrstuv"; -static const char Pad32 = '='; - -/* (From RFC3548 and draft-josefsson-rfc3548bis-00.txt) -5. Base 32 Encoding - - The Base 32 encoding is designed to represent arbitrary sequences of - octets in a form that needs to be case insensitive but need not be - humanly readable. - - A 33-character subset of US-ASCII is used, enabling 5 bits to be - represented per printable character. (The extra 33rd character, "=", - is used to signify a special processing function.) - - The encoding process represents 40-bit groups of input bits as output - strings of 8 encoded characters. Proceeding from left to right, a - 40-bit input group is formed by concatenating 5 8bit input groups. - These 40 bits are then treated as 8 concatenated 5-bit groups, each - of which is translated into a single digit in the base 32 alphabet. - When encoding a bit stream via the base 32 encoding, the bit stream - must be presumed to be ordered with the most-significant-bit first. - That is, the first bit in the stream will be the high-order bit in - the first 8bit byte, and the eighth bit will be the low-order bit in - the first 8bit byte, and so on. - - Each 5-bit group is used as an index into an array of 32 printable - characters. The character referenced by the index is placed in the - output string. These characters, identified in Table 3, below, are - selected from US-ASCII digits and uppercase letters. - - Table 3: The Base 32 Alphabet - - Value Encoding Value Encoding Value Encoding Value Encoding - 0 A 9 J 18 S 27 3 - 1 B 10 K 19 T 28 4 - 2 C 11 L 20 U 29 5 - 3 D 12 M 21 V 30 6 - 4 E 13 N 22 W 31 7 - 5 F 14 O 23 X - 6 G 15 P 24 Y (pad) = - 7 H 16 Q 25 Z - 8 I 17 R 26 2 - - - Special processing is performed if fewer than 40 bits are available - at the end of the data being encoded. A full encoding quantum is - always completed at the end of a body. When fewer than 40 input bits - are available in an input group, zero bits are added (on the right) - to form an integral number of 5-bit groups. Padding at the end of - the data is performed using the "=" character. Since all base 32 - 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 40 - bits; here, the final unit of encoded output will be an integral - multiple of 8 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 six - "=" padding characters, - - (3) the final quantum of encoding input is exactly 16 bits; here, the - final unit of encoded output will be four characters followed by four - "=" padding characters, - - (4) the final quantum of encoding input is exactly 24 bits; here, the - final unit of encoded output will be five characters followed by - three "=" padding characters, or - - (5) the final quantum of encoding input is exactly 32 bits; here, the - final unit of encoded output will be seven characters followed by one - "=" padding character. - - -6. Base 32 Encoding with Extended Hex Alphabet - - The following description of base 32 is due to [7]. This encoding - should not be regarded as the same as the "base32" encoding, and - should not be referred to as only "base32". - - One property with this alphabet, that the base64 and base32 alphabet - lack, is that encoded data maintain its sort order when the encoded - data is compared bit-wise. - - This encoding is identical to the previous one, except for the - alphabet. The new alphabet is found in table 4. - - Table 4: The "Extended Hex" Base 32 Alphabet - - Value Encoding Value Encoding Value Encoding Value Encoding - 0 0 9 9 18 I 27 R - 1 1 10 A 19 J 28 S - 2 2 11 B 20 K 29 T - 3 3 12 C 21 L 30 U - 4 4 13 D 22 M 31 V - 5 5 14 E 23 N - 6 6 15 F 24 O (pad) = - 7 7 16 G 25 P - 8 8 17 H 26 Q - -*/ - - -int -ldns_b32_ntop_ar(uint8_t const *src, size_t srclength, char *target, size_t targsize, const char B32_ar[]) { - size_t datalength = 0; - uint8_t input[5]; - uint8_t output[8]; - size_t i; - memset(output, 0, 8); - - while (4 < srclength) { - input[0] = *src++; - input[1] = *src++; - input[2] = *src++; - input[3] = *src++; - input[4] = *src++; - srclength -= 5; - - output[0] = (input[0] & 0xf8) >> 3; - output[1] = ((input[0] & 0x07) << 2) + ((input[1] & 0xc0) >> 6); - output[2] = (input[1] & 0x3e) >> 1; - output[3] = ((input[1] & 0x01) << 4) + ((input[2] & 0xf0) >> 4); - output[4] = ((input[2] & 0x0f) << 1) + ((input[3] & 0x80) >> 7); - output[5] = (input[3] & 0x7c) >> 2; - output[6] = ((input[3] & 0x03) << 3) + ((input[4] & 0xe0) >> 5); - output[7] = (input[4] & 0x1f); - - assert(output[0] < 32); - assert(output[1] < 32); - assert(output[2] < 32); - assert(output[3] < 32); - assert(output[4] < 32); - assert(output[5] < 32); - assert(output[6] < 32); - assert(output[7] < 32); - - if (datalength + 8 > targsize) { - return (-1); - } - target[datalength++] = B32_ar[output[0]]; - target[datalength++] = B32_ar[output[1]]; - target[datalength++] = B32_ar[output[2]]; - target[datalength++] = B32_ar[output[3]]; - target[datalength++] = B32_ar[output[4]]; - target[datalength++] = B32_ar[output[5]]; - target[datalength++] = B32_ar[output[6]]; - target[datalength++] = B32_ar[output[7]]; - } - - /* Now we worry about padding. */ - if (0 != srclength) { - /* Get what's left. */ - input[0] = input[1] = input[2] = input[3] = input[4] = (uint8_t) '\0'; - for (i = 0; i < srclength; i++) - input[i] = *src++; - - output[0] = (input[0] & 0xf8) >> 3; - assert(output[0] < 32); - if (srclength >= 1) { - output[1] = ((input[0] & 0x07) << 2) + ((input[1] & 0xc0) >> 6); - assert(output[1] < 32); - output[2] = (input[1] & 0x3e) >> 1; - assert(output[2] < 32); - } - if (srclength >= 2) { - output[3] = ((input[1] & 0x01) << 4) + ((input[2] & 0xf0) >> 4); - assert(output[3] < 32); - } - if (srclength >= 3) { - output[4] = ((input[2] & 0x0f) << 1) + ((input[3] & 0x80) >> 7); - assert(output[4] < 32); - output[5] = (input[3] & 0x7c) >> 2; - assert(output[5] < 32); - } - if (srclength >= 4) { - output[6] = ((input[3] & 0x03) << 3) + ((input[4] & 0xe0) >> 5); - assert(output[6] < 32); - } - - - if (datalength + 1 > targsize) { - return (-2); - } - target[datalength++] = B32_ar[output[0]]; - if (srclength >= 1) { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = B32_ar[output[1]]; - if (srclength == 1 && output[2] == 0) { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - } else { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = B32_ar[output[2]]; - } - } else { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - } - if (srclength >= 2) { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = B32_ar[output[3]]; - } else { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - } - if (srclength >= 3) { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = B32_ar[output[4]]; - if (srclength == 3 && output[5] == 0) { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - } else { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = B32_ar[output[5]]; - } - } else { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - } - if (srclength >= 4) { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = B32_ar[output[6]]; - } else { - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - } - if (datalength + 1 > targsize) { return (-2); } - target[datalength++] = Pad32; - } - if (datalength+1 > targsize) { - return (int) (datalength); - } - target[datalength] = '\0'; /* Returned value doesn't count \0. */ - return (int) (datalength); -} - -int -ldns_b32_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { - return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32); -} - -/* deprecated, here for backwards compatibility */ -int -b32_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { - return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32); -} - -int -ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize) { - return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32_extended_hex); -} - -/* deprecated, here for backwards compatibility */ -int -b32_ntop_extended_hex(uint8_t const *src, size_t srclength, char *target, size_t targsize) { - return ldns_b32_ntop_ar(src, srclength, target, targsize, Base32_extended_hex); -} - diff --git a/libs/ldns/compat/b32_pton.c b/libs/ldns/compat/b32_pton.c deleted file mode 100644 index 9c261e615b..0000000000 --- a/libs/ldns/compat/b32_pton.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - * Copyright (c) 1996, 1998 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. - */ - -/* - * Portions Copyright (c) 1995 by International Business Machines, Inc. - * - * International Business Machines, Inc. (hereinafter called IBM) grants - * permission under its copyrights to use, copy, modify, and distribute this - * Software with or without fee, provided that the above copyright notice and - * all paragraphs of this notice appear in all copies, and that the name of IBM - * not be used in connection with the marketing of any product incorporating - * the Software or modifications thereof, without specific, written prior - * permission. - * - * To the extent it has a right to do so, IBM grants an immunity from suit - * under its patents, if any, for the use, sale or manufacture of products to - * the extent that such products are used for performing Domain Name System - * dynamic updates in TCP/IP networks by means of the Software. No immunity is - * granted for any product per se or for any other function of any product. - * - * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, - * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN - * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ -#include - -#include -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#include -#include -#include -#include - -/* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/ -static const char Base32[] = - "abcdefghijklmnopqrstuvwxyz234567"; -/* "0123456789ABCDEFGHIJKLMNOPQRSTUV";*/ -static const char Base32_extended_hex[] = - "0123456789abcdefghijklmnopqrstuv"; -static const char Pad32 = '='; - -/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) -5. Base 32 Encoding - - The Base 32 encoding is designed to represent arbitrary sequences of - octets in a form that needs to be case insensitive but need not be - humanly readable. - - A 33-character subset of US-ASCII is used, enabling 5 bits to be - represented per printable character. (The extra 33rd character, "=", - is used to signify a special processing function.) - - The encoding process represents 40-bit groups of input bits as output - strings of 8 encoded characters. Proceeding from left to right, a - 40-bit input group is formed by concatenating 5 8bit input groups. - These 40 bits are then treated as 8 concatenated 5-bit groups, each - of which is translated into a single digit in the base 32 alphabet. - When encoding a bit stream via the base 32 encoding, the bit stream - must be presumed to be ordered with the most-significant-bit first. - That is, the first bit in the stream will be the high-order bit in - the first 8bit byte, and the eighth bit will be the low-order bit in - the first 8bit byte, and so on. - - Each 5-bit group is used as an index into an array of 32 printable - characters. The character referenced by the index is placed in the - output string. These characters, identified in Table 3, below, are - selected from US-ASCII digits and uppercase letters. - - Table 3: The Base 32 Alphabet - - Value Encoding Value Encoding Value Encoding Value Encoding - 0 A 9 J 18 S 27 3 - 1 B 10 K 19 T 28 4 - 2 C 11 L 20 U 29 5 - 3 D 12 M 21 V 30 6 - 4 E 13 N 22 W 31 7 - 5 F 14 O 23 X - 6 G 15 P 24 Y (pad) = - 7 H 16 Q 25 Z - 8 I 17 R 26 2 - - - Special processing is performed if fewer than 40 bits are available - at the end of the data being encoded. A full encoding quantum is - always completed at the end of a body. When fewer than 40 input bits - are available in an input group, zero bits are added (on the right) - to form an integral number of 5-bit groups. Padding at the end of - the data is performed using the "=" character. Since all base 32 - 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 40 - bits; here, the final unit of encoded output will be an integral - multiple of 8 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 six - "=" padding characters, - - (3) the final quantum of encoding input is exactly 16 bits; here, the - final unit of encoded output will be four characters followed by four - "=" padding characters, - - (4) the final quantum of encoding input is exactly 24 bits; here, the - final unit of encoded output will be five characters followed by - three "=" padding characters, or - - (5) the final quantum of encoding input is exactly 32 bits; here, the - final unit of encoded output will be seven characters followed by one - "=" padding character. - - -6. Base 32 Encoding with Extended Hex Alphabet - - The following description of base 32 is due to [7]. This encoding - should not be regarded as the same as the "base32" encoding, and - should not be referred to as only "base32". - - One property with this alphabet, that the base32 and base32 alphabet - lack, is that encoded data maintain its sort order when the encoded - data is compared bit-wise. - - This encoding is identical to the previous one, except for the - alphabet. The new alphabet is found in table 4. - - Table 4: The "Extended Hex" Base 32 Alphabet - - Value Encoding Value Encoding Value Encoding Value Encoding - 0 0 9 9 18 I 27 R - 1 1 10 A 19 J 28 S - 2 2 11 B 20 K 29 T - 3 3 12 C 21 L 30 U - 4 4 13 D 22 M 31 V - 5 5 14 E 23 N - 6 6 15 F 24 O (pad) = - 7 7 16 G 25 P - 8 8 17 H 26 Q - - - - -*/ -/* skips all whitespace anywhere. - converts characters, four at a time, starting at (or after) - src from base - 32 numbers into three 8 bit bytes in the target area. - it returns the number of data bytes stored at the target, or -1 on error. - */ - -int -ldns_b32_pton_ar(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize, const char B32_ar[]) -{ - int tarindex, state, ch; - char *pos; - int i = 0; - - state = 0; - tarindex = 0; - - while ((ch = *src++) != '\0' && (i == 0 || i < (int) hashed_owner_str_len)) { - i++; - ch = tolower(ch); - if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ - continue; - - if (ch == Pad32) - break; - - pos = strchr(B32_ar, ch); - if (pos == 0) { - /* A non-base32 character. */ - return (-ch); - } - - switch (state) { - case 0: - if (target) { - if ((size_t)tarindex >= targsize) { - return (-2); - } - target[tarindex] = (pos - B32_ar) << 3; - } - state = 1; - break; - case 1: - if (target) { - if ((size_t)tarindex + 1 >= targsize) { - return (-3); - } - target[tarindex] |= (pos - B32_ar) >> 2; - target[tarindex+1] = ((pos - B32_ar) & 0x03) - << 6 ; - } - tarindex++; - state = 2; - break; - case 2: - if (target) { - if ((size_t)tarindex + 1 >= targsize) { - return (-4); - } - target[tarindex] |= (pos - B32_ar) << 1; - } - /*tarindex++;*/ - state = 3; - break; - case 3: - if (target) { - if ((size_t)tarindex + 1 >= targsize) { - return (-5); - } - target[tarindex] |= (pos - B32_ar) >> 4; - target[tarindex+1] = ((pos - B32_ar) & 0x0f) << 4 ; - } - tarindex++; - state = 4; - break; - case 4: - if (target) { - if ((size_t)tarindex + 1 >= targsize) { - return (-6); - } - target[tarindex] |= (pos - B32_ar) >> 1; - target[tarindex+1] = ((pos - B32_ar) & 0x01) - << 7 ; - } - tarindex++; - state = 5; - break; - case 5: - if (target) { - if ((size_t)tarindex + 1 >= targsize) { - return (-7); - } - target[tarindex] |= (pos - B32_ar) << 2; - } - state = 6; - break; - case 6: - if (target) { - if ((size_t)tarindex + 1 >= targsize) { - return (-8); - } - target[tarindex] |= (pos - B32_ar) >> 3; - target[tarindex+1] = ((pos - B32_ar) & 0x07) - << 5 ; - } - tarindex++; - state = 7; - break; - case 7: - if (target) { - if ((size_t)tarindex + 1 >= targsize) { - return (-9); - } - target[tarindex] |= (pos - B32_ar); - } - tarindex++; - state = 0; - break; - default: - abort(); - } - } - - /* - * We are done decoding Base-32 chars. Let's see if we ended - * on a byte boundary, and/or with erroneous trailing characters. - */ - - if (ch == Pad32) { /* We got a pad char. */ - ch = *src++; /* Skip it, get next. */ - switch (state) { - case 0: /* Invalid = in first position */ - case 1: /* Invalid = in second position */ - return (-10); - - case 2: /* Valid, means one byte of info */ - case 3: - /* Skip any number of spaces. */ - for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace((unsigned char)ch)) - break; - /* Make sure there is another trailing = sign. */ - if (ch != Pad32) { - return (-11); - } - ch = *src++; /* Skip the = */ - /* Fall through to "single trailing =" case. */ - /* FALLTHROUGH */ - - case 4: /* Valid, means two bytes of info */ - case 5: - case 6: - /* - * We know this char is an =. Is there anything but - * whitespace after it? - */ - for ((void)NULL; ch != '\0'; ch = *src++) - if (!(isspace((unsigned char)ch) || ch == '=')) { - return (-12); - } - - case 7: /* Valid, means three bytes of info */ - /* - * We know this char is an =. Is there anything but - * whitespace after it? - */ - for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace((unsigned char)ch)) { - return (-13); - } - - /* - * Now make sure for cases 2 and 3 that the "extra" - * bits that slopped past the last full byte were - * zeros. If we don't check them, they become a - * subliminal channel. - */ - if (target && target[tarindex] != 0) { - return (-14); - } - } - } else { - /* - * We ended by seeing the end of the string. Make sure we - * have no partial bytes lying around. - */ - if (state != 0) - return (-15); - } - - return (tarindex); -} - -int -ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) -{ - return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32); -} - -/* deprecated, here for backwards compatibility */ -int -b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) -{ - return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32); -} - -int -ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) -{ - return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex); -} - -/* deprecated, here for backwards compatibility */ -int -b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) -{ - return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex); -} diff --git a/libs/ldns/compat/b64_ntop.c b/libs/ldns/compat/b64_ntop.c deleted file mode 100644 index d0b52b514b..0000000000 --- a/libs/ldns/compat/b64_ntop.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 1996, 1998 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. - */ - -/* - * Portions Copyright (c) 1995 by International Business Machines, Inc. - * - * International Business Machines, Inc. (hereinafter called IBM) grants - * permission under its copyrights to use, copy, modify, and distribute this - * Software with or without fee, provided that the above copyright notice and - * all paragraphs of this notice appear in all copies, and that the name of IBM - * not be used in connection with the marketing of any product incorporating - * the Software or modifications thereof, without specific, written prior - * permission. - * - * To the extent it has a right to do so, IBM grants an immunity from suit - * under its patents, if any, for the use, sale or manufacture of products to - * the extent that such products are used for performing Domain Name System - * dynamic updates in TCP/IP networks by means of the Software. No immunity is - * granted for any product per se or for any other function of any product. - * - * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, - * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN - * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ -#include - -#include -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#include -#include -#include -#include - -#define Assert(Cond) if (!(Cond)) abort() - -static const char Base64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static const char Pad64 = '='; - -/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) - The following encoding technique is taken from RFC 1521 by Borenstein - and Freed. It is reproduced here in a slightly 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 base64 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. - - Table 1: The Base64 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 base64 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 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. - */ - -int -ldns_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) { - size_t datalength = 0; - uint8_t input[3]; - uint8_t output[4]; - size_t i; - - if (srclength == 0) { - if (targsize > 0) { - target[0] = '\0'; - return 0; - } else { - return -1; - } - } - - while (2 < srclength) { - input[0] = *src++; - input[1] = *src++; - input[2] = *src++; - srclength -= 3; - - output[0] = input[0] >> 2; - output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); - output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); - output[3] = input[2] & 0x3f; - Assert(output[0] < 64); - Assert(output[1] < 64); - Assert(output[2] < 64); - Assert(output[3] < 64); - - if (datalength + 4 > targsize) { - return (-1); - } - target[datalength++] = Base64[output[0]]; - target[datalength++] = Base64[output[1]]; - target[datalength++] = Base64[output[2]]; - target[datalength++] = Base64[output[3]]; - } - - /* Now we worry about padding. */ - if (0 != srclength) { - /* Get what's left. */ - input[0] = input[1] = input[2] = (uint8_t) '\0'; - for (i = 0; i < srclength; i++) - input[i] = *src++; - - output[0] = input[0] >> 2; - output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4); - output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6); - Assert(output[0] < 64); - Assert(output[1] < 64); - Assert(output[2] < 64); - - if (datalength + 4 > targsize) { - return (-2); - } - target[datalength++] = Base64[output[0]]; - target[datalength++] = Base64[output[1]]; - if (srclength == 1) { - target[datalength++] = Pad64; - } else { - target[datalength++] = Base64[output[2]]; - } - target[datalength++] = Pad64; - } - if (datalength >= targsize) { - return (-3); - } - target[datalength] = '\0'; /* Returned value doesn't count \0. */ - return (int) (datalength); -} diff --git a/libs/ldns/compat/b64_pton.c b/libs/ldns/compat/b64_pton.c deleted file mode 100644 index aa637d2275..0000000000 --- a/libs/ldns/compat/b64_pton.c +++ /dev/null @@ -1,260 +0,0 @@ -/* - * Copyright (c) 1996, 1998 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. - */ - -/* - * Portions Copyright (c) 1995 by International Business Machines, Inc. - * - * International Business Machines, Inc. (hereinafter called IBM) grants - * permission under its copyrights to use, copy, modify, and distribute this - * Software with or without fee, provided that the above copyright notice and - * all paragraphs of this notice appear in all copies, and that the name of IBM - * not be used in connection with the marketing of any product incorporating - * the Software or modifications thereof, without specific, written prior - * permission. - * - * To the extent it has a right to do so, IBM grants an immunity from suit - * under its patents, if any, for the use, sale or manufacture of products to - * the extent that such products are used for performing Domain Name System - * dynamic updates in TCP/IP networks by means of the Software. No immunity is - * granted for any product per se or for any other function of any product. - * - * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, - * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN - * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. - */ -#include - -#include -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#include -#include -#include -#include - -#define Assert(Cond) if (!(Cond)) abort() - -static const char Base64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static const char Pad64 = '='; - -/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) - The following encoding technique is taken from RFC 1521 by Borenstein - and Freed. It is reproduced here in a slightly 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 base64 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. - - Table 1: The Base64 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 base64 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 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. - */ - -/* skips all whitespace anywhere. - converts characters, four at a time, starting at (or after) - src from base - 64 numbers into three 8 bit bytes in the target area. - it returns the number of data bytes stored at the target, or -1 on error. - */ - -int -ldns_b64_pton(char const *src, uint8_t *target, size_t targsize) -{ - int tarindex, state, ch; - char *pos; - - state = 0; - tarindex = 0; - - if (strlen(src) == 0) { - return 0; - } - - while ((ch = *src++) != '\0') { - if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ - continue; - - if (ch == Pad64) - break; - - pos = strchr(Base64, ch); - if (pos == 0) { - /* A non-base64 character. */ - return (-1); - } - - switch (state) { - case 0: - if (target) { - if ((size_t)tarindex >= targsize) - return (-1); - target[tarindex] = (pos - Base64) << 2; - } - state = 1; - break; - case 1: - if (target) { - if ((size_t)tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 4; - target[tarindex+1] = ((pos - Base64) & 0x0f) - << 4 ; - } - tarindex++; - state = 2; - break; - case 2: - if (target) { - if ((size_t)tarindex + 1 >= targsize) - return (-1); - target[tarindex] |= (pos - Base64) >> 2; - target[tarindex+1] = ((pos - Base64) & 0x03) - << 6; - } - tarindex++; - state = 3; - break; - case 3: - if (target) { - if ((size_t)tarindex >= targsize) - return (-1); - target[tarindex] |= (pos - Base64); - } - tarindex++; - state = 0; - break; - default: - abort(); - } - } - - /* - * We are done decoding Base-64 chars. Let's see if we ended - * on a byte boundary, and/or with erroneous trailing characters. - */ - - if (ch == Pad64) { /* We got a pad char. */ - ch = *src++; /* Skip it, get next. */ - switch (state) { - case 0: /* Invalid = in first position */ - case 1: /* Invalid = in second position */ - return (-1); - - case 2: /* Valid, means one byte of info */ - /* Skip any number of spaces. */ - for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace((unsigned char)ch)) - break; - /* Make sure there is another trailing = sign. */ - if (ch != Pad64) - return (-1); - ch = *src++; /* Skip the = */ - /* Fall through to "single trailing =" case. */ - /* FALLTHROUGH */ - - case 3: /* Valid, means two bytes of info */ - /* - * We know this char is an =. Is there anything but - * whitespace after it? - */ - for ((void)NULL; ch != '\0'; ch = *src++) - if (!isspace((unsigned char)ch)) - return (-1); - - /* - * Now make sure for cases 2 and 3 that the "extra" - * bits that slopped past the last full byte were - * zeros. If we don't check them, they become a - * subliminal channel. - */ - if (target && target[tarindex] != 0) - return (-1); - } - } else { - /* - * We ended by seeing the end of the string. Make sure we - * have no partial bytes lying around. - */ - if (state != 0) - return (-1); - } - - return (tarindex); -} diff --git a/libs/ldns/compat/ctime_r.c b/libs/ldns/compat/ctime_r.c deleted file mode 100644 index 4ffd8b7e35..0000000000 --- a/libs/ldns/compat/ctime_r.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_TIME_H -#include -#endif - -char *ctime_r(const time_t *timep, char *buf) -{ - /* no thread safety. */ - char* result = ctime(timep); - if(buf && result) - strcpy(buf, result); - return result; -} diff --git a/libs/ldns/compat/fake-rfc2553.c b/libs/ldns/compat/fake-rfc2553.c deleted file mode 100644 index 431e04a215..0000000000 --- a/libs/ldns/compat/fake-rfc2553.c +++ /dev/null @@ -1,229 +0,0 @@ -/* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */ -/* - * Copyright (C) 2000-2003 Damien Miller. All rights reserved. - * Copyright (C) 1999 WIDE Project. 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. Neither the name of the project 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 PROJECT 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 PROJECT 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. - */ - -/* - * Pseudo-implementation of RFC2553 name / address resolution functions - * - * But these functions are not implemented correctly. The minimum subset - * is implemented for ssh use only. For example, this routine assumes - * that ai_family is AF_INET. Don't use it for another purpose. - */ - -#include -#include -#include -#include -#include -#include -#include "compat/fake-rfc2553.h" - -#ifndef HAVE_GETNAMEINFO -int getnameinfo(const struct sockaddr *sa, size_t ATTR_UNUSED(salen), char *host, - size_t hostlen, char *serv, size_t servlen, int flags) -{ - struct sockaddr_in *sin = (struct sockaddr_in *)sa; - struct hostent *hp; - char tmpserv[16]; - - if (serv != NULL) { - snprintf(tmpserv, sizeof(tmpserv), "%d", ntohs(sin->sin_port)); - if (strlcpy(serv, tmpserv, servlen) >= servlen) - return (EAI_MEMORY); - } - - if (host != NULL) { - if (flags & NI_NUMERICHOST) { - if (strlcpy(host, inet_ntoa(sin->sin_addr), - hostlen) >= hostlen) - return (EAI_MEMORY); - else - return (0); - } else { - hp = gethostbyaddr((char *)&sin->sin_addr, - sizeof(struct in_addr), AF_INET); - if (hp == NULL) - return (EAI_NODATA); - - if (strlcpy(host, hp->h_name, hostlen) >= hostlen) - return (EAI_MEMORY); - else - return (0); - } - } - return (0); -} -#endif /* !HAVE_GETNAMEINFO */ - -#ifndef HAVE_GAI_STRERROR -#ifdef HAVE_CONST_GAI_STRERROR_PROTO -const char * -#else -char * -#endif -gai_strerror(int err) -{ - switch (err) { - case EAI_NODATA: - return ("no address associated with name"); - case EAI_MEMORY: - return ("memory allocation failure."); - case EAI_NONAME: - return ("nodename nor servname provided, or not known"); - default: - return ("unknown/invalid error."); - } -} -#endif /* !HAVE_GAI_STRERROR */ - -#ifndef HAVE_FREEADDRINFO -void -freeaddrinfo(struct addrinfo *ai) -{ - struct addrinfo *next; - - for(; ai != NULL;) { - next = ai->ai_next; - free(ai); - ai = next; - } -} -#endif /* !HAVE_FREEADDRINFO */ - -#ifndef HAVE_GETADDRINFO -static struct -addrinfo *malloc_ai(int port, u_long addr, const struct addrinfo *hints) -{ - struct addrinfo *ai; - - ai = malloc(sizeof(*ai) + sizeof(struct sockaddr_in)); - if (ai == NULL) - return (NULL); - - memset(ai, '\0', sizeof(*ai) + sizeof(struct sockaddr_in)); - - ai->ai_addr = (struct sockaddr *)(ai + 1); - /* XXX -- ssh doesn't use sa_len */ - ai->ai_addrlen = sizeof(struct sockaddr_in); - ai->ai_addr->sa_family = ai->ai_family = AF_INET; - - ((struct sockaddr_in *)(ai)->ai_addr)->sin_port = port; - ((struct sockaddr_in *)(ai)->ai_addr)->sin_addr.s_addr = addr; - - /* XXX: the following is not generally correct, but does what we want */ - if (hints->ai_socktype) - ai->ai_socktype = hints->ai_socktype; - else - ai->ai_socktype = SOCK_STREAM; - - if (hints->ai_protocol) - ai->ai_protocol = hints->ai_protocol; - - return (ai); -} - -int -getaddrinfo(const char *hostname, const char *servname, - const struct addrinfo *hints, struct addrinfo **res) -{ - struct hostent *hp; - struct servent *sp; - struct in_addr in; - int i; - long int port; - u_long addr; - - port = 0; - if (servname != NULL) { - char *cp; - - port = strtol(servname, &cp, 10); - if (port > 0 && port <= 65535 && *cp == '\0') - port = htons(port); - else if ((sp = getservbyname(servname, NULL)) != NULL) - port = sp->s_port; - else - port = 0; - } - - if (hints && hints->ai_flags & AI_PASSIVE) { - addr = htonl(0x00000000); - if (hostname && inet_aton(hostname, &in) != 0) - addr = in.s_addr; - *res = malloc_ai(port, addr, hints); - if (*res == NULL) - return (EAI_MEMORY); - return (0); - } - - if (!hostname) { - *res = malloc_ai(port, htonl(0x7f000001), hints); - if (*res == NULL) - return (EAI_MEMORY); - return (0); - } - - if (inet_aton(hostname, &in)) { - *res = malloc_ai(port, in.s_addr, hints); - if (*res == NULL) - return (EAI_MEMORY); - return (0); - } - - /* Don't try DNS if AI_NUMERICHOST is set */ - if (hints && hints->ai_flags & AI_NUMERICHOST) - return (EAI_NONAME); - - hp = gethostbyname(hostname); - if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) { - struct addrinfo *cur, *prev; - - cur = prev = *res = NULL; - for (i = 0; hp->h_addr_list[i]; i++) { - struct in_addr *in = (struct in_addr *)hp->h_addr_list[i]; - - cur = malloc_ai(port, in->s_addr, hints); - if (cur == NULL) { - if (*res != NULL) - freeaddrinfo(*res); - return (EAI_MEMORY); - } - if (prev) - prev->ai_next = cur; - else - *res = cur; - - prev = cur; - } - return (0); - } - - return (EAI_NODATA); -} -#endif /* !HAVE_GETADDRINFO */ diff --git a/libs/ldns/compat/fake-rfc2553.h b/libs/ldns/compat/fake-rfc2553.h deleted file mode 100644 index 4c277ee902..0000000000 --- a/libs/ldns/compat/fake-rfc2553.h +++ /dev/null @@ -1,183 +0,0 @@ -/* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */ -/* - * Copyright (C) 2000-2003 Damien Miller. All rights reserved. - * Copyright (C) 1999 WIDE Project. 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. Neither the name of the project 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 PROJECT 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 PROJECT 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. - */ - -/* - * Pseudo-implementation of RFC2553 name / address resolution functions - * - * But these functions are not implemented correctly. The minimum subset - * is implemented for ssh use only. For example, this routine assumes - * that ai_family is AF_INET. Don't use it for another purpose. - */ - -#ifndef _FAKE_RFC2553_H -#define _FAKE_RFC2553_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * First, socket and INET6 related definitions - */ -#ifndef HAVE_STRUCT_SOCKADDR_STORAGE -#ifndef _SS_MAXSIZE -# define _SS_MAXSIZE 128 /* Implementation specific max size */ -# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) -struct sockaddr_storage { - struct sockaddr ss_sa; - char __ss_pad2[_SS_PADSIZE]; -}; -# define ss_family ss_sa.sa_family -#endif /* _SS_MAXSIZE */ -#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ - -#ifndef IN6_IS_ADDR_LOOPBACK -# define IN6_IS_ADDR_LOOPBACK(a) \ - (((uint32_t *)(a))[0] == 0 && ((uint32_t *)(a))[1] == 0 && \ - ((uint32_t *)(a))[2] == 0 && ((uint32_t *)(a))[3] == htonl(1)) -#endif /* !IN6_IS_ADDR_LOOPBACK */ - -#ifndef HAVE_STRUCT_IN6_ADDR -struct in6_addr { - uint8_t s6_addr[16]; -}; -#endif /* !HAVE_STRUCT_IN6_ADDR */ - -#ifndef HAVE_STRUCT_SOCKADDR_IN6 -struct sockaddr_in6 { - unsigned short sin6_family; - uint16_t sin6_port; - uint32_t sin6_flowinfo; - struct in6_addr sin6_addr; -}; -#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ - -#ifndef AF_INET6 -/* Define it to something that should never appear */ -#define AF_INET6 AF_MAX -#endif - -/* - * Next, RFC2553 name / address resolution API - */ - -#ifndef NI_NUMERICHOST -# define NI_NUMERICHOST (1) -#endif -#ifndef NI_NAMEREQD -# define NI_NAMEREQD (1<<1) -#endif -#ifndef NI_NUMERICSERV -# define NI_NUMERICSERV (1<<2) -#endif - -#ifndef AI_PASSIVE -# define AI_PASSIVE (1) -#endif -#ifndef AI_CANONNAME -# define AI_CANONNAME (1<<1) -#endif -#ifndef AI_NUMERICHOST -# define AI_NUMERICHOST (1<<2) -#endif - -#ifndef NI_MAXSERV -# define NI_MAXSERV 32 -#endif /* !NI_MAXSERV */ -#ifndef NI_MAXHOST -# define NI_MAXHOST 1025 -#endif /* !NI_MAXHOST */ - -#ifndef INT_MAX -#define INT_MAX 0xffffffff -#endif - -#ifndef EAI_NODATA -# define EAI_NODATA (INT_MAX - 1) -#endif -#ifndef EAI_MEMORY -# define EAI_MEMORY (INT_MAX - 2) -#endif -#ifndef EAI_NONAME -# define EAI_NONAME (INT_MAX - 3) -#endif -#ifndef EAI_SYSTEM -# define EAI_SYSTEM (INT_MAX - 4) -#endif - -#ifndef HAVE_STRUCT_ADDRINFO -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; -#endif /* !HAVE_STRUCT_ADDRINFO */ - -#ifndef HAVE_GETADDRINFO -#ifdef getaddrinfo -# undef getaddrinfo -#endif -#define getaddrinfo(a,b,c,d) (ssh_getaddrinfo(a,b,c,d)) -int getaddrinfo(const char *, const char *, - const struct addrinfo *, struct addrinfo **); -#endif /* !HAVE_GETADDRINFO */ - -#if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO) -#define gai_strerror(a) (ssh_gai_strerror(a)) -char *gai_strerror(int); -#endif /* !HAVE_GAI_STRERROR */ - -#ifndef HAVE_FREEADDRINFO -#define freeaddrinfo(a) (ssh_freeaddrinfo(a)) -void freeaddrinfo(struct addrinfo *); -#endif /* !HAVE_FREEADDRINFO */ - -#ifndef HAVE_GETNAMEINFO -#define getnameinfo(a,b,c,d,e,f,g) (ssh_getnameinfo(a,b,c,d,e,f,g)) -int getnameinfo(const struct sockaddr *, size_t, char *, size_t, - char *, size_t, int); -#endif /* !HAVE_GETNAMEINFO */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_FAKE_RFC2553_H */ - diff --git a/libs/ldns/compat/gmtime_r.c b/libs/ldns/compat/gmtime_r.c deleted file mode 100644 index 7062e7dee3..0000000000 --- a/libs/ldns/compat/gmtime_r.c +++ /dev/null @@ -1,14 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifdef HAVE_TIME_H -#include -#endif - -struct tm *gmtime_r(const time_t *timep, struct tm *result) -{ - /* no thread safety. */ - *result = *gmtime(timep); - return result; -} diff --git a/libs/ldns/compat/inet_aton.c b/libs/ldns/compat/inet_aton.c deleted file mode 100644 index e8c3a57b9a..0000000000 --- a/libs/ldns/compat/inet_aton.c +++ /dev/null @@ -1,182 +0,0 @@ -/* From openssh4.3p2 compat/inet_aton.c */ -/* - * Copyright (c) 1983, 1990, 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. 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. - * - - * --Copyright-- - */ - -/* OPENBSD ORIGINAL: lib/libc/net/inet_addr.c */ - -#include - -#if !defined(HAVE_INET_ATON) - -#include -#include -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#include - -#if 0 -/* - * Ascii internet address interpretation routine. - * The value returned is in network order. - */ -in_addr_t -inet_addr(const char *cp) -{ - struct in_addr val; - - if (inet_aton(cp, &val)) - return (val.s_addr); - return (INADDR_NONE); -} -#endif - -/* - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int -inet_aton(const char *cp, struct in_addr *addr) -{ - uint32_t val; - int base, n; - char c; - unsigned int parts[4]; - unsigned int *pp = parts; - - c = *cp; - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, isdigit=decimal. - */ - if (!isdigit((int) c)) - return (0); - val = 0; base = 10; - if (c == '0') { - c = *++cp; - if (c == 'x' || c == 'X') - base = 16, c = *++cp; - else - base = 8; - } - for (;;) { - if (isascii((int) c) && isdigit((int) c)) { - val = (val * base) + (c - '0'); - c = *++cp; - } else if (base == 16 && isascii((int) c) && isxdigit((int) c)) { - val = (val << 4) | - (c + 10 - (islower((int) c) ? 'a' : 'A')); - c = *++cp; - } else - break; - } - if (c == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16 bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3) - return (0); - *pp++ = val; - c = *++cp; - } else - break; - } - /* - * Check for trailing characters. - */ - if (c != '\0' && (!isascii((int) c) || !isspace((int) c))) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - switch (n) { - - case 0: - return (0); /* initial nondigit */ - - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if ((val > 0xffffff) || (parts[0] > 0xff)) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if ((val > 0xffff) || (parts[0] > 0xff) || (parts[1] > 0xff)) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if ((val > 0xff) || (parts[0] > 0xff) || (parts[1] > 0xff) || (parts[2] > 0xff)) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - if (addr) - addr->s_addr = htonl(val); - return (1); -} - -#endif /* !defined(HAVE_INET_ATON) */ diff --git a/libs/ldns/compat/inet_ntop.c b/libs/ldns/compat/inet_ntop.c deleted file mode 100644 index 57509c7c98..0000000000 --- a/libs/ldns/compat/inet_ntop.c +++ /dev/null @@ -1,216 +0,0 @@ -/* From openssh 4.3p2 compat/inet_ntop.c */ -/* Copyright (c) 1996 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. - */ - -/* OPENBSD ORIGINAL: lib/libc/net/inet_ntop.c */ - -#include - -#ifndef HAVE_INET_NTOP - -#include -#include -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#include -#include -#include - -#ifndef IN6ADDRSZ -#define IN6ADDRSZ 16 /* IPv6 T_AAAA */ -#endif - -#ifndef INT16SZ -#define INT16SZ 2 /* for systems without 16-bit ints */ -#endif - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static const char *inet_ntop4(const u_char *src, char *dst, size_t size); -static const char *inet_ntop6(const u_char *src, char *dst, size_t size); - -/* char * - * inet_ntop(af, src, dst, size) - * convert a network format address to presentation format. - * return: - * pointer to presentation format address (`dst'), or NULL (see errno). - * author: - * Paul Vixie, 1996. - */ -const char * -inet_ntop(int af, const void *src, char *dst, size_t size) -{ - switch (af) { - case AF_INET: - return (inet_ntop4(src, dst, size)); - case AF_INET6: - return (inet_ntop6(src, dst, size)); - default: -#ifdef EAFNOSUPPORT - errno = EAFNOSUPPORT; -#else - errno = ENOSYS; -#endif - return (NULL); - } - /* NOTREACHED */ -} - -/* const char * - * inet_ntop4(src, dst, size) - * format an IPv4 address, more or less like inet_ntoa() - * return: - * `dst' (as a const) - * notes: - * (1) uses no statics - * (2) takes a u_char* not an in_addr as input - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop4(const u_char *src, char *dst, size_t size) -{ - static const char fmt[] = "%u.%u.%u.%u"; - char tmp[sizeof "255.255.255.255"]; - int l; - - l = snprintf(tmp, size, fmt, src[0], src[1], src[2], src[3]); - if (l <= 0 || l >= (int)size) { - errno = ENOSPC; - return (NULL); - } - strlcpy(dst, tmp, size); - return (dst); -} - -/* const char * - * inet_ntop6(src, dst, size) - * convert IPv6 binary address into presentation (printable) format - * author: - * Paul Vixie, 1996. - */ -static const char * -inet_ntop6(const u_char *src, char *dst, size_t size) -{ - /* - * Note that int32_t and int16_t need only be "at least" large enough - * to contain a value of the specified size. On some systems, like - * Crays, there is no such thing as an integer variable with 16 bits. - * Keep this in mind if you think this function should have been coded - * to use pointer overlays. All the world's not a VAX. - */ - char tmp[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"]; - char *tp, *ep; - struct { int base, len; } best, cur; - u_int words[IN6ADDRSZ / INT16SZ]; - int i; - int advance; - - /* - * Preprocess: - * Copy the input (bytewise) array into a wordwise array. - * Find the longest run of 0x00's in src[] for :: shorthanding. - */ - memset(words, '\0', sizeof words); - for (i = 0; i < IN6ADDRSZ; i++) - words[i / 2] |= (src[i] << ((1 - (i % 2)) << 3)); - best.base = -1; - cur.base = -1; - for (i = 0; i < (IN6ADDRSZ / INT16SZ); i++) { - if (words[i] == 0) { - if (cur.base == -1) - cur.base = i, cur.len = 1; - else - cur.len++; - } else { - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - cur.base = -1; - } - } - } - if (cur.base != -1) { - if (best.base == -1 || cur.len > best.len) - best = cur; - } - if (best.base != -1 && best.len < 2) - best.base = -1; - - /* - * Format the result. - */ - tp = tmp; - ep = tmp + sizeof(tmp); - for (i = 0; i < (IN6ADDRSZ / INT16SZ) && tp < ep; i++) { - /* Are we inside the best run of 0x00's? */ - if (best.base != -1 && i >= best.base && - i < (best.base + best.len)) { - if (i == best.base) { - if (tp + 1 >= ep) - return (NULL); - *tp++ = ':'; - } - continue; - } - /* Are we following an initial run of 0x00s or any real hex? */ - if (i != 0) { - if (tp + 1 >= ep) - return (NULL); - *tp++ = ':'; - } - /* Is this address an encapsulated IPv4? */ - if (i == 6 && best.base == 0 && - (best.len == 6 || (best.len == 5 && words[5] == 0xffff))) { - if (!inet_ntop4(src+12, tp, (size_t)(ep - tp))) - return (NULL); - tp += strlen(tp); - break; - } - advance = snprintf(tp, ep - tp, "%x", words[i]); - if (advance <= 0 || advance >= ep - tp) - return (NULL); - tp += advance; - } - /* Was it a trailing run of 0x00's? */ - if (best.base != -1 && (best.base + best.len) == (IN6ADDRSZ / INT16SZ)) { - if (tp + 1 >= ep) - return (NULL); - *tp++ = ':'; - } - if (tp + 1 >= ep) - return (NULL); - *tp++ = '\0'; - - /* - * Check for overflow, copy, and we're done. - */ - if ((size_t)(tp - tmp) > size) { - errno = ENOSPC; - return (NULL); - } - strlcpy(dst, tmp, size); - return (dst); -} - -#endif /* !HAVE_INET_NTOP */ diff --git a/libs/ldns/compat/inet_pton.c b/libs/ldns/compat/inet_pton.c deleted file mode 100644 index 7a4f57614f..0000000000 --- a/libs/ldns/compat/inet_pton.c +++ /dev/null @@ -1,230 +0,0 @@ -/* $KAME: inet_pton.c,v 1.5 2001/08/20 02:32:40 itojun Exp $ */ - -/* Copyright (c) 1996 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. - */ - -#include - -#include -#include -#include - -/* - * WARNING: Don't even consider trying to compile this on a system where - * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. - */ - -static int inet_pton4 (const char *src, uint8_t *dst); -static int inet_pton6 (const char *src, uint8_t *dst); - -/* - * - * The definitions we might miss. - * - */ -#ifndef NS_INT16SZ -#define NS_INT16SZ 2 -#endif - -#ifndef NS_IN6ADDRSZ -#define NS_IN6ADDRSZ 16 -#endif - -#ifndef NS_INADDRSZ -#define NS_INADDRSZ 4 -#endif - -/* int - * inet_pton(af, src, dst) - * convert from presentation format (which usually means ASCII printable) - * to network format (which is usually some kind of binary format). - * return: - * 1 if the address was valid for the specified address family - * 0 if the address wasn't valid (`dst' is untouched in this case) - * -1 if some other error occurred (`dst' is untouched in this case, too) - * author: - * Paul Vixie, 1996. - */ -int -inet_pton(af, src, dst) - int af; - const char *src; - void *dst; -{ - switch (af) { - case AF_INET: - return (inet_pton4(src, dst)); - case AF_INET6: - return (inet_pton6(src, dst)); - default: -#ifdef EAFNOSUPPORT - errno = EAFNOSUPPORT; -#else - errno = ENOSYS; -#endif - return (-1); - } - /* NOTREACHED */ -} - -/* int - * inet_pton4(src, dst) - * like inet_aton() but without all the hexadecimal and shorthand. - * return: - * 1 if `src' is a valid dotted quad, else 0. - * notice: - * does not touch `dst' unless it's returning 1. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton4(src, dst) - const char *src; - uint8_t *dst; -{ - static const char digits[] = "0123456789"; - int saw_digit, octets, ch; - uint8_t tmp[NS_INADDRSZ], *tp; - - saw_digit = 0; - octets = 0; - *(tp = tmp) = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr(digits, ch)) != NULL) { - uint32_t new = *tp * 10 + (pch - digits); - - if (new > 255) - return (0); - *tp = new; - if (! saw_digit) { - if (++octets > 4) - return (0); - saw_digit = 1; - } - } else if (ch == '.' && saw_digit) { - if (octets == 4) - return (0); - *++tp = 0; - saw_digit = 0; - } else - return (0); - } - if (octets < 4) - return (0); - - memcpy(dst, tmp, NS_INADDRSZ); - return (1); -} - -/* int - * inet_pton6(src, dst) - * convert presentation level address to network order binary form. - * return: - * 1 if `src' is a valid [RFC1884 2.2] address, else 0. - * notice: - * (1) does not touch `dst' unless it's returning 1. - * (2) :: in a full address is silently ignored. - * credit: - * inspired by Mark Andrews. - * author: - * Paul Vixie, 1996. - */ -static int -inet_pton6(src, dst) - const char *src; - uint8_t *dst; -{ - static const char xdigits_l[] = "0123456789abcdef", - xdigits_u[] = "0123456789ABCDEF"; - uint8_t tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp; - const char *xdigits, *curtok; - int ch, saw_xdigit; - uint32_t val; - - memset((tp = tmp), '\0', NS_IN6ADDRSZ); - endp = tp + NS_IN6ADDRSZ; - colonp = NULL; - /* Leading :: requires some special handling. */ - if (*src == ':') - if (*++src != ':') - return (0); - curtok = src; - saw_xdigit = 0; - val = 0; - while ((ch = *src++) != '\0') { - const char *pch; - - if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL) - pch = strchr((xdigits = xdigits_u), ch); - if (pch != NULL) { - val <<= 4; - val |= (pch - xdigits); - if (val > 0xffff) - return (0); - saw_xdigit = 1; - continue; - } - if (ch == ':') { - curtok = src; - if (!saw_xdigit) { - if (colonp) - return (0); - colonp = tp; - continue; - } - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (uint8_t) (val >> 8) & 0xff; - *tp++ = (uint8_t) val & 0xff; - saw_xdigit = 0; - val = 0; - continue; - } - if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) && - inet_pton4(curtok, tp) > 0) { - tp += NS_INADDRSZ; - saw_xdigit = 0; - break; /* '\0' was seen by inet_pton4(). */ - } - return (0); - } - if (saw_xdigit) { - if (tp + NS_INT16SZ > endp) - return (0); - *tp++ = (uint8_t) (val >> 8) & 0xff; - *tp++ = (uint8_t) val & 0xff; - } - if (colonp != NULL) { - /* - * Since some memmove()'s erroneously fail to handle - * overlapping regions, we'll do the shift by hand. - */ - const int n = tp - colonp; - int i; - - for (i = 1; i <= n; i++) { - endp[- i] = colonp[n - i]; - colonp[n - i] = 0; - } - tp = endp; - } - if (tp != endp) - return (0); - memcpy(dst, tmp, NS_IN6ADDRSZ); - return (1); -} diff --git a/libs/ldns/compat/isascii.c b/libs/ldns/compat/isascii.c deleted file mode 100644 index 8a4ab37431..0000000000 --- a/libs/ldns/compat/isascii.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Just a replacement, if the original isascii is not - present */ - -#if HAVE_CONFIG_H -#include -#endif - -int isascii(int c); - -/* true if character is ascii. */ -int -isascii(int c) -{ - return c >= 0 && c < 128; -} diff --git a/libs/ldns/compat/isblank.c b/libs/ldns/compat/isblank.c deleted file mode 100644 index 3b38154c5f..0000000000 --- a/libs/ldns/compat/isblank.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Just a replacement, if the original isblank is not - present */ - -#if HAVE_CONFIG_H -#include -#endif - -int isblank(int c); - -/* true if character is a blank (space or tab). C99. */ -int -isblank(int c) -{ - return (c == ' ') || (c == '\t'); -} diff --git a/libs/ldns/compat/malloc.c b/libs/ldns/compat/malloc.c deleted file mode 100644 index bbc632e4f6..0000000000 --- a/libs/ldns/compat/malloc.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Just a replacement, if the original malloc is not - GNU-compliant. See autoconf documentation. */ - -#if HAVE_CONFIG_H -#include -#endif -#undef malloc - -#include - -void *malloc (); - -/* Allocate an N-byte block of memory from the heap. - If N is zero, allocate a 1-byte block. */ - -void * -rpl_malloc (size_t n) -{ - if (n == 0) - n = 1; - return malloc (n); -} diff --git a/libs/ldns/compat/memmove.c b/libs/ldns/compat/memmove.c deleted file mode 100644 index e458092c33..0000000000 --- a/libs/ldns/compat/memmove.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * memmove.c: memmove compat implementation. - * - * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. -*/ - -#include -#include - -void *memmove(void *dest, const void *src, size_t n); - -void *memmove(void *dest, const void *src, size_t n) -{ - uint8_t* from = (uint8_t*) src; - uint8_t* to = (uint8_t*) dest; - - if (from == to || n == 0) - return dest; - if (to > from && to-from < (int)n) { - /* to overlaps with from */ - /* */ - /* */ - /* copy in reverse, to avoid overwriting from */ - int i; - for(i=n-1; i>=0; i--) - to[i] = from[i]; - return dest; - } - if (from > to && from-to < (int)n) { - /* to overlaps with from */ - /* */ - /* */ - /* copy forwards, to avoid overwriting from */ - size_t i; - for(i=0; i -#endif -#undef realloc - -#include - -void *realloc (void*, size_t); -void *malloc (size_t); - -/* Changes allocation to new sizes, copies over old data. - * if oldptr is NULL, does a malloc. - * if size is zero, allocate 1-byte block.... - * (does not return NULL and free block) - */ - -void * -rpl_realloc (void* ptr, size_t n) -{ - if (n == 0) - n = 1; - if(ptr == 0) { - return malloc(n); - } - return realloc(ptr, n); -} - diff --git a/libs/ldns/compat/snprintf.c b/libs/ldns/compat/snprintf.c deleted file mode 100644 index b7445111cb..0000000000 --- a/libs/ldns/compat/snprintf.c +++ /dev/null @@ -1,770 +0,0 @@ -#include - -#ifndef HAVE_SNPRINTF - -#include -#include - -/* Define this as a fall through, HAVE_STDARG_H is probably already set */ - -#define HAVE_VARARGS_H - -/************************************************************** - * Original: - * Patrick Powell Tue Apr 11 09:48:21 PDT 1995 - * A bombproof version of doprnt (dopr) included. - * Sigh. This sort of thing is always nasty do deal with. Note that - * the version here does not include floating point... - * - * snprintf() is used instead of sprintf() as it does limit checks - * for string length. This covers a nasty loophole. - * - * The other functions are there to prevent NULL pointers from - * causing nast effects. - * - * More Recently: - * Brandon Long (blong@fiction.net) 9/15/96 for mutt 0.43 - * This was ugly. It is still ugly. I opted out of floating point - * numbers, but the formatter understands just about everything - * from the normal C string format, at least as far as I can tell from - * the Solaris 2.5 printf(3S) man page. - * - * Brandon Long (blong@fiction.net) 10/22/97 for mutt 0.87.1 - * Ok, added some minimal floating point support, which means this - * probably requires libm on most operating systems. Don't yet - * support the exponent (e,E) and sigfig (g,G). Also, fmtint() - * was pretty badly broken, it just wasn't being exercised in ways - * which showed it, so that's been fixed. Also, formated the code - * to mutt conventions, and removed dead code left over from the - * original. Also, there is now a builtin-test, just compile with: - * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm - * and run snprintf for results. - * - **************************************************************/ - - -/* varargs declarations: */ - -#if defined(HAVE_STDARG_H) -# include -# define HAVE_STDARGS /* let's hope that works everywhere (mj) */ -# define VA_LOCAL_DECL va_list ap -# define VA_START(f) va_start(ap, f) -# define VA_SHIFT(v,t) ; /* no-op for ANSI */ -# define VA_END va_end(ap) -#else -# if defined(HAVE_VARARGS_H) -# include -# undef HAVE_STDARGS -# define VA_LOCAL_DECL va_list ap -# define VA_START(f) va_start(ap) /* f is ignored! */ -# define VA_SHIFT(v,t) v = va_arg(ap,t) -# define VA_END va_end(ap) -# else -/*XX ** NO VARARGS ** XX*/ -# endif -#endif - -int snprintf (char *str, size_t count, const char *fmt, ...); -int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); - -static void dopr (char *buffer, size_t maxlen, const char *format, - va_list args); -static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, - char *value, int flags, int min, int max); -static void fmtint (char *buffer, size_t *currlen, size_t maxlen, - long value, int base, int min, int max, int flags); -static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, - long double fvalue, int min, int max, int flags); -static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c ); - -int vsnprintf (char *str, size_t count, const char *fmt, va_list args) -{ - str[0] = 0; - dopr(str, count, fmt, args); - return(strlen(str)); -} - -/* VARARGS3 */ -#ifdef HAVE_STDARGS -int snprintf (char *str,size_t count,const char *fmt,...) -#else -int snprintf (va_alist) va_dcl -#endif -{ -#ifndef HAVE_STDARGS - char *str; - size_t count; - char *fmt; -#endif - VA_LOCAL_DECL; - - VA_START (fmt); - VA_SHIFT (str, char *); - VA_SHIFT (count, size_t ); - VA_SHIFT (fmt, char *); - (void) vsnprintf(str, count, fmt, ap); - VA_END; - return(strlen(str)); -} - -/* - * dopr(): poor man's version of doprintf - */ - -/* format read states */ -#define DP_S_DEFAULT 0 -#define DP_S_FLAGS 1 -#define DP_S_MIN 2 -#define DP_S_DOT 3 -#define DP_S_MAX 4 -#define DP_S_MOD 5 -#define DP_S_CONV 6 -#define DP_S_DONE 7 - -/* format flags - Bits */ -#define DP_F_MINUS 1 -#define DP_F_PLUS 2 -#define DP_F_SPACE 4 -#define DP_F_NUM 8 -#define DP_F_ZERO 16 -#define DP_F_UP 32 - -/* Conversion Flags */ -#define DP_C_SHORT 1 -#define DP_C_LONG 2 -#define DP_C_LDOUBLE 3 - -#define char_to_int(p) (p - '0') -#define MAX(p,q) ((p >= q) ? p : q) - -static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) -{ - char ch; - long value; - long double fvalue; - char *strvalue; - int min; - int max; - int state; - int flags; - int cflags; - size_t currlen; - - state = DP_S_DEFAULT; - currlen = flags = cflags = min = 0; - max = -1; - ch = *format++; - - while (state != DP_S_DONE) - { - if ((ch == '\0') || (currlen >= maxlen)) - state = DP_S_DONE; - - switch(state) - { - case DP_S_DEFAULT: - if (ch == '%') - state = DP_S_FLAGS; - else - dopr_outch (buffer, &currlen, maxlen, ch); - ch = *format++; - break; - case DP_S_FLAGS: - switch (ch) - { - case '-': - flags |= DP_F_MINUS; - ch = *format++; - break; - case '+': - flags |= DP_F_PLUS; - ch = *format++; - break; - case ' ': - flags |= DP_F_SPACE; - ch = *format++; - break; - case '#': - flags |= DP_F_NUM; - ch = *format++; - break; - case '0': - flags |= DP_F_ZERO; - ch = *format++; - break; - default: - state = DP_S_MIN; - break; - } - break; - case DP_S_MIN: - if (isdigit((int) ch)) - { - min = 10*min + char_to_int (ch); - ch = *format++; - } - else if (ch == '*') - { - min = va_arg (args, int); - ch = *format++; - state = DP_S_DOT; - } - else - state = DP_S_DOT; - break; - case DP_S_DOT: - if (ch == '.') - { - state = DP_S_MAX; - ch = *format++; - } - else - state = DP_S_MOD; - break; - case DP_S_MAX: - if (isdigit((int) ch)) - { - if (max < 0) - max = 0; - max = 10*max + char_to_int (ch); - ch = *format++; - } - else if (ch == '*') - { - max = va_arg (args, int); - ch = *format++; - state = DP_S_MOD; - } - else - state = DP_S_MOD; - break; - case DP_S_MOD: - /* Currently, we don't support Long Long, bummer */ - switch (ch) - { - case 'h': - cflags = DP_C_SHORT; - ch = *format++; - break; - case 'l': - cflags = DP_C_LONG; - ch = *format++; - break; - case 'L': - cflags = DP_C_LDOUBLE; - ch = *format++; - break; - default: - break; - } - state = DP_S_CONV; - break; - case DP_S_CONV: - switch (ch) - { - case 'd': - case 'i': - if (cflags == DP_C_SHORT) - value = va_arg (args, int); - else if (cflags == DP_C_LONG) - value = va_arg (args, long int); - else - value = va_arg (args, int); - fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); - break; - case 'o': - flags &= ~DP_F_PLUS; - if (cflags == DP_C_SHORT) - value = va_arg (args, unsigned int); - else if (cflags == DP_C_LONG) - value = va_arg (args, unsigned long int); - else - value = va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 8, min, max, flags); - break; - case 'u': - flags &= ~DP_F_PLUS; - if (cflags == DP_C_SHORT) - value = va_arg (args, unsigned int); - else if (cflags == DP_C_LONG) - value = va_arg (args, unsigned long int); - else - value = va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 10, min, max, flags); - break; - case 'X': - flags |= DP_F_UP; - case 'x': - flags &= ~DP_F_PLUS; - if (cflags == DP_C_SHORT) - value = va_arg (args, unsigned int); - else if (cflags == DP_C_LONG) - value = va_arg (args, unsigned long int); - else - value = va_arg (args, unsigned int); - fmtint (buffer, &currlen, maxlen, value, 16, min, max, flags); - break; - case 'f': - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, long double); - else - fvalue = va_arg (args, double); - /* um, floating point? */ - fmtfp (buffer, &currlen, maxlen, fvalue, min, max, flags); - break; - case 'E': - flags |= DP_F_UP; - case 'e': - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, long double); - else - fvalue = va_arg (args, double); - break; - case 'G': - flags |= DP_F_UP; - case 'g': - if (cflags == DP_C_LDOUBLE) - fvalue = va_arg (args, long double); - else - fvalue = va_arg (args, double); - break; - case 'c': - dopr_outch (buffer, &currlen, maxlen, va_arg (args, int)); - break; - case 's': - strvalue = va_arg (args, char *); - if (max < 0) - max = maxlen; /* ie, no max */ - fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); - break; - case 'p': - strvalue = va_arg (args, void *); - fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); - break; - case 'n': - if (cflags == DP_C_SHORT) - { - short int *num; - num = va_arg (args, short int *); - *num = currlen; - } - else if (cflags == DP_C_LONG) - { - long int *num; - num = va_arg (args, long int *); - *num = currlen; - } - else - { - int *num; - num = va_arg (args, int *); - *num = currlen; - } - break; - case '%': - dopr_outch (buffer, &currlen, maxlen, ch); - break; - case 'w': - /* not supported yet, treat as next char */ - ch = *format++; - break; - default: - /* Unknown, skip */ - break; - } - ch = *format++; - state = DP_S_DEFAULT; - flags = cflags = min = 0; - max = -1; - break; - case DP_S_DONE: - break; - default: - /* hmm? */ - break; /* some picky compilers need this */ - } - } - if (currlen < maxlen - 1) - buffer[currlen] = '\0'; - else - buffer[maxlen - 1] = '\0'; -} - -static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, - char *value, int flags, int min, int max) -{ - int padlen, strln; /* amount to pad */ - int cnt = 0; - - if (value == 0) - { - value = (char *) ""; - } - - for (strln = 0; value[strln]; ++strln); /* strlen */ - padlen = min - strln; - if (padlen < 0) - padlen = 0; - if (flags & DP_F_MINUS) - padlen = -padlen; /* Left Justify */ - - while ((padlen > 0) && (cnt < max)) - { - dopr_outch (buffer, currlen, maxlen, ' '); - --padlen; - ++cnt; - } - while (*value && (cnt < max)) - { - dopr_outch (buffer, currlen, maxlen, *value++); - ++cnt; - } - while ((padlen < 0) && (cnt < max)) - { - dopr_outch (buffer, currlen, maxlen, ' '); - ++padlen; - ++cnt; - } -} - -/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */ - -static void fmtint (char *buffer, size_t *currlen, size_t maxlen, - long value, int base, int min, int max, int flags) -{ - int signvalue = 0; - unsigned long uvalue; - char convert[20]; - int place = 0; - int spadlen = 0; /* amount to space pad */ - int zpadlen = 0; /* amount to zero pad */ - int caps = 0; - - if (max < 0) - max = 0; - - uvalue = value; - if( value < 0 ) { - signvalue = '-'; - uvalue = -value; - } - else - if (flags & DP_F_PLUS) /* Do a sign (+/i) */ - signvalue = '+'; - else - if (flags & DP_F_SPACE) - signvalue = ' '; - - if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ - - do { - convert[place++] = - (caps? "0123456789ABCDEF":"0123456789abcdef") - [uvalue % (unsigned)base ]; - uvalue = (uvalue / (unsigned)base ); - } while(uvalue && (place < 20)); - if (place == 20) place--; - convert[place] = 0; - - zpadlen = max - place; - spadlen = min - MAX (max, place) - (signvalue ? 1 : 0); - if (zpadlen < 0) zpadlen = 0; - if (spadlen < 0) spadlen = 0; - if (flags & DP_F_ZERO) - { - zpadlen = MAX(zpadlen, spadlen); - spadlen = 0; - } - if (flags & DP_F_MINUS) - spadlen = -spadlen; /* Left Justifty */ - -#ifdef DEBUG_SNPRINTF - dprint (1, (debugfile, "zpad: %d, spad: %d, min: %d, max: %d, place: %d\n", - zpadlen, spadlen, min, max, place)); -#endif - - /* Spaces */ - while (spadlen > 0) - { - dopr_outch (buffer, currlen, maxlen, ' '); - --spadlen; - } - - /* Sign */ - if (signvalue) - dopr_outch (buffer, currlen, maxlen, signvalue); - - /* Zeros */ - if (zpadlen > 0) - { - while (zpadlen > 0) - { - dopr_outch (buffer, currlen, maxlen, '0'); - --zpadlen; - } - } - - /* Digits */ - while (place > 0) - dopr_outch (buffer, currlen, maxlen, convert[--place]); - - /* Left Justified spaces */ - while (spadlen < 0) { - dopr_outch (buffer, currlen, maxlen, ' '); - ++spadlen; - } -} - -static long double abs_val (long double value) -{ - long double result = value; - - if (value < 0) - result = -value; - - return result; -} - -static double pow10 (double exp) -{ - long double result = 1; - - while (exp) - { - result *= 10; - exp--; - } - - return result; -} - -static double round (double value) -{ - long intpart; - - intpart = value; - value = value - intpart; - if (value >= 0.5) - intpart++; - - return intpart; -} - -static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, - long double fvalue, int min, int max, int flags) -{ - int signvalue = 0; - long double ufvalue; - char iconvert[20]; - char fconvert[20]; - int iplace = 0; - int fplace = 0; - int padlen = 0; /* amount to pad */ - int zpadlen = 0; - int caps = 0; - long intpart; - long fracpart; - - /* - * AIX manpage says the default is 0, but Solaris says the default - * is 6, and sprintf on AIX defaults to 6 - */ - if (max < 0) - max = 6; - - ufvalue = abs_val (fvalue); - - if (fvalue < 0) - signvalue = '-'; - else - if (flags & DP_F_PLUS) /* Do a sign (+/i) */ - signvalue = '+'; - else - if (flags & DP_F_SPACE) - signvalue = ' '; - -#if 0 - if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ -#endif - - intpart = ufvalue; - - /* - * Sorry, we only support 9 digits past the decimal because of our - * conversion method - */ - if (max > 9) - max = 9; - - /* We "cheat" by converting the fractional part to integer by - * multiplying by a factor of 10 - */ - fracpart = round ((pow10 (max)) * (ufvalue - intpart)); - - if (fracpart >= pow10 (max)) - { - intpart++; - fracpart -= pow10 (max); - } - -#ifdef DEBUG_SNPRINTF - dprint (1, (debugfile, "fmtfp: %f =? %d.%d\n", fvalue, intpart, fracpart)); -#endif - - /* Convert integer part */ - do { - iconvert[iplace++] = - (caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10]; - intpart = (intpart / 10); - } while(intpart && (iplace < 20)); - if (iplace == 20) iplace--; - iconvert[iplace] = 0; - - /* Convert fractional part */ - do { - fconvert[fplace++] = - (caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10]; - fracpart = (fracpart / 10); - } while(fracpart && (fplace < 20)); - if (fplace == 20) fplace--; - fconvert[fplace] = 0; - - /* -1 for decimal point, another -1 if we are printing a sign */ - padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); - zpadlen = max - fplace; - if (zpadlen < 0) - zpadlen = 0; - if (padlen < 0) - padlen = 0; - if (flags & DP_F_MINUS) - padlen = -padlen; /* Left Justifty */ - - if ((flags & DP_F_ZERO) && (padlen > 0)) - { - if (signvalue) - { - dopr_outch (buffer, currlen, maxlen, signvalue); - --padlen; - signvalue = 0; - } - while (padlen > 0) - { - dopr_outch (buffer, currlen, maxlen, '0'); - --padlen; - } - } - while (padlen > 0) - { - dopr_outch (buffer, currlen, maxlen, ' '); - --padlen; - } - if (signvalue) - dopr_outch (buffer, currlen, maxlen, signvalue); - - while (iplace > 0) - dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); - - /* - * Decimal point. This should probably use locale to find the correct - * char to print out. - */ - dopr_outch (buffer, currlen, maxlen, '.'); - - while (zpadlen > 0) - { - dopr_outch (buffer, currlen, maxlen, '0'); - --zpadlen; - } - - while (fplace > 0) - dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); - - while (padlen < 0) - { - dopr_outch (buffer, currlen, maxlen, ' '); - ++padlen; - } -} - -static void dopr_outch (char *buffer, size_t *currlen, size_t maxlen, char c) -{ - if (*currlen < maxlen) - buffer[(*currlen)++] = c; -} - -#ifdef TEST_SNPRINTF -#ifndef LONG_STRING -#define LONG_STRING 1024 -#endif -int main (void) -{ - char buf1[LONG_STRING]; - char buf2[LONG_STRING]; - char *fp_fmt[] = { - "%-1.5f", - "%1.5f", - "%123.9f", - "%10.5f", - "% 10.5f", - "%+22.9f", - "%+4.9f", - "%01.3f", - "%4f", - "%3.1f", - "%3.2f", - NULL - }; - double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, - 0.9996, 1.996, 4.136, 0}; - char *int_fmt[] = { - "%-1.5d", - "%1.5d", - "%123.9d", - "%5.5d", - "%10.5d", - "% 10.5d", - "%+22.33d", - "%01.3d", - "%4d", - NULL - }; - long int_nums[] = { -1, 134, 91340, 341, 0203, 0}; - int x, y; - int fail = 0; - int num = 0; - - printf ("Testing snprintf format codes against system sprintf...\n"); - - for (x = 0; fp_fmt[x] != NULL ; x++) - for (y = 0; fp_nums[y] != 0 ; y++) - { - snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); - sprintf (buf2, fp_fmt[x], fp_nums[y]); - if (strcmp (buf1, buf2)) - { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", - fp_fmt[x], buf1, buf2); - fail++; - } - num++; - } - - for (x = 0; int_fmt[x] != NULL ; x++) - for (y = 0; int_nums[y] != 0 ; y++) - { - snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); - sprintf (buf2, int_fmt[x], int_nums[y]); - if (strcmp (buf1, buf2)) - { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", - int_fmt[x], buf1, buf2); - fail++; - } - num++; - } - printf ("%d tests failed out of %d.\n", fail, num); -} -#endif /* SNPRINTF_TEST */ - -#endif /* !HAVE_SNPRINTF */ diff --git a/libs/ldns/compat/strlcpy.c b/libs/ldns/compat/strlcpy.c deleted file mode 100644 index d6c34c1d83..0000000000 --- a/libs/ldns/compat/strlcpy.c +++ /dev/null @@ -1,57 +0,0 @@ -/* from openssh 4.3p2 compat/strlcpy.c */ -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -/* OPENBSD ORIGINAL: lib/libc/string/strlcpy.c */ - -#include -#ifndef HAVE_STRLCPY - -#include -#include - -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t -strlcpy(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} - -#endif /* !HAVE_STRLCPY */ diff --git a/libs/ldns/compat/timegm.c b/libs/ldns/compat/timegm.c deleted file mode 100644 index 97e1e54436..0000000000 --- a/libs/ldns/compat/timegm.c +++ /dev/null @@ -1,31 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#ifdef HAVE_STDLIB_H -#include -#endif - -#include - -time_t -timegm (struct tm *tm) { - time_t ret; - char *tz; - - tz = getenv("TZ"); - putenv((char*)"TZ="); - tzset(); - ret = mktime(tm); - if (tz) { - char buf[256]; - snprintf(buf, sizeof(buf), "TZ=%s", tz); - putenv(tz); - } - else - putenv((char*)"TZ"); - tzset(); - return ret; -} diff --git a/libs/ldns/config.guess b/libs/ldns/config.guess deleted file mode 100755 index 0e30d56e94..0000000000 --- a/libs/ldns/config.guess +++ /dev/null @@ -1,1407 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-07-02' - -# 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. - -# Originally written by Per Bothner . -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# 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 build system type. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -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 - -# 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. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - 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 - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # 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 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-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 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # 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. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - 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-unknown-sysv4 - exit 0;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - 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:*:* | SR8000: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 ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; - esac ;; - 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=`(sed 1q /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 ;; - # 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 ;; - 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) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* 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 -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit 0 ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit 0 ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - 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 ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - 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:*:[45]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${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=${UNAME_VERSION}.${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:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - 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 -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - 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 -o $dummy $dummy.c && $dummy && exit 0 - 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:*:* | *3000*: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 ;; - 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*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - 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/ \ - -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - 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:*:*|*:GNU/FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/FreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; - i*:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; - x86:Interix*:[34]*) - echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - 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 i586-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 ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; - arm*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit 0 ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - mips:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips - #undef mipsel - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mipsel - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef mips64 - #undef mips64el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=mips64el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=mips64 - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 - ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit 0 ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit 0 ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit 0 ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit 0 ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit 0 ;; - i*86: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. - # Set LC_ALL=C to ensure ld outputs messages in English. - ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ - | sed -ne '/supported targets:/!d - s/[ ][ ]*/ /g - s/.*supported targets: *// - s/ .*// - p'` - case "$ld_supported_targets" in - elf32-i386) - TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" - ;; - a.out-i386-linux) - echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; - coff-i386) - echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; - "") - # Either a pre-BFD a.out linker (linux-gnuoldld) or - # one that does not give us useful --help. - echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; - esac - # Determine whether the default compiler is a.out or elf - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #ifdef __ELF__ - # ifdef __GLIBC__ - # if __GLIBC__ >= 2 - LIBC=gnu - # else - LIBC=gnulibc1 - # endif - # else - LIBC=gnulibc1 - # endif - #else - #ifdef __INTEL_COMPILER - LIBC=gnu - #else - LIBC=gnuaout - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 - ;; - i*86:DYNIX/ptx:4*:*) - # 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. - 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:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - 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:[78]*) - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - 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 ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit 0 ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*: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.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) - echo powerpc-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:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit 0 ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # 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 ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - 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 ;; - SX-6:SUPER-UX:*:*) - echo sx6-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:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit 0 ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit 0 ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit 0 ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit 0 ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit 0 ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit 0 ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit 0 ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit 0 ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${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 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#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 - 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) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# 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 -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 - -# 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 - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/libs/ldns/config.sub b/libs/ldns/config.sub deleted file mode 100755 index 9d7f733905..0000000000 --- a/libs/ldns/config.sub +++ /dev/null @@ -1,1504 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. - -timestamp='2003-07-04' - -# 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. - -# Please send patches to . Submit a context -# diff and a properly formatted ChangeLog entry. -# -# 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. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; - --version | -v ) - echo "$version" ; exit 0 ;; - --help | --h* | -h ) - echo "$usage"; exit 0 ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit 0;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -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* | kfreebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) - 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 | -axis) - os= - basic_machine=$1 - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - 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. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64vr | mips64vrel \ - | mips64orion | mips64orionel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | msp430 \ - | ns16k | ns32k \ - | openrisc | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ - | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ - | strongarm \ - | tahoe | thumb | tic4x | tic80 | tron \ - | v850 | v850e \ - | we32k \ - | x86 | xscale | xstormy16 | xtensa \ - | z8k) - basic_machine=$basic_machine-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - - # 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*86 | x86_64) - 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. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | amd64-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* \ - | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ - | pyramid-* \ - | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ - | tahoe-* | thumb-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tron-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ - | ymp-* \ - | z8k-*) - ;; - # 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 - ;; - amd64) - basic_machine=x86_64-pc - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - 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 - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - 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 | j90) - basic_machine=j90-cray - os=-unicos - ;; - crds | unos) - basic_machine=m68k-crds - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - 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 - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - 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*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*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 - ;; - 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 - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - 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 - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - 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 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - or32 | or32-*) - basic_machine=or32-unknown - os=-coff - ;; - 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 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-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/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-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=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tic54x | c54x*) - basic_machine=tic54x-unknown - os=-coff - ;; - tic55x | c55x*) - basic_machine=tic55x-unknown - os=-coff - ;; - tic6x | c6x*) - basic_machine=tic6x-unknown - os=-coff - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - 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 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - 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 - ;; - romp) - basic_machine=romp-ibm - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) - 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 - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - 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* | -kfreebsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|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 - ;; - -atheos*) - os=-atheos - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -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[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -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 - ;; - c4x-* | tic4x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - 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 - ;; - or32-*) - os=-coff - ;; - *-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 - ;; - f30[01]-fujitsu | f700-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* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/libs/ldns/configure b/libs/ldns/configure deleted file mode 100755 index 4f38261f0e..0000000000 --- a/libs/ldns/configure +++ /dev/null @@ -1,17354 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for ldns 1.6.9. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: libdns@nlnetlabs.nl about your system, including any -$0: error possibly output before this message. Then install -$0: a modern shell, or manually run the script under such a -$0: shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='ldns' -PACKAGE_TARNAME='libdns' -PACKAGE_VERSION='1.6.9' -PACKAGE_STRING='ldns 1.6.9' -PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' -PACKAGE_URL='' - -ac_unique_file="packet.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -enable_option_checking=no -ac_subst_vars='subdirs -LTLIBOBJS -WINDRES -LIBOBJS -include_unistd_h -include_systypes_h -include_inttypes_h -include_sys_socket_h -INSTALL_LDNS_CONFIG -LIBSSL_LIBS -LIBSSL_LDFLAGS -LIBSSL_CPPFLAGS -RUNTIME_PATH -HAVE_SSL -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -AWK -RANLIB -STRIP -ac_ct_AR -DLLTOOL -OBJDUMP -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -SED -LIBTOOL -AR -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -libtool -swig -PYLDNS -SWIG_LIB -SWIG -PYTHON_EXTRA_LDFLAGS -PYTHON_EXTRA_LIBS -PYTHON_SITE_PKG -PYTHON_LDFLAGS -PYTHON_CPPFLAGS -PYTHON -PYTHON_VERSION -doxygen -SET_MAKE -EGREP -GREP -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -LDNS_VERSION_MICRO -LDNS_VERSION_MINOR -LDNS_VERSION_MAJOR -LIBTOOL_VERSION_INFO -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -with_pyldns -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -with_sysroot -enable_libtool_lock -with_ssl -enable_sha2 -enable_gost -enable_ecdsa -enable_ldns_config -enable_rpath -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CPPFLAGS -CC -LDFLAGS -LIBS -CPPFLAGS -PYTHON_VERSION' -ac_subdirs_all='drill' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -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_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$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 ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$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 | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$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 ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - 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 | -n) - 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 ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$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_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=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 ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# 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 the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - 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 - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of ldns 1.6.9:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - --disable-sha2 Disable SHA256 and SHA512 RRSIG support - --disable-gost Disable GOST support - --enable-ecdsa Enable ECDSA support, experimental - --disable-ldns-config disable installation of ldns-config (default=enabled) - --disable-rpath disable hardcoded rpath (default=enabled) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pyldns generate python library, or --without-pyldns to - disable Python support. - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). - --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl - /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw - /usr) - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - PYTHON_VERSION - The installed Python version to use, for example '2.3'. This - string will be appended to the Python interpreter canonical - name. - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -ldns configure 1.6.9 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------- ## -## Report this to libdns@nlnetlabs.nl ## -## ---------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* 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_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl - -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if eval \${$4+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_member -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by ldns $as_me 1.6.9, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# needed to build correct soname -LIBTOOL_VERSION_INFO=1:6:9 - -LDNS_VERSION_MAJOR=1 - -LDNS_VERSION_MINOR=6 - -LDNS_VERSION_MICRO=9 - - -OURCPPFLAGS='' -CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} -CFLAGS="$CFLAGS" - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#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)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : - MINIX=yes -else - MINIX= -fi - - - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h - - -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h - - -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_define___extensions__=yes -else - ac_cv_safe_to_define___extensions__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h - - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h - - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - - - -$as_echo "#define WINVER 0x0502" >>confdefs.h - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 -$as_echo_n "checking whether $CC supports -std=c99... " >&6; } -cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-std=c99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 -$as_echo_n "checking whether $CC supports -xc99... " >&6; } -cache=`echo xc99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-xc99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - -# routine to copy files -# argument 1 is a list of files (relative to the source dir) -# argument 2 is a destination directory (relative to the current -# working directory - - -# copy all .h files in the dir at argument 1 -# (relative to source) to the dir at argument 2 -# (relative to current dir) - - -# Checks for typedefs, structures, and compiler characteristics. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes -else - ac_cv_c_const=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -g" >&5 -$as_echo_n "checking whether $CC supports -g... " >&6; } -cache=`echo g | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -g -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="-g $CFLAGS" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 -$as_echo_n "checking whether $CC supports -O2... " >&6; } -cache=`echo O2 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="-O2 $CFLAGS" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 -$as_echo_n "checking whether $CC supports -Wall... " >&6; } -cache=`echo Wall | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="-Wall $CFLAGS" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -W" >&5 -$as_echo_n "checking whether $CC supports -W... " >&6; } -cache=`echo W | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -W -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="-W $CFLAGS" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wwrite-strings" >&5 -$as_echo_n "checking whether $CC supports -Wwrite-strings... " >&6; } -cache=`echo Wwrite-strings | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Wwrite-strings -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="-Wwrite-strings $CFLAGS" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - -for ac_header in getopt.h time.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -# MinGW32 tests -for ac_header in winsock2.h ws2tcpip.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -# end mingw32 tests - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 -$as_echo_n "checking whether $CC supports -Werror... " >&6; } -cache=`echo Werror | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -ERRFLAG="-Werror" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: -ERRFLAG="-errwarn" -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 -$as_echo_n "checking whether $CC supports -Wall... " >&6; } -cache=`echo Wall | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -ERRFLAG="$ERRFLAG -Wall" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: -ERRFLAG="$ERRFLAG -errfmt" -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 -$as_echo_n "checking whether $CC supports -std=c99... " >&6; } -cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-std=c99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 -$as_echo_n "checking whether $CC supports -xc99... " >&6; } -cache=`echo xc99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-xc99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - -for ac_header in getopt.h time.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC" >&5 -$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE as a flag for $CC... " >&6; } -cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - const char* str = NULL; - struct msghdr msg; - msg.msg_control = 0; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - str = gai_strerror(0); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC" >&5 -$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE as a flag for $CC... " >&6; } -cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - const char* str = NULL; - struct msghdr msg; - msg.msg_control = 0; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - str = gai_strerror(0); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 -$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } -cache=`$as_echo "$C99FLAG" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include -#include -int test() { - int a = 0; - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS $C99FLAG" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_BSD_SOURCE as a flag for $CC" >&5 -$as_echo_n "checking whether we need -D_BSD_SOURCE as a flag for $CC... " >&6; } -cache=_D_BSD_SOURCE -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include - -int test() { - int a; - a = isascii(32); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS -D_BSD_SOURCE" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_BSD_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE as a flag for $CC" >&5 -$as_echo_n "checking whether we need -D_GNU_SOURCE as a flag for $CC... " >&6; } -cache=_D_GNU_SOURCE -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include - -int test() { - struct in6_pktinfo inf; - int a = (int)sizeof(inf); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS -D_GNU_SOURCE" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - -# check again for GNU_SOURCE for setresgid. May fail if setresgid -# is not available at all. -D_FRSRESGID is to make this check unique. -# otherwise we would get the previous cached result. - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC" >&5 -$as_echo_n "checking whether we need -D_GNU_SOURCE -D_FRSRESGID as a flag for $CC... " >&6; } -cache=_D_GNU_SOURCE__D_FRSRESGID -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include - -int test() { - int a = setresgid(0,0,0); - a = setresuid(0,0,0); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS -D_GNU_SOURCE" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_GNU_SOURCE -D_FRSRESGID $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC" >&5 -$as_echo_n "checking whether we need -D_POSIX_C_SOURCE=200112 as a flag for $CC... " >&6; } -cache=`$as_echo "-D_POSIX_C_SOURCE=200112" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include "confdefs.h" -#ifdef HAVE_TIME_H -#include -#endif -#include - -int test() { - int a = 0; - char *t; - time_t time = 0; - char *buf = NULL; - const char* str = NULL; - t = ctime_r(&time, buf); - str = gai_strerror(0); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D_POSIX_C_SOURCE=200112 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need -D__EXTENSIONS__ as a flag for $CC" >&5 -$as_echo_n "checking whether we need -D__EXTENSIONS__ as a flag for $CC... " >&6; } -cache=_D__EXTENSIONS__ -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS -D__EXTENSIONS__" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS -D__EXTENSIONS__ $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" -if test "x$ac_cv_type_int8_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int8_t char -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" -if test "x$ac_cv_type_int16_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int16_t short -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" -if test "x$ac_cv_type_int32_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int32_t int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" -if test "x$ac_cv_type_int64_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int64_t long long -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" -if test "x$ac_cv_type_uint8_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint8_t unsigned char -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" -if test "x$ac_cv_type_uint16_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint16_t unsigned short -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" -if test "x$ac_cv_type_uint32_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint32_t unsigned int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" -if test "x$ac_cv_type_uint64_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint64_t unsigned long long -_ACEOF - -fi - - -# my own checks -# Extract the first word of "doxygen", so it can be a program name with args. -set dummy doxygen; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_doxygen+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$doxygen"; then - ac_cv_prog_doxygen="$doxygen" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_doxygen="doxygen" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -doxygen=$ac_cv_prog_doxygen -if test -n "$doxygen"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $doxygen" >&5 -$as_echo "$doxygen" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - -# check to see if libraries are needed for these functions. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 -$as_echo_n "checking for library containing socket... " >&6; } -if ${ac_cv_search_socket+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char socket (); -int -main () -{ -return socket (); - ; - return 0; -} -_ACEOF -for ac_lib in '' socket; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_socket=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_socket+:} false; then : - break -fi -done -if ${ac_cv_search_socket+:} false; then : - -else - ac_cv_search_socket=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 -$as_echo "$ac_cv_search_socket" >&6; } -ac_res=$ac_cv_search_socket -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 -$as_echo_n "checking for library containing inet_pton... " >&6; } -if ${ac_cv_search_inet_pton+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char inet_pton (); -int -main () -{ -return inet_pton (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_inet_pton=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_inet_pton+:} false; then : - break -fi -done -if ${ac_cv_search_inet_pton+:} false; then : - -else - ac_cv_search_inet_pton=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 -$as_echo "$ac_cv_search_inet_pton" >&6; } -ac_res=$ac_cv_search_inet_pton -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - -# check for python - -# Check whether --with-pyldns was given. -if test "${with_pyldns+set}" = set; then : - withval=$with_pyldns; -else - withval="no" -fi - -ldns_have_python=no -if test x_$withval != x_no; then - - - - ac_save_LIBS="$LIBS" - # - # Allow the use of a (user set) custom python version - # - - - # Extract the first word of "python[$PYTHON_VERSION]", so it can be a program name with args. -set dummy python$PYTHON_VERSION; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_PYTHON+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $PYTHON in - [\\/]* | ?:[\\/]*) - ac_cv_path_PYTHON="$PYTHON" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_PYTHON="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -PYTHON=$ac_cv_path_PYTHON -if test -n "$PYTHON"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5 -$as_echo "$PYTHON" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test -z "$PYTHON"; then - as_fn_error $? "Cannot find python$PYTHON_VERSION in your system path" "$LINENO" 5 - PYTHON_VERSION="" - fi - - if test -z "$PYTHON_VERSION"; then - PYTHON_VERSION=`$PYTHON -c "import sys, string; \ - print string.split(sys.version)[0]"` - fi - - # - # Check for a version of Python >= 2.1.0 - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python >= '2.1.0'" >&5 -$as_echo_n "checking for a version of Python >= '2.1.0'... " >&6; } - ac_supports_python_ver=`$PYTHON -c "import sys, string; \ - ver = string.split(sys.version)[0]; \ - print ver >= '2.1.0'"` - if test "$ac_supports_python_ver" != "True"; then - if test -z "$PYTHON_NOVERSIONCHECK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? " -This version of the AC_PYTHON_DEVEL macro -doesn't work properly with versions of Python before -2.1.0. You may need to re-run configure, setting the -variables PYTHON_CPPFLAGS, PYTHON_LDFLAGS, PYTHON_SITE_PKG, -PYTHON_EXTRA_LIBS and PYTHON_EXTRA_LDFLAGS by hand. -Moreover, to disable this check, set PYTHON_NOVERSIONCHECK -to something else than an empty string. - -See \`config.log' for more details" "$LINENO" 5; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: skip at user request" >&5 -$as_echo "skip at user request" >&6; } - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - fi - - # - # if the macro parameter ``version'' is set, honour it - # - if test -n ""; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a version of Python " >&5 -$as_echo_n "checking for a version of Python ... " >&6; } - ac_supports_python_ver=`$PYTHON -c "import sys, string; \ - ver = string.split(sys.version)[0]; \ - print ver "` - if test "$ac_supports_python_ver" = "True"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "this package requires Python . -If you have it installed, but it isn't the default Python -interpreter in your system path, please pass the PYTHON_VERSION -variable to configure. See \`\`configure --help'' for reference. -" "$LINENO" 5 - PYTHON_VERSION="" - fi - fi - - # - # Check if you have distutils, else fail - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the distutils Python package" >&5 -$as_echo_n "checking for the distutils Python package... " >&6; } - ac_distutils_result=`$PYTHON -c "import distutils" 2>&1` - if test -z "$ac_distutils_result"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "cannot import Python module \"distutils\". -Please check your Python installation. The error was: -$ac_distutils_result" "$LINENO" 5 - PYTHON_VERSION="" - fi - - # - # Check for Python include path - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python include path" >&5 -$as_echo_n "checking for Python include path... " >&6; } - if test -z "$PYTHON_CPPFLAGS"; then - python_path=`$PYTHON -c "import distutils.sysconfig; \ - print distutils.sysconfig.get_python_inc();"` - if test -n "${python_path}"; then - python_path="-I$python_path" - fi - PYTHON_CPPFLAGS=$python_path - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_CPPFLAGS" >&5 -$as_echo "$PYTHON_CPPFLAGS" >&6; } - - - # - # Check for Python library path - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python library path" >&5 -$as_echo_n "checking for Python library path... " >&6; } - if test -z "$PYTHON_LDFLAGS"; then - # (makes two attempts to ensure we've got a version number - # from the interpreter) - py_version=`$PYTHON -c "from distutils.sysconfig import *; \ - from string import join; \ - print join(get_config_vars('VERSION'))"` - if test "$py_version" = "None"; then - if test -n "$PYTHON_VERSION"; then - py_version=$PYTHON_VERSION - else - py_version=`$PYTHON -c "import sys; \ - print sys.version[:3]"` - fi - fi - - PYTHON_LDFLAGS=`$PYTHON -c "from distutils.sysconfig import *; \ - from string import join; \ - print '-L' + get_python_lib(0,1), \ - '-L' + os.path.dirname(get_python_lib(0,1)), \ - '-lpython';"`$py_version - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_LDFLAGS" >&5 -$as_echo "$PYTHON_LDFLAGS" >&6; } - - - # - # Check for site packages - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Python site-packages path" >&5 -$as_echo_n "checking for Python site-packages path... " >&6; } - if test -z "$PYTHON_SITE_PKG"; then - PYTHON_SITE_PKG=`$PYTHON -c "import distutils.sysconfig; \ - print distutils.sysconfig.get_python_lib(0,0);"` - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_SITE_PKG" >&5 -$as_echo "$PYTHON_SITE_PKG" >&6; } - - - # - # libraries which must be linked in when embedding - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra libraries" >&5 -$as_echo_n "checking python extra libraries... " >&6; } - if test -z "$PYTHON_EXTRA_LIBS"; then - PYTHON_EXTRA_LIBS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print conf('LOCALMODLIBS'), conf('LIBS')"` - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LIBS" >&5 -$as_echo "$PYTHON_EXTRA_LIBS" >&6; } - - - # - # linking flags needed when embedding - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking python extra linking flags" >&5 -$as_echo_n "checking python extra linking flags... " >&6; } - if test -z "$PYTHON_EXTRA_LDFLAGS"; then - PYTHON_EXTRA_LDFLAGS=`$PYTHON -c "import distutils.sysconfig; \ - conf = distutils.sysconfig.get_config_var; \ - print conf('LINKFORSHARED')"` - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON_EXTRA_LDFLAGS" >&5 -$as_echo "$PYTHON_EXTRA_LDFLAGS" >&6; } - - - # - # final check to see if everything compiles alright - # - { $as_echo "$as_me:${as_lineno-$LINENO}: checking consistency of all components of python development environment" >&5 -$as_echo_n "checking consistency of all components of python development environment... " >&6; } - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - # save current global flags - LIBS="$ac_save_LIBS $PYTHON_LDFLAGS" - CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #include - -int -main () -{ - - Py_Initialize(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - pythonexists=yes -else - pythonexists=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pythonexists" >&5 -$as_echo "$pythonexists" >&6; } - - if test ! "$pythonexists" = "yes"; then - as_fn_error $? " - Could not link test program to Python. Maybe the main Python library has been - installed in some non-standard library path. If so, pass it to configure, - via the LDFLAGS environment variable. - Example: ./configure LDFLAGS=\"-L/usr/non-standard-path/python/lib\" - ============================================================================ - ERROR! - You probably have to install the development version of the Python package - for your distribution. The exact name of this package varies among them. - ============================================================================ - " "$LINENO" 5 - PYTHON_VERSION="" - fi - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - # turn back to default flags - CPPFLAGS="$ac_save_CPPFLAGS" - LIBS="$ac_save_LIBS" - - # - # all done! - # - - if test ! -z "$PYTHON_VERSION"; then - if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then - as_fn_error $? "Python version >= 2.4.0 is required" "$LINENO" 5 - fi - # Have Python - -$as_echo "#define HAVE_PYTHON 1" >>confdefs.h - - ldns_have_python=yes - fi - - # check for swig - if test x_$ldns_have_python != x_no; then - # =========================================================================== -# http://autoconf-archive.cryp.to/ac_pkg_swig.html -# =========================================================================== -# -# SYNOPSIS -# -# AC_PROG_SWIG([major.minor.micro]) -# -# DESCRIPTION -# -# This macro searches for a SWIG installation on your system. If found you -# should call SWIG via $(SWIG). You can use the optional first argument to -# check if the version of the available SWIG is greater than or equal to -# the value of the argument. It should have the format: N[.N[.N]] (N is a -# number between 0 and 999. Only the first N is mandatory.) -# -# If the version argument is given (e.g. 1.3.17), AC_PROG_SWIG checks that -# the swig package is this version number or higher. -# -# In configure.in, use as: -# -# AC_PROG_SWIG(1.3.17) -# SWIG_ENABLE_CXX -# SWIG_MULTI_MODULE_SUPPORT -# SWIG_PYTHON -# -# LAST MODIFICATION -# -# 2008-04-12 -# -# COPYLEFT -# -# Copyright (c) 2008 Sebastian Huber -# Copyright (c) 2008 Alan W. Irwin -# Copyright (c) 2008 Rafael Laboissiere -# Copyright (c) 2008 Andrew Collier -# -# 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, see . -# -# As a special exception, the respective Autoconf Macro's copyright owner -# gives unlimited permission to copy, distribute and modify the configure -# scripts that are the output of Autoconf when processing the Macro. You -# need not follow the terms of the GNU General Public License when using -# or distributing such scripts, even though portions of the text of the -# Macro appear in them. The GNU General Public License (GPL) does govern -# all other use of the material that constitutes the Autoconf Macro. -# -# This special exception to the GPL applies to versions of the Autoconf -# Macro released by the Autoconf Macro Archive. When you make and -# distribute a modified version of the Autoconf Macro, you may extend this -# special exception to the GPL to apply to your modified version as well. - - - - - # Extract the first word of "swig", so it can be a program name with args. -set dummy swig; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_SWIG+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $SWIG in - [\\/]* | ?:[\\/]*) - ac_cv_path_SWIG="$SWIG" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_SWIG="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -SWIG=$ac_cv_path_SWIG -if test -n "$SWIG"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SWIG" >&5 -$as_echo "$SWIG" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - if test -z "$SWIG" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&5 -$as_echo "$as_me: WARNING: cannot find 'swig' program. You should look at http://www.swig.org" >&2;} - SWIG='echo "Error: SWIG is not installed. You should look at http://www.swig.org" ; false' - elif test -n "" ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SWIG version" >&5 -$as_echo_n "checking for SWIG version... " >&6; } - swig_version=`$SWIG -version 2>&1 | grep 'SWIG Version' | sed 's/.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $swig_version" >&5 -$as_echo "$swig_version" >&6; } - if test -n "$swig_version" ; then - # Calculate the required version number components - required= - required_major=`echo $required | sed 's/[^0-9].*//'` - if test -z "$required_major" ; then - required_major=0 - fi - required=`echo $required | sed 's/[0-9]*[^0-9]//'` - required_minor=`echo $required | sed 's/[^0-9].*//'` - if test -z "$required_minor" ; then - required_minor=0 - fi - required=`echo $required | sed 's/[0-9]*[^0-9]//'` - required_patch=`echo $required | sed 's/[^0-9].*//'` - if test -z "$required_patch" ; then - required_patch=0 - fi - # Calculate the available version number components - available=$swig_version - available_major=`echo $available | sed 's/[^0-9].*//'` - if test -z "$available_major" ; then - available_major=0 - fi - available=`echo $available | sed 's/[0-9]*[^0-9]//'` - available_minor=`echo $available | sed 's/[^0-9].*//'` - if test -z "$available_minor" ; then - available_minor=0 - fi - available=`echo $available | sed 's/[0-9]*[^0-9]//'` - available_patch=`echo $available | sed 's/[^0-9].*//'` - if test -z "$available_patch" ; then - available_patch=0 - fi - if test $available_major -ne $required_major \ - -o $available_minor -ne $required_minor \ - -o $available_patch -lt $required_patch ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: SWIG version >= is required. You have $swig_version. You should look at http://www.swig.org" >&5 -$as_echo "$as_me: WARNING: SWIG version >= is required. You have $swig_version. You should look at http://www.swig.org" >&2;} - SWIG='echo "Error: SWIG version >= is required. You have '"$swig_version"'. You should look at http://www.swig.org" ; false' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG executable is '$SWIG'" >&5 -$as_echo "$as_me: SWIG executable is '$SWIG'" >&6;} - SWIG_LIB=`$SWIG -swiglib` - { $as_echo "$as_me:${as_lineno-$LINENO}: SWIG library directory is '$SWIG_LIB'" >&5 -$as_echo "$as_me: SWIG library directory is '$SWIG_LIB'" >&6;} - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine SWIG version" >&5 -$as_echo "$as_me: WARNING: cannot determine SWIG version" >&2;} - SWIG='echo "Error: Cannot determine SWIG version. You should look at http://www.swig.org" ; false' - fi - fi - - - if test ! -x "$SWIG"; then - as_fn_error $? "failed to find swig tool, install it, or do not build pyldns" "$LINENO" 5 - else - -$as_echo "#define HAVE_SWIG 1" >>confdefs.h - - PYLDNS="pyldns" - - swig="$SWIG" - - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: *** don't have Python, skipping Swig, no pyldns ***" >&5 -$as_echo "*** don't have Python, skipping Swig, no pyldns ***" >&6; } - fi -fi - -# Use libtool -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 - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - - -# skip these tests, we do not need them. - - - - - - - - -# always use ./libtool unless override from commandline (libtool=mylibtool) -if test -z "$libtool"; then - libtool="./libtool" -fi - -# avoid libtool max commandline length test on systems that fork slowly. - -if echo "$host_os" | grep "sunos4" >/dev/null; then - lt_cv_sys_max_cmd_len=32750; -fi -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. -set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $AR in - [\\/]* | ?:[\\/]*) - ac_cv_path_AR="$AR" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_AR="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -AR=$ac_cv_path_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_path_AR"; then - ac_pt_AR=$AR - # Extract the first word of "ar", so it can be a program name with args. -set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_ac_pt_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $ac_pt_AR in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_pt_AR="$ac_pt_AR" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_path_ac_pt_AR="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - - ;; -esac -fi -ac_pt_AR=$ac_cv_path_ac_pt_AR -if test -n "$ac_pt_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_AR" >&5 -$as_echo "$ac_pt_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_pt_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_pt_AR - fi -else - AR="$ac_cv_path_AR" -fi - -if test $AR = false; then - as_fn_error $? "Cannot find 'ar', please extend PATH to include it" "$LINENO" 5 -fi - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4' -macro_revision='1.3293' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Backslashify metacharacters that are still active within -# double-quoted strings. -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' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-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 "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_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 - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_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 extended 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. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_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]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} -: ${AR_FLAGS=cru} - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# 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]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && 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 $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - 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 $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - 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" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&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 - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - - - -# Set options - - - - enable_dlopen=no - - - enable_win32_dll=no - - - # Check whether --enable-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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-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. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -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 - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_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 - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_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 - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - lt_prog_compiler_pic='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # 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 extended regexp 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_|_GLOBAL__F[ID]_.*' - # 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. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # 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 "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, 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 install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_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. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - 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 $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - 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 - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # 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. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''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$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - 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 $linker_flags /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 $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - 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 $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - 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 $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -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" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) 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. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - 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=`func_echo_all "$lib" | $SED '\''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' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - 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" - # 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* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - 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}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - 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" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$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.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent 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 "$_LT_TAGVAR(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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; 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 - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - 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 - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&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 - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - - -tmp_CPPFLAGS=$CPPFLAGS -tmp_LDFLAGS=$LDFLAGS -tmp_LIBS=$LIBS - - - -# Check whether --with-ssl was given. -if test "${with_ssl+set}" = set; then : - withval=$with_ssl; - -else - - withval="yes" - -fi - - - withval=$withval - if test x_$withval != x_no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 -$as_echo_n "checking for SSL... " >&6; } - if test x_$withval = x_ -o x_$withval = x_yes; then - withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" - fi - for dir in $withval; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl="yes" - -cat >>confdefs.h <<_ACEOF -#define HAVE_SSL /**/ -_ACEOF - - if test "$ssldir" != "/usr"; then - CPPFLAGS="$CPPFLAGS -I$ssldir/include" - LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" - fi - break; - fi - done - if test x_$found_ssl != x_yes; then - as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 -$as_echo "found in $ssldir" >&6; } - HAVE_SSL=yes - if test "$ssldir" != "/usr" -a "$ssldir" != ""; then - LDFLAGS="$LDFLAGS -L$ssldir/lib" - LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" - - if test "x$enable_rpath" = xyes; then - if echo "$ssldir/lib" | grep "^/" >/dev/null; then - RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" - fi - fi - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 -$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } - LIBS="$LIBS -lcrypto" - LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - # check if -lwsock32 or -lgdi32 are needed. - BAKLIBS="$LIBS" - BAKSSLLIBS="$LIBSSL_LIBS" - LIBS="$LIBS -lgdi32" - LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 -$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LIBS="$BAKLIBS" - LIBSSL_LIBS="$BAKSSLLIBS" - LIBS="$LIBS -ldl" - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 -$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - - - # openssl engine functionality needs dlopen(). - BAKLIBS="$LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if ${ac_cv_search_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -for ac_lib in '' dl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_dlopen+:} false; then : - break -fi -done -if ${ac_cv_search_dlopen+:} false; then : - -else - ac_cv_search_dlopen=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - if test "$LIBS" != "$BAKLIBS"; then - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - fi - fi -for ac_header in openssl/ssl.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_SSL_H 1 -_ACEOF - -fi - -done - -for ac_header in openssl/err.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_err_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_ERR_H 1 -_ACEOF - -fi - -done - -for ac_header in openssl/rand.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_rand_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_RAND_H 1 -_ACEOF - -fi - -done - - - - -for ac_func in EVP_sha256 -do : - ac_fn_c_check_func "$LINENO" "EVP_sha256" "ac_cv_func_EVP_sha256" -if test "x$ac_cv_func_EVP_sha256" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_EVP_SHA256 1 -_ACEOF - -fi -done - - -# for macosx, see if glibtool exists and use that -# BSD's need to know the version... -#AC_CHECK_PROG(glibtool, glibtool, [glibtool], ) -#AC_CHECK_PROGS(libtool, [libtool15 libtool], [./libtool]) - -# Check whether --enable-sha2 was given. -if test "${enable_sha2+set}" = set; then : - enableval=$enable_sha2; -fi - -case "$enable_sha2" in - no) - ;; - yes|*) - if test "x$HAVE_SSL" != "xyes"; then - as_fn_error $? "SHA2 enabled, but no SSL support" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHA256 and SHA512" >&5 -$as_echo_n "checking for SHA256 and SHA512... " >&6; } - ac_fn_c_check_func "$LINENO" "SHA256_Init" "ac_cv_func_SHA256_Init" -if test "x$ac_cv_func_SHA256_Init" = xyes; then : - -else - - as_fn_error $? "No SHA2 functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-sha2" "$LINENO" 5 - -fi - - -cat >>confdefs.h <<_ACEOF -#define USE_SHA2 1 -_ACEOF - - ;; -esac - -# Check whether --enable-gost was given. -if test "${enable_gost+set}" = set; then : - enableval=$enable_gost; -fi - -case "$enable_gost" in - no) - ;; - *) if test "x$HAVE_SSL" != "xyes"; then - as_fn_error $? "GOST enabled, but no SSL support" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOST" >&5 -$as_echo_n "checking for GOST... " >&6; } - ac_fn_c_check_func "$LINENO" "EVP_PKEY_set_type_str" "ac_cv_func_EVP_PKEY_set_type_str" -if test "x$ac_cv_func_EVP_PKEY_set_type_str" = xyes; then : - -else - as_fn_error $? "OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost" "$LINENO" 5 -fi - - ac_fn_c_check_func "$LINENO" "EC_KEY_new" "ac_cv_func_EC_KEY_new" -if test "x$ac_cv_func_EC_KEY_new" = xyes; then : - -else - as_fn_error $? "No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost" "$LINENO" 5 -fi - - -cat >>confdefs.h <<_ACEOF -#define USE_GOST 1 -_ACEOF - - ;; -esac - -# Check whether --enable-ecdsa was given. -if test "${enable_ecdsa+set}" = set; then : - enableval=$enable_ecdsa; -fi - -case "$enable_ecdsa" in - yes) - if test "x$HAVE_SSL" != "xyes"; then - as_fn_error $? "ECDSA enabled, but no SSL support" "$LINENO" 5 - fi - ac_fn_c_check_func "$LINENO" "ECDSA_sign" "ac_cv_func_ECDSA_sign" -if test "x$ac_cv_func_ECDSA_sign" = xyes; then : - -else - as_fn_error $? "OpenSSL does not support ECDSA" "$LINENO" 5 -fi - - ac_fn_c_check_func "$LINENO" "SHA384_Init" "ac_cv_func_SHA384_Init" -if test "x$ac_cv_func_SHA384_Init" = xyes; then : - -else - as_fn_error $? "OpenSSL does not support SHA384" "$LINENO" 5 -fi - - ac_fn_c_check_decl "$LINENO" "NID_X9_62_prime256v1" "ac_cv_have_decl_NID_X9_62_prime256v1" "$ac_includes_default -#include - -" -if test "x$ac_cv_have_decl_NID_X9_62_prime256v1" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_NID_X9_62_PRIME256V1 $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - as_fn_error $? "OpenSSL does not support the ECDSA curve" "$LINENO" 5 -fi -ac_fn_c_check_decl "$LINENO" "NID_secp384r1" "ac_cv_have_decl_NID_secp384r1" "$ac_includes_default -#include - -" -if test "x$ac_cv_have_decl_NID_secp384r1" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_NID_SECP384R1 $ac_have_decl -_ACEOF -if test $ac_have_decl = 1; then : - -else - as_fn_error $? "OpenSSL does not support the ECDSA curve" "$LINENO" 5 -fi - - # we now know we have ECDSA and the required curves. - -cat >>confdefs.h <<_ACEOF -#define USE_ECDSA 1 -_ACEOF - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: - ***************************************************************** - *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** - *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** - *****************************************************************" >&5 -$as_echo "$as_me: WARNING: - ***************************************************************** - *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** - *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** - *****************************************************************" >&2;} - ;; - no) - ;; - *) - ;; -esac - - - - -CPPFLAGS=$tmp_CPPFLAGS -LDFLAGS=$tmp_LDFLAGS -LIBS=$tmp_LIBS - -# add option to disable installation of ldns-config script -# Check whether --enable-ldns-config was given. -if test "${enable_ldns_config+set}" = set; then : - enableval=$enable_ldns_config; enable_ldns_config=$enableval -else - enable_ldns_config=yes -fi - -if test "x$enable_ldns_config" = xyes; then - INSTALL_LDNS_CONFIG="yes" -else - INSTALL_LDNS_CONFIG="no" -fi - - -# add option to disable the evil rpath - -# Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : - enableval=$enable_rpath; enable_rpath=$enableval -else - enable_rpath=yes -fi - -if test "x$enable_rpath" = xno; then - ac_config_commands="$ac_config_commands disable-rpath" - -fi - - -#AC_TRY_RUN( -#[ -#int main() -#{ -#short one = 1; -#char *cp = (char*)&one; -#if ( *cp == 0 ) -#return(0); -#else -#return(1); -#} -#], [],[ -#AC_DEFINE(CONFCHECK_LITTLE_ENDIAN, 1, [system appears to be little-endian]) -#],[]) - -# should define WORDS_BIGENDIAN if the system is big-endian - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - - # Check for potential -arch flags. It is not universal unless - # there are at least two -arch flags with different values. - ac_arch= - ac_prev= - for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do - if test -n "$ac_prev"; then - case $ac_word in - i?86 | x86_64 | ppc | ppc64) - if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then - ac_arch=$ac_word - else - ac_cv_c_bigendian=universal - break - fi - ;; - esac - ac_prev= - elif test "x$ac_word" = "x-arch"; then - ac_prev=arch - fi - done -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -int -main () -{ -#ifndef _BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then : - # Try to guess by grepping values from an object file. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - -int -main () -{ -return use_ascii (foo) == use_ebcdic (foo); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h -;; #( - no) - ;; #( - universal) - -$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h - - ;; #( - *) - as_fn_error $? "unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; - esac - - -# Checks for header files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#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)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -#AC_HEADER_SYS_WAIT -#AC_CHECK_HEADERS([getopt.h fcntl.h stdlib.h string.h strings.h unistd.h]) -# do the very minimum - we can always extend this -for ac_header in getopt.h stdarg.h stdbool.h openssl/ssl.h netinet/in.h time.h arpa/inet.h netdb.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in sys/param.h sys/mount.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default - - #if HAVE_SYS_PARAM_H - # include - #endif - - -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -ac_fn_c_check_header_compile "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default - - #if HAVE_SYS_PARAM_H - # include - #endif - - -" -if test "x$ac_cv_header_sys_socket_h" = xyes; then : - -include_sys_socket_h='#include ' - -$as_echo "#define HAVE_SYS_SOCKET_H 1" >>confdefs.h - - -else - -include_sys_socket_h='' - -fi - - - -ac_fn_c_check_header_compile "$LINENO" "inttypes.h" "ac_cv_header_inttypes_h" "$ac_includes_default - -" -if test "x$ac_cv_header_inttypes_h" = xyes; then : - -include_inttypes_h='#include ' - -$as_echo "#define HAVE_INTTYPES_H 1" >>confdefs.h - - -else - -include_inttypes_h='' - -fi - - - -ac_fn_c_check_header_compile "$LINENO" "sys/types.h" "ac_cv_header_sys_types_h" "$ac_includes_default - -" -if test "x$ac_cv_header_sys_types_h" = xyes; then : - -include_systypes_h='#include ' - -$as_echo "#define HAVE_SYS_TYPES_H 1" >>confdefs.h - - -else - -include_systypes_h='' - -fi - - - -ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default - -" -if test "x$ac_cv_header_unistd_h" = xyes; then : - -include_unistd_h='#include ' - -$as_echo "#define HAVE_UNISTD_H 1" >>confdefs.h - - -else - -include_unistd_h='' - -fi - - - - - -ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " -$ac_includes_default -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_WS2TCPIP_H -# include -#endif - -" -if test "x$ac_cv_type_socklen_t" = xyes; then : - -else - -$as_echo "#define socklen_t int" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define ssize_t int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -" -if test "x$ac_cv_type_in_addr_t" = xyes; then : - -else - -$as_echo "#define in_addr_t uint32_t" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -" -if test "x$ac_cv_type_in_port_t" = xyes; then : - -else - -$as_echo "#define in_port_t uint16_t" >>confdefs.h - -fi - -ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "ss_family" "ac_cv_member_struct_sockaddr_storage_ss_family" "$ac_includes_default -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -" -if test "x$ac_cv_member_struct_sockaddr_storage_ss_family" = xyes; then : - -else - - ac_fn_c_check_member "$LINENO" "struct sockaddr_storage" "__ss_family" "ac_cv_member_struct_sockaddr_storage___ss_family" "$ac_includes_default -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -" -if test "x$ac_cv_member_struct_sockaddr_storage___ss_family" = xyes; then : - - -$as_echo "#define ss_family __ss_family" >>confdefs.h - - -fi - - -fi - - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 -$as_echo_n "checking for GNU libc compatible malloc... " >&6; } -if ${ac_cv_func_malloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_malloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *malloc (); -#endif - -int -main () -{ -return ! malloc (0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_malloc_0_nonnull=yes -else - ac_cv_func_malloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } -if test $ac_cv_func_malloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_MALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_MALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" malloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS malloc.$ac_objext" - ;; -esac - - -$as_echo "#define malloc rpl_malloc" >>confdefs.h - -fi - - -for ac_header in stdlib.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" -if test "x$ac_cv_header_stdlib_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_STDLIB_H 1 -_ACEOF - -fi - -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5 -$as_echo_n "checking for GNU libc compatible realloc... " >&6; } -if ${ac_cv_func_realloc_0_nonnull+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_realloc_0_nonnull=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#if defined STDC_HEADERS || defined HAVE_STDLIB_H -# include -#else -char *realloc (); -#endif - -int -main () -{ -return ! realloc (0, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_realloc_0_nonnull=yes -else - ac_cv_func_realloc_0_nonnull=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5 -$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; } -if test $ac_cv_func_realloc_0_nonnull = yes; then : - -$as_echo "#define HAVE_REALLOC 1" >>confdefs.h - -else - $as_echo "#define HAVE_REALLOC 0" >>confdefs.h - - case " $LIBOBJS " in - *" realloc.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS realloc.$ac_objext" - ;; -esac - - -$as_echo "#define realloc rpl_realloc" >>confdefs.h - -fi - - - -ac_fn_c_check_func "$LINENO" "b64_pton" "ac_cv_func_b64_pton" -if test "x$ac_cv_func_b64_pton" = xyes; then : - $as_echo "#define HAVE_B64_PTON 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" b64_pton.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS b64_pton.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "b64_ntop" "ac_cv_func_b64_ntop" -if test "x$ac_cv_func_b64_ntop" = xyes; then : - $as_echo "#define HAVE_B64_NTOP 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" b64_ntop.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS b64_ntop.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "b32_pton" "ac_cv_func_b32_pton" -if test "x$ac_cv_func_b32_pton" = xyes; then : - $as_echo "#define HAVE_B32_PTON 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" b32_pton.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS b32_pton.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "b32_ntop" "ac_cv_func_b32_ntop" -if test "x$ac_cv_func_b32_ntop" = xyes; then : - $as_echo "#define HAVE_B32_NTOP 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" b32_ntop.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS b32_ntop.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" -if test "x$ac_cv_func_timegm" = xyes; then : - $as_echo "#define HAVE_TIMEGM 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" timegm.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS timegm.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "gmtime_r" "ac_cv_func_gmtime_r" -if test "x$ac_cv_func_gmtime_r" = xyes; then : - $as_echo "#define HAVE_GMTIME_R 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" gmtime_r.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS gmtime_r.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "ctime_r" "ac_cv_func_ctime_r" -if test "x$ac_cv_func_ctime_r" = xyes; then : - $as_echo "#define HAVE_CTIME_R 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" ctime_r.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS ctime_r.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "isblank" "ac_cv_func_isblank" -if test "x$ac_cv_func_isblank" = xyes; then : - $as_echo "#define HAVE_ISBLANK 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" isblank.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS isblank.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "isascii" "ac_cv_func_isascii" -if test "x$ac_cv_func_isascii" = xyes; then : - $as_echo "#define HAVE_ISASCII 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" isascii.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS isascii.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "inet_aton" "ac_cv_func_inet_aton" -if test "x$ac_cv_func_inet_aton" = xyes; then : - $as_echo "#define HAVE_INET_ATON 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" inet_aton.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS inet_aton.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton" -if test "x$ac_cv_func_inet_pton" = xyes; then : - $as_echo "#define HAVE_INET_PTON 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" inet_pton.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS inet_pton.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop" -if test "x$ac_cv_func_inet_ntop" = xyes; then : - $as_echo "#define HAVE_INET_NTOP 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" inet_ntop.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS inet_ntop.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" -if test "x$ac_cv_func_snprintf" = xyes; then : - $as_echo "#define HAVE_SNPRINTF 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" snprintf.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS snprintf.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "strlcpy" "ac_cv_func_strlcpy" -if test "x$ac_cv_func_strlcpy" = xyes; then : - $as_echo "#define HAVE_STRLCPY 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" strlcpy.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS strlcpy.$ac_objext" - ;; -esac - -fi - - -ac_fn_c_check_func "$LINENO" "memmove" "ac_cv_func_memmove" -if test "x$ac_cv_func_memmove" = xyes; then : - $as_echo "#define HAVE_MEMMOVE 1" >>confdefs.h - -else - case " $LIBOBJS " in - *" memmove.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS memmove.$ac_objext" - ;; -esac - -fi - - -for ac_func in endprotoent endservent sleep random fcntl strtoul -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 -$as_echo_n "checking for getaddrinfo... " >&6; } -ac_cv_func_getaddrinfo=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef __cplusplus -extern "C" -{ -#endif -char* getaddrinfo(); -char* (*f) () = getaddrinfo; -#ifdef __cplusplus -} -#endif -int main() { - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_getaddrinfo="yes" -else - ORIGLIBS="$LIBS" -LIBS="$LIBS -lws2_32" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -int -main () -{ - - (void)getaddrinfo(NULL, NULL, NULL, NULL); - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -ac_cv_func_getaddrinfo="yes" - -$as_echo "#define USE_WINSOCK 1" >>confdefs.h - -USE_WINSOCK="1" - -else - -ac_cv_func_getaddrinfo="no" -LIBS="$ORIGLIBS" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 -$as_echo "$ac_cv_func_getaddrinfo" >&6; } -if test $ac_cv_func_getaddrinfo = yes; then - -$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h - -fi - -if test $ac_cv_func_getaddrinfo = no; then - case " $LIBOBJS " in - *" fake-rfc2553.$ac_objext "* ) ;; - *) LIBOBJS="$LIBOBJS fake-rfc2553.$ac_objext" - ;; -esac - -fi -if test "$USE_WINSOCK" = 1; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}windres", so it can be a program name with args. -set dummy ${ac_tool_prefix}windres; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_WINDRES+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$WINDRES"; then - ac_cv_prog_WINDRES="$WINDRES" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_WINDRES="${ac_tool_prefix}windres" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -WINDRES=$ac_cv_prog_WINDRES -if test -n "$WINDRES"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WINDRES" >&5 -$as_echo "$WINDRES" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_WINDRES"; then - ac_ct_WINDRES=$WINDRES - # Extract the first word of "windres", so it can be a program name with args. -set dummy windres; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_WINDRES+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_WINDRES"; then - ac_cv_prog_ac_ct_WINDRES="$ac_ct_WINDRES" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_WINDRES="windres" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_WINDRES=$ac_cv_prog_ac_ct_WINDRES -if test -n "$ac_ct_WINDRES"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_WINDRES" >&5 -$as_echo "$ac_ct_WINDRES" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_WINDRES" = x; then - WINDRES="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - WINDRES=$ac_ct_WINDRES - fi -else - WINDRES="$ac_cv_prog_WINDRES" -fi - -fi - -# check ioctlsocket -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ioctlsocket" >&5 -$as_echo_n "checking for ioctlsocket... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef HAVE_WINSOCK2_H -#include -#endif - -int -main () -{ - - (void)ioctlsocket(0, 0, NULL); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_IOCTLSOCKET 1" >>confdefs.h - - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - - -#AC_SEARCH_LIBS(RSA_new, [crypto]) - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"format\" attribute" >&5 -$as_echo_n "checking whether the C compiler (${CC-cc}) accepts the \"format\" attribute... " >&6; } -if ${ac_cv_c_format_attribute+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_format_attribute=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -void f (char *format, ...) __attribute__ ((format (printf, 1, 2))); -void (*pf) (char *format, ...) __attribute__ ((format (printf, 1, 2))); - -int -main () -{ - - f ("%s", "str"); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_format_attribute="yes" -else - ac_cv_c_format_attribute="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_format_attribute" >&5 -$as_echo "$ac_cv_c_format_attribute" >&6; } -if test $ac_cv_c_format_attribute = yes; then - -$as_echo "#define HAVE_ATTR_FORMAT 1" >>confdefs.h - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler (${CC-cc}) accepts the \"unused\" attribute" >&5 -$as_echo_n "checking whether the C compiler (${CC-cc}) accepts the \"unused\" attribute... " >&6; } -if ${ac_cv_c_unused_attribute+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_unused_attribute=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -void f (char *u __attribute__((unused))); - -int -main () -{ - - f ("x"); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_unused_attribute="yes" -else - ac_cv_c_unused_attribute="no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_unused_attribute" >&5 -$as_echo "$ac_cv_c_unused_attribute" >&6; } -if test $ac_cv_c_unused_attribute = yes; then - -$as_echo "#define HAVE_ATTR_UNUSED 1" >>confdefs.h - -fi - - -# check OSX deployment target which is needed -if echo $build_os | grep darwin > /dev/null; then - export MACOSX_DEPLOYMENT_TARGET="10.4" -fi - - -$as_echo "#define SYSCONFDIR sysconfdir" >>confdefs.h - - - - - - -ac_config_files="$ac_config_files Makefile ldns/net.h ldns/util.h packaging/libldns.pc packaging/ldns-config" - - -ac_config_headers="$ac_config_headers ldns/config.h" - -cat >confcache <<\_ACEOF -# 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, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# 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. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by ldns $as_me 1.6.9, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -ldns config.status 1.6.9 -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in SHELL \ -ECHO \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -OBJDUMP \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -DLLTOOL \ -sharedlib_from_linklib_cmd \ -AR \ -AR_FLAGS \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -nm_file_list_spec \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "disable-rpath") CONFIG_COMMANDS="$CONFIG_COMMANDS disable-rpath" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "ldns/net.h") CONFIG_FILES="$CONFIG_FILES ldns/net.h" ;; - "ldns/util.h") CONFIG_FILES="$CONFIG_FILES ldns/util.h" ;; - "packaging/libldns.pc") CONFIG_FILES="$CONFIG_FILES packaging/libldns.pc" ;; - "packaging/ldns-config") CONFIG_FILES="$CONFIG_FILES packaging/ldns-config" ;; - "ldns/config.h") CONFIG_HEADERS="$CONFIG_HEADERS ldns/config.h" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #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. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool 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. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="" - -# ### BEGIN LIBTOOL CONFIG - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# An object symbol dumper. -OBJDUMP=$lt_OBJDUMP - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot=$lt_sysroot - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# 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 - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_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=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$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 - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# 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 - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# 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 -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # 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? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - ;; - "disable-rpath":C) - sed < libtool > libtool-2 \ - 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_RPATH_SED__ "/' - mv libtool-2 libtool - chmod 755 libtool - libtool="./libtool" - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - -echo "copying header files" - -for file in $srcdir/ldns//*.h; do - sh $srcdir/install-sh -m 644 $file ldns/ -done - - - - - -subdirs="$subdirs drill" - diff --git a/libs/ldns/configure.ac b/libs/ldns/configure.ac deleted file mode 100644 index d4aa2b030e..0000000000 --- a/libs/ldns/configure.ac +++ /dev/null @@ -1,488 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. -AC_PREREQ(2.56) -sinclude(acx_nlnetlabs.m4) - -# must be numbers. ac_defun because of later processing. -m4_define([VERSION_MAJOR],[1]) -m4_define([VERSION_MINOR],[6]) -m4_define([VERSION_MICRO],[9]) -AC_INIT(ldns, m4_defn([VERSION_MAJOR]).m4_defn([VERSION_MINOR]).m4_defn([VERSION_MICRO]), libdns@nlnetlabs.nl, libdns) -AC_CONFIG_SRCDIR([packet.c]) -# needed to build correct soname -AC_SUBST(LIBTOOL_VERSION_INFO, VERSION_MAJOR:VERSION_MINOR:VERSION_MICRO) -AC_SUBST(LDNS_VERSION_MAJOR, [VERSION_MAJOR]) -AC_SUBST(LDNS_VERSION_MINOR, [VERSION_MINOR]) -AC_SUBST(LDNS_VERSION_MICRO, [VERSION_MICRO]) - -OURCPPFLAGS='' -CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} -CFLAGS="$CFLAGS" - -AC_AIX -# Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET - -AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) - -ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) -ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) - -# routine to copy files -# argument 1 is a list of files (relative to the source dir) -# argument 2 is a destination directory (relative to the current -# working directory -AC_DEFUN([COPY_FILES], -[ -for file in $1; do - sh $srcdir/install-sh -m 644 $file $2 -done -]) - -# copy all .h files in the dir at argument 1 -# (relative to source) to the dir at argument 2 -# (relative to current dir) -AC_DEFUN([COPY_HEADER_FILES], -[ -echo "copying header files" -COPY_FILES($srcdir/$1/*.h, $2) -]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_LANG_C -ACX_CHECK_COMPILER_FLAG(g, [CFLAGS="-g $CFLAGS"]) -ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="-O2 $CFLAGS"]) -ACX_CHECK_COMPILER_FLAG(Wall, [CFLAGS="-Wall $CFLAGS"]) -ACX_CHECK_COMPILER_FLAG(W, [CFLAGS="-W $CFLAGS"]) -ACX_CHECK_COMPILER_FLAG(Wwrite-strings, [CFLAGS="-Wwrite-strings $CFLAGS"]) - -AC_CHECK_HEADERS([getopt.h time.h],,, [AC_INCLUDES_DEFAULT]) - -# MinGW32 tests -AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) -# end mingw32 tests - -ACX_DETERMINE_EXT_FLAGS_UNBOUND - -AC_C_INLINE -AC_CHECK_TYPE(int8_t, char) -AC_CHECK_TYPE(int16_t, short) -AC_CHECK_TYPE(int32_t, int) -AC_CHECK_TYPE(int64_t, long long) -AC_CHECK_TYPE(uint8_t, unsigned char) -AC_CHECK_TYPE(uint16_t, unsigned short) -AC_CHECK_TYPE(uint32_t, unsigned int) -AC_CHECK_TYPE(uint64_t, unsigned long long) - -# my own checks -AC_CHECK_PROG(doxygen, doxygen, doxygen) - -# check to see if libraries are needed for these functions. -AC_SEARCH_LIBS([socket], [socket]) -AC_SEARCH_LIBS([inet_pton], [nsl]) - -# check for python -AC_ARG_WITH(pyldns, AC_HELP_STRING([--with-pyldns], - [generate python library, or --without-pyldns to disable Python support.]), - [],[ withval="no" ]) -ldns_have_python=no -if test x_$withval != x_no; then - sinclude(acx_python.m4) - ac_save_LIBS="$LIBS" dnl otherwise AC_PYTHON_DEVEL thrashes $LIBS - AC_PYTHON_DEVEL - if test ! -z "$PYTHON_VERSION"; then - if test `$PYTHON -c "print '$PYTHON_VERSION' >= '2.4.0'"` = "False"; then - AC_ERROR([Python version >= 2.4.0 is required]) - fi - # Have Python - AC_DEFINE(HAVE_PYTHON,1,[Define if you have Python libraries and header files.]) - ldns_have_python=yes - fi - - # check for swig - if test x_$ldns_have_python != x_no; then - sinclude(ac_pkg_swig.m4) - AC_PROG_SWIG - if test ! -x "$SWIG"; then - AC_ERROR([failed to find swig tool, install it, or do not build pyldns]) - else - AC_DEFINE(HAVE_SWIG,1,[Define if you have Swig libraries and header files.]) - AC_SUBST(PYLDNS, "pyldns") - AC_SUBST(swig, "$SWIG") - fi - else - AC_MSG_RESULT([*** don't have Python, skipping Swig, no pyldns ***]) - fi -fi - -# Use libtool -ACX_LIBTOOL_C_ONLY - -tmp_CPPFLAGS=$CPPFLAGS -tmp_LDFLAGS=$LDFLAGS -tmp_LIBS=$LIBS - -ACX_WITH_SSL_OPTIONAL - -AC_CHECK_FUNCS([EVP_sha256]) - -# for macosx, see if glibtool exists and use that -# BSD's need to know the version... -#AC_CHECK_PROG(glibtool, glibtool, [glibtool], ) -#AC_CHECK_PROGS(libtool, [libtool15 libtool], [./libtool]) - -AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) -case "$enable_sha2" in - no) - ;; - yes|*) - if test "x$HAVE_SSL" != "xyes"; then - AC_MSG_ERROR([SHA2 enabled, but no SSL support]) - fi - AC_MSG_CHECKING(for SHA256 and SHA512) - AC_CHECK_FUNC(SHA256_Init, [], [ - AC_MSG_ERROR([No SHA2 functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-sha2]) - ]) - AC_DEFINE_UNQUOTED([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) - ;; -esac - -AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) -case "$enable_gost" in - no) - ;; - *) dnl default - if test "x$HAVE_SSL" != "xyes"; then - AC_MSG_ERROR([GOST enabled, but no SSL support]) - fi - AC_MSG_CHECKING(for GOST) - AC_CHECK_FUNC(EVP_PKEY_set_type_str, [],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost])]) - AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost])]) - AC_DEFINE_UNQUOTED([USE_GOST], [1], [Define this to enable GOST support.]) - ;; -esac - -AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--enable-ecdsa], [Enable ECDSA support, experimental])) -case "$enable_ecdsa" in - yes) - if test "x$HAVE_SSL" != "xyes"; then - AC_MSG_ERROR([ECDSA enabled, but no SSL support]) - fi - AC_CHECK_FUNC(ECDSA_sign, [], [AC_MSG_ERROR([OpenSSL does not support ECDSA])]) - AC_CHECK_FUNC(SHA384_Init, [], [AC_MSG_ERROR([OpenSSL does not support SHA384])]) - AC_CHECK_DECLS([NID_X9_62_prime256v1, NID_secp384r1], [], [AC_MSG_ERROR([OpenSSL does not support the ECDSA curve])], [AC_INCLUDES_DEFAULT -#include - ]) - # we now know we have ECDSA and the required curves. - AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) - AC_WARN([ - ***************************************************************** - *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** - *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** - *****************************************************************]) - ;; - no) - ;; - *) - ;; -esac - -AC_SUBST(LIBSSL_CPPFLAGS) -AC_SUBST(LIBSSL_LDFLAGS) -AC_SUBST(LIBSSL_LIBS) -CPPFLAGS=$tmp_CPPFLAGS -LDFLAGS=$tmp_LDFLAGS -LIBS=$tmp_LIBS - -# add option to disable installation of ldns-config script -AC_ARG_ENABLE(ldns-config, [ --disable-ldns-config disable installation of ldns-config (default=enabled)], - enable_ldns_config=$enableval, enable_ldns_config=yes) -if test "x$enable_ldns_config" = xyes; then - INSTALL_LDNS_CONFIG="yes" -else - INSTALL_LDNS_CONFIG="no" -fi -AC_SUBST(INSTALL_LDNS_CONFIG) - -# add option to disable the evil rpath -ACX_ARG_RPATH - -#AC_TRY_RUN( -#[ -#int main() -#{ -#short one = 1; -#char *cp = (char*)&one; -#if ( *cp == 0 ) -#return(0); -#else -#return(1); -#} -#], [],[ -#AC_DEFINE(CONFCHECK_LITTLE_ENDIAN, 1, [system appears to be little-endian]) -#],[]) - -# should define WORDS_BIGENDIAN if the system is big-endian -AC_C_BIGENDIAN - -# Checks for header files. -AC_HEADER_STDC -#AC_HEADER_SYS_WAIT -#AC_CHECK_HEADERS([getopt.h fcntl.h stdlib.h string.h strings.h unistd.h]) -# do the very minimum - we can always extend this -AC_CHECK_HEADERS([getopt.h stdarg.h stdbool.h openssl/ssl.h netinet/in.h time.h arpa/inet.h netdb.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS(sys/param.h sys/mount.h,,, -[AC_INCLUDES_DEFAULT - [ - #if HAVE_SYS_PARAM_H - # include - #endif - ] -]) -AC_CHECK_HEADER(sys/socket.h, -[ -include_sys_socket_h='#include ' -AC_DEFINE(HAVE_SYS_SOCKET_H, 1, [define if you have sys/socket.h]) -],[ -include_sys_socket_h='' -],[AC_INCLUDES_DEFAULT - [ - #if HAVE_SYS_PARAM_H - # include - #endif - ] -]) -AC_SUBST(include_sys_socket_h) -AC_CHECK_HEADER(inttypes.h, -[ -include_inttypes_h='#include ' -AC_DEFINE(HAVE_INTTYPES_H, 1, [define if you have inttypes.h]) -],[ -include_inttypes_h='' -],[AC_INCLUDES_DEFAULT -]) -AC_SUBST(include_inttypes_h) -AC_CHECK_HEADER(sys/types.h, -[ -include_systypes_h='#include ' -AC_DEFINE(HAVE_SYS_TYPES_H, 1, [define if you have sys/types.h]) -],[ -include_systypes_h='' -],[AC_INCLUDES_DEFAULT -]) -AC_SUBST(include_systypes_h) -AC_CHECK_HEADER(unistd.h, -[ -include_unistd_h='#include ' -AC_DEFINE(HAVE_UNISTD_H, 1, [define if you have unistd.h]) -],[ -include_unistd_h='' -],[AC_INCLUDES_DEFAULT -]) -AC_SUBST(include_unistd_h) - -ACX_TYPE_SOCKLEN_T -AC_CHECK_TYPE(ssize_t, int) -AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif]) -AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif]) -ACX_CHECK_SS_FAMILY - -AC_FUNC_MALLOC -AC_FUNC_REALLOC - -AC_REPLACE_FUNCS(b64_pton) -AC_REPLACE_FUNCS(b64_ntop) -AC_REPLACE_FUNCS(b32_pton) -AC_REPLACE_FUNCS(b32_ntop) -AC_REPLACE_FUNCS(timegm) -AC_REPLACE_FUNCS(gmtime_r) -AC_REPLACE_FUNCS(ctime_r) -AC_REPLACE_FUNCS(isblank) -AC_REPLACE_FUNCS(isascii) -AC_REPLACE_FUNCS(inet_aton) -AC_REPLACE_FUNCS(inet_pton) -AC_REPLACE_FUNCS(inet_ntop) -AC_REPLACE_FUNCS(snprintf) -AC_REPLACE_FUNCS(strlcpy) -AC_REPLACE_FUNCS(memmove) -AC_CHECK_FUNCS([endprotoent endservent sleep random fcntl strtoul]) - -ACX_CHECK_GETADDRINFO_WITH_INCLUDES -if test $ac_cv_func_getaddrinfo = no; then - AC_LIBOBJ([fake-rfc2553]) -fi -if test "$USE_WINSOCK" = 1; then - AC_CHECK_TOOL(WINDRES, windres) -fi -ACX_FUNC_IOCTLSOCKET - -#AC_SEARCH_LIBS(RSA_new, [crypto]) - -ACX_CHECK_FORMAT_ATTRIBUTE -ACX_CHECK_UNUSED_ATTRIBUTE - -# check OSX deployment target which is needed -if echo $build_os | grep darwin > /dev/null; then - export MACOSX_DEPLOYMENT_TARGET="10.4" -fi - -AC_DEFINE([SYSCONFDIR], [sysconfdir], [System configuration dir]) - -AH_BOTTOM([ -#include -#include -#include -#include - -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN 1234 -#endif - -#ifndef BIG_ENDIAN -#define BIG_ENDIAN 4321 -#endif - -#ifndef BYTE_ORDER -#ifdef WORDS_BIGENDIAN -#define BYTE_ORDER BIG_ENDIAN -#else -#define BYTE_ORDER LITTLE_ENDIAN -#endif /* WORDS_BIGENDIAN */ -#endif /* BYTE_ORDER */ - -#if STDC_HEADERS -#include -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif -] -AHX_CONFIG_W32_FD_SET_T -) - -AH_BOTTOM([ -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef B64_PTON -int ldns_b64_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -/** - * calculates the size needed to store the result of b64_ntop - */ -/*@unused@*/ -static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) -{ - return ((((srcsize + 2) / 3) * 4) + 1); -} -#endif /* !B64_PTON */ -#ifndef B64_NTOP -int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); -/** - * calculates the size needed to store the result of ldns_b64_pton - */ -/*@unused@*/ -static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) -{ - return (((((srcsize + 3) / 4) * 3)) + 1); -} -#endif /* !B64_NTOP */ - -#ifndef HAVE_SLEEP -/* use windows sleep, in millisecs, instead */ -#define sleep(x) Sleep((x)*1000) -#endif - -#ifndef HAVE_RANDOM -#define srandom(x) srand(x) -#define random(x) rand(x) -#endif - -#ifndef HAVE_TIMEGM -#include -time_t timegm (struct tm *tm); -#endif /* !TIMEGM */ -#ifndef HAVE_GMTIME_R -struct tm *gmtime_r(const time_t *timep, struct tm *result); -#endif -#ifndef HAVE_ISBLANK -int isblank(int c); -#endif /* !HAVE_ISBLANK */ -#ifndef HAVE_ISASCII -int isascii(int c); -#endif /* !HAVE_ISASCII */ -#ifndef HAVE_SNPRINTF -#include -int snprintf (char *str, size_t count, const char *fmt, ...); -int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); -#endif /* HAVE_SNPRINTF */ -#ifndef HAVE_INET_PTON -int inet_pton(int af, const char* src, void* dst); -#endif /* HAVE_INET_PTON */ -#ifndef HAVE_INET_NTOP -const char *inet_ntop(int af, const void *src, char *dst, size_t size); -#endif -#ifndef HAVE_INET_ATON -int inet_aton(const char *cp, struct in_addr *addr); -#endif -#ifndef HAVE_MEMMOVE -void *memmove(void *dest, const void *src, size_t n); -#endif -#ifndef HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t siz); -#endif -#ifdef __cplusplus -} -#endif -#ifndef HAVE_GETADDRINFO -#include "compat/fake-rfc2553.h" -#endif -#ifndef HAVE_STRTOUL -#define strtoul (unsigned long)strtol -#endif -]) - -AC_CONFIG_FILES([Makefile ldns/net.h ldns/util.h packaging/libldns.pc packaging/ldns-config]) - -AC_CONFIG_HEADER([ldns/config.h]) -AC_OUTPUT -COPY_HEADER_FILES(ldns/, ldns/) - -AC_CONFIG_SUBDIRS([drill]) diff --git a/libs/ldns/configure.gnu b/libs/ldns/configure.gnu deleted file mode 100644 index 2fae4310cd..0000000000 --- a/libs/ldns/configure.gnu +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -srcpath=$(dirname $0 2>/dev/null ) || srcpath="." -$srcpath/configure "$@" --with-pic --disable-gost - diff --git a/libs/ldns/contrib/NETLDNS.readme.txt b/libs/ldns/contrib/NETLDNS.readme.txt deleted file mode 100644 index 29069b6a3c..0000000000 --- a/libs/ldns/contrib/NETLDNS.readme.txt +++ /dev/null @@ -1,10 +0,0 @@ -NETLDNS is a functionality port of NLnet Labs' LDNS to the .NET -2.0 framework, contributed by Alex Nicoll of the Carnegie Mellon -University Software Engineering Institute. NETLDNS is released -under the BSD license. NETLDNS uses Mihnea Radulescu's BigInteger -Library (http://www.codeproject.com/KB/cs/BigInteger_Library.aspx) -from CodeProject to help with key manipulation. Please contact Alex at -anicoll@cert.org with inquiries or requests for newer versions. - -This project is not supported by NLnet Labs. - diff --git a/libs/ldns/contrib/build-solaris.sh b/libs/ldns/contrib/build-solaris.sh deleted file mode 100644 index 9f35728ea7..0000000000 --- a/libs/ldns/contrib/build-solaris.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/ksh -# -# $Id: build-solaris.sh 2597 2008-04-15 08:39:58Z jelte $ - - -PREFIX=/opt/ldns -OPENSSL=/usr/sfw -SUDO=sudo - -MAKE_PROGRAM=gmake -MAKE_ARGS="-j 4" - -OBJ32=obj32 -OBJ64=obj64 - -SRCDIR=`pwd` - - -test -d $OBJ32 && $SUDO rm -fr $OBJ32 -mkdir $OBJ32 - -export CFLAGS="" -export LDFLAGS="-L${OPENSSL}/lib -R${OPENSSL}/lib" - -(cd $OBJ32; \ -${SRCDIR}/configure --with-ssl=${OPENSSL} --prefix=${PREFIX} --libdir=${PREFIX}/lib; \ -$MAKE_PROGRAM $MAKE_ARGS) - -if [ `isainfo -k` = amd64 ]; then - test -d $OBJ64 && $SUDO rm -fr $OBJ64 - mkdir $OBJ64 - - export CFLAGS="-m64" - export LDFLAGS="-L${OPENSSL}/lib/amd64 -R${OPENSSL}/lib/amd64" - - (cd $OBJ64; \ - ${SRCDIR}/configure --with-ssl=${OPENSSL} --prefix=${PREFIX} --libdir=${PREFIX}/lib/amd64; \ - $MAKE_PROGRAM $MAKE_ARGS) -fi - -# optionally install -# -if [ x$1 = xinstall ]; then - (cd $OBJ32; $SUDO $MAKE_PROGRAM install-h) - (cd $OBJ32; $SUDO $MAKE_PROGRAM install-doc) - (cd $OBJ32; $SUDO $MAKE_PROGRAM install-lib) - if [ `isainfo -k` = amd64 ]; then - (cd $OBJ64; $SUDO $MAKE_PROGRAM install-lib) - fi -fi diff --git a/libs/ldns/contrib/python/LICENSE b/libs/ldns/contrib/python/LICENSE deleted file mode 100644 index 1eb01e1216..0000000000 --- a/libs/ldns/contrib/python/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - Karel Slany (slany AT fit.vutbr.cz) -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the organization nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. diff --git a/libs/ldns/contrib/python/Makefile b/libs/ldns/contrib/python/Makefile deleted file mode 100644 index 15a5086050..0000000000 --- a/libs/ldns/contrib/python/Makefile +++ /dev/null @@ -1,67 +0,0 @@ -# Makefile: compilation of sources and documentation, test environment -# -# Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) -# Karel Slany (slany AT fit.vutbr.cz) -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# -# * Redistributions of source code must retain the above copyright notice, -# this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# * Neither the name of the organization nor the names of its -# contributors may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. - -help: - @echo "Please use \`make ' where is one of" - @echo " testenv to make test environment and run bash " - @echo " usefull in case you don't want to install ldns but want to test examples" - @echo " doc to make documentation" - @echo " clean clean all" - -../../Makefile: ../../configure - cd ../.. && ./configure --with-python - -_ldns.so: ../../Makefile - $(MAKE) -C ../.. - -../../.libs/ldns.so.1: ../../Makefile - $(MAKE) -C ../.. - -clean: - rm -rdf examples/ldns - rm -f _ldns.so ldns_wrapper.o - $(MAKE) -C ../.. clean - -testenv: ../../.libs/libldns.so.1 _ldns.so - rm -rdf examples/ldns - cd examples && mkdir ldns && ln -s ../../ldns.py ldns/__init__.py && ln -s ../../_ldns.so ldns/_ldns.so && ln -s ../../../../.libs/libldns.so.1 ldns/libldns.so.1 && ls -la - @echo "Run a script by typing ./script_name.py" - cd examples && LD_LIBRARY_PATH=ldns bash - rm -rdf examples/ldns - -doc: ../../.libs/ldns.so.1 _ldns.so - $(MAKE) -C docs html - -#for development only -swig: ldns.i - swig -python -o ldns_wrapper.c -I../.. ldns.i - gcc -c ldns_wrapper.c -O9 -fPIC -I../.. -I../../ldns -I/usr/include/python2.5 -I. -o ldns_wrapper.o - ld -shared ldns_wrapper.o -L../../.libs -lldns -o _ldns.so - diff --git a/libs/ldns/contrib/python/docs/Makefile b/libs/ldns/contrib/python/docs/Makefile deleted file mode 100644 index 856ecd45e1..0000000000 --- a/libs/ldns/contrib/python/docs/Makefile +++ /dev/null @@ -1,70 +0,0 @@ -# Makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -PAPER = - -# Internal variables. -PAPEROPT_a4 = -D latex_paper_size=a4 -PAPEROPT_letter = -D latex_paper_size=letter -ALLSPHINXOPTS = -d build/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source - -.PHONY: help clean html web pickle htmlhelp latex changes linkcheck - -help: - @echo "Please use \`make ' where is one of" - @echo " html to make standalone HTML files" - @echo " pickle to make pickle files (usable by e.g. sphinx-web)" - @echo " htmlhelp to make HTML files and a HTML help project" - @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" - @echo " changes to make an overview over all changed/added/deprecated items" - @echo " linkcheck to check all external links for integrity" - -clean: - -rm -rf build/* - -html: - mkdir -p build/html build/doctrees - LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) build/html - @echo - @echo "Build finished. The HTML pages are in build/html." - -pickle: - mkdir -p build/pickle build/doctrees - LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) build/pickle - @echo - @echo "Build finished; now you can process the pickle files or run" - @echo " sphinx-web build/pickle" - @echo "to start the sphinx-web server." - -web: pickle - -htmlhelp: - mkdir -p build/htmlhelp build/doctrees - LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) build/htmlhelp - @echo - @echo "Build finished; now you can run HTML Help Workshop with the" \ - ".hhp project file in build/htmlhelp." - -latex: - mkdir -p build/latex build/doctrees - LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) build/latex - @echo - @echo "Build finished; the LaTeX files are in build/latex." - @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ - "run these through (pdf)latex." - -changes: - mkdir -p build/changes build/doctrees - LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) build/changes - @echo - @echo "The overview file is in build/changes." - -linkcheck: - mkdir -p build/linkcheck build/doctrees - LD_LIBRARY_PATH=../../../.libs $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) build/linkcheck - @echo - @echo "Link check complete; look for any errors in the above output " \ - "or in build/linkcheck/output.txt." diff --git a/libs/ldns/contrib/python/docs/source/conf.py b/libs/ldns/contrib/python/docs/source/conf.py deleted file mode 100644 index 22b73bcd71..0000000000 --- a/libs/ldns/contrib/python/docs/source/conf.py +++ /dev/null @@ -1,180 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Unbound documentation build configuration file, created by -# sphinx-quickstart on Fri Jan 2 19:14:13 2009. -# -# This file is execfile()d with the current directory set to its containing dir. -# -# The contents of this file are pickled, so don't put values in the namespace -# that aren't pickleable (module imports are okay, they're removed automatically). -# -# All configuration values have a default value; values that are commented out -# serve to show the default value. - -import sys, os - -# If your extensions are in another directory, add it here. If the directory -# is relative to the documentation root, use os.path.abspath to make it -# absolute, like shown here. -sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__),'../../'))) -#print sys.path - -# General configuration -# --------------------- - -# Add any Sphinx extension module names here, as strings. They can be extensions -# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest'] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix of source filenames. -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General substitutions. -project = 'pyLDNS' -copyright = '2009, Karel Slany, Zdenek Vasicek' - -# The default replacements for |version| and |release|, also used in various -# other places throughout the built documents. -# -# The short X.Y version. -version = '1.0' -# The full version, including alpha/beta/rc tags. -release = '1.0.0' - -# There are two options for replacing |today|: either, you set today to some -# non-false value, then it is used: -#today = '' -# Else, today_fmt is used as the format for a strftime call. -today_fmt = '%B %d, %Y' - -# List of documents that shouldn't be included in the build. -#unused_docs = [] - -# List of directories, relative to source directories, that shouldn't be searched -# for source files. -#exclude_dirs = [] - -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None - -# If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True - -# If true, the current module name will be prepended to all description -# unit titles (such as .. function::). -#add_module_names = True - -# If true, sectionauthor and moduleauthor directives will be shown in the -# output. They are ignored by default. -#show_authors = False - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - - -# Options for HTML output -# ----------------------- - -# The style sheet to use for HTML and HTML Help pages. A file of that name -# must exist either in Sphinx' static/ path, or in one of the custom paths -# given in html_static_path. -html_style = 'default.css' - -# The name for this set of Sphinx documents. If None, it defaults to -# " v documentation". -#html_title = None - -# A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None - -# The name of an image file (within the static path) to place at the top of -# the sidebar. -#html_logo = None - -# The name of an image file (within the static path) to use as favicon of the -# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 -# pixels large. -#html_favicon = None - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, -# using the given strftime format. -html_last_updated_fmt = '%b %d, %Y' - -# If true, SmartyPants will be used to convert quotes and dashes to -# typographically correct entities. -#html_use_smartypants = True - -# Custom sidebar templates, maps document names to template names. -#html_sidebars = {} - -# Additional templates that should be rendered to pages, maps page names to -# template names. -#html_additional_pages = {} - -# If false, no module index is generated. -html_use_modindex = False - -# If false, no index is generated. -#html_use_index = True - -# If true, the index is split into individual pages for each letter. -html_split_index = False - -# If true, the reST sources are included in the HTML build as _sources/. -html_copy_source = False - -# If true, an OpenSearch description file will be output, and all pages will -# contain a tag referring to it. The value of this option must be the -# base URL from which the finished HTML is served. -#html_use_opensearch = '' - -# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' - -# Output file base name for HTML help builder. -htmlhelp_basename = 'ldnsdoc' - - -# Options for LaTeX output -# ------------------------ - -# The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' - -# The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, document class [howto/manual]). -latex_documents = [ - ('index', 'ldns-doc.tex', 'LDNS Documentation', - 'Karel Slany, Zdenek Vasicek', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -#latex_logo = None - -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False - -# Additional stuff for the LaTeX preamble. -#latex_preamble = '' - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_use_modindex = True diff --git a/libs/ldns/contrib/python/docs/source/examples/example1.rst b/libs/ldns/contrib/python/docs/source/examples/example1.rst deleted file mode 100644 index b44141759f..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example1.rst +++ /dev/null @@ -1,68 +0,0 @@ -Resolving the MX records -============================== - -This basic example shows how to create a resolver which asks for MX records which contain the information about mail servers. - -:: - - #!/usr/bin/python - # - # MX is a small program that prints out the mx records for a particular domain - # - import ldns - - resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - - dname = ldns.ldns_dname("nic.cz") - - pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) - if (pkt): - mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) - if (mx): - mx.sort() - print mx - -Resolving step by step ------------------------- - -First of all we import :mod:`ldns` extension module which make LDNS functions and classes accessible:: - - import ldns - -If importing fails, it means that Python cannot find the module or ldns library. - -Then we create the resolver by :meth:`ldns.ldns_resolver.new_frm_file` constructor :: - - resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - -and domain name variable dname:: - - dname = ldns.ldns_dname("nic.cz") - -To create a resolver you may also use:: - - resolver = ldns.ldns_resolver.new_frm_file(None) - -which behaves in the same manner as the command above. - -In the third step we tell the resolver to query for our domain, type MX, of class IN:: - - pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) - -The function should return a packet if everything goes well and this packet will contain resource records we asked for. -Note that there exists a simplier way. Instead of using a dname variable, we can use a string which will be automatically converted. -:: - - pkt = resolver.query("fit.vutbr.cz", ldns.LDNS_RR_TYPE_MX, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) - -Now, we test whether the resolver returns a packet and then get all RRs of type MX from the answer packet and store them in list mx:: - - if (pkt): - mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) - -If this list is not empty, we sort and print the content to stdout:: - - if (mx): - mx.sort() - print mx - diff --git a/libs/ldns/contrib/python/docs/source/examples/example2.py b/libs/ldns/contrib/python/docs/source/examples/example2.py deleted file mode 100755 index bb2acfdf76..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example2.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -import ldns -import sys - -debug = True - -# Check args -argc = len(sys.argv) -name = "www.nic.cz" -if argc < 2: - print "Usage:", sys.argv[0], "domain [resolver_addr]" - sys.exit(1) -else: - name = sys.argv[1] - -# Create resolver -resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") -resolver.set_dnssec(True) - -# Custom resolver -if argc > 2: - # Clear previous nameservers - ns = resolver.pop_nameserver() - while ns != None: - ns = resolver.pop_nameserver() - ip = ldns.ldns_rdf.new_frm_str(sys.argv[2], ldns.LDNS_RDF_TYPE_A) - resolver.push_nameserver(ip) - -# Resolve DNS name -pkt = resolver.query(name, ldns.LDNS_RR_TYPE_A, ldns.LDNS_RR_CLASS_IN) -if pkt and pkt.answer(): - - # Debug - if debug: - print "NS returned:", pkt.get_rcode(), "(AA: %d AD: %d)" % ( pkt.ad(), pkt.ad() ) - - # SERVFAIL indicated bogus name - if pkt.get_rcode() is ldns.LDNS_RCODE_SERVFAIL: - print name, "is bogus" - - # Check AD (Authenticated) bit - if pkt.get_rcode() is ldns.LDNS_RCODE_NOERROR: - if pkt.ad(): print name, "is secure" - else: print name, "is insecure" diff --git a/libs/ldns/contrib/python/docs/source/examples/example2.rst b/libs/ldns/contrib/python/docs/source/examples/example2.rst deleted file mode 100644 index b1734386e7..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example2.rst +++ /dev/null @@ -1,100 +0,0 @@ -.. _ex_dnssec: - -Querying DNS-SEC validators -=========================== - -This basic example shows how to query validating resolver and -evaluate answer. - -Resolving step by step ------------------------- - -For DNS queries, we need to initialize ldns resolver (covered in previous example). - -:: - - # Create resolver - resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - resolver.set_dnssec(True) - - # Custom resolver - if argc > 2: - # Clear previous nameservers - ns = resolver.pop_nameserver() - while ns != None: - ns = resolver.pop_nameserver() - ip = ldns.ldns_rdf.new_frm_str(sys.argv[2], ldns.LDNS_RDF_TYPE_A) - resolver.push_nameserver(ip) - -Note the second line :meth:`resolver.set_dnssec`, which enables DNSSEC OK bit -in queries in order to get meaningful results. - -As we have resolver initialized, we can start querying for domain names : - -:: - - # Resolve DNS name - pkt = resolver.query(name, ldns.LDNS_RR_TYPE_A, ldns.LDNS_RR_CLASS_IN) - if pkt and pkt.answer(): - -Now we evaluate result, where two flags are crucial : - - * Return code - * AD flag (authenticated) - -When return code is `SERVFAIL`, it means that validating resolver marked requested -name as **bogus** (or bad configuration). - -**AD** flag is set if domain name is authenticated **(secure)** or false if -it's insecure. - -Complete source code --------------------- - - .. literalinclude:: ../../../examples/ldns-dnssec.py - :language: python - - -Testing -------- - -In order to get meaningful results, you have to enter IP address of validating -resolver or setup your own (see howto). - -Execute `./example2.py` with options `domain name` and `resolver IP`, -example: - -:: - - user@localhost# ./example2.py www.dnssec.cz 127.0.0.1 # Secure (Configured Unbound running on localhost) - user@localhost# ./example2.py www.rhybar.cz 127.0.0.1 # Bogus - -Howto setup Unbound as validating resolver -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Install Unbound according to instructions. -Modify following options in `unbound.conf` (located in `/etc` or `/usr/local/etc`)/ - - -Uncomment `module-config` and set `validator` before iterator. - -:: - - module-config: "validator iterator" - -Download DLV keys and update path in `unbound.conf`:: - - # DLV keys - # Download from http://ftp.isc.org/www/dlv/dlv.isc.org.key - dlv-anchor-file: "/usr/local/etc/unbound/dlv.isc.org.key" - -Update trusted keys (`.cz` for example):: - - # Trusted keys - # For current key, see www.dnssec.cz - trusted-keys-file: "/usr/local/etc/unbound/trusted.key" - -Now you should have well configured Unbound, so run it:: - - user@localhost# unbound -dv - diff --git a/libs/ldns/contrib/python/docs/source/examples/example3.rst b/libs/ldns/contrib/python/docs/source/examples/example3.rst deleted file mode 100644 index 91f5e9d144..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example3.rst +++ /dev/null @@ -1,7 +0,0 @@ -High-level functions -=========================== - -This basic example shows how to get name by addr and vice versa. - -.. literalinclude:: ../../../examples/ldns-higher.py - :language: python diff --git a/libs/ldns/contrib/python/docs/source/examples/example4.rst b/libs/ldns/contrib/python/docs/source/examples/example4.rst deleted file mode 100644 index 2f41f76bde..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example4.rst +++ /dev/null @@ -1,7 +0,0 @@ -AXFR client with IDN support -=============================== - -This example shows how to get AXFR working and how to get involved Internationalized Domain Names (IDN) - -.. literalinclude:: ../../../examples/ldns-axfr.py - :language: python diff --git a/libs/ldns/contrib/python/docs/source/examples/example5.rst b/libs/ldns/contrib/python/docs/source/examples/example5.rst deleted file mode 100644 index 787c169265..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example5.rst +++ /dev/null @@ -1,14 +0,0 @@ -Examine the results -=============================== - -This example shows how to go through the obtained results - -.. literalinclude:: ../../../examples/ldns-mx2.py - :language: python - -This snippet of code prints:: - - nic.cz. 1761 IN MX 20 mx.cznic.org. - nic.cz. 1761 IN MX 10 mail.nic.cz. - nic.cz. 1761 IN MX 15 mail4.nic.cz. - diff --git a/libs/ldns/contrib/python/docs/source/examples/example6.rst b/libs/ldns/contrib/python/docs/source/examples/example6.rst deleted file mode 100644 index d0fd689980..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example6.rst +++ /dev/null @@ -1,12 +0,0 @@ -Read zone file -=============================== - -This example shows how to read the content of a zone file - -.. literalinclude:: ../../../examples/ldns-zone.py - :language: python - -Zone file ``zone.txt``: - -.. literalinclude:: ../../../examples/zone.txt - diff --git a/libs/ldns/contrib/python/docs/source/examples/example7.rst b/libs/ldns/contrib/python/docs/source/examples/example7.rst deleted file mode 100644 index 3e3e2dc22e..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example7.rst +++ /dev/null @@ -1,8 +0,0 @@ -Generate public/private key pair -======================================= - -This example shows how generate keys for DNSSEC (i.e. for signing a zone file according DNSSECbis). - -.. literalinclude:: ../../../examples/ldns-keygen.py - :language: python - diff --git a/libs/ldns/contrib/python/docs/source/examples/example8.rst b/libs/ldns/contrib/python/docs/source/examples/example8.rst deleted file mode 100644 index 6fc550a860..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/example8.rst +++ /dev/null @@ -1,17 +0,0 @@ -Signing of a zone file -=============================== - -This example shows how to sign the content of the given zone file - -.. literalinclude:: ../../../examples/ldns-signzone.py - :language: python - -In order to be able sign a zone file, you have to generate a key-pair using ``ldns-keygen.py``. Don't forget to modify tag number. - -Signing consists of three steps - -1. In the first step, the content of a zone file is readed and parsed. This can be done using :class:`ldns.ldns_zone` class. - -2. In the second step, the private and public key is readed and public key is inserted into zone (as DNSKEY). - -3. In the last step, the DNSSEC zone instace is created and all the RRs from zone file are copied here. Then, all the records are signed using :meth:`ldns.ldns_zone.sign` method. If the signing was successfull, the content of DNSSEC zone is written to a file. diff --git a/libs/ldns/contrib/python/docs/source/examples/index.rst b/libs/ldns/contrib/python/docs/source/examples/index.rst deleted file mode 100644 index 8f7f381c32..0000000000 --- a/libs/ldns/contrib/python/docs/source/examples/index.rst +++ /dev/null @@ -1,12 +0,0 @@ -Tutorials -============================== - -Here you can find a set of simple applications which utilizes the ldns library in Python environment. - -`Tutorials` - -.. toctree:: - :maxdepth: 1 - :glob: - - example* diff --git a/libs/ldns/contrib/python/docs/source/index.rst b/libs/ldns/contrib/python/docs/source/index.rst deleted file mode 100644 index d00b639d1a..0000000000 --- a/libs/ldns/contrib/python/docs/source/index.rst +++ /dev/null @@ -1,22 +0,0 @@ -PyLDNS documentation -======================================= - -PyLDNS provides an `LDNS`_ wrapper (Python extension module) - the thinnest layer over the library possible. Everything you can do from the C API, you can do from Python, but with less effort. The purpose of porting LDNS library to Python is to simplify DNS programming and usage of LDNS, however, still preserve the performance of this library as the speed represents the main benefit of LDNS. The proposed object approach allows the users to be concentrated at the essential part of application only and don't bother with deallocation of objects and so on. - -.. _LDNS: http://www.nlnetlabs.nl/projects/ldns/ - -Contents ----------- -.. toctree:: - :maxdepth: 2 - - install.rst - examples/index.rst - modules/ldns - -Indices and tables -------------------- - -* :ref:`genindex` -* :ref:`search` - diff --git a/libs/ldns/contrib/python/docs/source/install.rst b/libs/ldns/contrib/python/docs/source/install.rst deleted file mode 100644 index b3845b6e21..0000000000 --- a/libs/ldns/contrib/python/docs/source/install.rst +++ /dev/null @@ -1,46 +0,0 @@ -Installation -=================================== - -**Prerequisites** - -Python 2.4 or higher, SWIG 1.3 or higher, GNU make - -**Download** - -You can download the source codes `here`_. -The latest release is 1.4.1, Jan 15, 2009. - -.. _here: ldns-1.4.1-py.tar.gz - -**Compiling** - -After downloading, you can compile the library by doing:: - - > tar -xzf ldns-1.4.1-py.tar.gz - > cd ldns-1.4.1 - > ./configure --with-pyldns - > make - -You need GNU make to compile pyLDNS; SWIG and Python development libraries to compile extension module. - - -**Testing** - -If the compilation is successfull, you can test the python LDNS extension module by:: - - > cd contrib/python - > make testenv - > ./ldns-mx.py - -This will start a new shell, during which the symbolic links will be working. -When you exit the shell, then symbolic links will be deleted. - -In ``contrib/examples`` you can find many simple applications in python which demostrates the capabilities of LDNS library. - -**Installation** - -To install libraries and extension type:: - - > cd ldns-1.4.1 - > make install - diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns.rst b/libs/ldns/contrib/python/docs/source/modules/ldns.rst deleted file mode 100644 index 2c5e7b2455..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns.rst +++ /dev/null @@ -1,40 +0,0 @@ -LDNS module documentation -================================ - -Here you can find the documentation of pyLDNS extension module. This module consists of several classes and a couple of functions. - -.. toctree:: - :maxdepth: 1 - :glob: - - ldns_resolver - ldns_pkt - ldns_rr - ldns_rdf - ldns_dname - ldns_rr_list - ldns_zone - ldns_key - ldns_key_list - ldns_buffer - ldns_dnssec - ldns_func - - - - -**Differences against libLDNS** - -* You don't need to use ldns-compare functions, instances can be compared using standard operators <, >, = :: - - if (some_rr.owner() == another_rr.rdf(1)): - pass - -* Classes contain static methods that create new instances, the name of these methods starts with the new\_ prefix (e.g. :meth:`ldns.ldns_pkt.new_frm_file`). - -* Is it possible to print the content of an object using ``print objinst`` (see :meth:`ldns.ldns_resolver.get_addr_by_name`). - -* Classes contain write_to_buffer method that writes the content into buffer. - -* All the methods that consume parameter of (const ldns_rdf) type allows to use string instead (see :meth:`ldns.ldns_resolver.query`). - diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_buffer.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_buffer.rst deleted file mode 100644 index 7f59e75e3e..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_buffer.rst +++ /dev/null @@ -1,11 +0,0 @@ -Class ldns_buffer -================================ - - -.. automodule:: ldns - -Class ldns_buffer ------------------------------- -.. autoclass:: ldns_buffer - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_dname.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_dname.rst deleted file mode 100644 index 18373bf8e6..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_dname.rst +++ /dev/null @@ -1,11 +0,0 @@ -Class ldns_dname -================================ - - -.. automodule:: ldns - -Class ldns_dname ------------------------------- -.. autoclass:: ldns_dname - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_dnssec.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_dnssec.rst deleted file mode 100644 index bc5719dd55..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_dnssec.rst +++ /dev/null @@ -1,28 +0,0 @@ -Class ldns_dnssec_zone -================================ - -.. automodule:: ldns - -Class ldns_dnssec_zone ------------------------------- -.. autoclass:: ldns_dnssec_zone - :members: - :undoc-members: - -Class ldns_dnssec_name ------------------------------- -.. autoclass:: ldns_dnssec_name - :members: - :undoc-members: - -Class ldns_dnssec_rrsets ------------------------------- -.. autoclass:: ldns_dnssec_rrsets - :members: - :undoc-members: - -Class ldns_dnssec_rrs ------------------------------- -.. autoclass:: ldns_dnssec_rrs - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_func.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_func.rst deleted file mode 100644 index 7a9b8a8959..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_func.rst +++ /dev/null @@ -1,253 +0,0 @@ -Various functions -================================ - -Here you can find list of functions that are not assigned to the classes. -These functions have the same parameters as LDNS functions of the same name. -You are encouraged to read the LDNS documentation. - -**List of functions** - - * ldns_algorithm2buffer_str - * ldns_bget_keyword_data - * ldns_bget_token - * ldns_bgetc - * ldns_bskipcs - * ldns_bubblebabble - * ldns_buffer2pkt_wire - * ldns_buffer2str - * ldns_calc_keytag - * ldns_calc_keytag_raw - * ldns_cert_algorithm2buffer_str - * ldns_convert_dsa_rrsig_asn12rdf - * ldns_convert_dsa_rrsig_rdf2asn1 - * ldns_create_nsec - * ldns_create_nsec3 - * ldns_dname2buffer_wire - * ldns_dname2canonical - * ldns_dnssec_build_data_chain - * ldns_dnssec_chain_nsec3_list - * ldns_dnssec_create_nsec - * ldns_dnssec_create_nsec3 - * ldns_dnssec_create_nsec_bitmap - * ldns_dnssec_data_chain_deep_free - * ldns_dnssec_data_chain_free - * ldns_dnssec_data_chain_new - * ldns_dnssec_data_chain_print - * ldns_dnssec_default_add_to_signatures - * ldns_dnssec_default_delete_signatures - * ldns_dnssec_default_leave_signatures - * ldns_dnssec_default_replace_signatures - * ldns_dnssec_derive_trust_tree - * ldns_dnssec_derive_trust_tree_dnskey_rrset - * ldns_dnssec_derive_trust_tree_ds_rrset - * ldns_dnssec_derive_trust_tree_no_sig - * ldns_dnssec_derive_trust_tree_normal_rrset - * ldns_dnssec_get_dnskey_for_rrsig - * ldns_dnssec_get_rrsig_for_name_and_type - * ldns_dnssec_nsec3_closest_encloser - * ldns_dnssec_pkt_get_rrsigs_for_name_and_type - * ldns_dnssec_pkt_get_rrsigs_for_type - * ldns_dnssec_pkt_has_rrsigs - * ldns_dnssec_remove_signatures - * ldns_dnssec_trust_tree_add_parent - * ldns_dnssec_trust_tree_contains_keys - * ldns_dnssec_trust_tree_depth - * ldns_dnssec_trust_tree_free - * ldns_dnssec_trust_tree_new - * ldns_dnssec_trust_tree_print - * ldns_dnssec_verify_denial - * ldns_dnssec_verify_denial_nsec3 - * ldns_fetch_valid_domain_keys - * ldns_fget_keyword_data - * ldns_fget_keyword_data_l - * ldns_fget_token - * ldns_fget_token_l - * ldns_fskipcs - * ldns_fskipcs_l - * ldns_get_bit - * ldns_get_bit_r - * ldns_get_errorstr_by_id - * ldns_get_rr_class_by_name - * ldns_get_rr_list_addr_by_name - * ldns_get_rr_list_hosts_frm_file - * ldns_get_rr_list_hosts_frm_fp - * ldns_get_rr_list_hosts_frm_fp_l - * ldns_get_rr_list_name_by_addr - * ldns_get_rr_type_by_name - * ldns_getaddrinfo - * ldns_hexdigit_to_int - * ldns_hexstring_to_data - * ldns_init_random - * ldns_int_to_hexdigit - * ldns_is_rrset - * ldns_key2buffer_str - * ldns_key2rr - * ldns_key2str - * ldns_lookup_by_id - * ldns_lookup_by_name - * ldns_native2rdf_int16 - * ldns_native2rdf_int16_data - * ldns_native2rdf_int32 - * ldns_native2rdf_int8 - * ldns_nsec3_add_param_rdfs - * ldns_nsec3_algorithm - * ldns_nsec3_bitmap - * ldns_nsec3_flags - * ldns_nsec3_hash_name - * ldns_nsec3_hash_name_frm_nsec3 - * ldns_nsec3_iterations - * ldns_nsec3_next_owner - * ldns_nsec3_optout - * ldns_nsec3_salt - * ldns_nsec3_salt_data - * ldns_nsec3_salt_length - * ldns_nsec_bitmap_covers_type - * ldns_nsec_covers_name - * ldns_nsec_get_bitmap - * ldns_nsec_type_check - * ldns_octet - * ldns_pkt2buffer_str - * ldns_pkt2buffer_wire - * ldns_pkt2str - * ldns_pkt2wire - * ldns_pktheader2buffer_str - * ldns_power - * ldns_print_rr_rdf - * ldns_rbtree_create - * ldns_rbtree_delete - * ldns_rbtree_find_less_equal - * ldns_rbtree_first - * ldns_rbtree_free - * ldns_rbtree_init - * ldns_rbtree_insert - * ldns_rbtree_insert_vref - * ldns_rbtree_last - * ldns_rbtree_next - * ldns_rbtree_previous - * ldns_rbtree_search - * ldns_rdf2buffer_str - * ldns_rdf2buffer_str_a - * ldns_rdf2buffer_str_aaaa - * ldns_rdf2buffer_str_alg - * ldns_rdf2buffer_str_apl - * ldns_rdf2buffer_str_b64 - * ldns_rdf2buffer_str_cert_alg - * ldns_rdf2buffer_str_class - * ldns_rdf2buffer_str_dname - * ldns_rdf2buffer_str_hex - * ldns_rdf2buffer_str_int16 - * ldns_rdf2buffer_str_int16_data - * ldns_rdf2buffer_str_ipseckey - * ldns_rdf2buffer_str_loc - * ldns_rdf2buffer_str_nsap - * ldns_rdf2buffer_str_nsec - * ldns_rdf2buffer_str_period - * ldns_rdf2buffer_str_str - * ldns_rdf2buffer_str_tsig - * ldns_rdf2buffer_str_tsigtime - * ldns_rdf2buffer_str_type - * ldns_rdf2buffer_str_unknown - * ldns_rdf2buffer_str_wks - * ldns_rdf2buffer_wire - * ldns_rdf2buffer_wire_canonical - * ldns_rdf2native_int16 - * ldns_rdf2native_int32 - * ldns_rdf2native_int8 - * ldns_rdf2native_sockaddr_storage - * ldns_rdf2native_time_t - * ldns_rdf2rr_type - * ldns_rdf2str - * ldns_rdf2wire - * ldns_read_anchor_file - * ldns_read_uint16 - * ldns_read_uint32 - * ldns_rr2buffer_str - * ldns_rr2buffer_wire - * ldns_rr2buffer_wire_canonical - * ldns_rr2canonical - * ldns_rr2str - * ldns_rr2wire - * ldns_rrsig2buffer_wire - * ldns_send - * ldns_send_buffer - * ldns_set_bit - * ldns_sign_public - * ldns_sockaddr_storage2rdf - * ldns_str2period - * ldns_str2rdf_a - * ldns_str2rdf_aaaa - * ldns_str2rdf_alg - * ldns_str2rdf_apl - * ldns_str2rdf_b32_ext - * ldns_str2rdf_b64 - * ldns_str2rdf_cert_alg - * ldns_str2rdf_class - * ldns_str2rdf_dname - * ldns_str2rdf_hex - * ldns_str2rdf_int16 - * ldns_str2rdf_int32 - * ldns_str2rdf_int8 - * ldns_str2rdf_loc - * ldns_str2rdf_nsap - * ldns_str2rdf_nsec - * ldns_str2rdf_nsec3_salt - * ldns_str2rdf_period - * ldns_str2rdf_service - * ldns_str2rdf_str - * ldns_str2rdf_time - * ldns_str2rdf_tsig - * ldns_str2rdf_type - * ldns_str2rdf_unknown - * ldns_str2rdf_wks - * ldns_tcp_bgsend - * ldns_tcp_connect - * ldns_tcp_read_wire - * ldns_tcp_send - * ldns_tcp_send_query - * ldns_traverse_postorder - * ldns_tsig_algorithm - * ldns_tsig_keydata - * ldns_tsig_keydata_clone - * ldns_tsig_keyname - * ldns_tsig_keyname_clone - * ldns_udp_bgsend - * ldns_udp_connect - * ldns_udp_read_wire - * ldns_udp_send - * ldns_udp_send_query - * ldns_update_pkt_new - * ldns_update_pkt_tsig_add - * ldns_update_prcount - * ldns_update_set_adcount - * ldns_update_set_prcount - * ldns_update_set_upcount - * ldns_update_soa_mname - * ldns_update_soa_zone_mname - * ldns_update_upcount - * ldns_update_zocount - * ldns_validate_domain_dnskey - * ldns_validate_domain_ds - * ldns_verify - * ldns_verify_rrsig - * ldns_verify_rrsig_buffers - * ldns_verify_rrsig_buffers_raw - * ldns_verify_rrsig_dsa - * ldns_verify_rrsig_dsa_raw - * ldns_verify_rrsig_keylist - * ldns_verify_rrsig_rsamd5 - * ldns_verify_rrsig_rsamd5_raw - * ldns_verify_rrsig_rsasha1 - * ldns_verify_rrsig_rsasha1_raw - * ldns_verify_rrsig_rsasha256_raw - * ldns_verify_rrsig_rsasha512_raw - * ldns_verify_trusted - * ldns_version - * ldns_wire2dname - * ldns_wire2pkt - * ldns_wire2rdf - * ldns_wire2rr - * ldns_write_uint16 - * ldns_write_uint32 - * ldns_write_uint64_as_uint48 - * mktime_from_utc - * qsort_rr_compare_nsec3 diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_key.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_key.rst deleted file mode 100644 index 4d35766b79..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_key.rst +++ /dev/null @@ -1,11 +0,0 @@ -Class ldns_key -================================ - - -.. automodule:: ldns - -Class ldns_key ------------------------------- -.. autoclass:: ldns_key - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_key_list.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_key_list.rst deleted file mode 100644 index e8e447452e..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_key_list.rst +++ /dev/null @@ -1,11 +0,0 @@ -Class ldns_key_list -================================ - - -.. automodule:: ldns - -Class ldns_key_list ------------------------------- -.. autoclass:: ldns_key_list - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_pkt.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_pkt.rst deleted file mode 100644 index eb00a0bc07..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_pkt.rst +++ /dev/null @@ -1,11 +0,0 @@ -Class ldns_pkt -================================ - - -.. automodule:: ldns - -Class ldns_pkt ------------------------------- -.. autoclass:: ldns_pkt - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_rdf.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_rdf.rst deleted file mode 100644 index 5ed1799b1b..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_rdf.rst +++ /dev/null @@ -1,47 +0,0 @@ -Class ldns_rdf -================================ - - -.. automodule:: ldns - -Class ldns_rdf ------------------------------- -.. autoclass:: ldns_rdf - :members: - :undoc-members: - -Predefined constants ------------------------------- - -**RDF TYPE** - * LDNS_RDF_TYPE_NONE, - * LDNS_RDF_TYPE_DNAME, - * LDNS_RDF_TYPE_INT8, - * LDNS_RDF_TYPE_INT16, - * LDNS_RDF_TYPE_INT32, - * LDNS_RDF_TYPE_A, - * LDNS_RDF_TYPE_AAAA, - * LDNS_RDF_TYPE_STR, - * LDNS_RDF_TYPE_APL, - * LDNS_RDF_TYPE_B32_EXT, - * LDNS_RDF_TYPE_B64, - * LDNS_RDF_TYPE_HEX, - * LDNS_RDF_TYPE_NSEC, - * LDNS_RDF_TYPE_TYPE, - * LDNS_RDF_TYPE_CLASS, - * LDNS_RDF_TYPE_CERT_ALG, - * LDNS_RDF_TYPE_ALG, - * LDNS_RDF_TYPE_UNKNOWN, - * LDNS_RDF_TYPE_TIME, - * LDNS_RDF_TYPE_PERIOD, - * LDNS_RDF_TYPE_TSIGTIME, - * LDNS_RDF_TYPE_TSIG, - * LDNS_RDF_TYPE_INT16_DATA, - * LDNS_RDF_TYPE_SERVICE, - * LDNS_RDF_TYPE_LOC, - * LDNS_RDF_TYPE_WKS, - * LDNS_RDF_TYPE_NSAP, - * LDNS_RDF_TYPE_IPSECKEY, - * LDNS_RDF_TYPE_NSEC3_SALT, - * LDNS_RDF_TYPE_NSEC3_NEXT_OWNER - diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_resolver.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_resolver.rst deleted file mode 100644 index 2fda23a2f0..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_resolver.rst +++ /dev/null @@ -1,13 +0,0 @@ -Class ldns_resolver -================================ - -.. automodule:: ldns - -Class ldns_resolver ------------------------------- -.. autoclass:: ldns_resolver - :members: - :undoc-members: - - - diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_rr.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_rr.rst deleted file mode 100644 index 78404cda0d..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_rr.rst +++ /dev/null @@ -1,18 +0,0 @@ -Class ldns_rr -================================ - - -.. automodule:: ldns - -Class ldns_rr ------------------------------- -.. autoclass:: ldns_rr - :members: - :undoc-members: - -Class ldns_rr_descriptor ------------------------------- -.. autoclass:: ldns_rr_descriptor - :members: - :undoc-members: - diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_rr_list.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_rr_list.rst deleted file mode 100644 index f044093790..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_rr_list.rst +++ /dev/null @@ -1,11 +0,0 @@ -Class ldns_rr_list -================================ - - -.. automodule:: ldns - -Class ldns_rr_list ------------------------------- -.. autoclass:: ldns_rr_list - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/docs/source/modules/ldns_zone.rst b/libs/ldns/contrib/python/docs/source/modules/ldns_zone.rst deleted file mode 100644 index 5331429222..0000000000 --- a/libs/ldns/contrib/python/docs/source/modules/ldns_zone.rst +++ /dev/null @@ -1,11 +0,0 @@ -Class ldns_zone -================================ - - -.. automodule:: ldns - -Class ldns_zone ------------------------------- -.. autoclass:: ldns_zone - :members: - :undoc-members: diff --git a/libs/ldns/contrib/python/examples/ldns-axfr.py b/libs/ldns/contrib/python/examples/ldns-axfr.py deleted file mode 100755 index 5333484fa1..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-axfr.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/python -# vim:fileencoding=utf-8 -# -# AXFR client with IDN (Internationalized Domain Names) support -# - -import ldns -import encodings.idna - -def utf2name(name): - return '.'.join([encodings.idna.ToASCII(a) for a in name.split('.')]) -def name2utf(name): - return '.'.join([encodings.idna.ToUnicode(a) for a in name.split('.')]) - - -resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - -#addr = ldns.ldns_get_rr_list_addr_by_name(resolver, "zone.nic.cz", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD); -addr = resolver.get_addr_by_name("zone.nic.cz", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD); -if (not addr): - raise Exception("Can't retrieve server address") - -print "Addr_by_name:",str(addr).replace("\n","; ") - -#remove all nameservers -while resolver.pop_nameserver(): - pass - -#insert server addr -for rr in addr.rrs(): - resolver.push_nameserver_rr(rr) - -#AXFR transfer -status = resolver.axfr_start(utf2name(u"háÄkyÄárky.cz"), ldns.LDNS_RR_CLASS_IN) -if status != ldns.LDNS_STATUS_OK: - raise Exception("Can't start AXFR. Error: %s" % ldns.ldns_get_errorstr_by_id(status)) - -#Print results -while True: - rr = resolver.axfr_next() - if not rr: - break - - rdf = rr.owner() - if (rdf.get_type() == ldns.LDNS_RDF_TYPE_DNAME): - print "RDF owner: type=",rdf.get_type_str(),"data=",name2utf(str(rdf)) - else: - print "RDF owner: type=",rdf.get_type_str(),"data=",str(rdf) - print " RR type=", rr.get_type_str()," ttl=",rr.ttl() - for rdf in rr.rdfs(): - if (rdf.get_type() == ldns.LDNS_RDF_TYPE_DNAME): - print " RDF: type=",rdf.get_type_str(),"data=",name2utf(str(rdf)) - else: - print " RDF: type=",rdf.get_type_str(),"data=",str(rdf) - - print diff --git a/libs/ldns/contrib/python/examples/ldns-buf.py b/libs/ldns/contrib/python/examples/ldns-buf.py deleted file mode 100755 index 73d8a029ff..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-buf.py +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/python - -import ldns - -buf = ldns.ldns_buffer(1024) -buf.printf("Test buffer") -print buf - diff --git a/libs/ldns/contrib/python/examples/ldns-dnssec.py b/libs/ldns/contrib/python/examples/ldns-dnssec.py deleted file mode 100755 index bb2acfdf76..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-dnssec.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -import ldns -import sys - -debug = True - -# Check args -argc = len(sys.argv) -name = "www.nic.cz" -if argc < 2: - print "Usage:", sys.argv[0], "domain [resolver_addr]" - sys.exit(1) -else: - name = sys.argv[1] - -# Create resolver -resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") -resolver.set_dnssec(True) - -# Custom resolver -if argc > 2: - # Clear previous nameservers - ns = resolver.pop_nameserver() - while ns != None: - ns = resolver.pop_nameserver() - ip = ldns.ldns_rdf.new_frm_str(sys.argv[2], ldns.LDNS_RDF_TYPE_A) - resolver.push_nameserver(ip) - -# Resolve DNS name -pkt = resolver.query(name, ldns.LDNS_RR_TYPE_A, ldns.LDNS_RR_CLASS_IN) -if pkt and pkt.answer(): - - # Debug - if debug: - print "NS returned:", pkt.get_rcode(), "(AA: %d AD: %d)" % ( pkt.ad(), pkt.ad() ) - - # SERVFAIL indicated bogus name - if pkt.get_rcode() is ldns.LDNS_RCODE_SERVFAIL: - print name, "is bogus" - - # Check AD (Authenticated) bit - if pkt.get_rcode() is ldns.LDNS_RCODE_NOERROR: - if pkt.ad(): print name, "is secure" - else: print name, "is insecure" diff --git a/libs/ldns/contrib/python/examples/ldns-higher.py b/libs/ldns/contrib/python/examples/ldns-higher.py deleted file mode 100755 index 5175ec0e7a..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-higher.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python -import ldns - -resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - -dnn = ldns.ldns_dname("www.google.com") -print dnn.get_type_str(), dnn - -dna = ldns.ldns_rdf.new_frm_str("74.125.43.99",ldns.LDNS_RDF_TYPE_A) -print dna.get_type_str(), dna - -name = resolver.get_name_by_addr(dna) -if (not name): raise Exception("Can't retrieve server name") -for rr in name.rrs(): - print rr - -name = resolver.get_name_by_addr("74.125.43.99") -if (not name): raise Exception("Can't retrieve server name") -for rr in name.rrs(): - print rr - -addr = resolver.get_addr_by_name(dnn) -if (not addr): raise Exception("Can't retrieve server address") -for rr in addr.rrs(): - print rr - -addr = resolver.get_addr_by_name("www.google.com") -if (not addr): raise Exception("Can't retrieve server address") -for rr in addr.rrs(): - print rr - -hosts = ldns.ldns_rr_list.new_frm_file("/etc/hosts") -if (not hosts): raise Exception("Can't retrieve the content of file") -for rr in hosts.rrs(): - print rr - diff --git a/libs/ldns/contrib/python/examples/ldns-keygen.py b/libs/ldns/contrib/python/examples/ldns-keygen.py deleted file mode 100755 index 3ddf41a946..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-keygen.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/python -# -# This example shows how to generate public/private key pair -# -import ldns - -algorithm = ldns.LDNS_SIGN_DSA -bits = 512 - -ldns.ldns_init_random(open("/dev/random","rb"), (bits+7)//8) - -domain = ldns.ldns_dname("example.") - -#generate a new key -key = ldns.ldns_key.new_frm_algorithm(algorithm, bits); -print key - -#set owner -key.set_pubkey_owner(domain) - -#create the public from the ldns_key -pubkey = key.key_to_rr() -#previous command is equivalent to -# pubkey = ldns.ldns_key2rr(key) -print pubkey - -#calculate and set the keytag -key.set_keytag(ldns.ldns_calc_keytag(pubkey)) - -#build the DS record -ds = ldns.ldns_key_rr2ds(pubkey, ldns.LDNS_SHA1) -print ds - -owner, tag = pubkey.owner(), key.keytag() - -#write public key to .key file -fw = open("key-%s-%d.key" % (owner,tag), "wb") -pubkey.print_to_file(fw) - -#write private key to .priv file -fw = open("key-%s-%d.private" % (owner,tag), "wb") -key.print_to_file(fw) - -#write DS to .ds file -fw = open("key-%s-%d.ds" % (owner,tag), "wb") -ds.print_to_file(fw) diff --git a/libs/ldns/contrib/python/examples/ldns-mx.py b/libs/ldns/contrib/python/examples/ldns-mx.py deleted file mode 100755 index 38c3f11c16..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-mx.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python -# -# MX is a small program that prints out the mx records for a particular domain -# -import ldns - -resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - -pkt = resolver.query("nic.cz", ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) - -if (pkt): - mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) - if (mx): - mx.sort() - print mx diff --git a/libs/ldns/contrib/python/examples/ldns-mx1.py b/libs/ldns/contrib/python/examples/ldns-mx1.py deleted file mode 100755 index 3dade1ed3d..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-mx1.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/python -# -# MX is a small program that prints out the mx records for a particular domain -# -import ldns - -dname = ldns.ldns_dname("nic.cz") -print dname - -resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - -pkt = resolver.query(dname, ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) - -if (pkt): - mx = pkt.rr_list_by_type(ldns.LDNS_RR_TYPE_MX, ldns.LDNS_SECTION_ANSWER) - if (mx): - mx.sort() - print mx diff --git a/libs/ldns/contrib/python/examples/ldns-mx2.py b/libs/ldns/contrib/python/examples/ldns-mx2.py deleted file mode 100755 index 4fff98a4b1..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-mx2.py +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/python -# -# MX is a small program that prints out the mx records for a particular domain -# -import ldns - -resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - -pkt = resolver.query("nic.cz", ldns.LDNS_RR_TYPE_MX,ldns.LDNS_RR_CLASS_IN) -if (pkt) and (pkt.answer()): - - for rr in pkt.answer().rrs(): - if (rr.get_type() != ldns.LDNS_RR_TYPE_MX): - continue - - rdf = rr.owner() - print rdf," ",rr.ttl()," ",rr.get_class_str()," ",rr.get_type_str()," ", - print " ".join(str(rdf) for rdf in rr.rdfs()) - diff --git a/libs/ldns/contrib/python/examples/ldns-newpkt.py b/libs/ldns/contrib/python/examples/ldns-newpkt.py deleted file mode 100755 index d124a80f80..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-newpkt.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/python - -import ldns - -pkt = ldns.ldns_pkt.new_query_frm_str("www.google.com",ldns.LDNS_RR_TYPE_ANY, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_QR | ldns.LDNS_AA) - -rra = ldns.ldns_rr.new_frm_str("www.google.com. IN A 192.168.1.1",300) -rrb = ldns.ldns_rr.new_frm_str("www.google.com. IN TXT Some\ Description",300) - -list = ldns.ldns_rr_list() -if (rra): list.push_rr(rra) -if (rrb): list.push_rr(rrb) - -pkt.push_rr_list(ldns.LDNS_SECTION_ANSWER, list) - -print "Packet:" -print pkt diff --git a/libs/ldns/contrib/python/examples/ldns-signzone.py b/libs/ldns/contrib/python/examples/ldns-signzone.py deleted file mode 100755 index 41f76626ea..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-signzone.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python -# This example shows how to sign a given zone file with private key - -import ldns -import sys, os, time - -#private key TAG which identifies the private key -#use ldns-keygen.py in order to obtain private key -keytag = 30761 - -# Read zone file -#------------------------------------------------------------- - -zone = ldns.ldns_zone.new_frm_fp(open("zone.txt","r"), None, 0, ldns.LDNS_RR_CLASS_IN) -soa = zone.soa() -origin = soa.owner() - -# Prepare keys -#------------------------------------------------------------- - -#Read private key from file -keyfile = open("key-%s-%d.private" % (origin, keytag), "r"); -key = ldns.ldns_key.new_frm_fp(keyfile) - -#Read public key from file -pubfname = "key-%s-%d.key" % (origin, keytag) -pubkey = None -if os.path.isfile(pubfname): - pubkeyfile = open(pubfname, "r"); - pubkey,_,_,_ = ldns.ldns_rr.new_frm_fp(pubkeyfile) - -if not pubkey: - #Create new public key - pubkey = key.key_to_rr() - -#Set key expiration -key.set_expiration(int(time.time()) + 365*60*60*24) #365 days - -#Set key owner (important step) -key.set_pubkey_owner(origin) - -#Insert DNSKEY RR -zone.push_rr(pubkey) - -# Sign zone -#------------------------------------------------------------- - -#Create keylist and push private key -keys = ldns.ldns_key_list() -keys.push_key(key) - -#Add SOA -signed_zone = ldns.ldns_dnssec_zone() -signed_zone.add_rr(soa) - -#Add RRs -for rr in zone.rrs().rrs(): - print "RR:",str(rr), - signed_zone.add_rr(rr) - -added_rrs = ldns.ldns_rr_list() -status = signed_zone.sign(added_rrs, keys) -if (status == ldns.LDNS_STATUS_OK): - signed_zone.print_to_file(open("zone_signed.txt","w")) - diff --git a/libs/ldns/contrib/python/examples/ldns-zone.py b/libs/ldns/contrib/python/examples/ldns-zone.py deleted file mode 100755 index 266e6e5b47..0000000000 --- a/libs/ldns/contrib/python/examples/ldns-zone.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/python -import ldns - -#Read zone from file -zone = ldns.ldns_zone.new_frm_fp(open("zone.txt","r"), None, 0, ldns.LDNS_RR_CLASS_IN) -print zone - -print "SOA:", zone.soa() -for r in zone.rrs().rrs(): - print "RR:", r - - -zone = ldns.ldns_zone() -#print zone - diff --git a/libs/ldns/contrib/python/examples/zone.txt b/libs/ldns/contrib/python/examples/zone.txt deleted file mode 100644 index ffc87263f1..0000000000 --- a/libs/ldns/contrib/python/examples/zone.txt +++ /dev/null @@ -1,15 +0,0 @@ -$ORIGIN example. -$TTL 600 - -example. IN SOA example. admin.example. ( - 2008022501 ; serial - 28800 ; refresh (8 hours) - 7200 ; retry (2 hours) - 604800 ; expire (1 week) - 18000 ; minimum (5 hours) - ) - -@ IN MX 10 mail.example. -@ IN NS ns1 -@ IN NS ns2 -@ IN A 192.168.1.1 diff --git a/libs/ldns/contrib/python/ldns.i b/libs/ldns/contrib/python/ldns.i deleted file mode 100644 index ddd0a51bba..0000000000 --- a/libs/ldns/contrib/python/ldns.i +++ /dev/null @@ -1,267 +0,0 @@ -/* - * ldns.i: LDNS interface file - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -%module ldns -%{ - -#include "ldns.h" -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -%} - -//#define LDNS_DEBUG - -%include "stdint.i" // uint_16_t is known type now -%include "file.i" // FILE * -%include "typemaps.i" - -%inline %{ -struct timeval* ldns_make_timeval(uint32_t sec, uint32_t usec) -{ - struct timeval* res = (struct timeval*)malloc(sizeof(*res)); - res->tv_sec = sec; - res->tv_usec = usec; - return res; -} -uint32_t ldns_read_timeval_sec(struct timeval* t) { - return (uint32_t)t->tv_sec; } -uint32_t ldns_read_timeval_usec(struct timeval* t) { - return (uint32_t)t->tv_usec; } -%} - -%immutable ldns_struct_lookup_table::name; -%immutable ldns_struct_rr_descriptor::_name; -%immutable ldns_error_str; -%immutable ldns_signing_algorithms; - -//new_frm_fp_l -%apply int *OUTPUT { int *line_nr}; -%apply uint32_t *OUTPUT { uint32_t *default_ttl}; - -%include "ldns_packet.i" -%include "ldns_resolver.i" -%include "ldns_rr.i" -%include "ldns_rdf.i" -%include "ldns_zone.i" -%include "ldns_key.i" -%include "ldns_buffer.i" -%include "ldns_dnssec.i" - -%include - %include -%include -%include - %include -%include -%include - %include - %include -%include - %include - %include - %include - %include -%include -%include - %include -%include - %include - %include -%include - %include - %include -%include - %include - -typedef struct ldns_dnssec_name { }; -typedef struct ldns_dnssec_rrs { }; -typedef struct ldns_dnssec_rrsets { }; -typedef struct ldns_dnssec_zone { }; -// ================================================================================ - -%include "ldns_dname.i" - -%inline %{ - PyObject* ldns_rr_new_frm_str_(const char *str, uint32_t default_ttl, ldns_rdf* origin, ldns_rdf* prev) - //returns tuple (status, ldns_rr, prev) - { - PyObject* tuple; - - ldns_rdf *p_prev = prev; - ldns_rdf **pp_prev = &p_prev; - if (p_prev == 0) pp_prev = 0; - - ldns_rr *p_rr = 0; - ldns_rr **pp_rr = &p_rr; - - ldns_status st = ldns_rr_new_frm_str(pp_rr, str, default_ttl, origin, pp_prev); - - tuple = PyTuple_New(3); - PyTuple_SetItem(tuple, 0, SWIG_From_int(st)); - PyTuple_SetItem(tuple, 1, (st == LDNS_STATUS_OK) ? - SWIG_NewPointerObj(SWIG_as_voidptr(p_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 ) : - Py_None); - PyTuple_SetItem(tuple, 2, (p_prev != prev) ? - SWIG_NewPointerObj(SWIG_as_voidptr(p_prev), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : - Py_None); - return tuple; - } - - PyObject* ldns_rr_new_frm_fp_l_(FILE *fp, uint32_t default_ttl, ldns_rdf* origin, ldns_rdf* prev, int ret_linenr) - //returns tuple (status, ldns_rr, [line if ret_linenr], ttl, origin, prev) - { - int linenr = 0; - int *p_linenr = &linenr; - - uint32_t defttl = default_ttl; - uint32_t *p_defttl = &defttl; - if (defttl == 0) p_defttl = 0; - - ldns_rdf *p_origin = origin; - ldns_rdf **pp_origin = &p_origin; - if (p_origin == 0) pp_origin = 0; - - ldns_rdf *p_prev = prev; - ldns_rdf **pp_prev = &p_prev; - if (p_prev == 0) pp_prev = 0; - - ldns_rr *p_rr = 0; - ldns_rr **pp_rr = &p_rr; - - ldns_status st = ldns_rr_new_frm_fp_l(pp_rr, fp, p_defttl, pp_origin, pp_prev, p_linenr); - - PyObject* tuple; - tuple = PyTuple_New(ret_linenr ? 6 : 5); - int idx = 0; - PyTuple_SetItem(tuple, idx, SWIG_From_int(st)); - idx++; - PyTuple_SetItem(tuple, idx, (st == LDNS_STATUS_OK) ? - SWIG_NewPointerObj(SWIG_as_voidptr(p_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 ) : - Py_None); - idx++; - if (ret_linenr) { - PyTuple_SetItem(tuple, idx, SWIG_From_int(linenr)); - idx++; - } - PyTuple_SetItem(tuple, idx, (defttl != default_ttl) ? SWIG_From_int(defttl) : Py_None); - idx++; - PyTuple_SetItem(tuple, idx, (p_origin != origin) ? - SWIG_NewPointerObj(SWIG_as_voidptr(p_origin), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : - Py_None); - idx++; - PyTuple_SetItem(tuple, idx, (p_prev != prev) ? - SWIG_NewPointerObj(SWIG_as_voidptr(p_prev), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : - Py_None); - return tuple; - } - - PyObject* ldns_rr_new_question_frm_str_(const char *str, ldns_rdf* origin, ldns_rdf* prev) - //returns tuple (status, ldns_rr, prev) - { - PyObject* tuple; - - ldns_rdf *p_prev = prev; - ldns_rdf **pp_prev = &p_prev; - if (p_prev == 0) pp_prev = 0; - - ldns_rr *p_rr = 0; - ldns_rr **pp_rr = &p_rr; - - ldns_status st = ldns_rr_new_question_frm_str(pp_rr, str, origin, pp_prev); - - tuple = PyTuple_New(3); - PyTuple_SetItem(tuple, 0, SWIG_From_int(st)); - PyTuple_SetItem(tuple, 1, (st == LDNS_STATUS_OK) ? - SWIG_NewPointerObj(SWIG_as_voidptr(p_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 ) : - Py_None); - PyTuple_SetItem(tuple, 2, (p_prev != prev) ? - SWIG_NewPointerObj(SWIG_as_voidptr(p_prev), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 ) : - Py_None); - return tuple; - } - - - -PyObject* ldns_fetch_valid_domain_keys_(const ldns_resolver * res, const ldns_rdf * domain, - const ldns_rr_list * keys) - //returns tuple (status, result) - { - PyObject* tuple; - - ldns_rr_list *rrl = 0; - ldns_status st = 0; - rrl = ldns_fetch_valid_domain_keys(res, domain, keys, &st); - - - tuple = PyTuple_New(2); - PyTuple_SetItem(tuple, 0, SWIG_From_int(st)); - PyTuple_SetItem(tuple, 1, (st == LDNS_STATUS_OK) ? - SWIG_NewPointerObj(SWIG_as_voidptr(rrl), SWIGTYPE_p_ldns_struct_rr_list, SWIG_POINTER_OWN | 0 ) : - Py_None); - return tuple; - } - -%} - -%pythoncode %{ -def ldns_fetch_valid_domain_keys(res, domain, keys): - return _ldns.ldns_fetch_valid_domain_keys_(res, domain, keys) -%} - diff --git a/libs/ldns/contrib/python/ldns_buffer.i b/libs/ldns/contrib/python/ldns_buffer.i deleted file mode 100644 index ce1740875d..0000000000 --- a/libs/ldns/contrib/python/ldns_buffer.i +++ /dev/null @@ -1,560 +0,0 @@ -/****************************************************************************** - * ldns_buffer.i: LDNS buffer class - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ - -%typemap(in,numinputs=0,noblock=1) (ldns_buffer **) -{ - ldns_buffer *$1_buf; - $1 = &$1_buf; -} - -/* result generation */ -%typemap(argout,noblock=1) (ldns_buffer **) -{ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_buf), SWIGTYPE_p_ldns_struct_buffer, SWIG_POINTER_OWN | 0 )); -} - -%nodefaultctor ldns_struct_buffer; //no default constructor & destructor -%nodefaultdtor ldns_struct_buffer; - -%delobject ldns_buffer_free; -%newobject ldns_buffer_new; -%newobject ldns_dname_new; -%newobject ldns_dname_new_frm_data; -%newobject ldns_dname_label; - -%rename(ldns_buffer) ldns_struct_buffer; - -#ifdef LDNS_DEBUG -%rename(__ldns_buffer_free) ldns_buffer_free; -%inline %{ -void _ldns_buffer_free (ldns_buffer* b) { - printf("******** LDNS_BUFFER free 0x%lX ************\n", (long unsigned int)b); - ldns_buffer_free(b); -} -%} -#else -%rename(_ldns_buffer_free) ldns_buffer_free; -#endif - -%ignore ldns_struct_buffer::_position; -%ignore ldns_struct_buffer::_limit; -%ignore ldns_struct_buffer::_capacity; -%ignore ldns_struct_buffer::_data; -%ignore ldns_struct_buffer::_fixed; -%ignore ldns_struct_buffer::_status; - -%extend ldns_struct_buffer { - - %pythoncode %{ - def __init__(self, capacity): - """Creates a new buffer with the specified capacity. - - :param capacity: the size (in bytes) to allocate for the buffer - """ - self.this = _ldns.ldns_buffer_new(capacity) - - __swig_destroy__ = _ldns._ldns_buffer_free - - def __str__(self): - """Returns the data in the buffer as a string. Buffer data must be char * type.""" - return _ldns.ldns_buffer2str(self) - - def getc(self): - """returns the next character from a buffer. - - Advances the position pointer with 1. When end of buffer is reached returns EOF. This is the buffer's equivalent for getc(). - - :returns: (int) EOF on failure otherwise return the character - """ - return _ldns.ldns_bgetc(self) - - #LDNS_BUFFER_METHODS_# - def at(self,at): - """returns a pointer to the data at the indicated position. - - :param at: - position - :returns: (uint8_t \*) the pointer to the data - """ - return _ldns.ldns_buffer_at(self,at) - #parameters: const ldns_buffer *,size_t, - #retvals: uint8_t * - - def available(self,count): - """checks if the buffer has count bytes available at the current position - - :param count: - how much is available - :returns: (int) true or false - """ - return _ldns.ldns_buffer_available(self,count) - #parameters: ldns_buffer *,size_t, - #retvals: int - - def available_at(self,at,count): - """checks if the buffer has at least COUNT more bytes available. - - Before reading or writing the caller needs to ensure enough space is available! - - :param at: - indicated position - :param count: - how much is available - :returns: (int) true or false - """ - return _ldns.ldns_buffer_available_at(self,at,count) - #parameters: ldns_buffer *,size_t,size_t, - #retvals: int - - def begin(self): - """returns a pointer to the beginning of the buffer (the data at position 0). - - :returns: (uint8_t \*) the pointer - """ - return _ldns.ldns_buffer_begin(self) - #parameters: const ldns_buffer *, - #retvals: uint8_t * - - def capacity(self): - """returns the number of bytes the buffer can hold. - - :returns: (size_t) the number of bytes - """ - return _ldns.ldns_buffer_capacity(self) - #parameters: ldns_buffer *, - #retvals: size_t - - def clear(self): - """clears the buffer and make it ready for writing. - - The buffer's limit is set to the capacity and the position is set to 0. - """ - _ldns.ldns_buffer_clear(self) - #parameters: ldns_buffer *, - #retvals: - - def copy(self,bfrom): - """Copy contents of the other buffer to this buffer. - - Silently truncated if this buffer is too small. - - :param bfrom: other buffer - """ - _ldns.ldns_buffer_copy(self,bfrom) - #parameters: ldns_buffer *,ldns_buffer *, - #retvals: - - def current(self): - """returns a pointer to the data at the buffer's current position. - - :returns: (uint8_t \*) the pointer - """ - return _ldns.ldns_buffer_current(self) - #parameters: ldns_buffer *, - #retvals: uint8_t * - - def end(self): - """returns a pointer to the end of the buffer (the data at the buffer's limit). - - :returns: (uint8_t \*) the pointer - """ - return _ldns.ldns_buffer_end(self) - #parameters: ldns_buffer *, - #retvals: uint8_t * - - def export(self): - """Makes the buffer fixed and returns a pointer to the data. - - The caller is responsible for free'ing the result. - - :returns: (void \*) void - """ - return _ldns.ldns_buffer_export(self) - #parameters: ldns_buffer *, - #retvals: void * - - def flip(self): - """makes the buffer ready for reading the data that has been written to the buffer. - - The buffer's limit is set to the current position and the position is set to 0. - """ - _ldns.ldns_buffer_flip(self) - #parameters: ldns_buffer *, - - def invariant(self): - _ldns.ldns_buffer_invariant(self) - #parameters: ldns_buffer *, - - def limit(self): - """returns the maximum size of the buffer - - :returns: (size_t) the size - """ - return _ldns.ldns_buffer_limit(self) - #parameters: ldns_buffer *, - #retvals: size_t - - def position(self): - """returns the current position in the buffer (as a number of bytes) - - :returns: (size_t) the current position - """ - return _ldns.ldns_buffer_position(self) - #parameters: ldns_buffer *, - #retvals: size_t - - def printf(self,*str): - """Prints to the buffer, increasing the capacity if required using buffer_reserve(). - - The buffer's position is set to the terminating '\0'. Returns the number of characters written (not including the terminating '\0') or -1 on failure. - :param str: a string - :returns: (int) - """ - return _ldns.ldns_buffer_printf(self,*str) - #parameters: ldns_buffer *,const char *,... - #retvals: int - - def read(self,data,count): - """copies count bytes of data at the current position to the given data-array - - :param data: - buffer to copy to - :param count: - the length of the data to copy - """ - _ldns.ldns_buffer_read(self,data,count) - #parameters: ldns_buffer *,void *,size_t, - #retvals: - - def read_at(self,at,data,count): - """copies count bytes of data at the given position to the given data-array - - :param at: - the position in the buffer to start - :param data: - buffer to copy to - :param count: - the length of the data to copy - """ - _ldns.ldns_buffer_read_at(self,at,data,count) - #parameters: ldns_buffer *,size_t,void *,size_t, - #retvals: - - def read_u16(self): - """returns the 2-byte integer value at the current position in the buffer - - :returns: (uint16_t) 2 byte integer - """ - return _ldns.ldns_buffer_read_u16(self) - #parameters: ldns_buffer *, - #retvals: uint16_t - - def read_u16_at(self,at): - """returns the 2-byte integer value at the given position in the buffer - - :param at: - position in the buffer - :returns: (uint16_t) 2 byte integer - """ - return _ldns.ldns_buffer_read_u16_at(self,at) - #parameters: ldns_buffer *,size_t, - #retvals: uint16_t - - def read_u32(self): - """returns the 4-byte integer value at the current position in the buffer - - :returns: (uint32_t) 4 byte integer - """ - return _ldns.ldns_buffer_read_u32(self) - #parameters: ldns_buffer *, - #retvals: uint32_t - - def read_u32_at(self,at): - """returns the 4-byte integer value at the given position in the buffer - - :param at: - position in the buffer - :returns: (uint32_t) 4 byte integer - """ - return _ldns.ldns_buffer_read_u32_at(self,at) - #parameters: ldns_buffer *,size_t, - #retvals: uint32_t - - def read_u8(self): - """returns the byte value at the current position in the buffer - - :returns: (uint8_t) 1 byte integer - """ - return _ldns.ldns_buffer_read_u8(self) - #parameters: ldns_buffer *, - #retvals: uint8_t - - def read_u8_at(self,at): - """returns the byte value at the given position in the buffer - - :param at: - the position in the buffer - :returns: (uint8_t) 1 byte integer - """ - return _ldns.ldns_buffer_read_u8_at(self,at) - #parameters: ldns_buffer *,size_t, - #retvals: uint8_t - - def remaining(self): - """returns the number of bytes remaining between the buffer's position and limit. - - :returns: (size_t) the number of bytes - """ - return _ldns.ldns_buffer_remaining(self) - #parameters: ldns_buffer *, - #retvals: size_t - - def remaining_at(self,at): - """returns the number of bytes remaining between the indicated position and the limit. - - :param at: - indicated position - :returns: (size_t) number of bytes - """ - return _ldns.ldns_buffer_remaining_at(self,at) - #parameters: ldns_buffer *,size_t, - #retvals: size_t - - def reserve(self,amount): - """ensures BUFFER can contain at least AMOUNT more bytes. - - The buffer's capacity is increased if necessary using buffer_set_capacity(). - - The buffer's limit is always set to the (possibly increased) capacity. - - :param amount: - amount to use - :returns: (bool) whether this failed or succeeded - """ - return _ldns.ldns_buffer_reserve(self,amount) - #parameters: ldns_buffer *,size_t, - #retvals: bool - - def rewind(self): - """make the buffer ready for re-reading the data. - - The buffer's position is reset to 0. - """ - _ldns.ldns_buffer_rewind(self) - #parameters: ldns_buffer *, - #retvals: - - def set_capacity(self,capacity): - """changes the buffer's capacity. - - The data is reallocated so any pointers to the data may become invalid. The buffer's limit is set to the buffer's new capacity. - - :param capacity: - the capacity to use - :returns: (bool) whether this failed or succeeded - """ - return _ldns.ldns_buffer_set_capacity(self,capacity) - #parameters: ldns_buffer *,size_t, - #retvals: bool - - def set_limit(self,limit): - """changes the buffer's limit. - - If the buffer's position is greater than the new limit the position is set to the limit. - - :param limit: - the new limit - """ - _ldns.ldns_buffer_set_limit(self,limit) - #parameters: ldns_buffer *,size_t, - #retvals: - - def set_position(self,mark): - """sets the buffer's position to MARK. - - The position must be less than or equal to the buffer's limit. - - :param mark: - the mark to use - """ - _ldns.ldns_buffer_set_position(self,mark) - #parameters: ldns_buffer *,size_t, - #retvals: - - def skip(self,count): - """changes the buffer's position by COUNT bytes. - - The position must not be moved behind the buffer's limit or before the beginning of the buffer. - - :param count: - the count to use - """ - _ldns.ldns_buffer_skip(self,count) - #parameters: ldns_buffer *,ssize_t, - #retvals: - - def status(self): - """returns the status of the buffer - - :returns: (ldns_status) the status - """ - return _ldns.ldns_buffer_status(self) - #parameters: ldns_buffer *, - #retvals: ldns_status - - def status_ok(self): - """returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise - - :returns: (bool) true or false - """ - return _ldns.ldns_buffer_status_ok(self) - #parameters: ldns_buffer *, - #retvals: bool - - def write(self,data,count): - """writes count bytes of data to the current position of the buffer - - :param data: - the data to write - :param count: - the lenght of the data to write - """ - _ldns.ldns_buffer_write(self,data,count) - #parameters: ldns_buffer *,const void *,size_t, - #retvals: - - def write_at(self,at,data,count): - """writes the given data to the buffer at the specified position - - :param at: - the position (in number of bytes) to write the data at - :param data: - pointer to the data to write to the buffer - :param count: - the number of bytes of data to write - """ - _ldns.ldns_buffer_write_at(self,at,data,count) - #parameters: ldns_buffer *,size_t,const void *,size_t, - #retvals: - - def write_string(self,str): - """copies the given (null-delimited) string to the current position at the buffer - - :param str: - the string to write - """ - _ldns.ldns_buffer_write_string(self,str) - #parameters: ldns_buffer *,const char *, - #retvals: - - def write_string_at(self,at,str): - """copies the given (null-delimited) string to the specified position at the buffer - - :param at: - the position in the buffer - :param str: - the string to write - """ - _ldns.ldns_buffer_write_string_at(self,at,str) - #parameters: ldns_buffer *,size_t,const char *, - #retvals: - - def write_u16(self,data): - """writes the given 2 byte integer at the current position in the buffer - - :param data: - the 16 bits to write - """ - _ldns.ldns_buffer_write_u16(self,data) - #parameters: ldns_buffer *,uint16_t, - #retvals: - - def write_u16_at(self,at,data): - """writes the given 2 byte integer at the given position in the buffer - - :param at: - the position in the buffer - :param data: - the 16 bits to write - """ - _ldns.ldns_buffer_write_u16_at(self,at,data) - #parameters: ldns_buffer *,size_t,uint16_t, - #retvals: - - def write_u32(self,data): - """writes the given 4 byte integer at the current position in the buffer - - :param data: - the 32 bits to write - """ - _ldns.ldns_buffer_write_u32(self,data) - #parameters: ldns_buffer *,uint32_t, - #retvals: - - def write_u32_at(self,at,data): - """writes the given 4 byte integer at the given position in the buffer - - :param at: - the position in the buffer - :param data: - the 32 bits to write - """ - _ldns.ldns_buffer_write_u32_at(self,at,data) - #parameters: ldns_buffer *,size_t,uint32_t, - #retvals: - - def write_u8(self,data): - """writes the given byte of data at the current position in the buffer - - :param data: - the 8 bits to write - """ - _ldns.ldns_buffer_write_u8(self,data) - #parameters: ldns_buffer *,uint8_t, - #retvals: - - def write_u8_at(self,at,data): - """writes the given byte of data at the given position in the buffer - - :param at: - the position in the buffer - :param data: - the 8 bits to write - """ - _ldns.ldns_buffer_write_u8_at(self,at,data) - #parameters: ldns_buffer *,size_t,uint8_t, - #retvals: - - #_LDNS_BUFFER_METHODS# - %} -} - diff --git a/libs/ldns/contrib/python/ldns_dname.i b/libs/ldns/contrib/python/ldns_dname.i deleted file mode 100644 index 0aac54c106..0000000000 --- a/libs/ldns/contrib/python/ldns_dname.i +++ /dev/null @@ -1,196 +0,0 @@ -/****************************************************************************** - * ldns_dname.i: LDNS domain name class - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ -%pythoncode %{ - class ldns_dname(ldns_rdf): - """Domain name - - This class contains methods to read and manipulate domain names. - Domain names are stored in ldns_rdf structures, with the type LDNS_RDF_TYPE_DNAME - - **Usage** - - >>> import ldns - >>> resolver = ldns.ldns_resolver.new_frm_file("/etc/resolv.conf") - >>> dn1 = ldns.ldns_dname("test.nic.cz") - >>> print dn1 - test.nic.cz. - >>> dn2 = ldns.ldns_dname("nic.cz") - >>> if dn2.is_subdomain(dn1): print dn2,"is subdomain of",dn1 - >>> if dn1.is_subdomain(dn2): print dn1,"is subdomain of",dn2 - test.nic.cz. is subdomain of nic.cz. - """ - def __init__(self, str): - """Creates a new dname rdf from a string. - - :parameter str: str string to use - """ - self.this = _ldns.ldns_dname_new_frm_str(str) - - @staticmethod - def new_frm_str(str): - """Creates a new dname rdf instance from a string. - - This static method is equivalent to using of default class constructor. - - :parameter str: str string to use - """ - return ldns_dname(str) - - def absolute(self): - """Checks whether the given dname string is absolute (i.e. ends with a '.') - - :returns: (bool) True or False - """ - return self.endswith(".") - - - def make_canonical(self): - """Put a dname into canonical fmt - ie. lowercase it - """ - _ldns.ldns_dname2canonical(self) - - def __cmp__(self,other): - """Compares the two dname rdf's according to the algorithm for ordering in RFC4034 Section 6. - - :param other: - the second dname rdf to compare - :returns: (int) -1 if dname comes before other, 1 if dname comes after other, and 0 if they are equal. - """ - return _ldns.ldns_dname_compare(self,other) - - def write_to_buffer(self,buffer): - """Copies the dname data to the buffer in wire format. - - :param buffer: buffer to append the result to - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_dname2buffer_wire(buffer,self) - #parameters: ldns_buffer *,const ldns_rdf *, - #retvals: ldns_status - - #LDNS_DNAME_METHODS_# - - def cat(self,rd2): - """concatenates rd2 after this dname (rd2 is copied, this dname is modified) - - :param rd2: - the rightside - :returns: (ldns_status) LDNS_STATUS_OK on success - """ - return _ldns.ldns_dname_cat(self,rd2) - #parameters: ldns_rdf *,ldns_rdf *, - #retvals: ldns_status - - def cat_clone(self,rd2): - """concatenates two dnames together - - :param rd2: - the rightside - :returns: (ldns_rdf \*) a new rdf with leftside/rightside - """ - return _ldns.ldns_dname_cat_clone(self,rd2) - #parameters: const ldns_rdf *,const ldns_rdf *, - #retvals: ldns_rdf * - - def interval(self,middle,next): - """check if middle lays in the interval defined by prev and next prev <= middle < next. - - This is usefull for nsec checking - - :param middle: - the dname to check - :param next: - the next dname return 0 on error or unknown, -1 when middle is in the interval, +1 when not - :returns: (int) - """ - return _ldns.ldns_dname_interval(self,middle,next) - #parameters: const ldns_rdf *,const ldns_rdf *,const ldns_rdf *, - #retvals: int - - def is_subdomain(self,parent): - """Tests wether the name sub falls under parent (i.e. is a subdomain of parent). - - This function will return false if the given dnames are equal. - - :param parent: - (ldns_rdf) the parent's name - :returns: (bool) true if sub falls under parent, otherwise false - """ - return _ldns.ldns_dname_is_subdomain(self,parent) - #parameters: const ldns_rdf *,const ldns_rdf *, - #retvals: bool - - def label(self,labelpos): - """look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label. - - The labels are numbered starting from 0 (left most). - - :param labelpos: - return the label with this number - :returns: (ldns_rdf \*) a ldns_rdf* with the label as name or NULL on error - """ - return _ldns.ldns_dname_label(self,labelpos) - #parameters: const ldns_rdf *,uint8_t, - #retvals: ldns_rdf * - - def label_count(self): - """count the number of labels inside a LDNS_RDF_DNAME type rdf. - - :returns: (uint8_t) the number of labels - """ - return _ldns.ldns_dname_label_count(self) - #parameters: const ldns_rdf *, - #retvals: uint8_t - - def left_chop(self): - """chop one label off the left side of a dname. - - so wwww.nlnetlabs.nl, becomes nlnetlabs.nl - - :returns: (ldns_rdf \*) the remaining dname - """ - return _ldns.ldns_dname_left_chop(self) - #parameters: const ldns_rdf *, - #retvals: ldns_rdf * - - def reverse(self): - """Returns a clone of the given dname with the labels reversed. - - :returns: (ldns_rdf \*) clone of the dname with the labels reversed. - """ - return _ldns.ldns_dname_reverse(self) - #parameters: const ldns_rdf *, - #retvals: ldns_rdf * - - #_LDNS_DNAME_METHODS# -%} - diff --git a/libs/ldns/contrib/python/ldns_dnssec.i b/libs/ldns/contrib/python/ldns_dnssec.i deleted file mode 100644 index 6c06564846..0000000000 --- a/libs/ldns/contrib/python/ldns_dnssec.i +++ /dev/null @@ -1,434 +0,0 @@ -/****************************************************************************** - * ldns_dnssec.i: DNSSEC zone, name, rrs - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ -%nodefaultctor ldns_dnssec_rrs; //no default constructor & destructor -%nodefaultdtor ldns_dnssec_rrs; - -%newobject ldns_dnssec_rrs_new; -%delobject ldns_dnssec_rrs_free; - -%extend ldns_dnssec_rrs { - %pythoncode %{ - - def __init__(self): - """Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs. - - :returns: (ldns_dnssec_rrs) the allocated data - """ - self.this = _ldns.ldns_dnssec_rrs_new() - if not self.this: - raise Exception("Can't create rrs instance") - - __swig_destroy__ = _ldns.ldns_dnssec_rrs_free - - #LDNS_DNSSEC_RRS_METHODS_# - def add_rr(self,rr): - """Adds an RR to the list of RRs. - - The list will remain ordered - - :param rr: - the RR to add - :returns: (ldns_status) LDNS_STATUS_OK on success - """ - return _ldns.ldns_dnssec_rrs_add_rr(self,rr) - #parameters: ldns_dnssec_rrs *,ldns_rr *, - #retvals: ldns_status - #_LDNS_DNSSEC_RRS_METHODS# - %} -} - -// ================================================================================ -// DNNSEC RRS -// ================================================================================ -%nodefaultctor ldns_dnssec_rrsets; //no default constructor & destructor -%nodefaultdtor ldns_dnssec_rrsets; - -%newobject ldns_dnssec_rrsets_new; -%delobject ldns_dnssec_rrsets_free; - -%extend ldns_dnssec_rrsets { - %pythoncode %{ - def __init__(self): - """Creates a new list (entry) of RRsets. - - :returns: (ldns_dnssec_rrsets \*) instance - """ - self.this = _ldns.ldns_dnssec_rrsets_new() - if not self.this: - raise Exception("Can't create rrsets instance") - - __swig_destroy__ = _ldns.ldns_dnssec_rrsets_free - - def print_to_file(self, file, follow): - """Print the given list of rrsets to the given file descriptor. - - :param file: file pointer - :param follow: if set to false, only print the first RRset - """ - _ldns.ldns_dnssec_rrsets_print(file,self,follow) - #parameters: FILE *,ldns_dnssec_rrsets *,bool, - #retvals: - - #LDNS_DNSSEC_RRSETS_METHODS_# - def add_rr(self,rr): - """Add an ldns_rr to the corresponding RRset in the given list of RRsets. - - If it is not present, add it as a new RRset with 1 record. - - :param rr: - the rr to add to the list of rrsets - :returns: (ldns_status) LDNS_STATUS_OK on success - """ - return _ldns.ldns_dnssec_rrsets_add_rr(self,rr) - #parameters: ldns_dnssec_rrsets *,ldns_rr *, - #retvals: ldns_status - - def set_type(self,atype): - """Sets the RR type of the rrset (that is head of the given list). - - :param atype: - :returns: (ldns_status) LDNS_STATUS_OK on success - """ - return _ldns.ldns_dnssec_rrsets_set_type(self,atype) - #parameters: ldns_dnssec_rrsets *,ldns_rr_type, - #retvals: ldns_status - - def type(self): - """Returns the rr type of the rrset (that is head of the given list). - - :returns: (ldns_rr_type) the rr type - """ - return _ldns.ldns_dnssec_rrsets_type(self) - #parameters: ldns_dnssec_rrsets *, - #retvals: ldns_rr_type - #_LDNS_DNSSEC_RRSETS_METHODS# - %} -} - -// ================================================================================ -// DNNSEC NAME -// ================================================================================ -%nodefaultctor ldns_dnssec_name; //no default constructor & destructor -%nodefaultdtor ldns_dnssec_name; - -%newobject ldns_dnssec_name_new; -%delobject ldns_dnssec_name_free; - -%extend ldns_dnssec_name { - %pythoncode %{ - def __init__(self): - """Create a new instance of dnssec name.""" - self.this = _ldns.ldns_dnssec_name_new() - if not self.this: - raise Exception("Can't create dnssec name instance") - - __swig_destroy__ = _ldns.ldns_dnssec_name_free - - def print_to_file(self,file): - """Prints the RRs in the dnssec name structure to the given file descriptor. - - :param file: file pointer - """ - _ldns.ldns_dnssec_name_print(file, self) - #parameters: FILE *,ldns_dnssec_name *, - - @staticmethod - def new_frm_rr(raiseException=True): - """Create a new instace of dnssec name for the given RR. - - :returns: (ldns_dnssec_name) instance - """ - name = _ldns.ldns_dnssec_name_new_frm_rr(self) - if (not name) and (raiseException): - raise Exception("Can't create dnssec name") - return name - - #LDNS_DNSSEC_NAME_METHODS_# - def add_rr(self,rr): - """Inserts the given rr at the right place in the current dnssec_name No checking is done whether the name matches. - - :param rr: - The RR to add - :returns: (ldns_status) LDNS_STATUS_OK on success, error code otherwise - """ - return _ldns.ldns_dnssec_name_add_rr(self,rr) - #parameters: ldns_dnssec_name *,ldns_rr *, - #retvals: ldns_status - - def find_rrset(self,atype): - """Find the RRset with the given type in within this name structure. - - :param atype: - :returns: (ldns_dnssec_rrsets \*) the RRset, or NULL if not present - """ - return _ldns.ldns_dnssec_name_find_rrset(self,atype) - #parameters: ldns_dnssec_name *,ldns_rr_type, - #retvals: ldns_dnssec_rrsets * - - def name(self): - """Returns the domain name of the given dnssec_name structure. - - :returns: (ldns_rdf \*) the domain name - """ - return _ldns.ldns_dnssec_name_name(self) - #parameters: ldns_dnssec_name *, - #retvals: ldns_rdf * - - def set_name(self,dname): - """Sets the domain name of the given dnssec_name structure. - - :param dname: - the domain name to set it to. This data is *not* copied. - """ - _ldns.ldns_dnssec_name_set_name(self,dname) - #parameters: ldns_dnssec_name *,ldns_rdf *, - #retvals: - - def set_nsec(self,nsec): - """Sets the NSEC(3) RR of the given dnssec_name structure. - - :param nsec: - the nsec rr to set it to. This data is *not* copied. - """ - _ldns.ldns_dnssec_name_set_nsec(self,nsec) - #parameters: ldns_dnssec_name *,ldns_rr *, - #retvals: - #_LDNS_DNSSEC_NAME_METHODS# - %} -} - -// ================================================================================ -// DNNSEC ZONE -// ================================================================================ -%nodefaultctor ldns_dnssec_zone; //no default constructor & destructor -%nodefaultdtor ldns_dnssec_zone; - -%newobject ldns_dnssec_zone_new; -%delobject ldns_dnssec_zone_free; - -%inline %{ -ldns_status ldns_dnssec_zone_sign_defcb(ldns_dnssec_zone *zone, ldns_rr_list *new_rrs, ldns_key_list *key_list, int cbtype) -{ - if (cbtype == 0) - return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_add_to_signatures, NULL); - if (cbtype == 1) - return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_leave_signatures, NULL); - if (cbtype == 2) - return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_delete_signatures, NULL); - - return ldns_dnssec_zone_sign(zone, new_rrs, key_list, ldns_dnssec_default_replace_signatures, NULL); -} -%} - -%extend ldns_dnssec_zone { - %pythoncode %{ - - def __init__(self): - """Creates a new dnssec_zone instance""" - self.this = _ldns.ldns_dnssec_zone_new() - if not self.this: - raise Exception("Can't create dnssec zone instance") - - __swig_destroy__ = _ldns.ldns_dnssec_zone_free - - def print_to_file(self,file): - """Prints the complete zone to the given file descriptor. - - :param file: file pointer - """ - _ldns.ldns_dnssec_zone_print(file, self) - #parameters: FILE *, ldns_dnssec_zone *, - #retvals: - - def create_nsec3s(self,new_rrs,algorithm,flags,iterations,salt_length,salt): - """Adds NSEC3 records to the zone. - - :param new_rrs: - :param algorithm: - :param flags: - :param iterations: - :param salt_length: - :param salt: - :returns: (ldns_status) - """ - return _ldns.ldns_dnssec_zone_create_nsec3s(self,new_rrs,algorithm,flags,iterations,salt_length,salt) - #parameters: ldns_dnssec_zone *,ldns_rr_list *,uint8_t,uint8_t,uint16_t,uint8_t,uint8_t *, - #retvals: ldns_status - - def create_nsecs(self,new_rrs): - """Adds NSEC records to the given dnssec_zone. - - :param new_rrs: - ldns_rr's created by this function are added to this rr list, so the caller can free them later - :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise - """ - return _ldns.ldns_dnssec_zone_create_nsecs(self,new_rrs) - #parameters: ldns_dnssec_zone *,ldns_rr_list *, - #retvals: ldns_status - - def create_rrsigs(self,new_rrs,key_list,func,arg): - """Adds signatures to the zone. - - :param new_rrs: - the RRSIG RRs that are created are also added to this list, so the caller can free them later - :param key_list: - list of keys to sign with. - :param func: - Callback function to decide what keys to use and what to do with old signatures - :param arg: - Optional argument for the callback function - :returns: (ldns_status) LDNS_STATUS_OK on success, error otherwise - """ - return _ldns.ldns_dnssec_zone_create_rrsigs(self,new_rrs,key_list,func,arg) - #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *,int(*)(ldns_rr *, void *),void *, - #retvals: ldns_status - - def sign_cb(self,new_rrs,key_list,func,arg): - """signs the given zone with the given keys (with callback function) - - :param new_rrs: - newly created resource records are added to this list, to free them later - :param key_list: - the list of keys to sign the zone with - :param func: - callback function that decides what to do with old signatures. - This function takes an ldns_rr and an optional arg argument, and returns one of four values: - - * LDNS_SIGNATURE_LEAVE_ADD_NEW - leave the signature and add a new one for the corresponding key - - * LDNS_SIGNATURE_REMOVE_ADD_NEW - remove the signature and replace is with a new one from the same key - - * LDNS_SIGNATURE_LEAVE_NO_ADD - leave the signature and do not add a new one with the corresponding key - - * LDNS_SIGNATURE_REMOVE_NO_ADD - remove the signature and do not replace - - :param arg: - optional argument for the callback function - :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise - """ - return _ldns.ldns_dnssec_zone_sign(self,new_rrs,key_list,func,arg) - #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *,int(*)(ldns_rr *, void *),void *, - #retvals: ldns_status - - def sign(self,new_rrs,key_list, cbtype=3): - """signs the given zone with the given keys - - :param new_rrs: - newly created resource records are added to this list, to free them later - :param key_list: - the list of keys to sign the zone with - :param cb_type: - specifies how to deal with old signatures, possible values: - - * 0 - ldns_dnssec_default_add_to_signatures, - - * 1 - ldns_dnssec_default_leave_signatures, - - * 2 - ldns_dnssec_default_delete_signatures, - - * 3 - ldns_dnssec_default_replace_signatures - - :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise - """ - return _ldns.ldns_dnssec_zone_sign_defcb(self,new_rrs,key_list, cbtype) - #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *, - #retvals: ldns_status - - def sign_nsec3(self,new_rrs,key_list,func,arg,algorithm,flags,iterations,salt_length,salt): - """signs the given zone with the given new zone, with NSEC3 - - :param new_rrs: - newly created resource records are added to this list, to free them later - :param key_list: - the list of keys to sign the zone with - :param func: - callback function that decides what to do with old signatures - :param arg: - optional argument for the callback function - :param algorithm: - the NSEC3 hashing algorithm to use - :param flags: - NSEC3 flags - :param iterations: - the number of NSEC3 hash iterations to use - :param salt_length: - the length (in octets) of the NSEC3 salt - :param salt: - the NSEC3 salt data - :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise - """ - return _ldns.ldns_dnssec_zone_sign_nsec3(self,new_rrs,key_list,func,arg,algorithm,flags,iterations,salt_length,salt) - #parameters: ldns_dnssec_zone *,ldns_rr_list *,ldns_key_list *,int(*)(ldns_rr *, void *),void *,uint8_t,uint8_t,uint16_t,uint8_t,uint8_t *, - #retvals: ldns_status - - #LDNS_DNSSEC_ZONE_METHODS_# - def add_empty_nonterminals(self): - """Adds explicit dnssec_name structures for the empty nonterminals in this zone. - - (this is needed for NSEC3 generation) - - :returns: (ldns_status) - """ - return _ldns.ldns_dnssec_zone_add_empty_nonterminals(self) - #parameters: ldns_dnssec_zone *, - #retvals: ldns_status - - def add_rr(self,rr): - """Adds the given RR to the zone. - - It find whether there is a dnssec_name with that name present. - If so, add it to that, if not create a new one. - Special handling of NSEC and RRSIG provided. - - :param rr: - The RR to add - :returns: (ldns_status) LDNS_STATUS_OK on success, an error code otherwise - """ - return _ldns.ldns_dnssec_zone_add_rr(self,rr) - #parameters: ldns_dnssec_zone *,ldns_rr *, - #retvals: ldns_status - - def find_rrset(self,dname,atype): - """Find the RRset with the given name and type in the zone. - - :param dname: - the domain name of the RRset to find - :param atype: - :returns: (ldns_dnssec_rrsets \*) the RRset, or NULL if not present - """ - return _ldns.ldns_dnssec_zone_find_rrset(self,dname,atype) - #parameters: ldns_dnssec_zone *,ldns_rdf *,ldns_rr_type, - #retvals: ldns_dnssec_rrsets * - - #_LDNS_DNSSEC_ZONE_METHODS# - %} -} diff --git a/libs/ldns/contrib/python/ldns_key.i b/libs/ldns/contrib/python/ldns_key.i deleted file mode 100644 index 26a9b0f57f..0000000000 --- a/libs/ldns/contrib/python/ldns_key.i +++ /dev/null @@ -1,536 +0,0 @@ -/****************************************************************************** - * ldns_key.i: LDNS key class - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ -%typemap(in,numinputs=0,noblock=1) (ldns_key **) -{ - ldns_key *$1_key; - $1 = &$1_key; -} - -/* result generation */ -%typemap(argout,noblock=1) (ldns_key **) -{ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_key), SWIGTYPE_p_ldns_struct_key, SWIG_POINTER_OWN | 0 )); -} - -%exception ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r) %{ $action Py_INCREF(obj1); %} - -%nodefaultctor ldns_struct_key; //no default constructor & destructor -%nodefaultdtor ldns_struct_key; - -%delobject ldns_key_free; -%delobject ldns_key_deep_free; -%newobject ldns_key_list_pop_key; -%newobject ldns_key2rr; -%newobject ldns_key_new_frm_algorithm; -%newobject ldns_key_new_frm_fp; -%newobject ldns_key_new_frm_fp_l; -%newobject ldns_key_new_frm_engine; - -%rename(ldns_key) ldns_struct_key; - -#ifdef LDNS_DEBUG -%rename(__ldns_key_free) ldns_key_free; -%inline %{ -void _ldns_key_free (ldns_key* k) { - printf("******** LDNS_KEY free 0x%lX ************\n", (long unsigned int)k); - ldns_key_deep_free(k); -} -%} -#else -%rename(_ldns_key_free) ldns_key_deep_free; -%rename(__ldns_key_free) ldns_key_free; -#endif - -%feature("docstring") ldns_struct_key "Key class - -This class can contains all types of keys that are used in DNSSEC. Mostly used to store private keys, since public keys can also be stored in a ldns_rr with type LDNS_RR_TYPE_DNSKEY. This class can also store some variables that influence the signatures generated by signing with this key, for instance the inception date. - -**Usage** - - >>> import ldns - >>> ldns.ldns_init_random(open(\"/dev/random\",\"rb\"), 512/8) - >>> key = ldns.ldns_key.new_frm_algorithm(ldns.LDNS_SIGN_DSA, 512) #generate new DSA key - >>> print key - Private-key-format: v1.2 - Algorithm: 3 (DSA) - Prime(p): XXXXXXXXHRQBGRflHZQriSAoLI2g+LGvZz8BlEesO+ZQg65wrFGs9IC441y/mn3nFnXfCdtX6zbN5bQuabPdlQ== - Subprime(q): XXXXXdnWs/cWsGDglhEyZRLEVA8= - Base(g): XXXXXXXqrd+dm2bcxDBdCsZRzkXQ22FxCk2ycnjgevr+s2HfA57BPk3xwqCrHUwuOBVg3Fvq4bpldrCe0sT6Og== - Private_value(x): XXXXXcVubZF33pj04z4ZoETsQW1Y= - Public_value(y): XXXXXX8t6zfOxJHoy57qteIw9sOZ/Zu0yFiPO083sPm11NlFx3b4m7TJ2k41gYicHXHLUQK1p0xXFToeZEkPGQ== - >>> fw = open(\"key.priv\", \"wb\") - >>> key.print_to_file(fw) #write priv key to file -" - -%extend ldns_struct_key { - - %pythoncode %{ - def __init__(self): - self.this = _ldns.ldns_key_new() - if not self.this: - raise Exception("Can't create instance of this class") - - __swig_destroy__ = _ldns._ldns_key_free - - def __str__(self): - """converts the data to presentation format""" - return _ldns.ldns_key2str(self) - - - def key_to_rr(self): - """converts a ldns_key to a public key rr - - :returns: (ldns_rr \*) ldns_rr representation of the key - """ - return _ldns.ldns_key2rr(self) - #parameters: const ldns_key *, - #retvals: ldns_rr * - - def print_to_file(self, file): - """print a private key to the file ouput - - :param file: output file pointer - """ - _ldns.ldns_key_print(file, self) - #parameters: FILE *, const ldns_key *, - #retvals: - - #LDNS_KEY_CONSTRUCTORS_# - @staticmethod - def new_frm_fp(file, raiseException=True): - """Creates a new priv key based on the contents of the file pointed by fp. - - :param file: a file object - :param raiseException: if True, an exception occurs in case a key instance can't be created - :returns: key instance or None. If the object can't be created and raiseException is True, an exception occurs. - """ - status, key = _ldns.ldns_key_new_frm_fp(file) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create key, error: %s (%d)" % (_ldns.ldns_get_errorstr_by_id(status),status)) - return None - return key - - @staticmethod - def new_frm_fp_l(file, raiseException=True): - """Creates a new private key based on the contents of the file pointed by fp. - - :param file: a file object - :param raiseException: if True, an exception occurs in case a key instance can't be created - :returns: - * key - key instance or None. If an instance can't be created and raiseException is True, an exception occurs. - - * line - the line number (for debugging) - """ - status, key, line = _ldns.ldns_key_new_frm_fp_l(file) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create key, error: %d" % status) - return None - return key, line - - @staticmethod - def new_frm_algorithm(algorithm, size, raiseException=True): - """Creates a new key based on the algorithm. - - :param algorithm: the algorithm to use - :param size: the number of bytes for the keysize - :param raiseException: if True, an exception occurs in case a key instance can't be created - :returns: key instance or None. If the object can't be created and raiseException is True, an exception occurs. - - **Algorithms** - LDNS_SIGN_RSAMD5, LDNS_SIGN_RSASHA1, LDNS_SIGN_DSA, LDNS_SIGN_RSASHA1_NSEC3, LDNS_SIGN_RSASHA256, LDNS_SIGN_RSASHA256_NSEC3, LDNS_SIGN_RSASHA512, LDNS_SIGN_RSASHA512_NSEC3, LDNS_SIGN_DSA_NSEC3, LDNS_SIGN_HMACMD5, LDNS_SIGN_HMACSHA1, LDNS_SIGN_HMACSHA256 - """ - key = _ldns.ldns_key_new_frm_algorithm(algorithm, size) - if (not key) and (raiseException): raise Exception("Can't create key, error: %d" % status) - return key - #_LDNS_KEY_CONSTRUCTORS# - - #LDNS_KEY_METHODS_# - def algorithm(self): - """return the signing alg of the key - - :returns: (ldns_signing_algorithm) the algorithm - """ - return _ldns.ldns_key_algorithm(self) - #parameters: const ldns_key *, - #retvals: ldns_signing_algorithm - - def dsa_key(self): - """returns the (openssl) DSA struct contained in the key - - :returns: (DSA \*) - """ - return _ldns.ldns_key_dsa_key(self) - #parameters: const ldns_key *, - #retvals: DSA * - - def evp_key(self): - """returns the (openssl) EVP struct contained in the key - - :returns: (EVP_PKEY \*) the RSA * structure in the key - """ - return _ldns.ldns_key_evp_key(self) - #parameters: const ldns_key *, - #retvals: EVP_PKEY * - - def expiration(self): - """return the key's expiration date - - :returns: (uint32_t) the experiration date - """ - return _ldns.ldns_key_expiration(self) - #parameters: const ldns_key *, - #retvals: uint32_t - - def flags(self): - """return the flag of the key - - :returns: (uint16_t) the flag - """ - return _ldns.ldns_key_flags(self) - #parameters: const ldns_key *, - #retvals: uint16_t - - def hmac_key(self): - """return the hmac key data - - :returns: (unsigned char \*) the hmac key data - """ - return _ldns.ldns_key_hmac_key(self) - #parameters: const ldns_key *, - #retvals: unsigned char * - - def hmac_size(self): - """return the hmac key size - - :returns: (size_t) the hmac key size - """ - return _ldns.ldns_key_hmac_size(self) - #parameters: const ldns_key *, - #retvals: size_t - - def inception(self): - """return the key's inception date - - :returns: (uint32_t) the inception date - """ - return _ldns.ldns_key_inception(self) - #parameters: const ldns_key *, - #retvals: uint32_t - - def keytag(self): - """return the keytag - - :returns: (uint16_t) the keytag - """ - return _ldns.ldns_key_keytag(self) - #parameters: const ldns_key *, - #retvals: uint16_t - - def origttl(self): - """return the original ttl of the key - - :returns: (uint32_t) the original ttl - """ - return _ldns.ldns_key_origttl(self) - #parameters: const ldns_key *, - #retvals: uint32_t - - def pubkey_owner(self): - """return the public key's owner - - :returns: (ldns_rdf \*) the owner - """ - return _ldns.ldns_key_pubkey_owner(self) - #parameters: const ldns_key *, - #retvals: ldns_rdf * - - def rsa_key(self): - """returns the (openssl) RSA struct contained in the key - - :returns: (RSA \*) the RSA * structure in the key - """ - return _ldns.ldns_key_rsa_key(self) - #parameters: const ldns_key *, - #retvals: RSA * - - def set_algorithm(self,l): - """Set the key's algorithm. - - :param l: - the algorithm - """ - _ldns.ldns_key_set_algorithm(self,l) - #parameters: ldns_key *,ldns_signing_algorithm, - #retvals: - - def set_dsa_key(self,d): - """Set the key's dsa data. - - :param d: - the dsa data - """ - _ldns.ldns_key_set_dsa_key(self,d) - #parameters: ldns_key *,DSA *, - #retvals: - - def set_evp_key(self,e): - """Set the key's evp key. - - :param e: - the evp key - """ - _ldns.ldns_key_set_evp_key(self,e) - #parameters: ldns_key *,EVP_PKEY *, - #retvals: - - def set_expiration(self,e): - """Set the key's expiration date (seconds after epoch). - - :param e: - the expiration - """ - _ldns.ldns_key_set_expiration(self,e) - #parameters: ldns_key *,uint32_t, - #retvals: - - def set_flags(self,flags): - """Set the key's flags. - - :param flags: - the flags - """ - _ldns.ldns_key_set_flags(self,flags) - #parameters: ldns_key *,uint16_t, - #retvals: - - def set_hmac_key(self,hmac): - """Set the key's hmac data. - - :param hmac: - the raw key data - """ - _ldns.ldns_key_set_hmac_key(self,hmac) - #parameters: ldns_key *,unsigned char *, - #retvals: - - def set_hmac_size(self,hmac_size): - """Set the key's hmac size. - - :param hmac_size: - the size of the hmac data - """ - _ldns.ldns_key_set_hmac_size(self,hmac_size) - #parameters: ldns_key *,size_t, - #retvals: - - def set_inception(self,i): - """Set the key's inception date (seconds after epoch). - - :param i: - the inception - """ - _ldns.ldns_key_set_inception(self,i) - #parameters: ldns_key *,uint32_t, - #retvals: - - def set_keytag(self,tag): - """Set the key's key tag. - - :param tag: - the keytag - """ - _ldns.ldns_key_set_keytag(self,tag) - #parameters: ldns_key *,uint16_t, - #retvals: - - def set_origttl(self,t): - """Set the key's original ttl. - - :param t: - the ttl - """ - _ldns.ldns_key_set_origttl(self,t) - #parameters: ldns_key *,uint32_t, - #retvals: - - def set_pubkey_owner(self,r): - """Set the key's pubkey owner. - - :param r: - the owner - """ - _ldns.ldns_key_set_pubkey_owner(self,r) - #parameters: ldns_key *,ldns_rdf *, - #retvals: - - def set_rsa_key(self,r): - """Set the key's rsa data. - - :param r: - the rsa data - """ - _ldns.ldns_key_set_rsa_key(self,r) - #parameters: ldns_key *,RSA *, - #retvals: - - def set_use(self,v): - """set the use flag - - :param v: - the boolean value to set the _use field to - """ - _ldns.ldns_key_set_use(self,v) - #parameters: ldns_key *,bool, - #retvals: - - def use(self): - """return the use flag - - :returns: (bool) the boolean value of the _use field - """ - return _ldns.ldns_key_use(self) - #parameters: const ldns_key *, - #retvals: bool - #_LDNS_KEY_METHODS# - %} -} - -%nodefaultctor ldns_struct_key_list; //no default constructor & destructor -%nodefaultdtor ldns_struct_key_list; - -%newobject ldns_key_list_new; -%newobject ldns_key_list_pop_key; -%delobject ldns_key_list_free; -%delobject ldns_key_list_push_key; - -%rename(ldns_key_list) ldns_struct_key_list; - -#ifdef LDNS_DEBUG -%rename(__ldns_key_list_free) ldns_key_list_free; -%inline %{ -void _ldns_key_list_free (ldns_key_list* k) { - printf("******** LDNS_KEY_LIST free 0x%lX ************\n", (long unsigned int)k); - ldns_key_list_free(k); -} -%} -#else -%rename(_ldns_key_list_free) ldns_key_list_free; -#endif - -%extend ldns_struct_key_list { - - %pythoncode %{ - def __init__(self): - self.this = _ldns.ldns_key_list_new() - if not self.this: - raise Exception("Can't create class") - - __swig_destroy__ = _ldns._ldns_key_list_free - - def keys(self): - """Key list iterator""" - for i in range(0, self.key_count()): - yield self.key(i) - - def __str__(self): - i = 0 - s = "" - for k in self.keys(): - i += 1 - s += "key %d:\n %s\n" % (i, str(k).replace("\n","\n ")) - return s - - #LDNS_KEY_LIST_METHODS_# - def key(self,nr): - """returns a pointer to the key in the list at the given position - - :param nr: - the position in the list - :returns: (ldns_key \*) the key - """ - return _ldns.ldns_key_list_key(self,nr) - #parameters: const ldns_key_list *,size_t, - #retvals: ldns_key * - - def key_count(self): - """returns the number of keys in the key list - - :returns: (size_t) the numbers of keys in the list - """ - return _ldns.ldns_key_list_key_count(self) - #parameters: const ldns_key_list *, - #retvals: size_t - - def pop_key(self): - """pops the last rr from a keylist - - :returns: (ldns_key \*) NULL if nothing to pop. Otherwise the popped RR - """ - return _ldns.ldns_key_list_pop_key(self) - #parameters: ldns_key_list *, - #retvals: ldns_key * - - def push_key(self,key): - """pushes a key to a keylist - - :param key: - the key to push - :returns: (bool) false on error, otherwise true - """ - return _ldns.ldns_key_list_push_key(self,key) - #parameters: ldns_key_list *,ldns_key *, - #retvals: bool - - def set_key_count(self,count): - """Set the keylist's key count to count. - - :param count: - the cuont - """ - _ldns.ldns_key_list_set_key_count(self,count) - #parameters: ldns_key_list *,size_t, - #retvals: - - def set_use(self,v): - """Set the 'use' flag for all keys in the list. - - :param v: - The value to set the use flags to - """ - _ldns.ldns_key_list_set_use(self,v) - #parameters: ldns_key_list *,bool, - #retvals: - - #_LDNS_KEY_LIST_METHODS# - %} -} - diff --git a/libs/ldns/contrib/python/ldns_packet.i b/libs/ldns/contrib/python/ldns_packet.i deleted file mode 100644 index 21f31bd011..0000000000 --- a/libs/ldns/contrib/python/ldns_packet.i +++ /dev/null @@ -1,1036 +0,0 @@ -/****************************************************************************** - * ldns_packet.i: LDNS packet class - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ -%typemap(in,numinputs=0,noblock=1) (ldns_pkt **) -{ - ldns_pkt *$1_pkt; - $1 = &$1_pkt; -} - -/* result generation */ -%typemap(argout,noblock=1) (ldns_pkt **) -{ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_pkt), SWIGTYPE_p_ldns_struct_pkt, SWIG_POINTER_OWN | 0 )); -} - -%newobject ldns_pkt_clone; -%newobject ldns_pkt_rr_list_by_type; -%newobject ldns_pkt_rr_list_by_name_and_type; -%newobject ldns_pkt_rr_list_by_name; -%newobject ldns_update_pkt_new; - -%nodefaultctor ldns_struct_pkt; //no default constructor & destructor -%nodefaultdtor ldns_struct_pkt; - -%rename(ldns_pkt) ldns_struct_pkt; -#ifdef LDNS_DEBUG -%rename(__ldns_pkt_free) ldns_pkt_free; -%inline %{ -void _ldns_pkt_free (ldns_pkt* p) { - printf("******** LDNS_PKT free 0x%lX ************\n", (long unsigned int)p); - ldns_pkt_free(p); -} -%} -#else -%rename(_ldns_pkt_free) ldns_pkt_free; -#endif - -%newobject ldns_pkt2str; -%newobject ldns_pkt_opcode2str; -%newobject ldns_pkt_rcode2str; -%newobject ldns_pkt_algorithm2str; -%newobject ldns_pkt_cert_algorithm2str; - -%exception ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr) %{ $action if (result) Py_INCREF(obj2); %} -%exception ldns_pkt_push_rr_list(ldns_pkt *packet, ldns_pkt_section section, ldns_rr_list *list) %{ $action if (result) Py_INCREF(obj2); %} - - -%feature("docstring") ldns_struct_pkt "LDNS packet object. - -The ldns_pkt object contains DNS packed (either a query or an answer). It is the complete representation of what you actually send to a nameserver, and what you get back (see :class:`ldns.ldns_resolver`). - -**Usage** - ->>> import ldns ->>> resolver = ldns.ldns_resolver.new_frm_file(\"/etc/resolv.conf\") ->>> pkt = resolver.query(\"nic.cz\", ldns.LDNS_RR_TYPE_NS,ldns.LDNS_RR_CLASS_IN) ->>> print pkt -;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 63004 -;; flags: qr rd ra ; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0 -;; QUESTION SECTION: -;; nic.cz. IN NS -;; ANSWER SECTION: -nic.cz. 758 IN NS a.ns.nic.cz. -nic.cz. 758 IN NS c.ns.nic.cz. -nic.cz. 758 IN NS e.ns.nic.cz. -;; AUTHORITY SECTION: -;; ADDITIONAL SECTION: -;; Query time: 8 msec -;; SERVER: 82.100.38.2 -;; WHEN: Thu Jan 11 12:54:33 2009 -;; MSG SIZE rcvd: 75 - -This simple example instances a resolver in order to resolve NS for nic.cz. -" - -%extend ldns_struct_pkt { - - %pythoncode %{ - def __init__(self): - raise Exception("This class can't be created directly. Please use: ldns_pkt_new(), ldns_pkt_query_new() or ldns_pkt_query_new_frm_str()") - - __swig_destroy__ = _ldns._ldns_pkt_free - - #LDNS_PKT_CONSTRUCTORS_# - @staticmethod - def new_query(rr_name, rr_type, rr_class, flags): - """Creates a packet with a query in it for the given name, type and class. - - :param rr_name: the name to query for - :param rr_type: the type to query for - :param rr_class: the class to query for - :param flags: packet flags - :returns: new ldns_pkt object - """ - return _ldns.ldns_pkt_query_new(rr_name, rr_type, rr_class, flags) - - @staticmethod - def new_query_frm_str(rr_name, rr_type, rr_class, flags, raiseException = True): - """Creates a query packet for the given name, type, class. - - :param rr_name: the name to query for - :param rr_type: the type to query for - :param rr_class: the class to query for - :param flags: packet flags - :param raiseException: if True, an exception occurs in case a resolver object can't be created - :returns: query packet object or None. If the object can't be created and raiseException is True, an exception occurs. - - - **Usage** - - >>> pkt = ldns.ldns_pkt.new_query_frm_str("test.nic.cz",ldns.LDNS_RR_TYPE_ANY, ldns.LDNS_RR_CLASS_IN, ldns.LDNS_QR | ldns.LDNS_AA) - >>> rra = ldns.ldns_rr.new_frm_str("test.nic.cz. IN A 192.168.1.1",300) - >>> list = ldns.ldns_rr_list() - >>> if (rra): list.push_rr(rra) - >>> pkt.push_rr_list(ldns.LDNS_SECTION_ANSWER, list) - >>> print pkt - ;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 0 - ;; flags: qr aa ; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0 - ;; QUESTION SECTION: - ;; test.nic.cz. IN ANY - ;; ANSWER SECTION: - test.nic.cz. 300 IN A 192.168.1.1 - ;; AUTHORITY SECTION: - ;; ADDITIONAL SECTION: - ;; Query time: 0 msec - ;; WHEN: Thu Jan 1 01:00:00 1970 - ;; MSG SIZE rcvd: 0 - """ - status, pkt = _ldns.ldns_pkt_query_new_frm_str(rr_name, rr_type, rr_class, flags) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create query packet, error: %d" % status) - return None - return pkt - #_LDNS_PKT_CONSTRUCTORS# - - def __str__(self): - """Converts the data in the DNS packet to presentation format""" - return _ldns.ldns_pkt2str(self) - - def opcode2str(self): - """Converts a packet opcode to its mnemonic and returns that as an allocated null-terminated string.""" - return _ldns.ldns_pkt_opcode2str(sefl.get_opcode()) - - def rcode2str(self): - """Converts a packet rcode to its mnemonic and returns that as an allocated null-terminated string.""" - return _ldns.ldns_pkt_rcode2str(self.get_rcode()) - - def print_to_file(self,output): - """Prints the data in the DNS packet to the given file stream (in presentation format).""" - _ldns.ldns_pkt_print(output,self) - #parameters: FILE *,const ldns_pkt *, - - def write_to_buffer(self, buffer): - """Copies the packet data to the buffer in wire format. - - :param buffer: buffer to append the result to - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_pkt2buffer_wire(buffer, self) - #parameters: ldns_buffer *,const ldns_pkt *, - #retvals: ldns_status - - @staticmethod - def algorithm2str(alg): - """Converts a signing algorithms to its mnemonic and returns that as an allocated null-terminated string.""" - return _ldns.ldns_pkt_algorithm2str(alg) - #parameters: ldns_algorithm, - - @staticmethod - def cert_algorithm2str(alg): - """Converts a cert algorithm to its mnemonic and returns that as an allocated null-terminated string.""" - return _ldns.ldns_pkt_cert_algorithm2str(alg) - #parameters: ldns_algorithm, - - #LDNS_PKT_METHODS_# - def aa(self): - """Read the packet's aa bit. - - :returns: (bool) value of the bit - """ - return _ldns.ldns_pkt_aa(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def ad(self): - """Read the packet's ad bit. - - :returns: (bool) value of the bit - """ - return _ldns.ldns_pkt_ad(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def additional(self): - """Return the packet's additional section. - - :returns: (ldns_rr_list \*) the section - """ - return _ldns.ldns_pkt_additional(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rr_list * - - def all(self): - return _ldns.ldns_pkt_all(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rr_list * - - def all_noquestion(self): - return _ldns.ldns_pkt_all_noquestion(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rr_list * - - def ancount(self): - """Return the packet's an count. - - :returns: (uint16_t) the an count - """ - return _ldns.ldns_pkt_ancount(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def answer(self): - """Return the packet's answer section. - - :returns: (ldns_rr_list \*) the section - """ - return _ldns.ldns_pkt_answer(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rr_list * - - def answerfrom(self): - """Return the packet's answerfrom. - - :returns: (ldns_rdf \*) the name of the server - """ - return _ldns.ldns_pkt_answerfrom(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rdf * - - def arcount(self): - """Return the packet's ar count. - - :returns: (uint16_t) the ar count - """ - return _ldns.ldns_pkt_arcount(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def authority(self): - """Return the packet's authority section. - - :returns: (ldns_rr_list \*) the section - """ - return _ldns.ldns_pkt_authority(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rr_list * - - def cd(self): - """Read the packet's cd bit. - - :returns: (bool) value of the bit - """ - return _ldns.ldns_pkt_cd(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def clone(self): - """clones the given packet, creating a fully allocated copy - - :returns: (ldns_pkt \*) ldns_pkt* pointer to the new packet - """ - return _ldns.ldns_pkt_clone(self) - #parameters: ldns_pkt *, - #retvals: ldns_pkt * - - def edns(self): - """returns true if this packet needs and EDNS rr to be sent. - - At the moment the only reason is an expected packet size larger than 512 bytes, but for instance dnssec would be a good reason too. - - :returns: (bool) true if packet needs edns rr - """ - return _ldns.ldns_pkt_edns(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def edns_data(self): - """return the packet's edns data - - :returns: (ldns_rdf \*) the data - """ - return _ldns.ldns_pkt_edns_data(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rdf * - - def edns_do(self): - """return the packet's edns do bit - - :returns: (bool) the bit's value - """ - return _ldns.ldns_pkt_edns_do(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def edns_extended_rcode(self): - """return the packet's edns extended rcode - - :returns: (uint8_t) the rcode - """ - return _ldns.ldns_pkt_edns_extended_rcode(self) - #parameters: const ldns_pkt *, - #retvals: uint8_t - - def edns_udp_size(self): - """return the packet's edns udp size - - :returns: (uint16_t) the size - """ - return _ldns.ldns_pkt_edns_udp_size(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def edns_version(self): - """return the packet's edns version - - :returns: (uint8_t) the version - """ - return _ldns.ldns_pkt_edns_version(self) - #parameters: const ldns_pkt *, - #retvals: uint8_t - - def edns_z(self): - """return the packet's edns z value - - :returns: (uint16_t) the z value - """ - return _ldns.ldns_pkt_edns_z(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def empty(self): - """check if a packet is empty - - :returns: (bool) true: empty, false: empty - """ - return _ldns.ldns_pkt_empty(self) - #parameters: ldns_pkt *, - #retvals: bool - - def get_opcode(self): - """Read the packet's code. - - :returns: (ldns_pkt_opcode) the opcode - """ - return _ldns.ldns_pkt_get_opcode(self) - #parameters: const ldns_pkt *, - #retvals: ldns_pkt_opcode - - def get_rcode(self): - """Return the packet's respons code. - - :returns: (ldns_pkt_rcode) the respons code - """ - return _ldns.ldns_pkt_get_rcode(self) - #parameters: const ldns_pkt *, - #retvals: ldns_pkt_rcode - - def get_section_clone(self,s): - """return all the rr_list's in the packet. - - Clone the lists, instead of returning pointers. - - :param s: - what section(s) to return - :returns: (ldns_rr_list \*) ldns_rr_list with the rr's or NULL if none were found - """ - return _ldns.ldns_pkt_get_section_clone(self,s) - #parameters: const ldns_pkt *,ldns_pkt_section, - #retvals: ldns_rr_list * - - def id(self): - """Read the packet id. - - :returns: (uint16_t) the packet id - """ - return _ldns.ldns_pkt_id(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def nscount(self): - """Return the packet's ns count. - - :returns: (uint16_t) the ns count - """ - return _ldns.ldns_pkt_nscount(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def push_rr(self,section,rr): - """push an rr on a packet - - :param section: - where to put it - :param rr: - rr to push - :returns: (bool) a boolean which is true when the rr was added - """ - return _ldns.ldns_pkt_push_rr(self,section,rr) - #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr *, - #retvals: bool - - def push_rr_list(self,section,list): - """push a rr_list on a packet - - :param section: - where to put it - :param list: - the rr_list to push - :returns: (bool) a boolean which is true when the rr was added - """ - return _ldns.ldns_pkt_push_rr_list(self,section,list) - #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr_list *, - #retvals: bool - - def qdcount(self): - """Return the packet's qd count. - - :returns: (uint16_t) the qd count - """ - return _ldns.ldns_pkt_qdcount(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def qr(self): - """Read the packet's qr bit. - - :returns: (bool) value of the bit - """ - return _ldns.ldns_pkt_qr(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def querytime(self): - """Return the packet's querytime. - - :returns: (uint32_t) the querytime - """ - return _ldns.ldns_pkt_querytime(self) - #parameters: const ldns_pkt *, - #retvals: uint32_t - - def question(self): - """Return the packet's question section. - - :returns: (ldns_rr_list \*) the section - """ - return _ldns.ldns_pkt_question(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rr_list * - - def ra(self): - """Read the packet's ra bit. - - :returns: (bool) value of the bit - """ - return _ldns.ldns_pkt_ra(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def rd(self): - """Read the packet's rd bit. - - :returns: (bool) value of the bit - """ - return _ldns.ldns_pkt_rd(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def reply_type(self): - """looks inside the packet to determine what kind of packet it is, AUTH, NXDOMAIN, REFERRAL, etc. - - :returns: (ldns_pkt_type) the type of packet - """ - return _ldns.ldns_pkt_reply_type(self) - #parameters: ldns_pkt *, - #retvals: ldns_pkt_type - - def rr(self,sec,rr): - """check to see if an rr exist in the packet - - :param sec: - in which section to look - :param rr: - the rr to look for - :returns: (bool) - """ - return _ldns.ldns_pkt_rr(self,sec,rr) - #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr *, - #retvals: bool - - def rr_list_by_name(self,r,s): - """return all the rr with a specific name from a packet. - - Optionally specify from which section in the packet - - :param r: - the name - :param s: - the packet's section - :returns: (ldns_rr_list \*) a list with the rr's or NULL if none were found - """ - return _ldns.ldns_pkt_rr_list_by_name(self,r,s) - #parameters: ldns_pkt *,ldns_rdf *,ldns_pkt_section, - #retvals: ldns_rr_list * - - def rr_list_by_name_and_type(self,ownername,atype,sec): - """return all the rr with a specific type and type from a packet. - - Optionally specify from which section in the packet - - :param ownername: - the name - :param atype: - :param sec: - the packet's section - :returns: (ldns_rr_list \*) a list with the rr's or NULL if none were found - """ - return _ldns.ldns_pkt_rr_list_by_name_and_type(self,ownername,atype,sec) - #parameters: const ldns_pkt *,const ldns_rdf *,ldns_rr_type,ldns_pkt_section, - #retvals: ldns_rr_list * - - def rr_list_by_type(self,t,s): - """return all the rr with a specific type from a packet. - - Optionally specify from which section in the packet - - :param t: - the type - :param s: - the packet's section - :returns: (ldns_rr_list \*) a list with the rr's or NULL if none were found - """ - return _ldns.ldns_pkt_rr_list_by_type(self,t,s) - #parameters: const ldns_pkt *,ldns_rr_type,ldns_pkt_section, - #retvals: ldns_rr_list * - - def safe_push_rr(self,sec,rr): - """push an rr on a packet, provided the RR is not there. - - :param sec: - where to put it - :param rr: - rr to push - :returns: (bool) a boolean which is true when the rr was added - """ - return _ldns.ldns_pkt_safe_push_rr(self,sec,rr) - #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr *, - #retvals: bool - - def safe_push_rr_list(self,sec,list): - """push an rr_list to a packet, provided the RRs are not already there. - - :param sec: - where to put it - :param list: - the rr_list to push - :returns: (bool) a boolean which is true when the rr was added - """ - return _ldns.ldns_pkt_safe_push_rr_list(self,sec,list) - #parameters: ldns_pkt *,ldns_pkt_section,ldns_rr_list *, - #retvals: bool - - def section_count(self,s): - return _ldns.ldns_pkt_section_count(self,s) - #parameters: const ldns_pkt *,ldns_pkt_section, - #retvals: uint16_t - - def set_aa(self,b): - """Set the packet's aa bit. - - :param b: - the value to set (boolean) - """ - _ldns.ldns_pkt_set_aa(self,b) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_ad(self,b): - """Set the packet's ad bit. - - :param b: - the value to set (boolean) - """ - _ldns.ldns_pkt_set_ad(self,b) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_additional(self,rr): - """directly set the additional section - - :param rr: - rrlist to set - """ - _ldns.ldns_pkt_set_additional(self,rr) - #parameters: ldns_pkt *,ldns_rr_list *, - #retvals: - - def set_ancount(self,c): - """Set the packet's an count. - - :param c: - the count - """ - _ldns.ldns_pkt_set_ancount(self,c) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def set_answer(self,rr): - """directly set the answer section - - :param rr: - rrlist to set - """ - _ldns.ldns_pkt_set_answer(self,rr) - #parameters: ldns_pkt *,ldns_rr_list *, - #retvals: - - def set_answerfrom(self,r): - """Set the packet's answering server. - - :param r: - the address - """ - _ldns.ldns_pkt_set_answerfrom(self,r) - #parameters: ldns_pkt *,ldns_rdf *, - #retvals: - - def set_arcount(self,c): - """Set the packet's arcount. - - :param c: - the count - """ - _ldns.ldns_pkt_set_arcount(self,c) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def set_authority(self,rr): - """directly set the auhority section - - :param rr: - rrlist to set - """ - _ldns.ldns_pkt_set_authority(self,rr) - #parameters: ldns_pkt *,ldns_rr_list *, - #retvals: - - def set_cd(self,b): - """Set the packet's cd bit. - - :param b: - the value to set (boolean) - """ - _ldns.ldns_pkt_set_cd(self,b) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_edns_data(self,data): - """Set the packet's edns data. - - :param data: - the data - """ - _ldns.ldns_pkt_set_edns_data(self,data) - #parameters: ldns_pkt *,ldns_rdf *, - #retvals: - - def set_edns_do(self,value): - """Set the packet's edns do bit. - - :param value: - the bit's new value - """ - _ldns.ldns_pkt_set_edns_do(self,value) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_edns_extended_rcode(self,c): - """Set the packet's edns extended rcode. - - :param c: - the code - """ - _ldns.ldns_pkt_set_edns_extended_rcode(self,c) - #parameters: ldns_pkt *,uint8_t, - #retvals: - - def set_edns_udp_size(self,s): - """Set the packet's edns udp size. - - :param s: - the size - """ - _ldns.ldns_pkt_set_edns_udp_size(self,s) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def set_edns_version(self,v): - """Set the packet's edns version. - - :param v: - the version - """ - _ldns.ldns_pkt_set_edns_version(self,v) - #parameters: ldns_pkt *,uint8_t, - #retvals: - - def set_edns_z(self,z): - """Set the packet's edns z value. - - :param z: - the value - """ - _ldns.ldns_pkt_set_edns_z(self,z) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def set_flags(self,flags): - """sets the flags in a packet. - - :param flags: - ORed values: LDNS_QR| LDNS_AR for instance - :returns: (bool) true on success otherwise false - """ - return _ldns.ldns_pkt_set_flags(self,flags) - #parameters: ldns_pkt *,uint16_t, - #retvals: bool - - def set_id(self,id): - """Set the packet's id. - - :param id: - the id to set - """ - _ldns.ldns_pkt_set_id(self,id) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def set_nscount(self,c): - """Set the packet's ns count. - - :param c: - the count - """ - _ldns.ldns_pkt_set_nscount(self,c) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def set_opcode(self,c): - """Set the packet's opcode. - - :param c: - the opcode - """ - _ldns.ldns_pkt_set_opcode(self,c) - #parameters: ldns_pkt *,ldns_pkt_opcode, - #retvals: - - def set_qdcount(self,c): - """Set the packet's qd count. - - :param c: - the count - """ - _ldns.ldns_pkt_set_qdcount(self,c) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def set_qr(self,b): - """Set the packet's qr bit. - - :param b: - the value to set (boolean) - """ - _ldns.ldns_pkt_set_qr(self,b) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_querytime(self,t): - """Set the packet's query time. - - :param t: - the querytime in msec - """ - _ldns.ldns_pkt_set_querytime(self,t) - #parameters: ldns_pkt *,uint32_t, - #retvals: - - def set_question(self,rr): - """directly set the question section - - :param rr: - rrlist to set - """ - _ldns.ldns_pkt_set_question(self,rr) - #parameters: ldns_pkt *,ldns_rr_list *, - #retvals: - - def set_ra(self,b): - """Set the packet's ra bit. - - :param b: - the value to set (boolean) - """ - _ldns.ldns_pkt_set_ra(self,b) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_random_id(self): - """Set the packet's id to a random value. - """ - _ldns.ldns_pkt_set_random_id(self) - #parameters: ldns_pkt *, - #retvals: - - def set_rcode(self,c): - """Set the packet's respons code. - - :param c: - the rcode - """ - _ldns.ldns_pkt_set_rcode(self,c) - #parameters: ldns_pkt *,uint8_t, - #retvals: - - def set_rd(self,b): - """Set the packet's rd bit. - - :param b: - the value to set (boolean) - """ - _ldns.ldns_pkt_set_rd(self,b) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_section_count(self,s,x): - """Set a packet's section count to x. - - :param s: - the section - :param x: - the section count - """ - _ldns.ldns_pkt_set_section_count(self,s,x) - #parameters: ldns_pkt *,ldns_pkt_section,uint16_t, - #retvals: - - def set_size(self,s): - """Set the packet's size. - - :param s: - the size - """ - _ldns.ldns_pkt_set_size(self,s) - #parameters: ldns_pkt *,size_t, - #retvals: - - def set_tc(self,b): - """Set the packet's tc bit. - - :param b: - the value to set (boolean) - """ - _ldns.ldns_pkt_set_tc(self,b) - #parameters: ldns_pkt *,bool, - #retvals: - - def set_timestamp(self,timeval): - _ldns.ldns_pkt_set_timestamp(self,timeval) - #parameters: ldns_pkt *,struct timeval, - #retvals: - - def set_tsig(self,t): - """Set the packet's tsig rr. - - :param t: - the tsig rr - """ - _ldns.ldns_pkt_set_tsig(self,t) - #parameters: ldns_pkt *,ldns_rr *, - #retvals: - - def size(self): - """Return the packet's size in bytes. - - :returns: (size_t) the size - """ - return _ldns.ldns_pkt_size(self) - #parameters: const ldns_pkt *, - #retvals: size_t - - def tc(self): - """Read the packet's tc bit. - - :returns: (bool) value of the bit - """ - return _ldns.ldns_pkt_tc(self) - #parameters: const ldns_pkt *, - #retvals: bool - - def timestamp(self): - """Return the packet's timestamp. - - :returns: (struct timeval) the timestamp - """ - return _ldns.ldns_pkt_timestamp(self) - #parameters: const ldns_pkt *, - #retvals: struct timeval - - def tsig(self): - """Return the packet's tsig pseudo rr's. - - :returns: (ldns_rr \*) the tsig rr - """ - return _ldns.ldns_pkt_tsig(self) - #parameters: const ldns_pkt *, - #retvals: ldns_rr * - - #_LDNS_PKT_METHODS# - - #LDNS update methods - #LDNS_METHODS_# - def update_pkt_tsig_add(self,r): - """add tsig credentials to a packet from a resolver - - :param r: - resolver to copy from - :returns: (ldns_status) status wether successfull or not - """ - return _ldns.ldns_update_pkt_tsig_add(self,r) - #parameters: ldns_pkt *,ldns_resolver *, - #retvals: ldns_status - - def update_prcount(self): - """Get the zo count. - - :returns: (uint16_t) the pr count - """ - return _ldns.ldns_update_prcount(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def update_set_adcount(self,c): - """Set the ad count. - - :param c: - the ad count to set - """ - _ldns.ldns_update_set_adcount(self,c) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def update_set_prcount(self,c): - """Set the pr count. - - :param c: - the pr count to set - """ - _ldns.ldns_update_set_prcount(self,c) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def update_set_upcount(self,c): - """Set the up count. - - :param c: - the up count to set - """ - _ldns.ldns_update_set_upcount(self,c) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def update_set_zo(self,v): - _ldns.ldns_update_set_zo(self,v) - #parameters: ldns_pkt *,uint16_t, - #retvals: - - def update_upcount(self): - """Get the zo count. - - :returns: (uint16_t) the up count - """ - return _ldns.ldns_update_upcount(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - def update_zocount(self): - """Get the zo count. - - :returns: (uint16_t) the zo count - """ - return _ldns.ldns_update_zocount(self) - #parameters: const ldns_pkt *, - #retvals: uint16_t - - #_LDNS_METHODS# - %} -} diff --git a/libs/ldns/contrib/python/ldns_rdf.i b/libs/ldns/contrib/python/ldns_rdf.i deleted file mode 100644 index 045fae974b..0000000000 --- a/libs/ldns/contrib/python/ldns_rdf.i +++ /dev/null @@ -1,418 +0,0 @@ -/****************************************************************************** - * ldns_rdata.i: LDNS record data - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ - -//automatic conversion of const ldns_rdf* parameter from string -%typemap(in,noblock=1) const ldns_rdf * (void* argp, $1_ltype tmp = 0, int res) { - if (PyString_Check($input)) { - tmp = ldns_dname_new_frm_str(PyString_AsString($input)); - if (tmp == NULL) { - %argument_fail(SWIG_TypeError, "char *", $symname, $argnum); - } - $1 = ($1_ltype) tmp; - } else { - res = SWIG_ConvertPtr($input, &argp, SWIGTYPE_p_ldns_struct_rdf, 0 | 0 ); - if (!SWIG_IsOK(res)) { - %argument_fail(res, "ldns_rdf const *", $symname, $argnum); - } - $1 = ($1_ltype) argp; - } -} - -%typemap(in,numinputs=0,noblock=1) (ldns_rdf **) -{ - ldns_rdf *$1_rdf; - $1 = &$1_rdf; -} - -// result generation -%typemap(argout,noblock=1) (ldns_rdf **) -{ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_rdf), SWIGTYPE_p_ldns_struct_rdf, SWIG_POINTER_OWN | 0 )); -} - -%nodefaultctor ldns_struct_rdf; //no default constructor & destructor -%nodefaultdtor ldns_struct_rdf; - -%newobject ldns_dname_new; -%newobject ldns_dname_new_frm_str; -%newobject ldns_dname_new_frm_data; - -%delobject ldns_rdf_deep_free; -%delobject ldns_rdf_free; - -%rename(ldns_rdf) ldns_struct_rdf; - -%inline %{ - -const char *ldns_rdf_type2str(const ldns_rdf *rdf) -{ - if (rdf) { - switch(ldns_rdf_get_type(rdf)) { - case LDNS_RDF_TYPE_NONE: return 0; - case LDNS_RDF_TYPE_DNAME: return "DNAME"; - case LDNS_RDF_TYPE_INT8: return "INT8"; - case LDNS_RDF_TYPE_INT16: return "INT16"; - case LDNS_RDF_TYPE_INT32: return "INT32"; - case LDNS_RDF_TYPE_PERIOD: return "PERIOD"; - case LDNS_RDF_TYPE_TSIGTIME: return "TSIGTIME"; - case LDNS_RDF_TYPE_A: return "A"; - case LDNS_RDF_TYPE_AAAA: return "AAAA"; - case LDNS_RDF_TYPE_STR: return "STR"; - case LDNS_RDF_TYPE_APL: return "APL"; - case LDNS_RDF_TYPE_B32_EXT: return "B32_EXT"; - case LDNS_RDF_TYPE_B64: return "B64"; - case LDNS_RDF_TYPE_HEX: return "HEX"; - case LDNS_RDF_TYPE_NSEC: return "NSEC"; - case LDNS_RDF_TYPE_NSEC3_SALT: return "NSEC3_SALT"; - case LDNS_RDF_TYPE_TYPE: return "TYPE"; - case LDNS_RDF_TYPE_CLASS: return "CLASS"; - case LDNS_RDF_TYPE_CERT_ALG: return "CER_ALG"; - case LDNS_RDF_TYPE_ALG: return "ALG"; - case LDNS_RDF_TYPE_UNKNOWN: return "UNKNOWN"; - case LDNS_RDF_TYPE_TIME: return "TIME"; - case LDNS_RDF_TYPE_LOC: return "LOC"; - case LDNS_RDF_TYPE_WKS: return "WKS"; - case LDNS_RDF_TYPE_SERVICE: return "SERVICE"; - case LDNS_RDF_TYPE_NSAP: return "NSAP"; - case LDNS_RDF_TYPE_ATMA: return "ATMA"; - case LDNS_RDF_TYPE_IPSECKEY: return "IPSECKEY"; - case LDNS_RDF_TYPE_TSIG: return "TSIG"; - case LDNS_RDF_TYPE_INT16_DATA: return "INT16_DATA"; - case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: return "NSEC3_NEXT_OWNER"; - } - } - return 0; -} -%} - -#ifdef LDNS_DEBUG -%rename(__ldns_rdf_deep_free) ldns_rdf_deep_free; -%rename(__ldns_rdf_free) ldns_rdf_free; -%inline %{ -void _ldns_rdf_free (ldns_rdf* r) { - printf("******** LDNS_RDF free 0x%lX ************\n", (long unsigned int)r); - ldns_rdf_free(r); -} -%} -#else -%rename(_ldns_rdf_deep_free) ldns_rdf_deep_free; -%rename(_ldns_rdf_free) ldns_rdf_free; -#endif - -%newobject ldns_rdf2str; - - -%feature("docstring") ldns_struct_rdf "Resource record data field. - -The data is a network ordered array of bytes, which size is specified by the (16-bit) size field. To correctly parse it, use the type specified in the (16-bit) type field with a value from ldns_rdf_type." - -%extend ldns_struct_rdf { - - %pythoncode %{ - def __init__(self): - raise Exception("This class can't be created directly. Please use: ldns_rdf_new, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_new_frm_fp_l") - - __swig_destroy__ = _ldns._ldns_rdf_free - - #LDNS_RDF_CONSTRUCTORS_# - @staticmethod - def new_frm_str(str, rr_type, raiseException = True): - """Creates a new rdf from a string of a given type. - - :param str: string to use - :param rr_type: the type of RDF. See predefined `RDF_TYPE_` constants - :param raiseException: if True, an exception occurs in case a RDF object can't be created - :returns: RDF object or None. If the object can't be created and raiseException is True, an exception occurs. - - **Usage** - >>> rdf = ldns.ldns_rdf.new_frm_str("74.125.43.99",ldns.LDNS_RDF_TYPE_A) - >>> print rdf, rdf.get_type_str() - A 74.125.43.99 - >>> name = ldns.ldns_resolver.new_frm_file().get_name_by_addr(rdf) - >>> if (name): print name - 99.43.125.74.in-addr.arpa. 85277 IN PTR bw-in-f99.google.com. - """ - rr = _ldns.ldns_rdf_new_frm_str(rr_type, str) - if not rr: - if (raiseException): raise Exception("Can't create query packet, error: %d" % status) - return rr - #_LDNS_RDF_CONSTRUCTORS# - - def __str__(self): - """Converts the rdata field to presentation format""" - return _ldns.ldns_rdf2str(self) - - def __cmp__(self,other): - """compares two rdf's on their wire formats. - - (To order dnames according to rfc4034, use ldns_dname_compare) - - :param other: - the second one RDF - :returns: (int) 0 if equal -1 if self comes before other +1 if other comes before self - """ - return _ldns.ldns_rdf_compare(self,other) - - def print_to_file(self,output): - """Prints the data in the rdata field to the given file stream (in presentation format).""" - _ldns.ldns_rdf_print(output,self) - - def get_type_str(self): - """Converts type to string""" - return ldns_rdf_type2str(self) - - def write_to_buffer(self, buffer): - """Copies the rdata data to the buffer in wire format. - - :param buffer: buffer to append the result to - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_rdf2buffer_wire(buffer, self) - #parameters: ldns_buffer *,const ldns_rdf *, - #retvals: ldns_status - - def write_to_buffer_canonical(self, buffer): - """Copies the rdata data to the buffer in wire format If the rdata is a dname, the letters will be lowercased during the conversion. - - :param buffer: LDNS buffer - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_rdf2buffer_wire_canonical(buffer, self) - #parameters: ldns_buffer *,const ldns_rdf *, - #retvals: ldns_status - - #LDNS_RDF_METHODS_# - def address_reverse(self): - """reverses an rdf, only actually useful for AAAA and A records. - - The returned rdf has the type LDNS_RDF_TYPE_DNAME! - - :returns: (ldns_rdf \*) the reversed rdf (a newly created rdf) - """ - return _ldns.ldns_rdf_address_reverse(self) - #parameters: ldns_rdf *, - #retvals: ldns_rdf * - - def clone(self): - """clones a rdf structure. - - The data is copied. - - :returns: (ldns_rdf \*) a new rdf structure - """ - return _ldns.ldns_rdf_clone(self) - #parameters: const ldns_rdf *, - #retvals: ldns_rdf * - - def data(self): - """returns the data of the rdf. - - :returns: (uint8_t \*) uint8_t* pointer to the rdf's data - """ - return _ldns.ldns_rdf_data(self) - #parameters: const ldns_rdf *, - #retvals: uint8_t * - - def get_type(self): - """returns the type of the rdf. - - We need to insert _get_ here to prevent conflict the the rdf_type TYPE. - - :returns: (ldns_rdf_type) ldns_rdf_type with the type - """ - return _ldns.ldns_rdf_get_type(self) - #parameters: const ldns_rdf *, - #retvals: ldns_rdf_type - - def set_data(self,data): - """sets the size of the rdf. - - :param data: - """ - _ldns.ldns_rdf_set_data(self,data) - #parameters: ldns_rdf *,void *, - #retvals: - - def set_size(self,size): - """sets the size of the rdf. - - :param size: - the new size - """ - _ldns.ldns_rdf_set_size(self,size) - #parameters: ldns_rdf *,size_t, - #retvals: - - def set_type(self,atype): - """sets the size of the rdf. - - :param atype: - """ - _ldns.ldns_rdf_set_type(self,atype) - #parameters: ldns_rdf *,ldns_rdf_type, - #retvals: - - def size(self): - """returns the size of the rdf. - - :returns: (size_t) uint16_t with the size - """ - return _ldns.ldns_rdf_size(self) - #parameters: const ldns_rdf *, - #retvals: size_t - - @staticmethod - def dname_new_frm_str(str): - """Creates a new dname rdf instance from a string. - - This static method is equivalent to using of default class constructor. - - :parameter str: str string to use - """ - return _ldns.ldns_dname_new_frm_str(str) - - def absolute(self): - """Checks whether the given dname string is absolute (i.e. ends with a '.') - - :returns: (bool) True or False - """ - return self.endswith(".") - - def make_canonical(self): - """Put a dname into canonical fmt - ie. lowercase it - """ - _ldns.ldns_dname2canonical(self) - - def dname_compare(self,other): - """Compares the two dname rdf's according to the algorithm for ordering in RFC4034 Section 6. - - :param other: - the second dname rdf to compare - :returns: (int) -1 if dname comes before other, 1 if dname comes after other, and 0 if they are equal. - """ - return _ldns.ldns_dname_compare(self,other) - - def cat(self,rd2): - """concatenates rd2 after this dname (rd2 is copied, this dname is modified) - - :param rd2: - the rightside - :returns: (ldns_status) LDNS_STATUS_OK on success - """ - return _ldns.ldns_dname_cat(self,rd2) - #parameters: ldns_rdf *,ldns_rdf *, - #retvals: ldns_status - - def cat_clone(self,rd2): - """concatenates two dnames together - - :param rd2: - the rightside - :returns: (ldns_rdf \*) a new rdf with leftside/rightside - """ - return _ldns.ldns_dname_cat_clone(self,rd2) - #parameters: const ldns_rdf *,const ldns_rdf *, - #retvals: ldns_rdf * - - def interval(self,middle,next): - """check if middle lays in the interval defined by prev and next prev <= middle < next. - - This is usefull for nsec checking - - :param middle: - the dname to check - :param next: - the next dname return 0 on error or unknown, -1 when middle is in the interval, +1 when not - :returns: (int) - """ - return _ldns.ldns_dname_interval(self,middle,next) - #parameters: const ldns_rdf *,const ldns_rdf *,const ldns_rdf *, - #retvals: int - - def is_subdomain(self,parent): - """Tests wether the name sub falls under parent (i.e. is a subdomain of parent). - - This function will return false if the given dnames are equal. - - :param parent: - (ldns_rdf) the parent's name - :returns: (bool) true if sub falls under parent, otherwise false - """ - return _ldns.ldns_dname_is_subdomain(self,parent) - #parameters: const ldns_rdf *,const ldns_rdf *, - #retvals: bool - - def label(self,labelpos): - """look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME try and retrieve a specific label. - - The labels are numbered starting from 0 (left most). - - :param labelpos: - return the label with this number - :returns: (ldns_rdf \*) a ldns_rdf* with the label as name or NULL on error - """ - return _ldns.ldns_dname_label(self,labelpos) - #parameters: const ldns_rdf *,uint8_t, - #retvals: ldns_rdf * - - def label_count(self): - """count the number of labels inside a LDNS_RDF_DNAME type rdf. - - :returns: (uint8_t) the number of labels - """ - return _ldns.ldns_dname_label_count(self) - #parameters: const ldns_rdf *, - #retvals: uint8_t - - def left_chop(self): - """chop one label off the left side of a dname. - - so wwww.nlnetlabs.nl, becomes nlnetlabs.nl - - :returns: (ldns_rdf \*) the remaining dname - """ - return _ldns.ldns_dname_left_chop(self) - #parameters: const ldns_rdf *, - #retvals: ldns_rdf * - - def reverse(self): - """Returns a clone of the given dname with the labels reversed. - - :returns: (ldns_rdf \*) clone of the dname with the labels reversed. - """ - return _ldns.ldns_dname_reverse(self) - #parameters: const ldns_rdf *, - #retvals: ldns_rdf * - - #_LDNS_RDF_METHODS# - %} -} diff --git a/libs/ldns/contrib/python/ldns_resolver.i b/libs/ldns/contrib/python/ldns_resolver.i deleted file mode 100644 index dd3ed55e12..0000000000 --- a/libs/ldns/contrib/python/ldns_resolver.i +++ /dev/null @@ -1,940 +0,0 @@ -/****************************************************************************** - * ldns_resolver.i: LDNS resolver class - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ - -%typemap(in,numinputs=0,noblock=1) (ldns_resolver **r) -{ - ldns_resolver *$1_res; - $1 = &$1_res; -} - -/* result generation */ -%typemap(argout,noblock=1) (ldns_resolver **r) -{ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_res), SWIGTYPE_p_ldns_struct_resolver, SWIG_POINTER_OWN | 0 )); -} - -//TODO: pop_nameserver a podobne funkce musi predat objekt do spravy PYTHONU!! -%newobject ldns_resolver_pop_nameserver; -%newobject ldns_resolver_query; -%newobject ldns_axfr_next; - -%delobject ldns_resolver_deep_free; -%delobject ldns_resolver_free; - -%nodefaultctor ldns_struct_resolver; //no default constructor & destructor -%nodefaultdtor ldns_struct_resolver; - -%ignore ldns_struct_resolver::_searchlist; -%ignore ldns_struct_resolver::_nameservers; -%ignore ldns_resolver_set_nameservers; - -%rename(ldns_resolver) ldns_struct_resolver; - -#ifdef LDNS_DEBUG -%rename(__ldns_resolver_deep_free) ldns_resolver_deep_free; -%rename(__ldns_resolver_free) ldns_resolver_free; -%inline %{ -void _ldns_resolver_free (ldns_resolver* r) { - printf("******** LDNS_RESOLVER deep free 0x%lX ************\n", (long unsigned int)r); - ldns_resolver_deep_free(r); -} -%} -#else -%rename(_ldns_resolver_deep_free) ldns_resolver_deep_free; -%rename(_ldns_resolver_free) ldns_resolver_free; -#endif - -%feature("docstring") ldns_struct_resolver "LDNS resolver object. - -The ldns_resolver object keeps a list of nameservers and can perform queries. - -**Usage** - ->>> import ldns ->>> resolver = ldns.ldns_resolver.new_frm_file(\"/etc/resolv.conf\") ->>> pkt = resolver.query(\"www.nic.cz\", ldns.LDNS_RR_TYPE_A,ldns.LDNS_RR_CLASS_IN) ->>> if (pkt) and (pkt.answer()): ->>> print pkt.answer() -www.nic.cz. 1757 IN A 217.31.205.50 - -This simple example instances a resolver in order to resolve www.nic.cz record of A type. -" - -%extend ldns_struct_resolver { - - %pythoncode %{ - def __init__(self): - raise Exception("This class can't be created directly. Please use: new_frm_file(filename), new_frm_fp(file) or new_frm_fp_l(file,line)") - - __swig_destroy__ = _ldns._ldns_resolver_free - - #LDNS_RESOLVER_CONSTRUCTORS_# - @staticmethod - def new_frm_file(filename = "/etc/resolv.conf", raiseException=True): - """Creates a resolver object from given filename - - :param filename: name of file which contains informations (usually /etc/resolv.conf) - :param raiseException: if True, an exception occurs in case a resolver object can't be created - :returns: resolver object or None. If the object can't be created and raiseException is True, an exception occurs. - """ - status, resolver = _ldns.ldns_resolver_new_frm_file(filename) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create resolver, error: %d" % status) - return None - return resolver - - @staticmethod - def new_frm_fp(file, raiseException=True): - """Creates a resolver object from file - - :param file: a file object - :param raiseException: if True, an exception occurs in case a resolver object can't be created - :returns: resolver object or None. If the object can't be created and raiseException is True, an exception occurs. - """ - status, resolver = _ldns.ldns_resolver_new_frm_fp(file) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create resolver, error: %d" % status) - return None - return resolver - - @staticmethod - def new_frm_fp_l(file, raiseException=True): - """Creates a resolver object from file - - :param file: a file object - :param raiseException: if True, an exception occurs in case a resolver instance can't be created - :returns: - * resolver - resolver instance or None. If an instance can't be created and raiseException is True, an exception occurs. - - * line - the line number (for debugging) - """ - status, resolver, line = _ldns.ldns_resolver_new_frm_fp_l(file) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create resolver, error: %d" % status) - return None - return resolver, line - - #_LDNS_RESOLVER_CONSTRUCTORS# - - # High level functions - def get_addr_by_name(self, name, aclass = _ldns.LDNS_RR_CLASS_IN, flags = _ldns.LDNS_RD): - """Ask the resolver about name and return all address records - - :param name: (ldns_rdf) the name to look for - :param aclass: the class to use - :param flags: give some optional flags to the query - - :returns: RR List object or None - - **Usage** - >>> addr = resolver.get_addr_by_name("www.google.com", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) - >>> if (not addr): raise Exception("Can't retrieve server address") - >>> for rr in addr.rrs(): - >>> print rr - www.l.google.com. 300 IN A 74.125.43.99 - www.l.google.com. 300 IN A 74.125.43.103 - www.l.google.com. 300 IN A 74.125.43.104 - www.l.google.com. 300 IN A 74.125.43.147 - - """ - return _ldns.ldns_get_rr_list_addr_by_name(self, name, aclass, flags) - - def get_name_by_addr(self, addr, aclass = _ldns.LDNS_RR_CLASS_IN, flags = _ldns.LDNS_RD): - """Ask the resolver about the address and return the name - - :param name: (ldns_rdf of A or AAAA type) the addr to look for. If a string is given, A or AAAA type is identified automatically - :param aclass: the class to use - :param flags: give some optional flags to the query - - :returns: RR List object or None - - **Usage** - >>> addr = resolver.get_name_by_addr("74.125.43.99", ldns.LDNS_RR_CLASS_IN, ldns.LDNS_RD) - >>> if (not addr): raise Exception("Can't retrieve server address") - >>> for rr in addr.rrs(): - >>> print rr - 99.43.125.74.in-addr.arpa. 85641 IN PTR bw-in-f99.google.com. - - """ - rdf = addr - if isinstance(addr, str): - if (addr.find("::") >= 0): #IPv6 - rdf = _ldns.ldns_rdf_new_frm_str(_ldns.LDNS_RDF_TYPE_AAAA, addr) - else: - rdf = _ldns.ldns_rdf_new_frm_str(_ldns.LDNS_RDF_TYPE_A, addr) - return _ldns.ldns_get_rr_list_name_by_addr(self, rdf, aclass, flags) - - def print_to_file(self,output): - """Print a resolver (in sofar that is possible) state to output.""" - _ldns.ldns_resolver_print(output,self) - - def axfr_start(self, domain, aclass): - """Prepares the resolver for an axfr query. The query is sent and the answers can be read with axfr_next - - **Usage** - :: - - status = resolver.axfr_start("nic.cz", ldns.LDNS_RR_CLASS_IN) - if (status != ldns.LDNS_STATUS_OK): raise Exception("Can't start AXFR, error: %s" % ldns.ldns_get_errorstr_by_id(status)) - #Print the results - while True: - rr = resolver.axfr_next() - if not rr: - break - - print rr - - """ - return _ldns.ldns_axfr_start(self, domain, aclass) - #parameters: ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c - #retvals: int - - def axfr_complete(self): - """returns true if the axfr transfer has completed (i.e. 2 SOA RRs and no errors were encountered)""" - return _ldns.ldns_axfr_complete(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def axfr_last_pkt(self): - """returns a pointer to the last ldns_pkt that was sent by the server in the AXFR transfer uasable for instance to get the error code on failure""" - return _ldns.ldns_axfr_last_pkt(self) - #parameters: const ldns_resolver *, - #retvals: ldns_pkt * - - def axfr_next(self): - """get the next stream of RRs in a AXFR""" - return _ldns.ldns_axfr_next(self) - #parameters: ldns_resolver *, - #retvals: ldns_rr * - - #LDNS_RESOLVER_METHODS_# - def debug(self): - """Get the debug status of the resolver. - - :returns: (bool) true if so, otherwise false - """ - return _ldns.ldns_resolver_debug(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def dec_nameserver_count(self): - """Decrement the resolver's nameserver count. - """ - _ldns.ldns_resolver_dec_nameserver_count(self) - #parameters: ldns_resolver *, - #retvals: - - def defnames(self): - return _ldns.ldns_resolver_defnames(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def dnsrch(self): - return _ldns.ldns_resolver_dnsrch(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def dnssec(self): - """Does the resolver do DNSSEC. - - :returns: (bool) true: yes, false: no - """ - return _ldns.ldns_resolver_dnssec(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def dnssec_anchors(self): - """Get the resolver's DNSSEC anchors. - - :returns: (ldns_rr_list \*) an rr_list containg trusted DNSSEC anchors - """ - return _ldns.ldns_resolver_dnssec_anchors(self) - #parameters: const ldns_resolver *, - #retvals: ldns_rr_list * - - def dnssec_cd(self): - """Does the resolver set the CD bit. - - :returns: (bool) true: yes, false: no - """ - return _ldns.ldns_resolver_dnssec_cd(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def domain(self): - """What is the default dname to add to relative queries. - - :returns: (ldns_rdf \*) the dname which is added - """ - return _ldns.ldns_resolver_domain(self) - #parameters: const ldns_resolver *, - #retvals: ldns_rdf * - - def edns_udp_size(self): - """Get the resolver's udp size. - - :returns: (uint16_t) the udp mesg size - """ - return _ldns.ldns_resolver_edns_udp_size(self) - #parameters: const ldns_resolver *, - #retvals: uint16_t - - def fail(self): - """Does the resolver only try the first nameserver. - - :returns: (bool) true: yes, fail, false: no, try the others - """ - return _ldns.ldns_resolver_fail(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def fallback(self): - """Get the truncation fallback status. - - :returns: (bool) whether the truncation fallback mechanism is used - """ - return _ldns.ldns_resolver_fallback(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def igntc(self): - """Does the resolver ignore the TC bit (truncated). - - :returns: (bool) true: yes, false: no - """ - return _ldns.ldns_resolver_igntc(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def incr_nameserver_count(self): - """Incremental the resolver's nameserver count. - """ - _ldns.ldns_resolver_incr_nameserver_count(self) - #parameters: ldns_resolver *, - #retvals: - - def ip6(self): - """Does the resolver use ip6 or ip4. - - :returns: (uint8_t) 0: both, 1: ip4, 2:ip6 - """ - return _ldns.ldns_resolver_ip6(self) - #parameters: const ldns_resolver *, - #retvals: uint8_t - - def nameserver_count(self): - """How many nameserver are configured in the resolver. - - :returns: (size_t) number of nameservers - """ - return _ldns.ldns_resolver_nameserver_count(self) - #parameters: const ldns_resolver *, - #retvals: size_t - - def nameserver_rtt(self,pos): - """Return the used round trip time for a specific nameserver. - - :param pos: - the index to the nameserver - :returns: (size_t) the rrt, 0: infinite, >0: undefined (as of * yet) - """ - return _ldns.ldns_resolver_nameserver_rtt(self,pos) - #parameters: const ldns_resolver *,size_t, - #retvals: size_t - - def nameservers(self): - """Return the configured nameserver ip address. - - :returns: (ldns_rdf \*\*) a ldns_rdf pointer to a list of the addresses - """ - return _ldns.ldns_resolver_nameservers(self) - #parameters: const ldns_resolver *, - #retvals: ldns_rdf ** - - def nameservers_randomize(self): - """randomize the nameserver list in the resolver - """ - _ldns.ldns_resolver_nameservers_randomize(self) - #parameters: ldns_resolver *, - #retvals: - - def pop_nameserver(self): - """pop the last nameserver from the resolver. - - :returns: (ldns_rdf \*) the popped address or NULL if empty - """ - return _ldns.ldns_resolver_pop_nameserver(self) - #parameters: ldns_resolver *, - #retvals: ldns_rdf * - - def port(self): - """Get the port the resolver should use. - - :returns: (uint16_t) the port number - """ - return _ldns.ldns_resolver_port(self) - #parameters: const ldns_resolver *, - #retvals: uint16_t - - def prepare_query_pkt(self,name,t,c,f): - """Form a query packet from a resolver and name/type/class combo. - - :param name: - :param t: - query for this type (may be 0, defaults to A) - :param c: - query for this class (may be 0, default to IN) - :param f: - the query flags - :returns: * (ldns_status) ldns_pkt* a packet with the reply from the nameserver - * (ldns_pkt \*\*) query packet class - """ - return _ldns.ldns_resolver_prepare_query_pkt(self,name,t,c,f) - #parameters: ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, - #retvals: ldns_status,ldns_pkt ** - - def push_dnssec_anchor(self,rr): - """Push a new trust anchor to the resolver. - - It must be a DS or DNSKEY rr - - :param rr: - the RR to add as a trust anchor. - :returns: (ldns_status) a status - """ - return _ldns.ldns_resolver_push_dnssec_anchor(self,rr) - #parameters: ldns_resolver *,ldns_rr *, - #retvals: ldns_status - - def push_nameserver(self,n): - """push a new nameserver to the resolver. - - It must be an IP address v4 or v6. - - :param n: - the ip address - :returns: (ldns_status) ldns_status a status - """ - return _ldns.ldns_resolver_push_nameserver(self,n) - #parameters: ldns_resolver *,ldns_rdf *, - #retvals: ldns_status - - def push_nameserver_rr(self,rr): - """push a new nameserver to the resolver. - - It must be an A or AAAA RR record type - - :param rr: - the resource record - :returns: (ldns_status) ldns_status a status - """ - return _ldns.ldns_resolver_push_nameserver_rr(self,rr) - #parameters: ldns_resolver *,ldns_rr *, - #retvals: ldns_status - - def push_nameserver_rr_list(self,rrlist): - """push a new nameserver rr_list to the resolver. - - :param rrlist: - the rr_list to push - :returns: (ldns_status) ldns_status a status - """ - return _ldns.ldns_resolver_push_nameserver_rr_list(self,rrlist) - #parameters: ldns_resolver *,ldns_rr_list *, - #retvals: ldns_status - - def push_searchlist(self,rd): - """Push a new rd to the resolver's searchlist. - - :param rd: - to push - """ - _ldns.ldns_resolver_push_searchlist(self,rd) - #parameters: ldns_resolver *,ldns_rdf *, - #retvals: - - def query(self,name,atype=_ldns.LDNS_RR_TYPE_A,aclass=_ldns.LDNS_RR_CLASS_IN,flags=_ldns.LDNS_RD): - """Send a query to a nameserver. - - :param name: (ldns_rdf) the name to look for - :param atype: the RR type to use - :param aclass: the RR class to use - :param flags: give some optional flags to the query - :returns: (ldns_pkt) a packet with the reply from the nameserver if _defnames is true the default domain will be added - """ - return _ldns.ldns_resolver_query(self,name,atype,aclass,flags) - #parameters: const ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, - #retvals: ldns_pkt * - - def random(self): - """Does the resolver randomize the nameserver before usage. - - :returns: (bool) true: yes, false: no - """ - return _ldns.ldns_resolver_random(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def recursive(self): - """Is the resolver set to recurse. - - :returns: (bool) true if so, otherwise false - """ - return _ldns.ldns_resolver_recursive(self) - #parameters: const ldns_resolver *, - #retvals: bool - - def retrans(self): - """Get the retransmit interval. - - :returns: (uint8_t) the retransmit interval - """ - return _ldns.ldns_resolver_retrans(self) - #parameters: const ldns_resolver *, - #retvals: uint8_t - - def retry(self): - """Get the number of retries. - - :returns: (uint8_t) the number of retries - """ - return _ldns.ldns_resolver_retry(self) - #parameters: const ldns_resolver *, - #retvals: uint8_t - - def rtt(self): - """Return the used round trip times for the nameservers. - - :returns: (size_t \*) a size_t* pointer to the list. yet) - """ - return _ldns.ldns_resolver_rtt(self) - #parameters: const ldns_resolver *, - #retvals: size_t * - - def search(self,rdf,t,c,flags): - """Send the query for using the resolver and take the search list into account The search algorithm is as follows: If the name is absolute, try it as-is, otherwise apply the search list. - - :param rdf: - :param t: - query for this type (may be 0, defaults to A) - :param c: - query for this class (may be 0, default to IN) - :param flags: - the query flags - :returns: (ldns_pkt \*) ldns_pkt* a packet with the reply from the nameserver - """ - return _ldns.ldns_resolver_search(self,rdf,t,c,flags) - #parameters: const ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, - #retvals: ldns_pkt * - - def searchlist(self): - """What is the searchlist as used by the resolver. - - :returns: (ldns_rdf \*\*) a ldns_rdf pointer to a list of the addresses - """ - return _ldns.ldns_resolver_searchlist(self) - #parameters: const ldns_resolver *, - #retvals: ldns_rdf \*\* - - def searchlist_count(self): - """Return the resolver's searchlist count. - - :returns: (size_t) the searchlist count - """ - return _ldns.ldns_resolver_searchlist_count(self) - #parameters: const ldns_resolver *, - #retvals: size_t - - def send(self,name,t,c,flags): - """Send the query for name as-is. - - :param name: - :param t: - query for this type (may be 0, defaults to A) - :param c: - query for this class (may be 0, default to IN) - :param flags: - the query flags - :returns: * (ldns_status) ldns_pkt* a packet with the reply from the nameserver - * (ldns_pkt \*\*) - """ - return _ldns.ldns_resolver_send(self,name,t,c,flags) - #parameters: ldns_resolver *,const ldns_rdf *,ldns_rr_type,ldns_rr_class,uint16_t, - #retvals: ldns_status,ldns_pkt ** - - def send_pkt(self,query_pkt): - """Send the given packet to a nameserver. - - :param query_pkt: - :returns: * (ldns_status) - * (ldns_pkt \*\*) - """ - return _ldns.ldns_resolver_send_pkt(self,query_pkt) - #parameters: ldns_resolver *,ldns_pkt *, - #retvals: ldns_status,ldns_pkt ** - - def set_debug(self,b): - """Set the resolver debugging. - - :param b: - true: debug on: false debug off - """ - _ldns.ldns_resolver_set_debug(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_defnames(self,b): - """Whether the resolver uses the name set with _set_domain. - - :param b: - true: use the defaults, false: don't use them - """ - _ldns.ldns_resolver_set_defnames(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_dnsrch(self,b): - """Whether the resolver uses the searchlist. - - :param b: - true: use the list, false: don't use the list - """ - _ldns.ldns_resolver_set_dnsrch(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_dnssec(self,b): - """Whether the resolver uses DNSSEC. - - :param b: - true: use DNSSEC, false: don't use DNSSEC - """ - _ldns.ldns_resolver_set_dnssec(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_dnssec_anchors(self,l): - """Set the resolver's DNSSEC anchor list directly. - - RRs should be of type DS or DNSKEY. - - :param l: - the list of RRs to use as trust anchors - """ - _ldns.ldns_resolver_set_dnssec_anchors(self,l) - #parameters: ldns_resolver *,ldns_rr_list *, - #retvals: - - def set_dnssec_cd(self,b): - """Whether the resolver uses the checking disable bit. - - :param b: - true: enable , false: don't use TCP - """ - _ldns.ldns_resolver_set_dnssec_cd(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_domain(self,rd): - """Set the resolver's default domain. - - This gets appended when no absolute name is given - - :param rd: - the name to append - """ - _ldns.ldns_resolver_set_domain(self,rd) - #parameters: ldns_resolver *,ldns_rdf *, - #retvals: - - def set_edns_udp_size(self,s): - """Set maximum udp size. - - :param s: - the udp max size - """ - _ldns.ldns_resolver_set_edns_udp_size(self,s) - #parameters: ldns_resolver *,uint16_t, - #retvals: - - def set_fail(self,b): - """Whether or not to fail after one failed query. - - :param b: - true: yes fail, false: continue with next nameserver - """ - _ldns.ldns_resolver_set_fail(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_fallback(self,fallback): - """Set whether the resolvers truncation fallback mechanism is used when ldns_resolver_query() is called. - - :param fallback: - whether to use the fallback mechanism - """ - _ldns.ldns_resolver_set_fallback(self,fallback) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_igntc(self,b): - """Whether or not to ignore the TC bit. - - :param b: - true: yes ignore, false: don't ignore - """ - _ldns.ldns_resolver_set_igntc(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_ip6(self,i): - """Whether the resolver uses ip6. - - :param i: - 0: no pref, 1: ip4, 2: ip6 - """ - _ldns.ldns_resolver_set_ip6(self,i) - #parameters: ldns_resolver *,uint8_t, - #retvals: - - def set_nameserver_count(self,c): - """Set the resolver's nameserver count directly. - - :param c: - the nameserver count - """ - _ldns.ldns_resolver_set_nameserver_count(self,c) - #parameters: ldns_resolver *,size_t, - #retvals: - - def set_nameserver_rtt(self,pos,value): - """Set round trip time for a specific nameserver. - - Note this currently differentiates between: unreachable and reachable. - - :param pos: - the nameserver position - :param value: - the rtt - """ - _ldns.ldns_resolver_set_nameserver_rtt(self,pos,value) - #parameters: ldns_resolver *,size_t,size_t, - #retvals: - - def set_nameservers(self,rd): - """Set the resolver's nameserver count directly by using an rdf list. - - :param rd: - the resolver addresses - """ - _ldns.ldns_resolver_set_nameservers(self,rd) - #parameters: ldns_resolver *,ldns_rdf **, - #retvals: - - def set_port(self,p): - """Set the port the resolver should use. - - :param p: - the port number - """ - _ldns.ldns_resolver_set_port(self,p) - #parameters: ldns_resolver *,uint16_t, - #retvals: - - def set_random(self,b): - """Should the nameserver list be randomized before each use. - - :param b: - true: randomize, false: don't - """ - _ldns.ldns_resolver_set_random(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_recursive(self,b): - """Set the resolver recursion. - - :param b: - true: set to recurse, false: unset - """ - _ldns.ldns_resolver_set_recursive(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def set_retrans(self,re): - """Set the resolver retrans timeout (in seconds). - - :param re: - the retransmission interval in seconds - """ - _ldns.ldns_resolver_set_retrans(self,re) - #parameters: ldns_resolver *,uint8_t, - #retvals: - - def set_retry(self,re): - """Set the resolver retry interval (in seconds). - - :param re: - the retry interval - """ - _ldns.ldns_resolver_set_retry(self,re) - #parameters: ldns_resolver *,uint8_t, - #retvals: - - def set_rtt(self,rtt): - """Set round trip time for all nameservers. - - Note this currently differentiates between: unreachable and reachable. - - :param rtt: - a list with the times - """ - _ldns.ldns_resolver_set_rtt(self,rtt) - #parameters: ldns_resolver *,size_t *, - #retvals: - - def set_searchlist_count(self,c): - _ldns.ldns_resolver_set_searchlist_count(self,c) - #parameters: ldns_resolver *,size_t, - #retvals: - - def set_timeout(self,timeout): - """Set the resolver's socket time out when talking to remote hosts. - - :param timeout: - the timeout to use - """ - _ldns.ldns_resolver_set_timeout(self,timeout) - #parameters: ldns_resolver *,struct timeval, - #retvals: - - def set_tsig_algorithm(self,tsig_algorithm): - """Set the tsig algorithm. - - :param tsig_algorithm: - the tsig algorithm - """ - _ldns.ldns_resolver_set_tsig_algorithm(self,tsig_algorithm) - #parameters: ldns_resolver *,char *, - #retvals: - - def set_tsig_keydata(self,tsig_keydata): - """Set the tsig key data. - - :param tsig_keydata: - the key data - """ - _ldns.ldns_resolver_set_tsig_keydata(self,tsig_keydata) - #parameters: ldns_resolver *,char *, - #retvals: - - def set_tsig_keyname(self,tsig_keyname): - """Set the tsig key name. - - :param tsig_keyname: - the tsig key name - """ - _ldns.ldns_resolver_set_tsig_keyname(self,tsig_keyname) - #parameters: ldns_resolver *,char *, - #retvals: - - def set_usevc(self,b): - """Whether the resolver uses a virtual circuit (TCP). - - :param b: - true: use TCP, false: don't use TCP - """ - _ldns.ldns_resolver_set_usevc(self,b) - #parameters: ldns_resolver *,bool, - #retvals: - - def timeout(self): - """What is the timeout on socket connections. - - :returns: (struct timeval) the timeout as struct timeval - """ - return _ldns.ldns_resolver_timeout(self) - #parameters: const ldns_resolver *, - #retvals: struct timeval - - def trusted_key(self,keys,trusted_keys): - """Returns true if at least one of the provided keys is a trust anchor. - - :param keys: - the keyset to check - :param trusted_keys: - the subset of trusted keys in the 'keys' rrset - :returns: (bool) true if at least one of the provided keys is a configured trust anchor - """ - return _ldns.ldns_resolver_trusted_key(self,keys,trusted_keys) - #parameters: const ldns_resolver *,ldns_rr_list *,ldns_rr_list *, - #retvals: bool - - def tsig_algorithm(self): - """Return the tsig algorithm as used by the nameserver. - - :returns: (char \*) the algorithm used. - """ - return _ldns.ldns_resolver_tsig_algorithm(self) - #parameters: const ldns_resolver *, - #retvals: char * - - def tsig_keydata(self): - """Return the tsig keydata as used by the nameserver. - - :returns: (char \*) the keydata used. - """ - return _ldns.ldns_resolver_tsig_keydata(self) - #parameters: const ldns_resolver *, - #retvals: char * - - def tsig_keyname(self): - """Return the tsig keyname as used by the nameserver. - - :returns: (char \*) the name used. - """ - return _ldns.ldns_resolver_tsig_keyname(self) - #parameters: const ldns_resolver *, - #retvals: char * - - def usevc(self): - """Does the resolver use tcp or udp. - - :returns: (bool) true: tcp, false: udp - """ - return _ldns.ldns_resolver_usevc(self) - #parameters: const ldns_resolver *, - #retvals: bool - - #_LDNS_RESOLVER_METHODS# - %} -} diff --git a/libs/ldns/contrib/python/ldns_rr.i b/libs/ldns/contrib/python/ldns_rr.i deleted file mode 100644 index 64e8297883..0000000000 --- a/libs/ldns/contrib/python/ldns_rr.i +++ /dev/null @@ -1,1169 +0,0 @@ -/****************************************************************************** - * ldns_rr.i: LDNS resource records (RR), RR list - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ - -%typemap(in,numinputs=0,noblock=1) (ldns_rr **) -{ - ldns_rr *$1_rr; - $1 = &$1_rr; -} - -/* result generation */ -%typemap(argout,noblock=1) (ldns_rr **) -{ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_rr), SWIGTYPE_p_ldns_struct_rr, SWIG_POINTER_OWN | 0 )); -} - -%nodefaultctor ldns_struct_rr; //no default constructor & destructor -%nodefaultdtor ldns_struct_rr; - -%ignore ldns_struct_rr::_rdata_fields; - -%newobject ldns_rr_clone; -%newobject ldns_rr_pop_rdf; -%delobject ldns_rr_free; - -%rename(ldns_rr) ldns_struct_rr; - -#ifdef LDNS_DEBUG -%rename(__ldns_rr_free) ldns_rr_free; -%inline %{ -void _ldns_rr_free (ldns_rr* r) { - printf("******** LDNS_RR free 0x%lX ************\n", (long unsigned int)r); - ldns_rr_free(r); -} -%} -#else -%rename(_ldns_rr_free) ldns_rr_free; -#endif - -%newobject ldns_rr2str; -%newobject ldns_rr_type2str; -%newobject ldns_rr_class2str; -%newobject ldns_read_anchor_file; - -%rename(_ldns_rr_new_frm_str) ldns_rr_new_frm_str; -%rename(_ldns_rr_new_frm_fp_l) ldns_rr_new_frm_fp_l; -%rename(_ldns_rr_new_frm_fp) ldns_rr_new_frm_fp; - -%feature("docstring") ldns_struct_rr "Resource Record (RR) - -The RR is the basic DNS element that contains actual data. This class allows to create RR and manipulate with the content." - -%extend ldns_struct_rr { - - %pythoncode %{ - def __init__(self): - raise Exception("This class can't be created directly. Please use: ldns_rr_new, ldns_rr_new_frm_type, new_frm_fp(), new_frm_fp_l(), new_frm_str() or new_question_frm_str") - - __swig_destroy__ = _ldns._ldns_rr_free - - #LDNS_RR_CONSTRUCTORS_# - @staticmethod - def new_frm_str(str, default_ttl=0, origin=None, prev=None, raiseException=True): - """Creates an rr object from a string. - - The string should be a fully filled-in rr, like ownername [space] TTL [space] CLASS [space] TYPE [space] RDATA. - - :param str: the string to convert - :param default_ttl: default ttl value for the rr. If 0 DEF_TTL will be used - :param origin: when the owner is relative add this - :param prev: the previous ownername - :param raiseException: if True, an exception occurs in case a rr instance can't be created - :returns: - * rr - (ldnsrr) RR instance or None. If the object can't be created and raiseException is True, an exception occurs. - - **Usage** - - >>> import ldns - >>> rr = ldns.ldns_rr.new_frm_str("www.nic.cz. IN A 192.168.1.1",300) - >>> print rr - www.nic.cz. 300 IN A 192.168.1.1 - """ - status, rr, prev = _ldns.ldns_rr_new_frm_str_(str, default_ttl, origin, prev) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create RR, error: %d" % status) - return None - return rr - - @staticmethod - def new_question_frm_str(str, default_ttl=0, origin=None, prev=None, raiseException=True): - """Creates an rr object from a string. - - The string is like new_frm_str but without rdata. - - :param str: the string to convert - :param origin: when the owner is relative add this - :param prev: the previous ownername - :param raiseException: if True, an exception occurs in case a rr instance can't be created - :returns: - * rr - (ldnsrr) RR instance or None. If the object can't be created and raiseException is True, an exception occurs. - """ - status, rr, prev = _ldns.ldns_rr_new_question_frm_str_(str, origin, prev) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create RR, error: %d" % status) - return None - return rr - - @staticmethod - def new_frm_str_prev(str, default_ttl=0, origin=None, prev=None, raiseException=True): - """Creates an rr object from a string. - - The string should be a fully filled-in rr, like ownername [space] TTL [space] CLASS [space] TYPE [space] RDATA. - - :param str: the string to convert - :param default_ttl: default ttl value for the rr. If 0 DEF_TTL will be used - :param origin: when the owner is relative add this - :param prev: the previous ownername - :param raiseException: if True, an exception occurs in case a rr instance can't be created - :returns: - * rr - (ldnsrr) RR instance or None. If the object can't be created and raiseException is True, an exception occurs. - - * prev - (ldns_rdf) ownername found in this string or None - """ - status, rr, prev = _ldns.ldns_rr_new_frm_str_(str, default_ttl, origin, prev) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create RR, error: %d" % status) - return None - return rr, prev - - @staticmethod - def new_frm_fp(file, default_ttl=0, origin=None, prev=None, raiseException=True): - """Creates a new rr from a file containing a string. - - :param file: file pointer - :param default_ttl: If 0 DEF_TTL will be used - :param origin: when the owner is relative add this. - :param prev: when the owner is whitespaces use this. - :param raiseException: if True, an exception occurs in case a resolver object can't be created - :returns: - * rr - (ldns_rr) RR object or None. If the object can't be created and raiseException is True, an exception occurs. - - * ttl - (int) None or TTL if the file contains a $TTL directive - - * origin - (ldns_rdf) None or dname if the file contains a $ORIGIN directive - - * prev - (ldns_rdf) None or updated value of prev parameter - """ - res = _ldns.ldns_rr_new_frm_fp_l_(file, default_ttl, origin, prev, 0) - if res[0] != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create RR, error: %d" % res[0]) - return None - return res[1:] - - @staticmethod - def new_frm_fp_l(file, default_ttl=0, origin=None, prev=None, raiseException=True): - """Creates a new rr from a file containing a string. - - :param file: file pointer - :param default_ttl: If 0 DEF_TTL will be used - :param origin: when the owner is relative add this. - :param prev: when the owner is whitespaces use this. - :param raiseException: if True, an exception occurs in case a resolver object can't be created - :returns: - * rr - (ldns_rr) RR object or None. If the object can't be created and raiseException is True, an exception occurs. - - * line - (int) line number (for debugging) - - * ttl - (int) None or TTL if the file contains a $TTL directive - - * origin - (ldns_rdf) None or dname if the file contains a $ORIGIN directive - - * prev - (ldns_rdf) None or updated value of prev parameter - """ - res = _ldns.ldns_rr_new_frm_fp_l_(file, default_ttl, origin, prev, 1) - if res[0] != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create RR, error: %d" % res[0]) - return None - return res[1:] - #_LDNS_RR_CONSTRUCTORS# - - - def __str__(self): - """converts the data in the resource record to presentation format""" - return _ldns.ldns_rr2str(self) - - def __cmp__(self, other): - """compares two rrs. - - The TTL is not looked at. - - :param other: - the second RR one - :returns: (int) 0 if equal -1 if self comes before other RR +1 if other RR comes before self - """ - return _ldns.ldns_rr_compare(self,other) - - def rdfs(self): - """returns the list of rdata records.""" - for i in range(0,self.rd_count()): - yield self.rdf(i) - - def get_function(self,rtype,pos): - """return a specific rdf""" - return _ldns.ldns_rr_function(rtype,self,pos) - #parameters: ldns_rr_type,const ldns_rr *,size_t, - #retvals: ldns_rdf * - - def set_function(self,rtype,rdf,pos): - """set a specific rdf""" - return _ldns.ldns_rr_set_function(rtype,self,rdf,pos) - #parameters: ldns_rr_type,ldns_rr *,ldns_rdf *,size_t, - #retvals: bool - - def print_to_file(self,output): - """Prints the data in the resource record to the given file stream (in presentation format).""" - _ldns.ldns_rr_print(output,self) - #parameters: FILE *,const ldns_rr *, - - def get_type_str(self): - """Converts an RR type value to its string representation, and returns that string.""" - return _ldns.ldns_rr_type2str(self.get_type()) - #parameters: const ldns_rr_type, - - def get_class_str(self): - """Converts an RR class value to its string representation, and returns that string.""" - return _ldns.ldns_rr_class2str(self.get_class()) - #parameters: const ldns_rr_class, - - @staticmethod - def dnskey_key_size_raw(keydata,len,alg): - """get the length of the keydata in bits""" - return _ldns.ldns_rr_dnskey_key_size_raw(keydata,len,alg) - #parameters: const unsigned char *,const size_t,const ldns_algorithm, - #retvals: size_t - - def write_to_buffer(self,buffer,section): - """Copies the rr data to the buffer in wire format. - - :param buffer: buffer to append the result to buffer - :param section: the section in the packet this rr is supposed to be in (to determine whether to add rdata or not) - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_rr2buffer_wire(buffer,self,section) - #parameters: ldns_buffer *,const ldns_rr *,int, - #retvals: ldns_status - - def write_to_buffer_canonical(self,buffer,section): - """Copies the rr data to the buffer in wire format, in canonical format according to RFC3597 (every dname in rdata fields of RR's mentioned in that RFC will be lowercased). - - :param buffer: buffer to append the result to buffer - :param section: the section in the packet this rr is supposed to be in (to determine whether to add rdata or not) - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_rr2buffer_wire_canonical(buffer,self,section) - #parameters: ldns_buffer *,const ldns_rr *,int, - #retvals: ldns_status - - def write_data_to_buffer(self,buffer): - """Converts an rr's rdata to wireformat, while excluding the ownername and all the stuff before the rdata. - - This is needed in DNSSEC keytag calculation, the ds calcalution from the key and maybe elsewhere. - - :param buffer: buffer to append the result to - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_rr_rdata2buffer_wire(buffer,self) - #parameters: ldns_buffer *,const ldns_rr *, - #retvals: ldns_status - - def write_rrsig_to_buffer(self,buffer): - """Converts a rrsig to wireformat BUT EXCLUDE the rrsig rdata - - This is needed in DNSSEC verification. - - :param buffer: buffer to append the result to - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_rrsig2buffer_wire(buffer,self) - #parameters: ldns_buffer *,const ldns_rr *, - #retvals: ldns_status - - #LDNS_RR_METHODS_# - def a_address(self): - """returns the address of a LDNS_RR_TYPE_A rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the address or NULL on failure - """ - return _ldns.ldns_rr_a_address(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def a_set_address(self,f): - """sets the address of a LDNS_RR_TYPE_A rr - - :param f: - the address to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_a_set_address(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def clone(self): - """clones a rr and all its data - - :returns: (ldns_rr \*) the new rr or NULL on failure - """ - return _ldns.ldns_rr_clone(self) - #parameters: const ldns_rr *, - #retvals: ldns_rr * - - def compare_ds(self,rr2): - """returns true of the given rr's are equal. - - Also returns true if one record is a DS that represents the same DNSKEY record as the other record - - :param rr2: - the second rr - :returns: (bool) true if equal otherwise false - """ - return _ldns.ldns_rr_compare_ds(self,rr2) - #parameters: const ldns_rr *,const ldns_rr *, - #retvals: bool - - def compare_no_rdata(self,rr2): - """compares two rrs, up to the rdata. - - :param rr2: - the second one - :returns: (int) 0 if equal -1 if rr1 comes before rr2 +1 if rr2 comes before rr1 - """ - return _ldns.ldns_rr_compare_no_rdata(self,rr2) - #parameters: const ldns_rr *,const ldns_rr *, - #retvals: int - - def dnskey_algorithm(self): - """returns the algorithm of a LDNS_RR_TYPE_DNSKEY rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the algorithm or NULL on failure - """ - return _ldns.ldns_rr_dnskey_algorithm(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def dnskey_flags(self): - """returns the flags of a LDNS_RR_TYPE_DNSKEY rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the flags or NULL on failure - """ - return _ldns.ldns_rr_dnskey_flags(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def dnskey_key(self): - """returns the key data of a LDNS_RR_TYPE_DNSKEY rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the key data or NULL on failure - """ - return _ldns.ldns_rr_dnskey_key(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def dnskey_key_size(self): - """get the length of the keydata in bits - - :returns: (size_t) the keysize in bits - """ - return _ldns.ldns_rr_dnskey_key_size(self) - #parameters: const ldns_rr *, - #retvals: size_t - - def dnskey_protocol(self): - """returns the protocol of a LDNS_RR_TYPE_DNSKEY rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the protocol or NULL on failure - """ - return _ldns.ldns_rr_dnskey_protocol(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def dnskey_set_algorithm(self,f): - """sets the algorithm of a LDNS_RR_TYPE_DNSKEY rr - - :param f: - the algorithm to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_dnskey_set_algorithm(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def dnskey_set_flags(self,f): - """sets the flags of a LDNS_RR_TYPE_DNSKEY rr - - :param f: - the flags to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_dnskey_set_flags(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def dnskey_set_key(self,f): - """sets the key data of a LDNS_RR_TYPE_DNSKEY rr - - :param f: - the key data to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_dnskey_set_key(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def dnskey_set_protocol(self,f): - """sets the protocol of a LDNS_RR_TYPE_DNSKEY rr - - :param f: - the protocol to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_dnskey_set_protocol(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def get_class(self): - """returns the class of the rr. - - :returns: (ldns_rr_class) the class of the rr - """ - return _ldns.ldns_rr_get_class(self) - #parameters: const ldns_rr *, - #retvals: ldns_rr_class - - def get_type(self): - """returns the type of the rr. - - :returns: (ldns_rr_type) the type of the rr - """ - return _ldns.ldns_rr_get_type(self) - #parameters: const ldns_rr *, - #retvals: ldns_rr_type - - def label_count(self): - """counts the number of labels of the ownername. - - :returns: (uint8_t) the number of labels - """ - return _ldns.ldns_rr_label_count(self) - #parameters: ldns_rr *, - #retvals: uint8_t - - def mx_exchange(self): - """returns the mx host of a LDNS_RR_TYPE_MX rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the name of the MX host or NULL on failure - """ - return _ldns.ldns_rr_mx_exchange(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def mx_preference(self): - """returns the mx pref. - - of a LDNS_RR_TYPE_MX rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the preference or NULL on failure - """ - return _ldns.ldns_rr_mx_preference(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def ns_nsdname(self): - """returns the name of a LDNS_RR_TYPE_NS rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the name or NULL on failure - """ - return _ldns.ldns_rr_ns_nsdname(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def owner(self): - """returns the owner name of an rr structure. - - :returns: (ldns_rdf \*) ldns_rdf * - """ - return _ldns.ldns_rr_owner(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def pop_rdf(self): - """removes a rd_field member, it will be popped from the last position. - - :returns: (ldns_rdf \*) rdf which was popped (null if nothing) - """ - return _ldns.ldns_rr_pop_rdf(self) - #parameters: ldns_rr *, - #retvals: ldns_rdf * - - def push_rdf(self,f): - """sets rd_field member, it will be placed in the next available spot. - - :param f: - :returns: (bool) bool - """ - return _ldns.ldns_rr_push_rdf(self,f) - #parameters: ldns_rr *,const ldns_rdf *, - #retvals: bool - - def rd_count(self): - """returns the rd_count of an rr structure. - - :returns: (size_t) the rd count of the rr - """ - return _ldns.ldns_rr_rd_count(self) - #parameters: const ldns_rr *, - #retvals: size_t - - def rdf(self,nr): - """returns the rdata field member counter. - - :param nr: - the number of the rdf to return - :returns: (ldns_rdf \*) ldns_rdf * - """ - return _ldns.ldns_rr_rdf(self,nr) - #parameters: const ldns_rr *,size_t, - #retvals: ldns_rdf * - - def rrsig_algorithm(self): - """returns the algorithm of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the algorithm or NULL on failure - """ - return _ldns.ldns_rr_rrsig_algorithm(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_expiration(self): - """returns the expiration time of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the expiration time or NULL on failure - """ - return _ldns.ldns_rr_rrsig_expiration(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_inception(self): - """returns the inception time of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the inception time or NULL on failure - """ - return _ldns.ldns_rr_rrsig_inception(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_keytag(self): - """returns the keytag of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the keytag or NULL on failure - """ - return _ldns.ldns_rr_rrsig_keytag(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_labels(self): - """returns the number of labels of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the number of labels or NULL on failure - """ - return _ldns.ldns_rr_rrsig_labels(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_origttl(self): - """returns the original TTL of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the original TTL or NULL on failure - """ - return _ldns.ldns_rr_rrsig_origttl(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_set_algorithm(self,f): - """sets the algorithm of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the algorithm to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_algorithm(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_expiration(self,f): - """sets the expireation date of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the expireation date to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_expiration(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_inception(self,f): - """sets the inception date of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the inception date to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_inception(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_keytag(self,f): - """sets the keytag of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the keytag to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_keytag(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_labels(self,f): - """sets the number of labels of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the number of labels to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_labels(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_origttl(self,f): - """sets the original TTL of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the original TTL to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_origttl(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_sig(self,f): - """sets the signature data of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the signature data to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_sig(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_signame(self,f): - """sets the signers name of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the signers name to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_signame(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_set_typecovered(self,f): - """sets the typecovered of a LDNS_RR_TYPE_RRSIG rr - - :param f: - the typecovered to set - :returns: (bool) true on success, false otherwise - """ - return _ldns.ldns_rr_rrsig_set_typecovered(self,f) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: bool - - def rrsig_sig(self): - """returns the signature data of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the signature data or NULL on failure - """ - return _ldns.ldns_rr_rrsig_sig(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_signame(self): - """returns the signers name of a LDNS_RR_TYPE_RRSIG RR - - :returns: (ldns_rdf \*) a ldns_rdf* with the signers name or NULL on failure - """ - return _ldns.ldns_rr_rrsig_signame(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def rrsig_typecovered(self): - """returns the type covered of a LDNS_RR_TYPE_RRSIG rr - - :returns: (ldns_rdf \*) a ldns_rdf* with the type covered or NULL on failure - """ - return _ldns.ldns_rr_rrsig_typecovered(self) - #parameters: const ldns_rr *, - #retvals: ldns_rdf * - - def set_class(self,rr_class): - """sets the class in the rr. - - :param rr_class: - set to this class - """ - _ldns.ldns_rr_set_class(self,rr_class) - #parameters: ldns_rr *,ldns_rr_class, - #retvals: - - def set_owner(self,owner): - """sets the owner in the rr structure. - - :param owner: - """ - _ldns.ldns_rr_set_owner(self,owner) - #parameters: ldns_rr *,ldns_rdf *, - #retvals: - - def set_rd_count(self,count): - """sets the rd_count in the rr. - - :param count: - set to this count - """ - _ldns.ldns_rr_set_rd_count(self,count) - #parameters: ldns_rr *,size_t, - #retvals: - - def set_rdf(self,f,position): - """sets a rdf member, it will be set on the position given. - - The old value is returned, like pop. - - :param f: - :param position: - the position the set the rdf - :returns: (ldns_rdf \*) the old value in the rr, NULL on failyre - """ - return _ldns.ldns_rr_set_rdf(self,f,position) - #parameters: ldns_rr *,const ldns_rdf *,size_t, - #retvals: ldns_rdf * - - def set_ttl(self,ttl): - """sets the ttl in the rr structure. - - :param ttl: - set to this ttl - """ - _ldns.ldns_rr_set_ttl(self,ttl) - #parameters: ldns_rr *,uint32_t, - #retvals: - - def set_type(self,rr_type): - """sets the type in the rr. - - :param rr_type: - set to this type - """ - _ldns.ldns_rr_set_type(self,rr_type) - #parameters: ldns_rr *,ldns_rr_type, - #retvals: - - def ttl(self): - """returns the ttl of an rr structure. - - :returns: (uint32_t) the ttl of the rr - """ - return _ldns.ldns_rr_ttl(self) - #parameters: const ldns_rr *, - #retvals: uint32_t - - def uncompressed_size(self): - """calculates the uncompressed size of an RR. - - :returns: (size_t) size of the rr - """ - return _ldns.ldns_rr_uncompressed_size(self) - #parameters: const ldns_rr *, - #retvals: size_t - - #_LDNS_RR_METHODS# - %} -} - -%nodefaultctor ldns_struct_rr_list; //no default constructor & destructor -%nodefaultdtor ldns_struct_rr_list; - -%ignore ldns_struct_rr_list::_rrs; - -%newobject ldns_rr_list_clone; -%newobject ldns_rr_list_pop_rr; -%newobject ldns_rr_list_pop_rr_list; -%newobject ldns_rr_list_pop_rrset; -%delobject ldns_rr_list_deep_free; -%delobject ldns_rr_list_free; - -%rename(ldns_rr_list) ldns_struct_rr_list; -#ifdef LDNS_DEBUG -%rename(__ldns_rr_list_deep_free) ldns_rr_list_deep_free; -%rename(__ldns_rr_list_free) ldns_rr_list_free; -%inline %{ -void _ldns_rr_list_free(ldns_rr_list* r) { - printf("******** LDNS_RR_LIST deep free 0x%lX ************\n", (long unsigned int)r); - ldns_rr_list_deep_free(r); -} -%} -#else -%rename(_ldns_rr_list_deep_free) ldns_rr_list_deep_free; -%rename(_ldns_rr_list_free) ldns_rr_list_free; -#endif - -%exception ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr) %{ $action if (result) Py_INCREF(obj1); %} -%exception ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list) %{ $action if (result) Py_INCREF(obj1); %} - -%newobject ldns_rr_list2str; - - - - -%feature("docstring") ldns_struct_rr_list "List of Resource Records. - -This class contains a list of RR's (see :class:`ldns.ldns_rr`). -" - -%extend ldns_struct_rr_list { - - %pythoncode %{ - def __init__(self): - self.this = _ldns.ldns_rr_list_new() - if not self.this: - raise Exception("Can't create new RR_LIST") - - __swig_destroy__ = _ldns._ldns_rr_list_free - - #LDNS_RR_LIST_CONSTRUCTORS_# - @staticmethod - def new_frm_file(filename="/etc/hosts", raiseException=True): - """Creates an RR List object from a file content - - Goes through a file and returns a rr_list containing all the defined hosts in there. - - :param filename: the filename to use - :returns: RR List object or None. If the object can't be created and raiseException is True, an exception occurs. - - **Usage** - >>> alist = ldns.ldns_rr_list.new_frm_file() - >>> print alist - localhost. 3600 IN A 127.0.0.1 - ... - - """ - rr = _ldns.ldns_get_rr_list_hosts_frm_file(filename) - if (not rr) and (raiseException): raise Exception("Can't create RR List, error: %d" % status) - return rr - #_LDNS_RR_LIST_CONSTRUCTORS# - - def __str__(self): - """converts a list of resource records to presentation format""" - return _ldns.ldns_rr_list2str(self) - - def print_to_file(self,output): - """print a rr_list to output param[in] output the fd to print to param[in] list the rr_list to print""" - _ldns.ldns_rr_list_print(output,self) - - - def to_canonical(self): - """converts each dname in each rr in a rr_list to its canonical form.""" - _ldns.ldns_rr_list2canonical(self) - #parameters: ldns_rr_list *, - #retvals: - - def rrs(self): - """returns the list of rr records.""" - for i in range(0,self.rr_count()): - yield self.rr(i) - - def is_rrset(self): - """checks if an rr_list is a rrset.""" - return _ldns.ldns_is_rrset(self) - - def __cmp__(self,rrl2): - """compares two rr listss. - - :param rrl2: - the second one - :returns: (int) 0 if equal -1 if this list comes before rrl2 +1 if rrl2 comes before this list - """ - return _ldns.ldns_rr_list_compare(self,rrl2) - - def write_to_buffer(self, buffer): - """Copies the rr_list data to the buffer in wire format. - - :param buffer: output buffer to append the result to - :returns: (ldns_status) ldns_status - """ - return _ldns.ldns_rr_list2buffer_wire(buffer,self) - - #LDNS_RR_LIST_METHODS_# - def cat(self,right): - """concatenates two ldns_rr_lists together. - - This modifies rr list (to extend it and add the pointers from right). - - :param right: - the rightside - :returns: (bool) a left with right concatenated to it - """ - return _ldns.ldns_rr_list_cat(self,right) - #parameters: ldns_rr_list *,ldns_rr_list *, - #retvals: bool - - def cat_clone(self,right): - """concatenates two ldns_rr_lists together, but makes clones of the rr's (instead of pointer copying). - - :param right: - the rightside - :returns: (ldns_rr_list \*) a new rr_list with leftside/rightside concatenated - """ - return _ldns.ldns_rr_list_cat_clone(self,right) - #parameters: ldns_rr_list *,ldns_rr_list *, - #retvals: ldns_rr_list * - - def clone(self): - """clones an rrlist. - - :returns: (ldns_rr_list \*) the cloned rr list - """ - return _ldns.ldns_rr_list_clone(self) - #parameters: const ldns_rr_list *, - #retvals: ldns_rr_list * - - def contains_rr(self,rr): - """returns true if the given rr is one of the rrs in the list, or if it is equal to one - - :param rr: - the rr to check - :returns: (bool) true if rr_list contains rr, false otherwise - """ - return _ldns.ldns_rr_list_contains_rr(self,rr) - #parameters: const ldns_rr_list *,ldns_rr *, - #retvals: bool - - def owner(self): - """Returns the owner domain name rdf of the first element of the RR If there are no elements present, NULL is returned. - - :returns: (ldns_rdf \*) dname of the first element, or NULL if the list is empty - """ - return _ldns.ldns_rr_list_owner(self) - #parameters: const ldns_rr_list *, - #retvals: ldns_rdf * - - def pop_rr(self): - """pops the last rr from an rrlist. - - :returns: (ldns_rr \*) NULL if nothing to pop. Otherwise the popped RR - """ - return _ldns.ldns_rr_list_pop_rr(self) - #parameters: ldns_rr_list *, - #retvals: ldns_rr * - - def pop_rr_list(self,size): - """pops an rr_list of size s from an rrlist. - - :param size: - the number of rr's to pop - :returns: (ldns_rr_list \*) NULL if nothing to pop. Otherwise the popped rr_list - """ - return _ldns.ldns_rr_list_pop_rr_list(self,size) - #parameters: ldns_rr_list *,size_t, - #retvals: ldns_rr_list * - - def pop_rrset(self): - """pops the first rrset from the list, the list must be sorted, so that all rr's from each rrset are next to each other - - :returns: (ldns_rr_list \*) - """ - return _ldns.ldns_rr_list_pop_rrset(self) - #parameters: ldns_rr_list *, - #retvals: ldns_rr_list * - - def push_rr(self,rr): - """pushes an rr to an rrlist. - - :param rr: - the rr to push - :returns: (bool) false on error, otherwise true - """ - return _ldns.ldns_rr_list_push_rr(self,rr) - #parameters: ldns_rr_list *,const ldns_rr *, - #retvals: bool - - def push_rr_list(self,push_list): - """pushes an rr_list to an rrlist. - - :param push_list: - the rr_list to push - :returns: (bool) false on error, otherwise true - """ - return _ldns.ldns_rr_list_push_rr_list(self,push_list) - #parameters: ldns_rr_list *,const ldns_rr_list *, - #retvals: bool - - def rr(self,nr): - """returns a specific rr of an rrlist. - - :param nr: - return this rr - :returns: (ldns_rr \*) the rr at position nr - """ - return _ldns.ldns_rr_list_rr(self,nr) - #parameters: const ldns_rr_list *,size_t, - #retvals: ldns_rr * - - def rr_count(self): - """returns the number of rr's in an rr_list. - - :returns: (size_t) the number of rr's - """ - return _ldns.ldns_rr_list_rr_count(self) - #parameters: const ldns_rr_list *, - #retvals: size_t - - def set_rr(self,r,count): - """set a rr on a specific index in a ldns_rr_list - - :param r: - the rr to set - :param count: - index into the rr_list - :returns: (ldns_rr \*) the old rr which was stored in the rr_list, or NULL is the index was too large set a specific rr - """ - return _ldns.ldns_rr_list_set_rr(self,r,count) - #parameters: ldns_rr_list *,const ldns_rr *,size_t, - #retvals: ldns_rr * - - def set_rr_count(self,count): - """sets the number of rr's in an rr_list. - - :param count: - the number of rr in this list - """ - _ldns.ldns_rr_list_set_rr_count(self,count) - #parameters: ldns_rr_list *,size_t, - #retvals: - - def sort(self): - """sorts an rr_list (canonical wire format). - - the sorting is done inband. - """ - _ldns.ldns_rr_list_sort(self) - #parameters: ldns_rr_list *, - #retvals: - - def subtype_by_rdf(self,r,pos): - """Return the rr_list which matches the rdf at position field. - - Think type-covered stuff for RRSIG - - :param r: - the rdf to use for the comparison - :param pos: - at which position can we find the rdf - :returns: (ldns_rr_list \*) a new rr list with only the RRs that match - """ - return _ldns.ldns_rr_list_subtype_by_rdf(self,r,pos) - #parameters: ldns_rr_list *,ldns_rdf *,size_t, - #retvals: ldns_rr_list * - - def type(self): - """Returns the type of the first element of the RR If there are no elements present, 0 is returned (LDNS_RR_TYPE_A). - - :returns: (ldns_rr_type) rr_type of the first element, or 0 if the list is empty - """ - return _ldns.ldns_rr_list_type(self) - #parameters: const ldns_rr_list *, - #retvals: ldns_rr_type - #_LDNS_RR_LIST_METHODS# - %} -} - -%newobject ldns_rr_descript; - -%nodefaultctor ldns_struct_rr_descriptor; //no default constructor & destructor -%nodefaultdtor ldns_struct_rr_descriptor; -%rename(ldns_rr_descriptor) ldns_struct_rr_descriptor; - - - - -%feature("docstring") ldns_struct_rr_descriptor "Resource Record descriptor - -This structure contains, for all rr types, the rdata fields that are defined." - -%extend ldns_struct_rr_descriptor { - %pythoncode %{ - def __init__(self): - raise Exception("This class can't be created directly. Please use: ldns_rr_descript") - #LDNS_RR_DESCRIPTOR_METHODS_# - def field_type(self,field): - """returns the rdf type for the given rdata field number of the rr type for the given descriptor. - - :param field: - the field number - :returns: (ldns_rdf_type) the rdf type for the field - """ - return _ldns.ldns_rr_descriptor_field_type(self,field) - #parameters: const ldns_rr_descriptor *,size_t, - #retvals: ldns_rdf_type - - def maximum(self): - """returns the maximum number of rdata fields of the rr type this descriptor describes. - - :returns: (size_t) the maximum number of rdata fields - """ - return _ldns.ldns_rr_descriptor_maximum(self) - #parameters: const ldns_rr_descriptor *, - #retvals: size_t - - def minimum(self): - """returns the minimum number of rdata fields of the rr type this descriptor describes. - - :returns: (size_t) the minimum number of rdata fields - """ - return _ldns.ldns_rr_descriptor_minimum(self) - #parameters: const ldns_rr_descriptor *, - #retvals: size_t - - #_LDNS_RR_DESCRIPTOR_METHODS# - %} -} - diff --git a/libs/ldns/contrib/python/ldns_zone.i b/libs/ldns/contrib/python/ldns_zone.i deleted file mode 100644 index 2afdd96930..0000000000 --- a/libs/ldns/contrib/python/ldns_zone.i +++ /dev/null @@ -1,298 +0,0 @@ -/****************************************************************************** - * ldns_zone.i: LDNS zone class - * - * Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz) - * Karel Slany (slany AT fit.vutbr.cz) - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the organization nor the names of its - * contributors may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - ******************************************************************************/ - -%typemap(in,numinputs=0,noblock=1) (ldns_zone **) -{ - ldns_zone *$1_zone; - $1 = &$1_zone; -} - -/* result generation */ -%typemap(argout,noblock=1) (ldns_zone **) -{ - $result = SWIG_Python_AppendOutput($result, SWIG_NewPointerObj(SWIG_as_voidptr($1_zone), SWIGTYPE_p_ldns_struct_zone, SWIG_POINTER_OWN | 0 )); -} - -%nodefaultctor ldns_struct_zone; //no default constructor & destructor -%nodefaultdtor ldns_struct_zone; - -%newobject ldns_zone_new_frm_fp; -%newobject ldns_zone_new_frm_fp_l; -%newobject ldns_zone_new; -%delobject ldns_zone_free; -%delobject ldns_zone_deep_free; -%delobject ldns_zone_push_rr; -%delobject ldns_zone_push_rr_list; - -%ignore ldns_struct_zone::_soa; -%ignore ldns_struct_zone::_rrs; - -%rename(ldns_zone) ldns_struct_zone; - -#ifdef LDNS_DEBUG -%rename(__ldns_zone_free) ldns_zone_free; -%rename(__ldns_zone_deep_free) ldns_zone_deep_free; -%inline %{ -void _ldns_zone_free (ldns_zone* z) { - printf("******** LDNS_ZONE free 0x%lX ************\n", (long unsigned int)z); - ldns_zone_deep_free(z); -} -%} -#else -%rename(__ldns_zone_free) ldns_zone_free; -%rename(_ldns_zone_free) ldns_zone_deep_free; -#endif -%feature("docstring") ldns_struct_zone "Zone definitions - -**Usage** - -This class is able to read and parse the content of zone file by doing: - ->>> import ldns ->>> zone = ldns.ldns_zone.new_frm_fp(open(\"zone.txt\",\"r\"), None, 0, ldns.LDNS_RR_CLASS_IN) ->>> print zone.soa() -example. 600 IN SOA example. admin.example. 2008022501 28800 7200 604800 18000 ->>> print zone.rrs() -example. 600 IN MX 10 mail.example. -example. 600 IN NS ns1.example. -example. 600 IN NS ns2.example. -example. 600 IN A 192.168.1.1 - -The ``zone.txt`` file contains the following records:: - - $ORIGIN example. - $TTL 600 - - example. IN SOA example. admin.example. ( - 2008022501 ; serial - 28800 ; refresh (8 hours) - 7200 ; retry (2 hours) - 604800 ; expire (1 week) - 18000 ; minimum (5 hours) - ) - - @ IN MX 10 mail.example. - @ IN NS ns1 - @ IN NS ns2 - @ IN A 192.168.1.1 -" - -%extend ldns_struct_zone { - - %pythoncode %{ - def __init__(self): - self.this = _ldns.ldns_zone_new() - if not self.this: - raise Exception("Can't create zone.") - - __swig_destroy__ = _ldns._ldns_zone_free - - def __str__(self): - return str(self.soa()) + "\n" + str(self.rrs()) - - def print_to_file(self,output): - """Prints the data in the zone to the given file stream (in presentation format).""" - _ldns.ldns_zone_print(output,self) - #parameters: FILE *,const ldns_zone *, - - #LDNS_ZONE_CONSTRUCTORS_# - @staticmethod - def new_frm_fp(file, origin, ttl, rr_class=_ldns.LDNS_RR_CLASS_IN, raiseException=True): - """Creates a new zone object from given file pointer - - :param file: a file object - :param origin: (ldns_rdf) the zones' origin - :param ttl: default ttl to use - :param rr_class: efault class to use (IN) - :param raiseException: if True, an exception occurs in case a zone instance can't be created - :returns: zone instance or None. If an instance can't be created and raiseException is True, an exception occurs. - """ - status, zone = _ldns.ldns_zone_new_frm_fp(file, origin, ttl, rr_class) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create zone, error: %s (%d)" % (_ldns.ldns_get_errorstr_by_id(status),status)) - return None - return zone - - @staticmethod - def new_frm_fp_l(file, origin, ttl, rr_class, raiseException=True): - """Create a new zone from a file, keep track of the line numbering - - :param file: a file object - :param origin: (ldns_rdf) the zones' origin - :param ttl: default ttl to use - :param rr_class: efault class to use (IN) - :param raiseException: if True, an exception occurs in case a zone instance can't be created - :returns: - * zone - zone instance or None. If an instance can't be created and raiseException is True, an exception occurs. - - * line - used for error msg, to get to the line number - """ - status, zone = _ldns.ldns_zone_new_frm_fp_l(file, line) - if status != LDNS_STATUS_OK: - if (raiseException): raise Exception("Can't create zone, error: %d" % status) - return None - return zone - #_LDNS_ZONE_CONSTRUCTORS# - - def sign(self,key_list): - """Signs the zone, and returns a newly allocated signed zone. - - :param key_list: - list of keys to sign with - :returns: (ldns_zone \*) signed zone - """ - return _ldns.ldns_zone_sign(self,key_list) - #parameters: const ldns_zone *,ldns_key_list *, - #retvals: ldns_zone * - - def sign_nsec3(self,key_list,algorithm,flags,iterations,salt_length,salt): - """Signs the zone with NSEC3, and returns a newly allocated signed zone. - - :param key_list: - list of keys to sign with - :param algorithm: - the NSEC3 hashing algorithm to use - :param flags: - NSEC3 flags - :param iterations: - the number of NSEC3 hash iterations to use - :param salt_length: - the length (in octets) of the NSEC3 salt - :param salt: - the NSEC3 salt data - :returns: (ldns_zone \*) signed zone - """ - return _ldns.ldns_zone_sign_nsec3(self,key_list,algorithm,flags,iterations,salt_length,salt) - #parameters: ldns_zone *,ldns_key_list *,uint8_t,uint8_t,uint16_t,uint8_t,uint8_t *, - #retvals: ldns_zone * - - #LDNS_ZONE_METHODS_# - def glue_rr_list(self): - """Retrieve all resource records from the zone that are glue records. - - The resulting list does are pointer references to the zone's data. - - Due to the current zone implementation (as a list of rr's), this function is extremely slow. Another (probably better) way to do this is to use an ldns_dnssec_zone structure and the mark_glue function - - :returns: (ldns_rr_list \*) the rr_list with the glue - """ - return _ldns.ldns_zone_glue_rr_list(self) - #parameters: const ldns_zone *, - #retvals: ldns_rr_list * - - def push_rr(self,rr): - """push an single rr to a zone structure. - - This function use pointer copying, so the rr_list structure inside z is modified! - - :param rr: - the rr to add - :returns: (bool) a true on succes otherwise falsed - """ - return _ldns.ldns_zone_push_rr(self,rr) - #parameters: ldns_zone *,ldns_rr *, - #retvals: bool - - def push_rr_list(self,list): - """push an rrlist to a zone structure. - - This function use pointer copying, so the rr_list structure inside z is modified! - - :param list: - the list to add - :returns: (bool) a true on succes otherwise falsed - """ - return _ldns.ldns_zone_push_rr_list(self,list) - #parameters: ldns_zone *,ldns_rr_list *, - #retvals: bool - - def rr_count(self): - """Returns the number of resource records in the zone, NOT counting the SOA record. - - :returns: (size_t) the number of rr's in the zone - """ - return _ldns.ldns_zone_rr_count(self) - #parameters: const ldns_zone *, - #retvals: size_t - - def rrs(self): - """Get a list of a zone's content. - - Note that the SOA isn't included in this list. You need to get the with ldns_zone_soa. - - :returns: (ldns_rr_list \*) the rrs from this zone - """ - return _ldns.ldns_zone_rrs(self) - #parameters: const ldns_zone *, - #retvals: ldns_rr_list * - - def set_rrs(self,rrlist): - """Set the zone's contents. - - :param rrlist: - the rrlist to use - """ - _ldns.ldns_zone_set_rrs(self,rrlist) - #parameters: ldns_zone *,ldns_rr_list *, - #retvals: - - def set_soa(self,soa): - """Set the zone's soa record. - - :param soa: - the soa to set - """ - _ldns.ldns_zone_set_soa(self,soa) - #parameters: ldns_zone *,ldns_rr *, - #retvals: - - def soa(self): - """Return the soa record of a zone. - - :returns: (ldns_rr \*) the soa record in the zone - """ - return _ldns.ldns_zone_soa(self) - #parameters: const ldns_zone *, - #retvals: ldns_rr * - - def sort(self): - """Sort the rrs in a zone, with the current impl. - - this is slow - """ - _ldns.ldns_zone_sort(self) - #parameters: ldns_zone *, - #retvals: - - #_LDNS_ZONE_METHODS# - %} -} diff --git a/libs/ldns/dname.c b/libs/ldns/dname.c deleted file mode 100644 index 0e63ef2689..0000000000 --- a/libs/ldns/dname.c +++ /dev/null @@ -1,567 +0,0 @@ -/* - * dname.c - * - * dname specific rdata implementations - * A dname is a rdf structure with type LDNS_RDF_TYPE_DNAME - * It is not a /real/ type! All function must therefor check - * for LDNS_RDF_TYPE_DNAME. - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include - -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif - -ldns_rdf * -ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2) -{ - ldns_rdf *new; - uint16_t new_size; - uint8_t *buf; - uint16_t left_size; - - if (ldns_rdf_get_type(rd1) != LDNS_RDF_TYPE_DNAME || - ldns_rdf_get_type(rd2) != LDNS_RDF_TYPE_DNAME) { - return NULL; - } - - /* remove root label if it is present at the end of the left - * rd, by reducing the size with 1 - */ - left_size = ldns_rdf_size(rd1); - if (left_size > 0 &&ldns_rdf_data(rd1)[left_size - 1] == 0) { - left_size--; - } - - /* we overwrite the nullbyte of rd1 */ - new_size = left_size + ldns_rdf_size(rd2); - buf = LDNS_XMALLOC(uint8_t, new_size); - if (!buf) { - return NULL; - } - - /* put the two dname's after each other */ - memcpy(buf, ldns_rdf_data(rd1), left_size); - memcpy(buf + left_size, ldns_rdf_data(rd2), ldns_rdf_size(rd2)); - - new = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, new_size, buf); - - LDNS_FREE(buf); - return new; -} - -ldns_status -ldns_dname_cat(ldns_rdf *rd1, ldns_rdf *rd2) -{ - uint16_t left_size; - uint16_t size; - uint8_t* newd; - - if (ldns_rdf_get_type(rd1) != LDNS_RDF_TYPE_DNAME || - ldns_rdf_get_type(rd2) != LDNS_RDF_TYPE_DNAME) { - return LDNS_STATUS_ERR; - } - - /* remove root label if it is present at the end of the left - * rd, by reducing the size with 1 - */ - left_size = ldns_rdf_size(rd1); - if (left_size > 0 &&ldns_rdf_data(rd1)[left_size - 1] == 0) { - left_size--; - } - if(left_size == 0) { - return LDNS_STATUS_OK; - } - - size = left_size + ldns_rdf_size(rd2); - newd = LDNS_XREALLOC(ldns_rdf_data(rd1), uint8_t, size); - if(!newd) { - return LDNS_STATUS_MEM_ERR; - } - - ldns_rdf_set_data(rd1, newd); - memcpy(ldns_rdf_data(rd1) + left_size, ldns_rdf_data(rd2), - ldns_rdf_size(rd2)); - ldns_rdf_set_size(rd1, size); - - return LDNS_STATUS_OK; -} - -ldns_rdf * -ldns_dname_reverse(const ldns_rdf *d) -{ - ldns_rdf *new; - ldns_rdf *tmp; - ldns_rdf *d_tmp; - ldns_status status; - - d_tmp = ldns_rdf_clone(d); - - new = ldns_dname_new_frm_str("."); - if(!new) - return NULL; - - while(ldns_dname_label_count(d_tmp) > 0) { - tmp = ldns_dname_label(d_tmp, 0); - status = ldns_dname_cat(tmp, new); - if(status != LDNS_STATUS_OK) { - ldns_rdf_deep_free(new); - ldns_rdf_deep_free(d_tmp); - return NULL; - } - ldns_rdf_deep_free(new); - new = tmp; - tmp = ldns_dname_left_chop(d_tmp); - ldns_rdf_deep_free(d_tmp); - d_tmp = tmp; - } - ldns_rdf_deep_free(d_tmp); - - return new; -} - -ldns_rdf * -ldns_dname_clone_from(const ldns_rdf *d, uint16_t n) -{ - uint8_t *data; - uint8_t label_size; - size_t data_size; - - if (!d || - ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME || - ldns_dname_label_count(d) < n) { - return NULL; - } - - data = ldns_rdf_data(d); - data_size = ldns_rdf_size(d); - while (n > 0) { - label_size = data[0] + 1; - data += label_size; - if (data_size < label_size) { - /* this label is very broken */ - return NULL; - } - data_size -= label_size; - n--; - } - - return ldns_dname_new_frm_data(data_size, data); -} - -ldns_rdf * -ldns_dname_left_chop(const ldns_rdf *d) -{ - uint8_t label_pos; - ldns_rdf *chop; - - if (!d) { - return NULL; - } - - if (ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME) { - return NULL; - } - if (ldns_dname_label_count(d) == 0) { - /* root label */ - return NULL; - } - /* 05blaat02nl00 */ - label_pos = ldns_rdf_data(d)[0]; - - chop = ldns_dname_new_frm_data(ldns_rdf_size(d) - label_pos - 1, - ldns_rdf_data(d) + label_pos + 1); - return chop; -} - -uint8_t -ldns_dname_label_count(const ldns_rdf *r) -{ - uint16_t src_pos; - uint16_t len; - uint8_t i; - size_t r_size; - - if (!r) { - return 0; - } - - i = 0; - src_pos = 0; - r_size = ldns_rdf_size(r); - - if (ldns_rdf_get_type(r) != LDNS_RDF_TYPE_DNAME) { - return 0; - } else { - len = ldns_rdf_data(r)[src_pos]; /* start of the label */ - - /* single root label */ - if (1 == r_size) { - return 0; - } else { - while ((len > 0) && src_pos < r_size) { - src_pos++; - src_pos += len; - len = ldns_rdf_data(r)[src_pos]; - i++; - } - } - } - return i; -} - -ldns_rdf * -ldns_dname_new(uint16_t s, void *d) -{ - ldns_rdf *rd; - - rd = LDNS_MALLOC(ldns_rdf); - if (!rd) { - return NULL; - } - ldns_rdf_set_size(rd, s); - ldns_rdf_set_type(rd, LDNS_RDF_TYPE_DNAME); - ldns_rdf_set_data(rd, d); - return rd; -} - -ldns_rdf * -ldns_dname_new_frm_str(const char *str) -{ - return ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, str); -} - -ldns_rdf * -ldns_dname_new_frm_data(uint16_t size, const void *data) -{ - return ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, size, data); -} - -void -ldns_dname2canonical(const ldns_rdf *rd) -{ - uint8_t *rdd; - uint16_t i; - - if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_DNAME) { - return; - } - - rdd = (uint8_t*)ldns_rdf_data(rd); - for (i = 0; i < ldns_rdf_size(rd); i++, rdd++) { - *rdd = (uint8_t)LDNS_DNAME_NORMALIZE((int)*rdd); - } -} - -bool -ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent) -{ - uint8_t sub_lab; - uint8_t par_lab; - int8_t i, j; - ldns_rdf *tmp_sub = NULL; - ldns_rdf *tmp_par = NULL; - ldns_rdf *sub_clone; - ldns_rdf *parent_clone; - bool result = true; - - if (ldns_rdf_get_type(sub) != LDNS_RDF_TYPE_DNAME || - ldns_rdf_get_type(parent) != LDNS_RDF_TYPE_DNAME || - ldns_rdf_compare(sub, parent) == 0) { - return false; - } - - /* would be nicer if we do not have to clone... */ - sub_clone = ldns_dname_clone_from(sub, 0); - parent_clone = ldns_dname_clone_from(parent, 0); - ldns_dname2canonical(sub_clone); - ldns_dname2canonical(parent_clone); - - sub_lab = ldns_dname_label_count(sub_clone); - par_lab = ldns_dname_label_count(parent_clone); - - /* if sub sits above parent, it cannot be a child/sub domain */ - if (sub_lab < par_lab) { - result = false; - } else { - /* check all labels the from the parent labels, from right to left. - * When they /all/ match we have found a subdomain - */ - j = sub_lab - 1; /* we count from zero, thank you */ - for (i = par_lab -1; i >= 0; i--) { - tmp_sub = ldns_dname_label(sub_clone, j); - tmp_par = ldns_dname_label(parent_clone, i); - if (!tmp_sub || !tmp_par) { - /* deep free does null check */ - ldns_rdf_deep_free(tmp_sub); - ldns_rdf_deep_free(tmp_par); - result = false; - break; - } - - if (ldns_rdf_compare(tmp_sub, tmp_par) != 0) { - /* they are not equal */ - ldns_rdf_deep_free(tmp_sub); - ldns_rdf_deep_free(tmp_par); - result = false; - break; - } - ldns_rdf_deep_free(tmp_sub); - ldns_rdf_deep_free(tmp_par); - j--; - } - } - ldns_rdf_deep_free(sub_clone); - ldns_rdf_deep_free(parent_clone); - return result; -} - -int -ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2) -{ - size_t lc1, lc2, lc1f, lc2f; - size_t i; - int result = 0; - uint8_t *lp1, *lp2; - - /* see RFC4034 for this algorithm */ - /* this algorithm assumes the names are normalized to case */ - - /* only when both are not NULL we can say anything about them */ - if (!dname1 && !dname2) { - return 0; - } - if (!dname1 || !dname2) { - return -1; - } - /* asserts must happen later as we are looking in the - * dname, which could be NULL. But this case is handled - * above - */ - assert(ldns_rdf_get_type(dname1) == LDNS_RDF_TYPE_DNAME); - assert(ldns_rdf_get_type(dname2) == LDNS_RDF_TYPE_DNAME); - - lc1 = ldns_dname_label_count(dname1); - lc2 = ldns_dname_label_count(dname2); - - if (lc1 == 0 && lc2 == 0) { - return 0; - } - if (lc1 == 0) { - return -1; - } - if (lc2 == 0) { - return 1; - } - lc1--; - lc2--; - /* we start at the last label */ - while (true) { - /* find the label first */ - lc1f = lc1; - lp1 = ldns_rdf_data(dname1); - while (lc1f > 0) { - lp1 += *lp1 + 1; - lc1f--; - } - - /* and find the other one */ - lc2f = lc2; - lp2 = ldns_rdf_data(dname2); - while (lc2f > 0) { - lp2 += *lp2 + 1; - lc2f--; - } - - /* now check the label character for character. */ - for (i = 1; i < (size_t)(*lp1 + 1); i++) { - if (i > *lp2) { - /* apparently label 1 is larger */ - result = 1; - goto done; - } - if (LDNS_DNAME_NORMALIZE((int) *(lp1 + i)) < - LDNS_DNAME_NORMALIZE((int) *(lp2 + i))) { - result = -1; - goto done; - } else if (LDNS_DNAME_NORMALIZE((int) *(lp1 + i)) > - LDNS_DNAME_NORMALIZE((int) *(lp2 + i))) { - result = 1; - goto done; - } - } - if (*lp1 < *lp2) { - /* apparently label 2 is larger */ - result = -1; - goto done; - } - if (lc1 == 0 && lc2 > 0) { - result = -1; - goto done; - } else if (lc1 > 0 && lc2 == 0) { - result = 1; - goto done; - } else if (lc1 == 0 && lc2 == 0) { - result = 0; - goto done; - } - lc1--; - lc2--; - } - - done: - return result; -} - -int -ldns_dname_is_wildcard(const ldns_rdf* dname) -{ - return ( ldns_dname_label_count(dname) > 0 && - ldns_rdf_data(dname)[0] == 1 && - ldns_rdf_data(dname)[1] == '*'); -} - -int -ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard) -{ - ldns_rdf *wc_chopped; - int result; - /* check whether it really is a wildcard */ - if (ldns_dname_is_wildcard(wildcard)) { - /* ok, so the dname needs to be a subdomain of the wildcard - * without the * - */ - wc_chopped = ldns_dname_left_chop(wildcard); - result = (int) ldns_dname_is_subdomain(dname, wc_chopped); - ldns_rdf_deep_free(wc_chopped); - } else { - result = (ldns_dname_compare(dname, wildcard) == 0); - } - return result; -} - -/* nsec test: does prev <= middle < next - * -1 = yes - * 0 = error/can't tell - * 1 = no - */ -int -ldns_dname_interval(const ldns_rdf *prev, const ldns_rdf *middle, - const ldns_rdf *next) -{ - int prev_check, next_check; - - assert(ldns_rdf_get_type(prev) == LDNS_RDF_TYPE_DNAME); - assert(ldns_rdf_get_type(middle) == LDNS_RDF_TYPE_DNAME); - assert(ldns_rdf_get_type(next) == LDNS_RDF_TYPE_DNAME); - - prev_check = ldns_dname_compare(prev, middle); - next_check = ldns_dname_compare(middle, next); - /* <= next. This cannot be the case for nsec, because then we would - * have gotten the nsec of next... - */ - if (next_check == 0) { - return 0; - } - - /* <= */ - if ((prev_check == -1 || prev_check == 0) && - /* < */ - next_check == -1) { - return -1; - } else { - return 1; - } -} - - -bool -ldns_dname_str_absolute(const char *dname_str) -{ - const char* s; - if(dname_str && strcmp(dname_str, ".") == 0) - return 1; - if(!dname_str || strlen(dname_str) < 2) - return 0; - if(dname_str[strlen(dname_str) - 1] != '.') - return 0; - if(dname_str[strlen(dname_str) - 2] != '\\') - return 1; /* ends in . and no \ before it */ - /* so we have the case of ends in . and there is \ before it */ - for(s=dname_str; *s; s++) { - if(*s == '\\') { - if(s[1] && s[2] && s[3] /* check length */ - && isdigit(s[1]) && isdigit(s[2]) && - isdigit(s[3])) - s += 3; - else if(!s[1] || isdigit(s[1])) /* escape of nul,0-9 */ - return 0; /* parse error */ - else s++; /* another character escaped */ - } - else if(!*(s+1) && *s == '.') - return 1; /* trailing dot, unescaped */ - } - return 0; -} - -ldns_rdf * -ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos) -{ - uint8_t labelcnt; - uint16_t src_pos; - uint16_t len; - ldns_rdf *tmpnew; - size_t s; - - if (ldns_rdf_get_type(rdf) != LDNS_RDF_TYPE_DNAME) { - return NULL; - } - - labelcnt = 0; - src_pos = 0; - s = ldns_rdf_size(rdf); - - len = ldns_rdf_data(rdf)[src_pos]; /* label start */ - while ((len > 0) && src_pos < s) { - if (labelcnt == labelpos) { - /* found our label */ - tmpnew = LDNS_MALLOC(ldns_rdf); - if (!tmpnew) { - return NULL; - } - tmpnew->_type = LDNS_RDF_TYPE_DNAME; - tmpnew->_data = LDNS_XMALLOC(uint8_t, len + 2); - if (!tmpnew->_data) { - LDNS_FREE(tmpnew); - return NULL; - } - memset(tmpnew->_data, 0, len + 2); - memcpy(tmpnew->_data, ldns_rdf_data(rdf) + src_pos, len + 1); - tmpnew->_size = len + 2; - return tmpnew; - } - src_pos++; - src_pos += len; - len = ldns_rdf_data(rdf)[src_pos]; - labelcnt++; - } - return NULL; -} diff --git a/libs/ldns/dnssec.c b/libs/ldns/dnssec.c deleted file mode 100644 index ce02ef36fd..0000000000 --- a/libs/ldns/dnssec.c +++ /dev/null @@ -1,1730 +0,0 @@ -/* - * dnssec.c - * - * contains the cryptographic function needed for DNSSEC in ldns - * The crypto library used is openssl - * - * (c) NLnet Labs, 2004-2008 - * - * See the file LICENSE for the license - */ - -#include - -#include -#include - -#include -#include - -#ifdef HAVE_SSL -#include -#include -#include -#include -#include -#endif - -ldns_rr * -ldns_dnssec_get_rrsig_for_name_and_type(const ldns_rdf *name, - const ldns_rr_type type, - const ldns_rr_list *rrs) -{ - size_t i; - ldns_rr *candidate; - - if (!name || !rrs) { - return NULL; - } - - for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - candidate = ldns_rr_list_rr(rrs, i); - if (ldns_rr_get_type(candidate) == LDNS_RR_TYPE_RRSIG) { - if (ldns_dname_compare(ldns_rr_owner(candidate), - name) == 0 && - ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(candidate)) - == type - ) { - return candidate; - } - } - } - - return NULL; -} - -ldns_rr * -ldns_dnssec_get_dnskey_for_rrsig(const ldns_rr *rrsig, - const ldns_rr_list *rrs) -{ - size_t i; - ldns_rr *candidate; - - if (!rrsig || !rrs) { - return NULL; - } - - for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - candidate = ldns_rr_list_rr(rrs, i); - if (ldns_rr_get_type(candidate) == LDNS_RR_TYPE_DNSKEY) { - if (ldns_dname_compare(ldns_rr_owner(candidate), - ldns_rr_rrsig_signame(rrsig)) == 0 && - ldns_rdf2native_int16(ldns_rr_rrsig_keytag(rrsig)) == - ldns_calc_keytag(candidate) - ) { - return candidate; - } - } - } - - return NULL; -} - -ldns_rdf * -ldns_nsec_get_bitmap(ldns_rr *nsec) { - if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC) { - return ldns_rr_rdf(nsec, 1); - } else if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC3) { - return ldns_rr_rdf(nsec, 5); - } else { - return NULL; - } -} - -/*return the owner name of the closest encloser for name from the list of rrs */ -/* this is NOT the hash, but the original name! */ -ldns_rdf * -ldns_dnssec_nsec3_closest_encloser(ldns_rdf *qname, - ATTR_UNUSED(ldns_rr_type qtype), - ldns_rr_list *nsec3s) -{ - /* remember parameters, they must match */ - uint8_t algorithm; - uint32_t iterations; - uint8_t salt_length; - uint8_t *salt; - - ldns_rdf *sname, *hashed_sname, *tmp; - ldns_rr *ce; - bool flag; - - bool exact_match_found; - bool in_range_found; - - ldns_status status; - ldns_rdf *zone_name; - - size_t nsec_i; - ldns_rr *nsec; - ldns_rdf *result = NULL; - qtype = qtype; - - if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { - return NULL; - } - - nsec = ldns_rr_list_rr(nsec3s, 0); - algorithm = ldns_nsec3_algorithm(nsec); - salt_length = ldns_nsec3_salt_length(nsec); - salt = ldns_nsec3_salt_data(nsec); - iterations = ldns_nsec3_iterations(nsec); - - sname = ldns_rdf_clone(qname); - - ce = NULL; - flag = false; - - zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); - - /* algorithm from nsec3-07 8.3 */ - while (ldns_dname_label_count(sname) > 0) { - exact_match_found = false; - in_range_found = false; - - hashed_sname = ldns_nsec3_hash_name(sname, - algorithm, - iterations, - salt_length, - salt); - - status = ldns_dname_cat(hashed_sname, zone_name); - if(status != LDNS_STATUS_OK) { - LDNS_FREE(salt); - ldns_rdf_deep_free(zone_name); - ldns_rdf_deep_free(sname); - return NULL; - } - - for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { - nsec = ldns_rr_list_rr(nsec3s, nsec_i); - - /* check values of iterations etc! */ - - /* exact match? */ - if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { - exact_match_found = true; - } else if (ldns_nsec_covers_name(nsec, hashed_sname)) { - in_range_found = true; - } - - } - if (!exact_match_found && in_range_found) { - flag = true; - } else if (exact_match_found && flag) { - result = ldns_rdf_clone(sname); - /* RFC 5155: 8.3. 2.** "The proof is complete" */ - ldns_rdf_deep_free(hashed_sname); - goto done; - } else if (exact_match_found && !flag) { - /* error! */ - ldns_rdf_deep_free(hashed_sname); - goto done; - } else { - flag = false; - } - - ldns_rdf_deep_free(hashed_sname); - tmp = sname; - sname = ldns_dname_left_chop(sname); - ldns_rdf_deep_free(tmp); - } - - done: - LDNS_FREE(salt); - ldns_rdf_deep_free(zone_name); - ldns_rdf_deep_free(sname); - - return result; -} - -bool -ldns_dnssec_pkt_has_rrsigs(const ldns_pkt *pkt) -{ - size_t i; - for (i = 0; i < ldns_pkt_ancount(pkt); i++) { - if (ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_answer(pkt), i)) == - LDNS_RR_TYPE_RRSIG) { - return true; - } - } - for (i = 0; i < ldns_pkt_nscount(pkt); i++) { - if (ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_authority(pkt), i)) == - LDNS_RR_TYPE_RRSIG) { - return true; - } - } - return false; -} - -ldns_rr_list * -ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt, - ldns_rdf *name, - ldns_rr_type type) -{ - uint16_t t_netorder; - ldns_rr_list *sigs; - ldns_rr_list *sigs_covered; - ldns_rdf *rdf_t; - - sigs = ldns_pkt_rr_list_by_name_and_type(pkt, - name, - LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_ANY_NOQUESTION - ); - - t_netorder = htons(type); /* rdf are in network order! */ - rdf_t = ldns_rdf_new(LDNS_RDF_TYPE_TYPE, LDNS_RDF_SIZE_WORD, &t_netorder); - sigs_covered = ldns_rr_list_subtype_by_rdf(sigs, rdf_t, 0); - - ldns_rdf_free(rdf_t); - ldns_rr_list_deep_free(sigs); - - return sigs_covered; - -} - -ldns_rr_list * -ldns_dnssec_pkt_get_rrsigs_for_type(const ldns_pkt *pkt, ldns_rr_type type) -{ - uint16_t t_netorder; - ldns_rr_list *sigs; - ldns_rr_list *sigs_covered; - ldns_rdf *rdf_t; - - sigs = ldns_pkt_rr_list_by_type(pkt, - LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_ANY_NOQUESTION - ); - - t_netorder = htons(type); /* rdf are in network order! */ - rdf_t = ldns_rdf_new(LDNS_RDF_TYPE_TYPE, - 2, - &t_netorder); - sigs_covered = ldns_rr_list_subtype_by_rdf(sigs, rdf_t, 0); - - ldns_rdf_free(rdf_t); - ldns_rr_list_deep_free(sigs); - - return sigs_covered; - -} - -/* used only on the public key RR */ -uint16_t -ldns_calc_keytag(const ldns_rr *key) -{ - uint16_t ac16; - ldns_buffer *keybuf; - size_t keysize; - - if (!key) { - return 0; - } - - if (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY && - ldns_rr_get_type(key) != LDNS_RR_TYPE_KEY - ) { - return 0; - } - - /* rdata to buf - only put the rdata in a buffer */ - keybuf = ldns_buffer_new(LDNS_MIN_BUFLEN); /* grows */ - if (!keybuf) { - return 0; - } - (void)ldns_rr_rdata2buffer_wire(keybuf, key); - /* the current pos in the buffer is the keysize */ - keysize= ldns_buffer_position(keybuf); - - ac16 = ldns_calc_keytag_raw(ldns_buffer_begin(keybuf), keysize); - ldns_buffer_free(keybuf); - return ac16; -} - -uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize) -{ - unsigned int i; - uint32_t ac32; - uint16_t ac16; - - if(keysize < 4) { - return 0; - } - /* look at the algorithm field, copied from 2535bis */ - if (key[3] == LDNS_RSAMD5) { - ac16 = 0; - if (keysize > 4) { - memmove(&ac16, key + keysize - 3, 2); - } - ac16 = ntohs(ac16); - return (uint16_t) ac16; - } else { - ac32 = 0; - for (i = 0; (size_t)i < keysize; ++i) { - ac32 += (i & 1) ? key[i] : key[i] << 8; - } - ac32 += (ac32 >> 16) & 0xFFFF; - return (uint16_t) (ac32 & 0xFFFF); - } -} - -#ifdef HAVE_SSL -DSA * -ldns_key_buf2dsa(ldns_buffer *key) -{ - return ldns_key_buf2dsa_raw((unsigned char*)ldns_buffer_begin(key), - ldns_buffer_position(key)); -} - -DSA * -ldns_key_buf2dsa_raw(unsigned char* key, size_t len) -{ - uint8_t T; - uint16_t length; - uint16_t offset; - DSA *dsa; - BIGNUM *Q; BIGNUM *P; - BIGNUM *G; BIGNUM *Y; - - if(len == 0) - return NULL; - T = (uint8_t)key[0]; - length = (64 + T * 8); - offset = 1; - - if (T > 8) { - return NULL; - } - if(len < (size_t)1 + SHA_DIGEST_LENGTH + 3*length) - return NULL; - - Q = BN_bin2bn(key+offset, SHA_DIGEST_LENGTH, NULL); - offset += SHA_DIGEST_LENGTH; - - P = BN_bin2bn(key+offset, (int)length, NULL); - offset += length; - - G = BN_bin2bn(key+offset, (int)length, NULL); - offset += length; - - Y = BN_bin2bn(key+offset, (int)length, NULL); - offset += length; - - /* create the key and set its properties */ - if(!Q || !P || !G || !Y || !(dsa = DSA_new())) { - BN_free(Q); - BN_free(P); - BN_free(G); - BN_free(Y); - return NULL; - } -#ifndef S_SPLINT_S - dsa->p = P; - dsa->q = Q; - dsa->g = G; - dsa->pub_key = Y; -#endif /* splint */ - - return dsa; -} - -RSA * -ldns_key_buf2rsa(ldns_buffer *key) -{ - return ldns_key_buf2rsa_raw((unsigned char*)ldns_buffer_begin(key), - ldns_buffer_position(key)); -} - -RSA * -ldns_key_buf2rsa_raw(unsigned char* key, size_t len) -{ - uint16_t offset; - uint16_t exp; - uint16_t int16; - RSA *rsa; - BIGNUM *modulus; - BIGNUM *exponent; - - if (len == 0) - return NULL; - if (key[0] == 0) { - if(len < 3) - return NULL; - /* need some smart comment here XXX*/ - /* the exponent is too large so it's places - * futher...???? */ - memmove(&int16, key+1, 2); - exp = ntohs(int16); - offset = 3; - } else { - exp = key[0]; - offset = 1; - } - - /* key length at least one */ - if(len < (size_t)offset + exp + 1) - return NULL; - - /* Exponent */ - exponent = BN_new(); - if(!exponent) return NULL; - (void) BN_bin2bn(key+offset, (int)exp, exponent); - offset += exp; - - /* Modulus */ - modulus = BN_new(); - if(!modulus) { - BN_free(exponent); - return NULL; - } - /* length of the buffer must match the key length! */ - (void) BN_bin2bn(key+offset, (int)(len - offset), modulus); - - rsa = RSA_new(); - if(!rsa) { - BN_free(exponent); - BN_free(modulus); - return NULL; - } -#ifndef S_SPLINT_S - rsa->n = modulus; - rsa->e = exponent; -#endif /* splint */ - - return rsa; -} - -int -ldns_digest_evp(unsigned char* data, unsigned int len, unsigned char* dest, - const EVP_MD* md) -{ - EVP_MD_CTX* ctx; - ctx = EVP_MD_CTX_create(); - if(!ctx) - return false; - if(!EVP_DigestInit_ex(ctx, md, NULL) || - !EVP_DigestUpdate(ctx, data, len) || - !EVP_DigestFinal_ex(ctx, dest, NULL)) { - EVP_MD_CTX_destroy(ctx); - return false; - } - EVP_MD_CTX_destroy(ctx); - return true; -} -#endif /* HAVE_SSL */ - -ldns_rr * -ldns_key_rr2ds(const ldns_rr *key, ldns_hash h) -{ - ldns_rdf *tmp; - ldns_rr *ds; - uint16_t keytag; - uint8_t sha1hash; - uint8_t *digest; - ldns_buffer *data_buf; -#ifdef USE_GOST - const EVP_MD* md = NULL; -#endif - - if (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY) { - return NULL; - } - - ds = ldns_rr_new(); - if (!ds) { - return NULL; - } - ldns_rr_set_type(ds, LDNS_RR_TYPE_DS); - ldns_rr_set_owner(ds, ldns_rdf_clone( - ldns_rr_owner(key))); - ldns_rr_set_ttl(ds, ldns_rr_ttl(key)); - ldns_rr_set_class(ds, ldns_rr_get_class(key)); - - switch(h) { - default: - case LDNS_SHA1: - digest = LDNS_XMALLOC(uint8_t, LDNS_SHA1_DIGEST_LENGTH); - if (!digest) { - ldns_rr_free(ds); - return NULL; - } - break; - case LDNS_SHA256: - digest = LDNS_XMALLOC(uint8_t, LDNS_SHA256_DIGEST_LENGTH); - if (!digest) { - ldns_rr_free(ds); - return NULL; - } - break; - case LDNS_HASH_GOST: -#ifdef USE_GOST - (void)ldns_key_EVP_load_gost_id(); - md = EVP_get_digestbyname("md_gost94"); - if(!md) { - ldns_rr_free(ds); - return NULL; - } - digest = LDNS_XMALLOC(uint8_t, EVP_MD_size(md)); - if (!digest) { - ldns_rr_free(ds); - return NULL; - } - break; -#else - /* not implemented */ - ldns_rr_free(ds); - return NULL; -#endif -#ifdef USE_ECDSA - case LDNS_SHA384: - digest = LDNS_XMALLOC(uint8_t, SHA384_DIGEST_LENGTH); - if (!digest) { - ldns_rr_free(ds); - return NULL; - } - break; -#else - /* not implemented */ - ldns_rr_free(ds); - return NULL; -#endif - } - - data_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if (!data_buf) { - LDNS_FREE(digest); - ldns_rr_free(ds); - return NULL; - } - - /* keytag */ - keytag = htons(ldns_calc_keytag((ldns_rr*)key)); - tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT16, - sizeof(uint16_t), - &keytag); - ldns_rr_push_rdf(ds, tmp); - - /* copy the algorithm field */ - ldns_rr_push_rdf(ds, ldns_rdf_clone( ldns_rr_rdf(key, 2))); - - /* digest hash type */ - sha1hash = (uint8_t)h; - tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT8, - sizeof(uint8_t), - &sha1hash); - ldns_rr_push_rdf(ds, tmp); - - /* digest */ - /* owner name */ - tmp = ldns_rdf_clone(ldns_rr_owner(key)); - ldns_dname2canonical(tmp); - if (ldns_rdf2buffer_wire(data_buf, tmp) != LDNS_STATUS_OK) { - LDNS_FREE(digest); - ldns_buffer_free(data_buf); - ldns_rr_free(ds); - ldns_rdf_deep_free(tmp); - return NULL; - } - ldns_rdf_deep_free(tmp); - - /* all the rdata's */ - if (ldns_rr_rdata2buffer_wire(data_buf, - (ldns_rr*)key) != LDNS_STATUS_OK) { - LDNS_FREE(digest); - ldns_buffer_free(data_buf); - ldns_rr_free(ds); - return NULL; - } - switch(h) { - case LDNS_SHA1: - (void) ldns_sha1((unsigned char *) ldns_buffer_begin(data_buf), - (unsigned int) ldns_buffer_position(data_buf), - (unsigned char *) digest); - - tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, - LDNS_SHA1_DIGEST_LENGTH, - digest); - ldns_rr_push_rdf(ds, tmp); - - break; - case LDNS_SHA256: - (void) ldns_sha256((unsigned char *) ldns_buffer_begin(data_buf), - (unsigned int) ldns_buffer_position(data_buf), - (unsigned char *) digest); - tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, - LDNS_SHA256_DIGEST_LENGTH, - digest); - ldns_rr_push_rdf(ds, tmp); - break; - case LDNS_HASH_GOST: -#ifdef USE_GOST - if(!ldns_digest_evp((unsigned char *) ldns_buffer_begin(data_buf), - (unsigned int) ldns_buffer_position(data_buf), - (unsigned char *) digest, md)) { - LDNS_FREE(digest); - ldns_buffer_free(data_buf); - ldns_rr_free(ds); - return NULL; - } - tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, - (size_t)EVP_MD_size(md), - digest); - ldns_rr_push_rdf(ds, tmp); -#endif - break; -#ifdef USE_ECDSA - case LDNS_SHA384: - (void) SHA384((unsigned char *) ldns_buffer_begin(data_buf), - (unsigned int) ldns_buffer_position(data_buf), - (unsigned char *) digest); - tmp = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, - SHA384_DIGEST_LENGTH, - digest); - ldns_rr_push_rdf(ds, tmp); - break; -#endif - } - - LDNS_FREE(digest); - ldns_buffer_free(data_buf); - return ds; -} - -ldns_rdf * -ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[], - size_t size, - ldns_rr_type nsec_type) -{ - size_t i; - uint8_t *bitmap; - uint16_t bm_len = 0; - uint16_t i_type; - ldns_rdf *bitmap_rdf; - - uint8_t *data = NULL; - uint8_t cur_data[32]; - uint8_t cur_window = 0; - uint8_t cur_window_max = 0; - uint16_t cur_data_size = 0; - - if (nsec_type != LDNS_RR_TYPE_NSEC && - nsec_type != LDNS_RR_TYPE_NSEC3) { - return NULL; - } - - i_type = 0; - for (i = 0; i < size; i++) { - if (i_type < rr_type_list[i]) - i_type = rr_type_list[i]; - } - if (i_type < nsec_type) { - i_type = nsec_type; - } - - bm_len = i_type / 8 + 2; - bitmap = LDNS_XMALLOC(uint8_t, bm_len); - if(!bitmap) return NULL; - for (i = 0; i < bm_len; i++) { - bitmap[i] = 0; - } - - for (i = 0; i < size; i++) { - i_type = rr_type_list[i]; - ldns_set_bit(bitmap + (int) i_type / 8, - (int) (7 - (i_type % 8)), - true); - } - - /* fold it into windows TODO: can this be done directly? */ - memset(cur_data, 0, 32); - for (i = 0; i < bm_len; i++) { - if (i / 32 > cur_window) { - /* check, copy, new */ - if (cur_window_max > 0) { - /* this window has stuff, add it */ - data = LDNS_XREALLOC(data, - uint8_t, - cur_data_size + cur_window_max + 3); - if(!data) { - LDNS_FREE(bitmap); - return NULL; - } - data[cur_data_size] = cur_window; - data[cur_data_size + 1] = cur_window_max + 1; - memcpy(data + cur_data_size + 2, - cur_data, - cur_window_max+1); - cur_data_size += cur_window_max + 3; - } - cur_window++; - cur_window_max = 0; - memset(cur_data, 0, 32); - } - cur_data[i%32] = bitmap[i]; - if (bitmap[i] > 0) { - cur_window_max = i%32; - } - } - if (cur_window_max > 0 || cur_data[0] != 0) { - /* this window has stuff, add it */ - data = LDNS_XREALLOC(data, - uint8_t, - cur_data_size + cur_window_max + 3); - if(!data) { - LDNS_FREE(bitmap); - return NULL; - } - data[cur_data_size] = cur_window; - data[cur_data_size + 1] = cur_window_max + 1; - memcpy(data + cur_data_size + 2, cur_data, cur_window_max+1); - cur_data_size += cur_window_max + 3; - } - - bitmap_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC, - cur_data_size, - data); - - LDNS_FREE(bitmap); - LDNS_FREE(data); - - return bitmap_rdf; -} - -int -ldns_dnssec_rrsets_contains_type(ldns_dnssec_rrsets *rrsets, - ldns_rr_type type) -{ - ldns_dnssec_rrsets *cur_rrset = rrsets; - while (cur_rrset) { - if (cur_rrset->type == type) { - return 1; - } - cur_rrset = cur_rrset->next; - } - return 0; -} - -/* returns true if the current dnssec_rrset from the given list of rrsets - * is glue */ -static int -is_glue(ldns_dnssec_rrsets *cur_rrsets, ldns_dnssec_rrsets *orig_rrsets) -{ - /* only glue if a or aaaa if there are no ns, unless there is soa */ - return (cur_rrsets->type == LDNS_RR_TYPE_A || - cur_rrsets->type == LDNS_RR_TYPE_AAAA) && - (ldns_dnssec_rrsets_contains_type(orig_rrsets, - LDNS_RR_TYPE_NS) && - !ldns_dnssec_rrsets_contains_type(orig_rrsets, - LDNS_RR_TYPE_SOA)); -} - -ldns_rr * -ldns_dnssec_create_nsec(ldns_dnssec_name *from, - ldns_dnssec_name *to, - ldns_rr_type nsec_type) -{ - ldns_rr *nsec_rr; - ldns_rr_type types[65536]; - size_t type_count = 0; - ldns_dnssec_rrsets *cur_rrsets; - - if (!from || !to || (nsec_type != LDNS_RR_TYPE_NSEC && - nsec_type != LDNS_RR_TYPE_NSEC3)) { - return NULL; - } - - nsec_rr = ldns_rr_new(); - ldns_rr_set_type(nsec_rr, nsec_type); - ldns_rr_set_owner(nsec_rr, ldns_rdf_clone(ldns_dnssec_name_name(from))); - ldns_rr_push_rdf(nsec_rr, ldns_rdf_clone(ldns_dnssec_name_name(to))); - - cur_rrsets = from->rrsets; - while (cur_rrsets) { - if (is_glue(cur_rrsets, from->rrsets)) { - cur_rrsets = cur_rrsets->next; - continue; - } - if (cur_rrsets->type != LDNS_RR_TYPE_RRSIG && - cur_rrsets->type != LDNS_RR_TYPE_NSEC) { - types[type_count] = cur_rrsets->type; - type_count++; - } - cur_rrsets = cur_rrsets->next; - - } - types[type_count] = LDNS_RR_TYPE_RRSIG; - type_count++; - types[type_count] = LDNS_RR_TYPE_NSEC; - type_count++; - - ldns_rr_push_rdf(nsec_rr, ldns_dnssec_create_nsec_bitmap(types, - type_count, - nsec_type)); - - return nsec_rr; -} - -ldns_rr * -ldns_dnssec_create_nsec3(ldns_dnssec_name *from, - ldns_dnssec_name *to, - ldns_rdf *zone_name, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt) -{ - ldns_rr *nsec_rr; - ldns_rr_type types[65536]; - size_t type_count = 0; - ldns_dnssec_rrsets *cur_rrsets; - ldns_status status; - - flags = flags; - - if (!from) { - return NULL; - } - - nsec_rr = ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3); - ldns_rr_set_owner(nsec_rr, - ldns_nsec3_hash_name(ldns_dnssec_name_name(from), - algorithm, - iterations, - salt_length, - salt)); - status = ldns_dname_cat(ldns_rr_owner(nsec_rr), zone_name); - if(status != LDNS_STATUS_OK) { - ldns_rr_free(nsec_rr); - return NULL; - } - ldns_nsec3_add_param_rdfs(nsec_rr, - algorithm, - flags, - iterations, - salt_length, - salt); - - cur_rrsets = from->rrsets; - while (cur_rrsets) { - if (is_glue(cur_rrsets, from->rrsets)) { - cur_rrsets = cur_rrsets->next; - continue; - } - if (cur_rrsets->type != LDNS_RR_TYPE_RRSIG) { - types[type_count] = cur_rrsets->type; - type_count++; - } - cur_rrsets = cur_rrsets->next; - } - /* always add rrsig type if this is not an unsigned - * delegation - */ - if (type_count > 0 && - !(type_count == 1 && types[0] == LDNS_RR_TYPE_NS)) { - types[type_count] = LDNS_RR_TYPE_RRSIG; - type_count++; - } - - /* leave next rdata empty if they weren't precomputed yet */ - if (to && to->hashed_name) { - (void) ldns_rr_set_rdf(nsec_rr, - ldns_rdf_clone(to->hashed_name), - 4); - } else { - (void) ldns_rr_set_rdf(nsec_rr, NULL, 4); - } - - ldns_rr_push_rdf(nsec_rr, - ldns_dnssec_create_nsec_bitmap(types, - type_count, - LDNS_RR_TYPE_NSEC3)); - - return nsec_rr; -} - -ldns_rr * -ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs) -{ - /* we do not do any check here - garbage in, garbage out */ - - /* the the start and end names - get the type from the - * before rrlist */ - - /* inefficient, just give it a name, a next name, and a list of rrs */ - /* we make 1 big uberbitmap first, then windows */ - /* todo: make something more efficient :) */ - uint16_t i; - ldns_rr *i_rr; - uint16_t i_type; - - ldns_rr *nsec = NULL; - ldns_rr_type i_type_list[65536]; - size_t type_count = 0; - - nsec = ldns_rr_new(); - ldns_rr_set_type(nsec, LDNS_RR_TYPE_NSEC); - ldns_rr_set_owner(nsec, ldns_rdf_clone(cur_owner)); - ldns_rr_push_rdf(nsec, ldns_rdf_clone(next_owner)); - - for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - i_rr = ldns_rr_list_rr(rrs, i); - if (ldns_rdf_compare(cur_owner, - ldns_rr_owner(i_rr)) == 0) { - i_type = ldns_rr_get_type(i_rr); - if (i_type != LDNS_RR_TYPE_RRSIG && i_type != LDNS_RR_TYPE_NSEC) { - if (type_count == 0 || i_type_list[type_count-1] != i_type) { - i_type_list[type_count] = i_type; - type_count++; - } - } - } - } - - i_type_list[type_count] = LDNS_RR_TYPE_RRSIG; - type_count++; - i_type_list[type_count] = LDNS_RR_TYPE_NSEC; - type_count++; - - ldns_rr_push_rdf(nsec, - ldns_dnssec_create_nsec_bitmap(i_type_list, - type_count, LDNS_RR_TYPE_NSEC)); - - return nsec; -} - -ldns_rdf * -ldns_nsec3_hash_name(ldns_rdf *name, - uint8_t algorithm, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt) -{ - size_t hashed_owner_str_len; - ldns_rdf *cann; - ldns_rdf *hashed_owner; - unsigned char *hashed_owner_str; - char *hashed_owner_b32; - size_t hashed_owner_b32_len; - uint32_t cur_it; - /* define to contain the largest possible hash, which is - * sha1 at the moment */ - unsigned char hash[LDNS_SHA1_DIGEST_LENGTH]; - ldns_status status; - - /* TODO: mnemonic list for hash algs SHA-1, default to 1 now (sha1) */ - if (algorithm != LDNS_SHA1) { - return NULL; - } - - /* prepare the owner name according to the draft section bla */ - cann = ldns_rdf_clone(name); - if(!cann) { - fprintf(stderr, "Memory error\n"); - return NULL; - } - ldns_dname2canonical(cann); - - hashed_owner_str_len = salt_length + ldns_rdf_size(cann); - hashed_owner_str = LDNS_XMALLOC(unsigned char, hashed_owner_str_len); - if(!hashed_owner_str) { - ldns_rdf_deep_free(cann); - return NULL; - } - memcpy(hashed_owner_str, ldns_rdf_data(cann), ldns_rdf_size(cann)); - memcpy(hashed_owner_str + ldns_rdf_size(cann), salt, salt_length); - ldns_rdf_deep_free(cann); - - for (cur_it = iterations + 1; cur_it > 0; cur_it--) { - (void) ldns_sha1((unsigned char *) hashed_owner_str, - (unsigned int) hashed_owner_str_len, hash); - - LDNS_FREE(hashed_owner_str); - hashed_owner_str_len = salt_length + LDNS_SHA1_DIGEST_LENGTH; - hashed_owner_str = LDNS_XMALLOC(unsigned char, hashed_owner_str_len); - if (!hashed_owner_str) { - return NULL; - } - memcpy(hashed_owner_str, hash, LDNS_SHA1_DIGEST_LENGTH); - memcpy(hashed_owner_str + LDNS_SHA1_DIGEST_LENGTH, salt, salt_length); - hashed_owner_str_len = LDNS_SHA1_DIGEST_LENGTH + salt_length; - } - - LDNS_FREE(hashed_owner_str); - hashed_owner_str = hash; - hashed_owner_str_len = LDNS_SHA1_DIGEST_LENGTH; - - hashed_owner_b32 = LDNS_XMALLOC(char, - ldns_b32_ntop_calculate_size(hashed_owner_str_len) + 1); - if(!hashed_owner_b32) { - return NULL; - } - hashed_owner_b32_len = (size_t) ldns_b32_ntop_extended_hex( - (uint8_t *) hashed_owner_str, - hashed_owner_str_len, - hashed_owner_b32, - ldns_b32_ntop_calculate_size(hashed_owner_str_len)+1); - if (hashed_owner_b32_len < 1) { - fprintf(stderr, "Error in base32 extended hex encoding "); - fprintf(stderr, "of hashed owner name (name: "); - ldns_rdf_print(stderr, name); - fprintf(stderr, ", return code: %u)\n", - (unsigned int) hashed_owner_b32_len); - LDNS_FREE(hashed_owner_b32); - return NULL; - } - hashed_owner_b32[hashed_owner_b32_len] = '\0'; - - status = ldns_str2rdf_dname(&hashed_owner, hashed_owner_b32); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error creating rdf from %s\n", hashed_owner_b32); - LDNS_FREE(hashed_owner_b32); - return NULL; - } - - LDNS_FREE(hashed_owner_b32); - return hashed_owner; -} - -void -ldns_nsec3_add_param_rdfs(ldns_rr *rr, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt) -{ - ldns_rdf *salt_rdf = NULL; - uint8_t *salt_data = NULL; - ldns_rdf *old; - - old = ldns_rr_set_rdf(rr, - ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT8, - 1, (void*)&algorithm), - 0); - if (old) ldns_rdf_deep_free(old); - - old = ldns_rr_set_rdf(rr, - ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT8, - 1, (void*)&flags), - 1); - if (old) ldns_rdf_deep_free(old); - - old = ldns_rr_set_rdf(rr, - ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, - iterations), - 2); - if (old) ldns_rdf_deep_free(old); - - salt_data = LDNS_XMALLOC(uint8_t, salt_length + 1); - if(!salt_data) { - /* no way to return error */ - return; - } - salt_data[0] = salt_length; - memcpy(salt_data + 1, salt, salt_length); - salt_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC3_SALT, - salt_length + 1, - salt_data); - if(!salt_rdf) { - LDNS_FREE(salt_data); - /* no way to return error */ - return; - } - - old = ldns_rr_set_rdf(rr, salt_rdf, 3); - if (old) ldns_rdf_deep_free(old); - LDNS_FREE(salt_data); -} - -static int -rr_list_delegation_only(ldns_rdf *origin, ldns_rr_list *rr_list) -{ - size_t i; - ldns_rr *cur_rr; - if (!origin || !rr_list) return 0; - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - cur_rr = ldns_rr_list_rr(rr_list, i); - if (ldns_dname_compare(ldns_rr_owner(cur_rr), origin) == 0) { - return 0; - } - if (ldns_rr_get_type(cur_rr) != LDNS_RR_TYPE_NS) { - return 0; - } - } - return 1; -} - -/* this will NOT return the NSEC3 completed, you will have to run the - finalize function on the rrlist later! */ -ldns_rr * -ldns_create_nsec3(ldns_rdf *cur_owner, - ldns_rdf *cur_zone, - ldns_rr_list *rrs, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt, - bool emptynonterminal) -{ - size_t i; - ldns_rr *i_rr; - uint16_t i_type; - - ldns_rr *nsec = NULL; - ldns_rdf *hashed_owner = NULL; - - ldns_status status; - - ldns_rr_type i_type_list[1024]; - size_t type_count = 0; - - hashed_owner = ldns_nsec3_hash_name(cur_owner, - algorithm, - iterations, - salt_length, - salt); - status = ldns_dname_cat(hashed_owner, cur_zone); - if(status != LDNS_STATUS_OK) - return NULL; - - nsec = ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3); - if(!nsec) - return NULL; - ldns_rr_set_type(nsec, LDNS_RR_TYPE_NSEC3); - ldns_rr_set_owner(nsec, hashed_owner); - - ldns_nsec3_add_param_rdfs(nsec, - algorithm, - flags, - iterations, - salt_length, - salt); - (void) ldns_rr_set_rdf(nsec, NULL, 4); - - - for (i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - i_rr = ldns_rr_list_rr(rrs, i); - if (ldns_rdf_compare(cur_owner, - ldns_rr_owner(i_rr)) == 0) { - i_type = ldns_rr_get_type(i_rr); - if (type_count == 0 || i_type_list[type_count-1] != i_type) { - i_type_list[type_count] = i_type; - type_count++; - } - } - } - - /* add RRSIG anyway, but only if this is not an ENT or - * an unsigned delegation */ - if (!emptynonterminal && !rr_list_delegation_only(cur_zone, rrs)) { - i_type_list[type_count] = LDNS_RR_TYPE_RRSIG; - type_count++; - } - - /* and SOA if owner == zone */ - if (ldns_dname_compare(cur_zone, cur_owner) == 0) { - i_type_list[type_count] = LDNS_RR_TYPE_SOA; - type_count++; - } - - ldns_rr_push_rdf(nsec, - ldns_dnssec_create_nsec_bitmap(i_type_list, - type_count, LDNS_RR_TYPE_NSEC3)); - - return nsec; -} - -uint8_t -ldns_nsec3_algorithm(const ldns_rr *nsec3_rr) -{ - if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 && - ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 0)) > 0 - ) { - return ldns_rdf2native_int8(ldns_rr_rdf(nsec3_rr, 0)); - } - return 0; -} - -uint8_t -ldns_nsec3_flags(const ldns_rr *nsec3_rr) -{ - if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 && - ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 1)) > 0 - ) { - return ldns_rdf2native_int8(ldns_rr_rdf(nsec3_rr, 1)); - } - return 0; -} - -bool -ldns_nsec3_optout(const ldns_rr *nsec3_rr) -{ - return (ldns_nsec3_flags(nsec3_rr) & LDNS_NSEC3_VARS_OPTOUT_MASK); -} - -uint16_t -ldns_nsec3_iterations(const ldns_rr *nsec3_rr) -{ - if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3 && - ldns_rdf_size(ldns_rr_rdf(nsec3_rr, 2)) > 0 - ) { - return ldns_rdf2native_int16(ldns_rr_rdf(nsec3_rr, 2)); - } - return 0; - -} - -ldns_rdf * -ldns_nsec3_salt(const ldns_rr *nsec3_rr) -{ - if (nsec3_rr && ldns_rr_get_type(nsec3_rr) == LDNS_RR_TYPE_NSEC3) { - return ldns_rr_rdf(nsec3_rr, 3); - } - return NULL; -} - -uint8_t -ldns_nsec3_salt_length(const ldns_rr *nsec3_rr) -{ - ldns_rdf *salt_rdf = ldns_nsec3_salt(nsec3_rr); - if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) { - return (uint8_t) ldns_rdf_data(salt_rdf)[0]; - } - return 0; -} - -/* allocs data, free with LDNS_FREE() */ -uint8_t * -ldns_nsec3_salt_data(const ldns_rr *nsec3_rr) -{ - uint8_t salt_length; - uint8_t *salt; - - ldns_rdf *salt_rdf = ldns_nsec3_salt(nsec3_rr); - if (salt_rdf && ldns_rdf_size(salt_rdf) > 0) { - salt_length = ldns_rdf_data(salt_rdf)[0]; - salt = LDNS_XMALLOC(uint8_t, salt_length); - if(!salt) return NULL; - memcpy(salt, &ldns_rdf_data(salt_rdf)[1], salt_length); - return salt; - } - return NULL; -} - -ldns_rdf * -ldns_nsec3_next_owner(const ldns_rr *nsec3_rr) -{ - if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) { - return NULL; - } else { - return ldns_rr_rdf(nsec3_rr, 4); - } -} - -ldns_rdf * -ldns_nsec3_bitmap(const ldns_rr *nsec3_rr) -{ - if (!nsec3_rr || ldns_rr_get_type(nsec3_rr) != LDNS_RR_TYPE_NSEC3) { - return NULL; - } else { - return ldns_rr_rdf(nsec3_rr, 5); - } -} - -ldns_rdf * -ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name) -{ - uint8_t algorithm; - uint16_t iterations; - uint8_t salt_length; - uint8_t *salt = 0; - - ldns_rdf *hashed_owner; - - algorithm = ldns_nsec3_algorithm(nsec); - salt_length = ldns_nsec3_salt_length(nsec); - salt = ldns_nsec3_salt_data(nsec); - iterations = ldns_nsec3_iterations(nsec); - - hashed_owner = ldns_nsec3_hash_name(name, - algorithm, - iterations, - salt_length, - salt); - - LDNS_FREE(salt); - return hashed_owner; -} - -bool -ldns_nsec_bitmap_covers_type(const ldns_rdf *nsec_bitmap, ldns_rr_type type) -{ - uint8_t window_block_nr; - uint8_t bitmap_length; - uint16_t cur_type; - uint16_t pos = 0; - uint16_t bit_pos; - uint8_t *data = ldns_rdf_data(nsec_bitmap); - - while(pos < ldns_rdf_size(nsec_bitmap)) { - window_block_nr = data[pos]; - bitmap_length = data[pos + 1]; - pos += 2; - - for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { - if (ldns_get_bit(&data[pos], bit_pos)) { - cur_type = 256 * (uint16_t) window_block_nr + bit_pos; - if (cur_type == type) { - return true; - } - } - } - - pos += (uint16_t) bitmap_length; - } - return false; -} - -bool -ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name) -{ - ldns_rdf *nsec_owner = ldns_rr_owner(nsec); - ldns_rdf *hash_next; - char *next_hash_str; - ldns_rdf *nsec_next = NULL; - ldns_status status; - ldns_rdf *chopped_dname; - bool result; - - if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC) { - nsec_next = ldns_rdf_clone(ldns_rr_rdf(nsec, 0)); - } else if (ldns_rr_get_type(nsec) == LDNS_RR_TYPE_NSEC3) { - hash_next = ldns_nsec3_next_owner(nsec); - next_hash_str = ldns_rdf2str(hash_next); - nsec_next = ldns_dname_new_frm_str(next_hash_str); - LDNS_FREE(next_hash_str); - chopped_dname = ldns_dname_left_chop(nsec_owner); - status = ldns_dname_cat(nsec_next, chopped_dname); - ldns_rdf_deep_free(chopped_dname); - if (status != LDNS_STATUS_OK) { - printf("error catting: %s\n", ldns_get_errorstr_by_id(status)); - } - } else { - ldns_rdf_deep_free(nsec_next); - return false; - } - - /* in the case of the last nsec */ - if(ldns_dname_compare(nsec_owner, nsec_next) > 0) { - result = (ldns_dname_compare(nsec_owner, name) <= 0 || - ldns_dname_compare(name, nsec_next) < 0); - } else { - result = (ldns_dname_compare(nsec_owner, name) <= 0 && - ldns_dname_compare(name, nsec_next) < 0); - } - - ldns_rdf_deep_free(nsec_next); - return result; -} - -#ifdef HAVE_SSL -/* sig may be null - if so look in the packet */ -ldns_status -ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, - ldns_rr_list *k, ldns_rr_list *s, ldns_rr_list *good_keys) -{ - ldns_rr_list *rrset; - ldns_rr_list *sigs; - ldns_rr_list *sigs_covered; - ldns_rdf *rdf_t; - ldns_rr_type t_netorder; - - if (!k) { - return LDNS_STATUS_ERR; - /* return LDNS_STATUS_CRYPTO_NO_DNSKEY; */ - } - - if (t == LDNS_RR_TYPE_RRSIG) { - /* we don't have RRSIG(RRSIG) (yet? ;-) ) */ - return LDNS_STATUS_ERR; - } - - if (s) { - /* if s is not NULL, the sigs are given to use */ - sigs = s; - } else { - /* otherwise get them from the packet */ - sigs = ldns_pkt_rr_list_by_name_and_type(p, o, LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_ANY_NOQUESTION); - if (!sigs) { - /* no sigs */ - return LDNS_STATUS_ERR; - /* return LDNS_STATUS_CRYPTO_NO_RRSIG; */ - } - } - - /* rrsig are subtyped, so now we need to find the correct - * sigs for the type t - */ - t_netorder = htons(t); /* rdf are in network order! */ - /* a type identifier is a 16-bit number, so the size is 2 bytes */ - rdf_t = ldns_rdf_new(LDNS_RDF_TYPE_TYPE, - 2, - &t_netorder); - sigs_covered = ldns_rr_list_subtype_by_rdf(sigs, rdf_t, 0); - - rrset = ldns_pkt_rr_list_by_name_and_type(p, - o, - t, - LDNS_SECTION_ANY_NOQUESTION); - - if (!rrset) { - return LDNS_STATUS_ERR; - } - - if (!sigs_covered) { - return LDNS_STATUS_ERR; - } - - return ldns_verify(rrset, sigs, k, good_keys); -} -#endif /* HAVE_SSL */ - -ldns_status -ldns_dnssec_chain_nsec3_list(ldns_rr_list *nsec3_rrs) -{ - size_t i; - char *next_nsec_owner_str; - ldns_rdf *next_nsec_owner_label; - ldns_rdf *next_nsec_rdf; - ldns_status status = LDNS_STATUS_OK; - - for (i = 0; i < ldns_rr_list_rr_count(nsec3_rrs); i++) { - if (i == ldns_rr_list_rr_count(nsec3_rrs) - 1) { - next_nsec_owner_label = - ldns_dname_label(ldns_rr_owner(ldns_rr_list_rr(nsec3_rrs, - 0)), 0); - next_nsec_owner_str = ldns_rdf2str(next_nsec_owner_label); - if (next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] - == '.') { - next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] - = '\0'; - } - status = ldns_str2rdf_b32_ext(&next_nsec_rdf, - next_nsec_owner_str); - if (!ldns_rr_set_rdf(ldns_rr_list_rr(nsec3_rrs, i), - next_nsec_rdf, 4)) { - /* todo: error */ - } - - ldns_rdf_deep_free(next_nsec_owner_label); - LDNS_FREE(next_nsec_owner_str); - } else { - next_nsec_owner_label = - ldns_dname_label(ldns_rr_owner(ldns_rr_list_rr(nsec3_rrs, - i + 1)), - 0); - next_nsec_owner_str = ldns_rdf2str(next_nsec_owner_label); - if (next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] - == '.') { - next_nsec_owner_str[strlen(next_nsec_owner_str) - 1] - = '\0'; - } - status = ldns_str2rdf_b32_ext(&next_nsec_rdf, - next_nsec_owner_str); - ldns_rdf_deep_free(next_nsec_owner_label); - LDNS_FREE(next_nsec_owner_str); - if (!ldns_rr_set_rdf(ldns_rr_list_rr(nsec3_rrs, i), - next_nsec_rdf, 4)) { - /* todo: error */ - } - } - } - return status; -} - -int -qsort_rr_compare_nsec3(const void *a, const void *b) -{ - const ldns_rr *rr1 = * (const ldns_rr **) a; - const ldns_rr *rr2 = * (const ldns_rr **) b; - if (rr1 == NULL && rr2 == NULL) { - return 0; - } - if (rr1 == NULL) { - return -1; - } - if (rr2 == NULL) { - return 1; - } - return ldns_rdf_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)); -} - -void -ldns_rr_list_sort_nsec3(ldns_rr_list *unsorted) -{ - qsort(unsorted->_rrs, - ldns_rr_list_rr_count(unsorted), - sizeof(ldns_rr *), - qsort_rr_compare_nsec3); -} - -int -ldns_dnssec_default_add_to_signatures(ldns_rr *sig, void *n) -{ - sig = sig; - n = n; - return LDNS_SIGNATURE_LEAVE_ADD_NEW; -} - -int -ldns_dnssec_default_leave_signatures(ldns_rr *sig, void *n) -{ - sig = sig; - n = n; - return LDNS_SIGNATURE_LEAVE_NO_ADD; -} - -int -ldns_dnssec_default_delete_signatures(ldns_rr *sig, void *n) -{ - sig = sig; - n = n; - return LDNS_SIGNATURE_REMOVE_NO_ADD; -} - -int -ldns_dnssec_default_replace_signatures(ldns_rr *sig, void *n) -{ - sig = sig; - n = n; - return LDNS_SIGNATURE_REMOVE_ADD_NEW; -} - -#ifdef HAVE_SSL -ldns_rdf * -ldns_convert_dsa_rrsig_asn12rdf(const ldns_buffer *sig, - const long sig_len) -{ - ldns_rdf *sigdata_rdf; - DSA_SIG *dsasig; - unsigned char *dsasig_data = (unsigned char*)ldns_buffer_begin(sig); - size_t byte_offset; - - dsasig = d2i_DSA_SIG(NULL, - (const unsigned char **)&dsasig_data, - sig_len); - if (!dsasig) { - DSA_SIG_free(dsasig); - return NULL; - } - - dsasig_data = LDNS_XMALLOC(unsigned char, 41); - if(!dsasig_data) { - DSA_SIG_free(dsasig); - return NULL; - } - dsasig_data[0] = 0; - byte_offset = (size_t) (20 - BN_num_bytes(dsasig->r)); - if (byte_offset > 20) { - DSA_SIG_free(dsasig); - LDNS_FREE(dsasig_data); - return NULL; - } - memset(&dsasig_data[1], 0, byte_offset); - BN_bn2bin(dsasig->r, &dsasig_data[1 + byte_offset]); - byte_offset = (size_t) (20 - BN_num_bytes(dsasig->s)); - if (byte_offset > 20) { - DSA_SIG_free(dsasig); - LDNS_FREE(dsasig_data); - return NULL; - } - memset(&dsasig_data[21], 0, byte_offset); - BN_bn2bin(dsasig->s, &dsasig_data[21 + byte_offset]); - - sigdata_rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, 41, dsasig_data); - if(!sigdata_rdf) { - LDNS_FREE(dsasig_data); - } - DSA_SIG_free(dsasig); - - return sigdata_rdf; -} - -ldns_status -ldns_convert_dsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, - const ldns_rdf *sig_rdf) -{ - /* the EVP api wants the DER encoding of the signature... */ - BIGNUM *R, *S; - DSA_SIG *dsasig; - unsigned char *raw_sig = NULL; - int raw_sig_len; - - if(ldns_rdf_size(sig_rdf) < 1 + 2*SHA_DIGEST_LENGTH) - return LDNS_STATUS_SYNTAX_RDATA_ERR; - /* extract the R and S field from the sig buffer */ - R = BN_new(); - if(!R) return LDNS_STATUS_MEM_ERR; - (void) BN_bin2bn((unsigned char *) ldns_rdf_data(sig_rdf) + 1, - SHA_DIGEST_LENGTH, R); - S = BN_new(); - if(!S) { - BN_free(R); - return LDNS_STATUS_MEM_ERR; - } - (void) BN_bin2bn((unsigned char *) ldns_rdf_data(sig_rdf) + 21, - SHA_DIGEST_LENGTH, S); - - dsasig = DSA_SIG_new(); - if (!dsasig) { - BN_free(R); - BN_free(S); - return LDNS_STATUS_MEM_ERR; - } - - dsasig->r = R; - dsasig->s = S; - - raw_sig_len = i2d_DSA_SIG(dsasig, &raw_sig); - if (raw_sig_len < 0) { - DSA_SIG_free(dsasig); - free(raw_sig); - return LDNS_STATUS_SSL_ERR; - } - if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) { - ldns_buffer_write(target_buffer, raw_sig, (size_t)raw_sig_len); - } - - DSA_SIG_free(dsasig); - free(raw_sig); - - return ldns_buffer_status(target_buffer); -} - -#ifdef USE_ECDSA -#ifndef S_SPLINT_S -ldns_rdf * -ldns_convert_ecdsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len) -{ - ECDSA_SIG* ecdsa_sig; - unsigned char *data = (unsigned char*)ldns_buffer_begin(sig); - ldns_rdf* rdf; - ecdsa_sig = d2i_ECDSA_SIG(NULL, (const unsigned char **)&data, sig_len); - if(!ecdsa_sig) return NULL; - - /* "r | s". */ - data = LDNS_XMALLOC(unsigned char, - BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s)); - if(!data) { - ECDSA_SIG_free(ecdsa_sig); - return NULL; - } - BN_bn2bin(ecdsa_sig->r, data); - BN_bn2bin(ecdsa_sig->s, data+BN_num_bytes(ecdsa_sig->r)); - rdf = ldns_rdf_new(LDNS_RDF_TYPE_B64, (size_t)( - BN_num_bytes(ecdsa_sig->r) + BN_num_bytes(ecdsa_sig->s)), data); - ECDSA_SIG_free(ecdsa_sig); - return rdf; -} - -ldns_status -ldns_convert_ecdsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, - const ldns_rdf *sig_rdf) -{ - ECDSA_SIG* sig; - int raw_sig_len; - long bnsize = (long)ldns_rdf_size(sig_rdf) / 2; - /* if too short, or not even length, do not bother */ - if(bnsize < 16 || (size_t)bnsize*2 != ldns_rdf_size(sig_rdf)) - return LDNS_STATUS_ERR; - - /* use the raw data to parse two evenly long BIGNUMs, "r | s". */ - sig = ECDSA_SIG_new(); - if(!sig) return LDNS_STATUS_MEM_ERR; - sig->r = BN_bin2bn((const unsigned char*)ldns_rdf_data(sig_rdf), - bnsize, sig->r); - sig->s = BN_bin2bn((const unsigned char*)ldns_rdf_data(sig_rdf)+bnsize, - bnsize, sig->s); - if(!sig->r || !sig->s) { - ECDSA_SIG_free(sig); - return LDNS_STATUS_MEM_ERR; - } - - raw_sig_len = i2d_ECDSA_SIG(sig, NULL); - if (ldns_buffer_reserve(target_buffer, (size_t) raw_sig_len)) { - unsigned char* pp = (unsigned char*) - ldns_buffer_current(target_buffer); - raw_sig_len = i2d_ECDSA_SIG(sig, &pp); - ldns_buffer_skip(target_buffer, (ssize_t) raw_sig_len); - } - ECDSA_SIG_free(sig); - - return ldns_buffer_status(target_buffer); -} - -#endif /* S_SPLINT_S */ -#endif /* USE_ECDSA */ -#endif /* HAVE_SSL */ diff --git a/libs/ldns/dnssec_sign.c b/libs/ldns/dnssec_sign.c deleted file mode 100644 index b21094465f..0000000000 --- a/libs/ldns/dnssec_sign.c +++ /dev/null @@ -1,1269 +0,0 @@ -#include - -#include - -#include -#include - -#include -#include - -#ifdef HAVE_SSL -/* this entire file is rather useless when you don't have - * crypto... - */ -#include -#include -#include -#include -#include -#endif /* HAVE_SSL */ - -ldns_rr * -ldns_create_empty_rrsig(ldns_rr_list *rrset, - ldns_key *current_key) -{ - uint32_t orig_ttl; - ldns_rr_class orig_class; - time_t now; - ldns_rr *current_sig; - uint8_t label_count; - - label_count = ldns_dname_label_count(ldns_rr_owner(ldns_rr_list_rr(rrset, - 0))); - /* RFC4035 2.2: not counting the leftmost label if it is a wildcard */ - if(ldns_dname_is_wildcard(ldns_rr_owner(ldns_rr_list_rr(rrset, 0)))) - label_count --; - - current_sig = ldns_rr_new_frm_type(LDNS_RR_TYPE_RRSIG); - - /* set the type on the new signature */ - orig_ttl = ldns_rr_ttl(ldns_rr_list_rr(rrset, 0)); - orig_class = ldns_rr_get_class(ldns_rr_list_rr(rrset, 0)); - - ldns_rr_set_ttl(current_sig, orig_ttl); - ldns_rr_set_class(current_sig, orig_class); - ldns_rr_set_owner(current_sig, - ldns_rdf_clone( - ldns_rr_owner( - ldns_rr_list_rr(rrset, - 0)))); - - /* fill in what we know of the signature */ - - /* set the orig_ttl */ - (void)ldns_rr_rrsig_set_origttl( - current_sig, - ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, - orig_ttl)); - /* the signers name */ - (void)ldns_rr_rrsig_set_signame( - current_sig, - ldns_rdf_clone(ldns_key_pubkey_owner(current_key))); - /* label count - get it from the first rr in the rr_list */ - (void)ldns_rr_rrsig_set_labels( - current_sig, - ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, - label_count)); - /* inception, expiration */ - now = time(NULL); - if (ldns_key_inception(current_key) != 0) { - (void)ldns_rr_rrsig_set_inception( - current_sig, - ldns_native2rdf_int32( - LDNS_RDF_TYPE_TIME, - ldns_key_inception(current_key))); - } else { - (void)ldns_rr_rrsig_set_inception( - current_sig, - ldns_native2rdf_int32(LDNS_RDF_TYPE_TIME, now)); - } - if (ldns_key_expiration(current_key) != 0) { - (void)ldns_rr_rrsig_set_expiration( - current_sig, - ldns_native2rdf_int32( - LDNS_RDF_TYPE_TIME, - ldns_key_expiration(current_key))); - } else { - (void)ldns_rr_rrsig_set_expiration( - current_sig, - ldns_native2rdf_int32( - LDNS_RDF_TYPE_TIME, - now + LDNS_DEFAULT_EXP_TIME)); - } - - (void)ldns_rr_rrsig_set_keytag( - current_sig, - ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, - ldns_key_keytag(current_key))); - - (void)ldns_rr_rrsig_set_algorithm( - current_sig, - ldns_native2rdf_int8( - LDNS_RDF_TYPE_ALG, - ldns_key_algorithm(current_key))); - - (void)ldns_rr_rrsig_set_typecovered( - current_sig, - ldns_native2rdf_int16( - LDNS_RDF_TYPE_TYPE, - ldns_rr_get_type(ldns_rr_list_rr(rrset, - 0)))); - return current_sig; -} - -#ifdef HAVE_SSL -ldns_rdf * -ldns_sign_public_buffer(ldns_buffer *sign_buf, ldns_key *current_key) -{ - ldns_rdf *b64rdf = NULL; - - switch(ldns_key_algorithm(current_key)) { - case LDNS_SIGN_DSA: - case LDNS_SIGN_DSA_NSEC3: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_dss1()); - break; - case LDNS_SIGN_RSASHA1: - case LDNS_SIGN_RSASHA1_NSEC3: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_sha1()); - break; -#ifdef USE_SHA2 - case LDNS_SIGN_RSASHA256: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_sha256()); - break; - case LDNS_SIGN_RSASHA512: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_sha512()); - break; -#endif /* USE_SHA2 */ -#ifdef USE_GOST - case LDNS_SIGN_ECC_GOST: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_get_digestbyname("md_gost94")); - break; -#endif /* USE_GOST */ -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_sha256()); - break; - case LDNS_SIGN_ECDSAP384SHA384: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_sha384()); - break; -#endif - case LDNS_SIGN_RSAMD5: - b64rdf = ldns_sign_public_evp( - sign_buf, - ldns_key_evp_key(current_key), - EVP_md5()); - break; - default: - /* do _you_ know this alg? */ - printf("unknown algorithm, "); - printf("is the one used available on this system?\n"); - break; - } - - return b64rdf; -} - -/** - * use this function to sign with a public/private key alg - * return the created signatures - */ -ldns_rr_list * -ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys) -{ - ldns_rr_list *signatures; - ldns_rr_list *rrset_clone; - ldns_rr *current_sig; - ldns_rdf *b64rdf; - ldns_key *current_key; - size_t key_count; - uint16_t i; - ldns_buffer *sign_buf; - ldns_rdf *new_owner; - - if (!rrset || ldns_rr_list_rr_count(rrset) < 1 || !keys) { - return NULL; - } - - new_owner = NULL; - - signatures = ldns_rr_list_new(); - - /* prepare a signature and add all the know data - * prepare the rrset. Sign this together. */ - rrset_clone = ldns_rr_list_clone(rrset); - if (!rrset_clone) { - return NULL; - } - - /* make it canonical */ - for(i = 0; i < ldns_rr_list_rr_count(rrset_clone); i++) { - ldns_rr_set_ttl(ldns_rr_list_rr(rrset_clone, i), - ldns_rr_ttl(ldns_rr_list_rr(rrset, 0))); - ldns_rr2canonical(ldns_rr_list_rr(rrset_clone, i)); - } - /* sort */ - ldns_rr_list_sort(rrset_clone); - - for (key_count = 0; - key_count < ldns_key_list_key_count(keys); - key_count++) { - if (!ldns_key_use(ldns_key_list_key(keys, key_count))) { - continue; - } - sign_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if (!sign_buf) { - ldns_rr_list_free(rrset_clone); - ldns_rr_list_free(signatures); - ldns_rdf_free(new_owner); - return NULL; - } - b64rdf = NULL; - - current_key = ldns_key_list_key(keys, key_count); - /* sign all RRs with keys that have ZSKbit, !SEPbit. - sign DNSKEY RRs with keys that have ZSKbit&SEPbit */ - if (ldns_key_flags(current_key) & LDNS_KEY_ZONE_KEY) { - current_sig = ldns_create_empty_rrsig(rrset_clone, - current_key); - - /* right now, we have: a key, a semi-sig and an rrset. For - * which we can create the sig and base64 encode that and - * add that to the signature */ - - if (ldns_rrsig2buffer_wire(sign_buf, current_sig) - != LDNS_STATUS_OK) { - ldns_buffer_free(sign_buf); - /* ERROR */ - ldns_rr_list_deep_free(rrset_clone); - return NULL; - } - - /* add the rrset in sign_buf */ - if (ldns_rr_list2buffer_wire(sign_buf, rrset_clone) - != LDNS_STATUS_OK) { - ldns_buffer_free(sign_buf); - ldns_rr_list_deep_free(rrset_clone); - return NULL; - } - - b64rdf = ldns_sign_public_buffer(sign_buf, current_key); - - if (!b64rdf) { - /* signing went wrong */ - ldns_rr_list_deep_free(rrset_clone); - return NULL; - } - - ldns_rr_rrsig_set_sig(current_sig, b64rdf); - - /* push the signature to the signatures list */ - ldns_rr_list_push_rr(signatures, current_sig); - } - ldns_buffer_free(sign_buf); /* restart for the next key */ - } - ldns_rr_list_deep_free(rrset_clone); - - return signatures; -} - -/** - * Sign data with DSA - * - * \param[in] to_sign The ldns_buffer containing raw data that is - * to be signed - * \param[in] key The DSA key structure to sign with - * \return ldns_rdf for the RRSIG ldns_rr - */ -ldns_rdf * -ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key) -{ - unsigned char *sha1_hash; - ldns_rdf *sigdata_rdf; - ldns_buffer *b64sig; - - DSA_SIG *sig; - uint8_t *data; - size_t pad; - - b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if (!b64sig) { - return NULL; - } - - sha1_hash = SHA1((unsigned char*)ldns_buffer_begin(to_sign), - ldns_buffer_position(to_sign), NULL); - if (!sha1_hash) { - ldns_buffer_free(b64sig); - return NULL; - } - - sig = DSA_do_sign(sha1_hash, SHA_DIGEST_LENGTH, key); - if(!sig) { - ldns_buffer_free(b64sig); - return NULL; - } - - data = LDNS_XMALLOC(uint8_t, 1 + 2 * SHA_DIGEST_LENGTH); - if(!data) { - ldns_buffer_free(b64sig); - DSA_SIG_free(sig); - return NULL; - } - - data[0] = 1; - pad = 20 - (size_t) BN_num_bytes(sig->r); - if (pad > 0) { - memset(data + 1, 0, pad); - } - BN_bn2bin(sig->r, (unsigned char *) (data + 1) + pad); - - pad = 20 - (size_t) BN_num_bytes(sig->s); - if (pad > 0) { - memset(data + 1 + SHA_DIGEST_LENGTH, 0, pad); - } - BN_bn2bin(sig->s, (unsigned char *) (data + 1 + SHA_DIGEST_LENGTH + pad)); - - sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, - 1 + 2 * SHA_DIGEST_LENGTH, - data); - - ldns_buffer_free(b64sig); - LDNS_FREE(data); - DSA_SIG_free(sig); - - return sigdata_rdf; -} - -#ifdef USE_ECDSA -#ifndef S_SPLINT_S -static int -ldns_pkey_is_ecdsa(EVP_PKEY* pkey) -{ - EC_KEY* ec; - const EC_GROUP* g; - if(EVP_PKEY_type(pkey->type) != EVP_PKEY_EC) - return 0; - ec = EVP_PKEY_get1_EC_KEY(pkey); - g = EC_KEY_get0_group(ec); - if(!g) { - EC_KEY_free(ec); - return 0; - } - if(EC_GROUP_get_curve_name(g) == NID_secp224r1 || - EC_GROUP_get_curve_name(g) == NID_X9_62_prime256v1 || - EC_GROUP_get_curve_name(g) == NID_secp384r1) { - EC_KEY_free(ec); - return 1; - } - /* downref the eckey, the original is still inside the pkey */ - EC_KEY_free(ec); - return 0; -} -#endif /* splint */ -#endif /* USE_ECDSA */ - -ldns_rdf * -ldns_sign_public_evp(ldns_buffer *to_sign, - EVP_PKEY *key, - const EVP_MD *digest_type) -{ - unsigned int siglen; - ldns_rdf *sigdata_rdf; - ldns_buffer *b64sig; - EVP_MD_CTX ctx; - const EVP_MD *md_type; - int r; - - siglen = 0; - b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if (!b64sig) { - return NULL; - } - - /* initializes a signing context */ - md_type = digest_type; - if(!md_type) { - /* unknown message difest */ - ldns_buffer_free(b64sig); - return NULL; - } - - EVP_MD_CTX_init(&ctx); - r = EVP_SignInit(&ctx, md_type); - if(r == 1) { - r = EVP_SignUpdate(&ctx, (unsigned char*) - ldns_buffer_begin(to_sign), - ldns_buffer_position(to_sign)); - } else { - ldns_buffer_free(b64sig); - return NULL; - } - if(r == 1) { - r = EVP_SignFinal(&ctx, (unsigned char*) - ldns_buffer_begin(b64sig), &siglen, key); - } else { - ldns_buffer_free(b64sig); - return NULL; - } - if(r != 1) { - ldns_buffer_free(b64sig); - return NULL; - } - - /* unfortunately, OpenSSL output is differenct from DNS DSA format */ -#ifndef S_SPLINT_S - if (EVP_PKEY_type(key->type) == EVP_PKEY_DSA) { - sigdata_rdf = ldns_convert_dsa_rrsig_asn12rdf(b64sig, siglen); -#ifdef USE_ECDSA - } else if(EVP_PKEY_type(key->type) == EVP_PKEY_EC && - ldns_pkey_is_ecdsa(key)) { - sigdata_rdf = ldns_convert_ecdsa_rrsig_asn12rdf(b64sig, siglen); -#endif - } else { - /* ok output for other types is the same */ - sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen, - ldns_buffer_begin(b64sig)); - } -#endif /* splint */ - ldns_buffer_free(b64sig); - EVP_MD_CTX_cleanup(&ctx); - return sigdata_rdf; -} - -ldns_rdf * -ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key) -{ - unsigned char *sha1_hash; - unsigned int siglen; - ldns_rdf *sigdata_rdf; - ldns_buffer *b64sig; - int result; - - siglen = 0; - b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if (!b64sig) { - return NULL; - } - - sha1_hash = SHA1((unsigned char*)ldns_buffer_begin(to_sign), - ldns_buffer_position(to_sign), NULL); - if (!sha1_hash) { - ldns_buffer_free(b64sig); - return NULL; - } - - result = RSA_sign(NID_sha1, sha1_hash, SHA_DIGEST_LENGTH, - (unsigned char*)ldns_buffer_begin(b64sig), - &siglen, key); - if (result != 1) { - return NULL; - } - - if (result != 1) { - return NULL; - } - - sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen, - ldns_buffer_begin(b64sig)); - ldns_buffer_free(b64sig); /* can't free this buffer ?? */ - return sigdata_rdf; -} - -ldns_rdf * -ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key) -{ - unsigned char *md5_hash; - unsigned int siglen; - ldns_rdf *sigdata_rdf; - ldns_buffer *b64sig; - - b64sig = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if (!b64sig) { - return NULL; - } - - md5_hash = MD5((unsigned char*)ldns_buffer_begin(to_sign), - ldns_buffer_position(to_sign), NULL); - if (!md5_hash) { - ldns_buffer_free(b64sig); - return NULL; - } - - RSA_sign(NID_md5, md5_hash, MD5_DIGEST_LENGTH, - (unsigned char*)ldns_buffer_begin(b64sig), - &siglen, key); - - sigdata_rdf = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, siglen, - ldns_buffer_begin(b64sig)); - ldns_buffer_free(b64sig); - return sigdata_rdf; -} -#endif /* HAVE_SSL */ - -static int -ldns_dnssec_name_has_only_a(ldns_dnssec_name *cur_name) -{ - ldns_dnssec_rrsets *cur_rrset; - cur_rrset = cur_name->rrsets; - while (cur_rrset) { - if (cur_rrset->type != LDNS_RR_TYPE_A && - cur_rrset->type != LDNS_RR_TYPE_AAAA) { - return 0; - } else { - cur_rrset = cur_rrset->next; - } - } - return 1; -} - -ldns_status -ldns_dnssec_zone_mark_glue(ldns_dnssec_zone *zone) -{ - ldns_rbnode_t *cur_node; - ldns_dnssec_name *cur_name; - ldns_rdf *cur_owner, *cur_parent; - - cur_node = ldns_rbtree_first(zone->names); - while (cur_node != LDNS_RBTREE_NULL) { - cur_name = (ldns_dnssec_name *) cur_node->data; - cur_node = ldns_rbtree_next(cur_node); - if (ldns_dnssec_name_has_only_a(cur_name)) { - /* assume glue XXX check for zone cur */ - cur_owner = ldns_rdf_clone(ldns_rr_owner( - cur_name->rrsets->rrs->rr)); - while (ldns_dname_label_count(cur_owner) > - ldns_dname_label_count(zone->soa->name)) { - if (ldns_dnssec_zone_find_rrset(zone, - cur_owner, - LDNS_RR_TYPE_NS)) { - /* - fprintf(stderr, "[XX] Marking as glue: "); - ldns_rdf_print(stderr, cur_name->name); - fprintf(stderr, "\n"); - */ - cur_name->is_glue = true; - } - cur_parent = ldns_dname_left_chop(cur_owner); - ldns_rdf_deep_free(cur_owner); - cur_owner = cur_parent; - } - ldns_rdf_deep_free(cur_owner); - } - } - return LDNS_STATUS_OK; -} - -ldns_rbnode_t * -ldns_dnssec_name_node_next_nonglue(ldns_rbnode_t *node) -{ - ldns_rbnode_t *next_node = NULL; - ldns_dnssec_name *next_name = NULL; - bool done = false; - - if (node == LDNS_RBTREE_NULL) { - return NULL; - } - next_node = node; - while (!done) { - if (next_node == LDNS_RBTREE_NULL) { - return NULL; - } else { - next_name = (ldns_dnssec_name *)next_node->data; - if (!next_name->is_glue) { - done = true; - } else { - next_node = ldns_rbtree_next(next_node); - } - } - } - return next_node; -} - -ldns_status -ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs) -{ - - ldns_rbnode_t *first_node, *cur_node, *next_node; - ldns_dnssec_name *cur_name, *next_name; - ldns_rr *nsec_rr; - uint32_t nsec_ttl; - ldns_dnssec_rrsets *soa; - - /* the TTL of NSEC rrs should be set to the minimum TTL of - * the zone SOA (RFC4035 Section 2.3) - */ - soa = ldns_dnssec_name_find_rrset(zone->soa, LDNS_RR_TYPE_SOA); - - /* did the caller actually set it? if not, - * fall back to default ttl - */ - if (soa && soa->rrs && soa->rrs->rr) { - nsec_ttl = ldns_rdf2native_int32(ldns_rr_rdf( - soa->rrs->rr, 6)); - } else { - nsec_ttl = LDNS_DEFAULT_TTL; - } - - first_node = ldns_dnssec_name_node_next_nonglue( - ldns_rbtree_first(zone->names)); - cur_node = first_node; - if (cur_node) { - next_node = ldns_dnssec_name_node_next_nonglue( - ldns_rbtree_next(cur_node)); - } else { - next_node = NULL; - } - - while (cur_node && next_node) { - cur_name = (ldns_dnssec_name *)cur_node->data; - next_name = (ldns_dnssec_name *)next_node->data; - nsec_rr = ldns_dnssec_create_nsec(cur_name, - next_name, - LDNS_RR_TYPE_NSEC); - ldns_rr_set_ttl(nsec_rr, nsec_ttl); - if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){ - ldns_rr_free(nsec_rr); - return LDNS_STATUS_ERR; - } - ldns_rr_list_push_rr(new_rrs, nsec_rr); - cur_node = next_node; - if (cur_node) { - next_node = ldns_dnssec_name_node_next_nonglue( - ldns_rbtree_next(cur_node)); - } - } - - if (cur_node && !next_node) { - cur_name = (ldns_dnssec_name *)cur_node->data; - next_name = (ldns_dnssec_name *)first_node->data; - nsec_rr = ldns_dnssec_create_nsec(cur_name, - next_name, - LDNS_RR_TYPE_NSEC); - ldns_rr_set_ttl(nsec_rr, nsec_ttl); - if(ldns_dnssec_name_add_rr(cur_name, nsec_rr)!=LDNS_STATUS_OK){ - ldns_rr_free(nsec_rr); - return LDNS_STATUS_ERR; - } - ldns_rr_list_push_rr(new_rrs, nsec_rr); - } else { - printf("error\n"); - } - - return LDNS_STATUS_OK; -} - -#ifdef HAVE_SSL -ldns_status -ldns_dnssec_zone_create_nsec3s(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt) -{ - ldns_rbnode_t *first_name_node; - ldns_rbnode_t *current_name_node; - ldns_dnssec_name *current_name; - ldns_status result = LDNS_STATUS_OK; - ldns_rr *nsec_rr; - ldns_rr_list *nsec3_list; - uint32_t nsec_ttl; - ldns_dnssec_rrsets *soa; - - if (!zone || !new_rrs || !zone->names) { - return LDNS_STATUS_ERR; - } - - /* the TTL of NSEC rrs should be set to the minimum TTL of - * the zone SOA (RFC4035 Section 2.3) - */ - soa = ldns_dnssec_name_find_rrset(zone->soa, LDNS_RR_TYPE_SOA); - - /* did the caller actually set it? if not, - * fall back to default ttl - */ - if (soa && soa->rrs && soa->rrs->rr) { - nsec_ttl = ldns_rdf2native_int32(ldns_rr_rdf( - soa->rrs->rr, 6)); - } else { - nsec_ttl = LDNS_DEFAULT_TTL; - } - - nsec3_list = ldns_rr_list_new(); - - first_name_node = ldns_dnssec_name_node_next_nonglue( - ldns_rbtree_first(zone->names)); - - current_name_node = first_name_node; - - while (current_name_node && - current_name_node != LDNS_RBTREE_NULL) { - current_name = (ldns_dnssec_name *) current_name_node->data; - nsec_rr = ldns_dnssec_create_nsec3(current_name, - NULL, - zone->soa->name, - algorithm, - flags, - iterations, - salt_length, - salt); - /* by default, our nsec based generator adds rrsigs - * remove the bitmap for empty nonterminals */ - if (!current_name->rrsets) { - ldns_rdf_deep_free(ldns_rr_pop_rdf(nsec_rr)); - } - ldns_rr_set_ttl(nsec_rr, nsec_ttl); - result = ldns_dnssec_name_add_rr(current_name, nsec_rr); - ldns_rr_list_push_rr(new_rrs, nsec_rr); - ldns_rr_list_push_rr(nsec3_list, nsec_rr); - current_name_node = ldns_dnssec_name_node_next_nonglue( - ldns_rbtree_next(current_name_node)); - } - if (result != LDNS_STATUS_OK) { - return result; - } - - ldns_rr_list_sort_nsec3(nsec3_list); - result = ldns_dnssec_chain_nsec3_list(nsec3_list); - if (result != LDNS_STATUS_OK) { - return result; - } - - ldns_rr_list_free(nsec3_list); - return result; -} -#endif /* HAVE_SSL */ - -ldns_dnssec_rrs * -ldns_dnssec_remove_signatures(ldns_dnssec_rrs *signatures, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg) -{ - ldns_dnssec_rrs *base_rrs = signatures; - ldns_dnssec_rrs *cur_rr = base_rrs; - ldns_dnssec_rrs *prev_rr = NULL; - ldns_dnssec_rrs *next_rr; - - uint16_t keytag; - size_t i; - - key_list = key_list; - - if (!cur_rr) { - switch(func(NULL, arg)) { - case LDNS_SIGNATURE_LEAVE_ADD_NEW: - case LDNS_SIGNATURE_REMOVE_ADD_NEW: - break; - case LDNS_SIGNATURE_LEAVE_NO_ADD: - case LDNS_SIGNATURE_REMOVE_NO_ADD: - ldns_key_list_set_use(key_list, false); - break; - default: - fprintf(stderr, "[XX] unknown return value from callback\n"); - break; - } - return NULL; - } - (void)func(cur_rr->rr, arg); - - while (cur_rr) { - next_rr = cur_rr->next; - - switch (func(cur_rr->rr, arg)) { - case LDNS_SIGNATURE_LEAVE_ADD_NEW: - prev_rr = cur_rr; - break; - case LDNS_SIGNATURE_LEAVE_NO_ADD: - keytag = ldns_rdf2native_int16( - ldns_rr_rrsig_keytag(cur_rr->rr)); - for (i = 0; i < ldns_key_list_key_count(key_list); i++) { - if (ldns_key_keytag(ldns_key_list_key(key_list, i)) == - keytag) { - ldns_key_set_use(ldns_key_list_key(key_list, i), - false); - } - } - prev_rr = cur_rr; - break; - case LDNS_SIGNATURE_REMOVE_NO_ADD: - keytag = ldns_rdf2native_int16( - ldns_rr_rrsig_keytag(cur_rr->rr)); - for (i = 0; i < ldns_key_list_key_count(key_list); i++) { - if (ldns_key_keytag(ldns_key_list_key(key_list, i)) - == keytag) { - ldns_key_set_use(ldns_key_list_key(key_list, i), - false); - } - } - if (prev_rr) { - prev_rr->next = next_rr; - } else { - base_rrs = next_rr; - } - LDNS_FREE(cur_rr); - break; - case LDNS_SIGNATURE_REMOVE_ADD_NEW: - if (prev_rr) { - prev_rr->next = next_rr; - } else { - base_rrs = next_rr; - } - LDNS_FREE(cur_rr); - break; - default: - fprintf(stderr, "[XX] unknown return value from callback\n"); - break; - } - cur_rr = next_rr; - } - - return base_rrs; -} - -#ifdef HAVE_SSL -ldns_status -ldns_dnssec_zone_create_rrsigs(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void*), - void *arg) -{ - return ldns_dnssec_zone_create_rrsigs_flg(zone, new_rrs, key_list, - func, arg, 0); -} - -/** If there are KSKs use only them and mark ZSKs unused */ -static void -ldns_key_list_filter_for_dnskey(ldns_key_list *key_list) -{ - int saw_ksk = 0; - size_t i; - for(i=0; inames); - while (cur_node != LDNS_RBTREE_NULL) { - cur_name = (ldns_dnssec_name *) cur_node->data; - - if (!cur_name->is_glue) { - cur_rrset = cur_name->rrsets; - while (cur_rrset) { - /* reset keys to use */ - ldns_key_list_set_use(key_list, true); - - /* walk through old sigs, remove the old, - and mark which keys (not) to use) */ - cur_rrset->signatures = - ldns_dnssec_remove_signatures(cur_rrset->signatures, - key_list, - func, - arg); - if(!(flags&LDNS_SIGN_DNSKEY_WITH_ZSK) && - cur_rrset->type == LDNS_RR_TYPE_DNSKEY) - ldns_key_list_filter_for_dnskey(key_list); - - if(cur_rrset->type != LDNS_RR_TYPE_DNSKEY) - ldns_key_list_filter_for_non_dnskey(key_list); - - /* TODO: just set count to zero? */ - rr_list = ldns_rr_list_new(); - - cur_rr = cur_rrset->rrs; - while (cur_rr) { - ldns_rr_list_push_rr(rr_list, cur_rr->rr); - cur_rr = cur_rr->next; - } - - /* only sign non-delegation RRsets */ - /* (glue should have been marked earlier) */ - if ((ldns_rr_list_type(rr_list) != LDNS_RR_TYPE_NS || - ldns_dname_compare(ldns_rr_list_owner(rr_list), - zone->soa->name) == 0) && - /* OK, there is also the possibility that the record - * is glue, but at the same owner name as other records that - * are not NS nor A/AAAA. Bleh, our current data structure - * doesn't really support that... */ - !((ldns_rr_list_type(rr_list) == LDNS_RR_TYPE_A || - ldns_rr_list_type(rr_list) == LDNS_RR_TYPE_AAAA) && - !ldns_dname_compare(ldns_rr_list_owner(rr_list), zone->soa->name) == 0 && - ldns_dnssec_zone_find_rrset(zone, ldns_rr_list_owner(rr_list), LDNS_RR_TYPE_NS) - )) { - - siglist = ldns_sign_public(rr_list, key_list); - for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) { - if (cur_rrset->signatures) { - result = ldns_dnssec_rrs_add_rr(cur_rrset->signatures, - ldns_rr_list_rr(siglist, - i)); - } else { - cur_rrset->signatures = ldns_dnssec_rrs_new(); - cur_rrset->signatures->rr = - ldns_rr_list_rr(siglist, i); - ldns_rr_list_push_rr(new_rrs, - ldns_rr_list_rr(siglist, - i)); - } - } - ldns_rr_list_free(siglist); - } - - ldns_rr_list_free(rr_list); - - cur_rrset = cur_rrset->next; - } - - /* sign the nsec */ - ldns_key_list_set_use(key_list, true); - cur_name->nsec_signatures = - ldns_dnssec_remove_signatures(cur_name->nsec_signatures, - key_list, - func, - arg); - ldns_key_list_filter_for_non_dnskey(key_list); - - rr_list = ldns_rr_list_new(); - ldns_rr_list_push_rr(rr_list, cur_name->nsec); - siglist = ldns_sign_public(rr_list, key_list); - - for (i = 0; i < ldns_rr_list_rr_count(siglist); i++) { - if (cur_name->nsec_signatures) { - result = ldns_dnssec_rrs_add_rr(cur_name->nsec_signatures, - ldns_rr_list_rr(siglist, i)); - } else { - cur_name->nsec_signatures = ldns_dnssec_rrs_new(); - cur_name->nsec_signatures->rr = - ldns_rr_list_rr(siglist, i); - ldns_rr_list_push_rr(new_rrs, - ldns_rr_list_rr(siglist, i)); - } - } - - ldns_rr_list_free(siglist); - ldns_rr_list_free(rr_list); - } - cur_node = ldns_rbtree_next(cur_node); - } - - ldns_rr_list_deep_free(pubkey_list); - return result; -} - -ldns_status -ldns_dnssec_zone_sign(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg) -{ - return ldns_dnssec_zone_sign_flg(zone, new_rrs, key_list, func, arg, 0); -} - -ldns_status -ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg, - int flags) -{ - ldns_status result = LDNS_STATUS_OK; - - if (!zone || !new_rrs || !key_list) { - return LDNS_STATUS_ERR; - } - - /* zone is already sorted */ - result = ldns_dnssec_zone_mark_glue(zone); - if (result != LDNS_STATUS_OK) { - return result; - } - - /* check whether we need to add nsecs */ - if (zone->names && !((ldns_dnssec_name *)zone->names->root->data)->nsec) { - result = ldns_dnssec_zone_create_nsecs(zone, new_rrs); - if (result != LDNS_STATUS_OK) { - return result; - } - } - - result = ldns_dnssec_zone_create_rrsigs_flg(zone, - new_rrs, - key_list, - func, - arg, - flags); - - return result; -} - -ldns_status -ldns_dnssec_zone_sign_nsec3(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt) -{ - return ldns_dnssec_zone_sign_nsec3_flg(zone, new_rrs, key_list, - func, arg, algorithm, flags, iterations, salt_length, salt, 0); -} - -ldns_status -ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt, - int signflags) -{ - ldns_rr *nsec3, *nsec3params; - ldns_status result = LDNS_STATUS_OK; - - /* zone is already sorted */ - result = ldns_dnssec_zone_mark_glue(zone); - if (result != LDNS_STATUS_OK) { - return result; - } - - /* TODO if there are already nsec3s presents and their - * parameters are the same as these, we don't have to recreate - */ - if (zone->names) { - /* add empty nonterminals */ - result = ldns_dnssec_zone_add_empty_nonterminals(zone); - if (result != LDNS_STATUS_OK) { - return result; - } - - nsec3 = ((ldns_dnssec_name *)zone->names->root->data)->nsec; - if (nsec3 && ldns_rr_get_type(nsec3) == LDNS_RR_TYPE_NSEC3) { - /* no need to recreate */ - } else { - if (!ldns_dnssec_zone_find_rrset(zone, - zone->soa->name, - LDNS_RR_TYPE_NSEC3PARAMS)) { - /* create and add the nsec3params rr */ - nsec3params = - ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3PARAMS); - ldns_rr_set_owner(nsec3params, - ldns_rdf_clone(zone->soa->name)); - ldns_nsec3_add_param_rdfs(nsec3params, - algorithm, - flags, - iterations, - salt_length, - salt); - /* always set bit 7 of the flags to zero, according to - * rfc5155 section 11 */ - ldns_set_bit(ldns_rdf_data(ldns_rr_rdf(nsec3params, 1)), 7, 0); - result = ldns_dnssec_zone_add_rr(zone, nsec3params); - if (result != LDNS_STATUS_OK) { - return result; - } - ldns_rr_list_push_rr(new_rrs, nsec3params); - } - result = ldns_dnssec_zone_create_nsec3s(zone, - new_rrs, - algorithm, - flags, - iterations, - salt_length, - salt); - if (result != LDNS_STATUS_OK) { - return result; - } - } - - result = ldns_dnssec_zone_create_rrsigs_flg(zone, - new_rrs, - key_list, - func, - arg, - signflags); - } - - return result; -} - - -ldns_zone * -ldns_zone_sign(const ldns_zone *zone, ldns_key_list *key_list) -{ - ldns_dnssec_zone *dnssec_zone; - ldns_zone *signed_zone; - ldns_rr_list *new_rrs; - size_t i; - - signed_zone = ldns_zone_new(); - dnssec_zone = ldns_dnssec_zone_new(); - - (void) ldns_dnssec_zone_add_rr(dnssec_zone, ldns_zone_soa(zone)); - ldns_zone_set_soa(signed_zone, ldns_rr_clone(ldns_zone_soa(zone))); - - for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(zone)); i++) { - (void) ldns_dnssec_zone_add_rr(dnssec_zone, - ldns_rr_list_rr(ldns_zone_rrs(zone), - i)); - ldns_zone_push_rr(signed_zone, - ldns_rr_clone(ldns_rr_list_rr(ldns_zone_rrs(zone), - i))); - } - - new_rrs = ldns_rr_list_new(); - (void) ldns_dnssec_zone_sign(dnssec_zone, - new_rrs, - key_list, - ldns_dnssec_default_replace_signatures, - NULL); - - for (i = 0; i < ldns_rr_list_rr_count(new_rrs); i++) { - ldns_rr_list_push_rr(ldns_zone_rrs(signed_zone), - ldns_rr_clone(ldns_rr_list_rr(new_rrs, i))); - } - - ldns_rr_list_deep_free(new_rrs); - ldns_dnssec_zone_free(dnssec_zone); - - return signed_zone; -} - -ldns_zone * -ldns_zone_sign_nsec3(ldns_zone *zone, ldns_key_list *key_list, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt) -{ - ldns_dnssec_zone *dnssec_zone; - ldns_zone *signed_zone; - ldns_rr_list *new_rrs; - size_t i; - - signed_zone = ldns_zone_new(); - dnssec_zone = ldns_dnssec_zone_new(); - - (void) ldns_dnssec_zone_add_rr(dnssec_zone, ldns_zone_soa(zone)); - ldns_zone_set_soa(signed_zone, ldns_rr_clone(ldns_zone_soa(zone))); - - for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(zone)); i++) { - (void) ldns_dnssec_zone_add_rr(dnssec_zone, - ldns_rr_list_rr(ldns_zone_rrs(zone), - i)); - ldns_zone_push_rr(signed_zone, - ldns_rr_clone(ldns_rr_list_rr(ldns_zone_rrs(zone), - i))); - } - - new_rrs = ldns_rr_list_new(); - (void) ldns_dnssec_zone_sign_nsec3(dnssec_zone, - new_rrs, - key_list, - ldns_dnssec_default_replace_signatures, - NULL, - algorithm, - flags, - iterations, - salt_length, - salt); - - for (i = 0; i < ldns_rr_list_rr_count(new_rrs); i++) { - ldns_rr_list_push_rr(ldns_zone_rrs(signed_zone), - ldns_rr_clone(ldns_rr_list_rr(new_rrs, i))); - } - - ldns_rr_list_deep_free(new_rrs); - ldns_dnssec_zone_free(dnssec_zone); - - return signed_zone; -} -#endif /* HAVE_SSL */ - diff --git a/libs/ldns/dnssec_verify.c b/libs/ldns/dnssec_verify.c deleted file mode 100644 index 352e44066b..0000000000 --- a/libs/ldns/dnssec_verify.c +++ /dev/null @@ -1,2303 +0,0 @@ -#include - -#include - -#include -#include - -#ifdef HAVE_SSL -/* this entire file is rather useless when you don't have - * crypto... - */ -#include -#include -#include -#include -#include - -ldns_dnssec_data_chain * -ldns_dnssec_data_chain_new() -{ - ldns_dnssec_data_chain *nc = LDNS_XMALLOC(ldns_dnssec_data_chain, 1); - if(!nc) return NULL; - nc->rrset = NULL; - nc->parent_type = 0; - nc->parent = NULL; - nc->signatures = NULL; - nc->packet_rcode = 0; - nc->packet_qtype = 0; - nc->packet_nodata = false; - return nc; -} - -void -ldns_dnssec_data_chain_free(ldns_dnssec_data_chain *chain) -{ - LDNS_FREE(chain); -} - -void -ldns_dnssec_data_chain_deep_free(ldns_dnssec_data_chain *chain) -{ - ldns_rr_list_deep_free(chain->rrset); - ldns_rr_list_deep_free(chain->signatures); - if (chain->parent) { - ldns_dnssec_data_chain_deep_free(chain->parent); - } - LDNS_FREE(chain); -} - -void -ldns_dnssec_data_chain_print(FILE *out, const ldns_dnssec_data_chain *chain) -{ - ldns_lookup_table *rcode; - const ldns_rr_descriptor *rr_descriptor; - if (chain) { - ldns_dnssec_data_chain_print(out, chain->parent); - if (ldns_rr_list_rr_count(chain->rrset) > 0) { - rcode = ldns_lookup_by_id(ldns_rcodes, - (int) chain->packet_rcode); - if (rcode) { - fprintf(out, ";; rcode: %s\n", rcode->name); - } - - rr_descriptor = ldns_rr_descript(chain->packet_qtype); - if (rr_descriptor && rr_descriptor->_name) { - fprintf(out, ";; qtype: %s\n", rr_descriptor->_name); - } else if (chain->packet_qtype != 0) { - fprintf(out, "TYPE%u", - chain->packet_qtype); - } - if (chain->packet_nodata) { - fprintf(out, ";; NODATA response\n"); - } - fprintf(out, "rrset:\n"); - ldns_rr_list_print(out, chain->rrset); - fprintf(out, "sigs:\n"); - ldns_rr_list_print(out, chain->signatures); - fprintf(out, "---\n"); - } else { - fprintf(out, "\n"); - } - } -} - -static void -ldns_dnssec_build_data_chain_dnskey(ldns_resolver *res, - uint16_t qflags, - const ldns_pkt *pkt, - ldns_rr_list *signatures, - ldns_dnssec_data_chain *new_chain, - ldns_rdf *key_name, - ldns_rr_class c) { - ldns_rr_list *keys; - ldns_pkt *my_pkt; - if (signatures && ldns_rr_list_rr_count(signatures) > 0) { - new_chain->signatures = ldns_rr_list_clone(signatures); - new_chain->parent_type = 0; - - keys = ldns_pkt_rr_list_by_name_and_type( - pkt, - key_name, - LDNS_RR_TYPE_DNSKEY, - LDNS_SECTION_ANY_NOQUESTION - ); - if (!keys) { - my_pkt = ldns_resolver_query(res, - key_name, - LDNS_RR_TYPE_DNSKEY, - c, - qflags); - if (my_pkt) { - keys = ldns_pkt_rr_list_by_name_and_type( - my_pkt, - key_name, - LDNS_RR_TYPE_DNSKEY, - LDNS_SECTION_ANY_NOQUESTION - ); - new_chain->parent = ldns_dnssec_build_data_chain(res, - qflags, - keys, - my_pkt, - NULL); - new_chain->parent->packet_qtype = LDNS_RR_TYPE_DNSKEY; - ldns_pkt_free(my_pkt); - } - } else { - new_chain->parent = ldns_dnssec_build_data_chain(res, - qflags, - keys, - pkt, - NULL); - new_chain->parent->packet_qtype = LDNS_RR_TYPE_DNSKEY; - } - ldns_rr_list_deep_free(keys); - } -} - -static void -ldns_dnssec_build_data_chain_other(ldns_resolver *res, - uint16_t qflags, - ldns_dnssec_data_chain *new_chain, - ldns_rdf *key_name, - ldns_rr_class c, - ldns_rr_list *dss) -{ - /* 'self-signed', parent is a DS */ - - /* okay, either we have other keys signing the current one, - * or the current - * one should have a DS record in the parent zone. - * How do we find this out? Try both? - * - * request DNSKEYS for current zone, - * add all signatures to current level - */ - ldns_pkt *my_pkt; - ldns_rr_list *signatures2; - - new_chain->parent_type = 1; - - my_pkt = ldns_resolver_query(res, - key_name, - LDNS_RR_TYPE_DS, - c, - qflags); - if (my_pkt) { - dss = ldns_pkt_rr_list_by_name_and_type(my_pkt, - key_name, - LDNS_RR_TYPE_DS, - LDNS_SECTION_ANY_NOQUESTION - ); - if (dss) { - new_chain->parent = ldns_dnssec_build_data_chain(res, - qflags, - dss, - my_pkt, - NULL); - new_chain->parent->packet_qtype = LDNS_RR_TYPE_DS; - ldns_rr_list_deep_free(dss); - } - ldns_pkt_free(my_pkt); - } - - my_pkt = ldns_resolver_query(res, - key_name, - LDNS_RR_TYPE_DNSKEY, - c, - qflags); - if (my_pkt) { - signatures2 = ldns_pkt_rr_list_by_name_and_type(my_pkt, - key_name, - LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_ANSWER); - if (signatures2) { - if (new_chain->signatures) { - printf("There were already sigs!\n"); - ldns_rr_list_deep_free(new_chain->signatures); - printf("replacing the old sigs\n"); - } - new_chain->signatures = signatures2; - } - ldns_pkt_free(my_pkt); - } -} - -ldns_dnssec_data_chain * -ldns_dnssec_build_data_chain_nokeyname(ldns_resolver *res, - uint16_t qflags, - ldns_rr *orig_rr, - const ldns_rr_list *rrset, - ldns_dnssec_data_chain *new_chain) -{ - ldns_rdf *possible_parent_name; - ldns_pkt *my_pkt; - /* apparently we were not able to find a signing key, so - we assume the chain ends here - */ - /* try parents for auth denial of DS */ - if (orig_rr) { - possible_parent_name = ldns_rr_owner(orig_rr); - } else if (rrset && ldns_rr_list_rr_count(rrset) > 0) { - possible_parent_name = ldns_rr_owner(ldns_rr_list_rr(rrset, 0)); - } else { - /* no information to go on, give up */ - return new_chain; - } - - my_pkt = ldns_resolver_query(res, - possible_parent_name, - LDNS_RR_TYPE_DS, - LDNS_RR_CLASS_IN, - qflags); - if (!my_pkt) { - return new_chain; - } - - if (ldns_pkt_ancount(my_pkt) > 0) { - /* add error, no sigs but DS in parent */ - /*ldns_pkt_print(stdout, my_pkt);*/ - ldns_pkt_free(my_pkt); - } else { - /* are there signatures? */ - new_chain->parent = ldns_dnssec_build_data_chain(res, - qflags, - NULL, - my_pkt, - NULL); - - new_chain->parent->packet_qtype = LDNS_RR_TYPE_DS; - - } - return new_chain; -} - - -ldns_dnssec_data_chain * -ldns_dnssec_build_data_chain(ldns_resolver *res, - uint16_t qflags, - const ldns_rr_list *rrset, - const ldns_pkt *pkt, - ldns_rr *orig_rr) -{ - ldns_rr_list *signatures = NULL; - ldns_rr_list *dss = NULL; - - ldns_rr_list *my_rrset; - - ldns_pkt *my_pkt; - - ldns_rdf *name = NULL, *key_name = NULL; - ldns_rr_type type = 0; - ldns_rr_class c = 0; - - bool other_rrset = false; - - ldns_dnssec_data_chain *new_chain = ldns_dnssec_data_chain_new(); - - if (!ldns_dnssec_pkt_has_rrsigs(pkt)) { - /* hmm. no dnssec data in the packet. go up to try and deny - * DS? */ - return new_chain; - } - - if (orig_rr) { - new_chain->rrset = ldns_rr_list_new(); - ldns_rr_list_push_rr(new_chain->rrset, orig_rr); - new_chain->parent = ldns_dnssec_build_data_chain(res, - qflags, - rrset, - pkt, - NULL); - new_chain->packet_rcode = ldns_pkt_get_rcode(pkt); - new_chain->packet_qtype = ldns_rr_get_type(orig_rr); - if (ldns_pkt_ancount(pkt) == 0) { - new_chain->packet_nodata = true; - } - return new_chain; - } - - if (!rrset || ldns_rr_list_rr_count(rrset) < 1) { - /* hmm, no data, do we have denial? only works if pkt was given, - otherwise caller has to do the check himself */ - new_chain->packet_nodata = true; - if (pkt) { - my_rrset = ldns_pkt_rr_list_by_type(pkt, - LDNS_RR_TYPE_NSEC, - LDNS_SECTION_ANY_NOQUESTION - ); - if (my_rrset) { - if (ldns_rr_list_rr_count(my_rrset) > 0) { - type = LDNS_RR_TYPE_NSEC; - other_rrset = true; - } else { - ldns_rr_list_deep_free(my_rrset); - my_rrset = NULL; - } - } else { - /* nothing, try nsec3 */ - my_rrset = ldns_pkt_rr_list_by_type(pkt, - LDNS_RR_TYPE_NSEC3, - LDNS_SECTION_ANY_NOQUESTION); - if (my_rrset) { - if (ldns_rr_list_rr_count(my_rrset) > 0) { - type = LDNS_RR_TYPE_NSEC3; - other_rrset = true; - } else { - ldns_rr_list_deep_free(my_rrset); - my_rrset = NULL; - } - } else { - /* nothing, stop */ - /* try parent zone? for denied insecure? */ - return new_chain; - } - } - } else { - return new_chain; - } - } else { - my_rrset = (ldns_rr_list *) rrset; - } - - if (my_rrset && ldns_rr_list_rr_count(my_rrset) > 0) { - new_chain->rrset = ldns_rr_list_clone(my_rrset); - name = ldns_rr_owner(ldns_rr_list_rr(my_rrset, 0)); - type = ldns_rr_get_type(ldns_rr_list_rr(my_rrset, 0)); - c = ldns_rr_get_class(ldns_rr_list_rr(my_rrset, 0)); - } - - if (other_rrset) { - ldns_rr_list_deep_free(my_rrset); - } - - /* normally there will only be 1 signature 'set' - but there can be more than 1 denial (wildcards) - so check for NSEC - */ - if (type == LDNS_RR_TYPE_NSEC || type == LDNS_RR_TYPE_NSEC3) { - /* just throw in all signatures, the tree builder must sort - this out */ - if (pkt) { - signatures = ldns_dnssec_pkt_get_rrsigs_for_type(pkt, type); - } else { - my_pkt = ldns_resolver_query(res, name, type, c, qflags); - if (my_pkt) { - signatures = ldns_dnssec_pkt_get_rrsigs_for_type(pkt, type); - ldns_pkt_free(my_pkt); - } - } - } else { - if (pkt) { - signatures = - ldns_dnssec_pkt_get_rrsigs_for_name_and_type(pkt, - name, - type); - } - if (!signatures) { - my_pkt = ldns_resolver_query(res, name, type, c, qflags); - if (my_pkt) { - signatures = - ldns_dnssec_pkt_get_rrsigs_for_name_and_type(my_pkt, - name, - type); - ldns_pkt_free(my_pkt); - } - } - } - - if (signatures && ldns_rr_list_rr_count(signatures) > 0) { - key_name = ldns_rr_rdf(ldns_rr_list_rr(signatures, 0), 7); - } - - if (!key_name) { - return ldns_dnssec_build_data_chain_nokeyname(res, - qflags, - orig_rr, - rrset, - new_chain); - } - - if (type != LDNS_RR_TYPE_DNSKEY) { - ldns_dnssec_build_data_chain_dnskey(res, - qflags, - pkt, - signatures, - new_chain, - key_name, - c - ); - } else { - ldns_dnssec_build_data_chain_other(res, - qflags, - new_chain, - key_name, - c, - dss - - ); - } - if (signatures) { - ldns_rr_list_deep_free(signatures); - } - - return new_chain; -} - -ldns_dnssec_trust_tree * -ldns_dnssec_trust_tree_new() -{ - ldns_dnssec_trust_tree *new_tree = LDNS_XMALLOC(ldns_dnssec_trust_tree, - 1); - if(!new_tree) return NULL; - new_tree->rr = NULL; - new_tree->rrset = NULL; - new_tree->parent_count = 0; - - return new_tree; -} - -void -ldns_dnssec_trust_tree_free(ldns_dnssec_trust_tree *tree) -{ - size_t i; - if (tree) { - for (i = 0; i < tree->parent_count; i++) { - ldns_dnssec_trust_tree_free(tree->parents[i]); - } - } - LDNS_FREE(tree); -} - -size_t -ldns_dnssec_trust_tree_depth(ldns_dnssec_trust_tree *tree) -{ - size_t result = 0; - size_t parent = 0; - size_t i; - - for (i = 0; i < tree->parent_count; i++) { - parent = ldns_dnssec_trust_tree_depth(tree->parents[i]); - if (parent > result) { - result = parent; - } - } - return 1 + result; -} - -/* TODO ldns_ */ -static void -print_tabs(FILE *out, size_t nr, uint8_t *map, size_t treedepth) -{ - size_t i; - for (i = 0; i < nr; i++) { - if (i == nr - 1) { - fprintf(out, "|---"); - } else if (map && i < treedepth && map[i] == 1) { - fprintf(out, "| "); - } else { - fprintf(out, " "); - } - } -} - -void -ldns_dnssec_trust_tree_print_sm(FILE *out, - ldns_dnssec_trust_tree *tree, - size_t tabs, - bool extended, - uint8_t *sibmap, - size_t treedepth) -{ - size_t i; - const ldns_rr_descriptor *descriptor; - bool mapset = false; - - if (!sibmap) { - treedepth = ldns_dnssec_trust_tree_depth(tree); - sibmap = malloc(treedepth); - if(!sibmap) - return; /* mem err */ - memset(sibmap, 0, treedepth); - mapset = true; - } - - if (tree) { - if (tree->rr) { - print_tabs(out, tabs, sibmap, treedepth); - ldns_rdf_print(out, ldns_rr_owner(tree->rr)); - descriptor = ldns_rr_descript(ldns_rr_get_type(tree->rr)); - - if (descriptor->_name) { - fprintf(out, " (%s", descriptor->_name); - } else { - fprintf(out, " (TYPE%d", - ldns_rr_get_type(tree->rr)); - } - if (tabs > 0) { - if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_DNSKEY) { - fprintf(out, " keytag: %u", - (unsigned int) ldns_calc_keytag(tree->rr)); - fprintf(out, " alg: "); - ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 2)); - fprintf(out, " flags: "); - ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 0)); - } else if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_DS) { - fprintf(out, " keytag: "); - ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 0)); - fprintf(out, " digest type: "); - ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 2)); - } - if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_NSEC) { - fprintf(out, " "); - ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 0)); - fprintf(out, " "); - ldns_rdf_print(out, ldns_rr_rdf(tree->rr, 1)); - } - } - - fprintf(out, ")\n"); - for (i = 0; i < tree->parent_count; i++) { - if (tree->parent_count > 1 && i < tree->parent_count - 1) { - sibmap[tabs] = 1; - } else { - sibmap[tabs] = 0; - } - /* only print errors */ - if (ldns_rr_get_type(tree->parents[i]->rr) == - LDNS_RR_TYPE_NSEC || - ldns_rr_get_type(tree->parents[i]->rr) == - LDNS_RR_TYPE_NSEC3) { - if (tree->parent_status[i] == LDNS_STATUS_OK) { - print_tabs(out, tabs + 1, sibmap, treedepth); - if (tabs == 0 && - ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_NS && - ldns_rr_rd_count(tree->rr) > 0) { - fprintf(out, "Existence of DS is denied by:\n"); - } else { - fprintf(out, "Existence is denied by:\n"); - } - } else { - /* NS records aren't signed */ - if (ldns_rr_get_type(tree->rr) == LDNS_RR_TYPE_NS) { - fprintf(out, "Existence of DS is denied by:\n"); - } else { - print_tabs(out, tabs + 1, sibmap, treedepth); - fprintf(out, - "Error in denial of existence: %s\n", - ldns_get_errorstr_by_id( - tree->parent_status[i])); - } - } - } else - if (tree->parent_status[i] != LDNS_STATUS_OK) { - print_tabs(out, tabs + 1, sibmap, treedepth); - fprintf(out, - "%s:\n", - ldns_get_errorstr_by_id( - tree->parent_status[i])); - if (tree->parent_status[i] - == LDNS_STATUS_SSL_ERR) { - printf("; SSL Error: "); - ERR_load_crypto_strings(); - ERR_print_errors_fp(stdout); - printf("\n"); - } - ldns_rr_print(out, tree->parent_signature[i]); - printf("For RRset:\n"); - ldns_rr_list_print(out, tree->rrset); - printf("With key:\n"); - ldns_rr_print(out, tree->parents[i]->rr); - } - ldns_dnssec_trust_tree_print_sm(out, - tree->parents[i], - tabs+1, - extended, - sibmap, - treedepth); - } - } else { - print_tabs(out, tabs, sibmap, treedepth); - fprintf(out, "\n"); - } - } else { - fprintf(out, "\n"); - } - - if (mapset) { - free(sibmap); - } -} - -void -ldns_dnssec_trust_tree_print(FILE *out, - ldns_dnssec_trust_tree *tree, - size_t tabs, - bool extended) -{ - ldns_dnssec_trust_tree_print_sm(out, tree, tabs, extended, NULL, 0); -} - -ldns_status -ldns_dnssec_trust_tree_add_parent(ldns_dnssec_trust_tree *tree, - const ldns_dnssec_trust_tree *parent, - const ldns_rr *signature, - const ldns_status parent_status) -{ - if (tree - && parent - && tree->parent_count < LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS) { - /* - printf("Add parent for: "); - ldns_rr_print(stdout, tree->rr); - printf("parent: "); - ldns_rr_print(stdout, parent->rr); - */ - tree->parents[tree->parent_count] = - (ldns_dnssec_trust_tree *) parent; - tree->parent_status[tree->parent_count] = parent_status; - tree->parent_signature[tree->parent_count] = (ldns_rr *) signature; - tree->parent_count++; - return LDNS_STATUS_OK; - } else { - return LDNS_STATUS_ERR; - } -} - -/* if rr is null, take the first from the rrset */ -ldns_dnssec_trust_tree * -ldns_dnssec_derive_trust_tree(ldns_dnssec_data_chain *data_chain, ldns_rr *rr) -{ - ldns_rr_list *cur_rrset; - ldns_rr_list *cur_sigs; - ldns_rr *cur_rr = NULL; - ldns_rr *cur_sig_rr; - size_t i, j; - - ldns_dnssec_trust_tree *new_tree = ldns_dnssec_trust_tree_new(); - if(!new_tree) - return NULL; - - if (data_chain && data_chain->rrset) { - cur_rrset = data_chain->rrset; - - cur_sigs = data_chain->signatures; - - if (rr) { - cur_rr = rr; - } - - if (!cur_rr && ldns_rr_list_rr_count(cur_rrset) > 0) { - cur_rr = ldns_rr_list_rr(cur_rrset, 0); - } - - if (cur_rr) { - new_tree->rr = cur_rr; - new_tree->rrset = cur_rrset; - /* there are three possibilities: - 1 - 'normal' rrset, signed by a key - 2 - dnskey signed by other dnskey - 3 - dnskey proven by higher level DS - (data denied by nsec is a special case that can - occur in multiple places) - - */ - if (cur_sigs) { - for (i = 0; i < ldns_rr_list_rr_count(cur_sigs); i++) { - /* find the appropriate key in the parent list */ - cur_sig_rr = ldns_rr_list_rr(cur_sigs, i); - - if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_NSEC) { - if (ldns_dname_compare(ldns_rr_owner(cur_sig_rr), - ldns_rr_owner(cur_rr))) - { - /* find first that does match */ - - for (j = 0; - j < ldns_rr_list_rr_count(cur_rrset) && - ldns_dname_compare(ldns_rr_owner(cur_sig_rr),ldns_rr_owner(cur_rr)) != 0; - j++) { - cur_rr = ldns_rr_list_rr(cur_rrset, j); - - } - if (ldns_dname_compare(ldns_rr_owner(cur_sig_rr), - ldns_rr_owner(cur_rr))) - { - break; - } - } - - } - /* option 1 */ - if (data_chain->parent) { - ldns_dnssec_derive_trust_tree_normal_rrset( - new_tree, - data_chain, - cur_sig_rr); - } - - /* option 2 */ - ldns_dnssec_derive_trust_tree_dnskey_rrset( - new_tree, - data_chain, - cur_rr, - cur_sig_rr); - } - - ldns_dnssec_derive_trust_tree_ds_rrset(new_tree, - data_chain, - cur_rr); - } else { - /* no signatures? maybe it's nsec data */ - - /* just add every rr from parent as new parent */ - ldns_dnssec_derive_trust_tree_no_sig(new_tree, data_chain); - } - } - } - - return new_tree; -} - -void -ldns_dnssec_derive_trust_tree_normal_rrset(ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain, - ldns_rr *cur_sig_rr) -{ - size_t i, j; - ldns_rr_list *cur_rrset = ldns_rr_list_clone(data_chain->rrset); - ldns_dnssec_trust_tree *cur_parent_tree; - ldns_rr *cur_parent_rr; - uint16_t cur_keytag; - ldns_rr_list *tmp_rrset = NULL; - ldns_status cur_status; - - cur_keytag = ldns_rdf2native_int16(ldns_rr_rrsig_keytag(cur_sig_rr)); - - for (j = 0; j < ldns_rr_list_rr_count(data_chain->parent->rrset); j++) { - cur_parent_rr = ldns_rr_list_rr(data_chain->parent->rrset, j); - if (ldns_rr_get_type(cur_parent_rr) == LDNS_RR_TYPE_DNSKEY) { - if (ldns_calc_keytag(cur_parent_rr) == cur_keytag) { - - /* TODO: check wildcard nsec too */ - if (cur_rrset && ldns_rr_list_rr_count(cur_rrset) > 0) { - tmp_rrset = cur_rrset; - if (ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) - == LDNS_RR_TYPE_NSEC || - ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) - == LDNS_RR_TYPE_NSEC3) { - /* might contain different names! - sort and split */ - ldns_rr_list_sort(cur_rrset); - if (tmp_rrset && tmp_rrset != cur_rrset) { - ldns_rr_list_deep_free(tmp_rrset); - tmp_rrset = NULL; - } - tmp_rrset = ldns_rr_list_pop_rrset(cur_rrset); - - /* with nsecs, this might be the wrong one */ - while (tmp_rrset && - ldns_rr_list_rr_count(cur_rrset) > 0 && - ldns_dname_compare( - ldns_rr_owner(ldns_rr_list_rr( - tmp_rrset, 0)), - ldns_rr_owner(cur_sig_rr)) != 0) { - ldns_rr_list_deep_free(tmp_rrset); - tmp_rrset = - ldns_rr_list_pop_rrset(cur_rrset); - } - } - cur_status = ldns_verify_rrsig(tmp_rrset, - cur_sig_rr, - cur_parent_rr); - /* avoid dupes */ - for (i = 0; i < new_tree->parent_count; i++) { - if (cur_parent_rr == new_tree->parents[i]->rr) { - goto done; - } - } - - cur_parent_tree = - ldns_dnssec_derive_trust_tree(data_chain->parent, - cur_parent_rr); - (void)ldns_dnssec_trust_tree_add_parent(new_tree, - cur_parent_tree, - cur_sig_rr, - cur_status); - } - } - } - } - done: - if (tmp_rrset && tmp_rrset != cur_rrset) { - ldns_rr_list_deep_free(tmp_rrset); - } - ldns_rr_list_deep_free(cur_rrset); -} - -void -ldns_dnssec_derive_trust_tree_dnskey_rrset(ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain, - ldns_rr *cur_rr, - ldns_rr *cur_sig_rr) -{ - size_t j; - ldns_rr_list *cur_rrset = data_chain->rrset; - ldns_dnssec_trust_tree *cur_parent_tree; - ldns_rr *cur_parent_rr; - uint16_t cur_keytag; - ldns_status cur_status; - - cur_keytag = ldns_rdf2native_int16(ldns_rr_rrsig_keytag(cur_sig_rr)); - - for (j = 0; j < ldns_rr_list_rr_count(cur_rrset); j++) { - cur_parent_rr = ldns_rr_list_rr(cur_rrset, j); - if (cur_parent_rr != cur_rr && - ldns_rr_get_type(cur_parent_rr) == LDNS_RR_TYPE_DNSKEY) { - if (ldns_calc_keytag(cur_parent_rr) == cur_keytag - ) { - cur_parent_tree = ldns_dnssec_trust_tree_new(); - cur_parent_tree->rr = cur_parent_rr; - cur_parent_tree->rrset = cur_rrset; - cur_status = ldns_verify_rrsig(cur_rrset, - cur_sig_rr, - cur_parent_rr); - (void) ldns_dnssec_trust_tree_add_parent(new_tree, - cur_parent_tree, cur_sig_rr, cur_status); - } - } - } -} - -void -ldns_dnssec_derive_trust_tree_ds_rrset(ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain, - ldns_rr *cur_rr) -{ - size_t j, h; - ldns_rr_list *cur_rrset = data_chain->rrset; - ldns_dnssec_trust_tree *cur_parent_tree; - ldns_rr *cur_parent_rr; - - /* try the parent to see whether there are DSs there */ - if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_DNSKEY && - data_chain->parent && - data_chain->parent->rrset - ) { - for (j = 0; - j < ldns_rr_list_rr_count(data_chain->parent->rrset); - j++) { - cur_parent_rr = ldns_rr_list_rr(data_chain->parent->rrset, j); - if (ldns_rr_get_type(cur_parent_rr) == LDNS_RR_TYPE_DS) { - for (h = 0; h < ldns_rr_list_rr_count(cur_rrset); h++) { - cur_rr = ldns_rr_list_rr(cur_rrset, h); - if (ldns_rr_compare_ds(cur_rr, cur_parent_rr)) { - cur_parent_tree = - ldns_dnssec_derive_trust_tree( - data_chain->parent, cur_parent_rr); - (void) ldns_dnssec_trust_tree_add_parent( - new_tree, - cur_parent_tree, - NULL, - LDNS_STATUS_OK); - } else { - /*ldns_rr_print(stdout, cur_parent_rr);*/ - } - } - } - } - } -} - -void -ldns_dnssec_derive_trust_tree_no_sig(ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain) -{ - size_t i; - ldns_rr_list *cur_rrset; - ldns_rr *cur_parent_rr; - ldns_dnssec_trust_tree *cur_parent_tree; - ldns_status result; - - if (data_chain->parent && data_chain->parent->rrset) { - cur_rrset = data_chain->parent->rrset; - /* nsec? */ - if (cur_rrset && ldns_rr_list_rr_count(cur_rrset) > 0) { - if (ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) == - LDNS_RR_TYPE_NSEC3) { - result = ldns_dnssec_verify_denial_nsec3( - new_tree->rr, - cur_rrset, - data_chain->parent->signatures, - data_chain->packet_rcode, - data_chain->packet_qtype, - data_chain->packet_nodata); - } else if (ldns_rr_get_type(ldns_rr_list_rr(cur_rrset, 0)) == - LDNS_RR_TYPE_NSEC3) { - result = ldns_dnssec_verify_denial( - new_tree->rr, - cur_rrset, - data_chain->parent->signatures); - } else { - /* unsigned zone, unsigned parent */ - result = LDNS_STATUS_OK; - } - } else { - result = LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED; - } - for (i = 0; i < ldns_rr_list_rr_count(cur_rrset); i++) { - cur_parent_rr = ldns_rr_list_rr(cur_rrset, i); - cur_parent_tree = - ldns_dnssec_derive_trust_tree(data_chain->parent, - cur_parent_rr); - (void) ldns_dnssec_trust_tree_add_parent(new_tree, - cur_parent_tree, NULL, result); - } - } -} - -/* - * returns OK if there is a path from tree to key with only OK - * the (first) error in between otherwise - * or NOT_FOUND if the key wasn't present at all - */ -ldns_status -ldns_dnssec_trust_tree_contains_keys(ldns_dnssec_trust_tree *tree, - ldns_rr_list *trusted_keys) -{ - size_t i; - ldns_status result = LDNS_STATUS_CRYPTO_NO_DNSKEY; - bool equal; - ldns_status parent_result; - - if (tree && trusted_keys && ldns_rr_list_rr_count(trusted_keys) > 0) - { if (tree->rr) { - for (i = 0; i < ldns_rr_list_rr_count(trusted_keys); i++) { - equal = ldns_rr_compare_ds( - tree->rr, - ldns_rr_list_rr(trusted_keys, i)); - if (equal) { - result = LDNS_STATUS_OK; - return result; - } - } - } - for (i = 0; i < tree->parent_count; i++) { - parent_result = - ldns_dnssec_trust_tree_contains_keys(tree->parents[i], - trusted_keys); - if (parent_result != LDNS_STATUS_CRYPTO_NO_DNSKEY) { - if (tree->parent_status[i] != LDNS_STATUS_OK) { - result = tree->parent_status[i]; - } else { - if (ldns_rr_get_type(tree->rr) - == LDNS_RR_TYPE_NSEC && - parent_result == LDNS_STATUS_OK - ) { - result = - LDNS_STATUS_DNSSEC_EXISTENCE_DENIED; - } else { - result = parent_result; - } - } - } - } - } else { - result = LDNS_STATUS_ERR; - } - - return result; -} - -ldns_status -ldns_verify(ldns_rr_list *rrset, ldns_rr_list *rrsig, const ldns_rr_list *keys, - ldns_rr_list *good_keys) -{ - uint16_t i; - ldns_status verify_result = LDNS_STATUS_ERR; - - if (!rrset || !rrsig || !keys) { - return LDNS_STATUS_ERR; - } - - if (ldns_rr_list_rr_count(rrset) < 1) { - return LDNS_STATUS_ERR; - } - - if (ldns_rr_list_rr_count(rrsig) < 1) { - return LDNS_STATUS_CRYPTO_NO_RRSIG; - } - - if (ldns_rr_list_rr_count(keys) < 1) { - verify_result = LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY; - } else { - for (i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { - ldns_status s = ldns_verify_rrsig_keylist(rrset, - ldns_rr_list_rr(rrsig, i), keys, good_keys); - /* try a little to get more descriptive error */ - if(s == LDNS_STATUS_OK) { - verify_result = LDNS_STATUS_OK; - } else if(verify_result == LDNS_STATUS_ERR) - verify_result = s; - else if(s != LDNS_STATUS_ERR && verify_result == - LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY) - verify_result = s; - } - } - return verify_result; -} - -ldns_status -ldns_verify_notime(ldns_rr_list *rrset, ldns_rr_list *rrsig, - const ldns_rr_list *keys, ldns_rr_list *good_keys) -{ - uint16_t i; - ldns_status verify_result = LDNS_STATUS_ERR; - - if (!rrset || !rrsig || !keys) { - return LDNS_STATUS_ERR; - } - - if (ldns_rr_list_rr_count(rrset) < 1) { - return LDNS_STATUS_ERR; - } - - if (ldns_rr_list_rr_count(rrsig) < 1) { - return LDNS_STATUS_CRYPTO_NO_RRSIG; - } - - if (ldns_rr_list_rr_count(keys) < 1) { - verify_result = LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY; - } else { - for (i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { - ldns_status s = ldns_verify_rrsig_keylist_notime(rrset, - ldns_rr_list_rr(rrsig, i), keys, good_keys); - - /* try a little to get more descriptive error */ - if (s == LDNS_STATUS_OK) { - verify_result = LDNS_STATUS_OK; - } else if (verify_result == LDNS_STATUS_ERR) { - verify_result = s; - } else if (s != LDNS_STATUS_ERR && verify_result == - LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY) { - verify_result = s; - } - } - } - return verify_result; -} - -ldns_rr_list * -ldns_fetch_valid_domain_keys(const ldns_resolver *res, - const ldns_rdf *domain, - const ldns_rr_list *keys, - ldns_status *status) -{ - ldns_rr_list * trusted_keys = NULL; - ldns_rr_list * ds_keys = NULL; - - if (res && domain && keys) { - - if ((trusted_keys = ldns_validate_domain_dnskey(res, - domain, - keys))) { - *status = LDNS_STATUS_OK; - } else { - /* No trusted keys in this domain, we'll have to find some in the parent domain */ - *status = LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY; - - if (ldns_rdf_size(domain) > 1) { - /* Fail if we are at the root */ - ldns_rr_list * parent_keys; - ldns_rdf * parent_domain = ldns_dname_left_chop(domain); - - if ((parent_keys = - ldns_fetch_valid_domain_keys(res, - parent_domain, - keys, - status))) { - /* Check DS records */ - if ((ds_keys = - ldns_validate_domain_ds(res, - domain, - parent_keys))) { - trusted_keys = - ldns_fetch_valid_domain_keys(res, - domain, - ds_keys, - status); - ldns_rr_list_deep_free(ds_keys); - } else { - /* No valid DS at the parent -- fail */ - *status = LDNS_STATUS_CRYPTO_NO_TRUSTED_DS ; - } - ldns_rr_list_deep_free(parent_keys); - } - ldns_rdf_deep_free(parent_domain); - } - } - } - return trusted_keys; -} - -ldns_rr_list * -ldns_validate_domain_dnskey(const ldns_resolver * res, - const ldns_rdf * domain, - const ldns_rr_list * keys) -{ - ldns_pkt * keypkt; - ldns_rr * cur_key; - uint16_t key_i; uint16_t key_j; uint16_t key_k; - uint16_t sig_i; ldns_rr * cur_sig; - - ldns_rr_list * domain_keys = NULL; - ldns_rr_list * domain_sigs = NULL; - ldns_rr_list * trusted_keys = NULL; - - /* Fetch keys for the domain */ - keypkt = ldns_resolver_query(res, domain, - LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, LDNS_RD); - if (keypkt) { - domain_keys = ldns_pkt_rr_list_by_type(keypkt, - LDNS_RR_TYPE_DNSKEY, - LDNS_SECTION_ANSWER); - domain_sigs = ldns_pkt_rr_list_by_type(keypkt, - LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_ANSWER); - - /* Try to validate the record using our keys */ - for (key_i=0; key_i< ldns_rr_list_rr_count(domain_keys); key_i++) { - - cur_key = ldns_rr_list_rr(domain_keys, key_i); - for (key_j=0; key_j sizeof(buf)) - return NULL; /* sanity check */ - /* prepend the 0x02 (from docs) (or actually 0x04 from implementation - * of openssl) for uncompressed data */ - buf[0] = POINT_CONVERSION_UNCOMPRESSED; - memmove(buf+1, key, keylen); - if(!o2i_ECPublicKey(&ec, &pp, (int)keylen+1)) { - EC_KEY_free(ec); - return NULL; - } - evp_key = EVP_PKEY_new(); - if(!evp_key) { - EC_KEY_free(ec); - return NULL; - } - EVP_PKEY_assign_EC_KEY(evp_key, ec); - return evp_key; -} - -static ldns_status -ldns_verify_rrsig_ecdsa_raw(unsigned char* sig, size_t siglen, - ldns_buffer* rrset, unsigned char* key, size_t keylen, uint8_t algo) -{ - EVP_PKEY *evp_key; - ldns_status result; - const EVP_MD *d; - - evp_key = ldns_ecdsa2pkey_raw(key, keylen, algo); - if(!evp_key) { - /* could not convert key */ - return LDNS_STATUS_CRYPTO_BOGUS; - } - if(algo == LDNS_ECDSAP256SHA256) - d = EVP_sha256(); - else d = EVP_sha384(); /* LDNS_ECDSAP384SHA384 */ - result = ldns_verify_rrsig_evp_raw(sig, siglen, rrset, evp_key, d); - EVP_PKEY_free(evp_key); - return result; -} -#endif - -ldns_status -ldns_verify_rrsig_buffers(ldns_buffer *rawsig_buf, ldns_buffer *verify_buf, - ldns_buffer *key_buf, uint8_t algo) -{ - return ldns_verify_rrsig_buffers_raw( - (unsigned char*)ldns_buffer_begin(rawsig_buf), - ldns_buffer_position(rawsig_buf), - verify_buf, - (unsigned char*)ldns_buffer_begin(key_buf), - ldns_buffer_position(key_buf), algo); -} - -ldns_status -ldns_verify_rrsig_buffers_raw(unsigned char* sig, size_t siglen, - ldns_buffer *verify_buf, unsigned char* key, size_t keylen, - uint8_t algo) -{ - /* check for right key */ - switch(algo) { - case LDNS_DSA: - case LDNS_DSA_NSEC3: - return ldns_verify_rrsig_dsa_raw(sig, - siglen, - verify_buf, - key, - keylen); - break; - case LDNS_RSASHA1: - case LDNS_RSASHA1_NSEC3: - return ldns_verify_rrsig_rsasha1_raw(sig, - siglen, - verify_buf, - key, - keylen); - break; -#ifdef USE_SHA2 - case LDNS_RSASHA256: - return ldns_verify_rrsig_rsasha256_raw(sig, - siglen, - verify_buf, - key, - keylen); - break; - case LDNS_RSASHA512: - return ldns_verify_rrsig_rsasha512_raw(sig, - siglen, - verify_buf, - key, - keylen); - break; -#endif -#ifdef USE_GOST - case LDNS_ECC_GOST: - return ldns_verify_rrsig_gost_raw(sig, siglen, verify_buf, - key, keylen); - break; -#endif -#ifdef USE_ECDSA - case LDNS_ECDSAP256SHA256: - case LDNS_ECDSAP384SHA384: - return ldns_verify_rrsig_ecdsa_raw(sig, siglen, verify_buf, - key, keylen, algo); - break; -#endif - case LDNS_RSAMD5: - return ldns_verify_rrsig_rsamd5_raw(sig, - siglen, - verify_buf, - key, - keylen); - break; - default: - /* do you know this alg?! */ - return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; - } -} - - -/** - * Reset the ttl in the rrset with the orig_ttl from the sig - * and update owner name if it was wildcard - * Also canonicalizes the rrset. - * @param rrset: rrset to modify - * @param sig: signature to take TTL and wildcard values from - */ -static void -ldns_rrset_use_signature_ttl(ldns_rr_list* rrset_clone, ldns_rr* rrsig) -{ - uint32_t orig_ttl; - uint16_t i; - uint8_t label_count; - ldns_rdf *wildcard_name; - ldns_rdf *wildcard_chopped; - ldns_rdf *wildcard_chopped_tmp; - - orig_ttl = ldns_rdf2native_int32( ldns_rr_rdf(rrsig, 3)); - label_count = ldns_rdf2native_int8(ldns_rr_rdf(rrsig, 2)); - - for(i = 0; i < ldns_rr_list_rr_count(rrset_clone); i++) { - if (label_count < - ldns_dname_label_count( - ldns_rr_owner(ldns_rr_list_rr(rrset_clone, i)))) { - (void) ldns_str2rdf_dname(&wildcard_name, "*"); - wildcard_chopped = ldns_rdf_clone(ldns_rr_owner( - ldns_rr_list_rr(rrset_clone, i))); - while (label_count < ldns_dname_label_count(wildcard_chopped)) { - wildcard_chopped_tmp = ldns_dname_left_chop( - wildcard_chopped); - ldns_rdf_deep_free(wildcard_chopped); - wildcard_chopped = wildcard_chopped_tmp; - } - (void) ldns_dname_cat(wildcard_name, wildcard_chopped); - ldns_rdf_deep_free(wildcard_chopped); - ldns_rdf_deep_free(ldns_rr_owner(ldns_rr_list_rr( - rrset_clone, i))); - ldns_rr_set_owner(ldns_rr_list_rr(rrset_clone, i), - wildcard_name); - } - ldns_rr_set_ttl(ldns_rr_list_rr(rrset_clone, i), orig_ttl); - /* convert to lowercase */ - ldns_rr2canonical(ldns_rr_list_rr(rrset_clone, i)); - } -} - -/** - * Make raw signature buffer out of rrsig - * @param rawsig_buf: raw signature buffer for result - * @param rrsig: signature to convert - * @return OK or more specific error. - */ -static ldns_status -ldns_rrsig2rawsig_buffer(ldns_buffer* rawsig_buf, ldns_rr* rrsig) -{ - uint8_t sig_algo = ldns_rdf2native_int8(ldns_rr_rdf(rrsig, 1)); - /* check for known and implemented algo's now (otherwise - * the function could return a wrong error - */ - /* create a buffer with signature rdata */ - /* for some algorithms we need other data than for others... */ - /* (the DSA API wants DER encoding for instance) */ - - switch(sig_algo) { - case LDNS_RSAMD5: - case LDNS_RSASHA1: - case LDNS_RSASHA1_NSEC3: -#ifdef USE_SHA2 - case LDNS_RSASHA256: - case LDNS_RSASHA512: -#endif -#ifdef USE_GOST - case LDNS_ECC_GOST: -#endif - if (ldns_rdf2buffer_wire(rawsig_buf, - ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { - return LDNS_STATUS_MEM_ERR; - } - break; - case LDNS_DSA: - case LDNS_DSA_NSEC3: - /* EVP takes rfc2459 format, which is a tad longer than dns format */ - if (ldns_convert_dsa_rrsig_rdf2asn1(rawsig_buf, - ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { - /* - if (ldns_rdf2buffer_wire(rawsig_buf, - ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { - */ - return LDNS_STATUS_MEM_ERR; - } - break; -#ifdef USE_ECDSA - case LDNS_ECDSAP256SHA256: - case LDNS_ECDSAP384SHA384: - /* EVP produces an ASN prefix on the signature, which is - * not used in the DNS */ - if (ldns_convert_ecdsa_rrsig_rdf2asn1(rawsig_buf, - ldns_rr_rdf(rrsig, 8)) != LDNS_STATUS_OK) { - return LDNS_STATUS_MEM_ERR; - } - break; -#endif - case LDNS_DH: - case LDNS_ECC: - case LDNS_INDIRECT: - return LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL; - default: - return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; - } - return LDNS_STATUS_OK; -} - -/** - * Check RRSIG timestamps against the given 'now' time. - * @param rrsig: signature to check. - * @param now: the current time in seconds epoch. - * @return status code LDNS_STATUS_OK if all is fine. - */ -static ldns_status -ldns_rrsig_check_timestamps(ldns_rr* rrsig, int32_t now) -{ - int32_t inception, expiration; - - /* check the signature time stamps */ - inception = (int32_t)ldns_rdf2native_time_t( - ldns_rr_rrsig_inception(rrsig)); - expiration = (int32_t)ldns_rdf2native_time_t( - ldns_rr_rrsig_expiration(rrsig)); - - if (expiration - inception < 0) { - /* bad sig, expiration before inception?? Tsssg */ - return LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION; - } - if (now - inception < 0) { - /* bad sig, inception date has not yet come to pass */ - return LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED; - } - if (expiration - now < 0) { - /* bad sig, expiration date has passed */ - return LDNS_STATUS_CRYPTO_SIG_EXPIRED; - } - return LDNS_STATUS_OK; -} - -/** - * Prepare for verification. - * @param rawsig_buf: raw signature buffer made ready. - * @param verify_buf: data for verification buffer made ready. - * @param rrset_clone: made ready. - * @param rrsig: signature to prepare for. - * @return LDNS_STATUS_OK is all went well. Otherwise specific error. - */ -static ldns_status -ldns_prepare_for_verify(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf, - ldns_rr_list* rrset_clone, ldns_rr* rrsig) -{ - ldns_status result; - - /* canonicalize the sig */ - ldns_dname2canonical(ldns_rr_owner(rrsig)); - - /* check if the typecovered is equal to the type checked */ - if (ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rrsig)) != - ldns_rr_get_type(ldns_rr_list_rr(rrset_clone, 0))) - return LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR; - - /* create a buffer with b64 signature rdata */ - result = ldns_rrsig2rawsig_buffer(rawsig_buf, rrsig); - if(result != LDNS_STATUS_OK) - return result; - - /* use TTL from signature. Use wildcard names for wildcards */ - /* also canonicalizes rrset_clone */ - ldns_rrset_use_signature_ttl(rrset_clone, rrsig); - - /* sort the rrset in canonical order */ - ldns_rr_list_sort(rrset_clone); - - /* put the signature rr (without the b64) to the verify_buf */ - if (ldns_rrsig2buffer_wire(verify_buf, rrsig) != LDNS_STATUS_OK) - return LDNS_STATUS_MEM_ERR; - - /* add the rrset in verify_buf */ - if(ldns_rr_list2buffer_wire(verify_buf, rrset_clone) - != LDNS_STATUS_OK) - return LDNS_STATUS_MEM_ERR; - - return LDNS_STATUS_OK; -} - -/** - * Check if a key matches a signature. - * Checks keytag, sigalgo and signature. - * @param rawsig_buf: raw signature buffer for verify - * @param verify_buf: raw data buffer for verify - * @param rrsig: the rrsig - * @param key: key to attempt. - * @return LDNS_STATUS_OK if OK, else some specific error. - */ -static ldns_status -ldns_verify_test_sig_key(ldns_buffer* rawsig_buf, ldns_buffer* verify_buf, - ldns_rr* rrsig, ldns_rr* key) -{ - uint8_t sig_algo = ldns_rdf2native_int8(ldns_rr_rdf(rrsig, 1)); - - /* before anything, check if the keytags match */ - if (ldns_calc_keytag(key) - == - ldns_rdf2native_int16(ldns_rr_rrsig_keytag(rrsig)) - ) { - ldns_buffer* key_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); - ldns_status result = LDNS_STATUS_ERR; - - /* put the key-data in a buffer, that's the third rdf, with - * the base64 encoded key data */ - if (ldns_rdf2buffer_wire(key_buf, ldns_rr_rdf(key, 3)) - != LDNS_STATUS_OK) { - ldns_buffer_free(key_buf); - /* returning is bad might screw up - good keys later in the list - what to do? */ - return LDNS_STATUS_ERR; - } - - if (sig_algo == ldns_rdf2native_int8(ldns_rr_rdf(key, 2))) { - result = ldns_verify_rrsig_buffers(rawsig_buf, - verify_buf, key_buf, sig_algo); - } else { - /* No keys with the corresponding algorithm are found */ - result = LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY; - } - - ldns_buffer_free(key_buf); - return result; - } - else { - /* No keys with the corresponding keytag are found */ - return LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY; - } -} - -/* - * to verify: - * - create the wire fmt of the b64 key rdata - * - create the wire fmt of the sorted rrset - * - create the wire fmt of the b64 sig rdata - * - create the wire fmt of the sig without the b64 rdata - * - cat the sig data (without b64 rdata) to the rrset - * - verify the rrset+sig, with the b64 data and the b64 key data - */ -ldns_status -ldns_verify_rrsig_keylist(ldns_rr_list *rrset, - ldns_rr *rrsig, - const ldns_rr_list *keys, - ldns_rr_list *good_keys) -{ - ldns_status result; - ldns_rr_list *valid = ldns_rr_list_new(); - if (!valid) - return LDNS_STATUS_MEM_ERR; - - result = ldns_verify_rrsig_keylist_notime(rrset, rrsig, keys, valid); - if(result != LDNS_STATUS_OK) { - ldns_rr_list_free(valid); - return result; - } - - /* check timestamps last; its OK except time */ - result = ldns_rrsig_check_timestamps(rrsig, (int32_t)time(NULL)); - if(result != LDNS_STATUS_OK) { - ldns_rr_list_free(valid); - return result; - } - - ldns_rr_list_cat(good_keys, valid); - ldns_rr_list_free(valid); - return LDNS_STATUS_OK; -} - -ldns_status -ldns_verify_rrsig_keylist_notime(ldns_rr_list *rrset, - ldns_rr *rrsig, - const ldns_rr_list *keys, - ldns_rr_list *good_keys) -{ - ldns_buffer *rawsig_buf; - ldns_buffer *verify_buf; - uint16_t i; - ldns_status result, status; - ldns_rr_list *rrset_clone; - ldns_rr_list *validkeys; - - if (!rrset) { - return LDNS_STATUS_ERR; - } - - validkeys = ldns_rr_list_new(); - if (!validkeys) { - return LDNS_STATUS_MEM_ERR; - } - - /* clone the rrset so that we can fiddle with it */ - rrset_clone = ldns_rr_list_clone(rrset); - - /* create the buffers which will certainly hold the raw data */ - rawsig_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); - verify_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); - - result = ldns_prepare_for_verify(rawsig_buf, verify_buf, - rrset_clone, rrsig); - if(result != LDNS_STATUS_OK) { - ldns_buffer_free(verify_buf); - ldns_buffer_free(rawsig_buf); - ldns_rr_list_deep_free(rrset_clone); - ldns_rr_list_free(validkeys); - return result; - } - - result = LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY; - for(i = 0; i < ldns_rr_list_rr_count(keys); i++) { - status = ldns_verify_test_sig_key(rawsig_buf, verify_buf, - rrsig, ldns_rr_list_rr(keys, i)); - if (status == LDNS_STATUS_OK) { - /* one of the keys has matched, don't break - * here, instead put the 'winning' key in - * the validkey list and return the list - * later */ - if (!ldns_rr_list_push_rr(validkeys, - ldns_rr_list_rr(keys,i))) { - /* couldn't push the key?? */ - ldns_buffer_free(rawsig_buf); - ldns_buffer_free(verify_buf); - ldns_rr_list_deep_free(rrset_clone); - ldns_rr_list_free(validkeys); - return LDNS_STATUS_MEM_ERR; - } - - result = status; - } - - if (result == LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY) { - result = status; - } - } - - /* no longer needed */ - ldns_rr_list_deep_free(rrset_clone); - ldns_buffer_free(rawsig_buf); - ldns_buffer_free(verify_buf); - - if (ldns_rr_list_rr_count(validkeys) == 0) { - /* no keys were added, return last error */ - ldns_rr_list_free(validkeys); - return result; - } - - /* do not check timestamps */ - - ldns_rr_list_cat(good_keys, validkeys); - ldns_rr_list_free(validkeys); - return LDNS_STATUS_OK; -} - -ldns_status -ldns_verify_rrsig(ldns_rr_list *rrset, ldns_rr *rrsig, ldns_rr *key) -{ - ldns_buffer *rawsig_buf; - ldns_buffer *verify_buf; - ldns_status result; - ldns_rr_list *rrset_clone; - - if (!rrset) { - return LDNS_STATUS_NO_DATA; - } - /* clone the rrset so that we can fiddle with it */ - rrset_clone = ldns_rr_list_clone(rrset); - /* create the buffers which will certainly hold the raw data */ - rawsig_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); - verify_buf = ldns_buffer_new(LDNS_MAX_PACKETLEN); - - result = ldns_prepare_for_verify(rawsig_buf, verify_buf, - rrset_clone, rrsig); - if(result != LDNS_STATUS_OK) { - ldns_rr_list_deep_free(rrset_clone); - ldns_buffer_free(rawsig_buf); - ldns_buffer_free(verify_buf); - return result; - } - result = ldns_verify_test_sig_key(rawsig_buf, verify_buf, - rrsig, key); - /* no longer needed */ - ldns_rr_list_deep_free(rrset_clone); - ldns_buffer_free(rawsig_buf); - ldns_buffer_free(verify_buf); - - /* check timestamp last, apart from time its OK */ - if(result == LDNS_STATUS_OK) - result = ldns_rrsig_check_timestamps(rrsig, - (int32_t)time(NULL)); - - return result; -} - -ldns_status -ldns_verify_rrsig_evp(ldns_buffer *sig, - ldns_buffer *rrset, - EVP_PKEY *key, - const EVP_MD *digest_type) -{ - return ldns_verify_rrsig_evp_raw( - (unsigned char*)ldns_buffer_begin(sig), - ldns_buffer_position(sig), - rrset, - key, - digest_type); -} - -ldns_status -ldns_verify_rrsig_evp_raw(unsigned char *sig, size_t siglen, - ldns_buffer *rrset, EVP_PKEY *key, const EVP_MD *digest_type) -{ - EVP_MD_CTX ctx; - int res; - - EVP_MD_CTX_init(&ctx); - - EVP_VerifyInit(&ctx, digest_type); - EVP_VerifyUpdate(&ctx, - ldns_buffer_begin(rrset), - ldns_buffer_position(rrset)); - res = EVP_VerifyFinal(&ctx, sig, (unsigned int) siglen, key); - - EVP_MD_CTX_cleanup(&ctx); - - if (res == 1) { - return LDNS_STATUS_OK; - } else if (res == 0) { - return LDNS_STATUS_CRYPTO_BOGUS; - } - /* TODO how to communicate internal SSL error? - let caller use ssl's get_error() */ - return LDNS_STATUS_SSL_ERR; -} - -ldns_status -ldns_verify_rrsig_dsa(ldns_buffer *sig, ldns_buffer *rrset, ldns_buffer *key) -{ - return ldns_verify_rrsig_dsa_raw( - (unsigned char*) ldns_buffer_begin(sig), - ldns_buffer_position(sig), - rrset, - (unsigned char*) ldns_buffer_begin(key), - ldns_buffer_position(key)); -} - -ldns_status -ldns_verify_rrsig_rsasha1(ldns_buffer *sig, ldns_buffer *rrset, ldns_buffer *key) -{ - return ldns_verify_rrsig_rsasha1_raw( - (unsigned char*)ldns_buffer_begin(sig), - ldns_buffer_position(sig), - rrset, - (unsigned char*) ldns_buffer_begin(key), - ldns_buffer_position(key)); -} - -ldns_status -ldns_verify_rrsig_rsamd5(ldns_buffer *sig, ldns_buffer *rrset, ldns_buffer *key) -{ - return ldns_verify_rrsig_rsamd5_raw( - (unsigned char*)ldns_buffer_begin(sig), - ldns_buffer_position(sig), - rrset, - (unsigned char*) ldns_buffer_begin(key), - ldns_buffer_position(key)); -} - -ldns_status -ldns_verify_rrsig_dsa_raw(unsigned char* sig, size_t siglen, - ldns_buffer* rrset, unsigned char* key, size_t keylen) -{ - EVP_PKEY *evp_key; - ldns_status result; - - evp_key = EVP_PKEY_new(); - EVP_PKEY_assign_DSA(evp_key, ldns_key_buf2dsa_raw(key, keylen)); - result = ldns_verify_rrsig_evp_raw(sig, - siglen, - rrset, - evp_key, - EVP_dss1()); - EVP_PKEY_free(evp_key); - return result; - -} - -ldns_status -ldns_verify_rrsig_rsasha1_raw(unsigned char* sig, size_t siglen, - ldns_buffer* rrset, unsigned char* key, size_t keylen) -{ - EVP_PKEY *evp_key; - ldns_status result; - - evp_key = EVP_PKEY_new(); - EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); - result = ldns_verify_rrsig_evp_raw(sig, - siglen, - rrset, - evp_key, - EVP_sha1()); - EVP_PKEY_free(evp_key); - - return result; -} - -ldns_status -ldns_verify_rrsig_rsasha256_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen) -{ -#ifdef USE_SHA2 - EVP_PKEY *evp_key; - ldns_status result; - - evp_key = EVP_PKEY_new(); - EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); - result = ldns_verify_rrsig_evp_raw(sig, - siglen, - rrset, - evp_key, - EVP_sha256()); - EVP_PKEY_free(evp_key); - - return result; -#else - /* touch these to prevent compiler warnings */ - (void) sig; - (void) siglen; - (void) rrset; - (void) key; - (void) keylen; - return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; -#endif -} - -ldns_status -ldns_verify_rrsig_rsasha512_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen) -{ -#ifdef USE_SHA2 - EVP_PKEY *evp_key; - ldns_status result; - - evp_key = EVP_PKEY_new(); - EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); - result = ldns_verify_rrsig_evp_raw(sig, - siglen, - rrset, - evp_key, - EVP_sha512()); - EVP_PKEY_free(evp_key); - - return result; -#else - /* touch these to prevent compiler warnings */ - (void) sig; - (void) siglen; - (void) rrset; - (void) key; - (void) keylen; - return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; -#endif -} - - -ldns_status -ldns_verify_rrsig_rsamd5_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen) -{ - EVP_PKEY *evp_key; - ldns_status result; - - evp_key = EVP_PKEY_new(); - EVP_PKEY_assign_RSA(evp_key, ldns_key_buf2rsa_raw(key, keylen)); - result = ldns_verify_rrsig_evp_raw(sig, - siglen, - rrset, - evp_key, - EVP_md5()); - EVP_PKEY_free(evp_key); - - return result; -} - -#endif diff --git a/libs/ldns/dnssec_zone.c b/libs/ldns/dnssec_zone.c deleted file mode 100644 index e2a5fce6ed..0000000000 --- a/libs/ldns/dnssec_zone.c +++ /dev/null @@ -1,836 +0,0 @@ -/* - * special zone file structures and functions for better dnssec handling - */ - -#include - -#include - -ldns_dnssec_rrs * -ldns_dnssec_rrs_new() -{ - ldns_dnssec_rrs *new_rrs; - new_rrs = LDNS_MALLOC(ldns_dnssec_rrs); - if(!new_rrs) return NULL; - new_rrs->rr = NULL; - new_rrs->next = NULL; - return new_rrs; -} - -INLINE void -ldns_dnssec_rrs_free_internal(ldns_dnssec_rrs *rrs, int deep) -{ - ldns_dnssec_rrs *next; - while (rrs) { - next = rrs->next; - if (deep) { - ldns_rr_free(rrs->rr); - } - LDNS_FREE(rrs); - rrs = next; - } -} - -void -ldns_dnssec_rrs_free(ldns_dnssec_rrs *rrs) -{ - ldns_dnssec_rrs_free_internal(rrs, 0); -} - -void -ldns_dnssec_rrs_deep_free(ldns_dnssec_rrs *rrs) -{ - ldns_dnssec_rrs_free_internal(rrs, 1); -} - -ldns_status -ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr) -{ - int cmp; - ldns_dnssec_rrs *new_rrs; - if (!rrs || !rr) { - return LDNS_STATUS_ERR; - } - - /* this could be done more efficiently; name and type should already - be equal */ - cmp = ldns_rr_compare(rrs->rr, - rr); - /* should we error on equal? */ - if (cmp <= 0) { - if (rrs->next) { - return ldns_dnssec_rrs_add_rr(rrs->next, rr); - } else { - new_rrs = ldns_dnssec_rrs_new(); - new_rrs->rr = rr; - rrs->next = new_rrs; - } - } else if (cmp > 0) { - /* put the current old rr in the new next, put the new - rr in the current container */ - new_rrs = ldns_dnssec_rrs_new(); - new_rrs->rr = rrs->rr; - new_rrs->next = rrs->next; - rrs->rr = rr; - rrs->next = new_rrs; - } - return LDNS_STATUS_OK; -} - -void -ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs) -{ - if (!rrs) { - fprintf(out, ""); - } else { - if (rrs->rr) { - ldns_rr_print(out, rrs->rr); - } - if (rrs->next) { - ldns_dnssec_rrs_print(out, rrs->next); - } - } -} - -ldns_dnssec_rrsets * -ldns_dnssec_rrsets_new() -{ - ldns_dnssec_rrsets *new_rrsets; - new_rrsets = LDNS_MALLOC(ldns_dnssec_rrsets); - if(!new_rrsets) return NULL; - new_rrsets->rrs = NULL; - new_rrsets->type = 0; - new_rrsets->signatures = NULL; - new_rrsets->next = NULL; - return new_rrsets; -} - -INLINE void -ldns_dnssec_rrsets_free_internal(ldns_dnssec_rrsets *rrsets, int deep) -{ - if (rrsets) { - if (rrsets->rrs) { - ldns_dnssec_rrs_free_internal(rrsets->rrs, deep); - } - if (rrsets->next) { - ldns_dnssec_rrsets_free_internal(rrsets->next, deep); - } - if (rrsets->signatures) { - ldns_dnssec_rrs_free_internal(rrsets->signatures, deep); - } - LDNS_FREE(rrsets); - } -} - -void -ldns_dnssec_rrsets_free(ldns_dnssec_rrsets *rrsets) -{ - ldns_dnssec_rrsets_free_internal(rrsets, 0); -} - -void -ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets) -{ - ldns_dnssec_rrsets_free_internal(rrsets, 1); -} - -ldns_rr_type -ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets) -{ - if (rrsets) { - return rrsets->type; - } else { - return 0; - } -} - -ldns_status -ldns_dnssec_rrsets_set_type(ldns_dnssec_rrsets *rrsets, - ldns_rr_type type) -{ - if (rrsets) { - rrsets->type = type; - return LDNS_STATUS_OK; - } - return LDNS_STATUS_ERR; -} - -ldns_dnssec_rrsets * -ldns_dnssec_rrsets_new_frm_rr(ldns_rr *rr) -{ - ldns_dnssec_rrsets *new_rrsets; - ldns_rr_type rr_type; - bool rrsig; - - new_rrsets = ldns_dnssec_rrsets_new(); - rr_type = ldns_rr_get_type(rr); - if (rr_type == LDNS_RR_TYPE_RRSIG) { - rrsig = true; - rr_type = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); - } else { - rrsig = false; - } - if (!rrsig) { - new_rrsets->rrs = ldns_dnssec_rrs_new(); - new_rrsets->rrs->rr = rr; - } else { - new_rrsets->signatures = ldns_dnssec_rrs_new(); - new_rrsets->signatures->rr = rr; - } - new_rrsets->type = rr_type; - return new_rrsets; -} - -ldns_status -ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr) -{ - ldns_dnssec_rrsets *new_rrsets; - ldns_rr_type rr_type; - bool rrsig = false; - ldns_status result = LDNS_STATUS_OK; - - if (!rrsets || !rr) { - return LDNS_STATUS_ERR; - } - - rr_type = ldns_rr_get_type(rr); - - if (rr_type == LDNS_RR_TYPE_RRSIG) { - rrsig = true; - rr_type = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); - } - - if (!rrsets->rrs && rrsets->type == 0 && !rrsets->signatures) { - if (!rrsig) { - rrsets->rrs = ldns_dnssec_rrs_new(); - rrsets->rrs->rr = rr; - rrsets->type = rr_type; - } else { - rrsets->signatures = ldns_dnssec_rrs_new(); - rrsets->signatures->rr = rr; - rrsets->type = rr_type; - } - return LDNS_STATUS_OK; - } - - if (rr_type > ldns_dnssec_rrsets_type(rrsets)) { - if (rrsets->next) { - result = ldns_dnssec_rrsets_add_rr(rrsets->next, rr); - } else { - new_rrsets = ldns_dnssec_rrsets_new_frm_rr(rr); - rrsets->next = new_rrsets; - } - } else if (rr_type < ldns_dnssec_rrsets_type(rrsets)) { - /* move the current one into the new next, - replace field of current with data from new rr */ - new_rrsets = ldns_dnssec_rrsets_new(); - new_rrsets->rrs = rrsets->rrs; - new_rrsets->type = rrsets->type; - new_rrsets->signatures = rrsets->signatures; - new_rrsets->next = rrsets->next; - if (!rrsig) { - rrsets->rrs = ldns_dnssec_rrs_new(); - rrsets->rrs->rr = rr; - rrsets->signatures = NULL; - } else { - rrsets->rrs = NULL; - rrsets->signatures = ldns_dnssec_rrs_new(); - rrsets->signatures->rr = rr; - } - rrsets->type = rr_type; - rrsets->next = new_rrsets; - } else { - /* equal, add to current rrsets */ - if (rrsig) { - if (rrsets->signatures) { - result = ldns_dnssec_rrs_add_rr(rrsets->signatures, rr); - } else { - rrsets->signatures = ldns_dnssec_rrs_new(); - rrsets->signatures->rr = rr; - } - } else { - if (rrsets->rrs) { - result = ldns_dnssec_rrs_add_rr(rrsets->rrs, rr); - } else { - rrsets->rrs = ldns_dnssec_rrs_new(); - rrsets->rrs->rr = rr; - } - } - } - - return result; -} - -void -ldns_dnssec_rrsets_print_soa(FILE *out, - ldns_dnssec_rrsets *rrsets, - bool follow, - bool show_soa) -{ - if (!rrsets) { - fprintf(out, "\n"); - } else { - if (rrsets->rrs && - (show_soa || - ldns_rr_get_type(rrsets->rrs->rr) != LDNS_RR_TYPE_SOA - ) - ) { - ldns_dnssec_rrs_print(out, rrsets->rrs); - if (rrsets->signatures) { - ldns_dnssec_rrs_print(out, rrsets->signatures); - } - } - if (follow && rrsets->next) { - ldns_dnssec_rrsets_print_soa(out, rrsets->next, follow, show_soa); - } - } -} - -void -ldns_dnssec_rrsets_print(FILE *out, ldns_dnssec_rrsets *rrsets, bool follow) -{ - ldns_dnssec_rrsets_print_soa(out, rrsets, follow, true); -} - -ldns_dnssec_name * -ldns_dnssec_name_new() -{ - ldns_dnssec_name *new_name; - - new_name = LDNS_MALLOC(ldns_dnssec_name); - if (!new_name) { - return NULL; - } - - new_name->name = NULL; - new_name->rrsets = NULL; - new_name->name_alloced = false; - new_name->nsec = NULL; - new_name->nsec_signatures = NULL; - - new_name->is_glue = false; - new_name->hashed_name = NULL; - - return new_name; -} - -ldns_dnssec_name * -ldns_dnssec_name_new_frm_rr(ldns_rr *rr) -{ - ldns_dnssec_name *new_name = ldns_dnssec_name_new(); - - new_name->name = ldns_rr_owner(rr); - if(ldns_dnssec_name_add_rr(new_name, rr) != LDNS_STATUS_OK) { - ldns_dnssec_name_free(new_name); - return NULL; - } - - return new_name; -} - -INLINE void -ldns_dnssec_name_free_internal(ldns_dnssec_name *name, - int deep) -{ - if (name) { - if (name->name_alloced) { - ldns_rdf_deep_free(name->name); - } - if (name->rrsets) { - ldns_dnssec_rrsets_free_internal(name->rrsets, deep); - } - if (name->nsec && deep) { - ldns_rr_free(name->nsec); - } - if (name->nsec_signatures) { - ldns_dnssec_rrs_free_internal(name->nsec_signatures, deep); - } - if (name->hashed_name) { - if (deep) { - ldns_rdf_deep_free(name->hashed_name); - } - } - LDNS_FREE(name); - } -} - -void -ldns_dnssec_name_free(ldns_dnssec_name *name) -{ - ldns_dnssec_name_free_internal(name, 0); -} - -void -ldns_dnssec_name_deep_free(ldns_dnssec_name *name) -{ - ldns_dnssec_name_free_internal(name, 1); -} - -ldns_rdf * -ldns_dnssec_name_name(ldns_dnssec_name *name) -{ - if (name) { - return name->name; - } - return NULL; -} - -void -ldns_dnssec_name_set_name(ldns_dnssec_name *rrset, - ldns_rdf *dname) -{ - if (rrset && dname) { - rrset->name = dname; - } -} - -ldns_rr * -ldns_dnssec_name_nsec(ldns_dnssec_name *rrset) -{ - if (rrset) { - return rrset->nsec; - } - return NULL; -} - -void -ldns_dnssec_name_set_nsec(ldns_dnssec_name *rrset, ldns_rr *nsec) -{ - if (rrset && nsec) { - rrset->nsec = nsec; - } -} - -int -ldns_dnssec_name_cmp(const void *a, const void *b) -{ - ldns_dnssec_name *na = (ldns_dnssec_name *) a; - ldns_dnssec_name *nb = (ldns_dnssec_name *) b; - - if (na && nb) { - return ldns_dname_compare(ldns_dnssec_name_name(na), - ldns_dnssec_name_name(nb)); - } else if (na) { - return 1; - } else if (nb) { - return -1; - } else { - return 0; - } -} - -ldns_status -ldns_dnssec_name_add_rr(ldns_dnssec_name *name, - ldns_rr *rr) -{ - ldns_status result = LDNS_STATUS_OK; - ldns_rdf *name_name; - bool hashed_name = false; - ldns_rr_type rr_type; - ldns_rr_type typecovered = 0; - - /* special handling for NSEC3 and NSECX covering RRSIGS */ - - if (!name || !rr) { - return LDNS_STATUS_ERR; - } - - rr_type = ldns_rr_get_type(rr); - - if (rr_type == LDNS_RR_TYPE_RRSIG) { - typecovered = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); - } - -#ifdef HAVE_SSL - if (rr_type == LDNS_RR_TYPE_NSEC3 || - typecovered == LDNS_RR_TYPE_NSEC3) { - name_name = ldns_nsec3_hash_name_frm_nsec3(rr, - ldns_dnssec_name_name(name)); - hashed_name = true; - } else { - name_name = ldns_dnssec_name_name(name); - } -#else - name_name = ldns_dnssec_name_name(name); -#endif /* HAVE_SSL */ - - if (rr_type == LDNS_RR_TYPE_NSEC || - rr_type == LDNS_RR_TYPE_NSEC3) { - /* XX check if is already set (and error?) */ - name->nsec = rr; - } else if (typecovered == LDNS_RR_TYPE_NSEC || - typecovered == LDNS_RR_TYPE_NSEC3) { - if (name->nsec_signatures) { - result = ldns_dnssec_rrs_add_rr(name->nsec_signatures, rr); - } else { - name->nsec_signatures = ldns_dnssec_rrs_new(); - name->nsec_signatures->rr = rr; - } - } else { - /* it's a 'normal' RR, add it to the right rrset */ - if (name->rrsets) { - result = ldns_dnssec_rrsets_add_rr(name->rrsets, rr); - } else { - name->rrsets = ldns_dnssec_rrsets_new(); - result = ldns_dnssec_rrsets_add_rr(name->rrsets, rr); - } - } - - if (hashed_name) { - ldns_rdf_deep_free(name_name); - } - - return result; -} - -ldns_dnssec_rrsets * -ldns_dnssec_name_find_rrset(ldns_dnssec_name *name, - ldns_rr_type type) { - ldns_dnssec_rrsets *result; - - result = name->rrsets; - while (result) { - if (result->type == type) { - return result; - } else { - result = result->next; - } - } - return NULL; -} - -ldns_dnssec_rrsets * -ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone, - ldns_rdf *dname, - ldns_rr_type type) -{ - ldns_rbnode_t *node; - - if (!zone || !dname) { - return NULL; - } - - node = ldns_rbtree_search(zone->names, dname); - if (node) { - return ldns_dnssec_name_find_rrset((ldns_dnssec_name *)node->data, - type); - } else { - return NULL; - } -} - -void -ldns_dnssec_name_print_soa(FILE *out, ldns_dnssec_name *name, bool show_soa) -{ - if (name) { - if(name->rrsets) { - ldns_dnssec_rrsets_print_soa(out, name->rrsets, true, show_soa); - } else { - fprintf(out, ";; Empty nonterminal: "); - ldns_rdf_print(out, name->name); - fprintf(out, "\n"); - } - if(name->nsec) { - ldns_rr_print(out, name->nsec); - } - if (name->nsec_signatures) { - ldns_dnssec_rrs_print(out, name->nsec_signatures); - } - } else { - fprintf(out, "\n"); - } -} - -void -ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name) -{ - ldns_dnssec_name_print_soa(out, name, true); -} - -ldns_dnssec_zone * -ldns_dnssec_zone_new() -{ - ldns_dnssec_zone *zone = LDNS_MALLOC(ldns_dnssec_zone); - if(!zone) return NULL; - zone->soa = NULL; - zone->names = NULL; - - return zone; -} - -void -ldns_dnssec_name_node_free(ldns_rbnode_t *node, void *arg) { - (void) arg; - ldns_dnssec_name_free((ldns_dnssec_name *)node->data); - free(node); -} - -void -ldns_dnssec_name_node_deep_free(ldns_rbnode_t *node, void *arg) { - (void) arg; - ldns_dnssec_name_deep_free((ldns_dnssec_name *)node->data); - free(node); -} - -void -ldns_dnssec_zone_free(ldns_dnssec_zone *zone) -{ - if (zone) { - if (zone->names) { - /* destroy all name structures within the tree */ - ldns_traverse_postorder(zone->names, - ldns_dnssec_name_node_free, - NULL); - free(zone->names); - } - LDNS_FREE(zone); - } -} - -void -ldns_dnssec_zone_deep_free(ldns_dnssec_zone *zone) -{ - if (zone) { - if (zone->names) { - /* destroy all name structures within the tree */ - ldns_traverse_postorder(zone->names, - ldns_dnssec_name_node_deep_free, - NULL); - free(zone->names); - } - LDNS_FREE(zone); - } -} - -/* use for dname comparison in tree */ -int -ldns_dname_compare_v(const void *a, const void *b) { - return ldns_dname_compare((ldns_rdf *)a, (ldns_rdf *)b); -} - -#ifdef HAVE_SSL -ldns_rbnode_t * -ldns_dnssec_zone_find_nsec3_original(ldns_dnssec_zone *zone, - ldns_rr *rr) { - ldns_rbnode_t *current_node = ldns_rbtree_first(zone->names); - ldns_dnssec_name *current_name; - ldns_rdf *hashed_name; - - hashed_name = ldns_dname_label(ldns_rr_owner(rr), 0); - - while (current_node != LDNS_RBTREE_NULL) { - current_name = (ldns_dnssec_name *) current_node->data; - if (!current_name->hashed_name) { - current_name->hashed_name = - ldns_nsec3_hash_name_frm_nsec3(rr, current_name->name); - } - if (ldns_dname_compare(hashed_name, - current_name->hashed_name) - == 0) { - ldns_rdf_deep_free(hashed_name); - return current_node; - } - current_node = ldns_rbtree_next(current_node); - } - ldns_rdf_deep_free(hashed_name); - return NULL; -} - -ldns_status -ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, ldns_rr *rr) -{ - ldns_status result = LDNS_STATUS_OK; - ldns_dnssec_name *cur_name; - ldns_rbnode_t *cur_node; - ldns_rr_type type_covered = 0; - - if (!zone || !rr) { - return LDNS_STATUS_ERR; - } - - if (!zone->names) { - zone->names = ldns_rbtree_create(ldns_dname_compare_v); - if(!zone->names) return LDNS_STATUS_MEM_ERR; - } - - /* we need the original of the hashed name if this is - an NSEC3, or an RRSIG that covers an NSEC3 */ - if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_RRSIG) { - type_covered = ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(rr)); - } - if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_NSEC3 || - type_covered == LDNS_RR_TYPE_NSEC3) { - cur_node = ldns_dnssec_zone_find_nsec3_original(zone, - rr); - if (!cur_node) { - return LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND; - } - } else { - cur_node = ldns_rbtree_search(zone->names, ldns_rr_owner(rr)); - } - - if (!cur_node) { - /* add */ - cur_name = ldns_dnssec_name_new_frm_rr(rr); - if(!cur_name) return LDNS_STATUS_MEM_ERR; - cur_node = LDNS_MALLOC(ldns_rbnode_t); - if(!cur_node) { - ldns_dnssec_name_free(cur_name); - return LDNS_STATUS_MEM_ERR; - } - cur_node->key = ldns_rr_owner(rr); - cur_node->data = cur_name; - (void)ldns_rbtree_insert(zone->names, cur_node); - } else { - cur_name = (ldns_dnssec_name *) cur_node->data; - result = ldns_dnssec_name_add_rr(cur_name, rr); - } - - if (result != LDNS_STATUS_OK) { - fprintf(stderr, "error adding rr: "); - ldns_rr_print(stderr, rr); - } - - /*TODO ldns_dnssec_name_print_names(stdout, zone->names, 0);*/ - if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { - zone->soa = cur_name; - } - - return result; -} -#endif /* HAVE_SSL */ - -void -ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa) -{ - ldns_rbnode_t *node; - ldns_dnssec_name *name; - - node = ldns_rbtree_first(tree); - while (node != LDNS_RBTREE_NULL) { - name = (ldns_dnssec_name *) node->data; - ldns_dnssec_name_print_soa(out, name, print_soa); - fprintf(out, ";\n"); - node = ldns_rbtree_next(node); - } -} - -void -ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone) -{ - if (zone) { - if (zone->soa) { - fprintf(out, ";; Zone: "); - ldns_rdf_print(out, ldns_dnssec_name_name(zone->soa)); - fprintf(out, "\n;\n"); - ldns_dnssec_rrsets_print( - out, - ldns_dnssec_name_find_rrset(zone->soa, - LDNS_RR_TYPE_SOA), - false); - fprintf(out, ";\n"); - } - - if (zone->names) { - ldns_dnssec_zone_names_print(out, zone->names, false); - } - } -} - -ldns_status -ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone) -{ - ldns_dnssec_name *new_name; - ldns_rdf *cur_name; - ldns_rdf *next_name; - ldns_rbnode_t *cur_node, *next_node, *new_node; - - /* for the detection */ - uint16_t i, cur_label_count, next_label_count; - uint16_t soa_label_count = 0; - ldns_rdf *l1, *l2; - int lpos; - - if (!zone) { - return LDNS_STATUS_ERR; - } - if (zone->soa && zone->soa->name) { - soa_label_count = ldns_dname_label_count(zone->soa->name); - } - - cur_node = ldns_rbtree_first(zone->names); - while (cur_node != LDNS_RBTREE_NULL) { - next_node = ldns_rbtree_next(cur_node); - - /* skip glue */ - while (next_node != LDNS_RBTREE_NULL && - next_node->data && - ((ldns_dnssec_name *)next_node->data)->is_glue - ) { - next_node = ldns_rbtree_next(next_node); - } - - if (next_node == LDNS_RBTREE_NULL) { - next_node = ldns_rbtree_first(zone->names); - } - - cur_name = ((ldns_dnssec_name *)cur_node->data)->name; - next_name = ((ldns_dnssec_name *)next_node->data)->name; - cur_label_count = ldns_dname_label_count(cur_name); - next_label_count = ldns_dname_label_count(next_name); - - /* Since the names are in canonical order, we can - * recognize empty non-terminals by their labels; - * every label after the first one on the next owner - * name is a non-terminal if it either does not exist - * in the current name or is different from the same - * label in the current name (counting from the end) - */ - for (i = 1; i < next_label_count - soa_label_count; i++) { - lpos = (int)cur_label_count - (int)next_label_count + (int)i; - if (lpos >= 0) { - l1 = ldns_dname_label(cur_name, (uint8_t)lpos); - } else { - l1 = NULL; - } - l2 = ldns_dname_label(next_name, i); - - if (!l1 || ldns_dname_compare(l1, l2) != 0) { - /* We have an empty nonterminal, add it to the - * tree - */ - new_name = ldns_dnssec_name_new(); - if (!new_name) { - return LDNS_STATUS_MEM_ERR; - } - new_name->name = ldns_dname_clone_from(next_name, - i); - if (!new_name) { - ldns_dnssec_name_free(new_name); - return LDNS_STATUS_MEM_ERR; - } - new_name->name_alloced = true; - new_node = LDNS_MALLOC(ldns_rbnode_t); - if (!new_node) { - ldns_dnssec_name_free(new_name); - return LDNS_STATUS_MEM_ERR; - } - new_node->key = new_name->name; - new_node->data = new_name; - (void)ldns_rbtree_insert(zone->names, new_node); - } - ldns_rdf_deep_free(l1); - ldns_rdf_deep_free(l2); - } - - /* we might have inserted a new node after - * the current one so we can't just use next() - */ - if (next_node != ldns_rbtree_first(zone->names)) { - cur_node = next_node; - } else { - cur_node = LDNS_RBTREE_NULL; - } - } - return LDNS_STATUS_OK; -} diff --git a/libs/ldns/doc/API-header.xml b/libs/ldns/doc/API-header.xml deleted file mode 100644 index a4cd081bee..0000000000 --- a/libs/ldns/doc/API-header.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - -LibDNS API - - NLnet Labs -
- - Kruislaan 419 - Amsterdam - 1098 VA - The Netherlands - - miek@nlnetlabs.nl - http://www.nlnetlabs.nl -
-
- - NLnet Labs -
- - Kruislaan 419 - Amsterdam - 1098 VA - The Netherlands - - jelte@nlnetlabs.nl - http://www.nlnetlabs.nl -
-
- - NLnet Labs -
- - Kruislaan 419 - Amsterdam - 1098 VA - The Netherlands - - erik@nlnetlabs.nl - http://www.nlnetlabs.nl -
-
- -DNS -Elite -Hacking - - -A small abstract will come here, TBD. - - -
- - - -
- -LibDNS (or lDNS) is modelled after the Net::DNS perl library. It has -been shown that Net::DNS can be used vefficiently for -programming DNS aware applications. We want to bring the same -level of efficiency to C programmers. - - -The lDNS API consist of two layers. The top-layer, this is -what is actually exported to the application via the library. And the -bottom-layer, this is what lDNS needs to compile and function. - -
- -
- -Short intermezzo detailing differences with other libraries. Most important -ones are the libc resolver interface (from BIND8) and the lwres_ interface -from BIND9. - -
- -
- -At its lowest level lDNS is only dependent on libc. It uses a -few networking systems calls; socket, bind, send/recv and friends. - - -Further more it is to be expected that lDNS will depend on OpenSSL for -its cryptography. - - -As said, lDNS is modelled after Net::DNS, therefor its application API -looks very much like the one used for Net::DNS. Some modification are made -ofcourse, because not all functionality of Perl can be caught in C. - - - -This API document was written by carefully looking at the documentation -contained in the Net::DNS Perl module. - -
diff --git a/libs/ldns/doc/API.xml b/libs/ldns/doc/API.xml deleted file mode 100644 index 07007b9a29..0000000000 --- a/libs/ldns/doc/API.xml +++ /dev/null @@ -1,462 +0,0 @@ - - - - - - - - - - - - - - -LibDNS API - - NLnet Labs -
- - Kruislaan 419 - Amsterdam - 1098 VA - The Netherlands - - miek@nlnetlabs.nl - http://www.nlnetlabs.nl -
-
- - NLnet Labs -
- - Kruislaan 419 - Amsterdam - 1098 VA - The Netherlands - - jelte@nlnetlabs.nl - http://www.nlnetlabs.nl -
-
- - NLnet Labs -
- - Kruislaan 419 - Amsterdam - 1098 VA - The Netherlands - - erik@nlnetlabs.nl - http://www.nlnetlabs.nl -
-
- -DNS -Elite -Hacking - - -A small abstract will come here, TBD. - - -
- - - -
- -LibDNS (or lDNS) is modelled after the Net::DNS perl library. It has -been shown that Net::DNS can be used vefficiently for -programming DNS aware applications. We want to bring the same -level of efficiency to C programmers. - - -The lDNS API consist of two layers. The top-layer, this is -what is actually exported to the application via the library. And the -bottom-layer, this is what lDNS needs to compile and function. - -
- -
- -Short intermezzo detailing differences with other libraries. Most important -ones are the libc resolver interface (from BIND8) and the lwres_ interface -from BIND9. - -
- -
- -At its lowest level lDNS is only dependent on libc. It uses a -few networking systems calls; socket, bind, send/recv and friends. - - -Further more it is to be expected that lDNS will depend on OpenSSL for -its cryptography. - - -As said, lDNS is modelled after Net::DNS, therefor its application API -looks very much like the one used for Net::DNS. Some modification are made -ofcourse, because not all functionality of Perl can be caught in C. - - - -This API document was written by carefully looking at the documentation -contained in the Net::DNS Perl module. - -
- -
- -The rdf structure, the RData Field, is a type that contains the different -types in the rdata of an RR. Consider the following example: - -example.com. IN MX 10 mx.example.com. - -The "10 mx.example.com." is the rdata in this case. It consists of two -fields, "10" and "mx.example.com". These have the types (in this case) -LDNS_RDF_TYPE_INT8 and LDNS_RDF_TYPE_DNAME. - - -The following functions operate on this structure. - - - - -Create a new rdf structure. Return a pointer to it. - - -Get the size of a rdf structure. - - -Set the size of a rdf structure. - - -Set the type of a rdf structure. - - -Get the type of a rdf structure. - - -Set the (binary/network order) data of a rdf structure. - - -Get a pointer to the data in a rdf structure. - - -Free a rdf structure. - - -Create a new rdf structure from a string and a specific rdf_type. -The type is needed to perform the correct conversion. - - - -
- -
- -These functions operate on ldns_rr structures. - - - - -Returns a pointer to the newly created ldns_rr structure. - - -Prints the record to the stream s. - - -Returns a pointer to a ldns_buffer containing with string containing -RR-specific data. - - -Returns the record's owner name as a ldns_rdf type. - - -Returns the record's type. - - -Returns the record's class. - - -Returns the record's time-to-live (TTL). - - - - - -TODO the 'set' functions of the 'get' - -
- -
- -In the DNS the atomic data type is an RRset. This is a list -of RRs with the same ownername, type and class. Net::DNS doesn't -have rrsets as a seperate object. - - -In lDNS we have the ldns_rr_list, which just holds a bunch of RR's. -No specific check are made on the RRs that can be put in such a list. -Special wrapper functions exist which allow the usage of ldns_rr_list -of real (RFC compliant) RR sets. - - -TODO: See rr.c - -
- -
- - - -Create a new resolver structure and return the pointer to that. - - -Returns the version of lDNS. - - -Returns a ldns_pkt representing the MX records -for the specified dname. Function is documented differently in Net::DNS. -Do we need stuff like this?? XXX - - - Set the default domain for this resolver. This domain is added - when a query is made with a name without a trailing dot. - - - - -Add a new nameserver to the resolver. These nameservers are queried - when a search() or query() is done. - - - - Add a domain to the searchlist of a resolver. - - - Perform a query. Try all the nameservers in the *res structure. Apply - the search list. And default domain. -If type is NULL it defaults to 'A', -If class is NULL it default to 'IN'. - - -Perform a query. Only the default domain is added. -If type is NULL it defaults to 'A', -If class is NULL it default to 'IN'. - - -No search list nor default domain is applied. Return a pointer to a ldns_pkt -structure with the information from the nameserver. -If type is NULL it defaults to 'A', -If class is NULL it default to 'IN'. - - - - -TODO XX Gazillion helper functions to set port, src-port, etc. etc. - -
- -
- -A packet structure (ldns_pkt) has five sections: - -The header section, a ldns_hdr structure. -The question section, a ldns_rr_list structure. -The answer section, a ldns_rr_list structure. -The authority section, a ldns_rr_list structure. -The additional section, a ldns_rr_list structure. - - - - - -ldns_hdr represents the header section of a DNS packet. - - -A list of RRs in the Question section of a DNS packet. - - -A list of RRs in the Question section of a DNS packet. - - -A list of RRs in the Question section of a DNS packet. - - -A list of RRs in the Question section of a DNS packet. - - - - - - - -Creates a new empty packet. - - -Returns the packet data in binary format, suitable for sending to a -nameserver. [XXX, suitable for sending to a NS?] - - -Returns a ldns_hdr structure representing the header section of -the packet. - - - Returns a pointer to a ldns_rr_list representing the question section -of the packet. - - - Returns a pointer to a ldns_rr_list representing the answer section of -the packet. - - - -Returns a pointer to a ldns_rr_list representing the authority section -of the packet. - - - -Returns a pointer to a ldns_rr_list of representing the additional -section of the packet. - - - -Prints the packet data on the standard output in an ASCII format similar -to that used in DNS zone files. See RFC1035. - - - -Returns a ldns_buffer containing the string representation of the packet. - - - -Returns the IP address from which we received this packet. User-created -packets will return NULL. - - - -Returns the size of the packet in bytes as it was received from a -nameserver. User-created packets will return 0. [XXX -user-created??] - - - -Adds *rr to the specified section of the packet. Return LDNS_STATUS_OK -on success, LDNS_STATUS_ERR otherwise. - - - -Adds *rr to the specified section of the packet provided that the RR -does not already exist in the packet. Return LDNS_STATUS_OK -on success, LDNS_STATUS_ERR otherwise. - - -Removes a RR from the specified section of the packet. Returns NULL if -no RR's could be popped. - - -Retrieve all RRs in a packet matching certain criteria. XXX function needs -to be specified better. - - -Print packet p to stream s. - - - - -
- -
- -Some resource records can have special access function no other RR has. -Those are detailed here. XXX TODO don't exist (yet?). - -
- -
- -insert your long list here. - -
- -
- -A small example, which queries a nameserver on localhost -to diplay the MX records for miek.nl. - - - -
- -/** - * An example ldns program - * In semi-C code - * - * Setup a resolver - * Query a nameserver - * Print the result - */ - -#include <ldns.h> - -int -main(void) -{ - ldns_resolver *res; - ldns_rdf *default_dom; - ldns_rdf *nameserver; - ldns_rdf *qname; - ldns_pkt *pkt; - - /* init */ - res = ldns_resolver_new(); - if (!res) - return 1; - - /* create a default domain and add it */ - default_dom = ldns_rdf_new_frm_str("miek.nl.", LDNS_RDF_TYPE_DNAME); - nameserver = ldns_rdf_new_frm_str("127.0.0.1", LDNS_RDF_TYPE_A); - - if (ldns_resolver_domain(res, default_dom) != LDNS_STATUS_OK) - return 1; - if (ldns_resolver_nameserver_push(res, nameserver) != LDNS_STATUS_OK) - return 1; - - /* setup the question */ - qname = ldns_rdf_new_frm_str("www", LDNS_RDF_TYPE_DNAME); - - /* fire it off. "miek.nl." will be added */ - pkt = ldns_resolver_query(res, qname, LDNS_RR_TYPE_MX, NULL); - - /* print the resulting pkt to stdout */ - ldns_pkt_print(stdout, pkt); - - return 0; -} - -
-
-
- -
- - -
diff --git a/libs/ldns/doc/CodingStyle b/libs/ldns/doc/CodingStyle deleted file mode 100644 index a326e5c3f9..0000000000 --- a/libs/ldns/doc/CodingStyle +++ /dev/null @@ -1,64 +0,0 @@ -The libdns coding style guide - -* Use of tabs (real tabs, 8 positions long) -* Spaces only after comma's, and in between operators. - And after keywords (if, while, for) -* Underscores to make long names readable -* prefix (exported) identifiers with 'ldns_' -* no unneeded parentheses after 'return' -* always curly brackets in if-statements -* use defines for (weird) constants, and masks -* type 'bool', constants 'true'/'false'. Don't compare bools for - equality. -* always use LDNS_MALLOC/FREE etc, or the new/free/deep_free functions -* buffer can scale, so don't alloc the max size, but the min size -* make lint (uses splint) is your friend - - -* Return values: - - status code (structure to fill is usually passed as a first argument) - - new/pointer: return pointer or NULL on error - - 'read' functions: ldns_status wire2thing(uint8_t *p, size_t max, - size_t pos, *thing); - - void functions like ldns_rr_free - - bool functions - -* Parameter sequence: (dest, [dest_meta, ] src, [src_meta] etc) -* structure/union field names start with _ when "private" -* enum for rcode, opcode, types etc, - example: - enum ldns_rcode { - LDNS_RCODE_OK = 0, - ... = ., - LDNS_RCODE_FIRST = LDNS_RCODE_OK, - LDNS_RCODE_LAST = 15, - LDNS_RCODE_COUNT = LDNS_RCODE_LAST + 1 - } -* Everything by reference, all data structures an optional _clone() function -* arrays: ps[] with size_t p_count for the number of elements -* _size for size in bytes -* _free and _clone copies perform deep free/copy. - -* Standard abbreviations, don't abbreviate other names: - - id = identity - rr = resource record - rrset = resource record set - rdata = resource data - rdf = resource data field - rcode = result code - qr = query/resource bit - aa = authoritative answer - tc = truncated - rd = recursion disabled - cd = checking disabled - ra = recursion available - ad = authentic data - qdcount = question section count - ancount = answer section count - nscount = authority section count - arcount = additional section count - -ldns- -* use exit(EXIT_FAILURE)/ exit(SUCCES) -* diff --git a/libs/ldns/doc/TODO b/libs/ldns/doc/TODO deleted file mode 100644 index 52a408c8a4..0000000000 --- a/libs/ldns/doc/TODO +++ /dev/null @@ -1,19 +0,0 @@ -TODO - -Features: -* Multi-line zone file parsing -* Configure option for not printing DNSSEC RR comments -* HMAC and MD5 without OpenSSL -* HIP RR support -* Parse 'search' attribute in /etc/resolv.conf -* Make use of automake (Bug #173) -* ./configure --with-tools --with-drill (Bug #264) -* Drill: print appropriate DS RRs (relates to Bug #355) -* ldns-signzone optout to be really optout - -Bugfixes: -* Bug #279: fix return values for net.h functions, and related: make return - values for functions that cannot return memory-failure today. Needs medium - version increase because of API change. -* Long out-standing packaging bugs (debian) -* Lazy ABI diff --git a/libs/ldns/doc/design.dox b/libs/ldns/doc/design.dox deleted file mode 100644 index a4cbeadb8f..0000000000 --- a/libs/ldns/doc/design.dox +++ /dev/null @@ -1,124 +0,0 @@ -/** \page design Design - -The following image shows the various modules of libdns and their -functionality. - -\image html libdnsoverview.png - -\section central_structures Central structures - - - \ref ldns_pkt A DNS Packet, which can contain a query, answers, and additional information. - - \ref ldns_rr A Resource Record, which holds a bit of information about a specific domain name. - - \ref ldns_rdf An RDATA field, every Resource Record contains one or more RDATA fields, depending on the type of RR. These are the 'basic types' of DNS data. - - \ref ldns_rr_list A list of resource records - - \ref ldns_zone A representation of a DNS Zone. - -The actual structure definitions are named \c ldns_struct_ which are all typedeffed to \c ldns_ - - -A DNS Resource record looks like this: - -
-nlnetlabs.nl.   600     IN      MX             10    open.nlnetlabs.nl.
- \              \       \       \              \                     /
-  owner          ttl     class   type           \        rdf[]      /
-  (rdf)     (uint32_t) (rr_class) (rr_type)
-                                                 10          := rdf[0]
-                                                 open.nlnetlabs.nl. := rdf[1]
-
- -* Owner: -The owner name is put in an \c ldns_rdf structure, which is a normal rdata field but always -has the type LDNS_RDF_TYPE_DNAME. - -An \ref ldns_rdf structure has 3 members; the size, the type of rdata and a void * -pointer to the data. The data is always in uncompressed wireformat. - -The RSH (rdata) is put in an array of rdf's (in this case 2). - -The entire resource record is put in a RR structure, which has -the fields described above (under the RR): - - owner (nlnetlabs.nl.) - - ttl (600) - - class (LDNS_RR_CLASS_IN: 'IN') - - type (LDNS_RR_TYPE_MX: 'MX') - - rd_count (2) - - rdata_fields[rd_count] - - rdf[0] (10) - - rdf[1] (open.nlnetlabs.nl.) - -* RR list structure: -An RR list structure is simply a structure with a counter -and an array of RR structures. Different kinds of RR's can -be grouped together this way. - -* RRset structure: -An RRset structure is an RR list structure, but its accessor -function checks if the \c ldns_rr structures in there are: - - from the same type - - have the same TTL - - have the same ownername - -This is the RFC definition of an RRset. - -* pkt structure: -A pkt structure consists out of a header structure where -packet specific flags are kept, TC, RD, IP from the server which -sent the packet, etc. -Further more it is divided in 4 sections: question, authority, answer -and additional. - -All four sections have the type RRlist that simply hold a list of RR's - - -\section wire_module Wire module and central structures Interface - -As the WIRE module takes care of the compression/decompression -it needs a buffer which holds all the binary DNS data. -All functions will operate on such a buffer to extract specific -information which is then stored in RR structures. - - -\section resolver_module Resolver module and central structures Interface - -The resolver module always returns a pkt structure. Either with -the answer or a SERVFAIL pkt. - -The exact function-call parameters have not yet been -decided on. - -Also the resolver module will need to access some of the -to_wire and from_wire function to creates ldn_pkt's from -the data it receives (arrow not drawn). - - -\section str_module str module and central structures Interface - -Convert to and from strings. This module could be used -to read in a zone file (list of RRs) and convert the text strings to -the format used by ldns. Or the other way around. - - -\section net_module Net module and resolver module interface - -The resolver module will get a packet and will mold it so that -it can be sent off to a nameserver. -It might need to interface with the wire module (arrow not drawn). - -\section Net module and OS/libc interface -OS/network calls will be used here. The Net module is the only part of -the library where the underlying OS matters. - -\section Client program ldns interface -Any client program will have access to -- Wire module -- Central structures -- Resolver module -- str module (arrow not drawn in the above figure) - -\section dnssec_module DNSSEC module -The DNSSEC types are handled in the RR module, but the crypto -routines are contained in this module. This module will depend -on OpenSSL for the crypto routines. - -*/ diff --git a/libs/ldns/doc/dns-lib-implementations b/libs/ldns/doc/dns-lib-implementations deleted file mode 100644 index 18d01afb30..0000000000 --- a/libs/ldns/doc/dns-lib-implementations +++ /dev/null @@ -1,56 +0,0 @@ -http://www.posadis.org/projects/poslib.php -Poslib DNS library - Default branch - -http://www.posadis.org/poslib?DokuWiki=2b00f9da090fb9d4ad3d6e98b9c2f61f - -Poslib is the C++ library for applications using the Domain Name System -that is used by all Posadis tools, including the Posadis DNS server and the -Zoneedit and Dnsquery tools. It consists of a library for creating client -applications using DNS, and a server library for DNS servers. - - -FireDNS Library -http://firestuff.org/projects/firedns -FireDNS Library ---------------- -(c) 2002 Ian Gulliver under the GNU Public License, Version 2. -See GPL for more details. - -From libfiredns(3): - -libfiredns is a library for handling asynchronous DNS -requests. It provides a very simple interface for sending -requests and parsing reponses, as well as low-timeout -blocking functions. libfiredns functions have much lower -timeouts than the stock functions and tend to be faster -because they send requests to all configured system -nameservers at the same time. - -If you have questions or comments, you can reach me at -ian@penguinhosting.net. - - - -skadns - - Skadns is Kind of an Asynchronous DNS client software. - - * Kind of: it's small. Really small. But it just works. - * Asynchronous: all DNS operations are non-blocking. - * DNS client software: it's a DNS client, what you may know as a "stub resolver". To perform full DNS resolution, you will still need a full resolver like dnscache. - - Similar work - - * ares is an asynchronous DNS resolver library with a nice interface - * and more configuration options than skadns (and a very reasonable - * size). Use it if you find that skadns lacks configurability (you - * shouldn't need more than it provides, but well, you're the user). - * Yet it doesn't hide the DNS internals as opaquely as skadns does, - * giving you a bunch of fds to select() on instead of just one. - * adns works fine, and is small for a GNU project. Impressive. But - * the interface is still too complex and much too generic - the - * usual problems with GNU software. - - -ADNS; documentation scares - is it still active -simular aims - different ways diff --git a/libs/ldns/doc/doxyparse.pl b/libs/ldns/doc/doxyparse.pl deleted file mode 100755 index 218825fe1b..0000000000 --- a/libs/ldns/doc/doxyparse.pl +++ /dev/null @@ -1,288 +0,0 @@ -#!/usr/bin/perl - -# Doxygen is usefull for html documentation, but sucks -# in making manual pages. Still tool also parses the .h -# files with the doxygen documentation and creates -# the man page we want -# -# 2 way process -# 1. All the .h files are processed to create in file in which: -# filename | API | description | return values -# are documented -# 2. Another file is parsed which states which function should -# be grouped together in which manpage. Symlinks are also created. -# -# With this all in place, all documentation should be autogenerated -# from the doxydoc. - -use Getopt::Std; - -my $state; -my $description; -my $struct_description; -my $key; -my $return; -my $param; -my $api; -my $const; - -my %description; -my %api; -my %return; -my %options; -my %manpages; -my %see_also; - -my $BASE="doc/man"; -my $MAN_SECTION = "3"; -my $MAN_HEADER = ".TH ldns $MAN_SECTION \"30 May 2006\"\n"; -my $MAN_MIDDLE = ".SH AUTHOR -The ldns team at NLnet Labs. Which consists out of -Jelte Jansen and Miek Gieben. - -.SH REPORTING BUGS -Please report bugs to ldns-team\@nlnetlabs.nl or in -our bugzilla at -http://www.nlnetlabs.nl/bugs/index.html - -.SH COPYRIGHT -Copyright (c) 2004 - 2006 NLnet Labs. -.PP -Licensed under the BSD License. There is NO warranty; not even for -MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. -"; -my $MAN_FOOTER = ".SH REMARKS -This manpage was automaticly generated from the ldns source code by -use of Doxygen and some perl. -"; - -getopts("m:",\%options); -# if -m manpage file is given process that file -# parse the file which tells us what manpages go together -my $functions, $see_also; -if (defined $options{'m'}) { - # process - open(MAN, "<$options{'m'}") or die "Cannot open $options{'m'}"; - # it's line based: - # func1, func2, .. | see_also1, see_also2, ... - while() { - chomp; - if (/^#/) { next; } - if (/^$/) { next; } - ($functions, $see_also) = split /[\t ]*\|[\t ]*/, $_; - #print "{$functions}\n"; - #print "{$see_also}\n"; - my @funcs = split /[\t ]*,[\t ]*/, $functions; - my @also = split /[\t ]*,[\t ]*/, $see_also; - $manpages{$funcs[0]} = \@funcs; - $see_also{$funcs[0]} = \@also; - #print "[", $funcs[0], "]\n"; - } - close(MAN); -} else { - print "Need -m file to process the .h files\n"; - exit 1; -} - -# 0 - somewhere in the file -# 1 - in a doxygen par -# 2 - after doxygen, except funcion - -# create our pwd -mkdir "doc"; -mkdir "doc/man"; -mkdir "doc/man/man$MAN_SECTION"; - -$state = 0; -my $i; -my @lines = ; -my $max = @lines; - -while($i < $max) { - $typedef = ""; - if ($lines[$i] =~ /^typedef struct/ and $lines[$i + 1] =~ /^struct/) { - # move typedef to below struct - $typedef = $lines[$i]; - $j = $i; - while ($lines[$j] !~ /}/) { - $lines[$j] = $lines[$j+1]; - $j++; - } - $lines[$j] = $lines[$j+1]; - $lines[$j + 1] = $typedef; - } - - $cur_line = $lines[$i]; - chomp($cur_line); - if ($cur_line =~ /^\/\*\*[\t ]*$/) { - # /** Seen - #print "Comment seen! [$cur_line]\n"; - $state = 1; - undef $description; - undef $struct_description; - $i++; - next; - } - if ($cur_line =~ /\*\// and $state == 1) { - #print "END Comment seen!\n"; - $state = 2; - $i++; - next; - } - - if ($state == 1) { - # inside doxygen - $cur_line =~ s/\\/\\\\/g; - $cur_line =~ s/^[ \t]*\* ?//; - $description = $description . "\n" . $cur_line; - #$description = $description . "\n.br\n" . $cur_line; - } - if ($state == 2 and $cur_line =~ /const/) { - # the const word exists in the function call - #$const = "const"; - #s/[\t ]*const[\t ]*//; - } else { - #undef $const; - } - - if ($cur_line =~ /^INLINE/) { - $cur_line =~ s/^INLINE\s*//; - while ($cur_line !~ /{/) { - $i++; - $cur_line .= " ".$lines[$i]; - $cur_line =~ s/\n//; - } - $cur_line =~ s/{/;/; - } - - if ($cur_line =~ /^[^#*\/ ]([\w\*]+)[\t ]+(.*?)[({](.*)\s*/ and $state == 2) { - while ($cur_line !~ /\)\s*;/) { - $i++; - $cur_line .= $lines[$i]; - chomp($cur_line); - $cur_line =~ s/\n/ /g; - $cur_line =~ s/\s\s*/ /g; - } - $cur_line =~ /([\w\* ]+)[\t ]+(.*?)\((.*)\)\s*;/; - # this should also end the current comment parsing - $return = $1; - $key = $2; - $api = $3; - # sometimes the * is stuck to the function - # name instead to the return type - if ($key =~ /^\*/) { - #print"Name starts with *\n"; - $key =~ s/^\*//; - if (defined($const)) { - $return = $const . " " . $return . '*'; - } else { - $return = $return . '*'; - } - } - $description =~ s/\\param\[in\][ \t]*([\*\w]+)[ \t]+/.br\n\\fB$1\\fR: /g; - $description =~ s/\\param\[out\][ \t]*([\*\w]+)[ \t]+/.br\n\\fB$1\\fR: /g; - $description =~ s/\\return[ \t]*/.br\nReturns /g; - - $description{$key} = $description; - $api{$key} = $api; - $return{$key} = $return; - undef $description; - undef $struct_description; - $state = 0; - } elsif ($state == 2 and ( - $cur_line =~ /^typedef\sstruct\s(\w+)\s(\w+);/ or - $cur_line =~ /^typedef\senum\s(\w+)\s(\w+);/)) { - $struct_description .= "\n.br\n" . $cur_line; - $key = $2; - $struct_description =~ s/\/\*\*\s*(.*?)\s*\*\//\\fB$1:\\fR/g; - $description{$key} = $struct_description; - $api{$key} = "struct"; - $return{$key} = $1; - undef $description; - undef $struct_description; - $state = 0; - } else { - $struct_description .= "\n.br\n" . $cur_line; - } - $i++; -} - -# create the manpages -foreach (keys %manpages) { - $name = $manpages{$_}; - $also = $see_also{$_}; - - $filename = @$name[0]; - $filename = "$BASE/man$MAN_SECTION/$filename.$MAN_SECTION"; - - my $symlink_file = @$name[0] . "." . $MAN_SECTION; - -# print STDOUT $filename,"\n"; - open (MAN, ">$filename") or die "Can not open $filename"; - - print MAN $MAN_HEADER; - print MAN ".SH NAME\n"; - print MAN join ", ", @$name; - print MAN "\n\n"; - print MAN ".SH SYNOPSIS\n"; - - print MAN "#include \n.br\n"; - print MAN "#include \n.br\n"; - - print MAN ".PP\n"; - print MAN "#include \n"; - print MAN ".PP\n"; - - foreach (@$name) { - $b = $return{$_}; - $b =~ s/\s+$//; - if ($api{$_} ne "struct") { - print MAN $b, " ", $_; - print MAN "(", $api{$_},");\n"; - print MAN ".PP\n"; - } - } - - print MAN "\n.SH DESCRIPTION\n"; - foreach (@$name) { - print MAN ".HP\n"; - print MAN "\\fI", $_, "\\fR"; - if ($api{$_} ne "struct") { - print MAN "()"; - } -# print MAN ".br\n"; - print MAN $description{$_}; - print MAN "\n.PP\n"; - } - - print MAN $MAN_MIDDLE; - - if (defined(@$also)) { - print MAN "\n.SH SEE ALSO\n\\fI"; - print MAN join "\\fR, \\fI", @$also; - print MAN "\\fR.\nAnd "; - print MAN "\\fBperldoc Net::DNS\\fR, \\fBRFC1034\\fR, -\\fBRFC1035\\fR, \\fBRFC4033\\fR, \\fBRFC4034\\fR and \\fBRFC4035\\fR.\n"; - } else { - print MAN ".SH SEE ALSO -\\fBperldoc Net::DNS\\fR, \\fBRFC1034\\fR, -\\fBRFC1035\\fR, \\fBRFC4033\\fR, \\fBRFC4034\\fR and \\fBRFC4035\\fR.\n"; - } - - print MAN $MAN_FOOTER; - - # create symlinks - chdir("$BASE/man$MAN_SECTION"); - foreach (@$name) { - print STDERR $_,"\n"; - my $new_file = $_ . "." . $MAN_SECTION; - if ($new_file eq $symlink_file) { - next; - } - #print STDOUT "\t", $new_file, " -> ", $symlink_file, "\n"; - symlink $symlink_file, $new_file; - } - chdir("../../.."); # and back, tricky and fragile... - close(MAN); -} diff --git a/libs/ldns/doc/function_manpages b/libs/ldns/doc/function_manpages deleted file mode 100644 index 15706fada5..0000000000 --- a/libs/ldns/doc/function_manpages +++ /dev/null @@ -1,223 +0,0 @@ -# first function name will be the real name of the manpage -# other names are aliases (symlinks) -# all functions specified on the same line are included in the -# same manual page. We cannot deal with linebreaks! -# function named after the pipe `|' are put in the "see also" section - -# functions that must be included, separated by commas - -### host2wire.h -# conversion functions -ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire | ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf -# lower level conversions, some are from host2str.h -ldns_pkt2buffer_str, ldns_pktheader2buffer_str, ldns_rr2buffer_str, ldns_rr_list2buffer_str, ldns_rdf2buffer_str, ldns_key2buffer_str, ldns_pkt2buffer_wire, ldns_rr2buffer_wire, ldns_rdf2buffer_wire, ldns_rrsig2buffer_wire, ldns_rr_rdata2buffer_wire | ldns_pkt2str, ldns_rr2str, ldns_rdf2str, ldns_rr_list2str, ldns_key2str -### /host2wire.h - -### host2str.h -ldns_rr2str, ldns_pkt2str, ldns_rdf2str, ldns_rr_list2str, ldns_key2str | ldns_rr_print, ldns_rdf_print, ldns_pkt_print, ldns_rr_list_print, ldns_resolver_print, ldns_zone_print -ldns_rr_print, ldns_rdf_print, ldns_pkt_print, ldns_rr_list_print, ldns_resolver_print, ldns_zone_print | ldns_rr2str, ldns_rdf2str, ldns_pkt2str, ldns_rr_list2str, ldns_key2str -### /host2str.h - -### host2str.h -# and even lower -ldns_rdf2buffer_str_a, ldns_rdf2buffer_str_aaaa, ldns_rdf2buffer_str_str, ldns_rdf2buffer_str_b64, ldns_rdf2buffer_str_hex, ldns_rdf2buffer_str_type, ldns_rdf2buffer_str_class, ldns_rdf2buffer_str_alg, ldns_rdf2buffer_str_loc, ldns_rdf2buffer_str_unknown, ldns_rdf2buffer_str_nsap, ldns_rdf2buffer_str_wks, ldns_rdf2buffer_str_nsec, ldns_rdf2buffer_str_period, ldns_rdf2buffer_str_tsigtime, ldns_rdf2buffer_str_apl, ldns_rdf2buffer_str_int16_data, ldns_rdf2buffer_str_int16, ldns_rdf2buffer_str_ipseckey -### /host2str.h - -### wire2host.h -# wirefunctions -ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf, ldns_wire2dname | ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire, ldns_dname2wire -ldns_buffer2pkt_wire -### /wire2host.h - -### dname.h -ldns_dname_left_chop, ldns_dname_label_count | ldns_dname -ldns_dname2canonical | ldns_dname -ldns_dname_cat_clone, ldns_dname_cat | ldns_dname -ldns_dname_new, ldns_dname_new_frm_str, ldns_dname_new_frm_data | ldns_dname, ldns_pkt_query_new_frm_str, ldns_rdf_new_frm_str, ldns_rr_new_frm_str -ldns_dname_is_subdomain, ldns_dname_str_absolute, ldns_dname_label | ldns_dname -ldns_dname_compare, ldns_dname_interval | ldns_dname_is_subdomain | ldns_dname -ldns_dname | ldns_dname_left_chop, ldns_dname_label_count, ldns_dname2canonical, ldns_dname_cat, ldns_dname_cat_clone, ldns_dname_new, ldns_dname_new_frm_str, ldns_dname_new_frm_data, ldns_dname_is_subdomain, ldns_dname_str_absolute, ldns_dname_label, ldns_dname_compare, ldns_dname_interval -### /dname.h - -### rdata.h -ldns_rdf, ldns_rdf_type | ldns_rdf_set_size, ldns_rdf_set_type, ldns_rdf_set_data, ldns_rdf_size, ldns_rdf_get_type, ldns_rdf_data, ldns_rdf_compare, ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, ldns_rdf_print, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t -ldns_rdf_set_size, ldns_rdf_set_type, ldns_rdf_set_data | ldns_rdf -ldns_rdf_size, ldns_rdf_get_type, ldns_rdf_data, ldns_rdf_compare | ldns_rdf -ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, ldns_rdf_print | ldns_rdf -ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t | ldns_rdf -ldns_rdf_address_reverse | ldns_rdf -ldns_octet | ldns_rdf -# why is this in rdata.h? -ldns_str2period -### /rdata.h - -### higher.h -ldns_get_rr_list_addr_by_name, ldns_get_rr_list_name_by_addr | ldns_rr_list, ldns_rr -ldns_get_rr_list_hosts_frm_fp, ldns_get_rr_list_hosts_frm_file | ldns_rr_list, ldns_rr, ldns_get_rr_list_hosts_frm_fp_l -ldns_get_rr_list_hosts_frm_fp_l | ldns_rr_list -ldns_getaddrinfo -### /higher.h - -# -### dnssec.h -# -ldns_calc_keytag, ldns_verify, ldns_verify_rrsig, ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5, ldns_key_rr2ds, ldns_key_buf2dsa, ldns_key_buf2rsa | ldns_key, ldns_sign_public, ldns_zone_sign, ldns_verify, ldns_verify_rrsig - -# algs -ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5 | ldns_key, ldns_sign_public, ldns_zone_sign, ldns_verify, ldns_verify_rrsig - -# tsig -ldns_pkt_tsig_verify, ldns_pkt_tsig_sign | ldns_key - -# verify -ldns_verify, ldns_verify_rrsig, ldns_verify_rrsig_keylist, ldns_verify_rrsig_keylist_notime, ldns_verify_notime | ldns_verify_rrsig_evp | ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5, ldns_sign_public, ldns_zone_sign, ldns_key - -# convert -ldns_key_buf2dsa, ldns_key_buf2rsa | ldns_key_rr2ds -ldns_key_rr2ds | ldns_key -ldns_create_nsec | ldns_sign_public - -# signing -ldns_sign_public | ldns_sign_public_dsa, ldns_sign_public_rsamd5, ldns_sign_public_rsasha1, ldns_verify, ldns_verify_rrsig, ldns_key -ldns_sign_public_dsa, ldns_sign_public_rsamd5, ldns_sign_public_rsasha1 | ldns_sign_public -ldns_dnssec_zone_sign, ldns_dnssec_zone_sign_nsec3 | ldns_zone_sign, ldns_zone_sign_nsec3 | ldns_sign_public, ldns_key, ldns_init_random -ldns_init_random | ldns_sign_public, ldns_key -ldns_pkt_verify | ldns_verify, ldns_sign_public, ldns_zone_sign - -# new family of dnssec functions -ldns_dnssec_zone, ldns_dnssec_name, ldns_dnssec_rrs, ldns_dnssec_rrsets | ldns_dnssec_zone_new, ldns_dnssec_name_new, ldns_dnssec_rrs_new, ldns_dnssec_rrsets_new -ldns_dnssec_zone_find_rrset, ldns_dnssec_zone_new, ldns_dnssec_zone_free, ldns_dnssec_zone_add_rr, ldns_dnssec_zone_names_print, ldns_dnssec_zone_print, ldns_dnssec_zone_add_empty_nonterminals | ldns_dnssec_zone -ldns_dnssec_name_new, ldns_dnssec_name_new_frm_rr, ldns_dnssec_name_free, ldns_dnssec_name_name, ldns_dnssec_name_set_name, ldns_dnssec_name_set_nsec, ldns_dnssec_name_cmp, ldns_dnssec_name_add_rr, ldns_dnssec_name_find_rrset, ldns_dnssec_name_print | ldns_dnssec_zone -ldns_dnssec_rrsets_new, ldns_dnssec_rrsets_free, ldns_dnssec_rrsets_type, ldns_dnssec_rrsets_set_type, ldns_dnssec_rrsets_add_rr, ldns_dnssec_rrsets_print | ldns_dnssec_zone -ldns_dnssec_rrs_new, ldns_dnssec_rrs_free, ldns_dnssec_rrs_add_rr, ldns_dnssec_rrs_print | ldns_dnssec_zone - -# verification -ldns_dnssec_data_chain, ldns_dnssec_data_chain_struct, ldns_dnssec_trust_tree | ldns_dnssec_data_chain_new, ldns_dnssec_trust_tree_new, ldns_dnssec_verify_denial -ldns_dnssec_data_chain_new, ldns_dnssec_data_chain_free, ldns_dnssec_data_chain_deep_free, ldns_dnssec_build_data_chain, ldns_dnssec_data_chain_print | ldns_dnssec_data_chain -ldns_dnssec_trust_tree_new, ldns_dnssec_trust_tree_free, ldns_dnssec_trust_tree_depth, ldns_dnssec_derive_trust_tree, ldns_dnssec_trust_tree_contains_keys, ldns_dnssec_trust_tree_print, ldns_dnssec_trust_tree_print_sm, ldns_dnssec_trust_tree_add_parent, ldns_dnssec_derive_trust_tree_normal_rrset, ldns_dnssec_derive_trust_tree_dnskey_rrset, ldns_dnssec_derive_trust_tree_ds_rrset, ldns_dnssec_derive_trust_tree_no_sig | ldns_dnssec_data_chain, ldns_dnssec_trust_tree -ldns_dnssec_verify_denial, ldns_dnssec_verify_denial_nsec3 | ldns_dnssec_trust_tree, ldns_dnssec_data_chain - -# new signing functions -ldns_dnssec_zone_sign, ldns_dnssec_zone_sign_nsec3, ldns_dnssec_zone_mark_glue, ldns_dnssec_name_node_next_nonglue, ldns_dnssec_zone_create_nsecs, ldns_dnssec_remove_signatures, ldns_dnssec_zone_create_rrsigs | ldns_dnssec_zone - -### /dnssec.h - -### dnskey.h -ldns_key_new | ldns_key, ldns_key_list_new -ldns_key_new_frm_algorithm, ldns_key_new_frm_fp, ldns_key_new_frm_fp_l | ldns_key -ldns_key_new_frm_fp_rsa, ldns_key_new_frm_fp_rsa_l | ldns_key_new_frm_fp, ldns_key -ldns_key_new_frm_fp_dsa, ldns_key_new_frm_fp_dsa_l | ldns_key_new_frm_fp, ldns_key -ldns_key_list_new | ldns_key_new, ldns_key -# access, write -ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count, ldns_key_algo_supported | ldns_key_push_key, ldns_key -ldns_key_list_push_key | ldns_key_list_pop_key, ldns_key -ldns_key_list_pop_key | ldns_key_list_push_key, ldns_key -# access, read -ldns_key_list_key_count, ldns_key_list_key, ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key, ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags | ldns_key -# convert -ldns_key2rr | ldns_key -ldns_key_free, ldns_key_deep_free, ldns_key_list_free | ldns_key -# -ldns_key_print | ldns_key_new, ldns_key -ldns_key | ldns_key_new, ldns_key_new_frm_algorithm,ldns_key_new_frm_fp,ldns_key_new_frm_fp_l, ldns_key_new_frm_fp_rsa, ldns_key_new_frm_fp_rsa_l, ldns_key_new_frm_fp_dsa, ldns_key_new_frm_fp_dsa_l, ldns_key_list_new, ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count, ldns_key_list_push_key, ldns_key_list_pop_key, ldns_key_list_key_count, ldns_key_list_key, ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key, ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags, ldns_key2rr, ldns_key_free, ldns_key_deep_free, ldns_key_list_free, ldns_key_print -### /dnskey.h - -### MIEK TOT HIER TOT HIER - -# lists -ldns_key_list_new, ldns_key_list_push_key, ldns_key_list_pop_key, ldns_key_list_key_count, ldns_key_list_key | ldns_key_list, ldns_key -ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key | ldns_key_list, ldns_key - -# gets/sets -ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags | ldns_key -ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count | ldns_key - -# errr.h -ldns_get_errorstr_by_id | ldns_status -ldns_status | ldns_get_errorstr_by_id - -### net.h -ldns_send | ldns_pkt, ldns_resolver -ldns_tcp_send_query, ldns_tcp_read_wire, ldns_tcp_connect | ldns_send, ldns_pkt, ldns_resolver -### /net.h - -### buffer.h -# general -ldns_buffer | ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buffer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export, ldns_buffer_flip, ldns_buffer_rewind, ldns_buffer_position, ldns_buffer_set_position, ldns_buffer_skip, ldns_buffer_limit, ldns_buffer_set_limit, ldns_buffer_capacity, ldns_buffer_set_capacity, ldns_buffer_reserve, ldns_buffer_at, ldns_buffer_begin, ldns_buffer_end, ldns_buffer_current, ldns_buffer_remaining_at, ldns_buffer_remaining, ldns_buffer_available_at, ldns_buffer_available, ldns_buffer_status, ldns_buffer_status_ok, ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buffer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buffer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 -ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buffer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export | ldns_buffer -# position -ldns_buffer_flip, ldns_buffer_rewind, ldns_buffer_position, ldns_buffer_set_position, ldns_buffer_skip | ldns_buffer -# values and pointers -ldns_buffer_limit, ldns_buffer_set_limit, ldns_buffer_capacity, ldns_buffer_set_capacity, ldns_buffer_reserve, ldns_buffer_at, ldns_buffer_begin, ldns_buffer_end, ldns_buffer_current | ldns_buffer -# info -ldns_buffer_remaining_at, ldns_buffer_remaining, ldns_buffer_available_at, ldns_buffer_available, ldns_buffer_status, ldns_buffer_status_ok | ldns_buffer -# read and write -ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buffer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buffer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 | ldns_buffer -### /buffer.h - -# parse.h -ldns_bget_token, ldns_bgetc, ldns_bskipcs | ldns_buffer -ldns_fget_token, ldns_fskipcs | ldns_buffer -ldns_str_remove_comment - - -# rr.h and other general rr funcs -ldns_rr, ldns_rr_class, ldns_rr_type, ldns_rr_compress, ldns_rr_list | ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print, ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf, ldns_rr_push_rdf, ldns_rr_pop_rdf, ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class, ldns_rr_list_rr_count, ldns_rr_list_set_rr_count, ldns_rr_list_new, ldns_rr_list_free, ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr, ldns_is_rrset, ldns_rr_set_push_rr, ldns_rr_set_pop_rr, ldns_get_rr_class_by_name, ldns_get_rr_type_by_name, ldns_rr_list_clone, ldns_rr_list_sort, ldns_rr_compare, ldns_rr_compare_ds, ldns_rr_uncompressed_size, ldns_rr2canonical, ldns_rr_label_count, ldns_is_rrset, ldns_rr_descriptor, ldns_rr_descript -ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print | ldns_rr, ldns_rr_list -ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf | ldns_rr, ldns_rr_list -ldns_rr_push_rdf, ldns_rr_pop_rdf | ldns_rr, ldns_rr_list -ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class | ldns_rr, ldns_rr_list -ldns_rr_list_rr_count, ldns_rr_list_set_rr_count | ldns_rr, ldns_rr_list -ldns_rr_list_new, ldns_rr_list_free | ldns_rr, ldns_rr_list -ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr | ldns_rr, ldns_rr_list -ldns_is_rrset | ldns_rr, ldns_rr_list -ldns_rr_set_push_rr, ldns_rr_set_pop_rr | ldns_rr, ldns_rr_list -ldns_get_rr_class_by_name, ldns_get_rr_type_by_name | ldns_rr, ldns_rr_list -ldns_rr_list_clone | ldns_rr, ldns_rr_list -ldns_rr_list_sort | ldns_rr, ldns_rr_list -ldns_rr_compare, ldns_rr_compare_ds | ldns_rr, ldns_rr_list -ldns_rr_uncompressed_size | ldns_rr, ldns_rr_list -ldns_rr2canonical | ldns_rr, ldns_rr_list -ldns_rr_label_count | ldns_rr, ldns_rr_list -ldns_is_rrset | ldns_rr - -# rr descriptors -ldns_rr_descriptor, ldns_rr_descript, ldns_rr_descriptor_minimum, ldns_rr_descriptor_maximum, ldns_rr_descriptor_field_type | ldns_rr, ldns_rdf - -# packet.h -ldns_pkt, ldns_pkt_section, ldns_pkt_type | ldns_pkt_new, ldns_pkt_free, ldns_pkt_print, ldns_pkt_query_new, ldns_pkt_query_new_frm_str, ldns_pkt_reply_type, ldns_pkt_id, ldns_pkt_qr, ldns_pkt_aa, ldns_pkt_tc, ldns_pkt_rd, ldns_pkt_cd, ldns_pkt_ra, ldns_pkt_ad, ldns_pkt_get_opcode, ldns_pkt_get_rcode, ldns_pkt_qdcount, ldns_pkt_ancount, ldns_pkt_nscount, ldns_pkt_arcount, ldns_pkt_answerfrom, ldns_pkt_querytime, ldns_pkt_size, ldns_pkt_tsig, ldns_pkt_question, ldns_pkt_answer, ldns_pkt_authority, ldns_pkt_additional, ldns_pkt_get_section_clone, ldns_pkt_rr_list_by_name, ldns_pkt_rr_list_by_type, ldns_pkt_rr_list_by_name_and_type, ldns_pkt_set_flags, ldns_pkt_set_id, ldns_pkt_set_qr, ldns_pkt_set_aa, ldns_pkt_set_tc, ldns_pkt_set_rd, ldns_pkt_set_cd, ldns_pkt_set_ra, ldns_pkt_set_ad, ldns_pkt_set_opcode, ldns_pkt_set_rcode, ldns_pkt_set_qdcount, ldns_pkt_set_ancount, ldns_pkt_set_nscount, ldns_pkt_set_arcount, ldns_pkt_set_answerfrom, ldns_pkt_set_querytime, ldns_pkt_set_size, ldns_pkt_set_section_count, ldns_pkt_set_tsig, ldns_pkt_edns, ldns_pkt_edns_udp_size, ldns_pkt_edns_extended_rcode, ldns_pkt_edns_version, ldns_pkt_edns_z, ldns_pkt_edns_data, ldns_pkt_set_edns_udp_size, ldns_pkt_set_edns_extended_rcode, ldns_pkt_set_edns_version, ldns_pkt_set_edns_z, ldns_pkt_set_edns_data - -ldns_pkt_new, ldns_pkt_free, ldns_pkt_print, ldns_pkt_query_new, ldns_pkt_query_new_frm_str, ldns_pkt_reply_type | ldns_pkt -# gets -ldns_pkt_id, ldns_pkt_qr, ldns_pkt_aa, ldns_pkt_tc, ldns_pkt_rd, ldns_pkt_cd, ldns_pkt_ra, ldns_pkt_ad, ldns_pkt_get_opcode, ldns_pkt_get_rcode, ldns_pkt_qdcount, ldns_pkt_ancount, ldns_pkt_nscount, ldns_pkt_arcount, ldns_pkt_answerfrom, ldns_pkt_querytime, ldns_pkt_size, ldns_pkt_tsig, ldns_pkt_question, ldns_pkt_answer, ldns_pkt_authority, ldns_pkt_additional, ldns_pkt_get_section_clone, ldns_pkt_rr_list_by_name, ldns_pkt_rr_list_by_type, ldns_pkt_rr_list_by_name_and_type | ldns_pkt -# sets -ldns_pkt_set_flags, ldns_pkt_set_id, ldns_pkt_set_qr, ldns_pkt_set_aa, ldns_pkt_set_tc, ldns_pkt_set_rd, ldns_pkt_set_cd, ldns_pkt_set_ra, ldns_pkt_set_ad, ldns_pkt_set_opcode, ldns_pkt_set_rcode, ldns_pkt_set_qdcount, ldns_pkt_set_ancount, ldns_pkt_set_nscount, ldns_pkt_set_arcount, ldns_pkt_set_answerfrom, ldns_pkt_set_querytime, ldns_pkt_set_size, ldns_pkt_set_section_count, ldns_pkt_set_tsig | ldns_pkt -# EDNS0 -ldns_pkt_edns, ldns_pkt_edns_udp_size, ldns_pkt_edns_extended_rcode, ldns_pkt_edns_version, ldns_pkt_edns_z, ldns_pkt_edns_data, ldns_pkt_set_edns_udp_size, ldns_pkt_set_edns_extended_rcode, ldns_pkt_set_edns_version, ldns_pkt_set_edns_z, ldns_pkt_set_edns_data | ldns_pkt - -# rr_functions.h -ldns_rr_ns_nsdname -# -ldns_rr_mx_preference, ldns_rr_mx_exchange -# -ldns_rr_rrsig_typecovered, ldns_rr_rrsig_set_typecovered, ldns_rr_rrsig_algorithm, ldns_rr_rrsig_set_algorithm, ldns_rr_rrsig_labels, ldns_rr_rrsig_set_labels, ldns_rr_rrsig_origttl, ldns_rr_rrsig_set_origttl, ldns_rr_rrsig_expiration, ldns_rr_rrsig_set_expiration, ldns_rr_rrsig_inception, ldns_rr_rrsig_set_inception, ldns_rr_rrsig_keytag, ldns_rr_rrsig_set_keytag, ldns_rr_rrsig_signame, ldns_rr_rrsig_set_signame, ldns_rr_rrsig_sig, ldns_rr_rrsig_set_sig -# -ldns_rr_dnskey_flags, ldns_rr_dnskey_set_flags, ldns_rr_dnskey_protocol, ldns_rr_dnskey_set_protocol, ldns_rr_dnskey_algorithm, ldns_rr_dnskey_set_algorithm, ldns_rr_dnskey_key, ldns_rr_dnskey_set_key | ldns_rr - -### zone.h -ldns_zone | ldns_zone_new, ldns_zone_deep_free, ldns_zone_new_frm_fp, ldns_zone_new_frm_fp_l, ldns_zone_sort, ldns_zone_glue_rr_list, ldns_zone_push_rr, ldns_zone_push_rr_list, ldns_zone_set_rrs, ldns_zone_set_soa, ldns_zone_rrs, ldns_zone_soa, ldns_zone_rr_count, - - -ldns_zone_new, ldns_zone_deep_free, ldns_zone_new_frm_fp, ldns_zone_new_frm_fp_l | ldns_zone -ldns_zone_sort, ldns_zone_glue_rr_list | ldns_zone -ldns_zone_push_rr, ldns_zone_push_rr_list | ldns_zone -ldns_zone_set_rrs, ldns_zone_set_soa | ldns_zone, ldns_zone_rrs, ldns_zone_soa -ldns_zone_rrs, ldns_zone_soa | ldns_zone ldns_zone_set_rrs -ldns_zone_rr_count | ldns_zone - -### update.h -ldns_update_pkt_new | ldns_update_pkt_tsig_add, ldns_update_pkt_tsig_add, ldns_update_zocount, ldns_update_prcount, ldns_update_upcount, ldns_update_adcount, ldns_update_set_zocount, ldns_update_set_prcount, ldns_update_set_upcount, ldns_update_set_adcount, - -ldns_update_pkt_tsig_add | ldns_update_pkt_new -ldns_update_zocount, ldns_update_prcount, ldns_update_upcount, ldns_update_adcount | ldns_update_pkt_new -ldns_update_set_zocount, ldns_update_set_prcount, ldns_update_set_upcount, ldns_update_set_adcount | ldns_update_pkt_new diff --git a/libs/ldns/doc/header.html b/libs/ldns/doc/header.html deleted file mode 100644 index 5b311bd986..0000000000 --- a/libs/ldns/doc/header.html +++ /dev/null @@ -1,10 +0,0 @@ - - -ldns documentation - - - - diff --git a/libs/ldns/doc/images/LogoInGradientBar2-y100.png b/libs/ldns/doc/images/LogoInGradientBar2-y100.png deleted file mode 100644 index 0e753611279d503619e61b5e518ac2b0f8bb03dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 60773 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
-   % ldns-mx nlnetlabs.nl
-   nlnetlabs.nl.   86400   IN      MX      100 omval.tednet.nl.
-   nlnetlabs.nl.   86400   IN      MX      50 open.nlnetlabs.nl.
-   
- - First of all, we need to include the correct header files, so - that all functions are available to us: - - \skip include - \until dns.h - - In this case we have used a configure script to generate a config.h file - that does all our inclusions for us, so that it can be compiled on - multiple platforms. If your platform supports the include files \c - stdint.h and \c stdlib.h, you can include these instead of using a - configure script. - - The first included files are prerequisites that ldns needs to function. - The last one, of course, includes the functions of ldns itself. - - In our main function, we declare some variables that we are going to use: - - \skipline ldns_resolver - \until ldns_status - - - The \c ldns_resolver structure keeps a list of nameservers, and can perform queries for us - - An \c ldns_rdf is a basic data type of dns, the RDATA. See \ref design for a description about the building blocks of DNS. - In this case, \c domain will be used to store the name the user specifies when calling the program - - An \c ldns_pkt is a DNS packet, for instance a complete query, or an answer - - The \c ldns_rr_list structure contains a list of DNS Resource Records (RRs). In this case, we will store the MX records we find in the list. - - \c ldns_status is the basic type for status messages in ldns. Most functions will return a value of this type. - - First, we parse the command line argument (checks omitted on this page, see full source code), and store it in our \c domain variable: - \skipline ldns_dname_new_frm_str - - This function takes a string containing a domain name (like - "nlnetlabs.nl") and returns an \c ldns_rdf representing that name. If - somehow the given string can not be parsed it returns NULL. - - Then, we create the resolver structure: - \skipline ldns_resolver_new - - Most of the functions work like this, the first argument is a pointer to - the structure where ldns should store its results (which is also a - pointer). The function returns a status code indicating success - (\ref LDNS_STATUS_OK) or an error number. Remember that these types of - functions allocate memory that you should free later (using the - ldns_free_ functions). - - The second argument is the filename that contains information about the - resolver structure that is to be created. If this argument is NULL, - /etc/resolv.conf is used. The syntax of the file is like that of - /etc/resolv.conf. - - - - We tell the resolver to query for our domain, type MX, of class IN: - \skipline ldns_resolver_query - \until ) - - The last argument contains flags to influence the type of query the - resolver structure sends. In this case, we want the nameserver to use - recursion, so that we'll get the final answer. Therefore, we specify the - \ref LDNS_RD (Recursion Desired) flag. - - This should return a packet if everything goes well. - - We get all RRs of type MX from the answer packet and store them in our list: - \skipline ldns_pkt_rr_list_by_type - \until ) - - If this list is not empty, we sort and print it: - \skipline ldns_rr_list_sort - \skipline ldns_rr_list_print - - And finally, just to be proper, we free our allocated data: - \skipline free( - \until resolver_deep_free - - For structures that can contain other ldns structures, there are two types of free() function available - - \c ldns_free_ frees only the allocated data for the structure itself. - - \c ldns_deep_free_ frees the structure, and ALL structures that - are nested in it. For example, of you \c deep_free an ldns_rr_list, - all \c ldns_rr structures that were present in the list are also - freed. - - -*/ diff --git a/libs/ldns/doc/tutorial2_zone.dox b/libs/ldns/doc/tutorial2_zone.dox deleted file mode 100644 index 680ccb46a3..0000000000 --- a/libs/ldns/doc/tutorial2_zone.dox +++ /dev/null @@ -1,111 +0,0 @@ -/** - \page tutorial2_zone Tutorial 2: Reading a zone file - \dontinclude ldns-read-zone.c - - The full source code can be found in \link examples/ldns-read-zone.c \endlink - - ldns-read-zone reads a zone file, and prints it to stdout, with 1 resource record per line. - -
-% cat example.zone
-$ORIGIN example.
-$TTL 600
-
-example.        IN SOA  example. op.example. (
-                                2004022501 ; serial
-                                28800      ; refresh (8 hours)
-                                7200       ; retry (2 hours)
-                                604800     ; expire (1 week)
-                                18000      ; minimum (5 hours)
-                                )
-
-@       IN      MX      10 mail.example.
-@       IN      NS      ns1
-@       IN      NS      ns2
-@       IN      A       123.123.123.123
-
-% ldns-read-zone example.zone
-example.        600     IN      SOA     example. op.example. 2004022501 28800 7200 604800 18000
-example.        600     IN      MX      10 mail.example.
-example.        600     IN      NS      ns1.example.
-example.        600     IN      NS      ns2.example.
-example.        600     IN      A       123.123.123.123
-   
- - - -Again, let's start with including some necessary header files: - -\skipline include -\until errno - -In this example, we are going to open a file, if that fails, we'll need errno.h to display an error message. - -Okay, let's declare the variables we are going to need today: - -\skipline filename -\until ldns_status - -The only two ldns-specific types here are \c ldns_zone and \c ldns_status. - - \c ldns_zone is the structure that can contain a complete zone - - \c ldns_status again is used to check return values of ldns functions - - -If we get no filename, we'll read standard input, otherwise, we'll try to -open the given filename: -\skipline if (argc == 0) -\until exit(EXIT_FAILURE) -\until } -\until } - - -With the \c FILE pointer in our hands, we visit ldns to pour it into a zone -structure: -\skipline ldns_zone_new_frm_fp_l - -There is also a \c ldns_zone_new_frm_fp, but this one also remembers the -line number it was on, so we can use that if we encounter a parse error. - -Just like in \ref tutorial1_mx, the first argument is a pointer -to the place ldns should store its creation in, and again, the return value -is the status code. - -The second argument is the file pointer where our zone data should reside. - -The third argument, if not NULL, is a \c dname that contains the zones -origin. It will place this dname after every name in the file that is not a -fully qualified domain name. - -The fourth argument, if not 0, is the default TTL to use. - -Both these values can be specified in the zone file by setting \c $ORIGIN and \c $TTL. - -The fifth argument specifies the default class, which defaults to IN (\ref LDNS_RR_CLASS_IN). - -And finally, every time \c ldns_zone_new_frm_fp_l reads a line from the -input file pointer, it will increment the value pointed to by the last -argument with 1. - - -Okay, with that, we should have a nice zone structure. Of course we need to -check whether it has succeeded. - -\skipline LDNS_STATUS_OK -\until deep_free - -If everything went well, we sort the zone if necessary, print it, and free it. - -Since \c ldns_zone contains other ldns structures, we use \c ldns_deep_free -so that every \c ldns_rr_list, \c ldns_rr et cetera are freed too. - -\until line_nr); -\until } - -If something went wrong, we use \c ldns_get_errorstr_by_id() to get a nice -error string instead of just a status integer. - -And of course, we should play nice and close the file: -\skipline fclose -\until exit - -*/ diff --git a/libs/ldns/doc/tutorial3_signzone.dox b/libs/ldns/doc/tutorial3_signzone.dox deleted file mode 100644 index 1943e557ae..0000000000 --- a/libs/ldns/doc/tutorial3_signzone.dox +++ /dev/null @@ -1,206 +0,0 @@ -/** - \page tutorial3_signzone Tutorial 3: Signing a zone file - \dontinclude ldns-signzone.c - - The full source code can be found in \link examples/ldns-signzone.c \endlink - - Of course, we start by the usual includes. Since we need a bit more here, - we'll add those right away. - - \skipline include - \until define - - Let's skip the boring usage() and sanity check functions, and dive right - into main(). - - \skipline main(int argc - \skipline { - - We'll be reading another zone file, so let's prepare some variables for that. - - \skipline zone - \until argi - - We will create a separate zone structure for the signed zone, so let's have a clear name for the original one. - - \skipline zone - \until zone - - To sign a zone, we need keys, so we need some variables to read and store it; - - \skipline key - \until status - - The \ref ldns_key structure holds (private) keys. These can be of any - supported algorithm type; you can put an RSA key in it, an DSA key, or an - HMAC key. Public keys can simply be put in an \ref ldns_rr structure with - type \ref LDNS_RR_TYPE_DNSKEY. - - The \ref ldns_key_list type is much like the \ref ldns_rr_list, only, you - guessed it, for \c ldns_key entries. - - - The signed zone will be stored in a new file. - - \skipline file - \until file - - And we have some command line options for the output zone. - - \skipline tm - \until class - - \c origin is a domain name, so it can be stored in an \ref ldns_rdf - variable with type \ref LDNS_RDF_TYPE_DNAME. - - The next part is option parsing, which is pretty straightforward using \c - getopt(), so we'll skip this too. U can always look to the source of the - file to check it out. - - Okay that's it for the variables, let's get to work! - - First we'll try to read in the zone that is to be signed. - - \skipline fopen(zone - \until } else { - - If the file exists and can be read, we'll let ldns mold it into a zone - structure: - - \skipline zone_new - - This creates a new (\c new) zone from (\c frm) a filepointer (\c fp), - while remembering the current line (\c l) in the input file (for error - messages). - - A pointer to the zone structure to be filled is passed as the first - argument, like in most \c new_frm functions. - - Like a lot of ldns functions, this one returns a \c ldns_status - indicating success or the type of failure, so let us check that. - - \skipline STATUS - \until } else { - - If everything is ok so far, we check if the zone has a SOA record and contains actual data. - - \skipline orig_soa - \until } - \until } - \until } - - Now that we have the complete zone in our memory, we won't be needing the file anymore. - - \skipline fclose - \until } - - If there was no origin given, we'll use the one derived from the original zone file. - - \skipline origin - \until } - - No signing party can be complete without keys to sign with, let's fetch those. - - Multiple key files can be specified on the command line, by using the - base names of the .key/.private file pairs. - - \skipline key - \until fopen - - As you can see, we append ".private" to the name, which should result in - the complete file name of the private key. Later we'll also form the - ".key" file name, which will be directly included in the signed zone. - - If the file exists, we'll read it and create a \c ldns_key from its - contents, much like the way we read the zone earlier. - - \skipline line_nr - \until STATUS - - If this went ok, we need to set the inception and expiration times, which - are set in the keys, but will eventually end up in the RRSIGs generated - by those keys. - - \skipline expiration - \until } - \skipline inception - \until } - - And now that we have read the private keys, we read the public keys and - add them to the zone. - - Reading them from the files works roughly the same as reading private - keys, but public keys are normal Resource Records, and they can be stored - in general \c ldns_rr structures. - - \skipline FREE - \until } - \until } - - With \c push() we add them to our key list and our zone. This function - clones the data, so we can safely free it after that. - - \skipline push - \until free - - And if we're done, we free the allocated memory for the file name. - - \until FREE - - If the reading did not work, we print an error. Finally, we move on to - the next key in the argument list. - - \skipline } else { - \until } - \until } - \until } - - Just to be sure, we add a little check to see if we actually have any keys now. - - \skipline count - \until } - - So, we have our zone, we have our keys, let's do some signing! - - \skipline sign - - Yes. That's it. We now have a completely signed zone, \c ldns_zone_sign - checks the keys, and uses the zone signing keys to sign the data resource - records. NSEC and RRSIG resource records are generated and added to the - new zone. - - So now that we have a signed zone, all that is left is to store it somewhere. - - If no explicit output file name was given, we'll just append ".signed" to - the original zone file name. - - \skipline outputfile - \until } - - \c ldns_zone_sign returns NULL if the signing did not work, so we must check that. - - \skipline signed_zone - \until } else { - - Writing to a file is no different than normal printing, so we'll print to - the file and close it. - - \skipline print - \until } - - And of course, give an error if the signing failed. - - \skipline } else { - \until } - - Just to be nice, let's free the rest of the data we allocated, and exit - with the right return value. - - \skipline free - \until } - - - - - -*/ \ No newline at end of file diff --git a/libs/ldns/drill/ChangeLog.22-nov-2005 b/libs/ldns/drill/ChangeLog.22-nov-2005 deleted file mode 100644 index 1ce8b0b7c0..0000000000 --- a/libs/ldns/drill/ChangeLog.22-nov-2005 +++ /dev/null @@ -1,105 +0,0 @@ ---------- Drill now is a subdirectory in ldns. To make life easier ---------- we are using ldns' version numbering for drill from now on. ---------- Sadly this means we GO BACKWARDS in the versions ---------- This ChangeLog will not be updated anymore - all changes are ---------- documented in ldns' ChangeLog - -1.0-pre3: to be released: drill-team - * Secure tracing works - * Added section about DNSSEC in the manual page - * Allow the class information to be given to do_chase() - * Lint fixes for the code - * Bugzilla was setup for drill - * Bug #97 (drill); -S crash was fixed - * Add -Q (quiet) flag was added. This supresses output from drill. - -1.0-pre2: 20 Jun 2005: drill-team - * Second prerelease - * Bugs where fix in the chasing functionality - -1.0-pre1: 1 Jun 2005: drill-team - * First drill release based on ldns - * drill's core code is not much more simple, as - all the difficult stuff is moved to ldns. - * Much saner argument parsing - ----------- Above Newer drill based on ldns -------------- ----------- Below Older drill with it's own DNS handling -------------- - -0.9.2: Feb 3 2005: drill-team - * Added two more options (borrowed from dig) - --rd, don't set the RD bit in queries - --fail, don't query the next nameserver on SERVFAIL - * Fixed handling of obscure data types - * Handle classes other the 'IN' when making a query - - * For people using FreeBSD: drill is now in the ports - (Thanks to Jaap Akkerhuis) - -0.9.1: Jan 5 2005: drill-team - * Makefile tweaks - * drill ns . works - * re-check the root in when tracing - * added handling for some lesser known types (including WKS) - -0.9: Dec 6 2004: drill-team - * big configure.ac and Makefile.in updates (made more general) - * escapes in names argument and txt and dname data - * gcc 2(.95) support - * packet wire data is now checked for dangerous elements (like - looping compression etc) - * (Multiple) Octal char representation - * Responses can be saved to file - * 'Answers' can be read from file instead of server - * Lots and lots of bugfixes and improvements - -0.8.1: Oct 27 2004: Miek - * configure.ac updates - * secure resolving updates (still doesn't work) - * printing additions - - CERT RR supported - - LOC RR support - * All non supported RRs are handled as unknown - * If no namservers found in /etc/resolv.conf - default to 127.0.0.1 - * Various bugs fixed - - Close sockets after using them - - Some memory leaks were plugged - -0.8: Oct 26 2004: Miek - * Lots of features added. Drill is almost feature complete - * Unknown RR's are supported - * Numerous smaller updates in documentation - * Numerous code cleanups - * Dig is no longer needed to build drill - -0.7: Oct 21 2004: Miek - * reworked interal code - * DNSSEC is working, except the secure resolving - * build updates - * more sane options parsing - * more sane argument handling - -0.6-alpha: Oct 2004: Jelte - * No log - -0.5-alpha: Sept 22 2004: Miek - * most of the DNS stuff is working - * moved to configure - * tested on Linux/FreeBSD - * fully IPV6 capable - * new DNSSEC types supported - * DNSSEC somewhat working - * gcc => 3 is needed for building - -0.4-alpha: Sept 9 2004: Miek - * moved to autoconf for building - * lots of various updates - * really a workable program now - -0.3-alpha: Sept 6 2004: Miek - * IPv6 support - * automatic secure resolving - * --trace updates - * --chase updates - * more checks diff --git a/libs/ldns/drill/Makefile.in b/libs/ldns/drill/Makefile.in deleted file mode 100644 index 653cc51bce..0000000000 --- a/libs/ldns/drill/Makefile.in +++ /dev/null @@ -1,117 +0,0 @@ -# Standard installation pathnames -# See the file LICENSE for the license -SHELL = @SHELL@ -VERSION = @PACKAGE_VERSION@ -basesrcdir = $(shell basename `pwd`) -srcdir = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -mandir = @mandir@ -includedir = @includedir@ - -CC = @CC@ -CFLAGS = -I. @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -INSTALL = $(srcdir)/install-sh -c -INSTALL_PROGRAM = $(INSTALL) -LDNSDIR = @LDNSDIR@ -LIBS_STC = @LIBS_STC@ - -COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) -LINK = $(CC) $(CFLAGS) $(LDFLAGS) - -LINT = splint -LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -#-Dglob64=glob -Dglobfree64=globfree -# compat with openssl linux edition. -LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -# compat with NetBSD -ifeq "$(shell uname)" "NetBSD" -LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ -endif -# compat with OpenBSD -LINTFLAGS+="-Dsigset_t=long" -# FreeBSD8 -LINTFLAGS+="-D__uint16_t=uint16_t" -LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)=" - -OBJ=drill.o drill_util.o error.o root.o work.o chasetrace.o dnssec.o securetrace.o -SRC=$(OBJ:.o=.c) - -HEADER=drill.h $(srcdir)/drill_util.h - -.PHONY: all clean realclean docclean doc release tags install all-static - -all: drill -all-static: drill-stc - -tags: - ctags *.[ch] - -drill: $(OBJ) - $(LINK) -o drill $(OBJ) $(LIBS) - -drill-stc: $(OBJ) - $(LINK) -o drill $(OBJ) $(LIBS_STC) - -## implicit rule -%.o: $(srcdir)/%.c - $(COMPILE) -c $< - -clean: - rm -f ${OBJ} - rm -f drill - rm -f *core - rm -f config.h.in~ - rm -f config.log - rm -f config.guess - rm -f config.status - -docclean: - rm -rf doxydoc - -distclean: clean docclean - rm -f config.h - rm -f drill.h - -realclean: clean docclean - rm -f tags - rm -f config.log - rm -f config.sub - rm -f ltmain.sh - rm -f config.status - rm -rf autom4te.cache - rm -f config.h - rm -f config.h.in - rm -f drill.h - rm -f configure - rm -f Makefile - rm -f aclocal.m4 - -doc: - doxygen drill.doxygen - -install: all - $(INSTALL) -d $(DESTDIR)$(bindir) - $(INSTALL) drill $(DESTDIR)$(bindir)/drill - $(INSTALL) -m 644 $(srcdir)/drill.1 $(DESTDIR)$(mandir)/man1/drill.1 - -uninstall: - @echo - rm -f -- $(DESTDIR)$(bindir)/drill - rm -f -- $(DESTDIR)$(mandir)/man1/drill.1 - rmdir -p $(DESTDIR)$(bindir) - rmdir -p $(DESTDIR)$(mandir)/man1 - @echo - -lint: - @for i in $(SRC) ; do \ - $(LINT) $(LINTFLAGS) $(CPPFLAGS) -I$(srcdir) $(srcdir)/$$i ; \ - if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ - done - -confclean: clean - rm -rf config.log config.status config.h Makefile diff --git a/libs/ldns/drill/README b/libs/ldns/drill/README deleted file mode 100644 index bbbb816ef4..0000000000 --- a/libs/ldns/drill/README +++ /dev/null @@ -1,12 +0,0 @@ -QUICK INSTALL GUIDE - -drill is a subdirectory in ldns. - -To compile drill you need: -autoreconf && ./configure && make - -If ldns is installed in a different location, use --with-ldns=directory -See also ./configure --help - -In the first case you must run drill as: -LD_LIBRARY_PATH=../.libs ./drill diff --git a/libs/ldns/drill/REGRESSIONS b/libs/ldns/drill/REGRESSIONS deleted file mode 100644 index b8f6be9cc9..0000000000 --- a/libs/ldns/drill/REGRESSIONS +++ /dev/null @@ -1,25 +0,0 @@ -REGRESSIONS - -This version of drill is based on ldns and as such some things -are slightly changed. This file documents the changes. - -o When tracing (-T option) we use the local resolver (as specified - in /etc/resolv.conf) to lookup names. This increases the speed - dramatically, but you obviously need to be able to reach a recursive - server/cache. - Previously drill would try to resolve the names by itself. - -o Printing of DSs after DNSKEY records. Because we don't parse our - own packets anymore, we cannot print the DS directly after the DNSKEY - record. The DSs are now printed AFTER the packet. - -o The long options are removed. - -o The chase function has a different output, and will be subject to change - in the near future. - -o The useless (for jokes only) -I option was dropped. - -FIXED: -o the argument parsing is much smarter, the order doesn't matter (much) - anymore diff --git a/libs/ldns/drill/chasetrace.c b/libs/ldns/drill/chasetrace.c deleted file mode 100644 index a1dfd44681..0000000000 --- a/libs/ldns/drill/chasetrace.c +++ /dev/null @@ -1,401 +0,0 @@ -/* - * chasetrace.c - * Where all the hard work concerning chasing - * and tracing is done - * (c) 2005, 2006 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include - -/** - * trace down from the root to name - */ - -/* same naive method as in drill0.9 - * We resolver _ALL_ the names, which is ofcourse not needed - * We _do_ use the local resolver to do that, so it still is - * fast, but it can be made to run much faster - */ -ldns_pkt * -do_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, - ldns_rr_class c) -{ - ldns_resolver *res; - ldns_pkt *p; - ldns_rr_list *new_nss_a; - ldns_rr_list *new_nss_aaaa; - ldns_rr_list *final_answer; - ldns_rr_list *new_nss; - ldns_rr_list *hostnames; - ldns_rr_list *ns_addr; - uint16_t loop_count; - ldns_rdf *pop; - ldns_status status; - size_t i; - - loop_count = 0; - new_nss_a = NULL; - new_nss_aaaa = NULL; - new_nss = NULL; - ns_addr = NULL; - final_answer = NULL; - p = ldns_pkt_new(); - res = ldns_resolver_new(); - - if (!p || !res) { - error("Memory allocation failed"); - return NULL; - } - - /* transfer some properties of local_res to res, - * because they were given on the commandline */ - ldns_resolver_set_ip6(res, - ldns_resolver_ip6(local_res)); - ldns_resolver_set_port(res, - ldns_resolver_port(local_res)); - ldns_resolver_set_debug(res, - ldns_resolver_debug(local_res)); - ldns_resolver_set_dnssec(res, - ldns_resolver_dnssec(local_res)); - ldns_resolver_set_fail(res, - ldns_resolver_fail(local_res)); - ldns_resolver_set_usevc(res, - ldns_resolver_usevc(local_res)); - ldns_resolver_set_random(res, - ldns_resolver_random(local_res)); - ldns_resolver_set_recursive(res, false); - - /* setup the root nameserver in the new resolver */ - status = ldns_resolver_push_nameserver_rr_list(res, global_dns_root); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error adding root servers to resolver: %s\n", ldns_get_errorstr_by_id(status)); - ldns_rr_list_print(stdout, global_dns_root); - return NULL; - } - - /* this must be a real query to local_res */ - status = ldns_resolver_send(&p, res, ldns_dname_new_frm_str("."), LDNS_RR_TYPE_NS, c, 0); - /* p can still be NULL */ - - - if (ldns_pkt_empty(p)) { - warning("No root server information received"); - } - - if (status == LDNS_STATUS_OK) { - if (!ldns_pkt_empty(p)) { - drill_pkt_print(stdout, local_res, p); - } - } else { - error("cannot use local resolver"); - return NULL; - } - - status = ldns_resolver_send(&p, res, name, t, c, 0); - - while(status == LDNS_STATUS_OK && - ldns_pkt_reply_type(p) == LDNS_PACKET_REFERRAL) { - - if (!p) { - /* some error occurred, bail out */ - return NULL; - } - - new_nss_a = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); - new_nss_aaaa = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_AAAA, LDNS_SECTION_ADDITIONAL); - new_nss = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); - - if (verbosity != -1) { - ldns_rr_list_print(stdout, new_nss); - } - /* checks itself for verbosity */ - drill_pkt_print_footer(stdout, local_res, p); - - /* remove the old nameserver from the resolver */ - while((pop = ldns_resolver_pop_nameserver(res))) { /* do it */ } - - /* also check for new_nss emptyness */ - - if (!new_nss_aaaa && !new_nss_a) { - /* - * no nameserver found!!! - * try to resolve the names we do got - */ - for(i = 0; i < ldns_rr_list_rr_count(new_nss); i++) { - /* get the name of the nameserver */ - pop = ldns_rr_rdf(ldns_rr_list_rr(new_nss, i), 0); - if (!pop) { - break; - } - - ldns_rr_list_print(stdout, new_nss); - ldns_rdf_print(stdout, pop); - /* retrieve it's addresses */ - ns_addr = ldns_rr_list_cat_clone(ns_addr, - ldns_get_rr_list_addr_by_name(local_res, pop, c, 0)); - } - - if (ns_addr) { - if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != - LDNS_STATUS_OK) { - error("Error adding new nameservers"); - ldns_pkt_free(p); - return NULL; - } - ldns_rr_list_free(ns_addr); - } else { - ldns_rr_list_print(stdout, ns_addr); - error("Could not find the nameserver ip addr; abort"); - ldns_pkt_free(p); - return NULL; - } - } - - /* add the new ones */ - if (new_nss_aaaa) { - if (ldns_resolver_push_nameserver_rr_list(res, new_nss_aaaa) != - LDNS_STATUS_OK) { - error("adding new nameservers"); - ldns_pkt_free(p); - return NULL; - } - } - if (new_nss_a) { - if (ldns_resolver_push_nameserver_rr_list(res, new_nss_a) != - LDNS_STATUS_OK) { - error("adding new nameservers"); - ldns_pkt_free(p); - return NULL; - } - } - - if (loop_count++ > 20) { - /* unlikely that we are doing something usefull */ - error("Looks like we are looping"); - ldns_pkt_free(p); - return NULL; - } - - status = ldns_resolver_send(&p, res, name, t, c, 0); - new_nss_aaaa = NULL; - new_nss_a = NULL; - ns_addr = NULL; - } - - status = ldns_resolver_send(&p, res, name, t, c, 0); - - if (!p) { - return NULL; - } - - hostnames = ldns_get_rr_list_name_by_addr(local_res, - ldns_pkt_answerfrom(p), 0, 0); - - new_nss = ldns_pkt_authority(p); - final_answer = ldns_pkt_answer(p); - - if (verbosity != -1) { - ldns_rr_list_print(stdout, final_answer); - ldns_rr_list_print(stdout, new_nss); - - } - drill_pkt_print_footer(stdout, local_res, p); - ldns_pkt_free(p); - return NULL; -} - - -/** - * Chase the given rr to a known and trusted key - * - * Based on drill 0.9 - * - * the last argument prev_key_list, if not null, and type == DS, then the ds - * rr list we have must all be a ds for the keys in this list - */ -#ifdef HAVE_SSL -ldns_status -do_chase(ldns_resolver *res, - ldns_rdf *name, - ldns_rr_type type, - ldns_rr_class c, - ldns_rr_list *trusted_keys, - ldns_pkt *pkt_o, - uint16_t qflags, - ldns_rr_list *prev_key_list, - int verbosity) -{ - ldns_rr_list *rrset = NULL; - ldns_status result; - ldns_rr *orig_rr = NULL; - - bool cname_followed = false; -/* - ldns_rr_list *sigs; - ldns_rr *cur_sig; - uint16_t sig_i; - ldns_rr_list *keys; -*/ - ldns_pkt *pkt; - ldns_status tree_result; - ldns_dnssec_data_chain *chain; - ldns_dnssec_trust_tree *tree; - - const ldns_rr_descriptor *descriptor; - descriptor = ldns_rr_descript(type); - - ldns_dname2canonical(name); - - pkt = ldns_pkt_clone(pkt_o); - if (!name) { - mesg("No name to chase"); - ldns_pkt_free(pkt); - return LDNS_STATUS_EMPTY_LABEL; - } - if (verbosity != -1) { - printf(";; Chasing: "); - ldns_rdf_print(stdout, name); - if (descriptor && descriptor->_name) { - printf(" %s\n", descriptor->_name); - } else { - printf(" type %d\n", type); - } - } - - if (!trusted_keys || ldns_rr_list_rr_count(trusted_keys) < 1) { - warning("No trusted keys specified"); - } - - if (pkt) { - rrset = ldns_pkt_rr_list_by_name_and_type(pkt, - name, - type, - LDNS_SECTION_ANSWER - ); - if (!rrset) { - /* nothing in answer, try authority */ - rrset = ldns_pkt_rr_list_by_name_and_type(pkt, - name, - type, - LDNS_SECTION_AUTHORITY - ); - } - /* answer might be a cname, chase that first, then chase - cname target? (TODO) */ - if (!rrset) { - cname_followed = true; - rrset = ldns_pkt_rr_list_by_name_and_type(pkt, - name, - LDNS_RR_TYPE_CNAME, - LDNS_SECTION_ANSWER - ); - if (!rrset) { - /* nothing in answer, try authority */ - rrset = ldns_pkt_rr_list_by_name_and_type(pkt, - name, - LDNS_RR_TYPE_CNAME, - LDNS_SECTION_AUTHORITY - ); - } - } - } else { - /* no packet? */ - if (verbosity >= 0) { - fprintf(stderr, "%s", ldns_get_errorstr_by_id(LDNS_STATUS_MEM_ERR)); - fprintf(stderr, "\n"); - } - return LDNS_STATUS_MEM_ERR; - } - - if (!rrset) { - /* not found in original packet, try again */ - ldns_pkt_free(pkt); - pkt = NULL; - pkt = ldns_resolver_query(res, name, type, c, qflags); - - if (!pkt) { - if (verbosity >= 0) { - fprintf(stderr, "%s", ldns_get_errorstr_by_id(LDNS_STATUS_NETWORK_ERR)); - fprintf(stderr, "\n"); - } - return LDNS_STATUS_NETWORK_ERR; - } - if (verbosity >= 5) { - ldns_pkt_print(stdout, pkt); - } - - rrset = ldns_pkt_rr_list_by_name_and_type(pkt, - name, - type, - LDNS_SECTION_ANSWER - ); - } - - orig_rr = ldns_rr_new(); - -/* if the answer had no answer section, we need to construct our own rr (for instance if - * the rr qe asked for doesn't exist. This rr will be destroyed when the chain is freed */ - if (ldns_pkt_ancount(pkt) < 1) { - ldns_rr_set_type(orig_rr, type); - ldns_rr_set_owner(orig_rr, ldns_rdf_clone(name)); - - chain = ldns_dnssec_build_data_chain(res, qflags, rrset, pkt, ldns_rr_clone(orig_rr)); - } else { - /* chase the first answer */ - chain = ldns_dnssec_build_data_chain(res, qflags, rrset, pkt, NULL); - } - - if (verbosity >= 4) { - printf("\n\nDNSSEC Data Chain:\n"); - ldns_dnssec_data_chain_print(stdout, chain); - } - - result = LDNS_STATUS_OK; - - tree = ldns_dnssec_derive_trust_tree(chain, NULL); - - if (verbosity >= 2) { - printf("\n\nDNSSEC Trust tree:\n"); - ldns_dnssec_trust_tree_print(stdout, tree, 0, true); - } - - if (ldns_rr_list_rr_count(trusted_keys) > 0) { - tree_result = ldns_dnssec_trust_tree_contains_keys(tree, trusted_keys); - - if (tree_result == LDNS_STATUS_DNSSEC_EXISTENCE_DENIED) { - if (verbosity >= 1) { - printf("Existence denied or verifiably insecure\n"); - } - result = LDNS_STATUS_OK; - } else if (tree_result != LDNS_STATUS_OK) { - if (verbosity >= 1) { - printf("No trusted keys found in tree: first error was: %s\n", ldns_get_errorstr_by_id(tree_result)); - } - result = tree_result; - } - - } else { - if (verbosity >= 0) { - printf("You have not provided any trusted keys.\n"); - } - } - - ldns_rr_free(orig_rr); - ldns_dnssec_trust_tree_free(tree); - ldns_dnssec_data_chain_deep_free(chain); - - ldns_rr_list_deep_free(rrset); - ldns_pkt_free(pkt); - /* ldns_rr_free(orig_rr);*/ - - return result; -} -#endif /* HAVE_SSL */ - diff --git a/libs/ldns/drill/config.h.in b/libs/ldns/drill/config.h.in deleted file mode 100644 index 9b2a282a8e..0000000000 --- a/libs/ldns/drill/config.h.in +++ /dev/null @@ -1,293 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASSERT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CTYPE_H - -/* Whether getaddrinfo is available */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_GETOPT_H - -/* If you have HMAC_CTX_init */ -#undef HAVE_HMAC_CTX_INIT - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `isblank' function. */ -#undef HAVE_ISBLANK - -/* Define to 1 if you have the `ldns' library (-lldns). */ -#undef HAVE_LIBLDNS - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IF_ETHER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_SYSTM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP6_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_UDP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_ERR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_RAND_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_SSL_H - -/* Define if you have the SSL libraries installed. */ -#undef HAVE_SSL - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MOUNT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WINSOCK2_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WS2TCPIP_H - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Whether the windows socket API is used */ -#undef USE_WINSOCK - -/* the version of the windows API enabled */ -#undef WINVER - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* in_addr_t */ -#undef in_addr_t - -/* in_port_t */ -#undef in_port_t - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `short' if does not define. */ -#undef int16_t - -/* Define to `int' if does not define. */ -#undef int32_t - -/* Define to `long long' if does not define. */ -#undef int64_t - -/* Define to `char' if does not define. */ -#undef int8_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to 'int' if not defined */ -#undef socklen_t - -/* Define to `int' if does not define. */ -#undef ssize_t - -/* Define to `unsigned short' if does not define. */ -#undef uint16_t - -/* Define to `unsigned int' if does not define. */ -#undef uint32_t - -/* Define to `unsigned long long' if does not define. */ -#undef uint64_t - -/* Define to `unsigned char' if does not define. */ -#undef uint8_t - - - -#include -#include -#include -#include - -#if STDC_HEADERS -#include -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_NETINET_UDP_H -#include -#endif - -#ifdef HAVE_TIME_H -#include -#endif - -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif - -#ifdef HAVE_NETINET_IP_H -#include -#endif - -#ifdef HAVE_NET_IF_H -#include -#endif - -#ifdef HAVE_NETINET_IF_ETHER_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#define USE_WINSOCK 1 -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -extern char *optarg; -extern int optind, opterr; - -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif - -#ifdef S_SPLINT_S -#define FD_ZERO(a) /* a */ -#define FD_SET(a,b) /* a, b */ -#endif - diff --git a/libs/ldns/drill/configure b/libs/ldns/drill/configure deleted file mode 100755 index 2c79eb811b..0000000000 --- a/libs/ldns/drill/configure +++ /dev/null @@ -1,6663 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for ldns 1.6.9. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: libdns@nlnetlabs.nl about your system, including any -$0: error possibly output before this message. Then install -$0: a modern shell, or manually run the script under such a -$0: shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='ldns' -PACKAGE_TARNAME='libdns' -PACKAGE_VERSION='1.6.9' -PACKAGE_STRING='ldns 1.6.9' -PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' -PACKAGE_URL='' - -ac_unique_file="drill.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='LTLIBOBJS -LIBOBJS -LDNSDIR -LIBS_STC -RUNTIME_PATH -HAVE_SSL -libtool -SET_MAKE -EGREP -GREP -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_rpath -with_ssl -with_ldns -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CPPFLAGS -CC -LDFLAGS -LIBS -CPPFLAGS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -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_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$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 ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$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 | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$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 ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - 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 | -n) - 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 ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$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_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=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 ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# 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 the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - 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 - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of ldns 1.6.9:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-rpath disable hardcoded rpath (default=enabled) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl - /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw - /usr) - --with-ldns=PATH specify prefix of path of ldns library to use - - - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -ldns configure 1.6.9 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------- ## -## Report this to libdns@nlnetlabs.nl ## -## ---------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* 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_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by ldns $as_me 1.6.9, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# acx_nlnetlabs.m4 - common macros for configure checks -# Copyright 2009, Wouter Wijngaards, NLnet Labs. -# BSD licensed. -# -# Version 11 -# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. -# 2010-07-02 Add check for ss_family (for minix). -# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. -# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. -# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl -# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN -# 2010-01-20 added AHX_COONFIG_STRLCAT -# 2009-07-14 U_CHAR detection improved for windows crosscompile. -# added ACX_FUNC_MALLOC -# fixup some #if to #ifdef -# NONBLOCKING test for mingw crosscompile. -# 2009-07-13 added ACX_WITH_SSL_OPTIONAL -# 2009-07-03 fixup LDFLAGS for empty ssl dir. -# -# Automates some of the checking constructs. Aims at portability for POSIX. -# Documentation for functions is below. -# -# the following macro's are provided in this file: -# (see below for details on each macro). -# -# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. -# ACX_RSRC_VERSION - create windows resource version number. -# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. -# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). -# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. -# ACX_DEPFLAG - find cc dependency flags. -# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. -# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. -# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. -# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. -# ACX_TYPE_U_CHAR - u_char type. -# ACX_TYPE_RLIM_T - rlim_t type. -# ACX_TYPE_SOCKLEN_T - socklen_t type. -# ACX_TYPE_IN_ADDR_T - in_addr_t type. -# ACX_TYPE_IN_PORT_T - in_port_t type. -# ACX_ARG_RPATH - add --disable-rpath option. -# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. -# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, -# where --without-ssl is also accepted -# ACX_LIB_SSL - setup to link -lssl. -# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. -# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. -# ACX_FUNC_DEPRECATED - see if func is deprecated. -# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. -# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. -# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. -# ACX_FUNC_MALLOC - check malloc, define replacement . -# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. -# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. -# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. -# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. -# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. -# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. -# AHX_CONFIG_SNPRINTF - snprintf compat prototype -# AHX_CONFIG_INET_PTON - inet_pton compat prototype -# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype -# AHX_CONFIG_INET_ATON - inet_aton compat prototype -# AHX_CONFIG_MEMMOVE - memmove compat prototype -# AHX_CONFIG_STRLCAT - strlcat compat prototype -# AHX_CONFIG_STRLCPY - strlcpy compat prototype -# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype -# AHX_CONFIG_W32_SLEEP - w32 compat for sleep -# AHX_CONFIG_W32_USLEEP - w32 compat for usleep -# AHX_CONFIG_W32_RANDOM - w32 compat for random -# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom -# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. -# ACX_CFLAGS_STRIP - strip one flag from CFLAGS -# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS -# AHX_CONFIG_FLAG_OMITTED - define omitted flag -# AHX_CONFIG_FLAG_EXT - define omitted extension flag -# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags -# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. -# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. -# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -OURCPPFLAGS='' -CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} -OURCFLAGS='-g' -CFLAGS=${CFLAGS:-${OURCFLAGS}} - -$as_echo "#define WINVER 0x0502" >>confdefs.h - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#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)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : - MINIX=yes -else - MINIX= -fi - - - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h - - -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h - - -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_define___extensions__=yes -else - ac_cv_safe_to_define___extensions__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h - - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h - - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -for ac_prog in glibtool libtool15 libtool -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_libtool+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$libtool"; then - ac_cv_prog_libtool="$libtool" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_libtool="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -libtool=$ac_cv_prog_libtool -if test -n "$libtool"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libtool" >&5 -$as_echo "$libtool" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$libtool" && break -done -test -n "$libtool" || libtool="../libtool" - - -# add option to disable the evil rpath -# Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : - enableval=$enable_rpath; enable_rpath=$enableval -else - enable_rpath=yes -fi - - -if test "x$enable_rpath" = xyes; then - RPATH_VAL="-Wl,-rpath=\${libdir}" -fi - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 -$as_echo_n "checking whether $CC supports -std=c99... " >&6; } -cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-std=c99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 -$as_echo_n "checking whether $CC supports -xc99... " >&6; } -cache=`echo xc99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-xc99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 -$as_echo_n "checking whether $CC supports -O2... " >&6; } -cache=`echo O2 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS -O2" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 -$as_echo_n "checking whether $CC supports -Werror... " >&6; } -cache=`echo Werror | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -ERRFLAG="-Werror" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: -ERRFLAG="-errwarn" -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 -$as_echo_n "checking whether $CC supports -Wall... " >&6; } -cache=`echo Wall | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -ERRFLAG="$ERRFLAG -Wall" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: -ERRFLAG="$ERRFLAG -errfmt" -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC" >&5 -$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC... " >&6; } -cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 -$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } -cache=`$as_echo "$C99FLAG" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo '#include ' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS $C99FLAG" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" -if test "x$ac_cv_type_int8_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int8_t char -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" -if test "x$ac_cv_type_int16_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int16_t short -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" -if test "x$ac_cv_type_int32_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int32_t int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" -if test "x$ac_cv_type_int64_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int64_t long long -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" -if test "x$ac_cv_type_uint8_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint8_t unsigned char -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" -if test "x$ac_cv_type_uint16_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint16_t unsigned short -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" -if test "x$ac_cv_type_uint32_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint32_t unsigned int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" -if test "x$ac_cv_type_uint64_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint64_t unsigned long long -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define ssize_t int -_ACEOF - -fi - - -for ac_header in sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " -$ac_includes_default -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NET_IF_H -#include -#endif -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -# MinGW32 tests -for ac_header in winsock2.h ws2tcpip.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " -$ac_includes_default -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_WS2TCPIP_H -# include -#endif - -" -if test "x$ac_cv_type_socklen_t" = xyes; then : - -else - -$as_echo "#define socklen_t int" >>confdefs.h - -fi - -for ac_header in sys/param.h sys/mount.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default - - - #if HAVE_SYS_PARAM_H - # include - #endif - - -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -" -if test "x$ac_cv_type_in_addr_t" = xyes; then : - -else - -$as_echo "#define in_addr_t uint32_t" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -" -if test "x$ac_cv_type_in_port_t" = xyes; then : - -else - -$as_echo "#define in_port_t uint16_t" >>confdefs.h - -fi - - -# check to see if libraries are needed for these functions. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 -$as_echo_n "checking for library containing socket... " >&6; } -if ${ac_cv_search_socket+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char socket (); -int -main () -{ -return socket (); - ; - return 0; -} -_ACEOF -for ac_lib in '' socket; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_socket=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_socket+:} false; then : - break -fi -done -if ${ac_cv_search_socket+:} false; then : - -else - ac_cv_search_socket=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 -$as_echo "$ac_cv_search_socket" >&6; } -ac_res=$ac_cv_search_socket -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 -$as_echo_n "checking for library containing inet_pton... " >&6; } -if ${ac_cv_search_inet_pton+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char inet_pton (); -int -main () -{ -return inet_pton (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_inet_pton=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_inet_pton+:} false; then : - break -fi -done -if ${ac_cv_search_inet_pton+:} false; then : - -else - ac_cv_search_inet_pton=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 -$as_echo "$ac_cv_search_inet_pton" >&6; } -ac_res=$ac_cv_search_inet_pton -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - - - -# Check whether --with-ssl was given. -if test "${with_ssl+set}" = set; then : - withval=$with_ssl; - -else - - withval="yes" - -fi - - - withval=$withval - if test x_$withval != x_no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 -$as_echo_n "checking for SSL... " >&6; } - if test x_$withval = x_ -o x_$withval = x_yes; then - withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" - fi - for dir in $withval; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl="yes" - -cat >>confdefs.h <<_ACEOF -#define HAVE_SSL /**/ -_ACEOF - - if test "$ssldir" != "/usr"; then - CPPFLAGS="$CPPFLAGS -I$ssldir/include" - LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" - fi - break; - fi - done - if test x_$found_ssl != x_yes; then - as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 -$as_echo "found in $ssldir" >&6; } - HAVE_SSL=yes - if test "$ssldir" != "/usr" -a "$ssldir" != ""; then - LDFLAGS="$LDFLAGS -L$ssldir/lib" - LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" - - if test "x$enable_rpath" = xyes; then - if echo "$ssldir/lib" | grep "^/" >/dev/null; then - RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" - fi - fi - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 -$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } - LIBS="$LIBS -lcrypto" - LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - # check if -lwsock32 or -lgdi32 are needed. - BAKLIBS="$LIBS" - BAKSSLLIBS="$LIBSSL_LIBS" - LIBS="$LIBS -lgdi32" - LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 -$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LIBS="$BAKLIBS" - LIBSSL_LIBS="$BAKSSLLIBS" - LIBS="$LIBS -ldl" - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 -$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - - - # openssl engine functionality needs dlopen(). - BAKLIBS="$LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if ${ac_cv_search_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -for ac_lib in '' dl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_dlopen+:} false; then : - break -fi -done -if ${ac_cv_search_dlopen+:} false; then : - -else - ac_cv_search_dlopen=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - if test "$LIBS" != "$BAKLIBS"; then - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - fi - fi -for ac_header in openssl/ssl.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_SSL_H 1 -_ACEOF - -fi - -done - -for ac_header in openssl/err.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_err_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_ERR_H 1 -_ACEOF - -fi - -done - -for ac_header in openssl/rand.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_rand_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_RAND_H 1 -_ACEOF - -fi - -done - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 -$as_echo_n "checking for getaddrinfo... " >&6; } -ac_cv_func_getaddrinfo=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef __cplusplus -extern "C" -{ -#endif -char* getaddrinfo(); -char* (*f) () = getaddrinfo; -#ifdef __cplusplus -} -#endif -int main() { - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_getaddrinfo="yes" -else - ORIGLIBS="$LIBS" -LIBS="$LIBS -lws2_32" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -int -main () -{ - - (void)getaddrinfo(NULL, NULL, NULL, NULL); - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - -ac_cv_func_getaddrinfo="yes" - -$as_echo "#define USE_WINSOCK 1" >>confdefs.h - -USE_WINSOCK="1" - -else - -ac_cv_func_getaddrinfo="no" -LIBS="$ORIGLIBS" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 -$as_echo "$ac_cv_func_getaddrinfo" >&6; } -if test $ac_cv_func_getaddrinfo = yes; then - -$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h - -fi - - -LIBS_STC="$LIBS" - - -# check for ldns - -# Check whether --with-ldns was given. -if test "${with_ldns+set}" = set; then : - withval=$with_ldns; - specialldnsdir="$withval" - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" - LDNSDIR="$withval" - LIBS="-lldns $LIBS" - LIBS_STC="$withval/lib/libldns.a $LIBS_STC" - - -fi - - -#AC_CHECK_HEADER(ldns/ldns.h,, [ -# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) -# ], [AC_INCLUDES_DEFAULT] -#) - -for ac_func in isblank -do : - ac_fn_c_check_func "$LINENO" "isblank" "ac_cv_func_isblank" -if test "x$ac_cv_func_isblank" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_ISBLANK 1 -_ACEOF - -fi -done - - -# check for ldns development source tree -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns devel source" >&5 -$as_echo_n "checking for ldns devel source... " >&6; } -ldns_dev_dir=.. -if test -f $ldns_dev_dir/ldns/util.h && \ - grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then - ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $ldns_dev_dir with $ldns_version" >&5 -$as_echo "using $ldns_dev_dir with $ldns_version" >&6; } - CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" - LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" - LIBS="-lldns $LIBS" - -$as_echo "#define HAVE_LIBLDNS 1" >>confdefs.h - - LDNSDIR="$ldns_dev_dir" - LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 -$as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } -if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lldns $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char ldns_rr_new (); -int -main () -{ -return ldns_rr_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ldns_ldns_rr_new=yes -else - ac_cv_lib_ldns_ldns_rr_new=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 -$as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } -if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLDNS 1 -_ACEOF - - LIBS="-lldns $LIBS" - -else - - as_fn_error $? "Can't find ldns library" "$LINENO" 5 - - -fi - -fi - - - - - -ac_config_files="$ac_config_files Makefile drill.h" - -ac_config_headers="$ac_config_headers config.h" - -cat >confcache <<\_ACEOF -# 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, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# 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. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by ldns $as_me 1.6.9, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -ldns config.status 1.6.9 -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "drill.h") CONFIG_FILES="$CONFIG_FILES drill.h" ;; - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #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. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi - ;; - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/libs/ldns/drill/configure.ac b/libs/ldns/drill/configure.ac deleted file mode 100644 index 3c5a6f2e00..0000000000 --- a/libs/ldns/drill/configure.ac +++ /dev/null @@ -1,261 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.56) -AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns) -AC_CONFIG_SRCDIR([drill.c]) -sinclude(../acx_nlnetlabs.m4) - -OURCPPFLAGS='' -CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} -OURCFLAGS='-g' -CFLAGS=${CFLAGS:-${OURCFLAGS}} -AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) - -AC_AIX -# Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET -AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool]) - -# add option to disable the evil rpath -dnl Check whether to use rpath or not -AC_ARG_ENABLE(rpath, - [ --disable-rpath disable hardcoded rpath (default=enabled)], - enable_rpath=$enableval, enable_rpath=yes) - -if test "x$enable_rpath" = xyes; then - RPATH_VAL="-Wl,-rpath=\${libdir}" -fi - - -ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) -ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) - -AC_TYPE_SIZE_T -ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600, -[ -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - return a; -} -], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"]) - - -ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include ], [CFLAGS="$CFLAGS $C99FLAG"]) - -AC_C_INLINE -AC_CHECK_TYPE(int8_t, char) -AC_CHECK_TYPE(int16_t, short) -AC_CHECK_TYPE(int32_t, int) -AC_CHECK_TYPE(int64_t, long long) -AC_CHECK_TYPE(uint8_t, unsigned char) -AC_CHECK_TYPE(uint16_t, unsigned short) -AC_CHECK_TYPE(uint32_t, unsigned int) -AC_CHECK_TYPE(uint64_t, unsigned long long) -AC_CHECK_TYPE(ssize_t, int) - -AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h],,, [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NET_IF_H -#include -#endif]) -# MinGW32 tests -AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) - -ACX_TYPE_SOCKLEN_T -AC_CHECK_HEADERS([sys/param.h sys/mount.h],,, -[AC_INCLUDES_DEFAULT] -[ - [ - #if HAVE_SYS_PARAM_H - # include - #endif - ] -]) -AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif]) -AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif]) - -# check to see if libraries are needed for these functions. -AC_SEARCH_LIBS(socket, socket) -AC_SEARCH_LIBS([inet_pton], [nsl]) - -ACX_WITH_SSL_OPTIONAL - -ACX_CHECK_GETADDRINFO_WITH_INCLUDES - -LIBS_STC="$LIBS" -AC_SUBST(LIBS_STC) - -# check for ldns -AC_ARG_WITH(ldns, - AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use]) - , - [ - specialldnsdir="$withval" - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" - LDNSDIR="$withval" - LIBS="-lldns $LIBS" - LIBS_STC="$withval/lib/libldns.a $LIBS_STC" - ] -) - -#AC_CHECK_HEADER(ldns/ldns.h,, [ -# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) -# ], [AC_INCLUDES_DEFAULT] -#) - -AC_CHECK_FUNCS(isblank) - -# check for ldns development source tree -AC_MSG_CHECKING([for ldns devel source]) -ldns_dev_dir=.. -if test -f $ldns_dev_dir/ldns/util.h && \ - grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then - ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` - AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version]) - CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" - LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" - LIBS="-lldns $LIBS" - AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.]) - LDNSDIR="$ldns_dev_dir" - LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC" -else - AC_MSG_RESULT([no]) - AC_CHECK_LIB(ldns, ldns_rr_new, , [ - AC_MSG_ERROR([Can't find ldns library]) - ] - ) -fi - -AC_SUBST(LDNSDIR) - -AH_BOTTOM([ - -#include -#include -#include -#include - -#if STDC_HEADERS -#include -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_NETINET_UDP_H -#include -#endif - -#ifdef HAVE_TIME_H -#include -#endif - -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif - -#ifdef HAVE_NETINET_IP_H -#include -#endif - -#ifdef HAVE_NET_IF_H -#include -#endif - -#ifdef HAVE_NETINET_IF_ETHER_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#define USE_WINSOCK 1 -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -extern char *optarg; -extern int optind, opterr; - -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif - -#ifdef S_SPLINT_S -#define FD_ZERO(a) /* a */ -#define FD_SET(a,b) /* a, b */ -#endif -]) - -AC_CONFIG_FILES([Makefile - drill.h - ]) -AC_CONFIG_HEADER([config.h]) -AC_OUTPUT diff --git a/libs/ldns/drill/dnssec.c b/libs/ldns/drill/dnssec.c deleted file mode 100644 index 930ac7ce13..0000000000 --- a/libs/ldns/drill/dnssec.c +++ /dev/null @@ -1,509 +0,0 @@ -/* - * dnssec.c - * Some DNSSEC helper function are defined here - * and tracing is done - * (c) 2005 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include - -/* get rr_type from a server from a server */ -ldns_rr_list * -get_rr(ldns_resolver *res, ldns_rdf *zname, ldns_rr_type t, ldns_rr_class c) -{ - /* query, retrieve, extract and return */ - ldns_pkt *p; - ldns_rr_list *found; - - p = ldns_pkt_new(); - found = NULL; - - if (ldns_resolver_send(&p, res, zname, t, c, 0) != LDNS_STATUS_OK) { - /* oops */ - return NULL; - } else { - found = ldns_pkt_rr_list_by_type(p, t, LDNS_SECTION_ANY_NOQUESTION); - } - return found; -} - -void -drill_pkt_print(FILE *fd, ldns_resolver *r, ldns_pkt *p) -{ - ldns_rr_list *new_nss; - ldns_rr_list *hostnames; - - if (verbosity < 5) { - return; - } - - hostnames = ldns_get_rr_list_name_by_addr(r, ldns_pkt_answerfrom(p), 0, 0); - - new_nss = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); - ldns_rr_list_print(fd, new_nss); - - /* new_nss can be empty.... */ - - fprintf(fd, ";; Received %d bytes from %s#%d(", - (int) ldns_pkt_size(p), - ldns_rdf2str(ldns_pkt_answerfrom(p)), - (int) ldns_resolver_port(r)); - /* if we can resolve this print it, other print the ip again */ - if (hostnames) { - ldns_rdf_print(fd, - ldns_rr_rdf(ldns_rr_list_rr(hostnames, 0), 0)); - ldns_rr_list_deep_free(hostnames); - } else { - fprintf(fd, "%s", ldns_rdf2str(ldns_pkt_answerfrom(p))); - } - fprintf(fd, ") in %u ms\n\n", (unsigned int)ldns_pkt_querytime(p)); -} - -void -drill_pkt_print_footer(FILE *fd, ldns_resolver *r, ldns_pkt *p) -{ - ldns_rr_list *hostnames; - - if (verbosity < 5) { - return; - } - - hostnames = ldns_get_rr_list_name_by_addr(r, ldns_pkt_answerfrom(p), 0, 0); - - fprintf(fd, ";; Received %d bytes from %s#%d(", - (int) ldns_pkt_size(p), - ldns_rdf2str(ldns_pkt_answerfrom(p)), - (int) ldns_resolver_port(r)); - /* if we can resolve this print it, other print the ip again */ - if (hostnames) { - ldns_rdf_print(fd, - ldns_rr_rdf(ldns_rr_list_rr(hostnames, 0), 0)); - ldns_rr_list_deep_free(hostnames); - } else { - fprintf(fd, "%s", ldns_rdf2str(ldns_pkt_answerfrom(p))); - } - fprintf(fd, ") in %u ms\n\n", (unsigned int)ldns_pkt_querytime(p)); -} -/* - * generic function to get some RRset from a nameserver - * and possible some signatures too (that would be the day...) - */ -ldns_pkt_type -get_dnssec_rr(ldns_pkt *p, ldns_rdf *name, ldns_rr_type t, - ldns_rr_list **rrlist, ldns_rr_list **sig) -{ - ldns_pkt_type pt = LDNS_PACKET_UNKNOWN; - ldns_rr_list *rr = NULL; - ldns_rr_list *sigs = NULL; - size_t i; - - if (!p) { - if (rrlist) { - *rrlist = NULL; - } - return LDNS_PACKET_UNKNOWN; - } - - pt = ldns_pkt_reply_type(p); - if (name) { - rr = ldns_pkt_rr_list_by_name_and_type(p, name, t, LDNS_SECTION_ANSWER); - if (!rr) { - rr = ldns_pkt_rr_list_by_name_and_type(p, name, t, LDNS_SECTION_AUTHORITY); - } - sigs = ldns_pkt_rr_list_by_name_and_type(p, name, LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_ANSWER); - if (!sigs) { - sigs = ldns_pkt_rr_list_by_name_and_type(p, name, LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_AUTHORITY); - } - } else { - /* A DS-referral - get the DS records if they are there */ - rr = ldns_pkt_rr_list_by_type(p, t, LDNS_SECTION_AUTHORITY); - sigs = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_RRSIG, - LDNS_SECTION_AUTHORITY); - } - if (sig) { - *sig = ldns_rr_list_new(); - for (i = 0; i < ldns_rr_list_rr_count(sigs); i++) { - /* only add the sigs that cover this type */ - if (ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(ldns_rr_list_rr(sigs, i))) == - t) { - ldns_rr_list_push_rr(*sig, ldns_rr_clone(ldns_rr_list_rr(sigs, i))); - } - } - } - ldns_rr_list_deep_free(sigs); - if (rrlist) { - *rrlist = rr; - } - - if (pt == LDNS_PACKET_NXDOMAIN || pt == LDNS_PACKET_NODATA) { - return pt; - } else { - return LDNS_PACKET_ANSWER; - } -} - - -ldns_status -ldns_verify_denial(ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type, ldns_rr_list **nsec_rrs, ldns_rr_list **nsec_rr_sigs) -{ - uint16_t nsec_i; - - ldns_rr_list *nsecs; - ldns_status result; - - if (verbosity >= 5) { - printf("VERIFY DENIAL FROM:\n"); - ldns_pkt_print(stdout, pkt); - } - - result = LDNS_STATUS_CRYPTO_NO_RRSIG; - /* Try to see if there are NSECS in the packet */ - nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC, LDNS_SECTION_ANY_NOQUESTION); - if (nsecs) { - for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsecs); nsec_i++) { - /* there are four options: - * - name equals ownername and is covered by the type bitmap - * - name equals ownername but is not covered by the type bitmap - * - name falls within nsec coverage but is not equal to the owner name - * - name falls outside of nsec coverage - */ - if (ldns_dname_compare(ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), name) == 0) { - /* - printf("CHECKING NSEC:\n"); - ldns_rr_print(stdout, ldns_rr_list_rr(nsecs, nsec_i)); - printf("DAWASEM\n"); - */ - if (ldns_nsec_bitmap_covers_type( - ldns_nsec_get_bitmap(ldns_rr_list_rr(nsecs, - nsec_i)), - type)) { - /* Error, according to the nsec this rrset is signed */ - result = LDNS_STATUS_CRYPTO_NO_RRSIG; - } else { - /* ok nsec denies existence */ - if (verbosity >= 3) { - printf(";; Existence of data set with this type denied by NSEC\n"); - } - /*printf(";; Verifiably insecure.\n");*/ - if (nsec_rrs && nsec_rr_sigs) { - (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), LDNS_RR_TYPE_NSEC, nsec_rrs, nsec_rr_sigs); - } - ldns_rr_list_deep_free(nsecs); - return LDNS_STATUS_OK; - } - } else if (ldns_nsec_covers_name(ldns_rr_list_rr(nsecs, nsec_i), name)) { - if (verbosity >= 3) { - printf(";; Existence of data set with this name denied by NSEC\n"); - } - if (nsec_rrs && nsec_rr_sigs) { - (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), LDNS_RR_TYPE_NSEC, nsec_rrs, nsec_rr_sigs); - } - ldns_rr_list_deep_free(nsecs); - return LDNS_STATUS_OK; - } else { - /* nsec has nothing to do with this data */ - } - } - ldns_rr_list_deep_free(nsecs); - } else if( (nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC3, LDNS_SECTION_ANY_NOQUESTION)) ) { - ldns_rr_list* sigs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_RRSIG, LDNS_SECTION_ANY_NOQUESTION); - ldns_rr* q = ldns_rr_new(); - if(!sigs) return LDNS_STATUS_MEM_ERR; - if(!q) return LDNS_STATUS_MEM_ERR; - ldns_rr_set_question(q, 1); - ldns_rr_set_ttl(q, 0); - ldns_rr_set_owner(q, ldns_rdf_clone(name)); - if(!ldns_rr_owner(q)) return LDNS_STATUS_MEM_ERR; - ldns_rr_set_type(q, type); - - result = ldns_dnssec_verify_denial_nsec3(q, nsecs, sigs, ldns_pkt_get_rcode(pkt), type, ldns_pkt_ancount(pkt) == 0); - ldns_rr_free(q); - ldns_rr_list_deep_free(nsecs); - ldns_rr_list_deep_free(sigs); - } - return result; -} - -/* NSEC3 draft -07 */ -/*return hash name match*/ -ldns_rr * -ldns_nsec3_exact_match(ldns_rdf *qname, ldns_rr_type qtype, ldns_rr_list *nsec3s) { - uint8_t algorithm; - uint32_t iterations; - uint8_t salt_length; - uint8_t *salt; - - ldns_rdf *sname, *hashed_sname; - - size_t nsec_i; - ldns_rr *nsec; - ldns_rr *result = NULL; - - ldns_status status; - - const ldns_rr_descriptor *descriptor; - - ldns_rdf *zone_name; - - if (verbosity >= 4) { - printf(";; finding exact match for "); - descriptor = ldns_rr_descript(qtype); - if (descriptor && descriptor->_name) { - printf("%s ", descriptor->_name); - } else { - printf("TYPE%d ", qtype); - } - ldns_rdf_print(stdout, qname); - printf("\n"); - } - - if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { - if (verbosity >= 4) { - printf("no qname, nsec3s or list empty\n"); - } - return NULL; - } - - nsec = ldns_rr_list_rr(nsec3s, 0); - algorithm = ldns_nsec3_algorithm(nsec); - salt_length = ldns_nsec3_salt_length(nsec); - salt = ldns_nsec3_salt_data(nsec); - iterations = ldns_nsec3_iterations(nsec); - - sname = ldns_rdf_clone(qname); - - if (verbosity >= 4) { - printf(";; owner name hashes to: "); - } - hashed_sname = ldns_nsec3_hash_name(sname, algorithm, iterations, salt_length, salt); - - zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); - status = ldns_dname_cat(hashed_sname, zone_name); - - if (verbosity >= 4) { - ldns_rdf_print(stdout, hashed_sname); - printf("\n"); - } - - for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { - nsec = ldns_rr_list_rr(nsec3s, nsec_i); - - /* check values of iterations etc! */ - - /* exact match? */ - if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { - result = nsec; - goto done; - } - - } - -done: - ldns_rdf_deep_free(zone_name); - ldns_rdf_deep_free(sname); - ldns_rdf_deep_free(hashed_sname); - LDNS_FREE(salt); - - if (verbosity >= 4) { - if (result) { - printf(";; Found.\n"); - } else { - printf(";; Not foud.\n"); - } - } - return result; -} - -/*return the owner name of the closest encloser for name from the list of rrs */ -/* this is NOT the hash, but the original name! */ -ldns_rdf * -ldns_nsec3_closest_encloser(ldns_rdf *qname, ldns_rr_type qtype, ldns_rr_list *nsec3s) -{ - /* remember parameters, they must match */ - uint8_t algorithm; - uint32_t iterations; - uint8_t salt_length; - uint8_t *salt; - - ldns_rdf *sname, *hashed_sname, *tmp; - ldns_rr *ce; - bool flag; - - bool exact_match_found; - bool in_range_found; - - ldns_status status; - ldns_rdf *zone_name; - - size_t nsec_i; - ldns_rr *nsec; - ldns_rdf *result = NULL; - - if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { - return NULL; - } - - if (verbosity >= 4) { - printf(";; finding closest encloser for type %d ", qtype); - ldns_rdf_print(stdout, qname); - printf("\n"); - } - - nsec = ldns_rr_list_rr(nsec3s, 0); - algorithm = ldns_nsec3_algorithm(nsec); - salt_length = ldns_nsec3_salt_length(nsec); - salt = ldns_nsec3_salt_data(nsec); - iterations = ldns_nsec3_iterations(nsec); - - sname = ldns_rdf_clone(qname); - - ce = NULL; - flag = false; - - zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); - - /* algorithm from nsec3-07 8.3 */ - while (ldns_dname_label_count(sname) > 0) { - exact_match_found = false; - in_range_found = false; - - if (verbosity >= 3) { - printf(";; "); - ldns_rdf_print(stdout, sname); - printf(" hashes to: "); - } - hashed_sname = ldns_nsec3_hash_name(sname, algorithm, iterations, salt_length, salt); - - status = ldns_dname_cat(hashed_sname, zone_name); - - if (verbosity >= 3) { - ldns_rdf_print(stdout, hashed_sname); - printf("\n"); - } - - for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { - nsec = ldns_rr_list_rr(nsec3s, nsec_i); - - /* check values of iterations etc! */ - - /* exact match? */ - if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { - if (verbosity >= 4) { - printf(";; exact match found\n"); - } - exact_match_found = true; - } else if (ldns_nsec_covers_name(nsec, hashed_sname)) { - if (verbosity >= 4) { - printf(";; in range of an nsec\n"); - } - in_range_found = true; - } - - } - if (!exact_match_found && in_range_found) { - flag = true; - } else if (exact_match_found && flag) { - result = ldns_rdf_clone(sname); - } else if (exact_match_found && !flag) { - // error! - if (verbosity >= 4) { - printf(";; the closest encloser is the same name (ie. this is an exact match, ie there is no closest encloser)\n"); - } - ldns_rdf_deep_free(hashed_sname); - goto done; - } else { - flag = false; - } - - ldns_rdf_deep_free(hashed_sname); - tmp = sname; - sname = ldns_dname_left_chop(sname); - ldns_rdf_deep_free(tmp); - } - - done: - LDNS_FREE(salt); - ldns_rdf_deep_free(zone_name); - ldns_rdf_deep_free(sname); - - if (!result) { - if (verbosity >= 4) { - printf(";; no closest encloser found\n"); - } - } - - /* todo checks from end of 6.2. here or in caller? */ - return result; -} - - -/* special case were there was a wildcard expansion match, the exact match must be disproven */ -ldns_status -ldns_verify_denial_wildcard(ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type, ldns_rr_list **nsec_rrs, ldns_rr_list **nsec_rr_sigs) -{ - ldns_rdf *nsec3_ce = NULL; - ldns_rr *nsec3_ex = NULL; - ldns_rdf *wildcard_name = NULL; - ldns_rdf *nsec3_wc_ce = NULL; - ldns_rr *nsec3_wc_ex = NULL; - ldns_rdf *chopped_dname = NULL; - ldns_rr_list *nsecs; - ldns_status result = LDNS_STATUS_ERR; - - nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC3, LDNS_SECTION_ANY_NOQUESTION); - if (nsecs) { - wildcard_name = ldns_dname_new_frm_str("*"); - chopped_dname = ldns_dname_left_chop(name); - result = ldns_dname_cat(wildcard_name, chopped_dname); - ldns_rdf_deep_free(chopped_dname); - - nsec3_ex = ldns_nsec3_exact_match(name, type, nsecs); - nsec3_ce = ldns_nsec3_closest_encloser(name, type, nsecs); - nsec3_wc_ce = ldns_nsec3_closest_encloser(wildcard_name, type, nsecs); - nsec3_wc_ex = ldns_nsec3_exact_match(wildcard_name, type, nsecs); - - if (nsec3_ex) { - if (verbosity >= 3) { - printf(";; Error, exact match for for name found, but should not exist (draft -07 section 8.8)\n"); - } - result = LDNS_STATUS_NSEC3_ERR; - } else if (!nsec3_ce) { - if (verbosity >= 3) { - printf(";; Error, closest encloser for exact match missing in wildcard response (draft -07 section 8.8)\n"); - } - result = LDNS_STATUS_NSEC3_ERR; -/* - } else if (!nsec3_wc_ex) { - printf(";; Error, no wildcard nsec3 match: "); - ldns_rdf_print(stdout, wildcard_name); - printf(" (draft -07 section 8.8)\n"); - result = LDNS_STATUS_NSEC3_ERR; -*/ -/* } else if (!nsec */ - } else { - if (verbosity >= 3) { - printf(";; wilcard expansion proven\n"); - } - result = LDNS_STATUS_OK; - } - } else { - if (verbosity >= 3) { - printf(";; Error: no NSEC or NSEC3 records in answer\n"); - } - result = LDNS_STATUS_CRYPTO_NO_RRSIG; - } - - if (nsecs && nsec_rrs && nsec_rr_sigs) { - (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, 0)), LDNS_RR_TYPE_NSEC3, nsec_rrs, nsec_rr_sigs); - } - return result; -} - - diff --git a/libs/ldns/drill/drill.1 b/libs/ldns/drill/drill.1 deleted file mode 100644 index 24cfd6dabe..0000000000 --- a/libs/ldns/drill/drill.1 +++ /dev/null @@ -1,230 +0,0 @@ -.\" @(#)drill.1 1.7.0 14-Jul-2004 OF; -.TH drill 1 "28 May 2006" -.SH NAME -drill \- get (debug) information out of DNS(SEC) -.SH SYNOPSIS -.B drill -[ -.IR OPTIONS -] -.IR name -[ -.IR @server -] -[ -.IR type -] -[ -.IR class -] - -.SH DESCRIPTION -\fBdrill\fR is a tool to designed to get all sorts of information out of the -DNS. It is specificly designed to be used with DNSSEC. -.PP -The name \fBdrill\fR is a pun on \fBdig\fR. With \fBdrill\fR you should be able -get even more information than with \fBdig\fR. -.PP -If no arguments are given class defaults to 'IN' and type to 'A'. The -server(s) specified in /etc/resolv.conf are used to query against. - -.PP -\fIname\fR -Ask for this name. - -.PP -\fI@server\fR -Send to query to this server. If not specified use the nameservers from -\fI/etc/resolv.conf\fR. - -.PP -\fItype\fR -Ask for this RR type. If type is not given on the command line it defaults -to 'A'. Except when doing to reverse lookup when it defaults to 'PTR'. - -.PP -\fIclass\fR -Use this class when querying. - -.SH SAMPLE USAGE -\fBdrill mx miek.nl\fR -Show the MX records of the domain miek.nl - -.TP -\fBdrill -S jelte.nlnetlabs.nl\fR -Chase any signatures in the jelte.nlnetlab.nl domain. This option is -only available when ldns has been compiled with openssl-support. - -.TP -\fBdrill -TD www.example.com\fR -Do a DNSSEC (-D) trace (-T) from the rootservers down to www.example.com. -This option only works when ldns has been compiled with openssl support. - -.TP -\fBdrill -s dnskey jelte.nlnetlabs.nl\fR -Show the DNSKEY record(s) for jelte.nlnetlabs.nl. For each found DNSKEY -record also print the DS record. - -.SH OPTIONS - -.TP -\fB\-D -Enable DNSSEC in the query. When querying for DNSSEC types (DNSKEY, RRSIG, -DS and NSEC) this is \fInot\fR automaticly enabled. - -.TP -\fB\-T -Trace \fIname\fR from the root down. When using this option the @server and -the type arguments are not used. - -.TP -\fB\-S -Chase the signature(s) of 'name' to a known key or as high up in -the tree as possible. - -.TP -\fB\-V \fIlevel\fR -Be more verbose. Set level to 5 to see the actual query that is sent. - -.TP -\fB\-Q -Quiet mode, this overrules -V. - -.TP -\fB\-f \fIfile\fR -Read the query from a file. The query must be dumped with -w. - -.TP -\fB\-i \fIfile\fR -read the answer from the file instead from the network. This aids -in debugging and can be used to check if a query on disk is valid. -If the file contains binary data it is assumed to be a query in -network order. - -.TP -\fB\-w \fIfile\fR -Write an answer packet to file. - -.TP -\fB\-q \fIfile\fR -Write the query packet to file. - -.TP -\fB\-v -Show drill's version. - -.TP -\fB\-h -Show a short help message. - -.SS QUERY OPTIONS - -.TP -\fB\-4 -Stay on ip4. Only send queries to ip4 enabled nameservers. - -.TP -\fB\-6 -Stay on ip6. Only send queries to ip6 enabled nameservers. - -.TP -\fB\-a -Use the resolver structure's fallback mechanism if the answer -is truncated (TC=1). If a truncated packet is received and this -option is set, drill will first send a new query with EDNS0 -buffer size 4096. - -If the EDNS0 buffer size was already set to 512+ bytes, or the -above retry also results in a truncated answer, the resolver -structure will fall back to TCP. - -.TP -\fB\-b \fIsize\fR -Use size as the buffer size in the EDNS0 pseudo RR. - -.TP -\fB\-c \fIfile\fR -Use file instead of /etc/resolv.conf for nameserver configuration. - -.TP -\fB\-d \fIdomain\fR -When tracing (-T), start from this domain instead of the root. - -.TP -\fB\-t -Use TCP/IP when querying a server - -.TP -\fB\-k \fIkeyfile\fR -Use this file to read a (trusted) key from. When this options is -given \fBdrill\fR tries to validate the current answer with this -key. No chasing is done. When \fBdrill\fR is doing a secure trace, this -key will be used as trust anchor. Can contain a DNSKEY or a DS record. - -.TP -\fB\-o \fImnemonic\fR -Use this option to set or unset specific header bits. A bit is -set by using the bit mnemonic in CAPITAL letters. A bit is unset when -the mnemonic is given in lowercase. The following mnemonics are -understood by \fBdrill\fR: - - QR, qr: set, unset QueRy (default: on) - AA, aa: set, unset Authoritative Answer (default: off) - TC, tc: set, unset TrunCated (default: off) - RD, rd: set, unset Recursion Desired (default: on) - CD, cd: set, unset Checking Disabled (default: off) - RA, ra: set, unset Recursion Available (default: off) - AD, ad: set, unset Authenticated Data (default: off) - -Thus: \fB-o CD\fR, will enable Checking Disabled, which instructs the -cache to not validate the answers it gives out. - -.TP -\fB\-p \fIport\fR -Use this port instead of the default of 53. - -.TP -\fB\-r \fIfile\fR -When tracing (-T), use file as a root servers hint file. - -.TP -\fB\-s -When encountering a DNSKEY print the equivalent DS also. - -.TP -\fB\-u -Use UDP when querying a server. This is the default. - -.TP -\fB\-w \fIfile\fR -write the answer to a file. The file will contain a hexadecimal dump -of the query. This can be used in conjunction with -f. - -.TP -\fB\-x -Do a reverse loopup. The type argument is not used, it is preset to PTR. - -.TP -\fB\-y \fI\fR -specify named base64 tsig key, and optional an algorithm (defaults to hmac-md5.sig-alg.reg.int) - -.TP -\fB\-z \fR -don't randomize the nameserver list before sending queries. - - -.SH AUTHOR -Jelte Jansen and Miek Gieben. Both of NLnet Labs. - -.SH REPORTING BUGS -Report bugs to . - -.SH BUGS - -.SH COPYRIGHT -Copyright (c) 2004-2008 NLnet Labs. -Licensed under the revised BSD license. There is NO warranty; not even for MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. - -.SH SEE ALSO -\fBdig\fR(1), \fIRFC403{3,4,5}\fR. diff --git a/libs/ldns/drill/drill.c b/libs/ldns/drill/drill.c deleted file mode 100644 index abd0ff6300..0000000000 --- a/libs/ldns/drill/drill.c +++ /dev/null @@ -1,930 +0,0 @@ -/* - * drill.c - * the main file of drill - * (c) 2005-2008 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include - -#ifdef HAVE_SSL -#include -#endif - -#define IP6_ARPA_MAX_LEN 65 - -/* query debug, 2 hex dumps */ -int verbosity; - -static void -usage(FILE *stream, const char *progname) -{ - fprintf(stream, " Usage: %s name [@server] [type] [class]\n", progname); - fprintf(stream, "\t can be a domain name or an IP address (-x lookups)\n"); - fprintf(stream, "\t defaults to A\n"); - fprintf(stream, "\t defaults to IN\n"); - fprintf(stream, "\n\targuments may be placed in random order\n"); - fprintf(stream, "\n Options:\n"); - fprintf(stream, "\t-D\t\tenable DNSSEC (DO bit)\n"); -#ifdef HAVE_SSL - fprintf(stream, "\t-T\t\ttrace from the root down to \n"); - fprintf(stream, "\t-S\t\tchase signature(s) from to a know key [*]\n"); -#endif /*HAVE_SSL*/ - fprintf(stream, "\t-V \tverbosity (0-5)\n"); - fprintf(stream, "\t-Q\t\tquiet mode (overrules -V)\n"); - fprintf(stream, "\n"); - fprintf(stream, "\t-f file\t\tread packet from file and send it\n"); - fprintf(stream, "\t-i file\t\tread packet from file and print it\n"); - fprintf(stream, "\t-w file\t\twrite answer packet to file\n"); - fprintf(stream, "\t-q file\t\twrite query packet to file\n"); - fprintf(stream, "\t-h\t\tshow this help\n"); - fprintf(stream, "\t-v\t\tshow version\n"); - fprintf(stream, "\n Query options:\n"); - fprintf(stream, "\t-4\t\tstay on ip4\n"); - fprintf(stream, "\t-6\t\tstay on ip6\n"); - fprintf(stream, "\t-a\t\tfallback to EDNS0 and TCP if the answer is truncated\n"); - fprintf(stream, "\t-b \tuse as the buffer size (defaults to 512 b)\n"); - fprintf(stream, "\t-c \t\tuse file for rescursive nameserver configuration (/etc/resolv.conf)\n"); - fprintf(stream, "\t-k \tspecify a file that contains a trusted DNSSEC key (DNSKEY|DS) [**]\n"); - fprintf(stream, "\t\t\tused to verify any signatures in the current answer\n"); - fprintf(stream, "\t-o \tset flags to: [QR|qr][AA|aa][TC|tc][RD|rd][CD|cd][RA|ra][AD|ad]\n"); - fprintf(stream, "\t\t\tlowercase: unset bit, uppercase: set bit\n"); - fprintf(stream, "\t-p \tuse as remote port number\n"); - fprintf(stream, "\t-s\t\tshow the DS RR for each key in a packet\n"); - fprintf(stream, "\t-u\t\tsend the query with udp (the default)\n"); - fprintf(stream, "\t-x\t\tdo a reverse lookup\n"); - fprintf(stream, "\twhen doing a secure trace:\n"); - fprintf(stream, "\t-r \t\tuse file as root servers hint file\n"); - fprintf(stream, "\t-t\t\tsend the query with tcp (connected)\n"); - fprintf(stream, "\t-d \t\tuse domain as the start point for the trace\n"); - fprintf(stream, "\t-y \tspecify named base64 tsig key, and optional an\n\t\t\talgorithm (defaults to hmac-md5.sig-alg.reg.int)\n"); - fprintf(stream, "\t-z\t\tdon't randomize the nameservers before use\n"); - fprintf(stream, "\n [*] = enables/implies DNSSEC\n"); - fprintf(stream, " [**] = can be given more than once\n"); - fprintf(stream, "\n ldns-team@nlnetlabs.nl | http://www.nlnetlabs.nl/ldns/\n"); -} - -/** - * Prints the drill version to stderr - */ -static void -version(FILE *stream, const char *progname) -{ - fprintf(stream, "%s version %s (ldns version %s)\n", progname, DRILL_VERSION, ldns_version()); - fprintf(stream, "Written by NLnet Labs.\n"); - fprintf(stream, "\nCopyright (c) 2004-2008 NLnet Labs.\n"); - fprintf(stream, "Licensed under the revised BSD license.\n"); - fprintf(stream, "There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"); - fprintf(stream, "FOR A PARTICULAR PURPOSE.\n"); -} - - -/** - * Main function of drill - * parse the arguments and prepare a query - */ -int -main(int argc, char *argv[]) -{ - ldns_resolver *res = NULL; - ldns_resolver *cmdline_res = NULL; /* only used to resolv @name names */ - ldns_rr_list *cmdline_rr_list = NULL; - ldns_rdf *cmdline_dname = NULL; - ldns_rdf *qname, *qname_tmp; - ldns_pkt *pkt; - ldns_pkt *qpkt; - char *serv; - char *name; - char *name2; - char *progname; - char *query_file = NULL; - char *answer_file = NULL; - ldns_buffer *query_buffer = NULL; - ldns_rdf *serv_rdf; - ldns_rr_type type; - ldns_rr_class clas; -#if 0 - ldns_pkt_opcode opcode = LDNS_PACKET_QUERY; -#endif - int i, c; - int int_type; - int int_clas; - int PURPOSE; - char *tsig_name = NULL; - char *tsig_data = NULL; - char *tsig_algorithm = NULL; - size_t tsig_separator; - size_t tsig_separator2; - ldns_rr *axfr_rr; - ldns_status status; - char *type_str; - - /* list of keys used in dnssec operations */ - ldns_rr_list *key_list = ldns_rr_list_new(); - /* what key verify the current answer */ - ldns_rr_list *key_verified; - - /* resolver options */ - uint16_t qflags; - uint16_t qbuf; - uint16_t qport; - uint8_t qfamily; - bool qdnssec; - bool qfallback; - bool qds; - bool qusevc; - bool qrandom; - - char *resolv_conf_file = NULL; - - ldns_rdf *trace_start_name = NULL; - - int result = 0; - -#ifdef USE_WINSOCK - int r; - WSADATA wsa_data; -#endif - - int_type = -1; serv = NULL; type = 0; - int_clas = -1; name = NULL; clas = 0; - qname = NULL; - progname = strdup(argv[0]); - -#ifdef USE_WINSOCK - r = WSAStartup(MAKEWORD(2,2), &wsa_data); - if(r != 0) { - printf("Failed WSAStartup: %d\n", r); - result = EXIT_FAILURE; - goto exit; - } -#endif /* USE_WINSOCK */ - - - PURPOSE = DRILL_QUERY; - qflags = LDNS_RD; - qport = LDNS_PORT; - verbosity = 2; - qdnssec = false; - qfamily = LDNS_RESOLV_INETANY; - qfallback = false; - qds = false; - qbuf = 0; - qusevc = false; - qrandom = true; - key_verified = NULL; - - ldns_init_random(NULL, 0); - - if (argc == 0) { - usage(stdout, progname); - result = EXIT_FAILURE; - goto exit; - } - - /* string from orig drill: "i:w:I46Sk:TNp:b:DsvhVcuaq:f:xr" */ - /* global first, query opt next, option with parm's last - * and sorted */ /* "46DITSVQf:i:w:q:achuvxzy:so:p:b:k:" */ - - while ((c = getopt(argc, argv, "46ab:c:d:Df:hi:Ik:o:p:q:Qr:sStTuvV:w:xy:z")) != -1) { - switch(c) { - /* global options */ - case '4': - qfamily = LDNS_RESOLV_INET; - break; - case '6': - qfamily = LDNS_RESOLV_INET6; - break; - case 'D': - qdnssec = true; - break; - case 'I': - /* reserved for backward compatibility */ - break; - case 'T': - if (PURPOSE == DRILL_CHASE) { - fprintf(stderr, "-T and -S cannot be used at the same time.\n"); - exit(EXIT_FAILURE); - } - PURPOSE = DRILL_TRACE; - break; -#ifdef HAVE_SSL - case 'S': - if (PURPOSE == DRILL_TRACE) { - fprintf(stderr, "-T and -S cannot be used at the same time.\n"); - exit(EXIT_FAILURE); - } - PURPOSE = DRILL_CHASE; - break; -#endif /* HAVE_SSL */ - case 'V': - verbosity = atoi(optarg); - break; - case 'Q': - verbosity = -1; - break; - case 'f': - query_file = optarg; - break; - case 'i': - answer_file = optarg; - PURPOSE = DRILL_AFROMFILE; - break; - case 'w': - answer_file = optarg; - break; - case 'q': - query_file = optarg; - PURPOSE = DRILL_QTOFILE; - break; - case 'r': - if (global_dns_root) { - fprintf(stderr, "There was already a series of root servers set\n"); - exit(EXIT_FAILURE); - } - global_dns_root = read_root_hints(optarg); - if (!global_dns_root) { - fprintf(stderr, "Unable to read root hints file %s, aborting\n", optarg); - exit(EXIT_FAILURE); - } - break; - /* query options */ - case 'a': - qfallback = true; - break; - case 'b': - qbuf = (uint16_t)atoi(optarg); - if (qbuf == 0) { - error("%s", " could not be converted"); - } - break; - case 'c': - resolv_conf_file = optarg; - break; - case 't': - qusevc = true; - break; - case 'k': - status = read_key_file(optarg, key_list); - if (status != LDNS_STATUS_OK) { - error("Could not parse the key file %s: %s", optarg, ldns_get_errorstr_by_id(status)); - } - qdnssec = true; /* enable that too */ - break; - case 'o': - /* only looks at the first hit: capital=ON, lowercase=OFF*/ - if (strstr(optarg, "QR")) { - DRILL_ON(qflags, LDNS_QR); - } - if (strstr(optarg, "qr")) { - DRILL_OFF(qflags, LDNS_QR); - } - if (strstr(optarg, "AA")) { - DRILL_ON(qflags, LDNS_AA); - } - if (strstr(optarg, "aa")) { - DRILL_OFF(qflags, LDNS_AA); - } - if (strstr(optarg, "TC")) { - DRILL_ON(qflags, LDNS_TC); - } - if (strstr(optarg, "tc")) { - DRILL_OFF(qflags, LDNS_TC); - } - if (strstr(optarg, "RD")) { - DRILL_ON(qflags, LDNS_RD); - } - if (strstr(optarg, "rd")) { - DRILL_OFF(qflags, LDNS_RD); - } - if (strstr(optarg, "CD")) { - DRILL_ON(qflags, LDNS_CD); - } - if (strstr(optarg, "cd")) { - DRILL_OFF(qflags, LDNS_CD); - } - if (strstr(optarg, "RA")) { - DRILL_ON(qflags, LDNS_RA); - } - if (strstr(optarg, "ra")) { - DRILL_OFF(qflags, LDNS_RA); - } - if (strstr(optarg, "AD")) { - DRILL_ON(qflags, LDNS_AD); - } - if (strstr(optarg, "ad")) { - DRILL_OFF(qflags, LDNS_AD); - } - break; - case 'p': - qport = (uint16_t)atoi(optarg); - if (qport == 0) { - error("%s", " could not be converted"); - } - break; - case 's': - qds = true; - break; - case 'u': - qusevc = false; - break; - case 'v': - version(stdout, progname); - result = EXIT_SUCCESS; - goto exit; - case 'x': - PURPOSE = DRILL_REVERSE; - break; - case 'y': -#ifdef HAVE_SSL - if (strchr(optarg, ':')) { - tsig_separator = (size_t) (strchr(optarg, ':') - optarg); - if (strchr(optarg + tsig_separator + 1, ':')) { - tsig_separator2 = (size_t) (strchr(optarg + tsig_separator + 1, ':') - optarg); - tsig_algorithm = xmalloc(strlen(optarg) - tsig_separator2); - strncpy(tsig_algorithm, optarg + tsig_separator2 + 1, strlen(optarg) - tsig_separator2); - tsig_algorithm[strlen(optarg) - tsig_separator2 - 1] = '\0'; - } else { - tsig_separator2 = strlen(optarg); - tsig_algorithm = xmalloc(26); - strncpy(tsig_algorithm, "hmac-md5.sig-alg.reg.int.", 25); - tsig_algorithm[25] = '\0'; - } - tsig_name = xmalloc(tsig_separator + 1); - tsig_data = xmalloc(tsig_separator2 - tsig_separator); - strncpy(tsig_name, optarg, tsig_separator); - strncpy(tsig_data, optarg + tsig_separator + 1, tsig_separator2 - tsig_separator - 1); - /* strncpy does not append \0 if source is longer than n */ - tsig_name[tsig_separator] = '\0'; - tsig_data[ tsig_separator2 - tsig_separator - 1] = '\0'; - } -#else - fprintf(stderr, "TSIG requested, but SSL is not supported\n"); - result = EXIT_FAILURE; - goto exit; -#endif /* HAVE_SSL */ - break; - case 'z': - qrandom = false; - break; - case 'd': - trace_start_name = ldns_dname_new_frm_str(optarg); - if (!trace_start_name) { - fprintf(stderr, "Unable to parse argument for -%c\n", c); - result = EXIT_FAILURE; - goto exit; - } - break; - case 'h': - version(stdout, progname); - usage(stdout, progname); - result = EXIT_SUCCESS; - goto exit; - break; - default: - fprintf(stderr, "Unknown argument: -%c, use -h to see usage\n", c); - result = EXIT_FAILURE; - goto exit; - } - } - argc -= optind; - argv += optind; - - /* do a secure trace when requested */ - if (PURPOSE == DRILL_TRACE && qdnssec) { -#ifdef HAVE_SSL - if (ldns_rr_list_rr_count(key_list) == 0) { - warning("%s", "No trusted keys were given. Will not be able to verify authenticity!"); - } - PURPOSE = DRILL_SECTRACE; -#else - fprintf(stderr, "ldns has not been compiled with OpenSSL support. Secure trace not available\n"); - exit(1); -#endif /* HAVE_SSL */ - } - - /* parse the arguments, with multiple arguments, the last argument - * found is used */ - for(i = 0; i < argc; i++) { - - /* if ^@ then it's a server */ - if (argv[i][0] == '@') { - if (strlen(argv[i]) == 1) { - warning("%s", "No nameserver given"); - exit(EXIT_FAILURE); - } - serv = argv[i] + 1; - continue; - } - /* if has a dot, it's a name */ - if (strchr(argv[i], '.')) { - name = argv[i]; - continue; - } - /* if it matches a type, it's a type */ - if (int_type == -1) { - type = ldns_get_rr_type_by_name(argv[i]); - if (type != 0) { - int_type = 0; - continue; - } - } - /* if it matches a class, it's a class */ - if (int_clas == -1) { - clas = ldns_get_rr_class_by_name(argv[i]); - if (clas != 0) { - int_clas = 0; - continue; - } - } - /* it all fails assume it's a name */ - name = argv[i]; - } - /* act like dig and use for . NS */ - if (!name) { - name = "."; - int_type = 0; - type = LDNS_RR_TYPE_NS; - } - - /* defaults if not given */ - if (int_clas == -1) { - clas = LDNS_RR_CLASS_IN; - } - if (int_type == -1) { - if (PURPOSE != DRILL_REVERSE) { - type = LDNS_RR_TYPE_A; - } else { - type = LDNS_RR_TYPE_PTR; - } - } - - /* set the nameserver to use */ - if (!serv) { - /* no server given make a resolver from /etc/resolv.conf */ - status = ldns_resolver_new_frm_file(&res, resolv_conf_file); - if (status != LDNS_STATUS_OK) { - warning("Could not create a resolver structure: %s (%s)\n" - "Try drill @localhost if you have a resolver running on your machine.", - ldns_get_errorstr_by_id(status), resolv_conf_file); - result = EXIT_FAILURE; - goto exit; - } - } else { - res = ldns_resolver_new(); - if (!res || strlen(serv) <= 0) { - warning("Could not create a resolver structure"); - result = EXIT_FAILURE; - goto exit; - } - /* add the nameserver */ - serv_rdf = ldns_rdf_new_addr_frm_str(serv); - if (!serv_rdf) { - /* try to resolv the name if possible */ - status = ldns_resolver_new_frm_file(&cmdline_res, resolv_conf_file); - - if (status != LDNS_STATUS_OK) { - error("%s", "@server ip could not be converted"); - } - ldns_resolver_set_dnssec(cmdline_res, qdnssec); - ldns_resolver_set_ip6(cmdline_res, qfamily); - ldns_resolver_set_fallback(cmdline_res, qfallback); - ldns_resolver_set_usevc(cmdline_res, qusevc); - - cmdline_dname = ldns_dname_new_frm_str(serv); - - cmdline_rr_list = ldns_get_rr_list_addr_by_name( - cmdline_res, - cmdline_dname, - LDNS_RR_CLASS_IN, - qflags); - ldns_rdf_deep_free(cmdline_dname); - if (!cmdline_rr_list) { - /* This error msg is not always accurate */ - error("%s `%s\'", "could not find any address for the name:", serv); - } else { - if (ldns_resolver_push_nameserver_rr_list( - res, - cmdline_rr_list - ) != LDNS_STATUS_OK) { - error("%s", "pushing nameserver"); - } - } - } else { - if (ldns_resolver_push_nameserver(res, serv_rdf) != LDNS_STATUS_OK) { - error("%s", "pushing nameserver"); - } else { - ldns_rdf_deep_free(serv_rdf); - } - } - } - /* set the resolver options */ - ldns_resolver_set_port(res, qport); - if (verbosity >= 5) { - ldns_resolver_set_debug(res, true); - } else { - ldns_resolver_set_debug(res, false); - } - ldns_resolver_set_dnssec(res, qdnssec); -/* ldns_resolver_set_dnssec_cd(res, qdnssec);*/ - ldns_resolver_set_ip6(res, qfamily); - ldns_resolver_set_fallback(res, qfallback); - ldns_resolver_set_usevc(res, qusevc); - ldns_resolver_set_random(res, qrandom); - if (qbuf != 0) { - ldns_resolver_set_edns_udp_size(res, qbuf); - } - - if (!name && - PURPOSE != DRILL_AFROMFILE && - !query_file - ) { - usage(stdout, progname); - result = EXIT_FAILURE; - goto exit; - } - - if (tsig_name && tsig_data) { - ldns_resolver_set_tsig_keyname(res, tsig_name); - ldns_resolver_set_tsig_keydata(res, tsig_data); - ldns_resolver_set_tsig_algorithm(res, tsig_algorithm); - } - - /* main switching part of drill */ - switch(PURPOSE) { - case DRILL_TRACE: - /* do a trace from the root down */ - if (!global_dns_root) { - init_root(); - } - qname = ldns_dname_new_frm_str(name); - if (!qname) { - error("%s", "parsing query name"); - } - /* don't care about return packet */ - (void)do_trace(res, qname, type, clas); - clear_root(); - break; - case DRILL_SECTRACE: - /* do a secure trace from the root down */ - if (!global_dns_root) { - init_root(); - } - qname = ldns_dname_new_frm_str(name); - if (!qname) { - error("%s", "making qname"); - } - /* don't care about return packet */ -#ifdef HAVE_SSL - result = do_secure_trace(res, qname, type, clas, key_list, trace_start_name); -#endif /* HAVE_SSL */ - clear_root(); - break; - case DRILL_CHASE: - qname = ldns_dname_new_frm_str(name); - if (!qname) { - error("%s", "making qname"); - } - - ldns_resolver_set_dnssec(res, true); - ldns_resolver_set_dnssec_cd(res, true); - /* set dnssec implies udp_size of 4096 */ - ldns_resolver_set_edns_udp_size(res, 4096); - pkt = ldns_resolver_query(res, qname, type, clas, qflags); - - if (!pkt) { - error("%s", "error pkt sending"); - result = EXIT_FAILURE; - } else { - if (verbosity >= 3) { - ldns_pkt_print(stdout, pkt); - } - - if (!ldns_pkt_answer(pkt)) { - mesg("No answer in packet"); - } else { -#ifdef HAVE_SSL - ldns_resolver_set_dnssec_anchors(res, ldns_rr_list_clone(key_list)); - result = do_chase(res, qname, type, - clas, key_list, - pkt, qflags, NULL, - verbosity); - if (result == LDNS_STATUS_OK) { - if (verbosity != -1) { - mesg("Chase successful"); - } - result = 0; - } else { - if (verbosity != -1) { - mesg("Chase failed."); - } - } -#endif /* HAVE_SSL */ - } - ldns_pkt_free(pkt); - } - break; - case DRILL_AFROMFILE: - pkt = read_hex_pkt(answer_file); - if (pkt) { - if (verbosity != -1) { - ldns_pkt_print(stdout, pkt); - } - ldns_pkt_free(pkt); - } - - break; - case DRILL_QTOFILE: - qname = ldns_dname_new_frm_str(name); - if (!qname) { - error("%s", "making qname"); - } - - status = ldns_resolver_prepare_query_pkt(&qpkt, res, qname, type, clas, qflags); - if(status != LDNS_STATUS_OK) { - error("%s", "making query: %s", - ldns_get_errorstr_by_id(status)); - } - dump_hex(qpkt, query_file); - ldns_pkt_free(qpkt); - break; - case DRILL_NSEC: - break; - case DRILL_REVERSE: - /* ipv4 or ipv6 addr? */ - if (strchr(name, ':')) { - if (strchr(name, '.')) { - error("Syntax error: both '.' and ':' seen in address\n"); - } - name2 = malloc(IP6_ARPA_MAX_LEN + 20); - c = 0; - for (i=0; i<(int)strlen(name); i++) { - if (i >= IP6_ARPA_MAX_LEN) { - error("%s", "reverse argument to long"); - } - if (name[i] == ':') { - if (i < (int) strlen(name) && name[i + 1] == ':') { - error("%s", ":: not supported (yet)"); - } else { - if (i + 2 == (int) strlen(name) || name[i + 2] == ':') { - name2[c++] = '0'; - name2[c++] = '.'; - name2[c++] = '0'; - name2[c++] = '.'; - name2[c++] = '0'; - name2[c++] = '.'; - } else if (i + 3 == (int) strlen(name) || name[i + 3] == ':') { - name2[c++] = '0'; - name2[c++] = '.'; - name2[c++] = '0'; - name2[c++] = '.'; - } else if (i + 4 == (int) strlen(name) || name[i + 4] == ':') { - name2[c++] = '0'; - name2[c++] = '.'; - } - } - } else { - name2[c++] = name[i]; - name2[c++] = '.'; - } - } - name2[c++] = '\0'; - - qname = ldns_dname_new_frm_str(name2); - qname_tmp = ldns_dname_reverse(qname); - ldns_rdf_deep_free(qname); - qname = qname_tmp; - qname_tmp = ldns_dname_new_frm_str("ip6.arpa."); - status = ldns_dname_cat(qname, qname_tmp); - if (status != LDNS_STATUS_OK) { - error("%s", "could not create reverse address for ip6: %s\n", ldns_get_errorstr_by_id(status)); - } - ldns_rdf_deep_free(qname_tmp); - - free(name2); - } else { - qname = ldns_dname_new_frm_str(name); - qname_tmp = ldns_dname_reverse(qname); - ldns_rdf_deep_free(qname); - qname = qname_tmp; - qname_tmp = ldns_dname_new_frm_str("in-addr.arpa."); - status = ldns_dname_cat(qname, qname_tmp); - if (status != LDNS_STATUS_OK) { - error("%s", "could not create reverse address for ip4: %s\n", ldns_get_errorstr_by_id(status)); - } - ldns_rdf_deep_free(qname_tmp); - } - if (!qname) { - error("%s", "-x implies an ip address"); - } - - /* create a packet and set the RD flag on it */ - pkt = ldns_resolver_query(res, qname, type, clas, qflags); - if (!pkt) { - error("%s", "pkt sending"); - result = EXIT_FAILURE; - } else { - if (verbosity != -1) { - ldns_pkt_print(stdout, pkt); - } - ldns_pkt_free(pkt); - } - break; - case DRILL_QUERY: - default: - if (query_file) { - /* this old way, the query packet needed - to be parseable, but we want to be able - to send mangled packets, so we need - to do it directly */ - #if 0 - qpkt = read_hex_pkt(query_file); - if (qpkt) { - status = ldns_resolver_send_pkt(&pkt, res, qpkt); - if (status != LDNS_STATUS_OK) { - printf("Error: %s\n", ldns_get_errorstr_by_id(status)); - exit(1); - } - } else { - /* qpkt was bogus, reset pkt */ - pkt = NULL; - } - #endif - query_buffer = read_hex_buffer(query_file); - if (query_buffer) { - status = ldns_send_buffer(&pkt, res, query_buffer, NULL); - ldns_buffer_free(query_buffer); - if (status != LDNS_STATUS_OK) { - printf("Error: %s\n", ldns_get_errorstr_by_id(status)); - exit(1); - } - } else { - printf("NO BUFFER\n"); - pkt = NULL; - } - } else { - qname = ldns_dname_new_frm_str(name); - if (!qname) { - error("%s", "error in making qname"); - } - - if (type == LDNS_RR_TYPE_AXFR) { - status = ldns_axfr_start(res, qname, clas); - if(status != LDNS_STATUS_OK) { - error("Error starting axfr: %s", - ldns_get_errorstr_by_id(status)); - } - axfr_rr = ldns_axfr_next(res); - if(!axfr_rr) { - fprintf(stderr, "AXFR failed.\n"); - ldns_pkt_print(stdout, - ldns_axfr_last_pkt(res)); - goto exit; - } - while (axfr_rr) { - if (verbosity != -1) { - ldns_rr_print(stdout, axfr_rr); - } - ldns_rr_free(axfr_rr); - axfr_rr = ldns_axfr_next(res); - } - - goto exit; - } else { - /* create a packet and set the RD flag on it */ - pkt = ldns_resolver_query(res, qname, type, clas, qflags); - } - } - - if (!pkt) { - mesg("No packet received"); - result = EXIT_FAILURE; - } else { - if (verbosity != -1) { - ldns_pkt_print(stdout, pkt); - if (ldns_pkt_tc(pkt)) { - fprintf(stdout, - "\n;; WARNING: The answer packet was truncated; you might want to\n"); - fprintf(stdout, - ";; query again with TCP (-t argument), or EDNS0 (-b for buffer size)\n"); - } - } - if (qds) { - if (verbosity != -1) { - print_ds_of_keys(pkt); - printf("\n"); - } - } - - if (ldns_rr_list_rr_count(key_list) > 0) { - /* -k's were given on the cmd line */ - ldns_rr_list *rrset_verified; - uint16_t key_count; - - rrset_verified = ldns_pkt_rr_list_by_name_and_type( - pkt, qname, type, - LDNS_SECTION_ANY_NOQUESTION); - - if (type == LDNS_RR_TYPE_ANY) { - /* don't verify this */ - break; - } - - if (verbosity != -1) { - printf("; "); - ldns_rr_list_print(stdout, rrset_verified); - } - - /* verify */ -#ifdef HAVE_SSL - key_verified = ldns_rr_list_new(); - result = ldns_pkt_verify(pkt, type, qname, key_list, NULL, key_verified); - - if (result == LDNS_STATUS_ERR) { - /* is the existence denied then? */ - result = ldns_verify_denial(pkt, qname, type, NULL, NULL); - if (result == LDNS_STATUS_OK) { - if (verbosity != -1) { - printf("Existence denied for "); - ldns_rdf_print(stdout, qname); - type_str = ldns_rr_type2str(type); - printf("\t%s\n", type_str); - LDNS_FREE(type_str); - } - } else { - if (verbosity != -1) { - printf("Bad data; RR for name and " - "type not found or failed to " - "verify, and denial of " - "existence failed.\n"); - } - } - } else if (result == LDNS_STATUS_OK) { - for(key_count = 0; key_count < ldns_rr_list_rr_count(key_verified); - key_count++) { - if (verbosity != -1) { - printf("; VALIDATED by id = %u, owner = ", - (unsigned int)ldns_calc_keytag( - ldns_rr_list_rr(key_verified, key_count))); - ldns_rdf_print(stdout, ldns_rr_owner( - ldns_rr_list_rr(key_list, key_count))); - printf("\n"); - } - } - } else { - for(key_count = 0; key_count < ldns_rr_list_rr_count(key_list); - key_count++) { - if (verbosity != -1) { - printf("; %s for id = %u, owner = ", - ldns_get_errorstr_by_id(result), - (unsigned int)ldns_calc_keytag( - ldns_rr_list_rr(key_list, key_count))); - ldns_rdf_print(stdout, ldns_rr_owner( - - ldns_rr_list_rr(key_list, - key_count))); - printf("\n"); - } - } - } - ldns_rr_list_free(key_verified); -#else - (void) key_count; -#endif /* HAVE_SSL */ - } - if (answer_file) { - dump_hex(pkt, answer_file); - } - ldns_pkt_free(pkt); - } - - break; - } - - exit: - ldns_rdf_deep_free(qname); - ldns_resolver_deep_free(res); - ldns_resolver_deep_free(cmdline_res); - ldns_rr_list_deep_free(key_list); - ldns_rr_list_deep_free(cmdline_rr_list); - ldns_rdf_deep_free(trace_start_name); - xfree(progname); - xfree(tsig_name); - xfree(tsig_data); - xfree(tsig_algorithm); - -#ifdef HAVE_SSL - ERR_remove_state(0); - CRYPTO_cleanup_all_ex_data(); - ERR_free_strings(); - EVP_cleanup(); -#endif -#ifdef USE_WINSOCK - WSACleanup(); -#endif - - return result; -} diff --git a/libs/ldns/drill/drill.h.in b/libs/ldns/drill/drill.h.in deleted file mode 100644 index b787b923c2..0000000000 --- a/libs/ldns/drill/drill.h.in +++ /dev/null @@ -1,109 +0,0 @@ -/* - * drill.h - * the main header file of drill - * (c) 2005, 2006 NLnet Labs - * - * See the file LICENSE for the license - * - */ -#ifndef _DRILL_H_ -#define _DRILL_H_ -#include "config.h" - -#include "drill_util.h" - -#define DRILL_VERSION "@PACKAGE_VERSION@" - -/* what kind of stuff do we allow */ -#define DRILL_QUERY 0 -#define DRILL_TRACE 1 -#define DRILL_CHASE 2 -#define DRILL_AFROMFILE 3 -#define DRILL_QTOFILE 4 -#define DRILL_NSEC 5 -#define DRILL_REVERSE 6 -#define DRILL_SECTRACE 7 - -#define DRILL_ON(VAR, BIT) \ -(VAR) = (VAR) | (BIT) -#define DRILL_OFF(VAR, BIT) \ -(VAR) = (VAR) & ~(BIT) - -extern ldns_rr_list *global_dns_root; -extern bool qds; -extern int verbosity; - -ldns_pkt *do_trace(ldns_resolver *res, - ldns_rdf *name, - ldns_rr_type type, - ldns_rr_class c); -ldns_status do_chase(ldns_resolver *res, - ldns_rdf *name, - ldns_rr_type type, - ldns_rr_class c, - ldns_rr_list *trusted_keys, - ldns_pkt *pkt_o, - uint16_t qflags, - ldns_rr_list *prev_key_list, - int verbosity); -int do_secure_trace(ldns_resolver *res, - ldns_rdf *name, - ldns_rr_type type, - ldns_rr_class c, - ldns_rr_list *trusted_keys, - ldns_rdf *start_name); - -ldns_rr_list * get_rr(ldns_resolver *res, - ldns_rdf *zname, - ldns_rr_type t, - ldns_rr_class c); - -void drill_pkt_print(FILE *fd, ldns_resolver *r, ldns_pkt *p); -void drill_pkt_print_footer(FILE *fd, ldns_resolver *r, ldns_pkt *p); - -ldns_pkt_type get_dnssec_rr(ldns_pkt *p, - ldns_rdf *name, - ldns_rr_type t, - ldns_rr_list **rrlist, - ldns_rr_list **sig); - -ldns_rr *ldns_nsec3_exact_match(ldns_rdf *qname, - ldns_rr_type qtype, - ldns_rr_list *nsec3s); - -ldns_rdf *ldns_nsec3_closest_encloser(ldns_rdf *qname, - ldns_rr_type qtype, - ldns_rr_list *nsec3s); - -/* verifies denial of existence of *name in *pkt (must contain NSEC or NSEC3 records - * if *nsec_rrs and *nsec_rr_sigs are given, pointers to the relevant nsecs and their signatures are - * placed there - */ -ldns_status ldns_verify_denial(ldns_pkt *pkt, - ldns_rdf *name, - ldns_rr_type type, - ldns_rr_list **nsec_rrs, - ldns_rr_list **nsec_rr_sigs); -ldns_status ldns_verify_denial_wildcard(ldns_pkt *pkt, - ldns_rdf *name, - ldns_rr_type type, - ldns_rr_list **nsec_rrs, - ldns_rr_list **nsec_rr_sigs); - -ldns_status read_key_file(const char *filename, ldns_rr_list *key_list); -ldns_pkt *read_hex_pkt(char *filename); -ldns_buffer *read_hex_buffer(char *filename); -void init_root(void); -ldns_rr_list *read_root_hints(const char *filename); -void clear_root(void); -void dump_hex(const ldns_pkt *pkt, const char *file); -void warning(const char *fmt, ...); -void error(const char *fmt, ...); -void mesg(const char *fmt, ...); - -/* screen.c */ -void resolver_print_nameservers(ldns_resolver *r); -void print_dnskey(ldns_rr_list *key_list); -void print_ds(ldns_rr_list *ds_list); - -#endif /* _DRILL_H_ */ diff --git a/libs/ldns/drill/drill_util.c b/libs/ldns/drill/drill_util.c deleted file mode 100644 index 596be9d541..0000000000 --- a/libs/ldns/drill/drill_util.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - * util.c - * some handy function needed in drill and not implemented - * in ldns - * (c) 2005 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include - -#include - -static int -read_line(FILE *input, char *line) -{ - int i; - - char c; - for (i = 0; i < LDNS_MAX_PACKETLEN; i++) { - c = getc(input); - if (c == EOF) { - return -1; - } else if (c != '\n') { - line[i] = c; - } else { - break; - } - } - line[i] = '\0'; - return i; -} - -/* key_list must be initialized with ldns_rr_list_new() */ -ldns_status -read_key_file(const char *filename, ldns_rr_list *key_list) -{ - int line_len = 0; - int line_nr = 0; - int key_count = 0; - char line[LDNS_MAX_PACKETLEN]; - ldns_status status; - FILE *input_file; - ldns_rr *rr; - - input_file = fopen(filename, "r"); - if (!input_file) { - fprintf(stderr, "Error opening %s: %s\n", - filename, strerror(errno)); - return LDNS_STATUS_ERR; - } - while (line_len >= 0) { - line_len = read_line(input_file, line); - line_nr++; - if (line_len > 0 && line[0] != ';') { - status = ldns_rr_new_frm_str(&rr, line, 0, NULL, NULL); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, - "Error parsing DNSKEY RR in line %d: %s\n", - line_nr, - ldns_get_errorstr_by_id(status)); - } else if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_DNSKEY || - ldns_rr_get_type(rr) == LDNS_RR_TYPE_DS) { - ldns_rr_list_push_rr(key_list, rr); - key_count++; - } else { - ldns_rr_free(rr); - } - } - } - printf(";; Number of trusted keys: %d\n", key_count); - if (key_count > 0) { - return LDNS_STATUS_OK; - } else { - /*fprintf(stderr, "No keys read\n");*/ - return LDNS_STATUS_ERR; - } -} - -ldns_rdf * -ldns_rdf_new_addr_frm_str(char *str) -{ - ldns_rdf *a; - - a = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, str); - if (!a) { - /* maybe ip6 */ - a = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, str); - if (!a) { - return NULL; - } - } - return a; -} - -static inline void -local_print_ds(FILE* out, const char* pre, ldns_rr* ds) -{ - if (out && ds) { - fprintf(out, "%s", pre); - ldns_rr_print(out, ds); - ldns_rr_free(ds); - } -} - -/* - * For all keys in a packet print the DS - */ -void -print_ds_of_keys(ldns_pkt *p) -{ - ldns_rr_list *keys; - uint16_t i; - ldns_rr *ds; - - /* TODO fix the section stuff, here or in ldns */ - keys = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_DNSKEY, - LDNS_SECTION_ANSWER); - - /* this also returns the question section rr, which does not - * have any data.... and this inturn crashes everything */ - - if (keys) { - for (i = 0; i < ldns_rr_list_rr_count(keys); i++) { - fprintf(stdout, ";\n; equivalent DS records for key %u:\n", - (unsigned int)ldns_calc_keytag(ldns_rr_list_rr(keys, i))); - - ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA1); - local_print_ds(stdout, "; sha1: ", ds); - ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA256); - local_print_ds(stdout, "; sha256: ", ds); - } - } -} - -static void -print_class_type(FILE *fp, ldns_rr *r) -{ - ldns_lookup_table *lt; - lt = ldns_lookup_by_id(ldns_rr_classes, ldns_rr_get_class(r)); - if (lt) { - fprintf(fp, " %s", lt->name); - } else { - fprintf(fp, " CLASS%d", ldns_rr_get_class(r)); - } - /* okay not THE way - but the quickest */ - switch (ldns_rr_get_type(r)) { - case LDNS_RR_TYPE_RRSIG: - fprintf(fp, " RRSIG "); - break; - case LDNS_RR_TYPE_DNSKEY: - fprintf(fp, " DNSKEY "); - break; - case LDNS_RR_TYPE_DS: - fprintf(fp, " DS "); - break; - default: - break; - } -} - - -void -print_ds_abbr(FILE *fp, ldns_rr *ds) -{ - if (!ds || (ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS)) { - return; - } - - ldns_rdf_print(fp, ldns_rr_owner(ds)); - fprintf(fp, " %d", (int)ldns_rr_ttl(ds)); - print_class_type(fp, ds); - ldns_rdf_print(fp, ldns_rr_rdf(ds, 0)); fprintf(fp, " "); - ldns_rdf_print(fp, ldns_rr_rdf(ds, 1)); fprintf(fp, " "); - ldns_rdf_print(fp, ldns_rr_rdf(ds, 2)); fprintf(fp, " "); - ldns_rdf_print(fp, ldns_rr_rdf(ds, 3)); fprintf(fp, " "); -} - -/* print some of the elements of a signature */ -void -print_rrsig_abbr(FILE *fp, ldns_rr *sig) { - if (!sig || (ldns_rr_get_type(sig) != LDNS_RR_TYPE_RRSIG)) { - return; - } - - ldns_rdf_print(fp, ldns_rr_owner(sig)); - fprintf(fp, " %d", (int)ldns_rr_ttl(sig)); - print_class_type(fp, sig); - - /* print a number of rdf's */ - /* typecovered */ - ldns_rdf_print(fp, ldns_rr_rdf(sig, 0)); fprintf(fp, " "); - /* algo */ - ldns_rdf_print(fp, ldns_rr_rdf(sig, 1)); fprintf(fp, " "); - /* labels */ - ldns_rdf_print(fp, ldns_rr_rdf(sig, 2)); fprintf(fp, " (\n\t\t\t"); - /* expir */ - ldns_rdf_print(fp, ldns_rr_rdf(sig, 4)); fprintf(fp, " "); - /* incep */ - ldns_rdf_print(fp, ldns_rr_rdf(sig, 5)); fprintf(fp, " "); - /* key-id */ - ldns_rdf_print(fp, ldns_rr_rdf(sig, 6)); fprintf(fp, " "); - /* key owner */ - ldns_rdf_print(fp, ldns_rr_rdf(sig, 7)); fprintf(fp, ")"); -} - -void -print_dnskey_abbr(FILE *fp, ldns_rr *key) -{ - if (!key || (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY)) { - return; - } - - ldns_rdf_print(fp, ldns_rr_owner(key)); - fprintf(fp, " %d", (int)ldns_rr_ttl(key)); - print_class_type(fp, key); - - /* print a number of rdf's */ - /* flags */ - ldns_rdf_print(fp, ldns_rr_rdf(key, 0)); fprintf(fp, " "); - /* proto */ - ldns_rdf_print(fp, ldns_rr_rdf(key, 1)); fprintf(fp, " "); - /* algo */ - ldns_rdf_print(fp, ldns_rr_rdf(key, 2)); - - if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 256) { - fprintf(fp, " ;{id = %u (zsk), size = %db}", (unsigned int)ldns_calc_keytag(key), - (int)ldns_rr_dnskey_key_size(key)); - return; - } - if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 257) { - fprintf(fp, " ;{id = %u (ksk), size = %db}", (unsigned int)ldns_calc_keytag(key), - (int)ldns_rr_dnskey_key_size(key)); - return; - } - fprintf(fp, " ;{id = %u, size = %db}", (unsigned int)ldns_calc_keytag(key), - (int)ldns_rr_dnskey_key_size(key)); -} - -void -print_rr_list_abbr(FILE *fp, ldns_rr_list *rrlist, char *usr) -{ - size_t i; - ldns_rr_type tp; - - for(i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { - tp = ldns_rr_get_type(ldns_rr_list_rr(rrlist, i)); - if (i == 0 && tp != LDNS_RR_TYPE_RRSIG) { - if (usr) { - fprintf(fp, "%s ", usr); - } - } - switch(tp) { - case LDNS_RR_TYPE_DNSKEY: - print_dnskey_abbr(fp, ldns_rr_list_rr(rrlist, i)); - break; - case LDNS_RR_TYPE_RRSIG: - print_rrsig_abbr(fp, ldns_rr_list_rr(rrlist, i)); - break; - case LDNS_RR_TYPE_DS: - print_ds_abbr(fp, ldns_rr_list_rr(rrlist, i)); - break; - default: - /* not handled */ - break; - } - fputs("\n", fp); - } -} - -void * -xmalloc(size_t s) -{ - void *p; - - p = malloc(s); - if (!p) { - printf("Mem failure\n"); - exit(EXIT_FAILURE); - } - return p; -} - -void * -xrealloc(void *p, size_t size) -{ - void *q; - - q = realloc(p, size); - if (!q) { - printf("Mem failure\n"); - exit(EXIT_FAILURE); - } - return q; -} - -void -xfree(void *p) -{ - if (p) { - free(p); - } -} diff --git a/libs/ldns/drill/drill_util.h b/libs/ldns/drill/drill_util.h deleted file mode 100644 index db3a57436a..0000000000 --- a/libs/ldns/drill/drill_util.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * util.h - * util.c header file - * in ldns - * (c) 2005 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#ifndef _DRILL_UTIL_H_ -#define _DRILL_UTIL_H_ -#include - -/** - * return a address rdf, either A or AAAA - * NULL if anything goes wrong - */ -ldns_rdf * ldns_rdf_new_addr_frm_str(char *); - -/** - * print all the ds of the keys in the packet - */ -void print_ds_of_keys(ldns_pkt *p); - -/** - * print some rdfs of a signature - */ -void print_rrsig_abbr(FILE *fp, ldns_rr *sig); -/** - * print some rdfs of a dnskey - */ -void print_dnskey_abbr(FILE *fp, ldns_rr *key); -/** - * print some rdfs of a ds - */ -void print_ds_abbr(FILE *fp, ldns_rr *ds); - -/** - * print some rdfs of a rr in a rr_list - */ -void print_rr_list_abbr(FILE *fp, ldns_rr_list *sig, char *usr); - -/** - * Alloc some memory, with error checking - */ -void *xmalloc(size_t s); - -/** - * Realloc some memory, with error checking - */ -void *xrealloc(void *p, size_t s); - -/** - * Free the data - */ -void xfree(void *q); -#endif /* _DRILL_UTIL_H_ */ diff --git a/libs/ldns/drill/error.c b/libs/ldns/drill/error.c deleted file mode 100644 index e67b7fca02..0000000000 --- a/libs/ldns/drill/error.c +++ /dev/null @@ -1,115 +0,0 @@ -/** - * error.c - * - * error reporting routines - * basicly wrappers around printf - * - * (c) 2005 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include - -static void -warning_va_list(const char *fmt, va_list args) -{ - fprintf(stderr, "Warning: "); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); -} - -void -warning(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - warning_va_list(fmt, args); - va_end(args); -} - -static void -error_va_list(const char *fmt, va_list args) -{ - fprintf(stderr, "Error: "); - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); -} - -void -error(const char *fmt, ...) -{ - va_list args; - va_start(args, fmt); - error_va_list(fmt, args); - va_end(args); - exit(EXIT_FAILURE); -} - -static void -verbose_va_list(const char *fmt, va_list args) -{ - vfprintf(stdout, fmt, args); - fprintf(stdout, "\n"); -} - -/* print stuff */ -void -mesg(const char *fmt, ...) -{ - va_list args; - if (verbosity == -1) { - return; - } - fprintf(stdout, ";; "); - va_start(args, fmt); - verbose_va_list(fmt, args); - va_end(args); -} - -/* print stuff when in verbose mode (1) */ -void -verbose(const char *fmt, ...) -{ - va_list args; - if (verbosity < 1) { - return; - } - - va_start(args, fmt); - verbose_va_list(fmt, args); - va_end(args); -} - -/* print stuff when in vverbose mode (2) */ -void -vverbose(const char *fmt, ...) -{ - va_list args; - if (verbosity < 2) { - return; - } - - va_start(args, fmt); - verbose_va_list(fmt, args); - va_end(args); -} - -static void -debug_va_list(const char *fmt, va_list args) -{ - vfprintf(stderr, fmt, args); - fprintf(stderr, "\n"); -} - -void -debug(const char *fmt, ...) -{ - va_list args; - fprintf(stderr, "[DEBUG] "); - va_start(args, fmt); - debug_va_list(fmt, args); - va_end(args); -} diff --git a/libs/ldns/drill/install-sh b/libs/ldns/drill/install-sh deleted file mode 100755 index 6781b987bd..0000000000 --- a/libs/ldns/drill/install-sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2009-04-28.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# 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. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # 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 $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/libs/ldns/drill/root.c b/libs/ldns/drill/root.c deleted file mode 100644 index a829935cd5..0000000000 --- a/libs/ldns/drill/root.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * root.c - * Function to handle to the rootservers - * and to update and prime them - * (c) 2005 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include -#include - -/* a global list of the root-servers */ -ldns_rr_list *global_dns_root = NULL; - -/* put a hardcoded list in the root and - * init the root rrlist structure */ -void -init_root(void) -{ - ldns_rr *r; - - global_dns_root = ldns_rr_list_new(); - - (void)ldns_rr_new_frm_str(&r, "A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2F::F", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803F:235", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 ", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7FD::1", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:3::42 ", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); - (void)ldns_rr_new_frm_str(&r, "M.ROOT-SERVERS.NET. 3600000 AAAA 2001:DC3::35", 0, NULL, NULL); - ldns_rr_list_push_rr(global_dns_root, r); -} - -/* - * Read a hints file as root - * - * The file with the given path should contain a list of NS RRs - * for the root zone and A records for those NS RRs. - * Read them, check them, and append the a records to the rr list given. - */ -ldns_rr_list * -read_root_hints(const char *filename) -{ - FILE *fp = NULL; - int line_nr = 0; - ldns_zone *z; - ldns_status status; - ldns_rr_list *addresses = NULL; - ldns_rr *rr; - size_t i; - - fp = fopen(filename, "r"); - if (!fp) { - fprintf(stderr, "Unable to open %s for reading: %s\n", filename, strerror(errno)); - return NULL; - } - - status = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, 0, &line_nr); - fclose(fp); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error reading root hints file: %s\n", ldns_get_errorstr_by_id(status)); - return NULL; - } else { - addresses = ldns_rr_list_new(); - for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { - rr = ldns_rr_list_rr(ldns_zone_rrs(z), i); - /*if ((address_family == 0 || address_family == 1) && - */ - if ( ldns_rr_get_type(rr) == LDNS_RR_TYPE_A ) { - ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); - } - /*if ((address_family == 0 || address_family == 2) &&*/ - if ( ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) { - ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); - } - } - ldns_zone_deep_free(z); - return addresses; - } -} - - -void -clear_root(void) -{ - ldns_rr_list_deep_free(global_dns_root); -} diff --git a/libs/ldns/drill/securetrace.c b/libs/ldns/drill/securetrace.c deleted file mode 100644 index ecc21fdf49..0000000000 --- a/libs/ldns/drill/securetrace.c +++ /dev/null @@ -1,761 +0,0 @@ -/* - * securechasetrace.c - * Where all the hard work concerning secure tracing is done - * - * (c) 2005, 2006 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include - -#define SELF "[S]" /* self sig ok */ -#define TRUST "[T]" /* chain from parent */ -#define BOGUS "[B]" /* bogus */ -#define UNSIGNED "[U]" /* no relevant dnssec data found */ - -#if 0 -/* See if there is a key/ds in trusted that matches - * a ds in *ds. - */ -static ldns_rr_list * -ds_key_match(ldns_rr_list *ds, ldns_rr_list *trusted) -{ - size_t i, j; - bool match; - ldns_rr *rr_i, *rr_j; - ldns_rr_list *keys; - - if (!trusted || !ds) { - return NULL; - } - - match = false; - keys = ldns_rr_list_new(); - if (!keys) { - return NULL; - } - - if (!ds || !trusted) { - return NULL; - } - - for (i = 0; i < ldns_rr_list_rr_count(trusted); i++) { - rr_i = ldns_rr_list_rr(trusted, i); - for (j = 0; j < ldns_rr_list_rr_count(ds); j++) { - - rr_j = ldns_rr_list_rr(ds, j); - if (ldns_rr_compare_ds(rr_i, rr_j)) { - match = true; - /* only allow unique RRs to match */ - ldns_rr_set_push_rr(keys, rr_i); - } - } - } - if (match) { - return keys; - } else { - return NULL; - } -} -#endif - -ldns_pkt * -get_dnssec_pkt(ldns_resolver *r, ldns_rdf *name, ldns_rr_type t) -{ - ldns_pkt *p = NULL; - p = ldns_resolver_query(r, name, t, LDNS_RR_CLASS_IN, 0); - if (!p) { - return NULL; - } else { - if (verbosity >= 5) { - ldns_pkt_print(stdout, p); - } - return p; - } -} - -#ifdef HAVE_SSL -/* - * retrieve keys for this zone - */ -static ldns_pkt_type -get_key(ldns_pkt *p, ldns_rdf *apexname, ldns_rr_list **rrlist, ldns_rr_list **opt_sig) -{ - return get_dnssec_rr(p, apexname, LDNS_RR_TYPE_DNSKEY, rrlist, opt_sig); -} - -/* - * check to see if we can find a DS rrset here which we can then follow - */ -static ldns_pkt_type -get_ds(ldns_pkt *p, ldns_rdf *ownername, ldns_rr_list **rrlist, ldns_rr_list **opt_sig) -{ - return get_dnssec_rr(p, ownername, LDNS_RR_TYPE_DS, rrlist, opt_sig); -} -#endif /* HAVE_SSL */ - -void -remove_resolver_nameservers(ldns_resolver *res) -{ - ldns_rdf *pop; - - /* remove the old nameserver from the resolver */ - while((pop = ldns_resolver_pop_nameserver(res))) { - ldns_rdf_deep_free(pop); - } - -} - -void -show_current_nameservers(FILE *out, ldns_resolver *res) -{ - size_t i; - fprintf(out, "Current nameservers for resolver object:\n"); - for (i = 0; i < ldns_resolver_nameserver_count(res); i++) { - ldns_rdf_print(out, ldns_resolver_nameservers(res)[i]); - fprintf(out, "\n"); - } -} - -/*ldns_pkt **/ -#ifdef HAVE_SSL -int -do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, - ldns_rr_class c, ldns_rr_list *trusted_keys, ldns_rdf *start_name - ) -{ - ldns_resolver *res; - ldns_pkt *p, *local_p; - ldns_rr_list *new_nss_a; - ldns_rr_list *new_nss_aaaa; - ldns_rr_list *new_nss; - ldns_rr_list *ns_addr; - uint16_t loop_count; - ldns_rdf *pop; - ldns_rdf **labels = NULL; - ldns_status status, st; - ssize_t i; - size_t j; - size_t k; - size_t l; - uint8_t labels_count; - ldns_pkt_type pt; - - /* dnssec */ - ldns_rr_list *key_list; - ldns_rr_list *key_sig_list; - ldns_rr_list *ds_list; - ldns_rr_list *ds_sig_list; - ldns_rr_list *correct_key_list; - ldns_rr_list *trusted_ds_rrs; - bool new_keys_trusted = false; - ldns_rr_list *current_correct_keys; - ldns_rr_list *dataset; - - ldns_rr_list *nsec_rrs = NULL; - ldns_rr_list *nsec_rr_sigs = NULL; - - /* empty non-terminal check */ - bool ent; - - /* glue handling */ - ldns_rr_list *new_ns_addr; - ldns_rr_list *old_ns_addr; - ldns_rr *ns_rr; - - int result = 0; - - /* printing niceness */ - const ldns_rr_descriptor *descriptor; - - descriptor = ldns_rr_descript(t); - - loop_count = 0; - new_nss_a = NULL; - new_nss_aaaa = NULL; - new_nss = NULL; - ns_addr = NULL; - key_list = NULL; - ds_list = NULL; - pt = LDNS_PACKET_UNKNOWN; - - p = NULL; - local_p = NULL; - res = ldns_resolver_new(); - key_sig_list = NULL; - ds_sig_list = NULL; - - if (!res) { - error("Memory allocation failed"); - result = -1; - return result; - } - - correct_key_list = ldns_rr_list_new(); - if (!correct_key_list) { - error("Memory allocation failed"); - result = -1; - return result; - } - - trusted_ds_rrs = ldns_rr_list_new(); - if (!trusted_ds_rrs) { - error("Memory allocation failed"); - result = -1; - return result; - } - /* Add all preset trusted DS signatures to the list of trusted DS RRs. */ - for (j = 0; j < ldns_rr_list_rr_count(trusted_keys); j++) { - ldns_rr* one_rr = ldns_rr_list_rr(trusted_keys, j); - if (ldns_rr_get_type(one_rr) == LDNS_RR_TYPE_DS) { - ldns_rr_list_push_rr(trusted_ds_rrs, ldns_rr_clone(one_rr)); - } - } - - /* transfer some properties of local_res to res */ - ldns_resolver_set_ip6(res, - ldns_resolver_ip6(local_res)); - ldns_resolver_set_port(res, - ldns_resolver_port(local_res)); - ldns_resolver_set_debug(res, - ldns_resolver_debug(local_res)); - ldns_resolver_set_fail(res, - ldns_resolver_fail(local_res)); - ldns_resolver_set_usevc(res, - ldns_resolver_usevc(local_res)); - ldns_resolver_set_random(res, - ldns_resolver_random(local_res)); - ldns_resolver_set_recursive(local_res, true); - - ldns_resolver_set_recursive(res, false); - ldns_resolver_set_dnssec_cd(res, false); - ldns_resolver_set_dnssec(res, true); - - /* setup the root nameserver in the new resolver */ - status = ldns_resolver_push_nameserver_rr_list(res, global_dns_root); - if (status != LDNS_STATUS_OK) { - printf("ERRRRR: %s\n", ldns_get_errorstr_by_id(status)); - ldns_rr_list_print(stdout, global_dns_root); - return status; - } - labels_count = ldns_dname_label_count(name); - if (start_name) { - if (ldns_dname_is_subdomain(name, start_name)) { - labels_count -= ldns_dname_label_count(start_name); - } else { - fprintf(stderr, "Error; "); - ldns_rdf_print(stderr, name); - fprintf(stderr, " is not a subdomain of "); - ldns_rdf_print(stderr, start_name); - fprintf(stderr, "\n"); - goto done; - } - } - labels = LDNS_XMALLOC(ldns_rdf*, labels_count + 2); - if (!labels) { - goto done; - } - labels[0] = ldns_dname_new_frm_str(LDNS_ROOT_LABEL_STR); - labels[1] = ldns_rdf_clone(name); - for(i = 2 ; i < (ssize_t)labels_count + 2; i++) { - labels[i] = ldns_dname_left_chop(labels[i - 1]); - } - /* if no servers is given with @, start by asking local resolver */ - /* first part todo :) */ - for (i = 0; i < (ssize_t) ldns_resolver_nameserver_count(local_res); i++) { - (void) ldns_resolver_push_nameserver(res, ldns_resolver_nameservers(local_res)[i]); - } - - /* get the nameserver for the label - * ask: dnskey and ds for the label - */ - for(i = (ssize_t)labels_count + 1; i > 0; i--) { - status = ldns_resolver_send(&local_p, res, labels[i], LDNS_RR_TYPE_NS, c, 0); - - if (verbosity >= 5) { - ldns_pkt_print(stdout, local_p); - } - - new_nss = ldns_pkt_rr_list_by_type(local_p, - LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); - if (!new_nss) { - /* if it's a delegation, servers put them in the auth section */ - new_nss = ldns_pkt_rr_list_by_type(local_p, - LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); - } - - /* if this is the final step there might not be nameserver records - of course if the data is in the apex, there are, so cover both - cases */ - if (new_nss || i > 1) { - for(j = 0; j < ldns_rr_list_rr_count(new_nss); j++) { - ns_rr = ldns_rr_list_rr(new_nss, j); - pop = ldns_rr_rdf(ns_rr, 0); - if (!pop) { - printf("nopo\n"); - break; - } - /* retrieve it's addresses */ - /* trust glue? */ - new_ns_addr = NULL; - if (ldns_dname_is_subdomain(pop, labels[i])) { - new_ns_addr = ldns_pkt_rr_list_by_name_and_type(local_p, pop, LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); - } - if (!new_ns_addr || ldns_rr_list_rr_count(new_ns_addr) == 0) { - new_ns_addr = ldns_get_rr_list_addr_by_name(res, pop, c, 0); - } - if (!new_ns_addr || ldns_rr_list_rr_count(new_ns_addr) == 0) { - new_ns_addr = ldns_get_rr_list_addr_by_name(local_res, pop, c, 0); - } - - if (new_ns_addr) { - old_ns_addr = ns_addr; - ns_addr = ldns_rr_list_cat_clone(ns_addr, new_ns_addr); - ldns_rr_list_deep_free(old_ns_addr); - } - ldns_rr_list_deep_free(new_ns_addr); - } - ldns_rr_list_deep_free(new_nss); - - if (ns_addr) { - remove_resolver_nameservers(res); - - if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != - LDNS_STATUS_OK) { - error("Error adding new nameservers"); - ldns_pkt_free(local_p); - goto done; - } - ldns_rr_list_deep_free(ns_addr); - } else { - status = ldns_verify_denial(local_p, labels[i], LDNS_RR_TYPE_NS, &nsec_rrs, &nsec_rr_sigs); - - /* verify the nsec3 themselves*/ - if (verbosity >= 4) { - printf("NSEC(3) Records to verify:\n"); - ldns_rr_list_print(stdout, nsec_rrs); - printf("With signatures:\n"); - ldns_rr_list_print(stdout, nsec_rr_sigs); - printf("correct keys:\n"); - ldns_rr_list_print(stdout, correct_key_list); - } - - if (status == LDNS_STATUS_OK) { - if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", TRUST); - fprintf(stdout, "Existence denied: "); - ldns_rdf_print(stdout, labels[i]); - /* - if (descriptor && descriptor->_name) { - printf(" %s", descriptor->_name); - } else { - printf(" TYPE%u", t); - } - */ fprintf(stdout, " NS\n"); - } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", SELF); - fprintf(stdout, "Existence denied: "); - ldns_rdf_print(stdout, labels[i]); - /* - if (descriptor && descriptor->_name) { - printf(" %s", descriptor->_name); - } else { - printf(" TYPE%u", t); - } - */ - fprintf(stdout, " NS\n"); - } else { - fprintf(stdout, "%s ", BOGUS); - result = 1; - printf(";; Error verifying denial of existence for name "); - ldns_rdf_print(stdout, labels[i]); - /* - printf(" type "); - if (descriptor && descriptor->_name) { - printf("%s", descriptor->_name); - } else { - printf("TYPE%u", t); - } - */ printf("NS: %s\n", ldns_get_errorstr_by_id(st)); - } - } else { - fprintf(stdout, "%s ", BOGUS); - result = 1; - printf(";; Error verifying denial of existence for name "); - ldns_rdf_print(stdout, labels[i]); - printf("NS: %s\n", ldns_get_errorstr_by_id(status)); - } - - /* there might be an empty non-terminal, in which case we need to continue */ - ent = false; - for (j = 0; j < ldns_rr_list_rr_count(nsec_rrs); j++) { - if (ldns_dname_is_subdomain(ldns_rr_rdf(ldns_rr_list_rr(nsec_rrs, j), 0), labels[i])) { - ent = true; - } - } - if (!ent) { - ldns_rr_list_deep_free(nsec_rrs); - ldns_rr_list_deep_free(nsec_rr_sigs); - ldns_pkt_free(local_p); - goto done; - } else { - printf(";; There is an empty non-terminal here, continue\n"); - continue; - } - goto done; - } - - if (ldns_resolver_nameserver_count(res) == 0) { - error("No nameservers found for this node"); - goto done; - } - } - ldns_pkt_free(local_p); - - fprintf(stdout, ";; Domain: "); - ldns_rdf_print(stdout, labels[i]); - fprintf(stdout, "\n"); - - /* retrieve keys for current domain, and verify them - if they match an already trusted DS, or if one of the - keys used to sign these is trusted, add the keys to - the trusted list */ - p = get_dnssec_pkt(res, labels[i], LDNS_RR_TYPE_DNSKEY); - pt = get_key(p, labels[i], &key_list, &key_sig_list); - if (key_sig_list) { - if (key_list) { - current_correct_keys = ldns_rr_list_new(); - if ((st = ldns_verify(key_list, key_sig_list, key_list, current_correct_keys)) == - LDNS_STATUS_OK) { - /* add all signed keys (don't just add current_correct, you'd miss - * the zsk's then */ - for (j = 0; j < ldns_rr_list_rr_count(key_list); j++) { - ldns_rr_list_push_rr(correct_key_list, ldns_rr_clone(ldns_rr_list_rr(key_list, j))); - } - - /* check whether these keys were signed - * by a trusted keys. if so, these - * keys are also trusted */ - new_keys_trusted = false; - for (k = 0; k < ldns_rr_list_rr_count(current_correct_keys); k++) { - for (j = 0; j < ldns_rr_list_rr_count(trusted_ds_rrs); j++) { - if (ldns_rr_compare_ds(ldns_rr_list_rr(current_correct_keys, k), - ldns_rr_list_rr(trusted_ds_rrs, j))) { - new_keys_trusted = true; - } - } - } - - /* also all keys are trusted if one of the current correct keys is trusted */ - for (k = 0; k < ldns_rr_list_rr_count(current_correct_keys); k++) { - for (j = 0; j < ldns_rr_list_rr_count(trusted_keys); j++) { - if (ldns_rr_compare(ldns_rr_list_rr(current_correct_keys, k), - ldns_rr_list_rr(trusted_keys, j)) == 0) { - new_keys_trusted = true; - } - } - } - - - if (new_keys_trusted) { - ldns_rr_list_push_rr_list(trusted_keys, key_list); - print_rr_list_abbr(stdout, key_list, TRUST); - ldns_rr_list_free(key_list); - key_list = NULL; - } else { - if (verbosity >= 2) { - printf(";; Signature ok but no chain to a trusted key or ds record\n"); - } - print_rr_list_abbr(stdout, key_list, SELF); - ldns_rr_list_deep_free(key_list); - key_list = NULL; - } - } else { - print_rr_list_abbr(stdout, key_list, BOGUS); - result = 2; - ldns_rr_list_deep_free(key_list); - key_list = NULL; - } - ldns_rr_list_free(current_correct_keys); - current_correct_keys = NULL; - } else { - printf(";; No DNSKEY record found for "); - ldns_rdf_print(stdout, labels[i]); - printf("\n"); - } - } - - ldns_pkt_free(p); - ldns_rr_list_deep_free(key_sig_list); - key_sig_list = NULL; - - /* check the DS records for the next child domain */ - if (i > 1) { - p = get_dnssec_pkt(res, labels[i-1], LDNS_RR_TYPE_DS); - pt = get_ds(p, labels[i-1], &ds_list, &ds_sig_list); - if (!ds_list) { - ldns_pkt_free(p); - if (ds_sig_list) { - ldns_rr_list_deep_free(ds_sig_list); - } - p = get_dnssec_pkt(res, name, LDNS_RR_TYPE_DNSKEY); - pt = get_ds(p, NULL, &ds_list, &ds_sig_list); - } - if (ds_sig_list) { - if (ds_list) { - if (verbosity >= 4) { - printf("VERIFYING:\n"); - printf("DS LIST:\n"); - ldns_rr_list_print(stdout, ds_list); - printf("SIGS:\n"); - ldns_rr_list_print(stdout, ds_sig_list); - printf("KEYS:\n"); - ldns_rr_list_print(stdout, correct_key_list); - } - - current_correct_keys = ldns_rr_list_new(); - - if ((st = ldns_verify(ds_list, ds_sig_list, correct_key_list, current_correct_keys)) == - LDNS_STATUS_OK) { - /* if the ds is signed by a trusted key and a key from correct keys - matches that ds, add that key to the trusted keys */ - new_keys_trusted = false; - if (verbosity >= 2) { - printf("Checking if signing key is trusted:\n"); - } - for (j = 0; j < ldns_rr_list_rr_count(current_correct_keys); j++) { - if (verbosity >= 2) { - printf("New key: "); - ldns_rr_print(stdout, ldns_rr_list_rr(current_correct_keys, j)); - } - for (k = 0; k < ldns_rr_list_rr_count(trusted_keys); k++) { - if (verbosity >= 2) { - printf("\tTrusted key: "); - ldns_rr_print(stdout, ldns_rr_list_rr(trusted_keys, k)); - } - if (ldns_rr_compare(ldns_rr_list_rr(current_correct_keys, j), - ldns_rr_list_rr(trusted_keys, k)) == 0) { - if (verbosity >= 2) { - printf("Key is now trusted!\n"); - } - for (l = 0; l < ldns_rr_list_rr_count(ds_list); l++) { - ldns_rr_list_push_rr(trusted_ds_rrs, ldns_rr_clone(ldns_rr_list_rr(ds_list, l))); - new_keys_trusted = true; - } - } - } - } - if (new_keys_trusted) { - print_rr_list_abbr(stdout, ds_list, TRUST); - } else { - print_rr_list_abbr(stdout, ds_list, SELF); - } - } else { - result = 3; - print_rr_list_abbr(stdout, ds_list, BOGUS); - } - - ldns_rr_list_free(current_correct_keys); - current_correct_keys = NULL; - } else { - /* wait apparently there were no keys either, go back to the ds packet */ - ldns_pkt_free(p); - ldns_rr_list_deep_free(ds_sig_list); - p = get_dnssec_pkt(res, labels[i-1], LDNS_RR_TYPE_DS); - pt = get_ds(p, labels[i-1], &ds_list, &ds_sig_list); - - status = ldns_verify_denial(p, labels[i-1], LDNS_RR_TYPE_DS, &nsec_rrs, &nsec_rr_sigs); - - if (verbosity >= 4) { - printf("NSEC(3) Records to verify:\n"); - ldns_rr_list_print(stdout, nsec_rrs); - printf("With signatures:\n"); - ldns_rr_list_print(stdout, nsec_rr_sigs); - printf("correct keys:\n"); - ldns_rr_list_print(stdout, correct_key_list); - } - - if (status == LDNS_STATUS_OK) { - if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", TRUST); - fprintf(stdout, "Existence denied: "); - ldns_rdf_print(stdout, labels[i-1]); - printf(" DS"); - fprintf(stdout, "\n"); - } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", SELF); - fprintf(stdout, "Existence denied: "); - ldns_rdf_print(stdout, labels[i-1]); - printf(" DS"); - fprintf(stdout, "\n"); - } else { - result = 4; - fprintf(stdout, "%s ", BOGUS); - printf("Error verifying denial of existence for "); - ldns_rdf_print(stdout, labels[i-1]); - printf(" DS"); - printf(": %s\n", ldns_get_errorstr_by_id(st)); - } - - - } else { - if (status == LDNS_STATUS_CRYPTO_NO_RRSIG) { - printf(";; No DS for "); - ldns_rdf_print(stdout, labels[i - 1]); - } else { - printf("[B] Unable to verify denial of existence for "); - ldns_rdf_print(stdout, labels[i - 1]); - printf(" DS: %s\n", ldns_get_errorstr_by_id(status)); - } - } - if (verbosity >= 2) { - printf(";; No ds record for delegation\n"); - } - } - } - ldns_rr_list_deep_free(ds_list); - ldns_pkt_free(p); - } else { - /* if this is the last label, just verify the data and stop */ - p = get_dnssec_pkt(res, labels[i], t); - pt = get_dnssec_rr(p, labels[i], t, &dataset, &key_sig_list); - if (dataset && ldns_rr_list_rr_count(dataset) > 0) { - if (key_sig_list && ldns_rr_list_rr_count(key_sig_list) > 0) { - - /* If this is a wildcard, you must be able to deny exact match */ - if ((st = ldns_verify(dataset, key_sig_list, trusted_keys, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", TRUST); - ldns_rr_list_print(stdout, dataset); - } else if ((st = ldns_verify(dataset, key_sig_list, correct_key_list, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", SELF); - ldns_rr_list_print(stdout, dataset); - } else { - result = 5; - fprintf(stdout, "%s ", BOGUS); - ldns_rr_list_print(stdout, dataset); - printf(";; Error: %s\n", ldns_get_errorstr_by_id(st)); - } - } else { - fprintf(stdout, "%s ", UNSIGNED); - ldns_rr_list_print(stdout, dataset); - } - ldns_rr_list_deep_free(dataset); - } else { - status = ldns_verify_denial(p, name, t, &nsec_rrs, &nsec_rr_sigs); - if (status == LDNS_STATUS_OK) { - /* verify the nsec3 themselves*/ - if (verbosity >= 5) { - printf("NSEC(3) Records to verify:\n"); - ldns_rr_list_print(stdout, nsec_rrs); - printf("With signatures:\n"); - ldns_rr_list_print(stdout, nsec_rr_sigs); - printf("correct keys:\n"); - ldns_rr_list_print(stdout, correct_key_list); -/* - printf("trusted keys at %p:\n", trusted_keys); - ldns_rr_list_print(stdout, trusted_keys); -*/ } - - if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", TRUST); - fprintf(stdout, "Existence denied: "); - ldns_rdf_print(stdout, name); - if (descriptor && descriptor->_name) { - printf(" %s", descriptor->_name); - } else { - printf(" TYPE%u", t); - } - fprintf(stdout, "\n"); - } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { - fprintf(stdout, "%s ", SELF); - fprintf(stdout, "Existence denied: "); - ldns_rdf_print(stdout, name); - if (descriptor && descriptor->_name) { - printf(" %s", descriptor->_name); - } else { - printf(" TYPE%u", t); - } - fprintf(stdout, "\n"); - } else { - result = 6; - fprintf(stdout, "%s ", BOGUS); - printf("Error verifying denial of existence for "); - ldns_rdf_print(stdout, name); - printf(" type "); - if (descriptor && descriptor->_name) { - printf("%s", descriptor->_name); - } else { - printf("TYPE%u", t); - } - printf(": %s\n", ldns_get_errorstr_by_id(st)); - } - - ldns_rr_list_deep_free(nsec_rrs); - ldns_rr_list_deep_free(nsec_rr_sigs); - } else { -/* -*/ - if (status == LDNS_STATUS_CRYPTO_NO_RRSIG) { - printf("%s ", UNSIGNED); - printf("No data found for: "); - ldns_rdf_print(stdout, name); - printf(" type "); - if (descriptor && descriptor->_name) { - printf("%s", descriptor->_name); - } else { - printf("TYPE%u", t); - } - printf("\n"); - } else { - printf("[B] Unable to verify denial of existence for "); - ldns_rdf_print(stdout, name); - printf(" type "); - if (descriptor && descriptor->_name) { - printf("%s", descriptor->_name); - } else { - printf("TYPE%u", t); - } - printf("\n"); - } - - } - } - ldns_pkt_free(p); - } - - new_nss_aaaa = NULL; - new_nss_a = NULL; - new_nss = NULL; - ns_addr = NULL; - ldns_rr_list_deep_free(key_list); - key_list = NULL; - ldns_rr_list_deep_free(key_sig_list); - key_sig_list = NULL; - ds_list = NULL; - ldns_rr_list_deep_free(ds_sig_list); - ds_sig_list = NULL; - } - printf(";;" SELF " self sig OK; " BOGUS " bogus; " TRUST " trusted\n"); - /* verbose mode? - printf("Trusted keys:\n"); - ldns_rr_list_print(stdout, trusted_keys); - printf("trusted dss:\n"); - ldns_rr_list_print(stdout, trusted_ds_rrs); - */ - - done: - ldns_rr_list_deep_free(trusted_ds_rrs); - ldns_rr_list_deep_free(correct_key_list); - ldns_resolver_deep_free(res); - if (labels) { - for(i = 0 ; i < (ssize_t)labels_count + 2; i++) { - ldns_rdf_deep_free(labels[i]); - } - LDNS_FREE(labels); - } - return result; -} -#endif /* HAVE_SSL */ diff --git a/libs/ldns/drill/work.c b/libs/ldns/drill/work.c deleted file mode 100644 index 3a9cb5855d..0000000000 --- a/libs/ldns/drill/work.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * work.c - * Where all the hard work is done - * (c) 2005 NLnet Labs - * - * See the file LICENSE for the license - * - */ - -#include "drill.h" -#include - -/** - * Converts a hex string to binary data - * len is the length of the string - * buf is the buffer to store the result in - * offset is the starting position in the result buffer - * - * This function returns the length of the result - */ -size_t -hexstr2bin(char *hexstr, int len, uint8_t *buf, size_t offset, size_t buf_len) -{ - char c; - int i; - uint8_t int8 = 0; - int sec = 0; - size_t bufpos = 0; - - if (len % 2 != 0) { - return 0; - } - - for (i=0; i= '0' && c <= '9') { - int8 += c & 0x0f; - } else if (c >= 'a' && c <= 'z') { - int8 += (c & 0x0f) + 9; - } else if (c >= 'A' && c <= 'Z') { - int8 += (c & 0x0f) + 9; - } else { - return 0; - } - - if (sec == 0) { - int8 = int8 << 4; - sec = 1; - } else { - if (bufpos + offset + 1 <= buf_len) { - buf[bufpos+offset] = int8; - int8 = 0; - sec = 0; - bufpos++; - } else { - error("Buffer too small in hexstr2bin"); - } - } - } - } - return bufpos; -} - -size_t -packetbuffromfile(char *filename, uint8_t *wire) -{ - FILE *fp = NULL; - int c; - - /* stat hack - * 0 = normal - * 1 = comment (skip to end of line) - * 2 = unprintable character found, read binary data directly - */ - int state = 0; - uint8_t *hexbuf = xmalloc(LDNS_MAX_PACKETLEN); - int hexbufpos = 0; - size_t wirelen; - - if (strncmp(filename, "-", 2) == 0) { - fp = stdin; - } else { - fp = fopen(filename, "r"); - } - if (fp == NULL) { - perror("Unable to open file for reading"); - xfree(hexbuf); - return 0; - } - - /*verbose("Opened %s\n", filename);*/ - - c = fgetc(fp); - while (c != EOF && hexbufpos < LDNS_MAX_PACKETLEN) { - if (state < 2 && !isascii(c)) { - /*verbose("non ascii character found in file: (%d) switching to raw mode\n", c);*/ - state = 2; - } - switch (state) { - case 0: - if ( (c >= '0' && c <= '9') || - (c >= 'a' && c <= 'f') || - (c >= 'A' && c <= 'F') ) - { - hexbuf[hexbufpos] = (uint8_t) c; - hexbufpos++; - } else if (c == ';') { - state = 1; - } else if (c == ' ' || c == '\t' || c == '\n') { - /* skip whitespace */ - } - break; - case 1: - if (c == '\n' || c == EOF) { - state = 0; - } - break; - case 2: - hexbuf[hexbufpos] = (uint8_t) c; - hexbufpos++; - break; - default: - warning("unknown state while reading %s", filename); - xfree(hexbuf); - return 0; - break; - } - c = fgetc(fp); - } - - if (c == EOF) { - /* - if (have_drill_opt && drill_opt->verbose) { - verbose("END OF FILE REACHED\n"); - if (state < 2) { - verbose("read:\n"); - verbose("%s\n", hexbuf); - } else { - verbose("Not printing wire because it contains non ascii data\n"); - } - } - */ - } - if (hexbufpos >= LDNS_MAX_PACKETLEN) { - /*verbose("packet size reached\n");*/ - } - - /* lenient mode: length must be multiple of 2 */ - if (hexbufpos % 2 != 0) { - hexbuf[hexbufpos] = (uint8_t) '0'; - hexbufpos++; - } - - if (state < 2) { - wirelen = hexstr2bin((char *) hexbuf, - hexbufpos, - wire, - 0, - LDNS_MAX_PACKETLEN); - } else { - memcpy(wire, hexbuf, (size_t) hexbufpos); - wirelen = (size_t) hexbufpos; - } - if (fp != stdin) { - fclose(fp); - } - xfree(hexbuf); - return wirelen; -} - -ldns_buffer * -read_hex_buffer(char *filename) -{ - uint8_t *wire; - size_t wiresize; - ldns_buffer *result_buffer = NULL; - - FILE *fp = NULL; - - if (strncmp(filename, "-", 2) != 0) { - fp = fopen(filename, "r"); - } else { - fp = stdin; - } - - if (fp == NULL) { - perror(""); - warning("Unable to open %s", filename); - return NULL; - } - - wire = xmalloc(LDNS_MAX_PACKETLEN); - - wiresize = packetbuffromfile(filename, wire); - - result_buffer = LDNS_MALLOC(ldns_buffer); - ldns_buffer_new_frm_data(result_buffer, wire, wiresize); - ldns_buffer_set_position(result_buffer, ldns_buffer_capacity(result_buffer)); - - xfree(wire); - return result_buffer; -} - -ldns_pkt * -read_hex_pkt(char *filename) -{ - uint8_t *wire; - size_t wiresize; - - ldns_pkt *pkt = NULL; - - ldns_status status = LDNS_STATUS_ERR; - - wire = xmalloc(LDNS_MAX_PACKETLEN); - - wiresize = packetbuffromfile(filename, wire); - - if (wiresize > 0) { - status = ldns_wire2pkt(&pkt, wire, wiresize); - } - - xfree(wire); - - if (status == LDNS_STATUS_OK) { - return pkt; - } else { - fprintf(stderr, "Error parsing hex file: %s\n", - ldns_get_errorstr_by_id(status)); - return NULL; - } -} - -void -dump_hex(const ldns_pkt *pkt, const char *filename) -{ - uint8_t *wire; - size_t size, i; - FILE *fp; - ldns_status status; - - fp = fopen(filename, "w"); - - if (fp == NULL) { - error("Unable to open %s for writing", filename); - return; - } - - status = ldns_pkt2wire(&wire, pkt, &size); - - if (status != LDNS_STATUS_OK) { - error("Unable to convert packet: error code %u", status); - return; - } - - fprintf(fp, "; 0"); - for (i = 1; i < 20; i++) { - fprintf(fp, " %2u", (unsigned int) i); - } - fprintf(fp, "\n"); - fprintf(fp, ";--"); - for (i = 1; i < 20; i++) { - fprintf(fp, " --"); - } - fprintf(fp, "\n"); - for (i = 0; i < size; i++) { - if (i % 20 == 0 && i > 0) { - fprintf(fp, "\t;\t%4u-%4u\n", (unsigned int) i-19, (unsigned int) i); - } - fprintf(fp, " %02x", (unsigned int)wire[i]); - } - fprintf(fp, "\n"); - fclose(fp); -} diff --git a/libs/ldns/error.c b/libs/ldns/error.c deleted file mode 100644 index ff240dcc82..0000000000 --- a/libs/ldns/error.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * a error2str function to make sense of all the - * error codes we have laying ardoun - * - * a Net::DNS like library for C - * LibDNS Team @ NLnet Labs - * (c) NLnet Labs, 2005-2006 - * See the file LICENSE for the license - */ - -#include - -#include - -ldns_lookup_table ldns_error_str[] = { - { LDNS_STATUS_OK, "All OK" }, - { LDNS_STATUS_EMPTY_LABEL, "Empty label" }, - { LDNS_STATUS_LABEL_OVERFLOW, "Label length overflow" }, - { LDNS_STATUS_DOMAINNAME_OVERFLOW, "Domainname length overflow" }, - { LDNS_STATUS_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" }, - { LDNS_STATUS_DDD_OVERFLOW, "\\DDD sequence overflow (>255)" }, - { LDNS_STATUS_PACKET_OVERFLOW, "Packet size overflow" }, - { LDNS_STATUS_INVALID_POINTER, "Invalid compression pointer" }, - { LDNS_STATUS_MEM_ERR, "General memory error" }, - { LDNS_STATUS_INTERNAL_ERR, "Internal error, this should not happen" }, - { LDNS_STATUS_SSL_ERR, "Error in SSL library" }, - { LDNS_STATUS_ERR, "General LDNS error" }, - { LDNS_STATUS_INVALID_INT, "Conversion error, integer expected" }, - { LDNS_STATUS_INVALID_IP4, "Conversion error, ip4 addr expected" }, - { LDNS_STATUS_INVALID_IP6, "Conversion error, ip6 addr expected" }, - { LDNS_STATUS_INVALID_STR, "Conversion error, string expected" }, - { LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" }, - { LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" }, - { LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" }, - { LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" }, - { LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" }, - { LDNS_STATUS_FILE_ERR, "Could not open the files" }, - { LDNS_STATUS_UNKNOWN_INET, "Uknown address family" }, - { LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." }, - { LDNS_STATUS_NULL, "Supplied value pointer null" }, - { LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" }, - { LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" }, - { LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" }, - { LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" }, - { LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" }, - { LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" }, - { LDNS_STATUS_CRYPTO_NO_DS, "No DS record(s)" }, - { LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, "Could not validate DS record(s)" }, - { LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, "No keys with the keytag and algorithm from the RRSIG found" }, - { LDNS_STATUS_CRYPTO_VALIDATED, "Valid DNSSEC signature" }, - { LDNS_STATUS_CRYPTO_BOGUS, "Bogus DNSSEC signature" }, - { LDNS_STATUS_CRYPTO_SIG_EXPIRED, "DNSSEC signature has expired" }, - { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, "DNSSEC signature not incepted yet" }, - { LDNS_STATUS_CRYPTO_TSIG_BOGUS, "Bogus TSIG signature" }, - { LDNS_STATUS_CRYPTO_TSIG_ERR, "Could not create TSIG signature" }, - { LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, "DNSSEC signature has expiration date earlier than inception date" }, - { LDNS_STATUS_ENGINE_KEY_NOT_LOADED, "Unable to load private key from engine" }, - { LDNS_STATUS_NSEC3_ERR, "Error in NSEC3 denial of existence proof" }, - { LDNS_STATUS_RES_NO_NS, "No (valid) nameservers defined in the resolver" }, - { LDNS_STATUS_RES_QUERY, "No correct query given to resolver" }, - { LDNS_STATUS_WIRE_INCOMPLETE_HEADER, "header section incomplete" }, - { LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, "question section incomplete" }, - { LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, "answer section incomplete" }, - { LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, "authority section incomplete" }, - { LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, "additional section incomplete" }, - { LDNS_STATUS_NO_DATA, "No data" }, - { LDNS_STATUS_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" }, - { LDNS_STATUS_SYNTAX_TYPE_ERR, "Syntax error, could not parse the RR's type" }, - { LDNS_STATUS_SYNTAX_CLASS_ERR, "Syntax error, could not parse the RR's class" }, - { LDNS_STATUS_SYNTAX_TTL_ERR, "Syntax error, could not parse the RR's TTL" }, - { LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, "Syntax error, $INCLUDE not implemented" }, - { LDNS_STATUS_SYNTAX_RDATA_ERR, "Syntax error, could not parse the RR's rdata" }, - { LDNS_STATUS_SYNTAX_DNAME_ERR, "Syntax error, could not parse the RR's dname(s)" }, - { LDNS_STATUS_SYNTAX_VERSION_ERR, "Syntax error, version mismatch" }, - { LDNS_STATUS_SYNTAX_ALG_ERR, "Syntax error, algorithm unknown or non parseable" }, - { LDNS_STATUS_SYNTAX_KEYWORD_ERR, "Syntax error, unknown keyword in input" }, - { LDNS_STATUS_SYNTAX_ERR, "Syntax error, could not parse the RR" }, - { LDNS_STATUS_SYNTAX_EMPTY, "Empty line was returned" }, - { LDNS_STATUS_SYNTAX_TTL, "$TTL directive was seen in the zone" }, - { LDNS_STATUS_SYNTAX_ORIGIN, "$ORIGIN directive was seen in the zone" }, - { LDNS_STATUS_SYNTAX_INCLUDE, "$INCLUDE directive was seen in the zone" }, - { LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, "Iterations count for NSEC3 record higher than maximum" }, - { LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, "Syntax error, value expected" }, - { LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer value too large" }, - { LDNS_STATUS_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" }, - { LDNS_STATUS_SOCKET_ERROR, "Error creating socket" }, - { LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, "Existence denied by NSEC" }, - { LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, "RR not covered by the given NSEC RRs" }, - { LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, "wildcard not covered by the given NSEC RRs" }, - { LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND, "original of NSEC3 hashed name could not be found" }, - { 0, NULL } -}; - -const char * -ldns_get_errorstr_by_id(ldns_status err) -{ - ldns_lookup_table *lt; - - lt = ldns_lookup_by_id(ldns_error_str, err); - - if (lt) { - return lt->name; - } - return NULL; -} diff --git a/libs/ldns/examples/Makefile.in b/libs/ldns/examples/Makefile.in deleted file mode 100644 index 659efc0c33..0000000000 --- a/libs/ldns/examples/Makefile.in +++ /dev/null @@ -1,179 +0,0 @@ -# Standard installation pathnames -# See the file LICENSE for the license -SHELL = @SHELL@ -VERSION = @PACKAGE_VERSION@ -basesrcdir = $(shell basename `pwd`) -srcdir = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -mandir = @mandir@ -libtool = @libtool@ - -CC = @CC@ -CFLAGS = -I. -I${srcdir} @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBNSL_LIBS = @LIBNSL_LIBS@ -LIBSSL_CPPFLAGS = @LIBSSL_CPPFLAGS@ -LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ -LIBSSL_LIBS = @LIBSSL_LIBS@ -LIBS = @LIBS@ -RUNTIME_PATH = @RUNTIME_PATH@ -LDNSDIR = @LDNSDIR@ - -INSTALL = $(srcdir)/../install-sh - -COMPILE = $(CC) $(CPPFLAGS) $(LIBSSL_CPPFLAGS) $(CFLAGS) -LINK = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(RUNTIME_PATH) -LINK_STATIC = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) -static $(LDFLAGS) $(LIBS) $(RUNTIME_PATH) - -LINT = splint -LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list -#-Dglob64=glob -Dglobfree64=globfree -# compat with openssl linux edition. -LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" -# compat with NetBSD -ifeq "$(shell uname)" "NetBSD" -LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ -endif -# compat with OpenBSD -LINTFLAGS+="-Dsigset_t=long" -# FreeBSD8 -LINTFLAGS+="-D__uint16_t=uint16_t" -LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)=" - -HEADER = config.h -MAIN_SOURCES = ldns-read-zone.c \ - ldns-mx.c \ - ldns-chaos.c \ - ldns-update.c \ - ldns-keygen.c \ - ldns-key2ds.c \ - ldns-version.c \ - ldns-rrsig.c \ - ldns-walk.c \ - ldns-zsplit.c \ - ldns-zcat.c \ - ldns-dpa.c \ - ldns-resolver.c \ - ldns-test-edns.c \ - ldns-keyfetcher.c \ - ldns-notify.c \ - ldns-testns.c \ - ldns-compare-zones.c \ - ldnsd.c - -MAIN_SSL_SOURCES = ldns-signzone.c \ - ldns-verify-zone.c \ - ldns-revoke.c \ - ldns-nsec3-hash.c - -OTHER_SOURCES = ldns-testpkts.c - -PROGRAMS=$(MAIN_SOURCES:.c=) -SSL_PROGRAMS=$(MAIN_SSL_SOURCES:.c=) - -.PHONY: all clean realclean all-static -.SECONDARY: $(MAIN_SOURCES:.c=.o) $(OTHER_SOURCES:.c=.o) $(MAIN_SSL_SOURCES:.c=.o) - -all: $(addsuffix .prg,$(PROGRAMS)) $(addsuffix .prg-ssl,$(SSL_PROGRAMS)) - -all-static: $(addsuffix .stc,$(PROGRAMS)) $(addsuffix .stc-ssl,$(SSL_PROGRAMS)) - -%.o: $(srcdir)/%.c - $(COMPILE) -o $@ -c $< - -# ldns-testns uses more sources. -ldns-testns.o: $(srcdir)/ldns-testns.c $(srcdir)/ldns-testpkts.c $(srcdir)/ldns-testpkts.h -ldns-testns.prg: ldns-testpkts.o -ldns-testns.stc: ldns-testpkts.o - -ldnsd.prg: ldnsd.o - @if test ! -f $(@:.prg=) -o $< -nt $(@:.prg=); then \ - echo $(LINK) $(LIBNSL_LIBS) -o $(@:.prg=) $^ ; \ - $(LINK) $(LIBNSL_LIBS) -o $(@:.prg=) $^ ; \ - fi - -ldnsd.stc: ldnsd.o - @if test ! -f $@ -o $< -nt $@; then \ - echo $(LINK_STATIC) $(LIBNSL_LDFLAGS) -o $@ $^ ; \ - $(LINK_STATIC) $(LIBNSL_LDFLAGS) -o $@ $^ ; \ - fi - -%.prg-ssl: %.o - @if test ! -f $(@:.prg-ssl=) -o $< -nt $(@:.prg-ssl=); then \ - echo $(LINK) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $(@:.prg-ssl=) $^ ; \ - $(LINK) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $(@:.prg-ssl=) $^ ; \ - fi - -%.stc-ssl: %.o - @if test ! -f $@ -o $< -nt $@; then \ - echo $(LINK_STATIC) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $@ $^ ; \ - $(LINK_STATIC) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $@ $^ ; \ - fi - -%.prg: %.o - @if test ! -f $(@:.prg=) -o $< -nt $(@:.prg=); then \ - echo $(LINK) -o $(@:.prg=) $^ ; \ - $(LINK) -o $(@:.prg=) $^ ; \ - fi - -%.stc: %.o - @if test ! -f $@ -o $< -nt $@; then \ - echo $(LINK_STATIC) -o $@ $^ ; \ - $(LINK_STATIC) -o $@ $^ ; \ - fi - -lint: - for i in $(MAIN_SOURCES) $(OTHER_SOURCES); do \ - $(LINT) $(LINTFLAGS) -I. -I$(srcdir) $(srcdir)/$$i $(CPPFLAGS); \ - if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ - done - -clean: - rm -f *.o *.lo - rm -rf .libs - rm -f $(PROGRAMS) $(SSL_PROGRAMS) - rm -f $(addsuffix .stc,$(PROGRAMS)) $(addsuffix .stc-ssl,$(SSL_PROGRAMS)) - -realclean: clean - rm -rf autom4te.cache/ - rm -f config.log config.status aclocal.m4 config.h.in configure Makefile - rm -f config.h - -confclean: clean - rm -rf config.log config.status config.h Makefile - -install: $(PROGRAMS) $(SSL_PROGRAMS) - $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) - $(INSTALL) -d -m 755 $(DESTDIR)$(mandir) - $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 - for i in $(PROGRAMS) $(SSL_PROGRAMS); do \ - $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i $(DESTDIR)$(bindir) ; \ - $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ - done - exit 0 - -install-static: all-static - $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) - $(INSTALL) -d -m 755 $(DESTDIR)$(mandir) - $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 - for i in $(PROGRAMS); do \ - $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i.stc $(DESTDIR)$(bindir) ; \ - $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ - done - for i in $(SSL_PROGRAMS); do \ - $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i.stc-ssl $(DESTDIR)$(bindir) ; \ - $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ - done - exit 0 - -uninstall: - for i in $(PROGRAMS) $(SSL_PROGRAMS); do \ - rm -f $(DESTDIR)$(bindir)/$$i ; \ - rm -f $(DESTDIR)$(mandir)/man1/$$i.1 ; \ - done - exit 0 - rmdir -p $(DESTDIR)$(bindir) - rmdir -p $(DESTDIR)$(mandir) diff --git a/libs/ldns/examples/README b/libs/ldns/examples/README deleted file mode 100644 index f84fe9d8cf..0000000000 --- a/libs/ldns/examples/README +++ /dev/null @@ -1,5 +0,0 @@ -These tools are examples of ldns usage. They are not meant for production -systems and will not be supported as such. - -Compilation: -autoreconf && ./configure && make diff --git a/libs/ldns/examples/config.h.in b/libs/ldns/examples/config.h.in deleted file mode 100644 index dad78b17a2..0000000000 --- a/libs/ldns/examples/config.h.in +++ /dev/null @@ -1,363 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASSERT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_CTYPE_H - -/* Define to 1 if you have the declaration of `in6addr_any', and to 0 if you - don't. */ -#undef HAVE_DECL_IN6ADDR_ANY - -/* Define to 1 if you have the `fork' function. */ -#undef HAVE_FORK - -/* Whether getaddrinfo is available */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_GETOPT_H - -/* If you have HMAC_CTX_init */ -#undef HAVE_HMAC_CTX_INIT - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `isblank' function. */ -#undef HAVE_ISBLANK - -/* Define to 1 if you have the `ldns' library (-lldns). */ -#undef HAVE_LIBLDNS - -/* Define to 1 if you have the `pcap' library (-lpcap). */ -#undef HAVE_LIBPCAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IF_ETHER_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IGMP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_SYSTM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP6_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_UDP_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NET_IF_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_ERR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_RAND_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_SSL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PCAP_H - -/* Define to 1 if you have the `random' function. */ -#undef HAVE_RANDOM - -/* Define to 1 if you have the `sleep' function. */ -#undef HAVE_SLEEP - -/* Define to 1 if you have the `srandom' function. */ -#undef HAVE_SRANDOM - -/* Define if you have the SSL libraries installed. */ -#undef HAVE_SSL - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MOUNT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SELECT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the `vfork' function. */ -#undef HAVE_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_VFORK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WINSOCK2_H - -/* Define to 1 if `fork' works. */ -#undef HAVE_WORKING_FORK - -/* Define to 1 if `vfork' works. */ -#undef HAVE_WORKING_VFORK - -/* Define to 1 if you have the header file. */ -#undef HAVE_WS2TCPIP_H - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define this to enable ECDSA support. */ -#undef USE_ECDSA - -/* Define this to enable GOST support. */ -#undef USE_GOST - -/* Define this to enable SHA256 and SHA512 support. */ -#undef USE_SHA2 - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* the version of the windows API enabled */ -#undef WINVER - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* in_addr_t */ -#undef in_addr_t - -/* in_port_t */ -#undef in_port_t - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `short' if does not define. */ -#undef int16_t - -/* Define to `int' if does not define. */ -#undef int32_t - -/* Define to `long long' if does not define. */ -#undef int64_t - -/* Define to `char' if does not define. */ -#undef int8_t - -/* Define to `int' if does not define. */ -#undef pid_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t - -/* Define to 'int' if not defined */ -#undef socklen_t - -/* Define to `int' if does not define. */ -#undef ssize_t - -/* Define to `unsigned short' if does not define. */ -#undef uint16_t - -/* Define to `unsigned int' if does not define. */ -#undef uint32_t - -/* Define to `unsigned long long' if does not define. */ -#undef uint64_t - -/* Define to `unsigned char' if does not define. */ -#undef uint8_t - -/* Define as `fork' if `vfork' does not work. */ -#undef vfork - - - -#include -#include -#include -#include - -#if STDC_HEADERS -#include -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_NETINET_UDP_H -#include -#endif - -#ifdef HAVE_TIME_H -#include -#endif - -#ifdef HAVE_PCAP_H -#include -#endif - -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif - -#ifdef HAVE_NETINET_IP_H -#include -#endif - -#ifdef HAVE_NET_IF_H -#include -#endif - -#ifdef HAVE_NETINET_IF_ETHER_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#define USE_WINSOCK 1 -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -#ifndef HAVE_GETADDRINFO -#include -#endif - -#ifndef HAVE_RANDOM -/* random can be replaced by rand for ldnsexamples */ -#define random rand -#endif - -#ifndef HAVE_SRANDOM -/* srandom can be replaced by srand for ldnsexamples */ -#define srandom srand -#endif - -extern char *optarg; -extern int optind, opterr; - -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif - -#ifdef S_SPLINT_S -#define FD_ZERO(a) /* a */ -#define FD_SET(a,b) /* a, b */ -#endif - diff --git a/libs/ldns/examples/configure b/libs/ldns/examples/configure deleted file mode 100755 index 424aa3c78a..0000000000 --- a/libs/ldns/examples/configure +++ /dev/null @@ -1,7150 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for ldns 1.6.9. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: libdns@nlnetlabs.nl about your system, including any -$0: error possibly output before this message. Then install -$0: a modern shell, or manually run the script under such a -$0: shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='ldns' -PACKAGE_TARNAME='libdns' -PACKAGE_VERSION='1.6.9' -PACKAGE_STRING='ldns 1.6.9' -PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' -PACKAGE_URL='' - -ac_unique_file="ldns-read-zone.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_subst_vars='LTLIBOBJS -LIBOBJS -LDNSDIR -LIBSSL_LIBS -LIBSSL_LDFLAGS -LIBSSL_CPPFLAGS -RUNTIME_PATH -HAVE_SSL -LIBNSL_LIBS -libtool -SET_MAKE -EGREP -GREP -CPP -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_rpath -with_ssl -enable_sha2 -enable_gost -enable_ecdsa -with_ldns -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CPPFLAGS -CC -LDFLAGS -LIBS -CPPFLAGS' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -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_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$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 ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$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 | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$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 ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - 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 | -n) - 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 ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$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_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=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 ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# 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 the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - 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 - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of ldns 1.6.9:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-rpath Disable hardcoded rpath (default=enabled) - --disable-sha2 Disable SHA256 and SHA512 RRSIG support - --disable-gost Disable GOST support - --enable-ecdsa Enable ECDSA support, experimental - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl - /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw - /usr) - --with-ldns=PATH specify prefix of path of ldns library to use - - - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -ldns configure 1.6.9 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## ---------------------------------- ## -## Report this to libdns@nlnetlabs.nl ## -## ---------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* 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_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES -# --------------------------------------------- -# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR -# accordingly. -ac_fn_c_check_decl () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - as_decl_name=`echo $2|sed 's/ *(.*//'` - as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 -$as_echo_n "checking whether $as_decl_name is declared... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -#ifndef $as_decl_name -#ifdef __cplusplus - (void) $as_decl_use; -#else - (void) $as_decl_name; -#endif -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_decl -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by ldns $as_me 1.6.9, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -# acx_nlnetlabs.m4 - common macros for configure checks -# Copyright 2009, Wouter Wijngaards, NLnet Labs. -# BSD licensed. -# -# Version 11 -# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. -# 2010-07-02 Add check for ss_family (for minix). -# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. -# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. -# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl -# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN -# 2010-01-20 added AHX_COONFIG_STRLCAT -# 2009-07-14 U_CHAR detection improved for windows crosscompile. -# added ACX_FUNC_MALLOC -# fixup some #if to #ifdef -# NONBLOCKING test for mingw crosscompile. -# 2009-07-13 added ACX_WITH_SSL_OPTIONAL -# 2009-07-03 fixup LDFLAGS for empty ssl dir. -# -# Automates some of the checking constructs. Aims at portability for POSIX. -# Documentation for functions is below. -# -# the following macro's are provided in this file: -# (see below for details on each macro). -# -# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. -# ACX_RSRC_VERSION - create windows resource version number. -# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. -# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). -# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. -# ACX_DEPFLAG - find cc dependency flags. -# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. -# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. -# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. -# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. -# ACX_TYPE_U_CHAR - u_char type. -# ACX_TYPE_RLIM_T - rlim_t type. -# ACX_TYPE_SOCKLEN_T - socklen_t type. -# ACX_TYPE_IN_ADDR_T - in_addr_t type. -# ACX_TYPE_IN_PORT_T - in_port_t type. -# ACX_ARG_RPATH - add --disable-rpath option. -# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. -# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, -# where --without-ssl is also accepted -# ACX_LIB_SSL - setup to link -lssl. -# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. -# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. -# ACX_FUNC_DEPRECATED - see if func is deprecated. -# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. -# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. -# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. -# ACX_FUNC_MALLOC - check malloc, define replacement . -# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. -# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. -# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. -# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. -# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. -# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. -# AHX_CONFIG_SNPRINTF - snprintf compat prototype -# AHX_CONFIG_INET_PTON - inet_pton compat prototype -# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype -# AHX_CONFIG_INET_ATON - inet_aton compat prototype -# AHX_CONFIG_MEMMOVE - memmove compat prototype -# AHX_CONFIG_STRLCAT - strlcat compat prototype -# AHX_CONFIG_STRLCPY - strlcpy compat prototype -# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype -# AHX_CONFIG_W32_SLEEP - w32 compat for sleep -# AHX_CONFIG_W32_USLEEP - w32 compat for usleep -# AHX_CONFIG_W32_RANDOM - w32 compat for random -# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom -# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. -# ACX_CFLAGS_STRIP - strip one flag from CFLAGS -# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS -# AHX_CONFIG_FLAG_OMITTED - define omitted flag -# AHX_CONFIG_FLAG_EXT - define omitted extension flag -# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags -# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. -# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. -# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family -# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -OURCPPFLAGS='' -CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} -OURCFLAGS='-g' -CFLAGS=${CFLAGS:-${OURCFLAGS}} - -$as_echo "#define WINVER 0x0502" >>confdefs.h - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - 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 confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#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)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" -if test "x$ac_cv_header_minix_config_h" = xyes; then : - MINIX=yes -else - MINIX= -fi - - - if test "$MINIX" = yes; then - -$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h - - -$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h - - -$as_echo "#define _MINIX 1" >>confdefs.h - - fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if ${ac_cv_safe_to_define___extensions__+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_safe_to_define___extensions__=yes -else - ac_cv_safe_to_define___extensions__=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h - - $as_echo "#define _ALL_SOURCE 1" >>confdefs.h - - $as_echo "#define _GNU_SOURCE 1" >>confdefs.h - - $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h - - $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h - - - -# Checks for programs. -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_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 $# != 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 - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 -$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } -set x ${MAKE-make} -ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat >conftest.make <<\_ACEOF -SHELL = /bin/sh -all: - @echo '@@@%%%=$(MAKE)=@@@%%%' -_ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. -case `${MAKE-make} -f conftest.make 2>/dev/null` in - *@@@%%%=?*=@@@%%%*) - eval ac_cv_prog_make_${ac_make}_set=yes;; - *) - eval ac_cv_prog_make_${ac_make}_set=no;; -esac -rm -f conftest.make -fi -if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - SET_MAKE= -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - SET_MAKE="MAKE=${MAKE-make}" -fi - -for ac_prog in glibtool libtool15 libtool -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_libtool+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$libtool"; then - ac_cv_prog_libtool="$libtool" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_libtool="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -libtool=$ac_cv_prog_libtool -if test -n "$libtool"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libtool" >&5 -$as_echo "$libtool" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$libtool" && break -done -test -n "$libtool" || libtool="../libtool" - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 -$as_echo_n "checking whether $CC supports -std=c99... " >&6; } -cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-std=c99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 -$as_echo_n "checking whether $CC supports -xc99... " >&6; } -cache=`echo xc99 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -C99FLAG="-xc99" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - -# Check whether --enable-rpath was given. -if test "${enable_rpath+set}" = set; then : - enableval=$enable_rpath; enable_rpath=$enableval -else - enable_rpath=yes -fi - - -if test "x$enable_rpath" = xyes; then - RPATH_VAL="-Wl,-rpath=\${libdir}" -fi - - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 -$as_echo_n "checking whether $CC supports -O2... " >&6; } -cache=`echo O2 | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS -O2" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: - -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 -$as_echo_n "checking whether $CC supports -Werror... " >&6; } -cache=`echo Werror | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -ERRFLAG="-Werror" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: -ERRFLAG="-errwarn" -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 -$as_echo_n "checking whether $CC supports -Wall... " >&6; } -cache=`echo Wall | sed 'y%.=/+-%___p_%'` -if eval \${cv_prog_cc_flag_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo 'void f(){}' >conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_$cache=yes" -else -eval "cv_prog_cc_flag_$cache=no" -fi -rm -f conftest conftest.o conftest.c - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -ERRFLAG="$ERRFLAG -Wall" -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -: -ERRFLAG="$ERRFLAG -errfmt" -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC" >&5 -$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC... " >&6; } -cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo ' -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - return a; -} -' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 -$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } -cache=`$as_echo "$C99FLAG" | $as_tr_sh` -if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : - $as_echo_n "(cached) " >&6 -else - -echo '#include ' > conftest.c -echo 'void f(){}' >>conftest.c -if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=no" -else - -if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then -eval "cv_prog_cc_flag_needed_$cache=yes" -else -eval "cv_prog_cc_flag_needed_$cache=fail" -#echo 'Test with flag fails too!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` -#exit 1 -fi - -fi -rm -f conftest conftest.c conftest.o - -fi - -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -: -CFLAGS="$CFLAGS $C99FLAG" -else -if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -#echo 'Test with flag is no!' -#cat conftest.c -#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" -#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` -#exit 1 -: - -else -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -: - -fi -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 -$as_echo_n "checking for inline... " >&6; } -if ${ac_cv_c_inline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_inline=no -for ac_kw in inline __inline__ __inline; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifndef __cplusplus -typedef int foo_t; -static $ac_kw foo_t static_foo () {return 0; } -$ac_kw foo_t foo () {return 0; } -#endif - -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_inline=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_inline" != no && break -done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 -$as_echo "$ac_cv_c_inline" >&6; } - -case $ac_cv_c_inline in - inline | yes) ;; - *) - case $ac_cv_c_inline in - no) ac_val=;; - *) ac_val=$ac_cv_c_inline;; - esac - cat >>confdefs.h <<_ACEOF -#ifndef __cplusplus -#define inline $ac_val -#endif -_ACEOF - ;; -esac - -ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" -if test "x$ac_cv_type_int8_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int8_t char -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" -if test "x$ac_cv_type_int16_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int16_t short -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" -if test "x$ac_cv_type_int32_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int32_t int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" -if test "x$ac_cv_type_int64_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define int64_t long long -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" -if test "x$ac_cv_type_uint8_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint8_t unsigned char -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" -if test "x$ac_cv_type_uint16_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint16_t unsigned short -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" -if test "x$ac_cv_type_uint32_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint32_t unsigned int -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" -if test "x$ac_cv_type_uint64_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define uint64_t unsigned long long -_ACEOF - -fi - -ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" -if test "x$ac_cv_type_ssize_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define ssize_t int -_ACEOF - -fi - - -for ac_header in sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h pcap.h arpa/inet.h sys/time.h sys/socket.h sys/select.h netdb.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in winsock2.h ws2tcpip.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -for ac_header in netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/igmp.h netinet/if_ether.h netinet/ip6.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " -$ac_includes_default -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NET_IF_H -#include -#endif -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - -ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " -$ac_includes_default -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_WS2TCPIP_H -# include -#endif - -" -if test "x$ac_cv_type_socklen_t" = xyes; then : - -else - -$as_echo "#define socklen_t int" >>confdefs.h - -fi - -for ac_header in sys/param.h sys/mount.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default - - - #if HAVE_SYS_PARAM_H - # include - #endif - - -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -" -if test "x$ac_cv_type_in_addr_t" = xyes; then : - -else - -$as_echo "#define in_addr_t uint32_t" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif -" -if test "x$ac_cv_type_in_port_t" = xyes; then : - -else - -$as_echo "#define in_port_t uint16_t" >>confdefs.h - -fi - - -# check to see if libraries are needed for these functions. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 -$as_echo_n "checking for library containing socket... " >&6; } -if ${ac_cv_search_socket+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char socket (); -int -main () -{ -return socket (); - ; - return 0; -} -_ACEOF -for ac_lib in '' socket; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_socket=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_socket+:} false; then : - break -fi -done -if ${ac_cv_search_socket+:} false; then : - -else - ac_cv_search_socket=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 -$as_echo "$ac_cv_search_socket" >&6; } -ac_res=$ac_cv_search_socket -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -tmp_LIBS="$LIBS" -LIBS= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 -$as_echo_n "checking for library containing inet_pton... " >&6; } -if ${ac_cv_search_inet_pton+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char inet_pton (); -int -main () -{ -return inet_pton (); - ; - return 0; -} -_ACEOF -for ac_lib in '' nsl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_inet_pton=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_inet_pton+:} false; then : - break -fi -done -if ${ac_cv_search_inet_pton+:} false; then : - -else - ac_cv_search_inet_pton=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 -$as_echo "$ac_cv_search_inet_pton" >&6; } -ac_res=$ac_cv_search_inet_pton -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - -LIBNSL_LIBS=$LIBS - -LIBS="$tmp_LIBS" - -tmp_CPPFLAGS="$CPPFLAGS" -tmp_LDFLAGS="$LDFLAGS" -tmp_LIBS="$LIBS" - - - -# Check whether --with-ssl was given. -if test "${with_ssl+set}" = set; then : - withval=$with_ssl; - -else - - withval="yes" - -fi - - - withval=$withval - if test x_$withval != x_no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 -$as_echo_n "checking for SSL... " >&6; } - if test x_$withval = x_ -o x_$withval = x_yes; then - withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" - fi - for dir in $withval; do - ssldir="$dir" - if test -f "$dir/include/openssl/ssl.h"; then - found_ssl="yes" - -cat >>confdefs.h <<_ACEOF -#define HAVE_SSL /**/ -_ACEOF - - if test "$ssldir" != "/usr"; then - CPPFLAGS="$CPPFLAGS -I$ssldir/include" - LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" - fi - break; - fi - done - if test x_$found_ssl != x_yes; then - as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 -$as_echo "found in $ssldir" >&6; } - HAVE_SSL=yes - if test "$ssldir" != "/usr" -a "$ssldir" != ""; then - LDFLAGS="$LDFLAGS -L$ssldir/lib" - LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" - - if test "x$enable_rpath" = xyes; then - if echo "$ssldir/lib" | grep "^/" >/dev/null; then - RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" - fi - fi - - fi - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 -$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } - LIBS="$LIBS -lcrypto" - LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - # check if -lwsock32 or -lgdi32 are needed. - BAKLIBS="$LIBS" - BAKSSLLIBS="$LIBSSL_LIBS" - LIBS="$LIBS -lgdi32" - LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 -$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - LIBS="$BAKLIBS" - LIBSSL_LIBS="$BAKSSLLIBS" - LIBS="$LIBS -ldl" - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 -$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - int HMAC_CTX_init(void); - (void)HMAC_CTX_init(); - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - -$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - fi - - - # openssl engine functionality needs dlopen(). - BAKLIBS="$LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 -$as_echo_n "checking for library containing dlopen... " >&6; } -if ${ac_cv_search_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -for ac_lib in '' dl; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_dlopen=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if ${ac_cv_search_dlopen+:} false; then : - break -fi -done -if ${ac_cv_search_dlopen+:} false; then : - -else - ac_cv_search_dlopen=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 -$as_echo "$ac_cv_search_dlopen" >&6; } -ac_res=$ac_cv_search_dlopen -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -fi - - if test "$LIBS" != "$BAKLIBS"; then - LIBSSL_LIBS="$LIBSSL_LIBS -ldl" - fi - fi -for ac_header in openssl/ssl.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_SSL_H 1 -_ACEOF - -fi - -done - -for ac_header in openssl/err.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_err_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_ERR_H 1 -_ACEOF - -fi - -done - -for ac_header in openssl/rand.h -do : - ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default -" -if test "x$ac_cv_header_openssl_rand_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_OPENSSL_RAND_H 1 -_ACEOF - -fi - -done - - - - - - - - -CPPFLAGS="$tmp_CPPFLAGS" -LDFLAGS="$tmp_LDFLAGS" -LIBS="$tmp_LIBS" - -# use libcrypto to check the following: -tmp_LDFLAGS="$LDFLAGS" -tmp_LIBS="$LIBS" -LDFLAGS="$LDFLAGS $LIBSSL_LDFLAGS" -LIBS="$LIBS $LIBSSL_LIBS" -# Check whether --enable-sha2 was given. -if test "${enable_sha2+set}" = set; then : - enableval=$enable_sha2; -fi - -case "$enable_sha2" in - no) - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHA256 and SHA512" >&5 -$as_echo_n "checking for SHA256 and SHA512... " >&6; } - ac_fn_c_check_func "$LINENO" "SHA256_Init" "ac_cv_func_SHA256_Init" -if test "x$ac_cv_func_SHA256_Init" = xyes; then : - -else - - as_fn_error $? "SHA2 enabled, but no SHA2 functions found in OpenSSL" "$LINENO" 5 - -fi - - -cat >>confdefs.h <<_ACEOF -#define USE_SHA2 1 -_ACEOF - - ;; -esac - -# Check whether --enable-gost was given. -if test "${enable_gost+set}" = set; then : - enableval=$enable_gost; -fi - -case "$enable_gost" in - no) - ;; - *) - if test "x$HAVE_SSL" != "xyes"; then - as_fn_error $? "GOST enabled, but no SSL support" "$LINENO" 5 - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOST" >&5 -$as_echo_n "checking for GOST... " >&6; } - ac_fn_c_check_func "$LINENO" "EVP_PKEY_set_type_str" "ac_cv_func_EVP_PKEY_set_type_str" -if test "x$ac_cv_func_EVP_PKEY_set_type_str" = xyes; then : - -else - as_fn_error $? "OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost" "$LINENO" 5 -fi - - ac_fn_c_check_func "$LINENO" "EC_KEY_new" "ac_cv_func_EC_KEY_new" -if test "x$ac_cv_func_EC_KEY_new" = xyes; then : - -else - as_fn_error $? "No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost" "$LINENO" 5 -fi - - -cat >>confdefs.h <<_ACEOF -#define USE_GOST 1 -_ACEOF - - ;; -esac - -# Check whether --enable-ecdsa was given. -if test "${enable_ecdsa+set}" = set; then : - enableval=$enable_ecdsa; -fi - -case "$enable_ecdsa" in - yes) - ac_fn_c_check_func "$LINENO" "ECDSA_sign" "ac_cv_func_ECDSA_sign" -if test "x$ac_cv_func_ECDSA_sign" = xyes; then : - -else - as_fn_error $? "OpenSSL does not support ECDSA" "$LINENO" 5 -fi - - -cat >>confdefs.h <<_ACEOF -#define USE_ECDSA 1 -_ACEOF - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: - ***************************************************************** - *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** - *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** - *****************************************************************" >&5 -$as_echo "$as_me: WARNING: - ***************************************************************** - *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** - *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** - *****************************************************************" >&2;} - ;; - no|*) - ;; -esac - -LDFLAGS="$tmp_LDFLAGS" -LIBS="$tmp_LIBS" - -#AC_CHECK_HEADER(ldns/ldns.h,, [ -# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) -# ], [AC_INCLUDES_DEFAULT] -#) - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_open_offline in -lpcap" >&5 -$as_echo_n "checking for pcap_open_offline in -lpcap... " >&6; } -if ${ac_cv_lib_pcap_pcap_open_offline+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lpcap $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char pcap_open_offline (); -int -main () -{ -return pcap_open_offline (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pcap_pcap_open_offline=yes -else - ac_cv_lib_pcap_pcap_open_offline=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_open_offline" >&5 -$as_echo "$ac_cv_lib_pcap_pcap_open_offline" >&6; } -if test "x$ac_cv_lib_pcap_pcap_open_offline" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBPCAP 1 -_ACEOF - - LIBS="-lpcap $LIBS" - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find pcap library (needed for ldns-dpa, will not build dpa now.)" >&5 -$as_echo "$as_me: WARNING: Can't find pcap library (needed for ldns-dpa, will not build dpa now.)" >&2;} - - -fi - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 -$as_echo_n "checking for getaddrinfo... " >&6; } -if ${ac_cv_func_getaddrinfo+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_func_getaddrinfo=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef __cplusplus -extern "C" -{ -#endif -char* getaddrinfo(); -char* (*f) () = getaddrinfo; -#ifdef __cplusplus -} -#endif -int main() { - ; - return 0; -} - -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_getaddrinfo="yes" -else - ORIGLIBS="$LIBS" -LIBS="$LIBS -lws2_32" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -int -main () -{ - - (void)getaddrinfo(NULL, NULL, NULL, NULL); - - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_func_getaddrinfo="yes" -LDFLAGS="$LDFLAGS -lws2_32" - -else - ac_cv_func_getaddrinfo="no" -LIBS="$ORIGLIBS" - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 -$as_echo "$ac_cv_func_getaddrinfo" >&6; } -if test $ac_cv_func_getaddrinfo = yes; then - -$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h - -fi - - -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - -for ac_header in vfork.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" -if test "x$ac_cv_header_vfork_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VFORK_H 1 -_ACEOF - -fi - -done - -for ac_func in fork vfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 -$as_echo_n "checking for working fork... " >&6; } -if ${ac_cv_func_fork_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_fork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* By Ruediger Kuhlmann. */ - return fork () < 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_fork_works=yes -else - ac_cv_func_fork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 -$as_echo "$ac_cv_func_fork_works" >&6; } - -else - ac_cv_func_fork_works=$ac_cv_func_fork -fi -if test "x$ac_cv_func_fork_works" = xcross; then - case $host in - *-*-amigaos* | *-*-msdosdjgpp*) - # Override, as these systems have only a dummy fork() stub - ac_cv_func_fork_works=no - ;; - *) - ac_cv_func_fork_works=yes - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} -fi -ac_cv_func_vfork_works=$ac_cv_func_vfork -if test "x$ac_cv_func_vfork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 -$as_echo_n "checking for working vfork... " >&6; } -if ${ac_cv_func_vfork_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_vfork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Thanks to Paul Eggert for this test. */ -$ac_includes_default -#include -#ifdef HAVE_VFORK_H -# include -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. The compiler - is told about this with #include , but some compilers - (e.g. gcc -O) don't grok . Test for this by using a - static variable whose address is put into a register that is - clobbered by the vfork. */ -static void -#ifdef __cplusplus -sparc_address_test (int arg) -# else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} - -int -main () -{ - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (0); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. This - test uses lots of local variables, at least as many local - variables as main has allocated so far including compiler - temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris - 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should - reuse the register of parent for one of the local variables, - since it will think that parent can't possibly be used any more - in this routine. Assigning to the local variable will thus - munge parent in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent - from child file descriptors. If the child closes a descriptor - before it execs or exits, this munges the parent's descriptor - as well. Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - return ( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_vfork_works=yes -else - ac_cv_func_vfork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 -$as_echo "$ac_cv_func_vfork_works" >&6; } - -fi; -if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=$ac_cv_func_vfork - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} -fi - -if test "x$ac_cv_func_vfork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h - -else - -$as_echo "#define vfork fork" >>confdefs.h - -fi -if test "x$ac_cv_func_fork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h - -fi - -for ac_func in isblank srandom random sleep -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -ac_fn_c_check_decl "$LINENO" "in6addr_any" "ac_cv_have_decl_in6addr_any" "$ac_includes_default -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_UDP_H -#include -#endif -#ifdef HAVE_NETINET_IGMP_H -#include -#endif - -" -if test "x$ac_cv_have_decl_in6addr_any" = xyes; then : - ac_have_decl=1 -else - ac_have_decl=0 -fi - -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_IN6ADDR_ANY $ac_have_decl -_ACEOF - - -# check for ldns - -# Check whether --with-ldns was given. -if test "${with_ldns+set}" = set; then : - withval=$with_ldns; - specialldnsdir="$withval" - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" - LDNSDIR="$withval" - - -fi - - -# check for ldns development source tree -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns devel source" >&5 -$as_echo_n "checking for ldns devel source... " >&6; } -ldns_dev_dir=.. -if test -f $ldns_dev_dir/ldns/util.h && \ - grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then - ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` - { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $ldns_dev_dir with $ldns_version" >&5 -$as_echo "using $ldns_dev_dir with $ldns_version" >&6; } - CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" - LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" - LIBS="$LIBS -lldns" - -$as_echo "#define HAVE_LIBLDNS 1" >>confdefs.h - - LDNSDIR="$ldns_dev_dir" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 -$as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } -if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lldns $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char ldns_rr_new (); -int -main () -{ -return ldns_rr_new (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_ldns_ldns_rr_new=yes -else - ac_cv_lib_ldns_ldns_rr_new=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 -$as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } -if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBLDNS 1 -_ACEOF - - LIBS="-lldns $LIBS" - -else - - as_fn_error $? "Can't find ldns library" "$LINENO" 5 - - -fi - -fi - - - - - - -ac_config_files="$ac_config_files Makefile" - -ac_config_headers="$ac_config_headers config.h" - -cat >confcache <<\_ACEOF -# 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, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# 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. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by ldns $as_me 1.6.9, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -ldns config.status 1.6.9 -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #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. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi - ;; - - - esac - -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - diff --git a/libs/ldns/examples/configure.ac b/libs/ldns/examples/configure.ac deleted file mode 100644 index 2bf89d2dc0..0000000000 --- a/libs/ldns/examples/configure.ac +++ /dev/null @@ -1,421 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.56) -AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns) -AC_CONFIG_SRCDIR([ldns-read-zone.c]) -sinclude(../acx_nlnetlabs.m4) - -OURCPPFLAGS='' -CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} -OURCFLAGS='-g' -CFLAGS=${CFLAGS:-${OURCFLAGS}} -AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) - -AC_AIX -# Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET -AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool]) - -ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) -ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) - -AC_ARG_ENABLE(rpath, - [AC_HELP_STRING([--disable-rpath], [Disable hardcoded rpath (default=enabled)])], - enable_rpath=$enableval, enable_rpath=yes) - -if test "x$enable_rpath" = xyes; then - RPATH_VAL="-Wl,-rpath=\${libdir}" -fi - - -AC_TYPE_SIZE_T -ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) - -ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600, -[ -#include "confdefs.h" -#include -#include -#include -#ifdef HAVE_TIME_H -#include -#endif -#include -#ifdef HAVE_GETOPT_H -#include -#endif - -int test() { - int a; - char **opts = NULL; - struct timeval tv; - char *t; - time_t time = 0; - char *buf = NULL; - t = ctime_r(&time, buf); - tv.tv_usec = 10; - srandom(32); - a = getopt(2, opts, "a"); - a = isascii(32); - return a; -} -], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"]) - - -ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include ], [CFLAGS="$CFLAGS $C99FLAG"]) - -AC_C_INLINE -AC_CHECK_TYPE(int8_t, char) -AC_CHECK_TYPE(int16_t, short) -AC_CHECK_TYPE(int32_t, int) -AC_CHECK_TYPE(int64_t, long long) -AC_CHECK_TYPE(uint8_t, unsigned char) -AC_CHECK_TYPE(uint16_t, unsigned short) -AC_CHECK_TYPE(uint32_t, unsigned int) -AC_CHECK_TYPE(uint64_t, unsigned long long) -AC_CHECK_TYPE(ssize_t, int) - -AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h pcap.h arpa/inet.h sys/time.h sys/socket.h sys/select.h netdb.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) -AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/igmp.h netinet/if_ether.h netinet/ip6.h],,, [ -AC_INCLUDES_DEFAULT -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NET_IF_H -#include -#endif]) - -ACX_TYPE_SOCKLEN_T -AC_CHECK_HEADERS([sys/param.h sys/mount.h],,, -[AC_INCLUDES_DEFAULT] -[ - [ - #if HAVE_SYS_PARAM_H - # include - #endif - ] -]) -AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif]) -AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_NETINET_IN_H -# include -#endif]) - -# check to see if libraries are needed for these functions. -AC_SEARCH_LIBS(socket, socket) -tmp_LIBS="$LIBS" -LIBS= -AC_SEARCH_LIBS(inet_pton, nsl) -AC_SUBST(LIBNSL_LIBS,$LIBS) -LIBS="$tmp_LIBS" - -tmp_CPPFLAGS="$CPPFLAGS" -tmp_LDFLAGS="$LDFLAGS" -tmp_LIBS="$LIBS" - -ACX_WITH_SSL_OPTIONAL - -AC_SUBST(LIBSSL_CPPFLAGS) -AC_SUBST(LIBSSL_LDFLAGS) -AC_SUBST(LIBSSL_LIBS) - -CPPFLAGS="$tmp_CPPFLAGS" -LDFLAGS="$tmp_LDFLAGS" -LIBS="$tmp_LIBS" - -# use libcrypto to check the following: -tmp_LDFLAGS="$LDFLAGS" -tmp_LIBS="$LIBS" -LDFLAGS="$LDFLAGS $LIBSSL_LDFLAGS" -LIBS="$LIBS $LIBSSL_LIBS" -AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) -case "$enable_sha2" in - no) - ;; - *) - AC_MSG_CHECKING(for SHA256 and SHA512) - AC_CHECK_FUNC(SHA256_Init,, [ - AC_MSG_ERROR([SHA2 enabled, but no SHA2 functions found in OpenSSL]) - ]) - AC_DEFINE_UNQUOTED([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) - ;; -esac - -AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) -case "$enable_gost" in - no) - ;; - *) - if test "x$HAVE_SSL" != "xyes"; then - AC_MSG_ERROR([GOST enabled, but no SSL support]) - fi - AC_MSG_CHECKING(for GOST) - AC_CHECK_FUNC(EVP_PKEY_set_type_str, [],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost])]) - AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost])]) - AC_DEFINE_UNQUOTED([USE_GOST], [1], [Define this to enable GOST support.]) - ;; -esac - -AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--enable-ecdsa], [Enable ECDSA support, experimental])) -case "$enable_ecdsa" in - yes) - AC_CHECK_FUNC(ECDSA_sign,,[AC_MSG_ERROR([OpenSSL does not support ECDSA])]) - AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) - AC_WARN([ - ***************************************************************** - *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** - *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** - *****************************************************************]) - ;; - no|*) - ;; -esac - -LDFLAGS="$tmp_LDFLAGS" -LIBS="$tmp_LIBS" - -#AC_CHECK_HEADER(ldns/ldns.h,, [ -# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) -# ], [AC_INCLUDES_DEFAULT] -#) - -AC_CHECK_LIB(pcap, pcap_open_offline,, [ - AC_MSG_WARN([Can't find pcap library (needed for ldns-dpa, will not build dpa now.)]) - ] -) - - -AC_DEFUN([AC_CHECK_GETADDRINFO_WITH_INCLUDES], -[AC_REQUIRE([AC_PROG_CC]) -AC_MSG_CHECKING(for getaddrinfo) -AC_CACHE_VAL(ac_cv_func_getaddrinfo, -[ac_cv_func_getaddrinfo=no -AC_LINK_IFELSE( -[ -#ifdef __cplusplus -extern "C" -{ -#endif -char* getaddrinfo(); -char* (*f) () = getaddrinfo; -#ifdef __cplusplus -} -#endif -int main() { - ; - return 0; -} -], -dnl this case on linux, solaris, bsd -[ac_cv_func_getaddrinfo="yes"], -dnl no quick getaddrinfo, try mingw32 and winsock2 library. -ORIGLIBS="$LIBS" -LIBS="$LIBS -lws2_32" -AC_LINK_IFELSE( -AC_LANG_PROGRAM( -[ -#ifdef HAVE_WS2TCPIP_H -#include -#endif -], -[ - (void)getaddrinfo(NULL, NULL, NULL, NULL); -] -), -[ac_cv_func_getaddrinfo="yes" -LDFLAGS="$LDFLAGS -lws2_32" -], -[ac_cv_func_getaddrinfo="no" -LIBS="$ORIGLIBS" -]) -) -]) - -AC_MSG_RESULT($ac_cv_func_getaddrinfo) -if test $ac_cv_func_getaddrinfo = yes; then - AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) -fi -])dnl - -AC_CHECK_GETADDRINFO_WITH_INCLUDES - -AC_FUNC_FORK -AC_CHECK_FUNCS(isblank srandom random sleep) -AC_CHECK_DECLS([in6addr_any],,,[AC_INCLUDES_DEFAULT -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_TIME_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif -#ifdef HAVE_SYS_SELECT_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_NETINET_UDP_H -#include -#endif -#ifdef HAVE_NETINET_IGMP_H -#include -#endif -]) - -# check for ldns -AC_ARG_WITH(ldns, - AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use]) - , - [ - specialldnsdir="$withval" - CPPFLAGS="$CPPFLAGS -I$withval/include" - LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" - LDNSDIR="$withval" - ] -) - -# check for ldns development source tree -AC_MSG_CHECKING([for ldns devel source]) -ldns_dev_dir=.. -if test -f $ldns_dev_dir/ldns/util.h && \ - grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then - ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` - AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version]) - CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" - LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" - LIBS="$LIBS -lldns" - AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.]) - LDNSDIR="$ldns_dev_dir" -else - AC_MSG_RESULT([no]) - AC_CHECK_LIB(ldns, ldns_rr_new,, [ - AC_MSG_ERROR([Can't find ldns library]) - ] - ) -fi - -AC_SUBST(LDNSDIR) - - -AH_BOTTOM([ - -#include -#include -#include -#include - -#if STDC_HEADERS -#include -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_NETINET_UDP_H -#include -#endif - -#ifdef HAVE_TIME_H -#include -#endif - -#ifdef HAVE_PCAP_H -#include -#endif - -#ifdef HAVE_NETINET_IN_SYSTM_H -#include -#endif - -#ifdef HAVE_NETINET_IP_H -#include -#endif - -#ifdef HAVE_NET_IF_H -#include -#endif - -#ifdef HAVE_NETINET_IF_ETHER_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#define USE_WINSOCK 1 -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - -#ifndef HAVE_GETADDRINFO -#include -#endif - -#ifndef HAVE_RANDOM -/* random can be replaced by rand for ldnsexamples */ -#define random rand -#endif - -#ifndef HAVE_SRANDOM -/* srandom can be replaced by srand for ldnsexamples */ -#define srandom srand -#endif - -extern char *optarg; -extern int optind, opterr; - -#ifndef EXIT_FAILURE -#define EXIT_FAILURE 1 -#endif -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#endif - -#ifdef S_SPLINT_S -#define FD_ZERO(a) /* a */ -#define FD_SET(a,b) /* a, b */ -#endif -]) - -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_HEADER([config.h]) -AC_OUTPUT diff --git a/libs/ldns/examples/fake-rfc2553.h b/libs/ldns/examples/fake-rfc2553.h deleted file mode 100644 index 1e9add1eb0..0000000000 --- a/libs/ldns/examples/fake-rfc2553.h +++ /dev/null @@ -1,175 +0,0 @@ -/* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */ -/* - * Copyright (C) 2000-2003 Damien Miller. All rights reserved. - * Copyright (C) 1999 WIDE Project. 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. Neither the name of the project 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 PROJECT 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 PROJECT 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. - */ - -/* - * Pseudo-implementation of RFC2553 name / address resolution functions - * - * But these functions are not implemented correctly. The minimum subset - * is implemented for ssh use only. For example, this routine assumes - * that ai_family is AF_INET. Don't use it for another purpose. - */ - -#ifndef _FAKE_RFC2553_H -#define _FAKE_RFC2553_H - -#include -#include -#include -#include - -/* - * First, socket and INET6 related definitions - */ -#ifndef HAVE_STRUCT_SOCKADDR_STORAGE -#ifndef _SS_MAXSIZE -# define _SS_MAXSIZE 128 /* Implementation specific max size */ -# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) -struct sockaddr_storage { - struct sockaddr ss_sa; - char __ss_pad2[_SS_PADSIZE]; -}; -# define ss_family ss_sa.sa_family -#endif /* _SS_MAXSIZE */ -#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ - -#ifndef IN6_IS_ADDR_LOOPBACK -# define IN6_IS_ADDR_LOOPBACK(a) \ - (((uint32_t *)(a))[0] == 0 && ((uint32_t *)(a))[1] == 0 && \ - ((uint32_t *)(a))[2] == 0 && ((uint32_t *)(a))[3] == htonl(1)) -#endif /* !IN6_IS_ADDR_LOOPBACK */ - -#ifndef HAVE_STRUCT_IN6_ADDR -struct in6_addr { - uint8_t s6_addr[16]; -}; -#endif /* !HAVE_STRUCT_IN6_ADDR */ - -#ifndef HAVE_STRUCT_SOCKADDR_IN6 -struct sockaddr_in6 { - unsigned short sin6_family; - uint16_t sin6_port; - uint32_t sin6_flowinfo; - struct in6_addr sin6_addr; -}; -#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ - -#ifndef AF_INET6 -/* Define it to something that should never appear */ -#define AF_INET6 AF_MAX -#endif - -/* - * Next, RFC2553 name / address resolution API - */ - -#ifndef NI_NUMERICHOST -# define NI_NUMERICHOST (1) -#endif -#ifndef NI_NAMEREQD -# define NI_NAMEREQD (1<<1) -#endif -#ifndef NI_NUMERICSERV -# define NI_NUMERICSERV (1<<2) -#endif - -#ifndef AI_PASSIVE -# define AI_PASSIVE (1) -#endif -#ifndef AI_CANONNAME -# define AI_CANONNAME (1<<1) -#endif -#ifndef AI_NUMERICHOST -# define AI_NUMERICHOST (1<<2) -#endif - -#ifndef NI_MAXSERV -# define NI_MAXSERV 32 -#endif /* !NI_MAXSERV */ -#ifndef NI_MAXHOST -# define NI_MAXHOST 1025 -#endif /* !NI_MAXHOST */ - -#ifndef INT_MAX -#define INT_MAX 0xffffffff -#endif - -#ifndef EAI_NODATA -# define EAI_NODATA (INT_MAX - 1) -#endif -#ifndef EAI_MEMORY -# define EAI_MEMORY (INT_MAX - 2) -#endif -#ifndef EAI_NONAME -# define EAI_NONAME (INT_MAX - 3) -#endif -#ifndef EAI_SYSTEM -# define EAI_SYSTEM (INT_MAX - 4) -#endif - -#ifndef HAVE_STRUCT_ADDRINFO -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; -#endif /* !HAVE_STRUCT_ADDRINFO */ - -#ifndef HAVE_GETADDRINFO -#ifdef getaddrinfo -# undef getaddrinfo -#endif -#define getaddrinfo(a,b,c,d) (ssh_getaddrinfo(a,b,c,d)) -int getaddrinfo(const char *, const char *, - const struct addrinfo *, struct addrinfo **); -#endif /* !HAVE_GETADDRINFO */ - -#if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO) -#define gai_strerror(a) (ssh_gai_strerror(a)) -char *gai_strerror(int); -#endif /* !HAVE_GAI_STRERROR */ - -#ifndef HAVE_FREEADDRINFO -#define freeaddrinfo(a) (ssh_freeaddrinfo(a)) -void freeaddrinfo(struct addrinfo *); -#endif /* !HAVE_FREEADDRINFO */ - -#ifndef HAVE_GETNAMEINFO -#define getnameinfo(a,b,c,d,e,f,g) (ssh_getnameinfo(a,b,c,d,e,f,g)) -int getnameinfo(const struct sockaddr *, size_t, char *, size_t, - char *, size_t, int); -#endif /* !HAVE_GETNAMEINFO */ - -#endif /* !_FAKE_RFC2553_H */ - diff --git a/libs/ldns/examples/ldns-chaos.1 b/libs/ldns/examples/ldns-chaos.1 deleted file mode 100644 index e9b7bf46dc..0000000000 --- a/libs/ldns/examples/ldns-chaos.1 +++ /dev/null @@ -1,26 +0,0 @@ -.TH ldns-chaos 1 "27 Apr 2005" -.SH NAME -ldns-chaos \- give some information about a nameserver -.SH SYNOPSIS -.B ldns-chaos -.IR NAMESERVER - -.SH DESCRIPTION -\fBldns-chaos\fR retrieves all the addresses of the nameserver and then queries -each address for its \fIversion.bind\fR and \fIhostname.bind\fR. -.PP -\fBldns-chaos\fR is a bit more complex than \fBldns-mx\fR. - -.SH OPTIONS -\fBldns-chaos\fR has no options. - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-chaos.c b/libs/ldns/examples/ldns-chaos.c deleted file mode 100644 index a1e1b796bf..0000000000 --- a/libs/ldns/examples/ldns-chaos.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * chaos is a small programs that prints some information - * about a nameserver - * - * (c) NLnet Labs, 2005 - 2008 - * - * See the file LICENSE for the license - */ - -#include "config.h" - -#include - -static int -usage(FILE *fp, char *prog) { - fprintf(fp, "%s server\n", prog); - fprintf(fp, " print out some information about server\n"); - return 0; -} - -int -main(int argc, char *argv[]) -{ - ldns_resolver *res; - ldns_rdf *name; - ldns_rdf *version, *id; - ldns_pkt *p; - ldns_rr_list *addr; - ldns_rr_list *info; - ldns_status s; - ldns_rdf *pop; - size_t i; - - if (argc != 2) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } else { - /* create a rdf from the command line arg */ - name = ldns_dname_new_frm_str(argv[1]); - if (!name) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } - } - - /* create rdf for what we are going to ask */ - version = ldns_dname_new_frm_str("version.bind"); - id = ldns_dname_new_frm_str("hostname.bind"); - - /* create a new resolver from /etc/resolv.conf */ - s = ldns_resolver_new_frm_file(&res, NULL); - if (s != LDNS_STATUS_OK) { - ldns_rdf_deep_free(name); - exit(EXIT_FAILURE); - } - ldns_resolver_set_retry(res, 1); /* don't want to wait too long */ - - /* use the resolver to send it a query for the a/aaaa of name */ - addr = ldns_get_rr_list_addr_by_name(res, name, LDNS_RR_CLASS_IN, LDNS_RD); - if (!addr) { - fprintf(stderr, " *** could not get an address for %s\n", argv[1]); - ldns_rdf_deep_free(name); - ldns_resolver_deep_free(res); - exit(EXIT_FAILURE); - } - - /* remove current list of nameservers from resolver */ - while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } - - - /* can be multihomed */ - for(i = 0; i < ldns_rr_list_rr_count(addr); i++) { - if (i > 0) { - fprintf(stdout, "\n"); - } - - if (ldns_resolver_push_nameserver_rr(res, - ldns_rr_list_rr(addr, i)) != LDNS_STATUS_OK) { - printf("Error adding nameserver to resolver\n"); - } - - ldns_rr_print(stdout, ldns_rr_list_rr(addr, i)); - fprintf(stdout, "\n"); - - p = ldns_resolver_query(res, version, LDNS_RR_TYPE_TXT, - LDNS_RR_CLASS_CH, LDNS_RD); - if (p) { - ldns_pkt_print(stdout, p); - info = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_TXT, LDNS_SECTION_ANSWER); - - if (info) { - ldns_rr_list_print(stdout, info); - ldns_rr_list_deep_free(info); - } else { - printf(" *** version retrieval failed\n"); - } - ldns_pkt_free(p); - } else { - printf(" *** query failed\n"); - } - - p = ldns_resolver_query(res, id, LDNS_RR_TYPE_TXT, - LDNS_RR_CLASS_CH, LDNS_RD); - if (p) { - info = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_TXT, LDNS_SECTION_ANSWER); - if (info) { - ldns_rr_list_print(stdout, info); - ldns_rr_list_deep_free(info); - } else { - printf(" *** id retrieval failed\n"); - } - ldns_pkt_free(p); - } else { - printf(" *** query failed for\n"); - } - ldns_rdf_deep_free(ldns_resolver_pop_nameserver(res)); - - } - - ldns_rdf_deep_free(name); - ldns_resolver_deep_free(res); - exit(EXIT_SUCCESS); -} diff --git a/libs/ldns/examples/ldns-compare-zones.1 b/libs/ldns/examples/ldns-compare-zones.1 deleted file mode 100644 index facccd8745..0000000000 --- a/libs/ldns/examples/ldns-compare-zones.1 +++ /dev/null @@ -1,57 +0,0 @@ -.TH ldns-compare-zones 1 "17 Oct 2007" -.SH NAME -ldns-compare-zones \- read and compare two zonefiles and print differences -.SH SYNOPSIS -.B ldns-compare-zones -.IR [-c] -.IR [-i] -.IR [-d] -.IR [-z] -.IR [-s] -.IR ZONEFILE1 -.IR ZONEFILE2 -.SH DESCRIPTION -\fBldns-compare-zones\fR reads two DNS zone files and prints number of differences. -.nf -Output is formated to: - +NUM_INS -NUM_DEL ~NUM_CHG - -.fi -The major comparison is based on the owner name. If an owner name is present in zonefile 1, but not in zonefile 2, the resource records with this owner name are considered deleted, and counted as NUM_DEL. If an owner name is present in zonefile 2, but not in zonefile 1, the resource records with this owner name are considered inserted, and counted as NUM_INS. If an owner name is present in both, but there is a difference in the amount or content of the records, these are considered changed, and counted as NUM_CHG. -.SH OPTIONS -.TP -\fB-c\fR -Print resource records whose owner names are in both zone files, but with different resource records. (a.k.a. changed) -.TP -\fB-i\fR -Print resource records whose owner names are present only in ZONEFILE2 (a.k.a. inserted) -.TP -\fB-d\fR -Print resource records whose owner names are present only in ZONEFILE1 (a.k.a. deleted) -.TP -\fB-a\fR -Print all changes. Specifying this option is the same as specifying -c -i -amd -d. -.TP -\fB-z\fR -Suppress zone sorting; this option is not recommended; it can cause records -to be incorrectly marked as changed, depending of the nature of the changes. -.TP -\fB-s\fR -Do not exclude the SOA record from the comparison. The SOA record may -then show up as changed due to a new serial number. Off by default since -you may be interested to know if (other zone apex elements) have changed. -.TP -\fB-h\fR -Show usage and exit -.TP -\fB-v\fR -Show the version and exit -.SH AUTHOR -Written by Ondřej Surý for CZ.NIC, z.s.p.o. (czech domain registry) -.SH REPORTING BUGS -Report bugs to . -.SH COPYRIGHT -Copyright (C) 2005 CZ.NIC, z.s.p.o.. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-compare-zones.c b/libs/ldns/examples/ldns-compare-zones.c deleted file mode 100644 index 56d36a286c..0000000000 --- a/libs/ldns/examples/ldns-compare-zones.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * ldns-compare-zones compares two zone files - * - * Written by Ondrej Sury in 2007 - * - * Modified a bit by NLnet Labs. - * - * See the file LICENSE for the license - */ - -#include "config.h" -#include -#include -#include -#include - -#include - -#include - -#define OP_INS '+' -#define OP_DEL '-' -#define OP_CHG '~' - -static void -usage(int argc, char **argv) -{ - printf("Usage: %s [-v] [-i] [-d] [-c] [-s] \n", - argv[0]); - printf(" -i - print inserted\n"); - printf(" -d - print deleted\n"); - printf(" -c - print changed\n"); - printf(" -a - print all differences (-i -d -c)\n"); - printf(" -s - do not exclude SOA record from comparison\n"); - printf(" -z - do not sort zones\n"); -} - -int -main(int argc, char **argv) -{ - char *fn1, *fn2; - FILE *fp1, *fp2; - ldns_zone *z1, *z2; - ldns_status s; - size_t i , j; - ldns_rr_list *rrl1, *rrl2; - int rr_cmp, rr_chg = 0; - ldns_rr *rr1 = NULL, *rr2 = NULL, *rrx = NULL; - int line_nr1 = 0, line_nr2 = 0; - size_t rrc1 , rrc2; - size_t num_ins = 0, num_del = 0, num_chg = 0; - int c; - bool opt_deleted = false, opt_inserted = false, opt_changed = false; - bool sort = true, inc_soa = false; - char op = 0; - - while ((c = getopt(argc, argv, "ahvdicsz")) != -1) { - switch (c) { - case 'h': - usage(argc, argv); - exit(EXIT_SUCCESS); - break; - case 'v': - printf("%s version %s (ldns version %s)\n", - argv[0], - LDNS_VERSION, - ldns_version()); - exit(EXIT_SUCCESS); - break; - case 's': - inc_soa = true; - break; - case 'z': - sort = false; - break; - case 'd': - opt_deleted = true; - break; - case 'i': - opt_inserted = true; - break; - case 'c': - opt_changed = true; - break; - case 'a': - opt_deleted = true; - opt_inserted = true; - opt_changed = true; - break; - } - } - - argc -= optind; - argv += optind; - - if (argc != 2) { - argc -= optind; - argv -= optind; - usage(argc, argv); - exit(EXIT_FAILURE); - } - fn1 = argv[0]; - fp1 = fopen(fn1, "r"); - if (!fp1) { - fprintf(stderr, "Unable to open %s: %s\n", fn1, strerror(errno)); - exit(EXIT_FAILURE); - } - /* Read first zone */ - s = ldns_zone_new_frm_fp_l(&z1, fp1, NULL, 0, - LDNS_RR_CLASS_IN, &line_nr1); - if (s != LDNS_STATUS_OK) { - fclose(fp1); - fprintf(stderr, "%s: %s at %d\n", - fn1, - ldns_get_errorstr_by_id(s), - line_nr1); - exit(EXIT_FAILURE); - } - fclose(fp1); - - fn2 = argv[1]; - fp2 = fopen(fn2, "r"); - if (!fp2) { - fprintf(stderr, "Unable to open %s: %s\n", fn2, strerror(errno)); - exit(EXIT_FAILURE); - } - /* Read second zone */ - s = ldns_zone_new_frm_fp_l(&z2, fp2, NULL, 0, - LDNS_RR_CLASS_IN, &line_nr2); - if (s != LDNS_STATUS_OK) { - ldns_zone_deep_free(z1); - fclose(fp2); - fprintf(stderr, "%s: %s at %d\n", - fn2, - ldns_get_errorstr_by_id(s), - line_nr2); - exit(EXIT_FAILURE); - } - fclose(fp2); - - rrl1 = ldns_zone_rrs(z1); - rrc1 = ldns_rr_list_rr_count(rrl1); - - rrl2 = ldns_zone_rrs(z2); - rrc2 = ldns_rr_list_rr_count(rrl2); - - if (sort) { - /* canonicalize zone 1 */ - ldns_rr2canonical(ldns_zone_soa(z1)); - for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z1)); i++) { - ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z1), i)); - } - /* sort zone 1 */ - ldns_zone_sort(z1); - /* canonicalize zone 2 */ - ldns_rr2canonical(ldns_zone_soa(z2)); - for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z2)); i++) { - ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z2), i)); - } - /* sort zone 2 */ - ldns_zone_sort(z2); - } - - if(inc_soa) { - ldns_rr_list* wsoa = ldns_rr_list_new(); - ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z1)); - ldns_rr_list_cat(wsoa, rrl1); - rrl1 = wsoa; - rrc1 = ldns_rr_list_rr_count(rrl1); - wsoa = ldns_rr_list_new(); - ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z2)); - ldns_rr_list_cat(wsoa, rrl2); - rrl2 = wsoa; - rrc2 = ldns_rr_list_rr_count(rrl2); - if(sort) { - ldns_rr_list_sort(rrl1); - ldns_rr_list_sort(rrl2); - } - } - - /* - * Walk through both zones. The previously seen resource record is - * kept (in the variable rrx) so that we can recognize when we are - * handling a new owner name. If the owner name changes, we have to - * set the operator again. - */ - for (i = 0, j = 0; i < rrc1 || j < rrc2;) { - rr_cmp = 0; - if (i < rrc1 && j < rrc2) { - rr1 = ldns_rr_list_rr(rrl1, i); - rr2 = ldns_rr_list_rr(rrl2, j); - rr_cmp = ldns_rr_compare(rr1, rr2); - - /* Completely skip if the rrs are equal */ - if (rr_cmp == 0) { - i++; - j++; - continue; - } - rr_chg = ldns_dname_compare(ldns_rr_owner(rr1), - ldns_rr_owner(rr2)); - } else if (i >= rrc1) { - /* we have reached the end of zone 1, so the current record - * from zone 2 automatically sorts higher - */ - rr1 = NULL; - rr2 = ldns_rr_list_rr(rrl2, j); - rr_chg = rr_cmp = 1; - } else if (j >= rrc2) { - /* we have reached the end of zone 2, so the current record - * from zone 1 automatically sorts lower - */ - rr1 = ldns_rr_list_rr(rrl1, i); - rr2 = NULL; - rr_chg = rr_cmp = -1; - } - if (rr_cmp < 0) { - i++; - if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr1), - ldns_rr_owner(rrx) - ) != 0)) { - /* The owner name is different, forget previous rr */ - rrx = NULL; - } - if (rrx == NULL) { - if (rr_chg == 0) { - num_chg++; - op = OP_CHG; - } else { - num_del++; - op = OP_DEL; - } - rrx = rr1; - } - if (((op == OP_DEL) && opt_deleted) || - ((op == OP_CHG) && opt_changed)) { - printf("%c-", op); - ldns_rr_print(stdout, rr1); - } - } else if (rr_cmp > 0) { - j++; - if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr2), - ldns_rr_owner(rrx) - ) != 0)) { - rrx = NULL; - } - if (rrx == NULL) { - if (rr_chg == 0) { - num_chg++; - op = OP_CHG; - } else { - num_ins++; - op = OP_INS; - } - /* remember this rr for it's name in the next iteration */ - rrx = rr2; - } - if (((op == OP_INS) && opt_inserted) || - ((op == OP_CHG) && opt_changed)) { - printf("%c+", op); - ldns_rr_print(stdout, rr2); - } - } - } - - printf("\t%c%u\t%c%u\t%c%u\n", - OP_INS, - (unsigned int) num_ins, - OP_DEL, - (unsigned int) num_del, - OP_CHG, - (unsigned int) num_chg); - - /* Free resources */ - if(inc_soa) { - ldns_rr_list_free(rrl1); - ldns_rr_list_free(rrl2); - } - ldns_zone_deep_free(z2); - ldns_zone_deep_free(z1); - - return 0; -} diff --git a/libs/ldns/examples/ldns-dpa.1 b/libs/ldns/examples/ldns-dpa.1 deleted file mode 100644 index 0b433df661..0000000000 --- a/libs/ldns/examples/ldns-dpa.1 +++ /dev/null @@ -1,151 +0,0 @@ -.TH dpa 1 "1 Nov 2005" -.SH NAME -dpa \- DNS Packet Analyzer. Analyze DNS packets in ip trace files -.SH SYNOPSIS -.B dpa -[ -.IR OPTION -] -.IR TRACEFILE - -.SH DESCRIPTION -\fBdpa\fR is used to analyze dns packets in trace files. It has 3 main options: count, filter, and count uniques (i.e. count all different occurences). - -.SH OPTIONS -.TP -\fB-c\fR \fIexpressionlist\fR -Count occurrences of matching expressions - -.TP -\fB-f\fR \fIexpression\fR -Filter: only process packets that match the expression - -.TP -\fB-h\fR -Show usage - -.TP -\fB-p\fR -Show the total number of correct DNS packets, and percentage of -u and --c values (of the total of matching on the -f filter. if no filter is -given, percentages are on all correct dns packets) - -.TP -\fB-of\fR \fIfile\fR -Write all packets that match the -f flag to file, as pcap data. - -.TP -\fB-ofh\fR \fIfile\fR -Write all packets that match the -f flag to file, in hexadecimal format, -readable by drill. - -.TP -\fB-s\fR -Show possible match names - -.TP -\fB-s\fR \fImatchname\fR -show possible match operators and values for name - -.TP -\fB-sf\fR -Only evaluate packets (in representation format) that match the -f filter. -If no -f was given, evaluate all correct dns packets. - -.TP -\fB-u\fR \fImatchnamelist\fR -Count every occurence of every value of the matchname (for instance, count all packetsizes, see EXAMPLES in ldns-dpa(1) ). - -.TP -\fB-ua\fR -For every matchname in -u, show the average value of all matches. Behaviour for match types that do not have an integer value is undefined. - -.TP -\fB-uac\fR -For every matchname in -u, show the average number of times this value was encountered. - -.TP -\fB-um\fR \fInumber\fR -Only show the results from -u for values that occurred more than times. - -.TP -\fB-v\fR \fIlevel\fR -Set verbosity to level (1-5, 5 being the highest). Mostly used for debugging. - -.TP -\fB-notip\fR \fIfile\fR -Write packets that were not recognized as IP packets to file (as pcap data). - -.TP -\fB-baddns\fR \fIfile\fR -Write dns packets that were too mangled to parse to file (as pcap data). - -.TP -\fB-version\fR -Show version and exit - -.SH LIST AND MATCHES - -A is a comma separated list of match names (use -s to see possible match names). -A is a comma separated list of expressions. - -An expression has the following form: -: () - | - & - - -: - -: - = equal to - != not equal to - > greater than - < lesser than - >= greater than or equal to - <= lesser than or equal to - ~= contains - -See the -s option for possible matchnames, operators and values. - -.SH EXAMPLES - -.TP -ldns-dpa -u packetsize -p test.tr -Count all different packetsizes in test.tr and show the precentages. - -.TP -ldns-dpa -f "edns=1&qr=0" -of edns.tr test.tr -Filter out all edns enable queries in test.tr and put them in edns.tr - -.TP -ldns-dpa -f edns=1 -c tc=1 -u rcode test.tr -For all edns packets, count the number of truncated packets and all their rcodes in test.tr. - -.TP -ldns-dpa -c tc=1,qr=0,qr=1,opcode=QUERY test.tr -For all packets, count the number of truncated packets, the number of packets with qr=0, the number of packets with qr=1 and the number of queries in test.tr. - -.TP -ldns-dpa -u packetsize -ua test.tr -Show all packet sizes and the average packet size per packet. - -.TP -ldns-dpa -u srcaddress -uac test.tr -Show all packet source addresses and the average number of packets sent from this address. - -.TP -sudo tcpdump -i eth0 -s 0 -U -w - port 53 | ldns-dpa -f qr=0 -sf -Print all query packets seen on the specified interface. - - -.SH AUTHOR -Written by Jelte Jansen for NLnetLabs. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-dpa.c b/libs/ldns/examples/ldns-dpa.c deleted file mode 100644 index 8d18dd6938..0000000000 --- a/libs/ldns/examples/ldns-dpa.c +++ /dev/null @@ -1,2837 +0,0 @@ -/* - * ldns-dpa inspects the (udp) DNS packets found in a pcap file - * and provides statistics about them - * - * (C) NLnet Labs 2006 - 2008 - * - * See the file LICENSE for the license - */ -#include "config.h" - -#include - -#ifdef HAVE_PCAP_H -#ifdef HAVE_LIBPCAP - -#ifdef HAVE_NETINET_IP6_H -#include -#endif -#include - -#ifndef IP_OFFMASK -#define IP_OFFMASK 0x1fff -#endif - -int verbosity = 1; - -#define ETHER_HEADER_LENGTH 14 -#define UDP_HEADER_LENGTH 8 -#define IP6_HEADER_LENGTH 40 - -/* some systems don't have this? */ -#ifndef ETHERTYPE_IPV6 -#define ETHERTYPE_IPV6 0x86dd -#endif - -#define MAX_MATCHES 20 -#define MAX_OPERATORS 7 - - -/* global options */ -bool show_filter_matches = false; -size_t total_nr_of_dns_packets = 0; -size_t total_nr_of_filtered_packets = 0; -size_t not_ip_packets = 0; -size_t bad_dns_packets = 0; -size_t arp_packets = 0; -size_t udp_packets = 0; -size_t tcp_packets = 0; -size_t fragmented_packets = 0; -size_t lost_packet_fragments = 0; -FILE *hexdumpfile = NULL; -pcap_dumper_t *dumper = NULL; -pcap_dumper_t *not_ip_dump = NULL; -pcap_dumper_t *bad_dns_dump = NULL; - - -struct -fragment_part { - uint16_t ip_id; - uint8_t data[65536]; - size_t cur_len; -}; - -struct fragment_part *fragment_p; - -/* To add a match, - * - add it to the enum - * - add it to the table_matches const - * - add a handler to value_matches - * - tell in get_string_value() where in the packet the data lies - * - add to parser? - * - add to show_match_ function - */ -enum enum_match_ids { - MATCH_ID, - MATCH_OPCODE, - MATCH_RCODE, - MATCH_PACKETSIZE, - MATCH_QR, - MATCH_TC, - MATCH_AD, - MATCH_CD, - MATCH_RD, - MATCH_EDNS, - MATCH_EDNS_PACKETSIZE, - MATCH_DO, - MATCH_QUESTION_SIZE, - MATCH_ANSWER_SIZE, - MATCH_AUTHORITY_SIZE, - MATCH_ADDITIONAL_SIZE, - MATCH_SRC_ADDRESS, - MATCH_DST_ADDRESS, - MATCH_TIMESTAMP, - MATCH_QUERY, - MATCH_QTYPE, - MATCH_QNAME, - MATCH_ANSWER, - MATCH_AUTHORITY, - MATCH_ADDITIONAL, - MATCH_LAST -}; -typedef enum enum_match_ids match_id; - -enum enum_counter_types { - TYPE_INT, - TYPE_BOOL, - TYPE_OPCODE, - TYPE_RCODE, - TYPE_STRING, - TYPE_TIMESTAMP, - TYPE_ADDRESS, - TYPE_RR, - TYPE_RR_TYPE, - TYPE_LAST -}; -typedef enum enum_counter_types counter_type; - -const ldns_lookup_table lt_types[] = { - {TYPE_INT, "int" }, - {TYPE_BOOL, "bool" }, - {TYPE_OPCODE, "opcode" }, - {TYPE_RCODE, "rcode" }, - {TYPE_STRING, "string" }, - {TYPE_TIMESTAMP, "timestamp" }, - {TYPE_ADDRESS, "address" }, - {TYPE_RR, "rr" }, - { 0, NULL } -}; - -enum enum_type_operators { - OP_EQUAL, - OP_NOTEQUAL, - OP_GREATER, - OP_LESSER, - OP_GREATEREQUAL, - OP_LESSEREQUAL, - OP_CONTAINS, - OP_LAST -}; -typedef enum enum_type_operators type_operator; - -const ldns_lookup_table lt_operators[] = { - { OP_EQUAL, "=" }, - { OP_NOTEQUAL, "!=" }, - { OP_GREATER, ">" }, - { OP_LESSER, "<" }, - { OP_GREATEREQUAL, ">=" }, - { OP_LESSEREQUAL, "<=" }, - { OP_CONTAINS, "~=" }, - { 0, NULL } -}; - -static const char *get_op_str(type_operator op) { - const ldns_lookup_table *lt; - lt = ldns_lookup_by_id((ldns_lookup_table *) lt_operators, op); - if (lt) { - return lt->name; - } else { - fprintf(stderr, "Unknown operator id: %u\n", op); - exit(1); - } -} - -static type_operator -get_op_id(char *op_str) -{ - const ldns_lookup_table *lt; - lt = ldns_lookup_by_name((ldns_lookup_table *) lt_operators, op_str); - if (lt) { - return (type_operator) lt->id; - } else { - fprintf(stderr, "Unknown operator: %s\n", op_str); - exit(1); - } -} - -struct struct_type_operators { - counter_type type; - size_t operator_count; - type_operator operators[10]; -}; -typedef struct struct_type_operators type_operators; - -const type_operators const_type_operators[] = { - { TYPE_INT, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, - { TYPE_BOOL, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, - { TYPE_OPCODE, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, - { TYPE_RCODE, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, - { TYPE_STRING, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, - { TYPE_TIMESTAMP, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, - { TYPE_ADDRESS, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, - { TYPE_RR, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, - { TYPE_RR_TYPE, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, - { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -}; - -const type_operators * -get_type_operators(counter_type type) { - const type_operators *to = const_type_operators; - while (to) { - if (to->type == type) { - return to; - } - to++; - } - return NULL; -} - -struct struct_match_table { - match_id id; - const char *name; - const char *description; - const counter_type type; -}; -typedef struct struct_match_table match_table; - -/* order of entries has been changed after gprof analysis, and reasoning - * about the uses of -u arguments - */ -const match_table matches[] = { - { MATCH_QUERY, "query", "String representation of the query RR", TYPE_RR }, - { MATCH_QTYPE, "qtype", "RR Type of the question RR, if present", TYPE_RR_TYPE }, - { MATCH_QNAME, "qname", "Owner name of the question RR, if present", TYPE_STRING }, - { MATCH_SRC_ADDRESS, "srcaddress", "address the packet was sent from", TYPE_ADDRESS }, - { MATCH_TIMESTAMP, "timestamp", "time the packet was sent", TYPE_TIMESTAMP }, - { MATCH_DST_ADDRESS, "dstaddress", "address the packet was sent to", TYPE_ADDRESS }, - { MATCH_EDNS_PACKETSIZE, "edns-packetsize", "packets size specified in edns rr", TYPE_INT }, - { MATCH_ID, "id", "id of the packet", TYPE_INT }, - { MATCH_OPCODE, "opcode", "opcode of packet (rfc1035)", TYPE_OPCODE }, - { MATCH_RCODE, "rcode", "response code of packet", TYPE_RCODE }, - { MATCH_PACKETSIZE, "packetsize", "size of packet in bytes", TYPE_INT }, - { MATCH_QR, "qr", "value of qr bit", TYPE_BOOL }, - { MATCH_TC, "tc", "value of tc bit", TYPE_BOOL }, - { MATCH_AD, "ad", "value of ad bit", TYPE_BOOL }, - { MATCH_CD, "cd", "value of cd bit", TYPE_BOOL }, - { MATCH_RD, "rd", "value of rd bit", TYPE_BOOL }, - { MATCH_EDNS, "edns", "existence of edns rr", TYPE_BOOL }, - { MATCH_DO, "do", "value of do bit", TYPE_BOOL }, - { MATCH_QUESTION_SIZE, "questionsize", "number of rrs in the question section", TYPE_INT }, - { MATCH_ANSWER_SIZE, "answersize", "number of rrs in the answer section", TYPE_INT }, - { MATCH_AUTHORITY_SIZE, "authoritysize", "number of rrs in the authority section", TYPE_INT }, - { MATCH_ADDITIONAL_SIZE, "additionalsize", "number of rrs in the additional section", TYPE_INT }, - { MATCH_ANSWER, "answer", "String representation of the answer RRs", TYPE_RR }, - { MATCH_AUTHORITY, "authority", "String representation of the authority RRs", TYPE_RR }, - { MATCH_ADDITIONAL, "additional", "String representation of the additional RRs", TYPE_RR }, - { 0, NULL , NULL, TYPE_INT} -}; - -enum enum_match_expression_operators { - MATCH_EXPR_OR, - MATCH_EXPR_AND, - MATCH_EXPR_LEAF -}; -typedef enum enum_match_expression_operators match_expression_operator; - -struct struct_match_operation { - match_id id; - type_operator operator; - char *value; -}; -typedef struct struct_match_operation match_operation; - -typedef struct struct_match_expression match_expression; -struct struct_match_expression { - /* and or or, or leaf (in which case there are no subtrees, but only a match_table */ - match_expression_operator op; - match_expression *left; - match_expression *right; - match_operation *match; - size_t count; -}; - -typedef struct struct_match_counters match_counters; -struct struct_match_counters { -/* - match_expression **counter; - size_t size; -*/ - match_expression *match; - match_counters *left; - match_counters *right; -}; - -match_table * -get_match_by_name(char *name) { - match_table *mt = (match_table *) matches; - if (name) { - while (mt->name != NULL) { - if (strcasecmp(name, mt->name) == 0) { - return mt; - } - mt++; - } - } - return NULL; -} - -static match_table * -get_match_by_id(match_id id) { - match_table *mt = (match_table *) matches; - - while (mt->name != NULL) { - if (mt->id == id) { - return mt; - } - mt++; - } - return NULL; -} - -static const char * -get_match_name_str(match_id id) { - match_table *mt = get_match_by_id(id); - if (mt) { - return mt->name; - } else { - fprintf(stderr, "Unknown match id: %u\n", id); - exit(1); - return "Unknown match id"; - } -} - -static void -print_match_operation(FILE *output, match_operation *mc) -{ - match_table *mt = NULL; - ldns_lookup_table *lt; - struct timeval time; - time_t time_tt; - int value; - size_t pos; - char *tmp, *tmp2; - - if (mc) { - mt = get_match_by_id(mc->id); - - if (mt) { - fprintf(output, "%s %s ",mt->name, get_op_str(mc->operator)); - - switch (mt->type) { - case TYPE_INT: - case TYPE_STRING: - case TYPE_ADDRESS: - case TYPE_RR: - fprintf(output, "'%s'", mc->value); - break; - case TYPE_BOOL: - if (strncmp(mc->value, "1", 2) == 0) { - fprintf(output,"'true'"); - } else { - fprintf(output,"'false'"); - } - break; - case TYPE_OPCODE: - value = atoi(mc->value); - lt = ldns_lookup_by_id(ldns_opcodes, value); - if (lt) { - fprintf(output, "%s", lt->name); - } else { - fprintf(output, "%s", mc->value); - } - break; - case TYPE_RCODE: - value = atoi(mc->value); - lt = ldns_lookup_by_id(ldns_rcodes, value); - if (lt) { - fprintf(output, "%s", lt->name); - } else { - fprintf(output, "%s", mc->value); - } - break; - case TYPE_TIMESTAMP: -#ifndef S_SPLINT_S - time.tv_sec = (long int) atol(mc->value); -#endif - time_tt = (time_t)time.tv_sec; - tmp = ctime(&time_tt); - tmp2 = malloc(strlen(tmp) + 1); - for (pos = 0; pos < strlen(tmp); pos++) { - if (tmp[pos] == '\n') { - tmp2[pos] = '\0'; - } else { - tmp2[pos] = tmp[pos]; - } - } - tmp2[pos] = '\0'; - fprintf(output, "%s", tmp2); - free(tmp2); - break; - default: - fprintf(output, "'%s'", mc->value); - } - - } else { - fprintf(output, "%u %s '%s'", mc->id, get_op_str(mc->operator), mc->value); - } - } else { - fprintf(output, "(nil)"); - } -} - -static void -print_match_expression(FILE *output, match_expression *expr) -{ - if (expr) { - switch (expr->op) { - case MATCH_EXPR_OR: - fprintf(output, "("); - print_match_expression(output, expr->left); - fprintf(output, " | "); - print_match_expression(output, expr->right); - fprintf(output, ")"); - break; - case MATCH_EXPR_AND: - fprintf(output, "("); - print_match_expression(output, expr->left); - fprintf(output, " & "); - print_match_expression(output, expr->right); - fprintf(output, ")"); - break; - case MATCH_EXPR_LEAF: - print_match_operation(output, expr->match); - break; - default: -/* - fprintf(output, "ERROR PRINTING MATCH: unknown op: %u\n", expr->op); - exit(1); -*/ - fprintf(output, "("); -if (expr->left) { - print_match_expression(output, expr->left); -} - fprintf(output, " ? "); -if (expr->right) { - print_match_expression(output, expr->right); -} - fprintf(output, ") _"); -if (expr->match) { - print_match_operation(output, expr->match); -} -fprintf(output, "_"); - } - } else { - printf("(nil)"); - } -} - -static void -print_counters(FILE *output, match_counters *counters, bool show_percentages, size_t total, int count_minimum) -{ - double percentage; - - if (!counters || !output) { - return; - } - - if (counters->left) { - print_counters(output, counters->left, show_percentages, total, count_minimum); - } - if (counters->match) { - if (count_minimum < (int) counters->match->count) { - print_match_expression(output, counters->match); - printf(": %u", (unsigned int) counters->match->count); - if (show_percentages) { - percentage = (double) counters->match->count / (double) total * 100.0; - printf(" (%.2f%%)", percentage); - } - printf("\n"); - } - } - if (counters->right) { - print_counters(output, counters->right, show_percentages, total, count_minimum); - } - - return; -} - -static void -ldns_pkt2file_hex(FILE *fp, const ldns_pkt *pkt) -{ - uint8_t *wire; - size_t size, i; - ldns_status status; - - status = ldns_pkt2wire(&wire, pkt, &size); - - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Unable to convert packet: error code %u", status); - return; - } - - fprintf(fp, "; 0"); - for (i = 1; i < 20; i++) { - fprintf(fp, " %2u", (unsigned int) i); - } - fprintf(fp, "\n"); - fprintf(fp, ";--"); - for (i = 1; i < 20; i++) { - fprintf(fp, " --"); - } - fprintf(fp, "\n"); - for (i = 0; i < size; i++) { - if (i % 20 == 0 && i > 0) { - fprintf(fp, "\t; %4u-%4u\n", (unsigned int) i-19, (unsigned int) i); - } - fprintf(fp, " %02x", (unsigned int)wire[i]); - } - fprintf(fp, "\n\n"); -} - -/* - * Calculate the total for all match operations with the same id as this one - * (if they are 'under' this one in the tree, which should be the case in - * the unique counter tree - */ -static size_t -calculate_total_value(match_counters *counters, match_operation *cur) -{ - size_t result = 0; - - if (!counters) { - return 0; - } - - if (counters->match->match->id == cur->id) { - result = (size_t) atol(counters->match->match->value) * counters->match->count; - } - - if (counters->left) { - result += calculate_total_value(counters->left, cur); - } - if (counters->right) { - result += calculate_total_value(counters->right, cur); - } - - return result; -} - -static size_t -calculate_total_count_matches(match_counters *counters, match_operation *cur) -{ - size_t result = 0; - - if (!counters) { - return 0; - } - - if (counters->match->match->id == cur->id) { - result = 1; - } - - if (counters->left) { - /* In some cases, you don't want the number of actual - counted matches, for instance when calculating the - average number of queries per second. In this case - you want the number of seconds */ - if (cur->id == MATCH_TIMESTAMP) { - result += (size_t) abs((int) (atol(counters->match->match->value) - atol(counters->left->match->match->value))) - 1; - } - result += calculate_total_count_matches(counters->left, cur); - } - if (counters->right) { - if (cur->id == MATCH_TIMESTAMP) { - result += (size_t) abs((int) (atol(counters->right->match->match->value) - atol(counters->match->match->value))) - 1; - } - result += calculate_total_count_matches(counters->right, cur); - } - - return result; -} - -/** - * Returns true if there is a previous match operation with the given type - * in the counters structure - */ -static bool -has_previous_match(match_counters *counters, match_operation *cur) -{ - if (!counters) { - return false; - } - - if (counters->left) { - if (counters->left->match->match->id == cur->id) { - return true; - } else if (has_previous_match(counters->left, cur)) { - return true; - } else if (counters->left->right) { - if (counters->left->right->match->match->id == cur->id) { - return true; - } else if (has_previous_match(counters->left->right, cur)) { - return true; - } - } - } - return false; -} - -/** - * Returns true if there is a later match operation with the given type - * in the counters structure - */ -static bool -has_next_match(match_counters *counters, match_operation *cur) -{ - if (!counters) { - return false; - } - - if (counters->right) { - if (counters->right->match->match->id == cur->id) { - return true; - } else if (has_next_match(counters->right, cur)) { - return true; - } else if (counters->right->left) { - if (counters->right->left->match->match->id == cur->id) { - return true; - } else if (has_next_match(counters->right->left, cur)) { - return true; - } - } - } - return false; -} - -/** - * Returns the first match with the same type at *cur in - * the counter list, or NULL if it is not found - */ -static match_expression * -get_first_match_expression(match_counters *counters, match_operation *cur) -{ - if (!counters) { - return NULL; - } - - if (has_previous_match(counters, cur)) { - return get_first_match_expression(counters->left, cur); - } else if (counters->match->match->id == cur->id) { - return counters->match; - } else if (counters->right) { - return get_first_match_expression(counters->right, cur); - } else { - return NULL; - } -} - -/** - * Returns the second match expression with the same type at *cur in - * the counter list, or NULL if it is not found - */ -static match_expression * -get_second_match_expression(match_counters *counters, match_operation *cur) -{ - if (!counters) { - return NULL; - } - - if (has_previous_match(counters, cur)) { - if (has_previous_match(counters->left, cur)) { - return get_second_match_expression(counters->left, cur); - } else { - return counters->left->match; - } -/* - } else if (counters->match->match->id == cur->id) { - return counters->match->match->value; -*/ } else if (counters->right) { - return get_first_match_expression(counters->right, cur); - } else { - return NULL; - } -} - -/** - * Returns the last match expression with the same type at *cur in - * the counter list, or NULL if it is not found - */ -static match_expression * -get_last_match_expression(match_counters *counters, match_operation *cur) -{ - if (!counters) { - return NULL; - } - - if (has_next_match(counters, cur)) { - return get_last_match_expression(counters->right, cur); - } else if (counters->match->match->id == cur->id) { - return counters->match; - } else if (counters->left) { - return get_last_match_expression(counters->left, cur); - } else { - return NULL; - } -} - -/** - * Returns the last but one match expression with the same type at *cur in - * the counter list, or NULL if it is not found - */ -static match_expression * -get_last_but_one_match_expression(match_counters *counters, match_operation *cur) -{ - if (!counters) { - return NULL; - } - - if (has_next_match(counters, cur)) { - if (has_next_match(counters->right, cur)) { - return get_last_but_one_match_expression(counters->right, cur); - } else { - return counters->match; - } -/* - } else if (counters->match->match->id == cur->id) { - return counters->match->match->value; -*/ } else if (counters->left) { - return get_last_match_expression(counters->right, cur); - } else { - return NULL; - } -} - -static size_t -get_first_count(match_counters *counters, match_operation *cur) -{ - match_expression *o = get_first_match_expression(counters, cur); - if (o) { - return o->count; - } else { - return 0; - } -} - -static size_t -get_last_count(match_counters *counters, match_operation *cur) -{ - match_expression *o = get_last_match_expression(counters, cur); - if (o) { - return o->count; - } else { - return 0; - } -} - - -static size_t -calculate_total_count(match_counters *counters, match_operation *cur) -{ - size_t result = 0; - - if (!counters) { - return 0; - } - - if (counters->match->match->id == cur->id) { - result = counters->match->count; - } - - if (counters->left) { - result += calculate_total_count(counters->left, cur); - } - if (counters->right) { - result += calculate_total_count(counters->right, cur); - } - - return result; -} - -static void -print_counter_averages(FILE *output, match_counters *counters, match_operation *cur) -{ - size_t total_value; - size_t total_count; - match_table *mt; - - if (!counters || !output) { - return; - } - - if (!cur) { - cur = counters->match->match; - mt = get_match_by_id(cur->id); - total_value = calculate_total_value(counters, cur); - total_count = calculate_total_count(counters, cur); - printf("Average for %s: (%u / %u) %.02f\n", mt->name, (unsigned int) total_value, (unsigned int) total_count, (float) total_value / (float) total_count); - if (counters->left) { - print_counter_averages(output, counters->left, cur); - } - if (counters->right) { - print_counter_averages(output, counters->right, cur); - } - } else { - if (counters->left) { - if (counters->left->match->match->id != cur->id) { - print_counter_averages(output, counters->left, NULL); - } - } - if (counters->right) { - if (counters->right->match->match->id != cur->id) { - print_counter_averages(output, counters->right, NULL); - } - } - } - - return; -} - -static void -print_counter_average_count(FILE *output, match_counters *counters, match_operation *cur, bool remove_first_last) -{ - size_t total_matches; - size_t total_count; - match_table *mt; - - if (!counters || !output) { - return; - } - - if (!cur) { - cur = counters->match->match; - mt = get_match_by_id(cur->id); - total_matches = calculate_total_count_matches(counters, cur); - total_count = calculate_total_count(counters, cur); - /* Remove the first and last for instance for timestamp average counts (half seconds drag down the average) */ - if (remove_first_last) { - total_count -= get_first_count(counters, cur); - total_count -= get_last_count(counters, cur); - printf("Removing first count from average: %u\n", (unsigned int) get_first_count(counters,cur)); - printf("Removing last count from average: %u\n", (unsigned int) get_last_count(counters,cur)); - /* in the case where we count the differences between match values too - * (like with timestamps) we need to subtract from the match count too - */ - if (cur->id == MATCH_TIMESTAMP) { - if (get_first_match_expression(counters, cur) && get_second_match_expression(counters, cur)) { - total_matches -= atol(get_second_match_expression(counters, cur)->match->value) - atol(get_first_match_expression(counters, cur)->match->value); - } - if (get_last_match_expression(counters, cur) && get_last_but_one_match_expression(counters, cur)) { - total_matches -= atol(get_last_match_expression(counters, cur)->match->value) - atol(get_last_but_one_match_expression(counters, cur)->match->value); - } - } else { - total_matches -= 2; - } - } - printf("Average count for %s: (%u / %u) %.02f\n", mt->name, (unsigned int) total_count, (unsigned int) total_matches, (float) total_count / (float) total_matches); - if (counters->left) { - print_counter_averages(output, counters->left, cur); - } - if (counters->right) { - print_counter_averages(output, counters->right, cur); - } - } else { - if (counters->left) { - if (counters->left->match->match->id != cur->id) { - print_counter_averages(output, counters->left, NULL); - } - } - if (counters->right) { - if (counters->right->match->match->id != cur->id) { - print_counter_averages(output, counters->right, NULL); - } - } - } - - return; -} - -static bool -match_int(type_operator operator, - char *value, - char *mvalue) -{ - int a, b; - - if (!value || !mvalue) { - return false; - } - - a = atoi(value); - b = atoi(mvalue); - - switch (operator) { - case OP_EQUAL: - return a == b; - break; - case OP_NOTEQUAL: - return a != b; - break; - case OP_GREATER: - return a > b; - break; - case OP_LESSER: - return a < b; - break; - case OP_GREATEREQUAL: - return a >= b; - break; - case OP_LESSEREQUAL: - return a <= b; - break; - default: - fprintf(stderr, "Unknown operator: %u\n", operator); - exit(2); - } -} - -static bool -match_opcode(type_operator operator, - char *value, - char *mvalue) -{ - ldns_pkt_opcode a, b; - int i; - ldns_lookup_table *lt; - - /* try parse name first, then parse as int */ - lt = ldns_lookup_by_name(ldns_opcodes, value); - if (lt) { - a = lt->id; - } else { - i = atoi(value); - if (i >= 0 && !isdigit(value[0]) == 0) { - lt = ldns_lookup_by_id(ldns_opcodes, i); - if (lt) { - a = lt->id; - } else { - fprintf(stderr, "Unknown opcode: %s\n", value); - exit(1); - return false; - } - } else { - fprintf(stderr, "Unknown opcode: %s\n", value); - exit(1); - return false; - } - } - - lt = ldns_lookup_by_name(ldns_opcodes, mvalue); - if (lt) { - b = lt->id; - } else { - i = atoi(mvalue); - if (i >= 0 && !isdigit(mvalue[0]) == 0) { - lt = ldns_lookup_by_id(ldns_opcodes, i); - if (lt) { - b = lt->id; - } else { - fprintf(stderr, "Unknown opcode: %s\n", mvalue); - exit(1); - return false; - } - } else { - fprintf(stderr, "Unknown opcode: %s\n", mvalue); - exit(1); - return false; - } - } - - switch(operator) { - case OP_EQUAL: - return a == b; - break; - case OP_NOTEQUAL: - return a != b; - break; - default: - fprintf(stderr, "Error bad operator for opcode: %s\n", get_op_str(operator)); - return false; - break; - } -} - -static bool -match_str(type_operator operator, - char *value, - char *mvalue) -{ - char *valuedup, *mvaluedup; - size_t i; - bool result; - - if (operator == OP_CONTAINS) { - /* strcasestr is not C89 - return strcasestr(value, mvalue) != 0; - */ - valuedup = strdup(value); - mvaluedup = strdup(mvalue); - for (i = 0; i < strlen(valuedup); i++) { - valuedup[i] = tolower(valuedup[i]); - } - for (i = 0; i < strlen(mvaluedup); i++) { - mvaluedup[i] = tolower(mvaluedup[i]); - } - result = strstr(valuedup, mvaluedup) != 0; - free(valuedup); - free(mvaluedup); - return result; - } else if (operator == OP_EQUAL) { - return strcmp(value, mvalue) == 0; - } else { - return strcmp(value, mvalue) != 0; - } -} - -static bool -match_rr_type(type_operator operator, - char *value, - char *mvalue) -{ - ldns_rr_type a,b; - - a = ldns_get_rr_type_by_name(value); - b = ldns_get_rr_type_by_name(mvalue); - - switch (operator) { - case OP_EQUAL: - return a == b; - break; - case OP_NOTEQUAL: - return a != b; - break; - case OP_GREATER: - return a > b; - break; - case OP_LESSER: - return a < b; - break; - case OP_GREATEREQUAL: - return a >= b; - break; - case OP_LESSEREQUAL: - return a <= b; - break; - default: - fprintf(stderr, "Unknown operator: %u\n", operator); - exit(2); - } -} - -static bool -match_rcode(type_operator operator, - char *value, - char *mvalue) -{ - int a, b; - int i; - ldns_lookup_table *lt; - - /* try parse name first, then parse as int */ - lt = ldns_lookup_by_name(ldns_rcodes, value); - if (lt) { - a = lt->id; - } else { - i = atoi(value); - if (i >= 0 && !isdigit(value[0]) == 0) { - lt = ldns_lookup_by_id(ldns_rcodes, i); - if (lt) { - a = lt->id; - } else { - fprintf(stderr, "Unknown rcode: %s\n", value); - exit(1); - return false; - } - } else { - fprintf(stderr, "Unknown rcode: %s\n", value); - exit(1); - return false; - } - } - - lt = ldns_lookup_by_name(ldns_rcodes, mvalue); - if (lt) { - b = lt->id; - } else { - i = atoi(mvalue); - - if (i >= 0 && !isdigit(mvalue[0]) == 0) { - lt = ldns_lookup_by_id(ldns_rcodes, i); - if (lt) { - b = lt->id; - } else { - fprintf(stderr, "Unknown rcode: %s\n", mvalue); - exit(1); - return false; - } - } else { - fprintf(stderr, "Unknown rcode: %s\n", mvalue); - exit(1); - return false; - } - } - - switch(operator) { - case OP_EQUAL: - return a == b; - break; - case OP_NOTEQUAL: - return a != b; - break; - default: - fprintf(stderr, "Error bad operator for rcode: %s\n", get_op_str(operator)); - return false; - break; - } -} - -static bool -value_matches(match_id id, - type_operator operator, - char *value, - char *mvalue) -{ - int result; - - if (verbosity >= 5) { - printf("Match %s: %s %s %s: ", get_match_name_str(id), value, get_op_str(operator), mvalue); - } - switch(id) { - case MATCH_OPCODE: - result = match_opcode(operator, value, mvalue); - break; - case MATCH_RCODE: - result = match_rcode(operator, value, mvalue); - break; - case MATCH_ID: - case MATCH_QR: - case MATCH_TC: - case MATCH_AD: - case MATCH_CD: - case MATCH_RD: - case MATCH_DO: - case MATCH_PACKETSIZE: - case MATCH_EDNS: - case MATCH_EDNS_PACKETSIZE: - case MATCH_QUESTION_SIZE: - case MATCH_ANSWER_SIZE: - case MATCH_AUTHORITY_SIZE: - case MATCH_ADDITIONAL_SIZE: - case MATCH_TIMESTAMP: - result = match_int(operator, value, mvalue); - break; - case MATCH_QUERY: - case MATCH_QNAME: - case MATCH_ANSWER: - case MATCH_AUTHORITY: - case MATCH_ADDITIONAL: - result = match_str(operator, value, mvalue); - break; - case MATCH_SRC_ADDRESS: - case MATCH_DST_ADDRESS: - result = match_str(operator, value, mvalue); - break; - case MATCH_QTYPE: - result = match_rr_type(operator, value, mvalue); - break; - default: - fprintf(stderr, "Error: value_matches() for operator %s not implemented yet.\n", get_op_str((type_operator) id)); - exit(3); - } - if (verbosity >= 5) { - if (result) { - printf("true\n"); - } else { - printf("false\n"); - } - } - return result; -} - -static char * -get_string_value(match_id id, ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr) -{ - char *val; - match_table *mt; - size_t valsize = 100; - - val = malloc(valsize); - memset(val, 0, valsize); - - switch(id) { - case MATCH_QR: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_qr(pkt)); - break; - case MATCH_ID: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_id(pkt)); - break; - case MATCH_OPCODE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_get_opcode(pkt)); - break; - case MATCH_RCODE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_get_rcode(pkt)); - break; - case MATCH_PACKETSIZE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_size(pkt)); - break; - case MATCH_TC: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_tc(pkt)); - break; - case MATCH_AD: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_ad(pkt)); - break; - case MATCH_CD: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_cd(pkt)); - break; - case MATCH_RD: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_rd(pkt)); - break; - case MATCH_EDNS: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns(pkt)); - break; - case MATCH_EDNS_PACKETSIZE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns_udp_size(pkt)); - break; - case MATCH_DO: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns_do(pkt)); - break; - case MATCH_QUESTION_SIZE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_qdcount(pkt)); - break; - case MATCH_ANSWER_SIZE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_ancount(pkt)); - break; - case MATCH_AUTHORITY_SIZE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_nscount(pkt)); - break; - case MATCH_ADDITIONAL_SIZE: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_arcount(pkt)); - break; - case MATCH_SRC_ADDRESS: - free(val); - val = ldns_rdf2str(src_addr); - break; - case MATCH_DST_ADDRESS: - free(val); - val = ldns_rdf2str(dst_addr); - break; - case MATCH_TIMESTAMP: - snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_timestamp(pkt).tv_sec); - break; - case MATCH_QUERY: - if (ldns_pkt_qdcount(pkt) > 0) { - free(val); - val = ldns_rr2str(ldns_rr_list_rr(ldns_pkt_question(pkt), 0)); - /* replace \n for nicer printing later */ - if (strchr(val, '\n')) { - *(strchr(val, '\n')) = '\0'; - } - } else { - val[0] = '\0'; - } - break; - case MATCH_QNAME: - if (ldns_pkt_qdcount(pkt) > 0) { - free(val); - val = ldns_rdf2str(ldns_rr_owner(ldns_rr_list_rr(ldns_pkt_question(pkt), 0))); - /* replace \n for nicer printing later */ - if (strchr(val, '\n')) { - *(strchr(val, '\n')) = '\0'; - } - } else { - val[0] = '\0'; - } - break; - case MATCH_QTYPE: - if (ldns_pkt_qdcount(pkt) > 0) { - free(val); - val = ldns_rr_type2str(ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_question(pkt), 0))); - } else { - val[0] = '\0'; - } - break; - case MATCH_ANSWER: - if (ldns_pkt_ancount(pkt) > 0) { - free(val); - val = ldns_rr_list2str(ldns_pkt_answer(pkt)); - } else { - val[0] = '\0'; - } - break; - case MATCH_AUTHORITY: - if (ldns_pkt_nscount(pkt) > 0) { - free(val); - val = ldns_rr_list2str(ldns_pkt_authority(pkt)); - } else { - val[0] = '\0'; - } - break; - case MATCH_ADDITIONAL: - if (ldns_pkt_arcount(pkt) > 0) { - free(val); - val = ldns_rr_list2str(ldns_pkt_additional(pkt)); - } else { - val[0] = '\0'; - } - break; - default: - mt = get_match_by_id(id); - if (!mt) { - printf("ERROR UNKNOWN MATCH_TABLE ID %u\n", id); - exit(1); - } - printf("Matcher for %s not implemented yet\n", mt->name); - exit(1); - return NULL; - } - - return val; -} - -static bool -match_packet_to_operation(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_operation *operation) -{ - bool result; - char *val; - - if (!pkt || !operation) { - return false; - } else { - val = get_string_value(operation->id, pkt, src_addr, dst_addr); - if (!val) { - return false; - } - result = value_matches(operation->id, operation->operator, val, operation->value); - free(val); - return result; - } -} - -static int -match_operation_compare(const void *a, const void *b) -{ - match_operation *moa, *mob; - match_table *mt; - long ia, ib; - - if (!a) { - return 1; - } else if (!b) { - return -1; - } else { - moa = (match_operation *) a; - mob = (match_operation *) b; - - if (moa->id < mob->id) { - return -1; - } else if (moa->id > mob->id) { - return 1; - } else { - if (moa->operator < mob->operator) { - return -1; - } else if (moa->operator > mob->operator) { - return 1; - } else { - mt = get_match_by_id(moa->id); - if (mt) { - switch (mt->type) { - case TYPE_INT: - case TYPE_TIMESTAMP: - case TYPE_BOOL: - case TYPE_OPCODE: - case TYPE_RCODE: - ia = atol(moa->value); - ib = atol(mob->value); - return ia - ib; - break; - case TYPE_STRING: - case TYPE_ADDRESS: - case TYPE_RR: - default: - return strcmp(moa->value, mob->value); - break; - } - } else { - return strcmp(moa->value, mob->value); - } - } - } - } -} - -static int -match_expression_compare(const void *a, const void *b) -{ - match_expression *mea, *meb; - - if (!a) { - return 1; - } else if (!b) { - return -1; - } else { - mea = (match_expression *) a; - meb = (match_expression *) b; - - if (mea->op < meb->op) { - return -1; - } else if (mea->op > meb->op) { - return 1; - } else { - switch(mea->op) { - case MATCH_EXPR_AND: - case MATCH_EXPR_OR: - if (match_expression_compare(mea->left, meb->left) < 0) { - return -1; - } else if (match_expression_compare(mea->left, meb->left) > 0) { - return 1; - } else { - return match_expression_compare(mea->right, meb->right); - } - break; - case MATCH_EXPR_LEAF: - return match_operation_compare(mea->match, meb->match); - break; - default: - fprintf(stderr, "Unknown Match Expression logic operator: %u\n", mea->op); - exit(1); - } - } - } -} - -/** - * If count is true, and the counter is found, its count is increased by 1 - */ -static int -add_match_counter(match_counters *counters, - match_expression *expr, - bool count) -{ - int cmp; - match_counters *new; - - if (!counters || !expr) { - return -1; - } else { - if (counters->match) { - cmp = match_expression_compare(counters->match, - expr); - if (cmp > 0) { - if (counters->left) { - return add_match_counter(counters->left, - expr, - count); - } else { - new = malloc(sizeof(match_counters)); - new->left = NULL; - new->right = NULL; - new->match = expr; - counters->left = new; - return 0; - } - } else if (cmp < 0) { - if (counters->right) { - return add_match_counter(counters->right, - expr, - count); - } else { - new = malloc(sizeof(match_counters)); - new->left = NULL; - new->right = NULL; - new->match = expr; - counters->right = new; - return 0; - } - } else { - /* already there? */ - if (count) { - counters->match->count++; - } - return 1; - } - } else { - /* shouldn't happen but anyway */ - counters->match = expr; - } - } - return 0; -} - -static bool -match_dns_packet_to_expr(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_expression *expr) -{ - bool result; - - if (!pkt || !expr) { - return false; - } - - switch(expr->op) { - case MATCH_EXPR_OR: - result = (match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->left) || - match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->right)); - break; - case MATCH_EXPR_AND: - result = (match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->left) && - match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->right)); - break; - case MATCH_EXPR_LEAF: - result = match_packet_to_operation(pkt, src_addr, dst_addr, expr->match); - break; - default: - fprintf(stderr, "Error, unknown expression operator %u\n", expr->op); - fprintf(stderr, "full expression:\n"); - print_match_expression(stderr, expr); - fprintf(stderr, "\n"); - exit(1); - } - - if (result) { - if (verbosity >= 5) { - printf("Found Match:\n"); - print_match_expression(stdout, expr); - printf("\nCount now %u\n", (unsigned int) expr->count); - } - expr->count++; - } - - return result; -} - -static void -free_match_operation(match_operation *operation) -{ - if (operation) { - if (operation->value) { - free(operation->value); - } - free(operation); - } -} - -static void -free_match_expression(match_expression *expr) -{ - if (expr) { - switch(expr->op) { - case MATCH_EXPR_OR: - case MATCH_EXPR_AND: - free_match_expression(expr->left); - free_match_expression(expr->right); - break; - case MATCH_EXPR_LEAF: - free_match_operation(expr->match); - break; - } - free(expr); - } -} - -static void -free_counters(match_counters *counters) -{ - if (counters) { - if (counters->left) { - free_counters(counters->left); - } - if (counters->match) { - free_match_expression(counters->match); - } - if (counters->right) { - free_counters(counters->right); - } - free(counters); - } -} - -static void -match_pkt_counters(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_counters *counts) -{ - if (counts->left) { - match_pkt_counters(pkt, src_addr, dst_addr, counts->left); - } - if (counts->match) { - if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, counts->match)) { -/* - counts->match->count++; -*/ - } - } - if (counts->right) { - match_pkt_counters(pkt, src_addr, dst_addr, counts->right); - } -} - -static void -match_pkt_uniques(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_counters *uniques, match_id unique_ids[], size_t unique_id_count) -{ - match_expression *me; - size_t i; - match_operation *mo; - int add_result; - - for (i = 0; i < unique_id_count; i++) { - mo = malloc(sizeof(match_operation)); - mo->id = unique_ids[i]; - mo->operator = OP_EQUAL; - mo->value = get_string_value(mo->id, pkt, src_addr, dst_addr); - - me = malloc(sizeof(match_expression)); - me->op = MATCH_EXPR_LEAF; - me->left = NULL; - me->right = NULL; - me->match = mo; - me->count = 1; - - add_result = add_match_counter(uniques, me, true); - /* if result=1 it was already found, so delete new one */ - if (add_result == 1) { - free_match_expression(me); - } - } - -#if 0 - size_t i, j; - bool found; - match_expression *me; - match_operation *mo; - - /* get the value, match uniques for that, if not match, add new */ - /* all unique values should be MATCH_EXPR_LEAF */ - found = false; - for (j = 0; j < uniques->size; j++) { - if (uniques->counter[j]->match->id == unique_ids[i]) { - if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, uniques->counter[j])) { - found = true; - } - } - } - if (!found) { - mo = malloc(sizeof(match_operation)); - mo->id = unique_ids[i]; - mo->operator = OP_EQUAL; - mo->value = get_string_value(mo->id, pkt, src_addr, dst_addr); - - me = malloc(sizeof(match_expression)); - me->match = mo; - me->op = MATCH_EXPR_LEAF; - me->left = NULL; - me->right = NULL; - me->count = 1; - - add_counter(uniques, me); - } - } -#endif -} - -static match_expression * -parse_match_expression(char *string) -{ - match_expression *expr; - size_t i,j; - size_t leftstart, leftend = 0; - char *left_str, *op, *val; - match_table *mt; - match_operation *mo = NULL; - const type_operators *tos; - match_expression *result; - ldns_lookup_table *lt = NULL; - - /* remove whitespace */ - char *str = malloc(strlen(string) + 1); - - j = 0; - for (i = 0; i < strlen(string); i++) { - if(!isspace(string[i])) { - str[j] = string[i]; - j++; - } - } - str[j] = '\0'; - - expr = malloc(sizeof(match_expression)); - expr->left = NULL; - expr->right = NULL; - expr->match = NULL; - expr->count = 0; - leftstart = 0; - for (i = 0; i < strlen(str); i++) { - if (str[i] == '&') { - expr->op = MATCH_EXPR_AND; - if (!expr->left) { - left_str = malloc(leftend - leftstart + 2); - strncpy(left_str, &str[leftstart], leftend-leftstart+1); - left_str[leftend - leftstart + 1] = '\0'; - expr->left = parse_match_expression(left_str); - free(left_str); - } - expr->right = parse_match_expression(&str[i+1]); - if (expr->left && expr->right) { - result = expr; - goto done; - } else { - result = NULL; - goto done; - } - } else if (str[i] == '|') { - expr->op = MATCH_EXPR_OR; - if (!expr->left) { - left_str = malloc(leftend - leftstart + 2); - strncpy(left_str, &str[leftstart], leftend-leftstart+1); - left_str[leftend - leftstart + 1] = '\0'; - expr->left = parse_match_expression(left_str); - free(left_str); - } - expr->right = parse_match_expression(&str[i+1]); - expr->count = 0; - if (expr->left && expr->right) { - result = expr; - goto done; - } else { - result = NULL; - goto done; - } - } else if (str[i] == '(') { - leftstart = i + 1; - j = 1; - while (j > 0) { - i++; - if (i > strlen(str)) { - printf("parse error: no closing bracket: %s\n", str); - printf(" "); - for (j = 0; j < leftstart - 1; j++) { - printf(" "); - } - printf("^\n"); - result = NULL; - goto done; - } - if (str[i] == ')') { - j--; - } else if (str[i] == '(') { - j++; - } else { - } - } - leftend = i-1; - left_str = malloc(leftend - leftstart + 1); - strncpy(left_str, &str[leftstart], leftend - leftstart + 1); - expr->left = parse_match_expression(left_str); - free(left_str); - if (i >= strlen(str)-1) { - result = expr->left; - goto done; - } - } else if (str[i] == ')') { - printf("parse error: ) without (\n"); - result = NULL; - goto done; - } else { - leftend = i; - } - } - - /* no operators or hooks left, expr should be of the form - now */ - for (i = 0; i < strlen(str); i++) { - if (str[i] == '=' || - str[i] == '>' || - str[i] == '<' || - str[i] == '!' || - str[i] == '~' - ) { - leftend = i-1; - op = malloc(3); - j = 0; - op[j] = str[i]; - i++; - j++; - - if (i > strlen(str)) { - printf("parse error no right hand side: %s\n", str); - result = NULL; - goto done; - } - if (str[i] == '=' || - str[i] == '>' || - str[i] == '<' || - str[i] == '!' || - str[i] == '~' - ) { - op[j] = str[i]; - i++; - j++; - if (i > strlen(str)) { - printf("parse error no right hand side: %s\n", str); - result = NULL; - goto done; - } - } - op[j] = '\0'; - left_str = malloc(leftend - leftstart + 2); - strncpy(left_str, &str[leftstart], leftend - leftstart + 1); - left_str[leftend - leftstart + 1] = '\0'; - mt = get_match_by_name(left_str); - if (!mt) { - printf("parse error: unknown match name: %s\n", left_str); - result = NULL; - goto done; - } else { - /* check if operator is allowed */ - tos = get_type_operators(mt->type); - for (j = 0; j < tos->operator_count; j++) { - if (get_op_id(op) == tos->operators[j]) { - mo = malloc(sizeof(match_operation)); - mo->id = mt->id; - mo->operator = get_op_id(op); - switch (mt->type) { - case TYPE_BOOL: - val = malloc(2); - if (strncmp(&str[i], "true", 5) == 0 || - strncmp(&str[i], "TRUE", 5) == 0 || - strncmp(&str[i], "True", 5) == 0 || - strncmp(&str[i], "1", 2) == 0 - ) { - val[0] = '1'; - val[1] = '\0'; - } else if (strncmp(&str[i], "false", 5) == 0 || - strncmp(&str[i], "FALSE", 5) == 0 || - strncmp(&str[i], "False", 5) == 0 || - strncmp(&str[i], "0", 2) == 0 - ) { - - val[0] = '0'; - } else { - fprintf(stderr, "Bad value for bool: %s\n", &str[i]); - exit(EXIT_FAILURE); - } - val[1] = '\0'; - break; - case TYPE_RR: - /* convert first so we have the same strings for the same rrs in match_ later */ - /* - qrr = ldns_rr_new_frm_str(&str[i], LDNS_DEFAULT_TTL, NULL); - if (!qrr) { - fprintf(stderr, "Bad value for RR: %s\n", &str[i]); - exit(EXIT_FAILURE); - } - val = ldns_rr2str(qrr); - */ - /* remove \n for readability */ - /* - if (strchr(val, '\n')) { - *(strchr(val, '\n')) = '\0'; - } - ldns_rr_free(qrr); - */ - val = strdup(&str[i]); - break; - case TYPE_OPCODE: - lt = ldns_lookup_by_name(ldns_opcodes, &str[i]); - if (lt) { - val = malloc(4); - snprintf(val, 3, "%u", (unsigned int) lt->id); - } else { - val = strdup(&str[i]); - } - break; - case TYPE_RCODE: - lt = ldns_lookup_by_name(ldns_rcodes, &str[i]); - if (lt) { - val = malloc(4); - snprintf(val, 3, "%u", (unsigned int) lt->id); - } else { - val = strdup(&str[i]); - } - break; - default: - val = strdup(&str[i]); - break; - } - mo->value = val; - } - } - if (!mo) { - printf("parse error: operator %s not allowed for match %s\n", op, left_str); - result = NULL; - goto done; - } - } - free(left_str); - free(op); - expr->match = mo; - expr->op = MATCH_EXPR_LEAF; - result = expr; - goto done; - } - } - - result = NULL; - - done: - free(str); - if (!result) { - free_match_expression(expr); - } - return result; - -} -/* end of matches and counts */ -void -usage(FILE *output) -{ - fprintf(output, "Usage: ldns-dpa [OPTIONS] \n"); - fprintf(output, "Options:\n"); - fprintf(output, "\t-c :\tCount occurrences of matching expressions\n"); - fprintf(output, "\t-f :\tFilter occurrences of matching expressions\n"); - fprintf(output, "\t-h:\t\tshow this help\n"); - fprintf(output, "\t-p:\t\tshow percentage of -u and -c values (of the total of\n\t\t\tmatching on the -f filter. if no filter is given,\n\t\t\tpercentages are on all correct dns packets)\n"); - fprintf(output, "\t-of :\tWrite pcap packets that match the -f flag to file\n"); - fprintf(output, "\t-ofh :\tWrite pcap packets that match the -f flag to file\n\t\tin a hexadecimal format readable by drill\n"); - fprintf(output, "\t-s:\t\tshow possible match names\n"); - fprintf(output, "\t-s :\tshow possible match operators and values for \n"); - fprintf(output, "\t-sf:\t\tPrint packet that match -f. If no -f is given, print\n\t\t\tall dns packets\n"); - fprintf(output, "\t-u :\tCount all occurrences of matchname\n"); - fprintf(output, "\t-ua:\t\tShow average value of every -u matchname\n"); - fprintf(output, "\t-uac:\t\tShow average count of every -u matchname\n"); - fprintf(output, "\t-um :\tOnly show -u results that occured more than number times\n"); - fprintf(output, "\t-v :\tbe more verbose\n"); - fprintf(output, "\t-notip :\tDump pcap packets that were not recognized as\n\t\t\tIP packets to file\n"); - fprintf(output, "\t-baddns :\tDump mangled dns packets to file\n"); - fprintf(output, "\t-version:\tShow the version and exit\n"); - fprintf(output, "\n"); - fprintf(output, "The filename '-' stands for stdin or stdout, so you can use \"-of -\" if you want to pipe the output to another process\n"); - fprintf(output, "\n"); - fprintf(output, "A is a comma separated list of items\n"); - fprintf(output, "\n"); - fprintf(output, "An expression has the following form:\n"); - fprintf(output, ":\t()\n"); - fprintf(output, "\t | \n"); - fprintf(output, "\t & \n"); - fprintf(output, "\t\n"); - fprintf(output, "\n"); - fprintf(output, ":\t \n"); - fprintf(output, "\n"); - fprintf(output, "See the -s option for possible matchnames, operators and values.\n"); -} - -void -show_match_names(char *name) -{ - size_t j; - match_table *mt; - ldns_lookup_table *lt; - const type_operators *tos; - char *str; - size_t i; - - if (name) { - mt = get_match_by_name(name); - if (mt) { - printf("%s:\n", mt->name); - printf("\t%s.\n", mt->description); - printf("\toperators: "); - printf("\t"); - tos = get_type_operators(mt->type); - if (tos) { - for (j = 0; j < tos->operator_count; j++) { - printf("%s ", get_op_str(tos->operators[j])); -/* - lt = ldns_lookup_by_id((ldns_lookup_table *) lt_operators, tos->operators[j]); - if (lt) { - printf("%s ", lt->name); - } else { - printf("? "); - } -*/ - } - } else { - printf("unknown type"); - } - - printf("\n"); - printf("\tValues:\n"); - switch (mt->type) { - case TYPE_INT: - printf("\t\t\n"); - break; - case TYPE_BOOL: - printf("\t\t0\n"); - printf("\t\t1\n"); - printf("\t\ttrue\n"); - printf("\t\tfalse\n"); - break; - case TYPE_OPCODE: - printf("\t\t\n"); - lt = ldns_opcodes; - while (lt->name != NULL) { - printf("\t\t%s\n", lt->name); - lt++; - } - break; - case TYPE_RCODE: - printf("\t\t\n"); - lt = ldns_rcodes; - while (lt->name != NULL) { - printf("\t\t%s\n", lt->name); - lt++; - } - break; - case TYPE_STRING: - printf("\t\t\n"); - break; - case TYPE_TIMESTAMP: - printf("\t\t (seconds since epoch)\n"); - break; - case TYPE_ADDRESS: - printf("\t\t\n"); - break; - case TYPE_RR: - printf("\t\t\n"); - break; - default: - break; - } - } else { - printf("Unknown match name: %s\n", name); - } - } else { - mt = (match_table *) matches; - while (mt->name != NULL) { - str = (char *) mt->name; - printf("%s:", str); - i = strlen(str) + 1; - while (i < 24) { - printf(" "); - i++; - } - printf("%s\n", mt->description); - mt++; - } - } -} - -int -handle_ether_packet(const u_char *data, struct pcap_pkthdr cur_hdr, match_counters *count, match_expression *match_expr, match_counters *uniques, match_id unique_ids[], size_t unique_id_count) -{ - struct ether_header *eptr; - struct ip *iptr; - struct ip6_hdr *ip6_hdr; - int ip_hdr_size; - uint8_t protocol; - size_t data_offset = 0; - ldns_rdf *src_addr, *dst_addr; - uint8_t *ap; - char *astr; - bpf_u_int32 len = cur_hdr.caplen; - struct timeval timestamp; - uint16_t ip_flags; - uint16_t ip_len; - uint16_t ip_id; - uint16_t ip_f_offset; - const u_char *newdata = NULL; -/* -printf("timeval: %u ; %u\n", cur_hdr.ts.tv_sec, cur_hdr.ts.tv_usec); -*/ - - uint8_t *dnspkt; - - ldns_pkt *pkt; - ldns_status status; - - /* lets start with the ether header... */ - eptr = (struct ether_header *) data; - /* Do a couple of checks to see what packet type we have..*/ - if (ntohs (eptr->ether_type) == ETHERTYPE_IP) - { - if (verbosity >= 5) { - printf("Ethernet type hex:%x dec:%u is an IP packet\n", - (unsigned int) ntohs(eptr->ether_type), - (unsigned int) ntohs(eptr->ether_type)); - } - - data_offset = ETHER_HEADER_LENGTH; - iptr = (struct ip *) (data + data_offset); - /* - printf("IP_OFF: %u (%04x) %04x %04x (%d) (%d)\n", iptr->ip_off, iptr->ip_off, IP_MF, IP_DF, iptr->ip_off & 0x4000, iptr->ip_off & 0x2000); - */ - ip_flags = ldns_read_uint16(&(iptr->ip_off)); - ip_id = ldns_read_uint16(&(iptr->ip_id)); - ip_len = ldns_read_uint16(&(iptr->ip_len)); - ip_f_offset = (ip_flags & IP_OFFMASK)*8; - if (ip_flags & IP_MF && ip_f_offset == 0) { - /*printf("First Frag id %u len\n", ip_id, ip_len);*/ - fragment_p->ip_id = ip_id; - memset(fragment_p->data, 0, 65535); - memcpy(fragment_p->data, iptr, ip_len); - fragment_p->cur_len = ip_len + 20; -/* - for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { - if (ip_len > 0 && ip_len % 20 == 0) { - printf("\t; %u - %u\n", ip_len - 19, ip_len); - } - printf("%02x ", fragment_p->data[ip_len]); - } - printf("\t; ??? - %u\n", ip_len); -*/ - return 0; - } else - if (ip_flags & IP_MF && ip_f_offset != 0) { - /*printf("Next frag\n");*/ - if (ip_id == fragment_p->ip_id) { - /*printf("add fragment to current id %u len %u offset %u\n", ip_id, ip_len, ip_f_offset);*/ - memcpy(fragment_p->data + (ip_f_offset) + 20, data+data_offset+20, ip_len - (iptr->ip_hl)*4); - /*printf("COPIED %u\n", ip_len);*/ - fragment_p->cur_len = fragment_p->cur_len + ip_len - 20; - /*printf("cur len now %u\n", fragment_p->cur_len);*/ -/* - for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { - if (ip_len > 0 && ip_len % 20 == 0) { - printf("\t; %u - %u\n", ip_len - 19, ip_len); - } - printf("%02x ", fragment_p->data[ip_len]); - } - printf("\t; ??? - %u\n", ip_len); -*/ - return 0; - } else { - /*printf("Lost fragment %u\n", iptr->ip_id);*/ - lost_packet_fragments++; - return 1; - } - } else - if (!(ip_flags & IP_MF) && ip_f_offset != 0) { - /*printf("Last frag\n");*/ - if (ip_id == fragment_p->ip_id) { - /*printf("add fragment to current id %u len %u offset %u\n", ip_id, ip_len, ip_f_offset);*/ - memcpy(fragment_p->data + ip_f_offset + 20, data+data_offset+20, ip_len - 20); - fragment_p->cur_len = fragment_p->cur_len + ip_len - 20; - iptr = (struct ip *) fragment_p->data; - newdata = malloc(fragment_p->cur_len + data_offset); - if (!newdata) { - printf("Malloc failed, out of mem?\n"); - exit(4); - } - memcpy((char *) newdata, data, data_offset); - memcpy((char *) newdata+data_offset, fragment_p->data, fragment_p->cur_len); - iptr->ip_len = (u_short) ldns_read_uint16(&(fragment_p->cur_len)); - iptr->ip_off = 0; - len = (bpf_u_int32) fragment_p->cur_len; - cur_hdr.caplen = len; - fragment_p->ip_id = 0; - fragmented_packets++; -/* - for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { - if (ip_len > 0 && ip_len % 20 == 0) { - printf("\t; %u - %u\n", ip_len - 19, ip_len); - } - printf("%02x ", fragment_p->data[ip_len]); - } - printf("\t; ??? - %u\n", ip_len); -*/ - } else { - /*printf("Lost fragment %u\n", iptr->ip_id);*/ - lost_packet_fragments++; - return 1; - } - } else { - newdata = data; - } -/* - if (iptr->ip_off & 0x0040) { - printf("Don't fragment\n"); - } -*/ - - /* in_addr portability woes, going manual for now */ - /* ipv4 */ - ap = (uint8_t *) &(iptr->ip_src); - astr = malloc(INET_ADDRSTRLEN); - if (inet_ntop(AF_INET, ap, astr, INET_ADDRSTRLEN)) { - if (ldns_str2rdf_a(&src_addr, astr) == LDNS_STATUS_OK) { - - } - free(astr); - } - ap = (uint8_t *) &(iptr->ip_dst); - astr = malloc(INET_ADDRSTRLEN); - if (inet_ntop(AF_INET, ap, astr, INET_ADDRSTRLEN)) { - if (ldns_str2rdf_a(&dst_addr, astr) == LDNS_STATUS_OK) { - - } - free(astr); - } - - ip_hdr_size = (int) iptr->ip_hl * 4; - protocol = (uint8_t) iptr->ip_p; - - data_offset += ip_hdr_size; - - if (protocol == IPPROTO_UDP) { - udp_packets++; - data_offset += UDP_HEADER_LENGTH; - - dnspkt = (uint8_t *) (newdata + data_offset); - - /*printf("packet starts at byte %u\n", data_offset);*/ - - /*printf("Len: %u\n", len);*/ - - status = ldns_wire2pkt(&pkt, dnspkt, len - data_offset); - - if (status != LDNS_STATUS_OK) { - if (verbosity >= 3) { - printf("No dns packet: %s\n", ldns_get_errorstr_by_id(status)); - } - if (verbosity >= 5) { - for (ip_len = 0; ip_len < len - data_offset; ip_len++) { - if (ip_len > 0 && ip_len % 20 == 0) { - printf("\t; %u - %u\n", (unsigned int) ip_len - 19, (unsigned int) ip_len); - } - printf("%02x ", (unsigned int) dnspkt[ip_len]); - } - printf("\t; ??? - %u\n", (unsigned int) ip_len); - - } - bad_dns_packets++; - if (bad_dns_dump) { - pcap_dump((u_char *)bad_dns_dump, &cur_hdr, newdata); - } - } else { - timestamp.tv_sec = cur_hdr.ts.tv_sec; - timestamp.tv_usec = cur_hdr.ts.tv_usec; - ldns_pkt_set_timestamp(pkt, timestamp); - - if (verbosity >= 4) { - printf("DNS packet\n"); - ldns_pkt_print(stdout, pkt); - printf("\n\n"); - } - - total_nr_of_dns_packets++; - - if (match_expr) { - if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, match_expr)) { - /* if outputfile write */ - if (dumper) { - pcap_dump((u_char *)dumper, &cur_hdr, data); - } - if (hexdumpfile) { - fprintf(hexdumpfile, ";; %u\n", (unsigned int) total_nr_of_dns_packets); - ldns_pkt2file_hex(hexdumpfile, pkt); - } - if (show_filter_matches) { - printf(";; From: "); - ldns_rdf_print(stdout, src_addr); - printf("\n"); - printf(";; To: "); - ldns_rdf_print(stdout, dst_addr); - printf("\n"); - ldns_pkt_print(stdout, pkt); - printf("------------------------------------------------------------\n\n"); - } - } else { - ldns_pkt_free(pkt); - ldns_rdf_deep_free(src_addr); - ldns_rdf_deep_free(dst_addr); - return 0; - } - } else { - if (dumper) { - pcap_dump((u_char *)dumper, &cur_hdr, data); - } - if (hexdumpfile) { - fprintf(hexdumpfile, ";; %u\n", (unsigned int) total_nr_of_dns_packets); - ldns_pkt2file_hex(hexdumpfile, pkt); - } - if (show_filter_matches) { - printf(";; From: "); - ldns_rdf_print(stdout, src_addr); - printf("\n"); - printf(";; To: "); - ldns_rdf_print(stdout, dst_addr); - printf("\n"); - ldns_pkt_print(stdout, pkt); - printf("------------------------------------------------------------\n\n"); - } - } - - /* General counters here */ - total_nr_of_filtered_packets++; - - match_pkt_counters(pkt, src_addr, dst_addr, count); - match_pkt_uniques(pkt, src_addr, dst_addr, uniques, unique_ids, unique_id_count); - - ldns_pkt_free(pkt); - pkt = NULL; - } - ldns_rdf_deep_free(src_addr); - ldns_rdf_deep_free(dst_addr); - - } else if (protocol == IPPROTO_TCP) { - /* tcp packets are skipped */ - tcp_packets++; - } - /* don't have a define for ethertype ipv6 */ - } else if (ntohs (eptr->ether_type) == ETHERTYPE_IPV6) { - /*printf("IPv6!\n");*/ - - - /* copied from ipv4, move this to function? */ - - data_offset = ETHER_HEADER_LENGTH; - ip6_hdr = (struct ip6_hdr *) (data + data_offset); - - newdata = data; - - /* in_addr portability woes, going manual for now */ - /* ipv6 */ - ap = (uint8_t *) &(ip6_hdr->ip6_src); - astr = malloc(INET6_ADDRSTRLEN); - if (inet_ntop(AF_INET6, ap, astr, INET6_ADDRSTRLEN)) { - if (ldns_str2rdf_aaaa(&src_addr, astr) == LDNS_STATUS_OK) { - - } - free(astr); - } - ap = (uint8_t *) &(ip6_hdr->ip6_dst); - astr = malloc(INET6_ADDRSTRLEN); - if (inet_ntop(AF_INET6, ap, astr, INET6_ADDRSTRLEN)) { - if (ldns_str2rdf_aaaa(&dst_addr, astr) == LDNS_STATUS_OK) { - - } - free(astr); - } - - ip_hdr_size = IP6_HEADER_LENGTH; - protocol = (uint8_t) ip6_hdr->ip6_ctlun.ip6_un1.ip6_un1_nxt; - - data_offset += ip_hdr_size; - - if (protocol == IPPROTO_UDP) { - udp_packets++; - /*printf("V6 UDP!\n");*/ - data_offset += UDP_HEADER_LENGTH; - - dnspkt = (uint8_t *) (newdata + data_offset); - - /*printf("Len: %u\n", len);*/ - - status = ldns_wire2pkt(&pkt, dnspkt, len - data_offset); - - if (status != LDNS_STATUS_OK) { - if (verbosity >= 3) { - printf("No dns packet: %s\n", ldns_get_errorstr_by_id(status)); - } - bad_dns_packets++; - if (bad_dns_dump) { - pcap_dump((u_char *)bad_dns_dump, &cur_hdr, newdata); - } - } else { - timestamp.tv_sec = cur_hdr.ts.tv_sec; - timestamp.tv_usec = cur_hdr.ts.tv_usec; - ldns_pkt_set_timestamp(pkt, timestamp); - - if (verbosity >= 4) { - printf("DNS packet\n"); - ldns_pkt_print(stdout, pkt); - printf("\n\n"); - } - - total_nr_of_dns_packets++; - - if (match_expr) { - if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, match_expr)) { - /* if outputfile write */ - if (dumper) { - pcap_dump((u_char *)dumper, &cur_hdr, data); - } - if (show_filter_matches) { - printf(";; From: "); - ldns_rdf_print(stdout, src_addr); - printf("\n"); - printf(";; To: "); - ldns_rdf_print(stdout, dst_addr); - printf("\n"); - ldns_pkt_print(stdout, pkt); - printf("------------------------------------------------------------\n\n"); - } - } else { - ldns_pkt_free(pkt); - ldns_rdf_deep_free(src_addr); - ldns_rdf_deep_free(dst_addr); - return 0; - } - } else { - if (show_filter_matches) { - printf(";; From: "); - ldns_rdf_print(stdout, src_addr); - printf("\n"); - printf(";; To: "); - ldns_rdf_print(stdout, dst_addr); - printf("\n"); - ldns_pkt_print(stdout, pkt); - printf("------------------------------------------------------------\n\n"); - } - } - - /* General counters here */ - total_nr_of_filtered_packets++; - - match_pkt_counters(pkt, src_addr, dst_addr, count); - match_pkt_uniques(pkt, src_addr, dst_addr, uniques, unique_ids, unique_id_count); - - ldns_pkt_free(pkt); - pkt = NULL; - } - ldns_rdf_deep_free(src_addr); - ldns_rdf_deep_free(dst_addr); - - } else if (protocol == IPPROTO_TCP) { - /* tcp packets are skipped */ - tcp_packets++; - } else { - printf("ipv6 unknown next header type: %u\n", (unsigned int) protocol); - } - - - - } else if (ntohs (eptr->ether_type) == ETHERTYPE_ARP) { - if (verbosity >= 5) { - printf("Ethernet type hex:%x dec:%u is an ARP packet\n", - (unsigned int) ntohs(eptr->ether_type), - (unsigned int) ntohs(eptr->ether_type)); - } - arp_packets++; - } else { - printf("Ethernet type %x not IP\n", (unsigned int) ntohs(eptr->ether_type)); - if (verbosity >= 5) { - printf("Ethernet type %x not IP\n", (unsigned int) ntohs(eptr->ether_type)); - } - not_ip_packets++; - if (not_ip_dump) { - pcap_dump((u_char *)not_ip_dump, &cur_hdr, data); - } - } - - return 0; -} - -bool -parse_match_list(match_counters *counters, char *string) -{ - size_t i; - match_expression *expr; -/* match_counter *mc;*/ - size_t lastpos = 0; - char *substring; - - /*printf("Parsing match list: '%s'\n", string);*/ - - for (i = 0; i < strlen(string); i++) { - if (string[i] == ',') { - if (i<2) { - fprintf(stderr, "Matchlist cannot start with ,\n"); - return false; - } else { - substring = malloc(strlen(string)+1); - strncpy(substring, &string[lastpos], i - lastpos + 1); - substring[i - lastpos] = '\0'; - expr = parse_match_expression(substring); - if (!expr) { - return false; - } - free(substring); - /* - if (expr->op != MATCH_EXPR_LEAF) { - fprintf(stderr, "Matchlist can only contain , not a logic expression\n"); - return false; - } - */ - add_match_counter(counters, expr, false); - lastpos = i+1; - } - } - } - substring = malloc(strlen(string) + 1); - strncpy(substring, &string[lastpos], i - lastpos + 1); - substring[i - lastpos] = '\0'; - expr = parse_match_expression(substring); - - if (!expr) { - fprintf(stderr, "Bad match: %s\n", substring); - return false; - } - free(substring); - /* - if (expr->op != MATCH_EXPR_LEAF) { - fprintf(stderr, "Matchlist can only contain , not a logic expression\n"); - return false; - } - */ - add_match_counter(counters, expr, false); - return true; -} - -bool -parse_uniques(match_id ids[], size_t *count, char *string) -{ - size_t i, j, lastpos; - char *str, *strpart; - match_table *mt; - - /*printf("Parsing unique counts: '%s'\n", string);*/ - str = malloc(strlen(string) + 1); - j = 0; - for (i = 0; i < strlen(string); i++) { - if (!isspace(string[i])) { - str[j] = string[i]; - j++; - } - } - str[j] = '\0'; - - lastpos = 0; - for (i = 0; i <= strlen(str); i++) { - if (str[i] == ',' || i >= strlen(str)) { - strpart = malloc(i - lastpos + 1); - strncpy(strpart, &str[lastpos], i - lastpos); - strpart[i - lastpos] = '\0'; - if ((mt = get_match_by_name(strpart))) { - ids[*count] = mt->id; - *count = *count + 1; - } else { - printf("Error parsing match list; unknown match name: %s\n", strpart); - return false; - } - free(strpart); - lastpos = i + 1; - } - } - if (i > lastpos) { - strpart = malloc(i - lastpos + 1); - strncpy(strpart, &str[lastpos], i - lastpos); - strpart[i - lastpos] = '\0'; - if ((mt = get_match_by_name(strpart))) { - ids[*count] = mt->id; - *count = *count + 1; - } else { - printf("Error parsing match list; unknown match name: %s\n", strpart); - return false; - } - free(strpart); - lastpos = i + 1; - } - free(str); - return true; -} - -int main(int argc, char *argv[]) { - - int i; - int status = EXIT_SUCCESS; - match_counters *count = malloc(sizeof(match_counters)); - const char *inputfile = NULL; - char errbuf[PCAP_ERRBUF_SIZE]; - pcap_t *pc = NULL; - const u_char *cur; - struct pcap_pkthdr cur_hdr; - match_expression *expr = NULL; - match_id unique_ids[MAX_MATCHES]; - size_t unique_id_count = 0; /* number of unique counters */ - match_counters *uniques = malloc(sizeof(match_counters)); - char *dumpfile = NULL; - char *hexdumpfilename = NULL; - char *not_ip_dumpfile = NULL; - char *bad_dns_dumpfile = NULL; - - bool show_percentages = false; - bool show_averages = false; - bool show_average_count = false; - int unique_minimum = 0; - - count->left = NULL; - count->match = NULL; - count->right = NULL; - uniques->left = NULL; - uniques->match = NULL; - uniques->right = NULL; - - fragment_p = malloc(sizeof(struct fragment_part)); - fragment_p->ip_id = 0; - fragment_p->cur_len = 0; - - for (i = 1; i < argc; i++) { - - if (strncmp(argv[i], "-baddns", 8) == 0) { - if (i + 1 < argc) { - bad_dns_dumpfile = argv[i + 1]; - i++; - } else { - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strncmp(argv[i], "-notip", 7) == 0) { - if (i + 1 < argc) { - not_ip_dumpfile = argv[i + 1]; - i++; - } else { - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strncmp(argv[i], "-c", 3) == 0) { - if (i + 1 < argc) { - if (!parse_match_list(count, argv[i + 1])) { - status = EXIT_FAILURE; - goto exit; - } - i++; - } else { - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strncmp(argv[i], "-f", 3) == 0) { - if (i + 1 < argc) { - if (expr || strchr(argv[i+1], ',')) { - fprintf(stderr, "You can only specify 1 filter expression.\n"); - status = EXIT_FAILURE; - goto exit; - } - expr = parse_match_expression(argv[i + 1]); - i++; - } else { - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strncmp(argv[i], "-h", 3) == 0) { - usage(stdout); - status = EXIT_SUCCESS; - goto exit; - } else if (strncmp(argv[i], "-p", 3) == 0) { - show_percentages = true; - } else if (strncmp(argv[i], "-of", 4) == 0) { - if (i + 1 < argc) { - dumpfile = argv[i + 1]; - i++; - } else { - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strncmp(argv[i], "-ofh", 5) == 0) { - if (i + 1 < argc) { - hexdumpfilename = argv[i + 1]; - i++; - } else { - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strncmp(argv[i], "-s", 3) == 0) { - if (i + 1 < argc) { - show_match_names(argv[i + 1]); - } else { - show_match_names(NULL); - } - status = EXIT_SUCCESS; - goto exit; - } else if (strncmp(argv[i], "-sf", 4) == 0) { - show_filter_matches = true; - } else if (strncmp(argv[i], "-u", 3) == 0) { - if (i + 1 < argc) { - if (!parse_uniques(unique_ids, &unique_id_count, argv[i + 1])) { - status = EXIT_FAILURE; - goto exit; - } - i++; - } else { - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strcmp("-ua", argv[i]) == 0) { - show_averages = true; - } else if (strcmp("-uac", argv[i]) == 0) { - show_average_count = true; - } else if (strcmp("-um", argv[i]) == 0) { - if (i + 1 < argc) { - unique_minimum = atoi(argv[i+1]); - i++; - } else { - fprintf(stderr, "-um requires an argument"); - usage(stderr); - status = EXIT_FAILURE; - goto exit; - } - } else if (strcmp("-v", argv[i]) == 0) { - i++; - if (i < argc) { - verbosity = atoi(argv[i]); - } - } else if (strcmp("-version", argv[i]) == 0) { - printf("dns packet analyzer, version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); - goto exit; - } else { - if (inputfile) { - fprintf(stderr, "You can only specify 1 input file\n"); - exit(1); - } - inputfile = argv[i]; - } - } - - if (!inputfile) { - inputfile = "-"; - } - - if (verbosity >= 5) { - printf("Filter:\n"); - print_match_expression(stdout, expr); - printf("\n\n"); - } - - pc = pcap_open_offline(inputfile, errbuf); - - if (!pc) { - if (errno != 0) { - printf("Error opening pcap file %s: %s\n", inputfile, errbuf); - exit(1); - } else { - goto showresult; - } - } - - if (dumpfile) { - dumper = pcap_dump_open(pc, dumpfile); - - if (!dumper) { - printf("Error opening pcap dump file %s: %s\n", dumpfile, errbuf); - exit(1); - } - } - - if (hexdumpfilename) { - if (strncmp(hexdumpfilename, "-", 2) != 0) { - printf("hexdump is file\n"); - hexdumpfile = fopen(hexdumpfilename, "w"); - } else { - printf("hexdump is stdout\n"); - hexdumpfile = stdout; - } - - if (!hexdumpfile) { - printf("Error opening hex dump file %s: %s\n", hexdumpfilename, strerror(errno)); - exit(1); - } - } - - if (not_ip_dumpfile) { - not_ip_dump = pcap_dump_open(pc, not_ip_dumpfile); - if (!not_ip_dump) { - printf("Error opening pcap dump file NOT_IP: %s\n", errbuf); - } - } - if (bad_dns_dumpfile) { - bad_dns_dump = pcap_dump_open(pc, bad_dns_dumpfile); - if (!bad_dns_dump) { - printf("Error opening pcap dump file NOT_IP: %s\n", errbuf); - } - } - - while ((cur = pcap_next(pc, &cur_hdr))) { - if (verbosity >= 5) { - printf("\n\n\n[PKT_HDR] caplen: %u \tlen: %u\n", cur_hdr.caplen, cur_hdr.len); - } - handle_ether_packet(cur, cur_hdr, count, expr, uniques, unique_ids, unique_id_count); - } - - if (not_ip_dump) { - pcap_dump_close(not_ip_dump); - } - - if (bad_dns_dump) { - pcap_dump_close(bad_dns_dump); - } - - if (dumper) { - pcap_dump_close(dumper); - } - - if (hexdumpfile && hexdumpfile != stdout) { - fclose(hexdumpfile); - } - - pcap_close(pc); - - showresult: - if (show_percentages) { - fprintf(stdout, "Packets that are not IP: %u\n", (unsigned int) not_ip_packets); - fprintf(stdout, "bad dns packets: %u\n", (unsigned int) bad_dns_packets); - fprintf(stdout, "arp packets: %u\n", (unsigned int) arp_packets); - fprintf(stdout, "udp packets: %u\n", (unsigned int) udp_packets); - fprintf(stdout, "tcp packets (skipped): %u\n", (unsigned int) tcp_packets); - fprintf(stdout, "reassembled fragmented packets: %u\n", (unsigned int) fragmented_packets); - fprintf(stdout, "packet fragments lost: %u\n", (unsigned int) lost_packet_fragments); - fprintf(stdout, "Total number of DNS packets: %u\n", (unsigned int) total_nr_of_dns_packets); - fprintf(stdout, "Total number of DNS packets after filter: %u\n", (unsigned int) total_nr_of_filtered_packets); - } - if (count->match) { - print_counters(stdout, count, show_percentages, total_nr_of_filtered_packets, 0); - } - if (uniques->match) { - print_counters(stdout, uniques, show_percentages, total_nr_of_filtered_packets, unique_minimum); - if (show_averages) { - print_counter_averages(stdout, uniques, NULL); - } - if (show_average_count) { - print_counter_average_count(stdout, uniques, NULL, true); - } - } - - exit: - - free_match_expression(expr); - free_counters(count); - free_counters(uniques); - - return status; -} - -#else -int main() { - fprintf(stderr, "ldns-dpa was not built because there is no pcap library on this system, or there was no pcap header file at compilation time. Please install pcap and rebuild.\n"); - return 1; -} -#endif -#else -int main() { - fprintf(stderr, "ldns-dpa was not built because there is no pcap library on this system, or there was no pcap header file at compilation time. Please install pcap and rebuild.\n"); - return 1; -} -#endif - - diff --git a/libs/ldns/examples/ldns-key2ds.1 b/libs/ldns/examples/ldns-key2ds.1 deleted file mode 100644 index 6fdbee5f1a..0000000000 --- a/libs/ldns/examples/ldns-key2ds.1 +++ /dev/null @@ -1,41 +0,0 @@ -.TH ldns-key2ds 1 "30 May 2005" -.SH NAME -ldns-key2ds \- transform a DNSKEY RR to a DS RR -.SH SYNOPSIS -.B ldns-key2ds -.IR file - -.SH DESCRIPTION -\fBldns-key2ds\fR is used to transform a public DNSKEY RR to a DS RR. -When run it will read \fIfile\fR with a DNSKEY RR in it and -it will create a .ds file with the DS RR in it. - -It prints out the basename for this file (K++). - -By default it takes a pick of algorithm similar to the key algorithm, -SHA1 for RSASHA1, and so on. - -.SH OPTIONS -.TP -\fB-n\fR -Write the result DS Resource Record to stdout instead of a file - -.TP -\fB-1\fR -Use SHA1 as the hash function. - -.TP -\fB-2\fR -Use SHA256 as the hash function - - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-key2ds.c b/libs/ldns/examples/ldns-key2ds.c deleted file mode 100644 index a3e54383ab..0000000000 --- a/libs/ldns/examples/ldns-key2ds.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - * key2ds transforms a public key into its DS - * It (currently) prints out the public key - * - * (c) NLnet Labs, 2005 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" - -#include - -#include - -static void -usage(FILE *fp, char *prog) { - fprintf(fp, "%s [-fn] [-1|-2] keyfile\n", prog); - fprintf(fp, " Generate a DS RR from the DNSKEYS in keyfile\n"); - fprintf(fp, " The following file will be created: "); - fprintf(fp, "K++.ds\n"); - fprintf(fp, " The base name (K++ will be printed to stdout\n"); - fprintf(fp, "Options:\n"); - fprintf(fp, " -f: ignore SEP flag (i.e. make DS records for any key)\n"); - fprintf(fp, " -n: do not write DS records to file(s) but to stdout\n"); - fprintf(fp, " (default) use similar hash to the key algorithm.\n"); - fprintf(fp, " -1: use SHA1 for the DS hash\n"); - fprintf(fp, " -2: use SHA256 for the DS hash\n"); -#ifdef USE_GOST - fprintf(fp, " -g: use GOST for the DS hash\n"); -#endif -#ifdef USE_ECDSA - fprintf(fp, " -4: use SHA384 for the DS hash\n"); -#endif -} - -static int -is_suitable_dnskey(ldns_rr *rr, int sep_only) -{ - if (!rr || ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) { - return 0; - } - return !sep_only || - (ldns_rdf2native_int16(ldns_rr_dnskey_flags(rr)) & - LDNS_KEY_SEP_KEY); -} - -static ldns_hash -suitable_hash(ldns_signing_algorithm algorithm) -{ - switch (algorithm) { - case LDNS_SIGN_RSASHA256: - case LDNS_SIGN_RSASHA512: - return LDNS_SHA256; - case LDNS_SIGN_ECC_GOST: -#ifdef USE_GOST - return LDNS_HASH_GOST; -#else - return LDNS_SHA256; -#endif -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - return LDNS_SHA256; - case LDNS_SIGN_ECDSAP384SHA384: - return LDNS_SHA384; -#endif - default: - return LDNS_SHA1; - } - return LDNS_SHA1; -} - -int -main(int argc, char *argv[]) -{ - FILE *keyfp, *dsfp; - char *keyname; - char *dsname; - char *owner; - ldns_rr *k, *ds; - ldns_signing_algorithm alg; - ldns_hash h; - int similar_hash=1; - char *program = argv[0]; - int nofile = 0; - ldns_rdf *origin = NULL; - ldns_status result = LDNS_STATUS_OK; - int sep_only = 1; - - alg = 0; - h = LDNS_SHA1; - - argv++, argc--; - while (argc && argv[0][0] == '-') { - if (strcmp(argv[0], "-1") == 0) { - h = LDNS_SHA1; - similar_hash = 0; - } - if (strcmp(argv[0], "-2") == 0) { - h = LDNS_SHA256; - similar_hash = 0; - } -#ifdef USE_GOST - if (strcmp(argv[0], "-g") == 0) { - if(!ldns_key_EVP_load_gost_id()) { - fprintf(stderr, "error: libcrypto does not provide GOST\n"); - exit(EXIT_FAILURE); - } - h = LDNS_HASH_GOST; - similar_hash = 0; - } -#endif -#ifdef USE_ECDSA - if (strcmp(argv[0], "-4") == 0) { - h = LDNS_SHA384; - similar_hash = 0; - } -#endif - if (strcmp(argv[0], "-f") == 0) { - sep_only = 0; - } - if (strcmp(argv[0], "-n") == 0) { - nofile=1; - } - argv++, argc--; - } - - if (argc != 1) { - usage(stderr, program); - exit(EXIT_FAILURE); - } - keyname = strdup(argv[0]); - - keyfp = fopen(keyname, "r"); - if (!keyfp) { - fprintf(stderr, "Failed to open public key file %s: %s\n", keyname, - strerror(errno)); - exit(EXIT_FAILURE); - } - - while (result == LDNS_STATUS_OK) { - result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); - while (result == LDNS_STATUS_SYNTAX_ORIGIN || - result == LDNS_STATUS_SYNTAX_TTL || - (result == LDNS_STATUS_OK && !is_suitable_dnskey(k, sep_only)) - ) { - if (result == LDNS_STATUS_OK) { - ldns_rr_free(k); - } - result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); - } - if (result == LDNS_STATUS_SYNTAX_EMPTY) { - /* we're done */ - break; - } - if (result != LDNS_STATUS_OK) { - fprintf(stderr, "Could not read public key from file %s: %s\n", keyname, ldns_get_errorstr_by_id(result)); - exit(EXIT_FAILURE); - } - - owner = ldns_rdf2str(ldns_rr_owner(k)); - alg = ldns_rdf2native_int8(ldns_rr_dnskey_algorithm(k)); - if(similar_hash) - h = suitable_hash(alg); - - ds = ldns_key_rr2ds(k, h); - if (!ds) { - fprintf(stderr, "Conversion to a DS RR failed\n"); - ldns_rr_free(k); - free(owner); - exit(EXIT_FAILURE); - } - - /* print the public key RR to .key */ - dsname = LDNS_XMALLOC(char, strlen(owner) + 16); - snprintf(dsname, strlen(owner) + 15, "K%s+%03u+%05u.ds", owner, alg, (unsigned int) ldns_calc_keytag(k)); - - if (nofile) - ldns_rr_print(stdout,ds); - else { - dsfp = fopen(dsname, "w"); - if (!dsfp) { - fprintf(stderr, "Unable to open %s: %s\n", dsname, strerror(errno)); - exit(EXIT_FAILURE); - } else { - ldns_rr_print(dsfp, ds); - fclose(dsfp); - fprintf(stdout, "K%s+%03u+%05u\n", owner, alg, (unsigned int) ldns_calc_keytag(k)); - } - } - - ldns_rr_free(ds); - ldns_rr_free(k); - free(owner); - LDNS_FREE(dsname); - } - fclose(keyfp); - free(keyname); - exit(EXIT_SUCCESS); -} diff --git a/libs/ldns/examples/ldns-keyfetcher.1 b/libs/ldns/examples/ldns-keyfetcher.1 deleted file mode 100644 index 6ddc14eacf..0000000000 --- a/libs/ldns/examples/ldns-keyfetcher.1 +++ /dev/null @@ -1,64 +0,0 @@ -.TH ldns-keyfetcher 1 "4 Apr 2006" -.SH NAME -ldns-keyfetcher \- retrieve the DNSSEC DNSKEYs for a zone -.SH SYNOPSIS -.B ldns-keyfetcher -[ -.IR OPTIONS -] -.IR DOMAIN - -.SH DESCRIPTION -\fBldns-keyfetcher\fR is used to retrieve the DNSKEYs of a zone. - -First it finds all authoritative nameservers of the zone by tracing it from -the root down. All authoritative nameservers are then queried (using TCP) -for the DNSKEY RRset of the zone apex. If the results are all the same, -the key resource record set is printed. - - -.SH OPTIONS -\fB-4\fR \fI\fR -Only use IPv4 - -\fB-6\fR \fI\fR -Only use IPv6 - -\fB-h\fR \fI\fR -Show a help text and exit - -\fB-i\fR -Insecurer mode; there will only be one query for the DNSKEYS. There will not -be crosschecking of all authoritative nameservers. - -\fB-v\fR \fIverbosity\fR - -Set the verbosity level. The following levels are available: - - 0: default, only print the DNSKEY RRset found, or an error on failure. - 1: Show the nameservers that are queried - 2: Show more info on what is checked - 3: Show the intermediate results (authority and dnskey rrsets) - 4: Print the answer packets that are returned - -\fB-r\fR \fIfile\fR - -Use file as the root hints file, should contain A records in presentation -format. The default is /etc/named.root. You can get this file from -http://www.internic.net/zones/named.root. - -\fB-s\fR \fI\fR -Don't print the keys to stdout, but store them in files. - -The filenames will be of the format K.+.+.key - -.SH AUTHOR -Written by Jelte Jansen for NLnet Labs. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2006 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-keyfetcher.c b/libs/ldns/examples/ldns-keyfetcher.c deleted file mode 100644 index c24f5111fe..0000000000 --- a/libs/ldns/examples/ldns-keyfetcher.c +++ /dev/null @@ -1,724 +0,0 @@ -/* - * ldns-keyfetcher retrieves the DNSKEYS for a certain domain - * It traces the authoritatives nameservers down from the root - * And uses TCP, to minimize spoofing danger. - * - * (c) NLnet Labs, 2006 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" -#include -#include - -int verbosity = 0; -/* 0=use both ip4 and ip6 (default). 1=ip4only. 2=ip6only. */ -uint8_t address_family = 0; -bool store_in_file = false; - -static void -usage(FILE *fp, char *prog) { - fprintf(fp, "%s domain\n", prog); - fprintf(fp, " retrieve the dnskeys for a domain\n"); - fprintf(fp, "Options:\n"); - fprintf(fp, "-4\t\tUse IPv4 only\n"); - fprintf(fp, "-6\t\tUse IPv6 only\n"); - fprintf(fp, "-h\t\tShow this help\n"); - fprintf(fp, "-i\t\tInsecurer mode; don't do checks, just query for the keys\n"); - fprintf(fp, "-r \tUse file to read root hints from\n"); - fprintf(fp, "-s\t\tDon't print the keys but store them in files\n\t\tcalled K.+.+.key\n"); - fprintf(fp, "-v \tVerbosity level (0-5, not verbose-very verbose)\n"); -} - -static ldns_rr_list * -retrieve_dnskeys(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, - ldns_rr_class c, ldns_rr_list *dns_root) -{ - ldns_resolver *res; - ldns_pkt *p; - ldns_rr_list *new_nss_a; - ldns_rr_list *new_nss_aaaa; - ldns_rr_list *final_answer; - ldns_rr_list *new_nss; - ldns_rr_list *ns_addr; - ldns_rr_list *ns_addr2; - uint16_t loop_count; - ldns_rdf *pop; - ldns_status status; - size_t i; - - size_t nss_i; - ldns_rr_list *answer_list = NULL; - ldns_rr_list *authority_list = NULL; - - size_t last_nameserver_count; - ldns_rdf **last_nameservers; - - loop_count = 0; - new_nss_a = NULL; - new_nss_aaaa = NULL; - new_nss = NULL; - ns_addr = NULL; - ns_addr2 = NULL; - final_answer = NULL; - p = ldns_pkt_new(); - res = ldns_resolver_new(); - - if (!p || !res) { - fprintf(stderr, "Memory allocation failed"); - return NULL; - } - - if (verbosity >= 2) { - printf("Finding dnskey data for zone: "); - ldns_rdf_print(stdout, name); - printf("\n\n"); - } - - /* transfer some properties of local_res to res, - * because they were given on the commandline */ - ldns_resolver_set_ip6(res, - ldns_resolver_ip6(local_res)); - ldns_resolver_set_port(res, - ldns_resolver_port(local_res)); - ldns_resolver_set_debug(res, - ldns_resolver_debug(local_res)); - ldns_resolver_set_dnssec(res, - ldns_resolver_dnssec(local_res)); - ldns_resolver_set_fail(res, - ldns_resolver_fail(local_res)); - ldns_resolver_set_usevc(res, - ldns_resolver_usevc(local_res)); - ldns_resolver_set_random(res, - ldns_resolver_random(local_res)); - ldns_resolver_set_recursive(res, false); - - /* setup the root nameserver in the new resolver */ - status = ldns_resolver_push_nameserver_rr_list(res, dns_root); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error setting root nameservers in resolver: %s\n", ldns_get_errorstr_by_id(status)); - return NULL; - } - - ldns_pkt_free(p); - status = ldns_resolver_send(&p, res, name, t, c, 0); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error querying root servers: %s\n", ldns_get_errorstr_by_id(status)); - return NULL; - } - - if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { - printf("Error in packet:\n"); - ldns_pkt_print(stdout, p); - return NULL; - } - - if (verbosity >= 4) { - ldns_pkt_print(stdout, p); - printf("\n\n"); - } - - /* from now on, use TCP */ - ldns_resolver_set_usevc(res, true); - - while(status == LDNS_STATUS_OK && - ldns_pkt_reply_type(p) == LDNS_PACKET_REFERRAL) { - - if (verbosity >= 3) { - printf("This is a delegation!\n\n"); - } - if (address_family == 0 || address_family == 1) { - new_nss_a = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); - } else { - new_nss_a = ldns_rr_list_new(); - } - if (address_family == 0 || address_family == 2) { - new_nss_aaaa = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_AAAA, LDNS_SECTION_ADDITIONAL); - } else { - new_nss_aaaa = ldns_rr_list_new(); - } - new_nss = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); - - /* remove the old nameserver from the resolver */ - while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } - - /* also check for new_nss emptyness */ - - if (!new_nss_aaaa && !new_nss_a) { - /* - * no nameserver found!!! - * try to resolve the names we do got - */ - if (verbosity >= 3) { - printf("Did not get address record for nameserver, doing seperate query.\n"); - } - ns_addr = ldns_rr_list_new(); - for(i = 0; (size_t) i < ldns_rr_list_rr_count(new_nss); i++) { - /* get the name of the nameserver */ - pop = ldns_rr_rdf(ldns_rr_list_rr(new_nss, i), 0); - if (!pop) { - break; - } - - /* retrieve it's addresses */ - ns_addr2 = ldns_get_rr_list_addr_by_name(local_res, pop, c, 0); - if (!ldns_rr_list_cat(ns_addr, ns_addr2)) { - fprintf(stderr, "Internal error adding nameserver address.\n"); - exit(EXIT_FAILURE); - } - ldns_rr_list_free(ns_addr2); - } - - if (ns_addr) { - if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != - LDNS_STATUS_OK) { - fprintf(stderr, "Error adding new nameservers"); - ldns_pkt_free(p); - return NULL; - } - ldns_rr_list_deep_free(ns_addr); - } else { - ldns_rr_list_print(stdout, ns_addr); - fprintf(stderr, "Could not find the nameserver ip addr; abort"); - ldns_pkt_free(p); - return NULL; - } - } - - /* normally, the first working ns is used, but we need all now, so do it one by one - * if the answer is null, take it from the next resolver - * if the answer is not, compare it to that of the next resolver - * error if different, continue if the same - * if answer list null and no resolvers left die. - */ - - ldns_rr_list_deep_free(answer_list); - ldns_rr_list_deep_free(authority_list); - answer_list = NULL; - authority_list = NULL; - for (nss_i = 0; nss_i < ldns_rr_list_rr_count(new_nss_aaaa); nss_i++) { - while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } - - status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); - } - - if (verbosity >= 1) { - fprintf(stdout, "Querying nameserver: "); - ldns_rdf_print(stdout, ldns_rr_owner(ldns_rr_list_rr(new_nss_aaaa, nss_i))); - fprintf(stdout, " ("); - ldns_rdf_print(stdout, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); - fprintf(stdout, ")\n"); - } - status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); - } - - ldns_pkt_free(p); - status = ldns_resolver_send(&p, res, name, t, c, 0); - if (status == LDNS_STATUS_OK && p) { - if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { - printf("Error in packet:\n"); - ldns_pkt_print(stdout, p); - return NULL; - } - - if (verbosity >= 4) { - ldns_pkt_print(stdout, p); - printf("\n\n"); - } - - if (answer_list) { - if (verbosity >= 2) { - printf("Comparing answer list of answer to previous\n\n"); - } - ldns_rr_list_sort(ldns_pkt_answer(p)); - ldns_rr_list_sort(answer_list); - if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { - fprintf(stderr, "ERROR: different answer answer from nameserver\n"); - fprintf(stderr, "\nI had (from previous servers):\n"); - ldns_rr_list_print(stderr, answer_list); - fprintf(stderr, "\nI received (from nameserver at "); - ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); - fprintf(stderr, "):\n"); - ldns_rr_list_print(stderr, ldns_pkt_answer(p)); - exit(EXIT_FAILURE); - } - } else { - answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); - ldns_rr_list_sort(answer_list); - if (verbosity >= 2) { - printf("First answer list for this set, nothing to compare with\n\n"); - } - } - if (authority_list) { - if (verbosity >= 2) { - printf("Comparing authority list of answer to previous\n\n"); - } - ldns_rr_list_sort(ldns_pkt_authority(p)); - ldns_rr_list_sort(authority_list); - if (ldns_rr_list_compare(authority_list, ldns_pkt_authority(p)) != 0) { - fprintf(stderr, "ERROR: different authority answer from nameserver\n"); - fprintf(stderr, "\nI had (from previous servers):\n"); - ldns_rr_list_print(stderr, authority_list); - fprintf(stderr, "\nI received (from nameserver at "); - ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); - fprintf(stderr, "):\n"); - ldns_rr_list_print(stderr, ldns_pkt_authority(p)); - exit(EXIT_FAILURE); - } - } else { - authority_list = ldns_rr_list_clone(ldns_pkt_authority(p)); - ldns_rr_list_sort(authority_list); - if (verbosity >= 2) { - printf("First authority list for this set, nothing to compare with\n\n"); - } - if (verbosity >= 3) { - printf("NS RRset:\n"); - ldns_rr_list_print(stdout, authority_list); - printf("\n"); - } - } - } - } - - ldns_rr_list_deep_free(answer_list); - ldns_rr_list_deep_free(authority_list); - answer_list = NULL; - authority_list = NULL; - for (nss_i = 0; nss_i < ldns_rr_list_rr_count(new_nss_a); nss_i++) { - - while((pop = ldns_resolver_pop_nameserver(res))) {ldns_rdf_deep_free(pop); } - - if (verbosity >= 1) { - fprintf(stdout, "Querying nameserver: "); - ldns_rdf_print(stdout, ldns_rr_owner(ldns_rr_list_rr(new_nss_a, nss_i))); - fprintf(stdout, " ("); - ldns_rdf_print(stdout, ldns_rr_rdf(ldns_rr_list_rr(new_nss_a, nss_i), 0)); - fprintf(stdout, ")\n"); - } - status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_a, nss_i), 0)); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); - } - - ldns_pkt_free(p); - status = ldns_resolver_send(&p, res, name, t, c, 0); - - if (status == LDNS_STATUS_OK) { - if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { - printf("Error in packet:\n"); - ldns_pkt_print(stdout, p); - return NULL; - } - - if (verbosity >= 4) { - ldns_pkt_print(stdout, p); - printf("\n\n"); - } - - if (answer_list) { - if (verbosity >= 2) { - printf("Comparing answer list of answer to previous\n\n"); - } - ldns_rr_list_sort(ldns_pkt_answer(p)); - ldns_rr_list_sort(answer_list); - if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { - fprintf(stderr, "ERROR: different answer answer from nameserver\n"); - fprintf(stderr, "\nI had (from previous servers):\n"); - ldns_rr_list_print(stderr, answer_list); - fprintf(stderr, "\nI received (from nameserver at "); - ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); - fprintf(stderr, "):\n"); - ldns_rr_list_print(stderr, ldns_pkt_answer(p)); - exit(EXIT_FAILURE); - } - } else { - if (verbosity >= 2) { - printf("First answer list for this set, nothing to compare with\n\n"); - } - answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); - ldns_rr_list_sort(answer_list); - } - if (authority_list) { - if (verbosity >= 2) { - printf("Comparing authority list of answer to previous\n\n"); - } - ldns_rr_list_sort(ldns_pkt_authority(p)); - ldns_rr_list_sort(authority_list); - if (ldns_rr_list_compare(authority_list, ldns_pkt_authority(p)) != 0) { - fprintf(stderr, "ERROR: different authority answer from nameserver\n"); - fprintf(stderr, "\nI had (from previous servers):\n"); - ldns_rr_list_print(stderr, authority_list); - fprintf(stderr, "\nI received (from nameserver at "); - ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); - fprintf(stderr, "):\n"); - ldns_rr_list_print(stderr, ldns_pkt_authority(p)); - exit(EXIT_FAILURE); - } - } else { - if (verbosity >= 2) { - printf("First authority list for this set, nothing to compare with\n\n"); - } - authority_list = ldns_rr_list_clone(ldns_pkt_authority(p)); - ldns_rr_list_sort(authority_list); - if (verbosity >= 3) { - printf("NS RRset:\n"); - ldns_rr_list_print(stdout, authority_list); - printf("\n"); - } - } - } - } - ldns_rr_list_deep_free(authority_list); - authority_list = NULL; - - if (loop_count++ > 20) { - /* unlikely that we are doing something usefull */ - fprintf(stderr, "Looks like we are looping"); - ldns_pkt_free(p); - return NULL; - } - - ldns_pkt_free(p); - - if (verbosity >= 3) { - fprintf(stdout, "This level ok. Continuing to next.\n\n"); - } - - status = ldns_resolver_send(&p, res, name, t, c, 0); - - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error querying root servers: %s\n", ldns_get_errorstr_by_id(status)); - return NULL; - } - - if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { - printf("Error in packet:\n"); - ldns_pkt_print(stdout, p); - return NULL; - } - - if (verbosity >= 4) { - ldns_pkt_print(stdout, p); - printf("\n\n"); - } - - - ldns_rr_list_deep_free(new_nss_aaaa); - ldns_rr_list_deep_free(new_nss_a); - ldns_rr_list_deep_free(new_nss); - new_nss_aaaa = NULL; - new_nss_a = NULL; - ns_addr = NULL; - } - - ldns_rr_list_deep_free(answer_list); - answer_list = NULL; - /* clone the nameserver list, we are going to handle them one by one */ - last_nameserver_count = 0; - last_nameservers = LDNS_XMALLOC(ldns_rdf *, ldns_resolver_nameserver_count(res)); - - pop = NULL; - while((pop = ldns_resolver_pop_nameserver(res))) { - last_nameservers[last_nameserver_count] = pop; - last_nameserver_count++; - } - - for (nss_i = 0; nss_i < last_nameserver_count; nss_i++) { - /* remove previous nameserver */ - while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } - - if (verbosity >= 1) { - printf("Querying nameserver: "); - ldns_rdf_print(stdout, last_nameservers[nss_i]); - printf("\n"); - } - status = ldns_resolver_push_nameserver(res, last_nameservers[nss_i]); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); - } - - ldns_pkt_free(p); - status = ldns_resolver_send(&p, res, name, t, c, 0); - - if (!p) { - fprintf(stderr, "no packet received\n"); - return NULL; - } - - if (status == LDNS_STATUS_RES_NO_NS) { - fprintf(stderr, "Error: nameserver at "); - ldns_rdf_print(stderr, last_nameservers[nss_i]); - fprintf(stderr, " not responding. Unable to check RRset here, aborting.\n"); - return NULL; - } - - if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { - printf("Error in packet:\n"); - ldns_pkt_print(stdout, p); - return NULL; - } - - if (answer_list) { - if (verbosity >= 2) { - printf("1Comparing answer rr list of answer to previous\n"); - } - ldns_rr_list_sort(ldns_pkt_answer(p)); - ldns_rr_list_sort(answer_list); - if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { - printf("ERROR: different answer section in response from nameserver\n"); - fprintf(stderr, "\nI had:\n"); - ldns_rr_list_print(stderr, answer_list); - fprintf(stderr, "\nI received (from nameserver at "); - ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); - fprintf(stderr, "):\n"); - ldns_rr_list_print(stderr, ldns_pkt_answer(p)); - exit(EXIT_FAILURE); - } - } else { - if (verbosity >= 2) { - printf("First answer rr list for this set, nothing to compare with\n"); - } - answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); - if (verbosity >= 3) { - printf("DNSKEY RRset:\n"); - ldns_rr_list_print(stdout, answer_list); - } - } - - } - - for (nss_i = 0; nss_i < last_nameserver_count; nss_i++) { - ldns_rdf_deep_free(last_nameservers[nss_i]); - } - LDNS_FREE(last_nameservers); - ldns_resolver_deep_free(res); - ldns_pkt_free(p); - return answer_list; -} - - -/* - * The file with the given path should contain a list of NS RRs - * for the root zone and A records for those NS RRs. - * Read them, check them, and append the a records to the rr list given. - */ -ldns_rr_list * -read_root_hints(const char *filename) -{ - FILE *fp = NULL; - int line_nr = 0; - ldns_zone *z; - ldns_status status; - ldns_rr_list *addresses = NULL; - ldns_rr *rr; - size_t i; - - fp = fopen(filename, "r"); - if (!fp) { - fprintf(stderr, "Unable to open %s for reading: %s\n", filename, strerror(errno)); - return NULL; - } - - status = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, 0, &line_nr); - fclose(fp); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Error reading root hints file: %s\n", ldns_get_errorstr_by_id(status)); - return NULL; - } else { - addresses = ldns_rr_list_new(); - for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { - rr = ldns_rr_list_rr(ldns_zone_rrs(z), i); - if ((address_family == 0 || address_family == 1) && - ldns_rr_get_type(rr) == LDNS_RR_TYPE_A ) { - ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); - } - if ((address_family == 0 || address_family == 2) && - ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) { - ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); - } - } - ldns_zone_deep_free(z); - return addresses; - } -} - - -int -main(int argc, char *argv[]) -{ - ldns_resolver *res; - ldns_rdf *ns; - ldns_rdf *domain; - ldns_rr_list *l = NULL; - - ldns_rr_list *dns_root = NULL; - const char *root_file = "/etc/named.root"; - - ldns_status status; - - int i; - - char *domain_str; - char *outputfile_str; - ldns_buffer *outputfile_buffer; - FILE *outputfile; - ldns_rr *k; - - bool insecure = false; - ldns_pkt *pkt; - - domain = NULL; - res = NULL; - - if (argc < 2) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } else { - for (i = 1; i < argc; i++) { - if (strncmp("-4", argv[i], 3) == 0) { - if (address_family != 0) { - fprintf(stderr, "Options -4 and -6 cannot be specified at the same time\n"); - exit(EXIT_FAILURE); - } - address_family = 1; - } else if (strncmp("-6", argv[i], 3) == 0) { - if (address_family != 0) { - fprintf(stderr, "Options -4 and -6 cannot be specified at the same time\n"); - exit(EXIT_FAILURE); - } - address_family = 2; - } else if (strncmp("-h", argv[i], 3) == 0) { - usage(stdout, argv[0]); - exit(EXIT_SUCCESS); - } else if (strncmp("-i", argv[i], 2) == 0) { - insecure = true; - } else if (strncmp("-r", argv[i], 2) == 0) { - if (strlen(argv[i]) > 2) { - root_file = argv[i]+2; - } else if (i+1 >= argc) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } else { - root_file = argv[i+1]; - i++; - } - } else if (strncmp("-s", argv[i], 3) == 0) { - store_in_file = true; - } else if (strncmp("-v", argv[i], 2) == 0) { - if (strlen(argv[i]) > 2) { - verbosity = atoi(argv[i]+2); - } else if (i+1 > argc) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } else { - verbosity = atoi(argv[i+1]); - i++; - } - } else { - /* create a rdf from the command line arg */ - if (domain) { - fprintf(stdout, "You can only specify one domain at a time\n"); - exit(EXIT_FAILURE); - } - - domain = ldns_dname_new_frm_str(argv[i]); - } - - } - if (!domain) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } - } - - dns_root = read_root_hints(root_file); - if (!dns_root) { - fprintf(stderr, "cannot read the root hints file\n"); - exit(EXIT_FAILURE); - } - - /* create a new resolver from /etc/resolv.conf */ - status = ldns_resolver_new_frm_file(&res, NULL); - - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Warning: Unable to create stub resolver from /etc/resolv.conf:\n"); - fprintf(stderr, "%s\n", ldns_get_errorstr_by_id(status)); - fprintf(stderr, "defaulting to nameserver at 127.0.0.1 for separate nameserver name lookups\n"); - res = ldns_resolver_new(); - ns = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, "127.0.0.1"); - status = ldns_resolver_push_nameserver(res, ns); - if (status != LDNS_STATUS_OK) { - fprintf(stderr, "Unable to create stub resolver: %s\n", ldns_get_errorstr_by_id(status)); - exit(EXIT_FAILURE); - } - ldns_rdf_deep_free(ns); - } - - ldns_resolver_set_ip6(res, address_family); - - if (insecure) { - pkt = ldns_resolver_query(res, domain, LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, LDNS_RD); - if (pkt) { - l = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_DNSKEY, LDNS_SECTION_ANY_NOQUESTION); - } - } else { - l = retrieve_dnskeys(res, domain, LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, dns_root); - } - - /* separator for result data and verbosity data */ - if (verbosity > 0) { - fprintf(stdout, "; ---------------------------\n"); - fprintf(stdout, "; Got the following keys:\n"); - } - if (l) { - if (store_in_file) { - /* create filename: - * K.+.+.key - */ - for (i = 0; (size_t) i < ldns_rr_list_rr_count(l); i++) { - k = ldns_rr_list_rr(l, (size_t) i); - - outputfile_buffer = ldns_buffer_new(300); - domain_str = ldns_rdf2str(ldns_rr_owner(k)); - ldns_buffer_printf(outputfile_buffer, "K%s+%03u+%05u.key", domain_str, ldns_rdf2native_int8(ldns_rr_rdf(k, 2)), - (unsigned int) ldns_calc_keytag(k)); - outputfile_str = ldns_buffer_export(outputfile_buffer); - - if (verbosity >= 1) { - fprintf(stdout, "Writing key to file %s\n", outputfile_str); - } - - outputfile = fopen(outputfile_str, "w"); - if (!outputfile) { - fprintf(stderr, "Error writing key to file %s: %s\n", outputfile_str, strerror(errno)); - } else { - ldns_rr_print(outputfile, k); - fclose(outputfile); - } - - LDNS_FREE(domain_str); - LDNS_FREE(outputfile_str); - LDNS_FREE(outputfile_buffer); - } - } else { - ldns_rr_list_print(stdout, l); - } - } else { - fprintf(stderr, "no answer packet received, stub resolver config:\n"); - ldns_resolver_print(stderr, res); - } - printf("\n"); - - ldns_rdf_deep_free(domain); - ldns_resolver_deep_free(res); - ldns_rr_list_deep_free(l); - ldns_rr_list_deep_free(dns_root); - return EXIT_SUCCESS; -} diff --git a/libs/ldns/examples/ldns-keygen.1 b/libs/ldns/examples/ldns-keygen.1 deleted file mode 100644 index 36124d52a4..0000000000 --- a/libs/ldns/examples/ldns-keygen.1 +++ /dev/null @@ -1,53 +0,0 @@ -.TH ldns-keygen 1 "27 May 2008" -.SH NAME -ldns-keygen \- generate a DNSSEC key pair -.SH SYNOPSIS -.B ldns-keygen -[ -.IR OPTION -] -.IR DOMAIN - -.SH DESCRIPTION -\fBldns-keygen\fR is used to generate a private/public keypair. When run, it -will create 3 files; a .key file with the public DNSKEY, a .private -file with the private keydata and a .ds with the DS record of the -DNSKEY record. - -It prints out the basename for these files: K++ - -.SH OPTIONS -.TP -\fB-a \fI\fR -Create a key with this algorithm. Specifying 'list' here gives a list of supported algorithms. -Several alias names are also accepted (from older versions and other software), -the list gives names from the RFC. Also the plain algo number is accepted. - -.TP -\fB-b \fI\fR -Use this many bits for the key length. - -.TP -\fB-k\fR -When given, generate a key signing key. This just sets the flag field to -257 instead of 256 in the DNSKEY RR in the .key file. - -.TP -\fB-r \fIdevice\fR -Make ldns-keygen use this file to seed the random generator with. This will -default to /dev/random. - -.TP -\fB-v\fR -Show the version and exit - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005-2008 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-keygen.c b/libs/ldns/examples/ldns-keygen.c deleted file mode 100644 index 576541790c..0000000000 --- a/libs/ldns/examples/ldns-keygen.c +++ /dev/null @@ -1,307 +0,0 @@ -/* - * keygen is a small programs that generate a dnskey and private key - * for a particular domain. - * - * (c) NLnet Labs, 2005 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" - -#include - -#include - -#ifdef HAVE_SSL -static void -usage(FILE *fp, char *prog) { - fprintf(fp, "%s -a [-b bits] [-r /dev/random] [-v] domain\n", - prog); - fprintf(fp, " generate a new key pair for domain\n"); - fprintf(fp, " -a \tuse the specified algorithm (-a list to"); - fprintf(fp, " show a list)\n"); - fprintf(fp, " -k\t\tset the flags to 257; key signing key\n"); - fprintf(fp, " -b \tspecify the keylength\n"); - fprintf(fp, " -r \tspecify a random device (defaults to /dev/random)\n"); - fprintf(fp, "\t\tto seed the random generator with\n"); - fprintf(fp, " -v\t\tshow the version and exit\n"); - fprintf(fp, " The following files will be created:\n"); - fprintf(fp, " K++.key\tPublic key in RR format\n"); - fprintf(fp, " K++.private\tPrivate key in key format\n"); - fprintf(fp, " K++.ds\tDS in RR format (only for DNSSEC keys)\n"); - fprintf(fp, " The base name (K++ will be printed to stdout\n"); -} - -static void -show_algorithms(FILE *out) -{ - ldns_lookup_table *lt = ldns_signing_algorithms; - fprintf(out, "Possible algorithms:\n"); - - while (lt->name) { - fprintf(out, "%s\n", lt->name); - lt++; - } -} - -int -main(int argc, char *argv[]) -{ - int c; - char *prog; - - /* default key size */ - uint16_t def_bits = 1024; - uint16_t bits = def_bits; - bool ksk; - - FILE *file; - FILE *random; - char *filename; - char *owner; - - ldns_signing_algorithm algorithm; - ldns_rdf *domain; - ldns_rr *pubkey; - ldns_key *key; - ldns_rr *ds; - - prog = strdup(argv[0]); - algorithm = 0; - random = NULL; - ksk = false; /* don't create a ksk per default */ - - while ((c = getopt(argc, argv, "a:kb:r:v25")) != -1) { - switch (c) { - case 'a': - if (algorithm != 0) { - fprintf(stderr, "The -a argument can only be used once\n"); - exit(1); - } - if (strncmp(optarg, "list", 5) == 0) { - show_algorithms(stdout); - exit(EXIT_SUCCESS); - } - algorithm = ldns_get_signing_algorithm_by_name(optarg); - if (algorithm == 0) { - fprintf(stderr, "Algorithm %s not found\n", optarg); - show_algorithms(stderr); - exit(EXIT_FAILURE); - } - break; - case 'b': - bits = (uint16_t) atoi(optarg); - if (bits == 0) { - fprintf(stderr, "%s: %s %d", prog, "Can not parse the -b argument, setting it to the default\n", (int) def_bits); - bits = def_bits; - } - break; - case 'k': - ksk = true; - break; - case 'r': - random = fopen(optarg, "r"); - if (!random) { - fprintf(stderr, "Cannot open random file %s: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - break; - case 'v': - printf("DNSSEC key generator version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); - exit(EXIT_SUCCESS); - break; - default: - usage(stderr, prog); - exit(EXIT_FAILURE); - } - } - argc -= optind; - argv += optind; - - if (algorithm == 0) { - printf("Please use the -a argument to provide an algorithm\n"); - exit(1); - } - - if (argc != 1) { - usage(stderr, prog); - exit(EXIT_FAILURE); - } - free(prog); - - /* check whether key size is within RFC boundaries */ - switch (algorithm) { - case LDNS_SIGN_RSAMD5: - case LDNS_SIGN_RSASHA1: - if (bits < 512 || bits > 4096) { - fprintf(stderr, "For RSA, the key size must be between "); - fprintf(stderr, " 512 and 4096 bytes. Aborting.\n"); - exit(1); - } - break; - case LDNS_SIGN_DSA: - if (bits < 512 || bits > 4096) { - fprintf(stderr, "For DSA, the key size must be between "); - fprintf(stderr, " 512 and 1024 bytes. Aborting.\n"); - exit(1); - } - break; -#ifdef USE_GOST - case LDNS_SIGN_ECC_GOST: - if(!ldns_key_EVP_load_gost_id()) { - fprintf(stderr, "error: libcrypto does not provide GOST\n"); - exit(EXIT_FAILURE); - } - break; -#endif -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - case LDNS_SIGN_ECDSAP384SHA384: -#endif - case LDNS_SIGN_HMACMD5: - case LDNS_SIGN_HMACSHA1: - case LDNS_SIGN_HMACSHA256: - default: - break; - } - - if (!random) { - random = fopen("/dev/random", "r"); - if (!random) { - fprintf(stderr, "Cannot open random file %s: %s\n", optarg, strerror(errno)); - exit(EXIT_FAILURE); - } - } - - (void)ldns_init_random(random, (unsigned int) bits/8); - fclose(random); - - /* create an rdf from the domain name */ - domain = ldns_dname_new_frm_str(argv[0]); - - /* generate a new key */ - key = ldns_key_new_frm_algorithm(algorithm, bits); - - /* set the owner name in the key - this is a /seperate/ step */ - ldns_key_set_pubkey_owner(key, domain); - - /* ksk flag */ - if (ksk) { - ldns_key_set_flags(key, ldns_key_flags(key) + 1); - } - - /* create the public from the ldns_key */ - pubkey = ldns_key2rr(key); - if (!pubkey) { - fprintf(stderr, "Could not extract the public key from the key structure..."); - ldns_key_deep_free(key); - exit(EXIT_FAILURE); - } - owner = ldns_rdf2str(ldns_rr_owner(pubkey)); - - /* calculate and set the keytag */ - ldns_key_set_keytag(key, ldns_calc_keytag(pubkey)); - - /* build the DS record */ - switch (algorithm) { -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP384SHA384: - ds = ldns_key_rr2ds(pubkey, LDNS_SHA384); - break; - case LDNS_SIGN_ECDSAP256SHA256: -#endif - case LDNS_SIGN_RSASHA256: - case LDNS_SIGN_RSASHA512: - ds = ldns_key_rr2ds(pubkey, LDNS_SHA256); - break; - case LDNS_SIGN_ECC_GOST: -#ifdef USE_GOST - ds = ldns_key_rr2ds(pubkey, LDNS_HASH_GOST); -#else - ds = ldns_key_rr2ds(pubkey, LDNS_SHA256); -#endif - break; - default: - ds = ldns_key_rr2ds(pubkey, LDNS_SHA1); - break; - } - - /* print the public key RR to .key */ - filename = LDNS_XMALLOC(char, strlen(owner) + 17); - snprintf(filename, strlen(owner) + 16, "K%s+%03u+%05u.key", owner, algorithm, (unsigned int) ldns_key_keytag(key)); - file = fopen(filename, "w"); - if (!file) { - fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - ldns_key_deep_free(key); - free(owner); - ldns_rr_free(pubkey); - ldns_rr_free(ds); - LDNS_FREE(filename); - exit(EXIT_FAILURE); - } else { - /* temporarily set question so that TTL is not printed */ - ldns_rr_set_question(pubkey, true); - ldns_rr_print(file, pubkey); - ldns_rr_set_question(pubkey, false); - fclose(file); - LDNS_FREE(filename); - } - - /* print the priv key to stderr */ - filename = LDNS_XMALLOC(char, strlen(owner) + 21); - snprintf(filename, strlen(owner) + 20, "K%s+%03u+%05u.private", owner, algorithm, (unsigned int) ldns_key_keytag(key)); - file = fopen(filename, "w"); - if (!file) { - fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - ldns_key_deep_free(key); - free(owner); - ldns_rr_free(pubkey); - ldns_rr_free(ds); - LDNS_FREE(filename); - exit(EXIT_FAILURE); - } else { - ldns_key_print(file, key); - fclose(file); - LDNS_FREE(filename); - } - - /* print the DS to .ds */ - if (algorithm != LDNS_SIGN_HMACMD5 && - algorithm != LDNS_SIGN_HMACSHA1 && - algorithm != LDNS_SIGN_HMACSHA256) { - filename = LDNS_XMALLOC(char, strlen(owner) + 16); - snprintf(filename, strlen(owner) + 15, "K%s+%03u+%05u.ds", owner, algorithm, (unsigned int) ldns_key_keytag(key)); - file = fopen(filename, "w"); - if (!file) { - fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - ldns_key_deep_free(key); - free(owner); - ldns_rr_free(pubkey); - ldns_rr_free(ds); - LDNS_FREE(filename); - exit(EXIT_FAILURE); - } else { - /* temporarily set question so that TTL is not printed */ - ldns_rr_set_question(ds, true); - ldns_rr_print(file, ds); - ldns_rr_set_question(ds, false); - fclose(file); - LDNS_FREE(filename); - } - } - - fprintf(stdout, "K%s+%03u+%05u\n", owner, algorithm, (unsigned int) ldns_key_keytag(key)); - ldns_key_deep_free(key); - free(owner); - ldns_rr_free(pubkey); - ldns_rr_free(ds); - exit(EXIT_SUCCESS); -} -#else -int -main(int argc, char **argv) -{ - fprintf(stderr, "ldns-keygen needs OpenSSL support, which has not been compiled in\n"); - return 1; -} -#endif /* HAVE_SSL */ diff --git a/libs/ldns/examples/ldns-mx.1 b/libs/ldns/examples/ldns-mx.1 deleted file mode 100644 index cad97abcd8..0000000000 --- a/libs/ldns/examples/ldns-mx.1 +++ /dev/null @@ -1,23 +0,0 @@ -.TH ldns-mx 1 "27 Apr 2005" -.SH NAME -ldns-mx \- print out the mx record(s) for a domain -.SH SYNOPSIS -.B ldns-mx -.IR DOMAIN - -.SH DESCRIPTION -\fBldns-mx\fR is used to print out mx information of a domain. - -.SH OPTIONS -\fBldns-mx\fR has no options. - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-mx.c b/libs/ldns/examples/ldns-mx.c deleted file mode 100644 index 873cf55f87..0000000000 --- a/libs/ldns/examples/ldns-mx.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * mx is a small program that prints out the mx records - * for a particular domain - * (c) NLnet Labs, 2005 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" - -#include - -static int -usage(FILE *fp, char *prog) { - fprintf(fp, "%s domain\n", prog); - fprintf(fp, " print out the mx for domain\n"); - return 0; -} - -int -main(int argc, char *argv[]) -{ - ldns_resolver *res; - ldns_rdf *domain; - ldns_pkt *p; - ldns_rr_list *mx; - ldns_status s; - - p = NULL; - mx = NULL; - domain = NULL; - res = NULL; - - if (argc != 2) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } else { - /* create a rdf from the command line arg */ - domain = ldns_dname_new_frm_str(argv[1]); - if (!domain) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } - } - - /* create a new resolver from /etc/resolv.conf */ - s = ldns_resolver_new_frm_file(&res, NULL); - - if (s != LDNS_STATUS_OK) { - exit(EXIT_FAILURE); - } - - /* use the resolver to send a query for the mx - * records of the domain given on the command line - */ - p = ldns_resolver_query(res, - domain, - LDNS_RR_TYPE_MX, - LDNS_RR_CLASS_IN, - LDNS_RD); - - ldns_rdf_deep_free(domain); - - if (!p) { - exit(EXIT_FAILURE); - } else { - /* retrieve the MX records from the answer section of that - * packet - */ - mx = ldns_pkt_rr_list_by_type(p, - LDNS_RR_TYPE_MX, - LDNS_SECTION_ANSWER); - if (!mx) { - fprintf(stderr, - " *** invalid answer name %s after MX query for %s\n", - argv[1], argv[1]); - ldns_pkt_free(p); - ldns_resolver_deep_free(res); - exit(EXIT_FAILURE); - } else { - ldns_rr_list_sort(mx); - ldns_rr_list_print(stdout, mx); - ldns_rr_list_deep_free(mx); - } - } - ldns_pkt_free(p); - ldns_resolver_deep_free(res); - return 0; -} diff --git a/libs/ldns/examples/ldns-notify.1 b/libs/ldns/examples/ldns-notify.1 deleted file mode 100644 index 7ae77ac046..0000000000 --- a/libs/ldns/examples/ldns-notify.1 +++ /dev/null @@ -1,66 +0,0 @@ -.TH ldns-notify 1 "9 Jan 2007" -.SH NAME -ldns-notify \- notify DNS servers that updates are available -.SH SYNOPSIS -.B ldns-notify -[options] --z zone -.IR servers - -.SH DESCRIPTION - -\fBldns-notify\fR sends a NOTIFY message to DNS servers. This tells them -that an updated zone is available at the master servers. It can perform -TSIG signatures and it can add a SOA serial number of the updated zone. -If a server already has that serial number it will disregard the message. - -.SH OPTIONS -.TP -\fB-z zone\fR -The zone that is updated. - -.TP -\fB-h\fR -Show usage and exit - -.TP -\fB-v\fR -Show the version and exit - -.TP -\fB-s serial\fR -Append a SOA record indicating the serial number of the updated zone. - -.TP -\fB-p port\fR -Use port as destination port (default the DNS port 53) for the UDP packets. - -.TP -\fB-y key:data\fR -Use the given TSIG key and base64-data to sign the NOTIFY. Uses the -hmac-md5 algorithm. - -.TP -\fB-d\fR -Print verbose debug information. The query that is sent and the query -that is received. - -.TP -\fB-r num\fR -Specify the maximum number of retries before notify gives up trying to -send the UDP packet. - -.SH EXIT CODE -The program exits with a 0 exit code if all servers replied an -acknowledgement to the notify message, and a failure exit code otherwise. - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-notify.c b/libs/ldns/examples/ldns-notify.c deleted file mode 100644 index 258dc09b26..0000000000 --- a/libs/ldns/examples/ldns-notify.c +++ /dev/null @@ -1,329 +0,0 @@ -/* - * ldns-notify.c - ldns-notify(8) - * - * Copyright (c) 2001-2008, NLnet Labs, All right reserved - * - * See LICENSE for the license - * - * send a notify packet to a server - */ - -#include "config.h" - -/* ldns */ -#include - -#ifdef HAVE_NETDB_H -#include -#endif -#include - -static int verbose = 1; -static int max_num_retry = 15; /* times to try */ - -static void -usage(void) -{ - fprintf(stderr, "usage: ldns-notify [other options] -z zone \n"); - fprintf(stderr, "Ldns notify utility\n\n"); - fprintf(stderr, " Supported options:\n"); - fprintf(stderr, "\t-z zone\t\tThe zone\n"); - fprintf(stderr, "\t-s version\tSOA version number to include\n"); - fprintf(stderr, "\t-y key:data\tTSIG sign the query\n"); - fprintf(stderr, "\t-p port\t\tport to use to send to\n"); - fprintf(stderr, "\t-v\t\tPrint version information\n"); - fprintf(stderr, "\t-d\t\tPrint verbose debug information\n"); - fprintf(stderr, "\t-r num\t\tmax number of retries (%d)\n", - max_num_retry); - fprintf(stderr, "\t-h\t\tPrint this help information\n\n"); - fprintf(stderr, "Report bugs to \n"); - exit(1); -} - -static void -version(void) -{ - fprintf(stderr, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); - fprintf(stderr, "Written by NLnet Labs.\n\n"); - fprintf(stderr, - "Copyright (C) 2001-2008 NLnet Labs. This is free software.\n" - "There is NO warranty; not even for MERCHANTABILITY or FITNESS\n" - "FOR A PARTICULAR PURPOSE.\n"); - exit(0); -} - -static void -notify_host(int s, struct addrinfo* res, uint8_t* wire, size_t wiresize, - const char* addrstr) -{ - int timeout_retry = 5; /* seconds */ - int num_retry = max_num_retry; - fd_set rfds; - struct timeval tv; - int retval = 0; - ssize_t received = 0; - int got_ack = 0; - socklen_t addrlen = 0; - uint8_t replybuf[2048]; - ldns_status status; - ldns_pkt* pkt = NULL; - - while(!got_ack) { - /* send it */ - if(sendto(s, (void*)wire, wiresize, 0, - res->ai_addr, res->ai_addrlen) == -1) { - printf("warning: send to %s failed: %s\n", - addrstr, strerror(errno)); -#ifndef USE_WINSOCK - close(s); -#else - closesocket(s); -#endif - return; - } - - /* wait for ACK packet */ - FD_ZERO(&rfds); - FD_SET(s, &rfds); -#ifndef S_SPLINT_S - tv.tv_sec = timeout_retry; /* seconds */ -#endif - tv.tv_usec = 0; /* microseconds */ - retval = select(s + 1, &rfds, NULL, NULL, &tv); - if (retval == -1) { - printf("error waiting for reply from %s: %s\n", - addrstr, strerror(errno)); -#ifndef USE_WINSOCK - close(s); -#else - closesocket(s); -#endif - return; - } - if(retval == 0) { - num_retry--; - if(num_retry == 0) { - printf("error: failed to send notify to %s.\n", - addrstr); - exit(1); - } - printf("timeout (%d s) expired, retry notify to %s.\n", - timeout_retry, addrstr); - } - if (retval == 1) { - got_ack = 1; - } - } - - /* got reply */ - addrlen = res->ai_addrlen; - received = recvfrom(s, (void*)replybuf, sizeof(replybuf), 0, - res->ai_addr, &addrlen); - res->ai_addrlen = addrlen; - -#ifndef USE_WINSOCK - close(s); -#else - closesocket(s); -#endif - if (received == -1) { - printf("recv %s failed: %s\n", addrstr, strerror(errno)); - return; - } - - /* check reply */ - status = ldns_wire2pkt(&pkt, replybuf, (size_t)received); - if(status != LDNS_STATUS_OK) { - ssize_t i; - printf("Could not parse reply packet: %s\n", - ldns_get_errorstr_by_id(status)); - printf("hexdump of reply: "); - for(i=0; iai_next) { - int s = socket(res->ai_family, res->ai_socktype, - res->ai_protocol); - if(s == -1) - continue; - /* send the notify */ - notify_host(s, res, wire, wiresize, argv[i]); - } - freeaddrinfo(res0); - } - - ldns_pkt_free(notify); - free(wire); - return 0; -} diff --git a/libs/ldns/examples/ldns-nsec3-hash.1 b/libs/ldns/examples/ldns-nsec3-hash.1 deleted file mode 100644 index 1b0f70ce39..0000000000 --- a/libs/ldns/examples/ldns-nsec3-hash.1 +++ /dev/null @@ -1,34 +0,0 @@ -.TH ldns-nsec3-hash.c 1 "10 Dec 2008" -.SH NAME -ldns-nsec3-hash \- print out the NSEC3 hash for a domain name -.SH SYNOPSIS -.B ldns-nsec3-hash -.IR - -.SH DESCRIPTION -\fBldns-nsec3-hash\fR is used to print out the NSEC3 hash for the given domain name. - -.SH OPTIONS -.TP -\fB-a\fR \fInumber\fR -Use the given algorithm number for the hash calculation. Defaults to 1 (SHA-1). - -.TP -\fB-s\fR \fIsalt\fR -Use the given salt for the hash calculation. Salt value should be in hexadecimal format. - -.TP -\fB-t\fR \fIcount\fR -Use count iterations for the hash calculation. - - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2008 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-nsec3-hash.c b/libs/ldns/examples/ldns-nsec3-hash.c deleted file mode 100644 index 0ba2e68aec..0000000000 --- a/libs/ldns/examples/ldns-nsec3-hash.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * ldns-signzone signs a zone file - * - * (c) NLnet Labs, 2005 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" -#include -#include - -#include - -#include - -#include -#include - -#ifdef HAVE_SSL -#include -#include -#endif /* HAVE_SSL */ - -#define MAX_FILENAME_LEN 250 -int verbosity = 1; - -static void -usage(FILE *fp, const char *prog) { - fprintf(fp, "%s [OPTIONS] \n", prog); - fprintf(fp, " prints the NSEC3 hash of the given domain name\n"); - fprintf(fp, "-a [algorithm] hashing algorithm\n"); - fprintf(fp, "-t [number] number of hash iterations\n"); - fprintf(fp, "-s [string] salt\n"); -} - -int -main(int argc, char *argv[]) -{ - ldns_rdf *dname, *hashed_dname; - uint8_t nsec3_algorithm = 1; - size_t nsec3_iterations_cmd = 1; - uint16_t nsec3_iterations = 1; - uint8_t nsec3_salt_length = 0; - uint8_t *nsec3_salt = NULL; - - char *prog = strdup(argv[0]); - - int c; - while ((c = getopt(argc, argv, "a:s:t:")) != -1) { - switch (c) { - case 'a': - nsec3_algorithm = (uint8_t) atoi(optarg); - break; - case 's': - if (strlen(optarg) % 2 != 0) { - fprintf(stderr, "Salt value is not valid hex data, not a multiple of 2 characters\n"); - exit(EXIT_FAILURE); - } - if (strlen(optarg) > 512) { - fprintf(stderr, "Salt too long\n"); - exit(EXIT_FAILURE); - } - nsec3_salt_length = (uint8_t) (strlen(optarg) / 2); - nsec3_salt = LDNS_XMALLOC(uint8_t, nsec3_salt_length); - for (c = 0; c < (int) strlen(optarg); c += 2) { - if (isxdigit((int) optarg[c]) && isxdigit((int) optarg[c+1])) { - nsec3_salt[c/2] = (uint8_t) ldns_hexdigit_to_int(optarg[c]) * 16 + - ldns_hexdigit_to_int(optarg[c+1]); - } else { - fprintf(stderr, "Salt value is not valid hex data.\n"); - exit(EXIT_FAILURE); - } - } - - break; - case 't': - nsec3_iterations_cmd = (size_t) atol(optarg); - if (nsec3_iterations_cmd > LDNS_NSEC3_MAX_ITERATIONS) { - fprintf(stderr, "Iterations count can not exceed %u, quitting\n", LDNS_NSEC3_MAX_ITERATIONS); - exit(EXIT_FAILURE); - } - nsec3_iterations = (uint16_t) nsec3_iterations_cmd; - break; - default: - usage(stderr, prog); - exit(EXIT_SUCCESS); - } - } - - argc -= optind; - argv += optind; - - if (argc < 1) { - printf("Error: not enough arguments\n"); - usage(stdout, prog); - exit(EXIT_FAILURE); - } else { - dname = ldns_dname_new_frm_str(argv[0]); - if (!dname) { - fprintf(stderr, - "Error: unable to parse domain name\n"); - return EXIT_FAILURE; - } - hashed_dname = ldns_nsec3_hash_name(dname, - nsec3_algorithm, - nsec3_iterations, - nsec3_salt_length, - nsec3_salt); - if (!hashed_dname) { - fprintf(stderr, - "Error creating NSEC3 hash\n"); - return EXIT_FAILURE; - } - ldns_rdf_print(stdout, hashed_dname); - printf("\n"); - ldns_rdf_deep_free(dname); - ldns_rdf_deep_free(hashed_dname); - } - - if (nsec3_salt) { - free(nsec3_salt); - } - - free(prog); - - return EXIT_SUCCESS; -} diff --git a/libs/ldns/examples/ldns-read-zone.1 b/libs/ldns/examples/ldns-read-zone.1 deleted file mode 100644 index 31bedaba62..0000000000 --- a/libs/ldns/examples/ldns-read-zone.1 +++ /dev/null @@ -1,56 +0,0 @@ -.TH ldns-read-zone 1 "30 May 2005" -.SH NAME -ldns-read-zone \- read a zonefile and print it -.SH SYNOPSIS -.B ldns-read-zone -.IR ZONEFILE - -.SH DESCRIPTION - -\fBldns-read-zone\fR reads a DNS zone file and prints it. The output has 1 -resource record per line, and no pretty-printing makeup. - -.SH OPTIONS -.TP -\fB-c\fR -Canonicalize all resource records in the zone before printing - -.TP -\fB-d\fR -Only print DNSSEC data from the zone. This option skips every record -that is not of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are not -printed. - -.TP -\fB-h\fR -Show usage and exit - -.TP -\fB-n\fR -Do not print the SOA record - -.TP -\fB-s\fR -Strip DNSSEC data from the zone. This option skips every record -that is of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are still -printed. - -.TP -\fB-v\fR -Show the version and exit - -.TP -\fB-z\fR -Sort the zone before printing (this implies -c) - - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-read-zone.c b/libs/ldns/examples/ldns-read-zone.c deleted file mode 100644 index ea35850fc1..0000000000 --- a/libs/ldns/examples/ldns-read-zone.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * read a zone file from disk and prints it, one RR per line - * - * (c) NLnetLabs 2005-2008 - * - * See the file LICENSE for the license - */ - -#include "config.h" -#include -#include - -#include - -#include - -int -main(int argc, char **argv) -{ - char *filename; - FILE *fp; - ldns_zone *z; - int line_nr = 0; - int c; - bool canonicalize = false; - bool sort = false; - bool strip = false; - bool only_dnssec = false; - bool print_soa = true; - ldns_status s; - size_t i; - ldns_rr_list *stripped_list; - ldns_rr *cur_rr; - ldns_rr_type cur_rr_type; - - while ((c = getopt(argc, argv, "cdhnsvz")) != -1) { - switch(c) { - case 'c': - canonicalize = true; - break; - case 'd': - only_dnssec = true; - if (strip) { - fprintf(stderr, "Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"); - } - break; - case 'h': - printf("Usage: %s [-c] [-v] [-z] \n", argv[0]); - printf("\tReads the zonefile and prints it.\n"); - printf("\tThe RR count of the zone is printed to stderr.\n"); - printf("\t-c canonicalize all rrs in the zone.\n"); - printf("\t-d only show DNSSEC data from the zone\n"); - printf("\t-h show this text\n"); - printf("\t-n do not print the SOA record\n"); - printf("\t-s strip DNSSEC data from the zone\n"); - printf("\t-v shows the version and exits\n"); - printf("\t-z sort the zone (implies -c).\n"); - printf("\nif no file is given standard input is read\n"); - exit(EXIT_SUCCESS); - break; - case 'n': - print_soa = false; - break; - case 's': - strip = true; - if (only_dnssec) { - fprintf(stderr, "Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"); - } - break; - case 'v': - printf("read zone version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); - exit(EXIT_SUCCESS); - break; - case 'z': - canonicalize = true; - sort = true; - break; - } - } - - argc -= optind; - argv += optind; - - if (argc == 0) { - fp = stdin; - } else { - filename = argv[0]; - - fp = fopen(filename, "r"); - if (!fp) { - fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - exit(EXIT_FAILURE); - } - } - - s = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, LDNS_RR_CLASS_IN, &line_nr); - - if (strip) { - stripped_list = ldns_rr_list_new(); - while ((cur_rr = ldns_rr_list_pop_rr(ldns_zone_rrs(z)))) { - cur_rr_type = ldns_rr_get_type(cur_rr); - if (cur_rr_type == LDNS_RR_TYPE_RRSIG || - cur_rr_type == LDNS_RR_TYPE_NSEC || - cur_rr_type == LDNS_RR_TYPE_NSEC3 || - cur_rr_type == LDNS_RR_TYPE_NSEC3PARAMS - ) { - ldns_rr_free(cur_rr); - } else { - ldns_rr_list_push_rr(stripped_list, cur_rr); - } - } - ldns_rr_list_free(ldns_zone_rrs(z)); - ldns_zone_set_rrs(z, stripped_list); - } - if (only_dnssec) { - stripped_list = ldns_rr_list_new(); - while ((cur_rr = ldns_rr_list_pop_rr(ldns_zone_rrs(z)))) { - cur_rr_type = ldns_rr_get_type(cur_rr); - if (cur_rr_type == LDNS_RR_TYPE_RRSIG || - cur_rr_type == LDNS_RR_TYPE_NSEC || - cur_rr_type == LDNS_RR_TYPE_NSEC3 || - cur_rr_type == LDNS_RR_TYPE_NSEC3PARAMS - ) { - ldns_rr_list_push_rr(stripped_list, cur_rr); - } else { - ldns_rr_free(cur_rr); - } - } - ldns_rr_list_free(ldns_zone_rrs(z)); - ldns_zone_set_rrs(z, stripped_list); - } - - if (s == LDNS_STATUS_OK) { - if (canonicalize) { - ldns_rr2canonical(ldns_zone_soa(z)); - for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { - ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z), i)); - } - } - if (sort) { - ldns_zone_sort(z); - } - - if (print_soa && ldns_zone_soa(z)) { - ldns_rr_print(stdout, ldns_zone_soa(z)); - } - ldns_rr_list_print(stdout, ldns_zone_rrs(z)); - - ldns_zone_deep_free(z); - } else { - fprintf(stderr, "%s at %d\n", - ldns_get_errorstr_by_id(s), - line_nr); - exit(EXIT_FAILURE); - } - fclose(fp); - - exit(EXIT_SUCCESS); -} diff --git a/libs/ldns/examples/ldns-resolver.1 b/libs/ldns/examples/ldns-resolver.1 deleted file mode 100644 index 9552e6860c..0000000000 --- a/libs/ldns/examples/ldns-resolver.1 +++ /dev/null @@ -1,26 +0,0 @@ -.TH ldns-resolver 1 "27 Apr 2005" -.SH NAME -ldns-resolver \- tries to create a resolver from a resolv.conf file. -.SH SYNOPSIS -.B ldns-resolver -.IR file - -.SH DESCRIPTION -\fBldns-resolver\fR tries to create a resolver from a resolv.conf file. -This is only useful to test the library for robusteness with input data. - -.SH OPTIONS -\fBldns-resolver\fR takes a filename of the resolv.conf file as input. -For example \fIldns-resolver /etc/resolv.conf\fR will show if the file can -be parsed successfully. - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-resolver.c b/libs/ldns/examples/ldns-resolver.c deleted file mode 100644 index 04dcc35feb..0000000000 --- a/libs/ldns/examples/ldns-resolver.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ldns-resolver tries to create a resolver structure from /dev/urandom - * this is only useful to test the library for robusteness with input data - * - * (c) NLnet Labs 2006 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" -#include "errno.h" - -#include - -int -main(int argc, char **argv) { - - ldns_resolver *r; - int line = 1; - FILE *rand; - ldns_status s; - - if (argc != 2 || strncmp(argv[1], "-h", 3) == 0) { - printf("Usage: ldns-resolver \n"); - printf("Tries to create a stub resolver structure from the given file.\n"); - exit(EXIT_FAILURE); - } - - if (!(rand = fopen(argv[1], "r"))) { - printf("Error opening %s: %s\n", argv[1], strerror(errno)); - exit(EXIT_FAILURE); - } - - printf("Trying to read from %s\n", argv[1]); - s = ldns_resolver_new_frm_fp_l(&r, rand, &line); - if (s != LDNS_STATUS_OK) { - printf("Failed: %s at line %d\n", ldns_get_errorstr_by_id(s), line); - exit(EXIT_FAILURE); - } else { - printf("Succes\n"); - ldns_resolver_print(stdout, r); - ldns_resolver_deep_free(r); - } - - fclose(rand); - - return EXIT_SUCCESS; -} diff --git a/libs/ldns/examples/ldns-revoke.1 b/libs/ldns/examples/ldns-revoke.1 deleted file mode 100644 index 5a16244dac..0000000000 --- a/libs/ldns/examples/ldns-revoke.1 +++ /dev/null @@ -1,27 +0,0 @@ -.TH ldns-revoke 1 "23 Jul 2008" -.SH NAME -ldns-revoke \- sets the revoke bit of a DNSKEY -.SH SYNOPSIS -.B ldns-revoke -.IR file - -.SH DESCRIPTION -\fBldns-revoke\fR is used to revoke a public DNSKEY RR. -When run it will read \fIfile\fR with a DNSKEY RR in it, -sets the revoke bit and write back the output to \fIfile\fR . - -.SH OPTIONS -.TP -\fB-n\fR -Write the result to stdout instead of a file - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2008 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-revoke.c b/libs/ldns/examples/ldns-revoke.c deleted file mode 100644 index f46c98f010..0000000000 --- a/libs/ldns/examples/ldns-revoke.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * revoke sets the revoke bit of a public key. - * - * (c) NLnet Labs, 2005 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" - -#include -#ifdef HAVE_SSL -#include -#endif /* HAVE_SSL */ - -#include - -static void -usage(FILE *fp, char *prog) { - fprintf(fp, "%s [-n] keyfile\n", prog); - fprintf(fp, " Revokes a key\n"); - fprintf(fp, "Options:\n"); - fprintf(fp, " -n: do not write to file but to stdout\n"); -} - -int -main(int argc, char *argv[]) -{ - FILE *keyfp; - char *keyname; - ldns_rr *k; - uint16_t flags; - char *program = argv[0]; - int nofile = 0; - ldns_rdf *origin = NULL; - ldns_status result; - - argv++, argc--; - while (argc && argv[0][0] == '-') { - if (strcmp(argv[0], "-n") == 0) { - nofile=1; - } - else { - usage(stderr, program); - exit(EXIT_FAILURE); - } - argv++, argc--; - } - - if (argc != 1) { - usage(stderr, program); - exit(EXIT_FAILURE); - } - keyname = strdup(argv[0]); - - keyfp = fopen(keyname, "r"); - if (!keyfp) { - fprintf(stderr, "Failed to open public key file %s: %s\n", keyname, - strerror(errno)); - exit(EXIT_FAILURE); - } - - result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); - /* what does this while loop do? */ - while (result == LDNS_STATUS_SYNTAX_ORIGIN) { - result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); - } - if (result != LDNS_STATUS_OK) { - fprintf(stderr, "Could not read public key from file %s: %s\n", keyname, ldns_get_errorstr_by_id(result)); - exit(EXIT_FAILURE); - } - fclose(keyfp); - - flags = ldns_read_uint16(ldns_rdf_data(ldns_rr_dnskey_flags(k))); - flags |= LDNS_KEY_REVOKE_KEY; - - if (!ldns_rr_dnskey_set_flags(k, - ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, flags))) - { - fprintf(stderr, "Revocation failed\n"); - exit(EXIT_FAILURE); - } - - /* print the public key RR to .key */ - - if (nofile) - ldns_rr_print(stdout,k); - else { - keyfp = fopen(keyname, "w"); - if (!keyfp) { - fprintf(stderr, "Unable to open %s: %s\n", keyname, - strerror(errno)); - exit(EXIT_FAILURE); - } else { - ldns_rr_print(keyfp, k); - fclose(keyfp); - fprintf(stdout, "DNSKEY revoked\n"); - } - } - - free(keyname); - ldns_rr_free(k); - - exit(EXIT_SUCCESS); -} diff --git a/libs/ldns/examples/ldns-rrsig.1 b/libs/ldns/examples/ldns-rrsig.1 deleted file mode 100644 index 3aee863e05..0000000000 --- a/libs/ldns/examples/ldns-rrsig.1 +++ /dev/null @@ -1,30 +0,0 @@ -.TH ldns-rrsig 1 "27 Apr 2005" -.SH NAME -ldns-rrsig \- print out the inception and expiration dates in human -readable form -.SH SYNOPSIS -.B ldns-rrsig -.IR domain -[ -.IR type -] - -.SH DESCRIPTION -\fBldns-rrsig\fR is used to print the expiration and inception date of -a RRSIG. The first argument is a domain name. \fBldns-rrsig\fR will -query the authoritative servers for that domain to get a list of RRSIGs. -It will then print out the inception and experiration dates for the RRSIG -covering the SOA record. -.PP -If the second argument \fBtype\fR is given the RRSIG covering that type will be shown. - -.SH AUTHOR -Written by the ldns team as an example for ldns usage. - -.SH REPORTING BUGS -Report bugs to . - -.SH COPYRIGHT -Copyright (C) 2005 NLnet Labs. This is free software. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. diff --git a/libs/ldns/examples/ldns-rrsig.c b/libs/ldns/examples/ldns-rrsig.c deleted file mode 100644 index 5c565b1d4b..0000000000 --- a/libs/ldns/examples/ldns-rrsig.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * ldns-rrsig prints out the inception and expiration dates in a more readable - * way than the normal RRSIG presentation format - * - * for a particulary domain - * (c) NLnet Labs, 2005 - 2008 - * See the file LICENSE for the license - */ - -#include "config.h" - -#include - -static int -usage(FILE *fp, char *prog) { - fprintf(fp, "%s domain [type]\n", prog); - fprintf(fp, " print out the inception and expiration dates\n"); - fprintf(fp, " in a more human readable form\n"); - fprintf(fp, " \tquery for RRSIG(), defaults to SOA\n"); - return 0; -} - -int -main(int argc, char *argv[]) -{ - ldns_resolver *res; - ldns_resolver *localres; - ldns_rdf *domain; - ldns_pkt *p; - ldns_rr_list *rrsig; - ldns_rr_list *rrsig_type; - ldns_rr_list *ns; - ldns_rr_list *ns_ip; - uint8_t i, j; - ldns_rr_type t; - char * type_name; - time_t incep, expir; - char incep_buf[26]; - char expir_buf[26]; - ldns_status s; - - p = NULL; - rrsig = NULL; - rrsig_type = NULL; - domain = NULL; - - /* option parsing */ - - if (argc < 2) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } else { - /* create a rdf from the command line arg */ - domain = ldns_dname_new_frm_str(argv[1]); - if (!domain) { - usage(stdout, argv[0]); - exit(EXIT_FAILURE); - } - } - - if (argc == 3) { - /* optional type arg */ - type_name = strdup(argv[2]); - t = ldns_rdf2rr_type( - ldns_rdf_new_frm_str(LDNS_RDF_TYPE_TYPE, type_name)); - if (t == 0) { - fprintf(stderr, " *** %s is not a valid RR type\n", type_name); - exit(EXIT_FAILURE); - } - } else { - t = LDNS_RR_TYPE_SOA; - type_name = "SOA"; - } - - /* create a new resolver from /etc/resolv.conf */ - s = ldns_resolver_new_frm_file(&localres, NULL); - if (s != LDNS_STATUS_OK) { - exit(EXIT_FAILURE); - } - - /* first get the nameserver of the domain in question */ - p = ldns_resolver_query(localres, domain, LDNS_RR_TYPE_NS, - LDNS_RR_CLASS_IN, LDNS_RD); - if (!p) { - fprintf(stderr," *** Could not find any nameserver for %s", argv[1]); - ldns_resolver_deep_free(localres); - exit(EXIT_FAILURE); - } - ns = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); - - if (!ns) { - fprintf(stderr," *** Could not find any nameserver for %s", argv[1]); - ldns_pkt_free(p); - ldns_resolver_deep_free(localres); - exit(EXIT_FAILURE); - } - - /* use our local resolver to resolv the names in the for usage in our - * new resolver */ - res = ldns_resolver_new(); - if (!res) { - ldns_pkt_free(p); - ldns_resolver_deep_free(localres); - ldns_rr_list_deep_free(ns); - exit(EXIT_FAILURE); - } - for(i = 0; i < ldns_rr_list_rr_count(ns); i++) { - ns_ip = ldns_get_rr_list_addr_by_name(localres, - ldns_rr_ns_nsdname(ldns_rr_list_rr(ns, i)), - LDNS_RR_CLASS_IN, LDNS_RD); - /* add these to new resolver */ - for(j = 0; j < ldns_rr_list_rr_count(ns_ip); j++) { - if (ldns_resolver_push_nameserver(res, - ldns_rr_a_address(ldns_rr_list_rr(ns_ip, j))) != LDNS_STATUS_OK) { - printf("Error adding nameserver to resolver\n"); - ldns_pkt_free(p); - ldns_resolver_deep_free(res); - ldns_resolver_deep_free(localres); - ldns_rr_list_deep_free(ns); - exit(EXIT_FAILURE); - } - } - ldns_rr_list_deep_free(ns_ip); - - } - - /* enable DNSSEC */ - ldns_resolver_set_dnssec(res, true); - /* also set CD, we want EVERYTHING! */ - ldns_resolver_set_dnssec_cd(res, true); - - /* use the resolver to send it a query for the soa - * records of the domain given on the command line - */ - ldns_pkt_free(p); - p = ldns_resolver_query(res, domain, LDNS_RR_TYPE_RRSIG, LDNS_RR_CLASS_IN, LDNS_RD); - - ldns_rdf_deep_free(domain); - - if (!p) { - ldns_resolver_deep_free(localres); - ldns_rr_list_deep_free(ns); - exit(EXIT_FAILURE); - } else { - /* retrieve the RRSIG records from the answer section of that - * packet - */ - rrsig = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_RRSIG, LDNS_SECTION_ANSWER); - if (!rrsig) { - fprintf(stderr, - " *** invalid answer name %s after RRSIG query for %s\n", - argv[1], argv[1]); - ldns_pkt_free(p); - ldns_resolver_deep_free(res); - ldns_rr_list_deep_free(ns); - exit(EXIT_FAILURE); - } else { - rrsig_type = ldns_rr_list_new(); - - for(i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { - if (ldns_rdf2rr_type( - ldns_rr_rrsig_typecovered( - ldns_rr_list_rr(rrsig, i))) == t) { - ldns_rr_list_push_rr(rrsig_type, - ldns_rr_list_rr(rrsig, i)); - } - } - if (ldns_rr_list_rr_count(rrsig_type) == 0) { - fprintf(stderr, " *** No RRSIG(%s) type found\n", - type_name); - ldns_resolver_deep_free(localres); - ldns_resolver_deep_free(res); - ldns_pkt_free(p); - ldns_rr_list_deep_free(ns); - ldns_rr_list_free(rrsig); - ldns_rr_list_deep_free(rrsig_type); - exit(EXIT_FAILURE); - } - - for(i = 0; i < ldns_rr_list_rr_count(rrsig_type); i++) { - incep = ldns_rdf2native_time_t( - ldns_rr_rrsig_inception( - ldns_rr_list_rr(rrsig_type, i))); - expir = ldns_rdf2native_time_t( - ldns_rr_rrsig_expiration( - ldns_rr_list_rr(rrsig_type, i))); - - /* convert to human readable */ - ctime_r(&incep, incep_buf); - ctime_r(&expir, expir_buf); - /* kill the newline */ - incep_buf[24] = '\0'; - expir_buf[24] = '\0'; - - fprintf(stdout, "%s RRSIG(%s): %s - %s\n", - argv[1], type_name, incep_buf, expir_buf); - } - ldns_rr_list_free(rrsig); - ldns_rr_list_deep_free(rrsig_type); - } - } - ldns_pkt_free(p); - ldns_resolver_deep_free(localres); - ldns_resolver_deep_free(res); - ldns_rr_list_deep_free(ns); - return 0; -} diff --git a/libs/ldns/examples/ldns-signzone.1 b/libs/ldns/examples/ldns-signzone.1 deleted file mode 100644 index 0ac7c8094f..0000000000 --- a/libs/ldns/examples/ldns-signzone.1 +++ /dev/null @@ -1,159 +0,0 @@ -.TH ldns-signzone 1 "30 May 2005" -.SH NAME -ldns-signzone \- sign a zonefile with DNSSEC data -.SH SYNOPSIS -.B ldns-signzone -[ -.IR OPTIONS -] -.IR ZONEFILE -.IR -KEY -[KEY -[KEY] ... -] - -.SH DESCRIPTION - -\fBldns-signzone\fR is used to generate a DNSSEC signed zone. When run it -will create a new zonefile that contains RRSIG and NSEC resource records, as -specified in RFC 4033, RFC 4034 and RFC 4035. - -Keys must be specified by their base name (i.e. without .private). If -the DNSKEY that belongs to the key in the .private file is not present -in the zone, it will be read from the file .key. If that -file does not exist, the DNSKEY value will be generated from the -private key. - -Multiple keys can be specified, Key Signing Keys are used as such when -they are either already present in the zone, or specified in a .key -file, and have the KSK bit set. - -.SH OPTIONS -.TP -\fB-d\fR -Normally, if the DNSKEY RR for a key that is used to sign the zone is -not found in the zone file, it will be read from .key, or derived from -the private key (in that order). This option turns that feature off, -so that only the signatures are added to the zone. - -.TP -\fB-e\fR \fIdate\fR -Set expiration date of the signatures to this date, the format can be -YYYYMMDD[hhmmss], or a timestamp. - -.TP -\fB-f\fR \fIfile\fR -Use this file to store the signed zone in (default .signed) - -.TP -\fB-i\fR \fIdate\fR -Set inception date of the signatures to this date, the format can be -YYYYMMDD[hhmmss], or a timestamp. - -.TP -\fB-l\fR -Leave old DNSSEC RRSIGS and NSEC records intact (by default, they are -removed from the zone) - -.TP -\fB-o\fR \fIorigin\fR -Use this as the origin of the zone - -.TP -\fB-v\fR -Print the version and exit - -.TP -\fB-A\fR -Sign the DNSKEY record with all keys. By default it is signed with a -minimal number of keys, to keep the response size for the DNSKEY query -small, and only the SEP keys that are passed are used. If there are no -SEP keys, the DNSKEY RRset is signed with the non\-SEP keys. This option -turns off the default and all keys are used to sign the DNSKEY RRset. - -.TP -\fB-E\fR \fIname\fR -Use the EVP cryptographic engine with the given name for signing. This -can have some extra options; see ENGINE OPTIONS for more information. - -.TP -\fB-k\fR \fIid,int\fR -Use the key with the given id as the signing key for algorithm int as -a Zone signing key. This option is used when you use an OpenSSL -engine, see ENGINE OPTIONS for more information. - -.TP -\fB-K\fR \fIid,int\fR - -Use the key with the given id as the signing key for algorithm int as -a Key signing key. This options is used when you use an OpenSSL engine, -see ENGINE OPTIONS for more information. - -.TP -\fB-n\fR -Use NSEC3 instead of NSEC. - -.TP -If you use NSEC3, you can specify the following extra options: - -.TP -\fB-a\fR \fIalgorithm\fR -Algorithm used to create the hashed NSEC3 owner names - -.TP -\fB-p\fR -Opt-out. All NSEC3 records in the zone will have the Opt-out flag set. After signing, you can add insecure delegations to the signed zone. - -.TP -\fB-s\fR \fIstring\fR -Salt - -.TP -\fB-t\fR \fInumber\fR -Number of hash iterations - -.SH ENGINE OPTIONS -You can modify the possible engines, if supported, by setting an -OpenSSL configuration file. This is done through the environment -variable OPENSSL_CONF. If you use -E with a non-existent engine name, -ldns-signzone will print a list of engines supported by your -configuration. - -The key options (-k and -K) work as follows; you specify a key id, and a DNSSEC algorithm number (for instance, 5 for RSASHA1). The key id can be any of the following: - - - : - id_ - slot_-id_ - label_
\n"); - fprintf(output, "Listens on the specified port and answers queries for the given zone\n"); - fprintf(output, "This is NOT a full-fledged authoritative nameserver!\n"); -} - -static int udp_bind(int sock, int port, const char *my_address) -{ - struct sockaddr_in addr; - in_addr_t maddr = INADDR_ANY; - - if (my_address) { -#ifdef AF_INET6 - if (inet_pton(AF_INET6, my_address, &maddr) < 1) { -#else - if (0) { -#endif - if (inet_pton(AF_INET, my_address, &maddr) < 1) { - return -2; - } - } - } - - addr.sin_family = AF_INET; - addr.sin_port = (in_port_t) htons((uint16_t)port); - addr.sin_addr.s_addr = maddr; - return bind(sock, (struct sockaddr *)&addr, (socklen_t) sizeof(addr)); -} - -/* this will probably be moved to a better place in the library itself */ -ldns_rr_list * -get_rrset(const ldns_zone *zone, const ldns_rdf *owner_name, const ldns_rr_type qtype, const ldns_rr_class qclass) -{ - uint16_t i; - ldns_rr_list *rrlist = ldns_rr_list_new(); - ldns_rr *cur_rr; - if (!zone || !owner_name) { - fprintf(stderr, "Warning: get_rrset called with NULL zone or owner name\n"); - return rrlist; - } - - for (i = 0; i < ldns_zone_rr_count(zone); i++) { - cur_rr = ldns_rr_list_rr(ldns_zone_rrs(zone), i); - if (ldns_dname_compare(ldns_rr_owner(cur_rr), owner_name) == 0 && - ldns_rr_get_class(cur_rr) == qclass && - ldns_rr_get_type(cur_rr) == qtype - ) { - ldns_rr_list_push_rr(rrlist, ldns_rr_clone(cur_rr)); - } - } - - printf("Found rrset of %u rrs\n", (unsigned int) ldns_rr_list_rr_count(rrlist)); - - return rrlist; -} - -int -main(int argc, char **argv) -{ - /* arguments */ - int port; - const char *zone_file; - - /* network */ - int sock; - ssize_t nb; - struct sockaddr addr_me; - struct sockaddr addr_him; - socklen_t hislen = (socklen_t) sizeof(addr_him); - uint8_t inbuf[INBUF_SIZE]; - uint8_t *outbuf; - - /* dns */ - ldns_status status; - ldns_pkt *query_pkt; - ldns_pkt *answer_pkt; - size_t answer_size; - ldns_rr *query_rr; - ldns_rr_list *answer_qr; - ldns_rr_list *answer_an; - ldns_rr_list *answer_ns; - ldns_rr_list *answer_ad; - ldns_rdf *origin = NULL; - - /* zone */ - ldns_zone *zone; - int line_nr; - FILE *zone_fp; - - /* use this to listen on specified interfaces later? */ - char *my_address = NULL; - - if (argc < 5) { - usage(stderr); - exit(EXIT_FAILURE); - } else { - my_address = argv[1]; - port = atoi(argv[2]); - if (port < 1) { - usage(stderr); - exit(EXIT_FAILURE); - } - if (ldns_str2rdf_dname(&origin, argv[3]) != LDNS_STATUS_OK) { - fprintf(stderr, "Bad origin, not a correct domain name\n"); - usage(stderr); - exit(EXIT_FAILURE); - } - zone_file = argv[4]; - } - - printf("Reading zone file %s\n", zone_file); - zone_fp = fopen(zone_file, "r"); - if (!zone_fp) { - fprintf(stderr, "Unable to open %s: %s\n", zone_file, strerror(errno)); - exit(EXIT_FAILURE); - } - - line_nr = 0; - status = ldns_zone_new_frm_fp_l(&zone, zone_fp, origin, 0, LDNS_RR_CLASS_IN, &line_nr); - - if (status != LDNS_STATUS_OK) { - printf("Zone reader failed, aborting\n"); - exit(EXIT_FAILURE); - } else { - printf("Read %u resource records in zone file\n", (unsigned int) ldns_zone_rr_count(zone)); - } - fclose(zone_fp); - - printf("Listening on port %d\n", port); - sock = socket(AF_INET, SOCK_DGRAM, 0); - if (sock < 0) { - fprintf(stderr, "%s: socket(): %s\n", argv[0], strerror(errno)); - exit(1); - } - memset(&addr_me, 0, sizeof(addr_me)); - - /* bind: try all ports in that range */ - if (udp_bind(sock, port, my_address)) { - fprintf(stderr, "%s: cannot bind(): %s\n", argv[0], strerror(errno)); - exit(errno); - } - - /* Done. Now receive */ - while (1) { - nb = recvfrom(sock, (void*)inbuf, INBUF_SIZE, 0, - &addr_him, &hislen); - if (nb < 1) { - fprintf(stderr, "%s: recvfrom(): %s\n", - argv[0], strerror(errno)); - exit(1); - } - - /* - show(inbuf, nb, nn, hp, sp, ip, bp); - */ - printf("Got query of %u bytes\n", (unsigned int) nb); - status = ldns_wire2pkt(&query_pkt, inbuf, (size_t) nb); - if (status != LDNS_STATUS_OK) { - printf("Got bad packet: %s\n", ldns_get_errorstr_by_id(status)); - } else { - ldns_pkt_print(stdout, query_pkt); - } - - query_rr = ldns_rr_list_rr(ldns_pkt_question(query_pkt), 0); - printf("QUERY RR: \n"); - ldns_rr_print(stdout, query_rr); - - answer_qr = ldns_rr_list_new(); - ldns_rr_list_push_rr(answer_qr, ldns_rr_clone(query_rr)); - - answer_an = get_rrset(zone, ldns_rr_owner(query_rr), ldns_rr_get_type(query_rr), ldns_rr_get_class(query_rr)); - answer_pkt = ldns_pkt_new(); - answer_ns = ldns_rr_list_new(); - answer_ad = ldns_rr_list_new(); - - ldns_pkt_set_qr(answer_pkt, 1); - ldns_pkt_set_aa(answer_pkt, 1); - ldns_pkt_set_id(answer_pkt, ldns_pkt_id(query_pkt)); - - ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_QUESTION, answer_qr); - ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_ANSWER, answer_an); - ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_AUTHORITY, answer_ns); - ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_ADDITIONAL, answer_ad); - - status = ldns_pkt2wire(&outbuf, answer_pkt, &answer_size); - - printf("Answer packet size: %u bytes.\n", (unsigned int) answer_size); - if (status != LDNS_STATUS_OK) { - printf("Error creating answer: %s\n", ldns_get_errorstr_by_id(status)); - } else { - nb = sendto(sock, (void*)outbuf, answer_size, 0, - &addr_him, hislen); - } - - ldns_pkt_free(query_pkt); - ldns_pkt_free(answer_pkt); - LDNS_FREE(outbuf); - ldns_rr_list_free(answer_qr); - ldns_rr_list_free(answer_an); - ldns_rr_list_free(answer_ns); - ldns_rr_list_free(answer_ad); - } - - ldns_rdf_deep_free(origin); - ldns_zone_deep_free(zone); - - return 0; -} diff --git a/libs/ldns/higher.c b/libs/ldns/higher.c deleted file mode 100644 index 1563e821b6..0000000000 --- a/libs/ldns/higher.c +++ /dev/null @@ -1,354 +0,0 @@ -/* - * higher.c - * - * Specify some higher level functions that would - * be usefull to would be developers - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include - -#ifdef HAVE_SSL -#include -#include -#endif /* HAVE_SSL */ - -ldns_rr_list * -ldns_get_rr_list_addr_by_name(ldns_resolver *res, ldns_rdf *name, ldns_rr_class c, - uint16_t flags) -{ - ldns_pkt *pkt; - ldns_rr_list *aaaa; - ldns_rr_list *a; - ldns_rr_list *result = NULL; - ldns_rr_list *hostsfilenames; - size_t i; - uint8_t ip6; - - a = NULL; - aaaa = NULL; - result = NULL; - - if (!res) { - return NULL; - } - if (ldns_rdf_get_type(name) != LDNS_RDF_TYPE_DNAME) { - return NULL; - } - - ip6 = ldns_resolver_ip6(res); /* we use INET_ANY here, save - what was there */ - - ldns_resolver_set_ip6(res, LDNS_RESOLV_INETANY); - - hostsfilenames = ldns_get_rr_list_hosts_frm_file(NULL); - for (i = 0; i < ldns_rr_list_rr_count(hostsfilenames); i++) { - if (ldns_rdf_compare(name, - ldns_rr_owner(ldns_rr_list_rr(hostsfilenames, - i))) == 0) { - if (!result) { - result = ldns_rr_list_new(); - } - ldns_rr_list_push_rr(result, - ldns_rr_clone(ldns_rr_list_rr(hostsfilenames, i))); - } - } - ldns_rr_list_deep_free(hostsfilenames); - - if (result) { - return result; - } - - /* add the RD flags, because we want an answer */ - pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_AAAA, c, flags | LDNS_RD); - if (pkt) { - /* extract the data we need */ - aaaa = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_AAAA, - LDNS_SECTION_ANSWER); - ldns_pkt_free(pkt); - } - - pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_A, c, flags | LDNS_RD); - if (pkt) { - /* extract the data we need */ - a = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_A, LDNS_SECTION_ANSWER); - ldns_pkt_free(pkt); - } - ldns_resolver_set_ip6(res, ip6); - - if (aaaa && a) { - result = ldns_rr_list_cat_clone(aaaa, a); - ldns_rr_list_deep_free(aaaa); - ldns_rr_list_deep_free(a); - return result; - } - - if (aaaa) { - result = ldns_rr_list_clone(aaaa); - } - - if (a) { - result = ldns_rr_list_clone(a); - } - - ldns_rr_list_deep_free(aaaa); - ldns_rr_list_deep_free(a); - return result; -} - -ldns_rr_list * -ldns_get_rr_list_name_by_addr(ldns_resolver *res, ldns_rdf *addr, ldns_rr_class c, - uint16_t flags) -{ - ldns_pkt *pkt; - ldns_rr_list *names; - ldns_rdf *name; - - names = NULL; - - if (!res || !addr) { - return NULL; - } - - if (ldns_rdf_get_type(addr) != LDNS_RDF_TYPE_A && - ldns_rdf_get_type(addr) != LDNS_RDF_TYPE_AAAA) { - return NULL; - } - - name = ldns_rdf_address_reverse(addr); - - /* add the RD flags, because we want an answer */ - pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_PTR, c, flags | LDNS_RD); - if (pkt) { - /* extract the data we need */ - names = ldns_pkt_rr_list_by_type(pkt, - LDNS_RR_TYPE_PTR, LDNS_SECTION_ANSWER); - } - return names; -} - -/* read a line, put it in a buffer, parse the buffer */ -ldns_rr_list * -ldns_get_rr_list_hosts_frm_fp(FILE *fp) -{ - return ldns_get_rr_list_hosts_frm_fp_l(fp, NULL); -} - -ldns_rr_list * -ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr) -{ - ssize_t i, j; - size_t cnt; - char *line; - char *word; - char *addr; - char *rr_str; - ldns_buffer *linebuf; - ldns_rr *rr; - ldns_rr_list *list; - ldns_rdf *tmp; - bool ip6; - ldns_status parse_result; - - line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); - word = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); - addr = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); - rr_str = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); - ip6 = false; - list = ldns_rr_list_new(); - rr = NULL; - if(!line || !word || !addr || !rr_str || !list) { - LDNS_FREE(line); - LDNS_FREE(word); - LDNS_FREE(addr); - LDNS_FREE(rr_str); - ldns_rr_list_free(list); - return NULL; - } - - for(i = ldns_fget_token_l(fp, line, "\n", LDNS_MAX_LINELEN, line_nr); - i > 0; i = ldns_fget_token_l(fp, line, "\n", LDNS_MAX_LINELEN, line_nr)) { - /* # is comment */ - if (line[0] == '#') { - continue; - } - /* put it in a buffer for further processing */ - linebuf = LDNS_MALLOC(ldns_buffer); - if(!linebuf) { - LDNS_FREE(line); - LDNS_FREE(word); - LDNS_FREE(addr); - LDNS_FREE(rr_str); - ldns_rr_list_deep_free(list); - return NULL; - } - - ldns_buffer_new_frm_data(linebuf, line, (size_t) i); - for(cnt = 0, j = ldns_bget_token(linebuf, word, LDNS_PARSE_NO_NL, LDNS_MAX_LINELEN); - j > 0; - j = ldns_bget_token(linebuf, word, LDNS_PARSE_NO_NL, LDNS_MAX_LINELEN), cnt++) { - if (cnt == 0) { - /* the address */ - if ((tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, - word))) { - /* ip6 */ - ldns_rdf_deep_free(tmp); - ip6 = true; - } else { - if ((tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, - word))) { - /* ip4 */ - ldns_rdf_deep_free(tmp); - ip6 = false; - } else { - /* kaput */ - break; - } - } - (void)strlcpy(addr, word, LDNS_MAX_LINELEN+1); - } else { - /* la al la la */ - if (ip6) { - snprintf(rr_str, LDNS_MAX_LINELEN, - "%s IN AAAA %s", word, addr); - } else { - snprintf(rr_str, LDNS_MAX_LINELEN, - "%s IN A %s", word, addr); - } - parse_result = ldns_rr_new_frm_str(&rr, rr_str, 0, NULL, NULL); - if (parse_result == LDNS_STATUS_OK && ldns_rr_owner(rr) && ldns_rr_rd_count(rr) > 0) { - ldns_rr_list_push_rr(list, ldns_rr_clone(rr)); - } - ldns_rr_free(rr); - } - } - ldns_buffer_free(linebuf); - } - LDNS_FREE(line); - LDNS_FREE(word); - LDNS_FREE(addr); - LDNS_FREE(rr_str); - return list; -} - -ldns_rr_list * -ldns_get_rr_list_hosts_frm_file(char *filename) -{ - ldns_rr_list *names; - FILE *fp; - - if (!filename) { - fp = fopen(LDNS_RESOLV_HOSTS, "r"); - - } else { - fp = fopen(filename, "r"); - } - if (!fp) { - return NULL; - } - - names = ldns_get_rr_list_hosts_frm_fp(fp); - fclose(fp); - return names; -} - -uint16_t -ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, - ldns_rr_list **ret) -{ - ldns_rdf_type t; - uint16_t names_found; - ldns_resolver *r; - ldns_status s; - - t = ldns_rdf_get_type(node); - names_found = 0; - r = res; - - if (res == NULL) { - /* prepare a new resolver, using /etc/resolv.conf as a guide */ - s = ldns_resolver_new_frm_file(&r, NULL); - if (s != LDNS_STATUS_OK) { - return 0; - } - } - - if (t == LDNS_RDF_TYPE_DNAME) { - /* we're asked to query for a name */ - *ret = ldns_get_rr_list_addr_by_name(r, node, c, 0); - names_found = ldns_rr_list_rr_count(*ret); - } - - if (t == LDNS_RDF_TYPE_A || t == LDNS_RDF_TYPE_AAAA) { - /* an address */ - *ret = ldns_get_rr_list_name_by_addr(r, node, c, 0); - names_found = ldns_rr_list_rr_count(*ret); - } - - if (res == NULL) { - ldns_resolver_deep_free(r); - } - - return names_found; -} - -bool -ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t) -{ - /* does the nsec cover the t given? */ - /* copied from host2str.c line 465: ldns_rdf2buffer_str_nsec */ - uint8_t window_block_nr; - uint8_t bitmap_length; - uint16_t type; - uint16_t pos = 0; - uint16_t bit_pos; - ldns_rdf *nsec_type_list = ldns_rr_rdf(nsec, 1); - uint8_t *data = ldns_rdf_data(nsec_type_list); - - while(pos < ldns_rdf_size(nsec_type_list)) { - window_block_nr = data[pos]; - bitmap_length = data[pos + 1]; - pos += 2; - - for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { - if (ldns_get_bit(&data[pos], bit_pos)) { - type = 256 * (uint16_t) window_block_nr + bit_pos; - - if ((ldns_rr_type)type == t) { - /* we have a winner */ - return true; - } - } - } - pos += (uint16_t) bitmap_length; - } - return false; -} - -void -ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...) -{ - int16_t rdf; - ldns_rdf *rd; - va_list va_rdf; - va_start(va_rdf, rdfnum); - - for (rdf = (int16_t)rdfnum; rdf != -1; rdf = (int16_t)va_arg(va_rdf, int)) - { - rd = ldns_rr_rdf(r, rdf); - if (!rd) { - continue; - } else { - ldns_rdf_print(fp, rd); - fprintf(fp, " "); /* not sure if we want to do this */ - } - } - va_end(va_rdf); -} diff --git a/libs/ldns/host2str.c b/libs/ldns/host2str.c deleted file mode 100644 index 6942f6aa3c..0000000000 --- a/libs/ldns/host2str.c +++ /dev/null @@ -1,2084 +0,0 @@ -/* - * host2str.c - * - * conversion routines from the host format - * to the presentation format (strings) - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ -#include - -#include - -#include - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#include -#include - -#ifndef INET_ADDRSTRLEN -#define INET_ADDRSTRLEN 16 -#endif -#ifndef INET6_ADDRSTRLEN -#define INET6_ADDRSTRLEN 46 -#endif - -/* lookup tables for standard DNS stuff */ - -/* Taken from RFC 2535, section 7. */ -ldns_lookup_table ldns_algorithms[] = { - { LDNS_RSAMD5, "RSAMD5" }, - { LDNS_DH, "DH" }, - { LDNS_DSA, "DSA" }, - { LDNS_ECC, "ECC" }, - { LDNS_RSASHA1, "RSASHA1" }, - { LDNS_DSA_NSEC3, "DSA-NSEC3-SHA1" }, - { LDNS_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" }, -#ifdef USE_SHA2 - { LDNS_RSASHA256, "RSASHA256"}, - { LDNS_RSASHA512, "RSASHA512"}, -#endif -#ifdef USE_GOST - { LDNS_ECC_GOST, "ECC-GOST"}, -#endif -#ifdef USE_ECDSA - { LDNS_ECDSAP256SHA256, "ECDSAP256SHA256"}, - { LDNS_ECDSAP384SHA384, "ECDSAP384SHA384"}, -#endif - { LDNS_INDIRECT, "INDIRECT" }, - { LDNS_PRIVATEDNS, "PRIVATEDNS" }, - { LDNS_PRIVATEOID, "PRIVATEOID" }, - { 0, NULL } -}; - -/* Taken from RFC 4398 */ -ldns_lookup_table ldns_cert_algorithms[] = { - { LDNS_CERT_PKIX, "PKIX" }, - { LDNS_CERT_SPKI, "SPKI" }, - { LDNS_CERT_PGP, "PGP" }, - { LDNS_CERT_IPKIX, "IPKIX" }, - { LDNS_CERT_ISPKI, "ISPKI" }, - { LDNS_CERT_IPGP, "IPGP" }, - { LDNS_CERT_ACPKIX, "ACPKIX" }, - { LDNS_CERT_IACPKIX, "IACPKIX" }, - { LDNS_CERT_URI, "URI" }, - { LDNS_CERT_OID, "OID" }, - { 0, NULL } -}; - -/* classes */ -ldns_lookup_table ldns_rr_classes[] = { - { LDNS_RR_CLASS_IN, "IN" }, - { LDNS_RR_CLASS_CH, "CH" }, - { LDNS_RR_CLASS_HS, "HS" }, - { LDNS_RR_CLASS_NONE, "NONE" }, - { LDNS_RR_CLASS_ANY, "ANY" }, - { 0, NULL } -}; - -/* if these are used elsewhere */ -ldns_lookup_table ldns_rcodes[] = { - { LDNS_RCODE_NOERROR, "NOERROR" }, - { LDNS_RCODE_FORMERR, "FORMERR" }, - { LDNS_RCODE_SERVFAIL, "SERVFAIL" }, - { LDNS_RCODE_NXDOMAIN, "NXDOMAIN" }, - { LDNS_RCODE_NOTIMPL, "NOTIMPL" }, - { LDNS_RCODE_REFUSED, "REFUSED" }, - { LDNS_RCODE_YXDOMAIN, "YXDOMAIN" }, - { LDNS_RCODE_YXRRSET, "YXRRSET" }, - { LDNS_RCODE_NXRRSET, "NXRRSET" }, - { LDNS_RCODE_NOTAUTH, "NOTAUTH" }, - { LDNS_RCODE_NOTZONE, "NOTZONE" }, - { 0, NULL } -}; - -ldns_lookup_table ldns_opcodes[] = { - { LDNS_PACKET_QUERY, "QUERY" }, - { LDNS_PACKET_IQUERY, "IQUERY" }, - { LDNS_PACKET_STATUS, "STATUS" }, - { LDNS_PACKET_NOTIFY, "NOTIFY" }, - { LDNS_PACKET_UPDATE, "UPDATE" }, - { 0, NULL } -}; - -ldns_status -ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode) -{ - ldns_lookup_table *lt = ldns_lookup_by_id(ldns_opcodes, opcode); - if (lt && lt->name) { - ldns_buffer_printf(output, "%s", lt->name); - } else { - ldns_buffer_printf(output, "OPCODE%u", opcode); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode) -{ - ldns_lookup_table *lt = ldns_lookup_by_id(ldns_rcodes, rcode); - if (lt && lt->name) { - ldns_buffer_printf(output, "%s", lt->name); - } else { - ldns_buffer_printf(output, "RCODE%u", rcode); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_algorithm2buffer_str(ldns_buffer *output, - ldns_algorithm algorithm) -{ - ldns_lookup_table *lt = ldns_lookup_by_id(ldns_algorithms, - algorithm); - if (lt && lt->name) { - ldns_buffer_printf(output, "%s", lt->name); - } else { - ldns_buffer_printf(output, "ALG%u", algorithm); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_cert_algorithm2buffer_str(ldns_buffer *output, - ldns_cert_algorithm cert_algorithm) -{ - ldns_lookup_table *lt = ldns_lookup_by_id(ldns_cert_algorithms, - cert_algorithm); - if (lt && lt->name) { - ldns_buffer_printf(output, "%s", lt->name); - } else { - ldns_buffer_printf(output, "CERT_ALG%u", - cert_algorithm); - } - return ldns_buffer_status(output); -} - -char * -ldns_pkt_opcode2str(ldns_pkt_opcode opcode) -{ - char *str; - ldns_buffer *buf; - - buf = ldns_buffer_new(12); - if (!buf) { - return NULL; - } - - str = NULL; - if (ldns_pkt_opcode2buffer_str(buf, opcode) == LDNS_STATUS_OK) { - str = ldns_buffer2str(buf); - } - - ldns_buffer_free(buf); - return str; -} - -char * -ldns_pkt_rcode2str(ldns_pkt_rcode rcode) -{ - char *str; - ldns_buffer *buf; - - buf = ldns_buffer_new(10); - if (!buf) { - return NULL; - } - - str = NULL; - if (ldns_pkt_rcode2buffer_str(buf, rcode) == LDNS_STATUS_OK) { - str = ldns_buffer2str(buf); - } - - ldns_buffer_free(buf); - return str; -} - -char * -ldns_pkt_algorithm2str(ldns_algorithm algorithm) -{ - char *str; - ldns_buffer *buf; - - buf = ldns_buffer_new(10); - if (!buf) { - return NULL; - } - - str = NULL; - if (ldns_algorithm2buffer_str(buf, algorithm) - == LDNS_STATUS_OK) { - str = ldns_buffer2str(buf); - } - - ldns_buffer_free(buf); - return str; -} - -char * -ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm) -{ - char *str; - ldns_buffer *buf; - - buf = ldns_buffer_new(10); - if (!buf) { - return NULL; - } - - str = NULL; - if (ldns_cert_algorithm2buffer_str(buf, cert_algorithm) - == LDNS_STATUS_OK) { - str = ldns_buffer2str(buf); - } - - ldns_buffer_free(buf); - return str; -} - - -/* do NOT pass compressed data here :p */ -ldns_status -ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname) -{ - /* can we do with 1 pos var? or without at all? */ - uint8_t src_pos = 0; - uint8_t len; - uint8_t *data; - uint8_t i; - unsigned char c; - - data = (uint8_t*)ldns_rdf_data(dname); - len = data[src_pos]; - - if (ldns_rdf_size(dname) > LDNS_MAX_DOMAINLEN) { - /* too large, return */ - return LDNS_STATUS_DOMAINNAME_OVERFLOW; - } - - /* special case: root label */ - if (1 == ldns_rdf_size(dname)) { - ldns_buffer_printf(output, "."); - } else { - while ((len > 0) && src_pos < ldns_rdf_size(dname)) { - src_pos++; - for(i = 0; i < len; i++) { - /* paranoia check for various 'strange' - characters in dnames - */ - c = (unsigned char) data[src_pos]; - if(c == '.' || c == ';' || - c == '(' || c == ')' || - c == '\\') { - ldns_buffer_printf(output, "\\%c", - data[src_pos]); - } else if (!(isascii(c) && isgraph(c))) { - ldns_buffer_printf(output, "\\%03u", - data[src_pos]); - } else { - ldns_buffer_printf(output, "%c", data[src_pos]); - } - src_pos++; - } - - if (src_pos < ldns_rdf_size(dname)) { - ldns_buffer_printf(output, "."); - } - len = data[src_pos]; - } - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint8_t data = ldns_rdf_data(rdf)[0]; - ldns_buffer_printf(output, "%lu", (unsigned long) data); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_int16(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); - ldns_buffer_printf(output, "%lu", (unsigned long) data); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint32_t data = ldns_read_uint32(ldns_rdf_data(rdf)); - ldns_buffer_printf(output, "%lu", (unsigned long) data); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* create a YYYYMMDDHHMMSS string if possible */ - time_t data_time = (time_t) ldns_read_uint32(ldns_rdf_data(rdf)); - struct tm tm; - char date_buf[16]; - - memset(&tm, 0, sizeof(tm)); - - if (gmtime_r(&data_time, &tm) && strftime(date_buf, 15, "%Y%m%d%H%M%S", &tm)) { - ldns_buffer_printf(output, "%s", date_buf); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf) -{ - char str[INET_ADDRSTRLEN]; - - if (inet_ntop(AF_INET, ldns_rdf_data(rdf), str, INET_ADDRSTRLEN)) { - ldns_buffer_printf(output, "%s", str); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf) -{ - char str[INET6_ADDRSTRLEN]; - - if (inet_ntop(AF_INET6, ldns_rdf_data(rdf), str, INET6_ADDRSTRLEN)) { - ldns_buffer_printf(output, "%s", str); - } - - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf) -{ - const uint8_t *data = ldns_rdf_data(rdf); - uint8_t length = data[0]; - size_t i; - - ldns_buffer_printf(output, "\""); - for (i = 1; i <= length; ++i) { - char ch = (char) data[i]; - if (isprint((int)ch) || ch=='\t') { - if (ch=='\"'||ch=='\\') - ldns_buffer_printf(output, "\\%c", ch); - else - ldns_buffer_printf(output, "%c", ch); - } else { - ldns_buffer_printf(output, "\\%03u", - (unsigned)(uint8_t) ch); - } - } - ldns_buffer_printf(output, "\""); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_b64(ldns_buffer *output, const ldns_rdf *rdf) -{ - size_t size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf)); - char *b64 = LDNS_XMALLOC(char, size); - if(!b64) return LDNS_STATUS_MEM_ERR; - if (ldns_b64_ntop(ldns_rdf_data(rdf), ldns_rdf_size(rdf), b64, size)) { - ldns_buffer_printf(output, "%s", b64); - } - LDNS_FREE(b64); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf) -{ - size_t size; - char *b32; - if(ldns_rdf_size(rdf) == 0) - return LDNS_STATUS_OK; - /* remove -1 for the b32-hash-len octet */ - size = ldns_b32_ntop_calculate_size(ldns_rdf_size(rdf) - 1); - /* add one for the end nul for the string */ - b32 = LDNS_XMALLOC(char, size + 1); - if(!b32) return LDNS_STATUS_MEM_ERR; - size = (size_t) ldns_b32_ntop_extended_hex(ldns_rdf_data(rdf) + 1, - ldns_rdf_size(rdf) - 1, b32, size+1); - if (size > 0) { - ldns_buffer_printf(output, "%s", b32); - } - LDNS_FREE(b32); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf) -{ - size_t i; - for (i = 0; i < ldns_rdf_size(rdf); i++) { - ldns_buffer_printf(output, "%02x", ldns_rdf_data(rdf)[i]); - } - - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); - const ldns_rr_descriptor *descriptor; - - descriptor = ldns_rr_descript(data); - if (descriptor && descriptor->_name) { - ldns_buffer_printf(output, "%s", descriptor->_name); - } else { - ldns_buffer_printf(output, "TYPE%u", data); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_class(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); - ldns_lookup_table *lt; - - lt = ldns_lookup_by_id(ldns_rr_classes, (int) data); - if (lt) { - ldns_buffer_printf(output, "\t%s", lt->name); - } else { - ldns_buffer_printf(output, "\tCLASS%d", data); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); - ldns_lookup_table *lt; - lt = ldns_lookup_by_id(ldns_cert_algorithms, (int) data); - if (lt) { - ldns_buffer_printf(output, "%s", lt->name); - } else { - ldns_buffer_printf(output, "%d", data); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_alg(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* don't use algorithm mnemonics in the presentation format - this kind of got sneaked into the rfc's */ - uint8_t data = ldns_rdf_data(rdf)[0]; - ldns_buffer_printf(output, "%d", data); - return ldns_buffer_status(output); -} - -static void -loc_cm_print(ldns_buffer *output, uint8_t mantissa, uint8_t exponent) -{ - uint8_t i; - /* is it 0. ? */ - if(exponent < 2) { - if(exponent == 1) - mantissa *= 10; - ldns_buffer_printf(output, "0.%02ld", (long)mantissa); - return; - } - /* always */ - ldns_buffer_printf(output, "%d", (int)mantissa); - for(i=0; i_name) { - ldns_buffer_printf(output, "%s", descriptor->_name); - } else { - /* exceptions for pseudotypes */ - switch (type) { - case LDNS_RR_TYPE_IXFR: - ldns_buffer_printf(output, "IXFR"); - break; - case LDNS_RR_TYPE_AXFR: - ldns_buffer_printf(output, "AXFR"); - break; - case LDNS_RR_TYPE_MAILA: - ldns_buffer_printf(output, "MAILA"); - break; - case LDNS_RR_TYPE_MAILB: - ldns_buffer_printf(output, "MAILB"); - break; - case LDNS_RR_TYPE_ANY: - ldns_buffer_printf(output, "ANY"); - break; - default: - ldns_buffer_printf(output, "TYPE%u", type); - } - } - return ldns_buffer_status(output); -} - -char * -ldns_rr_type2str(const ldns_rr_type type) -{ - char *str; - ldns_buffer *buf; - - buf = ldns_buffer_new(10); - if (!buf) { - return NULL; - } - - str = NULL; - if (ldns_rr_type2buffer_str(buf, type) == LDNS_STATUS_OK) { - str = ldns_buffer2str(buf); - } - - ldns_buffer_free(buf); - return str; -} - - -ldns_status -ldns_rr_class2buffer_str(ldns_buffer *output, - const ldns_rr_class klass) -{ - ldns_lookup_table *lt; - - lt = ldns_lookup_by_id(ldns_rr_classes, klass); - if (lt) { - ldns_buffer_printf(output, "%s", lt->name); - } else { - ldns_buffer_printf(output, "CLASS%d", klass); - } - return ldns_buffer_status(output); -} - -char * -ldns_rr_class2str(const ldns_rr_class klass) -{ - ldns_buffer *buf; - char *str; - - buf = ldns_buffer_new(10); - if (!buf) { - return NULL; - } - - str = NULL; - if (ldns_rr_class2buffer_str(buf, klass) == LDNS_STATUS_OK) { - str = ldns_buffer2str(buf); - } - ldns_buffer_free(buf); - return str; -} - -ldns_status -ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* we could do checking (ie degrees < 90 etc)? */ - uint8_t version = ldns_rdf_data(rdf)[0]; - uint8_t size; - uint8_t horizontal_precision; - uint8_t vertical_precision; - uint32_t longitude; - uint32_t latitude; - uint32_t altitude; - char northerness; - char easterness; - uint32_t h; - uint32_t m; - double s; - - uint32_t equator = (uint32_t) ldns_power(2, 31); - - if (version == 0) { - size = ldns_rdf_data(rdf)[1]; - horizontal_precision = ldns_rdf_data(rdf)[2]; - vertical_precision = ldns_rdf_data(rdf)[3]; - - latitude = ldns_read_uint32(&ldns_rdf_data(rdf)[4]); - longitude = ldns_read_uint32(&ldns_rdf_data(rdf)[8]); - altitude = ldns_read_uint32(&ldns_rdf_data(rdf)[12]); - - if (latitude > equator) { - northerness = 'N'; - latitude = latitude - equator; - } else { - northerness = 'S'; - latitude = equator - latitude; - } - h = latitude / (1000 * 60 * 60); - latitude = latitude % (1000 * 60 * 60); - m = latitude / (1000 * 60); - latitude = latitude % (1000 * 60); - s = (double) latitude / 1000.0; - ldns_buffer_printf(output, "%02u %02u %0.3f %c ", - h, m, s, northerness); - - if (longitude > equator) { - easterness = 'E'; - longitude = longitude - equator; - } else { - easterness = 'W'; - longitude = equator - longitude; - } - h = longitude / (1000 * 60 * 60); - longitude = longitude % (1000 * 60 * 60); - m = longitude / (1000 * 60); - longitude = longitude % (1000 * 60); - s = (double) longitude / (1000.0); - ldns_buffer_printf(output, "%02u %02u %0.3f %c ", - h, m, s, easterness); - - - s = ((double) altitude) / 100; - s -= 100000; - - if(altitude%100 != 0) - ldns_buffer_printf(output, "%.2f", s); - else - ldns_buffer_printf(output, "%.0f", s); - - ldns_buffer_printf(output, "m "); - - loc_cm_print(output, (size & 0xf0) >> 4, size & 0x0f); - ldns_buffer_printf(output, "m "); - - loc_cm_print(output, (horizontal_precision & 0xf0) >> 4, - horizontal_precision & 0x0f); - ldns_buffer_printf(output, "m "); - - loc_cm_print(output, (vertical_precision & 0xf0) >> 4, - vertical_precision & 0x0f); - ldns_buffer_printf(output, "m"); - - return ldns_buffer_status(output); - } else { - return ldns_rdf2buffer_str_hex(output, rdf); - } -} - -ldns_status -ldns_rdf2buffer_str_unknown(ldns_buffer *output, const ldns_rdf *rdf) -{ - ldns_buffer_printf(output, "\\# %u ", ldns_rdf_size(rdf)); - return ldns_rdf2buffer_str_hex(output, rdf); -} - -ldns_status -ldns_rdf2buffer_str_nsap(ldns_buffer *output, const ldns_rdf *rdf) -{ - ldns_buffer_printf(output, "0x"); - return ldns_rdf2buffer_str_hex(output, rdf); -} - -ldns_status -ldns_rdf2buffer_str_atma(ldns_buffer *output, const ldns_rdf *rdf) -{ - return ldns_rdf2buffer_str_hex(output, rdf); -} - -ldns_status -ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* protocol, followed by bitmap of services */ - struct protoent *protocol; - char *proto_name = NULL; - uint8_t protocol_nr; - struct servent *service; - uint16_t current_service; - - protocol_nr = ldns_rdf_data(rdf)[0]; - protocol = getprotobynumber((int) protocol_nr); - if (protocol && (protocol->p_name != NULL)) { - proto_name = protocol->p_name; - ldns_buffer_printf(output, "%s ", protocol->p_name); - } else { - ldns_buffer_printf(output, "%u ", protocol_nr); - } - -#ifdef HAVE_ENDPROTOENT - endprotoent(); -#endif - - for (current_service = 0; - current_service < ldns_rdf_size(rdf) * 7; current_service++) { - if (ldns_get_bit(&(ldns_rdf_data(rdf)[1]), current_service)) { - service = getservbyport((int) htons(current_service), - proto_name); - if (service && service->s_name) { - ldns_buffer_printf(output, "%s ", service->s_name); - } else { - ldns_buffer_printf(output, "%u ", current_service); - } -#ifdef HAVE_ENDSERVENT - endservent(); -#endif - } - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* Note: this code is duplicated in higher.c in - * ldns_nsec_type_check() function - */ - uint8_t window_block_nr; - uint8_t bitmap_length; - uint16_t type; - uint16_t pos = 0; - uint16_t bit_pos; - uint8_t *data = ldns_rdf_data(rdf); - const ldns_rr_descriptor *descriptor; - - while(pos < ldns_rdf_size(rdf)) { - window_block_nr = data[pos]; - bitmap_length = data[pos + 1]; - pos += 2; - - for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { - if (ldns_get_bit(&data[pos], bit_pos)) { - type = 256 * (uint16_t) window_block_nr + bit_pos; - descriptor = ldns_rr_descript(type); - - if (descriptor && descriptor->_name) { - ldns_buffer_printf(output, "%s ", - descriptor->_name); - } else { - ldns_buffer_printf(output, "TYPE%u ", type); - } - } - } - - pos += (uint16_t) bitmap_length; - } - - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint8_t salt_length; - uint8_t salt_pos; - - uint8_t *data = ldns_rdf_data(rdf); - - if(ldns_rdf_size(rdf) == 0) { - output->_status = LDNS_STATUS_ERR; - return ldns_buffer_status(output); - } - salt_length = data[0]; - /* from now there are variable length entries so remember pos */ - if (salt_length == 0 || ((size_t)salt_length)+1 > ldns_rdf_size(rdf)) { - ldns_buffer_printf(output, "- "); - } else { - for (salt_pos = 0; salt_pos < salt_length; salt_pos++) { - ldns_buffer_printf(output, "%02x", data[1 + salt_pos]); - } - ldns_buffer_printf(output, " "); - } - - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* period is the number of seconds */ - uint32_t p = ldns_read_uint32(ldns_rdf_data(rdf)); - ldns_buffer_printf(output, "%u", p); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_tsigtime(ldns_buffer *output,const ldns_rdf *rdf) -{ - /* tsigtime is 48 bits network order unsigned integer */ - uint64_t tsigtime = 0; - uint8_t *data = ldns_rdf_data(rdf); - - if (ldns_rdf_size(rdf) != 6) { - return LDNS_STATUS_ERR; - } - - tsigtime = ldns_read_uint16(data); - tsigtime *= 65536; - tsigtime += ldns_read_uint16(data+2); - tsigtime *= 65536; - - ldns_buffer_printf(output, "%llu ", tsigtime); - - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) -{ - uint8_t *data = ldns_rdf_data(rdf); - uint16_t address_family; - uint8_t prefix; - bool negation; - uint8_t adf_length; - size_t i; - size_t pos = 0; - - while (pos < (unsigned int) ldns_rdf_size(rdf)) { - if(pos + 3 >= (unsigned)ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; - address_family = ldns_read_uint16(&data[pos]); - prefix = data[pos + 2]; - negation = data[pos + 3] & LDNS_APL_NEGATION; - adf_length = data[pos + 3] & LDNS_APL_MASK; - if (address_family == LDNS_APL_IP4) { - /* check if prefix < 32? */ - if (negation) { - ldns_buffer_printf(output, "!"); - } - ldns_buffer_printf(output, "%u:", address_family); - /* address is variable length 0 - 4 */ - for (i = 0; i < 4; i++) { - if (i > 0) { - ldns_buffer_printf(output, "."); - } - if (i < (unsigned short) adf_length) { - if(pos+i+4 >= ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; - ldns_buffer_printf(output, "%d", - data[pos + i + 4]); - } else { - ldns_buffer_printf(output, "0"); - } - } - ldns_buffer_printf(output, "/%u ", prefix); - } else if (address_family == LDNS_APL_IP6) { - /* check if prefix < 128? */ - if (negation) { - ldns_buffer_printf(output, "!"); - } - ldns_buffer_printf(output, "%u:", address_family); - /* address is variable length 0 - 16 */ - for (i = 0; i < 16; i++) { - if (i % 2 == 0 && i > 0) { - ldns_buffer_printf(output, ":"); - } - if (i < (unsigned short) adf_length) { - if(pos+i+4 >= ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; - ldns_buffer_printf(output, "%02x", - data[pos + i + 4]); - } else { - ldns_buffer_printf(output, "00"); - } - } - ldns_buffer_printf(output, "/%u ", prefix); - - } else { - /* unknown address family */ - ldns_buffer_printf(output, "Unknown address family: %u data: ", - address_family); - for (i = 1; i < (unsigned short) (4 + adf_length); i++) { - if(pos+i >= ldns_rdf_size(rdf)) - return LDNS_STATUS_SYNTAX_RDATA_ERR; - ldns_buffer_printf(output, "%02x", data[i]); - } - } - pos += 4 + adf_length; - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* Subtract the size (2) of the number that specifies the length */ - size_t size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf) - 2); - char *b64 = LDNS_XMALLOC(char, size); - if(!b64) - return LDNS_STATUS_MEM_ERR; - - ldns_buffer_printf(output, "%u ", ldns_rdf_size(rdf) - 2); - - if (ldns_rdf_size(rdf) > 2 && - ldns_b64_ntop(ldns_rdf_data(rdf) + 2, - ldns_rdf_size(rdf) - 2, - b64, size)) { - ldns_buffer_printf(output, "%s", b64); - } - LDNS_FREE(b64); - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* wire format from - http://www.ietf.org/internet-drafts/draft-ietf-ipseckey-rr-12.txt - */ - uint8_t *data = ldns_rdf_data(rdf); - uint8_t precedence; - uint8_t gateway_type; - uint8_t algorithm; - - ldns_rdf *gateway = NULL; - uint8_t *gateway_data; - - size_t public_key_size; - uint8_t *public_key_data; - ldns_rdf *public_key; - - size_t offset = 0; - ldns_status status; - - precedence = data[0]; - gateway_type = data[1]; - algorithm = data[2]; - offset = 3; - - switch (gateway_type) { - case 0: - /* no gateway */ - break; - case 1: - gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP4ADDRLEN); - if(!gateway_data) - return LDNS_STATUS_MEM_ERR; - memcpy(gateway_data, &data[offset], LDNS_IP4ADDRLEN); - gateway = ldns_rdf_new(LDNS_RDF_TYPE_A, LDNS_IP4ADDRLEN , gateway_data); - offset += LDNS_IP4ADDRLEN; - if(!gateway) { - LDNS_FREE(gateway_data); - return LDNS_STATUS_MEM_ERR; - } - break; - case 2: - gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP6ADDRLEN); - if(!gateway_data) - return LDNS_STATUS_MEM_ERR; - memcpy(gateway_data, &data[offset], LDNS_IP6ADDRLEN); - offset += LDNS_IP6ADDRLEN; - gateway = - ldns_rdf_new(LDNS_RDF_TYPE_AAAA, LDNS_IP6ADDRLEN, gateway_data); - if(!gateway) { - LDNS_FREE(gateway_data); - return LDNS_STATUS_MEM_ERR; - } - break; - case 3: - status = ldns_wire2dname(&gateway, data, ldns_rdf_size(rdf), &offset); - if(status != LDNS_STATUS_OK) - return status; - break; - default: - /* error? */ - break; - } - - public_key_size = ldns_rdf_size(rdf) - offset; - public_key_data = LDNS_XMALLOC(uint8_t, public_key_size); - if(!public_key_data) { - ldns_rdf_free(gateway); - return LDNS_STATUS_MEM_ERR; - } - memcpy(public_key_data, &data[offset], public_key_size); - public_key = ldns_rdf_new(LDNS_RDF_TYPE_B64, public_key_size, public_key_data); - if(!public_key) { - LDNS_FREE(public_key_data); - ldns_rdf_free(gateway); - return LDNS_STATUS_MEM_ERR; - } - - ldns_buffer_printf(output, "%u %u %u ", precedence, gateway_type, algorithm); - if (gateway) - (void) ldns_rdf2buffer_str(output, gateway); - else - ldns_buffer_printf(output, "."); - ldns_buffer_printf(output, " "); - (void) ldns_rdf2buffer_str(output, public_key); - - ldns_rdf_free(gateway); - ldns_rdf_free(public_key); - - return ldns_buffer_status(output); -} - -ldns_status -ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf) -{ - /* TSIG RRs have no presentation format, make them #size */ - return ldns_rdf2buffer_str_unknown(output, rdf); -} - - -ldns_status -ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) -{ - ldns_status res = LDNS_STATUS_OK; - - /*ldns_buffer_printf(buffer, "%u:", ldns_rdf_get_type(rdf));*/ - if (rdf) { - switch(ldns_rdf_get_type(rdf)) { - case LDNS_RDF_TYPE_NONE: - break; - case LDNS_RDF_TYPE_DNAME: - res = ldns_rdf2buffer_str_dname(buffer, rdf); - break; - case LDNS_RDF_TYPE_INT8: - res = ldns_rdf2buffer_str_int8(buffer, rdf); - break; - case LDNS_RDF_TYPE_INT16: - res = ldns_rdf2buffer_str_int16(buffer, rdf); - break; - case LDNS_RDF_TYPE_INT32: - res = ldns_rdf2buffer_str_int32(buffer, rdf); - break; - case LDNS_RDF_TYPE_PERIOD: - res = ldns_rdf2buffer_str_period(buffer, rdf); - break; - case LDNS_RDF_TYPE_TSIGTIME: - res = ldns_rdf2buffer_str_tsigtime(buffer, rdf); - break; - case LDNS_RDF_TYPE_A: - res = ldns_rdf2buffer_str_a(buffer, rdf); - break; - case LDNS_RDF_TYPE_AAAA: - res = ldns_rdf2buffer_str_aaaa(buffer, rdf); - break; - case LDNS_RDF_TYPE_STR: - res = ldns_rdf2buffer_str_str(buffer, rdf); - break; - case LDNS_RDF_TYPE_APL: - res = ldns_rdf2buffer_str_apl(buffer, rdf); - break; - case LDNS_RDF_TYPE_B32_EXT: - res = ldns_rdf2buffer_str_b32_ext(buffer, rdf); - break; - case LDNS_RDF_TYPE_B64: - res = ldns_rdf2buffer_str_b64(buffer, rdf); - break; - case LDNS_RDF_TYPE_HEX: - res = ldns_rdf2buffer_str_hex(buffer, rdf); - break; - case LDNS_RDF_TYPE_NSEC: - res = ldns_rdf2buffer_str_nsec(buffer, rdf); - break; - case LDNS_RDF_TYPE_NSEC3_SALT: - res = ldns_rdf2buffer_str_nsec3_salt(buffer, rdf); - break; - case LDNS_RDF_TYPE_TYPE: - res = ldns_rdf2buffer_str_type(buffer, rdf); - break; - case LDNS_RDF_TYPE_CLASS: - res = ldns_rdf2buffer_str_class(buffer, rdf); - break; - case LDNS_RDF_TYPE_CERT_ALG: - res = ldns_rdf2buffer_str_cert_alg(buffer, rdf); - break; - case LDNS_RDF_TYPE_ALG: - res = ldns_rdf2buffer_str_alg(buffer, rdf); - break; - case LDNS_RDF_TYPE_UNKNOWN: - res = ldns_rdf2buffer_str_unknown(buffer, rdf); - break; - case LDNS_RDF_TYPE_TIME: - res = ldns_rdf2buffer_str_time(buffer, rdf); - break; - case LDNS_RDF_TYPE_LOC: - res = ldns_rdf2buffer_str_loc(buffer, rdf); - break; - case LDNS_RDF_TYPE_WKS: - case LDNS_RDF_TYPE_SERVICE: - res = ldns_rdf2buffer_str_wks(buffer, rdf); - break; - case LDNS_RDF_TYPE_NSAP: - res = ldns_rdf2buffer_str_nsap(buffer, rdf); - break; - case LDNS_RDF_TYPE_ATMA: - res = ldns_rdf2buffer_str_atma(buffer, rdf); - break; - case LDNS_RDF_TYPE_IPSECKEY: - res = ldns_rdf2buffer_str_ipseckey(buffer, rdf); - break; - case LDNS_RDF_TYPE_TSIG: - res = ldns_rdf2buffer_str_tsig(buffer, rdf); - break; - case LDNS_RDF_TYPE_INT16_DATA: - res = ldns_rdf2buffer_str_int16_data(buffer, rdf); - break; - case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: - res = ldns_rdf2buffer_str_b32_ext(buffer, rdf); - break; - } - } else { - ldns_buffer_printf(buffer, "(null) "); - res = ldns_buffer_status(buffer); - } - return res; -} - -ldns_status -ldns_rr2buffer_str(ldns_buffer *output, const ldns_rr *rr) -{ - uint16_t i, flags; - ldns_status status = LDNS_STATUS_OK; - if (!rr) { - ldns_buffer_printf(output, "(null)\n"); - } else { - if (ldns_rr_owner(rr)) { - status = ldns_rdf2buffer_str_dname(output, ldns_rr_owner(rr)); - } - if (status != LDNS_STATUS_OK) { - return status; - } - - /* TTL should NOT be printed if it is a question */ - if (!ldns_rr_is_question(rr)) { - ldns_buffer_printf(output, "\t%d", ldns_rr_ttl(rr)); - } - - ldns_buffer_printf(output, "\t"); - status = ldns_rr_class2buffer_str(output, ldns_rr_get_class(rr)); - if (status != LDNS_STATUS_OK) { - return status; - } - ldns_buffer_printf(output, "\t"); - - status = ldns_rr_type2buffer_str(output, ldns_rr_get_type(rr)); - if (status != LDNS_STATUS_OK) { - return status; - } - - if (ldns_rr_rd_count(rr) > 0) { - ldns_buffer_printf(output, "\t"); - } else if (!ldns_rr_is_question(rr)) { - ldns_buffer_printf(output, "\t\\# 0"); - } - - for (i = 0; i < ldns_rr_rd_count(rr); i++) { - status = ldns_rdf2buffer_str(output, ldns_rr_rdf(rr, i)); - if(status != LDNS_STATUS_OK) - return status; - if (i < ldns_rr_rd_count(rr) - 1) { - ldns_buffer_printf(output, " "); - } - } - /* per RR special comments - handy for DNSSEC types */ - /* check to prevent question sec. rr from - * getting here */ - if (ldns_rr_rd_count(rr) > 0) { - switch (ldns_rr_get_type(rr)) { - case LDNS_RR_TYPE_DNSKEY: - if (ldns_rr_rdf(rr, 0)) { - flags = ldns_rdf2native_int16(ldns_rr_rdf(rr, 0)); - if (flags == 256 || flags == 384) { - ldns_buffer_printf(output, - " ;{id = %u (zsk), size = %db}", - (unsigned int) ldns_calc_keytag(rr), - ldns_rr_dnskey_key_size(rr)); - break; - } - if (flags == 257 || flags == 385) { - ldns_buffer_printf(output, - " ;{id = %u (ksk), size = %db}", - (unsigned int) ldns_calc_keytag(rr), - ldns_rr_dnskey_key_size(rr)); - break; - } - ldns_buffer_printf(output, " ;{id = %u, size = %db}", - (unsigned int) ldns_calc_keytag(rr), - ldns_rr_dnskey_key_size(rr)); - } - break; - case LDNS_RR_TYPE_RRSIG: - ldns_buffer_printf(output, " ;{id = %d}", - ldns_rdf2native_int16(ldns_rr_rdf(rr, 6))); - break; - case LDNS_RR_TYPE_DS: - { - uint8_t *data = ldns_rdf_data(ldns_rr_rdf(rr, 3)); - size_t len = ldns_rdf_size(ldns_rr_rdf(rr, 3)); - char *babble = ldns_bubblebabble(data, len); - if(babble) - ldns_buffer_printf(output, " ; %s", babble); - LDNS_FREE(babble); - } - break; - case LDNS_RR_TYPE_NSEC3: - if (ldns_nsec3_optout(rr)) { - ldns_buffer_printf(output, " ; flags: optout"); - } - break; - default: - break; - - } - } - /* last */ - ldns_buffer_printf(output, "\n"); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_rr_list2buffer_str(ldns_buffer *output, const ldns_rr_list *list) -{ - uint16_t i; - - for(i = 0; i < ldns_rr_list_rr_count(list); i++) { - (void) ldns_rr2buffer_str(output, ldns_rr_list_rr(list, i)); - } - return ldns_buffer_status(output); -} - -ldns_status -ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt) -{ - ldns_lookup_table *opcode = ldns_lookup_by_id(ldns_opcodes, - (int) ldns_pkt_get_opcode(pkt)); - ldns_lookup_table *rcode = ldns_lookup_by_id(ldns_rcodes, - (int) ldns_pkt_get_rcode(pkt)); - - ldns_buffer_printf(output, ";; ->>HEADER<<- "); - if (opcode) { - ldns_buffer_printf(output, "opcode: %s, ", opcode->name); - } else { - ldns_buffer_printf(output, "opcode: ?? (%u), ", - ldns_pkt_get_opcode(pkt)); - } - if (rcode) { - ldns_buffer_printf(output, "rcode: %s, ", rcode->name); - } else { - ldns_buffer_printf(output, "rcode: ?? (%u), ", ldns_pkt_get_rcode(pkt)); - } - ldns_buffer_printf(output, "id: %d\n", ldns_pkt_id(pkt)); - ldns_buffer_printf(output, ";; flags: "); - - if (ldns_pkt_qr(pkt)) { - ldns_buffer_printf(output, "qr "); - } - if (ldns_pkt_aa(pkt)) { - ldns_buffer_printf(output, "aa "); - } - if (ldns_pkt_tc(pkt)) { - ldns_buffer_printf(output, "tc "); - } - if (ldns_pkt_rd(pkt)) { - ldns_buffer_printf(output, "rd "); - } - if (ldns_pkt_cd(pkt)) { - ldns_buffer_printf(output, "cd "); - } - if (ldns_pkt_ra(pkt)) { - ldns_buffer_printf(output, "ra "); - } - if (ldns_pkt_ad(pkt)) { - ldns_buffer_printf(output, "ad "); - } - ldns_buffer_printf(output, "; "); - ldns_buffer_printf(output, "QUERY: %u, ", ldns_pkt_qdcount(pkt)); - ldns_buffer_printf(output, "ANSWER: %u, ", ldns_pkt_ancount(pkt)); - ldns_buffer_printf(output, "AUTHORITY: %u, ", ldns_pkt_nscount(pkt)); - ldns_buffer_printf(output, "ADDITIONAL: %u ", ldns_pkt_arcount(pkt)); - return ldns_buffer_status(output); -} - -ldns_status -ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt) -{ - uint16_t i; - ldns_status status = LDNS_STATUS_OK; - char *tmp; - struct timeval time; - time_t time_tt; - - if (!pkt) { - ldns_buffer_printf(output, "null"); - return LDNS_STATUS_OK; - } - - if (ldns_buffer_status_ok(output)) { - status = ldns_pktheader2buffer_str(output, pkt); - if (status != LDNS_STATUS_OK) { - return status; - } - - ldns_buffer_printf(output, "\n"); - - ldns_buffer_printf(output, ";; QUESTION SECTION:\n;; "); - - - for (i = 0; i < ldns_pkt_qdcount(pkt); i++) { - status = ldns_rr2buffer_str(output, - ldns_rr_list_rr(ldns_pkt_question(pkt), i)); - if (status != LDNS_STATUS_OK) { - return status; - } - } - ldns_buffer_printf(output, "\n"); - - ldns_buffer_printf(output, ";; ANSWER SECTION:\n"); - for (i = 0; i < ldns_pkt_ancount(pkt); i++) { - status = ldns_rr2buffer_str(output, - ldns_rr_list_rr(ldns_pkt_answer(pkt), i)); - if (status != LDNS_STATUS_OK) { - return status; - } - - } - ldns_buffer_printf(output, "\n"); - - ldns_buffer_printf(output, ";; AUTHORITY SECTION:\n"); - - for (i = 0; i < ldns_pkt_nscount(pkt); i++) { - status = ldns_rr2buffer_str(output, - ldns_rr_list_rr(ldns_pkt_authority(pkt), i)); - if (status != LDNS_STATUS_OK) { - return status; - } - } - ldns_buffer_printf(output, "\n"); - - ldns_buffer_printf(output, ";; ADDITIONAL SECTION:\n"); - for (i = 0; i < ldns_pkt_arcount(pkt); i++) { - status = ldns_rr2buffer_str(output, - ldns_rr_list_rr(ldns_pkt_additional(pkt), i)); - if (status != LDNS_STATUS_OK) { - return status; - } - - } - ldns_buffer_printf(output, "\n"); - /* add some futher fields */ - ldns_buffer_printf(output, ";; Query time: %d msec\n", - ldns_pkt_querytime(pkt)); - if (ldns_pkt_edns(pkt)) { - ldns_buffer_printf(output, - ";; EDNS: version %u; flags:", - ldns_pkt_edns_version(pkt)); - if (ldns_pkt_edns_do(pkt)) { - ldns_buffer_printf(output, " do"); - } - /* the extended rcode is the value set, shifted four bits, - * and or'd with the original rcode */ - if (ldns_pkt_edns_extended_rcode(pkt)) { - ldns_buffer_printf(output, " ; ext-rcode: %d", - (ldns_pkt_edns_extended_rcode(pkt) << 4 | ldns_pkt_get_rcode(pkt))); - } - ldns_buffer_printf(output, " ; udp: %u\n", - ldns_pkt_edns_udp_size(pkt)); - - if (ldns_pkt_edns_data(pkt)) { - ldns_buffer_printf(output, ";; Data: "); - (void)ldns_rdf2buffer_str(output, - ldns_pkt_edns_data(pkt)); - ldns_buffer_printf(output, "\n"); - } - } - if (ldns_pkt_tsig(pkt)) { - ldns_buffer_printf(output, ";; TSIG:\n;; "); - (void) ldns_rr2buffer_str(output, ldns_pkt_tsig(pkt)); - ldns_buffer_printf(output, "\n"); - } - if (ldns_pkt_answerfrom(pkt)) { - tmp = ldns_rdf2str(ldns_pkt_answerfrom(pkt)); - ldns_buffer_printf(output, ";; SERVER: %s\n", tmp); - LDNS_FREE(tmp); - } - time = ldns_pkt_timestamp(pkt); - time_tt = (time_t)time.tv_sec; - ldns_buffer_printf(output, ";; WHEN: %s", - (char*)ctime(&time_tt)); - - ldns_buffer_printf(output, ";; MSG SIZE rcvd: %d\n", - (int)ldns_pkt_size(pkt)); - } else { - return ldns_buffer_status(output); - } - return status; -} - -#ifdef HAVE_SSL -static ldns_status -ldns_hmac_key2buffer_str(ldns_buffer *output, const ldns_key *k) -{ - ldns_status status; - size_t i; - ldns_rdf *b64_bignum; - - ldns_buffer_printf(output, "Key: "); - - i = ldns_key_hmac_size(k); - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, ldns_key_hmac_key(k)); - status = ldns_rdf2buffer_str(output, b64_bignum); - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - return status; -} -#endif - -#if defined(HAVE_SSL) && defined(USE_GOST) -static ldns_status -ldns_gost_key2buffer_str(ldns_buffer *output, EVP_PKEY *p) -{ - unsigned char* pp = NULL; - int ret; - ldns_rdf *b64_bignum; - ldns_status status; - - ldns_buffer_printf(output, "GostAsn1: "); - - ret = i2d_PrivateKey(p, &pp); - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, (size_t)ret, pp); - status = ldns_rdf2buffer_str(output, b64_bignum); - - ldns_rdf_deep_free(b64_bignum); - OPENSSL_free(pp); - ldns_buffer_printf(output, "\n"); - return status; -} -#endif - -ldns_status -ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k) -{ - ldns_status status = LDNS_STATUS_OK; - unsigned char *bignum; -#ifndef S_SPLINT_S - uint16_t i; -#endif - -#ifdef HAVE_SSL - /* not used when ssl is not defined */ - ldns_rdf *b64_bignum = NULL; - - RSA *rsa; - DSA *dsa; -#endif /* HAVE_SSL */ - - if (!k) { - return LDNS_STATUS_ERR; - } - - bignum = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); - if (!bignum) { - return LDNS_STATUS_ERR; - } - - if (ldns_buffer_status_ok(output)) { -#ifdef HAVE_SSL - switch(ldns_key_algorithm(k)) { - case LDNS_SIGN_RSASHA1: - case LDNS_SIGN_RSASHA1_NSEC3: - case LDNS_SIGN_RSASHA256: - case LDNS_SIGN_RSASHA512: - case LDNS_SIGN_RSAMD5: - /* copied by looking at dnssec-keygen output */ - /* header */ - rsa = ldns_key_rsa_key(k); - - ldns_buffer_printf(output,"Private-key-format: v1.2\n"); - switch(ldns_key_algorithm(k)) { - case LDNS_SIGN_RSAMD5: - ldns_buffer_printf(output, - "Algorithm: %u (RSA)\n", - LDNS_RSAMD5); - break; - case LDNS_SIGN_RSASHA1: - ldns_buffer_printf(output, - "Algorithm: %u (RSASHA1)\n", - LDNS_RSASHA1); - break; - case LDNS_SIGN_RSASHA1_NSEC3: - ldns_buffer_printf(output, - "Algorithm: %u (RSASHA1_NSEC3)\n", - LDNS_RSASHA1_NSEC3); - break; -#ifdef USE_SHA2 - case LDNS_SIGN_RSASHA256: - ldns_buffer_printf(output, - "Algorithm: %u (RSASHA256)\n", - LDNS_RSASHA256); - break; - case LDNS_SIGN_RSASHA512: - ldns_buffer_printf(output, - "Algorithm: %u (RSASHA512)\n", - LDNS_RSASHA512); - break; -#endif - default: - fprintf(stderr, "Warning: unknown signature "); - fprintf(stderr, - "algorithm type %u\n", - ldns_key_algorithm(k)); - ldns_buffer_printf(output, - "Algorithm: %u (Unknown)\n", - ldns_key_algorithm(k)); - break; - } - - /* print to buf, convert to bin, convert to b64, - * print to buf */ - ldns_buffer_printf(output, "Modulus: "); -#ifndef S_SPLINT_S - i = (uint16_t)BN_bn2bin(rsa->n, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - ldns_buffer_printf(output, "PublicExponent: "); - i = (uint16_t)BN_bn2bin(rsa->e, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - - ldns_buffer_printf(output, "PrivateExponent: "); - if (rsa->d) { - i = (uint16_t)BN_bn2bin(rsa->d, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - ldns_buffer_printf(output, "(Not available)\n"); - } - - ldns_buffer_printf(output, "Prime1: "); - if (rsa->p) { - i = (uint16_t)BN_bn2bin(rsa->p, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - ldns_buffer_printf(output, "(Not available)\n"); - } - - ldns_buffer_printf(output, "Prime2: "); - if (rsa->q) { - i = (uint16_t)BN_bn2bin(rsa->q, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - ldns_buffer_printf(output, "(Not available)\n"); - } - - ldns_buffer_printf(output, "Exponent1: "); - if (rsa->dmp1) { - i = (uint16_t)BN_bn2bin(rsa->dmp1, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - ldns_buffer_printf(output, "(Not available)\n"); - } - - ldns_buffer_printf(output, "Exponent2: "); - if (rsa->dmq1) { - i = (uint16_t)BN_bn2bin(rsa->dmq1, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - ldns_buffer_printf(output, "(Not available)\n"); - } - - ldns_buffer_printf(output, "Coefficient: "); - if (rsa->iqmp) { - i = (uint16_t)BN_bn2bin(rsa->iqmp, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - ldns_buffer_printf(output, "(Not available)\n"); - } -#endif /* splint */ - - RSA_free(rsa); - break; - case LDNS_SIGN_DSA: - case LDNS_SIGN_DSA_NSEC3: - dsa = ldns_key_dsa_key(k); - - ldns_buffer_printf(output,"Private-key-format: v1.2\n"); - if (ldns_key_algorithm(k) == LDNS_SIGN_DSA) { - ldns_buffer_printf(output,"Algorithm: 3 (DSA)\n"); - } else if (ldns_key_algorithm(k) == LDNS_SIGN_DSA_NSEC3) { - ldns_buffer_printf(output,"Algorithm: 6 (DSA_NSEC3)\n"); - } - - /* print to buf, convert to bin, convert to b64, - * print to buf */ - ldns_buffer_printf(output, "Prime(p): "); -#ifndef S_SPLINT_S - if (dsa->p) { - i = (uint16_t)BN_bn2bin(dsa->p, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - printf("(Not available)\n"); - } - - ldns_buffer_printf(output, "Subprime(q): "); - if (dsa->q) { - i = (uint16_t)BN_bn2bin(dsa->q, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - printf("(Not available)\n"); - } - - ldns_buffer_printf(output, "Base(g): "); - if (dsa->g) { - i = (uint16_t)BN_bn2bin(dsa->g, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - printf("(Not available)\n"); - } - - ldns_buffer_printf(output, "Private_value(x): "); - if (dsa->priv_key) { - i = (uint16_t)BN_bn2bin(dsa->priv_key, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - printf("(Not available)\n"); - } - - ldns_buffer_printf(output, "Public_value(y): "); - if (dsa->pub_key) { - i = (uint16_t)BN_bn2bin(dsa->pub_key, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - } else { - printf("(Not available)\n"); - } -#endif /* splint */ - break; - case LDNS_SIGN_ECC_GOST: - /* no format defined, use blob */ -#if defined(HAVE_SSL) && defined(USE_GOST) - ldns_buffer_printf(output, "Private-key-format: v1.2\n"); - ldns_buffer_printf(output, "Algorithm: %d (ECC-GOST)\n", LDNS_SIGN_ECC_GOST); - status = ldns_gost_key2buffer_str(output, -#ifndef S_SPLINT_S - k->_key.key -#else - NULL -#endif - ); - -#endif - break; -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - case LDNS_SIGN_ECDSAP384SHA384: - ldns_buffer_printf(output, "Private-key-format: v1.2\n"); - ldns_buffer_printf(output, "Algorithm: %d (", ldns_key_algorithm(k)); - status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k)); -#ifndef S_SPLINT_S - ldns_buffer_printf(output, ")\n"); - if(k->_key.key) { - EC_KEY* ec = EVP_PKEY_get1_EC_KEY(k->_key.key); - const BIGNUM* b = EC_KEY_get0_private_key(ec); - ldns_buffer_printf(output, "PrivateKey: "); - i = (uint16_t)BN_bn2bin(b, bignum); - if (i > LDNS_MAX_KEYLEN) { - goto error; - } - b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); - if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { - goto error; - } - ldns_rdf_deep_free(b64_bignum); - ldns_buffer_printf(output, "\n"); - /* down reference count in EC_KEY - * its still assigned to the PKEY */ - EC_KEY_free(ec); - } -#endif /* splint */ - break; -#endif - case LDNS_SIGN_HMACMD5: - /* there's not much of a format defined for TSIG */ - /* It's just a binary blob, Same for all algorithms */ - ldns_buffer_printf(output, "Private-key-format: v1.2\n"); - ldns_buffer_printf(output, "Algorithm: 157 (HMAC_MD5)\n"); - status = ldns_hmac_key2buffer_str(output, k); - break; - case LDNS_SIGN_HMACSHA1: - ldns_buffer_printf(output, "Private-key-format: v1.2\n"); - ldns_buffer_printf(output, "Algorithm: 158 (HMAC_SHA1)\n"); - status = ldns_hmac_key2buffer_str(output, k); - break; - case LDNS_SIGN_HMACSHA256: - ldns_buffer_printf(output, "Private-key-format: v1.2\n"); - ldns_buffer_printf(output, "Algorithm: 159 (HMAC_SHA256)\n"); - status = ldns_hmac_key2buffer_str(output, k); - break; - } -#endif /* HAVE_SSL */ - } else { -#ifdef HAVE_SSL - LDNS_FREE(b64_bignum); -#endif - LDNS_FREE(bignum); - return ldns_buffer_status(output); - } - LDNS_FREE(bignum); - return status; - -#ifdef HAVE_SSL - /* compiles warn the label isn't used */ -error: - LDNS_FREE(bignum); - return LDNS_STATUS_ERR; -#endif /* HAVE_SSL */ - -} - -/* - * Zero terminate the buffer and fix it to the size of the string. - */ -char * -ldns_buffer2str(ldns_buffer *buffer) -{ - char *tmp_str; - char *str; - - /* check if buffer ends with \0, if not, and - if there is space, add it */ - if (*(ldns_buffer_at(buffer, ldns_buffer_position(buffer))) != 0) { - if (!ldns_buffer_reserve(buffer, 1)) { - return NULL; - } - ldns_buffer_write_u8(buffer, (uint8_t) '\0'); - if (!ldns_buffer_set_capacity(buffer, ldns_buffer_position(buffer))) { - return NULL; - } - } - - tmp_str = ldns_buffer_export(buffer); - str = LDNS_XMALLOC(char, strlen(tmp_str) + 1); - if(!str) { - return NULL; - } - memcpy(str, tmp_str, strlen(tmp_str) + 1); - - return str; -} - -char * -ldns_rdf2str(const ldns_rdf *rdf) -{ - char *result = NULL; - ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - - if (!tmp_buffer) { - return NULL; - } - if (ldns_rdf2buffer_str(tmp_buffer, rdf) == LDNS_STATUS_OK) { - /* export and return string, destroy rest */ - result = ldns_buffer2str(tmp_buffer); - } - ldns_buffer_free(tmp_buffer); - return result; -} - -char * -ldns_rr2str(const ldns_rr *rr) -{ - char *result = NULL; - ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - - if (!tmp_buffer) { - return NULL; - } - if (ldns_rr2buffer_str(tmp_buffer, rr) == LDNS_STATUS_OK) { - /* export and return string, destroy rest */ - result = ldns_buffer2str(tmp_buffer); - } - ldns_buffer_free(tmp_buffer); - return result; -} - -char * -ldns_pkt2str(const ldns_pkt *pkt) -{ - char *result = NULL; - ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - - if (!tmp_buffer) { - return NULL; - } - if (ldns_pkt2buffer_str(tmp_buffer, pkt) == LDNS_STATUS_OK) { - /* export and return string, destroy rest */ - result = ldns_buffer2str(tmp_buffer); - } - - ldns_buffer_free(tmp_buffer); - return result; -} - -char * -ldns_key2str(const ldns_key *k) -{ - char *result = NULL; - ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - - if (!tmp_buffer) { - return NULL; - } - if (ldns_key2buffer_str(tmp_buffer, k) == LDNS_STATUS_OK) { - /* export and return string, destroy rest */ - result = ldns_buffer2str(tmp_buffer); - } - ldns_buffer_free(tmp_buffer); - return result; -} - -char * -ldns_rr_list2str(const ldns_rr_list *list) -{ - char *result = NULL; - ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - - if (!tmp_buffer) { - return NULL; - } - if (list) { - if (ldns_rr_list2buffer_str(tmp_buffer, list) == LDNS_STATUS_OK) { - } - } else { - ldns_buffer_printf(tmp_buffer, "(null)\n"); - } - - /* export and return string, destroy rest */ - result = ldns_buffer2str(tmp_buffer); - ldns_buffer_free(tmp_buffer); - return result; -} - -void -ldns_rdf_print(FILE *output, const ldns_rdf *rdf) -{ - char *str = ldns_rdf2str(rdf); - if (str) { - fprintf(output, "%s", str); - } else { - fprintf(output, "Unable to convert rdf to string\n"); - } - LDNS_FREE(str); -} - -void -ldns_rr_print(FILE *output, const ldns_rr *rr) -{ - char *str = ldns_rr2str(rr); - if (str) { - fprintf(output, "%s", str); - } else { - fprintf(output, "Unable to convert rr to string\n"); - } - LDNS_FREE(str); -} - -void -ldns_pkt_print(FILE *output, const ldns_pkt *pkt) -{ - char *str = ldns_pkt2str(pkt); - if (str) { - fprintf(output, "%s", str); - } else { - fprintf(output, "Unable to convert packet to string\n"); - } - LDNS_FREE(str); -} - -void -ldns_rr_list_print(FILE *output, const ldns_rr_list *lst) -{ - size_t i; - for (i = 0; i < ldns_rr_list_rr_count(lst); i++) { - ldns_rr_print(output, ldns_rr_list_rr(lst, i)); - } -} - -void -ldns_resolver_print(FILE *output, const ldns_resolver *r) -{ - uint16_t i; - ldns_rdf **n; - ldns_rdf **s; - size_t *rtt; - if (!r) { - return; - } - n = ldns_resolver_nameservers(r); - s = ldns_resolver_searchlist(r); - rtt = ldns_resolver_rtt(r); - - fprintf(output, "port: %d\n", (int)ldns_resolver_port(r)); - fprintf(output, "edns0 size: %d\n", (int)ldns_resolver_edns_udp_size(r)); - fprintf(output, "use ip6: %d\n", (int)ldns_resolver_ip6(r)); - - fprintf(output, "recursive: %d\n", ldns_resolver_recursive(r)); - fprintf(output, "usevc: %d\n", ldns_resolver_usevc(r)); - fprintf(output, "igntc: %d\n", ldns_resolver_igntc(r)); - fprintf(output, "fail: %d\n", ldns_resolver_fail(r)); - fprintf(output, "retry: %d\n", (int)ldns_resolver_retry(r)); - fprintf(output, "retrans: %d\n", (int)ldns_resolver_retrans(r)); - fprintf(output, "fallback: %d\n", ldns_resolver_fallback(r)); - fprintf(output, "random: %d\n", ldns_resolver_random(r)); - fprintf(output, "timeout: %d\n", (int)ldns_resolver_timeout(r).tv_sec); - fprintf(output, "dnssec: %d\n", ldns_resolver_dnssec(r)); - fprintf(output, "dnssec cd: %d\n", ldns_resolver_dnssec_cd(r)); - fprintf(output, "trust anchors (%d listed):\n", - (int)ldns_rr_list_rr_count(ldns_resolver_dnssec_anchors(r))); - ldns_rr_list_print(output, ldns_resolver_dnssec_anchors(r)); - fprintf(output, "tsig: %s %s\n", - ldns_resolver_tsig_keyname(r)?ldns_resolver_tsig_keyname(r):"-", - ldns_resolver_tsig_algorithm(r)?ldns_resolver_tsig_algorithm(r):"-"); - fprintf(output, "debug: %d\n", ldns_resolver_debug(r)); - - fprintf(output, "default domain: "); - ldns_rdf_print(output, ldns_resolver_domain(r)); - fprintf(output, "\n"); - fprintf(output, "apply default domain: %d\n", ldns_resolver_defnames(r)); - - fprintf(output, "searchlist (%d listed):\n", (int)ldns_resolver_searchlist_count(r)); - for (i = 0; i < ldns_resolver_searchlist_count(r); i++) { - fprintf(output, "\t"); - ldns_rdf_print(output, s[i]); - fprintf(output, "\n"); - } - fprintf(output, "apply search list: %d\n", ldns_resolver_dnsrch(r)); - - fprintf(output, "nameservers (%d listed):\n", (int)ldns_resolver_nameserver_count(r)); - for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { - fprintf(output, "\t"); - ldns_rdf_print(output, n[i]); - - switch ((int)rtt[i]) { - case LDNS_RESOLV_RTT_MIN: - fprintf(output, " - reachable\n"); - break; - case LDNS_RESOLV_RTT_INF: - fprintf(output, " - unreachable\n"); - break; - } - } -} - -void -ldns_zone_print(FILE *output, const ldns_zone *z) -{ - if(ldns_zone_soa(z)) - ldns_rr_print(output, ldns_zone_soa(z)); - ldns_rr_list_print(output, ldns_zone_rrs(z)); -} diff --git a/libs/ldns/host2wire.c b/libs/ldns/host2wire.c deleted file mode 100644 index 1ffb0f5168..0000000000 --- a/libs/ldns/host2wire.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * host2wire.c - * - * conversion routines from the host to the wire format. - * This will usually just a re-ordering of the - * data (as we store it in network format) - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include - -/* TODO Jelte - add a pointer to a 'possiblecompression' structure - to all the needed functions? - something like an array of name, pointer values? - every dname part could be added to it -*/ - -ldns_status -ldns_dname2buffer_wire(ldns_buffer *buffer, const ldns_rdf *name) -{ - if (ldns_buffer_reserve(buffer, ldns_rdf_size(name))) { - ldns_buffer_write(buffer, ldns_rdf_data(name), ldns_rdf_size(name)); - } - return ldns_buffer_status(buffer); -} - -ldns_status -ldns_rdf2buffer_wire(ldns_buffer *buffer, const ldns_rdf *rdf) -{ - if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { - ldns_buffer_write(buffer, ldns_rdf_data(rdf), ldns_rdf_size(rdf)); - } - return ldns_buffer_status(buffer); -} - -ldns_status -ldns_rdf2buffer_wire_canonical(ldns_buffer *buffer, const ldns_rdf *rdf) -{ - size_t i; - uint8_t *rdf_data; - - if (ldns_rdf_get_type(rdf) == LDNS_RDF_TYPE_DNAME) { - if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { - rdf_data = ldns_rdf_data(rdf); - for (i = 0; i < ldns_rdf_size(rdf); i++) { - ldns_buffer_write_u8(buffer, - (uint8_t) LDNS_DNAME_NORMALIZE((int)rdf_data[i])); - } - } - } else { - /* direct copy for all other types */ - if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { - ldns_buffer_write(buffer, - ldns_rdf_data(rdf), - ldns_rdf_size(rdf)); - } - } - return ldns_buffer_status(buffer); -} - -/* convert a rr list to wireformat */ -ldns_status -ldns_rr_list2buffer_wire(ldns_buffer *buffer,const ldns_rr_list *rr_list) -{ - uint16_t rr_count; - uint16_t i; - - rr_count = ldns_rr_list_rr_count(rr_list); - for(i = 0; i < rr_count; i++) { - (void)ldns_rr2buffer_wire(buffer, ldns_rr_list_rr(rr_list, i), - LDNS_SECTION_ANY); - } - return ldns_buffer_status(buffer); -} - -ldns_status -ldns_rr2buffer_wire_canonical(ldns_buffer *buffer, - const ldns_rr *rr, - int section) -{ - uint16_t i; - uint16_t rdl_pos = 0; - bool pre_rfc3597 = false; - switch (ldns_rr_get_type(rr)) { - case LDNS_RR_TYPE_NS: - case LDNS_RR_TYPE_MD: - case LDNS_RR_TYPE_MF: - case LDNS_RR_TYPE_CNAME: - case LDNS_RR_TYPE_SOA: - case LDNS_RR_TYPE_MB: - case LDNS_RR_TYPE_MG: - case LDNS_RR_TYPE_MR: - case LDNS_RR_TYPE_PTR: - case LDNS_RR_TYPE_HINFO: - case LDNS_RR_TYPE_MINFO: - case LDNS_RR_TYPE_MX: - case LDNS_RR_TYPE_RP: - case LDNS_RR_TYPE_AFSDB: - case LDNS_RR_TYPE_RT: - case LDNS_RR_TYPE_SIG: - case LDNS_RR_TYPE_PX: - case LDNS_RR_TYPE_NXT: - case LDNS_RR_TYPE_NAPTR: - case LDNS_RR_TYPE_KX: - case LDNS_RR_TYPE_SRV: - case LDNS_RR_TYPE_DNAME: - case LDNS_RR_TYPE_A6: - pre_rfc3597 = true; - break; - default: - break; - } - - if (ldns_rr_owner(rr)) { - (void) ldns_rdf2buffer_wire_canonical(buffer, ldns_rr_owner(rr)); - } - - if (ldns_buffer_reserve(buffer, 4)) { - (void) ldns_buffer_write_u16(buffer, ldns_rr_get_type(rr)); - (void) ldns_buffer_write_u16(buffer, ldns_rr_get_class(rr)); - } - - if (section != LDNS_SECTION_QUESTION) { - if (ldns_buffer_reserve(buffer, 6)) { - ldns_buffer_write_u32(buffer, ldns_rr_ttl(rr)); - /* remember pos for later */ - rdl_pos = ldns_buffer_position(buffer); - ldns_buffer_write_u16(buffer, 0); - } - - for (i = 0; i < ldns_rr_rd_count(rr); i++) { - if (pre_rfc3597) { - (void) ldns_rdf2buffer_wire_canonical(buffer, - ldns_rr_rdf(rr, i)); - } else { - (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); - } - } - - if (rdl_pos != 0) { - ldns_buffer_write_u16_at(buffer, rdl_pos, - ldns_buffer_position(buffer) - - rdl_pos - 2); - } - } - return ldns_buffer_status(buffer); -} - -ldns_status -ldns_rr2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr, int section) -{ - uint16_t i; - uint16_t rdl_pos = 0; - - if (ldns_rr_owner(rr)) { - (void) ldns_dname2buffer_wire(buffer, ldns_rr_owner(rr)); - } - - if (ldns_buffer_reserve(buffer, 4)) { - (void) ldns_buffer_write_u16(buffer, ldns_rr_get_type(rr)); - (void) ldns_buffer_write_u16(buffer, ldns_rr_get_class(rr)); - } - - if (section != LDNS_SECTION_QUESTION) { - if (ldns_buffer_reserve(buffer, 6)) { - ldns_buffer_write_u32(buffer, ldns_rr_ttl(rr)); - /* remember pos for later */ - rdl_pos = ldns_buffer_position(buffer); - ldns_buffer_write_u16(buffer, 0); - } - - for (i = 0; i < ldns_rr_rd_count(rr); i++) { - (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); - } - - if (rdl_pos != 0) { - ldns_buffer_write_u16_at(buffer, rdl_pos, - ldns_buffer_position(buffer) - - rdl_pos - 2); - } - } - return ldns_buffer_status(buffer); -} - -ldns_status -ldns_rrsig2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) -{ - uint16_t i; - - /* it must be a sig RR */ - if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { - return LDNS_STATUS_ERR; - } - - /* Convert all the rdfs, except the actual signature data - * rdf number 8 - the last, hence: -1 */ - for (i = 0; i < ldns_rr_rd_count(rr) - 1; i++) { - if (ldns_rr_rdf(rr, i)) { - (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); - } - } - - return ldns_buffer_status(buffer); -} - -ldns_status -ldns_rr_rdata2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) -{ - uint16_t i; - /* convert all the rdf's */ - for (i = 0; i < ldns_rr_rd_count(rr); i++) { - (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); - } - - return ldns_buffer_status(buffer); -} - -/* - * Copies the packet header data to the buffer in wire format - */ -static ldns_status -ldns_hdr2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet) -{ - uint8_t flags; - uint16_t arcount; - - if (ldns_buffer_reserve(buffer, 12)) { - ldns_buffer_write_u16(buffer, ldns_pkt_id(packet)); - - flags = ldns_pkt_qr(packet) << 7 - | ldns_pkt_get_opcode(packet) << 3 - | ldns_pkt_aa(packet) << 2 - | ldns_pkt_tc(packet) << 1 | ldns_pkt_rd(packet); - ldns_buffer_write_u8(buffer, flags); - - flags = ldns_pkt_ra(packet) << 7 - /*| ldns_pkt_z(packet) << 6*/ - | ldns_pkt_ad(packet) << 5 - | ldns_pkt_cd(packet) << 4 | ldns_pkt_get_rcode(packet); - ldns_buffer_write_u8(buffer, flags); - - ldns_buffer_write_u16(buffer, ldns_pkt_qdcount(packet)); - ldns_buffer_write_u16(buffer, ldns_pkt_ancount(packet)); - ldns_buffer_write_u16(buffer, ldns_pkt_nscount(packet)); - /* add EDNS0 and TSIG to additional if they are there */ - arcount = ldns_pkt_arcount(packet); - if (ldns_pkt_tsig(packet)) { - arcount++; - } - if (ldns_pkt_edns(packet)) { - arcount++; - } - ldns_buffer_write_u16(buffer, arcount); - } - - return ldns_buffer_status(buffer); -} - -ldns_status -ldns_pkt2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet) -{ - ldns_rr_list *rr_list; - uint16_t i; - - /* edns tmp vars */ - ldns_rr *edns_rr; - uint8_t edata[4]; - - (void) ldns_hdr2buffer_wire(buffer, packet); - - rr_list = ldns_pkt_question(packet); - if (rr_list) { - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - (void) ldns_rr2buffer_wire(buffer, - ldns_rr_list_rr(rr_list, i), LDNS_SECTION_QUESTION); - } - } - rr_list = ldns_pkt_answer(packet); - if (rr_list) { - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - (void) ldns_rr2buffer_wire(buffer, - ldns_rr_list_rr(rr_list, i), LDNS_SECTION_ANSWER); - } - } - rr_list = ldns_pkt_authority(packet); - if (rr_list) { - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - (void) ldns_rr2buffer_wire(buffer, - ldns_rr_list_rr(rr_list, i), LDNS_SECTION_AUTHORITY); - } - } - rr_list = ldns_pkt_additional(packet); - if (rr_list) { - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - (void) ldns_rr2buffer_wire(buffer, - ldns_rr_list_rr(rr_list, i), LDNS_SECTION_ADDITIONAL); - } - } - - /* add EDNS to additional if it is needed */ - if (ldns_pkt_edns(packet)) { - edns_rr = ldns_rr_new(); - if(!edns_rr) return LDNS_STATUS_MEM_ERR; - ldns_rr_set_owner(edns_rr, - ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, ".")); - ldns_rr_set_type(edns_rr, LDNS_RR_TYPE_OPT); - ldns_rr_set_class(edns_rr, ldns_pkt_edns_udp_size(packet)); - edata[0] = ldns_pkt_edns_extended_rcode(packet); - edata[1] = ldns_pkt_edns_version(packet); - ldns_write_uint16(&edata[2], ldns_pkt_edns_z(packet)); - ldns_rr_set_ttl(edns_rr, ldns_read_uint32(edata)); - /* don't forget to add the edns rdata (if any) */ - if (packet->_edns_data) - ldns_rr_push_rdf (edns_rr, packet->_edns_data); - (void)ldns_rr2buffer_wire(buffer, edns_rr, LDNS_SECTION_ADDITIONAL); - /* take the edns rdata back out of the rr before we free rr */ - if (packet->_edns_data) - (void)ldns_rr_pop_rdf (edns_rr); - ldns_rr_free(edns_rr); - } - - /* add TSIG to additional if it is there */ - if (ldns_pkt_tsig(packet)) { - (void) ldns_rr2buffer_wire(buffer, - ldns_pkt_tsig(packet), LDNS_SECTION_ADDITIONAL); - } - - return LDNS_STATUS_OK; -} - -ldns_status -ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t *result_size) -{ - ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - uint8_t *result = NULL; - ldns_status status; - *result_size = 0; - *dest = NULL; - if(!buffer) return LDNS_STATUS_MEM_ERR; - - status = ldns_rdf2buffer_wire(buffer, rdf); - if (status == LDNS_STATUS_OK) { - *result_size = ldns_buffer_position(buffer); - result = (uint8_t *) ldns_buffer_export(buffer); - } else { - ldns_buffer_free(buffer); - return status; - } - - if (result) { - *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); - if(!*dest) { - ldns_buffer_free(buffer); - return LDNS_STATUS_MEM_ERR; - } - memcpy(*dest, result, ldns_buffer_position(buffer)); - } - - ldns_buffer_free(buffer); - return status; -} - -ldns_status -ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int section, size_t *result_size) -{ - ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - uint8_t *result = NULL; - ldns_status status; - *result_size = 0; - *dest = NULL; - if(!buffer) return LDNS_STATUS_MEM_ERR; - - status = ldns_rr2buffer_wire(buffer, rr, section); - if (status == LDNS_STATUS_OK) { - *result_size = ldns_buffer_position(buffer); - result = (uint8_t *) ldns_buffer_export(buffer); - } else { - ldns_buffer_free(buffer); - return status; - } - - if (result) { - *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); - if(!*dest) { - ldns_buffer_free(buffer); - return LDNS_STATUS_MEM_ERR; - } - memcpy(*dest, result, ldns_buffer_position(buffer)); - } - - ldns_buffer_free(buffer); - return status; -} - -ldns_status -ldns_pkt2wire(uint8_t **dest, const ldns_pkt *packet, size_t *result_size) -{ - ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - uint8_t *result = NULL; - ldns_status status; - *result_size = 0; - *dest = NULL; - if(!buffer) return LDNS_STATUS_MEM_ERR; - - status = ldns_pkt2buffer_wire(buffer, packet); - if (status == LDNS_STATUS_OK) { - *result_size = ldns_buffer_position(buffer); - result = (uint8_t *) ldns_buffer_export(buffer); - } else { - ldns_buffer_free(buffer); - return status; - } - - if (result) { - *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); - if(!*dest) { - ldns_buffer_free(buffer); - return LDNS_STATUS_MEM_ERR; - } - memcpy(*dest, result, ldns_buffer_position(buffer)); - } - - ldns_buffer_free(buffer); - return status; -} diff --git a/libs/ldns/install-sh b/libs/ldns/install-sh deleted file mode 100755 index 3f83ce9b55..0000000000 --- a/libs/ldns/install-sh +++ /dev/null @@ -1,524 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2010-02-06.18; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# 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. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - do_exit='(exit $ret); exit $ret' - trap "ret=129; $do_exit" 1 - trap "ret=130; $do_exit" 2 - trap "ret=141; $do_exit" 13 - trap "ret=143; $do_exit" 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # 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 $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/libs/ldns/keys.c b/libs/ldns/keys.c deleted file mode 100644 index c224cd6fe4..0000000000 --- a/libs/ldns/keys.c +++ /dev/null @@ -1,1666 +0,0 @@ -/* - * keys.c handle private keys for use in DNSSEC - * - * This module should hide some of the openSSL complexities - * and give a general interface for private keys and hmac - * handling - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include - -#ifdef HAVE_SSL -#include -#include -#include -#endif /* HAVE_SSL */ - -ldns_lookup_table ldns_signing_algorithms[] = { - { LDNS_SIGN_RSAMD5, "RSAMD5" }, - { LDNS_SIGN_RSASHA1, "RSASHA1" }, - { LDNS_SIGN_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" }, -#ifdef USE_SHA2 - { LDNS_SIGN_RSASHA256, "RSASHA256" }, - { LDNS_SIGN_RSASHA512, "RSASHA512" }, -#endif -#ifdef USE_GOST - { LDNS_SIGN_ECC_GOST, "ECC-GOST" }, -#endif -#ifdef USE_ECDSA - { LDNS_SIGN_ECDSAP256SHA256, "ECDSAP256SHA256" }, - { LDNS_SIGN_ECDSAP384SHA384, "ECDSAP384SHA384" }, -#endif - { LDNS_SIGN_DSA, "DSA" }, - { LDNS_SIGN_DSA_NSEC3, "DSA-NSEC3-SHA1" }, - { LDNS_SIGN_HMACMD5, "hmac-md5.sig-alg.reg.int" }, - { LDNS_SIGN_HMACSHA1, "hmac-sha1" }, - { LDNS_SIGN_HMACSHA256, "hmac-sha256" }, - { 0, NULL } -}; - -ldns_key_list * -ldns_key_list_new() -{ - ldns_key_list *key_list = LDNS_MALLOC(ldns_key_list); - if (!key_list) { - return NULL; - } else { - key_list->_key_count = 0; - key_list->_keys = NULL; - return key_list; - } -} - -ldns_key * -ldns_key_new() -{ - ldns_key *newkey; - - newkey = LDNS_MALLOC(ldns_key); - if (!newkey) { - return NULL; - } else { - /* some defaults - not sure wether to do this */ - ldns_key_set_use(newkey, true); - ldns_key_set_flags(newkey, LDNS_KEY_ZONE_KEY); - ldns_key_set_origttl(newkey, 0); - ldns_key_set_keytag(newkey, 0); - ldns_key_set_inception(newkey, 0); - ldns_key_set_expiration(newkey, 0); - ldns_key_set_pubkey_owner(newkey, NULL); -#ifdef HAVE_SSL - ldns_key_set_evp_key(newkey, NULL); -#endif /* HAVE_SSL */ - ldns_key_set_hmac_key(newkey, NULL); - ldns_key_set_external_key(newkey, NULL); - return newkey; - } -} - -ldns_status -ldns_key_new_frm_fp(ldns_key **k, FILE *fp) -{ - return ldns_key_new_frm_fp_l(k, fp, NULL); -} - -#ifdef HAVE_SSL -ldns_status -ldns_key_new_frm_engine(ldns_key **key, ENGINE *e, char *key_id, ldns_algorithm alg) -{ - ldns_key *k; - - k = ldns_key_new(); - if(!k) return LDNS_STATUS_MEM_ERR; -#ifndef S_SPLINT_S - k->_key.key = ENGINE_load_private_key(e, key_id, UI_OpenSSL(), NULL); - if(!k->_key.key) { - ldns_key_free(k); - return LDNS_STATUS_ERR; - } - ldns_key_set_algorithm(k, (ldns_signing_algorithm) alg); - if (!k->_key.key) { - ldns_key_free(k); - return LDNS_STATUS_ENGINE_KEY_NOT_LOADED; - } -#endif /* splint */ - *key = k; - return LDNS_STATUS_OK; -} -#endif - -#ifdef USE_GOST -/** store GOST engine reference loaded into OpenSSL library */ -ENGINE* ldns_gost_engine = NULL; - -int -ldns_key_EVP_load_gost_id(void) -{ - static int gost_id = 0; - const EVP_PKEY_ASN1_METHOD* meth; - ENGINE* e; - - if(gost_id) return gost_id; - - /* see if configuration loaded gost implementation from other engine*/ - meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1); - if(meth) { - EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); - return gost_id; - } - - /* see if engine can be loaded already */ - e = ENGINE_by_id("gost"); - if(!e) { - /* load it ourself, in case statically linked */ - ENGINE_load_builtin_engines(); - ENGINE_load_dynamic(); - e = ENGINE_by_id("gost"); - } - if(!e) { - /* no gost engine in openssl */ - return 0; - } - if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { - ENGINE_finish(e); - ENGINE_free(e); - return 0; - } - - meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1); - if(!meth) { - /* algo not found */ - ENGINE_finish(e); - ENGINE_free(e); - return 0; - } - /* Note: do not ENGINE_finish and ENGINE_free the acquired engine - * on some platforms this frees up the meth and unloads gost stuff */ - ldns_gost_engine = e; - - EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); - return gost_id; -} - -void ldns_key_EVP_unload_gost(void) -{ - if(ldns_gost_engine) { - ENGINE_finish(ldns_gost_engine); - ENGINE_free(ldns_gost_engine); - ldns_gost_engine = NULL; - } -} - -/** read GOST private key */ -static EVP_PKEY* -ldns_key_new_frm_fp_gost_l(FILE* fp, int* line_nr) -{ - char token[16384]; - const unsigned char* pp; - int gost_id; - EVP_PKEY* pkey; - ldns_rdf* b64rdf = NULL; - - gost_id = ldns_key_EVP_load_gost_id(); - if(!gost_id) - return NULL; - - if (ldns_fget_keyword_data_l(fp, "GostAsn1", ": ", token, "\n", - sizeof(token), line_nr) == -1) - return NULL; - while(strlen(token) < 96) { - /* read more b64 from the file, b64 split on multiple lines */ - if(ldns_fget_token_l(fp, token+strlen(token), "\n", - sizeof(token)-strlen(token), line_nr) == -1) - return NULL; - } - if(ldns_str2rdf_b64(&b64rdf, token) != LDNS_STATUS_OK) - return NULL; - pp = (unsigned char*)ldns_rdf_data(b64rdf); - pkey = d2i_PrivateKey(gost_id, NULL, &pp, (int)ldns_rdf_size(b64rdf)); - ldns_rdf_deep_free(b64rdf); - return pkey; -} -#endif - -#ifdef USE_ECDSA -/** calculate public key from private key */ -static int -ldns_EC_KEY_calc_public(EC_KEY* ec) -{ - EC_POINT* pub_key; - const EC_GROUP* group; - group = EC_KEY_get0_group(ec); - pub_key = EC_POINT_new(group); - if(!pub_key) return 0; - if(!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group))) { - EC_POINT_free(pub_key); - return 0; - } - if(!EC_POINT_mul(group, pub_key, EC_KEY_get0_private_key(ec), - NULL, NULL, NULL)) { - EC_POINT_free(pub_key); - return 0; - } - if(EC_KEY_set_public_key(ec, pub_key) == 0) { - EC_POINT_free(pub_key); - return 0; - } - EC_POINT_free(pub_key); - return 1; -} - -/** read ECDSA private key */ -static EVP_PKEY* -ldns_key_new_frm_fp_ecdsa_l(FILE* fp, ldns_algorithm alg, int* line_nr) -{ - char token[16384]; - ldns_rdf* b64rdf = NULL; - unsigned char* pp; - BIGNUM* bn; - EVP_PKEY* evp_key; - EC_KEY* ec; - if (ldns_fget_keyword_data_l(fp, "PrivateKey", ": ", token, "\n", - sizeof(token), line_nr) == -1) - return NULL; - if(ldns_str2rdf_b64(&b64rdf, token) != LDNS_STATUS_OK) - return NULL; - pp = (unsigned char*)ldns_rdf_data(b64rdf); - - if(alg == LDNS_ECDSAP256SHA256) - ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - else if(alg == LDNS_ECDSAP384SHA384) - ec = EC_KEY_new_by_curve_name(NID_secp384r1); - else ec = NULL; - if(!ec) { - ldns_rdf_deep_free(b64rdf); - return NULL; - } - bn = BN_bin2bn(pp, (int)ldns_rdf_size(b64rdf), NULL); - ldns_rdf_deep_free(b64rdf); - if(!bn) { - EC_KEY_free(ec); - return NULL; - } - EC_KEY_set_private_key(ec, bn); - BN_free(bn); - if(!ldns_EC_KEY_calc_public(ec)) { - EC_KEY_free(ec); - return NULL; - } - - evp_key = EVP_PKEY_new(); - if(!evp_key) { - EC_KEY_free(ec); - return NULL; - } - EVP_PKEY_assign_EC_KEY(evp_key, ec); - - return evp_key; -} -#endif - -ldns_status -ldns_key_new_frm_fp_l(ldns_key **key, FILE *fp, int *line_nr) -{ - ldns_key *k; - char *d; - ldns_signing_algorithm alg; - ldns_rr *key_rr; -#ifdef HAVE_SSL - RSA *rsa; - DSA *dsa; - unsigned char *hmac; - size_t hmac_size; -#endif /* HAVE_SSL */ - - k = ldns_key_new(); - - d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); - if (!k || !d) { - ldns_key_free(k); - LDNS_FREE(d); - return LDNS_STATUS_MEM_ERR; - } - - alg = 0; - - /* the file is highly structured. Do this in sequence */ - /* RSA: - * Private-key-format: v1.2 - * Algorithm: 1 (RSA) - - */ - /* get the key format version number */ - if (ldns_fget_keyword_data_l(fp, "Private-key-format", ": ", d, "\n", - LDNS_MAX_LINELEN, line_nr) == -1) { - /* no version information */ - ldns_key_free(k); - LDNS_FREE(d); - return LDNS_STATUS_SYNTAX_ERR; - } - if (strncmp(d, "v1.2", strlen(d)) != 0) { - ldns_key_free(k); - LDNS_FREE(d); - return LDNS_STATUS_SYNTAX_VERSION_ERR; - } - - /* get the algorithm type, our file function strip ( ) so there are - * not in the return string! */ - if (ldns_fget_keyword_data_l(fp, "Algorithm", ": ", d, "\n", - LDNS_MAX_LINELEN, line_nr) == -1) { - /* no alg information */ - ldns_key_free(k); - LDNS_FREE(d); - return LDNS_STATUS_SYNTAX_ALG_ERR; - } - - if (strncmp(d, "1 RSA", 2) == 0) { - alg = LDNS_SIGN_RSAMD5; - } - if (strncmp(d, "2 DH", 2) == 0) { - alg = (ldns_signing_algorithm)LDNS_DH; - } - if (strncmp(d, "3 DSA", 2) == 0) { - alg = LDNS_SIGN_DSA; - } - if (strncmp(d, "4 ECC", 2) == 0) { - alg = (ldns_signing_algorithm)LDNS_ECC; - } - if (strncmp(d, "5 RSASHA1", 2) == 0) { - alg = LDNS_SIGN_RSASHA1; - } - if (strncmp(d, "6 DSA", 2) == 0) { - alg = LDNS_SIGN_DSA_NSEC3; - } - if (strncmp(d, "7 RSASHA1", 2) == 0) { - alg = LDNS_SIGN_RSASHA1_NSEC3; - } - - if (strncmp(d, "8 RSASHA256", 2) == 0) { -#ifdef USE_SHA2 - alg = LDNS_SIGN_RSASHA256; -#else - fprintf(stderr, "Warning: SHA256 not compiled into this "); - fprintf(stderr, "version of ldns\n"); -#endif - } - if (strncmp(d, "10 RSASHA512", 3) == 0) { -#ifdef USE_SHA2 - alg = LDNS_SIGN_RSASHA512; -#else - fprintf(stderr, "Warning: SHA512 not compiled into this "); - fprintf(stderr, "version of ldns\n"); -#endif - } - if (strncmp(d, "12 ECC-GOST", 3) == 0) { -#ifdef USE_GOST - alg = LDNS_SIGN_ECC_GOST; -#else - fprintf(stderr, "Warning: ECC-GOST not compiled into this "); - fprintf(stderr, "version of ldns, use --enable-gost\n"); -#endif - } -#ifdef USE_ECDSA - if (strncmp(d, "13 ECDSAP256SHA256", 3) == 0) { - alg = LDNS_SIGN_ECDSAP256SHA256; - } - if (strncmp(d, "14 ECDSAP384SHA384", 3) == 0) { - alg = LDNS_SIGN_ECDSAP384SHA384; - } -#endif - if (strncmp(d, "157 HMAC-MD5", 4) == 0) { - alg = LDNS_SIGN_HMACMD5; - } - if (strncmp(d, "158 HMAC-SHA1", 4) == 0) { - alg = LDNS_SIGN_HMACSHA1; - } - if (strncmp(d, "159 HMAC-SHA256", 4) == 0) { - alg = LDNS_SIGN_HMACSHA256; - } - - LDNS_FREE(d); - - switch(alg) { - case LDNS_SIGN_RSAMD5: - case LDNS_SIGN_RSASHA1: - case LDNS_SIGN_RSASHA1_NSEC3: -#ifdef USE_SHA2 - case LDNS_SIGN_RSASHA256: - case LDNS_SIGN_RSASHA512: -#endif - ldns_key_set_algorithm(k, alg); -#ifdef HAVE_SSL - rsa = ldns_key_new_frm_fp_rsa_l(fp, line_nr); - if (!rsa) { - ldns_key_free(k); - return LDNS_STATUS_ERR; - } - ldns_key_set_rsa_key(k, rsa); - RSA_free(rsa); -#endif /* HAVE_SSL */ - break; - case LDNS_SIGN_DSA: - case LDNS_SIGN_DSA_NSEC3: - ldns_key_set_algorithm(k, alg); -#ifdef HAVE_SSL - dsa = ldns_key_new_frm_fp_dsa_l(fp, line_nr); - if (!dsa) { - ldns_key_free(k); - return LDNS_STATUS_ERR; - } - ldns_key_set_dsa_key(k, dsa); - DSA_free(dsa); -#endif /* HAVE_SSL */ - break; - case LDNS_SIGN_HMACMD5: - case LDNS_SIGN_HMACSHA1: - case LDNS_SIGN_HMACSHA256: - ldns_key_set_algorithm(k, alg); -#ifdef HAVE_SSL - hmac = ldns_key_new_frm_fp_hmac_l(fp, line_nr, &hmac_size); - if (!hmac) { - ldns_key_free(k); - return LDNS_STATUS_ERR; - } - ldns_key_set_hmac_size(k, hmac_size); - ldns_key_set_hmac_key(k, hmac); -#endif /* HAVE_SSL */ - break; - case LDNS_SIGN_ECC_GOST: - ldns_key_set_algorithm(k, alg); -#if defined(HAVE_SSL) && defined(USE_GOST) - if(!ldns_key_EVP_load_gost_id()) { - ldns_key_free(k); - return LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL; - } - ldns_key_set_evp_key(k, - ldns_key_new_frm_fp_gost_l(fp, line_nr)); -#ifndef S_SPLINT_S - if(!k->_key.key) { - ldns_key_free(k); - return LDNS_STATUS_ERR; - } -#endif /* splint */ -#endif - break; -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - case LDNS_SIGN_ECDSAP384SHA384: - ldns_key_set_algorithm(k, alg); - ldns_key_set_evp_key(k, - ldns_key_new_frm_fp_ecdsa_l(fp, (ldns_algorithm)alg, line_nr)); -#ifndef S_SPLINT_S - if(!k->_key.key) { - ldns_key_free(k); - return LDNS_STATUS_ERR; - } -#endif /* splint */ - break; -#endif - default: - ldns_key_free(k); - return LDNS_STATUS_SYNTAX_ALG_ERR; - } - key_rr = ldns_key2rr(k); - ldns_key_set_keytag(k, ldns_calc_keytag(key_rr)); - ldns_rr_free(key_rr); - - if (key) { - *key = k; - return LDNS_STATUS_OK; - } - return LDNS_STATUS_ERR; -} - -#ifdef HAVE_SSL -RSA * -ldns_key_new_frm_fp_rsa(FILE *f) -{ - return ldns_key_new_frm_fp_rsa_l(f, NULL); -} - -RSA * -ldns_key_new_frm_fp_rsa_l(FILE *f, int *line_nr) -{ - /* we parse - * Modulus: - * PublicExponent: - * PrivateExponent: - * Prime1: - * Prime2: - * Exponent1: - * Exponent2: - * Coefficient: - * - * man 3 RSA: - * - * struct - * { - * BIGNUM *n; // public modulus - * BIGNUM *e; // public exponent - * BIGNUM *d; // private exponent - * BIGNUM *p; // secret prime factor - * BIGNUM *q; // secret prime factor - * BIGNUM *dmp1; // d mod (p-1) - * BIGNUM *dmq1; // d mod (q-1) - * BIGNUM *iqmp; // q^-1 mod p - * // ... - * - */ - char *d; - RSA *rsa; - uint8_t *buf; - int i; - - d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); - buf = LDNS_XMALLOC(uint8_t, LDNS_MAX_LINELEN); - rsa = RSA_new(); - if (!d || !rsa || !buf) { - goto error; - } - - /* I could use functions again, but that seems an overkill, - * allthough this also looks tedious - */ - - /* Modules, rsa->n */ - if (ldns_fget_keyword_data_l(f, "Modulus", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); -#ifndef S_SPLINT_S - rsa->n = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->n) { - goto error; - } - - /* PublicExponent, rsa->e */ - if (ldns_fget_keyword_data_l(f, "PublicExponent", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - rsa->e = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->e) { - goto error; - } - - /* PrivateExponent, rsa->d */ - if (ldns_fget_keyword_data_l(f, "PrivateExponent", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - rsa->d = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->d) { - goto error; - } - - /* Prime1, rsa->p */ - if (ldns_fget_keyword_data_l(f, "Prime1", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - rsa->p = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->p) { - goto error; - } - - /* Prime2, rsa->q */ - if (ldns_fget_keyword_data_l(f, "Prime2", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - rsa->q = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->q) { - goto error; - } - - /* Exponent1, rsa->dmp1 */ - if (ldns_fget_keyword_data_l(f, "Exponent1", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - rsa->dmp1 = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->dmp1) { - goto error; - } - - /* Exponent2, rsa->dmq1 */ - if (ldns_fget_keyword_data_l(f, "Exponent2", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - rsa->dmq1 = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->dmq1) { - goto error; - } - - /* Coefficient, rsa->iqmp */ - if (ldns_fget_keyword_data_l(f, "Coefficient", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - rsa->iqmp = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!rsa->iqmp) { - goto error; - } -#endif /* splint */ - - LDNS_FREE(buf); - LDNS_FREE(d); - return rsa; - -error: - RSA_free(rsa); - LDNS_FREE(d); - LDNS_FREE(buf); - return NULL; -} - -DSA * -ldns_key_new_frm_fp_dsa(FILE *f) -{ - return ldns_key_new_frm_fp_dsa_l(f, NULL); -} - -DSA * -ldns_key_new_frm_fp_dsa_l(FILE *f, int *line_nr) -{ - int i; - char *d; - DSA *dsa; - uint8_t *buf; - - line_nr = line_nr; - - d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); - buf = LDNS_XMALLOC(uint8_t, LDNS_MAX_LINELEN); - dsa = DSA_new(); - if (!d || !dsa || !buf) { - goto error; - } - - /* the line parser removes the () from the input... */ - - /* Prime, dsa->p */ - if (ldns_fget_keyword_data_l(f, "Primep", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); -#ifndef S_SPLINT_S - dsa->p = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!dsa->p) { - goto error; - } - - /* Subprime, dsa->q */ - if (ldns_fget_keyword_data_l(f, "Subprimeq", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - dsa->q = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!dsa->q) { - goto error; - } - - /* Base, dsa->g */ - if (ldns_fget_keyword_data_l(f, "Baseg", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - dsa->g = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!dsa->g) { - goto error; - } - - /* Private key, dsa->priv_key */ - if (ldns_fget_keyword_data_l(f, "Private_valuex", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - dsa->priv_key = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!dsa->priv_key) { - goto error; - } - - /* Public key, dsa->priv_key */ - if (ldns_fget_keyword_data_l(f, "Public_valuey", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); - dsa->pub_key = BN_bin2bn((const char unsigned*)buf, i, NULL); - if (!dsa->pub_key) { - goto error; - } -#endif /* splint */ - - LDNS_FREE(buf); - LDNS_FREE(d); - - return dsa; - -error: - LDNS_FREE(d); - LDNS_FREE(buf); - DSA_free(dsa); - return NULL; -} - -unsigned char * -ldns_key_new_frm_fp_hmac(FILE *f, size_t *hmac_size) -{ - return ldns_key_new_frm_fp_hmac_l(f, NULL, hmac_size); -} - -unsigned char * -ldns_key_new_frm_fp_hmac_l(FILE *f, int *line_nr, size_t *hmac_size) -{ - size_t i; - char *d; - unsigned char *buf; - - line_nr = line_nr; - - d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); - buf = LDNS_XMALLOC(unsigned char, LDNS_MAX_LINELEN); - if(!d || !buf) { - goto error; - } - - if (ldns_fget_keyword_data_l(f, "Key", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { - goto error; - } - i = (size_t) ldns_b64_pton((const char*)d, - buf, - ldns_b64_ntop_calculate_size(strlen(d))); - - *hmac_size = i; - return buf; - - error: - LDNS_FREE(d); - LDNS_FREE(buf); - *hmac_size = 0; - return NULL; -} -#endif /* HAVE_SSL */ - -#ifdef USE_GOST -static EVP_PKEY* -ldns_gen_gost_key(void) -{ - EVP_PKEY_CTX* ctx; - EVP_PKEY* p = NULL; - int gost_id = ldns_key_EVP_load_gost_id(); - if(!gost_id) - return NULL; - ctx = EVP_PKEY_CTX_new_id(gost_id, NULL); - if(!ctx) { - /* the id should be available now */ - return NULL; - } - if(EVP_PKEY_CTX_ctrl_str(ctx, "paramset", "A") <= 0) { - /* cannot set paramset */ - EVP_PKEY_CTX_free(ctx); - return NULL; - } - - if(EVP_PKEY_keygen_init(ctx) <= 0) { - EVP_PKEY_CTX_free(ctx); - return NULL; - } - if(EVP_PKEY_keygen(ctx, &p) <= 0) { - EVP_PKEY_free(p); - EVP_PKEY_CTX_free(ctx); - return NULL; - } - EVP_PKEY_CTX_free(ctx); - return p; -} -#endif - -ldns_key * -ldns_key_new_frm_algorithm(ldns_signing_algorithm alg, uint16_t size) -{ - ldns_key *k; -#ifdef HAVE_SSL - DSA *d; - RSA *r; -# ifdef USE_ECDSA - EC_KEY *ec = NULL; -# endif -#else - int i; - uint16_t offset = 0; -#endif - unsigned char *hmac; - - k = ldns_key_new(); - if (!k) { - return NULL; - } - switch(alg) { - case LDNS_SIGN_RSAMD5: - case LDNS_SIGN_RSASHA1: - case LDNS_SIGN_RSASHA1_NSEC3: - case LDNS_SIGN_RSASHA256: - case LDNS_SIGN_RSASHA512: -#ifdef HAVE_SSL - r = RSA_generate_key((int)size, RSA_F4, NULL, NULL); - if(!r) { - ldns_key_free(k); - return NULL; - } - if (RSA_check_key(r) != 1) { - ldns_key_free(k); - return NULL; - } - - ldns_key_set_rsa_key(k, r); -#endif /* HAVE_SSL */ - break; - case LDNS_SIGN_DSA: - case LDNS_SIGN_DSA_NSEC3: -#ifdef HAVE_SSL - d = DSA_generate_parameters((int)size, NULL, 0, NULL, NULL, NULL, NULL); - if (!d) { - ldns_key_free(k); - return NULL; - } - if (DSA_generate_key(d) != 1) { - ldns_key_free(k); - return NULL; - } - ldns_key_set_dsa_key(k, d); -#endif /* HAVE_SSL */ - break; - case LDNS_SIGN_HMACMD5: - case LDNS_SIGN_HMACSHA1: - case LDNS_SIGN_HMACSHA256: -#ifdef HAVE_SSL -#ifndef S_SPLINT_S - k->_key.key = NULL; -#endif /* splint */ -#endif /* HAVE_SSL */ - size = size / 8; - ldns_key_set_hmac_size(k, size); - - hmac = LDNS_XMALLOC(unsigned char, size); - if(!hmac) { - ldns_key_free(k); - return NULL; - } -#ifdef HAVE_SSL - if (RAND_bytes(hmac, (int) size) != 1) { - LDNS_FREE(hmac); - ldns_key_free(k); - return NULL; - } -#else - while (offset + sizeof(i) < size) { - i = random(); - memcpy(&hmac[offset], &i, sizeof(i)); - offset += sizeof(i); - } - if (offset < size) { - i = random(); - memcpy(&hmac[offset], &i, size - offset); - } -#endif /* HAVE_SSL */ - ldns_key_set_hmac_key(k, hmac); - - ldns_key_set_flags(k, 0); - break; - case LDNS_SIGN_ECC_GOST: -#if defined(HAVE_SSL) && defined(USE_GOST) - ldns_key_set_evp_key(k, ldns_gen_gost_key()); -#ifndef S_SPLINT_S - if(!k->_key.key) { - ldns_key_free(k); - return NULL; - } -#endif /* splint */ -#endif /* HAVE_SSL and USE_GOST */ - break; -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - case LDNS_SIGN_ECDSAP384SHA384: - if(alg == LDNS_SIGN_ECDSAP256SHA256) - ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - else if(alg == LDNS_SIGN_ECDSAP384SHA384) - ec = EC_KEY_new_by_curve_name(NID_secp384r1); - if(!ec) { - ldns_key_free(k); - return NULL; - } - if(!EC_KEY_generate_key(ec)) { - ldns_key_free(k); - EC_KEY_free(ec); - return NULL; - } -#ifndef S_SPLINT_S - k->_key.key = EVP_PKEY_new(); - if(!k->_key.key) { - ldns_key_free(k); - EC_KEY_free(ec); - return NULL; - } - EVP_PKEY_assign_EC_KEY(k->_key.key, ec); -#endif /* splint */ - break; -#endif - } - ldns_key_set_algorithm(k, alg); - return k; -} - -void -ldns_key_print(FILE *output, const ldns_key *k) -{ - char *str = ldns_key2str(k); - if (str) { - fprintf(output, "%s", str); - } else { - fprintf(output, "Unable to convert private key to string\n"); - } - LDNS_FREE(str); -} - - -void -ldns_key_set_algorithm(ldns_key *k, ldns_signing_algorithm l) -{ - k->_alg = l; -} - -void -ldns_key_set_flags(ldns_key *k, uint16_t f) -{ - k->_extra.dnssec.flags = f; -} - -#ifdef HAVE_SSL -#ifndef S_SPLINT_S -void -ldns_key_set_evp_key(ldns_key *k, EVP_PKEY *e) -{ - k->_key.key = e; -} - -void -ldns_key_set_rsa_key(ldns_key *k, RSA *r) -{ - EVP_PKEY *key = EVP_PKEY_new(); - EVP_PKEY_set1_RSA(key, r); - k->_key.key = key; -} - -void -ldns_key_set_dsa_key(ldns_key *k, DSA *d) -{ - EVP_PKEY *key = EVP_PKEY_new(); - EVP_PKEY_set1_DSA(key, d); - k->_key.key = key; -} -#endif /* splint */ -#endif /* HAVE_SSL */ - -void -ldns_key_set_hmac_key(ldns_key *k, unsigned char *hmac) -{ - k->_key.hmac.key = hmac; -} - -void -ldns_key_set_hmac_size(ldns_key *k, size_t hmac_size) -{ - k->_key.hmac.size = hmac_size; -} - -void -ldns_key_set_external_key(ldns_key *k, void *external_key) -{ - k->_key.external_key = external_key; -} - -void -ldns_key_set_origttl(ldns_key *k, uint32_t t) -{ - k->_extra.dnssec.orig_ttl = t; -} - -void -ldns_key_set_inception(ldns_key *k, uint32_t i) -{ - k->_extra.dnssec.inception = i; -} - -void -ldns_key_set_expiration(ldns_key *k, uint32_t e) -{ - k->_extra.dnssec.expiration = e; -} - -void -ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r) -{ - k->_pubkey_owner = r; -} - -void -ldns_key_set_keytag(ldns_key *k, uint16_t tag) -{ - k->_extra.dnssec.keytag = tag; -} - -/* read */ -size_t -ldns_key_list_key_count(const ldns_key_list *key_list) -{ - return key_list->_key_count; -} - -ldns_key * -ldns_key_list_key(const ldns_key_list *key, size_t nr) -{ - if (nr < ldns_key_list_key_count(key)) { - return key->_keys[nr]; - } else { - return NULL; - } -} - -ldns_signing_algorithm -ldns_key_algorithm(const ldns_key *k) -{ - return k->_alg; -} - -void -ldns_key_set_use(ldns_key *k, bool v) -{ - if (k) { - k->_use = v; - } -} - -bool -ldns_key_use(const ldns_key *k) -{ - if (k) { - return k->_use; - } - return false; -} - -#ifdef HAVE_SSL -#ifndef S_SPLINT_S -EVP_PKEY * -ldns_key_evp_key(const ldns_key *k) -{ - return k->_key.key; -} - -RSA * -ldns_key_rsa_key(const ldns_key *k) -{ - if (k->_key.key) { - return EVP_PKEY_get1_RSA(k->_key.key); - } else { - return NULL; - } -} - -DSA * -ldns_key_dsa_key(const ldns_key *k) -{ - if (k->_key.key) { - return EVP_PKEY_get1_DSA(k->_key.key); - } else { - return NULL; - } -} -#endif /* splint */ -#endif /* HAVE_SSL */ - -unsigned char * -ldns_key_hmac_key(const ldns_key *k) -{ - if (k->_key.hmac.key) { - return k->_key.hmac.key; - } else { - return NULL; - } -} - -size_t -ldns_key_hmac_size(const ldns_key *k) -{ - if (k->_key.hmac.size) { - return k->_key.hmac.size; - } else { - return 0; - } -} - -void * -ldns_key_external_key(const ldns_key *k) -{ - return k->_key.external_key; -} - -uint32_t -ldns_key_origttl(const ldns_key *k) -{ - return k->_extra.dnssec.orig_ttl; -} - -uint16_t -ldns_key_flags(const ldns_key *k) -{ - return k->_extra.dnssec.flags; -} - -uint32_t -ldns_key_inception(const ldns_key *k) -{ - return k->_extra.dnssec.inception; -} - -uint32_t -ldns_key_expiration(const ldns_key *k) -{ - return k->_extra.dnssec.expiration; -} - -uint16_t -ldns_key_keytag(const ldns_key *k) -{ - return k->_extra.dnssec.keytag; -} - -ldns_rdf * -ldns_key_pubkey_owner(const ldns_key *k) -{ - return k->_pubkey_owner; -} - -/* write */ -void -ldns_key_list_set_use(ldns_key_list *keys, bool v) -{ - size_t i; - - for (i = 0; i < ldns_key_list_key_count(keys); i++) { - ldns_key_set_use(ldns_key_list_key(keys, i), v); - } -} - -void -ldns_key_list_set_key_count(ldns_key_list *key, size_t count) -{ - key->_key_count = count; -} - -bool -ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key) -{ - size_t key_count; - ldns_key **keys; - - key_count = ldns_key_list_key_count(key_list); - - /* grow the array */ - keys = LDNS_XREALLOC( - key_list->_keys, ldns_key *, key_count + 1); - if (!keys) { - return false; - } - - /* add the new member */ - key_list->_keys = keys; - key_list->_keys[key_count] = key; - - ldns_key_list_set_key_count(key_list, key_count + 1); - return true; -} - -ldns_key * -ldns_key_list_pop_key(ldns_key_list *key_list) -{ - size_t key_count; - ldns_key** a; - ldns_key *pop; - - if (!key_list) { - return NULL; - } - - key_count = ldns_key_list_key_count(key_list); - if (key_count == 0) { - return NULL; - } - - pop = ldns_key_list_key(key_list, key_count); - - /* shrink the array */ - a = LDNS_XREALLOC(key_list->_keys, ldns_key *, key_count - 1); - if(a) { - key_list->_keys = a; - } - - ldns_key_list_set_key_count(key_list, key_count - 1); - - return pop; -} - -#ifdef HAVE_SSL -#ifndef S_SPLINT_S -/* data pointer must be large enough (LDNS_MAX_KEYLEN) */ -static bool -ldns_key_rsa2bin(unsigned char *data, RSA *k, uint16_t *size) -{ - int i,j; - - if (!k) { - return false; - } - - if (BN_num_bytes(k->e) <= 256) { - /* normally only this path is executed (small factors are - * more common - */ - data[0] = (unsigned char) BN_num_bytes(k->e); - i = BN_bn2bin(k->e, data + 1); - j = BN_bn2bin(k->n, data + i + 1); - *size = (uint16_t) i + j; - } else if (BN_num_bytes(k->e) <= 65536) { - data[0] = 0; - /* BN_bn2bin does bigendian, _uint16 also */ - ldns_write_uint16(data + 1, (uint16_t) BN_num_bytes(k->e)); - - BN_bn2bin(k->e, data + 3); - BN_bn2bin(k->n, data + 4 + BN_num_bytes(k->e)); - *size = (uint16_t) BN_num_bytes(k->n) + 6; - } else { - return false; - } - return true; -} - -/* data pointer must be large enough (LDNS_MAX_KEYLEN) */ -static bool -ldns_key_dsa2bin(unsigned char *data, DSA *k, uint16_t *size) -{ - uint8_t T; - - if (!k) { - return false; - } - - /* See RFC2536 */ - *size = (uint16_t)BN_num_bytes(k->g); - T = (*size - 64) / 8; - memcpy(data, &T, 1); - - if (T > 8) { - fprintf(stderr, "DSA key with T > 8 (ie. > 1024 bits)"); - fprintf(stderr, " not implemented\n"); - return false; - } - - /* size = 64 + (T * 8); */ - data[0] = (unsigned char)T; - BN_bn2bin(k->q, data + 1 ); /* 20 octects */ - BN_bn2bin(k->p, data + 21 ); /* offset octects */ - BN_bn2bin(k->g, data + 21 + *size); /* offset octets */ - BN_bn2bin(k->pub_key, data + 21 + *size + *size); /* offset octets */ - *size = 21 + (*size * 3); - return true; -} - -#ifdef USE_GOST -static bool -ldns_key_gost2bin(unsigned char* data, EVP_PKEY* k, uint16_t* size) -{ - int i; - unsigned char* pp = NULL; - if(i2d_PUBKEY(k, &pp) != 37 + 64) { - /* expect 37 byte(ASN header) and 64 byte(X and Y) */ - CRYPTO_free(pp); - return false; - } - /* omit ASN header */ - for(i=0; i<64; i++) - data[i] = pp[i+37]; - CRYPTO_free(pp); - *size = 64; - return true; -} -#endif /* USE_GOST */ -#endif /* splint */ -#endif /* HAVE_SSL */ - -ldns_rr * -ldns_key2rr(const ldns_key *k) -{ - /* this function will convert a the keydata contained in - * rsa/dsa pointers to a DNSKEY rr. It will fill in as - * much as it can, but it does not know about key-flags - * for instance - */ - ldns_rr *pubkey; - ldns_rdf *keybin; - unsigned char *bin = NULL; - uint16_t size = 0; -#ifdef HAVE_SSL - RSA *rsa = NULL; - DSA *dsa = NULL; -#endif /* HAVE_SSL */ -#ifdef USE_ECDSA - EC_KEY* ec; -#endif - int internal_data = 0; - - pubkey = ldns_rr_new(); - if (!k) { - return NULL; - } - - switch (ldns_key_algorithm(k)) { - case LDNS_SIGN_HMACMD5: - case LDNS_SIGN_HMACSHA1: - case LDNS_SIGN_HMACSHA256: - ldns_rr_set_type(pubkey, LDNS_RR_TYPE_KEY); - break; - default: - ldns_rr_set_type(pubkey, LDNS_RR_TYPE_DNSKEY); - break; - } - /* zero-th rdf - flags */ - ldns_rr_push_rdf(pubkey, - ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, - ldns_key_flags(k))); - /* first - proto */ - ldns_rr_push_rdf(pubkey, - ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, LDNS_DNSSEC_KEYPROTO)); - - if (ldns_key_pubkey_owner(k)) { - ldns_rr_set_owner(pubkey, ldns_rdf_clone(ldns_key_pubkey_owner(k))); - } - - /* third - da algorithm */ - switch(ldns_key_algorithm(k)) { - case LDNS_SIGN_RSAMD5: - case LDNS_SIGN_RSASHA1: - case LDNS_SIGN_RSASHA1_NSEC3: - case LDNS_SIGN_RSASHA256: - case LDNS_SIGN_RSASHA512: - ldns_rr_push_rdf(pubkey, - ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); -#ifdef HAVE_SSL - rsa = ldns_key_rsa_key(k); - if (rsa) { - bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); - if (!bin) { - ldns_rr_free(pubkey); - return NULL; - } - if (!ldns_key_rsa2bin(bin, rsa, &size)) { - LDNS_FREE(bin); - ldns_rr_free(pubkey); - return NULL; - } - RSA_free(rsa); - internal_data = 1; - } -#endif - size++; - break; - case LDNS_SIGN_DSA: - ldns_rr_push_rdf(pubkey, - ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, LDNS_DSA)); -#ifdef HAVE_SSL - dsa = ldns_key_dsa_key(k); - if (dsa) { - bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); - if (!bin) { - ldns_rr_free(pubkey); - return NULL; - } - if (!ldns_key_dsa2bin(bin, dsa, &size)) { - LDNS_FREE(bin); - ldns_rr_free(pubkey); - return NULL; - } - DSA_free(dsa); - internal_data = 1; - } -#endif /* HAVE_SSL */ - break; - case LDNS_SIGN_DSA_NSEC3: - ldns_rr_push_rdf(pubkey, - ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, LDNS_DSA_NSEC3)); -#ifdef HAVE_SSL - dsa = ldns_key_dsa_key(k); - if (dsa) { - bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); - if (!bin) { - ldns_rr_free(pubkey); - return NULL; - } - if (!ldns_key_dsa2bin(bin, dsa, &size)) { - LDNS_FREE(bin); - ldns_rr_free(pubkey); - return NULL; - } - DSA_free(dsa); - internal_data = 1; - } -#endif /* HAVE_SSL */ - break; - case LDNS_SIGN_ECC_GOST: - ldns_rr_push_rdf(pubkey, ldns_native2rdf_int8( - LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); -#if defined(HAVE_SSL) && defined(USE_GOST) - bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); - if (!bin) { - ldns_rr_free(pubkey); - return NULL; - } -#ifndef S_SPLINT_S - if (!ldns_key_gost2bin(bin, k->_key.key, &size)) { - LDNS_FREE(bin); - ldns_rr_free(pubkey); - return NULL; - } -#endif /* splint */ - internal_data = 1; -#endif /* HAVE_SSL and USE_GOST */ - break; -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - case LDNS_SIGN_ECDSAP384SHA384: - ldns_rr_push_rdf(pubkey, ldns_native2rdf_int8( - LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); - bin = NULL; -#ifndef S_SPLINT_S - ec = EVP_PKEY_get1_EC_KEY(k->_key.key); -#endif - EC_KEY_set_conv_form(ec, POINT_CONVERSION_UNCOMPRESSED); - size = (uint16_t)i2o_ECPublicKey(ec, NULL); - if(!i2o_ECPublicKey(ec, &bin)) { - EC_KEY_free(ec); - ldns_rr_free(pubkey); - return NULL; - } - if(size > 1) { - /* move back one byte to shave off the 0x02 - * 'uncompressed' indicator that openssl made - * Actually its 0x04 (from implementation). - */ - assert(bin[0] == POINT_CONVERSION_UNCOMPRESSED); - size -= 1; - memmove(bin, bin+1, size); - } - /* down the reference count for ec, its still assigned - * to the pkey */ - EC_KEY_free(ec); - internal_data = 1; - break; -#endif - case LDNS_SIGN_HMACMD5: - case LDNS_SIGN_HMACSHA1: - case LDNS_SIGN_HMACSHA256: - bin = LDNS_XMALLOC(unsigned char, ldns_key_hmac_size(k)); - if (!bin) { - ldns_rr_free(pubkey); - return NULL; - } - ldns_rr_push_rdf(pubkey, - ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, - ldns_key_algorithm(k))); - size = ldns_key_hmac_size(k); - memcpy(bin, ldns_key_hmac_key(k), size); - internal_data = 1; - break; - } - /* fourth the key bin material */ - if (internal_data) { - keybin = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, size, bin); - LDNS_FREE(bin); - ldns_rr_push_rdf(pubkey, keybin); - } - return pubkey; -} - -void -ldns_key_free(ldns_key *key) -{ - LDNS_FREE(key); -} - -void -ldns_key_deep_free(ldns_key *key) -{ - if (ldns_key_pubkey_owner(key)) { - ldns_rdf_deep_free(ldns_key_pubkey_owner(key)); - } -#ifdef HAVE_SSL - if (ldns_key_evp_key(key)) { - EVP_PKEY_free(ldns_key_evp_key(key)); - } -#endif /* HAVE_SSL */ - if (ldns_key_hmac_key(key)) { - free(ldns_key_hmac_key(key)); - } - LDNS_FREE(key); -} - -void -ldns_key_list_free(ldns_key_list *key_list) -{ - size_t i; - for (i = 0; i < ldns_key_list_key_count(key_list); i++) { - ldns_key_deep_free(ldns_key_list_key(key_list, i)); - } - LDNS_FREE(key_list->_keys); - LDNS_FREE(key_list); -} - -ldns_rr * -ldns_read_anchor_file(const char *filename) -{ - FILE *fp; - /*char line[LDNS_MAX_PACKETLEN];*/ - char *line = LDNS_XMALLOC(char, LDNS_MAX_PACKETLEN); - int c; - size_t i = 0; - ldns_rr *r; - ldns_status status; - if(!line) { - return NULL; - } - - fp = fopen(filename, "r"); - if (!fp) { - fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); - LDNS_FREE(line); - return NULL; - } - - while ((c = fgetc(fp)) && i+1 < LDNS_MAX_PACKETLEN && c != EOF) { - line[i] = c; - i++; - } - line[i] = '\0'; - - fclose(fp); - - if (i <= 0) { - fprintf(stderr, "nothing read from %s", filename); - LDNS_FREE(line); - return NULL; - } else { - status = ldns_rr_new_frm_str(&r, line, 0, NULL, NULL); - if (status == LDNS_STATUS_OK && (ldns_rr_get_type(r) == LDNS_RR_TYPE_DNSKEY || ldns_rr_get_type(r) == LDNS_RR_TYPE_DS)) { - LDNS_FREE(line); - return r; - } else { - fprintf(stderr, "Error creating DNSKEY or DS rr from %s: %s\n", filename, ldns_get_errorstr_by_id(status)); - LDNS_FREE(line); - return NULL; - } - } -} - -char * -ldns_key_get_file_base_name(ldns_key *key) -{ - ldns_buffer *buffer; - char *file_base_name; - - buffer = ldns_buffer_new(255); - ldns_buffer_printf(buffer, "K"); - (void)ldns_rdf2buffer_str_dname(buffer, ldns_key_pubkey_owner(key)); - ldns_buffer_printf(buffer, - "+%03u+%05u", - ldns_key_algorithm(key), - ldns_key_keytag(key)); - file_base_name = strdup(ldns_buffer_export(buffer)); - ldns_buffer_free(buffer); - return file_base_name; -} - -int ldns_key_algo_supported(int algo) -{ - ldns_lookup_table *lt = ldns_signing_algorithms; - while(lt->name) { - if(lt->id == algo) - return 1; - lt++; - } - return 0; -} - -ldns_signing_algorithm ldns_get_signing_algorithm_by_name(const char* name) -{ - /* list of (signing algorithm id, alias_name) */ - ldns_lookup_table aliases[] = { - /* from bind dnssec-keygen */ - {LDNS_SIGN_HMACMD5, "HMAC-MD5"}, - {LDNS_SIGN_DSA_NSEC3, "NSEC3DSA"}, - {LDNS_SIGN_RSASHA1_NSEC3, "NSEC3RSASHA1"}, - /* old ldns usage, now RFC names */ - {LDNS_SIGN_DSA_NSEC3, "DSA_NSEC3" }, - {LDNS_SIGN_RSASHA1_NSEC3, "RSASHA1_NSEC3" }, -#ifdef USE_GOST - {LDNS_SIGN_ECC_GOST, "GOST"}, -#endif - /* compat with possible output */ - {LDNS_DH, "DH"}, - {LDNS_ECC, "ECC"}, - {LDNS_INDIRECT, "INDIRECT"}, - {LDNS_PRIVATEDNS, "PRIVATEDNS"}, - {LDNS_PRIVATEOID, "PRIVATEOID"}, - {0, NULL}}; - ldns_lookup_table* lt = ldns_signing_algorithms; - while(lt->name) { - if(strcasecmp(lt->name, name) == 0) - return lt->id; - lt++; - } - lt = aliases; - while(lt->name) { - if(strcasecmp(lt->name, name) == 0) - return lt->id; - lt++; - } - if(atoi(name) != 0) - return atoi(name); - return 0; -} diff --git a/libs/ldns/ldns/buffer.h b/libs/ldns/ldns/buffer.h deleted file mode 100644 index 65b8bdc4ad..0000000000 --- a/libs/ldns/ldns/buffer.h +++ /dev/null @@ -1,644 +0,0 @@ -/* - * buffer.h -- generic memory buffer. - * - * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. - * - * - * The buffer module implements a generic buffer. The API is based on - * the java.nio.Buffer interface. - */ - -#ifndef LDNS_BUFFER_H -#define LDNS_BUFFER_H - -#include -#include -#include - -#include -#include - -#include "ldns/util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * number of initial bytes in buffer of - * which we cannot tell the size before hand - */ -#define LDNS_MIN_BUFLEN 512 - -/** - * \file buffer.h - * - * This file contains the definition of ldns_buffer, and functions to manipulate those. - */ - -/** - * implementation of buffers to ease operations - * - * ldns_buffers can contain arbitrary information, per octet. You can write - * to the current end of a buffer, read from the current position, and - * access any data within it. - * - * Example use of buffers is in the source code of \ref host2str.c - */ -struct ldns_struct_buffer -{ - /** The current position used for reading/writing */ - size_t _position; - - /** The read/write limit */ - size_t _limit; - - /** The amount of data the buffer can contain */ - size_t _capacity; - - /** The data contained in the buffer */ - uint8_t *_data; - - /** If the buffer is fixed it cannot be resized */ - unsigned _fixed : 1; - - /** The current state of the buffer. If writing to the buffer fails - * for any reason, this value is changed. This way, you can perform - * multiple writes in sequence and check for success afterwards. */ - ldns_status _status; -}; -typedef struct ldns_struct_buffer ldns_buffer; - - -#ifdef NDEBUG -INLINE void -ldns_buffer_invariant(ldns_buffer *ATTR_UNUSED(buffer)) -{ -} -#else -INLINE void -ldns_buffer_invariant(ldns_buffer *buffer) -{ - assert(buffer != NULL); - assert(buffer->_position <= buffer->_limit); - assert(buffer->_limit <= buffer->_capacity); - assert(buffer->_data != NULL); -} -#endif - -/** - * creates a new buffer with the specified capacity. - * - * \param[in] capacity the size (in bytes) to allocate for the buffer - * \return the created buffer - */ -ldns_buffer *ldns_buffer_new(size_t capacity); - -/** - * creates a buffer with the specified data. The data IS copied - * and MEMORY allocations are done. The buffer is not fixed and can - * be resized using buffer_reserve(). - * - * \param[in] buffer pointer to the buffer to put the data in - * \param[in] data the data to encapsulate in the buffer - * \param[in] size the size of the data - */ -void ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t size); - -/** - * clears the buffer and make it ready for writing. The buffer's limit - * is set to the capacity and the position is set to 0. - * \param[in] buffer the buffer to clear - */ -INLINE void ldns_buffer_clear(ldns_buffer *buffer) -{ - ldns_buffer_invariant(buffer); - - /* reset status here? */ - - buffer->_position = 0; - buffer->_limit = buffer->_capacity; -} - -/** - * makes the buffer ready for reading the data that has been written to - * the buffer. The buffer's limit is set to the current position and - * the position is set to 0. - * - * \param[in] buffer the buffer to flip - * \return void - */ -INLINE void ldns_buffer_flip(ldns_buffer *buffer) -{ - ldns_buffer_invariant(buffer); - - buffer->_limit = buffer->_position; - buffer->_position = 0; -} - -/** - * make the buffer ready for re-reading the data. The buffer's - * position is reset to 0. - * \param[in] buffer the buffer to rewind - */ -INLINE void ldns_buffer_rewind(ldns_buffer *buffer) -{ - ldns_buffer_invariant(buffer); - - buffer->_position = 0; -} - -/** - * returns the current position in the buffer (as a number of bytes) - * \param[in] buffer the buffer - * \return the current position - */ -INLINE size_t -ldns_buffer_position(ldns_buffer *buffer) -{ - return buffer->_position; -} - -/** - * sets the buffer's position to MARK. The position must be less than - * or equal to the buffer's limit. - * \param[in] buffer the buffer - * \param[in] mark the mark to use - */ -INLINE void -ldns_buffer_set_position(ldns_buffer *buffer, size_t mark) -{ - assert(mark <= buffer->_limit); - buffer->_position = mark; -} - -/** - * changes the buffer's position by COUNT bytes. The position must not - * be moved behind the buffer's limit or before the beginning of the - * buffer. - * \param[in] buffer the buffer - * \param[in] count the count to use - */ -INLINE void -ldns_buffer_skip(ldns_buffer *buffer, ssize_t count) -{ - assert(buffer->_position + count <= buffer->_limit); - buffer->_position += count; -} - -/** - * returns the maximum size of the buffer - * \param[in] buffer - * \return the size - */ -INLINE size_t -ldns_buffer_limit(ldns_buffer *buffer) -{ - return buffer->_limit; -} - -/** - * changes the buffer's limit. If the buffer's position is greater - * than the new limit the position is set to the limit. - * \param[in] buffer the buffer - * \param[in] limit the new limit - */ -INLINE void -ldns_buffer_set_limit(ldns_buffer *buffer, size_t limit) -{ - assert(limit <= buffer->_capacity); - buffer->_limit = limit; - if (buffer->_position > buffer->_limit) - buffer->_position = buffer->_limit; -} - -/** - * returns the number of bytes the buffer can hold. - * \param[in] buffer the buffer - * \return the number of bytes - */ -INLINE size_t -ldns_buffer_capacity(ldns_buffer *buffer) -{ - return buffer->_capacity; -} - -/** - * changes the buffer's capacity. The data is reallocated so any - * pointers to the data may become invalid. The buffer's limit is set - * to the buffer's new capacity. - * \param[in] buffer the buffer - * \param[in] capacity the capacity to use - * \return whether this failed or succeeded - */ -bool ldns_buffer_set_capacity(ldns_buffer *buffer, size_t capacity); - -/** - * ensures BUFFER can contain at least AMOUNT more bytes. The buffer's - * capacity is increased if necessary using buffer_set_capacity(). - * - * The buffer's limit is always set to the (possibly increased) - * capacity. - * \param[in] buffer the buffer - * \param[in] amount amount to use - * \return whether this failed or succeeded - */ -bool ldns_buffer_reserve(ldns_buffer *buffer, size_t amount); - -/** - * returns a pointer to the data at the indicated position. - * \param[in] buffer the buffer - * \param[in] at position - * \return the pointer to the data - */ -INLINE uint8_t * -ldns_buffer_at(const ldns_buffer *buffer, size_t at) -{ - assert(at <= buffer->_limit); - return buffer->_data + at; -} - -/** - * returns a pointer to the beginning of the buffer (the data at - * position 0). - * \param[in] buffer the buffer - * \return the pointer - */ -INLINE uint8_t * -ldns_buffer_begin(const ldns_buffer *buffer) -{ - return ldns_buffer_at(buffer, 0); -} - -/** - * returns a pointer to the end of the buffer (the data at the buffer's - * limit). - * \param[in] buffer the buffer - * \return the pointer - */ -INLINE uint8_t * -ldns_buffer_end(ldns_buffer *buffer) -{ - return ldns_buffer_at(buffer, buffer->_limit); -} - -/** - * returns a pointer to the data at the buffer's current position. - * \param[in] buffer the buffer - * \return the pointer - */ -INLINE uint8_t * -ldns_buffer_current(ldns_buffer *buffer) -{ - return ldns_buffer_at(buffer, buffer->_position); -} - -/** - * returns the number of bytes remaining between the indicated position and - * the limit. - * \param[in] buffer the buffer - * \param[in] at indicated position - * \return number of bytes - */ -INLINE size_t -ldns_buffer_remaining_at(ldns_buffer *buffer, size_t at) -{ - ldns_buffer_invariant(buffer); - assert(at <= buffer->_limit); - return buffer->_limit - at; -} - -/** - * returns the number of bytes remaining between the buffer's position and - * limit. - * \param[in] buffer the buffer - * \return the number of bytes - */ -INLINE size_t -ldns_buffer_remaining(ldns_buffer *buffer) -{ - return ldns_buffer_remaining_at(buffer, buffer->_position); -} - -/** - * checks if the buffer has at least COUNT more bytes available. - * Before reading or writing the caller needs to ensure enough space - * is available! - * \param[in] buffer the buffer - * \param[in] at indicated position - * \param[in] count how much is available - * \return true or false (as int?) - */ -INLINE int -ldns_buffer_available_at(ldns_buffer *buffer, size_t at, size_t count) -{ - return count <= ldns_buffer_remaining_at(buffer, at); -} - -/** - * checks if the buffer has count bytes available at the current position - * \param[in] buffer the buffer - * \param[in] count how much is available - * \return true or false (as int?) - */ -INLINE int -ldns_buffer_available(ldns_buffer *buffer, size_t count) -{ - return ldns_buffer_available_at(buffer, buffer->_position, count); -} - -/** - * writes the given data to the buffer at the specified position - * \param[in] buffer the buffer - * \param[in] at the position (in number of bytes) to write the data at - * \param[in] data pointer to the data to write to the buffer - * \param[in] count the number of bytes of data to write - */ -INLINE void -ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void *data, size_t count) -{ - assert(ldns_buffer_available_at(buffer, at, count)); - memcpy(buffer->_data + at, data, count); -} - -/** - * writes count bytes of data to the current position of the buffer - * \param[in] buffer the buffer - * \param[in] data the data to write - * \param[in] count the lenght of the data to write - */ -INLINE void -ldns_buffer_write(ldns_buffer *buffer, const void *data, size_t count) -{ - ldns_buffer_write_at(buffer, buffer->_position, data, count); - buffer->_position += count; -} - -/** - * copies the given (null-delimited) string to the specified position at the buffer - * \param[in] buffer the buffer - * \param[in] at the position in the buffer - * \param[in] str the string to write - */ -INLINE void -ldns_buffer_write_string_at(ldns_buffer *buffer, size_t at, const char *str) -{ - ldns_buffer_write_at(buffer, at, str, strlen(str)); -} - -/** - * copies the given (null-delimited) string to the current position at the buffer - * \param[in] buffer the buffer - * \param[in] str the string to write - */ -INLINE void -ldns_buffer_write_string(ldns_buffer *buffer, const char *str) -{ - ldns_buffer_write(buffer, str, strlen(str)); -} - -/** - * writes the given byte of data at the given position in the buffer - * \param[in] buffer the buffer - * \param[in] at the position in the buffer - * \param[in] data the 8 bits to write - */ -INLINE void -ldns_buffer_write_u8_at(ldns_buffer *buffer, size_t at, uint8_t data) -{ - assert(ldns_buffer_available_at(buffer, at, sizeof(data))); - buffer->_data[at] = data; -} - -/** - * writes the given byte of data at the current position in the buffer - * \param[in] buffer the buffer - * \param[in] data the 8 bits to write - */ -INLINE void -ldns_buffer_write_u8(ldns_buffer *buffer, uint8_t data) -{ - ldns_buffer_write_u8_at(buffer, buffer->_position, data); - buffer->_position += sizeof(data); -} - -/** - * writes the given 2 byte integer at the given position in the buffer - * \param[in] buffer the buffer - * \param[in] at the position in the buffer - * \param[in] data the 16 bits to write - */ -INLINE void -ldns_buffer_write_u16_at(ldns_buffer *buffer, size_t at, uint16_t data) -{ - assert(ldns_buffer_available_at(buffer, at, sizeof(data))); - ldns_write_uint16(buffer->_data + at, data); -} - -/** - * writes the given 2 byte integer at the current position in the buffer - * \param[in] buffer the buffer - * \param[in] data the 16 bits to write - */ -INLINE void -ldns_buffer_write_u16(ldns_buffer *buffer, uint16_t data) -{ - ldns_buffer_write_u16_at(buffer, buffer->_position, data); - buffer->_position += sizeof(data); -} - -/** - * writes the given 4 byte integer at the given position in the buffer - * \param[in] buffer the buffer - * \param[in] at the position in the buffer - * \param[in] data the 32 bits to write - */ -INLINE void -ldns_buffer_write_u32_at(ldns_buffer *buffer, size_t at, uint32_t data) -{ - assert(ldns_buffer_available_at(buffer, at, sizeof(data))); - ldns_write_uint32(buffer->_data + at, data); -} - -/** - * writes the given 4 byte integer at the current position in the buffer - * \param[in] buffer the buffer - * \param[in] data the 32 bits to write - */ -INLINE void -ldns_buffer_write_u32(ldns_buffer *buffer, uint32_t data) -{ - ldns_buffer_write_u32_at(buffer, buffer->_position, data); - buffer->_position += sizeof(data); -} - -/** - * copies count bytes of data at the given position to the given data-array - * \param[in] buffer the buffer - * \param[in] at the position in the buffer to start - * \param[out] data buffer to copy to - * \param[in] count the length of the data to copy - */ -INLINE void -ldns_buffer_read_at(ldns_buffer *buffer, size_t at, void *data, size_t count) -{ - assert(ldns_buffer_available_at(buffer, at, count)); - memcpy(data, buffer->_data + at, count); -} - -/** - * copies count bytes of data at the current position to the given data-array - * \param[in] buffer the buffer - * \param[out] data buffer to copy to - * \param[in] count the length of the data to copy - */ -INLINE void -ldns_buffer_read(ldns_buffer *buffer, void *data, size_t count) -{ - ldns_buffer_read_at(buffer, buffer->_position, data, count); - buffer->_position += count; -} - -/** - * returns the byte value at the given position in the buffer - * \param[in] buffer the buffer - * \param[in] at the position in the buffer - * \return 1 byte integer - */ -INLINE uint8_t -ldns_buffer_read_u8_at(ldns_buffer *buffer, size_t at) -{ - assert(ldns_buffer_available_at(buffer, at, sizeof(uint8_t))); - return buffer->_data[at]; -} - -/** - * returns the byte value at the current position in the buffer - * \param[in] buffer the buffer - * \return 1 byte integer - */ -INLINE uint8_t -ldns_buffer_read_u8(ldns_buffer *buffer) -{ - uint8_t result = ldns_buffer_read_u8_at(buffer, buffer->_position); - buffer->_position += sizeof(uint8_t); - return result; -} - -/** - * returns the 2-byte integer value at the given position in the buffer - * \param[in] buffer the buffer - * \param[in] at position in the buffer - * \return 2 byte integer - */ -INLINE uint16_t -ldns_buffer_read_u16_at(ldns_buffer *buffer, size_t at) -{ - assert(ldns_buffer_available_at(buffer, at, sizeof(uint16_t))); - return ldns_read_uint16(buffer->_data + at); -} - -/** - * returns the 2-byte integer value at the current position in the buffer - * \param[in] buffer the buffer - * \return 2 byte integer - */ -INLINE uint16_t -ldns_buffer_read_u16(ldns_buffer *buffer) -{ - uint16_t result = ldns_buffer_read_u16_at(buffer, buffer->_position); - buffer->_position += sizeof(uint16_t); - return result; -} - -/** - * returns the 4-byte integer value at the given position in the buffer - * \param[in] buffer the buffer - * \param[in] at position in the buffer - * \return 4 byte integer - */ -INLINE uint32_t -ldns_buffer_read_u32_at(ldns_buffer *buffer, size_t at) -{ - assert(ldns_buffer_available_at(buffer, at, sizeof(uint32_t))); - return ldns_read_uint32(buffer->_data + at); -} - -/** - * returns the 4-byte integer value at the current position in the buffer - * \param[in] buffer the buffer - * \return 4 byte integer - */ -INLINE uint32_t -ldns_buffer_read_u32(ldns_buffer *buffer) -{ - uint32_t result = ldns_buffer_read_u32_at(buffer, buffer->_position); - buffer->_position += sizeof(uint32_t); - return result; -} - -/** - * returns the status of the buffer - * \param[in] buffer - * \return the status - */ -INLINE ldns_status -ldns_buffer_status(ldns_buffer *buffer) -{ - return buffer->_status; -} - -/** - * returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise - * \param[in] buffer the buffer - * \return true or false - */ -INLINE bool -ldns_buffer_status_ok(ldns_buffer *buffer) -{ - if (buffer) { - return ldns_buffer_status(buffer) == LDNS_STATUS_OK; - } else { - return false; - } -} - -/** - * prints to the buffer, increasing the capacity if required using - * buffer_reserve(). The buffer's position is set to the terminating - * '\\0'. Returns the number of characters written (not including the - * terminating '\\0') or -1 on failure. - */ -int ldns_buffer_printf(ldns_buffer *buffer, const char *format, ...); -/* ATTR_FORMAT(printf, 2, 3);*/ - -/** - * frees the buffer. - * \param[in] *buffer the buffer to be freed - * \return void - */ -void ldns_buffer_free(ldns_buffer *buffer); - -/** - * Makes the buffer fixed and returns a pointer to the data. The - * caller is responsible for free'ing the result. - * \param[in] *buffer the buffer to be exported - * \return void - */ -void *ldns_buffer_export(ldns_buffer *buffer); - -/** - * Copy contents of the other buffer to this buffer. Silently truncated - * if this buffer is too small. - * \param[out] *result resulting buffer which is copied to. - * \param[in] *from what to copy to result. - */ -void ldns_buffer_copy(ldns_buffer* result, ldns_buffer* from); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_BUFFER_H */ diff --git a/libs/ldns/ldns/common.h b/libs/ldns/ldns/common.h deleted file mode 100644 index cc7dd89d1a..0000000000 --- a/libs/ldns/ldns/common.h +++ /dev/null @@ -1,52 +0,0 @@ -/** - * \file common.h - * - * Common definitions for LDNS - */ - -/** - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#ifndef LDNS_COMMON_H -#define LDNS_COMMON_H - -#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) - -#if defined(HAVE_STDBOOL_H) -#include -#else - -/*@ignore@*/ -/* splint barfs on this construct */ -typedef unsigned int bool; -#define bool bool -#define false 0 -#define true 1 -#define __bool_true_false_are_defined 1 -/*@end@*/ - -#endif - -#endif - -#ifdef HAVE_ATTR_FORMAT -#define ATTR_FORMAT(archetype, string_index, first_to_check) \ - __attribute__ ((format (archetype, string_index, first_to_check))) -#else /* !HAVE_ATTR_FORMAT */ -#define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ -#endif /* !HAVE_ATTR_FORMAT */ - -#if defined(__cplusplus) -#define ATTR_UNUSED(x) -#elif defined(HAVE_ATTR_UNUSED) -#define ATTR_UNUSED(x) x __attribute__((unused)) -#else /* !HAVE_ATTR_UNUSED */ -#define ATTR_UNUSED(x) x -#endif /* !HAVE_ATTR_UNUSED */ - -#endif /* LDNS_COMMON_H */ diff --git a/libs/ldns/ldns/config.h.in b/libs/ldns/ldns/config.h.in deleted file mode 100644 index 473f1ff7c5..0000000000 --- a/libs/ldns/ldns/config.h.in +++ /dev/null @@ -1,470 +0,0 @@ -/* ldns/config.h.in. Generated from configure.ac by autoheader. */ - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define to 1 if you have the header file. */ -#undef HAVE_ARPA_INET_H - -/* Whether the C compiler accepts the "format" attribute */ -#undef HAVE_ATTR_FORMAT - -/* Whether the C compiler accepts the "unused" attribute */ -#undef HAVE_ATTR_UNUSED - -/* Define to 1 if you have the `b32_ntop' function. */ -#undef HAVE_B32_NTOP - -/* Define to 1 if you have the `b32_pton' function. */ -#undef HAVE_B32_PTON - -/* Define to 1 if you have the `b64_ntop' function. */ -#undef HAVE_B64_NTOP - -/* Define to 1 if you have the `b64_pton' function. */ -#undef HAVE_B64_PTON - -/* Define to 1 if you have the `ctime_r' function. */ -#undef HAVE_CTIME_R - -/* Define to 1 if you have the declaration of `NID_secp384r1', and to 0 if you - don't. */ -#undef HAVE_DECL_NID_SECP384R1 - -/* Define to 1 if you have the declaration of `NID_X9_62_prime256v1', and to 0 - if you don't. */ -#undef HAVE_DECL_NID_X9_62_PRIME256V1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the `endprotoent' function. */ -#undef HAVE_ENDPROTOENT - -/* Define to 1 if you have the `endservent' function. */ -#undef HAVE_ENDSERVENT - -/* Define to 1 if you have the `EVP_sha256' function. */ -#undef HAVE_EVP_SHA256 - -/* Define to 1 if you have the `fcntl' function. */ -#undef HAVE_FCNTL - -/* Whether getaddrinfo is available */ -#undef HAVE_GETADDRINFO - -/* Define to 1 if you have the header file. */ -#undef HAVE_GETOPT_H - -/* Define to 1 if you have the `gmtime_r' function. */ -#undef HAVE_GMTIME_R - -/* If you have HMAC_CTX_init */ -#undef HAVE_HMAC_CTX_INIT - -/* Define to 1 if you have the `inet_aton' function. */ -#undef HAVE_INET_ATON - -/* Define to 1 if you have the `inet_ntop' function. */ -#undef HAVE_INET_NTOP - -/* Define to 1 if you have the `inet_pton' function. */ -#undef HAVE_INET_PTON - -/* define if you have inttypes.h */ -#undef HAVE_INTTYPES_H - -/* if the function 'ioctlsocket' is available */ -#undef HAVE_IOCTLSOCKET - -/* Define to 1 if you have the `isascii' function. */ -#undef HAVE_ISASCII - -/* Define to 1 if you have the `isblank' function. */ -#undef HAVE_ISBLANK - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_ERR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_RAND_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_OPENSSL_SSL_H - -/* Define if you have Python libraries and header files. */ -#undef HAVE_PYTHON - -/* Define to 1 if you have the `random' function. */ -#undef HAVE_RANDOM - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#undef HAVE_REALLOC - -/* Define to 1 if you have the `sleep' function. */ -#undef HAVE_SLEEP - -/* Define to 1 if you have the `snprintf' function. */ -#undef HAVE_SNPRINTF - -/* Define if you have the SSL libraries installed. */ -#undef HAVE_SSL - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDARG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDBOOL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strlcpy' function. */ -#undef HAVE_STRLCPY - -/* Define to 1 if you have the `strtoul' function. */ -#undef HAVE_STRTOUL - -/* Define if you have Swig libraries and header files. */ -#undef HAVE_SWIG - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MOUNT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* define if you have sys/socket.h */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* define if you have sys/types.h */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the `timegm' function. */ -#undef HAVE_TIMEGM - -/* Define to 1 if you have the header file. */ -#undef HAVE_TIME_H - -/* define if you have unistd.h */ -#undef HAVE_UNISTD_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WINSOCK2_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_WS2TCPIP_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* System configuration dir */ -#undef SYSCONFDIR - -/* Define this to enable ECDSA support. */ -#undef USE_ECDSA - -/* Define this to enable GOST support. */ -#undef USE_GOST - -/* Define this to enable SHA256 and SHA512 support. */ -#undef USE_SHA2 - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Whether the windows socket API is used */ -#undef USE_WINSOCK - -/* the version of the windows API enabled */ -#undef WINVER - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to 1 if you need to in order for `stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* in_addr_t */ -#undef in_addr_t - -/* in_port_t */ -#undef in_port_t - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -#undef inline -#endif - -/* Define to `short' if does not define. */ -#undef int16_t - -/* Define to `int' if does not define. */ -#undef int32_t - -/* Define to `long long' if does not define. */ -#undef int64_t - -/* Define to `char' if does not define. */ -#undef int8_t - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - -/* Define to 'int' if not defined */ -#undef socklen_t - -/* Fallback member name for socket family in struct sockaddr_storage */ -#undef ss_family - -/* Define to `int' if does not define. */ -#undef ssize_t - -/* Define to `unsigned short' if does not define. */ -#undef uint16_t - -/* Define to `unsigned int' if does not define. */ -#undef uint32_t - -/* Define to `unsigned long long' if does not define. */ -#undef uint64_t - -/* Define to `unsigned char' if does not define. */ -#undef uint8_t - - -#include -#include -#include -#include - -#ifndef LITTLE_ENDIAN -#define LITTLE_ENDIAN 1234 -#endif - -#ifndef BIG_ENDIAN -#define BIG_ENDIAN 4321 -#endif - -#ifndef BYTE_ORDER -#ifdef WORDS_BIGENDIAN -#define BYTE_ORDER BIG_ENDIAN -#else -#define BYTE_ORDER LITTLE_ENDIAN -#endif /* WORDS_BIGENDIAN */ -#endif /* BYTE_ORDER */ - -#if STDC_HEADERS -#include -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_ARPA_INET_H -#include -#endif - -#ifdef HAVE_WINSOCK2_H -#include -#endif - -#ifdef HAVE_WS2TCPIP_H -#include -#endif - - -/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */ -#ifdef HAVE_WINSOCK2_H -#define FD_SET_T (u_int) -#else -#define FD_SET_T -#endif - - - - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef B64_PTON -int ldns_b64_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -/** - * calculates the size needed to store the result of b64_ntop - */ -/*@unused@*/ -static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) -{ - return ((((srcsize + 2) / 3) * 4) + 1); -} -#endif /* !B64_PTON */ -#ifndef B64_NTOP -int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); -/** - * calculates the size needed to store the result of ldns_b64_pton - */ -/*@unused@*/ -static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) -{ - return (((((srcsize + 3) / 4) * 3)) + 1); -} -#endif /* !B64_NTOP */ - -#ifndef HAVE_SLEEP -/* use windows sleep, in millisecs, instead */ -#define sleep(x) Sleep((x)*1000) -#endif - -#ifndef HAVE_RANDOM -#define srandom(x) srand(x) -#define random(x) rand(x) -#endif - -#ifndef HAVE_TIMEGM -#include -time_t timegm (struct tm *tm); -#endif /* !TIMEGM */ -#ifndef HAVE_GMTIME_R -struct tm *gmtime_r(const time_t *timep, struct tm *result); -#endif -#ifndef HAVE_ISBLANK -int isblank(int c); -#endif /* !HAVE_ISBLANK */ -#ifndef HAVE_ISASCII -int isascii(int c); -#endif /* !HAVE_ISASCII */ -#ifndef HAVE_SNPRINTF -#include -int snprintf (char *str, size_t count, const char *fmt, ...); -int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); -#endif /* HAVE_SNPRINTF */ -#ifndef HAVE_INET_PTON -int inet_pton(int af, const char* src, void* dst); -#endif /* HAVE_INET_PTON */ -#ifndef HAVE_INET_NTOP -const char *inet_ntop(int af, const void *src, char *dst, size_t size); -#endif -#ifndef HAVE_INET_ATON -int inet_aton(const char *cp, struct in_addr *addr); -#endif -#ifndef HAVE_MEMMOVE -void *memmove(void *dest, const void *src, size_t n); -#endif -#ifndef HAVE_STRLCPY -size_t strlcpy(char *dst, const char *src, size_t siz); -#endif -#ifdef __cplusplus -} -#endif -#ifndef HAVE_GETADDRINFO -#include "compat/fake-rfc2553.h" -#endif -#ifndef HAVE_STRTOUL -#define strtoul (unsigned long)strtol -#endif - diff --git a/libs/ldns/ldns/dname.h b/libs/ldns/ldns/dname.h deleted file mode 100644 index a91f075257..0000000000 --- a/libs/ldns/ldns/dname.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * dname.h - * - * dname definitions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file dname.h - * - * dname contains function to read and manipulate domain names. - * - * Example domain names are "www.nlnetlabs.nl." and "." (the root) - * - * If a domain name ends with a dot ("."), it is called a Fully Qualified - * Domain Name (FQDN). In certain places (for instance when reading a zone - * file), an origin (which is just another domain name) non-FQDNs will be - * placed after the current. For instance, if i have a zone file where the - * origin has been set to "nl.", and my file contains the name - * "www.nlnetlabs", it will result in "www.nlnetlabs.nl.". Internally, dnames are - * always absolute (the dot is added when it is missing and there is no origin). - * - * An FQDN is also - * known as an absolute domain name, therefore the function to check this is - * called \ref ldns_dname_str_absolute - * - * Domain names are stored in \ref ldns_rdf structures, with the type - * \ref LDNS_RDF_TYPE_DNAME - * - * This module is *NOT* about the RR type called DNAME. - */ - - -#ifndef LDNS_DNAME_H -#define LDNS_DNAME_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_DNAME_NORMALIZE tolower - -/** - * concatenates two dnames together - * \param[in] rd1 the leftside - * \param[in] rd2 the rightside - * \return a new rdf with leftside/rightside - */ -ldns_rdf *ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2); - -/** - * concatenates rd2 after rd1 (rd2 is copied, rd1 is modified) - * \param[in] rd1 the leftside - * \param[in] rd2 the rightside - * \return LDNS_STATUS_OK on success - */ -ldns_status ldns_dname_cat(ldns_rdf *rd1, ldns_rdf *rd2); - -/** - * Returns a clone of the given dname with the labels - * reversed - * \param[in] d the dname to reverse - * \return clone of the dname with the labels reversed. - */ -ldns_rdf *ldns_dname_reverse(const ldns_rdf *d); - -/** - * Clones the given dname from the nth label on - * \param[in] d The dname to clone - * \param[in] n the label nr to clone from, if this is 0, the complete - * dname is cloned - * \return A newly allocated *rdf structure, containing the cloned dname, - * or NULL if either d was NULL, not a dname, or if n >= - * label_count - */ -ldns_rdf * -ldns_dname_clone_from(const ldns_rdf *d, uint16_t n); - -/** - * chop one label off the left side of a dname. so - * wwww.nlnetlabs.nl, becomes nlnetlabs.nl - * This new name is a clone and must be freed with ldns_deep_free() - * \param[in] d the dname to chop - * \return the remaining dname - */ -ldns_rdf *ldns_dname_left_chop(const ldns_rdf *d); - -/** - * count the number of labels inside a LDNS_RDF_DNAME type rdf. - * \param[in] *r the rdf - * \return the number of labels - */ -uint8_t ldns_dname_label_count(const ldns_rdf *r); - -/** - * creates a new dname rdf from a string. - * \param[in] str string to use - * \return ldns_rdf* or NULL in case of an error - */ -ldns_rdf *ldns_dname_new_frm_str(const char *str); - -/** - * Create a new dname rdf from a string - * \param[in] s the size of the new dname - * \param[in] *data pointer to the actual data - * \return ldns_rdf* - */ -ldns_rdf *ldns_dname_new(uint16_t s, void *data); - -/** - * Create a new dname rdf from data (the data is copied) - * \param[in] size the size of the data - * \param[in] *data pointer to the actual data - * \return ldns_rdf* - */ -ldns_rdf *ldns_dname_new_frm_data(uint16_t size, const void *data); - -/** - * Put a dname into canonical fmt - ie. lowercase it - * \param[in] rdf the dname to lowercase - * \return void - */ -void ldns_dname2canonical(const ldns_rdf *rdf); - -/** - * test wether the name sub falls under parent (i.e. is a subdomain - * of parent). This function will return false if the given dnames are - * equal. - * \param[in] sub the name to test - * \param[in] parent the parent's name - * \return true if sub falls under parent, otherwise false - */ -bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent); - -/** - * Compares the two dname rdf's according to the algorithm for ordering - * in RFC4034 Section 6. - * \param[in] dname1 First dname rdf to compare - * \param[in] dname2 Second dname rdf to compare - * \return -1 if dname1 comes before dname2, 1 if dname1 comes after dname2, and 0 if they are equal. - */ -int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2); - -/** - * Checks whether the dname matches the given wildcard - * \param[in] dname The dname to check - * \param[in] wildcard The wildcard to check with - * \return 1 If the wildcard matches, OR if 'wildcard' is not a wildcard and - * the names are *exactly* the same - * 0 If the wildcard does not match, or if it is not a wildcard and - * the names are not the same - */ -int ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard); - -/** - * check if middle lays in the interval defined by prev and next - * prev <= middle < next. This is usefull for nsec checking - * \param[in] prev the previous dname - * \param[in] middle the dname to check - * \param[in] next the next dname - * return 0 on error or unknown, -1 when middle is in the interval, +1 when not - */ -int ldns_dname_interval(const ldns_rdf *prev, const ldns_rdf *middle, const ldns_rdf *next); - -/** - * Checks whether the given dname string is absolute (i.e. ends with a '.') - * \param[in] *dname_str a string representing the dname - * \return true or false - */ -bool ldns_dname_str_absolute(const char *dname_str); - -/** - * look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME - * try and retrieve a specific label. The labels are numbered - * starting from 0 (left most). - * \param[in] rdf the rdf to look in - * \param[in] labelpos return the label with this number - * \return a ldns_rdf* with the label as name or NULL on error - */ -ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos); - -/** - * Check if dname is a wildcard, starts with *. - * \param[in] dname: the rdf to look in - * \return true if a wildcard, false if not. - */ -int ldns_dname_is_wildcard(const ldns_rdf* dname); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_DNAME_H */ diff --git a/libs/ldns/ldns/dnssec.h b/libs/ldns/ldns/dnssec.h deleted file mode 100644 index 7bfc70b710..0000000000 --- a/libs/ldns/ldns/dnssec.h +++ /dev/null @@ -1,497 +0,0 @@ -/* - * dnssec.h -- defines for the Domain Name System (SEC) (DNSSEC) - * - * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. - * - * A bunch of defines that are used in the DNS - */ - -/** - * \file dnssec.h - * - * This module contains base functions for DNSSEC operations - * (RFC4033 t/m RFC4035). - * - * Since those functions heavily rely op cryptographic operations, - * this module is dependent on openssl. - * - */ - - -#ifndef LDNS_DNSSEC_H -#define LDNS_DNSSEC_H - -#ifdef HAVE_SSL -#include -#include -#endif /* HAVE_SSL */ -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_MAX_KEYLEN 2048 -#define LDNS_DNSSEC_KEYPROTO 3 -/* default time before sigs expire */ -#define LDNS_DEFAULT_EXP_TIME 2419200 /* 4 weeks */ - -/** return values for the old-signature callback */ -#define LDNS_SIGNATURE_LEAVE_ADD_NEW 0 -#define LDNS_SIGNATURE_LEAVE_NO_ADD 1 -#define LDNS_SIGNATURE_REMOVE_ADD_NEW 2 -#define LDNS_SIGNATURE_REMOVE_NO_ADD 3 - -/** - * Returns the first RRSIG rr that corresponds to the rrset - * with the given name and type - * - * \param[in] name The dname of the RRset covered by the RRSIG to find - * \param[in] type The type of the RRset covered by the RRSIG to find - * \param[in] rrs List of rrs to search in - * \returns Pointer to the first RRsig ldns_rr found, or NULL if it is - * not present - */ -ldns_rr *ldns_dnssec_get_rrsig_for_name_and_type(const ldns_rdf *name, - const ldns_rr_type type, - const ldns_rr_list *rrs); - -/** - * Returns the DNSKEY that corresponds to the given RRSIG rr from the list, if - * any - * - * \param[in] rrsig The rrsig to find the DNSKEY for - * \param[in] rrs The rr list to find the key in - * \return The DNSKEY that corresponds to the given RRSIG, or NULL if it was - * not found. - */ -ldns_rr *ldns_dnssec_get_dnskey_for_rrsig(const ldns_rr *rrsig, const ldns_rr_list *rrs); - -/** - * Returns the rdata field that contains the bitmap of the covered types of - * the given NSEC record - * - * \param[in] nsec The nsec to get the covered type bitmap of - * \return An ldns_rdf containing the bitmap, or NULL on error - */ -ldns_rdf *ldns_nsec_get_bitmap(ldns_rr *nsec); - - -#define LDNS_NSEC3_MAX_ITERATIONS 65535 - -/** - * Returns the dname of the closest (provable) encloser - */ -ldns_rdf * -ldns_dnssec_nsec3_closest_encloser(ldns_rdf *qname, - ldns_rr_type qtype, - ldns_rr_list *nsec3s); - -/** - * Checks whether the packet contains rrsigs - */ -bool -ldns_dnssec_pkt_has_rrsigs(const ldns_pkt *pkt); - -/** - * Returns a ldns_rr_list containing the signatures covering the given name - * and type - */ -ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type); - -/** - * Returns a ldns_rr_list containing the signatures covering the given type - */ -ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_type(const ldns_pkt *pkt, ldns_rr_type type); - -/** - * calculates a keytag of a key for use in DNSSEC. - * - * \param[in] key the key as an RR to use for the calc. - * \return the keytag - */ -uint16_t ldns_calc_keytag(const ldns_rr *key); - -/** - * Calculates keytag of DNSSEC key, operates on wireformat rdata. - * \param[in] key the key as uncompressed wireformat rdata. - * \param[in] keysize length of key data. - * \return the keytag - */ -uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize); - -#ifdef HAVE_SSL -/** - * converts a buffer holding key material to a DSA key in openssl. - * - * \param[in] key the key to convert - * \return a DSA * structure with the key material - */ -DSA *ldns_key_buf2dsa(ldns_buffer *key); -/** - * Like ldns_key_buf2dsa, but uses raw buffer. - * \param[in] key the uncompressed wireformat of the key. - * \param[in] len length of key data - * \return a DSA * structure with the key material - */ -DSA *ldns_key_buf2dsa_raw(unsigned char* key, size_t len); - -/** - * Utility function to calculate hash using generic EVP_MD pointer. - * \param[in] data the data to hash. - * \param[in] len length of data. - * \param[out] dest the destination of the hash, must be large enough. - * \param[in] md the message digest to use. - * \return true if worked, false on failure. - */ -int ldns_digest_evp(unsigned char* data, unsigned int len, - unsigned char* dest, const EVP_MD* md); - -/** - * Converts a holding buffer with key material to EVP PKEY in openssl. - * Only available if ldns was compiled with GOST. - * \param[in] key data to convert - * \param[in] keylen length of the key data - * \return the key or NULL on error. - */ -EVP_PKEY* ldns_gost2pkey_raw(unsigned char* key, size_t keylen); - -/** - * Converts a holding buffer with key material to EVP PKEY in openssl. - * Only available if ldns was compiled with ECDSA. - * \param[in] key data to convert - * \param[in] keylen length of the key data - * \param[in] algo precise algorithm to initialize ECC group values. - * \return the key or NULL on error. - */ -EVP_PKEY* ldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo); - -#endif /* HAVE_SSL */ - -#ifdef HAVE_SSL -/** - * converts a buffer holding key material to a RSA key in openssl. - * - * \param[in] key the key to convert - * \return a RSA * structure with the key material - */ -RSA *ldns_key_buf2rsa(ldns_buffer *key); - -/** - * Like ldns_key_buf2rsa, but uses raw buffer. - * \param[in] key the uncompressed wireformat of the key. - * \param[in] len length of key data - * \return a RSA * structure with the key material - */ -RSA *ldns_key_buf2rsa_raw(unsigned char* key, size_t len); -#endif /* HAVE_SSL */ - -/** - * returns a new DS rr that represents the given key rr. - * - * \param[in] *key the key to convert - * \param[in] h the hash to use LDNS_SHA1/LDNS_SHA256 - * \return ldns_rr* a new rr pointer to a DS - */ -ldns_rr *ldns_key_rr2ds(const ldns_rr *key, ldns_hash h); - -/** - * Create the type bitmap for an NSEC(3) record - */ -ldns_rdf * -ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[], - size_t size, - ldns_rr_type nsec_type); - -/** - * Creates NSEC - */ -ldns_rr * -ldns_dnssec_create_nsec(ldns_dnssec_name *from, - ldns_dnssec_name *to, - ldns_rr_type nsec_type); - - -/** - * Creates NSEC3 - */ -ldns_rr * -ldns_dnssec_create_nsec3(ldns_dnssec_name *from, - ldns_dnssec_name *to, - ldns_rdf *zone_name, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt); - -/** - * Create a NSEC record - * \param[in] cur_owner the current owner which should be taken as the starting point - * \param[in] next_owner the rrlist which the nsec rr should point to - * \param[in] rrs all rrs from the zone, to find all RR types of cur_owner in - * \return a ldns_rr with the nsec record in it - */ -ldns_rr * ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs); - -/** - * Calculates the hashed name using the given parameters - * \param[in] *name The owner name to calculate the hash for - * \param[in] algorithm The hash algorithm to use - * \param[in] iterations The number of hash iterations to use - * \param[in] salt_length The length of the salt in bytes - * \param[in] salt The salt to use - * \return The hashed owner name rdf, without the domain name - */ -ldns_rdf *ldns_nsec3_hash_name(ldns_rdf *name, uint8_t algorithm, uint16_t iterations, uint8_t salt_length, uint8_t *salt); - -/** - * Sets all the NSEC3 options. The rr to set them in must be initialized with _new() and - * type LDNS_RR_TYPE_NSEC3 - * \param[in] *rr The RR to set the values in - * \param[in] algorithm The NSEC3 hash algorithm - * \param[in] flags The flags field - * \param[in] iterations The number of hash iterations - * \param[in] salt_length The length of the salt in bytes - * \param[in] salt The salt bytes - */ -void ldns_nsec3_add_param_rdfs(ldns_rr *rr, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt); - -/* this will NOT return the NSEC3 completed, you will have to run the - finalize function on the rrlist later! */ -ldns_rr * -ldns_create_nsec3(ldns_rdf *cur_owner, - ldns_rdf *cur_zone, - ldns_rr_list *rrs, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt, - bool emptynonterminal); - -/** - * Returns the hash algorithm used in the given NSEC3 RR - * \param[in] *nsec3_rr The RR to read from - * \return The algorithm identifier, or 0 on error - */ -uint8_t ldns_nsec3_algorithm(const ldns_rr *nsec3_rr); - -/** - * Returns flags field - */ -uint8_t -ldns_nsec3_flags(const ldns_rr *nsec3_rr); - -/** - * Returns true if the opt-out flag has been set in the given NSEC3 RR - * \param[in] *nsec3_rr The RR to read from - * \return true if the RR has type NSEC3 and the opt-out bit has been set, false otherwise - */ -bool ldns_nsec3_optout(const ldns_rr *nsec3_rr); - -/** - * Returns the number of hash iterations used in the given NSEC3 RR - * \param[in] *nsec3_rr The RR to read from - * \return The number of iterations - */ -uint16_t ldns_nsec3_iterations(const ldns_rr *nsec3_rr); - -/** - * Returns the salt used in the given NSEC3 RR - * \param[in] *nsec3_rr The RR to read from - * \return The salt rdf, or NULL on error - */ -ldns_rdf *ldns_nsec3_salt(const ldns_rr *nsec3_rr); - -/** - * Returns the length of the salt used in the given NSEC3 RR - * \param[in] *nsec3_rr The RR to read from - * \return The length of the salt in bytes - */ -uint8_t ldns_nsec3_salt_length(const ldns_rr *nsec3_rr); - -/** - * Returns the salt bytes used in the given NSEC3 RR - * \param[in] *nsec3_rr The RR to read from - * \return The salt in bytes, this is alloced, so you need to free it - */ -uint8_t *ldns_nsec3_salt_data(const ldns_rr *nsec3_rr); - -/** - * Returns the first label of the next ownername in the NSEC3 chain (ie. without the domain) - * \param[in] nsec3_rr The RR to read from - * \return The first label of the next owner name in the NSEC3 chain, or NULL on error - */ -ldns_rdf *ldns_nsec3_next_owner(const ldns_rr *nsec3_rr); - -/** - * Returns the bitmap specifying the covered types of the given NSEC3 RR - * \param[in] *nsec3_rr The RR to read from - * \return The covered type bitmap rdf - */ -ldns_rdf *ldns_nsec3_bitmap(const ldns_rr *nsec3_rr); - -/** - * Calculates the hashed name using the parameters of the given NSEC3 RR - * \param[in] *nsec The RR to use the parameters from - * \param[in] *name The owner name to calculate the hash for - * \return The hashed owner name rdf, without the domain name - */ -ldns_rdf *ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name); - -/** - * Checks coverage of NSEC RR type bitmap - * \param[in] nsec_bitmap The NSEC bitmap rdata field to check - * \param[in] type The type to check - * \return true if the NSEC RR covers the type - */ -bool ldns_nsec_bitmap_covers_type(const ldns_rdf *nsec_bitmap, ldns_rr_type type); - -/** - * Checks coverage of NSEC(3) RR name span - * Remember that nsec and name must both be in canonical form (ie use - * \ref ldns_rr2canonical and \ref ldns_dname2canonical prior to calling this - * function) - * - * \param[in] nsec The NSEC RR to check - * \param[in] name The owner dname to check, if the nsec record is a NSEC3 record, this should be the hashed name - * \return true if the NSEC RR covers the owner name - */ -bool ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name); - -#ifdef HAVE_SSL -/** - * verify a packet - * \param[in] p the packet - * \param[in] t the rr set type to check - * \param[in] o the rr set name to check - * \param[in] k list of keys - * \param[in] s list of sigs (may be null) - * \param[out] good_keys keys which validated the packet - * \return status - * - */ -ldns_status ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, ldns_rr_list *k, ldns_rr_list *s, ldns_rr_list *good_keys); -#endif - -/** - * chains nsec3 list - */ -ldns_status -ldns_dnssec_chain_nsec3_list(ldns_rr_list *nsec3_rrs); - -/** - * compare for nsec3 sort - */ -int -qsort_rr_compare_nsec3(const void *a, const void *b); - -/** - * sort nsec3 list - */ -void -ldns_rr_list_sort_nsec3(ldns_rr_list *unsorted); - -/** - * Default callback function to always leave present signatures, and - * add new ones - * \param[in] sig The signature to check for removal (unused) - * \param[in] n Optional argument (unused) - * \return LDNS_SIGNATURE_LEAVE_ADD_NEW - */ -int ldns_dnssec_default_add_to_signatures(ldns_rr *sig, void *n); -/** - * Default callback function to always leave present signatures, and - * add no new ones for the keys of these signatures - * \param[in] sig The signature to check for removal (unused) - * \param[in] n Optional argument (unused) - * \return LDNS_SIGNATURE_LEAVE_NO_ADD - */ -int ldns_dnssec_default_leave_signatures(ldns_rr *sig, void *n); -/** - * Default callback function to always remove present signatures, but - * add no new ones - * \param[in] sig The signature to check for removal (unused) - * \param[in] n Optional argument (unused) - * \return LDNS_SIGNATURE_REMOVE_NO_ADD - */ -int ldns_dnssec_default_delete_signatures(ldns_rr *sig, void *n); -/** - * Default callback function to always leave present signatures, and - * add new ones - * \param[in] sig The signature to check for removal (unused) - * \param[in] n Optional argument (unused) - * \return LDNS_SIGNATURE_REMOVE_ADD_NEW - */ -int ldns_dnssec_default_replace_signatures(ldns_rr *sig, void *n); - -#ifdef HAVE_SSL -/** - * Converts the DSA signature from ASN1 representation (RFC2459, as - * used by OpenSSL) to raw signature data as used in DNS (rfc2536) - * - * \param[in] sig The signature in RFC2459 format - * \param[in] sig_len The length of the signature - * \return a new rdf with the signature - */ -ldns_rdf * -ldns_convert_dsa_rrsig_asn12rdf(const ldns_buffer *sig, - const long sig_len); - -/** - * Converts the RRSIG signature RDF (in rfc2536 format) to a buffer - * with the signature in rfc2459 format - * - * \param[out] target_buffer buffer to place the signature data - * \param[in] sig_rdf The signature rdf to convert - * \return LDNS_STATUS_OK on success, error code otherwise - */ -ldns_status -ldns_convert_dsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, - const ldns_rdf *sig_rdf); - -/** - * Converts the ECDSA signature from ASN1 representation (as - * used by OpenSSL) to raw signature data as used in DNS - * This routine is only present if ldns is compiled with ecdsa support. - * - * \param[in] sig The signature in ASN1 format - * \param[in] sig_len The length of the signature - * \return a new rdf with the signature - */ -ldns_rdf * -ldns_convert_ecdsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len); - -/** - * Converts the RRSIG signature RDF (from DNS) to a buffer with the - * signature in ASN1 format as openssl uses it. - * This routine is only present if ldns is compiled with ecdsa support. - * - * \param[out] target_buffer buffer to place the signature data in ASN1. - * \param[in] sig_rdf The signature rdf to convert - * \return LDNS_STATUS_OK on success, error code otherwise - */ -ldns_status -ldns_convert_ecdsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, - const ldns_rdf *sig_rdf); - -#endif /* HAVE_SSL */ - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_DNSSEC_H */ diff --git a/libs/ldns/ldns/dnssec_sign.h b/libs/ldns/ldns/dnssec_sign.h deleted file mode 100644 index 5b3921ab20..0000000000 --- a/libs/ldns/ldns/dnssec_sign.h +++ /dev/null @@ -1,318 +0,0 @@ -/** dnssec_verify */ - -#ifndef LDNS_DNSSEC_SIGN_H -#define LDNS_DNSSEC_SIGN_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* sign functions */ - -/** Sign flag that makes DNSKEY type signed by all keys, not only by SEP keys*/ -#define LDNS_SIGN_DNSKEY_WITH_ZSK 1 - -/** - * Create an empty RRSIG RR (i.e. without the actual signature data) - * \param[in] rrset The RRset to create the signature for - * \param[in] key The key that will create the signature - * \return signature rr - */ -ldns_rr * -ldns_create_empty_rrsig(ldns_rr_list *rrset, - ldns_key *key); - -/** - * Sign the buffer which contains the wiredata of an rrset, and the - * corresponding empty rrsig rr with the given key - * \param[in] sign_buf the buffer with data to sign - * \param[in] key the key to sign with - * \return an rdata field with the signature data - */ -ldns_rdf * -ldns_sign_public_buffer(ldns_buffer *sign_buf, ldns_key *key); - -/** - * Sign an rrset - * \param[in] rrset the rrset - * \param[in] keys the keys to use - * \return a rr_list with the signatures - */ -ldns_rr_list *ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys); - -#ifdef HAVE_SSL -/** - * Sign a buffer with the DSA key (hash with SHA1) - * \param[in] to_sign buffer with the data - * \param[in] key the key to use - * \return a ldns_rdf with the signed data - */ -ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key); - -/** - * Sign data with EVP (general method for different algorithms) - * - * \param[in] to_sign The ldns_buffer containing raw data that is - * to be signed - * \param[in] key The EVP_PKEY key structure to sign with - * \param[in] digest_type The digest algorithm to use in the creation of - * the signature - * \return ldns_rdf for the RRSIG ldns_rr - */ -ldns_rdf *ldns_sign_public_evp(ldns_buffer *to_sign, - EVP_PKEY *key, - const EVP_MD *digest_type); - -/** - * Sign a buffer with the RSA key (hash with SHA1) - * \param[in] to_sign buffer with the data - * \param[in] key the key to use - * \return a ldns_rdf with the signed data - */ -ldns_rdf *ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key); - -/** - * Sign a buffer with the RSA key (hash with MD5) - * \param[in] to_sign buffer with the data - * \param[in] key the key to use - * \return a ldns_rdf with the signed data - */ -ldns_rdf *ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key); -#endif /* HAVE_SSL */ - -/** - * Finds the first dnssec_name node in the rbtree that has not been marked - * as glue, starting at the given node - * - * \param[in] node the first node to check - * \return the first node that has not been marked as glue, or NULL - * if not found (TODO: make that LDNS_RBTREE_NULL?) - */ -ldns_rbnode_t *ldns_dnssec_name_node_next_nonglue(ldns_rbnode_t *node); - -/** - * Adds NSEC records to the given dnssec_zone - * - * \param[in] zone the zone to add the records to - * \param[in] new_rrs ldns_rr's created by this function are - * added to this rr list, so the caller can free them later - * \return LDNS_STATUS_OK on success, an error code otherwise - */ -ldns_status ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs); - -/** - * Adds NSEC3 records to the zone - */ -ldns_status -ldns_dnssec_zone_create_nsec3s(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt); - -/** - * remove signatures if callback function tells to - * - * \param[in] signatures list of signatures to check, and - * possibly remove, depending on the value of the - * callback - * \param[in] key_list these are marked to be used or not, - * on the return value of the callback - * \param[in] func this function is called to specify what to - * do with each signature (and corresponding key) - * \param[in] arg Optional argument for the callback function - * \returns pointer to the new signatures rrs (the original - * passed to this function may have been removed) - */ -ldns_dnssec_rrs *ldns_dnssec_remove_signatures(ldns_dnssec_rrs *signatures, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg); - -/** - * Adds signatures to the zone - * - * \param[in] zone the zone to add RRSIG Resource Records to - * \param[in] new_rrs the RRSIG RRs that are created are also - * added to this list, so the caller can free them - * later - * \param[in] key_list list of keys to sign with. - * \param[in] func Callback function to decide what keys to - * use and what to do with old signatures - * \param[in] arg Optional argument for the callback function - * \param[in] flags option flags for signing process. 0 makes DNSKEY - * RRset signed with the minimal key set, that is only SEP keys are used - * for signing. If there are no SEP keys available, non-SEP keys will - * be used. LDNS_SIGN_DNSKEY_WITH_ZSK makes DNSKEY type signed with all - * keys. 0 is the default. - * \return LDNS_STATUS_OK on success, error otherwise - */ -ldns_status ldns_dnssec_zone_create_rrsigs_flg(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void*), - void *arg, - int flags); - -/** - * Adds signatures to the zone - * - * \param[in] zone the zone to add RRSIG Resource Records to - * \param[in] new_rrs the RRSIG RRs that are created are also - * added to this list, so the caller can free them - * later - * \param[in] key_list list of keys to sign with. - * \param[in] func Callback function to decide what keys to - * use and what to do with old signatures - * \param[in] arg Optional argument for the callback function - * \return LDNS_STATUS_OK on success, error otherwise - */ -ldns_status ldns_dnssec_zone_create_rrsigs(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void*), - void *arg); - -/** - * signs the given zone with the given keys - * - * \param[in] zone the zone to sign - * \param[in] key_list the list of keys to sign the zone with - * \param[in] new_rrs newly created resource records are added to this list, to free them later - * \param[in] func callback function that decides what to do with old signatures - * This function takes an ldns_rr* and an optional void *arg argument, and returns one of four values: - * LDNS_SIGNATURE_LEAVE_ADD_NEW: - * leave the signature and add a new one for the corresponding key - * LDNS_SIGNATURE_REMOVE_ADD_NEW: - * remove the signature and replace is with a new one from the same key - * LDNS_SIGNATURE_LEAVE_NO_ADD: - * leave the signature and do not add a new one with the corresponding key - * LDNS_SIGNATURE_REMOVE_NO_ADD: - * remove the signature and do not replace - * - * \param[in] arg optional argument for the callback function - * \param[in] flags option flags for signing process. 0 makes DNSKEY - * RRset signed with the minimal key set, that is only SEP keys are used - * for signing. If there are no SEP keys available, non-SEP keys will - * be used. LDNS_SIGN_DNSKEY_WITH_ZSK makes DNSKEY type signed with all - * keys. 0 is the default. - * \return LDNS_STATUS_OK on success, an error code otherwise - */ -ldns_status ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg, - int flags); - -/** - * signs the given zone with the given new zone, with NSEC3 - * - * \param[in] zone the zone to sign - * \param[in] key_list the list of keys to sign the zone with - * \param[in] new_rrs newly created resource records are added to this list, to free them later - * \param[in] func callback function that decides what to do with old signatures - * \param[in] arg optional argument for the callback function - * \param[in] algorithm the NSEC3 hashing algorithm to use - * \param[in] flags NSEC3 flags - * \param[in] iterations the number of NSEC3 hash iterations to use - * \param[in] salt_length the length (in octets) of the NSEC3 salt - * \param[in] salt the NSEC3 salt data - * \param[in] signflags option flags for signing process. 0 is the default. - * \return LDNS_STATUS_OK on success, an error code otherwise - */ -ldns_status ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt, - int signflags); - -/** - * signs the given zone with the given keys - * - * \param[in] zone the zone to sign - * \param[in] key_list the list of keys to sign the zone with - * \param[in] new_rrs newly created resource records are added to this list, to free them later - * \param[in] func callback function that decides what to do with old signatures - * This function takes an ldns_rr* and an optional void *arg argument, and returns one of four values: - * LDNS_SIGNATURE_LEAVE_ADD_NEW: - * leave the signature and add a new one for the corresponding key - * LDNS_SIGNATURE_REMOVE_ADD_NEW: - * remove the signature and replace is with a new one from the same key - * LDNS_SIGNATURE_LEAVE_NO_ADD: - * leave the signature and do not add a new one with the corresponding key - * LDNS_SIGNATURE_REMOVE_NO_ADD: - * remove the signature and do not replace - * - * \param[in] arg optional argument for the callback function - * \return LDNS_STATUS_OK on success, an error code otherwise - */ -ldns_status ldns_dnssec_zone_sign(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg); - -/** - * signs the given zone with the given new zone, with NSEC3 - * - * \param[in] zone the zone to sign - * \param[in] key_list the list of keys to sign the zone with - * \param[in] new_rrs newly created resource records are added to this list, to free them later - * \param[in] func callback function that decides what to do with old signatures - * \param[in] arg optional argument for the callback function - * \param[in] algorithm the NSEC3 hashing algorithm to use - * \param[in] flags NSEC3 flags - * \param[in] iterations the number of NSEC3 hash iterations to use - * \param[in] salt_length the length (in octets) of the NSEC3 salt - * \param[in] salt the NSEC3 salt data - * \return LDNS_STATUS_OK on success, an error code otherwise - */ -ldns_status ldns_dnssec_zone_sign_nsec3(ldns_dnssec_zone *zone, - ldns_rr_list *new_rrs, - ldns_key_list *key_list, - int (*func)(ldns_rr *, void *), - void *arg, - uint8_t algorithm, - uint8_t flags, - uint16_t iterations, - uint8_t salt_length, - uint8_t *salt); - -/** - * Signs the zone, and returns a newly allocated signed zone - * \param[in] zone the zone to sign - * \param[in] key_list list of keys to sign with - * \return signed zone - */ -ldns_zone *ldns_zone_sign(const ldns_zone *zone, ldns_key_list *key_list); - -/** - * Signs the zone with NSEC3, and returns a newly allocated signed zone - * \param[in] zone the zone to sign - * \param[in] key_list list of keys to sign with - * \param[in] algorithm the NSEC3 hashing algorithm to use - * \param[in] flags NSEC3 flags - * \param[in] iterations the number of NSEC3 hash iterations to use - * \param[in] salt_length the length (in octets) of the NSEC3 salt - * \param[in] salt the NSEC3 salt data - * \return signed zone - */ -ldns_zone *ldns_zone_sign_nsec3(ldns_zone *zone, ldns_key_list *key_list, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libs/ldns/ldns/dnssec_verify.h b/libs/ldns/ldns/dnssec_verify.h deleted file mode 100644 index 8d380f9cee..0000000000 --- a/libs/ldns/ldns/dnssec_verify.h +++ /dev/null @@ -1,612 +0,0 @@ -/** dnssec_verify */ - -#ifndef LDNS_DNSSEC_VERIFY_H -#define LDNS_DNSSEC_VERIFY_H - -#define LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS 10 - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Chain structure that contains all DNSSEC data needed to - * verify an rrset - */ -typedef struct ldns_dnssec_data_chain_struct ldns_dnssec_data_chain; -struct ldns_dnssec_data_chain_struct -{ - ldns_rr_list *rrset; - ldns_rr_list *signatures; - ldns_rr_type parent_type; - ldns_dnssec_data_chain *parent; - ldns_pkt_rcode packet_rcode; - ldns_rr_type packet_qtype; - bool packet_nodata; -}; - -/** - * Creates a new dnssec_chain structure - * \return ldns_dnssec_data_chain * - */ -ldns_dnssec_data_chain *ldns_dnssec_data_chain_new(); - -/** - * Frees a dnssec_data_chain structure - * - * \param[in] *chain The chain to free - */ -void ldns_dnssec_data_chain_free(ldns_dnssec_data_chain *chain); - -/** - * Frees a dnssec_data_chain structure, and all data - * contained therein - * - * \param[in] *chain The dnssec_data_chain to free - */ -void ldns_dnssec_data_chain_deep_free(ldns_dnssec_data_chain *chain); - -/** - * Prints the dnssec_data_chain to the given file stream - * - * \param[in] *out The file stream to print to - * \param[in] *chain The dnssec_data_chain to print - */ -void ldns_dnssec_data_chain_print(FILE *out, const ldns_dnssec_data_chain *chain); - -/** - * Build an ldns_dnssec_data_chain, which contains all - * DNSSEC data that is needed to derive the trust tree later - * - * The data_set will be cloned - * - * \param[in] *res resolver structure for further needed queries - * \param[in] qflags resolution flags - * \param[in] *data_set The original rrset where the chain ends - * \param[in] *pkt optional, can contain the original packet - * (and hence the sigs and maybe the key) - * \param[in] *orig_rr The original Resource Record - * - * \return the DNSSEC data chain - */ -ldns_dnssec_data_chain *ldns_dnssec_build_data_chain(ldns_resolver *res, - const uint16_t qflags, - const ldns_rr_list *data_set, - const ldns_pkt *pkt, - ldns_rr *orig_rr); - -/** - * Tree structure that contains the relation of DNSSEC data, - * and their cryptographic status. - * - * This tree is derived from a data_chain, and can be used - * to look whether there is a connection between an RRSET - * and a trusted key. The tree only contains pointers to the - * data_chain, and therefore one should *never* free() the - * data_chain when there is still a trust tree derived from - * that chain. - * - * Example tree: - * key key key - * \ | / - * \ | / - * \ | / - * ds - * | - * key - * | - * key - * | - * rr - * - * For each signature there is a parent; if the parent - * pointer is null, it couldn't be found and there was no - * denial; otherwise is a tree which contains either a - * DNSKEY, a DS, or a NSEC rr - */ -typedef struct ldns_dnssec_trust_tree_struct ldns_dnssec_trust_tree; -struct ldns_dnssec_trust_tree_struct -{ - ldns_rr *rr; - /* the complete rrset this rr was in */ - ldns_rr_list *rrset; - ldns_dnssec_trust_tree *parents[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; - ldns_status parent_status[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; - /** for debugging, add signatures too (you might want - those if they contain errors) */ - ldns_rr *parent_signature[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; - size_t parent_count; -}; - -/** - * Creates a new (empty) dnssec_trust_tree structure - * - * \return ldns_dnssec_trust_tree * - */ -ldns_dnssec_trust_tree *ldns_dnssec_trust_tree_new(); - -/** - * Frees the dnssec_trust_tree recursively - * - * There is no deep free; all data in the trust tree - * consists of pointers to a data_chain - * - * \param[in] tree The tree to free - */ -void ldns_dnssec_trust_tree_free(ldns_dnssec_trust_tree *tree); - -/** - * returns the depth of the trust tree - * - * \param[in] tree tree to calculate the depth of - * \return The depth of the tree - */ -size_t ldns_dnssec_trust_tree_depth(ldns_dnssec_trust_tree *tree); - -/** - * Prints the dnssec_trust_tree structure to the given file - * stream. - * - * If a link status is not LDNS_STATUS_OK; the status and - * relevant signatures are printed too - * - * \param[in] *out The file stream to print to - * \param[in] tree The trust tree to print - * \param[in] tabs Prepend each line with tabs*2 spaces - * \param[in] extended If true, add little explanation lines to the output - */ -void ldns_dnssec_trust_tree_print(FILE *out, - ldns_dnssec_trust_tree *tree, - size_t tabs, - bool extended); - -/** - * Adds a trust tree as a parent for the given trust tree - * - * \param[in] *tree The tree to add the parent to - * \param[in] *parent The parent tree to add - * \param[in] *parent_signature The RRSIG relevant to this parent/child - * connection - * \param[in] parent_status The DNSSEC status for this parent, child and RRSIG - * \return LDNS_STATUS_OK if the addition succeeds, error otherwise - */ -ldns_status ldns_dnssec_trust_tree_add_parent(ldns_dnssec_trust_tree *tree, - const ldns_dnssec_trust_tree *parent, - const ldns_rr *parent_signature, - const ldns_status parent_status); - -/** - * Generates a dnssec_trust_ttree for the given rr from the - * given data_chain - * - * This does not clone the actual data; Don't free the - * data_chain before you are done with this tree - * - * \param[in] *data_chain The chain to derive the trust tree from - * \param[in] *rr The RR this tree will be about - * \return ldns_dnssec_trust_tree * - */ -ldns_dnssec_trust_tree *ldns_dnssec_derive_trust_tree( - ldns_dnssec_data_chain *data_chain, - ldns_rr *rr); - -/** - * Sub function for derive_trust_tree that is used for a - * 'normal' rrset - * - * \param[in] new_tree The trust tree that we are building - * \param[in] data_chain The data chain containing the data for the trust tree - * \param[in] cur_sig_rr The currently relevant signature - */ -void ldns_dnssec_derive_trust_tree_normal_rrset( - ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain, - ldns_rr *cur_sig_rr); - -/** - * Sub function for derive_trust_tree that is used for DNSKEY rrsets - * - * \param[in] new_tree The trust tree that we are building - * \param[in] data_chain The data chain containing the data for the trust tree - * \param[in] cur_rr The currently relevant DNSKEY RR - * \param[in] cur_sig_rr The currently relevant signature - */ -void ldns_dnssec_derive_trust_tree_dnskey_rrset( - ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain, - ldns_rr *cur_rr, - ldns_rr *cur_sig_rr); - -/** - * Sub function for derive_trust_tree that is used for DS rrsets - * - * \param[in] new_tree The trust tree that we are building - * \param[in] data_chain The data chain containing the data for the trust tree - * \param[in] cur_rr The currently relevant DS RR - */ -void ldns_dnssec_derive_trust_tree_ds_rrset( - ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain, - ldns_rr *cur_rr); - -/** - * Sub function for derive_trust_tree that is used when there are no - * signatures - * - * \param[in] new_tree The trust tree that we are building - * \param[in] data_chain The data chain containing the data for the trust tree - */ -void ldns_dnssec_derive_trust_tree_no_sig( - ldns_dnssec_trust_tree *new_tree, - ldns_dnssec_data_chain *data_chain); - -/** - * Returns OK if there is a trusted path in the tree to one of - * the DNSKEY or DS RRs in the given list - * - * \param *tree The trust tree so search - * \param *keys A ldns_rr_list of DNSKEY and DS rrs to look for - * \return LDNS_STATUS_OK if there is a trusted path to one of - * the keys, or the *first* error encountered - * if there were no paths - */ -ldns_status ldns_dnssec_trust_tree_contains_keys( - ldns_dnssec_trust_tree *tree, - ldns_rr_list *keys); - -/** - * Verifies a list of signatures for one rrset. - * - * \param[in] rrset the rrset to verify - * \param[in] rrsig a list of signatures to check - * \param[in] keys a list of keys to check with - * \param[out] good_keys if this is a (initialized) list, the pointer to keys - * from keys that validate one of the signatures - * are added to it - * \return status LDNS_STATUS_OK if there is at least one correct key - */ -ldns_status ldns_verify(ldns_rr_list *rrset, - ldns_rr_list *rrsig, - const ldns_rr_list *keys, - ldns_rr_list *good_keys); - -/** - * Verifies a list of signatures for one rrset, but disregard the time. - * Inception and Expiration are not checked. - * - * \param[in] rrset the rrset to verify - * \param[in] rrsig a list of signatures to check - * \param[in] keys a list of keys to check with - * \param[out] good_keys if this is a (initialized) list, the pointer to keys - * from keys that validate one of the signatures - * are added to it - * \return status LDNS_STATUS_OK if there is at least one correct key - */ -ldns_status ldns_verify_notime(ldns_rr_list *rrset, - ldns_rr_list *rrsig, - const ldns_rr_list *keys, - ldns_rr_list *good_keys); - -/** - * Tries to build an authentication chain from the given - * keys down to the queried domain. - * - * If we find a valid trust path, return the valid keys for the domain. - * - * \param[in] res the current resolver - * \param[in] domain the domain we want valid keys for - * \param[in] keys the current set of trusted keys - * \param[out] status pointer to the status variable where the result - * code will be stored - * \return the set of trusted keys for the domain, or NULL if no - * trust path could be built. - */ -ldns_rr_list *ldns_fetch_valid_domain_keys(const ldns_resolver * res, - const ldns_rdf * domain, - const ldns_rr_list * keys, - ldns_status *status); - -/** - * Validates the DNSKEY RRset for the given domain using the provided - * trusted keys. - * - * \param[in] res the current resolver - * \param[in] domain the domain we want valid keys for - * \param[in] keys the current set of trusted keys - * \return the set of trusted keys for the domain, or NULL if the RRSET - * could not be validated - */ -ldns_rr_list *ldns_validate_domain_dnskey (const ldns_resolver *res, - const ldns_rdf *domain, - const ldns_rr_list *keys); - -/** - * Validates the DS RRset for the given domain using the provided trusted keys. - * - * \param[in] res the current resolver - * \param[in] domain the domain we want valid keys for - * \param[in] keys the current set of trusted keys - * \return the set of trusted keys for the domain, or NULL if the RRSET could not be validated - */ -ldns_rr_list *ldns_validate_domain_ds(const ldns_resolver *res, - const ldns_rdf * - domain, - const ldns_rr_list * keys); - -/** - * Verifies a list of signatures for one RRset using a valid trust path. - * - * \param[in] res the current resolver - * \param[in] rrset the rrset to verify - * \param[in] rrsigs a list of signatures to check - * \param[out] validating_keys if this is a (initialized) list, the - * keys from keys that validate one of - * the signatures are added to it - * \return status LDNS_STATUS_OK if there is at least one correct key - */ -ldns_status ldns_verify_trusted(ldns_resolver *res, - ldns_rr_list *rrset, - ldns_rr_list *rrsigs, - ldns_rr_list *validating_keys); - -/** - * denial is not just a river in egypt - * - * \param[in] rr The (query) RR to check the denial of existence for - * \param[in] nsecs The list of NSEC RRs that are supposed to deny the - * existence of the RR - * \param[in] rrsigs The RRSIG RR covering the NSEC RRs - * \return LDNS_STATUS_OK if the NSEC RRs deny the existence, error code - * containing the reason they do not otherwise - */ -ldns_status ldns_dnssec_verify_denial(ldns_rr *rr, - ldns_rr_list *nsecs, - ldns_rr_list *rrsigs); - -/** - * Denial of existence using NSEC3 records - * Since NSEC3 is a bit more complicated than normal denial, some - * context arguments are needed - * - * \param[in] rr The (query) RR to check the denial of existence for - * \param[in] nsecs The list of NSEC3 RRs that are supposed to deny the - * existence of the RR - * \param[in] rrsigs The RRSIG rr covering the NSEC RRs - * \param[in] packet_rcode The RCODE value of the packet that provided the - * NSEC3 RRs - * \param[in] packet_qtype The original query RR type - * \param[in] packet_nodata True if the providing packet had an empty ANSWER - * section - * \return LDNS_STATUS_OK if the NSEC3 RRs deny the existence, error code - * containing the reason they do not otherwise - */ -ldns_status ldns_dnssec_verify_denial_nsec3(ldns_rr *rr, - ldns_rr_list *nsecs, - ldns_rr_list *rrsigs, - ldns_pkt_rcode packet_rcode, - ldns_rr_type packet_qtype, - bool packet_nodata); - -/** - * Verifies the already processed data in the buffers - * This function should probably not be used directly. - * - * \param[in] rawsig_buf Buffer containing signature data to use - * \param[in] verify_buf Buffer containing data to verify - * \param[in] key_buf Buffer containing key data to use - * \param[in] algo Signing algorithm - * \return status LDNS_STATUS_OK if the data verifies. Error if not. - */ -ldns_status ldns_verify_rrsig_buffers(ldns_buffer *rawsig_buf, - ldns_buffer *verify_buf, - ldns_buffer *key_buf, - uint8_t algo); - -/** - * Like ldns_verify_rrsig_buffers, but uses raw data. - * - * \param[in] sig signature data to use - * \param[in] siglen length of signature data to use - * \param[in] verify_buf Buffer containing data to verify - * \param[in] key key data to use - * \param[in] keylen length of key data to use - * \param[in] algo Signing algorithm - * \return status LDNS_STATUS_OK if the data verifies. Error if not. - */ -ldns_status ldns_verify_rrsig_buffers_raw(unsigned char* sig, - size_t siglen, - ldns_buffer *verify_buf, - unsigned char* key, - size_t keylen, - uint8_t algo); - -/** - * Verifies an rrsig. All keys in the keyset are tried. - * \param[in] rrset the rrset to check - * \param[in] rrsig the signature of the rrset - * \param[in] keys the keys to try - * \param[out] good_keys if this is a (initialized) list, the pointer to keys - * from keys that validate one of the signatures - * are added to it - * \return a list of keys which validate the rrsig + rrset. Returns - * status LDNS_STATUS_OK if at least one key matched. Else an error. - */ -ldns_status ldns_verify_rrsig_keylist(ldns_rr_list *rrset, - ldns_rr *rrsig, - const ldns_rr_list *keys, - ldns_rr_list *good_keys); - -/** - * Verifies an rrsig. All keys in the keyset are tried. Time is not checked. - * \param[in] rrset the rrset to check - * \param[in] rrsig the signature of the rrset - * \param[in] keys the keys to try - * \param[out] good_keys if this is a (initialized) list, the pointer to keys - * from keys that validate one of the signatures - * are added to it - * \return a list of keys which validate the rrsig + rrset. Returns - * status LDNS_STATUS_OK if at least one key matched. Else an error. - */ -ldns_status ldns_verify_rrsig_keylist_notime(ldns_rr_list *rrset, - ldns_rr *rrsig, - const ldns_rr_list *keys, - ldns_rr_list *good_keys); - -/** - * verify an rrsig with 1 key - * \param[in] rrset the rrset - * \param[in] rrsig the rrsig to verify - * \param[in] key the key to use - * \return status message wether verification succeeded. - */ -ldns_status ldns_verify_rrsig(ldns_rr_list *rrset, - ldns_rr *rrsig, - ldns_rr *key); - -/** - * verifies a buffer with signature data for a buffer with rrset data - * with an EVP_PKEY - * - * \param[in] sig the signature data - * \param[in] rrset the rrset data, sorted and processed for verification - * \param[in] key the EVP key structure - * \param[in] digest_type The digest type of the signature - */ -#ifdef HAVE_SSL -ldns_status ldns_verify_rrsig_evp(ldns_buffer *sig, - ldns_buffer *rrset, - EVP_PKEY *key, - const EVP_MD *digest_type); -#endif - -/** - * Like ldns_verify_rrsig_evp, but uses raw signature data. - * \param[in] sig the signature data, wireformat uncompressed - * \param[in] siglen length of the signature data - * \param[in] rrset the rrset data, sorted and processed for verification - * \param[in] key the EVP key structure - * \param[in] digest_type The digest type of the signature - */ -#ifdef HAVE_SSL -ldns_status ldns_verify_rrsig_evp_raw(unsigned char *sig, - size_t siglen, - ldns_buffer *rrset, - EVP_PKEY *key, - const EVP_MD *digest_type); -#endif - -/** - * verifies a buffer with signature data (DSA) for a buffer with rrset data - * with a buffer with key data. - * - * \param[in] sig the signature data - * \param[in] rrset the rrset data, sorted and processed for verification - * \param[in] key the key data - */ -ldns_status ldns_verify_rrsig_dsa(ldns_buffer *sig, - ldns_buffer *rrset, - ldns_buffer *key); - -/** - * verifies a buffer with signature data (RSASHA1) for a buffer with rrset data - * with a buffer with key data. - * - * \param[in] sig the signature data - * \param[in] rrset the rrset data, sorted and processed for verification - * \param[in] key the key data - */ -ldns_status ldns_verify_rrsig_rsasha1(ldns_buffer *sig, - ldns_buffer *rrset, - ldns_buffer *key); - -/** - * verifies a buffer with signature data (RSAMD5) for a buffer with rrset data - * with a buffer with key data. - * - * \param[in] sig the signature data - * \param[in] rrset the rrset data, sorted and processed for verification - * \param[in] key the key data - */ -ldns_status ldns_verify_rrsig_rsamd5(ldns_buffer *sig, - ldns_buffer *rrset, - ldns_buffer *key); - -/** - * Like ldns_verify_rrsig_dsa, but uses raw signature and key data. - * \param[in] sig raw uncompressed wireformat signature data - * \param[in] siglen length of signature data - * \param[in] rrset ldns buffer with prepared rrset data. - * \param[in] key raw uncompressed wireformat key data - * \param[in] keylen length of key data - */ -ldns_status ldns_verify_rrsig_dsa_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen); - -/** - * Like ldns_verify_rrsig_rsasha1, but uses raw signature and key data. - * \param[in] sig raw uncompressed wireformat signature data - * \param[in] siglen length of signature data - * \param[in] rrset ldns buffer with prepared rrset data. - * \param[in] key raw uncompressed wireformat key data - * \param[in] keylen length of key data - */ -ldns_status ldns_verify_rrsig_rsasha1_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen); - -/** - * Like ldns_verify_rrsig_rsasha256, but uses raw signature and key data. - * \param[in] sig raw uncompressed wireformat signature data - * \param[in] siglen length of signature data - * \param[in] rrset ldns buffer with prepared rrset data. - * \param[in] key raw uncompressed wireformat key data - * \param[in] keylen length of key data - */ - -ldns_status ldns_verify_rrsig_rsasha256_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen); - -/** - * Like ldns_verify_rrsig_rsasha512, but uses raw signature and key data. - * \param[in] sig raw uncompressed wireformat signature data - * \param[in] siglen length of signature data - * \param[in] rrset ldns buffer with prepared rrset data. - * \param[in] key raw uncompressed wireformat key data - * \param[in] keylen length of key data - */ -ldns_status ldns_verify_rrsig_rsasha512_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen); - -/** - * Like ldns_verify_rrsig_rsamd5, but uses raw signature and key data. - * \param[in] sig raw uncompressed wireformat signature data - * \param[in] siglen length of signature data - * \param[in] rrset ldns buffer with prepared rrset data. - * \param[in] key raw uncompressed wireformat key data - * \param[in] keylen length of key data - */ -ldns_status ldns_verify_rrsig_rsamd5_raw(unsigned char* sig, - size_t siglen, - ldns_buffer* rrset, - unsigned char* key, - size_t keylen); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/libs/ldns/ldns/dnssec_zone.h b/libs/ldns/ldns/dnssec_zone.h deleted file mode 100644 index 88117dafb3..0000000000 --- a/libs/ldns/ldns/dnssec_zone.h +++ /dev/null @@ -1,366 +0,0 @@ -/* - * special zone file structures and functions for better dnssec handling - * - * A zone contains a SOA dnssec_zone_rrset, and an AVL tree of 'normal' - * dnssec_zone_rrsets, indexed by name and type - */ - -#ifndef LDNS_DNSSEC_ZONE_H -#define LDNS_DNSSEC_ZONE_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Singly linked list of rrs - */ -typedef struct ldns_struct_dnssec_rrs ldns_dnssec_rrs; -struct ldns_struct_dnssec_rrs -{ - ldns_rr *rr; - ldns_dnssec_rrs *next; -}; - -/** - * Singly linked list of RRsets - */ -typedef struct ldns_struct_dnssec_rrsets ldns_dnssec_rrsets; -struct ldns_struct_dnssec_rrsets -{ - ldns_dnssec_rrs *rrs; - ldns_rr_type type; - ldns_dnssec_rrs *signatures; - ldns_dnssec_rrsets *next; -}; - -/** - * Structure containing all resource records for a domain name - * Including the derived NSEC3, if present - */ -typedef struct ldns_struct_dnssec_name ldns_dnssec_name; -struct ldns_struct_dnssec_name -{ - /** - * pointer to a dname containing the name. - * Usually points to the owner name of the first RR of the first RRset - */ - ldns_rdf *name; - /** - * Usually, the name is a pointer to the owner name of the first rr for - * this name, but sometimes there is no actual data to point to, - * for instance in - * names representing empty nonterminals. If so, set alloced to true to - * indicate that this data must also be freed when the name is freed - */ - bool name_alloced; - /** - * The rrsets for this name - */ - ldns_dnssec_rrsets *rrsets; - /** - * NSEC pointing to the next name (or NSEC3 pointing to the next NSEC3) - */ - ldns_rr *nsec; - /** - * signatures for the NSEC record - */ - ldns_dnssec_rrs *nsec_signatures; - /** - * Set to true if this name is glue - * (as marked by ldns_dnssec_zone_mark_glue()) - */ - bool is_glue; - /** - * pointer to store the hashed name (only used when in an NSEC3 zone - */ - ldns_rdf *hashed_name; -}; - -/** - * Structure containing a dnssec zone - */ -struct ldns_struct_dnssec_zone { - /** points to the name containing the SOA RR */ - ldns_dnssec_name *soa; - /** tree of ldns_dnssec_names */ - ldns_rbtree_t *names; -}; -typedef struct ldns_struct_dnssec_zone ldns_dnssec_zone; - -/** - * Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs - * \return the allocated data - */ -ldns_dnssec_rrs *ldns_dnssec_rrs_new(); - -/** - * Frees the list of rrs, but *not* the individual ldns_rr records - * contained in the list - * - * \param[in] rrs the data structure to free - */ -void ldns_dnssec_rrs_free(ldns_dnssec_rrs *rrs); - -/** - * Frees the list of rrs, and the individual ldns_rr records - * contained in the list - * - * \param[in] rrs the data structure to free - */ -void ldns_dnssec_rrs_deep_free(ldns_dnssec_rrs *rrs); - -/** - * Adds an RR to the list of RRs. The list will remain ordered - * - * \param[in] rrs the list to add to - * \param[in] rr the RR to add - * \return LDNS_STATUS_OK on success - */ -ldns_status ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr); - -/** - * Prints the given rrs to the file descriptor - * - * \param[in] out the file descriptor to print to - * \param[in] rrs the list of RRs to print - */ -void ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs); - -/** - * Creates a new list (entry) of RRsets - * \return the newly allocated structure - */ -ldns_dnssec_rrsets *ldns_dnssec_rrsets_new(); - -/** - * Frees the list of rrsets and their rrs, but *not* the ldns_rr - * records in the sets - * - * \param[in] rrsets the data structure to free - */ -void ldns_dnssec_rrsets_free(ldns_dnssec_rrsets *rrsets); - -/** - * Frees the list of rrsets and their rrs, and the ldns_rr - * records in the sets - * - * \param[in] rrsets the data structure to free - */ -void ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets); - -/** - * Returns the rr type of the rrset (that is head of the given list) - * - * \param[in] rrsets the rrset to get the type of - * \return the rr type - */ -ldns_rr_type ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets); - -/** - * Sets the RR type of the rrset (that is head of the given list) - * - * \param[in] rrsets the rrset to set the type of - * \param[in] type the type to set - * \return LDNS_STATUS_OK on success - */ -ldns_status ldns_dnssec_rrsets_set_type(ldns_dnssec_rrsets *rrsets, - ldns_rr_type type); - -/** - * Add an ldns_rr to the corresponding RRset in the given list of RRsets. - * If it is not present, add it as a new RRset with 1 record. - * - * \param[in] rrsets the list of rrsets to add the RR to - * \param[in] rr the rr to add to the list of rrsets - * \return LDNS_STATUS_OK on success - */ -ldns_status ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr); - -/** - * Print the given list of rrsets to the fiven file descriptor - * - * \param[in] out the file descriptor to print to - * \param[in] rrsets the list of RRsets to print - * \param[in] follow if set to false, only print the first RRset - */ -void ldns_dnssec_rrsets_print(FILE *out, - ldns_dnssec_rrsets *rrsets, - bool follow); - -/** - * Create a new data structure for a dnssec name - * \return the allocated structure - */ -ldns_dnssec_name *ldns_dnssec_name_new(); - -/** - * Create a new data structure for a dnssec name for the given RR - * - * \param[in] rr the RR to derive properties from, and to add to the name - */ -ldns_dnssec_name *ldns_dnssec_name_new_frm_rr(ldns_rr *rr); - -/** - * Frees the name structure and its rrs and rrsets. - * Individual ldns_rr records therein are not freed - * - * \param[in] name the structure to free - */ -void ldns_dnssec_name_free(ldns_dnssec_name *name); - -/** - * Frees the name structure and its rrs and rrsets. - * Individual ldns_rr records contained in the name are also freed - * - * \param[in] name the structure to free - */ -void ldns_dnssec_name_deep_free(ldns_dnssec_name *name); - -/** - * Returns the domain name of the given dnssec_name structure - * - * \param[in] name the dnssec name to get the domain name from - * \return the domain name - */ -ldns_rdf *ldns_dnssec_name_name(ldns_dnssec_name *name); - - -/** - * Sets the domain name of the given dnssec_name structure - * - * \param[in] name the dnssec name to set the domain name of - * \param[in] dname the domain name to set it to. This data is *not* copied. - */ -void ldns_dnssec_name_set_name(ldns_dnssec_name *name, - ldns_rdf *dname); - -/** - * Sets the NSEC(3) RR of the given dnssec_name structure - * - * \param[in] name the dnssec name to set the domain name of - * \param[in] nsec the nsec rr to set it to. This data is *not* copied. - */ -void ldns_dnssec_name_set_nsec(ldns_dnssec_name *name, ldns_rr *nsec); - -/** - * Compares the domain names of the two arguments in their - * canonical ordening. - * - * \param[in] a The first dnssec_name to compare - * \param[in] b The second dnssec_name to compare - * \return -1 if the domain name of a comes before that of b in canonical - * ordening, 1 if it is the other way around, and 0 if they are - * equal - */ -int ldns_dnssec_name_cmp(const void *a, const void *b); - -/** - * Inserts the given rr at the right place in the current dnssec_name - * No checking is done whether the name matches - * - * \param[in] name The ldns_dnssec_name to add the RR to - * \param[in] rr The RR to add - * \return LDNS_STATUS_OK on success, error code otherwise - */ -ldns_status ldns_dnssec_name_add_rr(ldns_dnssec_name *name, - ldns_rr *rr); - -/** - * Find the RRset with the given type in within this name structure - * - * \param[in] name the name to find the RRset in - * \param[in] type the type of the RRset to find - * \return the RRset, or NULL if not present - */ -ldns_dnssec_rrsets *ldns_dnssec_name_find_rrset(ldns_dnssec_name *name, - ldns_rr_type type); - -/** - * Find the RRset with the given name and type in the zone - * - * \param[in] zone the zone structure to find the RRset in - * \param[in] dname the domain name of the RRset to find - * \param[in] type the type of the RRset to find - * \return the RRset, or NULL if not present - */ -ldns_dnssec_rrsets *ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone, - ldns_rdf *dname, - ldns_rr_type type); - -/** - * Prints the RRs in the dnssec name structure to the given - * file descriptor - * - * \param[in] out the file descriptor to print to - * \param[in] name the name structure to print the contents of - */ -void ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name); - -/** - * Creates a new dnssec_zone structure - * \return the allocated structure - */ -ldns_dnssec_zone *ldns_dnssec_zone_new(); - -/** - * Frees the given zone structure, and its rbtree of dnssec_names - * Individual ldns_rr RRs within those names are *not* freed - * \param[in] *zone the zone to free - */ -void ldns_dnssec_zone_free(ldns_dnssec_zone *zone); - -/** - * Frees the given zone structure, and its rbtree of dnssec_names - * Individual ldns_rr RRs within those names are also freed - * \param[in] *zone the zone to free - */ -void ldns_dnssec_zone_deep_free(ldns_dnssec_zone *zone); - -/** - * Adds the given RR to the zone. - * It find whether there is a dnssec_name with that name present. - * If so, add it to that, if not create a new one. - * Special handling of NSEC and RRSIG provided - * - * \param[in] zone the zone to add the RR to - * \param[in] rr The RR to add - * \return LDNS_STATUS_OK on success, an error code otherwise - */ -ldns_status ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, - ldns_rr *rr); - -/** - * Prints the rbtree of ldns_dnssec_name structures to the file descriptor - * - * \param[in] out the file descriptor to print the names to - * \param[in] tree the tree of ldns_dnssec_name structures to print - * \param[in] print_soa if true, print SOA records, if false, skip them - */ -void ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa); - -/** - * Prints the complete zone to the given file descriptor - * - * \param[in] out the file descriptor to print to - * \param[in] zone the dnssec_zone to print - */ -void ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone); - -/** - * Adds explicit dnssec_name structures for the empty nonterminals - * in this zone. (this is needed for NSEC3 generation) - * - * \param[in] zone the zone to check for empty nonterminals - * return LDNS_STATUS_OK on success. - */ -ldns_status ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libs/ldns/ldns/error.h b/libs/ldns/ldns/error.h deleted file mode 100644 index e17846f38b..0000000000 --- a/libs/ldns/ldns/error.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * \file error.h - * - * Defines error numbers and functions to translate those to a readable string. - * - */ - -/** - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -#ifndef LDNS_ERROR_H -#define LDNS_ERROR_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -enum ldns_enum_status { - LDNS_STATUS_OK, - LDNS_STATUS_EMPTY_LABEL, - LDNS_STATUS_LABEL_OVERFLOW, - LDNS_STATUS_DOMAINNAME_OVERFLOW, - LDNS_STATUS_DOMAINNAME_UNDERFLOW, - LDNS_STATUS_DDD_OVERFLOW, - LDNS_STATUS_PACKET_OVERFLOW, - LDNS_STATUS_INVALID_POINTER, - LDNS_STATUS_MEM_ERR, - LDNS_STATUS_INTERNAL_ERR, - LDNS_STATUS_SSL_ERR, - LDNS_STATUS_ERR, - LDNS_STATUS_INVALID_INT, - LDNS_STATUS_INVALID_IP4, - LDNS_STATUS_INVALID_IP6, - LDNS_STATUS_INVALID_STR, - LDNS_STATUS_INVALID_B32_EXT, - LDNS_STATUS_INVALID_B64, - LDNS_STATUS_INVALID_HEX, - LDNS_STATUS_INVALID_TIME, - LDNS_STATUS_NETWORK_ERR, - LDNS_STATUS_ADDRESS_ERR, - LDNS_STATUS_FILE_ERR, - LDNS_STATUS_UNKNOWN_INET, - LDNS_STATUS_NOT_IMPL, - LDNS_STATUS_NULL, - LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, - LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, - LDNS_STATUS_CRYPTO_NO_RRSIG, - LDNS_STATUS_CRYPTO_NO_DNSKEY, - LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, - LDNS_STATUS_CRYPTO_NO_DS, - LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, - LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, - LDNS_STATUS_CRYPTO_VALIDATED, - LDNS_STATUS_CRYPTO_BOGUS, - LDNS_STATUS_CRYPTO_SIG_EXPIRED, - LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, - LDNS_STATUS_CRYPTO_TSIG_BOGUS, - LDNS_STATUS_CRYPTO_TSIG_ERR, - LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, - LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, - LDNS_STATUS_ENGINE_KEY_NOT_LOADED, - LDNS_STATUS_NSEC3_ERR, - LDNS_STATUS_RES_NO_NS, - LDNS_STATUS_RES_QUERY, - LDNS_STATUS_WIRE_INCOMPLETE_HEADER, - LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, - LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, - LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, - LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, - LDNS_STATUS_NO_DATA, - LDNS_STATUS_CERT_BAD_ALGORITHM, - LDNS_STATUS_SYNTAX_TYPE_ERR, - LDNS_STATUS_SYNTAX_CLASS_ERR, - LDNS_STATUS_SYNTAX_TTL_ERR, - LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, - LDNS_STATUS_SYNTAX_RDATA_ERR, - LDNS_STATUS_SYNTAX_DNAME_ERR, - LDNS_STATUS_SYNTAX_VERSION_ERR, - LDNS_STATUS_SYNTAX_ALG_ERR, - LDNS_STATUS_SYNTAX_KEYWORD_ERR, - LDNS_STATUS_SYNTAX_TTL, - LDNS_STATUS_SYNTAX_ORIGIN, - LDNS_STATUS_SYNTAX_INCLUDE, - LDNS_STATUS_SYNTAX_EMPTY, - LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, - LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, - LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, - LDNS_STATUS_SYNTAX_BAD_ESCAPE, - LDNS_STATUS_SOCKET_ERROR, - LDNS_STATUS_SYNTAX_ERR, - LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, - LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, - LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, - LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND -}; -typedef enum ldns_enum_status ldns_status; - -extern ldns_lookup_table ldns_error_str[]; - -/** - * look up a descriptive text by each error. This function - * could use a better name - * \param[in] err ldns_status number - * \return the string for that error - */ -const char *ldns_get_errorstr_by_id(ldns_status err); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_ERROR_H */ diff --git a/libs/ldns/ldns/higher.h b/libs/ldns/ldns/higher.h deleted file mode 100644 index 597e1343a9..0000000000 --- a/libs/ldns/ldns/higher.h +++ /dev/null @@ -1,113 +0,0 @@ -/** - * \file higher.h - * - * Specifies some higher level functions that could - * be useful for certain applications - */ - -/* - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -#ifndef LDNS_HIGHER_H -#define LDNS_HIGHER_H - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Ask the resolver about name - * and return all address records - * \param[in] r the resolver to use - * \param[in] name the name to look for - * \param[in] c the class to use - * \param[in] flags give some optional flags to the query - */ -ldns_rr_list *ldns_get_rr_list_addr_by_name(ldns_resolver *r, ldns_rdf *name, ldns_rr_class c, uint16_t flags); - -/** - * ask the resolver about the address - * and return the name - * \param[in] r the resolver to use - * \param[in] addr the addr to look for - * \param[in] c the class to use - * \param[in] flags give some optional flags to the query - */ -ldns_rr_list *ldns_get_rr_list_name_by_addr(ldns_resolver *r, ldns_rdf *addr, ldns_rr_class c, uint16_t flags); - -/** - * wade through fp (a /etc/hosts like file) - * and return a rr_list containing all the - * defined hosts in there - * \param[in] fp the file pointer to use - * \return ldns_rr_list * with the names - */ -ldns_rr_list *ldns_get_rr_list_hosts_frm_fp(FILE *fp); - -/** - * wade through fp (a /etc/hosts like file) - * and return a rr_list containing all the - * defined hosts in there - * \param[in] fp the file pointer to use - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return ldns_rr_list * with the names - */ -ldns_rr_list *ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr); - -/** - * wade through fp (a /etc/hosts like file) - * and return a rr_list containing all the - * defined hosts in there - * \param[in] filename the filename to use (NULL for /etc/hosts) - * \return ldns_rr_list * with the names - */ -ldns_rr_list *ldns_get_rr_list_hosts_frm_file(char *filename); - -/** - * This function is a wrapper function for ldns_get_rr_list_name_by_addr - * and ldns_get_rr_list_addr_by_name. It's name is from the getaddrinfo() - * library call. It tries to mimic that call, but without the lowlevel - * stuff. - * \param[in] res The resolver. If this value is NULL then a resolver will - * be created by ldns_getaddrinfo. - * \param[in] node the name or ip address to look up - * \param[in] c the class to look in - * \param[out] list put the found RR's in this list - * \return the number of RR found. - */ -uint16_t ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, ldns_rr_list **list); - -/** - * Check if t is enumerated in the nsec type rdata - * \param[in] nsec the NSEC Record to look in - * \param[in] t the type to check for - * \return true when t is found, otherwise return false - */ -bool ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t); - -/** - * Print a number of rdf's of the RR. The rdfnum-list must - * be ended by -1, otherwise unpredictable things might happen. - * rdfs may be printed multiple times - * \param[in] fp FILE * to write to - * \param[in] r RR to write - * \param[in] rdfnum a list of rdf to print. - */ -void ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_HIGHER_H */ diff --git a/libs/ldns/ldns/host2str.h b/libs/ldns/ldns/host2str.h deleted file mode 100644 index 07180bbd28..0000000000 --- a/libs/ldns/ldns/host2str.h +++ /dev/null @@ -1,566 +0,0 @@ -/** - * host2str.h - txt presentation of RRs - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Contains functions to translate the main structures to their text - * representation, as well as functions to print them. - */ - -#ifndef LDNS_HOST2STR_H -#define LDNS_HOST2STR_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ldns/util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_APL_IP4 1 -#define LDNS_APL_IP6 2 -#define LDNS_APL_MASK 0x7f -#define LDNS_APL_NEGATION 0x80 - -/** - * Converts an ldns packet opcode value to its mnemonic, and adds that - * to the output buffer - * \param[in] *output the buffer to add the data to - * \param[in] opcode to find the string representation of - * \return LDNS_STATUS_OK on success, or a buffer failure mode on error - */ -ldns_status -ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode); - -/** - * Converts an ldns packet rcode value to its mnemonic, and adds that - * to the output buffer - * \param[in] *output the buffer to add the data to - * \param[in] rcode to find the string representation of - * \return LDNS_STATUS_OK on success, or a buffer failure mode on error - */ -ldns_status -ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode); - -/** - * Converts an ldns algorithm type to its mnemonic, and adds that - * to the output buffer - * \param[in] *output the buffer to add the data to - * \param[in] algorithm to find the string representation of - * \return LDNS_STATUS_OK on success, or a buffer failure mode on error - */ -ldns_status -ldns_algorithm2buffer_str(ldns_buffer *output, - ldns_algorithm algorithm); - -/** - * Converts an ldns certificate algorithm type to its mnemonic, - * and adds that to the output buffer - * \param[in] *output the buffer to add the data to - * \param[in] cert_algorithm to find the string representation of - * \return LDNS_STATUS_OK on success, or a buffer failure mode on error - */ -ldns_status -ldns_cert_algorithm2buffer_str(ldns_buffer *output, - ldns_cert_algorithm cert_algorithm); - - -/** - * Converts a packet opcode to its mnemonic and returns that as - * an allocated null-terminated string. - * Remember to free it. - * - * \param[in] opcode the opcode to convert to text - * \return null terminated char * data, or NULL on error - */ -char *ldns_pkt_opcode2str(ldns_pkt_opcode opcode); - -/** - * Converts a packet rcode to its mnemonic and returns that as - * an allocated null-terminated string. - * Remember to free it. - * - * \param[in] rcode the rcode to convert to text - * \return null terminated char * data, or NULL on error - */ -char *ldns_pkt_rcode2str(ldns_pkt_rcode rcode); - -/** - * Converts a signing algorithms to its mnemonic and returns that as - * an allocated null-terminated string. - * Remember to free it. - * - * \param[in] algorithm the algorithm to convert to text - * \return null terminated char * data, or NULL on error - */ -char *ldns_pkt_algorithm2str(ldns_algorithm algorithm); - -/** - * Converts a cert algorithm to its mnemonic and returns that as - * an allocated null-terminated string. - * Remember to free it. - * - * \param[in] cert_algorithm to convert to text - * \return null terminated char * data, or NULL on error - */ -char *ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm); - -/** - * Converts an LDNS_RDF_TYPE_A rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_AAAA rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_STR rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_B64 rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_b64(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_B32_EXT rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_HEX rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_TYPE rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_CLASS rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_class(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_ALG rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_alg(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an ldns_rr_type value to its string representation, - * and places it in the given buffer - * \param[in] *output The buffer to add the data to - * \param[in] type the ldns_rr_type to convert - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rr_type2buffer_str(ldns_buffer *output, - const ldns_rr_type type); - -/** - * Converts an ldns_rr_type value to its string representation, - * and returns that string. For unknown types, the string - * "TYPE" is returned. This function allocates data that must be - * freed by the caller - * \param[in] type the ldns_rr_type to convert - * \return a newly allocated string - */ -char *ldns_rr_type2str(const ldns_rr_type type); - -/** - * Converts an ldns_rr_class value to its string representation, - * and places it in the given buffer - * \param[in] *output The buffer to add the data to - * \param[in] klass the ldns_rr_class to convert - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rr_class2buffer_str(ldns_buffer *output, - const ldns_rr_class klass); - -/** - * Converts an ldns_rr_class value to its string representation, - * and returns that string. For unknown types, the string - * "CLASS" is returned. This function allocates data that must be - * freed by the caller - * \param[in] klass the ldns_rr_class to convert - * \return a newly allocated string - */ -char *ldns_rr_class2str(const ldns_rr_class klass); - - -/** - * Converts an LDNS_RDF_TYPE_CERT rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_LOC rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_UNKNOWN rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_unknown(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_NSAP rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_nsap(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_ATMA rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_atma(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_WKS rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_NSEC rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_PERIOD rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_TSIGTIME rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_tsigtime(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_APL rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_INT16_DATA rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_IPSECKEY rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_TSIG rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf); - - -/** - * Converts the data in the rdata field to presentation - * format (as char *) and appends it to the given buffer - * - * \param[in] output pointer to the buffer to append the data to - * \param[in] rdf the pointer to the rdafa field containing the data - * \return status - */ -ldns_status ldns_rdf2buffer_str(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts the data in the resource record to presentation - * format (as char *) and appends it to the given buffer - * - * \param[in] output pointer to the buffer to append the data to - * \param[in] rr the pointer to the rr field to convert - * \return status - */ -ldns_status ldns_rr2buffer_str(ldns_buffer *output, const ldns_rr *rr); - -/** - * Converts the data in the DNS packet to presentation - * format (as char *) and appends it to the given buffer - * - * \param[in] output pointer to the buffer to append the data to - * \param[in] pkt the pointer to the packet to convert - * \return status - */ -ldns_status ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt); - -/** - * Converts an LDNS_RDF_TYPE_NSEC3_SALT rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf); - - -/** - * Converts the data in the DNS packet to presentation - * format (as char *) and appends it to the given buffer - * - * \param[in] output pointer to the buffer to append the data to - * \param[in] k the pointer to the private key to convert - * \return status - */ -ldns_status ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k); - -/** - * Converts an LDNS_RDF_TYPE_INT8 rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_INT16 rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_int16(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_INT32 rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts an LDNS_RDF_TYPE_TIME rdata element to string format and adds it to the output buffer - * \param[in] *rdf The rdata to convert - * \param[in] *output The buffer to add the data to - * \return LDNS_STATUS_OK on success, and error status on failure - */ -ldns_status ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Converts the data in the rdata field to presentation format and - * returns that as a char *. - * Remember to free it. - * - * \param[in] rdf The rdata field to convert - * \return null terminated char * data, or NULL on error - */ -char *ldns_rdf2str(const ldns_rdf *rdf); - -/** - * Converts the data in the resource record to presentation format and - * returns that as a char *. - * Remember to free it. - * - * \param[in] rr The rdata field to convert - * \return null terminated char * data, or NULL on error - */ -char *ldns_rr2str(const ldns_rr *rr); - -/** - * Converts the data in the DNS packet to presentation format and - * returns that as a char *. - * Remember to free it. - * - * \param[in] pkt The rdata field to convert - * \return null terminated char * data, or NULL on error - */ -char *ldns_pkt2str(const ldns_pkt *pkt); - -/** - * Converts a private key to the test presentation fmt and - * returns that as a char *. - * Remember to free it. - * - * \param[in] k the key to convert to text - * \return null terminated char * data, or NULL on error - */ -char *ldns_key2str(const ldns_key *k); - -/** - * Converts a list of resource records to presentation format - * and returns that as a char *. - * Remember to free it. - * - * \param[in] rr_list the rr_list to convert to text - * \return null terminated char * data, or NULL on error - */ -char *ldns_rr_list2str(const ldns_rr_list *rr_list); - -/** - * Returns the data in the buffer as a null terminated char * string - * Buffer data must be char * type, and must be freed by the caller - * - * \param[in] buffer buffer containing char * data - * \return null terminated char * data, or NULL on error - */ -char *ldns_buffer2str(ldns_buffer *buffer); - -/** - * Prints the data in the rdata field to the given file stream - * (in presentation format) - * - * \param[in] output the file stream to print to - * \param[in] rdf the rdata field to print - * \return void - */ -void ldns_rdf_print(FILE *output, const ldns_rdf *rdf); - -/** - * Prints the data in the resource record to the given file stream - * (in presentation format) - * - * \param[in] output the file stream to print to - * \param[in] rr the resource record to print - * \return void - */ -void ldns_rr_print(FILE *output, const ldns_rr *rr); - -/** - * Prints the data in the DNS packet to the given file stream - * (in presentation format) - * - * \param[in] output the file stream to print to - * \param[in] pkt the packet to print - * \return void - */ -void ldns_pkt_print(FILE *output, const ldns_pkt *pkt); - -/** - * Converts a rr_list to presentation format and appends it to - * the output buffer - * \param[in] output the buffer to append output to - * \param[in] list the ldns_rr_list to print - * \return ldns_status - */ -ldns_status ldns_rr_list2buffer_str(ldns_buffer *output, const ldns_rr_list *list); - -/** - * Converts the header of a packet to presentation format and appends it to - * the output buffer - * \param[in] output the buffer to append output to - * \param[in] pkt the packet to convert the header of - * \return ldns_status - */ -ldns_status ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt); - -/** - * print a rr_list to output - * param[in] output the fd to print to - * param[in] list the rr_list to print - */ -void ldns_rr_list_print(FILE *output, const ldns_rr_list *list); - -/** - * Print a resolver (in sofar that is possible) state - * to output. - * \param[in] output the fd to print to - * \param[in] r the resolver to print - */ -void ldns_resolver_print(FILE *output, const ldns_resolver *r); - -/** - * Print a zone structure * to output. Note the SOA record - * is included in this output - * \param[in] output the fd to print to - * \param[in] z the zone to print - */ -void ldns_zone_print(FILE *output, const ldns_zone *z); - -/** - * Print the ldns_rdf containing a dname to the buffer - * \param[in] output the buffer to print to - * \param[in] dname the dname to print - * \return ldns_status message if the printing succeeded - */ -ldns_status ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_HOST2STR_H */ diff --git a/libs/ldns/ldns/host2wire.h b/libs/ldns/ldns/host2wire.h deleted file mode 100644 index 5eafe9ddc4..0000000000 --- a/libs/ldns/ldns/host2wire.h +++ /dev/null @@ -1,164 +0,0 @@ -/* - * host2wire.h - 2wire conversion routines - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Contains all functions to translate the main structures to wire format - */ - -#ifndef LDNS_HOST2WIRE_H -#define LDNS_HOST2WIRE_H - -#include -#include -#include -#include -#include -#include -#include - -#include "ldns/util.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Copies the dname data to the buffer in wire format - * \param[out] *buffer buffer to append the result to - * \param[in] *name rdata dname to convert - * \return ldns_status - */ -ldns_status ldns_dname2buffer_wire(ldns_buffer *buffer, const ldns_rdf *name); - -/** - * Copies the rdata data to the buffer in wire format - * \param[out] *output buffer to append the result to - * \param[in] *rdf rdata to convert - * \return ldns_status - */ -ldns_status ldns_rdf2buffer_wire(ldns_buffer *output, const ldns_rdf *rdf); - -/** - * Copies the rdata data to the buffer in wire format - * If the rdata is a dname, the letters will be lowercased - * during the conversion - * \param[out] *output buffer to append the result to - * \param[in] *rdf rdata to convert - * \return ldns_status - */ -ldns_status ldns_rdf2buffer_wire_canonical(ldns_buffer *output, - const ldns_rdf *rdf); - -/** - * Copies the rr data to the buffer in wire format - * \param[out] *output buffer to append the result to - * \param[in] *rr resource record to convert - * \param[in] section the section in the packet this rr is supposed to be in - * (to determine whether to add rdata or not) - * \return ldns_status - */ -ldns_status ldns_rr2buffer_wire(ldns_buffer *output, - const ldns_rr *rr, - int section); - -/** - * Copies the rr data to the buffer in wire format, in canonical format - * according to RFC3597 (every dname in rdata fields of RR's mentioned in - * that RFC will be lowercased) - * \param[out] *output buffer to append the result to - * \param[in] *rr resource record to convert - * \param[in] section the section in the packet this rr is supposed to be in - * (to determine whether to add rdata or not) - * \return ldns_status - */ -ldns_status ldns_rr2buffer_wire_canonical(ldns_buffer *output, - const ldns_rr *rr, - int section); - - -/** - * Converts a rrsig to wireformat BUT EXCLUDE the rrsig rdata - * This is needed in DNSSEC verification - * \param[out] output buffer to append the result to - * \param[in] sigrr signature rr to operate on - * \return ldns_status - */ -ldns_status ldns_rrsig2buffer_wire(ldns_buffer *output, const ldns_rr *sigrr); - -/** - * Converts an rr's rdata to wireformat, while excluding - * the ownername and all the stuff before the rdata. - * This is needed in DNSSEC keytag calculation, the ds - * calcalution from the key and maybe elsewhere. - * - * \param[out] *output buffer where to put the result - * \param[in] *rr rr to operate on - * \return ldns_status - */ -ldns_status ldns_rr_rdata2buffer_wire(ldns_buffer *output, const ldns_rr *rr); - -/** - * Copies the packet data to the buffer in wire format - * \param[out] *output buffer to append the result to - * \param[in] *pkt packet to convert - * \return ldns_status - */ -ldns_status ldns_pkt2buffer_wire(ldns_buffer *output, const ldns_pkt *pkt); - -/** - * Copies the rr_list data to the buffer in wire format - * \param[out] *output buffer to append the result to - * \param[in] *rrlist rr_list to to convert - * \return ldns_status - */ -ldns_status ldns_rr_list2buffer_wire(ldns_buffer *output, const ldns_rr_list *rrlist); - -/** - * Allocates an array of uint8_t at dest, and puts the wireformat of the - * given rdf in that array. The result_size value contains the - * length of the array, if it succeeds, and 0 otherwise (in which case - * the function also returns NULL) - * - * \param[out] dest pointer to the array of bytes to be created - * \param[in] rdf the rdata field to convert - * \param[out] size the size of the converted result - */ -ldns_status ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t *size); - -/** - * Allocates an array of uint8_t at dest, and puts the wireformat of the - * given rr in that array. The result_size value contains the - * length of the array, if it succeeds, and 0 otherwise (in which case - * the function also returns NULL) - * - * If the section argument is LDNS_SECTION_QUESTION, data like ttl and rdata - * are not put into the result - * - * \param[out] dest pointer to the array of bytes to be created - * \param[in] rr the rr to convert - * \param[out] size the size of the converted result - */ -ldns_status ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int, size_t *size); - -/** - * Allocates an array of uint8_t at dest, and puts the wireformat of the - * given packet in that array. The result_size value contains the - * length of the array, if it succeeds, and 0 otherwise (in which case - * the function also returns NULL) - */ -ldns_status ldns_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_HOST2WIRE_H */ diff --git a/libs/ldns/ldns/keys.h b/libs/ldns/ldns/keys.h deleted file mode 100644 index e0f568d8f8..0000000000 --- a/libs/ldns/ldns/keys.h +++ /dev/null @@ -1,614 +0,0 @@ -/* - * - * keys.h - * - * priv key definitions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Addendum to \ref dnssec.h, this module contains key and algorithm definitions and functions. - */ - - -#ifndef LDNS_KEYS_H -#define LDNS_KEYS_H - -#ifdef HAVE_SSL -#include -#endif /* HAVE_SSL */ -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -extern ldns_lookup_table ldns_signing_algorithms[]; - -#define LDNS_KEY_ZONE_KEY 0x0100 /* rfc 4034 */ -#define LDNS_KEY_SEP_KEY 0x0001 /* rfc 4034 */ -#define LDNS_KEY_REVOKE_KEY 0x0080 /* rfc 5011 */ - -/** - * Algorithms used in dns - */ -enum ldns_enum_algorithm -{ - LDNS_RSAMD5 = 1, /* RFC 4034,4035 */ - LDNS_DH = 2, - LDNS_DSA = 3, - LDNS_ECC = 4, - LDNS_RSASHA1 = 5, - LDNS_DSA_NSEC3 = 6, - LDNS_RSASHA1_NSEC3 = 7, - LDNS_RSASHA256 = 8, /* RFC 5702 */ - LDNS_RSASHA512 = 10, /* RFC 5702 */ - LDNS_ECC_GOST = 12, /* RFC 5933 */ -#ifdef USE_ECDSA - /* this ifdef has to be removed once it is no longer experimental, - * to be able to use these values outside of the ldns library itself */ - LDNS_ECDSAP256SHA256 = 13, /* draft-hoffman-dnssec-ecdsa */ - LDNS_ECDSAP384SHA384 = 14, /* EXPERIMENTAL */ -#endif - LDNS_INDIRECT = 252, - LDNS_PRIVATEDNS = 253, - LDNS_PRIVATEOID = 254 -}; -typedef enum ldns_enum_algorithm ldns_algorithm; - -/** - * Hashing algorithms used in the DS record - */ -enum ldns_enum_hash -{ - LDNS_SHA1 = 1, /* RFC 4034 */ - LDNS_SHA256 = 2, /* RFC 4509 */ - LDNS_HASH_GOST = 3 /* RFC 5933 */ -#ifdef USE_ECDSA - /* this ifdef has to be removed once it is no longer experimental, - * to be able to use these values outside of the ldns library itself */ - ,LDNS_SHA384 = 4 /* draft-hoffman-dnssec-ecdsa EXPERIMENTAL */ -#endif -}; -typedef enum ldns_enum_hash ldns_hash; - -/** - * Algorithms used in dns for signing - */ -enum ldns_enum_signing_algorithm -{ - LDNS_SIGN_RSAMD5 = LDNS_RSAMD5, - LDNS_SIGN_RSASHA1 = LDNS_RSASHA1, - LDNS_SIGN_DSA = LDNS_DSA, - LDNS_SIGN_RSASHA1_NSEC3 = LDNS_RSASHA1_NSEC3, - LDNS_SIGN_RSASHA256 = LDNS_RSASHA256, - LDNS_SIGN_RSASHA512 = LDNS_RSASHA512, - LDNS_SIGN_DSA_NSEC3 = LDNS_DSA_NSEC3, - LDNS_SIGN_ECC_GOST = LDNS_ECC_GOST, -#ifdef USE_ECDSA - /* this ifdef has to be removed once it is no longer experimental, - * to be able to use these values outside of the ldns library itself */ - LDNS_SIGN_ECDSAP256SHA256 = LDNS_ECDSAP256SHA256, - LDNS_SIGN_ECDSAP384SHA384 = LDNS_ECDSAP384SHA384, -#endif - LDNS_SIGN_HMACMD5 = 157, /* not official! This type is for TSIG, not DNSSEC */ - LDNS_SIGN_HMACSHA1 = 158, /* not official! This type is for TSIG, not DNSSEC */ - LDNS_SIGN_HMACSHA256 = 159 /* ditto */ -}; -typedef enum ldns_enum_signing_algorithm ldns_signing_algorithm; - -/** - * General key structure, can contain all types of keys that - * are used in DNSSEC. Mostly used to store private keys, since - * public keys can also be stored in a \ref ldns_rr with type - * \ref LDNS_RR_TYPE_DNSKEY. - * - * This structure can also store some variables that influence the - * signatures generated by signing with this key, for instance the - * inception date. - */ -struct ldns_struct_key { - ldns_signing_algorithm _alg; - /** Whether to use this key when signing */ - bool _use; - /** Storage pointers for the types of keys supported */ - /* TODO remove unions? */ - struct { -#ifdef HAVE_SSL -#ifndef S_SPLINT_S - /* The key can be an OpenSSL EVP Key - */ - EVP_PKEY *key; -#endif -#endif /* HAVE_SSL */ - /** - * The key can be an HMAC key - */ - struct { - unsigned char *key; - size_t size; - } hmac; - /** the key structure can also just point to some external - * key data - */ - void *external_key; - } _key; - /** Depending on the key we can have extra data */ - union { - /** Some values that influence generated signatures */ - struct { - /** The TTL of the rrset that is currently signed */ - uint32_t orig_ttl; - /** The inception date of signatures made with this key. */ - uint32_t inception; - /** The expiration date of signatures made with this key. */ - uint32_t expiration; - /** The keytag of this key. */ - uint16_t keytag; - /** The dnssec key flags as specified in RFC4035, like ZSK and KSK */ - uint16_t flags; - } dnssec; - } _extra; - /** Owner name of the key */ - ldns_rdf *_pubkey_owner; -}; -typedef struct ldns_struct_key ldns_key; - -/** - * Same as rr_list, but now for keys - */ -struct ldns_struct_key_list -{ - size_t _key_count; - ldns_key **_keys; -}; -typedef struct ldns_struct_key_list ldns_key_list; - - -/** - * Creates a new empty key list - * \return a new ldns_key_list structure pointer - */ -ldns_key_list *ldns_key_list_new(); - -/** - * Creates a new empty key structure - * \return a new ldns_key * structure - */ -ldns_key *ldns_key_new(); - -/** - * Creates a new key based on the algorithm - * - * \param[in] a The algorithm to use - * \param[in] size the number of bytes for the keysize - * \return a new ldns_key structure with the key - */ -ldns_key *ldns_key_new_frm_algorithm(ldns_signing_algorithm a, uint16_t size); - -/** - * Creates a new priv key based on the - * contents of the file pointed by fp. - * - * The file should be in Private-key-format v1.2. - * - * \param[out] k the new ldns_key structure - * \param[in] fp the file pointer to use - * \return an error or LDNS_STATUS_OK - */ -ldns_status ldns_key_new_frm_fp(ldns_key **k, FILE *fp); - -/** - * Creates a new private key based on the - * contents of the file pointed by fp - * - * The file should be in Private-key-format v1.2. - * - * \param[out] k the new ldns_key structure - * \param[in] fp the file pointer to use - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return an error or LDNS_STATUS_OK - */ -ldns_status ldns_key_new_frm_fp_l(ldns_key **k, FILE *fp, int *line_nr); - -#ifdef HAVE_SSL -/** - * Read the key with the given id from the given engine and store it - * in the given ldns_key structure. The algorithm type is set - */ -ldns_status ldns_key_new_frm_engine(ldns_key **key, ENGINE *e, char *key_id, ldns_algorithm); - - -/** - * frm_fp helper function. This function parses the - * remainder of the (RSA) priv. key file generated from bind9 - * \param[in] fp the file to parse - * \return NULL on failure otherwise a RSA structure - */ -RSA *ldns_key_new_frm_fp_rsa(FILE *fp); -#endif /* HAVE_SSL */ - -#ifdef HAVE_SSL -/** - * frm_fp helper function. This function parses the - * remainder of the (RSA) priv. key file generated from bind9 - * \param[in] fp the file to parse - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return NULL on failure otherwise a RSA structure - */ -RSA *ldns_key_new_frm_fp_rsa_l(FILE *fp, int *line_nr); -#endif /* HAVE_SSL */ - -#ifdef HAVE_SSL -/** - * frm_fp helper function. This function parses the - * remainder of the (DSA) priv. key file - * \param[in] fp the file to parse - * \return NULL on failure otherwise a RSA structure - */ -DSA *ldns_key_new_frm_fp_dsa(FILE *fp); -#endif /* HAVE_SSL */ - -#ifdef HAVE_SSL -/** - * frm_fp helper function. This function parses the - * remainder of the (DSA) priv. key file - * \param[in] fp the file to parse - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return NULL on failure otherwise a RSA structure - */ -DSA *ldns_key_new_frm_fp_dsa_l(FILE *fp, int *line_nr); -#endif /* HAVE_SSL */ - -#ifdef HAVE_SSL -/** - * frm_fp helper function. This function parses the - * remainder of the (HMAC-MD5) key file - * This function allocated a buffer that needs to be freed - * \param[in] fp the file to parse - * \param[out] hmac_size the number of bits in the resulting buffer - * \return NULL on failure otherwise a newly allocated char buffer - */ -unsigned char *ldns_key_new_frm_fp_hmac(FILE *fp, size_t *hmac_size); -#endif - -#ifdef HAVE_SSL -/** - * frm_fp helper function. This function parses the - * remainder of the (HMAC-MD5) key file - * This function allocated a buffer that needs to be freed - * \param[in] fp the file to parse - * \param[in] line_nr pointer to an integer containing the current line number (for error reporting purposes) - * \param[out] hmac_size the number of bits in the resulting buffer - * \return NULL on failure otherwise a newly allocated char buffer - */ -unsigned char *ldns_key_new_frm_fp_hmac_l(FILE *fp, int *line_nr, size_t *hmac_size); -#endif /* HAVE_SSL */ - -/* acces write functions */ -/** - * Set the key's algorithm - * \param[in] k the key - * \param[in] l the algorithm - */ -void ldns_key_set_algorithm(ldns_key *k, ldns_signing_algorithm l); -#ifdef HAVE_SSL -/** - * Set the key's evp key - * \param[in] k the key - * \param[in] e the evp key - */ -void ldns_key_set_evp_key(ldns_key *k, EVP_PKEY *e); - -/** - * Set the key's rsa data - * \param[in] k the key - * \param[in] r the rsa data - */ -void ldns_key_set_rsa_key(ldns_key *k, RSA *r); -/** - * Set the key's dsa data - * \param[in] k the key - * \param[in] d the dsa data - */ -void ldns_key_set_dsa_key(ldns_key *k, DSA *d); - -/** - * Get the PKEY id for GOST, loads GOST into openssl as a side effect. - * Only available if GOST is compiled into the library and openssl. - * \return the gost id for EVP_CTX creation. - */ -int ldns_key_EVP_load_gost_id(void); - -/** Release the engine reference held for the GOST engine. */ -void ldns_key_EVP_unload_gost(void); -#endif /* HAVE_SSL */ - -/** - * Set the key's hmac data - * \param[in] k the key - * \param[in] hmac the raw key data - */ -void ldns_key_set_hmac_key(ldns_key *k, unsigned char *hmac); - -/** - * Set the key id data. This is used if the key points to - * some externally stored key data - * - * Only the pointer is set, the data there is not copied, - * and must be freed manually; ldns_key_deep_free() does - * *not* free this data - * \param[in] key the key - * \param[in] external_key key id data - */ -void ldns_key_set_external_key(ldns_key *key, void *external_key); - -/** - * Set the key's hmac size - * \param[in] k the key - * \param[in] hmac_size the size of the hmac data - */ -void ldns_key_set_hmac_size(ldns_key *k, size_t hmac_size); -/** - * Set the key's original ttl - * \param[in] k the key - * \param[in] t the ttl - */ -void ldns_key_set_origttl(ldns_key *k, uint32_t t); -/** - * Set the key's inception date (seconds after epoch) - * \param[in] k the key - * \param[in] i the inception - */ -void ldns_key_set_inception(ldns_key *k, uint32_t i); -/** - * Set the key's expiration date (seconds after epoch) - * \param[in] k the key - * \param[in] e the expiration - */ -void ldns_key_set_expiration(ldns_key *k, uint32_t e); -/** - * Set the key's pubkey owner - * \param[in] k the key - * \param[in] r the owner - */ -void ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r); -/** - * Set the key's key tag - * \param[in] k the key - * \param[in] tag the keytag - */ -void ldns_key_set_keytag(ldns_key *k, uint16_t tag); -/** - * Set the key's flags - * \param[in] k the key - * \param[in] flags the flags - */ -void ldns_key_set_flags(ldns_key *k, uint16_t flags); -/** - * Set the keylist's key count to count - * \param[in] key the key - * \param[in] count the cuont - */ -void ldns_key_list_set_key_count(ldns_key_list *key, size_t count); - -/** - * pushes a key to a keylist - * \param[in] key_list the key_list to push to - * \param[in] key the key to push - * \return false on error, otherwise true - */ -bool ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key); - -/** - * returns the number of keys in the key list - * \param[in] key_list the key_list - * \return the numbers of keys in the list - */ -size_t ldns_key_list_key_count(const ldns_key_list *key_list); - -/** - * returns a pointer to the key in the list at the given position - * \param[in] key the key - * \param[in] nr the position in the list - * \return the key - */ -ldns_key *ldns_key_list_key(const ldns_key_list *key, size_t nr); - -#ifdef HAVE_SSL -/** - * returns the (openssl) RSA struct contained in the key - * \param[in] k the key to look in - * \return the RSA * structure in the key - */ -RSA *ldns_key_rsa_key(const ldns_key *k); -/** - * returns the (openssl) EVP struct contained in the key - * \param[in] k the key to look in - * \return the RSA * structure in the key - */ -EVP_PKEY *ldns_key_evp_key(const ldns_key *k); -#endif /* HAVE_SSL */ - -/** - * returns the (openssl) DSA struct contained in the key - */ -#ifdef HAVE_SSL -DSA *ldns_key_dsa_key(const ldns_key *k); -#endif /* HAVE_SSL */ - -/** - * return the signing alg of the key - * \param[in] k the key - * \return the algorithm - */ -ldns_signing_algorithm ldns_key_algorithm(const ldns_key *k); -/** - * set the use flag - * \param[in] k the key - * \param[in] v the boolean value to set the _use field to - */ -void ldns_key_set_use(ldns_key *k, bool v); -/** - * return the use flag - * \param[in] k the key - * \return the boolean value of the _use field - */ -bool ldns_key_use(const ldns_key *k); -/** - * return the hmac key data - * \param[in] k the key - * \return the hmac key data - */ -unsigned char *ldns_key_hmac_key(const ldns_key *k); -/** - * return the key id key data - * \param[in] k the key - * \return the key id data - */ -void *ldns_key_external_key(const ldns_key *k); -/** - * return the hmac key size - * \param[in] k the key - * \return the hmac key size - */ -size_t ldns_key_hmac_size(const ldns_key *k); -/** - * return the original ttl of the key - * \param[in] k the key - * \return the original ttl - */ -uint32_t ldns_key_origttl(const ldns_key *k); -/** - * return the key's inception date - * \param[in] k the key - * \return the inception date - */ -uint32_t ldns_key_inception(const ldns_key *k); -/** - * return the key's expiration date - * \param[in] k the key - * \return the experiration date - */ -uint32_t ldns_key_expiration(const ldns_key *k); -/** - * return the keytag - * \param[in] k the key - * \return the keytag - */ -uint16_t ldns_key_keytag(const ldns_key *k); -/** - * return the public key's owner - * \param[in] k the key - * \return the owner - */ -ldns_rdf *ldns_key_pubkey_owner(const ldns_key *k); -/** - * Set the 'use' flag for all keys in the list - * \param[in] keys The key_list - * \param[in] v The value to set the use flags to - */ -void -ldns_key_list_set_use(ldns_key_list *keys, bool v); - -/** - * return the flag of the key - * \param[in] k the key - * \return the flag - */ -uint16_t ldns_key_flags(const ldns_key *k); - -/** - * pops the last rr from a keylist - * \param[in] key_list the rr_list to pop from - * \return NULL if nothing to pop. Otherwise the popped RR - */ -ldns_key *ldns_key_list_pop_key(ldns_key_list *key_list); - -/** - * converts a ldns_key to a public key rr - * If the key data exists at an external point, the corresponding - * rdata field must still be added with ldns_rr_rdf_push() to the - * result rr of this function - * - * \param[in] k the ldns_key to convert - * \return ldns_rr representation of the key - */ -ldns_rr *ldns_key2rr(const ldns_key *k); - -/** - * print a private key to the file ouput - * - * \param[in] output the FILE descriptor where to print to - * \param[in] k the ldns_key to print - */ -void ldns_key_print(FILE *output, const ldns_key *k); - -/** - * frees a key structure, but not its internal data structures - * - * \param[in] key the key object to free - */ -void ldns_key_free(ldns_key *key); - -/** - * frees a key structure and all its internal data structures, except - * the data set by ldns_key_set_external_key() - * - * \param[in] key the key object to free - */ -void ldns_key_deep_free(ldns_key *key); - -/** - * Frees a key list structure - * \param[in] key_list the key list object to free - */ -void ldns_key_list_free(ldns_key_list *key_list); - -/** - * Instantiates a DNSKEY or DS RR from file. - * \param[in] filename the file to read the record from - * \return the corresponding RR, or NULL if the parsing failed - */ -ldns_rr * ldns_read_anchor_file(const char *filename); - -/** - * Returns the 'default base name' for key files; - * IE. K\+\+\ - * (without the .key or .private) - * The memory for this is allocated by this function, - * and should be freed by the caller - * - * \param[in] key the key to get the file name from - * \returns A string containing the file base name - */ -char *ldns_key_get_file_base_name(ldns_key *key); - -/** - * See if a key algorithm is supported - * \param[in] algo the signing algorithm number. - * \returns true if supported. - */ -int ldns_key_algo_supported(int algo); - -/** - * Get signing algorithm by name. Comparison is case insensitive. - * \param[in] name string with the name. - * \returns 0 on parse failure or the algorithm number. - */ -ldns_signing_algorithm ldns_get_signing_algorithm_by_name(const char* name); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_KEYS_H */ diff --git a/libs/ldns/ldns/ldns.h b/libs/ldns/ldns/ldns.h deleted file mode 100644 index 6f57733750..0000000000 --- a/libs/ldns/ldns/ldns.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * dns.h -- defines for the Domain Name System - * - * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. - * - * This library was created by: - * Jelte Jansen, Erik Rozendaal and Miek Gieben - * - * A bunch of defines that are used in the DNS. - */ - - -/** -\mainpage LDNS Documentation - -\section introduction Introduction - -The goal of ldns is to simplify DNS programming, it supports recent RFCs -like the DNSSEC documents, and allow developers to easily create software -conforming to current RFCs, and experimental software for current Internet -drafts. A secondary benefit of using ldns is speed, because ldns is written -in C, and although it is not optimized for performance, it should be a lot -faster than Perl. - -The first main tool to use ldns is Drill, from which part of the library was -derived. From version 1.0.0 on, drill is included in the ldns release -and will not be distributed seperately anymore. The library also includes some -other examples and tools to show how it can be used. These can be found in the -examples/ directory in the tarball. - -ldns depends on OpenSSL for it's cryptographic functions. -Feature list - - - Transparent IPv4 and IPv6 support (overridable if necessary), - - TSIG support, - - DNSSEC support; signing and verification, - - small size, - - online documentation as well as manual pages. - -If you want to send us patches please use the code from subversion (trunk). - -\section using_ldns Using ldns - -Almost all interaction between an application and ldns goes through the ldns -data structures (\ref ldns_rr, \ref ldns_pkt, etc.). These are input or -output to the functions of ldns. For example, \ref ldns_zone_new_frm_fp -reads a zone from a \c FILE pointer, and returns an \ref ldns_zone -structure. - - -Let's use Drill as an example. Drill is a tool much like dig, whose most -basic function is to send 1 query to a nameserver and print the response. - -To be able to do this, drill uses the resolver module of ldns, which acts as -a stub resolver. The resolver module uses the net module to actually send -the query that drill requested. It then uses the wire2host module to -translate the response and place it in ldns' internal structures. These are -passed back to drill, which then uses the host2str module to print the -response in presentation format. - -\section gettingstarted Getting Started - -See the \ref design page for a very high level description of the design -choices made for ldns. - -For an overview of the functions and types ldns provides, you can check out -the \ref ldns ldns header file descriptions. - -If you want to see some libdns action, you can read our tutorials: - - \ref tutorial1_mx - - \ref tutorial2_zone - - \ref tutorial3_signzone - -Or you can just use the menu above to browse through the API docs. - -
-\image html LogoInGradientBar2-y100.png -
-*/ - -/** - * \file ldns.h - * - * Including this file will include all ldns files, and define some lookup tables. - */ - -#ifndef LDNS_DNS_H -#define LDNS_DNS_H - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_IP4ADDRLEN (32/8) -#define LDNS_IP6ADDRLEN (128/8) -#define LDNS_PORT 53 -#define LDNS_ROOT_LABEL_STR "." -#define LDNS_DEFAULT_TTL 3600 - -/* lookup tables for standard DNS stuff */ - -/** Taken from RFC 2538, section 2.1. */ -extern ldns_lookup_table ldns_certificate_types[]; -/** Taken from RFC 2535, section 7. */ -extern ldns_lookup_table ldns_algorithms[]; -/** Taken from RFC 2538. */ -extern ldns_lookup_table ldns_cert_algorithms[]; -/** rr types */ -extern ldns_lookup_table ldns_rr_classes[]; -/** Response codes */ -extern ldns_lookup_table ldns_rcodes[]; -/** Operation codes */ -extern ldns_lookup_table ldns_opcodes[]; -/** EDNS flags */ -extern ldns_lookup_table ldns_edns_flags[]; - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_DNS_H */ diff --git a/libs/ldns/ldns/net.h.in b/libs/ldns/ldns/net.h.in deleted file mode 100644 index c3f5a069a6..0000000000 --- a/libs/ldns/ldns/net.h.in +++ /dev/null @@ -1,208 +0,0 @@ -/* - * net.h - * - * DNS Resolver definitions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -#ifndef LDNS_NET_H -#define LDNS_NET_H - -#include -@include_sys_socket_h@ - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_DEFAULT_TIMEOUT_SEC 2 -#define LDNS_DEFAULT_TIMEOUT_USEC 0 - -/** - * \file - * - * Contains functions to send and receive packets over a network. - */ - -/** - * Sends a buffer to an ip using udp and return the respons as a ldns_pkt - * \param[in] qbin the ldns_buffer to be send - * \param[in] to the ip addr to send to - * \param[in] tolen length of the ip addr - * \param[in] timeout the timeout value for the network - * \param[out] answersize size of the packet - * \param[out] result packet with the answer - * \return status - */ -ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); - -/** - * Send an udp query and don't wait for an answer but return - * the socket - * \param[in] qbin the ldns_buffer to be send - * \param[in] to the ip addr to send to - * \param[in] tolen length of the ip addr - * \param[in] timeout *unused*, was the timeout value for the network - * \return the socket used - */ - -int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); - -/** - * Send an tcp query and don't wait for an answer but return - * the socket - * \param[in] qbin the ldns_buffer to be send - * \param[in] to the ip addr to send to - * \param[in] tolen length of the ip addr - * \param[in] timeout the timeout value for the connect attempt - * \return the socket used - */ -int ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); - -/** - * Sends a buffer to an ip using tcp and return the respons as a ldns_pkt - * \param[in] qbin the ldns_buffer to be send - * \param[in] qbin the ldns_buffer to be send - * \param[in] to the ip addr to send to - * \param[in] tolen length of the ip addr - * \param[in] timeout the timeout value for the network - * \param[out] answersize size of the packet - * \param[out] result packet with the answer - * \return status - */ -ldns_status ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); - -/** - * Sends ptk to the nameserver at the resolver object. Returns the data - * as a ldns_pkt - * - * \param[out] pkt packet received from the nameserver - * \param[in] r the resolver to use - * \param[in] query_pkt the query to send - * \return status - */ -ldns_status ldns_send(ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt); - -/** - * Sends and ldns_buffer (presumably containing a packet to the nameserver at the resolver object. Returns the data - * as a ldns_pkt - * - * \param[out] pkt packet received from the nameserver - * \param[in] r the resolver to use - * \param[in] qb the buffer to send - * \param[in] tsig_mac the tsig MAC to authenticate the response with (NULL to do no TSIG authentication) - * \return status - */ -ldns_status ldns_send_buffer(ldns_pkt **pkt, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac); - -/** - * Create a tcp socket to the specified address - * \param[in] to ip and family - * \param[in] tolen length of to - * \param[in] timeout timeout for the connect attempt - * \return a socket descriptor - */ -int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); - -/** - * Create a udp socket to the specified address - * \param[in] to ip and family - * \param[in] timeout *unused*, was timeout for the socket - * \return a socket descriptor - */ -int ldns_udp_connect(const struct sockaddr_storage *to, struct timeval timeout); - -/** - * send a query via tcp to a server. Don't want for the answer - * - * \param[in] qbin the buffer to send - * \param[in] sockfd the socket to use - * \param[in] to which ip to send it - * \param[in] tolen socketlen - * \return number of bytes sent - */ -ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); - -/** - * send a query via udp to a server. Don;t want for the answer - * - * \param[in] qbin the buffer to send - * \param[in] sockfd the socket to use - * \param[in] to which ip to send it - * \param[in] tolen socketlen - * \return number of bytes sent - */ -ssize_t ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); - -/** - * Gives back a raw packet from the wire and reads the header data from the given - * socket. Allocates the data (of size size) itself, so don't forget to free - * - * \param[in] sockfd the socket to read from - * \param[out] size the number of bytes that are read - * \param[in] timeout the time allowed between packets. - * \return the data read - */ -uint8_t *ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout); - -/** - * This routine may block. Use ldns_tcp_read_wire_timeout, it checks timeouts. - * Gives back a raw packet from the wire and reads the header data from the given - * socket. Allocates the data (of size size) itself, so don't forget to free - * - * \param[in] sockfd the socket to read from - * \param[out] size the number of bytes that are read - * \return the data read - */ -uint8_t *ldns_tcp_read_wire(int sockfd, size_t *size); - -/** - * Gives back a raw packet from the wire and reads the header data from the given - * socket. Allocates the data (of size size) itself, so don't forget to free - * - * \param[in] sockfd the socket to read from - * \param[in] fr the address of the client (if applicable) - * \param[in] *frlen the lenght of the client's addr (if applicable) - * \param[out] size the number of bytes that are read - * \return the data read - */ -uint8_t *ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *fr, socklen_t *frlen); - -/** - * returns the native sockaddr representation from the rdf. - * \param[in] rd the ldns_rdf to operate on - * \param[in] port what port to use. 0 means; use default (53) - * \param[out] size what is the size of the sockaddr_storage - * \return struct sockaddr* the address in the format so other - * functions can use it (sendto) - */ -struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size); - -/** - * returns an rdf with the sockaddr info. works for ip4 and ip6 - * \param[in] sock the struct sockaddr_storage to convert - * \param[in] port what port was used. When NULL this is not set - * \return ldns_rdf* wth the address - */ -ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port); - -/** - * Prepares the resolver for an axfr query - * The query is sent and the answers can be read with ldns_axfr_next - * \param[in] resolver the resolver to use - * \param[in] domain the domain to exfr - * \param[in] c the class to use - * \return ldns_status the status of the transfer - */ -ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_NET_H */ diff --git a/libs/ldns/ldns/packet.h b/libs/ldns/ldns/packet.h deleted file mode 100644 index 687a6a2595..0000000000 --- a/libs/ldns/ldns/packet.h +++ /dev/null @@ -1,855 +0,0 @@ -/* - * packet.h - * - * DNS packet definitions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Contains the definition of ldns_pkt and its parts, as well - * as functions to manipulate those. - */ - - -#ifndef LDNS_PACKET_H -#define LDNS_PACKET_H - -#define LDNS_MAX_PACKETLEN 65535 - -/* allow flags to be given to mk_query */ -#define LDNS_QR 1 /* QueRy - query flag */ -#define LDNS_AA 2 /* Authoritative Answer - server flag */ -#define LDNS_TC 4 /* TrunCated - server flag */ -#define LDNS_RD 8 /* Recursion Desired - query flag */ -#define LDNS_CD 16 /* Checking Disabled - query flag */ -#define LDNS_RA 32 /* Recursion Available - server flag */ -#define LDNS_AD 64 /* Authenticated Data - server flag */ - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* opcodes for pkt's */ -enum ldns_enum_pkt_opcode { - LDNS_PACKET_QUERY = 0, - LDNS_PACKET_IQUERY = 1, - LDNS_PACKET_STATUS = 2, /* there is no 3?? DNS is weird */ - LDNS_PACKET_NOTIFY = 4, - LDNS_PACKET_UPDATE = 5 -}; -typedef enum ldns_enum_pkt_opcode ldns_pkt_opcode; - -/* rcodes for pkts */ -enum ldns_enum_pkt_rcode { - LDNS_RCODE_NOERROR = 0, - LDNS_RCODE_FORMERR = 1, - LDNS_RCODE_SERVFAIL = 2, - LDNS_RCODE_NXDOMAIN = 3, - LDNS_RCODE_NOTIMPL = 4, - LDNS_RCODE_REFUSED = 5, - LDNS_RCODE_YXDOMAIN = 6, - LDNS_RCODE_YXRRSET = 7, - LDNS_RCODE_NXRRSET = 8, - LDNS_RCODE_NOTAUTH = 9, - LDNS_RCODE_NOTZONE = 10 -}; -typedef enum ldns_enum_pkt_rcode ldns_pkt_rcode; - -/** - * Header of a dns packet - * - * Contains the information about the packet itself, as specified in RFC1035 -
-4.1.1. Header section format
-
-The header contains the following fields:
-
-                                    1  1  1  1  1  1
-      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                      ID                       |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                    QDCOUNT                    |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                    ANCOUNT                    |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                    NSCOUNT                    |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                    ARCOUNT                    |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-
-where:
-
-ID              A 16 bit identifier assigned by the program that
-                generates any kind of query.  This identifier is copied
-                the corresponding reply and can be used by the requester
-                to match up replies to outstanding queries.
-
-QR              A one bit field that specifies whether this message is a
-                query (0), or a response (1).
-
-OPCODE          A four bit field that specifies kind of query in this
-                message.  This value is set by the originator of a query
-                and copied into the response.  The values are:
-
-                0               a standard query (QUERY)
-
-                1               an inverse query (IQUERY)
-
-                2               a server status request (STATUS)
-
-                3-15            reserved for future use
-
-AA              Authoritative Answer - this bit is valid in responses,
-                and specifies that the responding name server is an
-                authority for the domain name in question section.
-
-                Note that the contents of the answer section may have
-                multiple owner names because of aliases.  The AA bit
-
-                corresponds to the name which matches the query name, or
-                the first owner name in the answer section.
-
-TC              TrunCation - specifies that this message was truncated
-                due to length greater than that permitted on the
-                transmission channel.
-
-RD              Recursion Desired - this bit may be set in a query and
-                is copied into the response.  If RD is set, it directs
-                the name server to pursue the query recursively.
-                Recursive query support is optional.
-
-RA              Recursion Available - this be is set or cleared in a
-                response, and denotes whether recursive query support is
-                available in the name server.
-
-Z               Reserved for future use.  Must be zero in all queries
-                and responses.
-
-RCODE           Response code - this 4 bit field is set as part of
-                responses.  The values have the following
-                interpretation:
-
-                0               No error condition
-
-                1               Format error - The name server was
-                                unable to interpret the query.
-
-                2               Server failure - The name server was
-                                unable to process this query due to a
-                                problem with the name server.
-
-                3               Name Error - Meaningful only for
-                                responses from an authoritative name
-                                server, this code signifies that the
-                                domain name referenced in the query does
-                                not exist.
-
-                4               Not Implemented - The name server does
-                                not support the requested kind of query.
-
-                5               Refused - The name server refuses to
-                                perform the specified operation for
-                                policy reasons.  For example, a name
-                                server may not wish to provide the
-                                information to the particular requester,
-                                or a name server may not wish to perform
-                                a particular operation (e.g., zone
-
-                                transfer) for particular data.
-
-                6-15            Reserved for future use.
-
-QDCOUNT         an unsigned 16 bit integer specifying the number of
-                entries in the question section.
-
-ANCOUNT         an unsigned 16 bit integer specifying the number of
-                resource records in the answer section.
-
-NSCOUNT         an unsigned 16 bit integer specifying the number of name
-                server resource records in the authority records
-                section.
-
-ARCOUNT         an unsigned 16 bit integer specifying the number of
-                resource records in the additional records section.
-
-
- */ -struct ldns_struct_hdr -{ - /** Id of a packet */ - uint16_t _id; - /** Query bit (0=query, 1=answer) */ - bool _qr; - /** Authoritative answer */ - bool _aa; - /** Packet truncated */ - bool _tc; - /** Recursion desired */ - bool _rd; - /** Checking disabled */ - bool _cd; - /** Recursion available */ - bool _ra; - /** Authentic data */ - bool _ad; - /** Query type */ - ldns_pkt_opcode _opcode; /* XXX 8 bits? */ - /** Response code */ - uint8_t _rcode; - /** question sec */ - uint16_t _qdcount; - /** answer sec */ - uint16_t _ancount; - /** auth sec */ - uint16_t _nscount; - /** add sec */ - uint16_t _arcount; -}; -typedef struct ldns_struct_hdr ldns_hdr; - -/** - * DNS packet - * - * This structure contains a complete DNS packet (either a query or an answer) - * - * It is the complete representation of what you actually send to a - * nameserver, and what it sends back (assuming you are the client here). - */ -struct ldns_struct_pkt -{ - /** Header section */ - ldns_hdr *_header; - /* extra items needed in a packet */ - /** The size of the wire format of the packet in octets */ - ldns_rdf *_answerfrom; - /** Timestamp of the time the packet was sent or created */ - struct timeval timestamp; - /** The duration of the query this packet is an answer to */ - uint32_t _querytime; - /** The size of the wire format of the packet in octets */ - size_t _size; - /** Optional tsig rr */ - ldns_rr *_tsig_rr; - /** EDNS0 available buffer size, see RFC2671 */ - uint16_t _edns_udp_size; - /** EDNS0 Extended rcode */ - uint8_t _edns_extended_rcode; - /** EDNS Version */ - uint8_t _edns_version; - /** Reserved EDNS data bits */ - uint16_t _edns_z; - /** Arbitrary EDNS rdata */ - ldns_rdf *_edns_data; - /** Question section */ - ldns_rr_list *_question; - /** Answer section */ - ldns_rr_list *_answer; - /** Authority section */ - ldns_rr_list *_authority; - /** Additional section */ - ldns_rr_list *_additional; -}; -typedef struct ldns_struct_pkt ldns_pkt; - -/** - * The sections of a packet - */ -enum ldns_enum_pkt_section { - LDNS_SECTION_QUESTION = 0, - LDNS_SECTION_ANSWER = 1, - LDNS_SECTION_AUTHORITY = 2, - LDNS_SECTION_ADDITIONAL = 3, - /** bogus section, if not interested */ - LDNS_SECTION_ANY = 4, - /** used to get all non-question rrs from a packet */ - LDNS_SECTION_ANY_NOQUESTION = 5 -}; -typedef enum ldns_enum_pkt_section ldns_pkt_section; - -/** - * The different types of packets - */ -enum ldns_enum_pkt_type { - LDNS_PACKET_QUESTION, - LDNS_PACKET_REFERRAL, - LDNS_PACKET_ANSWER, - LDNS_PACKET_NXDOMAIN, - LDNS_PACKET_NODATA, - LDNS_PACKET_UNKNOWN -}; -typedef enum ldns_enum_pkt_type ldns_pkt_type; - -/* prototypes */ - -/* read */ - -/** - * Read the packet id - * \param[in] p the packet - * \return the packet id - */ -uint16_t ldns_pkt_id(const ldns_pkt *p); -/** - * Read the packet's qr bit - * \param[in] p the packet - * \return value of the bit - */ -bool ldns_pkt_qr(const ldns_pkt *p); -/** - * Read the packet's aa bit - * \param[in] p the packet - * \return value of the bit - */ -bool ldns_pkt_aa(const ldns_pkt *p); -/** - * Read the packet's tc bit - * \param[in] p the packet - * \return value of the bit - */ -bool ldns_pkt_tc(const ldns_pkt *p); -/** - * Read the packet's rd bit - * \param[in] p the packet - * \return value of the bit - */ -bool ldns_pkt_rd(const ldns_pkt *p); -/** - * Read the packet's cd bit - * \param[in] p the packet - * \return value of the bit - */ -bool ldns_pkt_cd(const ldns_pkt *p); -/** - * Read the packet's ra bit - * \param[in] p the packet - * \return value of the bit - */ -bool ldns_pkt_ra(const ldns_pkt *p); -/** - * Read the packet's ad bit - * \param[in] p the packet - * \return value of the bit - */ -bool ldns_pkt_ad(const ldns_pkt *p); -/** - * Read the packet's code - * \param[in] p the packet - * \return the opcode - */ -ldns_pkt_opcode ldns_pkt_get_opcode(const ldns_pkt *p); -/** - * Return the packet's respons code - * \param[in] p the packet - * \return the respons code - */ -ldns_pkt_rcode ldns_pkt_get_rcode(const ldns_pkt *p); -/** - * Return the packet's qd count - * \param[in] p the packet - * \return the qd count - */ -uint16_t ldns_pkt_qdcount(const ldns_pkt *p); -/** - * Return the packet's an count - * \param[in] p the packet - * \return the an count - */ -uint16_t ldns_pkt_ancount(const ldns_pkt *p); -/** - * Return the packet's ns count - * \param[in] p the packet - * \return the ns count - */ -uint16_t ldns_pkt_nscount(const ldns_pkt *p); -/** - * Return the packet's ar count - * \param[in] p the packet - * \return the ar count - */ -uint16_t ldns_pkt_arcount(const ldns_pkt *p); - -/** - * Return the packet's answerfrom - * \param[in] p packet - * \return the name of the server - */ -ldns_rdf *ldns_pkt_answerfrom(const ldns_pkt *p); - -/** - * Return the packet's timestamp - * \param[in] p the packet - * \return the timestamp - */ -struct timeval ldns_pkt_timestamp(const ldns_pkt *p); -/** - * Return the packet's querytime - * \param[in] p the packet - * \return the querytime - */ -uint32_t ldns_pkt_querytime(const ldns_pkt *p); - -/** - * Return the packet's size in bytes - * \param[in] p the packet - * \return the size - */ -size_t ldns_pkt_size(const ldns_pkt *p); - -/** - * Return the packet's tsig pseudo rr's - * \param[in] p the packet - * \return the tsig rr - */ -ldns_rr *ldns_pkt_tsig(const ldns_pkt *p); - -/** - * Return the packet's question section - * \param[in] p the packet - * \return the section - */ -ldns_rr_list *ldns_pkt_question(const ldns_pkt *p); -/** - * Return the packet's answer section - * \param[in] p the packet - * \return the section - */ -ldns_rr_list *ldns_pkt_answer(const ldns_pkt *p); -/** - * Return the packet's authority section - * \param[in] p the packet - * \return the section - */ -ldns_rr_list *ldns_pkt_authority(const ldns_pkt *p); -/** - * Return the packet's additional section - * \param[in] p the packet - * \return the section - */ -ldns_rr_list *ldns_pkt_additional(const ldns_pkt *p); -/** - * Return the packet's question, answer, authority and additional sections - * concatenated, in a new rr_list clone. - * \param[in] p the packet - * \return the rrs - */ -ldns_rr_list *ldns_pkt_all(const ldns_pkt *p); -/** - * Return the packet's answer, authority and additional sections concatenated, - * in a new rr_list clone. Like ldns_pkt_all but without the questions. - * \param[in] p the packet - * \return the rrs except the question rrs - */ -ldns_rr_list *ldns_pkt_all_noquestion(const ldns_pkt *p); - -/** - * return all the rr_list's in the packet. Clone the lists, instead - * of returning pointers. - * \param[in] p the packet to look in - * \param[in] s what section(s) to return - * \return ldns_rr_list with the rr's or NULL if none were found - */ -ldns_rr_list *ldns_pkt_get_section_clone(const ldns_pkt *p, ldns_pkt_section s); - -/** - * return all the rr with a specific name from a packet. Optionally - * specify from which section in the packet - * \param[in] p the packet - * \param[in] r the name - * \param[in] s the packet's section - * \return a list with the rr's or NULL if none were found - */ -ldns_rr_list *ldns_pkt_rr_list_by_name(ldns_pkt *p, ldns_rdf *r, ldns_pkt_section s); -/** - * return all the rr with a specific type from a packet. Optionally - * specify from which section in the packet - * \param[in] p the packet - * \param[in] t the type - * \param[in] s the packet's section - * \return a list with the rr's or NULL if none were found - */ -ldns_rr_list *ldns_pkt_rr_list_by_type(const ldns_pkt *p, ldns_rr_type t, ldns_pkt_section s); -/** - * return all the rr with a specific type and type from a packet. Optionally - * specify from which section in the packet - * \param[in] packet the packet - * \param[in] ownername the name - * \param[in] type the type - * \param[in] sec the packet's section - * \return a list with the rr's or NULL if none were found - */ -ldns_rr_list *ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, const ldns_rdf *ownername, ldns_rr_type type, ldns_pkt_section sec); - - -/** - * check to see if an rr exist in the packet - * \param[in] pkt the packet to examine - * \param[in] sec in which section to look - * \param[in] rr the rr to look for - */ -bool ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr); - - -/** - * sets the flags in a packet. - * \param[in] pkt the packet to operate on - * \param[in] flags ORed values: LDNS_QR| LDNS_AR for instance - * \return true on success otherwise false - */ -bool ldns_pkt_set_flags(ldns_pkt *pkt, uint16_t flags); - -/** - * Set the packet's id - * \param[in] p the packet - * \param[in] id the id to set - */ -void ldns_pkt_set_id(ldns_pkt *p, uint16_t id); -/** - * Set the packet's id to a random value - * \param[in] p the packet - */ -void ldns_pkt_set_random_id(ldns_pkt *p); -/** - * Set the packet's qr bit - * \param[in] p the packet - * \param[in] b the value to set (boolean) - */ -void ldns_pkt_set_qr(ldns_pkt *p, bool b); -/** - * Set the packet's aa bit - * \param[in] p the packet - * \param[in] b the value to set (boolean) - */ -void ldns_pkt_set_aa(ldns_pkt *p, bool b); -/** - * Set the packet's tc bit - * \param[in] p the packet - * \param[in] b the value to set (boolean) - */ -void ldns_pkt_set_tc(ldns_pkt *p, bool b); -/** - * Set the packet's rd bit - * \param[in] p the packet - * \param[in] b the value to set (boolean) - */ -void ldns_pkt_set_rd(ldns_pkt *p, bool b); -/** - * Set the packet's cd bit - * \param[in] p the packet - * \param[in] b the value to set (boolean) - */ -void ldns_pkt_set_cd(ldns_pkt *p, bool b); -/** - * Set the packet's ra bit - * \param[in] p the packet - * \param[in] b the value to set (boolean) - */ -void ldns_pkt_set_ra(ldns_pkt *p, bool b); -/** - * Set the packet's ad bit - * \param[in] p the packet - * \param[in] b the value to set (boolean) - */ -void ldns_pkt_set_ad(ldns_pkt *p, bool b); - -/** - * Set the packet's opcode - * \param[in] p the packet - * \param[in] c the opcode - */ -void ldns_pkt_set_opcode(ldns_pkt *p, ldns_pkt_opcode c); -/** - * Set the packet's respons code - * \param[in] p the packet - * \param[in] c the rcode - */ -void ldns_pkt_set_rcode(ldns_pkt *p, uint8_t c); -/** - * Set the packet's qd count - * \param[in] p the packet - * \param[in] c the count - */ -void ldns_pkt_set_qdcount(ldns_pkt *p, uint16_t c); -/** - * Set the packet's an count - * \param[in] p the packet - * \param[in] c the count - */ -void ldns_pkt_set_ancount(ldns_pkt *p, uint16_t c); -/** - * Set the packet's ns count - * \param[in] p the packet - * \param[in] c the count - */ -void ldns_pkt_set_nscount(ldns_pkt *p, uint16_t c); -/** - * Set the packet's arcount - * \param[in] p the packet - * \param[in] c the count - */ -void ldns_pkt_set_arcount(ldns_pkt *p, uint16_t c); -/** - * Set the packet's answering server - * \param[in] p the packet - * \param[in] r the address - */ -void ldns_pkt_set_answerfrom(ldns_pkt *p, ldns_rdf *r); -/** - * Set the packet's query time - * \param[in] p the packet - * \param[in] t the querytime in msec - */ -void ldns_pkt_set_querytime(ldns_pkt *p, uint32_t t); -/** - * Set the packet's size - * \param[in] p the packet - * \param[in] s the size - */ -void ldns_pkt_set_size(ldns_pkt *p, size_t s); - -/** - * Set the packet's timestamp - * \param[in] p the packet - * \param[in] timeval the timestamp - */ -void ldns_pkt_set_timestamp(ldns_pkt *p, struct timeval timeval); -/** - * Set a packet's section count to x - * \param[in] p the packet - * \param[in] s the section - * \param[in] x the section count - */ -void ldns_pkt_set_section_count(ldns_pkt *p, ldns_pkt_section s, uint16_t x); -/** - * Set the packet's tsig rr - * \param[in] p the packet - * \param[in] t the tsig rr - */ -void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t); - -/** - * looks inside the packet to determine - * what kind of packet it is, AUTH, NXDOMAIN, REFERRAL, etc. - * \param[in] p the packet to examine - * \return the type of packet - */ -ldns_pkt_type ldns_pkt_reply_type(ldns_pkt *p); - -/** - * return the packet's edns udp size - * \param[in] packet the packet - * \return the size - */ -uint16_t ldns_pkt_edns_udp_size(const ldns_pkt *packet); -/** - * return the packet's edns extended rcode - * \param[in] packet the packet - * \return the rcode - */ -uint8_t ldns_pkt_edns_extended_rcode(const ldns_pkt *packet); -/** - * return the packet's edns version - * \param[in] packet the packet - * \return the version - */ -uint8_t ldns_pkt_edns_version(const ldns_pkt *packet); -/** - * return the packet's edns z value - * \param[in] packet the packet - * \return the z value - */ -uint16_t ldns_pkt_edns_z(const ldns_pkt *packet); -/** - * return the packet's edns data - * \param[in] packet the packet - * \return the data - */ -ldns_rdf *ldns_pkt_edns_data(const ldns_pkt *packet); - -/** - * return the packet's edns do bit - * \param[in] packet the packet - * \return the bit's value - */ -bool ldns_pkt_edns_do(const ldns_pkt *packet); -/** - * Set the packet's edns do bit - * \param[in] packet the packet - * \param[in] value the bit's new value - */ -void ldns_pkt_set_edns_do(ldns_pkt *packet, bool value); - -/** - * returns true if this packet needs and EDNS rr to be sent. - * At the moment the only reason is an expected packet - * size larger than 512 bytes, but for instance dnssec would - * be a good reason too. - * - * \param[in] packet the packet to check - * \return true if packet needs edns rr - */ -bool ldns_pkt_edns(const ldns_pkt *packet); - -/** - * Set the packet's edns udp size - * \param[in] packet the packet - * \param[in] s the size - */ -void ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s); -/** - * Set the packet's edns extended rcode - * \param[in] packet the packet - * \param[in] c the code - */ -void ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c); -/** - * Set the packet's edns version - * \param[in] packet the packet - * \param[in] v the version - */ -void ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v); -/** - * Set the packet's edns z value - * \param[in] packet the packet - * \param[in] z the value - */ -void ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z); -/** - * Set the packet's edns data - * \param[in] packet the packet - * \param[in] data the data - */ -void ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data); - -/** - * allocates and initializes a ldns_pkt structure. - * \return pointer to the new packet - */ -ldns_pkt *ldns_pkt_new(); - -/** - * frees the packet structure and all data that it contains. - * \param[in] packet The packet structure to free - * \return void - */ -void ldns_pkt_free(ldns_pkt *packet); - -/** - * creates a query packet for the given name, type, class. - * \param[out] p the packet to be returned - * \param[in] rr_name the name to query for (as string) - * \param[in] rr_type the type to query for - * \param[in] rr_class the class to query for - * \param[in] flags packet flags - * \return LDNS_STATUS_OK or a ldns_status mesg with the error - */ -ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags); - -/** - * creates a packet with a query in it for the given name, type and class. - * \param[in] rr_name the name to query for - * \param[in] rr_type the type to query for - * \param[in] rr_class the class to query for - * \param[in] flags packet flags - * \return ldns_pkt* a pointer to the new pkt - */ -ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags); - -/** - * clones the given packet, creating a fully allocated copy - * - * \param[in] pkt the packet to clone - * \return ldns_pkt* pointer to the new packet - */ -ldns_pkt *ldns_pkt_clone(ldns_pkt *pkt); - -/** - * directly set the additional section - * \param[in] p packet to operate on - * \param[in] rr rrlist to set - */ -void ldns_pkt_set_additional(ldns_pkt *p, ldns_rr_list *rr); - -/** - * directly set the answer section - * \param[in] p packet to operate on - * \param[in] rr rrlist to set - */ -void ldns_pkt_set_answer(ldns_pkt *p, ldns_rr_list *rr); - -/** - * directly set the question section - * \param[in] p packet to operate on - * \param[in] rr rrlist to set - */ -void ldns_pkt_set_question(ldns_pkt *p, ldns_rr_list *rr); - -/** - * directly set the auhority section - * \param[in] p packet to operate on - * \param[in] rr rrlist to set - */ -void ldns_pkt_set_authority(ldns_pkt *p, ldns_rr_list *rr); - -/** - * push an rr on a packet - * \param[in] packet packet to operate on - * \param[in] section where to put it - * \param[in] rr rr to push - * \return a boolean which is true when the rr was added - */ -bool ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr); - -/** - * push an rr on a packet, provided the RR is not there. - * \param[in] pkt packet to operate on - * \param[in] sec where to put it - * \param[in] rr rr to push - * \return a boolean which is true when the rr was added - */ -bool ldns_pkt_safe_push_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr); - -/** - * push a rr_list on a packet - * \param[in] packet packet to operate on - * \param[in] section where to put it - * \param[in] list the rr_list to push - * \return a boolean which is true when the rr was added - */ -bool ldns_pkt_push_rr_list(ldns_pkt *packet, ldns_pkt_section section, ldns_rr_list *list); - -/** - * push an rr_list to a packet, provided the RRs are not already there. - * \param[in] pkt packet to operate on - * \param[in] sec where to put it - * \param[in] list the rr_list to push - * \return a boolean which is true when the rr was added - */ -bool ldns_pkt_safe_push_rr_list(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr_list *list); - -/** - * check if a packet is empty - * \param[in] p packet - * \return true: empty, false: not empty - */ -bool ldns_pkt_empty(ldns_pkt *p); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_PACKET_H */ diff --git a/libs/ldns/ldns/parse.h b/libs/ldns/ldns/parse.h deleted file mode 100644 index 0e9034c341..0000000000 --- a/libs/ldns/ldns/parse.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * parse.h - * - * a Net::DNS like library for C - * LibDNS Team @ NLnet Labs - * (c) NLnet Labs, 2005-2006 - * See the file LICENSE for the license - */ - -#ifndef LDNS_PARSE_H -#define LDNS_PARSE_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_PARSE_SKIP_SPACE "\f\n\r\v" -#define LDNS_PARSE_NORMAL " \f\n\r\t\v" -#define LDNS_PARSE_NO_NL " \t" -#define LDNS_MAX_LINELEN 10230 -#define LDNS_MAX_KEYWORDLEN 32 - - -/** - * \file - * - * Contains some low-level parsing functions, mostly used in the _frm_str - * family of functions. - */ - -/** - * different type of directives in zone files - * We now deal with $TTL, $ORIGIN and $INCLUDE. - * The latter is not implemented in ldns (yet) - */ -enum ldns_enum_directive -{ - LDNS_DIR_TTL, - LDNS_DIR_ORIGIN, - LDNS_DIR_INCLUDE -}; -typedef enum ldns_enum_directive ldns_directive; - -/** - * returns a token/char from the stream F. - * This function deals with ( and ) in the stream, - * and ignores them when encountered - * \param[in] *f the file to read from - * \param[out] *token the read token is put here - * \param[in] *delim chars at which the parsing should stop - * \param[in] *limit how much to read. If 0 the builtin maximum is used - * \return 0 on error of EOF of the stream F. Otherwise return the length of what is read - */ -ssize_t ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit); - -/** - * returns a token/char from the stream F. - * This function deals with ( and ) in the stream, - * and ignores when it finds them. - * \param[in] *f the file to read from - * \param[out] *token the token is put here - * \param[in] *delim chars at which the parsing should stop - * \param[in] *limit how much to read. If 0 use builtin maximum - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return 0 on error of EOF of F otherwise return the length of what is read - */ -ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr); - -/** - * returns a token/char from the buffer b. - * This function deals with ( and ) in the buffer, - * and ignores when it finds them. - * \param[in] *b the buffer to read from - * \param[out] *token the token is put here - * \param[in] *delim chars at which the parsing should stop - * \param[in] *limit how much to read. If 0 the builtin maximum is used - * \returns 0 on error of EOF of b. Otherwise return the length of what is read - */ -ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit); - -/* - * searches for keyword and delim in a file. Gives everything back - * after the keyword + k_del until we hit d_del - * \param[in] f file pointer to read from - * \param[in] keyword keyword to look for - * \param[in] k_del keyword delimeter - * \param[out] data the data found - * \param[in] d_del the data delimeter - * \param[in] data_limit maximum size the the data buffer - * \return the number of character read - */ -ssize_t ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); - -/* - * searches for keyword and delim. Gives everything back - * after the keyword + k_del until we hit d_del - * \param[in] f file pointer to read from - * \param[in] keyword keyword to look for - * \param[in] k_del keyword delimeter - * \param[out] data the data found - * \param[in] d_del the data delimeter - * \param[in] data_limit maximum size the the data buffer - * \param[in] line_nr pointer to an integer containing the current line number (for -debugging purposes) - * \return the number of character read - */ -ssize_t ldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr); - -/* - * searches for keyword and delim in a buffer. Gives everything back - * after the keyword + k_del until we hit d_del - * \param[in] b buffer pointer to read from - * \param[in] keyword keyword to look for - * \param[in] k_del keyword delimeter - * \param[out] data the data found - * \param[in] d_del the data delimeter - * \param[in] data_limit maximum size the the data buffer - * \return the number of character read - */ -ssize_t ldns_bget_keyword_data(ldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); - -/** - * returns the next character from a buffer. Advances the position pointer with 1. - * When end of buffer is reached returns EOF. This is the buffer's equivalent - * for getc(). - * \param[in] *buffer buffer to read from - * \return EOF on failure otherwise return the character - */ -int ldns_bgetc(ldns_buffer *buffer); - -/** - * skips all of the characters in the given string in the buffer, moving - * the position to the first character that is not in *s. - * \param[in] *buffer buffer to use - * \param[in] *s characters to skip - * \return void - */ -void ldns_bskipcs(ldns_buffer *buffer, const char *s); - -/** - * skips all of the characters in the given string in the fp, moving - * the position to the first character that is not in *s. - * \param[in] *fp file to use - * \param[in] *s characters to skip - * \return void - */ -void ldns_fskipcs(FILE *fp, const char *s); - - -/** - * skips all of the characters in the given string in the fp, moving - * the position to the first character that is not in *s. - * \param[in] *fp file to use - * \param[in] *s characters to skip - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return void - */ -void ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_PARSE_H */ diff --git a/libs/ldns/ldns/rbtree.h b/libs/ldns/ldns/rbtree.h deleted file mode 100644 index 98bd880329..0000000000 --- a/libs/ldns/ldns/rbtree.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * rbtree.h -- generic red-black tree - * - * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. - * - * This software is open source. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the NLNET LABS nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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. - * - */ - -/** - * \file - * Red black tree. Implementation taken from NSD 3.0.5, adjusted for use - * in unbound (memory allocation, logging and so on). - */ - -#ifndef LDNS_RBTREE_H_ -#define LDNS_RBTREE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * This structure must be the first member of the data structure in - * the rbtree. This allows easy casting between an rbnode_t and the - * user data (poor man's inheritance). - * Or you can use the data pointer member to get to your data item. - */ -typedef struct ldns_rbnode_t ldns_rbnode_t; -/** - * The rbnode_t struct definition. - */ -struct ldns_rbnode_t { - /** parent in rbtree, RBTREE_NULL for root */ - ldns_rbnode_t *parent; - /** left node (smaller items) */ - ldns_rbnode_t *left; - /** right node (larger items) */ - ldns_rbnode_t *right; - /** pointer to sorting key */ - const void *key; - /** pointer to data */ - const void *data; - /** colour of this node */ - uint8_t color; -}; - -/** The nullpointer, points to empty node */ -#define LDNS_RBTREE_NULL &ldns_rbtree_null_node -/** the global empty node */ -extern ldns_rbnode_t ldns_rbtree_null_node; - -/** An entire red black tree */ -typedef struct ldns_rbtree_t ldns_rbtree_t; -/** definition for tree struct */ -struct ldns_rbtree_t { - /** The root of the red-black tree */ - ldns_rbnode_t *root; - - /** The number of the nodes in the tree */ - size_t count; - - /** - * Key compare function. <0,0,>0 like strcmp. - * Return 0 on two NULL ptrs. - */ - int (*cmp) (const void *, const void *); -}; - -/** - * Create new tree (malloced) with given key compare function. - * @param cmpf: compare function (like strcmp) takes pointers to two keys. - * @return: new tree, empty. - */ -ldns_rbtree_t *ldns_rbtree_create(int (*cmpf)(const void *, const void *)); - -/** - * Free the complete tree (but not its keys) - * @param rbtree The tree to free - */ -void ldns_rbtree_free(ldns_rbtree_t *rbtree); - -/** - * Init a new tree (malloced by caller) with given key compare function. - * @param rbtree: uninitialised memory for new tree, returned empty. - * @param cmpf: compare function (like strcmp) takes pointers to two keys. - */ -void ldns_rbtree_init(ldns_rbtree_t *rbtree, int (*cmpf)(const void *, const void *)); - -/** - * Insert data into the tree. - * @param rbtree: tree to insert to. - * @param data: element to insert. - * @return: data ptr or NULL if key already present. - */ -ldns_rbnode_t *ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data); - -/** - * Insert data into the tree (reversed arguments, for use as callback) - * \param[in] data element to insert - * \param[out] rbtree tree to insert in to - * \return data ptr or NULL if key is already present - */ -void ldns_rbtree_insert_vref(ldns_rbnode_t *data, void *rbtree); - -/** - * Delete element from tree. - * @param rbtree: tree to delete from. - * @param key: key of item to delete. - * @return: node that is now unlinked from the tree. User to delete it. - * returns 0 if node not present - */ -ldns_rbnode_t *ldns_rbtree_delete(ldns_rbtree_t *rbtree, const void *key); - -/** - * Find key in tree. Returns NULL if not found. - * @param rbtree: tree to find in. - * @param key: key that must match. - * @return: node that fits or NULL. - */ -ldns_rbnode_t *ldns_rbtree_search(ldns_rbtree_t *rbtree, const void *key); - -/** - * Find, but match does not have to be exact. - * @param rbtree: tree to find in. - * @param key: key to find position of. - * @param result: set to the exact node if present, otherwise to element that - * precedes the position of key in the tree. NULL if no smaller element. - * @return: true if exact match in result. Else result points to <= element, - * or NULL if key is smaller than the smallest key. - */ -int ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key, - ldns_rbnode_t **result); - -/** - * Returns first (smallest) node in the tree - * @param rbtree: tree - * @return: smallest element or NULL if tree empty. - */ -ldns_rbnode_t *ldns_rbtree_first(ldns_rbtree_t *rbtree); - -/** - * Returns last (largest) node in the tree - * @param rbtree: tree - * @return: largest element or NULL if tree empty. - */ -ldns_rbnode_t *ldns_rbtree_last(ldns_rbtree_t *rbtree); - -/** - * Returns next larger node in the tree - * @param rbtree: tree - * @return: next larger element or NULL if no larger in tree. - */ -ldns_rbnode_t *ldns_rbtree_next(ldns_rbnode_t *rbtree); - -/** - * Returns previous smaller node in the tree - * @param rbtree: tree - * @return: previous smaller element or NULL if no previous in tree. - */ -ldns_rbnode_t *ldns_rbtree_previous(ldns_rbnode_t *rbtree); - -/** - * split off 'elements' number of elements from the start - * of the name tree and return a new tree containing those - * elements - */ -ldns_rbtree_t *ldns_rbtree_split(ldns_rbtree_t *tree, size_t elements); - -/** - * add all node from the second tree to the first (removing them from the - * second), and fix up nsec(3)s if present - */ -void ldns_rbtree_join(ldns_rbtree_t *tree1, ldns_rbtree_t *tree2); - -/** - * Call with node=variable of struct* with rbnode_t as first element. - * with type is the type of a pointer to that struct. - */ -#define LDNS_RBTREE_FOR(node, type, rbtree) \ - for(node=(type)ldns_rbtree_first(rbtree); \ - (ldns_rbnode_t*)node != LDNS_RBTREE_NULL; \ - node = (type)ldns_rbtree_next((ldns_rbnode_t*)node)) - -/** - * Call function for all elements in the redblack tree, such that - * leaf elements are called before parent elements. So that all - * elements can be safely free()d. - * Note that your function must not remove the nodes from the tree. - * Since that may trigger rebalances of the rbtree. - * @param tree: the tree - * @param func: function called with element and user arg. - * The function must not alter the rbtree. - * @param arg: user argument. - */ -void ldns_traverse_postorder(ldns_rbtree_t* tree, - void (*func)(ldns_rbnode_t*, void*), void* arg); - -#ifdef __cplusplus -} -#endif - -#endif /* UTIL_RBTREE_H_ */ diff --git a/libs/ldns/ldns/rdata.h b/libs/ldns/ldns/rdata.h deleted file mode 100644 index 90dcbf1381..0000000000 --- a/libs/ldns/ldns/rdata.h +++ /dev/null @@ -1,385 +0,0 @@ -/* - * rdata.h - * - * rdata definitions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - - -/** - * \file - * - * Defines ldns_rdf and functions to manipulate those. - */ - - -#ifndef LDNS_RDATA_H -#define LDNS_RDATA_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_MAX_RDFLEN 8192 - -#define LDNS_RDF_SIZE_BYTE 1 -#define LDNS_RDF_SIZE_WORD 2 -#define LDNS_RDF_SIZE_DOUBLEWORD 4 -#define LDNS_RDF_SIZE_6BYTES 6 -#define LDNS_RDF_SIZE_16BYTES 16 - -#define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01 - -/** - * The different types of RDATA fields. - */ -enum ldns_enum_rdf_type -{ - /** none */ - LDNS_RDF_TYPE_NONE, - /** domain name */ - LDNS_RDF_TYPE_DNAME, - /** 8 bits */ - LDNS_RDF_TYPE_INT8, - /** 16 bits */ - LDNS_RDF_TYPE_INT16, - /** 32 bits */ - LDNS_RDF_TYPE_INT32, - /** A record */ - LDNS_RDF_TYPE_A, - /** AAAA record */ - LDNS_RDF_TYPE_AAAA, - /** txt string */ - LDNS_RDF_TYPE_STR, - /** apl data */ - LDNS_RDF_TYPE_APL, - /** b32 string */ - LDNS_RDF_TYPE_B32_EXT, - /** b64 string */ - LDNS_RDF_TYPE_B64, - /** hex string */ - LDNS_RDF_TYPE_HEX, - /** nsec type codes */ - LDNS_RDF_TYPE_NSEC, - /** a RR type */ - LDNS_RDF_TYPE_TYPE, - /** a class */ - LDNS_RDF_TYPE_CLASS, - /** certificate algorithm */ - LDNS_RDF_TYPE_CERT_ALG, - /** a key algorithm */ - LDNS_RDF_TYPE_ALG, - /** unknown types */ - LDNS_RDF_TYPE_UNKNOWN, - /** time (32 bits) */ - LDNS_RDF_TYPE_TIME, - /** period */ - LDNS_RDF_TYPE_PERIOD, - /** tsig time 48 bits */ - LDNS_RDF_TYPE_TSIGTIME, - LDNS_RDF_TYPE_TSIG, - /** variable length any type rdata where the length - is specified by the first 2 bytes */ - LDNS_RDF_TYPE_INT16_DATA, - /** protocol and port bitmaps */ - LDNS_RDF_TYPE_SERVICE, - /** location data */ - LDNS_RDF_TYPE_LOC, - /** well known services */ - LDNS_RDF_TYPE_WKS, - /** NSAP */ - LDNS_RDF_TYPE_NSAP, - /** ATMA */ - LDNS_RDF_TYPE_ATMA, - /** IPSECKEY */ - LDNS_RDF_TYPE_IPSECKEY, - /** nsec3 hash salt */ - LDNS_RDF_TYPE_NSEC3_SALT, - /** nsec3 base32 string (with length byte on wire */ - LDNS_RDF_TYPE_NSEC3_NEXT_OWNER -}; -typedef enum ldns_enum_rdf_type ldns_rdf_type; - -/** - * algorithms used in CERT rrs - */ -enum ldns_enum_cert_algorithm -{ - LDNS_CERT_PKIX = 1, - LDNS_CERT_SPKI = 2, - LDNS_CERT_PGP = 3, - LDNS_CERT_IPKIX = 4, - LDNS_CERT_ISPKI = 5, - LDNS_CERT_IPGP = 6, - LDNS_CERT_ACPKIX = 7, - LDNS_CERT_IACPKIX = 8, - LDNS_CERT_URI = 253, - LDNS_CERT_OID = 254 -}; -typedef enum ldns_enum_cert_algorithm ldns_cert_algorithm; - - - -/** - * Resource record data field. - * - * The data is a network ordered array of bytes, which size is specified by - * the (16-bit) size field. To correctly parse it, use the type - * specified in the (16-bit) type field with a value from \ref ldns_rdf_type. - */ -struct ldns_struct_rdf -{ - /** The size of the data (in octets) */ - size_t _size; - /** The type of the data */ - ldns_rdf_type _type; - /** Pointer to the data (raw octets) */ - void *_data; -}; -typedef struct ldns_struct_rdf ldns_rdf; - -/* prototypes */ - -/* write access functions */ - -/** - * sets the size of the rdf. - * \param[in] *rd the rdf to operate on - * \param[in] size the new size - * \return void - */ -void ldns_rdf_set_size(ldns_rdf *rd, size_t size); - -/** - * sets the size of the rdf. - * \param[in] *rd the rdf to operate on - * \param[in] type the new type - * \return void - */ -void ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type); - -/** - * sets the size of the rdf. - * \param[in] *rd the rdf to operate on - * \param[in] *data pointer to the new data - * \return void - */ -void ldns_rdf_set_data(ldns_rdf *rd, void *data); - -/* read access */ - -/** - * returns the size of the rdf. - * \param[in] *rd the rdf to read from - * \return uint16_t with the size - */ -size_t ldns_rdf_size(const ldns_rdf *rd); - -/** - * returns the type of the rdf. We need to insert _get_ - * here to prevent conflict the the rdf_type TYPE. - * \param[in] *rd the rdf to read from - * \return ldns_rdf_type with the type - */ -ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd); - -/** - * returns the data of the rdf. - * \param[in] *rd the rdf to read from - * \return uint8_t* pointer to the rdf's data - */ -uint8_t *ldns_rdf_data(const ldns_rdf *rd); - -/* creator functions */ - -/** - * allocates a new rdf structure and fills it. - * This function DOES NOT copy the contents from - * the buffer, unlinke ldns_rdf_new_frm_data() - * \param[in] type type of the rdf - * \param[in] size size of the buffer - * \param[in] data pointer to the buffer to be copied - * \return the new rdf structure or NULL on failure - */ -ldns_rdf *ldns_rdf_new(ldns_rdf_type type, size_t size, void *data); - -/** - * allocates a new rdf structure and fills it. - * This function _does_ copy the contents from - * the buffer, unlinke ldns_rdf_new() - * \param[in] type type of the rdf - * \param[in] size size of the buffer - * \param[in] data pointer to the buffer to be copied - * \return the new rdf structure or NULL on failure - */ -ldns_rdf *ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data); - -/** - * creates a new rdf from a string. - * \param[in] type type to use - * \param[in] str string to use - * \return ldns_rdf* or NULL in case of an error - */ -ldns_rdf *ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str); - -/** - * creates a new rdf from a file containing a string. - * \param[out] r the new rdf - * \param[in] type type to use - * \param[in] fp the file pointer to use - * \return LDNS_STATUS_OK or the error - */ -ldns_status ldns_rdf_new_frm_fp(ldns_rdf **r, ldns_rdf_type type, FILE *fp); - -/** - * creates a new rdf from a file containing a string. - * \param[out] r the new rdf - * \param[in] type type to use - * \param[in] fp the file pointer to use - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return LDNS_STATUS_OK or the error - */ -ldns_status ldns_rdf_new_frm_fp_l(ldns_rdf **r, ldns_rdf_type type, FILE *fp, int *line_nr); - -/* destroy functions */ - -/** - * frees a rdf structure, leaving the - * data pointer intact. - * \param[in] rd the pointer to be freed - * \return void - */ -void ldns_rdf_free(ldns_rdf *rd); - -/** - * frees a rdf structure _and_ frees the - * data. rdf should be created with _new_frm_data - * \param[in] rd the rdf structure to be freed - * \return void - */ -void ldns_rdf_deep_free(ldns_rdf *rd); - -/* conversion functions */ - -/** - * returns the rdf containing the native uint8_t repr. - * \param[in] type the ldns_rdf type to use - * \param[in] value the uint8_t to use - * \return ldns_rdf* with the converted value - */ -ldns_rdf *ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value); - -/** - * returns the rdf containing the native uint16_t representation. - * \param[in] type the ldns_rdf type to use - * \param[in] value the uint16_t to use - * \return ldns_rdf* with the converted value - */ -ldns_rdf *ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value); - -/** - * returns an rdf that contains the given int32 value. - * - * Because multiple rdf types can contain an int32, the - * type must be specified - * \param[in] type the ldns_rdf type to use - * \param[in] value the uint32_t to use - * \return ldns_rdf* with the converted value - */ -ldns_rdf *ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value); - -/** - * returns an int16_data rdf that contains the data in the - * given array, preceded by an int16 specifying the length. - * - * The memory is copied, and an LDNS_RDF_TYPE_INT16DATA is returned - * \param[in] size the size of the data - * \param[in] *data pointer to the actual data - * \return ldns_rd* the rdf with the data - */ -ldns_rdf *ldns_native2rdf_int16_data(size_t size, uint8_t *data); - -/** - * reverses an rdf, only actually useful for AAAA and A records. - * The returned rdf has the type LDNS_RDF_TYPE_DNAME! - * \param[in] *rd rdf to be reversed - * \return the reversed rdf (a newly created rdf) - */ -ldns_rdf *ldns_rdf_address_reverse(ldns_rdf *rd); - -/** - * returns the native uint8_t representation from the rdf. - * \param[in] rd the ldns_rdf to operate on - * \return uint8_t the value extracted - */ -uint8_t ldns_rdf2native_int8(const ldns_rdf *rd); - -/** - * returns the native uint16_t representation from the rdf. - * \param[in] rd the ldns_rdf to operate on - * \return uint16_t the value extracted - */ -uint16_t ldns_rdf2native_int16(const ldns_rdf *rd); - -/** - * returns the native uint32_t representation from the rdf. - * \param[in] rd the ldns_rdf to operate on - * \return uint32_t the value extracted - */ -uint32_t ldns_rdf2native_int32(const ldns_rdf *rd); - -/** - * returns the native time_t representation from the rdf. - * \param[in] rd the ldns_rdf to operate on - * \return time_t the value extracted (32 bits currently) - */ -time_t ldns_rdf2native_time_t(const ldns_rdf *rd); - -/** - * converts a ttl value (like 5d2h) to a long. - * \param[in] nptr the start of the string - * \param[out] endptr points to the last char in case of error - * \return the convert duration value - */ -uint32_t ldns_str2period(const char *nptr, const char **endptr); - -/** - * removes \\DDD, \\[space] and other escapes from the input. - * See RFC 1035, section 5.1. - * \param[in] word what to check - * \param[in] length the string - * \return ldns_status mesg - */ -ldns_status ldns_octet(char *word, size_t *length); - -/** - * clones a rdf structure. The data is copied. - * \param[in] rd rdf to be copied - * \return a new rdf structure - */ -ldns_rdf *ldns_rdf_clone(const ldns_rdf *rd); - -/** - * compares two rdf's on their wire formats. - * (To order dnames according to rfc4034, use ldns_dname_compare) - * \param[in] rd1 the first one - * \param[in] rd2 the second one - * \return 0 if equal - * \return -1 if rd1 comes before rd2 - * \return +1 if rd2 comes before rd1 - */ -int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_RDATA_H */ diff --git a/libs/ldns/ldns/resolver.h b/libs/ldns/ldns/resolver.h deleted file mode 100644 index f887aaf676..0000000000 --- a/libs/ldns/ldns/resolver.h +++ /dev/null @@ -1,721 +0,0 @@ -/* - * resolver.h - * - * DNS Resolver definitions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Defines the ldns_resolver structure, a stub resolver that can send queries and parse answers. - * - */ - -#ifndef LDNS_RESOLVER_H -#define LDNS_RESOLVER_H - -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** Default location of the resolv.conf file */ -#define LDNS_RESOLV_CONF "/etc/resolv.conf" -/** Default location of the hosts file */ -#define LDNS_RESOLV_HOSTS "/etc/hosts" - -#define LDNS_RESOLV_KEYWORD -1 -#define LDNS_RESOLV_DEFDOMAIN 0 -#define LDNS_RESOLV_NAMESERVER 1 -#define LDNS_RESOLV_SEARCH 2 -#define LDNS_RESOLV_SORTLIST 3 -#define LDNS_RESOLV_OPTIONS 4 -#define LDNS_RESOLV_ANCHOR 5 -#define LDNS_RESOLV_KEYWORDS 6 - -#define LDNS_RESOLV_INETANY 0 -#define LDNS_RESOLV_INET 1 -#define LDNS_RESOLV_INET6 2 - -#define LDNS_RESOLV_RTT_INF 0 /* infinity */ -#define LDNS_RESOLV_RTT_MIN 1 /* reachable */ - -/** - * DNS stub resolver structure - */ -struct ldns_struct_resolver -{ - /** Port to send queries to */ - uint16_t _port; - - /** Array of nameservers to query (IP addresses or dnames) */ - ldns_rdf **_nameservers; - /** Number of nameservers in \c _nameservers */ - size_t _nameserver_count; /* how many do we have */ - - /** Round trip time; 0 -> infinity. Unit: ms? */ - size_t *_rtt; - - /** Wether or not to be recursive */ - bool _recursive; - - /** Print debug information */ - bool _debug; - - /** Default domain to add to non fully qualified domain names */ - ldns_rdf *_domain; - - /** Searchlist array, add the names in this array if a query cannot be found */ - ldns_rdf **_searchlist; - - /** Number of entries in the searchlist array */ - size_t _searchlist_count; - - /** Number of times to retry before giving up */ - uint8_t _retry; - /** Time to wait before retrying */ - uint8_t _retrans; - /** Use new fallback mechanism (try EDNS, then do TCP) */ - bool _fallback; - - /** Whether to do DNSSEC */ - bool _dnssec; - /** Whether to set the CD bit on DNSSEC requests */ - bool _dnssec_cd; - /** Optional trust anchors for complete DNSSEC validation */ - ldns_rr_list * _dnssec_anchors; - /** Whether to use tcp or udp (tcp if the value is true)*/ - bool _usevc; - /** Whether to ignore the tc bit */ - bool _igntc; - /** Whether to use ip6, 0->does not matter, 1 is IPv4, 2 is IPv6 */ - uint8_t _ip6; - /** If true append the default domain */ - bool _defnames; - /** If true apply the search list */ - bool _dnsrch; - /** Timeout for socket connections */ - struct timeval _timeout; - /** Only try the first nameserver, and return with an error directly if it fails */ - bool _fail; - /** Randomly choose a nameserver */ - bool _random; - /** Keep some things to make AXFR possible */ - int _socket; - /** Count the number of LDNS_RR_TYPE_SOA RRs we have seen so far - * (the second one signifies the end of the AXFR) - */ - int _axfr_soa_count; - /* when axfring we get complete packets from the server - but we want to give the caller 1 rr at a time, so - keep the current pkt */ - /** Packet currently handled when doing part of an AXFR */ - ldns_pkt *_cur_axfr_pkt; - /** Counter for within the AXFR packets */ - uint16_t _axfr_i; - /* EDNS0 available buffer size */ - uint16_t _edns_udp_size; - - /* Optional tsig key for signing queries, - outgoing messages are signed if and only if both are set - */ - /** Name of the key to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values, outgoing messages are automatically signed with TSIG. */ - char *_tsig_keyname; - /** Secret key data to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values, outgoing messages are automatically signed with TSIG. */ - char *_tsig_keydata; - /** TSIG signing algorithm */ - char *_tsig_algorithm; -}; -typedef struct ldns_struct_resolver ldns_resolver; - -/* prototypes */ -/* read access functions */ - -/** - * Get the port the resolver should use - * \param[in] r the resolver - * \return the port number - */ -uint16_t ldns_resolver_port(const ldns_resolver *r); - -/** - * Is the resolver set to recurse - * \param[in] r the resolver - * \return true if so, otherwise false - */ -bool ldns_resolver_recursive(const ldns_resolver *r); - -/** - * Get the debug status of the resolver - * \param[in] r the resolver - * \return true if so, otherwise false - */ -bool ldns_resolver_debug(const ldns_resolver *r); - -/** - * Get the number of retries - * \param[in] r the resolver - * \return the number of retries - */ -uint8_t ldns_resolver_retry(const ldns_resolver *r); - -/** - * Get the retransmit interval - * \param[in] r the resolver - * \return the retransmit interval - */ -uint8_t ldns_resolver_retrans(const ldns_resolver *r); - -/** - * Get the truncation fallback status - * \param[in] r the resolver - * \return whether the truncation fallback mechanism is used - */ -bool ldns_resolver_fallback(const ldns_resolver *r); - -/** - * Does the resolver use ip6 or ip4 - * \param[in] r the resolver - * \return 0: both, 1: ip4, 2:ip6 - */ -uint8_t ldns_resolver_ip6(const ldns_resolver *r); - -/** - * Get the resolver's udp size - * \param[in] r the resolver - * \return the udp mesg size - */ -uint16_t ldns_resolver_edns_udp_size(const ldns_resolver *r); -/** - * Does the resolver use tcp or udp - * \param[in] r the resolver - * \return true: tcp, false: udp - */ -bool ldns_resolver_usevc(const ldns_resolver *r); -/** - * Does the resolver only try the first nameserver - * \param[in] r the resolver - * \return true: yes, fail, false: no, try the others - */ -bool ldns_resolver_fail(const ldns_resolver *r); -/** - * Does the resolver apply default domain name - * \param[in] r the resolver - * \return true: yes, false: no - */ -bool ldns_resolver_defnames(const ldns_resolver *r); -/** - * Does the resolver apply search list - * \param[in] r the resolver - * \return true: yes, false: no - */ -bool ldns_resolver_dnsrch(const ldns_resolver *r); -/** - * Does the resolver do DNSSEC - * \param[in] r the resolver - * \return true: yes, false: no - */ -bool ldns_resolver_dnssec(const ldns_resolver *r); -/** - * Does the resolver set the CD bit - * \param[in] r the resolver - * \return true: yes, false: no - */ -bool ldns_resolver_dnssec_cd(const ldns_resolver *r); -/** - * Get the resolver's DNSSEC anchors - * \param[in] r the resolver - * \return an rr_list containg trusted DNSSEC anchors - */ -ldns_rr_list * ldns_resolver_dnssec_anchors(const ldns_resolver *r); -/** - * Does the resolver ignore the TC bit (truncated) - * \param[in] r the resolver - * \return true: yes, false: no - */ -bool ldns_resolver_igntc(const ldns_resolver *r); -/** - * Does the resolver randomize the nameserver before usage - * \param[in] r the resolver - * \return true: yes, false: no - */ -bool ldns_resolver_random(const ldns_resolver *r); -/** - * How many nameserver are configured in the resolver - * \param[in] r the resolver - * \return number of nameservers - */ -size_t ldns_resolver_nameserver_count(const ldns_resolver *r); -/** - * What is the default dname to add to relative queries - * \param[in] r the resolver - * \return the dname which is added - */ -ldns_rdf *ldns_resolver_domain(const ldns_resolver *r); -/** - * What is the timeout on socket connections - * \param[in] r the resolver - * \return the timeout as struct timeval - */ -struct timeval ldns_resolver_timeout(const ldns_resolver *r); -/** - * What is the searchlist as used by the resolver - * \param[in] r the resolver - * \return a ldns_rdf pointer to a list of the addresses - */ -ldns_rdf** ldns_resolver_searchlist(const ldns_resolver *r); -/** - * Return the configured nameserver ip address - * \param[in] r the resolver - * \return a ldns_rdf pointer to a list of the addresses - */ -ldns_rdf** ldns_resolver_nameservers(const ldns_resolver *r); -/** - * Return the used round trip times for the nameservers - * \param[in] r the resolver - * \return a size_t* pointer to the list. - * yet) - */ -size_t * ldns_resolver_rtt(const ldns_resolver *r); -/** - * Return the used round trip time for a specific nameserver - * \param[in] r the resolver - * \param[in] pos the index to the nameserver - * \return the rrt, 0: infinite, >0: undefined (as of * yet) - */ -size_t ldns_resolver_nameserver_rtt(const ldns_resolver *r, size_t pos); -/** - * Return the tsig keyname as used by the nameserver - * \param[in] r the resolver - * \return the name used. - */ -char *ldns_resolver_tsig_keyname(const ldns_resolver *r); -/** - * Return the tsig algorithm as used by the nameserver - * \param[in] r the resolver - * \return the algorithm used. - */ -char *ldns_resolver_tsig_algorithm(const ldns_resolver *r); -/** - * Return the tsig keydata as used by the nameserver - * \param[in] r the resolver - * \return the keydata used. - */ -char *ldns_resolver_tsig_keydata(const ldns_resolver *r); -/** - * pop the last nameserver from the resolver. - * \param[in] r the resolver - * \return the popped address or NULL if empty - */ -ldns_rdf* ldns_resolver_pop_nameserver(ldns_resolver *r); - -/** - * Return the resolver's searchlist count - * \param[in] r the resolver - * \return the searchlist count - */ -size_t ldns_resolver_searchlist_count(const ldns_resolver *r); - -/* write access function */ -/** - * Set the port the resolver should use - * \param[in] r the resolver - * \param[in] p the port number - */ -void ldns_resolver_set_port(ldns_resolver *r, uint16_t p); - -/** - * Set the resolver recursion - * \param[in] r the resolver - * \param[in] b true: set to recurse, false: unset - */ -void ldns_resolver_set_recursive(ldns_resolver *r, bool b); - -/** - * Set the resolver debugging - * \param[in] r the resolver - * \param[in] b true: debug on: false debug off - */ -void ldns_resolver_set_debug(ldns_resolver *r, bool b); - -/** - * Incremental the resolver's nameserver count. - * \param[in] r the resolver - */ -void ldns_resolver_incr_nameserver_count(ldns_resolver *r); - -/** - * Decrement the resolver's nameserver count. - * \param[in] r the resolver - */ -void ldns_resolver_dec_nameserver_count(ldns_resolver *r); - -/** - * Set the resolver's nameserver count directly. - * \param[in] r the resolver - * \param[in] c the nameserver count - */ -void ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c); - -/** - * Set the resolver's nameserver count directly by using an rdf list - * \param[in] r the resolver - * \param[in] rd the resolver addresses - */ -void ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **rd); - -/** - * Set the resolver's default domain. This gets appended when no - * absolute name is given - * \param[in] r the resolver - * \param[in] rd the name to append - */ -void ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *rd); - -/** - * Set the resolver's socket time out when talking to remote hosts - * \param[in] r the resolver - * \param[in] timeout the timeout to use - */ -void ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout); - -/** - * Push a new rd to the resolver's searchlist - * \param[in] r the resolver - * \param[in] rd to push - */ -void ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *rd); - -/** - * Whether the resolver uses the name set with _set_domain - * \param[in] r the resolver - * \param[in] b true: use the defaults, false: don't use them - */ -void ldns_resolver_set_defnames(ldns_resolver *r, bool b); - -/** - * Whether the resolver uses a virtual circuit (TCP) - * \param[in] r the resolver - * \param[in] b true: use TCP, false: don't use TCP - */ -void ldns_resolver_set_usevc(ldns_resolver *r, bool b); - -/** - * Whether the resolver uses the searchlist - * \param[in] r the resolver - * \param[in] b true: use the list, false: don't use the list - */ -void ldns_resolver_set_dnsrch(ldns_resolver *r, bool b); - -/** - * Whether the resolver uses DNSSEC - * \param[in] r the resolver - * \param[in] b true: use DNSSEC, false: don't use DNSSEC - */ -void ldns_resolver_set_dnssec(ldns_resolver *r, bool b); - -/** - * Whether the resolver uses the checking disable bit - * \param[in] r the resolver - * \param[in] b true: enable , false: don't use TCP - */ -void ldns_resolver_set_dnssec_cd(ldns_resolver *r, bool b); -/** - * Set the resolver's DNSSEC anchor list directly. RRs should be of type DS or DNSKEY. - * \param[in] r the resolver - * \param[in] l the list of RRs to use as trust anchors - */ -void ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list * l); - -/** - * Push a new trust anchor to the resolver. It must be a DS or DNSKEY rr - * \param[in] r the resolver. - * \param[in] rr the RR to add as a trust anchor. - * \return a status - */ -ldns_status ldns_resolver_push_dnssec_anchor(ldns_resolver *r, ldns_rr *rr); - -/** - * Set the resolver retrans timeout (in seconds) - * \param[in] r the resolver - * \param[in] re the retransmission interval in seconds - */ -void ldns_resolver_set_retrans(ldns_resolver *r, uint8_t re); - -/** - * Set whether the resolvers truncation fallback mechanism is used - * when ldns_resolver_query() is called. - * \param[in] r the resolver - * \param[in] fallback whether to use the fallback mechanism - */ -void ldns_resolver_set_fallback(ldns_resolver *r, bool fallback); - -/** - * Set the resolver retry interval (in seconds) - * \param[in] r the resolver - * \param[in] re the retry interval - */ -void ldns_resolver_set_retry(ldns_resolver *r, uint8_t re); - -/** - * Whether the resolver uses ip6 - * \param[in] r the resolver - * \param[in] i 0: no pref, 1: ip4, 2: ip6 - */ -void ldns_resolver_set_ip6(ldns_resolver *r, uint8_t i); - -/** - * Whether or not to fail after one failed query - * \param[in] r the resolver - * \param[in] b true: yes fail, false: continue with next nameserver - */ -void ldns_resolver_set_fail(ldns_resolver *r, bool b); - -/** - * Whether or not to ignore the TC bit - * \param[in] r the resolver - * \param[in] b true: yes ignore, false: don't ignore - */ -void ldns_resolver_set_igntc(ldns_resolver *r, bool b); - -/** - * Set maximum udp size - * \param[in] r the resolver - * \param[in] s the udp max size - */ -void ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s); - -/** - * Set the tsig key name - * \param[in] r the resolver - * \param[in] tsig_keyname the tsig key name - */ -void ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname); - -/** - * Set the tsig algorithm - * \param[in] r the resolver - * \param[in] tsig_algorithm the tsig algorithm - */ -void ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm); - -/** - * Set the tsig key data - * \param[in] r the resolver - * \param[in] tsig_keydata the key data - */ -void ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata); - -/** - * Set round trip time for all nameservers. Note this currently - * differentiates between: unreachable and reachable. - * \param[in] r the resolver - * \param[in] rtt a list with the times - */ -void ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt); - -/** - * Set round trip time for a specific nameserver. Note this - * currently differentiates between: unreachable and reachable. - * \param[in] r the resolver - * \param[in] pos the nameserver position - * \param[in] value the rtt - */ -void ldns_resolver_set_nameserver_rtt(ldns_resolver *r, size_t pos, size_t value); - -/** - * Should the nameserver list be randomized before each use - * \param[in] r the resolver - * \param[in] b: true: randomize, false: don't - */ -void ldns_resolver_set_random(ldns_resolver *r, bool b); - -/** - * Push a new nameserver to the resolver. It must be an IP - * address v4 or v6. - * \param[in] r the resolver - * \param[in] n the ip address - * \return ldns_status a status - */ -ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n); - -/** - * Push a new nameserver to the resolver. It must be an - * A or AAAA RR record type - * \param[in] r the resolver - * \param[in] rr the resource record - * \return ldns_status a status - */ -ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr); - -/** - * Push a new nameserver rr_list to the resolver. - * \param[in] r the resolver - * \param[in] rrlist the rr_list to push - * \return ldns_status a status - */ -ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist); - -/** - * Send the query for using the resolver and take the search list into account - * The search algorithm is as follows: - * If the name is absolute, try it as-is, otherwise apply the search list - * \param[in] *r operate using this resolver - * \param[in] *rdf query for this name - * \param[in] t query for this type (may be 0, defaults to A) - * \param[in] c query for this class (may be 0, default to IN) - * \param[in] flags the query flags - * \return ldns_pkt* a packet with the reply from the nameserver - */ -ldns_pkt* ldns_resolver_search(const ldns_resolver *r, const ldns_rdf *rdf, ldns_rr_type t, ldns_rr_class c, uint16_t flags); - -/** - * Form a query packet from a resolver and name/type/class combo - * \param[out] **q a pointer to a ldns_pkt pointer (initialized by this function) - * \param[in] *r operate using this resolver - * \param[in] *name query for this name - * \param[in] t query for this type (may be 0, defaults to A) - * \param[in] c query for this class (may be 0, default to IN) - * \param[in] f the query flags - * \return ldns_pkt* a packet with the reply from the nameserver - */ -ldns_status ldns_resolver_prepare_query_pkt(ldns_pkt **q, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t f); - -/** - * Send the query for name as-is - * \param[out] **answer a pointer to a ldns_pkt pointer (initialized by this function) - * \param[in] *r operate using this resolver - * \param[in] *name query for this name - * \param[in] t query for this type (may be 0, defaults to A) - * \param[in] c query for this class (may be 0, default to IN) - * \param[in] flags the query flags - * \return ldns_pkt* a packet with the reply from the nameserver - */ -ldns_status ldns_resolver_send(ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags); - -/** - * Send the given packet to a nameserver - * \param[out] **answer a pointer to a ldns_pkt pointer (initialized by this function) - * \param[in] *r operate using this resolver - * \param[in] *query_pkt query - */ -ldns_status ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, ldns_pkt *query_pkt); - -/** - * Send a query to a nameserver - * \param[in] *r operate using this resolver - * \param[in] *name query for this name - * \param[in] *t query for this type (may be 0, defaults to A) - * \param[in] *c query for this class (may be 0, default to IN) - * \param[in] flags the query flags - * \return ldns_pkt* a packet with the reply from the nameserver - * if _defnames is true the default domain will be added - */ -ldns_pkt* ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags); - - -/** - * Create a new resolver structure - * \return ldns_resolver* pointer to new strcture - */ -ldns_resolver* ldns_resolver_new(void); - -/** - * Create a resolver structure from a file like /etc/resolv.conf - * \param[out] r the new resolver - * \param[in] fp file pointer to create new resolver from - * if NULL use /etc/resolv.conf - * \return LDNS_STATUS_OK or the error - */ -ldns_status ldns_resolver_new_frm_fp(ldns_resolver **r, FILE *fp); - -/** - * Create a resolver structure from a file like /etc/resolv.conf - * \param[out] r the new resolver - * \param[in] fp file pointer to create new resolver from - * if NULL use /etc/resolv.conf - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \return LDNS_STATUS_OK or the error - */ -ldns_status ldns_resolver_new_frm_fp_l(ldns_resolver **r, FILE *fp, int *line_nr); - -/** - * Configure a resolver by means of a resolv.conf file - * The file may be NULL in which case there will be - * looked the RESOLV_CONF (defaults to /etc/resolv.conf - * \param[out] r the new resolver - * \param[in] filename the filename to use - * \return LDNS_STATUS_OK or the error - */ -ldns_status ldns_resolver_new_frm_file(ldns_resolver **r, const char *filename); - -/** - * Frees the allocated space for this resolver. Only frees the resolver pionter! You should probably be using _deep_free. - * \param res resolver to free - */ -void ldns_resolver_free(ldns_resolver *res); - -/** - * Frees the allocated space for this resolver and all it's data - * \param res resolver to free - */ -void ldns_resolver_deep_free(ldns_resolver *res); - -/** - * Get the next stream of RRs in a AXFR - * \param[in] resolver the resolver to use. First ldns_axfr_start() must be - * called - * \return ldns_rr the next RR from the AXFR stream - * After you get this returned RR (not NULL: on error), then check if - * ldns_axfr_complete() is true to see if the zone transfer has completed. - */ -ldns_rr* ldns_axfr_next(ldns_resolver *resolver); - -/** - * Returns true if the axfr transfer has completed (i.e. 2 SOA RRs and no errors were encountered - * \param[in] resolver the resolver that is used - * \return bool true if axfr transfer was completed without error - */ -bool ldns_axfr_complete(const ldns_resolver *resolver); - -/** - * Returns a pointer to the last ldns_pkt that was sent by the server in the AXFR transfer - * uasable for instance to get the error code on failure - * \param[in] res the resolver that was used in the axfr transfer - * \return ldns_pkt the last packet sent - */ -ldns_pkt *ldns_axfr_last_pkt(const ldns_resolver *res); - -/** - * Randomize the nameserver list in the resolver - * \param[in] r the resolver - */ -void ldns_resolver_nameservers_randomize(ldns_resolver *r); - -/** - * Returns true if at least one of the provided keys is a trust anchor - * \param[in] r the current resolver - * \param[in] keys the keyset to check - * \param[out] trusted_keys the subset of trusted keys in the 'keys' rrset - * \return true if at least one of the provided keys is a configured trust anchor - */ -bool ldns_resolver_trusted_key(const ldns_resolver *r, ldns_rr_list * keys, ldns_rr_list * trusted_keys); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_RESOLVER_H */ diff --git a/libs/ldns/ldns/rr.h b/libs/ldns/ldns/rr.h deleted file mode 100644 index 86e31de1f2..0000000000 --- a/libs/ldns/ldns/rr.h +++ /dev/null @@ -1,885 +0,0 @@ -/* - * rr.h - resource record definitions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Contains the definition of ldns_rr and functions to manipulate those. - */ - - -#ifndef LDNS_RR_H -#define LDNS_RR_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** Maximum length of a dname label */ -#define LDNS_MAX_LABELLEN 63 -/** Maximum length of a complete dname */ -#define LDNS_MAX_DOMAINLEN 255 -/** Maximum number of pointers in 1 dname */ -#define LDNS_MAX_POINTERS 65535 -/** The bytes TTL, CLASS and length use up in an rr */ -#define LDNS_RR_OVERHEAD 10 - -/* The first fields are 'common' and can be referenced instantly */ -#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 52 - - - -/** - * The different RR classes. - */ -enum ldns_enum_rr_class -{ - /** the Internet */ - LDNS_RR_CLASS_IN = 1, - /** Chaos class */ - LDNS_RR_CLASS_CH = 3, - /** Hesiod (Dyer 87) */ - LDNS_RR_CLASS_HS = 4, - /** None class, dynamic update */ - LDNS_RR_CLASS_NONE = 254, - /** Any class */ - LDNS_RR_CLASS_ANY = 255, - - LDNS_RR_CLASS_FIRST = 0, - LDNS_RR_CLASS_LAST = 65535, - LDNS_RR_CLASS_COUNT = LDNS_RR_CLASS_LAST - LDNS_RR_CLASS_FIRST + 1 -}; -typedef enum ldns_enum_rr_class ldns_rr_class; - -/** - * Used to specify whether compression is allowed. - */ -enum ldns_enum_rr_compress -{ - /** compression is allowed */ - LDNS_RR_COMPRESS, - LDNS_RR_NO_COMPRESS -}; -typedef enum ldns_enum_rr_compress ldns_rr_compress; - -/** - * The different RR types. - */ -enum ldns_enum_rr_type -{ - /** a host address */ - LDNS_RR_TYPE_A = 1, - /** an authoritative name server */ - LDNS_RR_TYPE_NS = 2, - /** a mail destination (Obsolete - use MX) */ - LDNS_RR_TYPE_MD = 3, - /** a mail forwarder (Obsolete - use MX) */ - LDNS_RR_TYPE_MF = 4, - /** the canonical name for an alias */ - LDNS_RR_TYPE_CNAME = 5, - /** marks the start of a zone of authority */ - LDNS_RR_TYPE_SOA = 6, - /** a mailbox domain name (EXPERIMENTAL) */ - LDNS_RR_TYPE_MB = 7, - /** a mail group member (EXPERIMENTAL) */ - LDNS_RR_TYPE_MG = 8, - /** a mail rename domain name (EXPERIMENTAL) */ - LDNS_RR_TYPE_MR = 9, - /** a null RR (EXPERIMENTAL) */ - LDNS_RR_TYPE_NULL = 10, - /** a well known service description */ - LDNS_RR_TYPE_WKS = 11, - /** a domain name pointer */ - LDNS_RR_TYPE_PTR = 12, - /** host information */ - LDNS_RR_TYPE_HINFO = 13, - /** mailbox or mail list information */ - LDNS_RR_TYPE_MINFO = 14, - /** mail exchange */ - LDNS_RR_TYPE_MX = 15, - /** text strings */ - LDNS_RR_TYPE_TXT = 16, - /** RFC1183 */ - LDNS_RR_TYPE_RP = 17, - /** RFC1183 */ - LDNS_RR_TYPE_AFSDB = 18, - /** RFC1183 */ - LDNS_RR_TYPE_X25 = 19, - /** RFC1183 */ - LDNS_RR_TYPE_ISDN = 20, - /** RFC1183 */ - LDNS_RR_TYPE_RT = 21, - /** RFC1706 */ - LDNS_RR_TYPE_NSAP = 22, - /** RFC1348 */ - LDNS_RR_TYPE_NSAP_PTR = 23, - /** 2535typecode */ - LDNS_RR_TYPE_SIG = 24, - /** 2535typecode */ - LDNS_RR_TYPE_KEY = 25, - /** RFC2163 */ - LDNS_RR_TYPE_PX = 26, - /** RFC1712 */ - LDNS_RR_TYPE_GPOS = 27, - /** ipv6 address */ - LDNS_RR_TYPE_AAAA = 28, - /** LOC record RFC1876 */ - LDNS_RR_TYPE_LOC = 29, - /** 2535typecode */ - LDNS_RR_TYPE_NXT = 30, - /** draft-ietf-nimrod-dns-01.txt */ - LDNS_RR_TYPE_EID = 31, - /** draft-ietf-nimrod-dns-01.txt */ - LDNS_RR_TYPE_NIMLOC = 32, - /** SRV record RFC2782 */ - LDNS_RR_TYPE_SRV = 33, - /** http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */ - LDNS_RR_TYPE_ATMA = 34, - /** RFC2915 */ - LDNS_RR_TYPE_NAPTR = 35, - /** RFC2230 */ - LDNS_RR_TYPE_KX = 36, - /** RFC2538 */ - LDNS_RR_TYPE_CERT = 37, - /** RFC2874 */ - LDNS_RR_TYPE_A6 = 38, - /** RFC2672 */ - LDNS_RR_TYPE_DNAME = 39, - /** dnsind-kitchen-sink-02.txt */ - LDNS_RR_TYPE_SINK = 40, - /** Pseudo OPT record... */ - LDNS_RR_TYPE_OPT = 41, - /** RFC3123 */ - LDNS_RR_TYPE_APL = 42, - /** draft-ietf-dnsext-delegation */ - LDNS_RR_TYPE_DS = 43, - /** SSH Key Fingerprint */ - LDNS_RR_TYPE_SSHFP = 44, - /** draft-richardson-ipseckey-rr-11.txt */ - LDNS_RR_TYPE_IPSECKEY = 45, - /** draft-ietf-dnsext-dnssec-25 */ - LDNS_RR_TYPE_RRSIG = 46, - LDNS_RR_TYPE_NSEC = 47, - LDNS_RR_TYPE_DNSKEY = 48, - LDNS_RR_TYPE_DHCID = 49, - - LDNS_RR_TYPE_NSEC3 = 50, - LDNS_RR_TYPE_NSEC3PARAMS = 51, - - /** draft-ietf-dnsop-trust-history */ - LDNS_RR_TYPE_TALINK = 58, - - LDNS_RR_TYPE_SPF = 99, - - LDNS_RR_TYPE_UINFO = 100, - LDNS_RR_TYPE_UID = 101, - LDNS_RR_TYPE_GID = 102, - LDNS_RR_TYPE_UNSPEC = 103, - - LDNS_RR_TYPE_TSIG = 250, - LDNS_RR_TYPE_IXFR = 251, - LDNS_RR_TYPE_AXFR = 252, - /** A request for mailbox-related records (MB, MG or MR) */ - LDNS_RR_TYPE_MAILB = 253, - /** A request for mail agent RRs (Obsolete - see MX) */ - LDNS_RR_TYPE_MAILA = 254, - /** any type (wildcard) */ - LDNS_RR_TYPE_ANY = 255, - - /* RFC 4431, 5074, DNSSEC Lookaside Validation */ - LDNS_RR_TYPE_DLV = 32769, - - /* type codes from nsec3 experimental phase - LDNS_RR_TYPE_NSEC3 = 65324, - LDNS_RR_TYPE_NSEC3PARAMS = 65325, */ - LDNS_RR_TYPE_FIRST = 0, - LDNS_RR_TYPE_LAST = 65535, - LDNS_RR_TYPE_COUNT = LDNS_RR_TYPE_LAST - LDNS_RR_TYPE_FIRST + 1 -}; -typedef enum ldns_enum_rr_type ldns_rr_type; - -/** - * Resource Record - * - * This is the basic DNS element that contains actual data - * - * From RFC1035: - *
-3.2.1. Format
-
-All RRs have the same top level format shown below:
-
-                                    1  1  1  1  1  1
-      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                                               |
-    /                                               /
-    /                      NAME                     /
-    |                                               |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                      TYPE                     |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                     CLASS                     |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                      TTL                      |
-    |                                               |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-    |                   RDLENGTH                    |
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
-    /                     RDATA                     /
-    /                                               /
-    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
-
-where:
-
-NAME            an owner name, i.e., the name of the node to which this
-                resource record pertains.
-
-TYPE            two octets containing one of the RR TYPE codes.
-
-CLASS           two octets containing one of the RR CLASS codes.
-
-TTL             a 32 bit signed integer that specifies the time interval
-                that the resource record may be cached before the source
-                of the information should again be consulted.  Zero
-                values are interpreted to mean that the RR can only be
-                used for the transaction in progress, and should not be
-                cached.  For example, SOA records are always distributed
-                with a zero TTL to prohibit caching.  Zero values can
-                also be used for extremely volatile data.
-
-RDLENGTH        an unsigned 16 bit integer that specifies the length in
-                octets of the RDATA field.
-
-RDATA           a variable length string of octets that describes the
-                resource.  The format of this information varies
-                according to the TYPE and CLASS of the resource record.
- * 
- * - * The actual amount and type of rdata fields depend on the RR type of the - * RR, and can be found by using \ref ldns_rr_descriptor functions. - */ -struct ldns_struct_rr -{ - /** Owner name, uncompressed */ - ldns_rdf *_owner; - /** Time to live */ - uint32_t _ttl; - /** Number of data fields */ - size_t _rd_count; - /** the type of the RR. A, MX etc. */ - ldns_rr_type _rr_type; - /** Class of the resource record. */ - ldns_rr_class _rr_class; - /* everything in the rdata is in network order */ - /** The array of rdata's */ - ldns_rdf **_rdata_fields; - /** question rr [it would be nicer if thous is after _rd_count] - ABI change: Fix this in next major release - */ - bool _rr_question; -}; -typedef struct ldns_struct_rr ldns_rr; - -/** - * List or Set of Resource Records - * - * Contains a list of rr's
- * No official RFC-like checks are made - */ -struct ldns_struct_rr_list -{ - size_t _rr_count; - size_t _rr_capacity; - ldns_rr **_rrs; -}; -typedef struct ldns_struct_rr_list ldns_rr_list; - -/** - * Contains all information about resource record types. - * - * This structure contains, for all rr types, the rdata fields that are defined. - */ -struct ldns_struct_rr_descriptor -{ - /** Type of the RR that is described here */ - ldns_rr_type _type; - /** Textual name of the RR type. */ - const char *_name; - /** Minimum number of rdata fields in the RRs of this type. */ - uint8_t _minimum; - /** Maximum number of rdata fields in the RRs of this type. */ - uint8_t _maximum; - /** Wireformat specification for the rr, i.e. the types of rdata fields in their respective order. */ - const ldns_rdf_type *_wireformat; - /** Special rdf types */ - ldns_rdf_type _variable; - /** Specifies whether compression can be used for dnames in this RR type. */ - ldns_rr_compress _compress; - /** The number of DNAMEs in the _wireformat string, for parsing. */ - uint8_t _dname_count; -}; -typedef struct ldns_struct_rr_descriptor ldns_rr_descriptor; - -/** - * creates a new rr structure. - * \return ldns_rr * - */ -ldns_rr* ldns_rr_new(void); - -/** - * creates a new rr structure, based on the given type. - * alloc enough space to hold all the rdf's - */ -ldns_rr* ldns_rr_new_frm_type(ldns_rr_type t); - -/** - * frees an RR structure - * \param[in] *rr the RR to be freed - * \return void - */ -void ldns_rr_free(ldns_rr *rr); - -/** - * creates an rr from a string. - * The string should be a fully filled-in rr, like - * ownername <space> TTL <space> CLASS <space> - * TYPE <space> RDATA. - * \param[out] n the rr to return - * \param[in] str the string to convert - * \param[in] default_ttl default ttl value for the rr. - * If 0 DEF_TTL will be used - * \param[in] origin when the owner is relative add this. - * The caller must ldns_rdf_deep_free it. - * \param[out] prev the previous ownername. if this value is not NULL, - * the function overwrites this with the ownername found in this - * string. The caller must then ldns_rdf_deep_free it. - * \return a status msg describing an error or LDNS_STATUS_OK - */ -ldns_status ldns_rr_new_frm_str(ldns_rr **n, const char *str, - uint32_t default_ttl, ldns_rdf *origin, - ldns_rdf **prev); - -/** - * creates an rr for the question section from a string, i.e. - * without RDATA fields - * Origin and previous RR functionality are the same as in - * ldns_rr_new_frm_str() - * \param[out] n the rr to return - * \param[in] str the string to convert - * \param[in] origin when the owner is relative add this. - * The caller must ldns_rdf_deep_free it. - * \param prev the previous ownername. the function overwrite this with - * the current found ownername. The caller must ldns_rdf_deep_free it. - * \return a status msg describing an error or LDNS_STATUS_OK - */ -ldns_status ldns_rr_new_question_frm_str(ldns_rr **n, const char *str, - ldns_rdf *origin, ldns_rdf **prev); - -/** - * creates a new rr from a file containing a string. - * \param[out] rr the new rr - * \param[in] fp the file pointer to use - * \param[in] default_ttl pointer to a default ttl for the rr. If NULL DEF_TTL will be used - * the pointer will be updated if the file contains a $TTL directive - * \param[in] origin when the owner is relative add this - * the pointer will be updated if the file contains a $ORIGIN directive - * The caller must ldns_rdf_deep_free it. - * \param[in] prev when the owner is whitespaces use this as the * ownername - * the pointer will be updated after the call - * The caller must ldns_rdf_deep_free it. - * \return a ldns_status with an error or LDNS_STATUS_OK - */ -ldns_status ldns_rr_new_frm_fp(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev); - -/** - * creates a new rr from a file containing a string. - * \param[out] rr the new rr - * \param[in] fp the file pointer to use - * \param[in] default_ttl a default ttl for the rr. If NULL DEF_TTL will be used - * the pointer will be updated if the file contains a $TTL directive - * \param[in] origin when the owner is relative add this - * the pointer will be updated if the file contains a $ORIGIN directive - * The caller must ldns_rdf_deep_free it. - * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) - * \param[in] prev when the owner is whitespaces use this as the * ownername - * the pointer will be updated after the call - * The caller must ldns_rdf_deep_free it. - * \return a ldns_status with an error or LDNS_STATUS_OK - */ -ldns_status ldns_rr_new_frm_fp_l(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr); - -/** - * sets the owner in the rr structure. - * \param[in] *rr rr to operate on - * \param[in] *owner set to this owner - * \return void - */ -void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner); - -/** - * sets the question flag in the rr structure. - * \param[in] *rr rr to operate on - * \param[in] question question flag - * \return void - */ -void ldns_rr_set_question(ldns_rr *rr, bool question); - -/** - * sets the ttl in the rr structure. - * \param[in] *rr rr to operate on - * \param[in] ttl set to this ttl - * \return void - */ -void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl); - -/** - * sets the rd_count in the rr. - * \param[in] *rr rr to operate on - * \param[in] count set to this count - * \return void - */ -void ldns_rr_set_rd_count(ldns_rr *rr, size_t count); - -/** - * sets the type in the rr. - * \param[in] *rr rr to operate on - * \param[in] rr_type set to this type - * \return void - */ -void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type); - -/** - * sets the class in the rr. - * \param[in] *rr rr to operate on - * \param[in] rr_class set to this class - * \return void - */ -void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class); - -/** - * sets a rdf member, it will be set on the - * position given. The old value is returned, like pop. - * \param[in] *rr the rr to operate on - * \param[in] *f the rdf to set - * \param[in] position the position the set the rdf - * \return the old value in the rr, NULL on failyre - */ -ldns_rdf* ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position); - -/** - * sets rd_field member, it will be - * placed in the next available spot. - * \param[in] *rr rr to operate on - * \param[in] *f the data field member to set - * \return bool - */ -bool ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f); - -/** - * removes a rd_field member, it will be - * popped from the last position. - * \param[in] *rr rr to operate on - * \return rdf which was popped (null if nothing) - */ -ldns_rdf* ldns_rr_pop_rdf(ldns_rr *rr); - -/** - * returns the rdata field member counter. - * \param[in] *rr rr to operate on - * \param[in] nr the number of the rdf to return - * \return ldns_rdf * - */ -ldns_rdf* ldns_rr_rdf(const ldns_rr *rr, size_t nr); - -/** - * returns the owner name of an rr structure. - * \param[in] *rr rr to operate on - * \return ldns_rdf * - */ -ldns_rdf* ldns_rr_owner(const ldns_rr *rr); - -/** - * returns the question flag of an rr structure. - * \param[in] *rr rr to operate on - * \return bool true if question - */ -bool ldns_rr_is_question(const ldns_rr *rr); - -/** - * returns the ttl of an rr structure. - * \param[in] *rr the rr to read from - * \return the ttl of the rr - */ -uint32_t ldns_rr_ttl(const ldns_rr *rr); - -/** - * returns the rd_count of an rr structure. - * \param[in] *rr the rr to read from - * \return the rd count of the rr - */ -size_t ldns_rr_rd_count(const ldns_rr *rr); - -/** - * returns the type of the rr. - * \param[in] *rr the rr to read from - * \return the type of the rr - */ -ldns_rr_type ldns_rr_get_type(const ldns_rr *rr); - -/** - * returns the class of the rr. - * \param[in] *rr the rr to read from - * \return the class of the rr - */ -ldns_rr_class ldns_rr_get_class(const ldns_rr *rr); - -/* rr_lists */ - -/** - * returns the number of rr's in an rr_list. - * \param[in] rr_list the rr_list to read from - * \return the number of rr's - */ -size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list); - -/** - * sets the number of rr's in an rr_list. - * \param[in] rr_list the rr_list to set the count on - * \param[in] count the number of rr in this list - * \return void - */ -void ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count); - -/** - * set a rr on a specific index in a ldns_rr_list - * \param[in] rr_list the rr_list to use - * \param[in] r the rr to set - * \param[in] count index into the rr_list - * \return the old rr which was stored in the rr_list, or - * NULL is the index was too large - * set a specific rr */ -ldns_rr * ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count); - -/** - * returns a specific rr of an rrlist. - * \param[in] rr_list the rr_list to read from - * \param[in] nr return this rr - * \return the rr at position nr - */ -ldns_rr* ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr); - -/** - * creates a new rr_list structure. - * \return a new rr_list structure - */ -ldns_rr_list* ldns_rr_list_new(); - -/** - * frees an rr_list structure. - * \param[in] rr_list the list to free - */ -void ldns_rr_list_free(ldns_rr_list *rr_list); - -/** - * frees an rr_list structure and all rrs contained therein. - * \param[in] rr_list the list to free - */ -void ldns_rr_list_deep_free(ldns_rr_list *rr_list); - -/** - * concatenates two ldns_rr_lists together. This modifies - * *left (to extend it and add the pointers from *right). - * \param[in] left the leftside - * \param[in] right the rightside - * \return a left with right concatenated to it - */ -bool ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right); - -/** - * concatenates two ldns_rr_lists together, but makes clones of the rr's - * (instead of pointer copying). - * \param[in] left the leftside - * \param[in] right the rightside - * \return a new rr_list with leftside/rightside concatenated - */ -ldns_rr_list* ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right); - -/** - * pushes an rr to an rrlist. - * \param[in] rr_list the rr_list to push to - * \param[in] rr the rr to push - * \return false on error, otherwise true - */ -bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr); - -/** - * pushes an rr_list to an rrlist. - * \param[in] rr_list the rr_list to push to - * \param[in] push_list the rr_list to push - * \return false on error, otherwise true - */ -bool ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list); - -/** - * pops the last rr from an rrlist. - * \param[in] rr_list the rr_list to pop from - * \return NULL if nothing to pop. Otherwise the popped RR - */ -ldns_rr* ldns_rr_list_pop_rr(ldns_rr_list *rr_list); - -/** - * pops an rr_list of size s from an rrlist. - * \param[in] rr_list the rr_list to pop from - * \param[in] size the number of rr's to pop - * \return NULL if nothing to pop. Otherwise the popped rr_list - */ -ldns_rr_list* ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t size); - -/** - * returns true if the given rr is one of the rrs in the - * list, or if it is equal to one - * \param[in] rr_list the rr_list to check - * \param[in] rr the rr to check - * \return true if rr_list contains rr, false otherwise - */ -bool ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr); - -/** - * checks if an rr_list is a rrset. - * \param[in] rr_list the rr_list to check - * \return true if it is an rrset otherwise false - */ -bool ldns_is_rrset(ldns_rr_list *rr_list); - -/** - * pushes an rr to an rrset (which really are rr_list's). - * \param[in] *rr_list the rrset to push the rr to - * \param[in] *rr the rr to push - * \return true if the push succeeded otherwise false - */ -bool ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr); - -/** - * pops the last rr from an rrset. This function is there only - * for the symmetry. - * \param[in] rr_list the rr_list to pop from - * \return NULL if nothing to pop. Otherwise the popped RR - * - */ -ldns_rr* ldns_rr_set_pop_rr(ldns_rr_list *rr_list); - -/** - * pops the first rrset from the list, - * the list must be sorted, so that all rr's from each rrset - * are next to each other - */ -ldns_rr_list *ldns_rr_list_pop_rrset(ldns_rr_list *rr_list); - - -/** - * retrieves a rrtype by looking up its name. - * \param[in] name a string with the name - * \return the type which corresponds with the name - */ -ldns_rr_type ldns_get_rr_type_by_name(const char *name); - -/** - * retrieves a class by looking up its name. - * \param[in] name string with the name - * \return the cass which corresponds with the name - */ -ldns_rr_class ldns_get_rr_class_by_name(const char *name); - -/** - * clones a rr and all its data - * \param[in] rr the rr to clone - * \return the new rr or NULL on failure - */ -ldns_rr* ldns_rr_clone(const ldns_rr *rr); - -/** - * clones an rrlist. - * \param[in] rrlist the rrlist to clone - * \return the cloned rr list - */ -ldns_rr_list* ldns_rr_list_clone(const ldns_rr_list *rrlist); - -/** - * sorts an rr_list (canonical wire format). the sorting is done inband. - * \param[in] unsorted the rr_list to be sorted - * \return void - */ -void ldns_rr_list_sort(ldns_rr_list *unsorted); - -/** - * compares two rrs. The TTL is not looked at. - * \param[in] rr1 the first one - * \param[in] rr2 the second one - * \return 0 if equal - * -1 if rr1 comes before rr2 - * +1 if rr2 comes before rr1 - */ -int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2); - -/** - * compares two rrs, up to the rdata. - * \param[in] rr1 the first one - * \param[in] rr2 the second one - * \return 0 if equal - * -1 if rr1 comes before rr2 - * +1 if rr2 comes before rr1 - */ -int ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2); - -/** - * compares the wireformat of two rrs, contained in the given buffers. - * \param[in] rr1_buf the first one - * \param[in] rr2_buf the second one - * \return 0 if equal - * -1 if rr1_buf comes before rr2_buf - * +1 if rr2_buf comes before rr1_buf - */ -int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf); - -/** - * returns true of the given rr's are equal. - * Also returns true if one record is a DS that represents the - * same DNSKEY record as the other record - * \param[in] rr1 the first rr - * \param[in] rr2 the second rr - * \return true if equal otherwise false - */ -bool ldns_rr_compare_ds(const ldns_rr *rr1, const ldns_rr *rr2); - -/** - * compares two rr listss. - * \param[in] rrl1 the first one - * \param[in] rrl2 the second one - * \return 0 if equal - * -1 if rrl1 comes before rrl2 - * +1 if rrl2 comes before rrl1 - */ -int ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2); - -/** - * calculates the uncompressed size of an RR. - * \param[in] r the rr to operate on - * \return size of the rr - */ -size_t ldns_rr_uncompressed_size(const ldns_rr *r); - -/** - * converts each dname in a rr to its canonical form. - * \param[in] rr the rr to work on - * \return void - */ -void ldns_rr2canonical(ldns_rr *rr); - -/** - * converts each dname in each rr in a rr_list to its canonical form. - * \param[in] rr_list the rr_list to work on - * \return void - */ -void ldns_rr_list2canonical(ldns_rr_list *rr_list); - -/** - * counts the number of labels of the ownername. - * \param[in] rr count the labels of this rr - * \return the number of labels - */ -uint8_t ldns_rr_label_count(ldns_rr *rr); - -/** - * returns the resource record descriptor for the given rr type. - * - * \param[in] type the type value of the rr type - *\return the ldns_rr_descriptor for this type - */ -const ldns_rr_descriptor *ldns_rr_descript(uint16_t type); - -/** - * returns the minimum number of rdata fields of the rr type this descriptor describes. - * - * \param[in] descriptor for an rr type - * \return the minimum number of rdata fields - */ -size_t ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor); - -/** - * returns the maximum number of rdata fields of the rr type this descriptor describes. - * - * \param[in] descriptor for an rr type - * \return the maximum number of rdata fields - */ -size_t ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor); - -/** - * returns the rdf type for the given rdata field number of the rr type for the given descriptor. - * - * \param[in] descriptor for an rr type - * \param[in] field the field number - * \return the rdf type for the field - */ -ldns_rdf_type ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, size_t field); - -/** - * Return the rr_list which matches the rdf at position field. Think - * type-covered stuff for RRSIG - * - * \param[in] l the rr_list to look in - * \param[in] r the rdf to use for the comparison - * \param[in] pos at which position can we find the rdf - * - * \return a new rr list with only the RRs that match - * - */ -ldns_rr_list *ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos); - -/** - * convert an rdf of type LDNS_RDF_TYPE_TYPE to an actual - * LDNS_RR_TYPE. This is usefull in the case when inspecting - * the rrtype covered field of an RRSIG. - * \param[in] rd the rdf to look at - * \return a ldns_rr_type with equivalent LDNS_RR_TYPE - * - */ -ldns_rr_type ldns_rdf2rr_type(const ldns_rdf *rd); - -/** - * Returns the type of the first element of the RR - * If there are no elements present, 0 is returned - * - * \param[in] rr_list The rr list - * \return rr_type of the first element, or 0 if the list is empty - */ -ldns_rr_type -ldns_rr_list_type(const ldns_rr_list *rr_list); - -/** - * Returns the owner domain name rdf of the first element of the RR - * If there are no elements present, NULL is returned - * - * \param[in] rr_list The rr list - * \return dname of the first element, or NULL if the list is empty - */ -ldns_rdf * -ldns_rr_list_owner(const ldns_rr_list *rr_list); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_RR_H */ diff --git a/libs/ldns/ldns/rr_functions.h b/libs/ldns/ldns/rr_functions.h deleted file mode 100644 index 635a1256f3..0000000000 --- a/libs/ldns/ldns/rr_functions.h +++ /dev/null @@ -1,259 +0,0 @@ -/* - * rr_functions.h - * - * the .h file with defs for the per rr - * functions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ -#ifndef LDNS_RR_FUNCTIONS_H -#define LDNS_RR_FUNCTIONS_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \file - * - * Defines some extra convenience functions for ldns_rr structures - */ - -/* A / AAAA */ -/** - * returns the address of a LDNS_RR_TYPE_A rr - * \param[in] r the resource record - * \return a ldns_rdf* with the address or NULL on failure - */ -ldns_rdf* ldns_rr_a_address(const ldns_rr *r); - -/** - * sets the address of a LDNS_RR_TYPE_A rr - * \param[in] r the rr to use - * \param[in] f the address to set - * \return true on success, false otherwise - */ -bool ldns_rr_a_set_address(ldns_rr *r, ldns_rdf *f); - -/* NS */ -/** - * returns the name of a LDNS_RR_TYPE_NS rr - * \param[in] r the resource record - * \return a ldns_rdf* with the name or NULL on failure - */ -ldns_rdf* ldns_rr_ns_nsdname(const ldns_rr *r); - -/* MX */ -/** - * returns the mx pref. of a LDNS_RR_TYPE_MX rr - * \param[in] r the resource record - * \return a ldns_rdf* with the preference or NULL on failure - */ -ldns_rdf* ldns_rr_mx_preference(const ldns_rr *r); -/** - * returns the mx host of a LDNS_RR_TYPE_MX rr - * \param[in] r the resource record - * \return a ldns_rdf* with the name of the MX host or NULL on failure - */ -ldns_rdf* ldns_rr_mx_exchange(const ldns_rr *r); - -/* RRSIG */ -/** - * returns the type covered of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the resource record - * \return a ldns_rdf* with the type covered or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_typecovered(const ldns_rr *r); -/** - * sets the typecovered of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the typecovered to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_typecovered(ldns_rr *r, ldns_rdf *f); -/** - * returns the algorithm of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the algorithm or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_algorithm(const ldns_rr *r); -/** - * sets the algorithm of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the algorithm to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_algorithm(ldns_rr *r, ldns_rdf *f); -/** - * returns the number of labels of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the number of labels or NULL on failure - */ -ldns_rdf *ldns_rr_rrsig_labels(const ldns_rr *r); -/** - * sets the number of labels of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the number of labels to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_labels(ldns_rr *r, ldns_rdf *f); -/** - * returns the original TTL of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the original TTL or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_origttl(const ldns_rr *r); -/** - * sets the original TTL of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the original TTL to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_origttl(ldns_rr *r, ldns_rdf *f); -/** - * returns the expiration time of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the expiration time or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_expiration(const ldns_rr *r); -/** - * sets the expireation date of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the expireation date to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_expiration(ldns_rr *r, ldns_rdf *f); -/** - * returns the inception time of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the inception time or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_inception(const ldns_rr *r); -/** - * sets the inception date of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the inception date to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_inception(ldns_rr *r, ldns_rdf *f); -/** - * returns the keytag of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the keytag or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_keytag(const ldns_rr *r); -/** - * sets the keytag of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the keytag to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_keytag(ldns_rr *r, ldns_rdf *f); -/** - * returns the signers name of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the signers name or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_signame(const ldns_rr *r); -/** - * sets the signers name of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the signers name to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_signame(ldns_rr *r, ldns_rdf *f); -/** - * returns the signature data of a LDNS_RR_TYPE_RRSIG RR - * \param[in] r the resource record - * \return a ldns_rdf* with the signature data or NULL on failure - */ -ldns_rdf* ldns_rr_rrsig_sig(const ldns_rr *r); -/** - * sets the signature data of a LDNS_RR_TYPE_RRSIG rr - * \param[in] r the rr to use - * \param[in] f the signature data to set - * \return true on success, false otherwise - */ -bool ldns_rr_rrsig_set_sig(ldns_rr *r, ldns_rdf *f); - -/* DNSKEY */ -/** - * returns the flags of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the resource record - * \return a ldns_rdf* with the flags or NULL on failure - */ -ldns_rdf* ldns_rr_dnskey_flags(const ldns_rr *r); -/** - * sets the flags of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the rr to use - * \param[in] f the flags to set - * \return true on success, false otherwise - */ -bool ldns_rr_dnskey_set_flags(ldns_rr *r, ldns_rdf *f); -/** - * returns the protocol of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the resource record - * \return a ldns_rdf* with the protocol or NULL on failure - */ -ldns_rdf* ldns_rr_dnskey_protocol(const ldns_rr *r); -/** - * sets the protocol of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the rr to use - * \param[in] f the protocol to set - * \return true on success, false otherwise - */ -bool ldns_rr_dnskey_set_protocol(ldns_rr *r, ldns_rdf *f); -/** - * returns the algorithm of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the resource record - * \return a ldns_rdf* with the algorithm or NULL on failure - */ -ldns_rdf* ldns_rr_dnskey_algorithm(const ldns_rr *r); -/** - * sets the algorithm of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the rr to use - * \param[in] f the algorithm to set - * \return true on success, false otherwise - */ -bool ldns_rr_dnskey_set_algorithm(ldns_rr *r, ldns_rdf *f); -/** - * returns the key data of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the resource record - * \return a ldns_rdf* with the key data or NULL on failure - */ -ldns_rdf* ldns_rr_dnskey_key(const ldns_rr *r); -/** - * sets the key data of a LDNS_RR_TYPE_DNSKEY rr - * \param[in] r the rr to use - * \param[in] f the key data to set - * \return true on success, false otherwise - */ -bool ldns_rr_dnskey_set_key(ldns_rr *r, ldns_rdf *f); - -/** - * get the length of the keydata in bits - * \param[in] keydata the raw key data - * \param[in] len the length of the keydata - * \param[in] alg the cryptographic algorithm this is a key for - * \return the keysize in bits, or 0 on error - */ -size_t ldns_rr_dnskey_key_size_raw(const unsigned char *keydata, - const size_t len, - const ldns_algorithm alg); - -/** - * get the length of the keydata in bits - * \param[in] key the key rr to use - * \return the keysize in bits - */ -size_t ldns_rr_dnskey_key_size(const ldns_rr *key); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_RR_FUNCTIONS_H */ diff --git a/libs/ldns/ldns/sha1.h b/libs/ldns/ldns/sha1.h deleted file mode 100644 index d5b1082e67..0000000000 --- a/libs/ldns/ldns/sha1.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef LDNS_SHA1_H -#define LDNS_SHA1_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define LDNS_SHA1_BLOCK_LENGTH 64 -#define LDNS_SHA1_DIGEST_LENGTH 20 - -typedef struct { - uint32_t state[5]; - uint64_t count; - unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]; -} ldns_sha1_ctx; - -void ldns_sha1_init(ldns_sha1_ctx * context); -void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]); -void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len); -void ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context); - -/** - * Convenience function to digest a fixed block of data at once. - * - * \param[in] data the data to digest - * \param[in] data_len the length of data in bytes - * \param[out] digest the length of data in bytes - * This pointer MUST have LDNS_SHA1_DIGEST_LENGTH bytes - * available - * \return the SHA1 digest of the given data - */ -unsigned char *ldns_sha1(unsigned char *data, unsigned int data_len, unsigned char *digest); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_SHA1_H */ diff --git a/libs/ldns/ldns/sha2.h b/libs/ldns/ldns/sha2.h deleted file mode 100644 index beb0b6f368..0000000000 --- a/libs/ldns/ldns/sha2.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * FILE: sha2.h - * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ - * - * Copyright (c) 2000-2001, Aaron D. Gifford - * All rights reserved. - * - * Modified by Jelte Jansen to fit in ldns, and not clash with any - * system-defined SHA code. - * Changes: - * - Renamed (external) functions and constants to fit ldns style - * - Removed uintXX vs. u_intXX smartness, since ldns needs uintXX - * anyway - * - BYTE ORDER check replaced by simple ifdef as defined or not by - * configure.ac - * - Removed _End and _Data functions - * - Added ldns_shaX(data, len, digest) functions - * - * 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. Neither the name of the copyright holder nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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. - * - * $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ - */ - -#ifndef __LDNS_SHA2_H__ -#define __LDNS_SHA2_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -/* - * Import u_intXX_t size_t type definitions from system headers. You - * may need to change this, or define these things yourself in this - * file. - * - * (include ldns/config.h so HAVE_INTTYPES is defined (or not, depending - * on the system)) - */ -#include - -#ifdef HAVE_INTTYPES_H - -#include - -#endif /* HAVE_INTTYPES_H */ - - -/*** SHA-256/384/512 Various Length Definitions ***********************/ -#define LDNS_SHA256_BLOCK_LENGTH 64 -#define LDNS_SHA256_DIGEST_LENGTH 32 -#define LDNS_SHA256_DIGEST_STRING_LENGTH (LDNS_SHA256_DIGEST_LENGTH * 2 + 1) -#define LDNS_SHA384_BLOCK_LENGTH 128 -#define LDNS_SHA384_DIGEST_LENGTH 48 -#define LDNS_SHA384_DIGEST_STRING_LENGTH (LDNS_SHA384_DIGEST_LENGTH * 2 + 1) -#define LDNS_SHA512_BLOCK_LENGTH 128 -#define LDNS_SHA512_DIGEST_LENGTH 64 -#define LDNS_SHA512_DIGEST_STRING_LENGTH (LDNS_SHA512_DIGEST_LENGTH * 2 + 1) - - -/*** SHA-256/384/512 Context Structures *******************************/ - -typedef struct _ldns_sha256_CTX { - uint32_t state[8]; - uint64_t bitcount; - uint8_t buffer[LDNS_SHA256_BLOCK_LENGTH]; -} ldns_sha256_CTX; -typedef struct _ldns_sha512_CTX { - uint64_t state[8]; - uint64_t bitcount[2]; - uint8_t buffer[LDNS_SHA512_BLOCK_LENGTH]; -} ldns_sha512_CTX; - -typedef ldns_sha512_CTX ldns_sha384_CTX; - - -/*** SHA-256/384/512 Function Prototypes ******************************/ -void ldns_sha256_init(ldns_sha256_CTX *); -void ldns_sha256_update(ldns_sha256_CTX*, const uint8_t*, size_t); -void ldns_sha256_final(uint8_t[LDNS_SHA256_DIGEST_LENGTH], ldns_sha256_CTX*); - -void ldns_sha384_init(ldns_sha384_CTX*); -void ldns_sha384_update(ldns_sha384_CTX*, const uint8_t*, size_t); -void ldns_sha384_final(uint8_t[LDNS_SHA384_DIGEST_LENGTH], ldns_sha384_CTX*); - -void ldns_sha512_init(ldns_sha512_CTX*); -void ldns_sha512_update(ldns_sha512_CTX*, const uint8_t*, size_t); -void ldns_sha512_final(uint8_t[LDNS_SHA512_DIGEST_LENGTH], ldns_sha512_CTX*); - -/** - * Convenience function to digest a fixed block of data at once. - * - * \param[in] data the data to digest - * \param[in] data_len the length of data in bytes - * \param[out] digest the length of data in bytes - * This pointer MUST have LDNS_SHA256_DIGEST_LENGTH bytes - * available - * \return the SHA1 digest of the given data - */ -unsigned char *ldns_sha256(unsigned char *data, unsigned int data_len, unsigned char *digest); - -/** - * Convenience function to digest a fixed block of data at once. - * - * \param[in] data the data to digest - * \param[in] data_len the length of data in bytes - * \param[out] digest the length of data in bytes - * This pointer MUST have LDNS_SHA384_DIGEST_LENGTH bytes - * available - * \return the SHA1 digest of the given data - */ -unsigned char *ldns_sha384(unsigned char *data, unsigned int data_len, unsigned char *digest); - -/** - * Convenience function to digest a fixed block of data at once. - * - * \param[in] data the data to digest - * \param[in] data_len the length of data in bytes - * \param[out] digest the length of data in bytes - * This pointer MUST have LDNS_SHA512_DIGEST_LENGTH bytes - * available - * \return the SHA1 digest of the given data - */ -unsigned char *ldns_sha512(unsigned char *data, unsigned int data_len, unsigned char *digest); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __LDNS_SHA2_H__ */ diff --git a/libs/ldns/ldns/str2host.h b/libs/ldns/ldns/str2host.h deleted file mode 100644 index 09416cd225..0000000000 --- a/libs/ldns/ldns/str2host.h +++ /dev/null @@ -1,251 +0,0 @@ -/** - * str2host.h - conversion from str to the host fmt - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -#ifndef LDNS_2HOST_H -#define LDNS_2HOST_H - -#include -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \file - * - * Defines functions to convert dns data in presentation format or text files - * to internal structures. - */ - -/** - * convert a byte into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] bytestr the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr); - -/** - * convert a string to a int16 in wireformat - * \param[in] rd the rdf where to put the data - * \param[in] shortstr the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr); - -/** - * convert a strings into a 4 byte int in wireformat - * \param[in] rd the rdf where to put the data - * \param[in] longstr the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr); - -/** - * convert a time string to a time value in wireformat - * \param[in] rd the rdf where to put the data - * \param[in] time the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_time(ldns_rdf **rd, const char *time); - -/* convert string with NSEC3 salt to wireformat) - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * return ldns_status - */ -ldns_status ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *nsec3_salt); - -/* convert a time period (think TTL's) to wireformat) - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * return ldns_status - */ -ldns_status ldns_str2rdf_period(ldns_rdf **rd, const char *str); - -/** - * convert str with an A record into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_a(ldns_rdf **rd, const char *str); - -/** - * convert the str with an AAAA record into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str); - -/** - * convert a string into wireformat (think txt record) - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted (NULL terminated) - * \return ldns_status - */ -ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str); - -/** - * convert str with the apl record into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_apl(ldns_rdf **rd, const char *str); - -/** - * convert the string with the b64 data into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_b64(ldns_rdf **rd, const char *str); - -/** - * convert the string with the b32 ext hex data into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str); - -/** - * convert a hex value into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_hex(ldns_rdf **rd, const char *str); - -/** - * convert string with nsec into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_nsec(ldns_rdf **rd, const char *str); - -/** - * convert a rrtype into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_type(ldns_rdf **rd, const char *str); - -/** - * convert string with a classname into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_class(ldns_rdf **rd, const char *str); - -/** - * convert an certificate algorithm value into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str); - -/** - * convert and algorithm value into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_alg(ldns_rdf **rd, const char *str); - -/** - * convert a string with a unknown RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str); - -/** - * convert string with a tsig? RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str); - -/** - * convert string with a protocol service into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_service(ldns_rdf **rd, const char *str); - -/** - * convert a string with a LOC RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_loc(ldns_rdf **rd, const char *str); - -/** - * convert string with a WKS RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_wks(ldns_rdf **rd, const char *str); - -/** - * convert a str with a NSAP RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str); - -/** - * convert a str with a ATMA RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_atma(ldns_rdf **rd, const char *str); - -/** - * convert a str with a IPSECKEY RR into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str); - -/** - * convert a dname string into wireformat - * \param[in] rd the rdf where to put the data - * \param[in] str the string to be converted - * \return ldns_status - */ -ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_2HOST_H */ diff --git a/libs/ldns/ldns/tsig.h b/libs/ldns/ldns/tsig.h deleted file mode 100644 index 676045fbb6..0000000000 --- a/libs/ldns/ldns/tsig.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * tsig.h -- defines for TSIG [RFC2845] - * - * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. - */ - -#ifndef LDNS_TSIG_H -#define LDNS_TSIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \file - * - * Defines functions for TSIG usage - */ - - -/** - * Contains credentials for TSIG -*/ -typedef struct ldns_tsig_credentials_struct -{ - char *algorithm; - char *keyname; - char *keydata; - /* XXX More eventually. */ -} ldns_tsig_credentials; - -char *ldns_tsig_algorithm(ldns_tsig_credentials *); -char *ldns_tsig_keyname(ldns_tsig_credentials *); -char *ldns_tsig_keydata(ldns_tsig_credentials *); -char *ldns_tsig_keyname_clone(ldns_tsig_credentials *); -char *ldns_tsig_keydata_clone(ldns_tsig_credentials *); - -/** - * verifies the tsig rr for the given packet and key. - * The wire must be given too because tsig does not sign normalized packets. - * \param[in] pkt the packet to verify - * \param[in] wire needed to verify the mac - * \param[in] wire_size size of wire - * \param[in] key_name the name of the shared key - * \param[in] key_data the key in base 64 format - * \param[in] mac original mac - * \return true if tsig is correct, false if not, or if tsig is not set - */ -bool ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac); - -/** - * verifies the tsig rr for the given packet and key. - * The wire must be given too because tsig does not sign normalized packets. - * \param[in] pkt the packet to verify - * \param[in] wire needed to verify the mac - * \param[in] wire_size size of wire - * \param[in] key_name the name of the shared key - * \param[in] key_data the key in base 64 format - * \param[in] mac original mac - * \param[in] tsig_timers_only must be zero for the first packet and positive for subsequent packets. If zero, all digest - components are used to verify the _mac. If non-zero, only the TSIG timers are used to verify the mac. - * \return true if tsig is correct, false if not, or if tsig is not set - */ -bool ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac, - int tsig_timers_only); - -/** - * creates a tsig rr for the given packet and key. - * \param[in] pkt the packet to sign - * \param[in] key_name the name of the shared key - * \param[in] key_data the key in base 64 format - * \param[in] fudge seconds of error permitted in time signed - * \param[in] algorithm_name the name of the algorithm used - * \param[in] query_mac is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers) - * \return status (OK if success) - */ -ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, - const char *algorithm_name, ldns_rdf *query_mac); - -/** - * creates a tsig rr for the given packet and key. - * \param[in] pkt the packet to sign - * \param[in] key_name the name of the shared key - * \param[in] key_data the key in base 64 format - * \param[in] fudge seconds of error permitted in time signed - * \param[in] algorithm_name the name of the algorithm used - * \param[in] query_mac is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers) - * \param[in] tsig_timers_only must be zero for the first packet and positive for subsequent packets. If zero, all digest - components are used to create the query_mac. If non-zero, only the TSIG timers are used to create the query_mac. - * \return status (OK if success) - */ -ldns_status ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, - const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_TSIG_H */ diff --git a/libs/ldns/ldns/update.h b/libs/ldns/ldns/update.h deleted file mode 100644 index d3459d325e..0000000000 --- a/libs/ldns/ldns/update.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * update.h - * - * Functions for RFC 2136 Dynamic Update - * - * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. - */ - -/** - * \file - * - * Defines functions to perform UPDATE queries - */ - - -#ifndef LDNS_UPDATE_H -#define LDNS_UPDATE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * create an update packet from zone name, class and the rr lists - * \param[in] zone_rdf name of the zone - * \param[in] clas zone class - * \param[in] pr_rrlist list of Prerequisite Section RRs - * \param[in] up_rrlist list of Updates Section RRs - * \param[in] ad_rrlist list of Additional Data Section RRs (currently unused) - * \return the new packet - */ -ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist); - -/** - * add tsig credentials to - * a packet from a resolver - * \param[in] p packet to copy to - * \param[in] r resolver to copy from - * - * \return status wether successfull or not - */ -ldns_status ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r); - -/* access functions */ - -/** - * Get the zo count - * \param[in] p the packet - * \return the zo count - */ -uint16_t ldns_update_zocount(const ldns_pkt *p); -/** - * Get the zo count - * \param[in] p the packet - * \return the pr count - */ -uint16_t ldns_update_prcount(const ldns_pkt *p); -/** - * Get the zo count - * \param[in] p the packet - * \return the up count - */ -uint16_t ldns_update_upcount(const ldns_pkt *p); -/** - * Get the zo count - * \param[in] p the packet - * \return the ad count - */ -uint16_t ldns_update_ad(const ldns_pkt *p); -/** - * Set the zo count - * \param[in] p the packet - * \param[in] c the zo count to set - */ -void ldns_update_set_zo(ldns_pkt *p, uint16_t c); -/** - * Set the pr count - * \param[in] p the packet - * \param[in] c the pr count to set - */ -void ldns_update_set_prcount(ldns_pkt *p, uint16_t c); -/** - * Set the up count - * \param[in] p the packet - * \param[in] c the up count to set - */ -void ldns_update_set_upcount(ldns_pkt *p, uint16_t c); -/** - * Set the ad count - * \param[in] p the packet - * \param[in] c the ad count to set - */ -void ldns_update_set_adcount(ldns_pkt *p, uint16_t c); - -/* soa functions that need to be configured */ -/* - * Not sure if we want to keep these like this, therefore - * not documented - */ -ldns_status ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, ldns_rr_class c, ldns_rdf **mname); -/* - * Not sure if we want to keep these like this, therefore - * not documented - */ -ldns_status ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, ldns_rr_class c, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_UPDATE_H */ diff --git a/libs/ldns/ldns/util.h.in b/libs/ldns/ldns/util.h.in deleted file mode 100644 index e9af95f673..0000000000 --- a/libs/ldns/ldns/util.h.in +++ /dev/null @@ -1,347 +0,0 @@ -/* - * util.h - * - * helper function header file - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004 - * - * See the file LICENSE for the license - */ - -#ifndef _UTIL_H -#define _UTIL_H - -@include_inttypes_h@ -@include_systypes_h@ -@include_unistd_h@ -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define dprintf(X,Y) fprintf(stderr, (X), (Y)) -/* #define dprintf(X, Y) */ - -#define LDNS_VERSION "@PACKAGE_VERSION@" -#define LDNS_REVISION ((@LDNS_VERSION_MAJOR@<<16)|(@LDNS_VERSION_MINOR@<<8)|(@LDNS_VERSION_MICRO@)) - -/** - * splint static inline workaround - */ -#ifdef S_SPLINT_S -# define INLINE -#else -# ifdef SWIG -# define INLINE static -# else -# define INLINE static inline -# endif -#endif - -/** - * Memory management macros - */ -#define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1) - -#define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type))) - -#define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1) - -#define LDNS_XREALLOC(ptr, type, count) \ - ((type *) realloc((ptr), (count) * sizeof(type))) - -#define LDNS_FREE(ptr) \ - do { free((ptr)); (ptr) = NULL; } while (0) - -#define LDNS_DEP printf("DEPRECATED FUNCTION!\n"); - -/* - * Copy data allowing for unaligned accesses in network byte order - * (big endian). - */ -INLINE uint16_t -ldns_read_uint16(const void *src) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - return ntohs(*(uint16_t *) src); -#else - uint8_t *p = (uint8_t *) src; - return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; -#endif -} - -INLINE uint32_t -ldns_read_uint32(const void *src) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - return ntohl(*(uint32_t *) src); -#else - uint8_t *p = (uint8_t *) src; - return ( ((uint32_t) p[0] << 24) - | ((uint32_t) p[1] << 16) - | ((uint32_t) p[2] << 8) - | (uint32_t) p[3]); -#endif -} - -/* - * Copy data allowing for unaligned accesses in network byte order - * (big endian). - */ -INLINE void -ldns_write_uint16(void *dst, uint16_t data) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - * (uint16_t *) dst = htons(data); -#else - uint8_t *p = (uint8_t *) dst; - p[0] = (uint8_t) ((data >> 8) & 0xff); - p[1] = (uint8_t) (data & 0xff); -#endif -} - -INLINE void -ldns_write_uint32(void *dst, uint32_t data) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - * (uint32_t *) dst = htonl(data); -#else - uint8_t *p = (uint8_t *) dst; - p[0] = (uint8_t) ((data >> 24) & 0xff); - p[1] = (uint8_t) ((data >> 16) & 0xff); - p[2] = (uint8_t) ((data >> 8) & 0xff); - p[3] = (uint8_t) (data & 0xff); -#endif -} - -/* warning. */ -INLINE void -ldns_write_uint64_as_uint48(void *dst, uint64_t data) -{ - uint8_t *p = (uint8_t *) dst; - p[0] = (uint8_t) ((data >> 40) & 0xff); - p[1] = (uint8_t) ((data >> 32) & 0xff); - p[2] = (uint8_t) ((data >> 24) & 0xff); - p[3] = (uint8_t) ((data >> 16) & 0xff); - p[4] = (uint8_t) ((data >> 8) & 0xff); - p[5] = (uint8_t) (data & 0xff); -} - - -/** - * Structure to do a Schwartzian-like transformation, for instance when - * sorting. If you need a transformation on the objects that are sorted, - * you can sue this to store the transformed values, so you do not - * need to do the transformation again for each comparison - */ -struct ldns_schwartzian_compare_struct { - void *original_object; - void *transformed_object; -}; - -/** A general purpose lookup table - * - * Lookup tables are arrays of (id, name) pairs, - * So you can for instance lookup the RCODE 3, which is "NXDOMAIN", - * and vice versa. The lookup tables themselves are defined wherever needed, - * for instance in \ref host2str.c - */ -struct ldns_struct_lookup_table { - int id; - const char *name; -}; -typedef struct ldns_struct_lookup_table ldns_lookup_table; - -/** - * Looks up the table entry by name, returns NULL if not found. - * \param[in] table the lookup table to search in - * \param[in] name what to search for - * \return the item found - */ -ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[], - const char *name); - -/** - * Looks up the table entry by id, returns NULL if not found. - * \param[in] table the lookup table to search in - * \param[in] id what to search for - * \return the item found - */ -ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id); - -/** - * Returns the value of the specified bit - * The bits are counted from left to right, so bit #0 is the - * left most bit. - * \param[in] bits array holding the bits - * \param[in] index to the wanted bit - * \return - */ -int ldns_get_bit(uint8_t bits[], size_t index); - - -/** - * Returns the value of the specified bit - * The bits are counted from right to left, so bit #0 is the - * right most bit. - * \param[in] bits array holding the bits - * \param[in] index to the wanted bit - * \return 1 or 0 depending no the bit state - */ -int ldns_get_bit_r(uint8_t bits[], size_t index); - -/** - * sets the specified bit in the specified byte to - * 1 if value is true, 0 if false - * The bits are counted from right to left, so bit #0 is the - * right most bit. - * \param[in] byte the bit to set the bit in - * \param[in] bit_nr the bit to set (0 <= n <= 7) - * \param[in] value whether to set the bit to 1 or 0 - * \return 1 or 0 depending no the bit state - */ -void ldns_set_bit(uint8_t *byte, int bit_nr, bool value); - -/** - * Returns the value of a to the power of b - * (or 1 of b < 1) - */ -/*@unused@*/ -INLINE long -ldns_power(long a, long b) { - long result = 1; - while (b > 0) { - if (b & 1) { - result *= a; - if (b == 1) { - return result; - } - } - a *= a; - b /= 2; - } - return result; -} - -/** - * Returns the int value of the given (hex) digit - * \param[in] ch the hex char to convert - * \return the converted decimal value - */ -int ldns_hexdigit_to_int(char ch); - -/** - * Returns the char (hex) representation of the given int - * \param[in] ch the int to convert - * \return the converted hex char - */ -char ldns_int_to_hexdigit(int ch); - -/** - * Converts a hex string to binary data - * - * \param[out] data The binary result is placed here. - * At least strlen(str)/2 bytes should be allocated - * \param[in] str The hex string to convert. - * This string should not contain spaces - * \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number - */ -int -ldns_hexstring_to_data(uint8_t *data, const char *str); - -/** - * Show the internal library version - * \return a string with the version in it - */ -const char * ldns_version(void); - -/** - * Convert TM to seconds since epoch (midnight, January 1st, 1970). - * Like timegm(3), which is not always available. - * \param[in] tm a struct tm* with the date - * \return the seconds since epoch - */ -time_t mktime_from_utc(const struct tm *tm); - -/** - * Seed the random function. - * If the file descriptor is specified, the random generator is seeded with - * data from that file. If not, /dev/urandom is used. - * - * applications should call this if they need entropy data within ldns - * If openSSL is available, it is automatically seeded from /dev/urandom - * or /dev/random. - * - * If you need more entropy, or have no openssl available, this function - * MUST be called at the start of the program - * - * If openssl *is* available, this function just adds more entropy - * - * \param[in] fd a file providing entropy data for the seed - * \param[in] size the number of bytes to use as entropy data. If this is 0, - * only the minimal amount is taken (usually 4 bytes) - * \return 0 if seeding succeeds, 1 if it fails - */ -int ldns_init_random(FILE *fd, unsigned int size); - -/** - * Get random number. - * \return random number. - * - */ -uint16_t ldns_get_random(void); - -/** - * Encode data as BubbleBabble - * - * \param[in] data a pointer to data to be encoded - * \param[in] len size the number of bytes of data - * \return a string of BubbleBabble - */ -char *ldns_bubblebabble(uint8_t *data, size_t len); - -#ifndef B32_NTOP -int ldns_b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -/** - * calculates the size needed to store the result of b32_ntop - */ -/*@unused@*/ -INLINE size_t ldns_b32_ntop_calculate_size(size_t srcsize) -{ - size_t result = ((((srcsize / 5) * 8) - 2) + 2); - return result; -} -#endif /* !B32_NTOP */ -#ifndef B32_PTON -int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -/** - * calculates the size needed to store the result of b32_pton - */ -/*@unused@*/ -INLINE size_t ldns_b32_pton_calculate_size(size_t srcsize) -{ - size_t result = ((((srcsize) / 8) * 5)); - return result; -} -#endif /* !B32_PTON */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_UTIL_H */ diff --git a/libs/ldns/ldns/wire2host.h b/libs/ldns/ldns/wire2host.h deleted file mode 100644 index 53155b3066..0000000000 --- a/libs/ldns/ldns/wire2host.h +++ /dev/null @@ -1,197 +0,0 @@ -/* - * wire2host.h - from wire conversion routines - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Contains functions that translate dns data from the wire format (as sent - * by servers and clients) to the internal structures. - */ - -#ifndef LDNS_WIRE2HOST_H -#define LDNS_WIRE2HOST_H - -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* The length of the header */ -#define LDNS_HEADER_SIZE 12 - -/* First octet of flags */ -#define LDNS_RD_MASK 0x01U -#define LDNS_RD_SHIFT 0 -#define LDNS_RD_WIRE(wirebuf) (*(wirebuf+2) & LDNS_RD_MASK) -#define LDNS_RD_SET(wirebuf) (*(wirebuf+2) |= LDNS_RD_MASK) -#define LDNS_RD_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_RD_MASK) - -#define LDNS_TC_MASK 0x02U -#define LDNS_TC_SHIFT 1 -#define LDNS_TC_WIRE(wirebuf) (*(wirebuf+2) & LDNS_TC_MASK) -#define LDNS_TC_SET(wirebuf) (*(wirebuf+2) |= LDNS_TC_MASK) -#define LDNS_TC_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_TC_MASK) - -#define LDNS_AA_MASK 0x04U -#define LDNS_AA_SHIFT 2 -#define LDNS_AA_WIRE(wirebuf) (*(wirebuf+2) & LDNS_AA_MASK) -#define LDNS_AA_SET(wirebuf) (*(wirebuf+2) |= LDNS_AA_MASK) -#define LDNS_AA_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_AA_MASK) - -#define LDNS_OPCODE_MASK 0x78U -#define LDNS_OPCODE_SHIFT 3 -#define LDNS_OPCODE_WIRE(wirebuf) ((*(wirebuf+2) & LDNS_OPCODE_MASK) >> LDNS_OPCODE_SHIFT) -#define LDNS_OPCODE_SET(wirebuf, opcode) \ - (*(wirebuf+2) = ((*(wirebuf+2)) & ~LDNS_OPCODE_MASK) | ((opcode) << LDNS_OPCODE_SHIFT)) - -#define LDNS_QR_MASK 0x80U -#define LDNS_QR_SHIFT 7 -#define LDNS_QR_WIRE(wirebuf) (*(wirebuf+2) & LDNS_QR_MASK) -#define LDNS_QR_SET(wirebuf) (*(wirebuf+2) |= LDNS_QR_MASK) -#define LDNS_QR_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_QR_MASK) - -/* Second octet of flags */ -#define LDNS_RCODE_MASK 0x0fU -#define LDNS_RCODE_SHIFT 0 -#define LDNS_RCODE_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RCODE_MASK) -#define LDNS_RCODE_SET(wirebuf, rcode) \ - (*(wirebuf+3) = ((*(wirebuf+3)) & ~LDNS_RCODE_MASK) | (rcode)) - -#define LDNS_CD_MASK 0x10U -#define LDNS_CD_SHIFT 4 -#define LDNS_CD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_CD_MASK) -#define LDNS_CD_SET(wirebuf) (*(wirebuf+3) |= LDNS_CD_MASK) -#define LDNS_CD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_CD_MASK) - -#define LDNS_AD_MASK 0x20U -#define LDNS_AD_SHIFT 5 -#define LDNS_AD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_AD_MASK) -#define LDNS_AD_SET(wirebuf) (*(wirebuf+3) |= LDNS_AD_MASK) -#define LDNS_AD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_AD_MASK) - -#define LDNS_Z_MASK 0x40U -#define LDNS_Z_SHIFT 6 -#define LDNS_Z_WIRE(wirebuf) (*(wirebuf+3) & LDNS_Z_MASK) -#define LDNS_Z_SET(wirebuf) (*(wirebuf+3) |= LDNS_Z_MASK) -#define LDNS_Z_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_Z_MASK) - -#define LDNS_RA_MASK 0x80U -#define LDNS_RA_SHIFT 7 -#define LDNS_RA_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RA_MASK) -#define LDNS_RA_SET(wirebuf) (*(wirebuf+3) |= LDNS_RA_MASK) -#define LDNS_RA_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_RA_MASK) - -/* Query ID */ -#define LDNS_ID_WIRE(wirebuf) (ldns_read_uint16(wirebuf)) -#define LDNS_ID_SET(wirebuf, id) (ldns_write_uint16(wirebuf, id)) - -/* Counter of the question section */ -#define LDNS_QDCOUNT_OFF 4 -/* -#define QDCOUNT(wirebuf) (ntohs(*(uint16_t *)(wirebuf+QDCOUNT_OFF))) -*/ -#define LDNS_QDCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_QDCOUNT_OFF)) - -/* Counter of the answer section */ -#define LDNS_ANCOUNT_OFF 6 -#define LDNS_ANCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ANCOUNT_OFF)) - -/* Counter of the authority section */ -#define LDNS_NSCOUNT_OFF 8 -#define LDNS_NSCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_NSCOUNT_OFF)) - -/* Counter of the additional section */ -#define LDNS_ARCOUNT_OFF 10 -#define LDNS_ARCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF)) - -/** - * converts the data on the uint8_t bytearray (in wire format) to a DNS packet. - * This function will initialize and allocate memory space for the packet - * structure. - * - * \param[in] packet pointer to the structure to hold the packet - * \param[in] data pointer to the buffer with the data - * \param[in] len the length of the data buffer (in bytes) - * \return LDNS_STATUS_OK if everything succeeds, error otherwise - */ -ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t len); - -/** - * converts the data on the uint8_t bytearray (in wire format) to a DNS packet. - * This function will initialize and allocate memory space for the packet - * structure. - * - * \param[in] packet pointer to the structure to hold the packet - * \param[in] buffer the buffer with the data - * \return LDNS_STATUS_OK if everything succeeds, error otherwise - */ -ldns_status ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer); - -/** - * converts the data on the uint8_t bytearray (in wire format) to a DNS - * dname rdata field. This function will initialize and allocate memory - * space for the dname structure. The length of the wiredata of this rdf - * is added to the *pos value. - * - * \param[in] dname pointer to the structure to hold the rdata value - * \param[in] wire pointer to the buffer with the data - * \param[in] max the length of the data buffer (in bytes) - * \param[in] pos the position of the rdf in the buffer (ie. the number of bytes - * from the start of the buffer) - * \return LDNS_STATUS_OK if everything succeeds, error otherwise - */ -ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos); - -/** - * converts the data on the uint8_t bytearray (in wire format) to DNS - * rdata fields, and adds them to the list of rdfs of the given rr. - * This function will initialize and allocate memory space for the dname - * structures. - * The length of the wiredata of these rdfs is added to the *pos value. - * - * All rdfs belonging to the RR are read; the rr should have no rdfs - * yet. An error is returned if the format cannot be parsed. - * - * \param[in] rr pointer to the ldns_rr structure to hold the rdata value - * \param[in] wire pointer to the buffer with the data - * \param[in] max the length of the data buffer (in bytes) - * \param[in] pos the position of the rdf in the buffer (ie. the number of bytes - * from the start of the buffer) - * \return LDNS_STATUS_OK if everything succeeds, error otherwise - */ -ldns_status ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos); - -/** - * converts the data on the uint8_t bytearray (in wire format) to a DNS - * resource record. - * This function will initialize and allocate memory space for the rr - * structure. - * The length of the wiredata of this rr is added to the *pos value. - * - * \param[in] rr pointer to the structure to hold the rdata value - * \param[in] wire pointer to the buffer with the data - * \param[in] max the length of the data buffer (in bytes) - * \param[in] pos the position of the rr in the buffer (ie. the number of bytes - * from the start of the buffer) - * \param[in] section the section in the packet the rr is meant for - * \return LDNS_STATUS_OK if everything succeeds, error otherwise - */ -ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_WIRE2HOST_H */ diff --git a/libs/ldns/ldns/zone.h b/libs/ldns/ldns/zone.h deleted file mode 100644 index a683ea87e0..0000000000 --- a/libs/ldns/ldns/zone.h +++ /dev/null @@ -1,175 +0,0 @@ -/** - * zone.h - * - * zone definitions - * - what is it - * - get_glue function - * - search etc - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * - * See the file LICENSE for the license - */ - -/** - * \file - * - * Defines the ldns_zone structure and functions to manipulate it. - */ - - -#ifndef LDNS_ZONE_H -#define LDNS_ZONE_H - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * DNS Zone - * - * A list of RR's with some - * extra information which comes from the SOA RR - * Note: nothing has been done to make this efficient (yet). - */ -struct ldns_struct_zone -{ - /** the soa defines a zone */ - ldns_rr *_soa; - /* basicly a zone is a list of rr's */ - ldns_rr_list *_rrs; - /* we could change this to be a b-tree etc etc todo */ -}; -typedef struct ldns_struct_zone ldns_zone; - -/** - * create a new ldns_zone structure - * \return a pointer to a ldns_zone structure - */ -ldns_zone * ldns_zone_new(void); - -/** - * Return the soa record of a zone - * \param[in] z the zone to read from - * \return the soa record in the zone - */ -ldns_rr * ldns_zone_soa(const ldns_zone *z); - -/** - * Returns the number of resource records in the zone, NOT counting the SOA record - * \param[in] z the zone to read from - * \return the number of rr's in the zone - */ -size_t ldns_zone_rr_count(const ldns_zone *z); - -/** - * Set the zone's soa record - * \param[in] z the zone to put the new soa in - * \param[in] soa the soa to set - */ -void ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa); - -/** - * Get a list of a zone's content. Note that the SOA - * isn't included in this list. You need to get the - * with ldns_zone_soa. - * \param[in] z the zone to read from - * \return the rrs from this zone - */ -ldns_rr_list * ldns_zone_rrs(const ldns_zone *z); - -/** - * Set the zone's contents - * \param[in] z the zone to put the new soa in - * \param[in] rrlist the rrlist to use - */ -void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist); - -/** - * push an rrlist to a zone structure. This function use pointer - * copying, so the rr_list structure inside z is modified! - * \param[in] z the zone to add to - * \param[in] list the list to add - * \return a true on succes otherwise falsed - */ -bool ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list); - -/** - * push an single rr to a zone structure. This function use pointer - * copying, so the rr_list structure inside z is modified! - * \param[in] z the zone to add to - * \param[in] rr the rr to add - * \return a true on succes otherwise falsed - */ -bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr); - -/** - * Retrieve all resource records from the zone that are glue - * records. The resulting list does are pointer references - * to the zone's data. - * - * Due to the current zone implementation (as a list of rr's), this - * function is extremely slow. Another (probably better) way to do this - * is to use an ldns_dnssec_zone structure and the mark_glue function - * - * \param[in] z the zone to look for glue - * \return the rr_list with the glue - */ -ldns_rr_list *ldns_zone_glue_rr_list(const ldns_zone *z); - -/** - * Create a new zone from a file - * \param[out] z the new zone - * \param[in] *fp the filepointer to use - * \param[in] *origin the zones' origin - * \param[in] ttl default ttl to use - * \param[in] c default class to use (IN) - * - * \return ldns_status mesg with an error or LDNS_STATUS_OK - */ -ldns_status ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c); - -/** - * Create a new zone from a file, keep track of the line numbering - * \param[out] z the new zone - * \param[in] *fp the filepointer to use - * \param[in] *origin the zones' origin - * \param[in] ttl default ttl to use - * \param[in] c default class to use (IN) - * \param[out] line_nr used for error msg, to get to the line number - * - * \return ldns_status mesg with an error or LDNS_STATUS_OK - */ -ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c, int *line_nr); - -/** - * Frees the allocated memory for the zone, and the rr_list structure in it - * \param[in] zone the zone to free - */ -void ldns_zone_free(ldns_zone *zone); - -/** - * Frees the allocated memory for the zone, the soa rr in it, - * and the rr_list structure in it, including the rr's in that. etc. - * \param[in] zone the zone to free - */ -void ldns_zone_deep_free(ldns_zone *zone); - -/** - * Sort the rrs in a zone, with the current impl. this is slow - * \param[in] zone the zone to sort - */ -void ldns_zone_sort(ldns_zone *zone); - -#ifdef __cplusplus -} -#endif - -#endif /* LDNS_ZONE_H */ diff --git a/libs/ldns/ldns_symbols.def b/libs/ldns/ldns_symbols.def deleted file mode 100644 index 7b80bf6952..0000000000 --- a/libs/ldns/ldns_symbols.def +++ /dev/null @@ -1,733 +0,0 @@ -ldns_algorithm2buffer_str -ldns_algorithms -ldns_axfr_complete -ldns_axfr_last_pkt -ldns_axfr_next -ldns_axfr_start -ldns_b32_ntop -ldns_b32_ntop_ar -ldns_b32_ntop_extended_hex -ldns_b32_pton -ldns_b32_pton_ar -ldns_b32_pton_extended_hex -ldns_b64_ntop -ldns_b64_pton -ldns_bgetc -ldns_bget_keyword_data -ldns_bget_token -ldns_bskipc -ldns_bskipcs -ldns_bubblebabble -ldns_buffer2pkt_wire -ldns_buffer2str -ldns_buffer_copy -ldns_buffer_export -ldns_buffer_free -ldns_buffer_new -ldns_buffer_new_frm_data -ldns_buffer_printf -ldns_buffer_reserve -ldns_buffer_set_capacity -ldns_calc_keytag -ldns_calc_keytag_raw -ldns_cert_algorithm2buffer_str -ldns_cert_algorithms -ldns_convert_ecdsa_rrsig_asn12rdf -ldns_convert_ecdsa_rrsig_rdf2asn1 -ldns_convert_dsa_rrsig_asn12rdf -ldns_convert_dsa_rrsig_rdf2asn1 -ldns_create_empty_rrsig -ldns_create_nsec -ldns_create_nsec3 -ldns_directive_types -ldns_dname2buffer_wire -ldns_dname2canonical -ldns_dname_cat -ldns_dname_cat_clone -ldns_dname_clone_from -ldns_dname_compare -ldns_dname_compare_v -ldns_dname_interval -ldns_dname_is_subdomain -ldns_dname_is_wildcard -ldns_dname_label -ldns_dname_label_count -ldns_dname_left_chop -ldns_dname_match_wildcard -ldns_dname_new -ldns_dname_new_frm_data -ldns_dname_new_frm_str -ldns_dname_reverse -ldns_dname_str_absolute -ldns_dnssec_build_data_chain -ldns_dnssec_build_data_chain_nokeyname -ldns_dnssec_chain_nsec3_list -ldns_dnssec_create_nsec -ldns_dnssec_create_nsec3 -ldns_dnssec_create_nsec_bitmap -ldns_dnssec_data_chain_deep_free -ldns_dnssec_data_chain_free -ldns_dnssec_data_chain_new -ldns_dnssec_data_chain_print -ldns_dnssec_default_add_to_signatures -ldns_dnssec_default_delete_signatures -ldns_dnssec_default_leave_signatures -ldns_dnssec_default_replace_signatures -ldns_dnssec_derive_trust_tree -ldns_dnssec_derive_trust_tree_dnskey_rrset -ldns_dnssec_derive_trust_tree_ds_rrset -ldns_dnssec_derive_trust_tree_normal_rrset -ldns_dnssec_derive_trust_tree_no_sig -ldns_dnssec_get_dnskey_for_rrsig -ldns_dnssec_get_rrsig_for_name_and_type -ldns_dnssec_name_add_rr -ldns_dnssec_name_cmp -ldns_dnssec_name_deep_free -ldns_dnssec_name_find_rrset -ldns_dnssec_name_free -ldns_dnssec_name_name -ldns_dnssec_name_new -ldns_dnssec_name_new_frm_rr -ldns_dnssec_name_node_deep_free -ldns_dnssec_name_node_free -ldns_dnssec_name_node_next_nonglue -ldns_dnssec_name_nsec -ldns_dnssec_name_print -ldns_dnssec_name_print_soa -ldns_dnssec_name_set_name -ldns_dnssec_name_set_nsec -ldns_dnssec_nsec3_closest_encloser -ldns_dnssec_pkt_get_rrsigs_for_name_and_type -ldns_dnssec_pkt_get_rrsigs_for_type -ldns_dnssec_pkt_has_rrsigs -ldns_dnssec_remove_signatures -ldns_dnssec_rrs_add_rr -ldns_dnssec_rrs_deep_free -ldns_dnssec_rrsets_add_rr -ldns_dnssec_rrsets_contains_type -ldns_dnssec_rrsets_deep_free -ldns_dnssec_rrsets_free -ldns_dnssec_rrsets_new -ldns_dnssec_rrsets_new_frm_rr -ldns_dnssec_rrsets_print -ldns_dnssec_rrsets_print_soa -ldns_dnssec_rrsets_set_type -ldns_dnssec_rrsets_type -ldns_dnssec_rrs_free -ldns_dnssec_rrs_new -ldns_dnssec_rrs_print -ldns_dnssec_trust_tree_add_parent -ldns_dnssec_trust_tree_contains_keys -ldns_dnssec_trust_tree_depth -ldns_dnssec_trust_tree_free -ldns_dnssec_trust_tree_new -ldns_dnssec_trust_tree_print -ldns_dnssec_trust_tree_print_sm -ldns_dnssec_verify_denial -ldns_dnssec_verify_denial_nsec3 -ldns_dnssec_zone_add_empty_nonterminals -ldns_dnssec_zone_add_rr -ldns_dnssec_zone_create_nsec3s -ldns_dnssec_zone_create_nsecs -ldns_dnssec_zone_create_rrsigs -ldns_dnssec_zone_create_rrsigs_flg -ldns_dnssec_zone_deep_free -ldns_dnssec_zone_find_nsec3_original -ldns_dnssec_zone_find_rrset -ldns_dnssec_zone_free -ldns_dnssec_zone_mark_glue -ldns_dnssec_zone_names_print -ldns_dnssec_zone_new -ldns_dnssec_zone_print -ldns_dnssec_zone_sign -ldns_dnssec_zone_sign_flg -ldns_dnssec_zone_sign_nsec3 -ldns_dnssec_zone_sign_nsec3_flg -ldns_ecdsa2pkey_raw -ldns_edns_flags -ldns_error_str -ldns_fetch_valid_domain_keys -ldns_fget_keyword_data -ldns_fget_keyword_data_l -ldns_fget_token -ldns_fget_token_l -ldns_fskipc -ldns_fskipcs -ldns_fskipcs_l -ldns_getaddrinfo -ldns_get_bit -ldns_get_bit_r -ldns_get_errorstr_by_id -ldns_get_random -ldns_get_rr_class_by_name -ldns_get_rr_list_addr_by_name -ldns_get_rr_list_hosts_frm_file -ldns_get_rr_list_hosts_frm_fp -ldns_get_rr_list_hosts_frm_fp_l -ldns_get_rr_list_name_by_addr -ldns_get_rr_type_by_name -ldns_get_signing_algorithm_by_name -ldns_gost2pkey_raw -ldns_digest_evp -ldns_key_EVP_load_gost_id -ldns_key_EVP_unload_gost -ldns_hexdigit_to_int -ldns_hexstring_to_data -ldns_init_random -ldns_int_to_hexdigit -ldns_is_rrset -ldns_key2buffer_str -ldns_key2rr -ldns_key2str -ldns_key_algo_supported -ldns_key_algorithm -ldns_key_buf2dsa -ldns_key_buf2dsa_raw -ldns_key_buf2rsa -ldns_key_buf2rsa_raw -ldns_key_deep_free -ldns_key_dsa_key -ldns_key_evp_key -ldns_key_expiration -ldns_key_external_key -ldns_key_flags -ldns_key_free -ldns_key_get_file_base_name -ldns_key_hmac_key -ldns_key_hmac_size -ldns_key_inception -ldns_key_keytag -ldns_key_list_free -ldns_key_list_key -ldns_key_list_key_count -ldns_key_list_new -ldns_key_list_pop_key -ldns_key_list_push_key -ldns_key_list_set_key_count -ldns_key_list_set_use -ldns_key_new -ldns_key_new_frm_algorithm -ldns_key_new_frm_engine -ldns_key_new_frm_fp -ldns_key_new_frm_fp_dsa -ldns_key_new_frm_fp_dsa_l -ldns_key_new_frm_fp_hmac -ldns_key_new_frm_fp_hmac_l -ldns_key_new_frm_fp_l -ldns_key_new_frm_fp_rsa -ldns_key_new_frm_fp_rsa_l -ldns_key_origttl -ldns_key_print -ldns_key_pubkey_owner -ldns_key_rr2ds -ldns_key_rsa_key -ldns_key_set_algorithm -ldns_key_set_dsa_key -ldns_key_set_evp_key -ldns_key_set_expiration -ldns_key_set_external_key -ldns_key_set_flags -ldns_key_set_hmac_key -ldns_key_set_hmac_size -ldns_key_set_inception -ldns_key_set_keytag -ldns_key_set_origttl -ldns_key_set_pubkey_owner -ldns_key_set_rsa_key -ldns_key_set_use -ldns_key_use -ldns_lookup_by_id -ldns_lookup_by_name -ldns_native2rdf_int16 -ldns_native2rdf_int16_data -ldns_native2rdf_int32 -ldns_native2rdf_int8 -ldns_nsec3_add_param_rdfs -ldns_nsec3_algorithm -ldns_nsec3_bitmap -ldns_nsec3_flags -ldns_nsec3_hash_name -ldns_nsec3_hash_name_frm_nsec3 -ldns_nsec3_iterations -ldns_nsec3_next_owner -ldns_nsec3_optout -ldns_nsec3_salt -ldns_nsec3_salt_data -ldns_nsec3_salt_length -ldns_nsec_bitmap_covers_type -ldns_nsec_covers_name -ldns_nsec_get_bitmap -ldns_nsec_type_check -ldns_octet -ldns_opcodes -ldns_pkt2buffer_str -ldns_pkt2buffer_wire -ldns_pkt2str -ldns_pkt2wire -ldns_pkt_aa -ldns_pkt_ad -ldns_pkt_additional -ldns_pkt_algorithm2str -ldns_pkt_all -ldns_pkt_all_noquestion -ldns_pkt_ancount -ldns_pkt_answer -ldns_pkt_answerfrom -ldns_pkt_arcount -ldns_pkt_authority -ldns_pkt_cd -ldns_pkt_cert_algorithm2str -ldns_pkt_clone -ldns_pkt_edns -ldns_pkt_edns_data -ldns_pkt_edns_do -ldns_pkt_edns_extended_rcode -ldns_pkt_edns_udp_size -ldns_pkt_edns_version -ldns_pkt_edns_z -ldns_pkt_empty -ldns_pkt_free -ldns_pkt_get_opcode -ldns_pkt_get_rcode -ldns_pkt_get_section_clone -ldns_pktheader2buffer_str -ldns_pkt_id -ldns_pkt_new -ldns_pkt_nscount -ldns_pkt_opcode2buffer_str -ldns_pkt_opcode2str -ldns_pkt_print -ldns_pkt_push_rr -ldns_pkt_push_rr_list -ldns_pkt_qdcount -ldns_pkt_qr -ldns_pkt_query_new -ldns_pkt_query_new_frm_str -ldns_pkt_querytime -ldns_pkt_question -ldns_pkt_ra -ldns_pkt_rcode2buffer_str -ldns_pkt_rcode2str -ldns_pkt_rd -ldns_pkt_reply_type -ldns_pkt_rr -ldns_pkt_rr_list_by_name -ldns_pkt_rr_list_by_name_and_type -ldns_pkt_rr_list_by_type -ldns_pkt_safe_push_rr -ldns_pkt_safe_push_rr_list -ldns_pkt_section_count -ldns_pkt_set_aa -ldns_pkt_set_ad -ldns_pkt_set_additional -ldns_pkt_set_ancount -ldns_pkt_set_answer -ldns_pkt_set_answerfrom -ldns_pkt_set_arcount -ldns_pkt_set_authority -ldns_pkt_set_cd -ldns_pkt_set_edns_data -ldns_pkt_set_edns_do -ldns_pkt_set_edns_extended_rcode -ldns_pkt_set_edns_udp_size -ldns_pkt_set_edns_version -ldns_pkt_set_edns_z -ldns_pkt_set_flags -ldns_pkt_set_id -ldns_pkt_set_nscount -ldns_pkt_set_opcode -ldns_pkt_set_qdcount -ldns_pkt_set_qr -ldns_pkt_set_querytime -ldns_pkt_set_question -ldns_pkt_set_ra -ldns_pkt_set_random_id -ldns_pkt_set_rcode -ldns_pkt_set_rd -ldns_pkt_set_section_count -ldns_pkt_set_size -ldns_pkt_set_tc -ldns_pkt_set_timestamp -ldns_pkt_set_tsig -ldns_pkt_size -ldns_pkt_tc -ldns_pkt_timestamp -ldns_pkt_tsig -ldns_pkt_tsig_sign -ldns_pkt_tsig_sign_next -ldns_pkt_tsig_verify -ldns_pkt_tsig_verify_next -ldns_pkt_verify -ldns_print_rr_rdf -ldns_rbtree_create -ldns_rbtree_delete -ldns_rbtree_find_less_equal -ldns_rbtree_first -ldns_rbtree_free -ldns_rbtree_init -ldns_rbtree_insert -ldns_rbtree_insert_vref -ldns_rbtree_join -ldns_rbtree_last -ldns_rbtree_next -ldns_rbtree_null_node -ldns_rbtree_previous -ldns_rbtree_search -ldns_rbtree_split -ldns_rcodes -ldns_rdf2buffer_str -ldns_rdf2buffer_str_a -ldns_rdf2buffer_str_aaaa -ldns_rdf2buffer_str_alg -ldns_rdf2buffer_str_apl -ldns_rdf2buffer_str_b32_ext -ldns_rdf2buffer_str_b64 -ldns_rdf2buffer_str_cert_alg -ldns_rdf2buffer_str_class -ldns_rdf2buffer_str_dname -ldns_rdf2buffer_str_hex -ldns_rdf2buffer_str_int16 -ldns_rdf2buffer_str_int16_data -ldns_rdf2buffer_str_int32 -ldns_rdf2buffer_str_int8 -ldns_rdf2buffer_str_ipseckey -ldns_rdf2buffer_str_loc -ldns_rdf2buffer_str_nsap -ldns_rdf2buffer_str_nsec -ldns_rdf2buffer_str_nsec3_salt -ldns_rdf2buffer_str_period -ldns_rdf2buffer_str_str -ldns_rdf2buffer_str_time -ldns_rdf2buffer_str_tsig -ldns_rdf2buffer_str_tsigtime -ldns_rdf2buffer_str_type -ldns_rdf2buffer_str_unknown -ldns_rdf2buffer_str_wks -ldns_rdf2buffer_wire -ldns_rdf2buffer_wire_canonical -ldns_rdf2native_int16 -ldns_rdf2native_int32 -ldns_rdf2native_int8 -ldns_rdf2native_sockaddr_storage -ldns_rdf2native_time_t -ldns_rdf2rr_type -ldns_rdf2str -ldns_rdf2wire -ldns_rdf_address_reverse -ldns_rdf_clone -ldns_rdf_compare -ldns_rdf_data -ldns_rdf_deep_free -ldns_rdf_free -ldns_rdf_get_type -ldns_rdf_new -ldns_rdf_new_frm_data -ldns_rdf_new_frm_fp -ldns_rdf_new_frm_fp_l -ldns_rdf_new_frm_str -ldns_rdf_print -ldns_rdf_set_data -ldns_rdf_set_size -ldns_rdf_set_type -ldns_rdf_size -ldns_read_anchor_file -ldns_resolver_debug -ldns_resolver_dec_nameserver_count -ldns_resolver_deep_free -ldns_resolver_defnames -ldns_resolver_dnsrch -ldns_resolver_dnssec -ldns_resolver_dnssec_anchors -ldns_resolver_dnssec_cd -ldns_resolver_domain -ldns_resolver_edns_udp_size -ldns_resolver_fail -ldns_resolver_fallback -ldns_resolver_free -ldns_resolver_igntc -ldns_resolver_incr_nameserver_count -ldns_resolver_ip6 -ldns_resolver_nameserver_count -ldns_resolver_nameserver_rtt -ldns_resolver_nameservers -ldns_resolver_nameservers_randomize -ldns_resolver_new -ldns_resolver_new_frm_file -ldns_resolver_new_frm_fp -ldns_resolver_new_frm_fp_l -ldns_resolver_pop_nameserver -ldns_resolver_port -ldns_resolver_prepare_query_pkt -ldns_resolver_print -ldns_resolver_push_dnssec_anchor -ldns_resolver_push_nameserver -ldns_resolver_push_nameserver_rr -ldns_resolver_push_nameserver_rr_list -ldns_resolver_push_searchlist -ldns_resolver_query -ldns_resolver_random -ldns_resolver_recursive -ldns_resolver_retrans -ldns_resolver_retry -ldns_resolver_rtt -ldns_resolver_search -ldns_resolver_searchlist -ldns_resolver_searchlist_count -ldns_resolver_send -ldns_resolver_send_pkt -ldns_resolver_set_debug -ldns_resolver_set_defnames -ldns_resolver_set_dnsrch -ldns_resolver_set_dnssec -ldns_resolver_set_dnssec_anchors -ldns_resolver_set_dnssec_cd -ldns_resolver_set_domain -ldns_resolver_set_edns_udp_size -ldns_resolver_set_fail -ldns_resolver_set_fallback -ldns_resolver_set_igntc -ldns_resolver_set_ip6 -ldns_resolver_set_nameserver_count -ldns_resolver_set_nameserver_rtt -ldns_resolver_set_nameservers -ldns_resolver_set_port -ldns_resolver_set_random -ldns_resolver_set_recursive -ldns_resolver_set_retrans -ldns_resolver_set_retry -ldns_resolver_set_rtt -ldns_resolver_set_searchlist_count -ldns_resolver_set_timeout -ldns_resolver_set_tsig_algorithm -ldns_resolver_set_tsig_keydata -ldns_resolver_set_tsig_keyname -ldns_resolver_set_usevc -ldns_resolver_timeout -ldns_resolver_trusted_key -ldns_resolver_tsig_algorithm -ldns_resolver_tsig_keydata -ldns_resolver_tsig_keyname -ldns_resolver_usevc -ldns_rr2buffer_str -ldns_rr2buffer_wire -ldns_rr2buffer_wire_canonical -ldns_rr2canonical -ldns_rr2str -ldns_rr2wire -ldns_rr_a_address -ldns_rr_a_set_address -ldns_rr_class2buffer_str -ldns_rr_class2str -ldns_rr_classes -ldns_rr_clone -ldns_rr_compare -ldns_rr_compare_ds -ldns_rr_compare_no_rdata -ldns_rr_compare_wire -ldns_rr_descript -ldns_rr_descriptor_field_type -ldns_rr_descriptor_maximum -ldns_rr_descriptor_minimum -ldns_rr_dnskey_algorithm -ldns_rr_dnskey_flags -ldns_rr_dnskey_key -ldns_rr_dnskey_key_size -ldns_rr_dnskey_key_size_raw -ldns_rr_dnskey_protocol -ldns_rr_dnskey_set_algorithm -ldns_rr_dnskey_set_flags -ldns_rr_dnskey_set_key -ldns_rr_dnskey_set_protocol -ldns_rr_free -ldns_rr_get_class -ldns_rr_get_type -ldns_rr_label_count -ldns_rr_list2buffer_str -ldns_rr_list2buffer_wire -ldns_rr_list2canonical -ldns_rr_list2str -ldns_rr_list_cat -ldns_rr_list_cat_clone -ldns_rr_list_clone -ldns_rr_list_compare -ldns_rr_list_contains_rr -ldns_rr_list_deep_free -ldns_rr_list_free -ldns_rr_list_new -ldns_rr_list_owner -ldns_rr_list_pop_rr -ldns_rr_list_pop_rr_list -ldns_rr_list_pop_rrset -ldns_rr_list_print -ldns_rr_list_push_rr -ldns_rr_list_push_rr_list -ldns_rr_list_rr -ldns_rr_list_rr_count -ldns_rr_list_set_rr -ldns_rr_list_set_rr_count -ldns_rr_list_sort -ldns_rr_list_sort_nsec3 -ldns_rr_list_subtype_by_rdf -ldns_rr_list_type -ldns_rr_mx_exchange -ldns_rr_mx_preference -ldns_rr_new -ldns_rr_new_frm_fp -ldns_rr_new_frm_fp_l -ldns_rr_new_frm_str -ldns_rr_new_frm_type -ldns_rr_new_question_frm_str -ldns_rr_ns_nsdname -ldns_rr_owner -ldns_rr_pop_rdf -ldns_rr_print -ldns_rr_push_rdf -ldns_rr_rdata2buffer_wire -ldns_rr_rd_count -ldns_rr_rdf -ldns_rr_rrsig_algorithm -ldns_rr_rrsig_expiration -ldns_rr_rrsig_inception -ldns_rr_rrsig_keytag -ldns_rr_rrsig_labels -ldns_rr_rrsig_origttl -ldns_rr_rrsig_set_algorithm -ldns_rr_rrsig_set_expiration -ldns_rr_rrsig_set_inception -ldns_rr_rrsig_set_keytag -ldns_rr_rrsig_set_labels -ldns_rr_rrsig_set_origttl -ldns_rr_rrsig_set_sig -ldns_rr_rrsig_set_signame -ldns_rr_rrsig_set_typecovered -ldns_rr_rrsig_sig -ldns_rr_rrsig_signame -ldns_rr_rrsig_typecovered -ldns_rr_set_class -ldns_rr_set_owner -ldns_rr_set_pop_rr -ldns_rr_set_push_rr -ldns_rr_set_rd_count -ldns_rr_set_rdf -ldns_rr_set_ttl -ldns_rr_set_type -ldns_rrsig2buffer_wire -ldns_rr_ttl -ldns_rr_type2buffer_str -ldns_rr_type2str -ldns_rr_uncompressed_size -ldns_send -ldns_send_buffer -ldns_set_bit -ldns_sha1 -ldns_sha1_final -ldns_sha1_init -ldns_sha1_transform -ldns_sha1_update -ldns_signing_algorithms -ldns_sign_public -ldns_sign_public_buffer -ldns_sign_public_dsa -ldns_sign_public_evp -ldns_sign_public_rsamd5 -ldns_sign_public_rsasha1 -ldns_sockaddr_storage2rdf -ldns_str2period -ldns_str2rdf_a -ldns_str2rdf_aaaa -ldns_str2rdf_alg -ldns_str2rdf_apl -ldns_str2rdf_b32_ext -ldns_str2rdf_b64 -ldns_str2rdf_cert_alg -ldns_str2rdf_class -ldns_str2rdf_dname -ldns_str2rdf_hex -ldns_str2rdf_int16 -ldns_str2rdf_int32 -ldns_str2rdf_int8 -ldns_str2rdf_loc -ldns_str2rdf_nsap -ldns_str2rdf_nsec -ldns_str2rdf_nsec3_salt -ldns_str2rdf_period -ldns_str2rdf_service -ldns_str2rdf_str -ldns_str2rdf_time -ldns_str2rdf_tsig -ldns_str2rdf_type -ldns_str2rdf_unknown -ldns_str2rdf_wks -ldns_tcp_bgsend -ldns_tcp_connect -ldns_tcp_read_wire -ldns_tcp_read_wire_timeout -ldns_tcp_send -ldns_tcp_send_query -ldns_traverse_postorder -ldns_tsig_algorithm -ldns_tsig_keydata -ldns_tsig_keydata_clone -ldns_tsig_keyname -ldns_tsig_keyname_clone -ldns_tsig_prepare_pkt_wire -ldns_udp_bgsend -ldns_udp_connect -ldns_udp_read_wire -ldns_udp_send -ldns_udp_send_query -ldns_update_ad -ldns_update_pkt_new -ldns_update_pkt_tsig_add -ldns_update_prcount -ldns_update_set_adcount -ldns_update_set_prcount -ldns_update_set_upcount -ldns_update_set_zo -ldns_update_soa_mname -ldns_update_soa_zone_mname -ldns_update_upcount -ldns_update_zocount -ldns_validate_domain_dnskey -ldns_validate_domain_ds -ldns_verify -ldns_verify_notime -ldns_verify_rrsig -ldns_verify_rrsig_buffers -ldns_verify_rrsig_buffers_raw -ldns_verify_rrsig_dsa -ldns_verify_rrsig_dsa_raw -ldns_verify_rrsig_evp -ldns_verify_rrsig_evp_raw -ldns_verify_rrsig_keylist -ldns_verify_rrsig_keylist_notime -ldns_verify_rrsig_rsamd5 -ldns_verify_rrsig_rsamd5_raw -ldns_verify_rrsig_rsasha1 -ldns_verify_rrsig_rsasha1_raw -ldns_verify_rrsig_rsasha256_raw -ldns_verify_rrsig_rsasha512_raw -ldns_verify_trusted -ldns_version -ldns_wire2dname -ldns_wire2pkt -ldns_wire2rdf -ldns_wire2rr -ldns_zone_deep_free -ldns_zone_free -ldns_zone_glue_rr_list -ldns_zone_new -ldns_zone_new_frm_fp -ldns_zone_new_frm_fp_l -ldns_zone_print -ldns_zone_push_rr -ldns_zone_push_rr_list -ldns_zone_rr_count -ldns_zone_rrs -ldns_zone_set_rrs -ldns_zone_set_soa -ldns_zone_sign -ldns_zone_sign_nsec3 -ldns_zone_soa -ldns_zone_sort -ldns_zone_strip_glue_rrs diff --git a/libs/ldns/libdns.doxygen b/libs/ldns/libdns.doxygen deleted file mode 100644 index b81c7362bb..0000000000 --- a/libs/ldns/libdns.doxygen +++ /dev/null @@ -1,1130 +0,0 @@ -# Doxyfile 1.3.9.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = ldns - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 1.6.7 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = doc/ - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of source -# files, where putting all generated files in the same directory would otherwise -# cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. - -OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is used -# as the annotated text. Otherwise, the brief description is used as-is. If left -# blank, the following values are used ("$name" is automatically replaced with the -# name of the entity): "The $name class" "The $name widget" "The $name file" -# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited -# members of a class in the documentation of that class as if those members were -# ordinary class members. Constructors, destructors and assignment operators of -# the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - -JAVADOC_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - -DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources -# only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = NO - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. - -SHOW_DIRECTORIES = YES - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. - -WARN_FORMAT = "doxygen: $file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = . ldns/ doc/ examples/ldns-mx.c examples/ldns-read-zone.c examples/ldns-signzone.c - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp -# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm - -#FILE_PATTERNS = *.h *.c *.dox -#FILE_PATTERNS = *.h *.dox - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories -# that are symbolic links (a Unix filesystem feature) are excluded from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. - -EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = examples - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = doc/images - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 3 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = ldns_ - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = doc/header.html - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -#HTML_STYLESHEET = doc/libdns.css - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = YES - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_PREDEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = HAVE_SSL - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse the -# parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or -# super classes. Setting the tag to NO turns the diagrams off. Note that this -# option is superseded by the HAVE_DOT option below. This is only a fallback. It is -# recommended to install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - -CALL_GRAPH = YES -SOURCE_BROWSER = YES -REFERENCES_RELATION = YES - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found on the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - -SEARCHENGINE = NO diff --git a/libs/ldns/libdns.vim b/libs/ldns/libdns.vim deleted file mode 100644 index 69ec067150..0000000000 --- a/libs/ldns/libdns.vim +++ /dev/null @@ -1,332 +0,0 @@ -" Vim syntax file -" Language: C libdns -" Maintainer: miekg -" Last change: 2004-12-15 - -" util.h -syn keyword ldnsMacro LDNS_MALLOC -syn keyword ldnsMacro LDNS_XMALLOC -syn keyword ldnsMacro LDNS_REALLOC -syn keyword ldnsMacro LDNS_XREALLOC -syn keyword ldnsMacro LDNS_FREE -syn keyword ldnsMacro LDNS_DEP - -" ldns/tsig.h -syn keyword ldnsType ldns_tsig_credentials - -" ldns/rdata.h -syn keyword ldnsType ldns_rdf -syn keyword ldnsType ldns_rdf_type -syn keyword ldnsType ldns_hdr -syn keyword ldnsType ldns_status -syn keyword ldnsType ldns_rrset -syn keyword ldnsType ldns_dname -syn keyword ldnsConstant true -syn keyword ldnsConstant false -syn keyword ldnsFunction ldns_rdf_get_type - -syn keyword ldnsConstant LDNS_RDF_TYPE_NONE -syn keyword ldnsConstant LDNS_RDF_TYPE_DNAME -syn keyword ldnsConstant LDNS_RDF_TYPE_INT8 -syn keyword ldnsConstant LDNS_RDF_TYPE_INT16 -syn keyword ldnsConstant LDNS_RDF_TYPE_INT16_DATA -syn keyword ldnsConstant LDNS_RDF_TYPE_INT32 -syn keyword ldnsConstant LDNS_RDF_TYPE_A -syn keyword ldnsConstant LDNS_RDF_TYPE_AAAA -syn keyword ldnsConstant LDNS_RDF_TYPE_STR -syn keyword ldnsConstant LDNS_RDF_TYPE_APL -syn keyword ldnsConstant LDNS_RDF_TYPE_B64 -syn keyword ldnsConstant LDNS_RDF_TYPE_HEX -syn keyword ldnsConstant LDNS_RDF_TYPE_NSEC -syn keyword ldnsConstant LDNS_RDF_TYPE_TYPE -syn keyword ldnsConstant LDNS_RDF_TYPE_CLASS -syn keyword ldnsConstant LDNS_RDF_TYPE_CERT -syn keyword ldnsConstant LDNS_RDF_TYPE_CERT_ALG -syn keyword ldnsConstant LDNS_RDF_TYPE_ALG -syn keyword ldnsConstant LDNS_RDF_TYPE_UNKNOWN -syn keyword ldnsConstant LDNS_RDF_TYPE_TIME -syn keyword ldnsConstant LDNS_RDF_TYPE_PERIOD -syn keyword ldnsConstant LDNS_RDF_TYPE_TSIGTIME -syn keyword ldnsConstant LDNS_RDF_TYPE_SERVICE -syn keyword ldnsConstant LDNS_RDF_TYPE_LOC -syn keyword ldnsConstant LDNS_RDF_TYPE_WKS -syn keyword ldnsConstant LDNS_RDF_TYPE_NSAP -syn keyword ldnsConstant LDNS_RDF_TYPE_IPSECKEY -syn keyword ldnsConstant LDNS_RDF_TYPE_TSIG -syn keyword ldnsConstant LDNS_MAX_RDFLEN -syn keyword ldnsConstant LDNS_RDF_SIZE_BYTE -syn keyword ldnsConstant LDNS_RDF_SIZE_WORD -syn keyword ldnsConstant LDNS_RDF_SIZE_DOUBLEWORD -syn keyword ldnsConstant LDNS_RDF_SIZE_6BYTES -syn keyword ldnsConstant LDNS_RDF_SIZE_16BYTES - -" ldns/ldns.h -syn keyword ldnsConstant LDNS_PORT -syn keyword ldnsConstant LDNS_IP4ADDRLEN -syn keyword ldnsConstant LDNS_IP6ADDRLEN -syn keyword ldnsConstant LDNS_ROOT_LABEL -syn keyword ldnsConstant LDNS_DEFAULT_TTL - -" ldns/packet.h -syn keyword ldnsType ldns_pkt -syn keyword ldnsType ldns_pkt_section -syn keyword ldnsType ldns_pkt_type -syn keyword ldnsType ldns_pkt_opcode -syn keyword ldnsType ldns_pkt_rcode -syn keyword ldnsConstant LDNS_QR -syn keyword ldnsConstant LDNS_AA -syn keyword ldnsConstant LDNS_TC -syn keyword ldnsConstant LDNS_CD -syn keyword ldnsConstant LDNS_RA -syn keyword ldnsConstant LDNS_AD -syn keyword ldnsConstant LDNS_PACKET_QUESTION -syn keyword ldnsConstant LDNS_PACKET_REFERRAL -syn keyword ldnsConstant LDNS_PACKET_ANSWER -syn keyword ldnsConstant LDNS_PACKET_NXDOMAIN -syn keyword ldnsConstant LDNS_PACKET_NODATA -syn keyword ldnsConstant LDNS_PACKET_UNKNOWN -syn keyword ldnsConstant LDNS_SECTION_QUESTION -syn keyword ldnsConstant LDNS_SECTION_ANSWER -syn keyword ldnsConstant LDNS_SECTION_AUTHORITY -syn keyword ldnsConstant LDNS_SECTION_ADDITIONAL -syn keyword ldnsConstant LDNS_SECTION_ANY -syn keyword ldnsConstant LDNS_SECTION_ANY_NOQUESTION -syn keyword ldnsConstant LDNS_MAX_PACKETLEN -syn keyword ldnsConstant LDNS_PACKET_QUERY -syn keyword ldnsConstant LDNS_PACKET_IQUERY -syn keyword ldnsConstant LDNS_PACKET_STATUS -syn keyword ldnsConstant LDNS_PACKET_NOTIFY -syn keyword ldnsConstant LDNS_PACKET_UPDATE - -syn keyword ldnsConstant LDNS_RCODE_NOERROR -syn keyword ldnsConstant LDNS_RCODE_FORMERR -syn keyword ldnsConstant LDNS_RCODE_SERVFAIL -syn keyword ldnsConstant LDNS_RCODE_NXDOMAIN -syn keyword ldnsConstant LDNS_RCODE_NOTIMPL -syn keyword ldnsConstant LDNS_RCODE_REFUSED -syn keyword ldnsConstant LDNS_RCODE_YXDOMAIN -syn keyword ldnsConstant LDNS_RCODE_YXRRSET -syn keyword ldnsConstant LDNS_RCODE_NXRRSET -syn keyword ldnsConstant LDNS_RCODE_NOTAUTH -syn keyword ldnsConstant LDNS_RCODE_NOTZONE - -" dns/error.h -syn keyword ldnsMacro LDNS_STATUS_OK -syn keyword ldnsMacro LDNS_STATUS_EMPTY_LABEL -syn keyword ldnsMacro LDNS_STATUS_LABEL_OVERFLOW -syn keyword ldnsMacro LDNS_STATUS_LABEL_UNDERFLOW -syn keyword ldnsMacro LDNS_STATUS_DOMAINNAME_OVERFLOW -syn keyword ldnsMacro LDNS_STATUS_DOMAINNAME_UNDERFLOW -syn keyword ldnsMacro LDNS_STATUS_DDD_OVERFLOW -syn keyword ldnsMacro LDNS_STATUS_PACKET_OVERFLOW -syn keyword ldnsMacro LDNS_STATUS_MEM_ERR -syn keyword ldnsMacro LDNS_STATUS_INTERNAL_ERR -syn keyword ldnsMacro LDNS_STATUS_ERR -syn keyword ldnsMacro LDNS_STATUS_ADDRESS_ERR -syn keyword ldnsMacro LDNS_STATUS_NETWORK_ERR -syn keyword ldnsMacro LDNS_STATUS_NO_NAMESERVERS_ERR -syn keyword ldnsMacro LDNS_STATUS_INVALID_POINTER -syn keyword ldnsMacro LDNS_STATUS_INVALID_INT -syn keyword ldnsMacro LDNS_STATUS_INVALID_IP4 -syn keyword ldnsMacro LDNS_STATUS_INVALID_IP6 -syn keyword ldnsMacro LDNS_STATUS_INVALID_STR -syn keyword ldnsMacro LDNS_STATUS_INVALID_B64 -syn keyword ldnsMacro LDNS_STATUS_INVALID_HEX -syn keyword ldnsMacro LDNS_STATUS_UNKNOWN_INET -syn keyword ldnsMacro LDNS_STATUS_NOT_IMPL -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_UNKNOWN_ALGO -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_VALIDATED -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_BOGUS -syn keyword ldnsMacro LDNS_STATUS_INVALID_INT -syn keyword ldnsMacro LDNS_STATUS_INVALID_TIME -syn keyword ldnsMacro LDNS_STATUS_NETWORK_ERR -syn keyword ldnsMacro LDNS_STATUS_ADDRESS_ERR -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_RRSIG -syn keyword ldnsMacro LDNS_STATUS_NULL -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_DNSKEY -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_SIG_EXPIRED -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_ERR -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_BOGUS -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION -syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_ERR -syn keyword ldnsMacro LDNS_STATUS_RES_NO_NS -syn keyword ldnsMacro LDNS_STATUS_RES_QUERY -syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_HEADER -syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_QUESTION -syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_ANSWER -syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY -syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL -syn keyword ldnsMacro LDNS_STATUS_NO_DATA -syn keyword ldnsMacro LDNS_STATUS_CERT_BAD_ALGORITHM - -" ldns/resolver.h -syn keyword ldnsType ldns_resolver - -" ldns/zone.h -syn keyword ldnsType ldns_zone - -" ldns/rr.h -syn keyword ldnsType ldns_rr_list -syn keyword ldnsType ldns_rr_descriptor -syn keyword ldnsType ldns_rr -syn keyword ldnsType ldns_rr_type -syn keyword ldnsType ldns_rr_class -syn keyword ldnsType ldns_rr_compress - -syn keyword ldnsConstant LDNS_RR_CLASS_IN -syn keyword ldnsConstant LDNS_RR_CLASS_CH -syn keyword ldnsConstant LDNS_RR_CLASS_HS -syn keyword ldnsConstant LDNS_RR_CLASS_NONE -syn keyword ldnsConstant LDNS_RR_CLASS_ANY - -syn keyword ldnsConstant LDNS_RR_TYPE_A -syn keyword ldnsConstant LDNS_RR_TYPE_NS -syn keyword ldnsConstant LDNS_RR_TYPE_MD -syn keyword ldnsConstant LDNS_RR_TYPE_MF -syn keyword ldnsConstant LDNS_RR_TYPE_CNAME -syn keyword ldnsConstant LDNS_RR_TYPE_SOA -syn keyword ldnsConstant LDNS_RR_TYPE_MB -syn keyword ldnsConstant LDNS_RR_TYPE_MG -syn keyword ldnsConstant LDNS_RR_TYPE_MR -syn keyword ldnsConstant LDNS_RR_TYPE_NULL -syn keyword ldnsConstant LDNS_RR_TYPE_WKS -syn keyword ldnsConstant LDNS_RR_TYPE_PTR -syn keyword ldnsConstant LDNS_RR_TYPE_HINFO -syn keyword ldnsConstant LDNS_RR_TYPE_MINFO -syn keyword ldnsConstant LDNS_RR_TYPE_MX -syn keyword ldnsConstant LDNS_RR_TYPE_TXT -syn keyword ldnsConstant LDNS_RR_TYPE_RP -syn keyword ldnsConstant LDNS_RR_TYPE_AFSDB -syn keyword ldnsConstant LDNS_RR_TYPE_X25 -syn keyword ldnsConstant LDNS_RR_TYPE_ISDN -syn keyword ldnsConstant LDNS_RR_TYPE_RT -syn keyword ldnsConstant LDNS_RR_TYPE_NSAP -syn keyword ldnsConstant LDNS_RR_TYPE_SIG -syn keyword ldnsConstant LDNS_RR_TYPE_KEY -syn keyword ldnsConstant LDNS_RR_TYPE_PX -syn keyword ldnsConstant LDNS_RR_TYPE_GPOS -syn keyword ldnsConstant LDNS_RR_TYPE_AAAA -syn keyword ldnsConstant LDNS_RR_TYPE_LOC -syn keyword ldnsConstant LDNS_RR_TYPE_NXT -syn keyword ldnsConstant LDNS_RR_TYPE_SRV -syn keyword ldnsConstant LDNS_RR_TYPE_NAPTR -syn keyword ldnsConstant LDNS_RR_TYPE_KX -syn keyword ldnsConstant LDNS_RR_TYPE_CERT -syn keyword ldnsConstant LDNS_RR_TYPE_DNAME -syn keyword ldnsConstant LDNS_RR_TYPE_OPT -syn keyword ldnsConstant LDNS_RR_TYPE_APL -syn keyword ldnsConstant LDNS_RR_TYPE_DS -syn keyword ldnsConstant LDNS_RR_TYPE_SSHFP -syn keyword ldnsConstant LDNS_RR_TYPE_RRSIG -syn keyword ldnsConstant LDNS_RR_TYPE_NSEC -syn keyword ldnsConstant LDNS_RR_TYPE_DNSKEY -syn keyword ldnsConstant LDNS_RR_TYPE_EID -syn keyword ldnsConstant LDNS_RR_TYPE_NIMLOC -syn keyword ldnsConstant LDNS_RR_TYPE_ATMA -syn keyword ldnsConstant LDNS_RR_TYPE_A6 -syn keyword ldnsConstant LDNS_RR_TYPE_SINK -syn keyword ldnsConstant LDNS_RR_TYPE_IPSECKEY -syn keyword ldnsConstant LDNS_RR_TYPE_UINFO -syn keyword ldnsConstant LDNS_RR_TYPE_UID -syn keyword ldnsConstant LDNS_RR_TYPE_GID -syn keyword ldnsConstant LDNS_RR_TYPE_UNSPEC -syn keyword ldnsConstant LDNS_RR_TYPE_TSIG -syn keyword ldnsConstant LDNS_RR_TYPE_IXFR -syn keyword ldnsConstant LDNS_RR_TYPE_AXFR -syn keyword ldnsConstant LDNS_RR_TYPE_MAILB -syn keyword ldnsConstant LDNS_RR_TYPE_MAILA -syn keyword ldnsConstant LDNS_RR_TYPE_ANY -syn keyword ldnsConstant LDNS_MAX_LABELLEN -syn keyword ldnsConstant LDNS_MAX_DOMAINLEN -syn keyword ldnsConstant LDNS_RR_COMPRESS -syn keyword ldnsConstant LDNS_RR_NO_COMPRESS - -syn keyword ldnsMacro QHEADERSZ -syn keyword ldnsMacro RD_MASK -syn keyword ldnsMacro RD_SHIFT -syn keyword ldnsMacro LDNS_RD -syn keyword ldnsMacro RD_SET -syn keyword ldnsMacro RD_CLR -syn keyword ldnsMacro TC_MASK -syn keyword ldnsMacro TC_SHIFT -syn keyword ldnsMacro LDNS_TC -syn keyword ldnsMacro TC_SET -syn keyword ldnsMacro TC_CLR -syn keyword ldnsMacro AA_MASK -syn keyword ldnsMacro AA_SHIFT -syn keyword ldnsMacro LDNS_AA -syn keyword ldnsMacro AA_SET -syn keyword ldnsMacro AA_CLR -syn keyword ldnsMacro OPCODE_MASK -syn keyword ldnsMacro OPCODE_SHIFT -syn keyword ldnsMacro OPCODE -syn keyword ldnsMacro OPCODE_SET -syn keyword ldnsMacro QR_MASK -syn keyword ldnsMacro QR_SHIFT -syn keyword ldnsMacro LDNS_QR -syn keyword ldnsMacro QR_SET -syn keyword ldnsMacro QR_CLR -syn keyword ldnsMacro RCODE_MASK -syn keyword ldnsMacro RCODE_SHIFT -syn keyword ldnsMacro RCODE -syn keyword ldnsMacro RCODE_SET -syn keyword ldnsMacro CD_MASK -syn keyword ldnsMacro CD_SHIFT -syn keyword ldnsMacro LDNS_CD -syn keyword ldnsMacro CD_SET -syn keyword ldnsMacro CD_CLR -syn keyword ldnsMacro AD_MASK -syn keyword ldnsMacro AD_SHIFT -syn keyword ldnsMacro LDNS_AD -syn keyword ldnsMacro AD_SET -syn keyword ldnsMacro AD_CLR -syn keyword ldnsMacro Z_MASK -syn keyword ldnsMacro Z_SHIFT -syn keyword ldnsMacro LDNS_Z -syn keyword ldnsMacro Z_SET -syn keyword ldnsMacro Z_CLR -syn keyword ldnsMacro RA_MASK -syn keyword ldnsMacro RA_SHIFT -syn keyword ldnsMacro LDNS_RA -syn keyword ldnsMacro RA_SET -syn keyword ldnsMacro RA_CLR -syn keyword ldnsMacro LDNS_ID -syn keyword ldnsMacro QDCOUNT_OFF -syn keyword ldnsMacro QDCOUNT -syn keyword ldnsMacro ANCOUNT_OFF -syn keyword ldnsMacro ANCOUNT -syn keyword ldnsMacro NSCOUNT_OFF -syn keyword ldnsMacro NSCOUNT -syn keyword ldnsMacro ARCOUNT_OFF -syn keyword ldnsMacro ARCOUNT - -" ldns/buffer.h -syn keyword ldnsType ldns_buffer -syn keyword ldnsConstant LDNS_MIN_BUFLEN - -" ldns/host2str.h -syn keyword ldnsType ldns_lookup_table -syn keyword ldnsConstant LDNS_APL_IP4 -syn keyword ldnsConstant LDNS_APL_IP6 - -" ldns/keys.h -syn keyword ldnsType ldns_key -syn keyword ldnsType ldns_key_list -syn keyword ldnsType ldns_signing_algorithm -syn keyword ldnsType ldns_hash - -" ldns/dnssec.h -syn keyword ldnsConstant LDNS_MAX_KEYLEN - -" Default highlighting -command -nargs=+ HiLink hi def link -HiLink ldnsType Type -HiLink ldnsFunction Function -HiLink ldnsMacro Macro -HiLink ldnsConstant Constant -delcommand HiLink diff --git a/libs/ldns/linktest.c b/libs/ldns/linktest.c deleted file mode 100644 index c21753a53f..0000000000 --- a/libs/ldns/linktest.c +++ /dev/null @@ -1,13 +0,0 @@ - -#include "ldns/config.h" -#include - -int -main(void) -{ - ldns_rr *rr = ldns_rr_new(); - - ldns_rr_free(rr); - return 0; -} - diff --git a/libs/ldns/ltmain.sh b/libs/ldns/ltmain.sh deleted file mode 100755 index 6dfcfd58a9..0000000000 --- a/libs/ldns/ltmain.sh +++ /dev/null @@ -1,9687 +0,0 @@ - -# libtool (GNU libtool) 2.4 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool 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. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [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 -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# 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. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -PROGRAM=libtool -PACKAGE=libtool -VERSION=2.4 -TIMESTAMP="" -package_revision=1.3293 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${EGREP="grep -E"} -: ${FGREP="grep -F"} -: ${GREP="grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=: - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# 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' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation - - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation - - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_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 $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_verbose=: -opt_silent=false -opt_verbose=false - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) - opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -## ----------- ## -## Main. ## -## ----------- ## - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - - # FreeBSD-specific: where we install compilers with non-standard names - tag_compilers_CC="*cc cc* *gcc gcc* clang" - tag_compilers_CXX="*c++ c++* *g++ g++* clang++" - base_compiler=`set -- "$@"; echo $1` - - # If $tagname isn't set, then try to infer if the default "CC" tag applies - if test -z "$tagname"; then - for zp in $tag_compilers_CC; do - case $base_compiler in - $zp) tagname="CC"; break;; - esac - done - fi - - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - - # FreeBSD-specific: try compilers based on inferred tag - if test -z "$tagname"; then - eval "tag_compilers=\$tag_compilers_${z}" - if test -n "$tag_compilers"; then - for zp in $tag_compilers; do - case $base_compiler in - $zp) tagname=$z; break;; - esac - done - if test -n "$tagname"; then - break - fi - fi - fi - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_append func_to_host_path_result "$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - -# func_mode_compile arg... -func_mode_compile () -{ - $opt_debug - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - pie_flag= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" - arg_mode=target - continue - ;; - - -pie | -fpie | -fPIE) - func_append pie_flag " $arg" - continue - ;; - - -shared | -static | -prefer-pic | -prefer-non-pic) - func_append later " $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - func_append_quoted lastarg "$arg" - done - IFS="$save_ifs" - func_stripname ' ' '' "$lastarg" - lastarg=$func_stripname_result - - # Add the arguments to base_compile. - func_append base_compile " $lastarg" - continue - ;; - - *) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" - done # for arg - - case $arg_mode in - arg) - func_fatal_error "you must specify an argument for -Xcompile" - ;; - target) - func_fatal_error "you must specify a target with \`-o'" - ;; - *) - # Get the name of the library object. - test -z "$libobj" && { - func_basename "$srcfile" - libobj="$func_basename_result" - } - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - case $libobj in - *.[cCFSifmso] | \ - *.ada | *.adb | *.ads | *.asm | \ - *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) - func_xform "$libobj" - libobj=$func_xform_result - ;; - esac - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ - && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # 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 "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - 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 $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "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." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - func_append removelist " $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - func_append removelist " $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # 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 - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - func_append command " -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - 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." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - func_append command " -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - func_append command "$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - 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." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $opt_mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build 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, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [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 - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [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 - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -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-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -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 - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -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: $progname [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." - ;; - - *) - func_fatal_help "invalid operation mode \`$opt_mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $opt_dlopen; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - func_append dir "/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - 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 - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - 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 $EXIT_SUCCESS - fi -} - -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libs= - libdirs= - admincmds= - - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - func_append libdirs " $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - func_append libs " $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || func_append admincmds " - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - 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 the \`-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" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - fi - exit $EXIT_SUCCESS -} - -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # 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 || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - func_append files " $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - func_append install_shared_prog " $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - 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 - *.$libext) - # Do the static libraries later. - func_append staticlibs " $file" - ;; - - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) func_append current_libdirs " $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) func_append future_libdirs " $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - func_append dir "$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && func_append 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 - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen . - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac - done - - $opt_dry_run || { - # 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" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - 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/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - 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*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) func_append symtab_cflags " $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *-*-freebsd*) - # FreeBSD doesn't need this... - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - 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 "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# 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. -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED '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 \"\$file\" | $SED '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 \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - 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 "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $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 "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${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\ -" -} - - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' - - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # 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 invocation. - # 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 - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_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 - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append 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 - func_append dlfiles " $arg" - else - func_append dlprefiles " $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) func_append deplibs " $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# func_append moreargs " $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) func_append rpath " $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) func_append xrpath " $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - func_append weak_libs " $arg" - prev= - continue - ;; - xcclinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - 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 - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; - *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; - *) func_append deplibs " -L$dir" ;; - esac - func_append lib_search_path " $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - deplibs="$deplibs $arg" - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - func_append deplibs " System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - func_append deplibs " $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - func_append compiler_flags " $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - func_append objs " $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - func_append deplibs " $arg" - func_append old_deplibs " $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - func_append dlfiles " $func_resolve_sysroot_result" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - func_append dlprefiles " $func_resolve_sysroot_result" - prev= - else - func_append deplibs " $func_resolve_sysroot_result" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then - case "$libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append libs " $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; - esac - func_append pre_post_deps " $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - func_resolve_sysroot "$lib" - case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) func_append deplibs " $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append compiler_flags " $deplib" - fi - - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - ;; - *) - ;; - esac # linkmode - - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $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" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - func_append newdlprefiles " $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append newdlfiles " $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && func_append dlfiles " $dlopen" - test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - func_append dlprefiles " $lib $dependency_libs" - else - func_append newdlfiles " $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - func_append newdlprefiles " $dir/$linklib" - else - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - func_append newdlprefiles " $dir/$dlname" - else - func_append newdlprefiles " $dir/$linklib" - fi - ;; - esac - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - func_append newlib_search_path " $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - func_append notinst_deplibs " $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - func_append notinst_deplibs " $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$opt_mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$opt_mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # 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_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - 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." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - 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 - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) func_append xrpath " $temp_xrpath";; - esac;; - *) func_append temp_deplibs " $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - func_append newlib_search_path " $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - func_append specialdeplibs " $func_resolve_sysroot_result" ;; - esac - fi - func_append tmp_libs " $func_resolve_sysroot_result" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result - func_dirname "$deplib" "" "." - dir=$func_dirname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) func_append lib_search_path " $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) func_append tmp_libs " $deplib" ;; - esac - ;; - *) func_append tmp_libs " $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - func_append tmp_libs " $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - func_append objs "$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - func_append libobjs " $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - func_append verstring ":${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - 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 - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - func_append libobjs " $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$opt_mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - func_append removelist " $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - func_append oldlibs " $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - func_replace_sysroot "$libdir" - func_append temp_xrpath " -R$func_replace_sysroot_result" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) func_append dlfiles " $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) func_append dlprefiles " $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - func_append deplibs " System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - func_append deplibs " -lc" - fi - ;; - esac - fi - - # 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 behavior. - 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. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi - 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 "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $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" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - func_append newdeplibs " $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $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" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - 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 - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - 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." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - 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 - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - deplibs="$new_libs" - - # 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 - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result - 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"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_apped 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" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - func_append linknames " $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - func_append delfiles " $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do - IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - func_append delfiles " $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" - func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - func_append tmp_deplibs " $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - func_append linker_flags " $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - func_append delfiles " $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_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 - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_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 and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${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" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - func_append compile_command " $compile_deplibs" - func_append finalize_command " $finalize_deplibs" - - 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 "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append 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"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - 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"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) func_append 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" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - 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 - func_append 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 - func_append rpath "$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - exit $EXIT_SUCCESS - 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" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED '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 "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - 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 $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $addlibs - func_append oldobjs " $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append oldobjs " $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - func_append oldobjs " $gentop/$newobj" - ;; - *) func_append oldobjs " $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -R$func_replace_sysroot_result" - ;; - *) func_append newdependency_libs " $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" - ;; - *) func_append newdlfiles " $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlfiles " $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlprefiles " $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; - -*) func_append RM " $arg" ;; - *) func_append files " $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" - else - odir="$dir/$objdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" - - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then - case " $rmdirs " in - *" $odir "*) ;; - *) func_append rmdirs " $odir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - func_append rmfiles " $odir/$n" - done - test -n "$old_library" && func_append rmfiles " $odir/$old_library" - - case "$opt_mode" in - clean) - case " $library_names " in - *" $dlname "*) ;; - *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; - esac - test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - func_append rmfiles " $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - func_append rmfiles " $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$opt_mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - func_append rmfiles " $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - func_append rmfiles " $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - func_append rmfiles " $odir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$opt_mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/libs/ldns/net.c b/libs/ldns/net.c deleted file mode 100644 index bf8766b990..0000000000 --- a/libs/ldns/net.c +++ /dev/null @@ -1,884 +0,0 @@ -/* - * net.c - * - * Network implementation - * All network related functions are grouped here - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include - -#ifdef HAVE_NETINET_IN_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#include -#include -#include - -ldns_status -ldns_send(ldns_pkt **result_packet, ldns_resolver *r, const ldns_pkt *query_pkt) -{ - ldns_buffer *qb; - ldns_status result; - ldns_rdf *tsig_mac = NULL; - - qb = ldns_buffer_new(LDNS_MIN_BUFLEN); - - if (query_pkt && ldns_pkt_tsig(query_pkt)) { - tsig_mac = ldns_rr_rdf(ldns_pkt_tsig(query_pkt), 3); - } - - if (!query_pkt || - ldns_pkt2buffer_wire(qb, query_pkt) != LDNS_STATUS_OK) { - result = LDNS_STATUS_ERR; - } else { - result = ldns_send_buffer(result_packet, r, qb, tsig_mac); - } - - ldns_buffer_free(qb); - - return result; -} - -ldns_status -ldns_send_buffer(ldns_pkt **result, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac) -{ - uint8_t i; - - struct sockaddr_storage *ns; - size_t ns_len; - struct timeval tv_s; - struct timeval tv_e; - - ldns_rdf **ns_array; - size_t *rtt; - ldns_pkt *reply; - bool all_servers_rtt_inf; - uint8_t retries; - - uint8_t *reply_bytes = NULL; - size_t reply_size = 0; - ldns_status status, send_status; - - assert(r != NULL); - - status = LDNS_STATUS_OK; - rtt = ldns_resolver_rtt(r); - ns_array = ldns_resolver_nameservers(r); - reply = NULL; - ns_len = 0; - - all_servers_rtt_inf = true; - - if (ldns_resolver_random(r)) { - ldns_resolver_nameservers_randomize(r); - } - - /* loop through all defined nameservers */ - for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { - if (rtt[i] == LDNS_RESOLV_RTT_INF) { - /* not reachable nameserver! */ - continue; - } - - /* maybe verbosity setting? - printf("Sending to "); - ldns_rdf_print(stdout, ns_array[i]); - printf("\n"); - */ - ns = ldns_rdf2native_sockaddr_storage(ns_array[i], - ldns_resolver_port(r), &ns_len); - - if ((ns->ss_family == AF_INET) && - (ldns_resolver_ip6(r) == LDNS_RESOLV_INET6)) { - /* not reachable */ - continue; - } - - if ((ns->ss_family == AF_INET6) && - (ldns_resolver_ip6(r) == LDNS_RESOLV_INET)) { - /* not reachable */ - continue; - } - - all_servers_rtt_inf = false; - - gettimeofday(&tv_s, NULL); - - send_status = LDNS_STATUS_ERR; - - /* reply_bytes implicitly handles our error */ - if (1 == ldns_resolver_usevc(r)) { - for (retries = ldns_resolver_retry(r); retries > 0; retries--) { - send_status = - ldns_tcp_send(&reply_bytes, qb, ns, - (socklen_t)ns_len, ldns_resolver_timeout(r), - &reply_size); - if (send_status == LDNS_STATUS_OK) { - break; - } - } - } else { - for (retries = ldns_resolver_retry(r); retries > 0; retries--) { - /* ldns_rdf_print(stdout, ns_array[i]); */ - send_status = - ldns_udp_send(&reply_bytes, qb, ns, - (socklen_t)ns_len, ldns_resolver_timeout(r), - &reply_size); - - if (send_status == LDNS_STATUS_OK) { - break; - } - } - } - - if (send_status != LDNS_STATUS_OK) { - ldns_resolver_set_nameserver_rtt(r, i, LDNS_RESOLV_RTT_INF); - status = send_status; - } - - /* obey the fail directive */ - if (!reply_bytes) { - /* the current nameserver seems to have a problem, blacklist it */ - if (ldns_resolver_fail(r)) { - LDNS_FREE(ns); - return LDNS_STATUS_ERR; - } else { - LDNS_FREE(ns); - continue; - } - } - - status = ldns_wire2pkt(&reply, reply_bytes, reply_size); - if (status != LDNS_STATUS_OK) { - LDNS_FREE(reply_bytes); - LDNS_FREE(ns); - return status; - } - - LDNS_FREE(ns); - gettimeofday(&tv_e, NULL); - - if (reply) { - ldns_pkt_set_querytime(reply, (uint32_t) - ((tv_e.tv_sec - tv_s.tv_sec) * 1000) + - (tv_e.tv_usec - tv_s.tv_usec) / 1000); - ldns_pkt_set_answerfrom(reply, ns_array[i]); - ldns_pkt_set_timestamp(reply, tv_s); - ldns_pkt_set_size(reply, reply_size); - break; - } else { - if (ldns_resolver_fail(r)) { - /* if fail is set bail out, after the first - * one */ - break; - } - } - - /* wait retrans seconds... */ - sleep((unsigned int) ldns_resolver_retrans(r)); - } - - if (all_servers_rtt_inf) { - LDNS_FREE(reply_bytes); - return LDNS_STATUS_RES_NO_NS; - } -#ifdef HAVE_SSL - if (tsig_mac && reply_bytes) { - if (!ldns_pkt_tsig_verify(reply, - reply_bytes, - reply_size, - ldns_resolver_tsig_keyname(r), - ldns_resolver_tsig_keydata(r), tsig_mac)) { - status = LDNS_STATUS_CRYPTO_TSIG_BOGUS; - } - } -#else - (void)tsig_mac; -#endif /* HAVE_SSL */ - - LDNS_FREE(reply_bytes); - if (result) { - *result = reply; - } - - return status; -} - -/** best effort to set nonblocking */ -static void -ldns_sock_nonblock(int sockfd) -{ -#ifdef HAVE_FCNTL - int flag; - if((flag = fcntl(sockfd, F_GETFL)) != -1) { - flag |= O_NONBLOCK; - if(fcntl(sockfd, F_SETFL, flag) == -1) { - /* ignore error, continue blockingly */ - } - } -#elif defined(HAVE_IOCTLSOCKET) - unsigned long on = 1; - if(ioctlsocket(sockfd, FIONBIO, &on) != 0) { - /* ignore error, continue blockingly */ - } -#endif -} - -/** best effort to set blocking */ -static void -ldns_sock_block(int sockfd) -{ -#ifdef HAVE_FCNTL - int flag; - if((flag = fcntl(sockfd, F_GETFL)) != -1) { - flag &= ~O_NONBLOCK; - if(fcntl(sockfd, F_SETFL, flag) == -1) { - /* ignore error, continue */ - } - } -#elif defined(HAVE_IOCTLSOCKET) - unsigned long off = 0; - if(ioctlsocket(sockfd, FIONBIO, &off) != 0) { - /* ignore error, continue */ - } -#endif -} - -/** wait for a socket to become ready */ -static int -ldns_sock_wait(int sockfd, struct timeval timeout, int write) -{ - fd_set fds; - int ret; -#ifndef S_SPLINT_S - FD_ZERO(&fds); - FD_SET(FD_SET_T sockfd, &fds); -#endif - if(write) - ret = select(sockfd+1, NULL, &fds, NULL, &timeout); - else - ret = select(sockfd+1, &fds, NULL, NULL, &timeout); - if(ret == 0) - /* timeout expired */ - return 0; - else if(ret == -1) - /* error */ - return 0; - return 1; -} - -ldns_status -ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, - socklen_t tolen, struct timeval timeout, size_t *answer_size) -{ - int sockfd; - uint8_t *answer; - - sockfd = ldns_udp_bgsend(qbin, to, tolen, timeout); - - if (sockfd == 0) { - return LDNS_STATUS_SOCKET_ERROR; - } - - /* wait for an response*/ - if(!ldns_sock_wait(sockfd, timeout, 0)) { -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - return LDNS_STATUS_NETWORK_ERR; - } - - /* set to nonblocking, so if the checksum is bad, it becomes - * an EGAIN error and the ldns_udp_send function does not block, - * but returns a 'NETWORK_ERROR' much like a timeout. */ - ldns_sock_nonblock(sockfd); - - answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL); -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - - if (*answer_size == 0) { - /* oops */ - return LDNS_STATUS_NETWORK_ERR; - } - - *result = answer; - return LDNS_STATUS_OK; -} - -int -ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, - struct timeval timeout) -{ - int sockfd; - - sockfd = ldns_udp_connect(to, timeout); - - if (sockfd == 0) { - return 0; - } - - if (ldns_udp_send_query(qbin, sockfd, to, tolen) == 0) { - return 0; - } - return sockfd; -} - -int -ldns_udp_connect(const struct sockaddr_storage *to, struct timeval ATTR_UNUSED(timeout)) -{ - int sockfd; - - if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM, - IPPROTO_UDP)) - == -1) { - return 0; - } - return sockfd; -} - -int -ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, - struct timeval timeout) -{ - int sockfd; - - if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_STREAM, - IPPROTO_TCP)) == -1) { - return 0; - } - - /* perform nonblocking connect, to be able to wait with select() */ - ldns_sock_nonblock(sockfd); - if (connect(sockfd, (struct sockaddr*)to, tolen) == -1) { -#ifndef USE_WINSOCK -#ifdef EINPROGRESS - if(errno != EINPROGRESS) { -#else - if(1) { -#endif - close(sockfd); - return 0; - } -#else /* USE_WINSOCK */ - if(WSAGetLastError() != WSAEINPROGRESS && - WSAGetLastError() != WSAEWOULDBLOCK) { - closesocket(sockfd); - return 0; - } -#endif - /* error was only telling us that it would block */ - } - - /* wait(write) until connected or error */ - while(1) { - int error = 0; - socklen_t len = (socklen_t)sizeof(error); - - if(!ldns_sock_wait(sockfd, timeout, 1)) { -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - return 0; - } - - /* check if there is a pending error for nonblocking connect */ - if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void*)&error, - &len) < 0) { -#ifndef USE_WINSOCK - error = errno; /* on solaris errno is error */ -#else - error = WSAGetLastError(); -#endif - } -#ifndef USE_WINSOCK -#if defined(EINPROGRESS) && defined(EWOULDBLOCK) - if(error == EINPROGRESS || error == EWOULDBLOCK) - continue; /* try again */ -#endif - else if(error != 0) { - close(sockfd); - /* error in errno for our user */ - errno = error; - return 0; - } -#else /* USE_WINSOCK */ - if(error == WSAEINPROGRESS) - continue; - else if(error == WSAEWOULDBLOCK) - continue; - else if(error != 0) { - closesocket(sockfd); - errno = error; - return 0; - } -#endif /* USE_WINSOCK */ - /* connected */ - break; - } - - /* set the socket blocking again */ - ldns_sock_block(sockfd); - - return sockfd; -} - -ssize_t -ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, - const struct sockaddr_storage *to, socklen_t tolen) -{ - uint8_t *sendbuf; - ssize_t bytes; - - /* add length of packet */ - sendbuf = LDNS_XMALLOC(uint8_t, ldns_buffer_position(qbin) + 2); - if(!sendbuf) return 0; - ldns_write_uint16(sendbuf, ldns_buffer_position(qbin)); - memcpy(sendbuf + 2, ldns_buffer_export(qbin), ldns_buffer_position(qbin)); - - bytes = sendto(sockfd, (void*)sendbuf, - ldns_buffer_position(qbin) + 2, 0, (struct sockaddr *)to, tolen); - - LDNS_FREE(sendbuf); - - if (bytes == -1 || (size_t) bytes != ldns_buffer_position(qbin) + 2 ) { - return 0; - } - return bytes; -} - -/* don't wait for an answer */ -ssize_t -ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, - socklen_t tolen) -{ - ssize_t bytes; - - bytes = sendto(sockfd, (void*)ldns_buffer_begin(qbin), - ldns_buffer_position(qbin), 0, (struct sockaddr *)to, tolen); - - if (bytes == -1 || (size_t)bytes != ldns_buffer_position(qbin)) { - return 0; - } - if ((size_t) bytes != ldns_buffer_position(qbin)) { - return 0; - } - return bytes; -} - -uint8_t * -ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *from, - socklen_t *fromlen) -{ - uint8_t *wire, *wireout; - ssize_t wire_size; - - wire = LDNS_XMALLOC(uint8_t, LDNS_MAX_PACKETLEN); - if (!wire) { - *size = 0; - return NULL; - } - - wire_size = recvfrom(sockfd, (void*)wire, LDNS_MAX_PACKETLEN, 0, - (struct sockaddr *)from, fromlen); - - /* recvfrom can also return 0 */ - if (wire_size == -1 || wire_size == 0) { - *size = 0; - LDNS_FREE(wire); - return NULL; - } - - *size = (size_t)wire_size; - wireout = LDNS_XREALLOC(wire, uint8_t, (size_t)wire_size); - if(!wireout) LDNS_FREE(wire); - - return wireout; -} - -uint8_t * -ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout) -{ - uint8_t *wire; - uint16_t wire_size; - ssize_t bytes = 0, rc = 0; - - wire = LDNS_XMALLOC(uint8_t, 2); - if (!wire) { - *size = 0; - return NULL; - } - - while (bytes < 2) { - if(!ldns_sock_wait(sockfd, timeout, 0)) { - *size = 0; - LDNS_FREE(wire); - return NULL; - } - rc = recv(sockfd, (void*) (wire + bytes), - (size_t) (2 - bytes), 0); - if (rc == -1 || rc == 0) { - *size = 0; - LDNS_FREE(wire); - return NULL; - } - bytes += rc; - } - - wire_size = ldns_read_uint16(wire); - - LDNS_FREE(wire); - wire = LDNS_XMALLOC(uint8_t, wire_size); - if (!wire) { - *size = 0; - return NULL; - } - bytes = 0; - - while (bytes < (ssize_t) wire_size) { - if(!ldns_sock_wait(sockfd, timeout, 0)) { - *size = 0; - LDNS_FREE(wire); - return NULL; - } - rc = recv(sockfd, (void*) (wire + bytes), - (size_t) (wire_size - bytes), 0); - if (rc == -1 || rc == 0) { - LDNS_FREE(wire); - *size = 0; - return NULL; - } - bytes += rc; - } - - *size = (size_t) bytes; - return wire; -} - -uint8_t * -ldns_tcp_read_wire(int sockfd, size_t *size) -{ - uint8_t *wire; - uint16_t wire_size; - ssize_t bytes = 0, rc = 0; - - wire = LDNS_XMALLOC(uint8_t, 2); - if (!wire) { - *size = 0; - return NULL; - } - - while (bytes < 2) { - rc = recv(sockfd, (void*) (wire + bytes), - (size_t) (2 - bytes), 0); - if (rc == -1 || rc == 0) { - *size = 0; - LDNS_FREE(wire); - return NULL; - } - bytes += rc; - } - - wire_size = ldns_read_uint16(wire); - - LDNS_FREE(wire); - wire = LDNS_XMALLOC(uint8_t, wire_size); - if (!wire) { - *size = 0; - return NULL; - } - bytes = 0; - - while (bytes < (ssize_t) wire_size) { - rc = recv(sockfd, (void*) (wire + bytes), - (size_t) (wire_size - bytes), 0); - if (rc == -1 || rc == 0) { - LDNS_FREE(wire); - *size = 0; - return NULL; - } - bytes += rc; - } - - *size = (size_t) bytes; - return wire; -} - -/* keep in mind that in DNS tcp messages the first 2 bytes signal the - * amount data to expect - */ -ldns_status -ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, - socklen_t tolen, struct timeval timeout, size_t *answer_size) -{ - int sockfd; - uint8_t *answer; - - sockfd = ldns_tcp_bgsend(qbin, to, tolen, timeout); - - if (sockfd == 0) { - return LDNS_STATUS_ERR; - } - - answer = ldns_tcp_read_wire_timeout(sockfd, answer_size, timeout); -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif - - if (*answer_size == 0) { - /* oops */ - return LDNS_STATUS_NETWORK_ERR; - } - - /* resize accordingly */ - *result = (uint8_t*)LDNS_XREALLOC(answer, uint8_t *, (size_t)*answer_size); - if(!*result) { - LDNS_FREE(answer); - return LDNS_STATUS_MEM_ERR; - } - return LDNS_STATUS_OK; -} - -int -ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, - struct timeval timeout) -{ - int sockfd; - - sockfd = ldns_tcp_connect(to, tolen, timeout); - - if (sockfd == 0) { - return 0; - } - - if (ldns_tcp_send_query(qbin, sockfd, to, tolen) == 0) { - return 0; - } - - return sockfd; -} - -/* code from rdata.c */ -struct sockaddr_storage * -ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size) -{ - struct sockaddr_storage *data; - struct sockaddr_in *data_in; - struct sockaddr_in6 *data_in6; - - data = LDNS_MALLOC(struct sockaddr_storage); - if (!data) { - return NULL; - } - /* zero the structure for portability */ - memset(data, 0, sizeof(struct sockaddr_storage)); - if (port == 0) { - port = LDNS_PORT; - } - - switch(ldns_rdf_get_type(rd)) { - case LDNS_RDF_TYPE_A: - data->ss_family = AF_INET; - data_in = (struct sockaddr_in*) data; - data_in->sin_port = (in_port_t)htons(port); - memcpy(&(data_in->sin_addr), ldns_rdf_data(rd), ldns_rdf_size(rd)); - *size = sizeof(struct sockaddr_in); - return data; - case LDNS_RDF_TYPE_AAAA: - data->ss_family = AF_INET6; - data_in6 = (struct sockaddr_in6*) data; - data_in6->sin6_port = (in_port_t)htons(port); - memcpy(&data_in6->sin6_addr, ldns_rdf_data(rd), ldns_rdf_size(rd)); - *size = sizeof(struct sockaddr_in6); - return data; - default: - LDNS_FREE(data); - return NULL; - } -} - -ldns_rdf * -ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port) -{ - ldns_rdf *addr; - struct sockaddr_in *data_in; - struct sockaddr_in6 *data_in6; - - switch(sock->ss_family) { - case AF_INET: - data_in = (struct sockaddr_in*)sock; - if (port) { - *port = ntohs((uint16_t)data_in->sin_port); - } - addr = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_A, - LDNS_IP4ADDRLEN, &data_in->sin_addr); - break; - case AF_INET6: - data_in6 = (struct sockaddr_in6*)sock; - if (port) { - *port = ntohs((uint16_t)data_in6->sin6_port); - } - addr = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_AAAA, - LDNS_IP6ADDRLEN, &data_in6->sin6_addr); - break; - default: - if (port) { - *port = 0; - } - return NULL; - } - return addr; -} - -/* code from resolver.c */ -ldns_status -ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) -{ - ldns_pkt *query; - ldns_buffer *query_wire; - - struct sockaddr_storage *ns = NULL; - size_t ns_len = 0; - size_t ns_i; - ldns_status status; - - if (!resolver || ldns_resolver_nameserver_count(resolver) < 1) { - return LDNS_STATUS_ERR; - } - - query = ldns_pkt_query_new(ldns_rdf_clone(domain), LDNS_RR_TYPE_AXFR, class, 0); - - if (!query) { - return LDNS_STATUS_ADDRESS_ERR; - } - /* For AXFR, we have to make the connection ourselves */ - /* try all nameservers (which usually would mean v4 fallback if - * @hostname is used */ - for (ns_i = 0; - ns_i < ldns_resolver_nameserver_count(resolver) && - resolver->_socket == 0; - ns_i++) { - ns = ldns_rdf2native_sockaddr_storage( - resolver->_nameservers[ns_i], - ldns_resolver_port(resolver), &ns_len); - - resolver->_socket = ldns_tcp_connect(ns, (socklen_t)ns_len, - ldns_resolver_timeout(resolver)); - } - - if (resolver->_socket == 0) { - ldns_pkt_free(query); - LDNS_FREE(ns); - return LDNS_STATUS_NETWORK_ERR; - } - -#ifdef HAVE_SSL - if (ldns_resolver_tsig_keyname(resolver) && ldns_resolver_tsig_keydata(resolver)) { - status = ldns_pkt_tsig_sign(query, - ldns_resolver_tsig_keyname(resolver), - ldns_resolver_tsig_keydata(resolver), - 300, ldns_resolver_tsig_algorithm(resolver), NULL); - if (status != LDNS_STATUS_OK) { - /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start - we have to close the socket here! */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - - return LDNS_STATUS_CRYPTO_TSIG_ERR; - } - } -#endif /* HAVE_SSL */ - - /* Convert the query to a buffer - * Is this necessary? - */ - query_wire = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if(!query_wire) { - ldns_pkt_free(query); - LDNS_FREE(ns); -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - - return LDNS_STATUS_MEM_ERR; - } - status = ldns_pkt2buffer_wire(query_wire, query); - if (status != LDNS_STATUS_OK) { - ldns_pkt_free(query); - ldns_buffer_free(query_wire); - LDNS_FREE(ns); - - /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start - we have to close the socket here! */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - - return status; - } - /* Send the query */ - if (ldns_tcp_send_query(query_wire, resolver->_socket, ns, - (socklen_t)ns_len) == 0) { - ldns_pkt_free(query); - ldns_buffer_free(query_wire); - LDNS_FREE(ns); - - /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start - we have to close the socket here! */ - -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - - return LDNS_STATUS_NETWORK_ERR; - } - - ldns_pkt_free(query); - ldns_buffer_free(query_wire); - LDNS_FREE(ns); - - /* - * The AXFR is done once the second SOA record is sent - */ - resolver->_axfr_soa_count = 0; - return LDNS_STATUS_OK; -} diff --git a/libs/ldns/packaging/fedora/ldns.spec b/libs/ldns/packaging/fedora/ldns.spec deleted file mode 100644 index abcdc81308..0000000000 --- a/libs/ldns/packaging/fedora/ldns.spec +++ /dev/null @@ -1,276 +0,0 @@ -%{?!with_python: %global with_python 1} - -%if %{with_python} -%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} -%endif - -Summary: Lowlevel DNS(SEC) library with API -Name: ldns -Version: 1.6.9 -Release: 2%{?dist} -License: BSD -Url: http://www.nlnetlabs.nl/%{name}/ -Source: http://www.nlnetlabs.nl/downloads/%{name}-%{version}.tar.gz -Group: System Environment/Libraries -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: libtool, autoconf, automake, gcc-c++, doxygen, -BuildRequires: perl, libpcap-devel, openssl-devel - -%if %{with_python} -BuildRequires: python-devel, swig -%endif - -%description -ldns is a library with the aim to simplify DNS programing in C. All -lowlevel DNS/DNSSEC operations are supported. We also define a higher -level API which allows a programmer to (for instance) create or sign -packets. - -%package devel -Summary: Development package that includes the ldns header files -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -The devel package contains the ldns library and the include files - -%if %{with_python} -%package python -Summary: Python extensions for ldns -Group: Applications/System -Requires: %{name} = %{version}-%{release} - -%description python -Python extensions for ldns -%endif - - -%prep -%setup -q -# To built svn snapshots -#rm config.guess config.sub ltmain.sh -#aclocal -#libtoolize -c --install -#autoreconf --install - -%build -%configure --disable-rpath --disable-static --with-sha2 \ -%if %{with_python} - --with-pyldns -%endif - -(cd drill ; %configure --disable-rpath --disable-static --with-ldns=%{buildroot}/lib/ ) -(cd examples ; %configure --disable-rpath --disable-static --with-ldns=%{buildroot}/lib/ ) - -make %{?_smp_mflags} -( cd drill ; make %{?_smp_mflags} ) -( cd examples ; make %{?_smp_mflags} ) -make %{?_smp_mflags} doc - -%install -rm -rf %{buildroot} - -make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install -make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install-doc - -# don't package building script in doc -rm doc/doxyparse.pl -#remove doc stubs -rm -rf doc/.svn -#remove double set of man pages -rm -rf doc/man - -# remove .la files -rm -rf %{buildroot}%{_libdir}/*.la %{buildroot}%{python_sitelib}/*.la -(cd drill ; make DESTDIR=%{buildroot} install) -(cd examples; make DESTDIR=%{buildroot} install) - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root) -%{_libdir}/libldns*so.* -%{_bindir}/drill -%{_bindir}/ldnsd -#%{_bindir}/ldns-* -%{_bindir}/ldns-chaos -%{_bindir}/ldns-compare-zones -%{_bindir}/ldns-[d-z]* -%doc README LICENSE -%{_mandir}/*/* - -%files devel -%defattr(-,root,root,-) -%{_libdir}/libldns*so -%{_bindir}/ldns-config -%dir %{_includedir}/ldns -%{_includedir}/ldns/*.h -%doc doc Changelog README - -%if %{with_python} -%files python -%defattr(-,root,root) -%{python_sitelib}/* -%endif - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - -%changelog -* Wed Mar 16 2011 Willem Toorop - 1.6.9 -- Upgraded to 1.6.9. - -* Mon Nov 8 2010 Matthijs Mekking - 1.6.8 -- Upgraded to 1.6.8. - -* Tue Aug 24 2010 Matthijs Mekking - 1.6.7 -- Upgraded to 1.6.7. - -* Fri Jan 22 2010 Paul Wouters - 1.6.4-2 -- Fix missing _ldns.so causing ldns-python to not work -- Patch for installing ldns-python files -- Patch for rpath in ldns-python -- Don't install .a file for ldns-python - -* Wed Jan 20 2010 Paul Wouters - 1.6.4-1 -- Upgraded to 1.6.4. -- Added ldns-python sub package - -* Fri Dec 04 2009 Paul Wouters - 1.6.3-1 -- Upgraded to 1.6.3, which has minor bugfixes - -* Fri Nov 13 2009 Paul Wouters - 1.6.2-1 -- Upgraded to 1.6.2. This fixes various bugs. - (upstream released mostly to default with sha2 for the imminent - signed root, but we already enabled that in our builds) - -* Tue Aug 25 2009 Tomas Mraz - 1.6.1-3 -- rebuilt with new openssl - -* Sun Aug 16 2009 Paul Wouters - 1.6.1-2 -- Added openssl dependancy back in, since we get more functionality - when using openssl. Especially in 'drill'. - -* Sun Aug 16 2009 Paul Wouters - 1.6.1-1 -- Updated to 1.6.1 - -* Fri Jul 24 2009 Fedora Release Engineering - 1.6.0-5 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Mon Jul 13 2009 Paul Wouters - 1.6.0-4 -- Fixed the ssl patch so it can now compile --without-ssl - -* Sat Jul 11 2009 Paul Wouters - 1.6.0-3 -- Added patch to compile with --without-ssl -- Removed openssl dependancies -- Recompiled with --without-ssl - -* Sat Jul 11 2009 Paul Wouters - 1.6.0-2 -- Updated to 1.6.0 -- (did not yet compile with --without-ssl due to compile failures) - -* Fri Jul 10 2009 Paul Wouters - 1.6.0-1 -- Updated to 1.6.0 -- Compile without openssl - -* Thu Apr 16 2009 Paul Wouters - 1.5.1-4 -- Memory management bug when generating a sha256 key, see: - https://bugzilla.redhat.com/show_bug.cgi?id=493953 - -* Wed Feb 25 2009 Fedora Release Engineering - 1.5.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Mon Feb 10 2009 Paul Wouters - 1.5.1-1 -- Updated to new version, 1.5.0 had a bug preventing - zone signing. - -* Mon Feb 9 2009 Paul Wouters - 1.5.0-1 -- Updated to new version - -* Thu Feb 05 2009 Adam Tkac - 1.4.0-3 -- fixed configure flags - -* Sat Jan 17 2009 Tomas Mraz - 1.4.0-2 -- rebuild with new openssl - -* Fri Nov 7 2008 Paul Wouters - 1.4.0-1 -- Updated to 1.4.0 - -* Wed May 28 2008 Paul Wouters - 1.3.0-3 -- enable SHA2 functionality - -* Wed May 28 2008 Paul Wouters - 1.3.0-2 -- re-tag (don't do builds while renaming local repo dirs) - -* Wed May 28 2008 Paul Wouters - 1.3.0-1 -- Updated to latest release - -* Tue Feb 19 2008 Fedora Release Engineering - 1.2.2-3 -- Autorebuild for GCC 4.3 - -* Wed Dec 5 2007 Paul Wouters - 1.2.2-2 -- Rebuild for new libcrypto - -* Thu Nov 29 2007 Paul Wouters - 1.2.2-1 -- Upgraded to 1.2.2. Removed no longer needed race workaround - -* Tue Nov 13 2007 Paul Wouters - 1.2.1-4 -- Try to fix racing ln -s statements in parallel builds - -* Fri Nov 9 2007 Paul Wouters - 1.2.1-3 -- Added patch for ldns-read-zone that does not put @. in RRDATA - -* Fri Oct 19 2007 Paul Wouters - 1.2.1-2 -- Use install -p to work around multilib conflicts for .h files - -* Wed Oct 10 2007 Paul Wouters - 1.2.1-1 -- Updated to 1.2.1 -- Removed patches that got moved into upstream - -* Wed Aug 8 2007 Paul Wouters 1.2.0-11 -- Patch for ldns-key2ds to write to stdout -- Again remove extra set of man pages from doc -- own /usr/include/ldns (bug 233858) - -* Wed Aug 8 2007 Paul Wouters 1.2.0-10 -- Added sha256 DS record patch to ldns-key2ds -- Minor tweaks for proper doc/man page installation. -- Workaround for parallel builds - -* Mon Aug 6 2007 Paul Wouters 1.2.0-2 -- Own the /usr/include/ldns directory (bug #233858) -- Removed obsoleted patch -- Remove files form previous libtool run accidentally packages by upstream - -* Mon Sep 11 2006 Paul Wouters 1.0.1-4 -- Commented out 1.1.0 make targets, put make 1.0.1 targets. - -* Mon Sep 11 2006 Paul Wouters 1.0.1-3 -- Fixed changelog typo in date -- Rebuild requested for PT_GNU_HASH support from gcc -- Did not upgrade to 1.1.0 due to compile issues on x86_64 - -* Fri Jan 6 2006 Paul Wouters 1.0.1-1 -- Upgraded to 1.0.1. Removed temporary clean hack from spec file. - -* Sun Dec 18 2005 Paul Wouters 1.0.0-8 -- Cannot use make clean because there are no Makefiles. Use hardcoded rm. - -* Sun Dec 18 2005 Paul Wouters 1.0.0-7 -- Patched 'make clean' target to get rid of object files shipped with 1.0.0 - -* Sun Dec 13 2005 Paul Wouters 1.0.0-6 -- added a make clean for 2.3.3 since .o files were left behind upstream, - causing failure on ppc platform - -* Sun Dec 11 2005 Tom "spot" Callaway 1.0.0-5 -- minor cleanups - -* Wed Oct 5 2005 Paul Wouters 0.70_1205 -- reworked for svn version - -* Sun Sep 25 2005 Paul Wouters - 0.70 -- Initial version diff --git a/libs/ldns/packaging/ldns-config.in b/libs/ldns/packaging/ldns-config.in deleted file mode 100755 index b728ba544e..0000000000 --- a/libs/ldns/packaging/ldns-config.in +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -prefix="@prefix@" -exec_prefix="@exec_prefix@" -VERSION="@PACKAGE_VERSION@" -CFLAGS="@CFLAGS@" -CPPFLAGS="@CPPFLAGS@ @LIBSSL_CPPFLAGS@ @PYTHON_CPPFLAGS@" -LDFLAGS="@LDFLAGS@ @LIBSSL_LDFLAGS@ @PYTHON_LDFLAGS@" -LIBS="@LIBS@ @LIBSSL_LIBS@" -LIBDIR="@libdir@" -INCLUDEDIR="@includedir@" - -for arg in $@ -do - if [ $arg = "--cflags" ] - then - echo "-I${INCLUDEDIR}" - fi - if [ $arg = "--libs" ] - then - echo "${LDFLAGS} -L${LIBDIR} ${LIBS} -lldns" - fi - if [ $arg = "-h" ] || [ $arg = "--help" ] - then - echo "Usage: $0 [--cflags] [--libs] [--version]" - fi - if [ $arg = "--version" ] - then - echo "${VERSION}" - fi -done diff --git a/libs/ldns/packaging/libldns.pc.in b/libs/ldns/packaging/libldns.pc.in deleted file mode 100644 index 923b688379..0000000000 --- a/libs/ldns/packaging/libldns.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: ldns -Description: Library for DNS programming -URL: http://www.nlnetlabs.nl/projects/ldns -Version: @PACKAGE_VERSION@ -Requires: -Libs: -L${libdir} -lldns -Libs.private: @LDFLAGS@ -Cflags: -I${includedir} diff --git a/libs/ldns/packet.c b/libs/ldns/packet.c deleted file mode 100644 index 0ac5ca8ba3..0000000000 --- a/libs/ldns/packet.c +++ /dev/null @@ -1,1007 +0,0 @@ -/* - * packet.c - * - * dns packet implementation - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include - -#include -#include - -#ifdef HAVE_SSL -#include -#endif - -/* Access functions - * do this as functions to get type checking - */ - -#define LDNS_EDNS_MASK_DO_BIT 0x8000 - -/* TODO defines for 3600 */ -/* convert to and from numerical flag values */ -ldns_lookup_table ldns_edns_flags[] = { - { 3600, "do"}, - { 0, NULL} -}; - -/* read */ -uint16_t -ldns_pkt_id(const ldns_pkt *packet) -{ - return packet->_header->_id; -} - -bool -ldns_pkt_qr(const ldns_pkt *packet) -{ - return packet->_header->_qr; -} - -bool -ldns_pkt_aa(const ldns_pkt *packet) -{ - return packet->_header->_aa; -} - -bool -ldns_pkt_tc(const ldns_pkt *packet) -{ - return packet->_header->_tc; -} - -bool -ldns_pkt_rd(const ldns_pkt *packet) -{ - return packet->_header->_rd; -} - -bool -ldns_pkt_cd(const ldns_pkt *packet) -{ - return packet->_header->_cd; -} - -bool -ldns_pkt_ra(const ldns_pkt *packet) -{ - return packet->_header->_ra; -} - -bool -ldns_pkt_ad(const ldns_pkt *packet) -{ - return packet->_header->_ad; -} - -ldns_pkt_opcode -ldns_pkt_get_opcode(const ldns_pkt *packet) -{ - return packet->_header->_opcode; -} - -ldns_pkt_rcode -ldns_pkt_get_rcode(const ldns_pkt *packet) -{ - return packet->_header->_rcode; -} - -uint16_t -ldns_pkt_qdcount(const ldns_pkt *packet) -{ - return packet->_header->_qdcount; -} - -uint16_t -ldns_pkt_ancount(const ldns_pkt *packet) -{ - return packet->_header->_ancount; -} - -uint16_t -ldns_pkt_nscount(const ldns_pkt *packet) -{ - return packet->_header->_nscount; -} - -uint16_t -ldns_pkt_arcount(const ldns_pkt *packet) -{ - return packet->_header->_arcount; -} - -ldns_rr_list * -ldns_pkt_question(const ldns_pkt *packet) -{ - return packet->_question; -} - -ldns_rr_list * -ldns_pkt_answer(const ldns_pkt *packet) -{ - return packet->_answer; -} - -ldns_rr_list * -ldns_pkt_authority(const ldns_pkt *packet) -{ - return packet->_authority; -} - -ldns_rr_list * -ldns_pkt_additional(const ldns_pkt *packet) -{ - return packet->_additional; -} - -/* return ALL section concatenated */ -ldns_rr_list * -ldns_pkt_all(const ldns_pkt *packet) -{ - ldns_rr_list *all, *prev_all; - - all = ldns_rr_list_cat_clone( - ldns_pkt_question(packet), - ldns_pkt_answer(packet)); - prev_all = all; - all = ldns_rr_list_cat_clone(all, - ldns_pkt_authority(packet)); - ldns_rr_list_deep_free(prev_all); - prev_all = all; - all = ldns_rr_list_cat_clone(all, - ldns_pkt_additional(packet)); - ldns_rr_list_deep_free(prev_all); - return all; -} - -ldns_rr_list * -ldns_pkt_all_noquestion(const ldns_pkt *packet) -{ - ldns_rr_list *all, *all2; - - all = ldns_rr_list_cat_clone( - ldns_pkt_answer(packet), - ldns_pkt_authority(packet)); - all2 = ldns_rr_list_cat_clone(all, - ldns_pkt_additional(packet)); - - ldns_rr_list_deep_free(all); - return all2; -} - -size_t -ldns_pkt_size(const ldns_pkt *packet) -{ - return packet->_size; -} - -uint32_t -ldns_pkt_querytime(const ldns_pkt *packet) -{ - return packet->_querytime; -} - -ldns_rdf * -ldns_pkt_answerfrom(const ldns_pkt *packet) -{ - return packet->_answerfrom; -} - -struct timeval -ldns_pkt_timestamp(const ldns_pkt *packet) -{ - return packet->timestamp; -} - -uint16_t -ldns_pkt_edns_udp_size(const ldns_pkt *packet) -{ - return packet->_edns_udp_size; -} - -uint8_t -ldns_pkt_edns_extended_rcode(const ldns_pkt *packet) -{ - return packet->_edns_extended_rcode; -} - -uint8_t -ldns_pkt_edns_version(const ldns_pkt *packet) -{ - return packet->_edns_version; -} - -uint16_t -ldns_pkt_edns_z(const ldns_pkt *packet) -{ - return packet->_edns_z; -} - -bool -ldns_pkt_edns_do(const ldns_pkt *packet) -{ - return (packet->_edns_z & LDNS_EDNS_MASK_DO_BIT); -} - -void -ldns_pkt_set_edns_do(ldns_pkt *packet, bool value) -{ - if (value) { - packet->_edns_z = packet->_edns_z | LDNS_EDNS_MASK_DO_BIT; - } else { - packet->_edns_z = packet->_edns_z & ~LDNS_EDNS_MASK_DO_BIT; - } -} - -ldns_rdf * -ldns_pkt_edns_data(const ldns_pkt *packet) -{ - return packet->_edns_data; -} - -/* return only those rr that share the ownername */ -ldns_rr_list * -ldns_pkt_rr_list_by_name(ldns_pkt *packet, - ldns_rdf *ownername, - ldns_pkt_section sec) -{ - ldns_rr_list *rrs; - ldns_rr_list *new; - ldns_rr_list *ret; - uint16_t i; - - if (!packet) { - return NULL; - } - - rrs = ldns_pkt_get_section_clone(packet, sec); - new = ldns_rr_list_new(); - ret = NULL; - - for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - if (ldns_rdf_compare(ldns_rr_owner( - ldns_rr_list_rr(rrs, i)), - ownername) == 0) { - /* owner names match */ - ldns_rr_list_push_rr(new, ldns_rr_list_rr(rrs, i)); - ret = new; - } - } - return ret; -} - -/* return only those rr that share a type */ -ldns_rr_list * -ldns_pkt_rr_list_by_type(const ldns_pkt *packet, - ldns_rr_type type, - ldns_pkt_section sec) -{ - ldns_rr_list *rrs; - ldns_rr_list *new; - uint16_t i; - - if(!packet) { - return NULL; - } - - rrs = ldns_pkt_get_section_clone(packet, sec); - new = ldns_rr_list_new(); - - for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - if (type == ldns_rr_get_type(ldns_rr_list_rr(rrs, i))) { - /* types match */ - ldns_rr_list_push_rr(new, - ldns_rr_clone( - ldns_rr_list_rr(rrs, i)) - ); - } - } - ldns_rr_list_deep_free(rrs); - - if (ldns_rr_list_rr_count(new) == 0) { - ldns_rr_list_free(new); - return NULL; - } else { - return new; - } -} - -/* return only those rrs that share name and type */ -ldns_rr_list * -ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, - const ldns_rdf *ownername, - ldns_rr_type type, - ldns_pkt_section sec) -{ - ldns_rr_list *rrs; - ldns_rr_list *new; - ldns_rr_list *ret; - uint16_t i; - - if(!packet) { - return NULL; - } - - rrs = ldns_pkt_get_section_clone(packet, sec); - new = ldns_rr_list_new(); - ret = NULL; - - for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - if (type == ldns_rr_get_type(ldns_rr_list_rr(rrs, i)) && - ldns_rdf_compare(ldns_rr_owner(ldns_rr_list_rr(rrs, i)), - ownername - ) == 0 - ) { - /* types match */ - ldns_rr_list_push_rr(new, ldns_rr_clone(ldns_rr_list_rr(rrs, i))); - ret = new; - } - } - ldns_rr_list_deep_free(rrs); - if (!ret) { - ldns_rr_list_free(new); - } - return ret; -} - -bool -ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr) -{ - bool result = false; - - switch (sec) { - case LDNS_SECTION_QUESTION: - return ldns_rr_list_contains_rr(ldns_pkt_question(pkt), rr); - case LDNS_SECTION_ANSWER: - return ldns_rr_list_contains_rr(ldns_pkt_answer(pkt), rr); - case LDNS_SECTION_AUTHORITY: - return ldns_rr_list_contains_rr(ldns_pkt_authority(pkt), rr); - case LDNS_SECTION_ADDITIONAL: - return ldns_rr_list_contains_rr(ldns_pkt_additional(pkt), rr); - case LDNS_SECTION_ANY: - result = ldns_rr_list_contains_rr(ldns_pkt_question(pkt), rr); - case LDNS_SECTION_ANY_NOQUESTION: - result = result - || ldns_rr_list_contains_rr(ldns_pkt_answer(pkt), rr) - || ldns_rr_list_contains_rr(ldns_pkt_authority(pkt), rr) - || ldns_rr_list_contains_rr(ldns_pkt_additional(pkt), rr); - } - - return result; -} - -uint16_t -ldns_pkt_section_count(const ldns_pkt *packet, ldns_pkt_section s) -{ - switch(s) { - case LDNS_SECTION_QUESTION: - return ldns_pkt_qdcount(packet); - case LDNS_SECTION_ANSWER: - return ldns_pkt_ancount(packet); - case LDNS_SECTION_AUTHORITY: - return ldns_pkt_nscount(packet); - case LDNS_SECTION_ADDITIONAL: - return ldns_pkt_arcount(packet); - case LDNS_SECTION_ANY: - return ldns_pkt_qdcount(packet) + - ldns_pkt_ancount(packet) + - ldns_pkt_nscount(packet) + - ldns_pkt_arcount(packet); - case LDNS_SECTION_ANY_NOQUESTION: - return ldns_pkt_ancount(packet) + - ldns_pkt_nscount(packet) + - ldns_pkt_arcount(packet); - default: - return 0; - } -} - -bool -ldns_pkt_empty(ldns_pkt *p) -{ - if (!p) { - return true; /* NULL is empty? */ - } - if (ldns_pkt_section_count(p, LDNS_SECTION_ANY) > 0) { - return false; - } else { - return true; - } -} - - -ldns_rr_list * -ldns_pkt_get_section_clone(const ldns_pkt *packet, ldns_pkt_section s) -{ - switch(s) { - case LDNS_SECTION_QUESTION: - return ldns_rr_list_clone(ldns_pkt_question(packet)); - case LDNS_SECTION_ANSWER: - return ldns_rr_list_clone(ldns_pkt_answer(packet)); - case LDNS_SECTION_AUTHORITY: - return ldns_rr_list_clone(ldns_pkt_authority(packet)); - case LDNS_SECTION_ADDITIONAL: - return ldns_rr_list_clone(ldns_pkt_additional(packet)); - case LDNS_SECTION_ANY: - /* these are already clones */ - return ldns_pkt_all(packet); - case LDNS_SECTION_ANY_NOQUESTION: - return ldns_pkt_all_noquestion(packet); - default: - return NULL; - } -} - -ldns_rr *ldns_pkt_tsig(const ldns_pkt *pkt) { - return pkt->_tsig_rr; -} - -/* write */ -void -ldns_pkt_set_id(ldns_pkt *packet, uint16_t id) -{ - packet->_header->_id = id; -} - -void -ldns_pkt_set_random_id(ldns_pkt *packet) -{ - uint16_t rid = ldns_get_random(); - ldns_pkt_set_id(packet, rid); -} - - -void -ldns_pkt_set_qr(ldns_pkt *packet, bool qr) -{ - packet->_header->_qr = qr; -} - -void -ldns_pkt_set_aa(ldns_pkt *packet, bool aa) -{ - packet->_header->_aa = aa; -} - -void -ldns_pkt_set_tc(ldns_pkt *packet, bool tc) -{ - packet->_header->_tc = tc; -} - -void -ldns_pkt_set_rd(ldns_pkt *packet, bool rd) -{ - packet->_header->_rd = rd; -} - -void -ldns_pkt_set_additional(ldns_pkt *p, ldns_rr_list *rr) -{ - p->_additional = rr; -} - -void -ldns_pkt_set_question(ldns_pkt *p, ldns_rr_list *rr) -{ - p->_question = rr; -} - -void -ldns_pkt_set_answer(ldns_pkt *p, ldns_rr_list *rr) -{ - p->_answer = rr; -} - -void -ldns_pkt_set_authority(ldns_pkt *p, ldns_rr_list *rr) -{ - p->_authority = rr; -} - -void -ldns_pkt_set_cd(ldns_pkt *packet, bool cd) -{ - packet->_header->_cd = cd; -} - -void -ldns_pkt_set_ra(ldns_pkt *packet, bool ra) -{ - packet->_header->_ra = ra; -} - -void -ldns_pkt_set_ad(ldns_pkt *packet, bool ad) -{ - packet->_header->_ad = ad; -} - -void -ldns_pkt_set_opcode(ldns_pkt *packet, ldns_pkt_opcode opcode) -{ - packet->_header->_opcode = opcode; -} - -void -ldns_pkt_set_rcode(ldns_pkt *packet, uint8_t rcode) -{ - packet->_header->_rcode = rcode; -} - -void -ldns_pkt_set_qdcount(ldns_pkt *packet, uint16_t qdcount) -{ - packet->_header->_qdcount = qdcount; -} - -void -ldns_pkt_set_ancount(ldns_pkt *packet, uint16_t ancount) -{ - packet->_header->_ancount = ancount; -} - -void -ldns_pkt_set_nscount(ldns_pkt *packet, uint16_t nscount) -{ - packet->_header->_nscount = nscount; -} - -void -ldns_pkt_set_arcount(ldns_pkt *packet, uint16_t arcount) -{ - packet->_header->_arcount = arcount; -} - -void -ldns_pkt_set_querytime(ldns_pkt *packet, uint32_t time) -{ - packet->_querytime = time; -} - -void -ldns_pkt_set_answerfrom(ldns_pkt *packet, ldns_rdf *answerfrom) -{ - packet->_answerfrom = answerfrom; -} - -void -ldns_pkt_set_timestamp(ldns_pkt *packet, struct timeval timeval) -{ - packet->timestamp.tv_sec = timeval.tv_sec; - packet->timestamp.tv_usec = timeval.tv_usec; -} - -void -ldns_pkt_set_size(ldns_pkt *packet, size_t s) -{ - packet->_size = s; -} - -void -ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s) -{ - packet->_edns_udp_size = s; -} - -void -ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c) -{ - packet->_edns_extended_rcode = c; -} - -void -ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v) -{ - packet->_edns_version = v; -} - -void -ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z) -{ - packet->_edns_z = z; -} - -void -ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data) -{ - packet->_edns_data = data; -} - -void -ldns_pkt_set_section_count(ldns_pkt *packet, ldns_pkt_section s, uint16_t count) -{ - switch(s) { - case LDNS_SECTION_QUESTION: - ldns_pkt_set_qdcount(packet, count); - break; - case LDNS_SECTION_ANSWER: - ldns_pkt_set_ancount(packet, count); - break; - case LDNS_SECTION_AUTHORITY: - ldns_pkt_set_nscount(packet, count); - break; - case LDNS_SECTION_ADDITIONAL: - ldns_pkt_set_arcount(packet, count); - break; - case LDNS_SECTION_ANY: - case LDNS_SECTION_ANY_NOQUESTION: - break; - } -} - -void ldns_pkt_set_tsig(ldns_pkt *pkt, ldns_rr *rr) -{ - pkt->_tsig_rr = rr; -} - -bool -ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr) -{ - switch(section) { - case LDNS_SECTION_QUESTION: - ldns_rr_list_push_rr(ldns_pkt_question(packet), rr); - ldns_pkt_set_qdcount(packet, ldns_pkt_qdcount(packet) + 1); - break; - case LDNS_SECTION_ANSWER: - ldns_rr_list_push_rr(ldns_pkt_answer(packet), rr); - ldns_pkt_set_ancount(packet, ldns_pkt_ancount(packet) + 1); - break; - case LDNS_SECTION_AUTHORITY: - ldns_rr_list_push_rr(ldns_pkt_authority(packet), rr); - ldns_pkt_set_nscount(packet, ldns_pkt_nscount(packet) + 1); - break; - case LDNS_SECTION_ADDITIONAL: - ldns_rr_list_push_rr(ldns_pkt_additional(packet), rr); - ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) + 1); - break; - case LDNS_SECTION_ANY: - case LDNS_SECTION_ANY_NOQUESTION: - /* shouldn't this error? */ - break; - } - return true; -} - -bool -ldns_pkt_safe_push_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr) -{ - - /* check to see if its there */ - if (ldns_pkt_rr(pkt, sec, rr)) { - /* already there */ - return false; - } - return ldns_pkt_push_rr(pkt, sec, rr); -} - -bool -ldns_pkt_push_rr_list(ldns_pkt *p, ldns_pkt_section s, ldns_rr_list *list) -{ - size_t i; - for(i = 0; i < ldns_rr_list_rr_count(list); i++) { - if (!ldns_pkt_push_rr(p, s, ldns_rr_list_rr(list, i))) { - return false; - } - } - return true; -} - -bool -ldns_pkt_safe_push_rr_list(ldns_pkt *p, ldns_pkt_section s, ldns_rr_list *list) -{ - size_t i; - for(i = 0; i < ldns_rr_list_rr_count(list); i++) { - if (!ldns_pkt_safe_push_rr(p, s, ldns_rr_list_rr(list, i))) { - return false; - } - } - return true; -} - -bool -ldns_pkt_edns(const ldns_pkt *pkt) { - return (ldns_pkt_edns_udp_size(pkt) > 0 || - ldns_pkt_edns_extended_rcode(pkt) > 0 || - ldns_pkt_edns_data(pkt) || - ldns_pkt_edns_do(pkt) - ); -} - - -/* Create/destroy/convert functions - */ -ldns_pkt * -ldns_pkt_new() -{ - ldns_pkt *packet; - packet = LDNS_MALLOC(ldns_pkt); - if (!packet) { - return NULL; - } - - packet->_header = LDNS_MALLOC(ldns_hdr); - if (!packet->_header) { - LDNS_FREE(packet); - return NULL; - } - - packet->_question = ldns_rr_list_new(); - packet->_answer = ldns_rr_list_new(); - packet->_authority = ldns_rr_list_new(); - packet->_additional = ldns_rr_list_new(); - - /* default everything to false */ - ldns_pkt_set_qr(packet, false); - ldns_pkt_set_aa(packet, false); - ldns_pkt_set_tc(packet, false); - ldns_pkt_set_rd(packet, false); - ldns_pkt_set_ra(packet, false); - ldns_pkt_set_ad(packet, false); - ldns_pkt_set_cd(packet, false); - - ldns_pkt_set_opcode(packet, LDNS_PACKET_QUERY); - ldns_pkt_set_rcode(packet, 0); - ldns_pkt_set_id(packet, 0); - ldns_pkt_set_size(packet, 0); - ldns_pkt_set_querytime(packet, 0); - memset(&packet->timestamp, 0, sizeof(packet->timestamp)); - ldns_pkt_set_answerfrom(packet, NULL); - ldns_pkt_set_section_count(packet, LDNS_SECTION_QUESTION, 0); - ldns_pkt_set_section_count(packet, LDNS_SECTION_ANSWER, 0); - ldns_pkt_set_section_count(packet, LDNS_SECTION_AUTHORITY, 0); - ldns_pkt_set_section_count(packet, LDNS_SECTION_ADDITIONAL, 0); - - ldns_pkt_set_edns_udp_size(packet, 0); - ldns_pkt_set_edns_extended_rcode(packet, 0); - ldns_pkt_set_edns_version(packet, 0); - ldns_pkt_set_edns_z(packet, 0); - ldns_pkt_set_edns_data(packet, NULL); - - ldns_pkt_set_tsig(packet, NULL); - - return packet; -} - -void -ldns_pkt_free(ldns_pkt *packet) -{ - if (packet) { - LDNS_FREE(packet->_header); - ldns_rr_list_deep_free(packet->_question); - ldns_rr_list_deep_free(packet->_answer); - ldns_rr_list_deep_free(packet->_authority); - ldns_rr_list_deep_free(packet->_additional); - ldns_rr_free(packet->_tsig_rr); - ldns_rdf_deep_free(packet->_edns_data); - LDNS_FREE(packet); - } -} - -bool -ldns_pkt_set_flags(ldns_pkt *packet, uint16_t flags) -{ - if (!packet) { - return false; - } - if ((flags & LDNS_QR) == LDNS_QR) { - ldns_pkt_set_qr(packet, true); - } - if ((flags & LDNS_AA) == LDNS_AA) { - ldns_pkt_set_aa(packet, true); - } - if ((flags & LDNS_RD) == LDNS_RD) { - ldns_pkt_set_rd(packet, true); - } - if ((flags & LDNS_TC) == LDNS_TC) { - ldns_pkt_set_tc(packet, true); - } - if ((flags & LDNS_CD) == LDNS_CD) { - ldns_pkt_set_cd(packet, true); - } - if ((flags & LDNS_RA) == LDNS_RA) { - ldns_pkt_set_ra(packet, true); - } - if ((flags & LDNS_AD) == LDNS_AD) { - ldns_pkt_set_ad(packet, true); - } - return true; -} - -ldns_status -ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type, - ldns_rr_class rr_class, uint16_t flags) -{ - ldns_pkt *packet; - ldns_rr *question_rr; - ldns_rdf *name_rdf; - - packet = ldns_pkt_new(); - if (!packet) { - return LDNS_STATUS_MEM_ERR; - } - - if (!ldns_pkt_set_flags(packet, flags)) { - return LDNS_STATUS_ERR; - } - - question_rr = ldns_rr_new(); - if (!question_rr) { - return LDNS_STATUS_MEM_ERR; - } - - if (rr_type == 0) { - rr_type = LDNS_RR_TYPE_A; - } - if (rr_class == 0) { - rr_class = LDNS_RR_CLASS_IN; - } - - if (ldns_str2rdf_dname(&name_rdf, name) == LDNS_STATUS_OK) { - ldns_rr_set_owner(question_rr, name_rdf); - ldns_rr_set_type(question_rr, rr_type); - ldns_rr_set_class(question_rr, rr_class); - ldns_rr_set_question(question_rr, true); - - ldns_pkt_push_rr(packet, LDNS_SECTION_QUESTION, question_rr); - } else { - ldns_rr_free(question_rr); - ldns_pkt_free(packet); - return LDNS_STATUS_ERR; - } - - packet->_tsig_rr = NULL; - - ldns_pkt_set_answerfrom(packet, NULL); - if (p) { - *p = packet; - return LDNS_STATUS_OK; - } else { - return LDNS_STATUS_NULL; - } -} - -ldns_pkt * -ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, - uint16_t flags) -{ - ldns_pkt *packet; - ldns_rr *question_rr; - - packet = ldns_pkt_new(); - if (!packet) { - return NULL; - } - - if (!ldns_pkt_set_flags(packet, flags)) { - return NULL; - } - - question_rr = ldns_rr_new(); - if (!question_rr) { - return NULL; - } - - if (rr_type == 0) { - rr_type = LDNS_RR_TYPE_A; - } - if (rr_class == 0) { - rr_class = LDNS_RR_CLASS_IN; - } - - ldns_rr_set_owner(question_rr, rr_name); - ldns_rr_set_type(question_rr, rr_type); - ldns_rr_set_class(question_rr, rr_class); - ldns_rr_set_question(question_rr, true); - - packet->_tsig_rr = NULL; - - ldns_pkt_push_rr(packet, LDNS_SECTION_QUESTION, question_rr); - - return packet; -} - -ldns_pkt_type -ldns_pkt_reply_type(ldns_pkt *p) -{ - ldns_rr_list *tmp; - - if (!p) { - return LDNS_PACKET_UNKNOWN; - } - - if (ldns_pkt_get_rcode(p) == LDNS_RCODE_NXDOMAIN) { - return LDNS_PACKET_NXDOMAIN; - } - - if (ldns_pkt_ancount(p) == 0 && ldns_pkt_arcount(p) == 0 - && ldns_pkt_nscount(p) == 1) { - - /* check for SOA */ - tmp = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_SOA, - LDNS_SECTION_AUTHORITY); - if (tmp) { - ldns_rr_list_deep_free(tmp); - return LDNS_PACKET_NODATA; - } else { - /* I have no idea ... */ - } - } - - if (ldns_pkt_ancount(p) == 0 && ldns_pkt_nscount(p) > 0) { - tmp = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NS, - LDNS_SECTION_AUTHORITY); - if (tmp) { - /* there are nameservers here */ - ldns_rr_list_deep_free(tmp); - return LDNS_PACKET_REFERRAL; - } else { - /* I have no idea */ - } - ldns_rr_list_deep_free(tmp); - } - - /* if we cannot determine the packet type, we say it's an - * answer... - */ - return LDNS_PACKET_ANSWER; -} - -ldns_pkt * -ldns_pkt_clone(ldns_pkt *pkt) -{ - ldns_pkt *new_pkt; - - if (!pkt) { - return NULL; - } - new_pkt = ldns_pkt_new(); - - ldns_pkt_set_id(new_pkt, ldns_pkt_id(pkt)); - ldns_pkt_set_qr(new_pkt, ldns_pkt_qr(pkt)); - ldns_pkt_set_aa(new_pkt, ldns_pkt_aa(pkt)); - ldns_pkt_set_tc(new_pkt, ldns_pkt_tc(pkt)); - ldns_pkt_set_rd(new_pkt, ldns_pkt_rd(pkt)); - ldns_pkt_set_cd(new_pkt, ldns_pkt_cd(pkt)); - ldns_pkt_set_ra(new_pkt, ldns_pkt_ra(pkt)); - ldns_pkt_set_ad(new_pkt, ldns_pkt_ad(pkt)); - ldns_pkt_set_opcode(new_pkt, ldns_pkt_get_opcode(pkt)); - ldns_pkt_set_rcode(new_pkt, ldns_pkt_get_rcode(pkt)); - ldns_pkt_set_qdcount(new_pkt, ldns_pkt_qdcount(pkt)); - ldns_pkt_set_ancount(new_pkt, ldns_pkt_ancount(pkt)); - ldns_pkt_set_nscount(new_pkt, ldns_pkt_nscount(pkt)); - ldns_pkt_set_arcount(new_pkt, ldns_pkt_arcount(pkt)); - ldns_pkt_set_answerfrom(new_pkt, ldns_pkt_answerfrom(pkt)); - ldns_pkt_set_querytime(new_pkt, ldns_pkt_querytime(pkt)); - ldns_pkt_set_size(new_pkt, ldns_pkt_size(pkt)); - ldns_pkt_set_tsig(new_pkt, ldns_rr_clone(ldns_pkt_tsig(pkt))); - - ldns_pkt_set_edns_udp_size(new_pkt, ldns_pkt_edns_udp_size(pkt)); - ldns_pkt_set_edns_extended_rcode(new_pkt, - ldns_pkt_edns_extended_rcode(pkt)); - ldns_pkt_set_edns_version(new_pkt, ldns_pkt_edns_version(pkt)); - ldns_pkt_set_edns_z(new_pkt, ldns_pkt_edns_z(pkt)); - if(ldns_pkt_edns_data(pkt)) - ldns_pkt_set_edns_data(new_pkt, - ldns_rdf_clone(ldns_pkt_edns_data(pkt))); - ldns_pkt_set_edns_do(new_pkt, ldns_pkt_edns_do(pkt)); - - ldns_rr_list_deep_free(new_pkt->_question); - ldns_rr_list_deep_free(new_pkt->_answer); - ldns_rr_list_deep_free(new_pkt->_authority); - ldns_rr_list_deep_free(new_pkt->_additional); - new_pkt->_question = ldns_rr_list_clone(ldns_pkt_question(pkt)); - new_pkt->_answer = ldns_rr_list_clone(ldns_pkt_answer(pkt)); - new_pkt->_authority = ldns_rr_list_clone(ldns_pkt_authority(pkt)); - new_pkt->_additional = ldns_rr_list_clone(ldns_pkt_additional(pkt)); - return new_pkt; -} diff --git a/libs/ldns/parse.c b/libs/ldns/parse.c deleted file mode 100644 index 0487873520..0000000000 --- a/libs/ldns/parse.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * a generic (simple) parser. Use to parse rr's, private key - * information and /etc/resolv.conf files - * - * a Net::DNS like library for C - * LibDNS Team @ NLnet Labs - * (c) NLnet Labs, 2005-2006 - * See the file LICENSE for the license - */ -#include -#include - -#include -#include - -ldns_lookup_table ldns_directive_types[] = { - { LDNS_DIR_TTL, "$TTL" }, - { LDNS_DIR_ORIGIN, "$ORIGIN" }, - { LDNS_DIR_INCLUDE, "$INCLUDE" }, - { 0, NULL } -}; - -/* add max_limit here? */ -ssize_t -ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit) -{ - return ldns_fget_token_l(f, token, delim, limit, NULL); -} - -ssize_t -ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr) -{ - int c, prev_c; - int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ - int com, quoted; - char *t; - size_t i; - const char *d; - const char *del; - - /* standard delimeters */ - if (!delim) { - /* from isspace(3) */ - del = LDNS_PARSE_NORMAL; - } else { - del = delim; - } - - p = 0; - i = 0; - com = 0; - quoted = 0; - prev_c = 0; - t = token; - if (del[0] == '"') { - quoted = 1; - } - while ((c = getc(f)) != EOF) { - if (c == '(' && prev_c != '\\' && !quoted) { - /* this only counts for non-comments */ - if (com == 0) { - p++; - } - prev_c = c; - continue; - } - - if (c == ')' && prev_c != '\\' && !quoted) { - /* this only counts for non-comments */ - if (com == 0) { - p--; - } - prev_c = c; - continue; - } - - if (p < 0) { - /* more ) then ( - close off the string */ - *t = '\0'; - return 0; - } - - /* do something with comments ; */ - if (c == ';' && quoted == 0) { - if (prev_c != '\\') { - com = 1; - } - } - if (c == '\"' && com == 0 && prev_c != '\\') { - quoted = 1 - quoted; - } - - if (c == '\n' && com != 0) { - /* comments */ - com = 0; - *t = ' '; - if (line_nr) { - *line_nr = *line_nr + 1; - } - if (p == 0 && i > 0) { - goto tokenread; - } else { - prev_c = c; - continue; - } - } - - if (com == 1) { - *t = ' '; - prev_c = c; - continue; - } - - - if (c == '\n' && p != 0 && t > token) { - /* in parentheses */ - if (line_nr) { - *line_nr = *line_nr + 1; - } - *t++ = ' '; - prev_c = c; - continue; - } - - /* check if we hit the delim */ - for (d = del; *d; d++) { - if (c == *d && i > 0 && prev_c != '\\') { - if (c == '\n' && line_nr) { - *line_nr = *line_nr + 1; - } - goto tokenread; - } - } - if (c != '\0' && c != '\n') { - *t++ = c; - i++; - } - if (limit > 0 && i >= limit) { - *t = '\0'; - return -1; - } - if (c == '\\' && prev_c == '\\') - prev_c = 0; - else prev_c = c; - } - *t = '\0'; - if (c == EOF) { - return (ssize_t)i; - } - - if (i == 0) { - /* nothing read */ - return -1; - } - if (p != 0) { - return -1; - } - return (ssize_t)i; - -tokenread: - ldns_fskipcs_l(f, delim, line_nr); - *t = '\0'; - if (p != 0) { - return -1; - } - - return (ssize_t)i; -} - -ssize_t -ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, - const char *d_del, size_t data_limit) -{ - return ldns_fget_keyword_data_l(f, keyword, k_del, data, d_del, - data_limit, NULL); -} - -ssize_t -ldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, - const char *d_del, size_t data_limit, int *line_nr) -{ - /* we assume: keyword|sep|data */ - char *fkeyword; - ssize_t i; - - if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) - return -1; - fkeyword = LDNS_XMALLOC(char, LDNS_MAX_KEYWORDLEN); - if(!fkeyword) - return -1; - - i = ldns_fget_token(f, fkeyword, k_del, LDNS_MAX_KEYWORDLEN); - if(i==0 || i==-1) { - LDNS_FREE(fkeyword); - return -1; - } - - /* case??? i instead of strlen? */ - if (strncmp(fkeyword, keyword, LDNS_MAX_KEYWORDLEN - 1) == 0) { - /* whee! */ - /* printf("%s\n%s\n", "Matching keyword", fkeyword); */ - i = ldns_fget_token_l(f, data, d_del, data_limit, line_nr); - LDNS_FREE(fkeyword); - return i; - } else { - /*printf("no match for %s (read: %s)\n", keyword, fkeyword);*/ - LDNS_FREE(fkeyword); - return -1; - } -} - - -ssize_t -ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit) -{ - int c, lc; - int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ - int com, quoted; - char *t; - size_t i; - const char *d; - const char *del; - - /* standard delimiters */ - if (!delim) { - /* from isspace(3) */ - del = LDNS_PARSE_NORMAL; - } else { - del = delim; - } - - p = 0; - i = 0; - com = 0; - quoted = 0; - t = token; - lc = 0; - if (del[0] == '"') { - quoted = 1; - } - - while ((c = ldns_bgetc(b)) != EOF) { - if (c == '(' && lc != '\\' && !quoted) { - /* this only counts for non-comments */ - if (com == 0) { - p++; - } - lc = c; - continue; - } - - if (c == ')' && lc != '\\' && !quoted) { - /* this only counts for non-comments */ - if (com == 0) { - p--; - } - lc = c; - continue; - } - - if (p < 0) { - /* more ) then ( */ - *t = '\0'; - return 0; - } - - /* do something with comments ; */ - if (c == ';' && quoted == 0) { - if (lc != '\\') { - com = 1; - } - } - if (c == '"' && com == 0 && lc != '\\') { - quoted = 1 - quoted; - } - - if (c == '\n' && com != 0) { - /* comments */ - com = 0; - *t = ' '; - lc = c; - continue; - } - - if (com == 1) { - *t = ' '; - lc = c; - continue; - } - - if (c == '\n' && p != 0) { - /* in parentheses */ - *t++ = ' '; - lc = c; - continue; - } - - /* check if we hit the delim */ - for (d = del; *d; d++) { - if (c == *d && lc != '\\') { - goto tokenread; - } - } - - *t++ = c; - i++; - if (limit > 0 && i >= limit) { - *t = '\0'; - return -1; - } - - if (c == '\\' && lc == '\\') { - lc = 0; - } else { - lc = c; - } - } - *t = '\0'; - if (i == 0) { - /* nothing read */ - return -1; - } - if (p != 0) { - return -1; - } - return (ssize_t)i; - -tokenread: - ldns_bskipcs(b, delim); - *t = '\0'; - - if (p != 0) { - return -1; - } - return (ssize_t)i; -} - -void -ldns_bskipc(ldns_buffer *buffer, char c) -{ - while (c == (char) ldns_buffer_read_u8_at(buffer, ldns_buffer_position(buffer))) { - if (ldns_buffer_available_at(buffer, - buffer->_position + sizeof(char), sizeof(char))) { - buffer->_position += sizeof(char); - } else { - return; - } - } -} - -void -ldns_bskipcs(ldns_buffer *buffer, const char *s) -{ - bool found; - char c; - const char *d; - - while(ldns_buffer_available_at(buffer, buffer->_position, sizeof(char))) { - c = (char) ldns_buffer_read_u8_at(buffer, buffer->_position); - found = false; - for (d = s; *d; d++) { - if (*d == c) { - found = true; - } - } - if (found && buffer->_limit > buffer->_position) { - buffer->_position += sizeof(char); - } else { - return; - } - } -} - -void -ldns_fskipc(FILE *fp, char c) -{ - fp = fp; - c = c; -} - - -void -ldns_fskipcs(FILE *fp, const char *s) -{ - ldns_fskipcs_l(fp, s, NULL); -} - -void -ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr) -{ - bool found; - int c; - const char *d; - - while ((c = fgetc(fp)) != EOF) { - if (line_nr && c == '\n') { - *line_nr = *line_nr + 1; - } - found = false; - for (d = s; *d; d++) { - if (*d == c) { - found = true; - } - } - if (!found) { - /* with getc, we've read too far */ - ungetc(c, fp); - return; - } - } -} - -ssize_t -ldns_bget_keyword_data(ldns_buffer *b, const char *keyword, const char *k_del, char -*data, const char *d_del, size_t data_limit) -{ - /* we assume: keyword|sep|data */ - char *fkeyword; - ssize_t i; - - if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) - return -1; - fkeyword = LDNS_XMALLOC(char, LDNS_MAX_KEYWORDLEN); - if(!fkeyword) - return -1; /* out of memory */ - - i = ldns_bget_token(b, fkeyword, k_del, data_limit); - if(i==0 || i==-1) { - LDNS_FREE(fkeyword); - return -1; /* nothing read */ - } - - /* case??? */ - if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) { - LDNS_FREE(fkeyword); - /* whee, the match! */ - /* retrieve it's data */ - i = ldns_bget_token(b, data, d_del, 0); - return i; - } else { - LDNS_FREE(fkeyword); - return -1; - } -} - diff --git a/libs/ldns/rbtree.c b/libs/ldns/rbtree.c deleted file mode 100644 index 217e61d275..0000000000 --- a/libs/ldns/rbtree.c +++ /dev/null @@ -1,669 +0,0 @@ -/* - * rbtree.c -- generic red black tree - * - * Taken from Unbound, modified for ldns - * - * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. - * - * This software is open source. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * Neither the name of the NLNET LABS nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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. - * - */ - -/** - * \file - * Implementation of a redblack tree. - */ - -#include -#include -#include - -/** Node colour black */ -#define BLACK 0 -/** Node colour red */ -#define RED 1 - -/** the NULL node, global alloc */ -ldns_rbnode_t ldns_rbtree_null_node = { - LDNS_RBTREE_NULL, /* Parent. */ - LDNS_RBTREE_NULL, /* Left. */ - LDNS_RBTREE_NULL, /* Right. */ - NULL, /* Key. */ - NULL, /* Data. */ - BLACK /* Color. */ -}; - -/** rotate subtree left (to preserve redblack property) */ -static void ldns_rbtree_rotate_left(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); -/** rotate subtree right (to preserve redblack property) */ -static void ldns_rbtree_rotate_right(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); -/** Fixup node colours when insert happened */ -static void ldns_rbtree_insert_fixup(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); -/** Fixup node colours when delete happened */ -static void ldns_rbtree_delete_fixup(ldns_rbtree_t* rbtree, ldns_rbnode_t* child, ldns_rbnode_t* child_parent); - -/* - * Creates a new red black tree, intializes and returns a pointer to it. - * - * Return NULL on failure. - * - */ -ldns_rbtree_t * -ldns_rbtree_create (int (*cmpf)(const void *, const void *)) -{ - ldns_rbtree_t *rbtree; - - /* Allocate memory for it */ - rbtree = (ldns_rbtree_t *) malloc(sizeof(ldns_rbtree_t)); - if (!rbtree) { - return NULL; - } - - /* Initialize it */ - ldns_rbtree_init(rbtree, cmpf); - - return rbtree; -} - -void -ldns_rbtree_init(ldns_rbtree_t *rbtree, int (*cmpf)(const void *, const void *)) -{ - /* Initialize it */ - rbtree->root = LDNS_RBTREE_NULL; - rbtree->count = 0; - rbtree->cmp = cmpf; -} - -void -ldns_rbtree_free(ldns_rbtree_t *rbtree) -{ - free(rbtree); -} - -/* - * Rotates the node to the left. - * - */ -static void -ldns_rbtree_rotate_left(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) -{ - ldns_rbnode_t *right = node->right; - node->right = right->left; - if (right->left != LDNS_RBTREE_NULL) - right->left->parent = node; - - right->parent = node->parent; - - if (node->parent != LDNS_RBTREE_NULL) { - if (node == node->parent->left) { - node->parent->left = right; - } else { - node->parent->right = right; - } - } else { - rbtree->root = right; - } - right->left = node; - node->parent = right; -} - -/* - * Rotates the node to the right. - * - */ -static void -ldns_rbtree_rotate_right(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) -{ - ldns_rbnode_t *left = node->left; - node->left = left->right; - if (left->right != LDNS_RBTREE_NULL) - left->right->parent = node; - - left->parent = node->parent; - - if (node->parent != LDNS_RBTREE_NULL) { - if (node == node->parent->right) { - node->parent->right = left; - } else { - node->parent->left = left; - } - } else { - rbtree->root = left; - } - left->right = node; - node->parent = left; -} - -static void -ldns_rbtree_insert_fixup(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) -{ - ldns_rbnode_t *uncle; - - /* While not at the root and need fixing... */ - while (node != rbtree->root && node->parent->color == RED) { - /* If our parent is left child of our grandparent... */ - if (node->parent == node->parent->parent->left) { - uncle = node->parent->parent->right; - - /* If our uncle is red... */ - if (uncle->color == RED) { - /* Paint the parent and the uncle black... */ - node->parent->color = BLACK; - uncle->color = BLACK; - - /* And the grandparent red... */ - node->parent->parent->color = RED; - - /* And continue fixing the grandparent */ - node = node->parent->parent; - } else { /* Our uncle is black... */ - /* Are we the right child? */ - if (node == node->parent->right) { - node = node->parent; - ldns_rbtree_rotate_left(rbtree, node); - } - /* Now we're the left child, repaint and rotate... */ - node->parent->color = BLACK; - node->parent->parent->color = RED; - ldns_rbtree_rotate_right(rbtree, node->parent->parent); - } - } else { - uncle = node->parent->parent->left; - - /* If our uncle is red... */ - if (uncle->color == RED) { - /* Paint the parent and the uncle black... */ - node->parent->color = BLACK; - uncle->color = BLACK; - - /* And the grandparent red... */ - node->parent->parent->color = RED; - - /* And continue fixing the grandparent */ - node = node->parent->parent; - } else { /* Our uncle is black... */ - /* Are we the right child? */ - if (node == node->parent->left) { - node = node->parent; - ldns_rbtree_rotate_right(rbtree, node); - } - /* Now we're the right child, repaint and rotate... */ - node->parent->color = BLACK; - node->parent->parent->color = RED; - ldns_rbtree_rotate_left(rbtree, node->parent->parent); - } - } - } - rbtree->root->color = BLACK; -} - -void -ldns_rbtree_insert_vref(ldns_rbnode_t *data, void *rbtree) -{ - (void) ldns_rbtree_insert((ldns_rbtree_t *) rbtree, - data); -} - -/* - * Inserts a node into a red black tree. - * - * Returns NULL on failure or the pointer to the newly added node - * otherwise. - */ -ldns_rbnode_t * -ldns_rbtree_insert (ldns_rbtree_t *rbtree, ldns_rbnode_t *data) -{ - /* XXX Not necessary, but keeps compiler quiet... */ - int r = 0; - - /* We start at the root of the tree */ - ldns_rbnode_t *node = rbtree->root; - ldns_rbnode_t *parent = LDNS_RBTREE_NULL; - - /* Lets find the new parent... */ - while (node != LDNS_RBTREE_NULL) { - /* Compare two keys, do we have a duplicate? */ - if ((r = rbtree->cmp(data->key, node->key)) == 0) { - return NULL; - } - parent = node; - - if (r < 0) { - node = node->left; - } else { - node = node->right; - } - } - - /* Initialize the new node */ - data->parent = parent; - data->left = data->right = LDNS_RBTREE_NULL; - data->color = RED; - rbtree->count++; - - /* Insert it into the tree... */ - if (parent != LDNS_RBTREE_NULL) { - if (r < 0) { - parent->left = data; - } else { - parent->right = data; - } - } else { - rbtree->root = data; - } - - /* Fix up the red-black properties... */ - ldns_rbtree_insert_fixup(rbtree, data); - - return data; -} - -/* - * Searches the red black tree, returns the data if key is found or NULL otherwise. - * - */ -ldns_rbnode_t * -ldns_rbtree_search (ldns_rbtree_t *rbtree, const void *key) -{ - ldns_rbnode_t *node; - - if (ldns_rbtree_find_less_equal(rbtree, key, &node)) { - return node; - } else { - return NULL; - } -} - -/** helpers for delete: swap node colours */ -static void swap_int8(uint8_t* x, uint8_t* y) -{ - uint8_t t = *x; *x = *y; *y = t; -} - -/** helpers for delete: swap node pointers */ -static void swap_np(ldns_rbnode_t** x, ldns_rbnode_t** y) -{ - ldns_rbnode_t* t = *x; *x = *y; *y = t; -} - -/** Update parent pointers of child trees of 'parent' */ -static void change_parent_ptr(ldns_rbtree_t* rbtree, ldns_rbnode_t* parent, ldns_rbnode_t* old, ldns_rbnode_t* new) -{ - if(parent == LDNS_RBTREE_NULL) - { - if(rbtree->root == old) rbtree->root = new; - return; - } - if(parent->left == old) parent->left = new; - if(parent->right == old) parent->right = new; -} -/** Update parent pointer of a node 'child' */ -static void change_child_ptr(ldns_rbnode_t* child, ldns_rbnode_t* old, ldns_rbnode_t* new) -{ - if(child == LDNS_RBTREE_NULL) return; - if(child->parent == old) child->parent = new; -} - -ldns_rbnode_t* -ldns_rbtree_delete(ldns_rbtree_t *rbtree, const void *key) -{ - ldns_rbnode_t *to_delete; - ldns_rbnode_t *child; - if((to_delete = ldns_rbtree_search(rbtree, key)) == 0) return 0; - rbtree->count--; - - /* make sure we have at most one non-leaf child */ - if(to_delete->left != LDNS_RBTREE_NULL && - to_delete->right != LDNS_RBTREE_NULL) - { - /* swap with smallest from right subtree (or largest from left) */ - ldns_rbnode_t *smright = to_delete->right; - while(smright->left != LDNS_RBTREE_NULL) - smright = smright->left; - /* swap the smright and to_delete elements in the tree, - * but the ldns_rbnode_t is first part of user data struct - * so cannot just swap the keys and data pointers. Instead - * readjust the pointers left,right,parent */ - - /* swap colors - colors are tied to the position in the tree */ - swap_int8(&to_delete->color, &smright->color); - - /* swap child pointers in parents of smright/to_delete */ - change_parent_ptr(rbtree, to_delete->parent, to_delete, smright); - if(to_delete->right != smright) - change_parent_ptr(rbtree, smright->parent, smright, to_delete); - - /* swap parent pointers in children of smright/to_delete */ - change_child_ptr(smright->left, smright, to_delete); - change_child_ptr(smright->left, smright, to_delete); - change_child_ptr(smright->right, smright, to_delete); - change_child_ptr(smright->right, smright, to_delete); - change_child_ptr(to_delete->left, to_delete, smright); - if(to_delete->right != smright) - change_child_ptr(to_delete->right, to_delete, smright); - if(to_delete->right == smright) - { - /* set up so after swap they work */ - to_delete->right = to_delete; - smright->parent = smright; - } - - /* swap pointers in to_delete/smright nodes */ - swap_np(&to_delete->parent, &smright->parent); - swap_np(&to_delete->left, &smright->left); - swap_np(&to_delete->right, &smright->right); - - /* now delete to_delete (which is at the location where the smright previously was) */ - } - - if(to_delete->left != LDNS_RBTREE_NULL) child = to_delete->left; - else child = to_delete->right; - - /* unlink to_delete from the tree, replace to_delete with child */ - change_parent_ptr(rbtree, to_delete->parent, to_delete, child); - change_child_ptr(child, to_delete, to_delete->parent); - - if(to_delete->color == RED) - { - /* if node is red then the child (black) can be swapped in */ - } - else if(child->color == RED) - { - /* change child to BLACK, removing a RED node is no problem */ - if(child!=LDNS_RBTREE_NULL) child->color = BLACK; - } - else ldns_rbtree_delete_fixup(rbtree, child, to_delete->parent); - - /* unlink completely */ - to_delete->parent = LDNS_RBTREE_NULL; - to_delete->left = LDNS_RBTREE_NULL; - to_delete->right = LDNS_RBTREE_NULL; - to_delete->color = BLACK; - return to_delete; -} - -static void ldns_rbtree_delete_fixup(ldns_rbtree_t* rbtree, ldns_rbnode_t* child, ldns_rbnode_t* child_parent) -{ - ldns_rbnode_t* sibling; - int go_up = 1; - - /* determine sibling to the node that is one-black short */ - if(child_parent->right == child) sibling = child_parent->left; - else sibling = child_parent->right; - - while(go_up) - { - if(child_parent == LDNS_RBTREE_NULL) - { - /* removed parent==black from root, every path, so ok */ - return; - } - - if(sibling->color == RED) - { /* rotate to get a black sibling */ - child_parent->color = RED; - sibling->color = BLACK; - if(child_parent->right == child) - ldns_rbtree_rotate_right(rbtree, child_parent); - else ldns_rbtree_rotate_left(rbtree, child_parent); - /* new sibling after rotation */ - if(child_parent->right == child) sibling = child_parent->left; - else sibling = child_parent->right; - } - - if(child_parent->color == BLACK - && sibling->color == BLACK - && sibling->left->color == BLACK - && sibling->right->color == BLACK) - { /* fixup local with recolor of sibling */ - if(sibling != LDNS_RBTREE_NULL) - sibling->color = RED; - - child = child_parent; - child_parent = child_parent->parent; - /* prepare to go up, new sibling */ - if(child_parent->right == child) sibling = child_parent->left; - else sibling = child_parent->right; - } - else go_up = 0; - } - - if(child_parent->color == RED - && sibling->color == BLACK - && sibling->left->color == BLACK - && sibling->right->color == BLACK) - { - /* move red to sibling to rebalance */ - if(sibling != LDNS_RBTREE_NULL) - sibling->color = RED; - child_parent->color = BLACK; - return; - } - - /* get a new sibling, by rotating at sibling. See which child - of sibling is red */ - if(child_parent->right == child - && sibling->color == BLACK - && sibling->right->color == RED - && sibling->left->color == BLACK) - { - sibling->color = RED; - sibling->right->color = BLACK; - ldns_rbtree_rotate_left(rbtree, sibling); - /* new sibling after rotation */ - if(child_parent->right == child) sibling = child_parent->left; - else sibling = child_parent->right; - } - else if(child_parent->left == child - && sibling->color == BLACK - && sibling->left->color == RED - && sibling->right->color == BLACK) - { - sibling->color = RED; - sibling->left->color = BLACK; - ldns_rbtree_rotate_right(rbtree, sibling); - /* new sibling after rotation */ - if(child_parent->right == child) sibling = child_parent->left; - else sibling = child_parent->right; - } - - /* now we have a black sibling with a red child. rotate and exchange colors. */ - sibling->color = child_parent->color; - child_parent->color = BLACK; - if(child_parent->right == child) - { - sibling->left->color = BLACK; - ldns_rbtree_rotate_right(rbtree, child_parent); - } - else - { - sibling->right->color = BLACK; - ldns_rbtree_rotate_left(rbtree, child_parent); - } -} - -int -ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key, ldns_rbnode_t **result) -{ - int r; - ldns_rbnode_t *node; - - /* We start at root... */ - node = rbtree->root; - - *result = NULL; - - /* While there are children... */ - while (node != LDNS_RBTREE_NULL) { - r = rbtree->cmp(key, node->key); - if (r == 0) { - /* Exact match */ - *result = node; - return 1; - } - if (r < 0) { - node = node->left; - } else { - /* Temporary match */ - *result = node; - node = node->right; - } - } - return 0; -} - -/* - * Finds the first element in the red black tree - * - */ -ldns_rbnode_t * -ldns_rbtree_first (ldns_rbtree_t *rbtree) -{ - ldns_rbnode_t *node = rbtree->root; - - if (rbtree->root != LDNS_RBTREE_NULL) { - for (node = rbtree->root; node->left != LDNS_RBTREE_NULL; node = node->left); - } - return node; -} - -ldns_rbnode_t * -ldns_rbtree_last (ldns_rbtree_t *rbtree) -{ - ldns_rbnode_t *node = rbtree->root; - - if (rbtree->root != LDNS_RBTREE_NULL) { - for (node = rbtree->root; node->right != LDNS_RBTREE_NULL; node = node->right); - } - return node; -} - -/* - * Returns the next node... - * - */ -ldns_rbnode_t * -ldns_rbtree_next (ldns_rbnode_t *node) -{ - ldns_rbnode_t *parent; - - if (node->right != LDNS_RBTREE_NULL) { - /* One right, then keep on going left... */ - for (node = node->right; - node->left != LDNS_RBTREE_NULL; - node = node->left); - } else { - parent = node->parent; - while (parent != LDNS_RBTREE_NULL && node == parent->right) { - node = parent; - parent = parent->parent; - } - node = parent; - } - return node; -} - -ldns_rbnode_t * -ldns_rbtree_previous(ldns_rbnode_t *node) -{ - ldns_rbnode_t *parent; - - if (node->left != LDNS_RBTREE_NULL) { - /* One left, then keep on going right... */ - for (node = node->left; - node->right != LDNS_RBTREE_NULL; - node = node->right); - } else { - parent = node->parent; - while (parent != LDNS_RBTREE_NULL && node == parent->left) { - node = parent; - parent = parent->parent; - } - node = parent; - } - return node; -} - -/** - * split off elements number of elements from the start - * of the name tree and return a new tree - */ -ldns_rbtree_t * -ldns_rbtree_split(ldns_rbtree_t *tree, - size_t elements) -{ - ldns_rbtree_t *new_tree; - ldns_rbnode_t *cur_node; - ldns_rbnode_t *move_node; - size_t count = 0; - - new_tree = ldns_rbtree_create(tree->cmp); - - cur_node = ldns_rbtree_first(tree); - while (count < elements && cur_node != LDNS_RBTREE_NULL) { - move_node = ldns_rbtree_delete(tree, cur_node->key); - (void)ldns_rbtree_insert(new_tree, move_node); - cur_node = ldns_rbtree_first(tree); - count++; - } - - return new_tree; -} - -/* - * add all node from the second tree to the first (removing them from the - * second), and fix up nsec(3)s if present - */ -void -ldns_rbtree_join(ldns_rbtree_t *tree1, ldns_rbtree_t *tree2) -{ - ldns_traverse_postorder(tree2, ldns_rbtree_insert_vref, tree1); -} - -/** recursive descent traverse */ -static void -traverse_post(void (*func)(ldns_rbnode_t*, void*), void* arg, - ldns_rbnode_t* node) -{ - if(!node || node == LDNS_RBTREE_NULL) - return; - /* recurse */ - traverse_post(func, arg, node->left); - traverse_post(func, arg, node->right); - /* call user func */ - (*func)(node, arg); -} - -void -ldns_traverse_postorder(ldns_rbtree_t* tree, - void (*func)(ldns_rbnode_t*, void*), void* arg) -{ - traverse_post(func, arg, tree->root); -} diff --git a/libs/ldns/rdata.c b/libs/ldns/rdata.c deleted file mode 100644 index 8af16a13a1..0000000000 --- a/libs/ldns/rdata.c +++ /dev/null @@ -1,675 +0,0 @@ -/* - * rdata.c - * - * rdata implementation - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include - -/* - * Access functions - * do this as functions to get type checking - */ - -/* read */ -size_t -ldns_rdf_size(const ldns_rdf *rd) -{ - assert(rd != NULL); - return rd->_size; -} - -ldns_rdf_type -ldns_rdf_get_type(const ldns_rdf *rd) -{ - assert(rd != NULL); - return rd->_type; -} - -uint8_t * -ldns_rdf_data(const ldns_rdf *rd) -{ - assert(rd != NULL); - return rd->_data; -} - -/* write */ -void -ldns_rdf_set_size(ldns_rdf *rd, size_t size) -{ - assert(rd != NULL); - rd->_size = size; -} - -void -ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type) -{ - assert(rd != NULL); - rd->_type = type; -} - -void -ldns_rdf_set_data(ldns_rdf *rd, void *data) -{ - /* only copy the pointer */ - assert(rd != NULL); - rd->_data = data; -} - -/* for types that allow it, return - * the native/host order type */ -uint8_t -ldns_rdf2native_int8(const ldns_rdf *rd) -{ - uint8_t data; - - /* only allow 8 bit rdfs */ - if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_BYTE) { - return 0; - } - - memcpy(&data, ldns_rdf_data(rd), sizeof(data)); - return data; -} - -uint16_t -ldns_rdf2native_int16(const ldns_rdf *rd) -{ - uint16_t data; - - /* only allow 16 bit rdfs */ - if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_WORD) { - return 0; - } - - memcpy(&data, ldns_rdf_data(rd), sizeof(data)); - return ntohs(data); -} - -uint32_t -ldns_rdf2native_int32(const ldns_rdf *rd) -{ - uint32_t data; - - /* only allow 32 bit rdfs */ - if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_DOUBLEWORD) { - return 0; - } - - memcpy(&data, ldns_rdf_data(rd), sizeof(data)); - return ntohl(data); -} - -time_t -ldns_rdf2native_time_t(const ldns_rdf *rd) -{ - uint32_t data; - - switch(ldns_rdf_get_type(rd)) { - case LDNS_RDF_TYPE_TIME: - memcpy(&data, ldns_rdf_data(rd), sizeof(data)); - return (time_t)ntohl(data); - default: - return 0; - } -} - -ldns_rdf * -ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value) -{ - return ldns_rdf_new_frm_data(type, LDNS_RDF_SIZE_BYTE, &value); -} - -ldns_rdf * -ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value) -{ - uint16_t *rdf_data = LDNS_XMALLOC(uint16_t, 1); - ldns_rdf* rdf; - if (!rdf_data) { - return NULL; - } - ldns_write_uint16(rdf_data, value); - rdf = ldns_rdf_new(type, LDNS_RDF_SIZE_WORD, rdf_data); - if(!rdf) - LDNS_FREE(rdf_data); - return rdf; -} - -ldns_rdf * -ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value) -{ - uint32_t *rdf_data = LDNS_XMALLOC(uint32_t, 1); - ldns_rdf* rdf; - if (!rdf_data) { - return NULL; - } - ldns_write_uint32(rdf_data, value); - rdf = ldns_rdf_new(type, LDNS_RDF_SIZE_DOUBLEWORD, rdf_data); - if(!rdf) - LDNS_FREE(rdf_data); - return rdf; -} - -ldns_rdf * -ldns_native2rdf_int16_data(size_t size, uint8_t *data) -{ - uint8_t *rdf_data = LDNS_XMALLOC(uint8_t, size + 2); - ldns_rdf* rdf; - if (!rdf_data) { - return NULL; - } - ldns_write_uint16(rdf_data, size); - memcpy(rdf_data + 2, data, size); - rdf = ldns_rdf_new(LDNS_RDF_TYPE_INT16_DATA, size + 2, rdf_data); - if(!rdf) - LDNS_FREE(rdf_data); - return rdf; -} - -/* note: data must be allocated memory */ -ldns_rdf * -ldns_rdf_new(ldns_rdf_type type, size_t size, void *data) -{ - ldns_rdf *rd; - rd = LDNS_MALLOC(ldns_rdf); - if (!rd) { - return NULL; - } - ldns_rdf_set_size(rd, size); - ldns_rdf_set_type(rd, type); - ldns_rdf_set_data(rd, data); - return rd; -} - -ldns_rdf * -ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data) -{ - ldns_rdf *rdf; - - /* if the size is too big, fail */ - if (size > LDNS_MAX_RDFLEN) { - return NULL; - } - - /* allocate space */ - rdf = LDNS_MALLOC(ldns_rdf); - if (!rdf) { - return NULL; - } - rdf->_data = LDNS_XMALLOC(uint8_t, size); - if (!rdf->_data) { - LDNS_FREE(rdf); - return NULL; - } - - /* set the values */ - ldns_rdf_set_type(rdf, type); - ldns_rdf_set_size(rdf, size); - memcpy(rdf->_data, data, size); - - return rdf; -} - -ldns_rdf * -ldns_rdf_clone(const ldns_rdf *rd) -{ - assert(rd != NULL); - return (ldns_rdf_new_frm_data( ldns_rdf_get_type(rd), - ldns_rdf_size(rd), ldns_rdf_data(rd))); -} - -void -ldns_rdf_deep_free(ldns_rdf *rd) -{ - if (rd) { - if (rd->_data) { - LDNS_FREE(rd->_data); - } - LDNS_FREE(rd); - } -} - -void -ldns_rdf_free(ldns_rdf *rd) -{ - if (rd) { - LDNS_FREE(rd); - } -} - -ldns_rdf * -ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str) -{ - ldns_rdf *rdf = NULL; - ldns_status status; - - switch (type) { - case LDNS_RDF_TYPE_DNAME: - status = ldns_str2rdf_dname(&rdf, str); - break; - case LDNS_RDF_TYPE_INT8: - status = ldns_str2rdf_int8(&rdf, str); - break; - case LDNS_RDF_TYPE_INT16: - status = ldns_str2rdf_int16(&rdf, str); - break; - case LDNS_RDF_TYPE_INT32: - status = ldns_str2rdf_int32(&rdf, str); - break; - case LDNS_RDF_TYPE_A: - status = ldns_str2rdf_a(&rdf, str); - break; - case LDNS_RDF_TYPE_AAAA: - status = ldns_str2rdf_aaaa(&rdf, str); - break; - case LDNS_RDF_TYPE_STR: - status = ldns_str2rdf_str(&rdf, str); - break; - case LDNS_RDF_TYPE_APL: - status = ldns_str2rdf_apl(&rdf, str); - break; - case LDNS_RDF_TYPE_B64: - status = ldns_str2rdf_b64(&rdf, str); - break; - case LDNS_RDF_TYPE_B32_EXT: - status = ldns_str2rdf_b32_ext(&rdf, str); - break; - case LDNS_RDF_TYPE_HEX: - status = ldns_str2rdf_hex(&rdf, str); - break; - case LDNS_RDF_TYPE_NSEC: - status = ldns_str2rdf_nsec(&rdf, str); - break; - case LDNS_RDF_TYPE_TYPE: - status = ldns_str2rdf_type(&rdf, str); - break; - case LDNS_RDF_TYPE_CLASS: - status = ldns_str2rdf_class(&rdf, str); - break; - case LDNS_RDF_TYPE_CERT_ALG: - status = ldns_str2rdf_cert_alg(&rdf, str); - break; - case LDNS_RDF_TYPE_ALG: - status = ldns_str2rdf_alg(&rdf, str); - break; - case LDNS_RDF_TYPE_UNKNOWN: - status = ldns_str2rdf_unknown(&rdf, str); - break; - case LDNS_RDF_TYPE_TIME: - status = ldns_str2rdf_time(&rdf, str); - break; - case LDNS_RDF_TYPE_PERIOD: - status = ldns_str2rdf_period(&rdf, str); - break; - case LDNS_RDF_TYPE_TSIG: - status = ldns_str2rdf_tsig(&rdf, str); - break; - case LDNS_RDF_TYPE_SERVICE: - status = ldns_str2rdf_service(&rdf, str); - break; - case LDNS_RDF_TYPE_LOC: - status = ldns_str2rdf_loc(&rdf, str); - break; - case LDNS_RDF_TYPE_WKS: - status = ldns_str2rdf_wks(&rdf, str); - break; - case LDNS_RDF_TYPE_NSAP: - status = ldns_str2rdf_nsap(&rdf, str); - break; - case LDNS_RDF_TYPE_ATMA: - status = ldns_str2rdf_atma(&rdf, str); - break; - case LDNS_RDF_TYPE_IPSECKEY: - status = ldns_str2rdf_ipseckey(&rdf, str); - break; - case LDNS_RDF_TYPE_NSEC3_SALT: - status = ldns_str2rdf_nsec3_salt(&rdf, str); - break; - case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: - status = ldns_str2rdf_b32_ext(&rdf, str); - break; - case LDNS_RDF_TYPE_NONE: - default: - /* default default ??? */ - status = LDNS_STATUS_ERR; - break; - } - if (LDNS_STATUS_OK == status) { - ldns_rdf_set_type(rdf, type); - return rdf; - } - if (rdf) { - LDNS_FREE(rdf); - } - return NULL; -} - -ldns_status -ldns_rdf_new_frm_fp(ldns_rdf **rdf, ldns_rdf_type type, FILE *fp) -{ - return ldns_rdf_new_frm_fp_l(rdf, type, fp, NULL); -} - -ldns_status -ldns_rdf_new_frm_fp_l(ldns_rdf **rdf, ldns_rdf_type type, FILE *fp, int *line_nr) -{ - char *line; - ldns_rdf *r; - ssize_t t; - - line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); - if (!line) { - return LDNS_STATUS_MEM_ERR; - } - - /* read an entire line in from the file */ - if ((t = ldns_fget_token_l(fp, line, LDNS_PARSE_SKIP_SPACE, 0, line_nr)) == -1 || t == 0) { - LDNS_FREE(line); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - r = ldns_rdf_new_frm_str(type, (const char*) line); - LDNS_FREE(line); - if (rdf) { - *rdf = r; - return LDNS_STATUS_OK; - } else { - return LDNS_STATUS_NULL; - } -} - -ldns_rdf * -ldns_rdf_address_reverse(ldns_rdf *rd) -{ - uint8_t buf_4[LDNS_IP4ADDRLEN]; - uint8_t buf_6[LDNS_IP6ADDRLEN * 2]; - ldns_rdf *rev; - ldns_rdf *in_addr; - ldns_rdf *ret_dname; - uint8_t octet; - uint8_t nnibble; - uint8_t nibble; - uint8_t i, j; - - char *char_dname; - int nbit; - - if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_A && - ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_AAAA) { - return NULL; - } - - in_addr = NULL; - ret_dname = NULL; - - switch(ldns_rdf_get_type(rd)) { - case LDNS_RDF_TYPE_A: - /* the length of the buffer is 4 */ - buf_4[3] = ldns_rdf_data(rd)[0]; - buf_4[2] = ldns_rdf_data(rd)[1]; - buf_4[1] = ldns_rdf_data(rd)[2]; - buf_4[0] = ldns_rdf_data(rd)[3]; - in_addr = ldns_dname_new_frm_str("in-addr.arpa."); - if (!in_addr) { - return NULL; - } - /* make a new rdf and convert that back */ - rev = ldns_rdf_new_frm_data( LDNS_RDF_TYPE_A, - LDNS_IP4ADDRLEN, (void*)&buf_4); - if (!rev) { - LDNS_FREE(in_addr); - return NULL; - } - - /* convert rev to a string */ - char_dname = ldns_rdf2str(rev); - if (!char_dname) { - LDNS_FREE(in_addr); - ldns_rdf_deep_free(rev); - return NULL; - } - /* transform back to rdf with type dname */ - ret_dname = ldns_dname_new_frm_str(char_dname); - if (!ret_dname) { - LDNS_FREE(in_addr); - ldns_rdf_deep_free(rev); - LDNS_FREE(char_dname); - return NULL; - } - /* not needed anymore */ - ldns_rdf_deep_free(rev); - LDNS_FREE(char_dname); - break; - case LDNS_RDF_TYPE_AAAA: - /* some foo magic to reverse the nibbles ... */ - - for (nbit = 127; nbit >= 0; nbit = nbit - 4) { - /* calculate octett (8 bit) */ - octet = ( ((unsigned int) nbit) & 0x78) >> 3; - /* calculate nibble */ - nnibble = ( ((unsigned int) nbit) & 0x04) >> 2; - /* extract nibble */ - nibble = (ldns_rdf_data(rd)[octet] & ( 0xf << (4 * (1 - - nnibble)) ) ) >> ( 4 * (1 - - nnibble)); - - buf_6[(LDNS_IP6ADDRLEN * 2 - 1) - - (octet * 2 + nnibble)] = - (uint8_t)ldns_int_to_hexdigit((int)nibble); - } - - char_dname = LDNS_XMALLOC(char, (LDNS_IP6ADDRLEN * 4)); - if (!char_dname) { - return NULL; - } - char_dname[LDNS_IP6ADDRLEN * 4 - 1] = '\0'; /* closure */ - - /* walk the string and add . 's */ - for (i = 0, j = 0; i < LDNS_IP6ADDRLEN * 2; i++, j = j + 2) { - char_dname[j] = (char)buf_6[i]; - if (i != LDNS_IP6ADDRLEN * 2 - 1) { - char_dname[j + 1] = '.'; - } - } - in_addr = ldns_dname_new_frm_str("ip6.arpa."); - if (!in_addr) { - LDNS_FREE(char_dname); - return NULL; - } - - /* convert rev to a string */ - ret_dname = ldns_dname_new_frm_str(char_dname); - LDNS_FREE(char_dname); - if (!ret_dname) { - ldns_rdf_deep_free(in_addr); - return NULL; - } - break; - default: - break; - } - /* add the suffix */ - rev = ldns_dname_cat_clone(ret_dname, in_addr); - - ldns_rdf_deep_free(ret_dname); - ldns_rdf_deep_free(in_addr); - return rev; -} - -ldns_status -ldns_octet(char *word, size_t *length) -{ - char *s; - char *p; - *length = 0; - - for (s = p = word; *s != '\0'; s++,p++) { - switch (*s) { - case '.': - if (s[1] == '.') { - return LDNS_STATUS_EMPTY_LABEL; - } - *p = *s; - (*length)++; - break; - case '\\': - if ('0' <= s[1] && s[1] <= '9' && - '0' <= s[2] && s[2] <= '9' && - '0' <= s[3] && s[3] <= '9') { - /* \DDD seen */ - int val = ((s[1] - '0') * 100 + - (s[2] - '0') * 10 + (s[3] - '0')); - - if (0 <= val && val <= 255) { - /* this also handles \0 */ - s += 3; - *p = val; - (*length)++; - } else { - return LDNS_STATUS_DDD_OVERFLOW; - } - } else { - /* an espaced character, like \ ? - * remove the '\' keep the rest */ - *p = *++s; - (*length)++; - } - break; - case '\"': - /* non quoted " Is either first or the last character in - * the string */ - - *p = *++s; /* skip it */ - (*length)++; - /* I'm not sure if this is needed in libdns... MG */ - if ( *s == '\0' ) { - /* ok, it was the last one */ - *p = '\0'; - return LDNS_STATUS_OK; - } - break; - default: - *p = *s; - (*length)++; - break; - } - } - *p = '\0'; - return LDNS_STATUS_OK; -} - -int -ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2) -{ - uint16_t i1, i2, i; - uint8_t *d1, *d2; - - /* only when both are not NULL we can say anything about them */ - if (!rd1 && !rd2) { - return 0; - } - if (!rd1 || !rd2) { - return -1; - } - i1 = ldns_rdf_size(rd1); - i2 = ldns_rdf_size(rd2); - - if (i1 < i2) { - return -1; - } else if (i1 > i2) { - return +1; - } else { - d1 = (uint8_t*)ldns_rdf_data(rd1); - d2 = (uint8_t*)ldns_rdf_data(rd2); - for(i = 0; i < i1; i++) { - if (d1[i] < d2[i]) { - return -1; - } else if (d1[i] > d2[i]) { - return +1; - } - } - } - return 0; -} - -uint32_t -ldns_str2period(const char *nptr, const char **endptr) -{ - int sign = 0; - uint32_t i = 0; - uint32_t seconds = 0; - - for(*endptr = nptr; **endptr; (*endptr)++) { - switch (**endptr) { - case ' ': - case '\t': - break; - case '-': - if(sign == 0) { - sign = -1; - } else { - return seconds; - } - break; - case '+': - if(sign == 0) { - sign = 1; - } else { - return seconds; - } - break; - case 's': - case 'S': - seconds += i; - i = 0; - break; - case 'm': - case 'M': - seconds += i * 60; - i = 0; - break; - case 'h': - case 'H': - seconds += i * 60 * 60; - i = 0; - break; - case 'd': - case 'D': - seconds += i * 60 * 60 * 24; - i = 0; - break; - case 'w': - case 'W': - seconds += i * 60 * 60 * 24 * 7; - i = 0; - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - i *= 10; - i += (**endptr - '0'); - break; - default: - seconds += i; - /* disregard signedness */ - return seconds; - } - } - seconds += i; - /* disregard signedness */ - return seconds; -} diff --git a/libs/ldns/resolver.c b/libs/ldns/resolver.c deleted file mode 100644 index 735e6f147d..0000000000 --- a/libs/ldns/resolver.c +++ /dev/null @@ -1,1309 +0,0 @@ -/* - * resolver.c - * - * resolver implementation - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include -#include - -/* Access function for reading - * and setting the different Resolver - * options */ - -/* read */ -uint16_t -ldns_resolver_port(const ldns_resolver *r) -{ - return r->_port; -} - -uint16_t -ldns_resolver_edns_udp_size(const ldns_resolver *r) -{ - return r->_edns_udp_size; -} - -uint8_t -ldns_resolver_retry(const ldns_resolver *r) -{ - return r->_retry; -} - -uint8_t -ldns_resolver_retrans(const ldns_resolver *r) -{ - return r->_retrans; -} - -bool -ldns_resolver_fallback(const ldns_resolver *r) -{ - return r->_fallback; -} - -uint8_t -ldns_resolver_ip6(const ldns_resolver *r) -{ - return r->_ip6; -} - -bool -ldns_resolver_recursive(const ldns_resolver *r) -{ - return r->_recursive; -} - -bool -ldns_resolver_debug(const ldns_resolver *r) -{ - return r->_debug; -} - -bool -ldns_resolver_dnsrch(const ldns_resolver *r) -{ - return r->_dnsrch; -} - -bool -ldns_resolver_fail(const ldns_resolver *r) -{ - return r->_fail; -} - -bool -ldns_resolver_defnames(const ldns_resolver *r) -{ - return r->_defnames; -} - -ldns_rdf * -ldns_resolver_domain(const ldns_resolver *r) -{ - return r->_domain; -} - -ldns_rdf ** -ldns_resolver_searchlist(const ldns_resolver *r) -{ - return r->_searchlist; -} - -ldns_rdf ** -ldns_resolver_nameservers(const ldns_resolver *r) -{ - return r->_nameservers; -} - -size_t -ldns_resolver_nameserver_count(const ldns_resolver *r) -{ - return r->_nameserver_count; -} - -bool -ldns_resolver_dnssec(const ldns_resolver *r) -{ - return r->_dnssec; -} - -bool -ldns_resolver_dnssec_cd(const ldns_resolver *r) -{ - return r->_dnssec_cd; -} - -ldns_rr_list * -ldns_resolver_dnssec_anchors(const ldns_resolver *r) -{ - return r->_dnssec_anchors; -} - -bool -ldns_resolver_trusted_key(const ldns_resolver *r, ldns_rr_list * keys, ldns_rr_list * trusted_keys) -{ - size_t i; - bool result = false; - - ldns_rr_list * trust_anchors; - ldns_rr * cur_rr; - - if (!r || !keys) { return false; } - - trust_anchors = ldns_resolver_dnssec_anchors(r); - - if (!trust_anchors) { return false; } - - for (i = 0; i < ldns_rr_list_rr_count(keys); i++) { - - cur_rr = ldns_rr_list_rr(keys, i); - if (ldns_rr_list_contains_rr(trust_anchors, cur_rr)) { - if (trusted_keys) { ldns_rr_list_push_rr(trusted_keys, cur_rr); } - result = true; - } - } - - return result; -} - -bool -ldns_resolver_igntc(const ldns_resolver *r) -{ - return r->_igntc; -} - -bool -ldns_resolver_usevc(const ldns_resolver *r) -{ - return r->_usevc; -} - -size_t * -ldns_resolver_rtt(const ldns_resolver *r) -{ - return r->_rtt; -} - -size_t -ldns_resolver_nameserver_rtt(const ldns_resolver *r, size_t pos) -{ - size_t *rtt; - - assert(r != NULL); - - rtt = ldns_resolver_rtt(r); - - if (pos >= ldns_resolver_nameserver_count(r)) { - /* error ?*/ - return 0; - } else { - return rtt[pos]; - } - -} - -struct timeval -ldns_resolver_timeout(const ldns_resolver *r) -{ - return r->_timeout; -} - -char * -ldns_resolver_tsig_keyname(const ldns_resolver *r) -{ - return r->_tsig_keyname; -} - -char * -ldns_resolver_tsig_algorithm(const ldns_resolver *r) -{ - return r->_tsig_algorithm; -} - -char * -ldns_resolver_tsig_keydata(const ldns_resolver *r) -{ - return r->_tsig_keydata; -} - -bool -ldns_resolver_random(const ldns_resolver *r) -{ - return r->_random; -} - -size_t -ldns_resolver_searchlist_count(const ldns_resolver *r) -{ - return r->_searchlist_count; -} - -/* write */ -void -ldns_resolver_set_port(ldns_resolver *r, uint16_t p) -{ - r->_port = p; -} - -ldns_rdf * -ldns_resolver_pop_nameserver(ldns_resolver *r) -{ - ldns_rdf **nameservers; - ldns_rdf *pop; - size_t ns_count; - size_t *rtt; - - assert(r != NULL); - - ns_count = ldns_resolver_nameserver_count(r); - nameservers = ldns_resolver_nameservers(r); - rtt = ldns_resolver_rtt(r); - if (ns_count == 0 || !nameservers) { - return NULL; - } - - pop = nameservers[ns_count - 1]; - - nameservers = LDNS_XREALLOC(nameservers, ldns_rdf *, (ns_count - 1)); - rtt = LDNS_XREALLOC(rtt, size_t, (ns_count - 1)); - - if(nameservers) - ldns_resolver_set_nameservers(r, nameservers); - if(rtt) - ldns_resolver_set_rtt(r, rtt); - /* decr the count */ - ldns_resolver_dec_nameserver_count(r); - return pop; -} - -ldns_status -ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n) -{ - ldns_rdf **nameservers; - size_t ns_count; - size_t *rtt; - - if (ldns_rdf_get_type(n) != LDNS_RDF_TYPE_A && - ldns_rdf_get_type(n) != LDNS_RDF_TYPE_AAAA) { - return LDNS_STATUS_ERR; - } - - ns_count = ldns_resolver_nameserver_count(r); - nameservers = ldns_resolver_nameservers(r); - rtt = ldns_resolver_rtt(r); - - /* make room for the next one */ - if (ns_count == 0) { - nameservers = LDNS_XMALLOC(ldns_rdf *, 1); - } else { - nameservers = LDNS_XREALLOC(nameservers, ldns_rdf *, (ns_count + 1)); - } - if(!nameservers) - return LDNS_STATUS_MEM_ERR; - - /* set the new value in the resolver */ - ldns_resolver_set_nameservers(r, nameservers); - - /* don't forget the rtt */ - if (ns_count == 0) { - rtt = LDNS_XMALLOC(size_t, 1); - } else { - rtt = LDNS_XREALLOC(rtt, size_t, (ns_count + 1)); - } - if(!rtt) - return LDNS_STATUS_MEM_ERR; - - /* slide n in its slot. */ - /* we clone it here, because then we can free the original - * rr's where it stood */ - nameservers[ns_count] = ldns_rdf_clone(n); - rtt[ns_count] = LDNS_RESOLV_RTT_MIN; - ldns_resolver_incr_nameserver_count(r); - ldns_resolver_set_rtt(r, rtt); - return LDNS_STATUS_OK; -} - -ldns_status -ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr) -{ - ldns_rdf *address; - if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_A && - ldns_rr_get_type(rr) != LDNS_RR_TYPE_AAAA)) { - return LDNS_STATUS_ERR; - } - address = ldns_rr_rdf(rr, 0); /* extract the ip number */ - if (address) { - return ldns_resolver_push_nameserver(r, address); - } else { - return LDNS_STATUS_ERR; - } -} - -ldns_status -ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist) -{ - ldns_rr *rr; - ldns_status stat; - size_t i; - - stat = LDNS_STATUS_OK; - if (rrlist) { - for(i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { - rr = ldns_rr_list_rr(rrlist, i); - if (ldns_resolver_push_nameserver_rr(r, rr) != LDNS_STATUS_OK) { - stat = LDNS_STATUS_ERR; - break; - } - } - return stat; - } else { - return LDNS_STATUS_ERR; - } -} - -void -ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s) -{ - r->_edns_udp_size = s; -} - -void -ldns_resolver_set_recursive(ldns_resolver *r, bool re) -{ - r->_recursive = re; -} - -void -ldns_resolver_set_dnssec(ldns_resolver *r, bool d) -{ - r->_dnssec = d; -} - -void -ldns_resolver_set_dnssec_cd(ldns_resolver *r, bool d) -{ - r->_dnssec_cd = d; -} - -void -ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list * l) -{ - r->_dnssec_anchors = l; -} - -ldns_status -ldns_resolver_push_dnssec_anchor(ldns_resolver *r, ldns_rr *rr) -{ - ldns_rr_list * trust_anchors; - - if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY)) { - return LDNS_STATUS_ERR; - } - - if (!(trust_anchors = ldns_resolver_dnssec_anchors(r))) { /* Initialize */ - trust_anchors = ldns_rr_list_new(); - ldns_resolver_set_dnssec_anchors(r, trust_anchors); - } - - return (ldns_rr_list_push_rr(trust_anchors, ldns_rr_clone(rr))) ? LDNS_STATUS_OK : LDNS_STATUS_ERR; -} - -void -ldns_resolver_set_igntc(ldns_resolver *r, bool i) -{ - r->_igntc = i; -} - -void -ldns_resolver_set_usevc(ldns_resolver *r, bool vc) -{ - r->_usevc = vc; -} - -void -ldns_resolver_set_debug(ldns_resolver *r, bool d) -{ - r->_debug = d; -} - -void -ldns_resolver_set_ip6(ldns_resolver *r, uint8_t ip6) -{ - r->_ip6 = ip6; -} - -void -ldns_resolver_set_fail(ldns_resolver *r, bool f) -{ - r->_fail =f; -} - -void -ldns_resolver_set_searchlist_count(ldns_resolver *r, size_t c) -{ - r->_searchlist_count = c; -} - -void -ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c) -{ - r->_nameserver_count = c; -} - -void -ldns_resolver_set_dnsrch(ldns_resolver *r, bool d) -{ - r->_dnsrch = d; -} - -void -ldns_resolver_set_retry(ldns_resolver *r, uint8_t retry) -{ - r->_retry = retry; -} - -void -ldns_resolver_set_retrans(ldns_resolver *r, uint8_t retrans) -{ - r->_retrans = retrans; -} - -void -ldns_resolver_set_fallback(ldns_resolver *r, bool fallback) -{ - r->_fallback = fallback; -} - -void -ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **n) -{ - r->_nameservers = n; -} - -void -ldns_resolver_set_defnames(ldns_resolver *r, bool d) -{ - r->_defnames = d; -} - -void -ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt) -{ - r->_rtt = rtt; -} - -void -ldns_resolver_set_nameserver_rtt(ldns_resolver *r, size_t pos, size_t value) -{ - size_t *rtt; - - assert(r != NULL); - - rtt = ldns_resolver_rtt(r); - - if (pos >= ldns_resolver_nameserver_count(r)) { - /* error ?*/ - } else { - rtt[pos] = value; - } - -} - -void -ldns_resolver_incr_nameserver_count(ldns_resolver *r) -{ - size_t c; - - c = ldns_resolver_nameserver_count(r); - ldns_resolver_set_nameserver_count(r, ++c); -} - -void -ldns_resolver_dec_nameserver_count(ldns_resolver *r) -{ - size_t c; - - c = ldns_resolver_nameserver_count(r); - if (c == 0) { - return; - } else { - ldns_resolver_set_nameserver_count(r, --c); - } -} - -void -ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *d) -{ - r->_domain = d; -} - -void -ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout) -{ - r->_timeout.tv_sec = timeout.tv_sec; - r->_timeout.tv_usec = timeout.tv_usec; -} - -void -ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *d) -{ - ldns_rdf **searchlist; - size_t list_count; - - if (ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME) { - return; - } - - list_count = ldns_resolver_searchlist_count(r); - searchlist = ldns_resolver_searchlist(r); - - searchlist = LDNS_XREALLOC(searchlist, ldns_rdf *, (list_count + 1)); - if (searchlist) { - r->_searchlist = searchlist; - - searchlist[list_count] = ldns_rdf_clone(d); - ldns_resolver_set_searchlist_count(r, list_count + 1); - } /* no way to report mem err */ -} - -void -ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname) -{ - LDNS_FREE(r->_tsig_keyname); - r->_tsig_keyname = strdup(tsig_keyname); -} - -void -ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm) -{ - LDNS_FREE(r->_tsig_algorithm); - r->_tsig_algorithm = strdup(tsig_algorithm); -} - -void -ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata) -{ - LDNS_FREE(r->_tsig_keydata); - r->_tsig_keydata = strdup(tsig_keydata); -} - -void -ldns_resolver_set_random(ldns_resolver *r, bool b) -{ - r->_random = b; -} - -/* more sophisticated functions */ -ldns_resolver * -ldns_resolver_new(void) -{ - ldns_resolver *r; - - r = LDNS_MALLOC(ldns_resolver); - if (!r) { - return NULL; - } - - r->_searchlist = NULL; - r->_nameservers = NULL; - r->_rtt = NULL; - - /* defaults are filled out */ - ldns_resolver_set_searchlist_count(r, 0); - ldns_resolver_set_nameserver_count(r, 0); - ldns_resolver_set_usevc(r, 0); - ldns_resolver_set_port(r, LDNS_PORT); - ldns_resolver_set_domain(r, NULL); - ldns_resolver_set_defnames(r, false); - ldns_resolver_set_retry(r, 3); - ldns_resolver_set_retrans(r, 2); - ldns_resolver_set_fallback(r, true); - ldns_resolver_set_fail(r, false); - ldns_resolver_set_edns_udp_size(r, 0); - ldns_resolver_set_dnssec(r, false); - ldns_resolver_set_dnssec_cd(r, false); - ldns_resolver_set_dnssec_anchors(r, NULL); - ldns_resolver_set_ip6(r, LDNS_RESOLV_INETANY); - ldns_resolver_set_igntc(r, false); - ldns_resolver_set_recursive(r, false); - ldns_resolver_set_dnsrch(r, true); - - /* randomize the nameserver to be queried - * when there are multiple - */ - ldns_resolver_set_random(r, true); - - ldns_resolver_set_debug(r, 0); - - r->_timeout.tv_sec = LDNS_DEFAULT_TIMEOUT_SEC; - r->_timeout.tv_usec = LDNS_DEFAULT_TIMEOUT_USEC; - - /* TODO: fd=0 is actually a valid socket (stdin), - replace with -1 */ - r->_socket = 0; - r->_axfr_soa_count = 0; - r->_axfr_i = 0; - r->_cur_axfr_pkt = NULL; - - r->_tsig_keyname = NULL; - r->_tsig_keydata = NULL; - r->_tsig_algorithm = NULL; - return r; -} - -ldns_status -ldns_resolver_new_frm_fp(ldns_resolver **res, FILE *fp) -{ - return ldns_resolver_new_frm_fp_l(res, fp, NULL); -} - -ldns_status -ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) -{ - ldns_resolver *r; - const char *keyword[LDNS_RESOLV_KEYWORDS]; - char word[LDNS_MAX_LINELEN + 1]; - int8_t expect; - uint8_t i; - ldns_rdf *tmp; -#ifdef HAVE_SSL - ldns_rr *tmp_rr; -#endif - ssize_t gtr, bgtr; - ldns_buffer *b; - int lnr = 0, oldline; - if(!line_nr) line_nr = &lnr; - - /* do this better - * expect = - * 0: keyword - * 1: default domain dname - * 2: NS aaaa or a record - */ - - /* recognized keywords */ - keyword[LDNS_RESOLV_NAMESERVER] = "nameserver"; - keyword[LDNS_RESOLV_DEFDOMAIN] = "domain"; - keyword[LDNS_RESOLV_SEARCH] = "search"; - /* these two are read but not used atm TODO */ - keyword[LDNS_RESOLV_SORTLIST] = "sortlist"; - keyword[LDNS_RESOLV_OPTIONS] = "options"; - keyword[LDNS_RESOLV_ANCHOR] = "anchor"; - expect = LDNS_RESOLV_KEYWORD; - - r = ldns_resolver_new(); - if (!r) { - return LDNS_STATUS_MEM_ERR; - } - - gtr = 1; - word[0] = 0; - oldline = *line_nr; - expect = LDNS_RESOLV_KEYWORD; - while (gtr > 0) { - /* check comments */ - if (word[0] == '#') { - word[0]='x'; - if(oldline == *line_nr) { - /* skip until end of line */ - int c; - do { - c = fgetc(fp); - } while(c != EOF && c != '\n'); - if(c=='\n' && line_nr) (*line_nr)++; - } - /* and read next to prepare for further parsing */ - oldline = *line_nr; - continue; - } - oldline = *line_nr; - switch(expect) { - case LDNS_RESOLV_KEYWORD: - /* keyword */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); - if (gtr != 0) { - if(word[0] == '#') continue; - for(i = 0; i < LDNS_RESOLV_KEYWORDS; i++) { - if (strcasecmp(keyword[i], word) == 0) { - /* chosen the keyword and - * expect values carefully - */ - expect = i; - break; - } - } - /* no keyword recognized */ - if (expect == LDNS_RESOLV_KEYWORD) { - /* skip line */ - /* - ldns_resolver_deep_free(r); - return LDNS_STATUS_SYNTAX_KEYWORD_ERR; - */ - } - } - break; - case LDNS_RESOLV_DEFDOMAIN: - /* default domain dname */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); - if (gtr == 0) { - return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; - } - if(word[0] == '#') { - expect = LDNS_RESOLV_KEYWORD; - continue; - } - tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word); - if (!tmp) { - ldns_resolver_deep_free(r); - return LDNS_STATUS_SYNTAX_DNAME_ERR; - } - - /* DOn't free, because we copy the pointer */ - ldns_resolver_set_domain(r, tmp); - expect = LDNS_RESOLV_KEYWORD; - break; - case LDNS_RESOLV_NAMESERVER: - /* NS aaaa or a record */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); - if (gtr == 0) { - return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; - } - if(word[0] == '#') { - expect = LDNS_RESOLV_KEYWORD; - continue; - } - if(strchr(word, '%')) { - /* snip off interface labels, - * fe80::222:19ff:fe31:4222%eth0 */ - strchr(word, '%')[0]=0; - } - tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, word); - if (!tmp) { - /* try ip4 */ - tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, word); - } - /* could not parse it, exit */ - if (!tmp) { - ldns_resolver_deep_free(r); - return LDNS_STATUS_SYNTAX_ERR; - } - (void)ldns_resolver_push_nameserver(r, tmp); - ldns_rdf_deep_free(tmp); - expect = LDNS_RESOLV_KEYWORD; - break; - case LDNS_RESOLV_SEARCH: - /* search list domain dname */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); - b = LDNS_MALLOC(ldns_buffer); - if(!b) { - ldns_resolver_deep_free(r); - return LDNS_STATUS_MEM_ERR; - } - - ldns_buffer_new_frm_data(b, word, (size_t) gtr); - if(ldns_buffer_status(b) != LDNS_STATUS_OK) { - LDNS_FREE(b); - ldns_resolver_deep_free(r); - return LDNS_STATUS_MEM_ERR; - } - bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, (size_t) gtr + 1); - while (bgtr > 0) { - gtr -= bgtr; - if(word[0] == '#') { - expect = LDNS_RESOLV_KEYWORD; - ldns_buffer_free(b); - continue; - } - tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word); - if (!tmp) { - ldns_resolver_deep_free(r); - ldns_buffer_free(b); - return LDNS_STATUS_SYNTAX_DNAME_ERR; - } - - ldns_resolver_push_searchlist(r, tmp); - - ldns_rdf_deep_free(tmp); - bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, - (size_t) gtr + 1); - } - ldns_buffer_free(b); - gtr = 1; - expect = LDNS_RESOLV_KEYWORD; - break; - case LDNS_RESOLV_SORTLIST: - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); - /* sortlist not implemented atm */ - expect = LDNS_RESOLV_KEYWORD; - break; - case LDNS_RESOLV_OPTIONS: - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); - /* options not implemented atm */ - expect = LDNS_RESOLV_KEYWORD; - break; - case LDNS_RESOLV_ANCHOR: - /* a file containing a DNSSEC trust anchor */ - gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); - if (gtr == 0) { - ldns_resolver_deep_free(r); - return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; - } - if(word[0] == '#') { - expect = LDNS_RESOLV_KEYWORD; - continue; - } - -#ifdef HAVE_SSL - tmp_rr = ldns_read_anchor_file(word); - (void) ldns_resolver_push_dnssec_anchor(r, tmp_rr); - ldns_rr_free(tmp_rr); -#endif - expect = LDNS_RESOLV_KEYWORD; - break; - } - } - - if (res) { - *res = r; - return LDNS_STATUS_OK; - } else { - ldns_resolver_deep_free(r); - return LDNS_STATUS_NULL; - } -} - -ldns_status -ldns_resolver_new_frm_file(ldns_resolver **res, const char *filename) -{ - ldns_resolver *r; - FILE *fp; - ldns_status s; - - if (!filename) { - fp = fopen(LDNS_RESOLV_CONF, "r"); - - } else { - fp = fopen(filename, "r"); - } - if (!fp) { - return LDNS_STATUS_FILE_ERR; - } - - s = ldns_resolver_new_frm_fp(&r, fp); - fclose(fp); - if (s == LDNS_STATUS_OK) { - if (res) { - *res = r; - return LDNS_STATUS_OK; - } else { - return LDNS_STATUS_NULL; - } - } - return s; -} - -void -ldns_resolver_free(ldns_resolver *res) -{ - LDNS_FREE(res); -} - -void -ldns_resolver_deep_free(ldns_resolver *res) -{ - size_t i; - - if (res) { - if (res->_searchlist) { - for (i = 0; i < ldns_resolver_searchlist_count(res); i++) { - ldns_rdf_deep_free(res->_searchlist[i]); - } - LDNS_FREE(res->_searchlist); - } - if (res->_nameservers) { - for (i = 0; i < res->_nameserver_count; i++) { - ldns_rdf_deep_free(res->_nameservers[i]); - } - LDNS_FREE(res->_nameservers); - } - if (ldns_resolver_domain(res)) { - ldns_rdf_deep_free(ldns_resolver_domain(res)); - } - if (res->_tsig_keyname) { - LDNS_FREE(res->_tsig_keyname); - } - if (res->_tsig_keydata) { - LDNS_FREE(res->_tsig_keydata); - } - if (res->_tsig_algorithm) { - LDNS_FREE(res->_tsig_algorithm); - } - - if (res->_cur_axfr_pkt) { - ldns_pkt_free(res->_cur_axfr_pkt); - } - - if (res->_rtt) { - LDNS_FREE(res->_rtt); - } - if (res->_dnssec_anchors) { - ldns_rr_list_deep_free(res->_dnssec_anchors); - } - LDNS_FREE(res); - } -} - -ldns_pkt * -ldns_resolver_search(const ldns_resolver *r,const ldns_rdf *name, - ldns_rr_type t, ldns_rr_class c, uint16_t flags) -{ - - char *str_dname; - ldns_rdf *new_name; - ldns_rdf **search_list; - size_t i; - ldns_pkt *p; - - str_dname = ldns_rdf2str(name); - - if (ldns_dname_str_absolute(str_dname)) { - /* query as-is */ - return ldns_resolver_query(r, name, t, c, flags); - } else if (ldns_resolver_dnsrch(r)) { - search_list = ldns_resolver_searchlist(r); - for (i = 0; i < ldns_resolver_searchlist_count(r); i++) { - new_name = ldns_dname_cat_clone(name, search_list[i]); - - p = ldns_resolver_query(r, new_name, t, c, flags); - ldns_rdf_free(new_name); - if (p) { - if (ldns_pkt_get_rcode(p) == LDNS_RCODE_NOERROR) { - return p; - } else { - ldns_pkt_free(p); - p = NULL; - } - } - } - } - return NULL; -} - -ldns_pkt * -ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, - ldns_rr_type t, ldns_rr_class c, uint16_t flags) -{ - ldns_rdf *newname; - ldns_pkt *pkt; - ldns_status status; - - pkt = NULL; - - if (!ldns_resolver_defnames(r)) { - status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, - t, c, flags); - if (status == LDNS_STATUS_OK) { - return pkt; - } else { - if (pkt) { - ldns_pkt_free(pkt); - } - return NULL; - } - } - - if (!ldns_resolver_domain(r)) { - /* _defnames is set, but the domain is not....?? */ - status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, - t, c, flags); - if (status == LDNS_STATUS_OK) { - return pkt; - } else { - if (pkt) { - ldns_pkt_free(pkt); - } - return NULL; - } - } - - newname = ldns_dname_cat_clone((const ldns_rdf*)name, ldns_resolver_domain(r)); - if (!newname) { - if (pkt) { - ldns_pkt_free(pkt); - } - return NULL; - } - - (void)ldns_resolver_send(&pkt, (ldns_resolver *)r, newname, t, c, - flags); - - ldns_rdf_free(newname); - - return pkt; -} - -ldns_status -ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, - ldns_pkt *query_pkt) -{ - ldns_pkt *answer_pkt = NULL; - ldns_status stat = LDNS_STATUS_OK; - - stat = ldns_send(&answer_pkt, (ldns_resolver *)r, query_pkt); - if (stat != LDNS_STATUS_OK) { - if(answer_pkt) { - ldns_pkt_free(answer_pkt); - answer_pkt = NULL; - } - } else { - /* if tc=1 fall back to EDNS and/or TCP */ - /* check for tcp first (otherwise we don't care about tc=1) */ - if (!ldns_resolver_usevc(r) && ldns_resolver_fallback(r)) { - if (ldns_pkt_tc(answer_pkt)) { - /* was EDNS0 set? */ - if (ldns_pkt_edns_udp_size(query_pkt) == 0) { - ldns_pkt_set_edns_udp_size(query_pkt, 4096); - ldns_pkt_free(answer_pkt); - stat = ldns_send(&answer_pkt, r, query_pkt); - } - /* either way, if it is still truncated, use TCP */ - if (stat != LDNS_STATUS_OK || - ldns_pkt_tc(answer_pkt)) { - ldns_resolver_set_usevc(r, true); - ldns_pkt_free(answer_pkt); - stat = ldns_send(&answer_pkt, r, query_pkt); - ldns_resolver_set_usevc(r, false); - } - } - } - } - - if (answer) { - *answer = answer_pkt; - } - - return stat; -} - -ldns_status -ldns_resolver_prepare_query_pkt(ldns_pkt **query_pkt, ldns_resolver *r, - const ldns_rdf *name, ldns_rr_type t, - ldns_rr_class c, uint16_t flags) -{ - struct timeval now; - - /* prepare a question pkt from the parameters - * and then send this */ - *query_pkt = ldns_pkt_query_new(ldns_rdf_clone(name), t, c, flags); - if (!*query_pkt) { - return LDNS_STATUS_ERR; - } - - /* set DO bit if necessary */ - if (ldns_resolver_dnssec(r)) { - if (ldns_resolver_edns_udp_size(r) == 0) { - ldns_resolver_set_edns_udp_size(r, 4096); - } - ldns_pkt_set_edns_do(*query_pkt, true); - if (ldns_resolver_dnssec_cd(r) || (flags & LDNS_CD)) { - ldns_pkt_set_cd(*query_pkt, true); - } - } - - /* transfer the udp_edns_size from the resolver to the packet */ - if (ldns_resolver_edns_udp_size(r) != 0) { - ldns_pkt_set_edns_udp_size(*query_pkt, ldns_resolver_edns_udp_size(r)); - } - - /* set the timestamp */ - now.tv_sec = time(NULL); - now.tv_usec = 0; - ldns_pkt_set_timestamp(*query_pkt, now); - - - if (ldns_resolver_debug(r)) { - ldns_pkt_print(stdout, *query_pkt); - } - - /* only set the id if it is not set yet */ - if (ldns_pkt_id(*query_pkt) == 0) { - ldns_pkt_set_random_id(*query_pkt); - } - - return LDNS_STATUS_OK; -} - - -ldns_status -ldns_resolver_send(ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, - ldns_rr_type t, ldns_rr_class c, uint16_t flags) -{ - ldns_pkt *query_pkt; - ldns_pkt *answer_pkt; - ldns_status status; - - assert(r != NULL); - assert(name != NULL); - - answer_pkt = NULL; - - /* do all the preprocessing here, then fire of an query to - * the network */ - - if (0 == t) { - t= LDNS_RR_TYPE_A; - } - if (0 == c) { - c= LDNS_RR_CLASS_IN; - } - if (0 == ldns_resolver_nameserver_count(r)) { - return LDNS_STATUS_RES_NO_NS; - } - if (ldns_rdf_get_type(name) != LDNS_RDF_TYPE_DNAME) { - return LDNS_STATUS_RES_QUERY; - } - - status = ldns_resolver_prepare_query_pkt(&query_pkt, r, name, - t, c, flags); - if (status != LDNS_STATUS_OK) { - return status; - } - - /* if tsig values are set, tsign it */ - /* TODO: make last 3 arguments optional too? maybe make complete - rr instead of seperate values in resolver (and packet) - Jelte - should this go in pkt_prepare? - */ - if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) { -#ifdef HAVE_SSL - status = ldns_pkt_tsig_sign(query_pkt, - ldns_resolver_tsig_keyname(r), - ldns_resolver_tsig_keydata(r), - 300, ldns_resolver_tsig_algorithm(r), NULL); - if (status != LDNS_STATUS_OK) { - return LDNS_STATUS_CRYPTO_TSIG_ERR; - } -#else - return LDNS_STATUS_CRYPTO_TSIG_ERR; -#endif /* HAVE_SSL */ - } - - status = ldns_resolver_send_pkt(&answer_pkt, r, query_pkt); - ldns_pkt_free(query_pkt); - - /* allows answer to be NULL when not interested in return value */ - if (answer) { - *answer = answer_pkt; - } - return status; -} - -ldns_rr * -ldns_axfr_next(ldns_resolver *resolver) -{ - ldns_rr *cur_rr; - uint8_t *packet_wire; - size_t packet_wire_size; - ldns_lookup_table *rcode; - ldns_status status; - - /* check if start() has been called */ - if (!resolver || resolver->_socket == 0) { - return NULL; - } - - if (resolver->_cur_axfr_pkt) { - if (resolver->_axfr_i == ldns_pkt_ancount(resolver->_cur_axfr_pkt)) { - ldns_pkt_free(resolver->_cur_axfr_pkt); - resolver->_cur_axfr_pkt = NULL; - return ldns_axfr_next(resolver); - } - cur_rr = ldns_rr_clone(ldns_rr_list_rr( - ldns_pkt_answer(resolver->_cur_axfr_pkt), - resolver->_axfr_i)); - resolver->_axfr_i++; - if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) { - resolver->_axfr_soa_count++; - if (resolver->_axfr_soa_count >= 2) { -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - ldns_pkt_free(resolver->_cur_axfr_pkt); - resolver->_cur_axfr_pkt = NULL; - } - } - return cur_rr; - } else { - packet_wire = ldns_tcp_read_wire(resolver->_socket, &packet_wire_size); - if(!packet_wire) - return NULL; - - status = ldns_wire2pkt(&resolver->_cur_axfr_pkt, packet_wire, - packet_wire_size); - free(packet_wire); - - resolver->_axfr_i = 0; - if (status != LDNS_STATUS_OK) { - /* TODO: make status return type of this function (...api change) */ - fprintf(stderr, "Error parsing rr during AXFR: %s\n", ldns_get_errorstr_by_id(status)); - - /* RoRi: we must now also close the socket, otherwise subsequent uses of the - same resolver structure will fail because the link is still open or - in an undefined state */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - - return NULL; - } else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) { - rcode = ldns_lookup_by_id(ldns_rcodes, (int) ldns_pkt_get_rcode(resolver->_cur_axfr_pkt)); - fprintf(stderr, "Error in AXFR: %s\n", rcode->name); - - /* RoRi: we must now also close the socket, otherwise subsequent uses of the - same resolver structure will fail because the link is still open or - in an undefined state */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - - return NULL; - } else { - return ldns_axfr_next(resolver); - } - - } - -} - -bool -ldns_axfr_complete(const ldns_resolver *res) -{ - /* complete when soa count is 2? */ - return res->_axfr_soa_count == 2; -} - -ldns_pkt * -ldns_axfr_last_pkt(const ldns_resolver *res) -{ - return res->_cur_axfr_pkt; -} - -/* random isn't really that good */ -void -ldns_resolver_nameservers_randomize(ldns_resolver *r) -{ - uint16_t i, j; - ldns_rdf **ns, *tmp; - - /* should I check for ldns_resolver_random?? */ - assert(r != NULL); - - ns = ldns_resolver_nameservers(r); - for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { - j = ldns_get_random() % ldns_resolver_nameserver_count(r); - tmp = ns[i]; - ns[i] = ns[j]; - ns[j] = tmp; - } - ldns_resolver_set_nameservers(r, ns); -} - diff --git a/libs/ldns/rr.c b/libs/ldns/rr.c deleted file mode 100644 index 7b799b9b56..0000000000 --- a/libs/ldns/rr.c +++ /dev/null @@ -1,2403 +0,0 @@ -/* rr.c - * - * access functions for ldns_rr - - * a Net::DNS like library for C - * LibDNS Team @ NLnet Labs - * - * (c) NLnet Labs, 2004-2006 - * See the file LICENSE for the license - */ -#include - -#include - -#include -#include - -#include - -#define LDNS_SYNTAX_DATALEN 16 -#define LDNS_TTL_DATALEN 21 -#define LDNS_RRLIST_INIT 8 - -ldns_rr * -ldns_rr_new(void) -{ - ldns_rr *rr; - rr = LDNS_MALLOC(ldns_rr); - if (!rr) { - return NULL; - } - - ldns_rr_set_owner(rr, NULL); - ldns_rr_set_question(rr, false); - ldns_rr_set_rd_count(rr, 0); - rr->_rdata_fields = NULL; - ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); - ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); - return rr; -} - -ldns_rr * -ldns_rr_new_frm_type(ldns_rr_type t) -{ - ldns_rr *rr; - const ldns_rr_descriptor *desc; - size_t i; - - rr = LDNS_MALLOC(ldns_rr); - if (!rr) { - return NULL; - } - - desc = ldns_rr_descript(t); - - rr->_rdata_fields = LDNS_XMALLOC(ldns_rdf *, ldns_rr_descriptor_minimum(desc)); - if(!rr->_rdata_fields) { - LDNS_FREE(rr); - return NULL; - } - for (i = 0; i < ldns_rr_descriptor_minimum(desc); i++) { - rr->_rdata_fields[i] = NULL; - } - - ldns_rr_set_owner(rr, NULL); - ldns_rr_set_question(rr, false); - /* set the count to minimum */ - ldns_rr_set_rd_count(rr, ldns_rr_descriptor_minimum(desc)); - ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); - ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); - ldns_rr_set_type(rr, t); - return rr; -} - -void -ldns_rr_free(ldns_rr *rr) -{ - size_t i; - if (rr) { - if (ldns_rr_owner(rr)) { - ldns_rdf_deep_free(ldns_rr_owner(rr)); - } - for (i = 0; i < ldns_rr_rd_count(rr); i++) { - ldns_rdf_deep_free(ldns_rr_rdf(rr, i)); - } - LDNS_FREE(rr->_rdata_fields); - LDNS_FREE(rr); - } -} - -/* - * trailing spaces are allowed - * leading spaces are not allowed - * allow ttl to be optional - * class is optional too - * if ttl is missing, and default_ttl is 0, use DEF_TTL - * allow ttl to be written as 1d3h - * So the RR should look like. e.g. - * miek.nl. 3600 IN MX 10 elektron.atoom.net - * or - * miek.nl. 1h IN MX 10 elektron.atoom.net - * or - * miek.nl. IN MX 10 elektron.atoom.net - */ -static ldns_status -ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, - uint32_t default_ttl, ldns_rdf *origin, - ldns_rdf **prev, bool question) -{ - ldns_rr *new; - const ldns_rr_descriptor *desc; - ldns_rr_type rr_type; - ldns_buffer *rr_buf = NULL; - ldns_buffer *rd_buf = NULL; - uint32_t ttl_val; - char *owner = NULL; - char *ttl = NULL; - ldns_rr_class clas_val; - char *clas = NULL; - char *type = NULL; - char *rdata = NULL; - char *rd = NULL; - char *b64 = NULL; - size_t rd_strlen; - const char *delimiters; - ssize_t c; - ldns_rdf *owner_dname; - const char* endptr; - int was_unknown_rr_format = 0; - ldns_status status = LDNS_STATUS_OK; - - /* used for types with unknown number of rdatas */ - bool done; - bool quoted; - - ldns_rdf *r = NULL; - uint16_t r_cnt; - uint16_t r_min; - uint16_t r_max; - size_t pre_data_pos; - - new = ldns_rr_new(); - - owner = LDNS_XMALLOC(char, LDNS_MAX_DOMAINLEN + 1); - ttl = LDNS_XMALLOC(char, LDNS_TTL_DATALEN); - clas = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); - rdata = LDNS_XMALLOC(char, LDNS_MAX_PACKETLEN + 1); - rr_buf = LDNS_MALLOC(ldns_buffer); - rd_buf = LDNS_MALLOC(ldns_buffer); - rd = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); - b64 = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); - if (!new || !owner || !ttl || !clas || !rdata || !rr_buf || !rd_buf || !rd || !b64 ) { - status = LDNS_STATUS_MEM_ERR; - LDNS_FREE(rr_buf); - goto ldnserror; - } - - ldns_buffer_new_frm_data(rr_buf, (char*)str, strlen(str)); - - /* split the rr in its parts -1 signals trouble */ - if (ldns_bget_token(rr_buf, owner, "\t\n ", LDNS_MAX_DOMAINLEN) == -1) { - status = LDNS_STATUS_SYNTAX_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - - if (ldns_bget_token(rr_buf, ttl, "\t\n ", LDNS_TTL_DATALEN) == -1) { - status = LDNS_STATUS_SYNTAX_TTL_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - ttl_val = (uint32_t) ldns_str2period(ttl, &endptr); - - if (strlen(ttl) > 0 && !isdigit((int) ttl[0])) { - /* ah, it's not there or something */ - if (default_ttl == 0) { - ttl_val = LDNS_DEFAULT_TTL; - } else { - ttl_val = default_ttl; - } - /* we not ASSUMING the TTL is missing and that - * the rest of the RR is still there. That is - * CLASS TYPE RDATA - * so ttl value we read is actually the class - */ - clas_val = ldns_get_rr_class_by_name(ttl); - /* class can be left out too, assume IN, current - * token must be type - */ - if (clas_val == 0) { - clas_val = LDNS_RR_CLASS_IN; - type = LDNS_XMALLOC(char, strlen(ttl) + 1); - if(!type) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - strncpy(type, ttl, strlen(ttl) + 1); - } - } else { - if (ldns_bget_token(rr_buf, clas, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { - status = LDNS_STATUS_SYNTAX_CLASS_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - clas_val = ldns_get_rr_class_by_name(clas); - /* class can be left out too, assume IN, current - * token must be type - */ - if (clas_val == 0) { - clas_val = LDNS_RR_CLASS_IN; - type = LDNS_XMALLOC(char, strlen(clas) + 1); - if(!type) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - strncpy(type, clas, strlen(clas) + 1); - } - } - /* the rest should still be waiting for us */ - - if (!type) { - type = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); - if(!type) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - if (ldns_bget_token(rr_buf, type, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { - status = LDNS_STATUS_SYNTAX_TYPE_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - } - - if (ldns_bget_token(rr_buf, rdata, "\0", LDNS_MAX_PACKETLEN) == -1) { - /* apparently we are done, and it's only a question RR - * so do not set status and go to ldnserror here - */ - } - - ldns_buffer_new_frm_data(rd_buf, rdata, strlen(rdata)); - - if (strlen(owner) <= 1 && strncmp(owner, "@", 1) == 0) { - if (origin) { - ldns_rr_set_owner(new, ldns_rdf_clone(origin)); - } else if (prev && *prev) { - ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); - } else { - /* default to root */ - ldns_rr_set_owner(new, ldns_dname_new_frm_str(".")); - } - - /* @ also overrides prev */ - if (prev) { - ldns_rdf_deep_free(*prev); - *prev = ldns_rdf_clone(ldns_rr_owner(new)); - if (!*prev) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - } - } else { - if (strlen(owner) == 0) { - /* no ownername was given, try prev, if that fails - * origin, else default to root */ - if (prev && *prev) { - ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); - } else if (origin) { - ldns_rr_set_owner(new, ldns_rdf_clone(origin)); - } else { - ldns_rr_set_owner(new, ldns_dname_new_frm_str(".")); - } - if(!ldns_rr_owner(new)) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - } else { - owner_dname = ldns_dname_new_frm_str(owner); - if (!owner_dname) { - status = LDNS_STATUS_SYNTAX_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - - ldns_rr_set_owner(new, owner_dname); - if (!ldns_dname_str_absolute(owner) && origin) { - if(ldns_dname_cat(ldns_rr_owner(new), - origin) != LDNS_STATUS_OK) { - status = LDNS_STATUS_SYNTAX_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - } - if (prev) { - ldns_rdf_deep_free(*prev); - *prev = ldns_rdf_clone(ldns_rr_owner(new)); - if(!*prev) { - status = LDNS_STATUS_MEM_ERR; - ldns_buffer_free(rr_buf); - goto ldnserror; - } - } - } - } - LDNS_FREE(owner); - owner = NULL; - - ldns_rr_set_question(new, question); - - ldns_rr_set_ttl(new, ttl_val); - LDNS_FREE(ttl); - ttl = NULL; - - ldns_rr_set_class(new, clas_val); - LDNS_FREE(clas); - clas = NULL; - - rr_type = ldns_get_rr_type_by_name(type); - LDNS_FREE(type); - type = NULL; - - desc = ldns_rr_descript((uint16_t)rr_type); - ldns_rr_set_type(new, rr_type); - if (desc) { - /* only the rdata remains */ - r_max = ldns_rr_descriptor_maximum(desc); - r_min = ldns_rr_descriptor_minimum(desc); - } else { - r_min = 0; - r_max = 1; - } - - /* depending on the rr_type we need to extract - * the rdata differently, e.g. NSEC/NSEC3 */ - switch(rr_type) { - default: - done = false; - - for (r_cnt = 0; !done && r_cnt < r_max; r_cnt++) { - quoted = false; - /* if type = B64, the field may contain spaces */ - if (ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_B64 || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_HEX || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_LOC || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_WKS || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_IPSECKEY || - ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_NSEC) { - delimiters = "\n\t"; - } else { - delimiters = "\n\t "; - } - - if (ldns_rr_descriptor_field_type(desc, - r_cnt) == LDNS_RDF_TYPE_STR && - ldns_buffer_remaining(rd_buf) > 0) { - /* skip spaces */ - while (*(ldns_buffer_current(rd_buf)) == ' ') { - ldns_buffer_skip(rd_buf, 1); - } - - if (*(ldns_buffer_current(rd_buf)) == '\"') { - delimiters = "\"\0"; - ldns_buffer_skip(rd_buf, 1); - quoted = true; - } - } - - /* because number of fields can be variable, we can't - rely on _maximum() only */ - /* skip spaces */ - while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf) && - *(ldns_buffer_current(rd_buf)) == ' ' && !quoted - ) { - ldns_buffer_skip(rd_buf, 1); - } - - pre_data_pos = ldns_buffer_position(rd_buf); - if ((c = ldns_bget_token(rd_buf, rd, delimiters, - LDNS_MAX_RDFLEN)) != -1) { - /* hmmz, rfc3597 specifies that any type can be represented with - * \# method, which can contain spaces... - * it does specify size though... - */ - rd_strlen = strlen(rd); - - /* unknown RR data */ - if (strncmp(rd, "\\#", 2) == 0 && !quoted && (rd_strlen == 2 || rd[2]==' ')) { - uint16_t hex_data_size; - char *hex_data_str; - uint16_t cur_hex_data_size; - - was_unknown_rr_format = 1; - /* go back to before \# and skip it while setting delimiters better */ - ldns_buffer_set_position(rd_buf, pre_data_pos); - delimiters = "\n\t "; - (void)ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); - /* read rdata octet length */ - c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); - if (c == -1) { - /* something goes very wrong here */ - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - hex_data_size = (uint16_t) atoi(rd); - /* copy the hex chars into hex str (which is 2 chars per byte) */ - hex_data_str = LDNS_XMALLOC(char, 2 * hex_data_size + 1); - if (!hex_data_str) { - /* malloc error */ - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - cur_hex_data_size = 0; - while(cur_hex_data_size < 2 * hex_data_size) { - c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); - rd_strlen = strlen(rd); - strncpy(hex_data_str + cur_hex_data_size, rd, rd_strlen); - cur_hex_data_size += rd_strlen; - } - hex_data_str[cur_hex_data_size] = '\0'; - - /* correct the rdf type */ - /* if *we* know the type, interpret it as wireformat */ - if (desc) { - size_t hex_pos = 0; - uint8_t *hex_data = LDNS_XMALLOC(uint8_t, hex_data_size + 2); - ldns_status s; - if(!hex_data) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_MEM_ERR; - } - ldns_write_uint16(hex_data, hex_data_size); - ldns_hexstring_to_data(hex_data + 2, hex_data_str); - s = ldns_wire2rdf(new, hex_data, - hex_data_size+2, &hex_pos); - if(s != LDNS_STATUS_OK) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return s; - } - LDNS_FREE(hex_data); - } else { - r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, hex_data_str); - if(!r) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_MEM_ERR; - } - ldns_rdf_set_type(r, LDNS_RDF_TYPE_UNKNOWN); - if(!ldns_rr_push_rdf(new, r)) { - LDNS_FREE(hex_data_str); - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_MEM_ERR; - } - } - LDNS_FREE(hex_data_str); - } else { - /* Normal RR */ - switch(ldns_rr_descriptor_field_type(desc, r_cnt)) { - case LDNS_RDF_TYPE_HEX: - case LDNS_RDF_TYPE_B64: - /* can have spaces, and will always be the last - * record of the rrdata. Read in the rest */ - if ((c = ldns_bget_token(rd_buf, - b64, - "\n", - LDNS_MAX_RDFLEN)) - != -1) { - rd = strncat(rd, - b64, - LDNS_MAX_RDFLEN - - strlen(rd) - 1); - } - r = ldns_rdf_new_frm_str( - ldns_rr_descriptor_field_type(desc, r_cnt), - rd); - break; - case LDNS_RDF_TYPE_DNAME: - r = ldns_rdf_new_frm_str( - ldns_rr_descriptor_field_type(desc, r_cnt), - rd); - - /* check if the origin should be used or concatenated */ - if (r && ldns_rdf_size(r) > 1 && ldns_rdf_data(r)[0] == 1 - && ldns_rdf_data(r)[1] == '@') { - ldns_rdf_deep_free(r); - if (origin) { - r = ldns_rdf_clone(origin); - } else { - /* if this is the SOA, use its own owner name */ - if (rr_type == LDNS_RR_TYPE_SOA) { - r = ldns_rdf_clone(ldns_rr_owner(new)); - } else { - r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "."); - } - } - } else if (r && rd_strlen >= 1 && !ldns_dname_str_absolute(rd) && origin) { - if (ldns_dname_cat(r, origin) != LDNS_STATUS_OK) { - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_ERR; - } - } - break; - default: - r = ldns_rdf_new_frm_str( - ldns_rr_descriptor_field_type(desc, r_cnt), - rd); - break; - } - if (r) { - ldns_rr_push_rdf(new, r); - } else { - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_RDATA_ERR; - } - } - if (quoted) { - if (ldns_buffer_available(rd_buf, 1)) { - ldns_buffer_skip(rd_buf, 1); - } else { - done = true; - } - } - } else { - done = true; - } - } - } - LDNS_FREE(rd); - LDNS_FREE(b64); - ldns_buffer_free(rd_buf); - ldns_buffer_free(rr_buf); - LDNS_FREE(rdata); - - if (!question && desc && !was_unknown_rr_format && ldns_rr_rd_count(new) < r_min) { - ldns_rr_free(new); - return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; - } - - if (newrr) { - *newrr = new; - } - return LDNS_STATUS_OK; - -ldnserror: - LDNS_FREE(type); - LDNS_FREE(owner); - LDNS_FREE(ttl); - LDNS_FREE(clas); - LDNS_FREE(rdata); - LDNS_FREE(rd); - LDNS_FREE(rd_buf); - LDNS_FREE(b64); - ldns_rr_free(new); - return status; -} - -ldns_status -ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, - uint32_t default_ttl, ldns_rdf *origin, - ldns_rdf **prev) -{ - return ldns_rr_new_frm_str_internal(newrr, - str, - default_ttl, - origin, - prev, - false); -} - -ldns_status -ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str, - ldns_rdf *origin, ldns_rdf **prev) -{ - return ldns_rr_new_frm_str_internal(newrr, - str, - 0, - origin, - prev, - true); -} - -ldns_status -ldns_rr_new_frm_fp(ldns_rr **newrr, FILE *fp, uint32_t *ttl, ldns_rdf **origin, ldns_rdf **prev) -{ - return ldns_rr_new_frm_fp_l(newrr, fp, ttl, origin, prev, NULL); -} - -ldns_status -ldns_rr_new_frm_fp_l(ldns_rr **newrr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr) -{ - char *line; - const char *endptr; /* unused */ - ldns_rr *rr; - uint32_t ttl; - ldns_rdf *tmp; - ldns_status s; - ssize_t size; - int offset = 0; - - if (default_ttl) { - ttl = *default_ttl; - } else { - ttl = 0; - } - - line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); - if (!line) { - return LDNS_STATUS_MEM_ERR; - } - - /* read an entire line in from the file */ - if ((size = ldns_fget_token_l(fp, line, LDNS_PARSE_SKIP_SPACE, LDNS_MAX_LINELEN, line_nr)) == -1) { - LDNS_FREE(line); - /* if last line was empty, we are now at feof, which is not - * always a parse error (happens when for instance last line - * was a comment) - */ - return LDNS_STATUS_SYNTAX_ERR; - } - - /* we can have the situation, where we've read ok, but still got - * no bytes to play with, in this case size is 0 - */ - if (size == 0) { - LDNS_FREE(line); - return LDNS_STATUS_SYNTAX_EMPTY; - } - - if (strncmp(line, "$ORIGIN", 7) == 0 && isspace(line[7])) { - if (*origin) { - ldns_rdf_deep_free(*origin); - *origin = NULL; - } - offset = 8; - while (isspace(line[offset])) { - offset++; - } - tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, line + offset); - if (!tmp) { - /* could not parse what next to $ORIGIN */ - LDNS_FREE(line); - return LDNS_STATUS_SYNTAX_DNAME_ERR; - } - *origin = tmp; - s = LDNS_STATUS_SYNTAX_ORIGIN; - } else if (strncmp(line, "$TTL", 4) == 0 && isspace(line[4])) { - offset = 5; - while (isspace(line[offset])) { - offset++; - } - if (default_ttl) { - *default_ttl = ldns_str2period(line + offset, &endptr); - } - s = LDNS_STATUS_SYNTAX_TTL; - } else if (strncmp(line, "$INCLUDE", 8) == 0) { - s = LDNS_STATUS_SYNTAX_INCLUDE; - } else { - if (origin && *origin) { - s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, *origin, prev); - } else { - s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, NULL, prev); - } - } - LDNS_FREE(line); - if (newrr && s == LDNS_STATUS_OK) { - *newrr = rr; - } - return s; -} - -void -ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner) -{ - rr->_owner = owner; -} - -void -ldns_rr_set_question(ldns_rr *rr, bool question) -{ - rr->_rr_question = question; -} - -void -ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl) -{ - rr->_ttl = ttl; -} - -void -ldns_rr_set_rd_count(ldns_rr *rr, size_t count) -{ - rr->_rd_count = count; -} - -void -ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type) -{ - rr->_rr_type = rr_type; -} - -void -ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class) -{ - rr->_rr_class = rr_class; -} - -ldns_rdf * -ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position) -{ - size_t rd_count; - ldns_rdf *pop; - - rd_count = ldns_rr_rd_count(rr); - if (position < rd_count) { - /* dicard the old one */ - pop = rr->_rdata_fields[position]; - rr->_rdata_fields[position] = (ldns_rdf*)f; - return pop; - } else { - return NULL; - } -} - -bool -ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f) -{ - size_t rd_count; - ldns_rdf **rdata_fields; - - rd_count = ldns_rr_rd_count(rr); - - /* grow the array */ - rdata_fields = LDNS_XREALLOC( - rr->_rdata_fields, ldns_rdf *, rd_count + 1); - if (!rdata_fields) { - return false; - } - - /* add the new member */ - rr->_rdata_fields = rdata_fields; - rr->_rdata_fields[rd_count] = (ldns_rdf*)f; - - ldns_rr_set_rd_count(rr, rd_count + 1); - return true; -} - -ldns_rdf * -ldns_rr_pop_rdf(ldns_rr *rr) -{ - size_t rd_count; - ldns_rdf *pop; - ldns_rdf** newrd; - - rd_count = ldns_rr_rd_count(rr); - - if (rd_count == 0) { - return NULL; - } - - pop = rr->_rdata_fields[rd_count - 1]; - - /* try to shrink the array */ - if(rd_count > 1) { - newrd = LDNS_XREALLOC( - rr->_rdata_fields, ldns_rdf *, rd_count - 1); - if(newrd) - rr->_rdata_fields = newrd; - } else { - LDNS_FREE(rr->_rdata_fields); - } - - ldns_rr_set_rd_count(rr, rd_count - 1); - return pop; -} - -ldns_rdf * -ldns_rr_rdf(const ldns_rr *rr, size_t nr) -{ - if (nr < ldns_rr_rd_count(rr)) { - return rr->_rdata_fields[nr]; - } else { - return NULL; - } -} - -ldns_rdf * -ldns_rr_owner(const ldns_rr *rr) -{ - return rr->_owner; -} - -bool -ldns_rr_is_question(const ldns_rr *rr) -{ - return rr->_rr_question; -} - -uint32_t -ldns_rr_ttl(const ldns_rr *rr) -{ - return rr->_ttl; -} - -size_t -ldns_rr_rd_count(const ldns_rr *rr) -{ - return rr->_rd_count; -} - -ldns_rr_type -ldns_rr_get_type(const ldns_rr *rr) -{ - return rr->_rr_type; -} - -ldns_rr_class -ldns_rr_get_class(const ldns_rr *rr) -{ - return rr->_rr_class; -} - -/* rr_lists */ - -size_t -ldns_rr_list_rr_count(const ldns_rr_list *rr_list) -{ - if (rr_list) { - return rr_list->_rr_count; - } else { - return 0; - } -} - -ldns_rr * -ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count) -{ - ldns_rr *old; - - if (count > ldns_rr_list_rr_count(rr_list)) { - return NULL; - } - - old = ldns_rr_list_rr(rr_list, count); - - /* overwrite old's pointer */ - rr_list->_rrs[count] = (ldns_rr*)r; - return old; -} - -void -ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count) -{ - assert(count <= rr_list->_rr_capacity); - rr_list->_rr_count = count; -} - -ldns_rr * -ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr) -{ - if (nr < ldns_rr_list_rr_count(rr_list)) { - return rr_list->_rrs[nr]; - } else { - return NULL; - } -} - -ldns_rr_list * -ldns_rr_list_new() -{ - ldns_rr_list *rr_list = LDNS_MALLOC(ldns_rr_list); - if(!rr_list) return NULL; - rr_list->_rr_count = 0; - rr_list->_rr_capacity = 0; - rr_list->_rrs = NULL; - return rr_list; -} - -void -ldns_rr_list_free(ldns_rr_list *rr_list) -{ - if (rr_list) { - LDNS_FREE(rr_list->_rrs); - LDNS_FREE(rr_list); - } -} - -void -ldns_rr_list_deep_free(ldns_rr_list *rr_list) -{ - size_t i; - - if (rr_list) { - for (i=0; i < ldns_rr_list_rr_count(rr_list); i++) { - ldns_rr_free(ldns_rr_list_rr(rr_list, i)); - } - LDNS_FREE(rr_list->_rrs); - LDNS_FREE(rr_list); - } -} - - -/* add right to left. So we modify *left! */ -bool -ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right) -{ - size_t r_rr_count; - size_t i; - - if (!left) { - return false; - } - - if (right) { - r_rr_count = ldns_rr_list_rr_count(right); - } else { - r_rr_count = 0; - } - - /* push right to left */ - for(i = 0; i < r_rr_count; i++) { - ldns_rr_list_push_rr(left, ldns_rr_list_rr(right, i)); - } - return true; -} - -ldns_rr_list * -ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right) -{ - size_t l_rr_count; - size_t r_rr_count; - size_t i; - ldns_rr_list *cat; - - if (left) { - l_rr_count = ldns_rr_list_rr_count(left); - } else { - return ldns_rr_list_clone(right); - } - - if (right) { - r_rr_count = ldns_rr_list_rr_count(right); - } else { - r_rr_count = 0; - } - - cat = ldns_rr_list_new(); - - if (!cat) { - return NULL; - } - - /* left */ - for(i = 0; i < l_rr_count; i++) { - ldns_rr_list_push_rr(cat, - ldns_rr_clone(ldns_rr_list_rr(left, i))); - } - /* right */ - for(i = 0; i < r_rr_count; i++) { - ldns_rr_list_push_rr(cat, - ldns_rr_clone(ldns_rr_list_rr(right, i))); - } - return cat; -} - -ldns_rr_list * -ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos) -{ - size_t i; - ldns_rr_list *subtyped; - ldns_rdf *list_rdf; - - subtyped = ldns_rr_list_new(); - - for(i = 0; i < ldns_rr_list_rr_count(l); i++) { - list_rdf = ldns_rr_rdf( - ldns_rr_list_rr(l, i), - pos); - if (!list_rdf) { - /* pos is too large or any other error */ - ldns_rr_list_deep_free(subtyped); - return NULL; - } - - if (ldns_rdf_compare(list_rdf, r) == 0) { - /* a match */ - ldns_rr_list_push_rr(subtyped, - ldns_rr_clone(ldns_rr_list_rr(l, i))); - } - } - - if (ldns_rr_list_rr_count(subtyped) > 0) { - return subtyped; - } else { - ldns_rr_list_free(subtyped); - return NULL; - } -} - -bool -ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr) -{ - size_t rr_count; - size_t cap; - - rr_count = ldns_rr_list_rr_count(rr_list); - cap = rr_list->_rr_capacity; - - /* grow the array */ - if(rr_count+1 > cap) { - ldns_rr **rrs; - - if(cap == 0) - cap = LDNS_RRLIST_INIT; /* initial list size */ - else cap *= 2; - rrs = LDNS_XREALLOC(rr_list->_rrs, ldns_rr *, cap); - if (!rrs) { - return false; - } - rr_list->_rrs = rrs; - rr_list->_rr_capacity = cap; - } - - /* add the new member */ - rr_list->_rrs[rr_count] = (ldns_rr*)rr; - - ldns_rr_list_set_rr_count(rr_list, rr_count + 1); - return true; -} - -bool -ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list) -{ - size_t i; - - for(i = 0; i < ldns_rr_list_rr_count(push_list); i++) { - if (!ldns_rr_list_push_rr(rr_list, - ldns_rr_list_rr(push_list, i))) { - return false; - } - } - return true; -} - -ldns_rr * -ldns_rr_list_pop_rr(ldns_rr_list *rr_list) -{ - size_t rr_count; - size_t cap; - ldns_rr *pop; - - rr_count = ldns_rr_list_rr_count(rr_list); - - if (rr_count == 0) { - return NULL; - } - - cap = rr_list->_rr_capacity; - pop = ldns_rr_list_rr(rr_list, rr_count - 1); - - /* shrink the array */ - if(cap > LDNS_RRLIST_INIT && rr_count-1 <= cap/2) { - ldns_rr** a; - cap /= 2; - a = LDNS_XREALLOC(rr_list->_rrs, ldns_rr *, cap); - if(a) { - rr_list->_rrs = a; - rr_list->_rr_capacity = cap; - } - } - - ldns_rr_list_set_rr_count(rr_list, rr_count - 1); - - return pop; -} - -ldns_rr_list * -ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t howmany) -{ - /* pop a number of rr's and put them in a rr_list */ - ldns_rr_list *popped; - ldns_rr *p; - size_t i = howmany; - - popped = ldns_rr_list_new(); - - if (!popped) { - return NULL; - } - - - while(i > 0 && - (p = ldns_rr_list_pop_rr(rr_list)) != NULL) { - ldns_rr_list_push_rr(popped, p); - i--; - } - - if (i == howmany) { - return NULL; - } else { - return popped; - } -} - - -bool -ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr) -{ - size_t i; - - if (!rr_list || !rr || ldns_rr_list_rr_count(rr_list) == 0) { - return false; - } - - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - if (rr == ldns_rr_list_rr(rr_list, i)) { - return true; - } else if (ldns_rr_compare(rr, ldns_rr_list_rr(rr_list, i)) == 0) { - return true; - } - } - return false; -} - -bool -ldns_is_rrset(ldns_rr_list *rr_list) -{ - ldns_rr_type t; - ldns_rr_class c; - ldns_rdf *o; - ldns_rr *tmp; - size_t i; - - if (!rr_list || ldns_rr_list_rr_count(rr_list) == 0) { - return false; - } - - tmp = ldns_rr_list_rr(rr_list, 0); - - t = ldns_rr_get_type(tmp); - c = ldns_rr_get_class(tmp); - o = ldns_rr_owner(tmp); - - /* compare these with the rest of the rr_list, start with 1 */ - for (i = 1; i < ldns_rr_list_rr_count(rr_list); i++) { - tmp = ldns_rr_list_rr(rr_list, i); - if (t != ldns_rr_get_type(tmp)) { - return false; - } - if (c != ldns_rr_get_class(tmp)) { - return false; - } - if (ldns_rdf_compare(o, ldns_rr_owner(tmp)) != 0) { - return false; - } - } - return true; -} - -bool -ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr) -{ - size_t rr_count; - size_t i; - ldns_rr *last; - - assert(rr != NULL); - - rr_count = ldns_rr_list_rr_count(rr_list); - - if (rr_count == 0) { - /* nothing there, so checking it is - * not needed */ - return ldns_rr_list_push_rr(rr_list, rr); - } else { - /* check with the final rr in the rr_list */ - last = ldns_rr_list_rr(rr_list, rr_count - 1); - - if (ldns_rr_get_class(last) != ldns_rr_get_class(rr)) { - return false; - } - if (ldns_rr_get_type(last) != ldns_rr_get_type(rr)) { - return false; - } - /* only check if not equal to RRSIG */ - if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { - if (ldns_rr_ttl(last) != ldns_rr_ttl(rr)) { - return false; - } - } - if (ldns_rdf_compare(ldns_rr_owner(last), - ldns_rr_owner(rr)) != 0) { - return false; - } - /* ok, still alive - check if the rr already - * exists - if so, dont' add it */ - for(i = 0; i < rr_count; i++) { - if(ldns_rr_compare( - ldns_rr_list_rr(rr_list, i), rr) == 0) { - return false; - } - } - /* it's safe, push it */ - return ldns_rr_list_push_rr(rr_list, rr); - } -} - -ldns_rr * -ldns_rr_set_pop_rr(ldns_rr_list *rr_list) -{ - return ldns_rr_list_pop_rr(rr_list); -} - -ldns_rr_list * -ldns_rr_list_pop_rrset(ldns_rr_list *rr_list) -{ - ldns_rr_list *rrset; - ldns_rr *last_rr = NULL; - ldns_rr *next_rr; - - if (!rr_list) { - return NULL; - } - - rrset = ldns_rr_list_new(); - if (!last_rr) { - last_rr = ldns_rr_list_pop_rr(rr_list); - if (!last_rr) { - ldns_rr_list_free(rrset); - return NULL; - } else { - ldns_rr_list_push_rr(rrset, last_rr); - } - } - - if (ldns_rr_list_rr_count(rr_list) > 0) { - next_rr = ldns_rr_list_rr(rr_list, ldns_rr_list_rr_count(rr_list) - 1); - } else { - next_rr = NULL; - } - - while (next_rr) { - if ( - ldns_rdf_compare(ldns_rr_owner(next_rr), - ldns_rr_owner(last_rr)) == 0 - && - ldns_rr_get_type(next_rr) == ldns_rr_get_type(last_rr) - && - ldns_rr_get_class(next_rr) == ldns_rr_get_class(last_rr) - ) { - ldns_rr_list_push_rr(rrset, ldns_rr_list_pop_rr(rr_list)); - if (ldns_rr_list_rr_count(rr_list) > 0) { - last_rr = next_rr; - next_rr = ldns_rr_list_rr(rr_list, ldns_rr_list_rr_count(rr_list) - 1); - } else { - next_rr = NULL; - } - } else { - next_rr = NULL; - } - } - - return rrset; -} - -ldns_rr * -ldns_rr_clone(const ldns_rr *rr) -{ - size_t i; - ldns_rr *new_rr; - - if (!rr) { - return NULL; - } - - new_rr = ldns_rr_new(); - if (!new_rr) { - return NULL; - } - if (ldns_rr_owner(rr)) { - ldns_rr_set_owner(new_rr, ldns_rdf_clone(ldns_rr_owner(rr))); - } - ldns_rr_set_ttl(new_rr, ldns_rr_ttl(rr)); - ldns_rr_set_type(new_rr, ldns_rr_get_type(rr)); - ldns_rr_set_class(new_rr, ldns_rr_get_class(rr)); - ldns_rr_set_question(new_rr, ldns_rr_is_question(rr)); - - for (i = 0; i < ldns_rr_rd_count(rr); i++) { - if (ldns_rr_rdf(rr,i)) { - ldns_rr_push_rdf(new_rr, ldns_rdf_clone(ldns_rr_rdf(rr, i))); - } - } - - return new_rr; -} - -ldns_rr_list * -ldns_rr_list_clone(const ldns_rr_list *rrlist) -{ - size_t i; - ldns_rr_list *new_list; - ldns_rr *r; - - if (!rrlist) { - return NULL; - } - - new_list = ldns_rr_list_new(); - if (!new_list) { - return NULL; - } - for (i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { - r = ldns_rr_clone( - ldns_rr_list_rr(rrlist, i) - ); - if (!r) { - /* huh, failure in cloning */ - ldns_rr_list_deep_free(new_list); - return NULL; - } - ldns_rr_list_push_rr(new_list, r); - } - return new_list; -} - - -int -qsort_rr_compare(const void *a, const void *b) -{ - const ldns_rr *rr1 = * (const ldns_rr **) a; - const ldns_rr *rr2 = * (const ldns_rr **) b; - - if (rr1 == NULL && rr2 == NULL) { - return 0; - } - if (rr1 == NULL) { - return -1; - } - if (rr2 == NULL) { - return 1; - } - return ldns_rr_compare(rr1, rr2); -} - -int -qsort_schwartz_rr_compare(const void *a, const void *b) -{ - int result = 0; - ldns_rr *rr1, *rr2; - ldns_buffer *rr1_buf, *rr2_buf; - struct ldns_schwartzian_compare_struct *sa = *(struct ldns_schwartzian_compare_struct **) a; - struct ldns_schwartzian_compare_struct *sb = *(struct ldns_schwartzian_compare_struct **) b; - /* if we are doing 2wire, we need to do lowercasing on the dname (and maybe on the rdata) - * this must be done for comparison only, so we need to have a temp var for both buffers, - * which is only used when the transformed object value isn't there yet - */ - ldns_rr *canonical_a, *canonical_b; - - rr1 = (ldns_rr *) sa->original_object; - rr2 = (ldns_rr *) sb->original_object; - - result = ldns_rr_compare_no_rdata(rr1, rr2); - - if (result == 0) { - if (!sa->transformed_object) { - canonical_a = ldns_rr_clone(sa->original_object); - ldns_rr2canonical(canonical_a); - sa->transformed_object = ldns_buffer_new(ldns_rr_uncompressed_size(canonical_a)); - if (ldns_rr2buffer_wire(sa->transformed_object, canonical_a, LDNS_SECTION_ANY) != LDNS_STATUS_OK) { - ldns_buffer_free((ldns_buffer *)sa->transformed_object); - sa->transformed_object = NULL; - ldns_rr_free(canonical_a); - return 0; - } - ldns_rr_free(canonical_a); - } - if (!sb->transformed_object) { - canonical_b = ldns_rr_clone(sb->original_object); - ldns_rr2canonical(canonical_b); - sb->transformed_object = ldns_buffer_new(ldns_rr_uncompressed_size(canonical_b)); - if (ldns_rr2buffer_wire(sb->transformed_object, canonical_b, LDNS_SECTION_ANY) != LDNS_STATUS_OK) { - ldns_buffer_free((ldns_buffer *)sa->transformed_object); - ldns_buffer_free((ldns_buffer *)sb->transformed_object); - sa->transformed_object = NULL; - sb->transformed_object = NULL; - ldns_rr_free(canonical_b); - return 0; - } - ldns_rr_free(canonical_b); - } - rr1_buf = (ldns_buffer *) sa->transformed_object; - rr2_buf = (ldns_buffer *) sb->transformed_object; - - result = ldns_rr_compare_wire(rr1_buf, rr2_buf); - } - - return result; -} - -void -ldns_rr_list_sort(ldns_rr_list *unsorted) -{ - struct ldns_schwartzian_compare_struct **sortables; - size_t item_count; - size_t i; - - if (unsorted) { - item_count = ldns_rr_list_rr_count(unsorted); - - sortables = LDNS_XMALLOC(struct ldns_schwartzian_compare_struct *, - item_count); - if(!sortables) return; /* no way to return error */ - for (i = 0; i < item_count; i++) { - sortables[i] = LDNS_XMALLOC(struct ldns_schwartzian_compare_struct, 1); - if(!sortables[i]) { - /* free the allocated parts */ - while(i>0) { - i--; - LDNS_FREE(sortables[i]); - } - /* no way to return error */ - return; - } - sortables[i]->original_object = ldns_rr_list_rr(unsorted, i); - sortables[i]->transformed_object = NULL; - } - qsort(sortables, - item_count, - sizeof(struct ldns_schwartzian_compare_struct *), - qsort_schwartz_rr_compare); - for (i = 0; i < item_count; i++) { - unsorted->_rrs[i] = sortables[i]->original_object; - if (sortables[i]->transformed_object) { - ldns_buffer_free(sortables[i]->transformed_object); - } - LDNS_FREE(sortables[i]); - } - LDNS_FREE(sortables); - } -} - -int -ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2) -{ - size_t rr1_len; - size_t rr2_len; - size_t offset; - - assert(rr1 != NULL); - assert(rr2 != NULL); - - rr1_len = ldns_rr_uncompressed_size(rr1); - rr2_len = ldns_rr_uncompressed_size(rr2); - - if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) < 0) { - return -1; - } else if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) > 0) { - return 1; - } - - /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */ - if (ldns_rr_get_class(rr1) != ldns_rr_get_class(rr2)) { - return ldns_rr_get_class(rr1) - ldns_rr_get_class(rr2); - } - - /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */ - if (ldns_rr_get_type(rr1) != ldns_rr_get_type(rr2)) { - return ldns_rr_get_type(rr1) - ldns_rr_get_type(rr2); - } - - /* offset is the owername length + ttl + type + class + rdlen == start of wire format rdata */ - offset = ldns_rdf_size(ldns_rr_owner(rr1)) + 4 + 2 + 2 + 2; - /* if either record doesn't have any RDATA... */ - if (offset > rr1_len || offset > rr2_len) { - if (rr1_len == rr2_len) { - return 0; - } - return ((int) rr2_len - (int) rr1_len); - } - - return 0; -} - -int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf) -{ - size_t rr1_len, rr2_len, min_len, i, offset; - - rr1_len = ldns_buffer_capacity(rr1_buf); - rr2_len = ldns_buffer_capacity(rr2_buf); - - /* jump past dname (checked in earlier part) - * and especially past TTL */ - offset = 0; - while (offset < rr1_len && *ldns_buffer_at(rr1_buf, offset) != 0) { - offset += *ldns_buffer_at(rr1_buf, offset) + 1; - } - /* jump to rdata section (PAST the rdata length field, otherwise - rrs with different lengths might be sorted erroneously */ - offset += 11; - min_len = (rr1_len < rr2_len) ? rr1_len : rr2_len; - /* Compare RRs RDATA byte for byte. */ - for(i = offset; i < min_len; i++) { - if (*ldns_buffer_at(rr1_buf,i) < *ldns_buffer_at(rr2_buf,i)) { - return -1; - } else if (*ldns_buffer_at(rr1_buf,i) > *ldns_buffer_at(rr2_buf,i)) { - return +1; - } - } - - /* If both RDATAs are the same up to min_len, then the shorter one sorts first. */ - if (rr1_len < rr2_len) { - return -1; - } else if (rr1_len > rr2_len) { - return +1; - } - /* The RDATAs are equal. */ - return 0; - -} - -int -ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2) -{ - int result; - size_t rr1_len, rr2_len; - - ldns_buffer *rr1_buf; - ldns_buffer *rr2_buf; - - result = ldns_rr_compare_no_rdata(rr1, rr2); - if (result == 0) { - rr1_len = ldns_rr_uncompressed_size(rr1); - rr2_len = ldns_rr_uncompressed_size(rr2); - - rr1_buf = ldns_buffer_new(rr1_len); - rr2_buf = ldns_buffer_new(rr2_len); - - if (ldns_rr2buffer_wire_canonical(rr1_buf, - rr1, - LDNS_SECTION_ANY) - != LDNS_STATUS_OK) { - ldns_buffer_free(rr1_buf); - ldns_buffer_free(rr2_buf); - return 0; - } - if (ldns_rr2buffer_wire_canonical(rr2_buf, - rr2, - LDNS_SECTION_ANY) - != LDNS_STATUS_OK) { - ldns_buffer_free(rr1_buf); - ldns_buffer_free(rr2_buf); - return 0; - } - - result = ldns_rr_compare_wire(rr1_buf, rr2_buf); - - ldns_buffer_free(rr1_buf); - ldns_buffer_free(rr2_buf); - } - - return result; -} - -/* convert dnskey to a ds with the given algorithm, - * then compare the result with the given ds */ -static int -ldns_rr_compare_ds_dnskey(ldns_rr *ds, - ldns_rr *dnskey) -{ - ldns_rr *ds_gen; - bool result = false; - ldns_hash algo; - - if (!dnskey || !ds || - ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS || - ldns_rr_get_type(dnskey) != LDNS_RR_TYPE_DNSKEY) { - return false; - } - -algo = ldns_rdf2native_int8(ldns_rr_rdf(ds, 2)); - - ds_gen = ldns_key_rr2ds(dnskey, algo); - if (ds_gen) { - result = ldns_rr_compare(ds, ds_gen) == 0; - ldns_rr_free(ds_gen); - } - return result; -} - -bool -ldns_rr_compare_ds(const ldns_rr *orr1, const ldns_rr *orr2) -{ - bool result; - ldns_rr *rr1 = ldns_rr_clone(orr1); - ldns_rr *rr2 = ldns_rr_clone(orr2); - - /* set ttls to zero */ - ldns_rr_set_ttl(rr1, 0); - ldns_rr_set_ttl(rr2, 0); - - if (ldns_rr_get_type(rr1) == LDNS_RR_TYPE_DS && - ldns_rr_get_type(rr2) == LDNS_RR_TYPE_DNSKEY) { - result = ldns_rr_compare_ds_dnskey(rr1, rr2); - } else if (ldns_rr_get_type(rr1) == LDNS_RR_TYPE_DNSKEY && - ldns_rr_get_type(rr2) == LDNS_RR_TYPE_DS) { - result = ldns_rr_compare_ds_dnskey(rr2, rr1); - } else { - result = (ldns_rr_compare(rr1, rr2) == 0); - } - - ldns_rr_free(rr1); - ldns_rr_free(rr2); - - return result; -} - -int -ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2) -{ - size_t i = 0; - int rr_cmp; - - assert(rrl1 != NULL); - assert(rrl2 != NULL); - - for (i = 0; i < ldns_rr_list_rr_count(rrl1) && i < ldns_rr_list_rr_count(rrl2); i++) { - rr_cmp = ldns_rr_compare(ldns_rr_list_rr(rrl1, i), ldns_rr_list_rr(rrl2, i)); - if (rr_cmp != 0) { - return rr_cmp; - } - } - - if (i == ldns_rr_list_rr_count(rrl1) && - i != ldns_rr_list_rr_count(rrl2)) { - return 1; - } else if (i == ldns_rr_list_rr_count(rrl2) && - i != ldns_rr_list_rr_count(rrl1)) { - return -1; - } else { - return 0; - } -} - -size_t -ldns_rr_uncompressed_size(const ldns_rr *r) -{ - size_t rrsize; - size_t i; - - rrsize = 0; - /* add all the rdf sizes */ - for(i = 0; i < ldns_rr_rd_count(r); i++) { - rrsize += ldns_rdf_size(ldns_rr_rdf(r, i)); - } - /* ownername */ - rrsize += ldns_rdf_size(ldns_rr_owner(r)); - rrsize += LDNS_RR_OVERHEAD; - return rrsize; -} - -void -ldns_rr2canonical(ldns_rr *rr) -{ - uint16_t i; - - if (!rr) { - return; - } - - ldns_dname2canonical(ldns_rr_owner(rr)); - - /* - * lowercase the rdata dnames if the rr type is one - * of the list in chapter 7 of RFC3597 - */ - switch(ldns_rr_get_type(rr)) { - case LDNS_RR_TYPE_NS: - case LDNS_RR_TYPE_MD: - case LDNS_RR_TYPE_MF: - case LDNS_RR_TYPE_CNAME: - case LDNS_RR_TYPE_SOA: - case LDNS_RR_TYPE_MB: - case LDNS_RR_TYPE_MG: - case LDNS_RR_TYPE_MR: - case LDNS_RR_TYPE_PTR: - case LDNS_RR_TYPE_HINFO: - case LDNS_RR_TYPE_MINFO: - case LDNS_RR_TYPE_MX: - case LDNS_RR_TYPE_RP: - case LDNS_RR_TYPE_AFSDB: - case LDNS_RR_TYPE_RT: - case LDNS_RR_TYPE_SIG: - case LDNS_RR_TYPE_PX: - case LDNS_RR_TYPE_NXT: - case LDNS_RR_TYPE_NAPTR: - case LDNS_RR_TYPE_KX: - case LDNS_RR_TYPE_SRV: - case LDNS_RR_TYPE_DNAME: - case LDNS_RR_TYPE_A6: - for (i = 0; i < ldns_rr_rd_count(rr); i++) { - ldns_dname2canonical(ldns_rr_rdf(rr, i)); - } - return; - default: - /* do nothing */ - return; - } -} - -void -ldns_rr_list2canonical(ldns_rr_list *rr_list) -{ - size_t i; - for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { - ldns_rr2canonical(ldns_rr_list_rr(rr_list, i)); - } -} - -uint8_t -ldns_rr_label_count(ldns_rr *rr) -{ - if (!rr) { - return 0; - } - return ldns_dname_label_count( - ldns_rr_owner(rr)); -} - -/** \cond */ -static const ldns_rdf_type type_0_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; -static const ldns_rdf_type type_a_wireformat[] = { LDNS_RDF_TYPE_A }; -static const ldns_rdf_type type_ns_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_md_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_mf_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_cname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_soa_wireformat[] = { - LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_INT32, - LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, - LDNS_RDF_TYPE_PERIOD -}; -static const ldns_rdf_type type_mb_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_mg_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_mr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_wks_wireformat[] = { - LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_WKS -}; -static const ldns_rdf_type type_ptr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_hinfo_wireformat[] = { - LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR -}; -static const ldns_rdf_type type_minfo_wireformat[] = { - LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_mx_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_rp_wireformat[] = { - LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_afsdb_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_x25_wireformat[] = { LDNS_RDF_TYPE_STR }; -static const ldns_rdf_type type_isdn_wireformat[] = { - LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR -}; -static const ldns_rdf_type type_rt_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_nsap_wireformat[] = { - LDNS_RDF_TYPE_NSAP -}; -static const ldns_rdf_type type_nsap_ptr_wireformat[] = { - LDNS_RDF_TYPE_STR -}; -static const ldns_rdf_type type_sig_wireformat[] = { - LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, - LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, - LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 -}; -static const ldns_rdf_type type_key_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 -}; -static const ldns_rdf_type type_px_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_gpos_wireformat[] = { - LDNS_RDF_TYPE_STR, - LDNS_RDF_TYPE_STR, - LDNS_RDF_TYPE_STR -}; -static const ldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA }; -static const ldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC }; -static const ldns_rdf_type type_nxt_wireformat[] = { - LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_UNKNOWN -}; -static const ldns_rdf_type type_eid_wireformat[] = { - LDNS_RDF_TYPE_HEX -}; -static const ldns_rdf_type type_nimloc_wireformat[] = { - LDNS_RDF_TYPE_HEX -}; -static const ldns_rdf_type type_srv_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_atma_wireformat[] = { - LDNS_RDF_TYPE_ATMA -}; -static const ldns_rdf_type type_naptr_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_kx_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME -}; -static const ldns_rdf_type type_cert_wireformat[] = { - LDNS_RDF_TYPE_CERT_ALG, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64 -}; -static const ldns_rdf_type type_a6_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; -static const ldns_rdf_type type_dname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; -static const ldns_rdf_type type_sink_wireformat[] = { LDNS_RDF_TYPE_INT8, - LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 -}; -static const ldns_rdf_type type_apl_wireformat[] = { - LDNS_RDF_TYPE_APL -}; -static const ldns_rdf_type type_ds_wireformat[] = { - LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX -}; -static const ldns_rdf_type type_sshfp_wireformat[] = { - LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX -}; -static const ldns_rdf_type type_ipseckey_wireformat[] = { - LDNS_RDF_TYPE_IPSECKEY -}; -static const ldns_rdf_type type_rrsig_wireformat[] = { - LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, - LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 -}; -static const ldns_rdf_type type_nsec_wireformat[] = { - LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_NSEC -}; -static const ldns_rdf_type type_dhcid_wireformat[] = { - LDNS_RDF_TYPE_B64 -}; -static const ldns_rdf_type type_talink_wireformat[] = { - LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME -}; -/* nsec3 is some vars, followed by same type of data of nsec */ -static const ldns_rdf_type type_nsec3_wireformat[] = { -/* LDNS_RDF_TYPE_NSEC3_VARS, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC*/ - LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_NSEC3_SALT, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC -}; - -static const ldns_rdf_type type_nsec3params_wireformat[] = { -/* LDNS_RDF_TYPE_NSEC3_PARAMS_VARS*/ - LDNS_RDF_TYPE_INT8, - LDNS_RDF_TYPE_INT8, - LDNS_RDF_TYPE_INT16, - LDNS_RDF_TYPE_NSEC3_SALT -}; - -static const ldns_rdf_type type_dnskey_wireformat[] = { - LDNS_RDF_TYPE_INT16, - LDNS_RDF_TYPE_INT8, - LDNS_RDF_TYPE_ALG, - LDNS_RDF_TYPE_B64 -}; -static const ldns_rdf_type type_tsig_wireformat[] = { - LDNS_RDF_TYPE_DNAME, - LDNS_RDF_TYPE_TSIGTIME, - LDNS_RDF_TYPE_INT16, - LDNS_RDF_TYPE_INT16_DATA, - LDNS_RDF_TYPE_INT16, - LDNS_RDF_TYPE_INT16, - LDNS_RDF_TYPE_INT16_DATA -}; -/** \endcond */ - -/** \cond */ -/* All RR's defined in 1035 are well known and can thus - * be compressed. See RFC3597. These RR's are: - * CNAME HINFO MB MD MF MG MINFO MR MX NULL NS PTR SOA TXT - */ -static ldns_rr_descriptor rdata_field_descriptors[] = { - /* 0 */ - { 0, NULL, 0, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 1 */ - {LDNS_RR_TYPE_A, "A", 1, 1, type_a_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 2 */ - {LDNS_RR_TYPE_NS, "NS", 1, 1, type_ns_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 3 */ - {LDNS_RR_TYPE_MD, "MD", 1, 1, type_md_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 4 */ - {LDNS_RR_TYPE_MF, "MF", 1, 1, type_mf_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 5 */ - {LDNS_RR_TYPE_CNAME, "CNAME", 1, 1, type_cname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 6 */ - {LDNS_RR_TYPE_SOA, "SOA", 7, 7, type_soa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, - /* 7 */ - {LDNS_RR_TYPE_MB, "MB", 1, 1, type_mb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 8 */ - {LDNS_RR_TYPE_MG, "MG", 1, 1, type_mg_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 9 */ - {LDNS_RR_TYPE_MR, "MR", 1, 1, type_mr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 10 */ - {LDNS_RR_TYPE_NULL, "NULL", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 11 */ - {LDNS_RR_TYPE_WKS, "WKS", 2, 2, type_wks_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 12 */ - {LDNS_RR_TYPE_PTR, "PTR", 1, 1, type_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 13 */ - {LDNS_RR_TYPE_HINFO, "HINFO", 2, 2, type_hinfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 14 */ - {LDNS_RR_TYPE_MINFO, "MINFO", 2, 2, type_minfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, - /* 15 */ - {LDNS_RR_TYPE_MX, "MX", 2, 2, type_mx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, - /* 16 */ - {LDNS_RR_TYPE_TXT, "TXT", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, - /* 17 */ - {LDNS_RR_TYPE_RP, "RP", 2, 2, type_rp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, - /* 18 */ - {LDNS_RR_TYPE_AFSDB, "AFSDB", 2, 2, type_afsdb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 19 */ - {LDNS_RR_TYPE_X25, "X25", 1, 1, type_x25_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 20 */ - {LDNS_RR_TYPE_ISDN, "ISDN", 1, 2, type_isdn_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 21 */ - {LDNS_RR_TYPE_RT, "RT", 2, 2, type_rt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 22 */ - {LDNS_RR_TYPE_NSAP, "NSAP", 1, 1, type_nsap_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 23 */ - {LDNS_RR_TYPE_NSAP_PTR, "NSAP-PTR", 1, 1, type_nsap_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 24 */ - {LDNS_RR_TYPE_SIG, "SIG", 9, 9, type_sig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 25 */ - {LDNS_RR_TYPE_KEY, "KEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 26 */ - {LDNS_RR_TYPE_PX, "PX", 3, 3, type_px_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, - /* 27 */ - {LDNS_RR_TYPE_GPOS, "GPOS", 1, 1, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 28 */ - {LDNS_RR_TYPE_AAAA, "AAAA", 1, 1, type_aaaa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 29 */ - {LDNS_RR_TYPE_LOC, "LOC", 1, 1, type_loc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 30 */ - {LDNS_RR_TYPE_NXT, "NXT", 2, 2, type_nxt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 31 */ - {LDNS_RR_TYPE_EID, "EID", 1, 1, type_eid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 32 */ - {LDNS_RR_TYPE_NIMLOC, "NIMLOC", 1, 1, type_nimloc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 33 */ - {LDNS_RR_TYPE_SRV, "SRV", 4, 4, type_srv_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 34 */ - {LDNS_RR_TYPE_ATMA, "ATMA", 1, 1, type_atma_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 35 */ - {LDNS_RR_TYPE_NAPTR, "NAPTR", 6, 6, type_naptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 36 */ - {LDNS_RR_TYPE_KX, "KX", 2, 2, type_kx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 37 */ - {LDNS_RR_TYPE_CERT, "CERT", 4, 4, type_cert_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 38 */ - {LDNS_RR_TYPE_A6, "A6", 1, 1, type_a6_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 39 */ - {LDNS_RR_TYPE_DNAME, "DNAME", 1, 1, type_dname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 40 */ - {LDNS_RR_TYPE_SINK, "SINK", 1, 1, type_sink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 41 */ - {LDNS_RR_TYPE_OPT, "OPT", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 42 */ - {LDNS_RR_TYPE_APL, "APL", 0, 0, type_apl_wireformat, LDNS_RDF_TYPE_APL, LDNS_RR_NO_COMPRESS, 0 }, - /* 43 */ - {LDNS_RR_TYPE_DS, "DS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 44 */ - {LDNS_RR_TYPE_SSHFP, "SSHFP", 3, 3, type_sshfp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 45 */ - {LDNS_RR_TYPE_IPSECKEY, "IPSECKEY", 1, 1, type_ipseckey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 46 */ - {LDNS_RR_TYPE_RRSIG, "RRSIG", 9, 9, type_rrsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, - /* 47 */ - {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NSEC, LDNS_RR_NO_COMPRESS, 1 }, - /* 48 */ - {LDNS_RR_TYPE_DNSKEY, "DNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 49 */ -{LDNS_RR_TYPE_DHCID, "DHCID", 1, 1, type_dhcid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 50 */ - {LDNS_RR_TYPE_NSEC3, "NSEC3", 5, 6, type_nsec3_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 51 */ -{LDNS_RR_TYPE_NSEC3PARAMS, "NSEC3PARAM", 4, 4, type_nsec3params_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, - /* 52 */ -{LDNS_RR_TYPE_NULL, "TYPE52", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE55", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, -{LDNS_RR_TYPE_NULL, "TYPE59", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE60", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE61", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE62", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE63", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE64", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE65", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE66", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE67", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE68", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE69", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE70", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE71", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE72", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE73", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE74", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE75", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE76", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE77", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE78", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE79", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE80", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE81", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE82", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE83", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE84", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE85", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE86", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE87", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE88", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE89", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE90", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE91", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE92", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE93", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE94", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE95", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE104", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE105", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE106", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE107", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE108", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE109", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE113", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE114", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE115", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE116", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE117", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE118", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE119", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE120", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE121", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE122", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE123", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE124", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE125", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE126", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE127", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE128", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE129", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE130", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE131", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE132", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE133", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE134", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE135", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE136", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE137", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE138", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE139", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE140", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE141", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE142", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE143", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE144", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE145", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE146", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE147", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE148", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE149", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE150", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE151", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE152", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE153", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE154", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE155", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE156", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE157", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE158", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE159", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE160", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE161", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE162", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE163", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE164", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE165", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE166", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE167", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE168", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE169", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE170", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE171", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE172", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE173", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE174", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE175", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE176", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE177", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE178", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE179", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE180", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE181", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE182", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE183", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE184", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE185", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE186", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE187", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE188", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE189", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE190", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE191", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE192", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE193", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE194", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE195", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE196", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE197", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE198", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE199", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE200", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE201", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE202", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE203", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE204", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE205", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE206", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE207", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE208", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE209", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE210", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE211", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE212", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE213", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE214", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE215", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE216", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE217", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE218", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE219", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE220", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE221", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE222", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE223", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE224", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE225", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE226", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE227", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE228", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE229", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE230", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE231", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE232", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE233", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE234", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE235", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE236", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE237", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE238", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE239", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE240", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE241", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE242", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE243", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE244", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE245", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_NULL, "TYPE249", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -{LDNS_RR_TYPE_TSIG, "TSIG", 8, 9, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, -/* split in array, no longer contiguous */ -{LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 } -}; -/** \endcond */ - -/** - * \def LDNS_RDATA_FIELD_DESCRIPTORS_COUNT - * computes the number of rdata fields - */ -#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \ - (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0])) - -const ldns_rr_descriptor * -ldns_rr_descript(uint16_t type) -{ - size_t i; - if (type <= LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) { - return &rdata_field_descriptors[type]; - } else { - /* because not all array index equals type code */ - for (i = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON; - i < LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; - i++) { - if (rdata_field_descriptors[i]._type == type) { - return &rdata_field_descriptors[i]; - } - } - return &rdata_field_descriptors[0]; - } -} - -size_t -ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor) -{ - if (descriptor) { - return descriptor->_minimum; - } else { - return 0; - } -} - -size_t -ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor) -{ - if (descriptor) { - if (descriptor->_variable != LDNS_RDF_TYPE_NONE) { - /* Should really be SIZE_MAX... bad FreeBSD. */ - return UINT_MAX; - } else { - return descriptor->_maximum; - } - } else { - return 0; - } -} - -ldns_rdf_type -ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, - size_t index) -{ - assert(descriptor != NULL); - assert(index < descriptor->_maximum - || descriptor->_variable != LDNS_RDF_TYPE_NONE); - if (index < descriptor->_maximum) { - return descriptor->_wireformat[index]; - } else { - return descriptor->_variable; - } -} - -ldns_rr_type -ldns_get_rr_type_by_name(const char *name) -{ - unsigned int i; - const char *desc_name; - const ldns_rr_descriptor *desc; - - /* TYPEXX representation */ - if (strlen(name) > 4 && strncasecmp(name, "TYPE", 4) == 0) { - return atoi(name + 4); - } - - /* Normal types */ - for (i = 0; i < (unsigned int) LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; i++) { - desc = &rdata_field_descriptors[i]; - desc_name = desc->_name; - if(desc_name && - strlen(name) == strlen(desc_name) && - strncasecmp(name, desc_name, strlen(desc_name)) == 0) { - /* because not all array index equals type code */ - return desc->_type; - } - } - - /* special cases for query types */ - if (strlen(name) == 4 && strncasecmp(name, "IXFR", 4) == 0) { - return 251; - } else if (strlen(name) == 4 && strncasecmp(name, "AXFR", 4) == 0) { - return 252; - } else if (strlen(name) == 5 && strncasecmp(name, "MAILB", 5) == 0) { - return 253; - } else if (strlen(name) == 5 && strncasecmp(name, "MAILA", 5) == 0) { - return 254; - } else if (strlen(name) == 3 && strncasecmp(name, "ANY", 3) == 0) { - return 255; - } - - return 0; -} - -ldns_rr_class -ldns_get_rr_class_by_name(const char *name) -{ - ldns_lookup_table *lt; - - /* CLASSXX representation */ - if (strlen(name) > 5 && strncasecmp(name, "CLASS", 5) == 0) { - return atoi(name + 5); - } - - /* Normal types */ - lt = ldns_lookup_by_name(ldns_rr_classes, name); - - if (lt) { - return lt->id; - } - return 0; -} - - -ldns_rr_type -ldns_rdf2rr_type(const ldns_rdf *rd) -{ - ldns_rr_type r; - - if (!rd) { - return 0; - } - - if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_TYPE) { - return 0; - } - - r = (ldns_rr_type) ldns_rdf2native_int16(rd); - return r; -} - -ldns_rr_type -ldns_rr_list_type(const ldns_rr_list *rr_list) -{ - if (rr_list && ldns_rr_list_rr_count(rr_list) > 0) { - return ldns_rr_get_type(ldns_rr_list_rr(rr_list, 0)); - } else { - return 0; - } -} - -ldns_rdf * -ldns_rr_list_owner(const ldns_rr_list *rr_list) -{ - if (rr_list && ldns_rr_list_rr_count(rr_list) > 0) { - return ldns_rr_owner(ldns_rr_list_rr(rr_list, 0)); - } else { - return NULL; - } -} diff --git a/libs/ldns/rr_functions.c b/libs/ldns/rr_functions.c deleted file mode 100644 index 700372b91c..0000000000 --- a/libs/ldns/rr_functions.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * rr_function.c - * - * function that operate on specific rr types - * - * (c) NLnet Labs, 2004-2006 - * See the file LICENSE for the license - */ - -/* - * These come strait from perldoc Net::DNS::RR::xxx - * first the read variant, then the write. This is - * not complete. - */ - -#include - -#include - -#include -#include - -/** - * return a specific rdf - * \param[in] type type of RR - * \param[in] rr the rr itself - * \param[in] pos at which postion to get it - * \return the rdf sought - */ -static ldns_rdf * -ldns_rr_function(ldns_rr_type type, const ldns_rr *rr, size_t pos) -{ - if (!rr || ldns_rr_get_type(rr) != type) { - return NULL; - } - return ldns_rr_rdf(rr, pos); -} - -/** - * set a specific rdf - * \param[in] type type of RR - * \param[in] rr the rr itself - * \param[in] rdf the rdf to set - * \param[in] pos at which postion to set it - * \return true or false - */ -static bool -ldns_rr_set_function(ldns_rr_type type, ldns_rr *rr, ldns_rdf *rdf, size_t pos) -{ - ldns_rdf *pop; - if (!rr || ldns_rr_get_type(rr) != type) { - return false; - } - pop = ldns_rr_set_rdf(rr, rdf, pos); - ldns_rdf_deep_free(pop); - return true; -} - -/* A/AAAA records */ -ldns_rdf * -ldns_rr_a_address(const ldns_rr *r) -{ - /* 2 types to check, cannot use the macro */ - if (!r || (ldns_rr_get_type(r) != LDNS_RR_TYPE_A && - ldns_rr_get_type(r) != LDNS_RR_TYPE_AAAA)) { - return NULL; - } - return ldns_rr_rdf(r, 0); -} - -bool -ldns_rr_a_set_address(ldns_rr *r, ldns_rdf *f) -{ - /* 2 types to check, cannot use the macro... */ - ldns_rdf *pop; - if (!r || (ldns_rr_get_type(r) != LDNS_RR_TYPE_A && - ldns_rr_get_type(r) != LDNS_RR_TYPE_AAAA)) { - return false; - } - pop = ldns_rr_set_rdf(r, f, 0); - if (pop) { - LDNS_FREE(pop); - return true; - } else { - return false; - } -} - -/* NS record */ -ldns_rdf * -ldns_rr_ns_nsdname(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_NS, r, 0); -} - -/* MX record */ -ldns_rdf * -ldns_rr_mx_preference(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_MX, r, 0); -} - -ldns_rdf * -ldns_rr_mx_exchange(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_MX, r, 1); -} - -/* RRSIG record */ -ldns_rdf * -ldns_rr_rrsig_typecovered(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 0); -} - -bool -ldns_rr_rrsig_set_typecovered(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 0); -} - -ldns_rdf * -ldns_rr_rrsig_algorithm(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 1); -} - -bool -ldns_rr_rrsig_set_algorithm(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 1); -} - -ldns_rdf * -ldns_rr_rrsig_labels(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 2); -} - -bool -ldns_rr_rrsig_set_labels(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 2); -} - -ldns_rdf * -ldns_rr_rrsig_origttl(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 3); -} - -bool -ldns_rr_rrsig_set_origttl(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 3); -} - -ldns_rdf * -ldns_rr_rrsig_expiration(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 4); -} - -bool -ldns_rr_rrsig_set_expiration(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 4); -} - -ldns_rdf * -ldns_rr_rrsig_inception(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 5); -} - -bool -ldns_rr_rrsig_set_inception(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 5); -} - -ldns_rdf * -ldns_rr_rrsig_keytag(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 6); -} - -bool -ldns_rr_rrsig_set_keytag(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 6); -} - -ldns_rdf * -ldns_rr_rrsig_signame(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 7); -} - -bool -ldns_rr_rrsig_set_signame(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 7); -} - -ldns_rdf * -ldns_rr_rrsig_sig(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 8); -} - -bool -ldns_rr_rrsig_set_sig(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 8); -} - -/* DNSKEY record */ -ldns_rdf * -ldns_rr_dnskey_flags(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 0); -} - -bool -ldns_rr_dnskey_set_flags(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 0); -} - -ldns_rdf * -ldns_rr_dnskey_protocol(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 1); -} - -bool -ldns_rr_dnskey_set_protocol(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 1); -} - -ldns_rdf * -ldns_rr_dnskey_algorithm(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 2); -} - -bool -ldns_rr_dnskey_set_algorithm(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 2); -} - -ldns_rdf * -ldns_rr_dnskey_key(const ldns_rr *r) -{ - return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 3); -} - -bool -ldns_rr_dnskey_set_key(ldns_rr *r, ldns_rdf *f) -{ - return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 3); -} - -size_t -ldns_rr_dnskey_key_size_raw(const unsigned char* keydata, - const size_t len, - const ldns_algorithm alg) -{ - /* for DSA keys */ - uint8_t t; - - /* for RSA keys */ - uint16_t exp; - uint16_t int16; - - switch ((ldns_signing_algorithm)alg) { - case LDNS_SIGN_DSA: - case LDNS_SIGN_DSA_NSEC3: - if (len > 0) { - t = keydata[0]; - return (64 + t*8)*8; - } else { - return 0; - } - break; - case LDNS_SIGN_RSAMD5: - case LDNS_SIGN_RSASHA1: - case LDNS_SIGN_RSASHA1_NSEC3: -#ifdef USE_SHA2 - case LDNS_SIGN_RSASHA256: - case LDNS_SIGN_RSASHA512: -#endif - if (len > 0) { - if (keydata[0] == 0) { - /* big exponent */ - if (len > 3) { - memmove(&int16, keydata + 1, 2); - exp = ntohs(int16); - return (len - exp - 3)*8; - } else { - return 0; - } - } else { - exp = keydata[0]; - return (len-exp-1)*8; - } - } else { - return 0; - } - break; -#ifdef USE_GOST - case LDNS_SIGN_ECC_GOST: - return 512; -#endif -#ifdef USE_ECDSA - case LDNS_SIGN_ECDSAP256SHA256: - return 256; - case LDNS_SIGN_ECDSAP384SHA384: - return 384; -#endif - case LDNS_SIGN_HMACMD5: - return len; - default: - return 0; - } -} - -size_t -ldns_rr_dnskey_key_size(const ldns_rr *key) -{ - if (!key) { - return 0; - } - return ldns_rr_dnskey_key_size_raw((unsigned char*)ldns_rdf_data(ldns_rr_dnskey_key(key)), - ldns_rdf_size(ldns_rr_dnskey_key(key)), - ldns_rdf2native_int8(ldns_rr_dnskey_algorithm(key)) - ); -} diff --git a/libs/ldns/sha1.c b/libs/ldns/sha1.c deleted file mode 100644 index 5dec680a1b..0000000000 --- a/libs/ldns/sha1.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * modified for ldns by Jelte Jansen, original taken from OpenBSD: - * - * SHA-1 in C - * By Steve Reid - * 100% Public Domain - * - * Test Vectors (from FIPS PUB 180-1) - * "abc" - * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D - * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" - * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 - * A million repetitions of "a" - * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F -*/ - -/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */ -/* #define SHA1HANDSOFF * Copies data before messing with it. */ - -#include -#include -#include - -#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) - -/* blk0() and blk() perform the initial expand. */ -/* I got the idea of expanding during the round function from SSLeay */ -#if BYTE_ORDER == LITTLE_ENDIAN -#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ - |(rol(block->l[i],8)&0x00FF00FF)) -#else -#define blk0(i) block->l[i] -#endif -#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ - ^block->l[(i+2)&15]^block->l[i&15],1)) - -/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); -#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); -#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); - -/* Hash a single 512-bit block. This is the core of the algorithm. */ - -void -ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]) -{ - uint32_t a, b, c, d, e; - typedef union { - unsigned char c[64]; - unsigned int l[16]; - } CHAR64LONG16; - CHAR64LONG16* block; -#ifdef SHA1HANDSOFF - unsigned char workspace[LDNS_SHA1_BLOCK_LENGTH]; - - block = (CHAR64LONG16 *)workspace; - memmove(block, buffer, LDNS_SHA1_BLOCK_LENGTH); -#else - block = (CHAR64LONG16 *)buffer; -#endif - /* Copy context->state[] to working vars */ - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - - /* 4 rounds of 20 operations each. Loop unrolled. */ - R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); - R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); - R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); - R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); - R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); - R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); - R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); - R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); - R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); - R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); - R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); - R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); - R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); - R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); - R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); - R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); - R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); - R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); - R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); - R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); - - /* Add the working vars back into context.state[] */ - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - state[4] += e; - /* Wipe variables */ - a = b = c = d = e = 0; -} - - -/* SHA1Init - Initialize new context */ - -void -ldns_sha1_init(ldns_sha1_ctx *context) -{ - /* SHA1 initialization constants */ - context->count = 0; - context->state[0] = 0x67452301; - context->state[1] = 0xEFCDAB89; - context->state[2] = 0x98BADCFE; - context->state[3] = 0x10325476; - context->state[4] = 0xC3D2E1F0; -} - - -/* Run your data through this. */ - -void -ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len) -{ - unsigned int i; - unsigned int j; - - j = (unsigned)(uint32_t)((context->count >> 3) & 63); - context->count += (len << 3); - if ((j + len) > 63) { - memmove(&context->buffer[j], data, (i = 64 - j)); - ldns_sha1_transform(context->state, context->buffer); - for ( ; i + 63 < len; i += 64) { - ldns_sha1_transform(context->state, &data[i]); - } - j = 0; - } - else i = 0; - memmove(&context->buffer[j], &data[i], len - i); -} - - -/* Add padding and return the message digest. */ - -void -ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context) -{ - unsigned int i; - unsigned char finalcount[8]; - - for (i = 0; i < 8; i++) { - finalcount[i] = (unsigned char)((context->count >> - ((7 - (i & 7)) * 8)) & 255); /* Endian independent */ - } - ldns_sha1_update(context, (unsigned char *)"\200", 1); - while ((context->count & 504) != 448) { - ldns_sha1_update(context, (unsigned char *)"\0", 1); - } - ldns_sha1_update(context, finalcount, 8); /* Should cause a SHA1Transform() */ - - if (digest != NULL) - for (i = 0; i < LDNS_SHA1_DIGEST_LENGTH; i++) { - digest[i] = (unsigned char)((context->state[i >> 2] >> - ((3 - (i & 3)) * 8)) & 255); - } -#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite its own static vars */ - ldns_sha1_transform(context->state, context->buffer); -#endif -} - -unsigned char * -ldns_sha1(unsigned char *data, unsigned int data_len, unsigned char *digest) -{ - ldns_sha1_ctx ctx; - ldns_sha1_init(&ctx); - ldns_sha1_update(&ctx, data, data_len); - ldns_sha1_final(digest, &ctx); - return digest; -} diff --git a/libs/ldns/sha2.c b/libs/ldns/sha2.c deleted file mode 100644 index 26b7716a66..0000000000 --- a/libs/ldns/sha2.c +++ /dev/null @@ -1,982 +0,0 @@ -/* - * FILE: sha2.c - * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ - * - * Copyright (c) 2000-2001, Aaron D. Gifford - * All rights reserved. - * - * Modified by Jelte Jansen to fit in ldns, and not clash with any - * system-defined SHA code. - * Changes: - * - Renamed (external) functions and constants to fit ldns style - * - Removed _End and _Data functions - * - Added ldns_shaX(data, len, digest) convenience functions - * - Removed prototypes of _Transform functions and made those static - * - * 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. Neither the name of the copyright holder nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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. - * - * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ - */ - -#include -#include /* memcpy()/memset() or bcopy()/bzero() */ -#include /* assert() */ -#include - -/* - * ASSERT NOTE: - * Some sanity checking code is included using assert(). On my FreeBSD - * system, this additional code can be removed by compiling with NDEBUG - * defined. Check your own systems manpage on assert() to see how to - * compile WITHOUT the sanity checking code on your system. - * - * UNROLLED TRANSFORM LOOP NOTE: - * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform - * loop version for the hash transform rounds (defined using macros - * later in this file). Either define on the command line, for example: - * - * cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c - * - * or define below: - * - * #define SHA2_UNROLL_TRANSFORM - * - */ - - -/*** SHA-256/384/512 Machine Architecture Definitions *****************/ -/* - * BYTE_ORDER NOTE: - * - * Please make sure that your system defines BYTE_ORDER. If your - * architecture is little-endian, make sure it also defines - * LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are - * equivilent. - * - * If your system does not define the above, then you can do so by - * hand like this: - * - * #define LITTLE_ENDIAN 1234 - * #define BIG_ENDIAN 4321 - * - * And for little-endian machines, add: - * - * #define BYTE_ORDER LITTLE_ENDIAN - * - * Or for big-endian machines: - * - * #define BYTE_ORDER BIG_ENDIAN - * - * The FreeBSD machine this was written on defines BYTE_ORDER - * appropriately by including (which in turn includes - * where the appropriate definitions are actually - * made). - */ -#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) -#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN -#endif - -typedef uint8_t sha2_byte; /* Exactly 1 byte */ -typedef uint32_t sha2_word32; /* Exactly 4 bytes */ -#ifdef S_SPLINT_S -typedef unsigned long long sha2_word64; /* lint 8 bytes */ -#else -typedef uint64_t sha2_word64; /* Exactly 8 bytes */ -#endif - -/*** SHA-256/384/512 Various Length Definitions ***********************/ -/* NOTE: Most of these are in sha2.h */ -#define ldns_sha256_SHORT_BLOCK_LENGTH (LDNS_SHA256_BLOCK_LENGTH - 8) -#define ldns_sha384_SHORT_BLOCK_LENGTH (LDNS_SHA384_BLOCK_LENGTH - 16) -#define ldns_sha512_SHORT_BLOCK_LENGTH (LDNS_SHA512_BLOCK_LENGTH - 16) - - -/*** ENDIAN REVERSAL MACROS *******************************************/ -#if BYTE_ORDER == LITTLE_ENDIAN -#define REVERSE32(w,x) { \ - sha2_word32 tmp = (w); \ - tmp = (tmp >> 16) | (tmp << 16); \ - (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ -} -#ifndef S_SPLINT_S -#define REVERSE64(w,x) { \ - sha2_word64 tmp = (w); \ - tmp = (tmp >> 32) | (tmp << 32); \ - tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \ - ((tmp & 0x00ff00ff00ff00ffULL) << 8); \ - (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \ - ((tmp & 0x0000ffff0000ffffULL) << 16); \ -} -#else /* splint */ -#define REVERSE64(w,x) /* splint */ -#endif /* splint */ -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -/* - * Macro for incrementally adding the unsigned 64-bit integer n to the - * unsigned 128-bit integer (represented using a two-element array of - * 64-bit words): - */ -#define ADDINC128(w,n) { \ - (w)[0] += (sha2_word64)(n); \ - if ((w)[0] < (n)) { \ - (w)[1]++; \ - } \ -} -#ifdef S_SPLINT_S -#undef ADDINC128 -#define ADDINC128(w,n) /* splint */ -#endif - -/* - * Macros for copying blocks of memory and for zeroing out ranges - * of memory. Using these macros makes it easy to switch from - * using memset()/memcpy() and using bzero()/bcopy(). - * - * Please define either SHA2_USE_MEMSET_MEMCPY or define - * SHA2_USE_BZERO_BCOPY depending on which function set you - * choose to use: - */ -#if !defined(SHA2_USE_MEMSET_MEMCPY) && !defined(SHA2_USE_BZERO_BCOPY) -/* Default to memset()/memcpy() if no option is specified */ -#define SHA2_USE_MEMSET_MEMCPY 1 -#endif -#if defined(SHA2_USE_MEMSET_MEMCPY) && defined(SHA2_USE_BZERO_BCOPY) -/* Abort with an error if BOTH options are defined */ -#error Define either SHA2_USE_MEMSET_MEMCPY or SHA2_USE_BZERO_BCOPY, not both! -#endif - -#ifdef SHA2_USE_MEMSET_MEMCPY -#define MEMSET_BZERO(p,l) memset((p), 0, (l)) -#define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l)) -#endif -#ifdef SHA2_USE_BZERO_BCOPY -#define MEMSET_BZERO(p,l) bzero((p), (l)) -#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l)) -#endif - - -/*** THE SIX LOGICAL FUNCTIONS ****************************************/ -/* - * Bit shifting and rotation (used by the six SHA-XYZ logical functions: - * - * NOTE: The naming of R and S appears backwards here (R is a SHIFT and - * S is a ROTATION) because the SHA-256/384/512 description document - * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this - * same "backwards" definition. - */ -/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ -#define R(b,x) ((x) >> (b)) -/* 32-bit Rotate-right (used in SHA-256): */ -#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) -/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ -#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) - -/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */ -#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) -#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -/* Four of six logical functions used in SHA-256: */ -#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) -#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) -#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) -#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) - -/* Four of six logical functions used in SHA-384 and SHA-512: */ -#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) -#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) -#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) -#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) - -/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ -/* Hash constant words K for SHA-256: */ -static const sha2_word32 K256[64] = { - 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, - 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, - 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, - 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, - 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, - 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, - 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, - 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, - 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, - 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, - 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, - 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, - 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, - 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, - 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, - 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL -}; - -/* initial hash value H for SHA-256: */ -static const sha2_word32 ldns_sha256_initial_hash_value[8] = { - 0x6a09e667UL, - 0xbb67ae85UL, - 0x3c6ef372UL, - 0xa54ff53aUL, - 0x510e527fUL, - 0x9b05688cUL, - 0x1f83d9abUL, - 0x5be0cd19UL -}; - -/* Hash constant words K for SHA-384 and SHA-512: */ -static const sha2_word64 K512[80] = { - 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, - 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, - 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, - 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, - 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, - 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, - 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, - 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, - 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, - 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, - 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, - 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, - 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, - 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, - 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, - 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, - 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, - 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, - 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, - 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, - 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, - 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, - 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, - 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, - 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, - 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, - 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, - 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, - 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, - 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, - 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, - 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, - 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, - 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, - 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, - 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, - 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, - 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, - 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, - 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL -}; - -/* initial hash value H for SHA-384 */ -static const sha2_word64 sha384_initial_hash_value[8] = { - 0xcbbb9d5dc1059ed8ULL, - 0x629a292a367cd507ULL, - 0x9159015a3070dd17ULL, - 0x152fecd8f70e5939ULL, - 0x67332667ffc00b31ULL, - 0x8eb44a8768581511ULL, - 0xdb0c2e0d64f98fa7ULL, - 0x47b5481dbefa4fa4ULL -}; - -/* initial hash value H for SHA-512 */ -static const sha2_word64 sha512_initial_hash_value[8] = { - 0x6a09e667f3bcc908ULL, - 0xbb67ae8584caa73bULL, - 0x3c6ef372fe94f82bULL, - 0xa54ff53a5f1d36f1ULL, - 0x510e527fade682d1ULL, - 0x9b05688c2b3e6c1fULL, - 0x1f83d9abfb41bd6bULL, - 0x5be0cd19137e2179ULL -}; - -/*** SHA-256: *********************************************************/ -void ldns_sha256_init(ldns_sha256_CTX* context) { - if (context == (ldns_sha256_CTX*)0) { - return; - } - MEMCPY_BCOPY(context->state, ldns_sha256_initial_hash_value, LDNS_SHA256_DIGEST_LENGTH); - MEMSET_BZERO(context->buffer, LDNS_SHA256_BLOCK_LENGTH); - context->bitcount = 0; -} - -#ifdef SHA2_UNROLL_TRANSFORM - -/* Unrolled SHA-256 round macros: */ - -#if BYTE_ORDER == LITTLE_ENDIAN - -#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ - REVERSE32(*data++, W256[j]); \ - T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ - K256[j] + W256[j]; \ - (d) += T1; \ - (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ - j++ - - -#else /* BYTE_ORDER == LITTLE_ENDIAN */ - -#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ - T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ - K256[j] + (W256[j] = *data++); \ - (d) += T1; \ - (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ - j++ - -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -#define ROUND256(a,b,c,d,e,f,g,h) \ - s0 = W256[(j+1)&0x0f]; \ - s0 = sigma0_256(s0); \ - s1 = W256[(j+14)&0x0f]; \ - s1 = sigma1_256(s1); \ - T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \ - (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \ - (d) += T1; \ - (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ - j++ - -static void ldns_sha256_Transform(ldns_sha256_CTX* context, - const sha2_word32* data) { - sha2_word32 a, b, c, d, e, f, g, h, s0, s1; - sha2_word32 T1, *W256; - int j; - - W256 = (sha2_word32*)context->buffer; - - /* initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { - /* Rounds 0 to 15 (unrolled): */ - ROUND256_0_TO_15(a,b,c,d,e,f,g,h); - ROUND256_0_TO_15(h,a,b,c,d,e,f,g); - ROUND256_0_TO_15(g,h,a,b,c,d,e,f); - ROUND256_0_TO_15(f,g,h,a,b,c,d,e); - ROUND256_0_TO_15(e,f,g,h,a,b,c,d); - ROUND256_0_TO_15(d,e,f,g,h,a,b,c); - ROUND256_0_TO_15(c,d,e,f,g,h,a,b); - ROUND256_0_TO_15(b,c,d,e,f,g,h,a); - } while (j < 16); - - /* Now for the remaining rounds to 64: */ - do { - ROUND256(a,b,c,d,e,f,g,h); - ROUND256(h,a,b,c,d,e,f,g); - ROUND256(g,h,a,b,c,d,e,f); - ROUND256(f,g,h,a,b,c,d,e); - ROUND256(e,f,g,h,a,b,c,d); - ROUND256(d,e,f,g,h,a,b,c); - ROUND256(c,d,e,f,g,h,a,b); - ROUND256(b,c,d,e,f,g,h,a); - } while (j < 64); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = 0; -} - -#else /* SHA2_UNROLL_TRANSFORM */ - -static void ldns_sha256_Transform(ldns_sha256_CTX* context, - const sha2_word32* data) { - sha2_word32 a, b, c, d, e, f, g, h, s0, s1; - sha2_word32 T1, T2, *W256; - int j; - - W256 = (sha2_word32*)context->buffer; - - /* initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { -#if BYTE_ORDER == LITTLE_ENDIAN - /* Copy data while converting to host byte order */ - REVERSE32(*data++,W256[j]); - /* Apply the SHA-256 compression function to update a..h */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j]; -#else /* BYTE_ORDER == LITTLE_ENDIAN */ - /* Apply the SHA-256 compression function to update a..h with copy */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++); -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - T2 = Sigma0_256(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 16); - - do { - /* Part of the message block expansion: */ - s0 = W256[(j+1)&0x0f]; - s0 = sigma0_256(s0); - s1 = W256[(j+14)&0x0f]; - s1 = sigma1_256(s1); - - /* Apply the SHA-256 compression function to update a..h */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + - (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); - T2 = Sigma0_256(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 64); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = T2 = 0; -} - -#endif /* SHA2_UNROLL_TRANSFORM */ - -void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t len) { - size_t freespace, usedspace; - - if (len == 0) { - /* Calling with no data is valid - we do nothing */ - return; - } - - /* Sanity check: */ - assert(context != (ldns_sha256_CTX*)0 && data != (sha2_byte*)0); - - usedspace = (context->bitcount >> 3) % LDNS_SHA256_BLOCK_LENGTH; - if (usedspace > 0) { - /* Calculate how much free space is available in the buffer */ - freespace = LDNS_SHA256_BLOCK_LENGTH - usedspace; - - if (len >= freespace) { - /* Fill the buffer completely and process it */ - MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); - context->bitcount += freespace << 3; - len -= freespace; - data += freespace; - ldns_sha256_Transform(context, (sha2_word32*)context->buffer); - } else { - /* The buffer is not yet full */ - MEMCPY_BCOPY(&context->buffer[usedspace], data, len); - context->bitcount += len << 3; - /* Clean up: */ - usedspace = freespace = 0; - return; - } - } - while (len >= LDNS_SHA256_BLOCK_LENGTH) { - /* Process as many complete blocks as we can */ - ldns_sha256_Transform(context, (sha2_word32*)data); - context->bitcount += LDNS_SHA256_BLOCK_LENGTH << 3; - len -= LDNS_SHA256_BLOCK_LENGTH; - data += LDNS_SHA256_BLOCK_LENGTH; - } - if (len > 0) { - /* There's left-overs, so save 'em */ - MEMCPY_BCOPY(context->buffer, data, len); - context->bitcount += len << 3; - } - /* Clean up: */ - usedspace = freespace = 0; -} - -void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) { - sha2_word32 *d = (sha2_word32*)digest; - size_t usedspace; - - /* Sanity check: */ - assert(context != (ldns_sha256_CTX*)0); - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != (sha2_byte*)0) { - usedspace = (context->bitcount >> 3) % LDNS_SHA256_BLOCK_LENGTH; -#if BYTE_ORDER == LITTLE_ENDIAN - /* Convert FROM host byte order */ - REVERSE64(context->bitcount,context->bitcount); -#endif - if (usedspace > 0) { - /* Begin padding with a 1 bit: */ - context->buffer[usedspace++] = 0x80; - - if (usedspace <= ldns_sha256_SHORT_BLOCK_LENGTH) { - /* Set-up for the last transform: */ - MEMSET_BZERO(&context->buffer[usedspace], ldns_sha256_SHORT_BLOCK_LENGTH - usedspace); - } else { - if (usedspace < LDNS_SHA256_BLOCK_LENGTH) { - MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA256_BLOCK_LENGTH - usedspace); - } - /* Do second-to-last transform: */ - ldns_sha256_Transform(context, (sha2_word32*)context->buffer); - - /* And set-up for the last transform: */ - MEMSET_BZERO(context->buffer, ldns_sha256_SHORT_BLOCK_LENGTH); - } - } else { - /* Set-up for the last transform: */ - MEMSET_BZERO(context->buffer, ldns_sha256_SHORT_BLOCK_LENGTH); - - /* Begin padding with a 1 bit: */ - *context->buffer = 0x80; - } - /* Set the bit count: */ - *(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount; - - /* final transform: */ - ldns_sha256_Transform(context, (sha2_word32*)context->buffer); - -#if BYTE_ORDER == LITTLE_ENDIAN - { - /* Convert TO host byte order */ - int j; - for (j = 0; j < 8; j++) { - REVERSE32(context->state[j],context->state[j]); - *d++ = context->state[j]; - } - } -#else - MEMCPY_BCOPY(d, context->state, LDNS_SHA256_DIGEST_LENGTH); -#endif - } - - /* Clean up state data: */ - MEMSET_BZERO(context, sizeof(context)); - usedspace = 0; -} - -unsigned char * -ldns_sha256(unsigned char *data, unsigned int data_len, unsigned char *digest) -{ - ldns_sha256_CTX ctx; - ldns_sha256_init(&ctx); - ldns_sha256_update(&ctx, data, data_len); - ldns_sha256_final(digest, &ctx); - return digest; -} - -/*** SHA-512: *********************************************************/ -void ldns_sha512_init(ldns_sha512_CTX* context) { - if (context == (ldns_sha512_CTX*)0) { - return; - } - MEMCPY_BCOPY(context->state, sha512_initial_hash_value, LDNS_SHA512_DIGEST_LENGTH); - MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH); - context->bitcount[0] = context->bitcount[1] = 0; -} - -#ifdef SHA2_UNROLL_TRANSFORM - -/* Unrolled SHA-512 round macros: */ -#if BYTE_ORDER == LITTLE_ENDIAN - -#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ - REVERSE64(*data++, W512[j]); \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ - K512[j] + W512[j]; \ - (d) += T1, \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \ - j++ - - -#else /* BYTE_ORDER == LITTLE_ENDIAN */ - -#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ - K512[j] + (W512[j] = *data++); \ - (d) += T1; \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ - j++ - -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - -#define ROUND512(a,b,c,d,e,f,g,h) \ - s0 = W512[(j+1)&0x0f]; \ - s0 = sigma0_512(s0); \ - s1 = W512[(j+14)&0x0f]; \ - s1 = sigma1_512(s1); \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \ - (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ - (d) += T1; \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ - j++ - -static void ldns_sha512_Transform(ldns_sha512_CTX* context, - const sha2_word64* data) { - sha2_word64 a, b, c, d, e, f, g, h, s0, s1; - sha2_word64 T1, *W512 = (sha2_word64*)context->buffer; - int j; - - /* initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { - ROUND512_0_TO_15(a,b,c,d,e,f,g,h); - ROUND512_0_TO_15(h,a,b,c,d,e,f,g); - ROUND512_0_TO_15(g,h,a,b,c,d,e,f); - ROUND512_0_TO_15(f,g,h,a,b,c,d,e); - ROUND512_0_TO_15(e,f,g,h,a,b,c,d); - ROUND512_0_TO_15(d,e,f,g,h,a,b,c); - ROUND512_0_TO_15(c,d,e,f,g,h,a,b); - ROUND512_0_TO_15(b,c,d,e,f,g,h,a); - } while (j < 16); - - /* Now for the remaining rounds up to 79: */ - do { - ROUND512(a,b,c,d,e,f,g,h); - ROUND512(h,a,b,c,d,e,f,g); - ROUND512(g,h,a,b,c,d,e,f); - ROUND512(f,g,h,a,b,c,d,e); - ROUND512(e,f,g,h,a,b,c,d); - ROUND512(d,e,f,g,h,a,b,c); - ROUND512(c,d,e,f,g,h,a,b); - ROUND512(b,c,d,e,f,g,h,a); - } while (j < 80); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = 0; -} - -#else /* SHA2_UNROLL_TRANSFORM */ - -static void ldns_sha512_Transform(ldns_sha512_CTX* context, - const sha2_word64* data) { - sha2_word64 a, b, c, d, e, f, g, h, s0, s1; - sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer; - int j; - - /* initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { -#if BYTE_ORDER == LITTLE_ENDIAN - /* Convert TO host byte order */ - REVERSE64(*data++, W512[j]); - /* Apply the SHA-512 compression function to update a..h */ - T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j]; -#else /* BYTE_ORDER == LITTLE_ENDIAN */ - /* Apply the SHA-512 compression function to update a..h with copy */ - T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++); -#endif /* BYTE_ORDER == LITTLE_ENDIAN */ - T2 = Sigma0_512(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 16); - - do { - /* Part of the message block expansion: */ - s0 = W512[(j+1)&0x0f]; - s0 = sigma0_512(s0); - s1 = W512[(j+14)&0x0f]; - s1 = sigma1_512(s1); - - /* Apply the SHA-512 compression function to update a..h */ - T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + - (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); - T2 = Sigma0_512(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 80); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = T2 = 0; -} - -#endif /* SHA2_UNROLL_TRANSFORM */ - -void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t len) { - size_t freespace, usedspace; - - if (len == 0) { - /* Calling with no data is valid - we do nothing */ - return; - } - - /* Sanity check: */ - assert(context != (ldns_sha512_CTX*)0 && data != (sha2_byte*)0); - - usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; - if (usedspace > 0) { - /* Calculate how much free space is available in the buffer */ - freespace = LDNS_SHA512_BLOCK_LENGTH - usedspace; - - if (len >= freespace) { - /* Fill the buffer completely and process it */ - MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); - ADDINC128(context->bitcount, freespace << 3); - len -= freespace; - data += freespace; - ldns_sha512_Transform(context, (sha2_word64*)context->buffer); - } else { - /* The buffer is not yet full */ - MEMCPY_BCOPY(&context->buffer[usedspace], data, len); - ADDINC128(context->bitcount, len << 3); - /* Clean up: */ - usedspace = freespace = 0; - return; - } - } - while (len >= LDNS_SHA512_BLOCK_LENGTH) { - /* Process as many complete blocks as we can */ - ldns_sha512_Transform(context, (sha2_word64*)data); - ADDINC128(context->bitcount, LDNS_SHA512_BLOCK_LENGTH << 3); - len -= LDNS_SHA512_BLOCK_LENGTH; - data += LDNS_SHA512_BLOCK_LENGTH; - } - if (len > 0) { - /* There's left-overs, so save 'em */ - MEMCPY_BCOPY(context->buffer, data, len); - ADDINC128(context->bitcount, len << 3); - } - /* Clean up: */ - usedspace = freespace = 0; -} - -static void ldns_sha512_Last(ldns_sha512_CTX* context) { - size_t usedspace; - - usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; -#if BYTE_ORDER == LITTLE_ENDIAN - /* Convert FROM host byte order */ - REVERSE64(context->bitcount[0],context->bitcount[0]); - REVERSE64(context->bitcount[1],context->bitcount[1]); -#endif - if (usedspace > 0) { - /* Begin padding with a 1 bit: */ - context->buffer[usedspace++] = 0x80; - - if (usedspace <= ldns_sha512_SHORT_BLOCK_LENGTH) { - /* Set-up for the last transform: */ - MEMSET_BZERO(&context->buffer[usedspace], ldns_sha512_SHORT_BLOCK_LENGTH - usedspace); - } else { - if (usedspace < LDNS_SHA512_BLOCK_LENGTH) { - MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA512_BLOCK_LENGTH - usedspace); - } - /* Do second-to-last transform: */ - ldns_sha512_Transform(context, (sha2_word64*)context->buffer); - - /* And set-up for the last transform: */ - MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH - 2); - } - } else { - /* Prepare for final transform: */ - MEMSET_BZERO(context->buffer, ldns_sha512_SHORT_BLOCK_LENGTH); - - /* Begin padding with a 1 bit: */ - *context->buffer = 0x80; - } - /* Store the length of input data (in bits): */ - *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; - *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; - - /* final transform: */ - ldns_sha512_Transform(context, (sha2_word64*)context->buffer); -} - -void ldns_sha512_final(sha2_byte digest[], ldns_sha512_CTX* context) { - sha2_word64 *d = (sha2_word64*)digest; - - /* Sanity check: */ - assert(context != (ldns_sha512_CTX*)0); - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != (sha2_byte*)0) { - ldns_sha512_Last(context); - - /* Save the hash data for output: */ -#if BYTE_ORDER == LITTLE_ENDIAN - { - /* Convert TO host byte order */ - int j; - for (j = 0; j < 8; j++) { - REVERSE64(context->state[j],context->state[j]); - *d++ = context->state[j]; - } - } -#else - MEMCPY_BCOPY(d, context->state, LDNS_SHA512_DIGEST_LENGTH); -#endif - } - - /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); -} - -unsigned char * -ldns_sha512(unsigned char *data, unsigned int data_len, unsigned char *digest) -{ - ldns_sha512_CTX ctx; - ldns_sha512_init(&ctx); - ldns_sha512_update(&ctx, data, data_len); - ldns_sha512_final(digest, &ctx); - return digest; -} - -/*** SHA-384: *********************************************************/ -void ldns_sha384_init(ldns_sha384_CTX* context) { - if (context == (ldns_sha384_CTX*)0) { - return; - } - MEMCPY_BCOPY(context->state, sha384_initial_hash_value, LDNS_SHA512_DIGEST_LENGTH); - MEMSET_BZERO(context->buffer, LDNS_SHA384_BLOCK_LENGTH); - context->bitcount[0] = context->bitcount[1] = 0; -} - -void ldns_sha384_update(ldns_sha384_CTX* context, const sha2_byte* data, size_t len) { - ldns_sha512_update((ldns_sha512_CTX*)context, data, len); -} - -void ldns_sha384_final(sha2_byte digest[], ldns_sha384_CTX* context) { - sha2_word64 *d = (sha2_word64*)digest; - - /* Sanity check: */ - assert(context != (ldns_sha384_CTX*)0); - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != (sha2_byte*)0) { - ldns_sha512_Last((ldns_sha512_CTX*)context); - - /* Save the hash data for output: */ -#if BYTE_ORDER == LITTLE_ENDIAN - { - /* Convert TO host byte order */ - int j; - for (j = 0; j < 6; j++) { - REVERSE64(context->state[j],context->state[j]); - *d++ = context->state[j]; - } - } -#else - MEMCPY_BCOPY(d, context->state, LDNS_SHA384_DIGEST_LENGTH); -#endif - } - - /* Zero out state data */ - MEMSET_BZERO(context, sizeof(context)); -} - -unsigned char * -ldns_sha384(unsigned char *data, unsigned int data_len, unsigned char *digest) -{ - ldns_sha384_CTX ctx; - ldns_sha384_init(&ctx); - ldns_sha384_update(&ctx, data, data_len); - ldns_sha384_final(digest, &ctx); - return digest; -} diff --git a/libs/ldns/str2host.c b/libs/ldns/str2host.c deleted file mode 100644 index 2eda2f805b..0000000000 --- a/libs/ldns/str2host.c +++ /dev/null @@ -1,1313 +0,0 @@ -/* - * str2host.c - * - * conversion routines from the presentation format - * to the host format - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ -#include - -#include - -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_ARPA_INET_H -#include -#endif -#include - -#include -#ifdef HAVE_NETDB_H -#include -#endif - -#include -#ifdef HAVE_SYS_PARAM_H -#include -#endif - -ldns_status -ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr) -{ - char *end = NULL; - uint16_t *r; - r = LDNS_MALLOC(uint16_t); - if(!r) return LDNS_STATUS_MEM_ERR; - - *r = htons((uint16_t)strtol((char *)shortstr, &end, 10)); - - if(*end != 0) { - LDNS_FREE(r); - return LDNS_STATUS_INVALID_INT; - } else { - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_INT16, sizeof(uint16_t), r); - LDNS_FREE(r); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; - } -} - -ldns_status -ldns_str2rdf_time(ldns_rdf **rd, const char *time) -{ - /* convert a time YYYYDDMMHHMMSS to wireformat */ - uint16_t *r = NULL; - struct tm tm; - uint32_t l; - char *end; - - /* Try to scan the time... */ - r = (uint16_t*)LDNS_MALLOC(uint32_t); - if(!r) return LDNS_STATUS_MEM_ERR; - - memset(&tm, 0, sizeof(tm)); - - if (strlen(time) == 14 && - sscanf(time, "%4d%2d%2d%2d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6 - ) { - tm.tm_year -= 1900; - tm.tm_mon--; - /* Check values */ - if (tm.tm_year < 70) { - goto bad_format; - } - if (tm.tm_mon < 0 || tm.tm_mon > 11) { - goto bad_format; - } - if (tm.tm_mday < 1 || tm.tm_mday > 31) { - goto bad_format; - } - - if (tm.tm_hour < 0 || tm.tm_hour > 23) { - goto bad_format; - } - - if (tm.tm_min < 0 || tm.tm_min > 59) { - goto bad_format; - } - - if (tm.tm_sec < 0 || tm.tm_sec > 59) { - goto bad_format; - } - - l = htonl(mktime_from_utc(&tm)); - memcpy(r, &l, sizeof(uint32_t)); - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_TIME, sizeof(uint32_t), r); - LDNS_FREE(r); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; - } else { - /* handle it as 32 bits timestamp */ - l = htonl((uint32_t)strtol((char*)time, &end, 10)); - if(*end != 0) { - LDNS_FREE(r); - return LDNS_STATUS_ERR; - } else { - memcpy(r, &l, sizeof(uint32_t)); - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_INT32, sizeof(uint32_t), r); - LDNS_FREE(r); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; - } - } - - bad_format: - LDNS_FREE(r); - return LDNS_STATUS_INVALID_TIME; -} - -ldns_status -ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *salt_str) -{ - uint8_t salt_length; - int c; - int salt_length_str; - - uint8_t *salt; - uint8_t *data; - if(rd == NULL) { - return LDNS_STATUS_NULL; - } - - salt_length_str = (int)strlen(salt_str); - if (salt_length_str == 1 && salt_str[0] == '-') { - salt_length_str = 0; - } else if (salt_length_str % 2 != 0) { - return LDNS_STATUS_INVALID_HEX; - } - if (salt_length_str > 512) { - return LDNS_STATUS_INVALID_HEX; - } - - salt = LDNS_XMALLOC(uint8_t, salt_length_str / 2); - if(!salt) { - return LDNS_STATUS_MEM_ERR; - } - for (c = 0; c < salt_length_str; c += 2) { - if (isxdigit((int) salt_str[c]) && isxdigit((int) salt_str[c+1])) { - salt[c/2] = (uint8_t) ldns_hexdigit_to_int(salt_str[c]) * 16 + - ldns_hexdigit_to_int(salt_str[c+1]); - } else { - LDNS_FREE(salt); - return LDNS_STATUS_INVALID_HEX; - } - } - salt_length = (uint8_t) (salt_length_str / 2); - - data = LDNS_XMALLOC(uint8_t, 1 + salt_length); - if(!data) { - LDNS_FREE(salt); - return LDNS_STATUS_MEM_ERR; - } - data[0] = salt_length; - memcpy(&data[1], salt, salt_length); - *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC3_SALT, 1 + salt_length, data); - LDNS_FREE(data); - LDNS_FREE(salt); - - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_period(ldns_rdf **rd,const char *period) -{ - uint32_t p; - const char *end; - - /* Allocate required space... */ - p = ldns_str2period(period, &end); - - if (*end != 0) { - return LDNS_STATUS_ERR; - } else { - p = (uint32_t) htonl(p); - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_PERIOD, sizeof(uint32_t), &p); - } - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr) -{ - char *end; - uint16_t *r = NULL; - uint32_t l; - - r = (uint16_t*)LDNS_MALLOC(uint32_t); - if(!r) return LDNS_STATUS_MEM_ERR; - errno = 0; /* must set to zero before call, - note race condition on errno */ - if(*longstr == '-') - l = htonl((uint32_t)strtol((char*)longstr, &end, 10)); - else l = htonl((uint32_t)strtoul((char*)longstr, &end, 10)); - - if(*end != 0) { - LDNS_FREE(r); - return LDNS_STATUS_ERR; - } else { - if (errno == ERANGE) { - LDNS_FREE(r); - return LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW; - } - memcpy(r, &l, sizeof(uint32_t)); - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_INT32, sizeof(uint32_t), r); - LDNS_FREE(r); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; - } -} - -ldns_status -ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr) -{ - char *end; - uint8_t *r = NULL; - - r = LDNS_MALLOC(uint8_t); - if(!r) return LDNS_STATUS_MEM_ERR; - - *r = (uint8_t)strtol((char*)bytestr, &end, 10); - - if(*end != 0) { - LDNS_FREE(r); - return LDNS_STATUS_ERR; - } else { - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_INT8, sizeof(uint8_t), r); - LDNS_FREE(r); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; - } -} - - -/* - * Checks whether the escaped value at **s is an octal value or - * a 'normally' escaped character (and not eos) - * - * The string pointer at *s is increased by either 0 (on error), 1 (on - * normal escapes), or 3 (on octals) - * - * Returns the number of bytes read from the escaped string, or - * 0 on error - */ -static int -parse_escape(uint8_t *s, uint8_t *q) { - uint8_t val; - if (strlen((char *)s) > 3 && - isdigit((int) s[1]) && - isdigit((int) s[2]) && - isdigit((int) s[3])) { - /* cast this so it fits */ - val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 100 + - ldns_hexdigit_to_int((char) s[2]) * 10 + - ldns_hexdigit_to_int((char) s[3]); - *q = val; - return 3; - } else { - s++; - if (*s == '\0' || isdigit((int) *s)) { - /* apparently the string terminator - * or a digit has been escaped... - */ - return 0; - } - *q = *s; - return 1; - } -} - -/* - * No special care is taken, all dots are translated into - * label seperators. - * Could be made more efficient....we do 3 memcpy's in total... - */ -ldns_status -ldns_str2rdf_dname(ldns_rdf **d, const char *str) -{ - size_t len; - - int esc; - uint8_t *s, *q, *pq, label_len; - uint8_t buf[LDNS_MAX_DOMAINLEN + 1]; - *d = NULL; - - len = strlen((char*)str); - /* octet representation can make strings a lot longer than actual length */ - if (len > LDNS_MAX_DOMAINLEN * 4) { - return LDNS_STATUS_DOMAINNAME_OVERFLOW; - } - if (0 == len) { - return LDNS_STATUS_DOMAINNAME_UNDERFLOW; - } - - /* root label */ - if (1 == len && *str == '.') { - *d = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, 1, "\0"); - return LDNS_STATUS_OK; - } - - /* get on with the rest */ - - /* s is on the current character in the string - * pq points to where the labellength is going to go - * label_len keeps track of the current label's length - * q builds the dname inside the buf array - */ - len = 0; - q = buf+1; - pq = buf; - label_len = 0; - for (s = (uint8_t *)str; *s; s++, q++) { - if (q > buf + LDNS_MAX_DOMAINLEN) { - return LDNS_STATUS_DOMAINNAME_OVERFLOW; - } - *q = 0; - switch (*s) { - case '.': - if (label_len > LDNS_MAX_LABELLEN) { - return LDNS_STATUS_LABEL_OVERFLOW; - } - if (label_len == 0) { - return LDNS_STATUS_EMPTY_LABEL; - } - len += label_len + 1; - *pq = label_len; - label_len = 0; - pq = q; - break; - case '\\': - /* octet value or literal char */ - esc = parse_escape(s, q); - if (esc > 0) { - s += esc; - label_len++; - } else { - return LDNS_STATUS_SYNTAX_BAD_ESCAPE; - } - break; - default: - *q = *s; - label_len++; - } - } - - /* add root label if last char was not '.' */ - if (!ldns_dname_str_absolute(str)) { - if (q > buf + LDNS_MAX_DOMAINLEN) { - return LDNS_STATUS_DOMAINNAME_OVERFLOW; - } - if (label_len > LDNS_MAX_LABELLEN) { - return LDNS_STATUS_LABEL_OVERFLOW; - } - if (label_len == 0) { /* label_len 0 but not . at end? */ - return LDNS_STATUS_EMPTY_LABEL; - } - len += label_len + 1; - *pq = label_len; - *q = 0; - } - len++; - - *d = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, len, buf); - return LDNS_STATUS_OK; -} - -ldns_status -ldns_str2rdf_a(ldns_rdf **rd, const char *str) -{ - in_addr_t address; - if (inet_pton(AF_INET, (char*)str, &address) != 1) { - return LDNS_STATUS_INVALID_IP4; - } else { - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_A, sizeof(address), &address); - } - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str) -{ - uint8_t address[LDNS_IP6ADDRLEN + 1]; - - if (inet_pton(AF_INET6, (char*)str, address) != 1) { - return LDNS_STATUS_INVALID_IP6; - } else { - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_AAAA, sizeof(address) - 1, &address); - } - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_str(ldns_rdf **rd, const char *str) -{ - uint8_t *data; - size_t i, str_i, esc_i; - - if (strlen(str) > 255) { - return LDNS_STATUS_INVALID_STR; - } - - data = LDNS_XMALLOC(uint8_t, strlen(str) + 1); - if(!data) return LDNS_STATUS_MEM_ERR; - i = 1; - - for (str_i = 0; str_i < strlen(str); str_i++) { - if (str[str_i] == '\\') { - /* octet value or literal char */ - esc_i = (size_t) parse_escape((uint8_t*) &str[str_i], (uint8_t*) &data[i]); - if (esc_i == 0) { - LDNS_FREE(data); - return LDNS_STATUS_SYNTAX_BAD_ESCAPE; - } - str_i += esc_i; - } else { - data[i] = (uint8_t) str[str_i]; - } - i++; - } - data[0] = i - 1; - *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_STR, i, data); - - LDNS_FREE(data); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_apl(ldns_rdf **rd, const char *str) -{ - const char *my_str = str; - - char *my_ip_str; - size_t ip_str_len; - - uint16_t family; - bool negation; - uint8_t afdlength = 0; - uint8_t *afdpart; - uint8_t prefix; - - uint8_t *data; - - size_t i = 0; - - /* [!]afi:address/prefix */ - if (strlen(my_str) < 2) { - return LDNS_STATUS_INVALID_STR; - } - - if (my_str[0] == '!') { - negation = true; - my_str += 1; - } else { - negation = false; - } - - family = (uint16_t) atoi(my_str); - - my_str = strchr(my_str, ':') + 1; - - /* need ip addr and only ip addr for inet_pton */ - ip_str_len = (size_t) (strchr(my_str, '/') - my_str); - my_ip_str = LDNS_XMALLOC(char, ip_str_len + 1); - if(!my_ip_str) return LDNS_STATUS_MEM_ERR; - strncpy(my_ip_str, my_str, ip_str_len + 1); - my_ip_str[ip_str_len] = '\0'; - - if (family == 1) { - /* ipv4 */ - afdpart = LDNS_XMALLOC(uint8_t, 4); - if(!afdpart) { - LDNS_FREE(my_ip_str); - return LDNS_STATUS_MEM_ERR; - } - if (inet_pton(AF_INET, my_ip_str, afdpart) == 0) { - LDNS_FREE(my_ip_str); - LDNS_FREE(afdpart); - return LDNS_STATUS_INVALID_STR; - } - for (i = 0; i < 4; i++) { - if (afdpart[i] != 0) { - afdlength = i + 1; - } - } - } else if (family == 2) { - /* ipv6 */ - afdpart = LDNS_XMALLOC(uint8_t, 16); - if(!afdpart) { - LDNS_FREE(my_ip_str); - return LDNS_STATUS_MEM_ERR; - } - if (inet_pton(AF_INET6, my_ip_str, afdpart) == 0) { - LDNS_FREE(my_ip_str); - LDNS_FREE(afdpart); - return LDNS_STATUS_INVALID_STR; - } - for (i = 0; i < 16; i++) { - if (afdpart[i] != 0) { - afdlength = i + 1; - } - } - } else { - /* unknown family */ - LDNS_FREE(my_ip_str); - return LDNS_STATUS_INVALID_STR; - } - - my_str = strchr(my_str, '/') + 1; - prefix = (uint8_t) atoi(my_str); - - data = LDNS_XMALLOC(uint8_t, 4 + afdlength); - if(!data) { - LDNS_FREE(my_ip_str); - return LDNS_STATUS_INVALID_STR; - } - ldns_write_uint16(data, family); - data[2] = prefix; - data[3] = afdlength; - if (negation) { - /* set bit 1 of byte 3 */ - data[3] = data[3] | 0x80; - } - - memcpy(data + 4, afdpart, afdlength); - - *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_APL, afdlength + 4, data); - LDNS_FREE(afdpart); - LDNS_FREE(data); - LDNS_FREE(my_ip_str); - - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_b64(ldns_rdf **rd, const char *str) -{ - uint8_t *buffer; - int16_t i; - - buffer = LDNS_XMALLOC(uint8_t, ldns_b64_ntop_calculate_size(strlen(str))); - if(!buffer) { - return LDNS_STATUS_MEM_ERR; - } - - i = (uint16_t)ldns_b64_pton((const char*)str, buffer, - ldns_b64_ntop_calculate_size(strlen(str))); - if (-1 == i) { - LDNS_FREE(buffer); - return LDNS_STATUS_INVALID_B64; - } else { - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_B64, (uint16_t) i, buffer); - } - LDNS_FREE(buffer); - - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str) -{ - uint8_t *buffer; - int i; - /* first byte contains length of actual b32 data */ - uint8_t len = ldns_b32_pton_calculate_size(strlen(str)); - buffer = LDNS_XMALLOC(uint8_t, len + 1); - if(!buffer) { - return LDNS_STATUS_MEM_ERR; - } - buffer[0] = len; - - i = ldns_b32_pton_extended_hex((const char*)str, strlen(str), buffer + 1, - ldns_b32_ntop_calculate_size(strlen(str))); - if (i < 0) { - LDNS_FREE(buffer); - return LDNS_STATUS_INVALID_B32_EXT; - } else { - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_B32_EXT, (uint16_t) i + 1, buffer); - } - LDNS_FREE(buffer); - - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_hex(ldns_rdf **rd, const char *str) -{ - uint8_t *t, *t_orig; - int i; - size_t len; - - len = strlen(str); - - if (len > LDNS_MAX_RDFLEN * 2) { - return LDNS_STATUS_LABEL_OVERFLOW; - } else { - t = LDNS_XMALLOC(uint8_t, (len / 2) + 1); - if(!t) { - return LDNS_STATUS_MEM_ERR; - } - t_orig = t; - /* Now process octet by octet... */ - while (*str) { - *t = 0; - if (isspace((int) *str)) { - str++; - } else { - for (i = 16; i >= 1; i -= 15) { - while (*str && isspace((int) *str)) { str++; } - if (*str) { - if (isxdigit((int) *str)) { - *t += ldns_hexdigit_to_int(*str) * i; - } else { - LDNS_FREE(t_orig); - return LDNS_STATUS_ERR; - } - ++str; - } - } - ++t; - } - } - *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, - (size_t) (t - t_orig), - t_orig); - LDNS_FREE(t_orig); - } - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_nsec(ldns_rdf **rd, const char *str) -{ - const char *delimiters = "\n\t "; - char *token = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); - ldns_buffer *str_buf; - ssize_t c; - uint16_t cur_type; - size_t type_count = 0; - ldns_rr_type type_list[65536]; - if(!token) return LDNS_STATUS_MEM_ERR; - if(rd == NULL) { - LDNS_FREE(token); - return LDNS_STATUS_NULL; - } - - str_buf = LDNS_MALLOC(ldns_buffer); - if(!str_buf) { - LDNS_FREE(token); - return LDNS_STATUS_MEM_ERR; - } - ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); - if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { - LDNS_FREE(str_buf); - LDNS_FREE(token); - return LDNS_STATUS_MEM_ERR; - } - - while ((c = ldns_bget_token(str_buf, token, delimiters, LDNS_MAX_RDFLEN)) != -1 && c != 0) { - if(type_count >= sizeof(type_list)) { - LDNS_FREE(str_buf); - LDNS_FREE(token); - return LDNS_STATUS_ERR; - } - cur_type = ldns_get_rr_type_by_name(token); - type_list[type_count] = cur_type; - type_count++; - } - - *rd = ldns_dnssec_create_nsec_bitmap(type_list, - type_count, - LDNS_RR_TYPE_NSEC); - - LDNS_FREE(token); - ldns_buffer_free(str_buf); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_type(ldns_rdf **rd, const char *str) -{ - uint16_t type; - type = htons(ldns_get_rr_type_by_name(str)); - /* ldns_rr_type is a 16 bit value */ - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_TYPE, sizeof(uint16_t), &type); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_class(ldns_rdf **rd, const char *str) -{ - uint16_t klass; - klass = htons(ldns_get_rr_class_by_name(str)); - /* class is 16 bit */ - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_CLASS, sizeof(uint16_t), &klass); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -/* An certificate alg field can either be specified as a 8 bits number - * or by its symbolic name. Handle both - */ -ldns_status -ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str) -{ - ldns_lookup_table *lt; - ldns_status st; - uint8_t idd[2]; - lt = ldns_lookup_by_name(ldns_cert_algorithms, str); - st = LDNS_STATUS_OK; - - if (lt) { - ldns_write_uint16(idd, (uint16_t) lt->id); - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_INT16, sizeof(uint16_t), idd); - if (!*rd) { - st = LDNS_STATUS_ERR; - } - } else { - /* try as-is (a number) */ - st = ldns_str2rdf_int16(rd, str); - if (st == LDNS_STATUS_OK && - ldns_rdf2native_int16(*rd) == 0) { - st = LDNS_STATUS_CERT_BAD_ALGORITHM; - } - } - - return st; -} - -/* An alg field can either be specified as a 8 bits number - * or by its symbolic name. Handle both - */ -ldns_status -ldns_str2rdf_alg(ldns_rdf **rd, const char *str) -{ - ldns_lookup_table *lt; - ldns_status st; - - lt = ldns_lookup_by_name(ldns_algorithms, str); - st = LDNS_STATUS_OK; - - if (lt) { - /* it was given as a integer */ - *rd = ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, (uint8_t) lt->id); - if (!*rd) { - st = LDNS_STATUS_ERR; - } - } else { - /* try as-is (a number) */ - st = ldns_str2rdf_int8(rd, str); - } - return st; -} - -ldns_status -ldns_str2rdf_unknown(ldns_rdf **rd, const char *str) -{ - /* this should be caught in an earlier time (general str2host for - rr's */ - rd = rd; - str = str; - return LDNS_STATUS_NOT_IMPL; -} - -ldns_status -ldns_str2rdf_tsig(ldns_rdf **rd, const char *str) -{ - /* there is no strign representation for TSIG rrs */ - rd = rd; - str = str; - return LDNS_STATUS_NOT_IMPL; -} - -ldns_status -ldns_str2rdf_service(ldns_rdf **rd, const char *str) -{ - /* is this used? is this actually WKS? or SRV? */ - rd = rd; - str = str; - return LDNS_STATUS_NOT_IMPL; -} - -static int -loc_parse_cm(char* my_str, char** endstr, uint8_t* m, uint8_t* e) -{ - /* read [.][mM] */ - /* into mantissa exponent format for LOC type */ - uint32_t meters = 0, cm = 0, val; - while (isblank(*my_str)) { - my_str++; - } - meters = (uint32_t)strtol(my_str, &my_str, 10); - if (*my_str == '.') { - my_str++; - cm = (uint32_t)strtol(my_str, &my_str, 10); - } - if (meters >= 1) { - *e = 2; - val = meters; - } else { - *e = 0; - val = cm; - } - while(val >= 10) { - (*e)++; - val /= 10; - } - *m = (uint8_t)val; - - if (*e > 9) - return 0; - if (*my_str == 'm' || *my_str == 'M') { - my_str++; - } - *endstr = my_str; - return 1; -} - -ldns_status -ldns_str2rdf_loc(ldns_rdf **rd, const char *str) -{ - uint32_t latitude = 0; - uint32_t longitude = 0; - uint32_t altitude = 0; - - uint8_t *data; - uint32_t equator = (uint32_t) ldns_power(2, 31); - - uint32_t h = 0; - uint32_t m = 0; - uint8_t size_b = 1, size_e = 2; - uint8_t horiz_pre_b = 1, horiz_pre_e = 6; - uint8_t vert_pre_b = 1, vert_pre_e = 3; - - double s = 0.0; - bool northerness; - bool easterness; - - char *my_str = (char *) str; - - /* only support version 0 */ - if (isdigit((int) *my_str)) { - h = (uint32_t) strtol(my_str, &my_str, 10); - } else { - return LDNS_STATUS_INVALID_STR; - } - - while (isblank((int) *my_str)) { - my_str++; - } - - if (isdigit((int) *my_str)) { - m = (uint32_t) strtol(my_str, &my_str, 10); - } else if (*my_str == 'N' || *my_str == 'S') { - goto north; - } else { - return LDNS_STATUS_INVALID_STR; - } - - while (isblank((int) *my_str)) { - my_str++; - } - - if (isdigit((int) *my_str)) { - s = strtod(my_str, &my_str); - } -north: - while (isblank((int) *my_str)) { - my_str++; - } - - if (*my_str == 'N') { - northerness = true; - } else if (*my_str == 'S') { - northerness = false; - } else { - return LDNS_STATUS_INVALID_STR; - } - - my_str++; - - /* store number */ - s = 1000.0 * s; - /* add a little to make floor in conversion a round */ - s += 0.0005; - latitude = (uint32_t) s; - latitude += 1000 * 60 * m; - latitude += 1000 * 60 * 60 * h; - if (northerness) { - latitude = equator + latitude; - } else { - latitude = equator - latitude; - } - while (isblank(*my_str)) { - my_str++; - } - - if (isdigit((int) *my_str)) { - h = (uint32_t) strtol(my_str, &my_str, 10); - } else { - return LDNS_STATUS_INVALID_STR; - } - - while (isblank((int) *my_str)) { - my_str++; - } - - if (isdigit((int) *my_str)) { - m = (uint32_t) strtol(my_str, &my_str, 10); - } else if (*my_str == 'E' || *my_str == 'W') { - goto east; - } else { - return LDNS_STATUS_INVALID_STR; - } - - while (isblank(*my_str)) { - my_str++; - } - - if (isdigit((int) *my_str)) { - s = strtod(my_str, &my_str); - } - -east: - while (isblank(*my_str)) { - my_str++; - } - - if (*my_str == 'E') { - easterness = true; - } else if (*my_str == 'W') { - easterness = false; - } else { - return LDNS_STATUS_INVALID_STR; - } - - my_str++; - - /* store number */ - s *= 1000.0; - /* add a little to make floor in conversion a round */ - s += 0.0005; - longitude = (uint32_t) s; - longitude += 1000 * 60 * m; - longitude += 1000 * 60 * 60 * h; - - if (easterness) { - longitude += equator; - } else { - longitude = equator - longitude; - } - - altitude = (uint32_t)(strtod(my_str, &my_str)*100.0 + - 10000000.0 + 0.5); - if (*my_str == 'm' || *my_str == 'M') { - my_str++; - } - - if (strlen(my_str) > 0) { - if(!loc_parse_cm(my_str, &my_str, &size_b, &size_e)) - return LDNS_STATUS_INVALID_STR; - } - - if (strlen(my_str) > 0) { - if(!loc_parse_cm(my_str, &my_str, &horiz_pre_b, &horiz_pre_e)) - return LDNS_STATUS_INVALID_STR; - } - - if (strlen(my_str) > 0) { - if(!loc_parse_cm(my_str, &my_str, &vert_pre_b, &vert_pre_e)) - return LDNS_STATUS_INVALID_STR; - } - - data = LDNS_XMALLOC(uint8_t, 16); - if(!data) { - return LDNS_STATUS_MEM_ERR; - } - data[0] = 0; - data[1] = 0; - data[1] = ((size_b << 4) & 0xf0) | (size_e & 0x0f); - data[2] = ((horiz_pre_b << 4) & 0xf0) | (horiz_pre_e & 0x0f); - data[3] = ((vert_pre_b << 4) & 0xf0) | (vert_pre_e & 0x0f); - ldns_write_uint32(data + 4, latitude); - ldns_write_uint32(data + 8, longitude); - ldns_write_uint32(data + 12, altitude); - - *rd = ldns_rdf_new_frm_data( - LDNS_RDF_TYPE_LOC, 16, data); - - LDNS_FREE(data); - return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; -} - -ldns_status -ldns_str2rdf_wks(ldns_rdf **rd, const char *str) -{ - uint8_t *bitmap = NULL; - uint8_t *data; - int bm_len = 0; - - struct protoent *proto = NULL; - struct servent *serv = NULL; - int serv_port; - - ldns_buffer *str_buf; - - char *proto_str = NULL; - char *token; - if(strlen(str) == 0) - token = LDNS_XMALLOC(char, 50); - else token = LDNS_XMALLOC(char, strlen(str)+2); - if(!token) return LDNS_STATUS_MEM_ERR; - - str_buf = LDNS_MALLOC(ldns_buffer); - if(!str_buf) {LDNS_FREE(token); return LDNS_STATUS_MEM_ERR;} - ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); - if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { - LDNS_FREE(str_buf); - LDNS_FREE(token); - return LDNS_STATUS_MEM_ERR; - } - - while(ldns_bget_token(str_buf, token, "\t\n ", strlen(str)) > 0) { - if (!proto_str) { - proto_str = strdup(token); - if (!proto_str) { - LDNS_FREE(bitmap); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - return LDNS_STATUS_INVALID_STR; - } - } else { - serv = getservbyname(token, proto_str); - if (serv) { - serv_port = (int) ntohs((uint16_t) serv->s_port); - } else { - serv_port = atoi(token); - } - if (serv_port / 8 >= bm_len) { - uint8_t *b2 = LDNS_XREALLOC(bitmap, uint8_t, (serv_port / 8) + 1); - if(!b2) { - LDNS_FREE(bitmap); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - free(proto_str); - return LDNS_STATUS_INVALID_STR; - } - bitmap = b2; - /* set to zero to be sure */ - for (; bm_len <= serv_port / 8; bm_len++) { - bitmap[bm_len] = 0; - } - } - ldns_set_bit(bitmap + (serv_port / 8), 7 - (serv_port % 8), true); - } - } - - if (!proto_str || !bitmap) { - LDNS_FREE(bitmap); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - free(proto_str); - return LDNS_STATUS_INVALID_STR; - } - - data = LDNS_XMALLOC(uint8_t, bm_len + 1); - if(!data) { - LDNS_FREE(token); - ldns_buffer_free(str_buf); - LDNS_FREE(bitmap); - free(proto_str); - return LDNS_STATUS_INVALID_STR; - } - if (proto_str) - proto = getprotobyname(proto_str); - if (proto) { - data[0] = (uint8_t) proto->p_proto; - } else if (proto_str) { - data[0] = (uint8_t) atoi(proto_str); - } else { - data[0] = 0; - } - memcpy(data + 1, bitmap, (size_t) bm_len); - - *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_WKS, (uint16_t) (bm_len + 1), data); - - LDNS_FREE(data); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - LDNS_FREE(bitmap); - free(proto_str); -#ifdef HAVE_ENDSERVENT - endservent(); -#endif -#ifdef HAVE_ENDPROTOENT - endprotoent(); -#endif - - if(!*rd) return LDNS_STATUS_MEM_ERR; - - return LDNS_STATUS_OK; -} - -ldns_status -ldns_str2rdf_nsap(ldns_rdf **rd, const char *str) -{ - size_t len, i; - char* nsap_str = (char*) str; - - /* just a hex string with optional dots? */ - if (str[0] != '0' || str[1] != 'x') { - return LDNS_STATUS_INVALID_STR; - } else { - len = strlen(str); - for (i=0; i < len; i++) { - if (nsap_str[i] == '.') - nsap_str[i] = ' '; - } - return ldns_str2rdf_hex(rd, str+2); - } -} - -ldns_status -ldns_str2rdf_atma(ldns_rdf **rd, const char *str) -{ - size_t len, i; - char* atma_str = (char*) str; - ldns_status status; - - /* just a hex string with optional dots? */ - len = strlen(str); - for (i=0; i < len; i++) { - if (atma_str[i] == '.') - atma_str[i] = ' '; - } - status = ldns_str2rdf_hex(rd, str); - if (status != LDNS_STATUS_OK) { - ; /* probably in e.164 format than */ - } - return status; -} - -ldns_status -ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str) -{ - uint8_t precedence = 0; - uint8_t gateway_type = 0; - uint8_t algorithm = 0; - char* gateway = NULL; - char* publickey = NULL; - uint8_t *data; - ldns_buffer *str_buf; - char *token; - int token_count = 0; - int ipseckey_len = 0; - ldns_rdf* gateway_rdf = NULL; - ldns_rdf* publickey_rdf = NULL; - ldns_status status = LDNS_STATUS_OK; - - if(strlen(str) == 0) - token = LDNS_XMALLOC(char, 256); - else token = LDNS_XMALLOC(char, strlen(str)+2); - if(!token) return LDNS_STATUS_MEM_ERR; - - str_buf = LDNS_MALLOC(ldns_buffer); - if(!str_buf) {LDNS_FREE(token); return LDNS_STATUS_MEM_ERR;} - ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); - if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { - LDNS_FREE(str_buf); - LDNS_FREE(token); - return LDNS_STATUS_MEM_ERR; - } - while(ldns_bget_token(str_buf, token, "\t\n ", strlen(str)) > 0) { - switch (token_count) { - case 0: - precedence = (uint8_t)atoi(token); - break; - case 1: - gateway_type = (uint8_t)atoi(token); - break; - case 2: - algorithm = (uint8_t)atoi(token); - break; - case 3: - gateway = strdup(token); - if (!gateway || (gateway_type == 0 && - (token[0] != '.' || token[1] != '\0'))) { - LDNS_FREE(gateway); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - return LDNS_STATUS_INVALID_STR; - } - break; - case 4: - publickey = strdup(token); - break; - default: - LDNS_FREE(token); - ldns_buffer_free(str_buf); - return LDNS_STATUS_INVALID_STR; - break; - } - token_count++; - } - - if (!gateway || !publickey) { - if (gateway) - LDNS_FREE(gateway); - if (publickey) - LDNS_FREE(publickey); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - return LDNS_STATUS_INVALID_STR; - } - - if (gateway_type == 1) { - status = ldns_str2rdf_a(&gateway_rdf, gateway); - } else if (gateway_type == 2) { - status = ldns_str2rdf_aaaa(&gateway_rdf, gateway); - } else if (gateway_type == 3) { - status = ldns_str2rdf_dname(&gateway_rdf, gateway); - } - - if (status != LDNS_STATUS_OK) { - if (gateway) - LDNS_FREE(gateway); - if (publickey) - LDNS_FREE(publickey); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - return LDNS_STATUS_INVALID_STR; - } - - status = ldns_str2rdf_b64(&publickey_rdf, publickey); - - if (status != LDNS_STATUS_OK) { - if (gateway) - LDNS_FREE(gateway); - if (publickey) - LDNS_FREE(publickey); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - if (gateway_rdf) ldns_rdf_free(gateway_rdf); - return LDNS_STATUS_INVALID_STR; - } - - /* now copy all into one ipseckey rdf */ - if (gateway_type) - ipseckey_len = 3 + (int)ldns_rdf_size(gateway_rdf) + (int)ldns_rdf_size(publickey_rdf); - else - ipseckey_len = 3 + (int)ldns_rdf_size(publickey_rdf); - - data = LDNS_XMALLOC(uint8_t, ipseckey_len); - if(!data) { - if (gateway) - LDNS_FREE(gateway); - if (publickey) - LDNS_FREE(publickey); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - if (gateway_rdf) ldns_rdf_free(gateway_rdf); - if (publickey_rdf) ldns_rdf_free(publickey_rdf); - return LDNS_STATUS_MEM_ERR; - } - - data[0] = precedence; - data[1] = gateway_type; - data[2] = algorithm; - - if (gateway_type) { - memcpy(data + 3, - ldns_rdf_data(gateway_rdf), ldns_rdf_size(gateway_rdf)); - memcpy(data + 3 + ldns_rdf_size(gateway_rdf), - ldns_rdf_data(publickey_rdf), ldns_rdf_size(publickey_rdf)); - } else { - memcpy(data + 3, - ldns_rdf_data(publickey_rdf), ldns_rdf_size(publickey_rdf)); - } - - *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_IPSECKEY, (uint16_t) ipseckey_len, data); - - if (gateway) - LDNS_FREE(gateway); - if (publickey) - LDNS_FREE(publickey); - LDNS_FREE(token); - ldns_buffer_free(str_buf); - ldns_rdf_free(gateway_rdf); - ldns_rdf_free(publickey_rdf); - LDNS_FREE(data); - if(!*rd) return LDNS_STATUS_MEM_ERR; - return LDNS_STATUS_OK; -} diff --git a/libs/ldns/tsig.c b/libs/ldns/tsig.c deleted file mode 100644 index 7fcf21da0e..0000000000 --- a/libs/ldns/tsig.c +++ /dev/null @@ -1,458 +0,0 @@ -/* - * tsig.c - * - * contains the functions needed for TSIG [RFC2845] - * - * (c) 2005-2006 NLnet Labs - * See the file LICENSE for the license - */ - -#include - -#include - -#include - -#ifdef HAVE_SSL -#include -#include -#endif /* HAVE_SSL */ - -char * -ldns_tsig_algorithm(ldns_tsig_credentials *tc) -{ - return tc->algorithm; -} - -char * -ldns_tsig_keyname(ldns_tsig_credentials *tc) -{ - return tc->keyname; -} - -char * -ldns_tsig_keydata(ldns_tsig_credentials *tc) -{ - return tc->keydata; -} - -char * -ldns_tsig_keyname_clone(ldns_tsig_credentials *tc) -{ - return strdup(tc->keyname); -} - -char * -ldns_tsig_keydata_clone(ldns_tsig_credentials *tc) -{ - return strdup(tc->keydata); -} - -/* - * Makes an exact copy of the wire, but with the tsig rr removed - */ -uint8_t * -ldns_tsig_prepare_pkt_wire(uint8_t *wire, size_t wire_len, size_t *result_len) -{ - uint8_t *wire2 = NULL; - uint16_t qd_count; - uint16_t an_count; - uint16_t ns_count; - uint16_t ar_count; - ldns_rr *rr; - - size_t pos; - uint16_t i; - - ldns_status status; - - if(wire_len < LDNS_HEADER_SIZE) { - return NULL; - } - /* fake parse the wire */ - qd_count = LDNS_QDCOUNT(wire); - an_count = LDNS_ANCOUNT(wire); - ns_count = LDNS_NSCOUNT(wire); - ar_count = LDNS_ARCOUNT(wire); - - if (ar_count > 0) { - ar_count--; - } else { - return NULL; - } - - pos = LDNS_HEADER_SIZE; - - for (i = 0; i < qd_count; i++) { - status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_QUESTION); - if (status != LDNS_STATUS_OK) { - return NULL; - } - ldns_rr_free(rr); - } - - for (i = 0; i < an_count; i++) { - status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_ANSWER); - if (status != LDNS_STATUS_OK) { - return NULL; - } - ldns_rr_free(rr); - } - - for (i = 0; i < ns_count; i++) { - status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_AUTHORITY); - if (status != LDNS_STATUS_OK) { - return NULL; - } - ldns_rr_free(rr); - } - - for (i = 0; i < ar_count; i++) { - status = ldns_wire2rr(&rr, wire, wire_len, &pos, - LDNS_SECTION_ADDITIONAL); - if (status != LDNS_STATUS_OK) { - return NULL; - } - ldns_rr_free(rr); - } - - *result_len = pos; - wire2 = LDNS_XMALLOC(uint8_t, *result_len); - if(!wire2) { - return NULL; - } - memcpy(wire2, wire, *result_len); - - ldns_write_uint16(wire2 + LDNS_ARCOUNT_OFF, ar_count); - - return wire2; -} - -#ifdef HAVE_SSL -static const EVP_MD * -ldns_digest_function(char *name) -{ - /* these are the mandatory algorithms from RFC4635 */ - /* The optional algorithms are not yet implemented */ - if (strlen(name) == 12 && strncasecmp(name, "hmac-sha256.", 11) == 0) { -#ifdef HAVE_EVP_SHA256 - return EVP_sha256(); -#else - return NULL; -#endif - } else if (strlen(name) == 10 && strncasecmp(name, "hmac-sha1.", 9) == 0) - return EVP_sha1(); - else if (strlen(name) == 25 && strncasecmp(name, - "hmac-md5.sig-alg.reg.int.", 25) == 0) - return EVP_md5(); - else - return NULL; -} -#endif - -#ifdef HAVE_SSL -static ldns_status -ldns_tsig_mac_new(ldns_rdf **tsig_mac, uint8_t *pkt_wire, size_t pkt_wire_size, - const char *key_data, ldns_rdf *key_name_rdf, ldns_rdf *fudge_rdf, - ldns_rdf *algorithm_rdf, ldns_rdf *time_signed_rdf, ldns_rdf *error_rdf, - ldns_rdf *other_data_rdf, ldns_rdf *orig_mac_rdf, int tsig_timers_only) -{ - char *wireformat; - int wiresize; - unsigned char *mac_bytes; - unsigned char *key_bytes; - int key_size; - const EVP_MD *digester; - char *algorithm_name; - unsigned int md_len = EVP_MAX_MD_SIZE; - ldns_rdf *result = NULL; - ldns_buffer *data_buffer = NULL; - - /* - * prepare the digestable information - */ - data_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); - if(!data_buffer) { - return LDNS_STATUS_MEM_ERR; - } - /* if orig_mac is not NULL, add it too */ - if (orig_mac_rdf) { - (void) ldns_rdf2buffer_wire(data_buffer, orig_mac_rdf); - } - ldns_buffer_write(data_buffer, pkt_wire, pkt_wire_size); - if (!tsig_timers_only) { - (void)ldns_rdf2buffer_wire(data_buffer, key_name_rdf); - ldns_buffer_write_u16(data_buffer, LDNS_RR_CLASS_ANY); - ldns_buffer_write_u32(data_buffer, 0); - (void)ldns_rdf2buffer_wire(data_buffer, algorithm_rdf); - } - (void)ldns_rdf2buffer_wire(data_buffer, time_signed_rdf); - (void)ldns_rdf2buffer_wire(data_buffer, fudge_rdf); - if (!tsig_timers_only) { - (void)ldns_rdf2buffer_wire(data_buffer, error_rdf); - (void)ldns_rdf2buffer_wire(data_buffer, other_data_rdf); - } - - wireformat = (char *) data_buffer->_data; - wiresize = (int) ldns_buffer_position(data_buffer); - - algorithm_name = ldns_rdf2str(algorithm_rdf); - if(!algorithm_name) { - ldns_buffer_free(data_buffer); - return LDNS_STATUS_MEM_ERR; - } - - /* prepare the key */ - key_bytes = LDNS_XMALLOC(unsigned char, - ldns_b64_pton_calculate_size(strlen(key_data))); - if(!key_bytes) { - LDNS_FREE(algorithm_name); - ldns_buffer_free(data_buffer); - return LDNS_STATUS_MEM_ERR; - } - key_size = ldns_b64_pton(key_data, key_bytes, - ldns_b64_pton_calculate_size(strlen(key_data))); - if (key_size < 0) { - LDNS_FREE(algorithm_name); - LDNS_FREE(key_bytes); - ldns_buffer_free(data_buffer); - /* LDNS_STATUS_INVALID_B64 */ - return LDNS_STATUS_INVALID_B64; - } - /* hmac it */ - /* 2 spare bytes for the length */ - mac_bytes = LDNS_XMALLOC(unsigned char, md_len+2); - if(!mac_bytes) { - LDNS_FREE(algorithm_name); - LDNS_FREE(key_bytes); - ldns_buffer_free(data_buffer); - return LDNS_STATUS_MEM_ERR; - } - memset(mac_bytes, 0, md_len+2); - - digester = ldns_digest_function(algorithm_name); - - if (digester) { - (void) HMAC(digester, key_bytes, key_size, (void *)wireformat, - (size_t) wiresize, mac_bytes + 2, &md_len); - - ldns_write_uint16(mac_bytes, md_len); - result = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT16_DATA, md_len + 2, - mac_bytes); - } else { - LDNS_FREE(algorithm_name); - LDNS_FREE(mac_bytes); - LDNS_FREE(key_bytes); - ldns_buffer_free(data_buffer); - return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; - } - - LDNS_FREE(algorithm_name); - LDNS_FREE(mac_bytes); - LDNS_FREE(key_bytes); - ldns_buffer_free(data_buffer); - - *tsig_mac = result; - - return LDNS_STATUS_OK; -} -#endif /* HAVE_SSL */ - - -#ifdef HAVE_SSL -bool -ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char *key_name, - const char *key_data, ldns_rdf *orig_mac_rdf) -{ - return ldns_pkt_tsig_verify_next(pkt, wire, wirelen, key_name, key_data, orig_mac_rdf, 0); -} - -bool -ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char* key_name, - const char *key_data, ldns_rdf *orig_mac_rdf, int tsig_timers_only) -{ - ldns_rdf *fudge_rdf; - ldns_rdf *algorithm_rdf; - ldns_rdf *time_signed_rdf; - ldns_rdf *orig_id_rdf; - ldns_rdf *error_rdf; - ldns_rdf *other_data_rdf; - ldns_rdf *pkt_mac_rdf; - ldns_rdf *my_mac_rdf; - ldns_rdf *key_name_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, key_name); - uint16_t pkt_id, orig_pkt_id; - ldns_status status; - - uint8_t *prepared_wire = NULL; - size_t prepared_wire_size = 0; - - ldns_rr *orig_tsig = ldns_pkt_tsig(pkt); - - if (!orig_tsig) { - ldns_rdf_deep_free(key_name_rdf); - return false; - } - algorithm_rdf = ldns_rr_rdf(orig_tsig, 0); - time_signed_rdf = ldns_rr_rdf(orig_tsig, 1); - fudge_rdf = ldns_rr_rdf(orig_tsig, 2); - pkt_mac_rdf = ldns_rr_rdf(orig_tsig, 3); - orig_id_rdf = ldns_rr_rdf(orig_tsig, 4); - error_rdf = ldns_rr_rdf(orig_tsig, 5); - other_data_rdf = ldns_rr_rdf(orig_tsig, 6); - - /* remove temporarily */ - ldns_pkt_set_tsig(pkt, NULL); - /* temporarily change the id to the original id */ - pkt_id = ldns_pkt_id(pkt); - orig_pkt_id = ldns_rdf2native_int16(orig_id_rdf); - ldns_pkt_set_id(pkt, orig_pkt_id); - - prepared_wire = ldns_tsig_prepare_pkt_wire(wire, wirelen, &prepared_wire_size); - - status = ldns_tsig_mac_new(&my_mac_rdf, prepared_wire, prepared_wire_size, - key_data, key_name_rdf, fudge_rdf, algorithm_rdf, - time_signed_rdf, error_rdf, other_data_rdf, orig_mac_rdf, tsig_timers_only); - - LDNS_FREE(prepared_wire); - - if (status != LDNS_STATUS_OK) { - ldns_rdf_deep_free(key_name_rdf); - return false; - } - /* Put back the values */ - ldns_pkt_set_tsig(pkt, orig_tsig); - ldns_pkt_set_id(pkt, pkt_id); - - ldns_rdf_deep_free(key_name_rdf); - - if (ldns_rdf_compare(pkt_mac_rdf, my_mac_rdf) == 0) { - ldns_rdf_deep_free(my_mac_rdf); - return true; - } else { - ldns_rdf_deep_free(my_mac_rdf); - return false; - } -} -#endif /* HAVE_SSL */ - -#ifdef HAVE_SSL -ldns_status -ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, - uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac) -{ - return ldns_pkt_tsig_sign_next(pkt, key_name, key_data, fudge, algorithm_name, query_mac, 0); -} - -ldns_status -ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data, - uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only) -{ - ldns_rr *tsig_rr; - ldns_rdf *key_name_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, key_name); - ldns_rdf *fudge_rdf = NULL; - ldns_rdf *orig_id_rdf = NULL; - ldns_rdf *algorithm_rdf; - ldns_rdf *error_rdf = NULL; - ldns_rdf *mac_rdf = NULL; - ldns_rdf *other_data_rdf = NULL; - - ldns_status status = LDNS_STATUS_OK; - - uint8_t *pkt_wire = NULL; - size_t pkt_wire_len; - - struct timeval tv_time_signed; - uint8_t *time_signed = NULL; - ldns_rdf *time_signed_rdf = NULL; - - algorithm_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, algorithm_name); - if(!key_name_rdf || !algorithm_rdf) { - status = LDNS_STATUS_MEM_ERR; - goto clean; - } - - /* eww don't have create tsigtime rdf yet :( */ - /* bleh :p */ - if (gettimeofday(&tv_time_signed, NULL) == 0) { - time_signed = LDNS_XMALLOC(uint8_t, 6); - if(!time_signed) { - status = LDNS_STATUS_MEM_ERR; - goto clean; - } - ldns_write_uint64_as_uint48(time_signed, - (uint64_t)tv_time_signed.tv_sec); - } else { - status = LDNS_STATUS_INTERNAL_ERR; - goto clean; - } - - time_signed_rdf = ldns_rdf_new(LDNS_RDF_TYPE_TSIGTIME, 6, time_signed); - if(!time_signed_rdf) { - LDNS_FREE(time_signed); - status = LDNS_STATUS_MEM_ERR; - goto clean; - } - - fudge_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, fudge); - - orig_id_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, ldns_pkt_id(pkt)); - - error_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, 0); - - other_data_rdf = ldns_native2rdf_int16_data(0, NULL); - - if(!fudge_rdf || !orig_id_rdf || !error_rdf || !other_data_rdf) { - status = LDNS_STATUS_MEM_ERR; - goto clean; - } - - if (ldns_pkt2wire(&pkt_wire, pkt, &pkt_wire_len) != LDNS_STATUS_OK) { - status = LDNS_STATUS_ERR; - goto clean; - } - - status = ldns_tsig_mac_new(&mac_rdf, pkt_wire, pkt_wire_len, - key_data, key_name_rdf, fudge_rdf, algorithm_rdf, - time_signed_rdf, error_rdf, other_data_rdf, query_mac, tsig_timers_only); - - if (!mac_rdf) { - goto clean; - } - - LDNS_FREE(pkt_wire); - - /* Create the TSIG RR */ - tsig_rr = ldns_rr_new(); - if(!tsig_rr) { - status = LDNS_STATUS_MEM_ERR; - goto clean; - } - ldns_rr_set_owner(tsig_rr, key_name_rdf); - ldns_rr_set_class(tsig_rr, LDNS_RR_CLASS_ANY); - ldns_rr_set_type(tsig_rr, LDNS_RR_TYPE_TSIG); - ldns_rr_set_ttl(tsig_rr, 0); - - ldns_rr_push_rdf(tsig_rr, algorithm_rdf); - ldns_rr_push_rdf(tsig_rr, time_signed_rdf); - ldns_rr_push_rdf(tsig_rr, fudge_rdf); - ldns_rr_push_rdf(tsig_rr, mac_rdf); - ldns_rr_push_rdf(tsig_rr, orig_id_rdf); - ldns_rr_push_rdf(tsig_rr, error_rdf); - ldns_rr_push_rdf(tsig_rr, other_data_rdf); - - ldns_pkt_set_tsig(pkt, tsig_rr); - - return status; - - clean: - LDNS_FREE(pkt_wire); - ldns_rdf_free(key_name_rdf); - ldns_rdf_free(algorithm_rdf); - ldns_rdf_free(time_signed_rdf); - ldns_rdf_free(fudge_rdf); - ldns_rdf_free(orig_id_rdf); - ldns_rdf_free(error_rdf); - ldns_rdf_free(other_data_rdf); - return status; -} -#endif /* HAVE_SSL */ diff --git a/libs/ldns/update.c b/libs/ldns/update.c deleted file mode 100644 index 01e67aa069..0000000000 --- a/libs/ldns/update.c +++ /dev/null @@ -1,315 +0,0 @@ -/* update.c - * - * Functions for RFC 2136 Dynamic Update - * - * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. - * - * See LICENSE for the license. - */ - -#include - -#include - -#include -#include -#include - -/* - * RFC 2136 sections mapped to RFC 1035: - * zone/ZO -- QD/question - * prerequisites/PR -- AN/answers - * updates/UP -- NS/authority records - * additional data/AD -- AR/additional records - */ - -ldns_pkt * -ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class c, - ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist) -{ - ldns_pkt *p; - - if (!zone_rdf || !up_rrlist) { - return NULL; - } - - if (c == 0) { - c = LDNS_RR_CLASS_IN; - } - - /* Create packet, fill in Zone Section. */ - p = ldns_pkt_query_new(zone_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); - if (!p) { - return NULL; - } - zone_rdf = NULL; /* No longer safe to use. */ - - ldns_pkt_set_opcode(p, LDNS_PACKET_UPDATE); - - ldns_rr_list_deep_free(p->_authority); - - ldns_pkt_set_authority(p, ldns_rr_list_clone(up_rrlist)); - - ldns_update_set_upcount(p, ldns_rr_list_rr_count(up_rrlist)); - - if (pr_rrlist) { - ldns_rr_list_deep_free(p->_answer); /*XXX access function */ - ldns_pkt_set_answer(p, ldns_rr_list_clone(pr_rrlist)); - ldns_update_set_prcount(p, ldns_rr_list_rr_count(pr_rrlist)); - } - - if (ad_rrlist) { - ldns_rr_list_deep_free(p->_additional); - ldns_pkt_set_additional(p, ldns_rr_list_clone(ad_rrlist)); - ldns_update_set_adcount(p, ldns_rr_list_rr_count(ad_rrlist)); - } - return p; -} - -ldns_status -ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r) -{ -#ifdef HAVE_SSL - uint16_t fudge = 300; /* Recommended fudge. [RFC2845 6.4] */ - if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) - return ldns_pkt_tsig_sign(p, ldns_resolver_tsig_keyname(r), - ldns_resolver_tsig_keydata(r), fudge, - ldns_resolver_tsig_algorithm(r), NULL); -#else - /* do nothing */ - (void)p; - (void)r; -#endif /* HAVE_SSL */ - /* No TSIG to do. */ - return LDNS_STATUS_OK; -} - -/* Move to higher.c or similar? */ -/* XXX doc */ -ldns_status -ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, - ldns_rr_class c, ldns_rdf **mname) -{ - ldns_rr *soa_rr; - ldns_pkt *query, *resp; - - /* Nondestructive, so clone 'zone' here */ - query = ldns_pkt_query_new(ldns_rdf_clone(zone), LDNS_RR_TYPE_SOA, - c, LDNS_RD); - if (!query) { - return LDNS_STATUS_ERR; - } - - ldns_pkt_set_random_id(query); - if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { - ldns_pkt_free(query); - return LDNS_STATUS_ERR; - } - ldns_pkt_free(query); - if (!resp) { - return LDNS_STATUS_ERR; - } - - /* Expect a SOA answer. */ - *mname = NULL; - while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_answer(resp)))) { - if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) - continue; - /* [RFC1035 3.3.13] */ - *mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); - break; - } - ldns_pkt_free(resp); - - return *mname ? LDNS_STATUS_OK : LDNS_STATUS_ERR; -} - -/* Try to get zone and MNAME from SOA queries. */ -ldns_status -ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, - ldns_rr_class c, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf) -{ - ldns_rr *soa_rr, *rr; - ldns_rdf *soa_zone = NULL, *soa_mname = NULL; - ldns_rdf *ipaddr, *fqdn_rdf, *tmp; - ldns_rdf **nslist; - ldns_pkt *query, *resp; - size_t i; - - /* - * XXX Ok, this cannot be the best way to find this...? - * XXX (I run into weird cache-related stuff here) - */ - - /* Step 1 - first find a nameserver that should know *something* */ - fqdn_rdf = ldns_dname_new_frm_str(fqdn); - query = ldns_pkt_query_new(fqdn_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); - if (!query) { - return LDNS_STATUS_ERR; - } - fqdn_rdf = NULL; - - ldns_pkt_set_random_id(query); - if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { - ldns_pkt_free(query); - return LDNS_STATUS_ERR; - } - ldns_pkt_free(query); - if (!resp) { - return LDNS_STATUS_ERR; - } - - /* XXX Is it safe to only look in authority section here? */ - while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_authority(resp)))) { - if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) - continue; - /* [RFC1035 3.3.13] */ - soa_mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); - break; - } - ldns_pkt_free(resp); - if (!soa_rr) { - return LDNS_STATUS_ERR; - } - - /* Step 2 - find SOA MNAME IP address, add to resolver */ - query = ldns_pkt_query_new(soa_mname, LDNS_RR_TYPE_A, c, LDNS_RD); - if (!query) { - return LDNS_STATUS_ERR; - } - soa_mname = NULL; - - ldns_pkt_set_random_id(query); - if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { - ldns_pkt_free(query); - return LDNS_STATUS_ERR; - } - ldns_pkt_free(query); - if (!resp) { - return LDNS_STATUS_ERR; - } - - if (ldns_pkt_ancount(resp) == 0) { - ldns_pkt_free(resp); - return LDNS_STATUS_ERR; - } - - /* XXX There may be more than one answer RR here. */ - rr = ldns_rr_list_pop_rr(ldns_pkt_answer(resp)); - ipaddr = ldns_rr_rdf(rr, 0); - - /* Put the SOA mname IP first in the nameserver list. */ - nslist = ldns_resolver_nameservers(r); - for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { - if (ldns_rdf_compare(ipaddr, nslist[i]) == 0) { - if (i) { - tmp = nslist[0]; - nslist[0] = nslist[i]; - nslist[i] = tmp; - } - break; - } - } - if (i >= ldns_resolver_nameserver_count(r)) { - /* SOA mname was not part of the resolver so add it first. */ - (void) ldns_resolver_push_nameserver(r, ipaddr); - nslist = ldns_resolver_nameservers(r); - i = ldns_resolver_nameserver_count(r) - 1; - tmp = nslist[0]; - nslist[0] = nslist[i]; - nslist[i] = tmp; - } - ldns_pkt_free(resp); - - /* Make sure to ask the first in the list, i.e SOA mname */ - ldns_resolver_set_random(r, false); - - /* Step 3 - Redo SOA query, sending to SOA MNAME directly. */ - fqdn_rdf = ldns_dname_new_frm_str(fqdn); - query = ldns_pkt_query_new(fqdn_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); - if (!query) { - return LDNS_STATUS_ERR; - } - fqdn_rdf = NULL; - - ldns_pkt_set_random_id(query); - if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { - ldns_pkt_free(query); - return LDNS_STATUS_ERR; - } - ldns_pkt_free(query); - if (!resp) { - return LDNS_STATUS_ERR; - } - - /* XXX Is it safe to only look in authority section here, too? */ - while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_authority(resp)))) { - if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) - continue; - /* [RFC1035 3.3.13] */ - soa_mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); - soa_zone = ldns_rdf_clone(ldns_rr_owner(soa_rr)); - break; - } - ldns_pkt_free(resp); - if (!soa_rr) { - return LDNS_STATUS_ERR; - } - - /* That seems to have worked, pass results to caller. */ - *zone_rdf = soa_zone; - *mname_rdf = soa_mname; - return LDNS_STATUS_OK; -} - -/* - * ldns_update_{get,set}_{zo,pr,up,ad}count - */ - -uint16_t -ldns_update_zocount(const ldns_pkt *p) -{ - return ldns_pkt_qdcount(p); -} - -uint16_t -ldns_update_prcount(const ldns_pkt *p) -{ - return ldns_pkt_ancount(p); -} - -uint16_t -ldns_update_upcount(const ldns_pkt *p) -{ - return ldns_pkt_nscount(p); -} - -uint16_t -ldns_update_ad(const ldns_pkt *p) -{ - return ldns_pkt_arcount(p); -} - -void -ldns_update_set_zo(ldns_pkt *p, uint16_t v) -{ - ldns_pkt_set_qdcount(p, v); -} - -void -ldns_update_set_prcount(ldns_pkt *p, uint16_t v) -{ - ldns_pkt_set_ancount(p, v); -} - -void -ldns_update_set_upcount(ldns_pkt *p, uint16_t v) -{ - ldns_pkt_set_nscount(p, v); -} - -void -ldns_update_set_adcount(ldns_pkt *p, uint16_t v) -{ - ldns_pkt_set_arcount(p, v); -} diff --git a/libs/ldns/util.c b/libs/ldns/util.c deleted file mode 100644 index eb24f81dbe..0000000000 --- a/libs/ldns/util.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * util.c - * - * some general memory functions - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifdef HAVE_SSL -#include -#endif - -/* put this here tmp. for debugging */ -void -xprintf_rdf(ldns_rdf *rd) -{ - /* assume printable string */ - fprintf(stderr, "size\t:%u\n", (unsigned int)ldns_rdf_size(rd)); - fprintf(stderr, "type\t:%u\n", (unsigned int)ldns_rdf_get_type(rd)); - fprintf(stderr, "data\t:[%.*s]\n", (int)ldns_rdf_size(rd), - (char*)ldns_rdf_data(rd)); -} - -void -xprintf_rr(ldns_rr *rr) -{ - /* assume printable string */ - uint16_t count, i; - - count = ldns_rr_rd_count(rr); - - for(i = 0; i < count; i++) { - fprintf(stderr, "print rd %u\n", (unsigned int) i); - xprintf_rdf(rr->_rdata_fields[i]); - } -} - -void xprintf_hex(uint8_t *data, size_t len) -{ - size_t i; - for (i = 0; i < len; i++) { - if (i > 0 && i % 20 == 0) { - printf("\t; %u - %u\n", (unsigned int) i - 19, (unsigned int) i); - } - printf("%02x ", (unsigned int) data[i]); - } - printf("\n"); -} - -ldns_lookup_table * -ldns_lookup_by_name(ldns_lookup_table *table, const char *name) -{ - while (table->name != NULL) { - if (strcasecmp(name, table->name) == 0) - return table; - table++; - } - return NULL; -} - -ldns_lookup_table * -ldns_lookup_by_id(ldns_lookup_table *table, int id) -{ - while (table->name != NULL) { - if (table->id == id) - return table; - table++; - } - return NULL; -} - -int -ldns_get_bit(uint8_t bits[], size_t index) -{ - /* - * The bits are counted from left to right, so bit #0 is the - * left most bit. - */ - return (int) (bits[index / 8] & (1 << (7 - index % 8))); -} - -int -ldns_get_bit_r(uint8_t bits[], size_t index) -{ - /* - * The bits are counted from right to left, so bit #0 is the - * right most bit. - */ - return (int) bits[index / 8] & (1 << (index % 8)); -} - -void -ldns_set_bit(uint8_t *byte, int bit_nr, bool value) -{ - if (bit_nr >= 0 && bit_nr < 8) { - if (value) { - *byte = *byte | (0x01 << bit_nr); - } else { - *byte = *byte & ~(0x01 << bit_nr); - } - } -} - -int -ldns_hexdigit_to_int(char ch) -{ - switch (ch) { - case '0': return 0; - case '1': return 1; - case '2': return 2; - case '3': return 3; - case '4': return 4; - case '5': return 5; - case '6': return 6; - case '7': return 7; - case '8': return 8; - case '9': return 9; - case 'a': case 'A': return 10; - case 'b': case 'B': return 11; - case 'c': case 'C': return 12; - case 'd': case 'D': return 13; - case 'e': case 'E': return 14; - case 'f': case 'F': return 15; - default: - return -1; - } -} - -char -ldns_int_to_hexdigit(int i) -{ - switch (i) { - case 0: return '0'; - case 1: return '1'; - case 2: return '2'; - case 3: return '3'; - case 4: return '4'; - case 5: return '5'; - case 6: return '6'; - case 7: return '7'; - case 8: return '8'; - case 9: return '9'; - case 10: return 'a'; - case 11: return 'b'; - case 12: return 'c'; - case 13: return 'd'; - case 14: return 'e'; - case 15: return 'f'; - default: - abort(); - } -} - -int -ldns_hexstring_to_data(uint8_t *data, const char *str) -{ - size_t i; - - if (!str || !data) { - return -1; - } - - if (strlen(str) % 2 != 0) { - return -2; - } - - for (i = 0; i < strlen(str) / 2; i++) { - data[i] = - 16 * (uint8_t) ldns_hexdigit_to_int(str[i*2]) + - (uint8_t) ldns_hexdigit_to_int(str[i*2 + 1]); - } - - return (int) i; -} - -const char * -ldns_version(void) -{ - return (char*)LDNS_VERSION; -} - -/* Number of days per month (except for February in leap years). */ -static const int mdays[] = { - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - -static int -is_leap_year(int year) -{ - return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); -} - -static int -leap_days(int y1, int y2) -{ - --y1; - --y2; - return (y2/4 - y1/4) - (y2/100 - y1/100) + (y2/400 - y1/400); -} - -/* - * Code adapted from Python 2.4.1 sources (Lib/calendar.py). - */ -time_t -mktime_from_utc(const struct tm *tm) -{ - int year = 1900 + tm->tm_year; - time_t days = 365 * ((time_t) year - 1970) + leap_days(1970, year); - time_t hours; - time_t minutes; - time_t seconds; - int i; - - for (i = 0; i < tm->tm_mon; ++i) { - days += mdays[i]; - } - if (tm->tm_mon > 1 && is_leap_year(year)) { - ++days; - } - days += tm->tm_mday - 1; - - hours = days * 24 + tm->tm_hour; - minutes = hours * 60 + tm->tm_min; - seconds = minutes * 60 + tm->tm_sec; - - return seconds; -} - -/** - * Init the random source - * applications should call this if they need entropy data within ldns - * If openSSL is available, it is automatically seeded from /dev/urandom - * or /dev/random - * - * If you need more entropy, or have no openssl available, this function - * MUST be called at the start of the program - * - * If openssl *is* available, this function just adds more entropy - **/ -int -ldns_init_random(FILE *fd, unsigned int size) -{ - /* if fp is given, seed srandom with data from file - otherwise use /dev/urandom */ - FILE *rand_f; - uint8_t *seed; - size_t read = 0; - unsigned int seed_i; - struct timeval tv; - - /* we'll need at least sizeof(unsigned int) bytes for the - standard prng seed */ - if (size < (unsigned int) sizeof(seed_i)){ - size = (unsigned int) sizeof(seed_i); - } - - seed = LDNS_XMALLOC(uint8_t, size); - if(!seed) { - return 1; - } - - if (!fd) { - if ((rand_f = fopen("/dev/urandom", "r")) == NULL) { - /* no readable /dev/urandom, try /dev/random */ - if ((rand_f = fopen("/dev/random", "r")) == NULL) { - /* no readable /dev/random either, and no entropy - source given. we'll have to improvise */ - for (read = 0; read < size; read++) { - gettimeofday(&tv, NULL); - seed[read] = (uint8_t) (tv.tv_usec % 256); - } - } else { - read = fread(seed, 1, size, rand_f); - } - } else { - read = fread(seed, 1, size, rand_f); - } - } else { - rand_f = fd; - read = fread(seed, 1, size, rand_f); - } - - if (read < size) { - LDNS_FREE(seed); - return 1; - } else { -#ifdef HAVE_SSL - /* Seed the OpenSSL prng (most systems have it seeded - automatically, in that case this call just adds entropy */ - RAND_seed(seed, (int) size); -#else - /* Seed the standard prng, only uses the first - * unsigned sizeof(unsiged int) bytes found in the entropy pool - */ - memcpy(&seed_i, seed, sizeof(seed_i)); - srandom(seed_i); -#endif - LDNS_FREE(seed); - } - - if (!fd) { - if (rand_f) fclose(rand_f); - } - - return 0; -} - -/** - * Get random number. - * - */ -uint16_t -ldns_get_random(void) -{ - uint16_t rid = 0; -#ifdef HAVE_SSL - if (RAND_bytes((unsigned char*)&rid, 2) != 1) { - rid = (uint16_t) random(); - } -#else - rid = (uint16_t) random(); -#endif - return rid; -} - -/* - * BubbleBabble code taken from OpenSSH - * Copyright (c) 2001 Carsten Raskgaard. All rights reserved. - */ -char * -ldns_bubblebabble(uint8_t *data, size_t len) -{ - char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' }; - char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', - 'n', 'p', 'r', 's', 't', 'v', 'z', 'x' }; - size_t i, j = 0, rounds, seed = 1; - char *retval; - - rounds = (len / 2) + 1; - retval = LDNS_XMALLOC(char, rounds * 6); - if(!retval) return NULL; - retval[j++] = 'x'; - for (i = 0; i < rounds; i++) { - size_t idx0, idx1, idx2, idx3, idx4; - if ((i + 1 < rounds) || (len % 2 != 0)) { - idx0 = (((((size_t)(data[2 * i])) >> 6) & 3) + - seed) % 6; - idx1 = (((size_t)(data[2 * i])) >> 2) & 15; - idx2 = ((((size_t)(data[2 * i])) & 3) + - (seed / 6)) % 6; - retval[j++] = vowels[idx0]; - retval[j++] = consonants[idx1]; - retval[j++] = vowels[idx2]; - if ((i + 1) < rounds) { - idx3 = (((size_t)(data[(2 * i) + 1])) >> 4) & 15; - idx4 = (((size_t)(data[(2 * i) + 1]))) & 15; - retval[j++] = consonants[idx3]; - retval[j++] = '-'; - retval[j++] = consonants[idx4]; - seed = ((seed * 5) + - ((((size_t)(data[2 * i])) * 7) + - ((size_t)(data[(2 * i) + 1])))) % 36; - } - } else { - idx0 = seed % 6; - idx1 = 16; - idx2 = seed / 6; - retval[j++] = vowels[idx0]; - retval[j++] = consonants[idx1]; - retval[j++] = vowels[idx2]; - } - } - retval[j++] = 'x'; - retval[j++] = '\0'; - return retval; -} diff --git a/libs/ldns/util.h b/libs/ldns/util.h deleted file mode 100644 index 8ce850a33d..0000000000 --- a/libs/ldns/util.h +++ /dev/null @@ -1,347 +0,0 @@ -/* - * util.h - * - * helper function header file - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004 - * - * See the file LICENSE for the license - */ - -#ifndef _UTIL_H -#define _UTIL_H - -#include -#include -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define dprintf(X,Y) fprintf(stderr, (X), (Y)) -/* #define dprintf(X, Y) */ - -#define LDNS_VERSION "1.6.9" -#define LDNS_REVISION ((1<<16)|(6<<8)|(9)) - -/** - * splint static inline workaround - */ -#ifdef S_SPLINT_S -# define INLINE -#else -# ifdef SWIG -# define INLINE static -# else -# define INLINE static inline -# endif -#endif - -/** - * Memory management macros - */ -#define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1) - -#define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type))) - -#define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1) - -#define LDNS_XREALLOC(ptr, type, count) \ - ((type *) realloc((ptr), (count) * sizeof(type))) - -#define LDNS_FREE(ptr) \ - do { free((ptr)); (ptr) = NULL; } while (0) - -#define LDNS_DEP printf("DEPRECATED FUNCTION!\n"); - -/* - * Copy data allowing for unaligned accesses in network byte order - * (big endian). - */ -INLINE uint16_t -ldns_read_uint16(const void *src) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - return ntohs(*(uint16_t *) src); -#else - uint8_t *p = (uint8_t *) src; - return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; -#endif -} - -INLINE uint32_t -ldns_read_uint32(const void *src) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - return ntohl(*(uint32_t *) src); -#else - uint8_t *p = (uint8_t *) src; - return ( ((uint32_t) p[0] << 24) - | ((uint32_t) p[1] << 16) - | ((uint32_t) p[2] << 8) - | (uint32_t) p[3]); -#endif -} - -/* - * Copy data allowing for unaligned accesses in network byte order - * (big endian). - */ -INLINE void -ldns_write_uint16(void *dst, uint16_t data) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - * (uint16_t *) dst = htons(data); -#else - uint8_t *p = (uint8_t *) dst; - p[0] = (uint8_t) ((data >> 8) & 0xff); - p[1] = (uint8_t) (data & 0xff); -#endif -} - -INLINE void -ldns_write_uint32(void *dst, uint32_t data) -{ -#ifdef ALLOW_UNALIGNED_ACCESSES - * (uint32_t *) dst = htonl(data); -#else - uint8_t *p = (uint8_t *) dst; - p[0] = (uint8_t) ((data >> 24) & 0xff); - p[1] = (uint8_t) ((data >> 16) & 0xff); - p[2] = (uint8_t) ((data >> 8) & 0xff); - p[3] = (uint8_t) (data & 0xff); -#endif -} - -/* warning. */ -INLINE void -ldns_write_uint64_as_uint48(void *dst, uint64_t data) -{ - uint8_t *p = (uint8_t *) dst; - p[0] = (uint8_t) ((data >> 40) & 0xff); - p[1] = (uint8_t) ((data >> 32) & 0xff); - p[2] = (uint8_t) ((data >> 24) & 0xff); - p[3] = (uint8_t) ((data >> 16) & 0xff); - p[4] = (uint8_t) ((data >> 8) & 0xff); - p[5] = (uint8_t) (data & 0xff); -} - - -/** - * Structure to do a Schwartzian-like transformation, for instance when - * sorting. If you need a transformation on the objects that are sorted, - * you can sue this to store the transformed values, so you do not - * need to do the transformation again for each comparison - */ -struct ldns_schwartzian_compare_struct { - void *original_object; - void *transformed_object; -}; - -/** A general purpose lookup table - * - * Lookup tables are arrays of (id, name) pairs, - * So you can for instance lookup the RCODE 3, which is "NXDOMAIN", - * and vice versa. The lookup tables themselves are defined wherever needed, - * for instance in \ref host2str.c - */ -struct ldns_struct_lookup_table { - int id; - const char *name; -}; -typedef struct ldns_struct_lookup_table ldns_lookup_table; - -/** - * Looks up the table entry by name, returns NULL if not found. - * \param[in] table the lookup table to search in - * \param[in] name what to search for - * \return the item found - */ -ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[], - const char *name); - -/** - * Looks up the table entry by id, returns NULL if not found. - * \param[in] table the lookup table to search in - * \param[in] id what to search for - * \return the item found - */ -ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id); - -/** - * Returns the value of the specified bit - * The bits are counted from left to right, so bit #0 is the - * left most bit. - * \param[in] bits array holding the bits - * \param[in] index to the wanted bit - * \return - */ -int ldns_get_bit(uint8_t bits[], size_t index); - - -/** - * Returns the value of the specified bit - * The bits are counted from right to left, so bit #0 is the - * right most bit. - * \param[in] bits array holding the bits - * \param[in] index to the wanted bit - * \return 1 or 0 depending no the bit state - */ -int ldns_get_bit_r(uint8_t bits[], size_t index); - -/** - * sets the specified bit in the specified byte to - * 1 if value is true, 0 if false - * The bits are counted from right to left, so bit #0 is the - * right most bit. - * \param[in] byte the bit to set the bit in - * \param[in] bit_nr the bit to set (0 <= n <= 7) - * \param[in] value whether to set the bit to 1 or 0 - * \return 1 or 0 depending no the bit state - */ -void ldns_set_bit(uint8_t *byte, int bit_nr, bool value); - -/** - * Returns the value of a to the power of b - * (or 1 of b < 1) - */ -/*@unused@*/ -INLINE long -ldns_power(long a, long b) { - long result = 1; - while (b > 0) { - if (b & 1) { - result *= a; - if (b == 1) { - return result; - } - } - a *= a; - b /= 2; - } - return result; -} - -/** - * Returns the int value of the given (hex) digit - * \param[in] ch the hex char to convert - * \return the converted decimal value - */ -int ldns_hexdigit_to_int(char ch); - -/** - * Returns the char (hex) representation of the given int - * \param[in] ch the int to convert - * \return the converted hex char - */ -char ldns_int_to_hexdigit(int ch); - -/** - * Converts a hex string to binary data - * - * \param[out] data The binary result is placed here. - * At least strlen(str)/2 bytes should be allocated - * \param[in] str The hex string to convert. - * This string should not contain spaces - * \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number - */ -int -ldns_hexstring_to_data(uint8_t *data, const char *str); - -/** - * Show the internal library version - * \return a string with the version in it - */ -const char * ldns_version(void); - -/** - * Convert TM to seconds since epoch (midnight, January 1st, 1970). - * Like timegm(3), which is not always available. - * \param[in] tm a struct tm* with the date - * \return the seconds since epoch - */ -time_t mktime_from_utc(const struct tm *tm); - -/** - * Seed the random function. - * If the file descriptor is specified, the random generator is seeded with - * data from that file. If not, /dev/urandom is used. - * - * applications should call this if they need entropy data within ldns - * If openSSL is available, it is automatically seeded from /dev/urandom - * or /dev/random. - * - * If you need more entropy, or have no openssl available, this function - * MUST be called at the start of the program - * - * If openssl *is* available, this function just adds more entropy - * - * \param[in] fd a file providing entropy data for the seed - * \param[in] size the number of bytes to use as entropy data. If this is 0, - * only the minimal amount is taken (usually 4 bytes) - * \return 0 if seeding succeeds, 1 if it fails - */ -int ldns_init_random(FILE *fd, unsigned int size); - -/** - * Get random number. - * \return random number. - * - */ -uint16_t ldns_get_random(void); - -/** - * Encode data as BubbleBabble - * - * \param[in] data a pointer to data to be encoded - * \param[in] len size the number of bytes of data - * \return a string of BubbleBabble - */ -char *ldns_bubblebabble(uint8_t *data, size_t len); - -#ifndef B32_NTOP -int ldns_b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, - char *target, size_t targsize); -/** - * calculates the size needed to store the result of b32_ntop - */ -/*@unused@*/ -INLINE size_t ldns_b32_ntop_calculate_size(size_t srcsize) -{ - size_t result = ((((srcsize / 5) * 8) - 2) + 2); - return result; -} -#endif /* !B32_NTOP */ -#ifndef B32_PTON -int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); -/** - * calculates the size needed to store the result of b32_pton - */ -/*@unused@*/ -INLINE size_t ldns_b32_pton_calculate_size(size_t srcsize) -{ - size_t result = ((((srcsize) / 8) * 5)); - return result; -} -#endif /* !B32_PTON */ - -#ifdef __cplusplus -} -#endif - -#endif /* !_UTIL_H */ diff --git a/libs/ldns/version b/libs/ldns/version deleted file mode 100644 index 15d45d4b47..0000000000 --- a/libs/ldns/version +++ /dev/null @@ -1 +0,0 @@ -1.6.9 diff --git a/libs/ldns/wire2host.c b/libs/ldns/wire2host.c deleted file mode 100644 index e87fcdf5df..0000000000 --- a/libs/ldns/wire2host.c +++ /dev/null @@ -1,456 +0,0 @@ -/* - * wire2host.c - * - * conversion routines from the wire to the host - * format. - * This will usually just a re-ordering of the - * data (as we store it in network format) - * - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2004-2006 - * - * See the file LICENSE for the license - */ - - -#include - -#include -/*#include */ - -#include -#include - - - -/* - * Set of macro's to deal with the dns message header as specified - * in RFC1035 in portable way. - * - */ - -/* - * - * 1 1 1 1 1 1 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | ID | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * |QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | QDCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | ANCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | NSCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * | ARCOUNT | - * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ - * - */ - - -/* allocates memory to *dname! */ -ldns_status -ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos) -{ - uint8_t label_size; - uint16_t pointer_target; - uint8_t pointer_target_buf[2]; - size_t dname_pos = 0; - size_t uncompressed_length = 0; - size_t compression_pos = 0; - uint8_t tmp_dname[LDNS_MAX_DOMAINLEN]; - unsigned int pointer_count = 0; - - if (*pos >= max) { - return LDNS_STATUS_PACKET_OVERFLOW; - } - - label_size = wire[*pos]; - while (label_size > 0) { - /* compression */ - while (label_size >= 192) { - if (compression_pos == 0) { - compression_pos = *pos + 2; - } - - pointer_count++; - - /* remove first two bits */ - if (*pos + 2 > max) { - return LDNS_STATUS_PACKET_OVERFLOW; - } - pointer_target_buf[0] = wire[*pos] & 63; - pointer_target_buf[1] = wire[*pos + 1]; - pointer_target = ldns_read_uint16(pointer_target_buf); - - if (pointer_target == 0) { - return LDNS_STATUS_INVALID_POINTER; - } else if (pointer_target >= max) { - return LDNS_STATUS_INVALID_POINTER; - } else if (pointer_count > LDNS_MAX_POINTERS) { - return LDNS_STATUS_INVALID_POINTER; - } - *pos = pointer_target; - label_size = wire[*pos]; - } - if(label_size == 0) - break; /* break from pointer to 0 byte */ - if (label_size > LDNS_MAX_LABELLEN) { - return LDNS_STATUS_LABEL_OVERFLOW; - } - if (*pos + 1 + label_size > max) { - return LDNS_STATUS_LABEL_OVERFLOW; - } - - /* check space for labelcount itself */ - if (dname_pos + 1 > LDNS_MAX_DOMAINLEN) { - return LDNS_STATUS_DOMAINNAME_OVERFLOW; - } - tmp_dname[dname_pos] = label_size; - if (label_size > 0) { - dname_pos++; - } - *pos = *pos + 1; - if (dname_pos + label_size > LDNS_MAX_DOMAINLEN) { - return LDNS_STATUS_DOMAINNAME_OVERFLOW; - } - memcpy(&tmp_dname[dname_pos], &wire[*pos], label_size); - uncompressed_length += label_size + 1; - dname_pos += label_size; - *pos = *pos + label_size; - - if (*pos < max) { - label_size = wire[*pos]; - } - } - - if (compression_pos > 0) { - *pos = compression_pos; - } else { - *pos = *pos + 1; - } - - if (dname_pos >= LDNS_MAX_DOMAINLEN) { - return LDNS_STATUS_DOMAINNAME_OVERFLOW; - } - - tmp_dname[dname_pos] = 0; - dname_pos++; - - *dname = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, - (uint16_t) dname_pos, tmp_dname); - if (!*dname) { - return LDNS_STATUS_MEM_ERR; - } - return LDNS_STATUS_OK; -} - -/* maybe make this a goto error so data can be freed or something/ */ -#define LDNS_STATUS_CHECK_RETURN(st) {if (st != LDNS_STATUS_OK) { return st; }} -#define LDNS_STATUS_CHECK_GOTO(st, label) {if (st != LDNS_STATUS_OK) { /*printf("STG %s:%d: status code %d\n", __FILE__, __LINE__, st);*/ goto label; }} - -ldns_status -ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) -{ - size_t end; - size_t cur_rdf_length; - uint8_t rdf_index; - uint8_t *data; - uint16_t rd_length; - ldns_rdf *cur_rdf = NULL; - ldns_rdf_type cur_rdf_type; - const ldns_rr_descriptor *descriptor = ldns_rr_descript(ldns_rr_get_type(rr)); - ldns_status status; - - if (*pos + 2 > max) { - return LDNS_STATUS_PACKET_OVERFLOW; - } - - rd_length = ldns_read_uint16(&wire[*pos]); - *pos = *pos + 2; - - if (*pos + rd_length > max) { - return LDNS_STATUS_PACKET_OVERFLOW; - } - - end = *pos + (size_t) rd_length; - - for (rdf_index = 0; - rdf_index < ldns_rr_descriptor_maximum(descriptor); rdf_index++) { - if (*pos >= end) { - break; - } - cur_rdf_length = 0; - - cur_rdf_type = ldns_rr_descriptor_field_type(descriptor, rdf_index); - /* handle special cases immediately, set length - for fixed length rdata and do them below */ - switch (cur_rdf_type) { - case LDNS_RDF_TYPE_DNAME: - status = ldns_wire2dname(&cur_rdf, wire, max, pos); - LDNS_STATUS_CHECK_RETURN(status); - break; - case LDNS_RDF_TYPE_CLASS: - case LDNS_RDF_TYPE_ALG: - case LDNS_RDF_TYPE_INT8: - cur_rdf_length = LDNS_RDF_SIZE_BYTE; - break; - case LDNS_RDF_TYPE_TYPE: - case LDNS_RDF_TYPE_INT16: - case LDNS_RDF_TYPE_CERT_ALG: - cur_rdf_length = LDNS_RDF_SIZE_WORD; - break; - case LDNS_RDF_TYPE_TIME: - case LDNS_RDF_TYPE_INT32: - case LDNS_RDF_TYPE_A: - case LDNS_RDF_TYPE_PERIOD: - cur_rdf_length = LDNS_RDF_SIZE_DOUBLEWORD; - break; - case LDNS_RDF_TYPE_TSIGTIME: - cur_rdf_length = LDNS_RDF_SIZE_6BYTES; - break; - case LDNS_RDF_TYPE_AAAA: - cur_rdf_length = LDNS_RDF_SIZE_16BYTES; - break; - case LDNS_RDF_TYPE_STR: - case LDNS_RDF_TYPE_NSEC3_SALT: - /* len is stored in first byte - * it should be in the rdf too, so just - * copy len+1 from this position - */ - cur_rdf_length = ((size_t) wire[*pos]) + 1; - break; - case LDNS_RDF_TYPE_INT16_DATA: - cur_rdf_length = (size_t) ldns_read_uint16(&wire[*pos]) + 2; - break; - case LDNS_RDF_TYPE_B32_EXT: - case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: - /* length is stored in first byte */ - cur_rdf_length = ((size_t) wire[*pos]) + 1; - break; - case LDNS_RDF_TYPE_APL: - case LDNS_RDF_TYPE_B64: - case LDNS_RDF_TYPE_HEX: - case LDNS_RDF_TYPE_NSEC: - case LDNS_RDF_TYPE_UNKNOWN: - case LDNS_RDF_TYPE_SERVICE: - case LDNS_RDF_TYPE_LOC: - case LDNS_RDF_TYPE_WKS: - case LDNS_RDF_TYPE_NSAP: - case LDNS_RDF_TYPE_ATMA: - case LDNS_RDF_TYPE_IPSECKEY: - case LDNS_RDF_TYPE_TSIG: - case LDNS_RDF_TYPE_NONE: - /* - * Read to end of rr rdata - */ - cur_rdf_length = end - *pos; - break; - } - - /* fixed length rdata */ - if (cur_rdf_length > 0) { - if (cur_rdf_length + *pos > end) { - return LDNS_STATUS_PACKET_OVERFLOW; - } - data = LDNS_XMALLOC(uint8_t, rd_length); - if (!data) { - return LDNS_STATUS_MEM_ERR; - } - memcpy(data, &wire[*pos], cur_rdf_length); - - cur_rdf = ldns_rdf_new(cur_rdf_type, cur_rdf_length, data); - *pos = *pos + cur_rdf_length; - } - - if (cur_rdf) { - ldns_rr_push_rdf(rr, cur_rdf); - cur_rdf = NULL; - } - } - - return LDNS_STATUS_OK; -} - - -/* TODO: - can *pos be incremented at READ_INT? or maybe use something like - RR_CLASS(wire)? - uhhm Jelte?? -*/ -ldns_status -ldns_wire2rr(ldns_rr **rr_p, const uint8_t *wire, size_t max, - size_t *pos, ldns_pkt_section section) -{ - ldns_rdf *owner = NULL; - ldns_rr *rr = ldns_rr_new(); - ldns_status status; - - status = ldns_wire2dname(&owner, wire, max, pos); - LDNS_STATUS_CHECK_GOTO(status, status_error); - - ldns_rr_set_owner(rr, owner); - - if (*pos + 4 > max) { - status = LDNS_STATUS_PACKET_OVERFLOW; - goto status_error; - } - - ldns_rr_set_type(rr, ldns_read_uint16(&wire[*pos])); - *pos = *pos + 2; - - ldns_rr_set_class(rr, ldns_read_uint16(&wire[*pos])); - *pos = *pos + 2; - - if (section != LDNS_SECTION_QUESTION) { - if (*pos + 4 > max) { - status = LDNS_STATUS_PACKET_OVERFLOW; - goto status_error; - } - ldns_rr_set_ttl(rr, ldns_read_uint32(&wire[*pos])); - - *pos = *pos + 4; - status = ldns_wire2rdf(rr, wire, max, pos); - - LDNS_STATUS_CHECK_GOTO(status, status_error); - ldns_rr_set_question(rr, false); - } else { - ldns_rr_set_question(rr, true); - } - - *rr_p = rr; - return LDNS_STATUS_OK; - -status_error: - ldns_rr_free(rr); - return status; -} - -static ldns_status -ldns_wire2pkt_hdr(ldns_pkt *packet, const uint8_t *wire, size_t max, size_t *pos) -{ - if (*pos + LDNS_HEADER_SIZE > max) { - return LDNS_STATUS_WIRE_INCOMPLETE_HEADER; - } else { - ldns_pkt_set_id(packet, LDNS_ID_WIRE(wire)); - ldns_pkt_set_qr(packet, LDNS_QR_WIRE(wire)); - ldns_pkt_set_opcode(packet, LDNS_OPCODE_WIRE(wire)); - ldns_pkt_set_aa(packet, LDNS_AA_WIRE(wire)); - ldns_pkt_set_tc(packet, LDNS_TC_WIRE(wire)); - ldns_pkt_set_rd(packet, LDNS_RD_WIRE(wire)); - ldns_pkt_set_ra(packet, LDNS_RA_WIRE(wire)); - ldns_pkt_set_ad(packet, LDNS_AD_WIRE(wire)); - ldns_pkt_set_cd(packet, LDNS_CD_WIRE(wire)); - ldns_pkt_set_rcode(packet, LDNS_RCODE_WIRE(wire)); - - ldns_pkt_set_qdcount(packet, LDNS_QDCOUNT(wire)); - ldns_pkt_set_ancount(packet, LDNS_ANCOUNT(wire)); - ldns_pkt_set_nscount(packet, LDNS_NSCOUNT(wire)); - ldns_pkt_set_arcount(packet, LDNS_ARCOUNT(wire)); - - *pos += LDNS_HEADER_SIZE; - - return LDNS_STATUS_OK; - } -} - -ldns_status -ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer) -{ - /* lazy */ - return ldns_wire2pkt(packet, ldns_buffer_begin(buffer), - ldns_buffer_limit(buffer)); - -} - -ldns_status -ldns_wire2pkt(ldns_pkt **packet_p, const uint8_t *wire, size_t max) -{ - size_t pos = 0; - uint16_t i; - ldns_rr *rr; - ldns_pkt *packet = ldns_pkt_new(); - ldns_status status = LDNS_STATUS_OK; - int have_edns = 0; - - uint8_t data[4]; - - status = ldns_wire2pkt_hdr(packet, wire, max, &pos); - LDNS_STATUS_CHECK_GOTO(status, status_error); - - for (i = 0; i < ldns_pkt_qdcount(packet); i++) { - - status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_QUESTION); - if (status == LDNS_STATUS_PACKET_OVERFLOW) { - status = LDNS_STATUS_WIRE_INCOMPLETE_QUESTION; - } - LDNS_STATUS_CHECK_GOTO(status, status_error); - if (!ldns_rr_list_push_rr(ldns_pkt_question(packet), rr)) { - ldns_pkt_free(packet); - return LDNS_STATUS_INTERNAL_ERR; - } - } - for (i = 0; i < ldns_pkt_ancount(packet); i++) { - status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_ANSWER); - if (status == LDNS_STATUS_PACKET_OVERFLOW) { - status = LDNS_STATUS_WIRE_INCOMPLETE_ANSWER; - } - LDNS_STATUS_CHECK_GOTO(status, status_error); - if (!ldns_rr_list_push_rr(ldns_pkt_answer(packet), rr)) { - ldns_pkt_free(packet); - return LDNS_STATUS_INTERNAL_ERR; - } - } - for (i = 0; i < ldns_pkt_nscount(packet); i++) { - status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_AUTHORITY); - if (status == LDNS_STATUS_PACKET_OVERFLOW) { - status = LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY; - } - LDNS_STATUS_CHECK_GOTO(status, status_error); - if (!ldns_rr_list_push_rr(ldns_pkt_authority(packet), rr)) { - ldns_pkt_free(packet); - return LDNS_STATUS_INTERNAL_ERR; - } - } - for (i = 0; i < ldns_pkt_arcount(packet); i++) { - status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_ADDITIONAL); - if (status == LDNS_STATUS_PACKET_OVERFLOW) { - status = LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL; - } - LDNS_STATUS_CHECK_GOTO(status, status_error); - - if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_OPT) { - ldns_pkt_set_edns_udp_size(packet, ldns_rr_get_class(rr)); - ldns_write_uint32(data, ldns_rr_ttl(rr)); - ldns_pkt_set_edns_extended_rcode(packet, data[0]); - ldns_pkt_set_edns_version(packet, data[1]); - ldns_pkt_set_edns_z(packet, ldns_read_uint16(&data[2])); - /* edns might not have rdfs */ - if (ldns_rr_rdf(rr, 0)) { - ldns_pkt_set_edns_data(packet, ldns_rdf_clone(ldns_rr_rdf(rr, 0))); - } - ldns_rr_free(rr); - have_edns += 1; - } else if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_TSIG) { - ldns_pkt_set_tsig(packet, rr); - ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) - 1); - } else if (!ldns_rr_list_push_rr(ldns_pkt_additional(packet), rr)) { - ldns_pkt_free(packet); - return LDNS_STATUS_INTERNAL_ERR; - } - } - ldns_pkt_set_size(packet, max); - if(have_edns) - ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) - - have_edns); - - *packet_p = packet; - return status; - -status_error: - ldns_pkt_free(packet); - return status; -} diff --git a/libs/ldns/zone.c b/libs/ldns/zone.c deleted file mode 100644 index 917af8befc..0000000000 --- a/libs/ldns/zone.c +++ /dev/null @@ -1,430 +0,0 @@ -/* zone.c - * - * Functions for ldns_zone structure - * a Net::DNS like library for C - * - * (c) NLnet Labs, 2005-2006 - * See the file LICENSE for the license - */ -#include - -#include - -#include -#include - -ldns_rr * -ldns_zone_soa(const ldns_zone *z) -{ - return z->_soa; -} - -size_t -ldns_zone_rr_count(const ldns_zone *z) -{ - return ldns_rr_list_rr_count(z->_rrs); -} - -void -ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa) -{ - z->_soa = soa; -} - -ldns_rr_list * -ldns_zone_rrs(const ldns_zone *z) -{ - return z->_rrs; -} - -void -ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist) -{ - z->_rrs = rrlist; -} - -bool -ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list) -{ - return ldns_rr_list_cat(ldns_zone_rrs(z), list); - -} - -bool -ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr) -{ - return ldns_rr_list_push_rr( ldns_zone_rrs(z), rr); -} - -/* return a clone of the given rr list, without the glue records - * rr list should be the complete zone - * if present, stripped records are added to the list *glue_records - */ -ldns_rr_list * -ldns_zone_strip_glue_rrs(const ldns_rdf *zone_name, const ldns_rr_list *rrs, ldns_rr_list *glue_rrs) -{ - ldns_rr_list *new_list; - - /* when do we find glue? It means we find an IP address - * (AAAA/A) for a nameserver listed in the zone - * - * Alg used here: - * first find all the zonecuts (NS records) - * find all the AAAA or A records (can be done it the - * above loop). - * - * Check if the aaaa/a list are subdomains under the - * NS domains. - * If yes -> glue, if no -> not glue - */ - - ldns_rr_list *zone_cuts; - ldns_rr_list *addr; - ldns_rr *r, *ns, *a; - ldns_rdf *dname_a, *ns_owner; - uint16_t i,j; - - new_list = NULL; - zone_cuts = NULL; - addr = NULL; - - new_list = ldns_rr_list_new(); - if (!new_list) goto memory_error; - zone_cuts = ldns_rr_list_new(); - if (!zone_cuts) goto memory_error; - addr = ldns_rr_list_new(); - if (!addr) goto memory_error; - - for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { - r = ldns_rr_list_rr(rrs, i); - if (ldns_rr_get_type(r) == LDNS_RR_TYPE_A || - ldns_rr_get_type(r) == LDNS_RR_TYPE_AAAA) { - /* possibly glue */ - if (!ldns_rr_list_push_rr(addr, r)) goto memory_error; - continue; - } - if (ldns_rr_get_type(r) == LDNS_RR_TYPE_NS) { - /* multiple zones will end up here - - * for now; not a problem - */ - /* don't add NS records for the current zone itself */ - if (ldns_rdf_compare(ldns_rr_owner(r), - zone_name) != 0) { - if (!ldns_rr_list_push_rr(zone_cuts, r)) goto memory_error; - } - continue; - } - } - - /* will sorting make it quicker ?? */ - for(i = 0; i < ldns_rr_list_rr_count(zone_cuts); i++) { - ns = ldns_rr_list_rr(zone_cuts, i); - ns_owner = ldns_rr_owner(ns); - for(j = 0; j < ldns_rr_list_rr_count(addr); j++) { - a = ldns_rr_list_rr(addr, j); - dname_a = ldns_rr_owner(a); - - if (ldns_dname_is_subdomain(dname_a, ns_owner)) { - /* GLUE! */ - if (glue_rrs) { - if (!ldns_rr_list_push_rr(glue_rrs, a)) goto memory_error; - } - break; - } else { - if (!ldns_rr_list_push_rr(new_list, a)) goto memory_error; - } - } - } - - ldns_rr_list_free(addr); - ldns_rr_list_free(zone_cuts); - - return new_list; - -memory_error: - if (new_list) { - ldns_rr_list_free(new_list); - } - if (zone_cuts) { - ldns_rr_list_free(zone_cuts); - } - if (addr) { - ldns_rr_list_free(addr); - } - return NULL; -} - -/* - * Get the list of glue records in a zone - * XXX: there should be a way for this to return error, other than NULL, - * since NULL is a valid return - */ -ldns_rr_list * -ldns_zone_glue_rr_list(const ldns_zone *z) -{ - /* when do we find glue? It means we find an IP address - * (AAAA/A) for a nameserver listed in the zone - * - * Alg used here: - * first find all the zonecuts (NS records) - * find all the AAAA or A records (can be done it the - * above loop). - * - * Check if the aaaa/a list are subdomains under the - * NS domains. - * If yes -> glue, if no -> not glue - */ - - ldns_rr_list *zone_cuts; - ldns_rr_list *addr; - ldns_rr_list *glue; - ldns_rr *r, *ns, *a; - ldns_rdf *dname_a, *ns_owner; - size_t i,j; - - zone_cuts = NULL; - addr = NULL; - glue = NULL; - - /* we cannot determine glue in a 'zone' without a SOA */ - if (!ldns_zone_soa(z)) { - return NULL; - } - - zone_cuts = ldns_rr_list_new(); - if (!zone_cuts) goto memory_error; - addr = ldns_rr_list_new(); - if (!addr) goto memory_error; - glue = ldns_rr_list_new(); - if (!glue) goto memory_error; - - for(i = 0; i < ldns_zone_rr_count(z); i++) { - r = ldns_rr_list_rr(ldns_zone_rrs(z), i); - if (ldns_rr_get_type(r) == LDNS_RR_TYPE_A || - ldns_rr_get_type(r) == LDNS_RR_TYPE_AAAA) { - /* possibly glue */ - if (!ldns_rr_list_push_rr(addr, r)) goto memory_error; - continue; - } - if (ldns_rr_get_type(r) == LDNS_RR_TYPE_NS) { - /* multiple zones will end up here - - * for now; not a problem - */ - /* don't add NS records for the current zone itself */ - if (ldns_rdf_compare(ldns_rr_owner(r), - ldns_rr_owner(ldns_zone_soa(z))) != 0) { - if (!ldns_rr_list_push_rr(zone_cuts, r)) goto memory_error; - } - continue; - } - } - - /* will sorting make it quicker ?? */ - for(i = 0; i < ldns_rr_list_rr_count(zone_cuts); i++) { - ns = ldns_rr_list_rr(zone_cuts, i); - ns_owner = ldns_rr_owner(ns); - - for(j = 0; j < ldns_rr_list_rr_count(addr); j++) { - a = ldns_rr_list_rr(addr, j); - dname_a = ldns_rr_owner(a); - - if (ldns_dname_is_subdomain(dname_a, ns_owner)) { - /* GLUE! */ - if (!ldns_rr_list_push_rr(glue, a)) goto memory_error; - } - } - } - - ldns_rr_list_free(addr); - ldns_rr_list_free(zone_cuts); - - if (ldns_rr_list_rr_count(glue) == 0) { - ldns_rr_list_free(glue); - return NULL; - } else { - return glue; - } - -memory_error: - if (zone_cuts) { - LDNS_FREE(zone_cuts); - } - if (addr) { - ldns_rr_list_free(addr); - } - if (glue) { - ldns_rr_list_free(glue); - } - return NULL; -} - -ldns_zone * -ldns_zone_new(void) -{ - ldns_zone *z; - - z = LDNS_MALLOC(ldns_zone); - if (!z) { - return NULL; - } - - z->_rrs = ldns_rr_list_new(); - if (!z->_rrs) { - LDNS_FREE(z); - return NULL; - } - ldns_zone_set_soa(z, NULL); - return z; -} - -/* we regocnize: - * $TTL, $ORIGIN - */ -ldns_status -ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c) -{ - return ldns_zone_new_frm_fp_l(z, fp, origin, ttl, c, NULL); -} - -/* XXX: class is never used */ -ldns_status -ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, - ldns_rr_class ATTR_UNUSED(c), int *line_nr) -{ - ldns_zone *newzone; - ldns_rr *rr; - uint32_t my_ttl; - ldns_rdf *my_origin; - ldns_rdf *my_prev; - bool soa_seen = false; /* 2 soa are an error */ - ldns_status s; - ldns_status ret; - - /* most cases of error are memory problems */ - ret = LDNS_STATUS_MEM_ERR; - - newzone = NULL; - my_origin = NULL; - my_prev = NULL; - - my_ttl = ttl; - - if (origin) { - my_origin = ldns_rdf_clone(origin); - if (!my_origin) goto error; - /* also set the prev */ - my_prev = ldns_rdf_clone(origin); - if (!my_prev) goto error; - } - - newzone = ldns_zone_new(); - if (!newzone) goto error; - - while(!feof(fp)) { - s = ldns_rr_new_frm_fp_l(&rr, fp, &my_ttl, &my_origin, &my_prev, line_nr); - switch (s) { - case LDNS_STATUS_OK: - if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { - if (soa_seen) { - /* second SOA - * just skip, maybe we want to say - * something??? */ - ldns_rr_free(rr); - continue; - } - soa_seen = true; - ldns_zone_set_soa(newzone, rr); - /* set origin to soa if not specified */ - if (!my_origin) { - my_origin = ldns_rdf_clone(ldns_rr_owner(rr)); - } - continue; - } - - /* a normal RR - as sofar the DNS is normal */ - if (!ldns_zone_push_rr(newzone, rr)) goto error; - - case LDNS_STATUS_SYNTAX_EMPTY: - /* empty line was seen */ - case LDNS_STATUS_SYNTAX_TTL: - /* the function set the ttl */ - break; - case LDNS_STATUS_SYNTAX_ORIGIN: - /* the function set the origin */ - break; - case LDNS_STATUS_SYNTAX_INCLUDE: - ret = LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL; - break; - default: - ret = s; - goto error; - } - } - - if (my_origin) { - ldns_rdf_deep_free(my_origin); - } - if (my_prev) { - ldns_rdf_deep_free(my_prev); - } - if (z) { - *z = newzone; - } else { - ldns_zone_free(newzone); - } - - return LDNS_STATUS_OK; - -error: - if (my_origin) { - ldns_rdf_deep_free(my_origin); - } - if (my_prev) { - ldns_rdf_deep_free(my_prev); - } - if (newzone) { - ldns_zone_free(newzone); - } - return ret; -} - -void -ldns_zone_sort(ldns_zone *zone) -{ - ldns_rr_list *zrr; - assert(zone != NULL); - - zrr = ldns_zone_rrs(zone); - ldns_rr_list_sort(zrr); -} - -#if 0 -/** - * ixfr function. Work on a ldns_zone and remove and add - * the rrs from the rrlist - * \param[in] z the zone to work on - * \param[in] del rr_list to remove from the zone - * \param[in] add rr_list to add to the zone - * \return Tja, wat zouden we eens returnen TODO - */ -void -ldns_zone_ixfr_del_add(ldns_zone *z, ldns_rr_list *del, ldns_rr_list *add) -{ - -} -#endif - -void -ldns_zone_free(ldns_zone *zone) -{ - ldns_rr_list_free(zone->_rrs); - LDNS_FREE(zone); -} - -void -ldns_zone_deep_free(ldns_zone *zone) -{ - ldns_rr_free(zone->_soa); - ldns_rr_list_deep_free(zone->_rrs); - LDNS_FREE(zone); -} From d2823173921b13cfff50d51cd920e294eab6a908 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 24 Mar 2011 17:06:59 -0500 Subject: [PATCH 125/558] temporarily remove mod_enum from windows build --- Freeswitch.2008.sln | 8 -------- Freeswitch.2010.sln | 8 -------- 2 files changed, 16 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index e171ffe418..f65dbdae61 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -1608,24 +1608,16 @@ Global {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|x64 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.Build.0 = Release|x64 diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 464cb2e273..93d2c4ace0 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -1480,15 +1480,11 @@ Global {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64 Setup.Build.0 = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x86 Setup.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64 Setup.ActiveCfg = Debug|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64 Setup.ActiveCfg = Release|x64 {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x86 Setup.ActiveCfg = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64 @@ -1498,15 +1494,11 @@ Global {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64 Setup.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x86 Setup.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|x64 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64 Setup.ActiveCfg = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64 - {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64 Setup.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x86 Setup.ActiveCfg = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64 From 017bea0468c40cc1bb95c71793ee995d1635c21a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 17:08:34 -0500 Subject: [PATCH 126/558] FS-3110 --comment-only phase 3 nevermind use getlibs --- src/mod/applications/mod_enum/Makefile.am | 45 ----------------------- 1 file changed, 45 deletions(-) delete mode 100644 src/mod/applications/mod_enum/Makefile.am diff --git a/src/mod/applications/mod_enum/Makefile.am b/src/mod/applications/mod_enum/Makefile.am deleted file mode 100644 index c0bdd11a3a..0000000000 --- a/src/mod/applications/mod_enum/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -include $(top_srcdir)/build/modmake.rulesam -MODNAME=mod_enum - -LDNS_DIR=$(switch_srcdir)/libs/ldns -mod_enum_la_CFLAGS = -I$(LDNS_DIR) -I$(LDNS_DIR)/include -DHAVE_POLL $(AM_CFLAGS) - -mod_LTLIBRARIES = mod_enum.la -mod_enum_la_SOURCES = mod_enum.c - -mod_enum_la_SOURCES += $(LDNS_DIR)/buffer.c\ -$(LDNS_DIR)/dname.c\ -$(LDNS_DIR)/dnssec.c\ -$(LDNS_DIR)/dnssec_sign.c\ -$(LDNS_DIR)/dnssec_verify.c\ -$(LDNS_DIR)/dnssec_zone.c\ -$(LDNS_DIR)/error.c\ -$(LDNS_DIR)/higher.c\ -$(LDNS_DIR)/host2str.c\ -$(LDNS_DIR)/host2wire.c\ -$(LDNS_DIR)/keys.c\ -$(LDNS_DIR)/linktest.c\ -$(LDNS_DIR)/net.c\ -$(LDNS_DIR)/packet.c\ -$(LDNS_DIR)/parse.c\ -$(LDNS_DIR)/rbtree.c\ -$(LDNS_DIR)/rdata.c\ -$(LDNS_DIR)/resolver.c\ -$(LDNS_DIR)/rr.c\ -$(LDNS_DIR)/rr_functions.c\ -$(LDNS_DIR)/sha1.c\ -$(LDNS_DIR)/sha2.c\ -$(LDNS_DIR)/str2host.c\ -$(LDNS_DIR)/tsig.c\ -$(LDNS_DIR)/update.c\ -$(LDNS_DIR)/util.c\ -$(LDNS_DIR)/wire2host.c\ -$(LDNS_DIR)/compat/strlcpy.c\ -$(LDNS_DIR)/compat/b64_pton.c\ -$(LDNS_DIR)/compat/b32_pton.c\ -$(LDNS_DIR)/compat/b64_ntop.c\ -$(LDNS_DIR)/compat/b32_ntop.c\ -$(LDNS_DIR)/zone.c - -mod_enum_la_LIBADD = $(switch_builddir)/libfreeswitch.la -mod_enum_la_LDFLAGS = -avoid-version -module -no-undefined -shared From a25ef8b9aeb341dcac5e7538aa10e5e2549f93b7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 17:12:02 -0500 Subject: [PATCH 127/558] FS-3110 --comment-only phase 3.1 nevermind use getlibs --- src/mod/applications/mod_enum/Makefile | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/mod/applications/mod_enum/Makefile diff --git a/src/mod/applications/mod_enum/Makefile b/src/mod/applications/mod_enum/Makefile new file mode 100644 index 0000000000..789bba9214 --- /dev/null +++ b/src/mod/applications/mod_enum/Makefile @@ -0,0 +1,34 @@ +# LDNS=ldns-1.6.9 +# BASE=../../../.. + +# LDNS_DIR=$(switch_srcdir)/libs/$(LDNS) +# LDNS_BUILDDIR=$(switch_builddir)/libs/$(LDNS) +# LDNSLA=$(LDNS_BUILDDIR)/libldns.la + +# include $(BASE)/build/modmake.rules +# LOCAL_LIBADD=$(LDNSLA) + + +BASE=../../../.. + +LDNS=ldns-1.6.9 + +LDNS_DIR=$(switch_srcdir)/libs/$(LDNS) +LDNS_BUILDDIR=$(switch_builddir)/libs/$(LDNS) +LOCAL_CFLAGS=-I$(LDNS_DIR) -I$(LDNS_DIR)/include +LDNS_LA=$(LDNS_BUILDDIR)/libldns.la +LOCAL_LIBADD=$(LDNS_LA) +include $(BASE)/build/modmake.rules + +$(LDNS_DIR)/Makefile.in: + $(GETLIB) $(LDNS).tar.gz + +$(LDNS_BUILDDIR)/Makefile: $(LDNS_DIR)/Makefile.in + mkdir -p $(LDNS_BUILDDIR) + cd $(LDNS_BUILDDIR) && $(DEFAULT_VARS) $(LDNS_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDNS_DIR) --disable-gost + $(TOUCH_TARGET) + +$(LDNS_LA): $(LDNS_BUILDDIR)/Makefile + cd $(LDNS_BUILDDIR) && $(MAKE) + $(TOUCH_TARGET) + From e566b270b88d95195cca214a99bf86fc0f1fbddb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 17:13:50 -0500 Subject: [PATCH 128/558] FS-3110 --comment-only phase 3.2 nevermind use getlibs --- bootstrap.sh | 2 +- configure.in | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/bootstrap.sh b/bootstrap.sh index 0dd37b925f..2dd76c409c 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -15,7 +15,7 @@ done BASEDIR=`pwd`; LIBDIR=${BASEDIR}/libs; -SUBDIRS="ilbc curl iksemel js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip ldns \ +SUBDIRS="ilbc curl iksemel js js/nsprpub libdingaling libedit libsndfile pcre sofia-sip \ speex sqlite srtp openzap freetdm spandsp libg722_1 portaudio unimrcp tiff-3.8.2 broadvoice silk libcodec2"; if [ ! -f modules.conf ]; then diff --git a/configure.in b/configure.in index 492093c1be..cb5319c152 100644 --- a/configure.in +++ b/configure.in @@ -1024,7 +1024,6 @@ AC_CONFIG_SUBDIRS([libs/broadvoice]) AC_CONFIG_SUBDIRS([libs/libg722_1]) AC_CONFIG_SUBDIRS([libs/silk]) AC_CONFIG_SUBDIRS([libs/libcodec2]) -AC_CONFIG_SUBDIRS([libs/ldns]) case $host in *-openbsd*) From 60da5740eb2f51c7e67b9c041a7b6f69c2aa8e79 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 17:22:42 -0500 Subject: [PATCH 129/558] FS-3110 --comment-only phase 3.3 nevermind use getlibs --- src/mod/applications/mod_enum/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_enum/Makefile b/src/mod/applications/mod_enum/Makefile index 789bba9214..f5d0ac265d 100644 --- a/src/mod/applications/mod_enum/Makefile +++ b/src/mod/applications/mod_enum/Makefile @@ -25,7 +25,7 @@ $(LDNS_DIR)/Makefile.in: $(LDNS_BUILDDIR)/Makefile: $(LDNS_DIR)/Makefile.in mkdir -p $(LDNS_BUILDDIR) - cd $(LDNS_BUILDDIR) && $(DEFAULT_VARS) $(LDNS_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDNS_DIR) --disable-gost + cd $(LDNS_BUILDDIR) && $(DEFAULT_VARS) $(LDNS_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDNS_DIR) --disable-gost --without-ssl --disable-sha2 $(TOUCH_TARGET) $(LDNS_LA): $(LDNS_BUILDDIR)/Makefile From 7fe291f1f9acb3f0753150d70b37b64a4ffb391a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 24 Mar 2011 17:23:08 -0500 Subject: [PATCH 130/558] FS-3110 --comment-only phase 3.4 nevermind use getlibs --- configure.in | 1 - 1 file changed, 1 deletion(-) diff --git a/configure.in b/configure.in index cb5319c152..d56116a9a6 100644 --- a/configure.in +++ b/configure.in @@ -922,7 +922,6 @@ AC_CONFIG_FILES([Makefile build/Makefile src/Makefile src/mod/Makefile - src/mod/applications/mod_enum/Makefile src/mod/applications/mod_expr/Makefile src/mod/applications/mod_fax/Makefile src/mod/applications/mod_spandsp/Makefile From b737851459cc03915f1ca2dce6c7b8a901cbb219 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Fri, 25 Mar 2011 00:13:16 +0100 Subject: [PATCH 131/558] correct a few ringback tone definitions, alphabetize them, add some new ones --- conf/vars.xml | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/conf/vars.xml b/conf/vars.xml index 94529aa9bc..a342c4565c 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -199,15 +199,28 @@ - - - - - + + + + + - + + + + + + + + + - + + + + + + + + + + + + + + + + +LibDNS API + + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + miek@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + jelte@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + erik@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ +DNS +Elite +Hacking + + +A small abstract will come here, TBD. + + +
+ + + +
+ +LibDNS (or lDNS) is modelled after the Net::DNS perl library. It has +been shown that Net::DNS can be used vefficiently for +programming DNS aware applications. We want to bring the same +level of efficiency to C programmers. + + +The lDNS API consist of two layers. The top-layer, this is +what is actually exported to the application via the library. And the +bottom-layer, this is what lDNS needs to compile and function. + +
+ +
+ +Short intermezzo detailing differences with other libraries. Most important +ones are the libc resolver interface (from BIND8) and the lwres_ interface +from BIND9. + +
+ +
+ +At its lowest level lDNS is only dependent on libc. It uses a +few networking systems calls; socket, bind, send/recv and friends. + + +Further more it is to be expected that lDNS will depend on OpenSSL for +its cryptography. + + +As said, lDNS is modelled after Net::DNS, therefor its application API +looks very much like the one used for Net::DNS. Some modification are made +ofcourse, because not all functionality of Perl can be caught in C. + + + +This API document was written by carefully looking at the documentation +contained in the Net::DNS Perl module. + +
diff --git a/libs/ldns/doc/API.xml b/libs/ldns/doc/API.xml new file mode 100644 index 0000000000..07007b9a29 --- /dev/null +++ b/libs/ldns/doc/API.xml @@ -0,0 +1,462 @@ + + + + + + + + + + + + + + +LibDNS API + + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + miek@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + jelte@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ + NLnet Labs +
+ + Kruislaan 419 + Amsterdam + 1098 VA + The Netherlands + + erik@nlnetlabs.nl + http://www.nlnetlabs.nl +
+
+ +DNS +Elite +Hacking + + +A small abstract will come here, TBD. + + +
+ + + +
+ +LibDNS (or lDNS) is modelled after the Net::DNS perl library. It has +been shown that Net::DNS can be used vefficiently for +programming DNS aware applications. We want to bring the same +level of efficiency to C programmers. + + +The lDNS API consist of two layers. The top-layer, this is +what is actually exported to the application via the library. And the +bottom-layer, this is what lDNS needs to compile and function. + +
+ +
+ +Short intermezzo detailing differences with other libraries. Most important +ones are the libc resolver interface (from BIND8) and the lwres_ interface +from BIND9. + +
+ +
+ +At its lowest level lDNS is only dependent on libc. It uses a +few networking systems calls; socket, bind, send/recv and friends. + + +Further more it is to be expected that lDNS will depend on OpenSSL for +its cryptography. + + +As said, lDNS is modelled after Net::DNS, therefor its application API +looks very much like the one used for Net::DNS. Some modification are made +ofcourse, because not all functionality of Perl can be caught in C. + + + +This API document was written by carefully looking at the documentation +contained in the Net::DNS Perl module. + +
+ +
+ +The rdf structure, the RData Field, is a type that contains the different +types in the rdata of an RR. Consider the following example: + +example.com. IN MX 10 mx.example.com. + +The "10 mx.example.com." is the rdata in this case. It consists of two +fields, "10" and "mx.example.com". These have the types (in this case) +LDNS_RDF_TYPE_INT8 and LDNS_RDF_TYPE_DNAME. + + +The following functions operate on this structure. + + + + +Create a new rdf structure. Return a pointer to it. + + +Get the size of a rdf structure. + + +Set the size of a rdf structure. + + +Set the type of a rdf structure. + + +Get the type of a rdf structure. + + +Set the (binary/network order) data of a rdf structure. + + +Get a pointer to the data in a rdf structure. + + +Free a rdf structure. + + +Create a new rdf structure from a string and a specific rdf_type. +The type is needed to perform the correct conversion. + + + +
+ +
+ +These functions operate on ldns_rr structures. + + + + +Returns a pointer to the newly created ldns_rr structure. + + +Prints the record to the stream s. + + +Returns a pointer to a ldns_buffer containing with string containing +RR-specific data. + + +Returns the record's owner name as a ldns_rdf type. + + +Returns the record's type. + + +Returns the record's class. + + +Returns the record's time-to-live (TTL). + + + + + +TODO the 'set' functions of the 'get' + +
+ +
+ +In the DNS the atomic data type is an RRset. This is a list +of RRs with the same ownername, type and class. Net::DNS doesn't +have rrsets as a seperate object. + + +In lDNS we have the ldns_rr_list, which just holds a bunch of RR's. +No specific check are made on the RRs that can be put in such a list. +Special wrapper functions exist which allow the usage of ldns_rr_list +of real (RFC compliant) RR sets. + + +TODO: See rr.c + +
+ +
+ + + +Create a new resolver structure and return the pointer to that. + + +Returns the version of lDNS. + + +Returns a ldns_pkt representing the MX records +for the specified dname. Function is documented differently in Net::DNS. +Do we need stuff like this?? XXX + + + Set the default domain for this resolver. This domain is added + when a query is made with a name without a trailing dot. + + + + +Add a new nameserver to the resolver. These nameservers are queried + when a search() or query() is done. + + + + Add a domain to the searchlist of a resolver. + + + Perform a query. Try all the nameservers in the *res structure. Apply + the search list. And default domain. +If type is NULL it defaults to 'A', +If class is NULL it default to 'IN'. + + +Perform a query. Only the default domain is added. +If type is NULL it defaults to 'A', +If class is NULL it default to 'IN'. + + +No search list nor default domain is applied. Return a pointer to a ldns_pkt +structure with the information from the nameserver. +If type is NULL it defaults to 'A', +If class is NULL it default to 'IN'. + + + + +TODO XX Gazillion helper functions to set port, src-port, etc. etc. + +
+ +
+ +A packet structure (ldns_pkt) has five sections: + +The header section, a ldns_hdr structure. +The question section, a ldns_rr_list structure. +The answer section, a ldns_rr_list structure. +The authority section, a ldns_rr_list structure. +The additional section, a ldns_rr_list structure. + + + + + +ldns_hdr represents the header section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + +A list of RRs in the Question section of a DNS packet. + + + + + + + +Creates a new empty packet. + + +Returns the packet data in binary format, suitable for sending to a +nameserver. [XXX, suitable for sending to a NS?] + + +Returns a ldns_hdr structure representing the header section of +the packet. + + + Returns a pointer to a ldns_rr_list representing the question section +of the packet. + + + Returns a pointer to a ldns_rr_list representing the answer section of +the packet. + + + +Returns a pointer to a ldns_rr_list representing the authority section +of the packet. + + + +Returns a pointer to a ldns_rr_list of representing the additional +section of the packet. + + + +Prints the packet data on the standard output in an ASCII format similar +to that used in DNS zone files. See RFC1035. + + + +Returns a ldns_buffer containing the string representation of the packet. + + + +Returns the IP address from which we received this packet. User-created +packets will return NULL. + + + +Returns the size of the packet in bytes as it was received from a +nameserver. User-created packets will return 0. [XXX +user-created??] + + + +Adds *rr to the specified section of the packet. Return LDNS_STATUS_OK +on success, LDNS_STATUS_ERR otherwise. + + + +Adds *rr to the specified section of the packet provided that the RR +does not already exist in the packet. Return LDNS_STATUS_OK +on success, LDNS_STATUS_ERR otherwise. + + +Removes a RR from the specified section of the packet. Returns NULL if +no RR's could be popped. + + +Retrieve all RRs in a packet matching certain criteria. XXX function needs +to be specified better. + + +Print packet p to stream s. + + + + +
+ +
+ +Some resource records can have special access function no other RR has. +Those are detailed here. XXX TODO don't exist (yet?). + +
+ +
+ +insert your long list here. + +
+ +
+ +A small example, which queries a nameserver on localhost +to diplay the MX records for miek.nl. + + + +
+ +/** + * An example ldns program + * In semi-C code + * + * Setup a resolver + * Query a nameserver + * Print the result + */ + +#include <ldns.h> + +int +main(void) +{ + ldns_resolver *res; + ldns_rdf *default_dom; + ldns_rdf *nameserver; + ldns_rdf *qname; + ldns_pkt *pkt; + + /* init */ + res = ldns_resolver_new(); + if (!res) + return 1; + + /* create a default domain and add it */ + default_dom = ldns_rdf_new_frm_str("miek.nl.", LDNS_RDF_TYPE_DNAME); + nameserver = ldns_rdf_new_frm_str("127.0.0.1", LDNS_RDF_TYPE_A); + + if (ldns_resolver_domain(res, default_dom) != LDNS_STATUS_OK) + return 1; + if (ldns_resolver_nameserver_push(res, nameserver) != LDNS_STATUS_OK) + return 1; + + /* setup the question */ + qname = ldns_rdf_new_frm_str("www", LDNS_RDF_TYPE_DNAME); + + /* fire it off. "miek.nl." will be added */ + pkt = ldns_resolver_query(res, qname, LDNS_RR_TYPE_MX, NULL); + + /* print the resulting pkt to stdout */ + ldns_pkt_print(stdout, pkt); + + return 0; +} + +
+
+
+ +
+ + +
diff --git a/libs/ldns/doc/CodingStyle b/libs/ldns/doc/CodingStyle new file mode 100644 index 0000000000..a326e5c3f9 --- /dev/null +++ b/libs/ldns/doc/CodingStyle @@ -0,0 +1,64 @@ +The libdns coding style guide + +* Use of tabs (real tabs, 8 positions long) +* Spaces only after comma's, and in between operators. + And after keywords (if, while, for) +* Underscores to make long names readable +* prefix (exported) identifiers with 'ldns_' +* no unneeded parentheses after 'return' +* always curly brackets in if-statements +* use defines for (weird) constants, and masks +* type 'bool', constants 'true'/'false'. Don't compare bools for + equality. +* always use LDNS_MALLOC/FREE etc, or the new/free/deep_free functions +* buffer can scale, so don't alloc the max size, but the min size +* make lint (uses splint) is your friend + + +* Return values: + - status code (structure to fill is usually passed as a first argument) + - new/pointer: return pointer or NULL on error + - 'read' functions: ldns_status wire2thing(uint8_t *p, size_t max, + size_t pos, *thing); + - void functions like ldns_rr_free + - bool functions + +* Parameter sequence: (dest, [dest_meta, ] src, [src_meta] etc) +* structure/union field names start with _ when "private" +* enum for rcode, opcode, types etc, + example: + enum ldns_rcode { + LDNS_RCODE_OK = 0, + ... = ., + LDNS_RCODE_FIRST = LDNS_RCODE_OK, + LDNS_RCODE_LAST = 15, + LDNS_RCODE_COUNT = LDNS_RCODE_LAST + 1 + } +* Everything by reference, all data structures an optional _clone() function +* arrays: ps[] with size_t p_count for the number of elements +* _size for size in bytes +* _free and _clone copies perform deep free/copy. + +* Standard abbreviations, don't abbreviate other names: + + id = identity + rr = resource record + rrset = resource record set + rdata = resource data + rdf = resource data field + rcode = result code + qr = query/resource bit + aa = authoritative answer + tc = truncated + rd = recursion disabled + cd = checking disabled + ra = recursion available + ad = authentic data + qdcount = question section count + ancount = answer section count + nscount = authority section count + arcount = additional section count + +ldns- +* use exit(EXIT_FAILURE)/ exit(SUCCES) +* diff --git a/libs/ldns/doc/TODO b/libs/ldns/doc/TODO new file mode 100644 index 0000000000..52a408c8a4 --- /dev/null +++ b/libs/ldns/doc/TODO @@ -0,0 +1,19 @@ +TODO + +Features: +* Multi-line zone file parsing +* Configure option for not printing DNSSEC RR comments +* HMAC and MD5 without OpenSSL +* HIP RR support +* Parse 'search' attribute in /etc/resolv.conf +* Make use of automake (Bug #173) +* ./configure --with-tools --with-drill (Bug #264) +* Drill: print appropriate DS RRs (relates to Bug #355) +* ldns-signzone optout to be really optout + +Bugfixes: +* Bug #279: fix return values for net.h functions, and related: make return + values for functions that cannot return memory-failure today. Needs medium + version increase because of API change. +* Long out-standing packaging bugs (debian) +* Lazy ABI diff --git a/libs/ldns/doc/design.dox b/libs/ldns/doc/design.dox new file mode 100644 index 0000000000..a4cbeadb8f --- /dev/null +++ b/libs/ldns/doc/design.dox @@ -0,0 +1,124 @@ +/** \page design Design + +The following image shows the various modules of libdns and their +functionality. + +\image html libdnsoverview.png + +\section central_structures Central structures + + - \ref ldns_pkt A DNS Packet, which can contain a query, answers, and additional information. + - \ref ldns_rr A Resource Record, which holds a bit of information about a specific domain name. + - \ref ldns_rdf An RDATA field, every Resource Record contains one or more RDATA fields, depending on the type of RR. These are the 'basic types' of DNS data. + - \ref ldns_rr_list A list of resource records + - \ref ldns_zone A representation of a DNS Zone. + +The actual structure definitions are named \c ldns_struct_ which are all typedeffed to \c ldns_ + + +A DNS Resource record looks like this: + +
+nlnetlabs.nl.   600     IN      MX             10    open.nlnetlabs.nl.
+ \              \       \       \              \                     /
+  owner          ttl     class   type           \        rdf[]      /
+  (rdf)     (uint32_t) (rr_class) (rr_type)
+                                                 10          := rdf[0]
+                                                 open.nlnetlabs.nl. := rdf[1]
+
+ +* Owner: +The owner name is put in an \c ldns_rdf structure, which is a normal rdata field but always +has the type LDNS_RDF_TYPE_DNAME. + +An \ref ldns_rdf structure has 3 members; the size, the type of rdata and a void * +pointer to the data. The data is always in uncompressed wireformat. + +The RSH (rdata) is put in an array of rdf's (in this case 2). + +The entire resource record is put in a RR structure, which has +the fields described above (under the RR): + - owner (nlnetlabs.nl.) + - ttl (600) + - class (LDNS_RR_CLASS_IN: 'IN') + - type (LDNS_RR_TYPE_MX: 'MX') + - rd_count (2) + - rdata_fields[rd_count] + - rdf[0] (10) + - rdf[1] (open.nlnetlabs.nl.) + +* RR list structure: +An RR list structure is simply a structure with a counter +and an array of RR structures. Different kinds of RR's can +be grouped together this way. + +* RRset structure: +An RRset structure is an RR list structure, but its accessor +function checks if the \c ldns_rr structures in there are: + - from the same type + - have the same TTL + - have the same ownername + +This is the RFC definition of an RRset. + +* pkt structure: +A pkt structure consists out of a header structure where +packet specific flags are kept, TC, RD, IP from the server which +sent the packet, etc. +Further more it is divided in 4 sections: question, authority, answer +and additional. + +All four sections have the type RRlist that simply hold a list of RR's + + +\section wire_module Wire module and central structures Interface + +As the WIRE module takes care of the compression/decompression +it needs a buffer which holds all the binary DNS data. +All functions will operate on such a buffer to extract specific +information which is then stored in RR structures. + + +\section resolver_module Resolver module and central structures Interface + +The resolver module always returns a pkt structure. Either with +the answer or a SERVFAIL pkt. + +The exact function-call parameters have not yet been +decided on. + +Also the resolver module will need to access some of the +to_wire and from_wire function to creates ldn_pkt's from +the data it receives (arrow not drawn). + + +\section str_module str module and central structures Interface + +Convert to and from strings. This module could be used +to read in a zone file (list of RRs) and convert the text strings to +the format used by ldns. Or the other way around. + + +\section net_module Net module and resolver module interface + +The resolver module will get a packet and will mold it so that +it can be sent off to a nameserver. +It might need to interface with the wire module (arrow not drawn). + +\section Net module and OS/libc interface +OS/network calls will be used here. The Net module is the only part of +the library where the underlying OS matters. + +\section Client program ldns interface +Any client program will have access to +- Wire module +- Central structures +- Resolver module +- str module (arrow not drawn in the above figure) + +\section dnssec_module DNSSEC module +The DNSSEC types are handled in the RR module, but the crypto +routines are contained in this module. This module will depend +on OpenSSL for the crypto routines. + +*/ diff --git a/libs/ldns/doc/dns-lib-implementations b/libs/ldns/doc/dns-lib-implementations new file mode 100644 index 0000000000..18d01afb30 --- /dev/null +++ b/libs/ldns/doc/dns-lib-implementations @@ -0,0 +1,56 @@ +http://www.posadis.org/projects/poslib.php +Poslib DNS library - Default branch + +http://www.posadis.org/poslib?DokuWiki=2b00f9da090fb9d4ad3d6e98b9c2f61f + +Poslib is the C++ library for applications using the Domain Name System +that is used by all Posadis tools, including the Posadis DNS server and the +Zoneedit and Dnsquery tools. It consists of a library for creating client +applications using DNS, and a server library for DNS servers. + + +FireDNS Library +http://firestuff.org/projects/firedns +FireDNS Library +--------------- +(c) 2002 Ian Gulliver under the GNU Public License, Version 2. +See GPL for more details. + +From libfiredns(3): + +libfiredns is a library for handling asynchronous DNS +requests. It provides a very simple interface for sending +requests and parsing reponses, as well as low-timeout +blocking functions. libfiredns functions have much lower +timeouts than the stock functions and tend to be faster +because they send requests to all configured system +nameservers at the same time. + +If you have questions or comments, you can reach me at +ian@penguinhosting.net. + + + +skadns + + Skadns is Kind of an Asynchronous DNS client software. + + * Kind of: it's small. Really small. But it just works. + * Asynchronous: all DNS operations are non-blocking. + * DNS client software: it's a DNS client, what you may know as a "stub resolver". To perform full DNS resolution, you will still need a full resolver like dnscache. + + Similar work + + * ares is an asynchronous DNS resolver library with a nice interface + * and more configuration options than skadns (and a very reasonable + * size). Use it if you find that skadns lacks configurability (you + * shouldn't need more than it provides, but well, you're the user). + * Yet it doesn't hide the DNS internals as opaquely as skadns does, + * giving you a bunch of fds to select() on instead of just one. + * adns works fine, and is small for a GNU project. Impressive. But + * the interface is still too complex and much too generic - the + * usual problems with GNU software. + + +ADNS; documentation scares - is it still active +simular aims - different ways diff --git a/libs/ldns/doc/doxyparse.pl b/libs/ldns/doc/doxyparse.pl new file mode 100644 index 0000000000..218825fe1b --- /dev/null +++ b/libs/ldns/doc/doxyparse.pl @@ -0,0 +1,288 @@ +#!/usr/bin/perl + +# Doxygen is usefull for html documentation, but sucks +# in making manual pages. Still tool also parses the .h +# files with the doxygen documentation and creates +# the man page we want +# +# 2 way process +# 1. All the .h files are processed to create in file in which: +# filename | API | description | return values +# are documented +# 2. Another file is parsed which states which function should +# be grouped together in which manpage. Symlinks are also created. +# +# With this all in place, all documentation should be autogenerated +# from the doxydoc. + +use Getopt::Std; + +my $state; +my $description; +my $struct_description; +my $key; +my $return; +my $param; +my $api; +my $const; + +my %description; +my %api; +my %return; +my %options; +my %manpages; +my %see_also; + +my $BASE="doc/man"; +my $MAN_SECTION = "3"; +my $MAN_HEADER = ".TH ldns $MAN_SECTION \"30 May 2006\"\n"; +my $MAN_MIDDLE = ".SH AUTHOR +The ldns team at NLnet Labs. Which consists out of +Jelte Jansen and Miek Gieben. + +.SH REPORTING BUGS +Please report bugs to ldns-team\@nlnetlabs.nl or in +our bugzilla at +http://www.nlnetlabs.nl/bugs/index.html + +.SH COPYRIGHT +Copyright (c) 2004 - 2006 NLnet Labs. +.PP +Licensed under the BSD License. There is NO warranty; not even for +MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. +"; +my $MAN_FOOTER = ".SH REMARKS +This manpage was automaticly generated from the ldns source code by +use of Doxygen and some perl. +"; + +getopts("m:",\%options); +# if -m manpage file is given process that file +# parse the file which tells us what manpages go together +my $functions, $see_also; +if (defined $options{'m'}) { + # process + open(MAN, "<$options{'m'}") or die "Cannot open $options{'m'}"; + # it's line based: + # func1, func2, .. | see_also1, see_also2, ... + while() { + chomp; + if (/^#/) { next; } + if (/^$/) { next; } + ($functions, $see_also) = split /[\t ]*\|[\t ]*/, $_; + #print "{$functions}\n"; + #print "{$see_also}\n"; + my @funcs = split /[\t ]*,[\t ]*/, $functions; + my @also = split /[\t ]*,[\t ]*/, $see_also; + $manpages{$funcs[0]} = \@funcs; + $see_also{$funcs[0]} = \@also; + #print "[", $funcs[0], "]\n"; + } + close(MAN); +} else { + print "Need -m file to process the .h files\n"; + exit 1; +} + +# 0 - somewhere in the file +# 1 - in a doxygen par +# 2 - after doxygen, except funcion + +# create our pwd +mkdir "doc"; +mkdir "doc/man"; +mkdir "doc/man/man$MAN_SECTION"; + +$state = 0; +my $i; +my @lines = ; +my $max = @lines; + +while($i < $max) { + $typedef = ""; + if ($lines[$i] =~ /^typedef struct/ and $lines[$i + 1] =~ /^struct/) { + # move typedef to below struct + $typedef = $lines[$i]; + $j = $i; + while ($lines[$j] !~ /}/) { + $lines[$j] = $lines[$j+1]; + $j++; + } + $lines[$j] = $lines[$j+1]; + $lines[$j + 1] = $typedef; + } + + $cur_line = $lines[$i]; + chomp($cur_line); + if ($cur_line =~ /^\/\*\*[\t ]*$/) { + # /** Seen + #print "Comment seen! [$cur_line]\n"; + $state = 1; + undef $description; + undef $struct_description; + $i++; + next; + } + if ($cur_line =~ /\*\// and $state == 1) { + #print "END Comment seen!\n"; + $state = 2; + $i++; + next; + } + + if ($state == 1) { + # inside doxygen + $cur_line =~ s/\\/\\\\/g; + $cur_line =~ s/^[ \t]*\* ?//; + $description = $description . "\n" . $cur_line; + #$description = $description . "\n.br\n" . $cur_line; + } + if ($state == 2 and $cur_line =~ /const/) { + # the const word exists in the function call + #$const = "const"; + #s/[\t ]*const[\t ]*//; + } else { + #undef $const; + } + + if ($cur_line =~ /^INLINE/) { + $cur_line =~ s/^INLINE\s*//; + while ($cur_line !~ /{/) { + $i++; + $cur_line .= " ".$lines[$i]; + $cur_line =~ s/\n//; + } + $cur_line =~ s/{/;/; + } + + if ($cur_line =~ /^[^#*\/ ]([\w\*]+)[\t ]+(.*?)[({](.*)\s*/ and $state == 2) { + while ($cur_line !~ /\)\s*;/) { + $i++; + $cur_line .= $lines[$i]; + chomp($cur_line); + $cur_line =~ s/\n/ /g; + $cur_line =~ s/\s\s*/ /g; + } + $cur_line =~ /([\w\* ]+)[\t ]+(.*?)\((.*)\)\s*;/; + # this should also end the current comment parsing + $return = $1; + $key = $2; + $api = $3; + # sometimes the * is stuck to the function + # name instead to the return type + if ($key =~ /^\*/) { + #print"Name starts with *\n"; + $key =~ s/^\*//; + if (defined($const)) { + $return = $const . " " . $return . '*'; + } else { + $return = $return . '*'; + } + } + $description =~ s/\\param\[in\][ \t]*([\*\w]+)[ \t]+/.br\n\\fB$1\\fR: /g; + $description =~ s/\\param\[out\][ \t]*([\*\w]+)[ \t]+/.br\n\\fB$1\\fR: /g; + $description =~ s/\\return[ \t]*/.br\nReturns /g; + + $description{$key} = $description; + $api{$key} = $api; + $return{$key} = $return; + undef $description; + undef $struct_description; + $state = 0; + } elsif ($state == 2 and ( + $cur_line =~ /^typedef\sstruct\s(\w+)\s(\w+);/ or + $cur_line =~ /^typedef\senum\s(\w+)\s(\w+);/)) { + $struct_description .= "\n.br\n" . $cur_line; + $key = $2; + $struct_description =~ s/\/\*\*\s*(.*?)\s*\*\//\\fB$1:\\fR/g; + $description{$key} = $struct_description; + $api{$key} = "struct"; + $return{$key} = $1; + undef $description; + undef $struct_description; + $state = 0; + } else { + $struct_description .= "\n.br\n" . $cur_line; + } + $i++; +} + +# create the manpages +foreach (keys %manpages) { + $name = $manpages{$_}; + $also = $see_also{$_}; + + $filename = @$name[0]; + $filename = "$BASE/man$MAN_SECTION/$filename.$MAN_SECTION"; + + my $symlink_file = @$name[0] . "." . $MAN_SECTION; + +# print STDOUT $filename,"\n"; + open (MAN, ">$filename") or die "Can not open $filename"; + + print MAN $MAN_HEADER; + print MAN ".SH NAME\n"; + print MAN join ", ", @$name; + print MAN "\n\n"; + print MAN ".SH SYNOPSIS\n"; + + print MAN "#include \n.br\n"; + print MAN "#include \n.br\n"; + + print MAN ".PP\n"; + print MAN "#include \n"; + print MAN ".PP\n"; + + foreach (@$name) { + $b = $return{$_}; + $b =~ s/\s+$//; + if ($api{$_} ne "struct") { + print MAN $b, " ", $_; + print MAN "(", $api{$_},");\n"; + print MAN ".PP\n"; + } + } + + print MAN "\n.SH DESCRIPTION\n"; + foreach (@$name) { + print MAN ".HP\n"; + print MAN "\\fI", $_, "\\fR"; + if ($api{$_} ne "struct") { + print MAN "()"; + } +# print MAN ".br\n"; + print MAN $description{$_}; + print MAN "\n.PP\n"; + } + + print MAN $MAN_MIDDLE; + + if (defined(@$also)) { + print MAN "\n.SH SEE ALSO\n\\fI"; + print MAN join "\\fR, \\fI", @$also; + print MAN "\\fR.\nAnd "; + print MAN "\\fBperldoc Net::DNS\\fR, \\fBRFC1034\\fR, +\\fBRFC1035\\fR, \\fBRFC4033\\fR, \\fBRFC4034\\fR and \\fBRFC4035\\fR.\n"; + } else { + print MAN ".SH SEE ALSO +\\fBperldoc Net::DNS\\fR, \\fBRFC1034\\fR, +\\fBRFC1035\\fR, \\fBRFC4033\\fR, \\fBRFC4034\\fR and \\fBRFC4035\\fR.\n"; + } + + print MAN $MAN_FOOTER; + + # create symlinks + chdir("$BASE/man$MAN_SECTION"); + foreach (@$name) { + print STDERR $_,"\n"; + my $new_file = $_ . "." . $MAN_SECTION; + if ($new_file eq $symlink_file) { + next; + } + #print STDOUT "\t", $new_file, " -> ", $symlink_file, "\n"; + symlink $symlink_file, $new_file; + } + chdir("../../.."); # and back, tricky and fragile... + close(MAN); +} diff --git a/libs/ldns/doc/function_manpages b/libs/ldns/doc/function_manpages new file mode 100644 index 0000000000..15706fada5 --- /dev/null +++ b/libs/ldns/doc/function_manpages @@ -0,0 +1,223 @@ +# first function name will be the real name of the manpage +# other names are aliases (symlinks) +# all functions specified on the same line are included in the +# same manual page. We cannot deal with linebreaks! +# function named after the pipe `|' are put in the "see also" section + +# functions that must be included, separated by commas + +### host2wire.h +# conversion functions +ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire | ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf +# lower level conversions, some are from host2str.h +ldns_pkt2buffer_str, ldns_pktheader2buffer_str, ldns_rr2buffer_str, ldns_rr_list2buffer_str, ldns_rdf2buffer_str, ldns_key2buffer_str, ldns_pkt2buffer_wire, ldns_rr2buffer_wire, ldns_rdf2buffer_wire, ldns_rrsig2buffer_wire, ldns_rr_rdata2buffer_wire | ldns_pkt2str, ldns_rr2str, ldns_rdf2str, ldns_rr_list2str, ldns_key2str +### /host2wire.h + +### host2str.h +ldns_rr2str, ldns_pkt2str, ldns_rdf2str, ldns_rr_list2str, ldns_key2str | ldns_rr_print, ldns_rdf_print, ldns_pkt_print, ldns_rr_list_print, ldns_resolver_print, ldns_zone_print +ldns_rr_print, ldns_rdf_print, ldns_pkt_print, ldns_rr_list_print, ldns_resolver_print, ldns_zone_print | ldns_rr2str, ldns_rdf2str, ldns_pkt2str, ldns_rr_list2str, ldns_key2str +### /host2str.h + +### host2str.h +# and even lower +ldns_rdf2buffer_str_a, ldns_rdf2buffer_str_aaaa, ldns_rdf2buffer_str_str, ldns_rdf2buffer_str_b64, ldns_rdf2buffer_str_hex, ldns_rdf2buffer_str_type, ldns_rdf2buffer_str_class, ldns_rdf2buffer_str_alg, ldns_rdf2buffer_str_loc, ldns_rdf2buffer_str_unknown, ldns_rdf2buffer_str_nsap, ldns_rdf2buffer_str_wks, ldns_rdf2buffer_str_nsec, ldns_rdf2buffer_str_period, ldns_rdf2buffer_str_tsigtime, ldns_rdf2buffer_str_apl, ldns_rdf2buffer_str_int16_data, ldns_rdf2buffer_str_int16, ldns_rdf2buffer_str_ipseckey +### /host2str.h + +### wire2host.h +# wirefunctions +ldns_wire2rr, ldns_wire2pkt, ldns_wire2rdf, ldns_wire2dname | ldns_rr2wire, ldns_pkt2wire, ldns_rdf2wire, ldns_dname2wire +ldns_buffer2pkt_wire +### /wire2host.h + +### dname.h +ldns_dname_left_chop, ldns_dname_label_count | ldns_dname +ldns_dname2canonical | ldns_dname +ldns_dname_cat_clone, ldns_dname_cat | ldns_dname +ldns_dname_new, ldns_dname_new_frm_str, ldns_dname_new_frm_data | ldns_dname, ldns_pkt_query_new_frm_str, ldns_rdf_new_frm_str, ldns_rr_new_frm_str +ldns_dname_is_subdomain, ldns_dname_str_absolute, ldns_dname_label | ldns_dname +ldns_dname_compare, ldns_dname_interval | ldns_dname_is_subdomain | ldns_dname +ldns_dname | ldns_dname_left_chop, ldns_dname_label_count, ldns_dname2canonical, ldns_dname_cat, ldns_dname_cat_clone, ldns_dname_new, ldns_dname_new_frm_str, ldns_dname_new_frm_data, ldns_dname_is_subdomain, ldns_dname_str_absolute, ldns_dname_label, ldns_dname_compare, ldns_dname_interval +### /dname.h + +### rdata.h +ldns_rdf, ldns_rdf_type | ldns_rdf_set_size, ldns_rdf_set_type, ldns_rdf_set_data, ldns_rdf_size, ldns_rdf_get_type, ldns_rdf_data, ldns_rdf_compare, ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, ldns_rdf_print, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t, ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t +ldns_rdf_set_size, ldns_rdf_set_type, ldns_rdf_set_data | ldns_rdf +ldns_rdf_size, ldns_rdf_get_type, ldns_rdf_data, ldns_rdf_compare | ldns_rdf +ldns_rdf_new, ldns_rdf_clone, ldns_rdf_new_frm_data, ldns_rdf_new_frm_str, ldns_rdf_new_frm_fp, ldns_rdf_free, ldns_rdf_deep_free, ldns_rdf_print | ldns_rdf +ldns_native2rdf_int8, ldns_native2rdf_int16, ldns_native2rdf_int32, ldns_native2rdf_int16_data, ldns_rdf2native_int8, ldns_rdf2native_int16, ldns_rdf2native_int32, ldns_rdf2native_sockaddr_storage, ldns_rdf2native_time_t | ldns_rdf +ldns_rdf_address_reverse | ldns_rdf +ldns_octet | ldns_rdf +# why is this in rdata.h? +ldns_str2period +### /rdata.h + +### higher.h +ldns_get_rr_list_addr_by_name, ldns_get_rr_list_name_by_addr | ldns_rr_list, ldns_rr +ldns_get_rr_list_hosts_frm_fp, ldns_get_rr_list_hosts_frm_file | ldns_rr_list, ldns_rr, ldns_get_rr_list_hosts_frm_fp_l +ldns_get_rr_list_hosts_frm_fp_l | ldns_rr_list +ldns_getaddrinfo +### /higher.h + +# +### dnssec.h +# +ldns_calc_keytag, ldns_verify, ldns_verify_rrsig, ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5, ldns_key_rr2ds, ldns_key_buf2dsa, ldns_key_buf2rsa | ldns_key, ldns_sign_public, ldns_zone_sign, ldns_verify, ldns_verify_rrsig + +# algs +ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5 | ldns_key, ldns_sign_public, ldns_zone_sign, ldns_verify, ldns_verify_rrsig + +# tsig +ldns_pkt_tsig_verify, ldns_pkt_tsig_sign | ldns_key + +# verify +ldns_verify, ldns_verify_rrsig, ldns_verify_rrsig_keylist, ldns_verify_rrsig_keylist_notime, ldns_verify_notime | ldns_verify_rrsig_evp | ldns_verify_rrsig_dsa, ldns_verify_rrsig_rsasha1, ldns_verify_rrsig_rsamd5, ldns_sign_public, ldns_zone_sign, ldns_key + +# convert +ldns_key_buf2dsa, ldns_key_buf2rsa | ldns_key_rr2ds +ldns_key_rr2ds | ldns_key +ldns_create_nsec | ldns_sign_public + +# signing +ldns_sign_public | ldns_sign_public_dsa, ldns_sign_public_rsamd5, ldns_sign_public_rsasha1, ldns_verify, ldns_verify_rrsig, ldns_key +ldns_sign_public_dsa, ldns_sign_public_rsamd5, ldns_sign_public_rsasha1 | ldns_sign_public +ldns_dnssec_zone_sign, ldns_dnssec_zone_sign_nsec3 | ldns_zone_sign, ldns_zone_sign_nsec3 | ldns_sign_public, ldns_key, ldns_init_random +ldns_init_random | ldns_sign_public, ldns_key +ldns_pkt_verify | ldns_verify, ldns_sign_public, ldns_zone_sign + +# new family of dnssec functions +ldns_dnssec_zone, ldns_dnssec_name, ldns_dnssec_rrs, ldns_dnssec_rrsets | ldns_dnssec_zone_new, ldns_dnssec_name_new, ldns_dnssec_rrs_new, ldns_dnssec_rrsets_new +ldns_dnssec_zone_find_rrset, ldns_dnssec_zone_new, ldns_dnssec_zone_free, ldns_dnssec_zone_add_rr, ldns_dnssec_zone_names_print, ldns_dnssec_zone_print, ldns_dnssec_zone_add_empty_nonterminals | ldns_dnssec_zone +ldns_dnssec_name_new, ldns_dnssec_name_new_frm_rr, ldns_dnssec_name_free, ldns_dnssec_name_name, ldns_dnssec_name_set_name, ldns_dnssec_name_set_nsec, ldns_dnssec_name_cmp, ldns_dnssec_name_add_rr, ldns_dnssec_name_find_rrset, ldns_dnssec_name_print | ldns_dnssec_zone +ldns_dnssec_rrsets_new, ldns_dnssec_rrsets_free, ldns_dnssec_rrsets_type, ldns_dnssec_rrsets_set_type, ldns_dnssec_rrsets_add_rr, ldns_dnssec_rrsets_print | ldns_dnssec_zone +ldns_dnssec_rrs_new, ldns_dnssec_rrs_free, ldns_dnssec_rrs_add_rr, ldns_dnssec_rrs_print | ldns_dnssec_zone + +# verification +ldns_dnssec_data_chain, ldns_dnssec_data_chain_struct, ldns_dnssec_trust_tree | ldns_dnssec_data_chain_new, ldns_dnssec_trust_tree_new, ldns_dnssec_verify_denial +ldns_dnssec_data_chain_new, ldns_dnssec_data_chain_free, ldns_dnssec_data_chain_deep_free, ldns_dnssec_build_data_chain, ldns_dnssec_data_chain_print | ldns_dnssec_data_chain +ldns_dnssec_trust_tree_new, ldns_dnssec_trust_tree_free, ldns_dnssec_trust_tree_depth, ldns_dnssec_derive_trust_tree, ldns_dnssec_trust_tree_contains_keys, ldns_dnssec_trust_tree_print, ldns_dnssec_trust_tree_print_sm, ldns_dnssec_trust_tree_add_parent, ldns_dnssec_derive_trust_tree_normal_rrset, ldns_dnssec_derive_trust_tree_dnskey_rrset, ldns_dnssec_derive_trust_tree_ds_rrset, ldns_dnssec_derive_trust_tree_no_sig | ldns_dnssec_data_chain, ldns_dnssec_trust_tree +ldns_dnssec_verify_denial, ldns_dnssec_verify_denial_nsec3 | ldns_dnssec_trust_tree, ldns_dnssec_data_chain + +# new signing functions +ldns_dnssec_zone_sign, ldns_dnssec_zone_sign_nsec3, ldns_dnssec_zone_mark_glue, ldns_dnssec_name_node_next_nonglue, ldns_dnssec_zone_create_nsecs, ldns_dnssec_remove_signatures, ldns_dnssec_zone_create_rrsigs | ldns_dnssec_zone + +### /dnssec.h + +### dnskey.h +ldns_key_new | ldns_key, ldns_key_list_new +ldns_key_new_frm_algorithm, ldns_key_new_frm_fp, ldns_key_new_frm_fp_l | ldns_key +ldns_key_new_frm_fp_rsa, ldns_key_new_frm_fp_rsa_l | ldns_key_new_frm_fp, ldns_key +ldns_key_new_frm_fp_dsa, ldns_key_new_frm_fp_dsa_l | ldns_key_new_frm_fp, ldns_key +ldns_key_list_new | ldns_key_new, ldns_key +# access, write +ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count, ldns_key_algo_supported | ldns_key_push_key, ldns_key +ldns_key_list_push_key | ldns_key_list_pop_key, ldns_key +ldns_key_list_pop_key | ldns_key_list_push_key, ldns_key +# access, read +ldns_key_list_key_count, ldns_key_list_key, ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key, ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags | ldns_key +# convert +ldns_key2rr | ldns_key +ldns_key_free, ldns_key_deep_free, ldns_key_list_free | ldns_key +# +ldns_key_print | ldns_key_new, ldns_key +ldns_key | ldns_key_new, ldns_key_new_frm_algorithm,ldns_key_new_frm_fp,ldns_key_new_frm_fp_l, ldns_key_new_frm_fp_rsa, ldns_key_new_frm_fp_rsa_l, ldns_key_new_frm_fp_dsa, ldns_key_new_frm_fp_dsa_l, ldns_key_list_new, ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count, ldns_key_list_push_key, ldns_key_list_pop_key, ldns_key_list_key_count, ldns_key_list_key, ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key, ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags, ldns_key2rr, ldns_key_free, ldns_key_deep_free, ldns_key_list_free, ldns_key_print +### /dnskey.h + +### MIEK TOT HIER TOT HIER + +# lists +ldns_key_list_new, ldns_key_list_push_key, ldns_key_list_pop_key, ldns_key_list_key_count, ldns_key_list_key | ldns_key_list, ldns_key +ldns_key_rsa_key, ldns_key_dsa_key, ldns_key_algorithm, ldns_key_hmac_key | ldns_key_list, ldns_key + +# gets/sets +ldns_key_origttl, ldns_key_inception, ldns_key_expiration, ldns_key_keytag, ldns_key_pubkey_owner, ldns_key_flags | ldns_key +ldns_key_set_algorithm, ldns_key_set_rsa_key, ldns_key_set_dsa_key, ldns_key_set_hmac_key, ldns_key_set_origttl, ldns_key_set_inception, ldns_key_set_expiration, ldns_key_set_pubkey_owner, ldns_key_set_keytag, ldns_key_set_flags, ldns_key_list_set_key_count | ldns_key + +# errr.h +ldns_get_errorstr_by_id | ldns_status +ldns_status | ldns_get_errorstr_by_id + +### net.h +ldns_send | ldns_pkt, ldns_resolver +ldns_tcp_send_query, ldns_tcp_read_wire, ldns_tcp_connect | ldns_send, ldns_pkt, ldns_resolver +### /net.h + +### buffer.h +# general +ldns_buffer | ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buffer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export, ldns_buffer_flip, ldns_buffer_rewind, ldns_buffer_position, ldns_buffer_set_position, ldns_buffer_skip, ldns_buffer_limit, ldns_buffer_set_limit, ldns_buffer_capacity, ldns_buffer_set_capacity, ldns_buffer_reserve, ldns_buffer_at, ldns_buffer_begin, ldns_buffer_end, ldns_buffer_current, ldns_buffer_remaining_at, ldns_buffer_remaining, ldns_buffer_available_at, ldns_buffer_available, ldns_buffer_status, ldns_buffer_status_ok, ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buffer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buffer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 +ldns_buffer_new, ldns_buffer_new_frm_data, ldns_buffer_clear, ldns_buffer_printf, ldns_buffer_free, ldns_buffer_export | ldns_buffer +# position +ldns_buffer_flip, ldns_buffer_rewind, ldns_buffer_position, ldns_buffer_set_position, ldns_buffer_skip | ldns_buffer +# values and pointers +ldns_buffer_limit, ldns_buffer_set_limit, ldns_buffer_capacity, ldns_buffer_set_capacity, ldns_buffer_reserve, ldns_buffer_at, ldns_buffer_begin, ldns_buffer_end, ldns_buffer_current | ldns_buffer +# info +ldns_buffer_remaining_at, ldns_buffer_remaining, ldns_buffer_available_at, ldns_buffer_available, ldns_buffer_status, ldns_buffer_status_ok | ldns_buffer +# read and write +ldns_buffer_write_at, ldns_buffer_write_at, ldns_buffer_write, ldns_buffer_write_string_at, ldns_buffer_write_string, ldns_buffer_write_u8_at, ldns_buffer_write_u8, ldns_buffer_write_u16_at, ldns_buffer_write_u16, ldns_buffer_read_at, ldns_buffer_read, ldns_buffer_read_u8_at, ldns_buffer_read_u8, ldns_buffer_read_u16_at, ldns_buffer_read_u16, ldns_buffer_read_u32_at, ldns_buffer_read_u32 | ldns_buffer +### /buffer.h + +# parse.h +ldns_bget_token, ldns_bgetc, ldns_bskipcs | ldns_buffer +ldns_fget_token, ldns_fskipcs | ldns_buffer +ldns_str_remove_comment + + +# rr.h and other general rr funcs +ldns_rr, ldns_rr_class, ldns_rr_type, ldns_rr_compress, ldns_rr_list | ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print, ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf, ldns_rr_push_rdf, ldns_rr_pop_rdf, ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class, ldns_rr_list_rr_count, ldns_rr_list_set_rr_count, ldns_rr_list_new, ldns_rr_list_free, ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr, ldns_is_rrset, ldns_rr_set_push_rr, ldns_rr_set_pop_rr, ldns_get_rr_class_by_name, ldns_get_rr_type_by_name, ldns_rr_list_clone, ldns_rr_list_sort, ldns_rr_compare, ldns_rr_compare_ds, ldns_rr_uncompressed_size, ldns_rr2canonical, ldns_rr_label_count, ldns_is_rrset, ldns_rr_descriptor, ldns_rr_descript +ldns_rr_new, ldns_rr_new_frm_type, ldns_rr_new_frm_str, ldns_rr_new_frm_fp, ldns_rr_free, ldns_rr_print | ldns_rr, ldns_rr_list +ldns_rr_set_owner, ldns_rr_set_ttl, ldns_rr_set_type, ldns_rr_set_rd_count, ldns_rr_set_class, ldns_rr_set_rdf | ldns_rr, ldns_rr_list +ldns_rr_push_rdf, ldns_rr_pop_rdf | ldns_rr, ldns_rr_list +ldns_rr_rdf, ldns_rr_owner, ldns_rr_rd_count, ldns_rr_ttl, ldns_rr_get_class | ldns_rr, ldns_rr_list +ldns_rr_list_rr_count, ldns_rr_list_set_rr_count | ldns_rr, ldns_rr_list +ldns_rr_list_new, ldns_rr_list_free | ldns_rr, ldns_rr_list +ldns_rr_list_cat, ldns_rr_list_push_rr, ldns_rr_list_pop_rr | ldns_rr, ldns_rr_list +ldns_is_rrset | ldns_rr, ldns_rr_list +ldns_rr_set_push_rr, ldns_rr_set_pop_rr | ldns_rr, ldns_rr_list +ldns_get_rr_class_by_name, ldns_get_rr_type_by_name | ldns_rr, ldns_rr_list +ldns_rr_list_clone | ldns_rr, ldns_rr_list +ldns_rr_list_sort | ldns_rr, ldns_rr_list +ldns_rr_compare, ldns_rr_compare_ds | ldns_rr, ldns_rr_list +ldns_rr_uncompressed_size | ldns_rr, ldns_rr_list +ldns_rr2canonical | ldns_rr, ldns_rr_list +ldns_rr_label_count | ldns_rr, ldns_rr_list +ldns_is_rrset | ldns_rr + +# rr descriptors +ldns_rr_descriptor, ldns_rr_descript, ldns_rr_descriptor_minimum, ldns_rr_descriptor_maximum, ldns_rr_descriptor_field_type | ldns_rr, ldns_rdf + +# packet.h +ldns_pkt, ldns_pkt_section, ldns_pkt_type | ldns_pkt_new, ldns_pkt_free, ldns_pkt_print, ldns_pkt_query_new, ldns_pkt_query_new_frm_str, ldns_pkt_reply_type, ldns_pkt_id, ldns_pkt_qr, ldns_pkt_aa, ldns_pkt_tc, ldns_pkt_rd, ldns_pkt_cd, ldns_pkt_ra, ldns_pkt_ad, ldns_pkt_get_opcode, ldns_pkt_get_rcode, ldns_pkt_qdcount, ldns_pkt_ancount, ldns_pkt_nscount, ldns_pkt_arcount, ldns_pkt_answerfrom, ldns_pkt_querytime, ldns_pkt_size, ldns_pkt_tsig, ldns_pkt_question, ldns_pkt_answer, ldns_pkt_authority, ldns_pkt_additional, ldns_pkt_get_section_clone, ldns_pkt_rr_list_by_name, ldns_pkt_rr_list_by_type, ldns_pkt_rr_list_by_name_and_type, ldns_pkt_set_flags, ldns_pkt_set_id, ldns_pkt_set_qr, ldns_pkt_set_aa, ldns_pkt_set_tc, ldns_pkt_set_rd, ldns_pkt_set_cd, ldns_pkt_set_ra, ldns_pkt_set_ad, ldns_pkt_set_opcode, ldns_pkt_set_rcode, ldns_pkt_set_qdcount, ldns_pkt_set_ancount, ldns_pkt_set_nscount, ldns_pkt_set_arcount, ldns_pkt_set_answerfrom, ldns_pkt_set_querytime, ldns_pkt_set_size, ldns_pkt_set_section_count, ldns_pkt_set_tsig, ldns_pkt_edns, ldns_pkt_edns_udp_size, ldns_pkt_edns_extended_rcode, ldns_pkt_edns_version, ldns_pkt_edns_z, ldns_pkt_edns_data, ldns_pkt_set_edns_udp_size, ldns_pkt_set_edns_extended_rcode, ldns_pkt_set_edns_version, ldns_pkt_set_edns_z, ldns_pkt_set_edns_data + +ldns_pkt_new, ldns_pkt_free, ldns_pkt_print, ldns_pkt_query_new, ldns_pkt_query_new_frm_str, ldns_pkt_reply_type | ldns_pkt +# gets +ldns_pkt_id, ldns_pkt_qr, ldns_pkt_aa, ldns_pkt_tc, ldns_pkt_rd, ldns_pkt_cd, ldns_pkt_ra, ldns_pkt_ad, ldns_pkt_get_opcode, ldns_pkt_get_rcode, ldns_pkt_qdcount, ldns_pkt_ancount, ldns_pkt_nscount, ldns_pkt_arcount, ldns_pkt_answerfrom, ldns_pkt_querytime, ldns_pkt_size, ldns_pkt_tsig, ldns_pkt_question, ldns_pkt_answer, ldns_pkt_authority, ldns_pkt_additional, ldns_pkt_get_section_clone, ldns_pkt_rr_list_by_name, ldns_pkt_rr_list_by_type, ldns_pkt_rr_list_by_name_and_type | ldns_pkt +# sets +ldns_pkt_set_flags, ldns_pkt_set_id, ldns_pkt_set_qr, ldns_pkt_set_aa, ldns_pkt_set_tc, ldns_pkt_set_rd, ldns_pkt_set_cd, ldns_pkt_set_ra, ldns_pkt_set_ad, ldns_pkt_set_opcode, ldns_pkt_set_rcode, ldns_pkt_set_qdcount, ldns_pkt_set_ancount, ldns_pkt_set_nscount, ldns_pkt_set_arcount, ldns_pkt_set_answerfrom, ldns_pkt_set_querytime, ldns_pkt_set_size, ldns_pkt_set_section_count, ldns_pkt_set_tsig | ldns_pkt +# EDNS0 +ldns_pkt_edns, ldns_pkt_edns_udp_size, ldns_pkt_edns_extended_rcode, ldns_pkt_edns_version, ldns_pkt_edns_z, ldns_pkt_edns_data, ldns_pkt_set_edns_udp_size, ldns_pkt_set_edns_extended_rcode, ldns_pkt_set_edns_version, ldns_pkt_set_edns_z, ldns_pkt_set_edns_data | ldns_pkt + +# rr_functions.h +ldns_rr_ns_nsdname +# +ldns_rr_mx_preference, ldns_rr_mx_exchange +# +ldns_rr_rrsig_typecovered, ldns_rr_rrsig_set_typecovered, ldns_rr_rrsig_algorithm, ldns_rr_rrsig_set_algorithm, ldns_rr_rrsig_labels, ldns_rr_rrsig_set_labels, ldns_rr_rrsig_origttl, ldns_rr_rrsig_set_origttl, ldns_rr_rrsig_expiration, ldns_rr_rrsig_set_expiration, ldns_rr_rrsig_inception, ldns_rr_rrsig_set_inception, ldns_rr_rrsig_keytag, ldns_rr_rrsig_set_keytag, ldns_rr_rrsig_signame, ldns_rr_rrsig_set_signame, ldns_rr_rrsig_sig, ldns_rr_rrsig_set_sig +# +ldns_rr_dnskey_flags, ldns_rr_dnskey_set_flags, ldns_rr_dnskey_protocol, ldns_rr_dnskey_set_protocol, ldns_rr_dnskey_algorithm, ldns_rr_dnskey_set_algorithm, ldns_rr_dnskey_key, ldns_rr_dnskey_set_key | ldns_rr + +### zone.h +ldns_zone | ldns_zone_new, ldns_zone_deep_free, ldns_zone_new_frm_fp, ldns_zone_new_frm_fp_l, ldns_zone_sort, ldns_zone_glue_rr_list, ldns_zone_push_rr, ldns_zone_push_rr_list, ldns_zone_set_rrs, ldns_zone_set_soa, ldns_zone_rrs, ldns_zone_soa, ldns_zone_rr_count, + + +ldns_zone_new, ldns_zone_deep_free, ldns_zone_new_frm_fp, ldns_zone_new_frm_fp_l | ldns_zone +ldns_zone_sort, ldns_zone_glue_rr_list | ldns_zone +ldns_zone_push_rr, ldns_zone_push_rr_list | ldns_zone +ldns_zone_set_rrs, ldns_zone_set_soa | ldns_zone, ldns_zone_rrs, ldns_zone_soa +ldns_zone_rrs, ldns_zone_soa | ldns_zone ldns_zone_set_rrs +ldns_zone_rr_count | ldns_zone + +### update.h +ldns_update_pkt_new | ldns_update_pkt_tsig_add, ldns_update_pkt_tsig_add, ldns_update_zocount, ldns_update_prcount, ldns_update_upcount, ldns_update_adcount, ldns_update_set_zocount, ldns_update_set_prcount, ldns_update_set_upcount, ldns_update_set_adcount, + +ldns_update_pkt_tsig_add | ldns_update_pkt_new +ldns_update_zocount, ldns_update_prcount, ldns_update_upcount, ldns_update_adcount | ldns_update_pkt_new +ldns_update_set_zocount, ldns_update_set_prcount, ldns_update_set_upcount, ldns_update_set_adcount | ldns_update_pkt_new diff --git a/libs/ldns/doc/header.html b/libs/ldns/doc/header.html new file mode 100644 index 0000000000..5b311bd986 --- /dev/null +++ b/libs/ldns/doc/header.html @@ -0,0 +1,10 @@ + + +ldns documentation + + + + diff --git a/libs/ldns/doc/images/LogoInGradientBar2-y100.png b/libs/ldns/doc/images/LogoInGradientBar2-y100.png new file mode 100644 index 0000000000000000000000000000000000000000..0e753611279d503619e61b5e518ac2b0f8bb03dc GIT binary patch literal 60773 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
+   % ldns-mx nlnetlabs.nl
+   nlnetlabs.nl.   86400   IN      MX      100 omval.tednet.nl.
+   nlnetlabs.nl.   86400   IN      MX      50 open.nlnetlabs.nl.
+   
+ + First of all, we need to include the correct header files, so + that all functions are available to us: + + \skip include + \until dns.h + + In this case we have used a configure script to generate a config.h file + that does all our inclusions for us, so that it can be compiled on + multiple platforms. If your platform supports the include files \c + stdint.h and \c stdlib.h, you can include these instead of using a + configure script. + + The first included files are prerequisites that ldns needs to function. + The last one, of course, includes the functions of ldns itself. + + In our main function, we declare some variables that we are going to use: + + \skipline ldns_resolver + \until ldns_status + + - The \c ldns_resolver structure keeps a list of nameservers, and can perform queries for us + - An \c ldns_rdf is a basic data type of dns, the RDATA. See \ref design for a description about the building blocks of DNS. + In this case, \c domain will be used to store the name the user specifies when calling the program + - An \c ldns_pkt is a DNS packet, for instance a complete query, or an answer + - The \c ldns_rr_list structure contains a list of DNS Resource Records (RRs). In this case, we will store the MX records we find in the list. + - \c ldns_status is the basic type for status messages in ldns. Most functions will return a value of this type. + + First, we parse the command line argument (checks omitted on this page, see full source code), and store it in our \c domain variable: + \skipline ldns_dname_new_frm_str + + This function takes a string containing a domain name (like + "nlnetlabs.nl") and returns an \c ldns_rdf representing that name. If + somehow the given string can not be parsed it returns NULL. + + Then, we create the resolver structure: + \skipline ldns_resolver_new + + Most of the functions work like this, the first argument is a pointer to + the structure where ldns should store its results (which is also a + pointer). The function returns a status code indicating success + (\ref LDNS_STATUS_OK) or an error number. Remember that these types of + functions allocate memory that you should free later (using the + ldns_free_ functions). + + The second argument is the filename that contains information about the + resolver structure that is to be created. If this argument is NULL, + /etc/resolv.conf is used. The syntax of the file is like that of + /etc/resolv.conf. + + + + We tell the resolver to query for our domain, type MX, of class IN: + \skipline ldns_resolver_query + \until ) + + The last argument contains flags to influence the type of query the + resolver structure sends. In this case, we want the nameserver to use + recursion, so that we'll get the final answer. Therefore, we specify the + \ref LDNS_RD (Recursion Desired) flag. + + This should return a packet if everything goes well. + + We get all RRs of type MX from the answer packet and store them in our list: + \skipline ldns_pkt_rr_list_by_type + \until ) + + If this list is not empty, we sort and print it: + \skipline ldns_rr_list_sort + \skipline ldns_rr_list_print + + And finally, just to be proper, we free our allocated data: + \skipline free( + \until resolver_deep_free + + For structures that can contain other ldns structures, there are two types of free() function available + - \c ldns_free_ frees only the allocated data for the structure itself. + - \c ldns_deep_free_ frees the structure, and ALL structures that + are nested in it. For example, of you \c deep_free an ldns_rr_list, + all \c ldns_rr structures that were present in the list are also + freed. + + +*/ diff --git a/libs/ldns/doc/tutorial2_zone.dox b/libs/ldns/doc/tutorial2_zone.dox new file mode 100644 index 0000000000..680ccb46a3 --- /dev/null +++ b/libs/ldns/doc/tutorial2_zone.dox @@ -0,0 +1,111 @@ +/** + \page tutorial2_zone Tutorial 2: Reading a zone file + \dontinclude ldns-read-zone.c + + The full source code can be found in \link examples/ldns-read-zone.c \endlink + + ldns-read-zone reads a zone file, and prints it to stdout, with 1 resource record per line. + +
+% cat example.zone
+$ORIGIN example.
+$TTL 600
+
+example.        IN SOA  example. op.example. (
+                                2004022501 ; serial
+                                28800      ; refresh (8 hours)
+                                7200       ; retry (2 hours)
+                                604800     ; expire (1 week)
+                                18000      ; minimum (5 hours)
+                                )
+
+@       IN      MX      10 mail.example.
+@       IN      NS      ns1
+@       IN      NS      ns2
+@       IN      A       123.123.123.123
+
+% ldns-read-zone example.zone
+example.        600     IN      SOA     example. op.example. 2004022501 28800 7200 604800 18000
+example.        600     IN      MX      10 mail.example.
+example.        600     IN      NS      ns1.example.
+example.        600     IN      NS      ns2.example.
+example.        600     IN      A       123.123.123.123
+   
+ + + +Again, let's start with including some necessary header files: + +\skipline include +\until errno + +In this example, we are going to open a file, if that fails, we'll need errno.h to display an error message. + +Okay, let's declare the variables we are going to need today: + +\skipline filename +\until ldns_status + +The only two ldns-specific types here are \c ldns_zone and \c ldns_status. + - \c ldns_zone is the structure that can contain a complete zone + - \c ldns_status again is used to check return values of ldns functions + + +If we get no filename, we'll read standard input, otherwise, we'll try to +open the given filename: +\skipline if (argc == 0) +\until exit(EXIT_FAILURE) +\until } +\until } + + +With the \c FILE pointer in our hands, we visit ldns to pour it into a zone +structure: +\skipline ldns_zone_new_frm_fp_l + +There is also a \c ldns_zone_new_frm_fp, but this one also remembers the +line number it was on, so we can use that if we encounter a parse error. + +Just like in \ref tutorial1_mx, the first argument is a pointer +to the place ldns should store its creation in, and again, the return value +is the status code. + +The second argument is the file pointer where our zone data should reside. + +The third argument, if not NULL, is a \c dname that contains the zones +origin. It will place this dname after every name in the file that is not a +fully qualified domain name. + +The fourth argument, if not 0, is the default TTL to use. + +Both these values can be specified in the zone file by setting \c $ORIGIN and \c $TTL. + +The fifth argument specifies the default class, which defaults to IN (\ref LDNS_RR_CLASS_IN). + +And finally, every time \c ldns_zone_new_frm_fp_l reads a line from the +input file pointer, it will increment the value pointed to by the last +argument with 1. + + +Okay, with that, we should have a nice zone structure. Of course we need to +check whether it has succeeded. + +\skipline LDNS_STATUS_OK +\until deep_free + +If everything went well, we sort the zone if necessary, print it, and free it. + +Since \c ldns_zone contains other ldns structures, we use \c ldns_deep_free +so that every \c ldns_rr_list, \c ldns_rr et cetera are freed too. + +\until line_nr); +\until } + +If something went wrong, we use \c ldns_get_errorstr_by_id() to get a nice +error string instead of just a status integer. + +And of course, we should play nice and close the file: +\skipline fclose +\until exit + +*/ diff --git a/libs/ldns/doc/tutorial3_signzone.dox b/libs/ldns/doc/tutorial3_signzone.dox new file mode 100644 index 0000000000..1943e557ae --- /dev/null +++ b/libs/ldns/doc/tutorial3_signzone.dox @@ -0,0 +1,206 @@ +/** + \page tutorial3_signzone Tutorial 3: Signing a zone file + \dontinclude ldns-signzone.c + + The full source code can be found in \link examples/ldns-signzone.c \endlink + + Of course, we start by the usual includes. Since we need a bit more here, + we'll add those right away. + + \skipline include + \until define + + Let's skip the boring usage() and sanity check functions, and dive right + into main(). + + \skipline main(int argc + \skipline { + + We'll be reading another zone file, so let's prepare some variables for that. + + \skipline zone + \until argi + + We will create a separate zone structure for the signed zone, so let's have a clear name for the original one. + + \skipline zone + \until zone + + To sign a zone, we need keys, so we need some variables to read and store it; + + \skipline key + \until status + + The \ref ldns_key structure holds (private) keys. These can be of any + supported algorithm type; you can put an RSA key in it, an DSA key, or an + HMAC key. Public keys can simply be put in an \ref ldns_rr structure with + type \ref LDNS_RR_TYPE_DNSKEY. + + The \ref ldns_key_list type is much like the \ref ldns_rr_list, only, you + guessed it, for \c ldns_key entries. + + + The signed zone will be stored in a new file. + + \skipline file + \until file + + And we have some command line options for the output zone. + + \skipline tm + \until class + + \c origin is a domain name, so it can be stored in an \ref ldns_rdf + variable with type \ref LDNS_RDF_TYPE_DNAME. + + The next part is option parsing, which is pretty straightforward using \c + getopt(), so we'll skip this too. U can always look to the source of the + file to check it out. + + Okay that's it for the variables, let's get to work! + + First we'll try to read in the zone that is to be signed. + + \skipline fopen(zone + \until } else { + + If the file exists and can be read, we'll let ldns mold it into a zone + structure: + + \skipline zone_new + + This creates a new (\c new) zone from (\c frm) a filepointer (\c fp), + while remembering the current line (\c l) in the input file (for error + messages). + + A pointer to the zone structure to be filled is passed as the first + argument, like in most \c new_frm functions. + + Like a lot of ldns functions, this one returns a \c ldns_status + indicating success or the type of failure, so let us check that. + + \skipline STATUS + \until } else { + + If everything is ok so far, we check if the zone has a SOA record and contains actual data. + + \skipline orig_soa + \until } + \until } + \until } + + Now that we have the complete zone in our memory, we won't be needing the file anymore. + + \skipline fclose + \until } + + If there was no origin given, we'll use the one derived from the original zone file. + + \skipline origin + \until } + + No signing party can be complete without keys to sign with, let's fetch those. + + Multiple key files can be specified on the command line, by using the + base names of the .key/.private file pairs. + + \skipline key + \until fopen + + As you can see, we append ".private" to the name, which should result in + the complete file name of the private key. Later we'll also form the + ".key" file name, which will be directly included in the signed zone. + + If the file exists, we'll read it and create a \c ldns_key from its + contents, much like the way we read the zone earlier. + + \skipline line_nr + \until STATUS + + If this went ok, we need to set the inception and expiration times, which + are set in the keys, but will eventually end up in the RRSIGs generated + by those keys. + + \skipline expiration + \until } + \skipline inception + \until } + + And now that we have read the private keys, we read the public keys and + add them to the zone. + + Reading them from the files works roughly the same as reading private + keys, but public keys are normal Resource Records, and they can be stored + in general \c ldns_rr structures. + + \skipline FREE + \until } + \until } + + With \c push() we add them to our key list and our zone. This function + clones the data, so we can safely free it after that. + + \skipline push + \until free + + And if we're done, we free the allocated memory for the file name. + + \until FREE + + If the reading did not work, we print an error. Finally, we move on to + the next key in the argument list. + + \skipline } else { + \until } + \until } + \until } + + Just to be sure, we add a little check to see if we actually have any keys now. + + \skipline count + \until } + + So, we have our zone, we have our keys, let's do some signing! + + \skipline sign + + Yes. That's it. We now have a completely signed zone, \c ldns_zone_sign + checks the keys, and uses the zone signing keys to sign the data resource + records. NSEC and RRSIG resource records are generated and added to the + new zone. + + So now that we have a signed zone, all that is left is to store it somewhere. + + If no explicit output file name was given, we'll just append ".signed" to + the original zone file name. + + \skipline outputfile + \until } + + \c ldns_zone_sign returns NULL if the signing did not work, so we must check that. + + \skipline signed_zone + \until } else { + + Writing to a file is no different than normal printing, so we'll print to + the file and close it. + + \skipline print + \until } + + And of course, give an error if the signing failed. + + \skipline } else { + \until } + + Just to be nice, let's free the rest of the data we allocated, and exit + with the right return value. + + \skipline free + \until } + + + + + +*/ \ No newline at end of file diff --git a/libs/ldns/drill/ChangeLog.22-nov-2005 b/libs/ldns/drill/ChangeLog.22-nov-2005 new file mode 100644 index 0000000000..1ce8b0b7c0 --- /dev/null +++ b/libs/ldns/drill/ChangeLog.22-nov-2005 @@ -0,0 +1,105 @@ +--------- Drill now is a subdirectory in ldns. To make life easier +--------- we are using ldns' version numbering for drill from now on. +--------- Sadly this means we GO BACKWARDS in the versions +--------- This ChangeLog will not be updated anymore - all changes are +--------- documented in ldns' ChangeLog + +1.0-pre3: to be released: drill-team + * Secure tracing works + * Added section about DNSSEC in the manual page + * Allow the class information to be given to do_chase() + * Lint fixes for the code + * Bugzilla was setup for drill + * Bug #97 (drill); -S crash was fixed + * Add -Q (quiet) flag was added. This supresses output from drill. + +1.0-pre2: 20 Jun 2005: drill-team + * Second prerelease + * Bugs where fix in the chasing functionality + +1.0-pre1: 1 Jun 2005: drill-team + * First drill release based on ldns + * drill's core code is not much more simple, as + all the difficult stuff is moved to ldns. + * Much saner argument parsing + +---------- Above Newer drill based on ldns -------------- +---------- Below Older drill with it's own DNS handling -------------- + +0.9.2: Feb 3 2005: drill-team + * Added two more options (borrowed from dig) + --rd, don't set the RD bit in queries + --fail, don't query the next nameserver on SERVFAIL + * Fixed handling of obscure data types + * Handle classes other the 'IN' when making a query + + * For people using FreeBSD: drill is now in the ports + (Thanks to Jaap Akkerhuis) + +0.9.1: Jan 5 2005: drill-team + * Makefile tweaks + * drill ns . works + * re-check the root in when tracing + * added handling for some lesser known types (including WKS) + +0.9: Dec 6 2004: drill-team + * big configure.ac and Makefile.in updates (made more general) + * escapes in names argument and txt and dname data + * gcc 2(.95) support + * packet wire data is now checked for dangerous elements (like + looping compression etc) + * (Multiple) Octal char representation + * Responses can be saved to file + * 'Answers' can be read from file instead of server + * Lots and lots of bugfixes and improvements + +0.8.1: Oct 27 2004: Miek + * configure.ac updates + * secure resolving updates (still doesn't work) + * printing additions + - CERT RR supported + - LOC RR support + * All non supported RRs are handled as unknown + * If no namservers found in /etc/resolv.conf + default to 127.0.0.1 + * Various bugs fixed + - Close sockets after using them + - Some memory leaks were plugged + +0.8: Oct 26 2004: Miek + * Lots of features added. Drill is almost feature complete + * Unknown RR's are supported + * Numerous smaller updates in documentation + * Numerous code cleanups + * Dig is no longer needed to build drill + +0.7: Oct 21 2004: Miek + * reworked interal code + * DNSSEC is working, except the secure resolving + * build updates + * more sane options parsing + * more sane argument handling + +0.6-alpha: Oct 2004: Jelte + * No log + +0.5-alpha: Sept 22 2004: Miek + * most of the DNS stuff is working + * moved to configure + * tested on Linux/FreeBSD + * fully IPV6 capable + * new DNSSEC types supported + * DNSSEC somewhat working + * gcc => 3 is needed for building + +0.4-alpha: Sept 9 2004: Miek + * moved to autoconf for building + * lots of various updates + * really a workable program now + +0.3-alpha: Sept 6 2004: Miek + * IPv6 support + * automatic secure resolving + * --trace updates + * --chase updates + * more checks diff --git a/libs/ldns/drill/Makefile.in b/libs/ldns/drill/Makefile.in new file mode 100644 index 0000000000..653cc51bce --- /dev/null +++ b/libs/ldns/drill/Makefile.in @@ -0,0 +1,117 @@ +# Standard installation pathnames +# See the file LICENSE for the license +SHELL = @SHELL@ +VERSION = @PACKAGE_VERSION@ +basesrcdir = $(shell basename `pwd`) +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +mandir = @mandir@ +includedir = @includedir@ + +CC = @CC@ +CFLAGS = -I. @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +INSTALL = $(srcdir)/install-sh -c +INSTALL_PROGRAM = $(INSTALL) +LDNSDIR = @LDNSDIR@ +LIBS_STC = @LIBS_STC@ + +COMPILE = $(CC) $(CPPFLAGS) $(CFLAGS) -I. -I$(srcdir) +LINK = $(CC) $(CFLAGS) $(LDFLAGS) + +LINT = splint +LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list +#-Dglob64=glob -Dglobfree64=globfree +# compat with openssl linux edition. +LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" +# compat with NetBSD +ifeq "$(shell uname)" "NetBSD" +LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ +endif +# compat with OpenBSD +LINTFLAGS+="-Dsigset_t=long" +# FreeBSD8 +LINTFLAGS+="-D__uint16_t=uint16_t" +LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)=" + +OBJ=drill.o drill_util.o error.o root.o work.o chasetrace.o dnssec.o securetrace.o +SRC=$(OBJ:.o=.c) + +HEADER=drill.h $(srcdir)/drill_util.h + +.PHONY: all clean realclean docclean doc release tags install all-static + +all: drill +all-static: drill-stc + +tags: + ctags *.[ch] + +drill: $(OBJ) + $(LINK) -o drill $(OBJ) $(LIBS) + +drill-stc: $(OBJ) + $(LINK) -o drill $(OBJ) $(LIBS_STC) + +## implicit rule +%.o: $(srcdir)/%.c + $(COMPILE) -c $< + +clean: + rm -f ${OBJ} + rm -f drill + rm -f *core + rm -f config.h.in~ + rm -f config.log + rm -f config.guess + rm -f config.status + +docclean: + rm -rf doxydoc + +distclean: clean docclean + rm -f config.h + rm -f drill.h + +realclean: clean docclean + rm -f tags + rm -f config.log + rm -f config.sub + rm -f ltmain.sh + rm -f config.status + rm -rf autom4te.cache + rm -f config.h + rm -f config.h.in + rm -f drill.h + rm -f configure + rm -f Makefile + rm -f aclocal.m4 + +doc: + doxygen drill.doxygen + +install: all + $(INSTALL) -d $(DESTDIR)$(bindir) + $(INSTALL) drill $(DESTDIR)$(bindir)/drill + $(INSTALL) -m 644 $(srcdir)/drill.1 $(DESTDIR)$(mandir)/man1/drill.1 + +uninstall: + @echo + rm -f -- $(DESTDIR)$(bindir)/drill + rm -f -- $(DESTDIR)$(mandir)/man1/drill.1 + rmdir -p $(DESTDIR)$(bindir) + rmdir -p $(DESTDIR)$(mandir)/man1 + @echo + +lint: + @for i in $(SRC) ; do \ + $(LINT) $(LINTFLAGS) $(CPPFLAGS) -I$(srcdir) $(srcdir)/$$i ; \ + if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ + done + +confclean: clean + rm -rf config.log config.status config.h Makefile diff --git a/libs/ldns/drill/README b/libs/ldns/drill/README new file mode 100644 index 0000000000..bbbb816ef4 --- /dev/null +++ b/libs/ldns/drill/README @@ -0,0 +1,12 @@ +QUICK INSTALL GUIDE + +drill is a subdirectory in ldns. + +To compile drill you need: +autoreconf && ./configure && make + +If ldns is installed in a different location, use --with-ldns=directory +See also ./configure --help + +In the first case you must run drill as: +LD_LIBRARY_PATH=../.libs ./drill diff --git a/libs/ldns/drill/REGRESSIONS b/libs/ldns/drill/REGRESSIONS new file mode 100644 index 0000000000..b8f6be9cc9 --- /dev/null +++ b/libs/ldns/drill/REGRESSIONS @@ -0,0 +1,25 @@ +REGRESSIONS + +This version of drill is based on ldns and as such some things +are slightly changed. This file documents the changes. + +o When tracing (-T option) we use the local resolver (as specified + in /etc/resolv.conf) to lookup names. This increases the speed + dramatically, but you obviously need to be able to reach a recursive + server/cache. + Previously drill would try to resolve the names by itself. + +o Printing of DSs after DNSKEY records. Because we don't parse our + own packets anymore, we cannot print the DS directly after the DNSKEY + record. The DSs are now printed AFTER the packet. + +o The long options are removed. + +o The chase function has a different output, and will be subject to change + in the near future. + +o The useless (for jokes only) -I option was dropped. + +FIXED: +o the argument parsing is much smarter, the order doesn't matter (much) + anymore diff --git a/libs/ldns/drill/chasetrace.c b/libs/ldns/drill/chasetrace.c new file mode 100644 index 0000000000..a1dfd44681 --- /dev/null +++ b/libs/ldns/drill/chasetrace.c @@ -0,0 +1,401 @@ +/* + * chasetrace.c + * Where all the hard work concerning chasing + * and tracing is done + * (c) 2005, 2006 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +/** + * trace down from the root to name + */ + +/* same naive method as in drill0.9 + * We resolver _ALL_ the names, which is ofcourse not needed + * We _do_ use the local resolver to do that, so it still is + * fast, but it can be made to run much faster + */ +ldns_pkt * +do_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c) +{ + ldns_resolver *res; + ldns_pkt *p; + ldns_rr_list *new_nss_a; + ldns_rr_list *new_nss_aaaa; + ldns_rr_list *final_answer; + ldns_rr_list *new_nss; + ldns_rr_list *hostnames; + ldns_rr_list *ns_addr; + uint16_t loop_count; + ldns_rdf *pop; + ldns_status status; + size_t i; + + loop_count = 0; + new_nss_a = NULL; + new_nss_aaaa = NULL; + new_nss = NULL; + ns_addr = NULL; + final_answer = NULL; + p = ldns_pkt_new(); + res = ldns_resolver_new(); + + if (!p || !res) { + error("Memory allocation failed"); + return NULL; + } + + /* transfer some properties of local_res to res, + * because they were given on the commandline */ + ldns_resolver_set_ip6(res, + ldns_resolver_ip6(local_res)); + ldns_resolver_set_port(res, + ldns_resolver_port(local_res)); + ldns_resolver_set_debug(res, + ldns_resolver_debug(local_res)); + ldns_resolver_set_dnssec(res, + ldns_resolver_dnssec(local_res)); + ldns_resolver_set_fail(res, + ldns_resolver_fail(local_res)); + ldns_resolver_set_usevc(res, + ldns_resolver_usevc(local_res)); + ldns_resolver_set_random(res, + ldns_resolver_random(local_res)); + ldns_resolver_set_recursive(res, false); + + /* setup the root nameserver in the new resolver */ + status = ldns_resolver_push_nameserver_rr_list(res, global_dns_root); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding root servers to resolver: %s\n", ldns_get_errorstr_by_id(status)); + ldns_rr_list_print(stdout, global_dns_root); + return NULL; + } + + /* this must be a real query to local_res */ + status = ldns_resolver_send(&p, res, ldns_dname_new_frm_str("."), LDNS_RR_TYPE_NS, c, 0); + /* p can still be NULL */ + + + if (ldns_pkt_empty(p)) { + warning("No root server information received"); + } + + if (status == LDNS_STATUS_OK) { + if (!ldns_pkt_empty(p)) { + drill_pkt_print(stdout, local_res, p); + } + } else { + error("cannot use local resolver"); + return NULL; + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + + while(status == LDNS_STATUS_OK && + ldns_pkt_reply_type(p) == LDNS_PACKET_REFERRAL) { + + if (!p) { + /* some error occurred, bail out */ + return NULL; + } + + new_nss_a = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); + new_nss_aaaa = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_AAAA, LDNS_SECTION_ADDITIONAL); + new_nss = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); + + if (verbosity != -1) { + ldns_rr_list_print(stdout, new_nss); + } + /* checks itself for verbosity */ + drill_pkt_print_footer(stdout, local_res, p); + + /* remove the old nameserver from the resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { /* do it */ } + + /* also check for new_nss emptyness */ + + if (!new_nss_aaaa && !new_nss_a) { + /* + * no nameserver found!!! + * try to resolve the names we do got + */ + for(i = 0; i < ldns_rr_list_rr_count(new_nss); i++) { + /* get the name of the nameserver */ + pop = ldns_rr_rdf(ldns_rr_list_rr(new_nss, i), 0); + if (!pop) { + break; + } + + ldns_rr_list_print(stdout, new_nss); + ldns_rdf_print(stdout, pop); + /* retrieve it's addresses */ + ns_addr = ldns_rr_list_cat_clone(ns_addr, + ldns_get_rr_list_addr_by_name(local_res, pop, c, 0)); + } + + if (ns_addr) { + if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != + LDNS_STATUS_OK) { + error("Error adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + ldns_rr_list_free(ns_addr); + } else { + ldns_rr_list_print(stdout, ns_addr); + error("Could not find the nameserver ip addr; abort"); + ldns_pkt_free(p); + return NULL; + } + } + + /* add the new ones */ + if (new_nss_aaaa) { + if (ldns_resolver_push_nameserver_rr_list(res, new_nss_aaaa) != + LDNS_STATUS_OK) { + error("adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + } + if (new_nss_a) { + if (ldns_resolver_push_nameserver_rr_list(res, new_nss_a) != + LDNS_STATUS_OK) { + error("adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + } + + if (loop_count++ > 20) { + /* unlikely that we are doing something usefull */ + error("Looks like we are looping"); + ldns_pkt_free(p); + return NULL; + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + new_nss_aaaa = NULL; + new_nss_a = NULL; + ns_addr = NULL; + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (!p) { + return NULL; + } + + hostnames = ldns_get_rr_list_name_by_addr(local_res, + ldns_pkt_answerfrom(p), 0, 0); + + new_nss = ldns_pkt_authority(p); + final_answer = ldns_pkt_answer(p); + + if (verbosity != -1) { + ldns_rr_list_print(stdout, final_answer); + ldns_rr_list_print(stdout, new_nss); + + } + drill_pkt_print_footer(stdout, local_res, p); + ldns_pkt_free(p); + return NULL; +} + + +/** + * Chase the given rr to a known and trusted key + * + * Based on drill 0.9 + * + * the last argument prev_key_list, if not null, and type == DS, then the ds + * rr list we have must all be a ds for the keys in this list + */ +#ifdef HAVE_SSL +ldns_status +do_chase(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c, + ldns_rr_list *trusted_keys, + ldns_pkt *pkt_o, + uint16_t qflags, + ldns_rr_list *prev_key_list, + int verbosity) +{ + ldns_rr_list *rrset = NULL; + ldns_status result; + ldns_rr *orig_rr = NULL; + + bool cname_followed = false; +/* + ldns_rr_list *sigs; + ldns_rr *cur_sig; + uint16_t sig_i; + ldns_rr_list *keys; +*/ + ldns_pkt *pkt; + ldns_status tree_result; + ldns_dnssec_data_chain *chain; + ldns_dnssec_trust_tree *tree; + + const ldns_rr_descriptor *descriptor; + descriptor = ldns_rr_descript(type); + + ldns_dname2canonical(name); + + pkt = ldns_pkt_clone(pkt_o); + if (!name) { + mesg("No name to chase"); + ldns_pkt_free(pkt); + return LDNS_STATUS_EMPTY_LABEL; + } + if (verbosity != -1) { + printf(";; Chasing: "); + ldns_rdf_print(stdout, name); + if (descriptor && descriptor->_name) { + printf(" %s\n", descriptor->_name); + } else { + printf(" type %d\n", type); + } + } + + if (!trusted_keys || ldns_rr_list_rr_count(trusted_keys) < 1) { + warning("No trusted keys specified"); + } + + if (pkt) { + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + type, + LDNS_SECTION_ANSWER + ); + if (!rrset) { + /* nothing in answer, try authority */ + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + type, + LDNS_SECTION_AUTHORITY + ); + } + /* answer might be a cname, chase that first, then chase + cname target? (TODO) */ + if (!rrset) { + cname_followed = true; + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + LDNS_RR_TYPE_CNAME, + LDNS_SECTION_ANSWER + ); + if (!rrset) { + /* nothing in answer, try authority */ + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + LDNS_RR_TYPE_CNAME, + LDNS_SECTION_AUTHORITY + ); + } + } + } else { + /* no packet? */ + if (verbosity >= 0) { + fprintf(stderr, "%s", ldns_get_errorstr_by_id(LDNS_STATUS_MEM_ERR)); + fprintf(stderr, "\n"); + } + return LDNS_STATUS_MEM_ERR; + } + + if (!rrset) { + /* not found in original packet, try again */ + ldns_pkt_free(pkt); + pkt = NULL; + pkt = ldns_resolver_query(res, name, type, c, qflags); + + if (!pkt) { + if (verbosity >= 0) { + fprintf(stderr, "%s", ldns_get_errorstr_by_id(LDNS_STATUS_NETWORK_ERR)); + fprintf(stderr, "\n"); + } + return LDNS_STATUS_NETWORK_ERR; + } + if (verbosity >= 5) { + ldns_pkt_print(stdout, pkt); + } + + rrset = ldns_pkt_rr_list_by_name_and_type(pkt, + name, + type, + LDNS_SECTION_ANSWER + ); + } + + orig_rr = ldns_rr_new(); + +/* if the answer had no answer section, we need to construct our own rr (for instance if + * the rr qe asked for doesn't exist. This rr will be destroyed when the chain is freed */ + if (ldns_pkt_ancount(pkt) < 1) { + ldns_rr_set_type(orig_rr, type); + ldns_rr_set_owner(orig_rr, ldns_rdf_clone(name)); + + chain = ldns_dnssec_build_data_chain(res, qflags, rrset, pkt, ldns_rr_clone(orig_rr)); + } else { + /* chase the first answer */ + chain = ldns_dnssec_build_data_chain(res, qflags, rrset, pkt, NULL); + } + + if (verbosity >= 4) { + printf("\n\nDNSSEC Data Chain:\n"); + ldns_dnssec_data_chain_print(stdout, chain); + } + + result = LDNS_STATUS_OK; + + tree = ldns_dnssec_derive_trust_tree(chain, NULL); + + if (verbosity >= 2) { + printf("\n\nDNSSEC Trust tree:\n"); + ldns_dnssec_trust_tree_print(stdout, tree, 0, true); + } + + if (ldns_rr_list_rr_count(trusted_keys) > 0) { + tree_result = ldns_dnssec_trust_tree_contains_keys(tree, trusted_keys); + + if (tree_result == LDNS_STATUS_DNSSEC_EXISTENCE_DENIED) { + if (verbosity >= 1) { + printf("Existence denied or verifiably insecure\n"); + } + result = LDNS_STATUS_OK; + } else if (tree_result != LDNS_STATUS_OK) { + if (verbosity >= 1) { + printf("No trusted keys found in tree: first error was: %s\n", ldns_get_errorstr_by_id(tree_result)); + } + result = tree_result; + } + + } else { + if (verbosity >= 0) { + printf("You have not provided any trusted keys.\n"); + } + } + + ldns_rr_free(orig_rr); + ldns_dnssec_trust_tree_free(tree); + ldns_dnssec_data_chain_deep_free(chain); + + ldns_rr_list_deep_free(rrset); + ldns_pkt_free(pkt); + /* ldns_rr_free(orig_rr);*/ + + return result; +} +#endif /* HAVE_SSL */ + diff --git a/libs/ldns/drill/config.h.in b/libs/ldns/drill/config.h.in new file mode 100644 index 0000000000..9b2a282a8e --- /dev/null +++ b/libs/ldns/drill/config.h.in @@ -0,0 +1,293 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Whether getaddrinfo is available */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* If you have HMAC_CTX_init */ +#undef HAVE_HMAC_CTX_INIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define to 1 if you have the `ldns' library (-lldns). */ +#undef HAVE_LIBLDNS + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP6_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_UDP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have the SSL libraries installed. */ +#undef HAVE_SSL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Whether the windows socket API is used */ +#undef USE_WINSOCK + +/* the version of the windows API enabled */ +#undef WINVER + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* in_addr_t */ +#undef in_addr_t + +/* in_port_t */ +#undef in_port_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `short' if does not define. */ +#undef int16_t + +/* Define to `int' if does not define. */ +#undef int32_t + +/* Define to `long long' if does not define. */ +#undef int64_t + +/* Define to `char' if does not define. */ +#undef int8_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to 'int' if not defined */ +#undef socklen_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `unsigned short' if does not define. */ +#undef uint16_t + +/* Define to `unsigned int' if does not define. */ +#undef uint32_t + +/* Define to `unsigned long long' if does not define. */ +#undef uint64_t + +/* Define to `unsigned char' if does not define. */ +#undef uint8_t + + + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif + diff --git a/libs/ldns/drill/configure b/libs/ldns/drill/configure new file mode 100644 index 0000000000..2c79eb811b --- /dev/null +++ b/libs/ldns/drill/configure @@ -0,0 +1,6663 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for ldns 1.6.9. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libdns@nlnetlabs.nl about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='ldns' +PACKAGE_TARNAME='libdns' +PACKAGE_VERSION='1.6.9' +PACKAGE_STRING='ldns 1.6.9' +PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' +PACKAGE_URL='' + +ac_unique_file="drill.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +LDNSDIR +LIBS_STC +RUNTIME_PATH +HAVE_SSL +libtool +SET_MAKE +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_rpath +with_ssl +with_ldns +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CPPFLAGS +CC +LDFLAGS +LIBS +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of ldns 1.6.9:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-rpath disable hardcoded rpath (default=enabled) + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl + /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw + /usr) + --with-ldns=PATH specify prefix of path of ldns library to use + + + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +ldns configure 1.6.9 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------- ## +## Report this to libdns@nlnetlabs.nl ## +## ---------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# acx_nlnetlabs.m4 - common macros for configure checks +# Copyright 2009, Wouter Wijngaards, NLnet Labs. +# BSD licensed. +# +# Version 11 +# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. +# 2010-07-02 Add check for ss_family (for minix). +# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. +# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. +# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl +# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN +# 2010-01-20 added AHX_COONFIG_STRLCAT +# 2009-07-14 U_CHAR detection improved for windows crosscompile. +# added ACX_FUNC_MALLOC +# fixup some #if to #ifdef +# NONBLOCKING test for mingw crosscompile. +# 2009-07-13 added ACX_WITH_SSL_OPTIONAL +# 2009-07-03 fixup LDFLAGS for empty ssl dir. +# +# Automates some of the checking constructs. Aims at portability for POSIX. +# Documentation for functions is below. +# +# the following macro's are provided in this file: +# (see below for details on each macro). +# +# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. +# ACX_RSRC_VERSION - create windows resource version number. +# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. +# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). +# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. +# ACX_DEPFLAG - find cc dependency flags. +# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. +# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. +# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. +# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. +# ACX_TYPE_U_CHAR - u_char type. +# ACX_TYPE_RLIM_T - rlim_t type. +# ACX_TYPE_SOCKLEN_T - socklen_t type. +# ACX_TYPE_IN_ADDR_T - in_addr_t type. +# ACX_TYPE_IN_PORT_T - in_port_t type. +# ACX_ARG_RPATH - add --disable-rpath option. +# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. +# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, +# where --without-ssl is also accepted +# ACX_LIB_SSL - setup to link -lssl. +# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. +# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. +# ACX_FUNC_DEPRECATED - see if func is deprecated. +# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. +# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. +# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. +# ACX_FUNC_MALLOC - check malloc, define replacement . +# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. +# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. +# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. +# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. +# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. +# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. +# AHX_CONFIG_SNPRINTF - snprintf compat prototype +# AHX_CONFIG_INET_PTON - inet_pton compat prototype +# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype +# AHX_CONFIG_INET_ATON - inet_aton compat prototype +# AHX_CONFIG_MEMMOVE - memmove compat prototype +# AHX_CONFIG_STRLCAT - strlcat compat prototype +# AHX_CONFIG_STRLCPY - strlcpy compat prototype +# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype +# AHX_CONFIG_W32_SLEEP - w32 compat for sleep +# AHX_CONFIG_W32_USLEEP - w32 compat for usleep +# AHX_CONFIG_W32_RANDOM - w32 compat for random +# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom +# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. +# ACX_CFLAGS_STRIP - strip one flag from CFLAGS +# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS +# AHX_CONFIG_FLAG_OMITTED - define omitted flag +# AHX_CONFIG_FLAG_EXT - define omitted extension flag +# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags +# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. +# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. +# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family +# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} + +$as_echo "#define WINVER 0x0502" >>confdefs.h + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +for ac_prog in glibtool libtool15 libtool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_libtool+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$libtool"; then + ac_cv_prog_libtool="$libtool" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_libtool="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +libtool=$ac_cv_prog_libtool +if test -n "$libtool"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libtool" >&5 +$as_echo "$libtool" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$libtool" && break +done +test -n "$libtool" || libtool="../libtool" + + +# add option to disable the evil rpath +# Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; enable_rpath=$enableval +else + enable_rpath=yes +fi + + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 +$as_echo_n "checking whether $CC supports -std=c99... " >&6; } +cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-std=c99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 +$as_echo_n "checking whether $CC supports -xc99... " >&6; } +cache=`echo xc99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-xc99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 +$as_echo_n "checking whether $CC supports -O2... " >&6; } +cache=`echo O2 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -O2" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 +$as_echo_n "checking whether $CC supports -Werror... " >&6; } +cache=`echo Werror | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="-Werror" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="-errwarn" +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 +$as_echo_n "checking whether $CC supports -Wall... " >&6; } +cache=`echo Wall | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="$ERRFLAG -Wall" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="$ERRFLAG -errfmt" +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo '#include ' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" +if test "x$ac_cv_type_int8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int8_t char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" +if test "x$ac_cv_type_int16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int16_t short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int32_t int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" +if test "x$ac_cv_type_int64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int64_t long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" +if test "x$ac_cv_type_uint8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint8_t unsigned char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" +if test "x$ac_cv_type_uint16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint16_t unsigned short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" +if test "x$ac_cv_type_uint32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint32_t unsigned int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" +if test "x$ac_cv_type_uint64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint64_t unsigned long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF + +fi + + +for ac_header in sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +$ac_includes_default +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +# MinGW32 tests +for ac_header in winsock2.h ws2tcpip.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " +$ac_includes_default +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +" +if test "x$ac_cv_type_socklen_t" = xyes; then : + +else + +$as_echo "#define socklen_t int" >>confdefs.h + +fi + +for ac_header in sys/param.h sys/mount.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default + + + #if HAVE_SYS_PARAM_H + # include + #endif + + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_addr_t" = xyes; then : + +else + +$as_echo "#define in_addr_t uint32_t" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_port_t" = xyes; then : + +else + +$as_echo "#define in_port_t uint16_t" >>confdefs.h + +fi + + +# check to see if libraries are needed for these functions. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break +fi +done +if ${ac_cv_search_socket+:} false; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 +$as_echo_n "checking for library containing inet_pton... " >&6; } +if ${ac_cv_search_inet_pton+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_pton (); +int +main () +{ +return inet_pton (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_inet_pton=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_inet_pton+:} false; then : + break +fi +done +if ${ac_cv_search_inet_pton+:} false; then : + +else + ac_cv_search_inet_pton=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 +$as_echo "$ac_cv_search_inet_pton" >&6; } +ac_res=$ac_cv_search_inet_pton +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + + + +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; + +else + + withval="yes" + +fi + + + withval=$withval + if test x_$withval != x_no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 +$as_echo_n "checking for SSL... " >&6; } + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" + fi + for dir in $withval; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes" + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSL /**/ +_ACEOF + + if test "$ssldir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" + fi + break; + fi + done + if test x_$found_ssl != x_yes; then + as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 +$as_echo "found in $ssldir" >&6; } + HAVE_SSL=yes + if test "$ssldir" != "/usr" -a "$ssldir" != ""; then + LDFLAGS="$LDFLAGS -L$ssldir/lib" + LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" + + if test "x$enable_rpath" = xyes; then + if echo "$ssldir/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" + fi + fi + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } + LIBS="$LIBS -lcrypto" + LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + # check if -lwsock32 or -lgdi32 are needed. + BAKLIBS="$LIBS" + BAKSSLLIBS="$LIBSSL_LIBS" + LIBS="$LIBS -lgdi32" + LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 +$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 +$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + + + # openssl engine functionality needs dlopen(). + BAKLIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_dlopen+:} false; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + if test "$LIBS" != "$BAKLIBS"; then + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + fi + fi +for ac_header in openssl/ssl.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_SSL_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/err.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_err_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_ERR_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/rand.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_rand_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_RAND_H 1 +_ACEOF + +fi + +done + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 +$as_echo_n "checking for getaddrinfo... " >&6; } +ac_cv_func_getaddrinfo=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_getaddrinfo="yes" +else + ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +int +main () +{ + + (void)getaddrinfo(NULL, NULL, NULL, NULL); + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +ac_cv_func_getaddrinfo="yes" + +$as_echo "#define USE_WINSOCK 1" >>confdefs.h + +USE_WINSOCK="1" + +else + +ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 +$as_echo "$ac_cv_func_getaddrinfo" >&6; } +if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h + +fi + + +LIBS_STC="$LIBS" + + +# check for ldns + +# Check whether --with-ldns was given. +if test "${with_ldns+set}" = set; then : + withval=$with_ldns; + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + LIBS="-lldns $LIBS" + LIBS_STC="$withval/lib/libldns.a $LIBS_STC" + + +fi + + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +for ac_func in isblank +do : + ac_fn_c_check_func "$LINENO" "isblank" "ac_cv_func_isblank" +if test "x$ac_cv_func_isblank" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_ISBLANK 1 +_ACEOF + +fi +done + + +# check for ldns development source tree +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns devel source" >&5 +$as_echo_n "checking for ldns devel source... " >&6; } +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $ldns_dev_dir with $ldns_version" >&5 +$as_echo "using $ldns_dev_dir with $ldns_version" >&6; } + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="-lldns $LIBS" + +$as_echo "#define HAVE_LIBLDNS 1" >>confdefs.h + + LDNSDIR="$ldns_dev_dir" + LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 +$as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } +if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldns $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ldns_rr_new (); +int +main () +{ +return ldns_rr_new (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ldns_ldns_rr_new=yes +else + ac_cv_lib_ldns_ldns_rr_new=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 +$as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } +if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBLDNS 1 +_ACEOF + + LIBS="-lldns $LIBS" + +else + + as_fn_error $? "Can't find ldns library" "$LINENO" 5 + + +fi + +fi + + + + + +ac_config_files="$ac_config_files Makefile drill.h" + +ac_config_headers="$ac_config_headers config.h" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +ldns config.status 1.6.9 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "drill.h") CONFIG_FILES="$CONFIG_FILES drill.h" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/libs/ldns/drill/configure.ac b/libs/ldns/drill/configure.ac new file mode 100644 index 0000000000..3c5a6f2e00 --- /dev/null +++ b/libs/ldns/drill/configure.ac @@ -0,0 +1,261 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.56) +AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns) +AC_CONFIG_SRCDIR([drill.c]) +sinclude(../acx_nlnetlabs.m4) + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} +AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) + +AC_AIX +# Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool]) + +# add option to disable the evil rpath +dnl Check whether to use rpath or not +AC_ARG_ENABLE(rpath, + [ --disable-rpath disable hardcoded rpath (default=enabled)], + enable_rpath=$enableval, enable_rpath=yes) + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + +ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) +ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) + +AC_TYPE_SIZE_T +ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600, +[ +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"]) + + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include ], [CFLAGS="$CFLAGS $C99FLAG"]) + +AC_C_INLINE +AC_CHECK_TYPE(int8_t, char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(int32_t, int) +AC_CHECK_TYPE(int64_t, long long) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(uint16_t, unsigned short) +AC_CHECK_TYPE(uint32_t, unsigned int) +AC_CHECK_TYPE(uint64_t, unsigned long long) +AC_CHECK_TYPE(ssize_t, int) + +AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h arpa/inet.h sys/time.h sys/socket.h sys/select.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/if_ether.h netinet/ip6.h],,, [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif]) +# MinGW32 tests +AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) + +ACX_TYPE_SOCKLEN_T +AC_CHECK_HEADERS([sys/param.h sys/mount.h],,, +[AC_INCLUDES_DEFAULT] +[ + [ + #if HAVE_SYS_PARAM_H + # include + #endif + ] +]) +AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) +AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) + +# check to see if libraries are needed for these functions. +AC_SEARCH_LIBS(socket, socket) +AC_SEARCH_LIBS([inet_pton], [nsl]) + +ACX_WITH_SSL_OPTIONAL + +ACX_CHECK_GETADDRINFO_WITH_INCLUDES + +LIBS_STC="$LIBS" +AC_SUBST(LIBS_STC) + +# check for ldns +AC_ARG_WITH(ldns, + AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use]) + , + [ + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + LIBS="-lldns $LIBS" + LIBS_STC="$withval/lib/libldns.a $LIBS_STC" + ] +) + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +AC_CHECK_FUNCS(isblank) + +# check for ldns development source tree +AC_MSG_CHECKING([for ldns devel source]) +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version]) + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="-lldns $LIBS" + AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.]) + LDNSDIR="$ldns_dev_dir" + LIBS_STC="$ldns_dev_dir/lib/libldns.a $LIBS_STC" +else + AC_MSG_RESULT([no]) + AC_CHECK_LIB(ldns, ldns_rr_new, , [ + AC_MSG_ERROR([Can't find ldns library]) + ] + ) +fi + +AC_SUBST(LDNSDIR) + +AH_BOTTOM([ + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif +]) + +AC_CONFIG_FILES([Makefile + drill.h + ]) +AC_CONFIG_HEADER([config.h]) +AC_OUTPUT diff --git a/libs/ldns/drill/dnssec.c b/libs/ldns/drill/dnssec.c new file mode 100644 index 0000000000..930ac7ce13 --- /dev/null +++ b/libs/ldns/drill/dnssec.c @@ -0,0 +1,509 @@ +/* + * dnssec.c + * Some DNSSEC helper function are defined here + * and tracing is done + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +/* get rr_type from a server from a server */ +ldns_rr_list * +get_rr(ldns_resolver *res, ldns_rdf *zname, ldns_rr_type t, ldns_rr_class c) +{ + /* query, retrieve, extract and return */ + ldns_pkt *p; + ldns_rr_list *found; + + p = ldns_pkt_new(); + found = NULL; + + if (ldns_resolver_send(&p, res, zname, t, c, 0) != LDNS_STATUS_OK) { + /* oops */ + return NULL; + } else { + found = ldns_pkt_rr_list_by_type(p, t, LDNS_SECTION_ANY_NOQUESTION); + } + return found; +} + +void +drill_pkt_print(FILE *fd, ldns_resolver *r, ldns_pkt *p) +{ + ldns_rr_list *new_nss; + ldns_rr_list *hostnames; + + if (verbosity < 5) { + return; + } + + hostnames = ldns_get_rr_list_name_by_addr(r, ldns_pkt_answerfrom(p), 0, 0); + + new_nss = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); + ldns_rr_list_print(fd, new_nss); + + /* new_nss can be empty.... */ + + fprintf(fd, ";; Received %d bytes from %s#%d(", + (int) ldns_pkt_size(p), + ldns_rdf2str(ldns_pkt_answerfrom(p)), + (int) ldns_resolver_port(r)); + /* if we can resolve this print it, other print the ip again */ + if (hostnames) { + ldns_rdf_print(fd, + ldns_rr_rdf(ldns_rr_list_rr(hostnames, 0), 0)); + ldns_rr_list_deep_free(hostnames); + } else { + fprintf(fd, "%s", ldns_rdf2str(ldns_pkt_answerfrom(p))); + } + fprintf(fd, ") in %u ms\n\n", (unsigned int)ldns_pkt_querytime(p)); +} + +void +drill_pkt_print_footer(FILE *fd, ldns_resolver *r, ldns_pkt *p) +{ + ldns_rr_list *hostnames; + + if (verbosity < 5) { + return; + } + + hostnames = ldns_get_rr_list_name_by_addr(r, ldns_pkt_answerfrom(p), 0, 0); + + fprintf(fd, ";; Received %d bytes from %s#%d(", + (int) ldns_pkt_size(p), + ldns_rdf2str(ldns_pkt_answerfrom(p)), + (int) ldns_resolver_port(r)); + /* if we can resolve this print it, other print the ip again */ + if (hostnames) { + ldns_rdf_print(fd, + ldns_rr_rdf(ldns_rr_list_rr(hostnames, 0), 0)); + ldns_rr_list_deep_free(hostnames); + } else { + fprintf(fd, "%s", ldns_rdf2str(ldns_pkt_answerfrom(p))); + } + fprintf(fd, ") in %u ms\n\n", (unsigned int)ldns_pkt_querytime(p)); +} +/* + * generic function to get some RRset from a nameserver + * and possible some signatures too (that would be the day...) + */ +ldns_pkt_type +get_dnssec_rr(ldns_pkt *p, ldns_rdf *name, ldns_rr_type t, + ldns_rr_list **rrlist, ldns_rr_list **sig) +{ + ldns_pkt_type pt = LDNS_PACKET_UNKNOWN; + ldns_rr_list *rr = NULL; + ldns_rr_list *sigs = NULL; + size_t i; + + if (!p) { + if (rrlist) { + *rrlist = NULL; + } + return LDNS_PACKET_UNKNOWN; + } + + pt = ldns_pkt_reply_type(p); + if (name) { + rr = ldns_pkt_rr_list_by_name_and_type(p, name, t, LDNS_SECTION_ANSWER); + if (!rr) { + rr = ldns_pkt_rr_list_by_name_and_type(p, name, t, LDNS_SECTION_AUTHORITY); + } + sigs = ldns_pkt_rr_list_by_name_and_type(p, name, LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_ANSWER); + if (!sigs) { + sigs = ldns_pkt_rr_list_by_name_and_type(p, name, LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_AUTHORITY); + } + } else { + /* A DS-referral - get the DS records if they are there */ + rr = ldns_pkt_rr_list_by_type(p, t, LDNS_SECTION_AUTHORITY); + sigs = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_RRSIG, + LDNS_SECTION_AUTHORITY); + } + if (sig) { + *sig = ldns_rr_list_new(); + for (i = 0; i < ldns_rr_list_rr_count(sigs); i++) { + /* only add the sigs that cover this type */ + if (ldns_rdf2rr_type(ldns_rr_rrsig_typecovered(ldns_rr_list_rr(sigs, i))) == + t) { + ldns_rr_list_push_rr(*sig, ldns_rr_clone(ldns_rr_list_rr(sigs, i))); + } + } + } + ldns_rr_list_deep_free(sigs); + if (rrlist) { + *rrlist = rr; + } + + if (pt == LDNS_PACKET_NXDOMAIN || pt == LDNS_PACKET_NODATA) { + return pt; + } else { + return LDNS_PACKET_ANSWER; + } +} + + +ldns_status +ldns_verify_denial(ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type, ldns_rr_list **nsec_rrs, ldns_rr_list **nsec_rr_sigs) +{ + uint16_t nsec_i; + + ldns_rr_list *nsecs; + ldns_status result; + + if (verbosity >= 5) { + printf("VERIFY DENIAL FROM:\n"); + ldns_pkt_print(stdout, pkt); + } + + result = LDNS_STATUS_CRYPTO_NO_RRSIG; + /* Try to see if there are NSECS in the packet */ + nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC, LDNS_SECTION_ANY_NOQUESTION); + if (nsecs) { + for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsecs); nsec_i++) { + /* there are four options: + * - name equals ownername and is covered by the type bitmap + * - name equals ownername but is not covered by the type bitmap + * - name falls within nsec coverage but is not equal to the owner name + * - name falls outside of nsec coverage + */ + if (ldns_dname_compare(ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), name) == 0) { + /* + printf("CHECKING NSEC:\n"); + ldns_rr_print(stdout, ldns_rr_list_rr(nsecs, nsec_i)); + printf("DAWASEM\n"); + */ + if (ldns_nsec_bitmap_covers_type( + ldns_nsec_get_bitmap(ldns_rr_list_rr(nsecs, + nsec_i)), + type)) { + /* Error, according to the nsec this rrset is signed */ + result = LDNS_STATUS_CRYPTO_NO_RRSIG; + } else { + /* ok nsec denies existence */ + if (verbosity >= 3) { + printf(";; Existence of data set with this type denied by NSEC\n"); + } + /*printf(";; Verifiably insecure.\n");*/ + if (nsec_rrs && nsec_rr_sigs) { + (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), LDNS_RR_TYPE_NSEC, nsec_rrs, nsec_rr_sigs); + } + ldns_rr_list_deep_free(nsecs); + return LDNS_STATUS_OK; + } + } else if (ldns_nsec_covers_name(ldns_rr_list_rr(nsecs, nsec_i), name)) { + if (verbosity >= 3) { + printf(";; Existence of data set with this name denied by NSEC\n"); + } + if (nsec_rrs && nsec_rr_sigs) { + (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, nsec_i)), LDNS_RR_TYPE_NSEC, nsec_rrs, nsec_rr_sigs); + } + ldns_rr_list_deep_free(nsecs); + return LDNS_STATUS_OK; + } else { + /* nsec has nothing to do with this data */ + } + } + ldns_rr_list_deep_free(nsecs); + } else if( (nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC3, LDNS_SECTION_ANY_NOQUESTION)) ) { + ldns_rr_list* sigs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_RRSIG, LDNS_SECTION_ANY_NOQUESTION); + ldns_rr* q = ldns_rr_new(); + if(!sigs) return LDNS_STATUS_MEM_ERR; + if(!q) return LDNS_STATUS_MEM_ERR; + ldns_rr_set_question(q, 1); + ldns_rr_set_ttl(q, 0); + ldns_rr_set_owner(q, ldns_rdf_clone(name)); + if(!ldns_rr_owner(q)) return LDNS_STATUS_MEM_ERR; + ldns_rr_set_type(q, type); + + result = ldns_dnssec_verify_denial_nsec3(q, nsecs, sigs, ldns_pkt_get_rcode(pkt), type, ldns_pkt_ancount(pkt) == 0); + ldns_rr_free(q); + ldns_rr_list_deep_free(nsecs); + ldns_rr_list_deep_free(sigs); + } + return result; +} + +/* NSEC3 draft -07 */ +/*return hash name match*/ +ldns_rr * +ldns_nsec3_exact_match(ldns_rdf *qname, ldns_rr_type qtype, ldns_rr_list *nsec3s) { + uint8_t algorithm; + uint32_t iterations; + uint8_t salt_length; + uint8_t *salt; + + ldns_rdf *sname, *hashed_sname; + + size_t nsec_i; + ldns_rr *nsec; + ldns_rr *result = NULL; + + ldns_status status; + + const ldns_rr_descriptor *descriptor; + + ldns_rdf *zone_name; + + if (verbosity >= 4) { + printf(";; finding exact match for "); + descriptor = ldns_rr_descript(qtype); + if (descriptor && descriptor->_name) { + printf("%s ", descriptor->_name); + } else { + printf("TYPE%d ", qtype); + } + ldns_rdf_print(stdout, qname); + printf("\n"); + } + + if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { + if (verbosity >= 4) { + printf("no qname, nsec3s or list empty\n"); + } + return NULL; + } + + nsec = ldns_rr_list_rr(nsec3s, 0); + algorithm = ldns_nsec3_algorithm(nsec); + salt_length = ldns_nsec3_salt_length(nsec); + salt = ldns_nsec3_salt_data(nsec); + iterations = ldns_nsec3_iterations(nsec); + + sname = ldns_rdf_clone(qname); + + if (verbosity >= 4) { + printf(";; owner name hashes to: "); + } + hashed_sname = ldns_nsec3_hash_name(sname, algorithm, iterations, salt_length, salt); + + zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); + status = ldns_dname_cat(hashed_sname, zone_name); + + if (verbosity >= 4) { + ldns_rdf_print(stdout, hashed_sname); + printf("\n"); + } + + for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { + nsec = ldns_rr_list_rr(nsec3s, nsec_i); + + /* check values of iterations etc! */ + + /* exact match? */ + if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { + result = nsec; + goto done; + } + + } + +done: + ldns_rdf_deep_free(zone_name); + ldns_rdf_deep_free(sname); + ldns_rdf_deep_free(hashed_sname); + LDNS_FREE(salt); + + if (verbosity >= 4) { + if (result) { + printf(";; Found.\n"); + } else { + printf(";; Not foud.\n"); + } + } + return result; +} + +/*return the owner name of the closest encloser for name from the list of rrs */ +/* this is NOT the hash, but the original name! */ +ldns_rdf * +ldns_nsec3_closest_encloser(ldns_rdf *qname, ldns_rr_type qtype, ldns_rr_list *nsec3s) +{ + /* remember parameters, they must match */ + uint8_t algorithm; + uint32_t iterations; + uint8_t salt_length; + uint8_t *salt; + + ldns_rdf *sname, *hashed_sname, *tmp; + ldns_rr *ce; + bool flag; + + bool exact_match_found; + bool in_range_found; + + ldns_status status; + ldns_rdf *zone_name; + + size_t nsec_i; + ldns_rr *nsec; + ldns_rdf *result = NULL; + + if (!qname || !nsec3s || ldns_rr_list_rr_count(nsec3s) < 1) { + return NULL; + } + + if (verbosity >= 4) { + printf(";; finding closest encloser for type %d ", qtype); + ldns_rdf_print(stdout, qname); + printf("\n"); + } + + nsec = ldns_rr_list_rr(nsec3s, 0); + algorithm = ldns_nsec3_algorithm(nsec); + salt_length = ldns_nsec3_salt_length(nsec); + salt = ldns_nsec3_salt_data(nsec); + iterations = ldns_nsec3_iterations(nsec); + + sname = ldns_rdf_clone(qname); + + ce = NULL; + flag = false; + + zone_name = ldns_dname_left_chop(ldns_rr_owner(nsec)); + + /* algorithm from nsec3-07 8.3 */ + while (ldns_dname_label_count(sname) > 0) { + exact_match_found = false; + in_range_found = false; + + if (verbosity >= 3) { + printf(";; "); + ldns_rdf_print(stdout, sname); + printf(" hashes to: "); + } + hashed_sname = ldns_nsec3_hash_name(sname, algorithm, iterations, salt_length, salt); + + status = ldns_dname_cat(hashed_sname, zone_name); + + if (verbosity >= 3) { + ldns_rdf_print(stdout, hashed_sname); + printf("\n"); + } + + for (nsec_i = 0; nsec_i < ldns_rr_list_rr_count(nsec3s); nsec_i++) { + nsec = ldns_rr_list_rr(nsec3s, nsec_i); + + /* check values of iterations etc! */ + + /* exact match? */ + if (ldns_dname_compare(ldns_rr_owner(nsec), hashed_sname) == 0) { + if (verbosity >= 4) { + printf(";; exact match found\n"); + } + exact_match_found = true; + } else if (ldns_nsec_covers_name(nsec, hashed_sname)) { + if (verbosity >= 4) { + printf(";; in range of an nsec\n"); + } + in_range_found = true; + } + + } + if (!exact_match_found && in_range_found) { + flag = true; + } else if (exact_match_found && flag) { + result = ldns_rdf_clone(sname); + } else if (exact_match_found && !flag) { + // error! + if (verbosity >= 4) { + printf(";; the closest encloser is the same name (ie. this is an exact match, ie there is no closest encloser)\n"); + } + ldns_rdf_deep_free(hashed_sname); + goto done; + } else { + flag = false; + } + + ldns_rdf_deep_free(hashed_sname); + tmp = sname; + sname = ldns_dname_left_chop(sname); + ldns_rdf_deep_free(tmp); + } + + done: + LDNS_FREE(salt); + ldns_rdf_deep_free(zone_name); + ldns_rdf_deep_free(sname); + + if (!result) { + if (verbosity >= 4) { + printf(";; no closest encloser found\n"); + } + } + + /* todo checks from end of 6.2. here or in caller? */ + return result; +} + + +/* special case were there was a wildcard expansion match, the exact match must be disproven */ +ldns_status +ldns_verify_denial_wildcard(ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type, ldns_rr_list **nsec_rrs, ldns_rr_list **nsec_rr_sigs) +{ + ldns_rdf *nsec3_ce = NULL; + ldns_rr *nsec3_ex = NULL; + ldns_rdf *wildcard_name = NULL; + ldns_rdf *nsec3_wc_ce = NULL; + ldns_rr *nsec3_wc_ex = NULL; + ldns_rdf *chopped_dname = NULL; + ldns_rr_list *nsecs; + ldns_status result = LDNS_STATUS_ERR; + + nsecs = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_NSEC3, LDNS_SECTION_ANY_NOQUESTION); + if (nsecs) { + wildcard_name = ldns_dname_new_frm_str("*"); + chopped_dname = ldns_dname_left_chop(name); + result = ldns_dname_cat(wildcard_name, chopped_dname); + ldns_rdf_deep_free(chopped_dname); + + nsec3_ex = ldns_nsec3_exact_match(name, type, nsecs); + nsec3_ce = ldns_nsec3_closest_encloser(name, type, nsecs); + nsec3_wc_ce = ldns_nsec3_closest_encloser(wildcard_name, type, nsecs); + nsec3_wc_ex = ldns_nsec3_exact_match(wildcard_name, type, nsecs); + + if (nsec3_ex) { + if (verbosity >= 3) { + printf(";; Error, exact match for for name found, but should not exist (draft -07 section 8.8)\n"); + } + result = LDNS_STATUS_NSEC3_ERR; + } else if (!nsec3_ce) { + if (verbosity >= 3) { + printf(";; Error, closest encloser for exact match missing in wildcard response (draft -07 section 8.8)\n"); + } + result = LDNS_STATUS_NSEC3_ERR; +/* + } else if (!nsec3_wc_ex) { + printf(";; Error, no wildcard nsec3 match: "); + ldns_rdf_print(stdout, wildcard_name); + printf(" (draft -07 section 8.8)\n"); + result = LDNS_STATUS_NSEC3_ERR; +*/ +/* } else if (!nsec */ + } else { + if (verbosity >= 3) { + printf(";; wilcard expansion proven\n"); + } + result = LDNS_STATUS_OK; + } + } else { + if (verbosity >= 3) { + printf(";; Error: no NSEC or NSEC3 records in answer\n"); + } + result = LDNS_STATUS_CRYPTO_NO_RRSIG; + } + + if (nsecs && nsec_rrs && nsec_rr_sigs) { + (void) get_dnssec_rr(pkt, ldns_rr_owner(ldns_rr_list_rr(nsecs, 0)), LDNS_RR_TYPE_NSEC3, nsec_rrs, nsec_rr_sigs); + } + return result; +} + + diff --git a/libs/ldns/drill/drill.1 b/libs/ldns/drill/drill.1 new file mode 100644 index 0000000000..24cfd6dabe --- /dev/null +++ b/libs/ldns/drill/drill.1 @@ -0,0 +1,230 @@ +.\" @(#)drill.1 1.7.0 14-Jul-2004 OF; +.TH drill 1 "28 May 2006" +.SH NAME +drill \- get (debug) information out of DNS(SEC) +.SH SYNOPSIS +.B drill +[ +.IR OPTIONS +] +.IR name +[ +.IR @server +] +[ +.IR type +] +[ +.IR class +] + +.SH DESCRIPTION +\fBdrill\fR is a tool to designed to get all sorts of information out of the +DNS. It is specificly designed to be used with DNSSEC. +.PP +The name \fBdrill\fR is a pun on \fBdig\fR. With \fBdrill\fR you should be able +get even more information than with \fBdig\fR. +.PP +If no arguments are given class defaults to 'IN' and type to 'A'. The +server(s) specified in /etc/resolv.conf are used to query against. + +.PP +\fIname\fR +Ask for this name. + +.PP +\fI@server\fR +Send to query to this server. If not specified use the nameservers from +\fI/etc/resolv.conf\fR. + +.PP +\fItype\fR +Ask for this RR type. If type is not given on the command line it defaults +to 'A'. Except when doing to reverse lookup when it defaults to 'PTR'. + +.PP +\fIclass\fR +Use this class when querying. + +.SH SAMPLE USAGE +\fBdrill mx miek.nl\fR +Show the MX records of the domain miek.nl + +.TP +\fBdrill -S jelte.nlnetlabs.nl\fR +Chase any signatures in the jelte.nlnetlab.nl domain. This option is +only available when ldns has been compiled with openssl-support. + +.TP +\fBdrill -TD www.example.com\fR +Do a DNSSEC (-D) trace (-T) from the rootservers down to www.example.com. +This option only works when ldns has been compiled with openssl support. + +.TP +\fBdrill -s dnskey jelte.nlnetlabs.nl\fR +Show the DNSKEY record(s) for jelte.nlnetlabs.nl. For each found DNSKEY +record also print the DS record. + +.SH OPTIONS + +.TP +\fB\-D +Enable DNSSEC in the query. When querying for DNSSEC types (DNSKEY, RRSIG, +DS and NSEC) this is \fInot\fR automaticly enabled. + +.TP +\fB\-T +Trace \fIname\fR from the root down. When using this option the @server and +the type arguments are not used. + +.TP +\fB\-S +Chase the signature(s) of 'name' to a known key or as high up in +the tree as possible. + +.TP +\fB\-V \fIlevel\fR +Be more verbose. Set level to 5 to see the actual query that is sent. + +.TP +\fB\-Q +Quiet mode, this overrules -V. + +.TP +\fB\-f \fIfile\fR +Read the query from a file. The query must be dumped with -w. + +.TP +\fB\-i \fIfile\fR +read the answer from the file instead from the network. This aids +in debugging and can be used to check if a query on disk is valid. +If the file contains binary data it is assumed to be a query in +network order. + +.TP +\fB\-w \fIfile\fR +Write an answer packet to file. + +.TP +\fB\-q \fIfile\fR +Write the query packet to file. + +.TP +\fB\-v +Show drill's version. + +.TP +\fB\-h +Show a short help message. + +.SS QUERY OPTIONS + +.TP +\fB\-4 +Stay on ip4. Only send queries to ip4 enabled nameservers. + +.TP +\fB\-6 +Stay on ip6. Only send queries to ip6 enabled nameservers. + +.TP +\fB\-a +Use the resolver structure's fallback mechanism if the answer +is truncated (TC=1). If a truncated packet is received and this +option is set, drill will first send a new query with EDNS0 +buffer size 4096. + +If the EDNS0 buffer size was already set to 512+ bytes, or the +above retry also results in a truncated answer, the resolver +structure will fall back to TCP. + +.TP +\fB\-b \fIsize\fR +Use size as the buffer size in the EDNS0 pseudo RR. + +.TP +\fB\-c \fIfile\fR +Use file instead of /etc/resolv.conf for nameserver configuration. + +.TP +\fB\-d \fIdomain\fR +When tracing (-T), start from this domain instead of the root. + +.TP +\fB\-t +Use TCP/IP when querying a server + +.TP +\fB\-k \fIkeyfile\fR +Use this file to read a (trusted) key from. When this options is +given \fBdrill\fR tries to validate the current answer with this +key. No chasing is done. When \fBdrill\fR is doing a secure trace, this +key will be used as trust anchor. Can contain a DNSKEY or a DS record. + +.TP +\fB\-o \fImnemonic\fR +Use this option to set or unset specific header bits. A bit is +set by using the bit mnemonic in CAPITAL letters. A bit is unset when +the mnemonic is given in lowercase. The following mnemonics are +understood by \fBdrill\fR: + + QR, qr: set, unset QueRy (default: on) + AA, aa: set, unset Authoritative Answer (default: off) + TC, tc: set, unset TrunCated (default: off) + RD, rd: set, unset Recursion Desired (default: on) + CD, cd: set, unset Checking Disabled (default: off) + RA, ra: set, unset Recursion Available (default: off) + AD, ad: set, unset Authenticated Data (default: off) + +Thus: \fB-o CD\fR, will enable Checking Disabled, which instructs the +cache to not validate the answers it gives out. + +.TP +\fB\-p \fIport\fR +Use this port instead of the default of 53. + +.TP +\fB\-r \fIfile\fR +When tracing (-T), use file as a root servers hint file. + +.TP +\fB\-s +When encountering a DNSKEY print the equivalent DS also. + +.TP +\fB\-u +Use UDP when querying a server. This is the default. + +.TP +\fB\-w \fIfile\fR +write the answer to a file. The file will contain a hexadecimal dump +of the query. This can be used in conjunction with -f. + +.TP +\fB\-x +Do a reverse loopup. The type argument is not used, it is preset to PTR. + +.TP +\fB\-y \fI\fR +specify named base64 tsig key, and optional an algorithm (defaults to hmac-md5.sig-alg.reg.int) + +.TP +\fB\-z \fR +don't randomize the nameserver list before sending queries. + + +.SH AUTHOR +Jelte Jansen and Miek Gieben. Both of NLnet Labs. + +.SH REPORTING BUGS +Report bugs to . + +.SH BUGS + +.SH COPYRIGHT +Copyright (c) 2004-2008 NLnet Labs. +Licensed under the revised BSD license. There is NO warranty; not even for MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. + +.SH SEE ALSO +\fBdig\fR(1), \fIRFC403{3,4,5}\fR. diff --git a/libs/ldns/drill/drill.c b/libs/ldns/drill/drill.c new file mode 100644 index 0000000000..abd0ff6300 --- /dev/null +++ b/libs/ldns/drill/drill.c @@ -0,0 +1,930 @@ +/* + * drill.c + * the main file of drill + * (c) 2005-2008 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +#ifdef HAVE_SSL +#include +#endif + +#define IP6_ARPA_MAX_LEN 65 + +/* query debug, 2 hex dumps */ +int verbosity; + +static void +usage(FILE *stream, const char *progname) +{ + fprintf(stream, " Usage: %s name [@server] [type] [class]\n", progname); + fprintf(stream, "\t can be a domain name or an IP address (-x lookups)\n"); + fprintf(stream, "\t defaults to A\n"); + fprintf(stream, "\t defaults to IN\n"); + fprintf(stream, "\n\targuments may be placed in random order\n"); + fprintf(stream, "\n Options:\n"); + fprintf(stream, "\t-D\t\tenable DNSSEC (DO bit)\n"); +#ifdef HAVE_SSL + fprintf(stream, "\t-T\t\ttrace from the root down to \n"); + fprintf(stream, "\t-S\t\tchase signature(s) from to a know key [*]\n"); +#endif /*HAVE_SSL*/ + fprintf(stream, "\t-V \tverbosity (0-5)\n"); + fprintf(stream, "\t-Q\t\tquiet mode (overrules -V)\n"); + fprintf(stream, "\n"); + fprintf(stream, "\t-f file\t\tread packet from file and send it\n"); + fprintf(stream, "\t-i file\t\tread packet from file and print it\n"); + fprintf(stream, "\t-w file\t\twrite answer packet to file\n"); + fprintf(stream, "\t-q file\t\twrite query packet to file\n"); + fprintf(stream, "\t-h\t\tshow this help\n"); + fprintf(stream, "\t-v\t\tshow version\n"); + fprintf(stream, "\n Query options:\n"); + fprintf(stream, "\t-4\t\tstay on ip4\n"); + fprintf(stream, "\t-6\t\tstay on ip6\n"); + fprintf(stream, "\t-a\t\tfallback to EDNS0 and TCP if the answer is truncated\n"); + fprintf(stream, "\t-b \tuse as the buffer size (defaults to 512 b)\n"); + fprintf(stream, "\t-c \t\tuse file for rescursive nameserver configuration (/etc/resolv.conf)\n"); + fprintf(stream, "\t-k \tspecify a file that contains a trusted DNSSEC key (DNSKEY|DS) [**]\n"); + fprintf(stream, "\t\t\tused to verify any signatures in the current answer\n"); + fprintf(stream, "\t-o \tset flags to: [QR|qr][AA|aa][TC|tc][RD|rd][CD|cd][RA|ra][AD|ad]\n"); + fprintf(stream, "\t\t\tlowercase: unset bit, uppercase: set bit\n"); + fprintf(stream, "\t-p \tuse as remote port number\n"); + fprintf(stream, "\t-s\t\tshow the DS RR for each key in a packet\n"); + fprintf(stream, "\t-u\t\tsend the query with udp (the default)\n"); + fprintf(stream, "\t-x\t\tdo a reverse lookup\n"); + fprintf(stream, "\twhen doing a secure trace:\n"); + fprintf(stream, "\t-r \t\tuse file as root servers hint file\n"); + fprintf(stream, "\t-t\t\tsend the query with tcp (connected)\n"); + fprintf(stream, "\t-d \t\tuse domain as the start point for the trace\n"); + fprintf(stream, "\t-y \tspecify named base64 tsig key, and optional an\n\t\t\talgorithm (defaults to hmac-md5.sig-alg.reg.int)\n"); + fprintf(stream, "\t-z\t\tdon't randomize the nameservers before use\n"); + fprintf(stream, "\n [*] = enables/implies DNSSEC\n"); + fprintf(stream, " [**] = can be given more than once\n"); + fprintf(stream, "\n ldns-team@nlnetlabs.nl | http://www.nlnetlabs.nl/ldns/\n"); +} + +/** + * Prints the drill version to stderr + */ +static void +version(FILE *stream, const char *progname) +{ + fprintf(stream, "%s version %s (ldns version %s)\n", progname, DRILL_VERSION, ldns_version()); + fprintf(stream, "Written by NLnet Labs.\n"); + fprintf(stream, "\nCopyright (c) 2004-2008 NLnet Labs.\n"); + fprintf(stream, "Licensed under the revised BSD license.\n"); + fprintf(stream, "There is NO warranty; not even for MERCHANTABILITY or FITNESS\n"); + fprintf(stream, "FOR A PARTICULAR PURPOSE.\n"); +} + + +/** + * Main function of drill + * parse the arguments and prepare a query + */ +int +main(int argc, char *argv[]) +{ + ldns_resolver *res = NULL; + ldns_resolver *cmdline_res = NULL; /* only used to resolv @name names */ + ldns_rr_list *cmdline_rr_list = NULL; + ldns_rdf *cmdline_dname = NULL; + ldns_rdf *qname, *qname_tmp; + ldns_pkt *pkt; + ldns_pkt *qpkt; + char *serv; + char *name; + char *name2; + char *progname; + char *query_file = NULL; + char *answer_file = NULL; + ldns_buffer *query_buffer = NULL; + ldns_rdf *serv_rdf; + ldns_rr_type type; + ldns_rr_class clas; +#if 0 + ldns_pkt_opcode opcode = LDNS_PACKET_QUERY; +#endif + int i, c; + int int_type; + int int_clas; + int PURPOSE; + char *tsig_name = NULL; + char *tsig_data = NULL; + char *tsig_algorithm = NULL; + size_t tsig_separator; + size_t tsig_separator2; + ldns_rr *axfr_rr; + ldns_status status; + char *type_str; + + /* list of keys used in dnssec operations */ + ldns_rr_list *key_list = ldns_rr_list_new(); + /* what key verify the current answer */ + ldns_rr_list *key_verified; + + /* resolver options */ + uint16_t qflags; + uint16_t qbuf; + uint16_t qport; + uint8_t qfamily; + bool qdnssec; + bool qfallback; + bool qds; + bool qusevc; + bool qrandom; + + char *resolv_conf_file = NULL; + + ldns_rdf *trace_start_name = NULL; + + int result = 0; + +#ifdef USE_WINSOCK + int r; + WSADATA wsa_data; +#endif + + int_type = -1; serv = NULL; type = 0; + int_clas = -1; name = NULL; clas = 0; + qname = NULL; + progname = strdup(argv[0]); + +#ifdef USE_WINSOCK + r = WSAStartup(MAKEWORD(2,2), &wsa_data); + if(r != 0) { + printf("Failed WSAStartup: %d\n", r); + result = EXIT_FAILURE; + goto exit; + } +#endif /* USE_WINSOCK */ + + + PURPOSE = DRILL_QUERY; + qflags = LDNS_RD; + qport = LDNS_PORT; + verbosity = 2; + qdnssec = false; + qfamily = LDNS_RESOLV_INETANY; + qfallback = false; + qds = false; + qbuf = 0; + qusevc = false; + qrandom = true; + key_verified = NULL; + + ldns_init_random(NULL, 0); + + if (argc == 0) { + usage(stdout, progname); + result = EXIT_FAILURE; + goto exit; + } + + /* string from orig drill: "i:w:I46Sk:TNp:b:DsvhVcuaq:f:xr" */ + /* global first, query opt next, option with parm's last + * and sorted */ /* "46DITSVQf:i:w:q:achuvxzy:so:p:b:k:" */ + + while ((c = getopt(argc, argv, "46ab:c:d:Df:hi:Ik:o:p:q:Qr:sStTuvV:w:xy:z")) != -1) { + switch(c) { + /* global options */ + case '4': + qfamily = LDNS_RESOLV_INET; + break; + case '6': + qfamily = LDNS_RESOLV_INET6; + break; + case 'D': + qdnssec = true; + break; + case 'I': + /* reserved for backward compatibility */ + break; + case 'T': + if (PURPOSE == DRILL_CHASE) { + fprintf(stderr, "-T and -S cannot be used at the same time.\n"); + exit(EXIT_FAILURE); + } + PURPOSE = DRILL_TRACE; + break; +#ifdef HAVE_SSL + case 'S': + if (PURPOSE == DRILL_TRACE) { + fprintf(stderr, "-T and -S cannot be used at the same time.\n"); + exit(EXIT_FAILURE); + } + PURPOSE = DRILL_CHASE; + break; +#endif /* HAVE_SSL */ + case 'V': + verbosity = atoi(optarg); + break; + case 'Q': + verbosity = -1; + break; + case 'f': + query_file = optarg; + break; + case 'i': + answer_file = optarg; + PURPOSE = DRILL_AFROMFILE; + break; + case 'w': + answer_file = optarg; + break; + case 'q': + query_file = optarg; + PURPOSE = DRILL_QTOFILE; + break; + case 'r': + if (global_dns_root) { + fprintf(stderr, "There was already a series of root servers set\n"); + exit(EXIT_FAILURE); + } + global_dns_root = read_root_hints(optarg); + if (!global_dns_root) { + fprintf(stderr, "Unable to read root hints file %s, aborting\n", optarg); + exit(EXIT_FAILURE); + } + break; + /* query options */ + case 'a': + qfallback = true; + break; + case 'b': + qbuf = (uint16_t)atoi(optarg); + if (qbuf == 0) { + error("%s", " could not be converted"); + } + break; + case 'c': + resolv_conf_file = optarg; + break; + case 't': + qusevc = true; + break; + case 'k': + status = read_key_file(optarg, key_list); + if (status != LDNS_STATUS_OK) { + error("Could not parse the key file %s: %s", optarg, ldns_get_errorstr_by_id(status)); + } + qdnssec = true; /* enable that too */ + break; + case 'o': + /* only looks at the first hit: capital=ON, lowercase=OFF*/ + if (strstr(optarg, "QR")) { + DRILL_ON(qflags, LDNS_QR); + } + if (strstr(optarg, "qr")) { + DRILL_OFF(qflags, LDNS_QR); + } + if (strstr(optarg, "AA")) { + DRILL_ON(qflags, LDNS_AA); + } + if (strstr(optarg, "aa")) { + DRILL_OFF(qflags, LDNS_AA); + } + if (strstr(optarg, "TC")) { + DRILL_ON(qflags, LDNS_TC); + } + if (strstr(optarg, "tc")) { + DRILL_OFF(qflags, LDNS_TC); + } + if (strstr(optarg, "RD")) { + DRILL_ON(qflags, LDNS_RD); + } + if (strstr(optarg, "rd")) { + DRILL_OFF(qflags, LDNS_RD); + } + if (strstr(optarg, "CD")) { + DRILL_ON(qflags, LDNS_CD); + } + if (strstr(optarg, "cd")) { + DRILL_OFF(qflags, LDNS_CD); + } + if (strstr(optarg, "RA")) { + DRILL_ON(qflags, LDNS_RA); + } + if (strstr(optarg, "ra")) { + DRILL_OFF(qflags, LDNS_RA); + } + if (strstr(optarg, "AD")) { + DRILL_ON(qflags, LDNS_AD); + } + if (strstr(optarg, "ad")) { + DRILL_OFF(qflags, LDNS_AD); + } + break; + case 'p': + qport = (uint16_t)atoi(optarg); + if (qport == 0) { + error("%s", " could not be converted"); + } + break; + case 's': + qds = true; + break; + case 'u': + qusevc = false; + break; + case 'v': + version(stdout, progname); + result = EXIT_SUCCESS; + goto exit; + case 'x': + PURPOSE = DRILL_REVERSE; + break; + case 'y': +#ifdef HAVE_SSL + if (strchr(optarg, ':')) { + tsig_separator = (size_t) (strchr(optarg, ':') - optarg); + if (strchr(optarg + tsig_separator + 1, ':')) { + tsig_separator2 = (size_t) (strchr(optarg + tsig_separator + 1, ':') - optarg); + tsig_algorithm = xmalloc(strlen(optarg) - tsig_separator2); + strncpy(tsig_algorithm, optarg + tsig_separator2 + 1, strlen(optarg) - tsig_separator2); + tsig_algorithm[strlen(optarg) - tsig_separator2 - 1] = '\0'; + } else { + tsig_separator2 = strlen(optarg); + tsig_algorithm = xmalloc(26); + strncpy(tsig_algorithm, "hmac-md5.sig-alg.reg.int.", 25); + tsig_algorithm[25] = '\0'; + } + tsig_name = xmalloc(tsig_separator + 1); + tsig_data = xmalloc(tsig_separator2 - tsig_separator); + strncpy(tsig_name, optarg, tsig_separator); + strncpy(tsig_data, optarg + tsig_separator + 1, tsig_separator2 - tsig_separator - 1); + /* strncpy does not append \0 if source is longer than n */ + tsig_name[tsig_separator] = '\0'; + tsig_data[ tsig_separator2 - tsig_separator - 1] = '\0'; + } +#else + fprintf(stderr, "TSIG requested, but SSL is not supported\n"); + result = EXIT_FAILURE; + goto exit; +#endif /* HAVE_SSL */ + break; + case 'z': + qrandom = false; + break; + case 'd': + trace_start_name = ldns_dname_new_frm_str(optarg); + if (!trace_start_name) { + fprintf(stderr, "Unable to parse argument for -%c\n", c); + result = EXIT_FAILURE; + goto exit; + } + break; + case 'h': + version(stdout, progname); + usage(stdout, progname); + result = EXIT_SUCCESS; + goto exit; + break; + default: + fprintf(stderr, "Unknown argument: -%c, use -h to see usage\n", c); + result = EXIT_FAILURE; + goto exit; + } + } + argc -= optind; + argv += optind; + + /* do a secure trace when requested */ + if (PURPOSE == DRILL_TRACE && qdnssec) { +#ifdef HAVE_SSL + if (ldns_rr_list_rr_count(key_list) == 0) { + warning("%s", "No trusted keys were given. Will not be able to verify authenticity!"); + } + PURPOSE = DRILL_SECTRACE; +#else + fprintf(stderr, "ldns has not been compiled with OpenSSL support. Secure trace not available\n"); + exit(1); +#endif /* HAVE_SSL */ + } + + /* parse the arguments, with multiple arguments, the last argument + * found is used */ + for(i = 0; i < argc; i++) { + + /* if ^@ then it's a server */ + if (argv[i][0] == '@') { + if (strlen(argv[i]) == 1) { + warning("%s", "No nameserver given"); + exit(EXIT_FAILURE); + } + serv = argv[i] + 1; + continue; + } + /* if has a dot, it's a name */ + if (strchr(argv[i], '.')) { + name = argv[i]; + continue; + } + /* if it matches a type, it's a type */ + if (int_type == -1) { + type = ldns_get_rr_type_by_name(argv[i]); + if (type != 0) { + int_type = 0; + continue; + } + } + /* if it matches a class, it's a class */ + if (int_clas == -1) { + clas = ldns_get_rr_class_by_name(argv[i]); + if (clas != 0) { + int_clas = 0; + continue; + } + } + /* it all fails assume it's a name */ + name = argv[i]; + } + /* act like dig and use for . NS */ + if (!name) { + name = "."; + int_type = 0; + type = LDNS_RR_TYPE_NS; + } + + /* defaults if not given */ + if (int_clas == -1) { + clas = LDNS_RR_CLASS_IN; + } + if (int_type == -1) { + if (PURPOSE != DRILL_REVERSE) { + type = LDNS_RR_TYPE_A; + } else { + type = LDNS_RR_TYPE_PTR; + } + } + + /* set the nameserver to use */ + if (!serv) { + /* no server given make a resolver from /etc/resolv.conf */ + status = ldns_resolver_new_frm_file(&res, resolv_conf_file); + if (status != LDNS_STATUS_OK) { + warning("Could not create a resolver structure: %s (%s)\n" + "Try drill @localhost if you have a resolver running on your machine.", + ldns_get_errorstr_by_id(status), resolv_conf_file); + result = EXIT_FAILURE; + goto exit; + } + } else { + res = ldns_resolver_new(); + if (!res || strlen(serv) <= 0) { + warning("Could not create a resolver structure"); + result = EXIT_FAILURE; + goto exit; + } + /* add the nameserver */ + serv_rdf = ldns_rdf_new_addr_frm_str(serv); + if (!serv_rdf) { + /* try to resolv the name if possible */ + status = ldns_resolver_new_frm_file(&cmdline_res, resolv_conf_file); + + if (status != LDNS_STATUS_OK) { + error("%s", "@server ip could not be converted"); + } + ldns_resolver_set_dnssec(cmdline_res, qdnssec); + ldns_resolver_set_ip6(cmdline_res, qfamily); + ldns_resolver_set_fallback(cmdline_res, qfallback); + ldns_resolver_set_usevc(cmdline_res, qusevc); + + cmdline_dname = ldns_dname_new_frm_str(serv); + + cmdline_rr_list = ldns_get_rr_list_addr_by_name( + cmdline_res, + cmdline_dname, + LDNS_RR_CLASS_IN, + qflags); + ldns_rdf_deep_free(cmdline_dname); + if (!cmdline_rr_list) { + /* This error msg is not always accurate */ + error("%s `%s\'", "could not find any address for the name:", serv); + } else { + if (ldns_resolver_push_nameserver_rr_list( + res, + cmdline_rr_list + ) != LDNS_STATUS_OK) { + error("%s", "pushing nameserver"); + } + } + } else { + if (ldns_resolver_push_nameserver(res, serv_rdf) != LDNS_STATUS_OK) { + error("%s", "pushing nameserver"); + } else { + ldns_rdf_deep_free(serv_rdf); + } + } + } + /* set the resolver options */ + ldns_resolver_set_port(res, qport); + if (verbosity >= 5) { + ldns_resolver_set_debug(res, true); + } else { + ldns_resolver_set_debug(res, false); + } + ldns_resolver_set_dnssec(res, qdnssec); +/* ldns_resolver_set_dnssec_cd(res, qdnssec);*/ + ldns_resolver_set_ip6(res, qfamily); + ldns_resolver_set_fallback(res, qfallback); + ldns_resolver_set_usevc(res, qusevc); + ldns_resolver_set_random(res, qrandom); + if (qbuf != 0) { + ldns_resolver_set_edns_udp_size(res, qbuf); + } + + if (!name && + PURPOSE != DRILL_AFROMFILE && + !query_file + ) { + usage(stdout, progname); + result = EXIT_FAILURE; + goto exit; + } + + if (tsig_name && tsig_data) { + ldns_resolver_set_tsig_keyname(res, tsig_name); + ldns_resolver_set_tsig_keydata(res, tsig_data); + ldns_resolver_set_tsig_algorithm(res, tsig_algorithm); + } + + /* main switching part of drill */ + switch(PURPOSE) { + case DRILL_TRACE: + /* do a trace from the root down */ + if (!global_dns_root) { + init_root(); + } + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "parsing query name"); + } + /* don't care about return packet */ + (void)do_trace(res, qname, type, clas); + clear_root(); + break; + case DRILL_SECTRACE: + /* do a secure trace from the root down */ + if (!global_dns_root) { + init_root(); + } + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "making qname"); + } + /* don't care about return packet */ +#ifdef HAVE_SSL + result = do_secure_trace(res, qname, type, clas, key_list, trace_start_name); +#endif /* HAVE_SSL */ + clear_root(); + break; + case DRILL_CHASE: + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "making qname"); + } + + ldns_resolver_set_dnssec(res, true); + ldns_resolver_set_dnssec_cd(res, true); + /* set dnssec implies udp_size of 4096 */ + ldns_resolver_set_edns_udp_size(res, 4096); + pkt = ldns_resolver_query(res, qname, type, clas, qflags); + + if (!pkt) { + error("%s", "error pkt sending"); + result = EXIT_FAILURE; + } else { + if (verbosity >= 3) { + ldns_pkt_print(stdout, pkt); + } + + if (!ldns_pkt_answer(pkt)) { + mesg("No answer in packet"); + } else { +#ifdef HAVE_SSL + ldns_resolver_set_dnssec_anchors(res, ldns_rr_list_clone(key_list)); + result = do_chase(res, qname, type, + clas, key_list, + pkt, qflags, NULL, + verbosity); + if (result == LDNS_STATUS_OK) { + if (verbosity != -1) { + mesg("Chase successful"); + } + result = 0; + } else { + if (verbosity != -1) { + mesg("Chase failed."); + } + } +#endif /* HAVE_SSL */ + } + ldns_pkt_free(pkt); + } + break; + case DRILL_AFROMFILE: + pkt = read_hex_pkt(answer_file); + if (pkt) { + if (verbosity != -1) { + ldns_pkt_print(stdout, pkt); + } + ldns_pkt_free(pkt); + } + + break; + case DRILL_QTOFILE: + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "making qname"); + } + + status = ldns_resolver_prepare_query_pkt(&qpkt, res, qname, type, clas, qflags); + if(status != LDNS_STATUS_OK) { + error("%s", "making query: %s", + ldns_get_errorstr_by_id(status)); + } + dump_hex(qpkt, query_file); + ldns_pkt_free(qpkt); + break; + case DRILL_NSEC: + break; + case DRILL_REVERSE: + /* ipv4 or ipv6 addr? */ + if (strchr(name, ':')) { + if (strchr(name, '.')) { + error("Syntax error: both '.' and ':' seen in address\n"); + } + name2 = malloc(IP6_ARPA_MAX_LEN + 20); + c = 0; + for (i=0; i<(int)strlen(name); i++) { + if (i >= IP6_ARPA_MAX_LEN) { + error("%s", "reverse argument to long"); + } + if (name[i] == ':') { + if (i < (int) strlen(name) && name[i + 1] == ':') { + error("%s", ":: not supported (yet)"); + } else { + if (i + 2 == (int) strlen(name) || name[i + 2] == ':') { + name2[c++] = '0'; + name2[c++] = '.'; + name2[c++] = '0'; + name2[c++] = '.'; + name2[c++] = '0'; + name2[c++] = '.'; + } else if (i + 3 == (int) strlen(name) || name[i + 3] == ':') { + name2[c++] = '0'; + name2[c++] = '.'; + name2[c++] = '0'; + name2[c++] = '.'; + } else if (i + 4 == (int) strlen(name) || name[i + 4] == ':') { + name2[c++] = '0'; + name2[c++] = '.'; + } + } + } else { + name2[c++] = name[i]; + name2[c++] = '.'; + } + } + name2[c++] = '\0'; + + qname = ldns_dname_new_frm_str(name2); + qname_tmp = ldns_dname_reverse(qname); + ldns_rdf_deep_free(qname); + qname = qname_tmp; + qname_tmp = ldns_dname_new_frm_str("ip6.arpa."); + status = ldns_dname_cat(qname, qname_tmp); + if (status != LDNS_STATUS_OK) { + error("%s", "could not create reverse address for ip6: %s\n", ldns_get_errorstr_by_id(status)); + } + ldns_rdf_deep_free(qname_tmp); + + free(name2); + } else { + qname = ldns_dname_new_frm_str(name); + qname_tmp = ldns_dname_reverse(qname); + ldns_rdf_deep_free(qname); + qname = qname_tmp; + qname_tmp = ldns_dname_new_frm_str("in-addr.arpa."); + status = ldns_dname_cat(qname, qname_tmp); + if (status != LDNS_STATUS_OK) { + error("%s", "could not create reverse address for ip4: %s\n", ldns_get_errorstr_by_id(status)); + } + ldns_rdf_deep_free(qname_tmp); + } + if (!qname) { + error("%s", "-x implies an ip address"); + } + + /* create a packet and set the RD flag on it */ + pkt = ldns_resolver_query(res, qname, type, clas, qflags); + if (!pkt) { + error("%s", "pkt sending"); + result = EXIT_FAILURE; + } else { + if (verbosity != -1) { + ldns_pkt_print(stdout, pkt); + } + ldns_pkt_free(pkt); + } + break; + case DRILL_QUERY: + default: + if (query_file) { + /* this old way, the query packet needed + to be parseable, but we want to be able + to send mangled packets, so we need + to do it directly */ + #if 0 + qpkt = read_hex_pkt(query_file); + if (qpkt) { + status = ldns_resolver_send_pkt(&pkt, res, qpkt); + if (status != LDNS_STATUS_OK) { + printf("Error: %s\n", ldns_get_errorstr_by_id(status)); + exit(1); + } + } else { + /* qpkt was bogus, reset pkt */ + pkt = NULL; + } + #endif + query_buffer = read_hex_buffer(query_file); + if (query_buffer) { + status = ldns_send_buffer(&pkt, res, query_buffer, NULL); + ldns_buffer_free(query_buffer); + if (status != LDNS_STATUS_OK) { + printf("Error: %s\n", ldns_get_errorstr_by_id(status)); + exit(1); + } + } else { + printf("NO BUFFER\n"); + pkt = NULL; + } + } else { + qname = ldns_dname_new_frm_str(name); + if (!qname) { + error("%s", "error in making qname"); + } + + if (type == LDNS_RR_TYPE_AXFR) { + status = ldns_axfr_start(res, qname, clas); + if(status != LDNS_STATUS_OK) { + error("Error starting axfr: %s", + ldns_get_errorstr_by_id(status)); + } + axfr_rr = ldns_axfr_next(res); + if(!axfr_rr) { + fprintf(stderr, "AXFR failed.\n"); + ldns_pkt_print(stdout, + ldns_axfr_last_pkt(res)); + goto exit; + } + while (axfr_rr) { + if (verbosity != -1) { + ldns_rr_print(stdout, axfr_rr); + } + ldns_rr_free(axfr_rr); + axfr_rr = ldns_axfr_next(res); + } + + goto exit; + } else { + /* create a packet and set the RD flag on it */ + pkt = ldns_resolver_query(res, qname, type, clas, qflags); + } + } + + if (!pkt) { + mesg("No packet received"); + result = EXIT_FAILURE; + } else { + if (verbosity != -1) { + ldns_pkt_print(stdout, pkt); + if (ldns_pkt_tc(pkt)) { + fprintf(stdout, + "\n;; WARNING: The answer packet was truncated; you might want to\n"); + fprintf(stdout, + ";; query again with TCP (-t argument), or EDNS0 (-b for buffer size)\n"); + } + } + if (qds) { + if (verbosity != -1) { + print_ds_of_keys(pkt); + printf("\n"); + } + } + + if (ldns_rr_list_rr_count(key_list) > 0) { + /* -k's were given on the cmd line */ + ldns_rr_list *rrset_verified; + uint16_t key_count; + + rrset_verified = ldns_pkt_rr_list_by_name_and_type( + pkt, qname, type, + LDNS_SECTION_ANY_NOQUESTION); + + if (type == LDNS_RR_TYPE_ANY) { + /* don't verify this */ + break; + } + + if (verbosity != -1) { + printf("; "); + ldns_rr_list_print(stdout, rrset_verified); + } + + /* verify */ +#ifdef HAVE_SSL + key_verified = ldns_rr_list_new(); + result = ldns_pkt_verify(pkt, type, qname, key_list, NULL, key_verified); + + if (result == LDNS_STATUS_ERR) { + /* is the existence denied then? */ + result = ldns_verify_denial(pkt, qname, type, NULL, NULL); + if (result == LDNS_STATUS_OK) { + if (verbosity != -1) { + printf("Existence denied for "); + ldns_rdf_print(stdout, qname); + type_str = ldns_rr_type2str(type); + printf("\t%s\n", type_str); + LDNS_FREE(type_str); + } + } else { + if (verbosity != -1) { + printf("Bad data; RR for name and " + "type not found or failed to " + "verify, and denial of " + "existence failed.\n"); + } + } + } else if (result == LDNS_STATUS_OK) { + for(key_count = 0; key_count < ldns_rr_list_rr_count(key_verified); + key_count++) { + if (verbosity != -1) { + printf("; VALIDATED by id = %u, owner = ", + (unsigned int)ldns_calc_keytag( + ldns_rr_list_rr(key_verified, key_count))); + ldns_rdf_print(stdout, ldns_rr_owner( + ldns_rr_list_rr(key_list, key_count))); + printf("\n"); + } + } + } else { + for(key_count = 0; key_count < ldns_rr_list_rr_count(key_list); + key_count++) { + if (verbosity != -1) { + printf("; %s for id = %u, owner = ", + ldns_get_errorstr_by_id(result), + (unsigned int)ldns_calc_keytag( + ldns_rr_list_rr(key_list, key_count))); + ldns_rdf_print(stdout, ldns_rr_owner( + + ldns_rr_list_rr(key_list, + key_count))); + printf("\n"); + } + } + } + ldns_rr_list_free(key_verified); +#else + (void) key_count; +#endif /* HAVE_SSL */ + } + if (answer_file) { + dump_hex(pkt, answer_file); + } + ldns_pkt_free(pkt); + } + + break; + } + + exit: + ldns_rdf_deep_free(qname); + ldns_resolver_deep_free(res); + ldns_resolver_deep_free(cmdline_res); + ldns_rr_list_deep_free(key_list); + ldns_rr_list_deep_free(cmdline_rr_list); + ldns_rdf_deep_free(trace_start_name); + xfree(progname); + xfree(tsig_name); + xfree(tsig_data); + xfree(tsig_algorithm); + +#ifdef HAVE_SSL + ERR_remove_state(0); + CRYPTO_cleanup_all_ex_data(); + ERR_free_strings(); + EVP_cleanup(); +#endif +#ifdef USE_WINSOCK + WSACleanup(); +#endif + + return result; +} diff --git a/libs/ldns/drill/drill.h.in b/libs/ldns/drill/drill.h.in new file mode 100644 index 0000000000..b787b923c2 --- /dev/null +++ b/libs/ldns/drill/drill.h.in @@ -0,0 +1,109 @@ +/* + * drill.h + * the main header file of drill + * (c) 2005, 2006 NLnet Labs + * + * See the file LICENSE for the license + * + */ +#ifndef _DRILL_H_ +#define _DRILL_H_ +#include "config.h" + +#include "drill_util.h" + +#define DRILL_VERSION "@PACKAGE_VERSION@" + +/* what kind of stuff do we allow */ +#define DRILL_QUERY 0 +#define DRILL_TRACE 1 +#define DRILL_CHASE 2 +#define DRILL_AFROMFILE 3 +#define DRILL_QTOFILE 4 +#define DRILL_NSEC 5 +#define DRILL_REVERSE 6 +#define DRILL_SECTRACE 7 + +#define DRILL_ON(VAR, BIT) \ +(VAR) = (VAR) | (BIT) +#define DRILL_OFF(VAR, BIT) \ +(VAR) = (VAR) & ~(BIT) + +extern ldns_rr_list *global_dns_root; +extern bool qds; +extern int verbosity; + +ldns_pkt *do_trace(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c); +ldns_status do_chase(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c, + ldns_rr_list *trusted_keys, + ldns_pkt *pkt_o, + uint16_t qflags, + ldns_rr_list *prev_key_list, + int verbosity); +int do_secure_trace(ldns_resolver *res, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_class c, + ldns_rr_list *trusted_keys, + ldns_rdf *start_name); + +ldns_rr_list * get_rr(ldns_resolver *res, + ldns_rdf *zname, + ldns_rr_type t, + ldns_rr_class c); + +void drill_pkt_print(FILE *fd, ldns_resolver *r, ldns_pkt *p); +void drill_pkt_print_footer(FILE *fd, ldns_resolver *r, ldns_pkt *p); + +ldns_pkt_type get_dnssec_rr(ldns_pkt *p, + ldns_rdf *name, + ldns_rr_type t, + ldns_rr_list **rrlist, + ldns_rr_list **sig); + +ldns_rr *ldns_nsec3_exact_match(ldns_rdf *qname, + ldns_rr_type qtype, + ldns_rr_list *nsec3s); + +ldns_rdf *ldns_nsec3_closest_encloser(ldns_rdf *qname, + ldns_rr_type qtype, + ldns_rr_list *nsec3s); + +/* verifies denial of existence of *name in *pkt (must contain NSEC or NSEC3 records + * if *nsec_rrs and *nsec_rr_sigs are given, pointers to the relevant nsecs and their signatures are + * placed there + */ +ldns_status ldns_verify_denial(ldns_pkt *pkt, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_list **nsec_rrs, + ldns_rr_list **nsec_rr_sigs); +ldns_status ldns_verify_denial_wildcard(ldns_pkt *pkt, + ldns_rdf *name, + ldns_rr_type type, + ldns_rr_list **nsec_rrs, + ldns_rr_list **nsec_rr_sigs); + +ldns_status read_key_file(const char *filename, ldns_rr_list *key_list); +ldns_pkt *read_hex_pkt(char *filename); +ldns_buffer *read_hex_buffer(char *filename); +void init_root(void); +ldns_rr_list *read_root_hints(const char *filename); +void clear_root(void); +void dump_hex(const ldns_pkt *pkt, const char *file); +void warning(const char *fmt, ...); +void error(const char *fmt, ...); +void mesg(const char *fmt, ...); + +/* screen.c */ +void resolver_print_nameservers(ldns_resolver *r); +void print_dnskey(ldns_rr_list *key_list); +void print_ds(ldns_rr_list *ds_list); + +#endif /* _DRILL_H_ */ diff --git a/libs/ldns/drill/drill_util.c b/libs/ldns/drill/drill_util.c new file mode 100644 index 0000000000..596be9d541 --- /dev/null +++ b/libs/ldns/drill/drill_util.c @@ -0,0 +1,305 @@ +/* + * util.c + * some handy function needed in drill and not implemented + * in ldns + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +#include + +static int +read_line(FILE *input, char *line) +{ + int i; + + char c; + for (i = 0; i < LDNS_MAX_PACKETLEN; i++) { + c = getc(input); + if (c == EOF) { + return -1; + } else if (c != '\n') { + line[i] = c; + } else { + break; + } + } + line[i] = '\0'; + return i; +} + +/* key_list must be initialized with ldns_rr_list_new() */ +ldns_status +read_key_file(const char *filename, ldns_rr_list *key_list) +{ + int line_len = 0; + int line_nr = 0; + int key_count = 0; + char line[LDNS_MAX_PACKETLEN]; + ldns_status status; + FILE *input_file; + ldns_rr *rr; + + input_file = fopen(filename, "r"); + if (!input_file) { + fprintf(stderr, "Error opening %s: %s\n", + filename, strerror(errno)); + return LDNS_STATUS_ERR; + } + while (line_len >= 0) { + line_len = read_line(input_file, line); + line_nr++; + if (line_len > 0 && line[0] != ';') { + status = ldns_rr_new_frm_str(&rr, line, 0, NULL, NULL); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, + "Error parsing DNSKEY RR in line %d: %s\n", + line_nr, + ldns_get_errorstr_by_id(status)); + } else if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_DNSKEY || + ldns_rr_get_type(rr) == LDNS_RR_TYPE_DS) { + ldns_rr_list_push_rr(key_list, rr); + key_count++; + } else { + ldns_rr_free(rr); + } + } + } + printf(";; Number of trusted keys: %d\n", key_count); + if (key_count > 0) { + return LDNS_STATUS_OK; + } else { + /*fprintf(stderr, "No keys read\n");*/ + return LDNS_STATUS_ERR; + } +} + +ldns_rdf * +ldns_rdf_new_addr_frm_str(char *str) +{ + ldns_rdf *a; + + a = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, str); + if (!a) { + /* maybe ip6 */ + a = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, str); + if (!a) { + return NULL; + } + } + return a; +} + +static inline void +local_print_ds(FILE* out, const char* pre, ldns_rr* ds) +{ + if (out && ds) { + fprintf(out, "%s", pre); + ldns_rr_print(out, ds); + ldns_rr_free(ds); + } +} + +/* + * For all keys in a packet print the DS + */ +void +print_ds_of_keys(ldns_pkt *p) +{ + ldns_rr_list *keys; + uint16_t i; + ldns_rr *ds; + + /* TODO fix the section stuff, here or in ldns */ + keys = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_DNSKEY, + LDNS_SECTION_ANSWER); + + /* this also returns the question section rr, which does not + * have any data.... and this inturn crashes everything */ + + if (keys) { + for (i = 0; i < ldns_rr_list_rr_count(keys); i++) { + fprintf(stdout, ";\n; equivalent DS records for key %u:\n", + (unsigned int)ldns_calc_keytag(ldns_rr_list_rr(keys, i))); + + ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA1); + local_print_ds(stdout, "; sha1: ", ds); + ds = ldns_key_rr2ds(ldns_rr_list_rr(keys, i), LDNS_SHA256); + local_print_ds(stdout, "; sha256: ", ds); + } + } +} + +static void +print_class_type(FILE *fp, ldns_rr *r) +{ + ldns_lookup_table *lt; + lt = ldns_lookup_by_id(ldns_rr_classes, ldns_rr_get_class(r)); + if (lt) { + fprintf(fp, " %s", lt->name); + } else { + fprintf(fp, " CLASS%d", ldns_rr_get_class(r)); + } + /* okay not THE way - but the quickest */ + switch (ldns_rr_get_type(r)) { + case LDNS_RR_TYPE_RRSIG: + fprintf(fp, " RRSIG "); + break; + case LDNS_RR_TYPE_DNSKEY: + fprintf(fp, " DNSKEY "); + break; + case LDNS_RR_TYPE_DS: + fprintf(fp, " DS "); + break; + default: + break; + } +} + + +void +print_ds_abbr(FILE *fp, ldns_rr *ds) +{ + if (!ds || (ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS)) { + return; + } + + ldns_rdf_print(fp, ldns_rr_owner(ds)); + fprintf(fp, " %d", (int)ldns_rr_ttl(ds)); + print_class_type(fp, ds); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 0)); fprintf(fp, " "); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 1)); fprintf(fp, " "); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 2)); fprintf(fp, " "); + ldns_rdf_print(fp, ldns_rr_rdf(ds, 3)); fprintf(fp, " "); +} + +/* print some of the elements of a signature */ +void +print_rrsig_abbr(FILE *fp, ldns_rr *sig) { + if (!sig || (ldns_rr_get_type(sig) != LDNS_RR_TYPE_RRSIG)) { + return; + } + + ldns_rdf_print(fp, ldns_rr_owner(sig)); + fprintf(fp, " %d", (int)ldns_rr_ttl(sig)); + print_class_type(fp, sig); + + /* print a number of rdf's */ + /* typecovered */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 0)); fprintf(fp, " "); + /* algo */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 1)); fprintf(fp, " "); + /* labels */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 2)); fprintf(fp, " (\n\t\t\t"); + /* expir */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 4)); fprintf(fp, " "); + /* incep */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 5)); fprintf(fp, " "); + /* key-id */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 6)); fprintf(fp, " "); + /* key owner */ + ldns_rdf_print(fp, ldns_rr_rdf(sig, 7)); fprintf(fp, ")"); +} + +void +print_dnskey_abbr(FILE *fp, ldns_rr *key) +{ + if (!key || (ldns_rr_get_type(key) != LDNS_RR_TYPE_DNSKEY)) { + return; + } + + ldns_rdf_print(fp, ldns_rr_owner(key)); + fprintf(fp, " %d", (int)ldns_rr_ttl(key)); + print_class_type(fp, key); + + /* print a number of rdf's */ + /* flags */ + ldns_rdf_print(fp, ldns_rr_rdf(key, 0)); fprintf(fp, " "); + /* proto */ + ldns_rdf_print(fp, ldns_rr_rdf(key, 1)); fprintf(fp, " "); + /* algo */ + ldns_rdf_print(fp, ldns_rr_rdf(key, 2)); + + if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 256) { + fprintf(fp, " ;{id = %u (zsk), size = %db}", (unsigned int)ldns_calc_keytag(key), + (int)ldns_rr_dnskey_key_size(key)); + return; + } + if (ldns_rdf2native_int16(ldns_rr_rdf(key, 0)) == 257) { + fprintf(fp, " ;{id = %u (ksk), size = %db}", (unsigned int)ldns_calc_keytag(key), + (int)ldns_rr_dnskey_key_size(key)); + return; + } + fprintf(fp, " ;{id = %u, size = %db}", (unsigned int)ldns_calc_keytag(key), + (int)ldns_rr_dnskey_key_size(key)); +} + +void +print_rr_list_abbr(FILE *fp, ldns_rr_list *rrlist, char *usr) +{ + size_t i; + ldns_rr_type tp; + + for(i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { + tp = ldns_rr_get_type(ldns_rr_list_rr(rrlist, i)); + if (i == 0 && tp != LDNS_RR_TYPE_RRSIG) { + if (usr) { + fprintf(fp, "%s ", usr); + } + } + switch(tp) { + case LDNS_RR_TYPE_DNSKEY: + print_dnskey_abbr(fp, ldns_rr_list_rr(rrlist, i)); + break; + case LDNS_RR_TYPE_RRSIG: + print_rrsig_abbr(fp, ldns_rr_list_rr(rrlist, i)); + break; + case LDNS_RR_TYPE_DS: + print_ds_abbr(fp, ldns_rr_list_rr(rrlist, i)); + break; + default: + /* not handled */ + break; + } + fputs("\n", fp); + } +} + +void * +xmalloc(size_t s) +{ + void *p; + + p = malloc(s); + if (!p) { + printf("Mem failure\n"); + exit(EXIT_FAILURE); + } + return p; +} + +void * +xrealloc(void *p, size_t size) +{ + void *q; + + q = realloc(p, size); + if (!q) { + printf("Mem failure\n"); + exit(EXIT_FAILURE); + } + return q; +} + +void +xfree(void *p) +{ + if (p) { + free(p); + } +} diff --git a/libs/ldns/drill/drill_util.h b/libs/ldns/drill/drill_util.h new file mode 100644 index 0000000000..db3a57436a --- /dev/null +++ b/libs/ldns/drill/drill_util.h @@ -0,0 +1,58 @@ +/* + * util.h + * util.c header file + * in ldns + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#ifndef _DRILL_UTIL_H_ +#define _DRILL_UTIL_H_ +#include + +/** + * return a address rdf, either A or AAAA + * NULL if anything goes wrong + */ +ldns_rdf * ldns_rdf_new_addr_frm_str(char *); + +/** + * print all the ds of the keys in the packet + */ +void print_ds_of_keys(ldns_pkt *p); + +/** + * print some rdfs of a signature + */ +void print_rrsig_abbr(FILE *fp, ldns_rr *sig); +/** + * print some rdfs of a dnskey + */ +void print_dnskey_abbr(FILE *fp, ldns_rr *key); +/** + * print some rdfs of a ds + */ +void print_ds_abbr(FILE *fp, ldns_rr *ds); + +/** + * print some rdfs of a rr in a rr_list + */ +void print_rr_list_abbr(FILE *fp, ldns_rr_list *sig, char *usr); + +/** + * Alloc some memory, with error checking + */ +void *xmalloc(size_t s); + +/** + * Realloc some memory, with error checking + */ +void *xrealloc(void *p, size_t s); + +/** + * Free the data + */ +void xfree(void *q); +#endif /* _DRILL_UTIL_H_ */ diff --git a/libs/ldns/drill/error.c b/libs/ldns/drill/error.c new file mode 100644 index 0000000000..e67b7fca02 --- /dev/null +++ b/libs/ldns/drill/error.c @@ -0,0 +1,115 @@ +/** + * error.c + * + * error reporting routines + * basicly wrappers around printf + * + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +static void +warning_va_list(const char *fmt, va_list args) +{ + fprintf(stderr, "Warning: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); +} + +void +warning(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + warning_va_list(fmt, args); + va_end(args); +} + +static void +error_va_list(const char *fmt, va_list args) +{ + fprintf(stderr, "Error: "); + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); +} + +void +error(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + error_va_list(fmt, args); + va_end(args); + exit(EXIT_FAILURE); +} + +static void +verbose_va_list(const char *fmt, va_list args) +{ + vfprintf(stdout, fmt, args); + fprintf(stdout, "\n"); +} + +/* print stuff */ +void +mesg(const char *fmt, ...) +{ + va_list args; + if (verbosity == -1) { + return; + } + fprintf(stdout, ";; "); + va_start(args, fmt); + verbose_va_list(fmt, args); + va_end(args); +} + +/* print stuff when in verbose mode (1) */ +void +verbose(const char *fmt, ...) +{ + va_list args; + if (verbosity < 1) { + return; + } + + va_start(args, fmt); + verbose_va_list(fmt, args); + va_end(args); +} + +/* print stuff when in vverbose mode (2) */ +void +vverbose(const char *fmt, ...) +{ + va_list args; + if (verbosity < 2) { + return; + } + + va_start(args, fmt); + verbose_va_list(fmt, args); + va_end(args); +} + +static void +debug_va_list(const char *fmt, va_list args) +{ + vfprintf(stderr, fmt, args); + fprintf(stderr, "\n"); +} + +void +debug(const char *fmt, ...) +{ + va_list args; + fprintf(stderr, "[DEBUG] "); + va_start(args, fmt); + debug_va_list(fmt, args); + va_end(args); +} diff --git a/libs/ldns/drill/install-sh b/libs/ldns/drill/install-sh new file mode 100644 index 0000000000..6781b987bd --- /dev/null +++ b/libs/ldns/drill/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# 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. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # 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 $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/libs/ldns/drill/root.c b/libs/ldns/drill/root.c new file mode 100644 index 0000000000..a829935cd5 --- /dev/null +++ b/libs/ldns/drill/root.c @@ -0,0 +1,122 @@ +/* + * root.c + * Function to handle to the rootservers + * and to update and prime them + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include +#include + +/* a global list of the root-servers */ +ldns_rr_list *global_dns_root = NULL; + +/* put a hardcoded list in the root and + * init the root rrlist structure */ +void +init_root(void) +{ + ldns_rr *r; + + global_dns_root = ldns_rr_list_new(); + + (void)ldns_rr_new_frm_str(&r, "A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "D.ROOT-SERVERS.NET. 3600000 A 128.8.10.90", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2F::F", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803F:235", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 ", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7FD::1", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:3::42 ", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); + (void)ldns_rr_new_frm_str(&r, "M.ROOT-SERVERS.NET. 3600000 AAAA 2001:DC3::35", 0, NULL, NULL); + ldns_rr_list_push_rr(global_dns_root, r); +} + +/* + * Read a hints file as root + * + * The file with the given path should contain a list of NS RRs + * for the root zone and A records for those NS RRs. + * Read them, check them, and append the a records to the rr list given. + */ +ldns_rr_list * +read_root_hints(const char *filename) +{ + FILE *fp = NULL; + int line_nr = 0; + ldns_zone *z; + ldns_status status; + ldns_rr_list *addresses = NULL; + ldns_rr *rr; + size_t i; + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s for reading: %s\n", filename, strerror(errno)); + return NULL; + } + + status = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, 0, &line_nr); + fclose(fp); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error reading root hints file: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } else { + addresses = ldns_rr_list_new(); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { + rr = ldns_rr_list_rr(ldns_zone_rrs(z), i); + /*if ((address_family == 0 || address_family == 1) && + */ + if ( ldns_rr_get_type(rr) == LDNS_RR_TYPE_A ) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + /*if ((address_family == 0 || address_family == 2) &&*/ + if ( ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + } + ldns_zone_deep_free(z); + return addresses; + } +} + + +void +clear_root(void) +{ + ldns_rr_list_deep_free(global_dns_root); +} diff --git a/libs/ldns/drill/securetrace.c b/libs/ldns/drill/securetrace.c new file mode 100644 index 0000000000..ecc21fdf49 --- /dev/null +++ b/libs/ldns/drill/securetrace.c @@ -0,0 +1,761 @@ +/* + * securechasetrace.c + * Where all the hard work concerning secure tracing is done + * + * (c) 2005, 2006 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +#define SELF "[S]" /* self sig ok */ +#define TRUST "[T]" /* chain from parent */ +#define BOGUS "[B]" /* bogus */ +#define UNSIGNED "[U]" /* no relevant dnssec data found */ + +#if 0 +/* See if there is a key/ds in trusted that matches + * a ds in *ds. + */ +static ldns_rr_list * +ds_key_match(ldns_rr_list *ds, ldns_rr_list *trusted) +{ + size_t i, j; + bool match; + ldns_rr *rr_i, *rr_j; + ldns_rr_list *keys; + + if (!trusted || !ds) { + return NULL; + } + + match = false; + keys = ldns_rr_list_new(); + if (!keys) { + return NULL; + } + + if (!ds || !trusted) { + return NULL; + } + + for (i = 0; i < ldns_rr_list_rr_count(trusted); i++) { + rr_i = ldns_rr_list_rr(trusted, i); + for (j = 0; j < ldns_rr_list_rr_count(ds); j++) { + + rr_j = ldns_rr_list_rr(ds, j); + if (ldns_rr_compare_ds(rr_i, rr_j)) { + match = true; + /* only allow unique RRs to match */ + ldns_rr_set_push_rr(keys, rr_i); + } + } + } + if (match) { + return keys; + } else { + return NULL; + } +} +#endif + +ldns_pkt * +get_dnssec_pkt(ldns_resolver *r, ldns_rdf *name, ldns_rr_type t) +{ + ldns_pkt *p = NULL; + p = ldns_resolver_query(r, name, t, LDNS_RR_CLASS_IN, 0); + if (!p) { + return NULL; + } else { + if (verbosity >= 5) { + ldns_pkt_print(stdout, p); + } + return p; + } +} + +#ifdef HAVE_SSL +/* + * retrieve keys for this zone + */ +static ldns_pkt_type +get_key(ldns_pkt *p, ldns_rdf *apexname, ldns_rr_list **rrlist, ldns_rr_list **opt_sig) +{ + return get_dnssec_rr(p, apexname, LDNS_RR_TYPE_DNSKEY, rrlist, opt_sig); +} + +/* + * check to see if we can find a DS rrset here which we can then follow + */ +static ldns_pkt_type +get_ds(ldns_pkt *p, ldns_rdf *ownername, ldns_rr_list **rrlist, ldns_rr_list **opt_sig) +{ + return get_dnssec_rr(p, ownername, LDNS_RR_TYPE_DS, rrlist, opt_sig); +} +#endif /* HAVE_SSL */ + +void +remove_resolver_nameservers(ldns_resolver *res) +{ + ldns_rdf *pop; + + /* remove the old nameserver from the resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { + ldns_rdf_deep_free(pop); + } + +} + +void +show_current_nameservers(FILE *out, ldns_resolver *res) +{ + size_t i; + fprintf(out, "Current nameservers for resolver object:\n"); + for (i = 0; i < ldns_resolver_nameserver_count(res); i++) { + ldns_rdf_print(out, ldns_resolver_nameservers(res)[i]); + fprintf(out, "\n"); + } +} + +/*ldns_pkt **/ +#ifdef HAVE_SSL +int +do_secure_trace(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c, ldns_rr_list *trusted_keys, ldns_rdf *start_name + ) +{ + ldns_resolver *res; + ldns_pkt *p, *local_p; + ldns_rr_list *new_nss_a; + ldns_rr_list *new_nss_aaaa; + ldns_rr_list *new_nss; + ldns_rr_list *ns_addr; + uint16_t loop_count; + ldns_rdf *pop; + ldns_rdf **labels = NULL; + ldns_status status, st; + ssize_t i; + size_t j; + size_t k; + size_t l; + uint8_t labels_count; + ldns_pkt_type pt; + + /* dnssec */ + ldns_rr_list *key_list; + ldns_rr_list *key_sig_list; + ldns_rr_list *ds_list; + ldns_rr_list *ds_sig_list; + ldns_rr_list *correct_key_list; + ldns_rr_list *trusted_ds_rrs; + bool new_keys_trusted = false; + ldns_rr_list *current_correct_keys; + ldns_rr_list *dataset; + + ldns_rr_list *nsec_rrs = NULL; + ldns_rr_list *nsec_rr_sigs = NULL; + + /* empty non-terminal check */ + bool ent; + + /* glue handling */ + ldns_rr_list *new_ns_addr; + ldns_rr_list *old_ns_addr; + ldns_rr *ns_rr; + + int result = 0; + + /* printing niceness */ + const ldns_rr_descriptor *descriptor; + + descriptor = ldns_rr_descript(t); + + loop_count = 0; + new_nss_a = NULL; + new_nss_aaaa = NULL; + new_nss = NULL; + ns_addr = NULL; + key_list = NULL; + ds_list = NULL; + pt = LDNS_PACKET_UNKNOWN; + + p = NULL; + local_p = NULL; + res = ldns_resolver_new(); + key_sig_list = NULL; + ds_sig_list = NULL; + + if (!res) { + error("Memory allocation failed"); + result = -1; + return result; + } + + correct_key_list = ldns_rr_list_new(); + if (!correct_key_list) { + error("Memory allocation failed"); + result = -1; + return result; + } + + trusted_ds_rrs = ldns_rr_list_new(); + if (!trusted_ds_rrs) { + error("Memory allocation failed"); + result = -1; + return result; + } + /* Add all preset trusted DS signatures to the list of trusted DS RRs. */ + for (j = 0; j < ldns_rr_list_rr_count(trusted_keys); j++) { + ldns_rr* one_rr = ldns_rr_list_rr(trusted_keys, j); + if (ldns_rr_get_type(one_rr) == LDNS_RR_TYPE_DS) { + ldns_rr_list_push_rr(trusted_ds_rrs, ldns_rr_clone(one_rr)); + } + } + + /* transfer some properties of local_res to res */ + ldns_resolver_set_ip6(res, + ldns_resolver_ip6(local_res)); + ldns_resolver_set_port(res, + ldns_resolver_port(local_res)); + ldns_resolver_set_debug(res, + ldns_resolver_debug(local_res)); + ldns_resolver_set_fail(res, + ldns_resolver_fail(local_res)); + ldns_resolver_set_usevc(res, + ldns_resolver_usevc(local_res)); + ldns_resolver_set_random(res, + ldns_resolver_random(local_res)); + ldns_resolver_set_recursive(local_res, true); + + ldns_resolver_set_recursive(res, false); + ldns_resolver_set_dnssec_cd(res, false); + ldns_resolver_set_dnssec(res, true); + + /* setup the root nameserver in the new resolver */ + status = ldns_resolver_push_nameserver_rr_list(res, global_dns_root); + if (status != LDNS_STATUS_OK) { + printf("ERRRRR: %s\n", ldns_get_errorstr_by_id(status)); + ldns_rr_list_print(stdout, global_dns_root); + return status; + } + labels_count = ldns_dname_label_count(name); + if (start_name) { + if (ldns_dname_is_subdomain(name, start_name)) { + labels_count -= ldns_dname_label_count(start_name); + } else { + fprintf(stderr, "Error; "); + ldns_rdf_print(stderr, name); + fprintf(stderr, " is not a subdomain of "); + ldns_rdf_print(stderr, start_name); + fprintf(stderr, "\n"); + goto done; + } + } + labels = LDNS_XMALLOC(ldns_rdf*, labels_count + 2); + if (!labels) { + goto done; + } + labels[0] = ldns_dname_new_frm_str(LDNS_ROOT_LABEL_STR); + labels[1] = ldns_rdf_clone(name); + for(i = 2 ; i < (ssize_t)labels_count + 2; i++) { + labels[i] = ldns_dname_left_chop(labels[i - 1]); + } + /* if no servers is given with @, start by asking local resolver */ + /* first part todo :) */ + for (i = 0; i < (ssize_t) ldns_resolver_nameserver_count(local_res); i++) { + (void) ldns_resolver_push_nameserver(res, ldns_resolver_nameservers(local_res)[i]); + } + + /* get the nameserver for the label + * ask: dnskey and ds for the label + */ + for(i = (ssize_t)labels_count + 1; i > 0; i--) { + status = ldns_resolver_send(&local_p, res, labels[i], LDNS_RR_TYPE_NS, c, 0); + + if (verbosity >= 5) { + ldns_pkt_print(stdout, local_p); + } + + new_nss = ldns_pkt_rr_list_by_type(local_p, + LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); + if (!new_nss) { + /* if it's a delegation, servers put them in the auth section */ + new_nss = ldns_pkt_rr_list_by_type(local_p, + LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); + } + + /* if this is the final step there might not be nameserver records + of course if the data is in the apex, there are, so cover both + cases */ + if (new_nss || i > 1) { + for(j = 0; j < ldns_rr_list_rr_count(new_nss); j++) { + ns_rr = ldns_rr_list_rr(new_nss, j); + pop = ldns_rr_rdf(ns_rr, 0); + if (!pop) { + printf("nopo\n"); + break; + } + /* retrieve it's addresses */ + /* trust glue? */ + new_ns_addr = NULL; + if (ldns_dname_is_subdomain(pop, labels[i])) { + new_ns_addr = ldns_pkt_rr_list_by_name_and_type(local_p, pop, LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); + } + if (!new_ns_addr || ldns_rr_list_rr_count(new_ns_addr) == 0) { + new_ns_addr = ldns_get_rr_list_addr_by_name(res, pop, c, 0); + } + if (!new_ns_addr || ldns_rr_list_rr_count(new_ns_addr) == 0) { + new_ns_addr = ldns_get_rr_list_addr_by_name(local_res, pop, c, 0); + } + + if (new_ns_addr) { + old_ns_addr = ns_addr; + ns_addr = ldns_rr_list_cat_clone(ns_addr, new_ns_addr); + ldns_rr_list_deep_free(old_ns_addr); + } + ldns_rr_list_deep_free(new_ns_addr); + } + ldns_rr_list_deep_free(new_nss); + + if (ns_addr) { + remove_resolver_nameservers(res); + + if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != + LDNS_STATUS_OK) { + error("Error adding new nameservers"); + ldns_pkt_free(local_p); + goto done; + } + ldns_rr_list_deep_free(ns_addr); + } else { + status = ldns_verify_denial(local_p, labels[i], LDNS_RR_TYPE_NS, &nsec_rrs, &nsec_rr_sigs); + + /* verify the nsec3 themselves*/ + if (verbosity >= 4) { + printf("NSEC(3) Records to verify:\n"); + ldns_rr_list_print(stdout, nsec_rrs); + printf("With signatures:\n"); + ldns_rr_list_print(stdout, nsec_rr_sigs); + printf("correct keys:\n"); + ldns_rr_list_print(stdout, correct_key_list); + } + + if (status == LDNS_STATUS_OK) { + if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i]); + /* + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + */ fprintf(stdout, " NS\n"); + } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i]); + /* + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + */ + fprintf(stdout, " NS\n"); + } else { + fprintf(stdout, "%s ", BOGUS); + result = 1; + printf(";; Error verifying denial of existence for name "); + ldns_rdf_print(stdout, labels[i]); + /* + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + */ printf("NS: %s\n", ldns_get_errorstr_by_id(st)); + } + } else { + fprintf(stdout, "%s ", BOGUS); + result = 1; + printf(";; Error verifying denial of existence for name "); + ldns_rdf_print(stdout, labels[i]); + printf("NS: %s\n", ldns_get_errorstr_by_id(status)); + } + + /* there might be an empty non-terminal, in which case we need to continue */ + ent = false; + for (j = 0; j < ldns_rr_list_rr_count(nsec_rrs); j++) { + if (ldns_dname_is_subdomain(ldns_rr_rdf(ldns_rr_list_rr(nsec_rrs, j), 0), labels[i])) { + ent = true; + } + } + if (!ent) { + ldns_rr_list_deep_free(nsec_rrs); + ldns_rr_list_deep_free(nsec_rr_sigs); + ldns_pkt_free(local_p); + goto done; + } else { + printf(";; There is an empty non-terminal here, continue\n"); + continue; + } + goto done; + } + + if (ldns_resolver_nameserver_count(res) == 0) { + error("No nameservers found for this node"); + goto done; + } + } + ldns_pkt_free(local_p); + + fprintf(stdout, ";; Domain: "); + ldns_rdf_print(stdout, labels[i]); + fprintf(stdout, "\n"); + + /* retrieve keys for current domain, and verify them + if they match an already trusted DS, or if one of the + keys used to sign these is trusted, add the keys to + the trusted list */ + p = get_dnssec_pkt(res, labels[i], LDNS_RR_TYPE_DNSKEY); + pt = get_key(p, labels[i], &key_list, &key_sig_list); + if (key_sig_list) { + if (key_list) { + current_correct_keys = ldns_rr_list_new(); + if ((st = ldns_verify(key_list, key_sig_list, key_list, current_correct_keys)) == + LDNS_STATUS_OK) { + /* add all signed keys (don't just add current_correct, you'd miss + * the zsk's then */ + for (j = 0; j < ldns_rr_list_rr_count(key_list); j++) { + ldns_rr_list_push_rr(correct_key_list, ldns_rr_clone(ldns_rr_list_rr(key_list, j))); + } + + /* check whether these keys were signed + * by a trusted keys. if so, these + * keys are also trusted */ + new_keys_trusted = false; + for (k = 0; k < ldns_rr_list_rr_count(current_correct_keys); k++) { + for (j = 0; j < ldns_rr_list_rr_count(trusted_ds_rrs); j++) { + if (ldns_rr_compare_ds(ldns_rr_list_rr(current_correct_keys, k), + ldns_rr_list_rr(trusted_ds_rrs, j))) { + new_keys_trusted = true; + } + } + } + + /* also all keys are trusted if one of the current correct keys is trusted */ + for (k = 0; k < ldns_rr_list_rr_count(current_correct_keys); k++) { + for (j = 0; j < ldns_rr_list_rr_count(trusted_keys); j++) { + if (ldns_rr_compare(ldns_rr_list_rr(current_correct_keys, k), + ldns_rr_list_rr(trusted_keys, j)) == 0) { + new_keys_trusted = true; + } + } + } + + + if (new_keys_trusted) { + ldns_rr_list_push_rr_list(trusted_keys, key_list); + print_rr_list_abbr(stdout, key_list, TRUST); + ldns_rr_list_free(key_list); + key_list = NULL; + } else { + if (verbosity >= 2) { + printf(";; Signature ok but no chain to a trusted key or ds record\n"); + } + print_rr_list_abbr(stdout, key_list, SELF); + ldns_rr_list_deep_free(key_list); + key_list = NULL; + } + } else { + print_rr_list_abbr(stdout, key_list, BOGUS); + result = 2; + ldns_rr_list_deep_free(key_list); + key_list = NULL; + } + ldns_rr_list_free(current_correct_keys); + current_correct_keys = NULL; + } else { + printf(";; No DNSKEY record found for "); + ldns_rdf_print(stdout, labels[i]); + printf("\n"); + } + } + + ldns_pkt_free(p); + ldns_rr_list_deep_free(key_sig_list); + key_sig_list = NULL; + + /* check the DS records for the next child domain */ + if (i > 1) { + p = get_dnssec_pkt(res, labels[i-1], LDNS_RR_TYPE_DS); + pt = get_ds(p, labels[i-1], &ds_list, &ds_sig_list); + if (!ds_list) { + ldns_pkt_free(p); + if (ds_sig_list) { + ldns_rr_list_deep_free(ds_sig_list); + } + p = get_dnssec_pkt(res, name, LDNS_RR_TYPE_DNSKEY); + pt = get_ds(p, NULL, &ds_list, &ds_sig_list); + } + if (ds_sig_list) { + if (ds_list) { + if (verbosity >= 4) { + printf("VERIFYING:\n"); + printf("DS LIST:\n"); + ldns_rr_list_print(stdout, ds_list); + printf("SIGS:\n"); + ldns_rr_list_print(stdout, ds_sig_list); + printf("KEYS:\n"); + ldns_rr_list_print(stdout, correct_key_list); + } + + current_correct_keys = ldns_rr_list_new(); + + if ((st = ldns_verify(ds_list, ds_sig_list, correct_key_list, current_correct_keys)) == + LDNS_STATUS_OK) { + /* if the ds is signed by a trusted key and a key from correct keys + matches that ds, add that key to the trusted keys */ + new_keys_trusted = false; + if (verbosity >= 2) { + printf("Checking if signing key is trusted:\n"); + } + for (j = 0; j < ldns_rr_list_rr_count(current_correct_keys); j++) { + if (verbosity >= 2) { + printf("New key: "); + ldns_rr_print(stdout, ldns_rr_list_rr(current_correct_keys, j)); + } + for (k = 0; k < ldns_rr_list_rr_count(trusted_keys); k++) { + if (verbosity >= 2) { + printf("\tTrusted key: "); + ldns_rr_print(stdout, ldns_rr_list_rr(trusted_keys, k)); + } + if (ldns_rr_compare(ldns_rr_list_rr(current_correct_keys, j), + ldns_rr_list_rr(trusted_keys, k)) == 0) { + if (verbosity >= 2) { + printf("Key is now trusted!\n"); + } + for (l = 0; l < ldns_rr_list_rr_count(ds_list); l++) { + ldns_rr_list_push_rr(trusted_ds_rrs, ldns_rr_clone(ldns_rr_list_rr(ds_list, l))); + new_keys_trusted = true; + } + } + } + } + if (new_keys_trusted) { + print_rr_list_abbr(stdout, ds_list, TRUST); + } else { + print_rr_list_abbr(stdout, ds_list, SELF); + } + } else { + result = 3; + print_rr_list_abbr(stdout, ds_list, BOGUS); + } + + ldns_rr_list_free(current_correct_keys); + current_correct_keys = NULL; + } else { + /* wait apparently there were no keys either, go back to the ds packet */ + ldns_pkt_free(p); + ldns_rr_list_deep_free(ds_sig_list); + p = get_dnssec_pkt(res, labels[i-1], LDNS_RR_TYPE_DS); + pt = get_ds(p, labels[i-1], &ds_list, &ds_sig_list); + + status = ldns_verify_denial(p, labels[i-1], LDNS_RR_TYPE_DS, &nsec_rrs, &nsec_rr_sigs); + + if (verbosity >= 4) { + printf("NSEC(3) Records to verify:\n"); + ldns_rr_list_print(stdout, nsec_rrs); + printf("With signatures:\n"); + ldns_rr_list_print(stdout, nsec_rr_sigs); + printf("correct keys:\n"); + ldns_rr_list_print(stdout, correct_key_list); + } + + if (status == LDNS_STATUS_OK) { + if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i-1]); + printf(" DS"); + fprintf(stdout, "\n"); + } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, labels[i-1]); + printf(" DS"); + fprintf(stdout, "\n"); + } else { + result = 4; + fprintf(stdout, "%s ", BOGUS); + printf("Error verifying denial of existence for "); + ldns_rdf_print(stdout, labels[i-1]); + printf(" DS"); + printf(": %s\n", ldns_get_errorstr_by_id(st)); + } + + + } else { + if (status == LDNS_STATUS_CRYPTO_NO_RRSIG) { + printf(";; No DS for "); + ldns_rdf_print(stdout, labels[i - 1]); + } else { + printf("[B] Unable to verify denial of existence for "); + ldns_rdf_print(stdout, labels[i - 1]); + printf(" DS: %s\n", ldns_get_errorstr_by_id(status)); + } + } + if (verbosity >= 2) { + printf(";; No ds record for delegation\n"); + } + } + } + ldns_rr_list_deep_free(ds_list); + ldns_pkt_free(p); + } else { + /* if this is the last label, just verify the data and stop */ + p = get_dnssec_pkt(res, labels[i], t); + pt = get_dnssec_rr(p, labels[i], t, &dataset, &key_sig_list); + if (dataset && ldns_rr_list_rr_count(dataset) > 0) { + if (key_sig_list && ldns_rr_list_rr_count(key_sig_list) > 0) { + + /* If this is a wildcard, you must be able to deny exact match */ + if ((st = ldns_verify(dataset, key_sig_list, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + ldns_rr_list_print(stdout, dataset); + } else if ((st = ldns_verify(dataset, key_sig_list, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + ldns_rr_list_print(stdout, dataset); + } else { + result = 5; + fprintf(stdout, "%s ", BOGUS); + ldns_rr_list_print(stdout, dataset); + printf(";; Error: %s\n", ldns_get_errorstr_by_id(st)); + } + } else { + fprintf(stdout, "%s ", UNSIGNED); + ldns_rr_list_print(stdout, dataset); + } + ldns_rr_list_deep_free(dataset); + } else { + status = ldns_verify_denial(p, name, t, &nsec_rrs, &nsec_rr_sigs); + if (status == LDNS_STATUS_OK) { + /* verify the nsec3 themselves*/ + if (verbosity >= 5) { + printf("NSEC(3) Records to verify:\n"); + ldns_rr_list_print(stdout, nsec_rrs); + printf("With signatures:\n"); + ldns_rr_list_print(stdout, nsec_rr_sigs); + printf("correct keys:\n"); + ldns_rr_list_print(stdout, correct_key_list); +/* + printf("trusted keys at %p:\n", trusted_keys); + ldns_rr_list_print(stdout, trusted_keys); +*/ } + + if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, trusted_keys, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", TRUST); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, name); + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + fprintf(stdout, "\n"); + } else if ((st = ldns_verify(nsec_rrs, nsec_rr_sigs, correct_key_list, NULL)) == LDNS_STATUS_OK) { + fprintf(stdout, "%s ", SELF); + fprintf(stdout, "Existence denied: "); + ldns_rdf_print(stdout, name); + if (descriptor && descriptor->_name) { + printf(" %s", descriptor->_name); + } else { + printf(" TYPE%u", t); + } + fprintf(stdout, "\n"); + } else { + result = 6; + fprintf(stdout, "%s ", BOGUS); + printf("Error verifying denial of existence for "); + ldns_rdf_print(stdout, name); + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + printf(": %s\n", ldns_get_errorstr_by_id(st)); + } + + ldns_rr_list_deep_free(nsec_rrs); + ldns_rr_list_deep_free(nsec_rr_sigs); + } else { +/* +*/ + if (status == LDNS_STATUS_CRYPTO_NO_RRSIG) { + printf("%s ", UNSIGNED); + printf("No data found for: "); + ldns_rdf_print(stdout, name); + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + printf("\n"); + } else { + printf("[B] Unable to verify denial of existence for "); + ldns_rdf_print(stdout, name); + printf(" type "); + if (descriptor && descriptor->_name) { + printf("%s", descriptor->_name); + } else { + printf("TYPE%u", t); + } + printf("\n"); + } + + } + } + ldns_pkt_free(p); + } + + new_nss_aaaa = NULL; + new_nss_a = NULL; + new_nss = NULL; + ns_addr = NULL; + ldns_rr_list_deep_free(key_list); + key_list = NULL; + ldns_rr_list_deep_free(key_sig_list); + key_sig_list = NULL; + ds_list = NULL; + ldns_rr_list_deep_free(ds_sig_list); + ds_sig_list = NULL; + } + printf(";;" SELF " self sig OK; " BOGUS " bogus; " TRUST " trusted\n"); + /* verbose mode? + printf("Trusted keys:\n"); + ldns_rr_list_print(stdout, trusted_keys); + printf("trusted dss:\n"); + ldns_rr_list_print(stdout, trusted_ds_rrs); + */ + + done: + ldns_rr_list_deep_free(trusted_ds_rrs); + ldns_rr_list_deep_free(correct_key_list); + ldns_resolver_deep_free(res); + if (labels) { + for(i = 0 ; i < (ssize_t)labels_count + 2; i++) { + ldns_rdf_deep_free(labels[i]); + } + LDNS_FREE(labels); + } + return result; +} +#endif /* HAVE_SSL */ diff --git a/libs/ldns/drill/work.c b/libs/ldns/drill/work.c new file mode 100644 index 0000000000..3a9cb5855d --- /dev/null +++ b/libs/ldns/drill/work.c @@ -0,0 +1,276 @@ +/* + * work.c + * Where all the hard work is done + * (c) 2005 NLnet Labs + * + * See the file LICENSE for the license + * + */ + +#include "drill.h" +#include + +/** + * Converts a hex string to binary data + * len is the length of the string + * buf is the buffer to store the result in + * offset is the starting position in the result buffer + * + * This function returns the length of the result + */ +size_t +hexstr2bin(char *hexstr, int len, uint8_t *buf, size_t offset, size_t buf_len) +{ + char c; + int i; + uint8_t int8 = 0; + int sec = 0; + size_t bufpos = 0; + + if (len % 2 != 0) { + return 0; + } + + for (i=0; i= '0' && c <= '9') { + int8 += c & 0x0f; + } else if (c >= 'a' && c <= 'z') { + int8 += (c & 0x0f) + 9; + } else if (c >= 'A' && c <= 'Z') { + int8 += (c & 0x0f) + 9; + } else { + return 0; + } + + if (sec == 0) { + int8 = int8 << 4; + sec = 1; + } else { + if (bufpos + offset + 1 <= buf_len) { + buf[bufpos+offset] = int8; + int8 = 0; + sec = 0; + bufpos++; + } else { + error("Buffer too small in hexstr2bin"); + } + } + } + } + return bufpos; +} + +size_t +packetbuffromfile(char *filename, uint8_t *wire) +{ + FILE *fp = NULL; + int c; + + /* stat hack + * 0 = normal + * 1 = comment (skip to end of line) + * 2 = unprintable character found, read binary data directly + */ + int state = 0; + uint8_t *hexbuf = xmalloc(LDNS_MAX_PACKETLEN); + int hexbufpos = 0; + size_t wirelen; + + if (strncmp(filename, "-", 2) == 0) { + fp = stdin; + } else { + fp = fopen(filename, "r"); + } + if (fp == NULL) { + perror("Unable to open file for reading"); + xfree(hexbuf); + return 0; + } + + /*verbose("Opened %s\n", filename);*/ + + c = fgetc(fp); + while (c != EOF && hexbufpos < LDNS_MAX_PACKETLEN) { + if (state < 2 && !isascii(c)) { + /*verbose("non ascii character found in file: (%d) switching to raw mode\n", c);*/ + state = 2; + } + switch (state) { + case 0: + if ( (c >= '0' && c <= '9') || + (c >= 'a' && c <= 'f') || + (c >= 'A' && c <= 'F') ) + { + hexbuf[hexbufpos] = (uint8_t) c; + hexbufpos++; + } else if (c == ';') { + state = 1; + } else if (c == ' ' || c == '\t' || c == '\n') { + /* skip whitespace */ + } + break; + case 1: + if (c == '\n' || c == EOF) { + state = 0; + } + break; + case 2: + hexbuf[hexbufpos] = (uint8_t) c; + hexbufpos++; + break; + default: + warning("unknown state while reading %s", filename); + xfree(hexbuf); + return 0; + break; + } + c = fgetc(fp); + } + + if (c == EOF) { + /* + if (have_drill_opt && drill_opt->verbose) { + verbose("END OF FILE REACHED\n"); + if (state < 2) { + verbose("read:\n"); + verbose("%s\n", hexbuf); + } else { + verbose("Not printing wire because it contains non ascii data\n"); + } + } + */ + } + if (hexbufpos >= LDNS_MAX_PACKETLEN) { + /*verbose("packet size reached\n");*/ + } + + /* lenient mode: length must be multiple of 2 */ + if (hexbufpos % 2 != 0) { + hexbuf[hexbufpos] = (uint8_t) '0'; + hexbufpos++; + } + + if (state < 2) { + wirelen = hexstr2bin((char *) hexbuf, + hexbufpos, + wire, + 0, + LDNS_MAX_PACKETLEN); + } else { + memcpy(wire, hexbuf, (size_t) hexbufpos); + wirelen = (size_t) hexbufpos; + } + if (fp != stdin) { + fclose(fp); + } + xfree(hexbuf); + return wirelen; +} + +ldns_buffer * +read_hex_buffer(char *filename) +{ + uint8_t *wire; + size_t wiresize; + ldns_buffer *result_buffer = NULL; + + FILE *fp = NULL; + + if (strncmp(filename, "-", 2) != 0) { + fp = fopen(filename, "r"); + } else { + fp = stdin; + } + + if (fp == NULL) { + perror(""); + warning("Unable to open %s", filename); + return NULL; + } + + wire = xmalloc(LDNS_MAX_PACKETLEN); + + wiresize = packetbuffromfile(filename, wire); + + result_buffer = LDNS_MALLOC(ldns_buffer); + ldns_buffer_new_frm_data(result_buffer, wire, wiresize); + ldns_buffer_set_position(result_buffer, ldns_buffer_capacity(result_buffer)); + + xfree(wire); + return result_buffer; +} + +ldns_pkt * +read_hex_pkt(char *filename) +{ + uint8_t *wire; + size_t wiresize; + + ldns_pkt *pkt = NULL; + + ldns_status status = LDNS_STATUS_ERR; + + wire = xmalloc(LDNS_MAX_PACKETLEN); + + wiresize = packetbuffromfile(filename, wire); + + if (wiresize > 0) { + status = ldns_wire2pkt(&pkt, wire, wiresize); + } + + xfree(wire); + + if (status == LDNS_STATUS_OK) { + return pkt; + } else { + fprintf(stderr, "Error parsing hex file: %s\n", + ldns_get_errorstr_by_id(status)); + return NULL; + } +} + +void +dump_hex(const ldns_pkt *pkt, const char *filename) +{ + uint8_t *wire; + size_t size, i; + FILE *fp; + ldns_status status; + + fp = fopen(filename, "w"); + + if (fp == NULL) { + error("Unable to open %s for writing", filename); + return; + } + + status = ldns_pkt2wire(&wire, pkt, &size); + + if (status != LDNS_STATUS_OK) { + error("Unable to convert packet: error code %u", status); + return; + } + + fprintf(fp, "; 0"); + for (i = 1; i < 20; i++) { + fprintf(fp, " %2u", (unsigned int) i); + } + fprintf(fp, "\n"); + fprintf(fp, ";--"); + for (i = 1; i < 20; i++) { + fprintf(fp, " --"); + } + fprintf(fp, "\n"); + for (i = 0; i < size; i++) { + if (i % 20 == 0 && i > 0) { + fprintf(fp, "\t;\t%4u-%4u\n", (unsigned int) i-19, (unsigned int) i); + } + fprintf(fp, " %02x", (unsigned int)wire[i]); + } + fprintf(fp, "\n"); + fclose(fp); +} diff --git a/libs/ldns/error.c b/libs/ldns/error.c new file mode 100644 index 0000000000..ff240dcc82 --- /dev/null +++ b/libs/ldns/error.c @@ -0,0 +1,105 @@ +/* + * a error2str function to make sense of all the + * error codes we have laying ardoun + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ + +#include + +#include + +ldns_lookup_table ldns_error_str[] = { + { LDNS_STATUS_OK, "All OK" }, + { LDNS_STATUS_EMPTY_LABEL, "Empty label" }, + { LDNS_STATUS_LABEL_OVERFLOW, "Label length overflow" }, + { LDNS_STATUS_DOMAINNAME_OVERFLOW, "Domainname length overflow" }, + { LDNS_STATUS_DOMAINNAME_UNDERFLOW, "Domainname length underflow (zero length)" }, + { LDNS_STATUS_DDD_OVERFLOW, "\\DDD sequence overflow (>255)" }, + { LDNS_STATUS_PACKET_OVERFLOW, "Packet size overflow" }, + { LDNS_STATUS_INVALID_POINTER, "Invalid compression pointer" }, + { LDNS_STATUS_MEM_ERR, "General memory error" }, + { LDNS_STATUS_INTERNAL_ERR, "Internal error, this should not happen" }, + { LDNS_STATUS_SSL_ERR, "Error in SSL library" }, + { LDNS_STATUS_ERR, "General LDNS error" }, + { LDNS_STATUS_INVALID_INT, "Conversion error, integer expected" }, + { LDNS_STATUS_INVALID_IP4, "Conversion error, ip4 addr expected" }, + { LDNS_STATUS_INVALID_IP6, "Conversion error, ip6 addr expected" }, + { LDNS_STATUS_INVALID_STR, "Conversion error, string expected" }, + { LDNS_STATUS_INVALID_B64, "Conversion error, b64 encoding expected" }, + { LDNS_STATUS_INVALID_HEX, "Conversion error, hex encoding expected" }, + { LDNS_STATUS_INVALID_TIME, "Conversion error, time encoding expected" }, + { LDNS_STATUS_NETWORK_ERR, "Could not send or receive, because of network error" }, + { LDNS_STATUS_ADDRESS_ERR, "Could not start AXFR, because of address error" }, + { LDNS_STATUS_FILE_ERR, "Could not open the files" }, + { LDNS_STATUS_UNKNOWN_INET, "Uknown address family" }, + { LDNS_STATUS_NOT_IMPL, "This function is not implemented (yet), please notify the developers - or not..." }, + { LDNS_STATUS_NULL, "Supplied value pointer null" }, + { LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, "Unknown cryptographic algorithm" }, + { LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, "Cryptographic algorithm not implemented" }, + { LDNS_STATUS_CRYPTO_NO_RRSIG, "No DNSSEC signature(s)" }, + { LDNS_STATUS_CRYPTO_NO_DNSKEY, "No DNSSEC public key(s)" }, + { LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, "The signature does not cover this RRset" }, + { LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, "No signatures found for trusted DNSSEC public key(s)" }, + { LDNS_STATUS_CRYPTO_NO_DS, "No DS record(s)" }, + { LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, "Could not validate DS record(s)" }, + { LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, "No keys with the keytag and algorithm from the RRSIG found" }, + { LDNS_STATUS_CRYPTO_VALIDATED, "Valid DNSSEC signature" }, + { LDNS_STATUS_CRYPTO_BOGUS, "Bogus DNSSEC signature" }, + { LDNS_STATUS_CRYPTO_SIG_EXPIRED, "DNSSEC signature has expired" }, + { LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, "DNSSEC signature not incepted yet" }, + { LDNS_STATUS_CRYPTO_TSIG_BOGUS, "Bogus TSIG signature" }, + { LDNS_STATUS_CRYPTO_TSIG_ERR, "Could not create TSIG signature" }, + { LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, "DNSSEC signature has expiration date earlier than inception date" }, + { LDNS_STATUS_ENGINE_KEY_NOT_LOADED, "Unable to load private key from engine" }, + { LDNS_STATUS_NSEC3_ERR, "Error in NSEC3 denial of existence proof" }, + { LDNS_STATUS_RES_NO_NS, "No (valid) nameservers defined in the resolver" }, + { LDNS_STATUS_RES_QUERY, "No correct query given to resolver" }, + { LDNS_STATUS_WIRE_INCOMPLETE_HEADER, "header section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, "question section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, "answer section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, "authority section incomplete" }, + { LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, "additional section incomplete" }, + { LDNS_STATUS_NO_DATA, "No data" }, + { LDNS_STATUS_CERT_BAD_ALGORITHM, "Bad algorithm type for CERT record" }, + { LDNS_STATUS_SYNTAX_TYPE_ERR, "Syntax error, could not parse the RR's type" }, + { LDNS_STATUS_SYNTAX_CLASS_ERR, "Syntax error, could not parse the RR's class" }, + { LDNS_STATUS_SYNTAX_TTL_ERR, "Syntax error, could not parse the RR's TTL" }, + { LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, "Syntax error, $INCLUDE not implemented" }, + { LDNS_STATUS_SYNTAX_RDATA_ERR, "Syntax error, could not parse the RR's rdata" }, + { LDNS_STATUS_SYNTAX_DNAME_ERR, "Syntax error, could not parse the RR's dname(s)" }, + { LDNS_STATUS_SYNTAX_VERSION_ERR, "Syntax error, version mismatch" }, + { LDNS_STATUS_SYNTAX_ALG_ERR, "Syntax error, algorithm unknown or non parseable" }, + { LDNS_STATUS_SYNTAX_KEYWORD_ERR, "Syntax error, unknown keyword in input" }, + { LDNS_STATUS_SYNTAX_ERR, "Syntax error, could not parse the RR" }, + { LDNS_STATUS_SYNTAX_EMPTY, "Empty line was returned" }, + { LDNS_STATUS_SYNTAX_TTL, "$TTL directive was seen in the zone" }, + { LDNS_STATUS_SYNTAX_ORIGIN, "$ORIGIN directive was seen in the zone" }, + { LDNS_STATUS_SYNTAX_INCLUDE, "$INCLUDE directive was seen in the zone" }, + { LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, "Iterations count for NSEC3 record higher than maximum" }, + { LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, "Syntax error, value expected" }, + { LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, "Syntax error, integer value too large" }, + { LDNS_STATUS_SYNTAX_BAD_ESCAPE, "Syntax error, bad escape sequence" }, + { LDNS_STATUS_SOCKET_ERROR, "Error creating socket" }, + { LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, "Existence denied by NSEC" }, + { LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, "RR not covered by the given NSEC RRs" }, + { LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, "wildcard not covered by the given NSEC RRs" }, + { LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND, "original of NSEC3 hashed name could not be found" }, + { 0, NULL } +}; + +const char * +ldns_get_errorstr_by_id(ldns_status err) +{ + ldns_lookup_table *lt; + + lt = ldns_lookup_by_id(ldns_error_str, err); + + if (lt) { + return lt->name; + } + return NULL; +} diff --git a/libs/ldns/examples/Makefile.in b/libs/ldns/examples/Makefile.in new file mode 100644 index 0000000000..659efc0c33 --- /dev/null +++ b/libs/ldns/examples/Makefile.in @@ -0,0 +1,179 @@ +# Standard installation pathnames +# See the file LICENSE for the license +SHELL = @SHELL@ +VERSION = @PACKAGE_VERSION@ +basesrcdir = $(shell basename `pwd`) +srcdir = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ +bindir = @bindir@ +mandir = @mandir@ +libtool = @libtool@ + +CC = @CC@ +CFLAGS = -I. -I${srcdir} @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +LIBNSL_LIBS = @LIBNSL_LIBS@ +LIBSSL_CPPFLAGS = @LIBSSL_CPPFLAGS@ +LIBSSL_LDFLAGS = @LIBSSL_LDFLAGS@ +LIBSSL_LIBS = @LIBSSL_LIBS@ +LIBS = @LIBS@ +RUNTIME_PATH = @RUNTIME_PATH@ +LDNSDIR = @LDNSDIR@ + +INSTALL = $(srcdir)/../install-sh + +COMPILE = $(CC) $(CPPFLAGS) $(LIBSSL_CPPFLAGS) $(CFLAGS) +LINK = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(RUNTIME_PATH) +LINK_STATIC = $(libtool) --tag=CC --quiet --mode=link $(CC) $(CFLAGS) -static $(LDFLAGS) $(LIBS) $(RUNTIME_PATH) + +LINT = splint +LINTFLAGS=+quiet -weak -warnposix -unrecog -Din_addr_t=uint32_t -Du_int=unsigned -Du_char=uint8_t -preproc -Drlimit=rlimit64 -D__gnuc_va_list=va_list +#-Dglob64=glob -Dglobfree64=globfree +# compat with openssl linux edition. +LINTFLAGS+="-DBN_ULONG=unsigned long" -Dkrb5_int32=int "-Dkrb5_ui_4=unsigned int" -DPQ_64BIT=uint64_t -DRC4_INT=unsigned -fixedformalarray -D"ENGINE=unsigned" -D"RSA=unsigned" -D"DSA=unsigned" -D"EVP_PKEY=unsigned" -D"EVP_MD=unsigned" -D"SSL=unsigned" -D"SSL_CTX=unsigned" -D"X509=unsigned" -D"RC4_KEY=unsigned" -D"EVP_MD_CTX=unsigned" +# compat with NetBSD +ifeq "$(shell uname)" "NetBSD" +LINTFLAGS+="-D__RENAME(x)=" -D_NETINET_IN_H_ +endif +# compat with OpenBSD +LINTFLAGS+="-Dsigset_t=long" +# FreeBSD8 +LINTFLAGS+="-D__uint16_t=uint16_t" +LINTFLAGS+=-D__signed__=signed "-D__packed=" "-D__aligned(x)=" + +HEADER = config.h +MAIN_SOURCES = ldns-read-zone.c \ + ldns-mx.c \ + ldns-chaos.c \ + ldns-update.c \ + ldns-keygen.c \ + ldns-key2ds.c \ + ldns-version.c \ + ldns-rrsig.c \ + ldns-walk.c \ + ldns-zsplit.c \ + ldns-zcat.c \ + ldns-dpa.c \ + ldns-resolver.c \ + ldns-test-edns.c \ + ldns-keyfetcher.c \ + ldns-notify.c \ + ldns-testns.c \ + ldns-compare-zones.c \ + ldnsd.c + +MAIN_SSL_SOURCES = ldns-signzone.c \ + ldns-verify-zone.c \ + ldns-revoke.c \ + ldns-nsec3-hash.c + +OTHER_SOURCES = ldns-testpkts.c + +PROGRAMS=$(MAIN_SOURCES:.c=) +SSL_PROGRAMS=$(MAIN_SSL_SOURCES:.c=) + +.PHONY: all clean realclean all-static +.SECONDARY: $(MAIN_SOURCES:.c=.o) $(OTHER_SOURCES:.c=.o) $(MAIN_SSL_SOURCES:.c=.o) + +all: $(addsuffix .prg,$(PROGRAMS)) $(addsuffix .prg-ssl,$(SSL_PROGRAMS)) + +all-static: $(addsuffix .stc,$(PROGRAMS)) $(addsuffix .stc-ssl,$(SSL_PROGRAMS)) + +%.o: $(srcdir)/%.c + $(COMPILE) -o $@ -c $< + +# ldns-testns uses more sources. +ldns-testns.o: $(srcdir)/ldns-testns.c $(srcdir)/ldns-testpkts.c $(srcdir)/ldns-testpkts.h +ldns-testns.prg: ldns-testpkts.o +ldns-testns.stc: ldns-testpkts.o + +ldnsd.prg: ldnsd.o + @if test ! -f $(@:.prg=) -o $< -nt $(@:.prg=); then \ + echo $(LINK) $(LIBNSL_LIBS) -o $(@:.prg=) $^ ; \ + $(LINK) $(LIBNSL_LIBS) -o $(@:.prg=) $^ ; \ + fi + +ldnsd.stc: ldnsd.o + @if test ! -f $@ -o $< -nt $@; then \ + echo $(LINK_STATIC) $(LIBNSL_LDFLAGS) -o $@ $^ ; \ + $(LINK_STATIC) $(LIBNSL_LDFLAGS) -o $@ $^ ; \ + fi + +%.prg-ssl: %.o + @if test ! -f $(@:.prg-ssl=) -o $< -nt $(@:.prg-ssl=); then \ + echo $(LINK) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $(@:.prg-ssl=) $^ ; \ + $(LINK) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $(@:.prg-ssl=) $^ ; \ + fi + +%.stc-ssl: %.o + @if test ! -f $@ -o $< -nt $@; then \ + echo $(LINK_STATIC) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $@ $^ ; \ + $(LINK_STATIC) $(LIBNSL_LIBS) $(LIBSSL_LDFLAGS) $(LIBSSL_LIBS) -o $@ $^ ; \ + fi + +%.prg: %.o + @if test ! -f $(@:.prg=) -o $< -nt $(@:.prg=); then \ + echo $(LINK) -o $(@:.prg=) $^ ; \ + $(LINK) -o $(@:.prg=) $^ ; \ + fi + +%.stc: %.o + @if test ! -f $@ -o $< -nt $@; then \ + echo $(LINK_STATIC) -o $@ $^ ; \ + $(LINK_STATIC) -o $@ $^ ; \ + fi + +lint: + for i in $(MAIN_SOURCES) $(OTHER_SOURCES); do \ + $(LINT) $(LINTFLAGS) -I. -I$(srcdir) $(srcdir)/$$i $(CPPFLAGS); \ + if [ $$? -ne 0 ] ; then exit 1 ; fi ; \ + done + +clean: + rm -f *.o *.lo + rm -rf .libs + rm -f $(PROGRAMS) $(SSL_PROGRAMS) + rm -f $(addsuffix .stc,$(PROGRAMS)) $(addsuffix .stc-ssl,$(SSL_PROGRAMS)) + +realclean: clean + rm -rf autom4te.cache/ + rm -f config.log config.status aclocal.m4 config.h.in configure Makefile + rm -f config.h + +confclean: clean + rm -rf config.log config.status config.h Makefile + +install: $(PROGRAMS) $(SSL_PROGRAMS) + $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 + for i in $(PROGRAMS) $(SSL_PROGRAMS); do \ + $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i $(DESTDIR)$(bindir) ; \ + $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + exit 0 + +install-static: all-static + $(INSTALL) -d -m 755 $(DESTDIR)$(bindir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir) + $(INSTALL) -d -m 755 $(DESTDIR)$(mandir)/man1 + for i in $(PROGRAMS); do \ + $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i.stc $(DESTDIR)$(bindir) ; \ + $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + for i in $(SSL_PROGRAMS); do \ + $(libtool) --tag=CC --mode=install ${INSTALL} -c $$i.stc-ssl $(DESTDIR)$(bindir) ; \ + $(INSTALL) -c -m 644 $(srcdir)/$$i.1 $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + exit 0 + +uninstall: + for i in $(PROGRAMS) $(SSL_PROGRAMS); do \ + rm -f $(DESTDIR)$(bindir)/$$i ; \ + rm -f $(DESTDIR)$(mandir)/man1/$$i.1 ; \ + done + exit 0 + rmdir -p $(DESTDIR)$(bindir) + rmdir -p $(DESTDIR)$(mandir) diff --git a/libs/ldns/examples/README b/libs/ldns/examples/README new file mode 100644 index 0000000000..f84fe9d8cf --- /dev/null +++ b/libs/ldns/examples/README @@ -0,0 +1,5 @@ +These tools are examples of ldns usage. They are not meant for production +systems and will not be supported as such. + +Compilation: +autoreconf && ./configure && make diff --git a/libs/ldns/examples/config.h.in b/libs/ldns/examples/config.h.in new file mode 100644 index 0000000000..dad78b17a2 --- /dev/null +++ b/libs/ldns/examples/config.h.in @@ -0,0 +1,363 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Define to 1 if you have the declaration of `in6addr_any', and to 0 if you + don't. */ +#undef HAVE_DECL_IN6ADDR_ANY + +/* Define to 1 if you have the `fork' function. */ +#undef HAVE_FORK + +/* Whether getaddrinfo is available */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* If you have HMAC_CTX_init */ +#undef HAVE_HMAC_CTX_INIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define to 1 if you have the `ldns' library (-lldns). */ +#undef HAVE_LIBLDNS + +/* Define to 1 if you have the `pcap' library (-lpcap). */ +#undef HAVE_LIBPCAP + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IF_ETHER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IGMP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP6_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_UDP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PCAP_H + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if you have the `sleep' function. */ +#undef HAVE_SLEEP + +/* Define to 1 if you have the `srandom' function. */ +#undef HAVE_SRANDOM + +/* Define if you have the SSL libraries installed. */ +#undef HAVE_SSL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if `fork' works. */ +#undef HAVE_WORKING_FORK + +/* Define to 1 if `vfork' works. */ +#undef HAVE_WORKING_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define this to enable ECDSA support. */ +#undef USE_ECDSA + +/* Define this to enable GOST support. */ +#undef USE_GOST + +/* Define this to enable SHA256 and SHA512 support. */ +#undef USE_SHA2 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* the version of the windows API enabled */ +#undef WINVER + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* in_addr_t */ +#undef in_addr_t + +/* in_port_t */ +#undef in_port_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `short' if does not define. */ +#undef int16_t + +/* Define to `int' if does not define. */ +#undef int32_t + +/* Define to `long long' if does not define. */ +#undef int64_t + +/* Define to `char' if does not define. */ +#undef int8_t + +/* Define to `int' if does not define. */ +#undef pid_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define to 'int' if not defined */ +#undef socklen_t + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `unsigned short' if does not define. */ +#undef uint16_t + +/* Define to `unsigned int' if does not define. */ +#undef uint32_t + +/* Define to `unsigned long long' if does not define. */ +#undef uint64_t + +/* Define to `unsigned char' if does not define. */ +#undef uint8_t + +/* Define as `fork' if `vfork' does not work. */ +#undef vfork + + + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_PCAP_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +#ifndef HAVE_GETADDRINFO +#include +#endif + +#ifndef HAVE_RANDOM +/* random can be replaced by rand for ldnsexamples */ +#define random rand +#endif + +#ifndef HAVE_SRANDOM +/* srandom can be replaced by srand for ldnsexamples */ +#define srandom srand +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif + diff --git a/libs/ldns/examples/configure b/libs/ldns/examples/configure new file mode 100644 index 0000000000..424aa3c78a --- /dev/null +++ b/libs/ldns/examples/configure @@ -0,0 +1,7150 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for ldns 1.6.9. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: libdns@nlnetlabs.nl about your system, including any +$0: error possibly output before this message. Then install +$0: a modern shell, or manually run the script under such a +$0: shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='ldns' +PACKAGE_TARNAME='libdns' +PACKAGE_VERSION='1.6.9' +PACKAGE_STRING='ldns 1.6.9' +PACKAGE_BUGREPORT='libdns@nlnetlabs.nl' +PACKAGE_URL='' + +ac_unique_file="ldns-read-zone.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +LDNSDIR +LIBSSL_LIBS +LIBSSL_LDFLAGS +LIBSSL_CPPFLAGS +RUNTIME_PATH +HAVE_SSL +LIBNSL_LIBS +libtool +SET_MAKE +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_rpath +with_ssl +enable_sha2 +enable_gost +enable_ecdsa +with_ldns +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CPPFLAGS +CC +LDFLAGS +LIBS +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 | -n) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$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_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures ldns 1.6.9 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libdns] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of ldns 1.6.9:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-rpath Disable hardcoded rpath (default=enabled) + --disable-sha2 Disable SHA256 and SHA512 RRSIG support + --disable-gost Disable GOST support + --enable-ecdsa Enable ECDSA support, experimental + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-ssl=pathname enable SSL (will check /usr/local/ssl /usr/lib/ssl + /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw + /usr) + --with-ldns=PATH specify prefix of path of ldns library to use + + + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +ldns configure 1.6.9 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ---------------------------------- ## +## Report this to libdns@nlnetlabs.nl ## +## ---------------------------------- ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES +# --------------------------------------------- +# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR +# accordingly. +ac_fn_c_check_decl () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + as_decl_name=`echo $2|sed 's/ *(.*//'` + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5 +$as_echo_n "checking whether $as_decl_name is declared... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_decl +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +# acx_nlnetlabs.m4 - common macros for configure checks +# Copyright 2009, Wouter Wijngaards, NLnet Labs. +# BSD licensed. +# +# Version 11 +# 2010-08-16 Fix FLAG_OMITTED for AS_TR_CPP changes in autoconf-2.66. +# 2010-07-02 Add check for ss_family (for minix). +# 2010-04-26 Fix to use CPPFLAGS for CHECK_COMPILER_FLAGS. +# 2010-03-01 Fix RPATH using CONFIG_COMMANDS to run at the very end. +# 2010-02-18 WITH_SSL outputs the LIBSSL_LDFLAGS, LIBS, CPPFLAGS seperate, -ldl +# 2010-02-01 added ACX_CHECK_MEMCMP_SIGNED, AHX_MEMCMP_BROKEN +# 2010-01-20 added AHX_COONFIG_STRLCAT +# 2009-07-14 U_CHAR detection improved for windows crosscompile. +# added ACX_FUNC_MALLOC +# fixup some #if to #ifdef +# NONBLOCKING test for mingw crosscompile. +# 2009-07-13 added ACX_WITH_SSL_OPTIONAL +# 2009-07-03 fixup LDFLAGS for empty ssl dir. +# +# Automates some of the checking constructs. Aims at portability for POSIX. +# Documentation for functions is below. +# +# the following macro's are provided in this file: +# (see below for details on each macro). +# +# ACX_ESCAPE_BACKSLASH - escape backslashes in var for C-preproc. +# ACX_RSRC_VERSION - create windows resource version number. +# ACX_CHECK_COMPILER_FLAG - see if cc supports a flag. +# ACX_CHECK_ERROR_FLAGS - see which flag is -werror (used below). +# ACX_CHECK_COMPILER_FLAG_NEEDED - see if flags make the code compile cleanly. +# ACX_DEPFLAG - find cc dependency flags. +# ACX_DETERMINE_EXT_FLAGS_UNBOUND - find out which flags enable BSD and POSIX. +# ACX_CHECK_FORMAT_ATTRIBUTE - find cc printf format syntax. +# ACX_CHECK_UNUSED_ATTRIBUTE - find cc variable unused syntax. +# ACX_LIBTOOL_C_ONLY - create libtool for C only, improved. +# ACX_TYPE_U_CHAR - u_char type. +# ACX_TYPE_RLIM_T - rlim_t type. +# ACX_TYPE_SOCKLEN_T - socklen_t type. +# ACX_TYPE_IN_ADDR_T - in_addr_t type. +# ACX_TYPE_IN_PORT_T - in_port_t type. +# ACX_ARG_RPATH - add --disable-rpath option. +# ACX_WITH_SSL - add --with-ssl option, link -lcrypto. +# ACX_WITH_SSL_OPTIONAL - add --with-ssl option, link -lcrypto, +# where --without-ssl is also accepted +# ACX_LIB_SSL - setup to link -lssl. +# ACX_SYS_LARGEFILE - improved sys_largefile, fseeko, >2G files. +# ACX_CHECK_GETADDRINFO_WITH_INCLUDES - find getaddrinfo, portably. +# ACX_FUNC_DEPRECATED - see if func is deprecated. +# ACX_CHECK_NONBLOCKING_BROKEN - see if nonblocking sockets really work. +# ACX_MKDIR_ONE_ARG - determine mkdir(2) number of arguments. +# ACX_FUNC_IOCTLSOCKET - find ioctlsocket, portably. +# ACX_FUNC_MALLOC - check malloc, define replacement . +# AHX_CONFIG_FORMAT_ATTRIBUTE - config.h text for format. +# AHX_CONFIG_UNUSED_ATTRIBUTE - config.h text for unused. +# AHX_CONFIG_FSEEKO - define fseeko, ftello fallback. +# AHX_CONFIG_RAND_MAX - define RAND_MAX if needed. +# AHX_CONFIG_MAXHOSTNAMELEN - define MAXHOSTNAMELEN if needed. +# AHX_CONFIG_IPV6_MIN_MTU - define IPV6_MIN_MTU if needed. +# AHX_CONFIG_SNPRINTF - snprintf compat prototype +# AHX_CONFIG_INET_PTON - inet_pton compat prototype +# AHX_CONFIG_INET_NTOP - inet_ntop compat prototype +# AHX_CONFIG_INET_ATON - inet_aton compat prototype +# AHX_CONFIG_MEMMOVE - memmove compat prototype +# AHX_CONFIG_STRLCAT - strlcat compat prototype +# AHX_CONFIG_STRLCPY - strlcpy compat prototype +# AHX_CONFIG_GMTIME_R - gmtime_r compat prototype +# AHX_CONFIG_W32_SLEEP - w32 compat for sleep +# AHX_CONFIG_W32_USLEEP - w32 compat for usleep +# AHX_CONFIG_W32_RANDOM - w32 compat for random +# AHX_CONFIG_W32_SRANDOM - w32 compat for srandom +# AHX_CONFIG_W32_FD_SET_T - w32 detection of FD_SET_T. +# ACX_CFLAGS_STRIP - strip one flag from CFLAGS +# ACX_STRIP_EXT_FLAGS - strip extension flags from CFLAGS +# AHX_CONFIG_FLAG_OMITTED - define omitted flag +# AHX_CONFIG_FLAG_EXT - define omitted extension flag +# AHX_CONFIG_EXT_FLAGS - define the stripped extension flags +# ACX_CHECK_MEMCMP_SIGNED - check if memcmp uses signed characters. +# AHX_MEMCMP_BROKEN - replace memcmp func for CHECK_MEMCMP_SIGNED. +# ACX_CHECK_SS_FAMILY - check for sockaddr_storage.ss_family +# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} + +$as_echo "#define WINVER 0x0502" >>confdefs.h + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default" +if test "x$ac_cv_header_minix_config_h" = xyes; then : + MINIX=yes +else + MINIX= +fi + + + if test "$MINIX" = yes; then + +$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h + + +$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h + + +$as_echo "#define _MINIX 1" >>confdefs.h + + fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if ${ac_cv_safe_to_define___extensions__+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_safe_to_define___extensions__=yes +else + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } + test $ac_cv_safe_to_define___extensions__ = yes && + $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h + + $as_echo "#define _ALL_SOURCE 1" >>confdefs.h + + $as_echo "#define _GNU_SOURCE 1" >>confdefs.h + + $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h + + + +# Checks for programs. +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +for ac_prog in glibtool libtool15 libtool +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_libtool+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$libtool"; then + ac_cv_prog_libtool="$libtool" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_libtool="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +libtool=$ac_cv_prog_libtool +if test -n "$libtool"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libtool" >&5 +$as_echo "$libtool" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$libtool" && break +done +test -n "$libtool" || libtool="../libtool" + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -std=c99" >&5 +$as_echo_n "checking whether $CC supports -std=c99... " >&6; } +cache=`echo std=c99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -std=c99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-std=c99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -xc99" >&5 +$as_echo_n "checking whether $CC supports -xc99... " >&6; } +cache=`echo xc99 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -xc99 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +C99FLAG="-xc99" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + +# Check whether --enable-rpath was given. +if test "${enable_rpath+set}" = set; then : + enableval=$enable_rpath; enable_rpath=$enableval +else + enable_rpath=yes +fi + + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -O2" >&5 +$as_echo_n "checking whether $CC supports -O2... " >&6; } +cache=`echo O2 | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -O2 -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS -O2" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: + +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Werror" >&5 +$as_echo_n "checking whether $CC supports -Werror... " >&6; } +cache=`echo Werror | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Werror -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="-Werror" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="-errwarn" +fi + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC supports -Wall" >&5 +$as_echo_n "checking whether $CC supports -Wall... " >&6; } +cache=`echo Wall | sed 'y%.=/+-%___p_%'` +if eval \${cv_prog_cc_flag_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo 'void f(){}' >conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS -Wall -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_$cache=yes" +else +eval "cv_prog_cc_flag_$cache=no" +fi +rm -f conftest conftest.o conftest.c + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +ERRFLAG="$ERRFLAG -Wall" +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +: +ERRFLAG="$ERRFLAG -errfmt" +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo ' +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600 $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we need $C99FLAG as a flag for $CC" >&5 +$as_echo_n "checking whether we need $C99FLAG as a flag for $CC... " >&6; } +cache=`$as_echo "$C99FLAG" | $as_tr_sh` +if eval \${cv_prog_cc_flag_needed_$cache+:} false; then : + $as_echo_n "(cached) " >&6 +else + +echo '#include ' > conftest.c +echo 'void f(){}' >>conftest.c +if test -z "`$CC $CPPFLAGS $CFLAGS $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=no" +else + +if test -z "`$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1`"; then +eval "cv_prog_cc_flag_needed_$cache=yes" +else +eval "cv_prog_cc_flag_needed_$cache=fail" +#echo 'Test with flag fails too!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +fi + +fi +rm -f conftest conftest.c conftest.o + +fi + +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = yes"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +: +CFLAGS="$CFLAGS $C99FLAG" +else +if eval "test \"`echo '$cv_prog_cc_flag_needed_'$cache`\" = no"; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +#echo 'Test with flag is no!' +#cat conftest.c +#echo "$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1" +#echo `$CC $CPPFLAGS $CFLAGS $C99FLAG $ERRFLAG -c conftest.c 2>&1` +#exit 1 +: + +else +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +: + +fi +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +$as_echo_n "checking for inline... " >&6; } +if ${ac_cv_c_inline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo () {return 0; } +$ac_kw foo_t foo () {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +$as_echo "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + +ac_fn_c_check_type "$LINENO" "int8_t" "ac_cv_type_int8_t" "$ac_includes_default" +if test "x$ac_cv_type_int8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int8_t char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int16_t" "ac_cv_type_int16_t" "$ac_includes_default" +if test "x$ac_cv_type_int16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int16_t short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int32_t" "ac_cv_type_int32_t" "$ac_includes_default" +if test "x$ac_cv_type_int32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int32_t int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "int64_t" "ac_cv_type_int64_t" "$ac_includes_default" +if test "x$ac_cv_type_int64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define int64_t long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint8_t" "ac_cv_type_uint8_t" "$ac_includes_default" +if test "x$ac_cv_type_uint8_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint8_t unsigned char +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint16_t" "ac_cv_type_uint16_t" "$ac_includes_default" +if test "x$ac_cv_type_uint16_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint16_t unsigned short +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint32_t" "ac_cv_type_uint32_t" "$ac_includes_default" +if test "x$ac_cv_type_uint32_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint32_t unsigned int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "uint64_t" "ac_cv_type_uint64_t" "$ac_includes_default" +if test "x$ac_cv_type_uint64_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define uint64_t unsigned long long +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" +if test "x$ac_cv_type_ssize_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define ssize_t int +_ACEOF + +fi + + +for ac_header in sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h pcap.h arpa/inet.h sys/time.h sys/socket.h sys/select.h netdb.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in winsock2.h ws2tcpip.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +for ac_header in netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/igmp.h netinet/if_ether.h netinet/ip6.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" " +$ac_includes_default +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + +ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " +$ac_includes_default +#ifdef HAVE_SYS_SOCKET_H +# include +#endif +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +" +if test "x$ac_cv_type_socklen_t" = xyes; then : + +else + +$as_echo "#define socklen_t int" >>confdefs.h + +fi + +for ac_header in sys/param.h sys/mount.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default + + + #if HAVE_SYS_PARAM_H + # include + #endif + + +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + +ac_fn_c_check_type "$LINENO" "in_addr_t" "ac_cv_type_in_addr_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_addr_t" = xyes; then : + +else + +$as_echo "#define in_addr_t uint32_t" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "in_port_t" "ac_cv_type_in_port_t" " +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +" +if test "x$ac_cv_type_in_port_t" = xyes; then : + +else + +$as_echo "#define in_port_t uint16_t" >>confdefs.h + +fi + + +# check to see if libraries are needed for these functions. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 +$as_echo_n "checking for library containing socket... " >&6; } +if ${ac_cv_search_socket+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char socket (); +int +main () +{ +return socket (); + ; + return 0; +} +_ACEOF +for ac_lib in '' socket; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_socket=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_socket+:} false; then : + break +fi +done +if ${ac_cv_search_socket+:} false; then : + +else + ac_cv_search_socket=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 +$as_echo "$ac_cv_search_socket" >&6; } +ac_res=$ac_cv_search_socket +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +tmp_LIBS="$LIBS" +LIBS= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing inet_pton" >&5 +$as_echo_n "checking for library containing inet_pton... " >&6; } +if ${ac_cv_search_inet_pton+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char inet_pton (); +int +main () +{ +return inet_pton (); + ; + return 0; +} +_ACEOF +for ac_lib in '' nsl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_inet_pton=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_inet_pton+:} false; then : + break +fi +done +if ${ac_cv_search_inet_pton+:} false; then : + +else + ac_cv_search_inet_pton=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_inet_pton" >&5 +$as_echo "$ac_cv_search_inet_pton" >&6; } +ac_res=$ac_cv_search_inet_pton +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +LIBNSL_LIBS=$LIBS + +LIBS="$tmp_LIBS" + +tmp_CPPFLAGS="$CPPFLAGS" +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" + + + +# Check whether --with-ssl was given. +if test "${with_ssl+set}" = set; then : + withval=$with_ssl; + +else + + withval="yes" + +fi + + + withval=$withval + if test x_$withval != x_no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL" >&5 +$as_echo_n "checking for SSL... " >&6; } + if test x_$withval = x_ -o x_$withval = x_yes; then + withval="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /opt/local /usr/sfw /usr" + fi + for dir in $withval; do + ssldir="$dir" + if test -f "$dir/include/openssl/ssl.h"; then + found_ssl="yes" + +cat >>confdefs.h <<_ACEOF +#define HAVE_SSL /**/ +_ACEOF + + if test "$ssldir" != "/usr"; then + CPPFLAGS="$CPPFLAGS -I$ssldir/include" + LIBSSL_CPPFLAGS="$LIBSSL_CPPFLAGS -I$ssldir/include" + fi + break; + fi + done + if test x_$found_ssl != x_yes; then + as_fn_error $? "Cannot find the SSL libraries in $withval" "$LINENO" 5 + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $ssldir" >&5 +$as_echo "found in $ssldir" >&6; } + HAVE_SSL=yes + if test "$ssldir" != "/usr" -a "$ssldir" != ""; then + LDFLAGS="$LDFLAGS -L$ssldir/lib" + LIBSSL_LDFLAGS="$LIBSSL_LDFLAGS -L$ssldir/lib" + + if test "x$enable_rpath" = xyes; then + if echo "$ssldir/lib" | grep "^/" >/dev/null; then + RUNTIME_PATH="$RUNTIME_PATH -R$ssldir/lib" + fi + fi + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HMAC_CTX_init in -lcrypto" >&5 +$as_echo_n "checking for HMAC_CTX_init in -lcrypto... " >&6; } + LIBS="$LIBS -lcrypto" + LIBSSL_LIBS="$LIBSSL_LIBS -lcrypto" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + # check if -lwsock32 or -lgdi32 are needed. + BAKLIBS="$LIBS" + BAKSSLLIBS="$LIBSSL_LIBS" + LIBS="$LIBS -lgdi32" + LIBSSL_LIBS="$LIBSSL_LIBS -lgdi32" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -lgdi32" >&5 +$as_echo_n "checking if -lcrypto needs -lgdi32... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + LIBS="$BAKLIBS" + LIBSSL_LIBS="$BAKSSLLIBS" + LIBS="$LIBS -ldl" + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -lcrypto needs -ldl" >&5 +$as_echo_n "checking if -lcrypto needs -ldl... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + int HMAC_CTX_init(void); + (void)HMAC_CTX_init(); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + +$as_echo "#define HAVE_HMAC_CTX_INIT 1" >>confdefs.h + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + as_fn_error $? "OpenSSL found in $ssldir, but version 0.9.7 or higher is required" "$LINENO" 5 + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + fi + + + # openssl engine functionality needs dlopen(). + BAKLIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlopen" >&5 +$as_echo_n "checking for library containing dlopen... " >&6; } +if ${ac_cv_search_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +for ac_lib in '' dl; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_dlopen=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if ${ac_cv_search_dlopen+:} false; then : + break +fi +done +if ${ac_cv_search_dlopen+:} false; then : + +else + ac_cv_search_dlopen=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlopen" >&5 +$as_echo "$ac_cv_search_dlopen" >&6; } +ac_res=$ac_cv_search_dlopen +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + + if test "$LIBS" != "$BAKLIBS"; then + LIBSSL_LIBS="$LIBSSL_LIBS -ldl" + fi + fi +for ac_header in openssl/ssl.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/ssl.h" "ac_cv_header_openssl_ssl_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_ssl_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_SSL_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/err.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/err.h" "ac_cv_header_openssl_err_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_err_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_ERR_H 1 +_ACEOF + +fi + +done + +for ac_header in openssl/rand.h +do : + ac_fn_c_check_header_compile "$LINENO" "openssl/rand.h" "ac_cv_header_openssl_rand_h" "$ac_includes_default +" +if test "x$ac_cv_header_openssl_rand_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_OPENSSL_RAND_H 1 +_ACEOF + +fi + +done + + + + + + + + +CPPFLAGS="$tmp_CPPFLAGS" +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +# use libcrypto to check the following: +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" +LDFLAGS="$LDFLAGS $LIBSSL_LDFLAGS" +LIBS="$LIBS $LIBSSL_LIBS" +# Check whether --enable-sha2 was given. +if test "${enable_sha2+set}" = set; then : + enableval=$enable_sha2; +fi + +case "$enable_sha2" in + no) + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for SHA256 and SHA512" >&5 +$as_echo_n "checking for SHA256 and SHA512... " >&6; } + ac_fn_c_check_func "$LINENO" "SHA256_Init" "ac_cv_func_SHA256_Init" +if test "x$ac_cv_func_SHA256_Init" = xyes; then : + +else + + as_fn_error $? "SHA2 enabled, but no SHA2 functions found in OpenSSL" "$LINENO" 5 + +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_SHA2 1 +_ACEOF + + ;; +esac + +# Check whether --enable-gost was given. +if test "${enable_gost+set}" = set; then : + enableval=$enable_gost; +fi + +case "$enable_gost" in + no) + ;; + *) + if test "x$HAVE_SSL" != "xyes"; then + as_fn_error $? "GOST enabled, but no SSL support" "$LINENO" 5 + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GOST" >&5 +$as_echo_n "checking for GOST... " >&6; } + ac_fn_c_check_func "$LINENO" "EVP_PKEY_set_type_str" "ac_cv_func_EVP_PKEY_set_type_str" +if test "x$ac_cv_func_EVP_PKEY_set_type_str" = xyes; then : + +else + as_fn_error $? "OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost" "$LINENO" 5 +fi + + ac_fn_c_check_func "$LINENO" "EC_KEY_new" "ac_cv_func_EC_KEY_new" +if test "x$ac_cv_func_EC_KEY_new" = xyes; then : + +else + as_fn_error $? "No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost" "$LINENO" 5 +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_GOST 1 +_ACEOF + + ;; +esac + +# Check whether --enable-ecdsa was given. +if test "${enable_ecdsa+set}" = set; then : + enableval=$enable_ecdsa; +fi + +case "$enable_ecdsa" in + yes) + ac_fn_c_check_func "$LINENO" "ECDSA_sign" "ac_cv_func_ECDSA_sign" +if test "x$ac_cv_func_ECDSA_sign" = xyes; then : + +else + as_fn_error $? "OpenSSL does not support ECDSA" "$LINENO" 5 +fi + + +cat >>confdefs.h <<_ACEOF +#define USE_ECDSA 1 +_ACEOF + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************" >&5 +$as_echo "$as_me: WARNING: + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************" >&2;} + ;; + no|*) + ;; +esac + +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcap_open_offline in -lpcap" >&5 +$as_echo_n "checking for pcap_open_offline in -lpcap... " >&6; } +if ${ac_cv_lib_pcap_pcap_open_offline+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcap $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pcap_open_offline (); +int +main () +{ +return pcap_open_offline (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pcap_pcap_open_offline=yes +else + ac_cv_lib_pcap_pcap_open_offline=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcap_pcap_open_offline" >&5 +$as_echo "$ac_cv_lib_pcap_pcap_open_offline" >&6; } +if test "x$ac_cv_lib_pcap_pcap_open_offline" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPCAP 1 +_ACEOF + + LIBS="-lpcap $LIBS" + +else + + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find pcap library (needed for ldns-dpa, will not build dpa now.)" >&5 +$as_echo "$as_me: WARNING: Can't find pcap library (needed for ldns-dpa, will not build dpa now.)" >&2;} + + +fi + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo" >&5 +$as_echo_n "checking for getaddrinfo... " >&6; } +if ${ac_cv_func_getaddrinfo+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_func_getaddrinfo=no +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_getaddrinfo="yes" +else + ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +int +main () +{ + + (void)getaddrinfo(NULL, NULL, NULL, NULL); + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_getaddrinfo="yes" +LDFLAGS="$LDFLAGS -lws2_32" + +else + ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getaddrinfo" >&5 +$as_echo "$ac_cv_func_getaddrinfo" >&6; } +if test $ac_cv_func_getaddrinfo = yes; then + +$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h + +fi + + +ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" +if test "x$ac_cv_type_pid_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define pid_t int +_ACEOF + +fi + +for ac_header in vfork.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" +if test "x$ac_cv_header_vfork_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_VFORK_H 1 +_ACEOF + +fi + +done + +for ac_func in fork vfork +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +if test "x$ac_cv_func_fork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 +$as_echo_n "checking for working fork... " >&6; } +if ${ac_cv_func_fork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_fork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* By Ruediger Kuhlmann. */ + return fork () < 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_fork_works=yes +else + ac_cv_func_fork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 +$as_echo "$ac_cv_func_fork_works" >&6; } + +else + ac_cv_func_fork_works=$ac_cv_func_fork +fi +if test "x$ac_cv_func_fork_works" = xcross; then + case $host in + *-*-amigaos* | *-*-msdosdjgpp*) + # Override, as these systems have only a dummy fork() stub + ac_cv_func_fork_works=no + ;; + *) + ac_cv_func_fork_works=yes + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} +fi +ac_cv_func_vfork_works=$ac_cv_func_vfork +if test "x$ac_cv_func_vfork" = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 +$as_echo_n "checking for working vfork... " >&6; } +if ${ac_cv_func_vfork_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_func_vfork_works=cross +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Thanks to Paul Eggert for this test. */ +$ac_includes_default +#include +#ifdef HAVE_VFORK_H +# include +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. The compiler + is told about this with #include , but some compilers + (e.g. gcc -O) don't grok . Test for this by using a + static variable whose address is put into a register that is + clobbered by the vfork. */ +static void +#ifdef __cplusplus +sparc_address_test (int arg) +# else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} + +int +main () +{ + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (0); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. This + test uses lots of local variables, at least as many local + variables as main has allocated so far including compiler + temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris + 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should + reuse the register of parent for one of the local variables, + since it will think that parent can't possibly be used any more + in this routine. Assigning to the local variable will thus + munge parent in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent + from child file descriptors. If the child closes a descriptor + before it execs or exits, this munges the parent's descriptor + as well. Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + return ( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_func_vfork_works=yes +else + ac_cv_func_vfork_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 +$as_echo "$ac_cv_func_vfork_works" >&6; } + +fi; +if test "x$ac_cv_func_fork_works" = xcross; then + ac_cv_func_vfork_works=$ac_cv_func_vfork + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 +$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} +fi + +if test "x$ac_cv_func_vfork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h + +else + +$as_echo "#define vfork fork" >>confdefs.h + +fi +if test "x$ac_cv_func_fork_works" = xyes; then + +$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h + +fi + +for ac_func in isblank srandom random sleep +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + +ac_fn_c_check_decl "$LINENO" "in6addr_any" "ac_cv_have_decl_in6addr_any" "$ac_includes_default +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_UDP_H +#include +#endif +#ifdef HAVE_NETINET_IGMP_H +#include +#endif + +" +if test "x$ac_cv_have_decl_in6addr_any" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_IN6ADDR_ANY $ac_have_decl +_ACEOF + + +# check for ldns + +# Check whether --with-ldns was given. +if test "${with_ldns+set}" = set; then : + withval=$with_ldns; + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + + +fi + + +# check for ldns development source tree +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns devel source" >&5 +$as_echo_n "checking for ldns devel source... " >&6; } +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using $ldns_dev_dir with $ldns_version" >&5 +$as_echo "using $ldns_dev_dir with $ldns_version" >&6; } + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="$LIBS -lldns" + +$as_echo "#define HAVE_LIBLDNS 1" >>confdefs.h + + LDNSDIR="$ldns_dev_dir" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldns_rr_new in -lldns" >&5 +$as_echo_n "checking for ldns_rr_new in -lldns... " >&6; } +if ${ac_cv_lib_ldns_ldns_rr_new+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lldns $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char ldns_rr_new (); +int +main () +{ +return ldns_rr_new (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ldns_ldns_rr_new=yes +else + ac_cv_lib_ldns_ldns_rr_new=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ldns_ldns_rr_new" >&5 +$as_echo "$ac_cv_lib_ldns_ldns_rr_new" >&6; } +if test "x$ac_cv_lib_ldns_ldns_rr_new" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBLDNS 1 +_ACEOF + + LIBS="-lldns $LIBS" + +else + + as_fn_error $? "Can't find ldns library" "$LINENO" 5 + + +fi + +fi + + + + + + +ac_config_files="$ac_config_files Makefile" + +ac_config_headers="$ac_config_headers config.h" + +cat >confcache <<\_ACEOF +# 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, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by ldns $as_me 1.6.9, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +ldns config.status 1.6.9 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/libs/ldns/examples/configure.ac b/libs/ldns/examples/configure.ac new file mode 100644 index 0000000000..2bf89d2dc0 --- /dev/null +++ b/libs/ldns/examples/configure.ac @@ -0,0 +1,421 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_PREREQ(2.56) +AC_INIT(ldns, 1.6.9, libdns@nlnetlabs.nl,libdns) +AC_CONFIG_SRCDIR([ldns-read-zone.c]) +sinclude(../acx_nlnetlabs.m4) + +OURCPPFLAGS='' +CPPFLAGS=${CPPFLAGS:-${OURCPPFLAGS}} +OURCFLAGS='-g' +CFLAGS=${CFLAGS:-${OURCFLAGS}} +AC_DEFINE(WINVER, 0x0502, [the version of the windows API enabled]) + +AC_AIX +# Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AC_CHECK_PROGS(libtool, [glibtool libtool15 libtool], [../libtool]) + +ACX_CHECK_COMPILER_FLAG(std=c99, [C99FLAG="-std=c99"]) +ACX_CHECK_COMPILER_FLAG(xc99, [C99FLAG="-xc99"]) + +AC_ARG_ENABLE(rpath, + [AC_HELP_STRING([--disable-rpath], [Disable hardcoded rpath (default=enabled)])], + enable_rpath=$enableval, enable_rpath=yes) + +if test "x$enable_rpath" = xyes; then + RPATH_VAL="-Wl,-rpath=\${libdir}" +fi + + +AC_TYPE_SIZE_T +ACX_CHECK_COMPILER_FLAG(O2, [CFLAGS="$CFLAGS -O2"]) + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600, +[ +#include "confdefs.h" +#include +#include +#include +#ifdef HAVE_TIME_H +#include +#endif +#include +#ifdef HAVE_GETOPT_H +#include +#endif + +int test() { + int a; + char **opts = NULL; + struct timeval tv; + char *t; + time_t time = 0; + char *buf = NULL; + t = ctime_r(&time, buf); + tv.tv_usec = 10; + srandom(32); + a = getopt(2, opts, "a"); + a = isascii(32); + return a; +} +], [CFLAGS="$CFLAGS $C99FLAG -D__EXTENSIONS__ -D_BSD_SOURCE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600"]) + + +ACX_CHECK_COMPILER_FLAG_NEEDED($C99FLAG, [#include ], [CFLAGS="$CFLAGS $C99FLAG"]) + +AC_C_INLINE +AC_CHECK_TYPE(int8_t, char) +AC_CHECK_TYPE(int16_t, short) +AC_CHECK_TYPE(int32_t, int) +AC_CHECK_TYPE(int64_t, long long) +AC_CHECK_TYPE(uint8_t, unsigned char) +AC_CHECK_TYPE(uint16_t, unsigned short) +AC_CHECK_TYPE(uint32_t, unsigned int) +AC_CHECK_TYPE(uint64_t, unsigned long long) +AC_CHECK_TYPE(ssize_t, int) + +AC_CHECK_HEADERS([sys/types.h getopt.h stdlib.h stdio.h assert.h netinet/in.h ctype.h time.h pcap.h arpa/inet.h sys/time.h sys/socket.h sys/select.h netdb.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([winsock2.h ws2tcpip.h],,, [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS([netinet/in_systm.h net/if.h netinet/ip.h netinet/udp.h netinet/igmp.h netinet/if_ether.h netinet/ip6.h],,, [ +AC_INCLUDES_DEFAULT +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NET_IF_H +#include +#endif]) + +ACX_TYPE_SOCKLEN_T +AC_CHECK_HEADERS([sys/param.h sys/mount.h],,, +[AC_INCLUDES_DEFAULT] +[ + [ + #if HAVE_SYS_PARAM_H + # include + #endif + ] +]) +AC_CHECK_TYPE(in_addr_t, [], [AC_DEFINE([in_addr_t], [uint32_t], [in_addr_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) +AC_CHECK_TYPE(in_port_t, [], [AC_DEFINE([in_port_t], [uint16_t], [in_port_t])], [ +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif]) + +# check to see if libraries are needed for these functions. +AC_SEARCH_LIBS(socket, socket) +tmp_LIBS="$LIBS" +LIBS= +AC_SEARCH_LIBS(inet_pton, nsl) +AC_SUBST(LIBNSL_LIBS,$LIBS) +LIBS="$tmp_LIBS" + +tmp_CPPFLAGS="$CPPFLAGS" +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" + +ACX_WITH_SSL_OPTIONAL + +AC_SUBST(LIBSSL_CPPFLAGS) +AC_SUBST(LIBSSL_LDFLAGS) +AC_SUBST(LIBSSL_LIBS) + +CPPFLAGS="$tmp_CPPFLAGS" +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +# use libcrypto to check the following: +tmp_LDFLAGS="$LDFLAGS" +tmp_LIBS="$LIBS" +LDFLAGS="$LDFLAGS $LIBSSL_LDFLAGS" +LIBS="$LIBS $LIBSSL_LIBS" +AC_ARG_ENABLE(sha2, AC_HELP_STRING([--disable-sha2], [Disable SHA256 and SHA512 RRSIG support])) +case "$enable_sha2" in + no) + ;; + *) + AC_MSG_CHECKING(for SHA256 and SHA512) + AC_CHECK_FUNC(SHA256_Init,, [ + AC_MSG_ERROR([SHA2 enabled, but no SHA2 functions found in OpenSSL]) + ]) + AC_DEFINE_UNQUOTED([USE_SHA2], [1], [Define this to enable SHA256 and SHA512 support.]) + ;; +esac + +AC_ARG_ENABLE(gost, AC_HELP_STRING([--disable-gost], [Disable GOST support])) +case "$enable_gost" in + no) + ;; + *) + if test "x$HAVE_SSL" != "xyes"; then + AC_MSG_ERROR([GOST enabled, but no SSL support]) + fi + AC_MSG_CHECKING(for GOST) + AC_CHECK_FUNC(EVP_PKEY_set_type_str, [],[AC_MSG_ERROR([OpenSSL >= 1.0.0 is needed for GOST support or rerun with --disable-gost])]) + AC_CHECK_FUNC(EC_KEY_new, [], [AC_MSG_ERROR([No ECC functions found in OpenSSL: please upgrade OpenSSL or rerun with --disable-gost])]) + AC_DEFINE_UNQUOTED([USE_GOST], [1], [Define this to enable GOST support.]) + ;; +esac + +AC_ARG_ENABLE(ecdsa, AC_HELP_STRING([--enable-ecdsa], [Enable ECDSA support, experimental])) +case "$enable_ecdsa" in + yes) + AC_CHECK_FUNC(ECDSA_sign,,[AC_MSG_ERROR([OpenSSL does not support ECDSA])]) + AC_DEFINE_UNQUOTED([USE_ECDSA], [1], [Define this to enable ECDSA support.]) + AC_WARN([ + ***************************************************************** + *** YOU HAVE ENABLED ECDSA WHICH IS EXPERIMENTAL AT THIS TIME *** + *** PLEASE DO NOT USE THIS ON THE PUBLIC INTERNET *** + *****************************************************************]) + ;; + no|*) + ;; +esac + +LDFLAGS="$tmp_LDFLAGS" +LIBS="$tmp_LIBS" + +#AC_CHECK_HEADER(ldns/ldns.h,, [ +# AC_MSG_ERROR([Can't find ldns headers (make copy-headers in devel source.)]) +# ], [AC_INCLUDES_DEFAULT] +#) + +AC_CHECK_LIB(pcap, pcap_open_offline,, [ + AC_MSG_WARN([Can't find pcap library (needed for ldns-dpa, will not build dpa now.)]) + ] +) + + +AC_DEFUN([AC_CHECK_GETADDRINFO_WITH_INCLUDES], +[AC_REQUIRE([AC_PROG_CC]) +AC_MSG_CHECKING(for getaddrinfo) +AC_CACHE_VAL(ac_cv_func_getaddrinfo, +[ac_cv_func_getaddrinfo=no +AC_LINK_IFELSE( +[ +#ifdef __cplusplus +extern "C" +{ +#endif +char* getaddrinfo(); +char* (*f) () = getaddrinfo; +#ifdef __cplusplus +} +#endif +int main() { + ; + return 0; +} +], +dnl this case on linux, solaris, bsd +[ac_cv_func_getaddrinfo="yes"], +dnl no quick getaddrinfo, try mingw32 and winsock2 library. +ORIGLIBS="$LIBS" +LIBS="$LIBS -lws2_32" +AC_LINK_IFELSE( +AC_LANG_PROGRAM( +[ +#ifdef HAVE_WS2TCPIP_H +#include +#endif +], +[ + (void)getaddrinfo(NULL, NULL, NULL, NULL); +] +), +[ac_cv_func_getaddrinfo="yes" +LDFLAGS="$LDFLAGS -lws2_32" +], +[ac_cv_func_getaddrinfo="no" +LIBS="$ORIGLIBS" +]) +) +]) + +AC_MSG_RESULT($ac_cv_func_getaddrinfo) +if test $ac_cv_func_getaddrinfo = yes; then + AC_DEFINE(HAVE_GETADDRINFO, 1, [Whether getaddrinfo is available]) +fi +])dnl + +AC_CHECK_GETADDRINFO_WITH_INCLUDES + +AC_FUNC_FORK +AC_CHECK_FUNCS(isblank srandom random sleep) +AC_CHECK_DECLS([in6addr_any],,,[AC_INCLUDES_DEFAULT +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_SYS_SELECT_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_NETINET_UDP_H +#include +#endif +#ifdef HAVE_NETINET_IGMP_H +#include +#endif +]) + +# check for ldns +AC_ARG_WITH(ldns, + AC_HELP_STRING([--with-ldns=PATH specify prefix of path of ldns library to use]) + , + [ + specialldnsdir="$withval" + CPPFLAGS="$CPPFLAGS -I$withval/include" + LDFLAGS="-L$withval -L$withval/lib $LDFLAGS" + LDNSDIR="$withval" + ] +) + +# check for ldns development source tree +AC_MSG_CHECKING([for ldns devel source]) +ldns_dev_dir=.. +if test -f $ldns_dev_dir/ldns/util.h && \ + grep LDNS_VERSION $ldns_dev_dir/ldns/util.h >/dev/null; then + ldns_version=`grep LDNS_VERSION $ldns_dev_dir/ldns/util.h | sed -e 's/^.*"\(.*\)".*$/\1/'` + AC_MSG_RESULT([using $ldns_dev_dir with $ldns_version]) + CPPFLAGS="$CPPFLAGS -I$ldns_dev_dir/include" + LDFLAGS="-L$ldns_dev_dir -L$ldns_dev_dir/lib $LDFLAGS" + LIBS="$LIBS -lldns" + AC_DEFINE(HAVE_LIBLDNS, 1, [If the ldns library is available.]) + LDNSDIR="$ldns_dev_dir" +else + AC_MSG_RESULT([no]) + AC_CHECK_LIB(ldns, ldns_rr_new,, [ + AC_MSG_ERROR([Can't find ldns library]) + ] + ) +fi + +AC_SUBST(LDNSDIR) + + +AH_BOTTOM([ + +#include +#include +#include +#include + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_NETINET_UDP_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#ifdef HAVE_PCAP_H +#include +#endif + +#ifdef HAVE_NETINET_IN_SYSTM_H +#include +#endif + +#ifdef HAVE_NETINET_IP_H +#include +#endif + +#ifdef HAVE_NET_IF_H +#include +#endif + +#ifdef HAVE_NETINET_IF_ETHER_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#define USE_WINSOCK 1 +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +#ifndef HAVE_GETADDRINFO +#include +#endif + +#ifndef HAVE_RANDOM +/* random can be replaced by rand for ldnsexamples */ +#define random rand +#endif + +#ifndef HAVE_SRANDOM +/* srandom can be replaced by srand for ldnsexamples */ +#define srandom srand +#endif + +extern char *optarg; +extern int optind, opterr; + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif + +#ifdef S_SPLINT_S +#define FD_ZERO(a) /* a */ +#define FD_SET(a,b) /* a, b */ +#endif +]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_HEADER([config.h]) +AC_OUTPUT diff --git a/libs/ldns/examples/fake-rfc2553.h b/libs/ldns/examples/fake-rfc2553.h new file mode 100644 index 0000000000..1e9add1eb0 --- /dev/null +++ b/libs/ldns/examples/fake-rfc2553.h @@ -0,0 +1,175 @@ +/* From openssh 4.3p2 filename openbsd-compat/fake-rfc2553.h */ +/* + * Copyright (C) 2000-2003 Damien Miller. All rights reserved. + * Copyright (C) 1999 WIDE Project. 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. Neither the name of the project 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 PROJECT 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 PROJECT 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. + */ + +/* + * Pseudo-implementation of RFC2553 name / address resolution functions + * + * But these functions are not implemented correctly. The minimum subset + * is implemented for ssh use only. For example, this routine assumes + * that ai_family is AF_INET. Don't use it for another purpose. + */ + +#ifndef _FAKE_RFC2553_H +#define _FAKE_RFC2553_H + +#include +#include +#include +#include + +/* + * First, socket and INET6 related definitions + */ +#ifndef HAVE_STRUCT_SOCKADDR_STORAGE +#ifndef _SS_MAXSIZE +# define _SS_MAXSIZE 128 /* Implementation specific max size */ +# define _SS_PADSIZE (_SS_MAXSIZE - sizeof (struct sockaddr)) +struct sockaddr_storage { + struct sockaddr ss_sa; + char __ss_pad2[_SS_PADSIZE]; +}; +# define ss_family ss_sa.sa_family +#endif /* _SS_MAXSIZE */ +#endif /* !HAVE_STRUCT_SOCKADDR_STORAGE */ + +#ifndef IN6_IS_ADDR_LOOPBACK +# define IN6_IS_ADDR_LOOPBACK(a) \ + (((uint32_t *)(a))[0] == 0 && ((uint32_t *)(a))[1] == 0 && \ + ((uint32_t *)(a))[2] == 0 && ((uint32_t *)(a))[3] == htonl(1)) +#endif /* !IN6_IS_ADDR_LOOPBACK */ + +#ifndef HAVE_STRUCT_IN6_ADDR +struct in6_addr { + uint8_t s6_addr[16]; +}; +#endif /* !HAVE_STRUCT_IN6_ADDR */ + +#ifndef HAVE_STRUCT_SOCKADDR_IN6 +struct sockaddr_in6 { + unsigned short sin6_family; + uint16_t sin6_port; + uint32_t sin6_flowinfo; + struct in6_addr sin6_addr; +}; +#endif /* !HAVE_STRUCT_SOCKADDR_IN6 */ + +#ifndef AF_INET6 +/* Define it to something that should never appear */ +#define AF_INET6 AF_MAX +#endif + +/* + * Next, RFC2553 name / address resolution API + */ + +#ifndef NI_NUMERICHOST +# define NI_NUMERICHOST (1) +#endif +#ifndef NI_NAMEREQD +# define NI_NAMEREQD (1<<1) +#endif +#ifndef NI_NUMERICSERV +# define NI_NUMERICSERV (1<<2) +#endif + +#ifndef AI_PASSIVE +# define AI_PASSIVE (1) +#endif +#ifndef AI_CANONNAME +# define AI_CANONNAME (1<<1) +#endif +#ifndef AI_NUMERICHOST +# define AI_NUMERICHOST (1<<2) +#endif + +#ifndef NI_MAXSERV +# define NI_MAXSERV 32 +#endif /* !NI_MAXSERV */ +#ifndef NI_MAXHOST +# define NI_MAXHOST 1025 +#endif /* !NI_MAXHOST */ + +#ifndef INT_MAX +#define INT_MAX 0xffffffff +#endif + +#ifndef EAI_NODATA +# define EAI_NODATA (INT_MAX - 1) +#endif +#ifndef EAI_MEMORY +# define EAI_MEMORY (INT_MAX - 2) +#endif +#ifndef EAI_NONAME +# define EAI_NONAME (INT_MAX - 3) +#endif +#ifndef EAI_SYSTEM +# define EAI_SYSTEM (INT_MAX - 4) +#endif + +#ifndef HAVE_STRUCT_ADDRINFO +struct addrinfo { + int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ + int ai_family; /* PF_xxx */ + int ai_socktype; /* SOCK_xxx */ + int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ + size_t ai_addrlen; /* length of ai_addr */ + char *ai_canonname; /* canonical name for hostname */ + struct sockaddr *ai_addr; /* binary address */ + struct addrinfo *ai_next; /* next structure in linked list */ +}; +#endif /* !HAVE_STRUCT_ADDRINFO */ + +#ifndef HAVE_GETADDRINFO +#ifdef getaddrinfo +# undef getaddrinfo +#endif +#define getaddrinfo(a,b,c,d) (ssh_getaddrinfo(a,b,c,d)) +int getaddrinfo(const char *, const char *, + const struct addrinfo *, struct addrinfo **); +#endif /* !HAVE_GETADDRINFO */ + +#if !defined(HAVE_GAI_STRERROR) && !defined(HAVE_CONST_GAI_STRERROR_PROTO) +#define gai_strerror(a) (ssh_gai_strerror(a)) +char *gai_strerror(int); +#endif /* !HAVE_GAI_STRERROR */ + +#ifndef HAVE_FREEADDRINFO +#define freeaddrinfo(a) (ssh_freeaddrinfo(a)) +void freeaddrinfo(struct addrinfo *); +#endif /* !HAVE_FREEADDRINFO */ + +#ifndef HAVE_GETNAMEINFO +#define getnameinfo(a,b,c,d,e,f,g) (ssh_getnameinfo(a,b,c,d,e,f,g)) +int getnameinfo(const struct sockaddr *, size_t, char *, size_t, + char *, size_t, int); +#endif /* !HAVE_GETNAMEINFO */ + +#endif /* !_FAKE_RFC2553_H */ + diff --git a/libs/ldns/examples/ldns-chaos.1 b/libs/ldns/examples/ldns-chaos.1 new file mode 100644 index 0000000000..e9b7bf46dc --- /dev/null +++ b/libs/ldns/examples/ldns-chaos.1 @@ -0,0 +1,26 @@ +.TH ldns-chaos 1 "27 Apr 2005" +.SH NAME +ldns-chaos \- give some information about a nameserver +.SH SYNOPSIS +.B ldns-chaos +.IR NAMESERVER + +.SH DESCRIPTION +\fBldns-chaos\fR retrieves all the addresses of the nameserver and then queries +each address for its \fIversion.bind\fR and \fIhostname.bind\fR. +.PP +\fBldns-chaos\fR is a bit more complex than \fBldns-mx\fR. + +.SH OPTIONS +\fBldns-chaos\fR has no options. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-chaos.c b/libs/ldns/examples/ldns-chaos.c new file mode 100644 index 0000000000..a1e1b796bf --- /dev/null +++ b/libs/ldns/examples/ldns-chaos.c @@ -0,0 +1,125 @@ +/* + * chaos is a small programs that prints some information + * about a nameserver + * + * (c) NLnet Labs, 2005 - 2008 + * + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +static int +usage(FILE *fp, char *prog) { + fprintf(fp, "%s server\n", prog); + fprintf(fp, " print out some information about server\n"); + return 0; +} + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_rdf *name; + ldns_rdf *version, *id; + ldns_pkt *p; + ldns_rr_list *addr; + ldns_rr_list *info; + ldns_status s; + ldns_rdf *pop; + size_t i; + + if (argc != 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + /* create a rdf from the command line arg */ + name = ldns_dname_new_frm_str(argv[1]); + if (!name) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + /* create rdf for what we are going to ask */ + version = ldns_dname_new_frm_str("version.bind"); + id = ldns_dname_new_frm_str("hostname.bind"); + + /* create a new resolver from /etc/resolv.conf */ + s = ldns_resolver_new_frm_file(&res, NULL); + if (s != LDNS_STATUS_OK) { + ldns_rdf_deep_free(name); + exit(EXIT_FAILURE); + } + ldns_resolver_set_retry(res, 1); /* don't want to wait too long */ + + /* use the resolver to send it a query for the a/aaaa of name */ + addr = ldns_get_rr_list_addr_by_name(res, name, LDNS_RR_CLASS_IN, LDNS_RD); + if (!addr) { + fprintf(stderr, " *** could not get an address for %s\n", argv[1]); + ldns_rdf_deep_free(name); + ldns_resolver_deep_free(res); + exit(EXIT_FAILURE); + } + + /* remove current list of nameservers from resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + + /* can be multihomed */ + for(i = 0; i < ldns_rr_list_rr_count(addr); i++) { + if (i > 0) { + fprintf(stdout, "\n"); + } + + if (ldns_resolver_push_nameserver_rr(res, + ldns_rr_list_rr(addr, i)) != LDNS_STATUS_OK) { + printf("Error adding nameserver to resolver\n"); + } + + ldns_rr_print(stdout, ldns_rr_list_rr(addr, i)); + fprintf(stdout, "\n"); + + p = ldns_resolver_query(res, version, LDNS_RR_TYPE_TXT, + LDNS_RR_CLASS_CH, LDNS_RD); + if (p) { + ldns_pkt_print(stdout, p); + info = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_TXT, LDNS_SECTION_ANSWER); + + if (info) { + ldns_rr_list_print(stdout, info); + ldns_rr_list_deep_free(info); + } else { + printf(" *** version retrieval failed\n"); + } + ldns_pkt_free(p); + } else { + printf(" *** query failed\n"); + } + + p = ldns_resolver_query(res, id, LDNS_RR_TYPE_TXT, + LDNS_RR_CLASS_CH, LDNS_RD); + if (p) { + info = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_TXT, LDNS_SECTION_ANSWER); + if (info) { + ldns_rr_list_print(stdout, info); + ldns_rr_list_deep_free(info); + } else { + printf(" *** id retrieval failed\n"); + } + ldns_pkt_free(p); + } else { + printf(" *** query failed for\n"); + } + ldns_rdf_deep_free(ldns_resolver_pop_nameserver(res)); + + } + + ldns_rdf_deep_free(name); + ldns_resolver_deep_free(res); + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-compare-zones.1 b/libs/ldns/examples/ldns-compare-zones.1 new file mode 100644 index 0000000000..facccd8745 --- /dev/null +++ b/libs/ldns/examples/ldns-compare-zones.1 @@ -0,0 +1,57 @@ +.TH ldns-compare-zones 1 "17 Oct 2007" +.SH NAME +ldns-compare-zones \- read and compare two zonefiles and print differences +.SH SYNOPSIS +.B ldns-compare-zones +.IR [-c] +.IR [-i] +.IR [-d] +.IR [-z] +.IR [-s] +.IR ZONEFILE1 +.IR ZONEFILE2 +.SH DESCRIPTION +\fBldns-compare-zones\fR reads two DNS zone files and prints number of differences. +.nf +Output is formated to: + +NUM_INS -NUM_DEL ~NUM_CHG + +.fi +The major comparison is based on the owner name. If an owner name is present in zonefile 1, but not in zonefile 2, the resource records with this owner name are considered deleted, and counted as NUM_DEL. If an owner name is present in zonefile 2, but not in zonefile 1, the resource records with this owner name are considered inserted, and counted as NUM_INS. If an owner name is present in both, but there is a difference in the amount or content of the records, these are considered changed, and counted as NUM_CHG. +.SH OPTIONS +.TP +\fB-c\fR +Print resource records whose owner names are in both zone files, but with different resource records. (a.k.a. changed) +.TP +\fB-i\fR +Print resource records whose owner names are present only in ZONEFILE2 (a.k.a. inserted) +.TP +\fB-d\fR +Print resource records whose owner names are present only in ZONEFILE1 (a.k.a. deleted) +.TP +\fB-a\fR +Print all changes. Specifying this option is the same as specifying -c -i +amd -d. +.TP +\fB-z\fR +Suppress zone sorting; this option is not recommended; it can cause records +to be incorrectly marked as changed, depending of the nature of the changes. +.TP +\fB-s\fR +Do not exclude the SOA record from the comparison. The SOA record may +then show up as changed due to a new serial number. Off by default since +you may be interested to know if (other zone apex elements) have changed. +.TP +\fB-h\fR +Show usage and exit +.TP +\fB-v\fR +Show the version and exit +.SH AUTHOR +Written by Ondřej Surý for CZ.NIC, z.s.p.o. (czech domain registry) +.SH REPORTING BUGS +Report bugs to . +.SH COPYRIGHT +Copyright (C) 2005 CZ.NIC, z.s.p.o.. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-compare-zones.c b/libs/ldns/examples/ldns-compare-zones.c new file mode 100644 index 0000000000..56d36a286c --- /dev/null +++ b/libs/ldns/examples/ldns-compare-zones.c @@ -0,0 +1,283 @@ +/* + * ldns-compare-zones compares two zone files + * + * Written by Ondrej Sury in 2007 + * + * Modified a bit by NLnet Labs. + * + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include +#include +#include + +#include + +#include + +#define OP_INS '+' +#define OP_DEL '-' +#define OP_CHG '~' + +static void +usage(int argc, char **argv) +{ + printf("Usage: %s [-v] [-i] [-d] [-c] [-s] \n", + argv[0]); + printf(" -i - print inserted\n"); + printf(" -d - print deleted\n"); + printf(" -c - print changed\n"); + printf(" -a - print all differences (-i -d -c)\n"); + printf(" -s - do not exclude SOA record from comparison\n"); + printf(" -z - do not sort zones\n"); +} + +int +main(int argc, char **argv) +{ + char *fn1, *fn2; + FILE *fp1, *fp2; + ldns_zone *z1, *z2; + ldns_status s; + size_t i , j; + ldns_rr_list *rrl1, *rrl2; + int rr_cmp, rr_chg = 0; + ldns_rr *rr1 = NULL, *rr2 = NULL, *rrx = NULL; + int line_nr1 = 0, line_nr2 = 0; + size_t rrc1 , rrc2; + size_t num_ins = 0, num_del = 0, num_chg = 0; + int c; + bool opt_deleted = false, opt_inserted = false, opt_changed = false; + bool sort = true, inc_soa = false; + char op = 0; + + while ((c = getopt(argc, argv, "ahvdicsz")) != -1) { + switch (c) { + case 'h': + usage(argc, argv); + exit(EXIT_SUCCESS); + break; + case 'v': + printf("%s version %s (ldns version %s)\n", + argv[0], + LDNS_VERSION, + ldns_version()); + exit(EXIT_SUCCESS); + break; + case 's': + inc_soa = true; + break; + case 'z': + sort = false; + break; + case 'd': + opt_deleted = true; + break; + case 'i': + opt_inserted = true; + break; + case 'c': + opt_changed = true; + break; + case 'a': + opt_deleted = true; + opt_inserted = true; + opt_changed = true; + break; + } + } + + argc -= optind; + argv += optind; + + if (argc != 2) { + argc -= optind; + argv -= optind; + usage(argc, argv); + exit(EXIT_FAILURE); + } + fn1 = argv[0]; + fp1 = fopen(fn1, "r"); + if (!fp1) { + fprintf(stderr, "Unable to open %s: %s\n", fn1, strerror(errno)); + exit(EXIT_FAILURE); + } + /* Read first zone */ + s = ldns_zone_new_frm_fp_l(&z1, fp1, NULL, 0, + LDNS_RR_CLASS_IN, &line_nr1); + if (s != LDNS_STATUS_OK) { + fclose(fp1); + fprintf(stderr, "%s: %s at %d\n", + fn1, + ldns_get_errorstr_by_id(s), + line_nr1); + exit(EXIT_FAILURE); + } + fclose(fp1); + + fn2 = argv[1]; + fp2 = fopen(fn2, "r"); + if (!fp2) { + fprintf(stderr, "Unable to open %s: %s\n", fn2, strerror(errno)); + exit(EXIT_FAILURE); + } + /* Read second zone */ + s = ldns_zone_new_frm_fp_l(&z2, fp2, NULL, 0, + LDNS_RR_CLASS_IN, &line_nr2); + if (s != LDNS_STATUS_OK) { + ldns_zone_deep_free(z1); + fclose(fp2); + fprintf(stderr, "%s: %s at %d\n", + fn2, + ldns_get_errorstr_by_id(s), + line_nr2); + exit(EXIT_FAILURE); + } + fclose(fp2); + + rrl1 = ldns_zone_rrs(z1); + rrc1 = ldns_rr_list_rr_count(rrl1); + + rrl2 = ldns_zone_rrs(z2); + rrc2 = ldns_rr_list_rr_count(rrl2); + + if (sort) { + /* canonicalize zone 1 */ + ldns_rr2canonical(ldns_zone_soa(z1)); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z1)); i++) { + ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z1), i)); + } + /* sort zone 1 */ + ldns_zone_sort(z1); + /* canonicalize zone 2 */ + ldns_rr2canonical(ldns_zone_soa(z2)); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z2)); i++) { + ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z2), i)); + } + /* sort zone 2 */ + ldns_zone_sort(z2); + } + + if(inc_soa) { + ldns_rr_list* wsoa = ldns_rr_list_new(); + ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z1)); + ldns_rr_list_cat(wsoa, rrl1); + rrl1 = wsoa; + rrc1 = ldns_rr_list_rr_count(rrl1); + wsoa = ldns_rr_list_new(); + ldns_rr_list_push_rr(wsoa, ldns_zone_soa(z2)); + ldns_rr_list_cat(wsoa, rrl2); + rrl2 = wsoa; + rrc2 = ldns_rr_list_rr_count(rrl2); + if(sort) { + ldns_rr_list_sort(rrl1); + ldns_rr_list_sort(rrl2); + } + } + + /* + * Walk through both zones. The previously seen resource record is + * kept (in the variable rrx) so that we can recognize when we are + * handling a new owner name. If the owner name changes, we have to + * set the operator again. + */ + for (i = 0, j = 0; i < rrc1 || j < rrc2;) { + rr_cmp = 0; + if (i < rrc1 && j < rrc2) { + rr1 = ldns_rr_list_rr(rrl1, i); + rr2 = ldns_rr_list_rr(rrl2, j); + rr_cmp = ldns_rr_compare(rr1, rr2); + + /* Completely skip if the rrs are equal */ + if (rr_cmp == 0) { + i++; + j++; + continue; + } + rr_chg = ldns_dname_compare(ldns_rr_owner(rr1), + ldns_rr_owner(rr2)); + } else if (i >= rrc1) { + /* we have reached the end of zone 1, so the current record + * from zone 2 automatically sorts higher + */ + rr1 = NULL; + rr2 = ldns_rr_list_rr(rrl2, j); + rr_chg = rr_cmp = 1; + } else if (j >= rrc2) { + /* we have reached the end of zone 2, so the current record + * from zone 1 automatically sorts lower + */ + rr1 = ldns_rr_list_rr(rrl1, i); + rr2 = NULL; + rr_chg = rr_cmp = -1; + } + if (rr_cmp < 0) { + i++; + if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr1), + ldns_rr_owner(rrx) + ) != 0)) { + /* The owner name is different, forget previous rr */ + rrx = NULL; + } + if (rrx == NULL) { + if (rr_chg == 0) { + num_chg++; + op = OP_CHG; + } else { + num_del++; + op = OP_DEL; + } + rrx = rr1; + } + if (((op == OP_DEL) && opt_deleted) || + ((op == OP_CHG) && opt_changed)) { + printf("%c-", op); + ldns_rr_print(stdout, rr1); + } + } else if (rr_cmp > 0) { + j++; + if ((rrx != NULL) && (ldns_dname_compare(ldns_rr_owner(rr2), + ldns_rr_owner(rrx) + ) != 0)) { + rrx = NULL; + } + if (rrx == NULL) { + if (rr_chg == 0) { + num_chg++; + op = OP_CHG; + } else { + num_ins++; + op = OP_INS; + } + /* remember this rr for it's name in the next iteration */ + rrx = rr2; + } + if (((op == OP_INS) && opt_inserted) || + ((op == OP_CHG) && opt_changed)) { + printf("%c+", op); + ldns_rr_print(stdout, rr2); + } + } + } + + printf("\t%c%u\t%c%u\t%c%u\n", + OP_INS, + (unsigned int) num_ins, + OP_DEL, + (unsigned int) num_del, + OP_CHG, + (unsigned int) num_chg); + + /* Free resources */ + if(inc_soa) { + ldns_rr_list_free(rrl1); + ldns_rr_list_free(rrl2); + } + ldns_zone_deep_free(z2); + ldns_zone_deep_free(z1); + + return 0; +} diff --git a/libs/ldns/examples/ldns-dpa.1 b/libs/ldns/examples/ldns-dpa.1 new file mode 100644 index 0000000000..0b433df661 --- /dev/null +++ b/libs/ldns/examples/ldns-dpa.1 @@ -0,0 +1,151 @@ +.TH dpa 1 "1 Nov 2005" +.SH NAME +dpa \- DNS Packet Analyzer. Analyze DNS packets in ip trace files +.SH SYNOPSIS +.B dpa +[ +.IR OPTION +] +.IR TRACEFILE + +.SH DESCRIPTION +\fBdpa\fR is used to analyze dns packets in trace files. It has 3 main options: count, filter, and count uniques (i.e. count all different occurences). + +.SH OPTIONS +.TP +\fB-c\fR \fIexpressionlist\fR +Count occurrences of matching expressions + +.TP +\fB-f\fR \fIexpression\fR +Filter: only process packets that match the expression + +.TP +\fB-h\fR +Show usage + +.TP +\fB-p\fR +Show the total number of correct DNS packets, and percentage of -u and +-c values (of the total of matching on the -f filter. if no filter is +given, percentages are on all correct dns packets) + +.TP +\fB-of\fR \fIfile\fR +Write all packets that match the -f flag to file, as pcap data. + +.TP +\fB-ofh\fR \fIfile\fR +Write all packets that match the -f flag to file, in hexadecimal format, +readable by drill. + +.TP +\fB-s\fR +Show possible match names + +.TP +\fB-s\fR \fImatchname\fR +show possible match operators and values for name + +.TP +\fB-sf\fR +Only evaluate packets (in representation format) that match the -f filter. +If no -f was given, evaluate all correct dns packets. + +.TP +\fB-u\fR \fImatchnamelist\fR +Count every occurence of every value of the matchname (for instance, count all packetsizes, see EXAMPLES in ldns-dpa(1) ). + +.TP +\fB-ua\fR +For every matchname in -u, show the average value of all matches. Behaviour for match types that do not have an integer value is undefined. + +.TP +\fB-uac\fR +For every matchname in -u, show the average number of times this value was encountered. + +.TP +\fB-um\fR \fInumber\fR +Only show the results from -u for values that occurred more than times. + +.TP +\fB-v\fR \fIlevel\fR +Set verbosity to level (1-5, 5 being the highest). Mostly used for debugging. + +.TP +\fB-notip\fR \fIfile\fR +Write packets that were not recognized as IP packets to file (as pcap data). + +.TP +\fB-baddns\fR \fIfile\fR +Write dns packets that were too mangled to parse to file (as pcap data). + +.TP +\fB-version\fR +Show version and exit + +.SH LIST AND MATCHES + +A is a comma separated list of match names (use -s to see possible match names). +A is a comma separated list of expressions. + +An expression has the following form: +: () + | + & + + +: + +: + = equal to + != not equal to + > greater than + < lesser than + >= greater than or equal to + <= lesser than or equal to + ~= contains + +See the -s option for possible matchnames, operators and values. + +.SH EXAMPLES + +.TP +ldns-dpa -u packetsize -p test.tr +Count all different packetsizes in test.tr and show the precentages. + +.TP +ldns-dpa -f "edns=1&qr=0" -of edns.tr test.tr +Filter out all edns enable queries in test.tr and put them in edns.tr + +.TP +ldns-dpa -f edns=1 -c tc=1 -u rcode test.tr +For all edns packets, count the number of truncated packets and all their rcodes in test.tr. + +.TP +ldns-dpa -c tc=1,qr=0,qr=1,opcode=QUERY test.tr +For all packets, count the number of truncated packets, the number of packets with qr=0, the number of packets with qr=1 and the number of queries in test.tr. + +.TP +ldns-dpa -u packetsize -ua test.tr +Show all packet sizes and the average packet size per packet. + +.TP +ldns-dpa -u srcaddress -uac test.tr +Show all packet source addresses and the average number of packets sent from this address. + +.TP +sudo tcpdump -i eth0 -s 0 -U -w - port 53 | ldns-dpa -f qr=0 -sf +Print all query packets seen on the specified interface. + + +.SH AUTHOR +Written by Jelte Jansen for NLnetLabs. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-dpa.c b/libs/ldns/examples/ldns-dpa.c new file mode 100644 index 0000000000..8d18dd6938 --- /dev/null +++ b/libs/ldns/examples/ldns-dpa.c @@ -0,0 +1,2837 @@ +/* + * ldns-dpa inspects the (udp) DNS packets found in a pcap file + * and provides statistics about them + * + * (C) NLnet Labs 2006 - 2008 + * + * See the file LICENSE for the license + */ +#include "config.h" + +#include + +#ifdef HAVE_PCAP_H +#ifdef HAVE_LIBPCAP + +#ifdef HAVE_NETINET_IP6_H +#include +#endif +#include + +#ifndef IP_OFFMASK +#define IP_OFFMASK 0x1fff +#endif + +int verbosity = 1; + +#define ETHER_HEADER_LENGTH 14 +#define UDP_HEADER_LENGTH 8 +#define IP6_HEADER_LENGTH 40 + +/* some systems don't have this? */ +#ifndef ETHERTYPE_IPV6 +#define ETHERTYPE_IPV6 0x86dd +#endif + +#define MAX_MATCHES 20 +#define MAX_OPERATORS 7 + + +/* global options */ +bool show_filter_matches = false; +size_t total_nr_of_dns_packets = 0; +size_t total_nr_of_filtered_packets = 0; +size_t not_ip_packets = 0; +size_t bad_dns_packets = 0; +size_t arp_packets = 0; +size_t udp_packets = 0; +size_t tcp_packets = 0; +size_t fragmented_packets = 0; +size_t lost_packet_fragments = 0; +FILE *hexdumpfile = NULL; +pcap_dumper_t *dumper = NULL; +pcap_dumper_t *not_ip_dump = NULL; +pcap_dumper_t *bad_dns_dump = NULL; + + +struct +fragment_part { + uint16_t ip_id; + uint8_t data[65536]; + size_t cur_len; +}; + +struct fragment_part *fragment_p; + +/* To add a match, + * - add it to the enum + * - add it to the table_matches const + * - add a handler to value_matches + * - tell in get_string_value() where in the packet the data lies + * - add to parser? + * - add to show_match_ function + */ +enum enum_match_ids { + MATCH_ID, + MATCH_OPCODE, + MATCH_RCODE, + MATCH_PACKETSIZE, + MATCH_QR, + MATCH_TC, + MATCH_AD, + MATCH_CD, + MATCH_RD, + MATCH_EDNS, + MATCH_EDNS_PACKETSIZE, + MATCH_DO, + MATCH_QUESTION_SIZE, + MATCH_ANSWER_SIZE, + MATCH_AUTHORITY_SIZE, + MATCH_ADDITIONAL_SIZE, + MATCH_SRC_ADDRESS, + MATCH_DST_ADDRESS, + MATCH_TIMESTAMP, + MATCH_QUERY, + MATCH_QTYPE, + MATCH_QNAME, + MATCH_ANSWER, + MATCH_AUTHORITY, + MATCH_ADDITIONAL, + MATCH_LAST +}; +typedef enum enum_match_ids match_id; + +enum enum_counter_types { + TYPE_INT, + TYPE_BOOL, + TYPE_OPCODE, + TYPE_RCODE, + TYPE_STRING, + TYPE_TIMESTAMP, + TYPE_ADDRESS, + TYPE_RR, + TYPE_RR_TYPE, + TYPE_LAST +}; +typedef enum enum_counter_types counter_type; + +const ldns_lookup_table lt_types[] = { + {TYPE_INT, "int" }, + {TYPE_BOOL, "bool" }, + {TYPE_OPCODE, "opcode" }, + {TYPE_RCODE, "rcode" }, + {TYPE_STRING, "string" }, + {TYPE_TIMESTAMP, "timestamp" }, + {TYPE_ADDRESS, "address" }, + {TYPE_RR, "rr" }, + { 0, NULL } +}; + +enum enum_type_operators { + OP_EQUAL, + OP_NOTEQUAL, + OP_GREATER, + OP_LESSER, + OP_GREATEREQUAL, + OP_LESSEREQUAL, + OP_CONTAINS, + OP_LAST +}; +typedef enum enum_type_operators type_operator; + +const ldns_lookup_table lt_operators[] = { + { OP_EQUAL, "=" }, + { OP_NOTEQUAL, "!=" }, + { OP_GREATER, ">" }, + { OP_LESSER, "<" }, + { OP_GREATEREQUAL, ">=" }, + { OP_LESSEREQUAL, "<=" }, + { OP_CONTAINS, "~=" }, + { 0, NULL } +}; + +static const char *get_op_str(type_operator op) { + const ldns_lookup_table *lt; + lt = ldns_lookup_by_id((ldns_lookup_table *) lt_operators, op); + if (lt) { + return lt->name; + } else { + fprintf(stderr, "Unknown operator id: %u\n", op); + exit(1); + } +} + +static type_operator +get_op_id(char *op_str) +{ + const ldns_lookup_table *lt; + lt = ldns_lookup_by_name((ldns_lookup_table *) lt_operators, op_str); + if (lt) { + return (type_operator) lt->id; + } else { + fprintf(stderr, "Unknown operator: %s\n", op_str); + exit(1); + } +} + +struct struct_type_operators { + counter_type type; + size_t operator_count; + type_operator operators[10]; +}; +typedef struct struct_type_operators type_operators; + +const type_operators const_type_operators[] = { + { TYPE_INT, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, + { TYPE_BOOL, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_OPCODE, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_RCODE, 2, { OP_EQUAL, OP_NOTEQUAL, 0, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_STRING, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_TIMESTAMP, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, + { TYPE_ADDRESS, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_RR, 3, { OP_EQUAL, OP_NOTEQUAL, OP_CONTAINS, 0, 0, 0, 0, 0, 0, 0} }, + { TYPE_RR_TYPE, 6, { OP_EQUAL, OP_NOTEQUAL, OP_GREATER, OP_LESSER, OP_GREATEREQUAL, OP_LESSEREQUAL, 0, 0, 0, 0 } }, + { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } } +}; + +const type_operators * +get_type_operators(counter_type type) { + const type_operators *to = const_type_operators; + while (to) { + if (to->type == type) { + return to; + } + to++; + } + return NULL; +} + +struct struct_match_table { + match_id id; + const char *name; + const char *description; + const counter_type type; +}; +typedef struct struct_match_table match_table; + +/* order of entries has been changed after gprof analysis, and reasoning + * about the uses of -u arguments + */ +const match_table matches[] = { + { MATCH_QUERY, "query", "String representation of the query RR", TYPE_RR }, + { MATCH_QTYPE, "qtype", "RR Type of the question RR, if present", TYPE_RR_TYPE }, + { MATCH_QNAME, "qname", "Owner name of the question RR, if present", TYPE_STRING }, + { MATCH_SRC_ADDRESS, "srcaddress", "address the packet was sent from", TYPE_ADDRESS }, + { MATCH_TIMESTAMP, "timestamp", "time the packet was sent", TYPE_TIMESTAMP }, + { MATCH_DST_ADDRESS, "dstaddress", "address the packet was sent to", TYPE_ADDRESS }, + { MATCH_EDNS_PACKETSIZE, "edns-packetsize", "packets size specified in edns rr", TYPE_INT }, + { MATCH_ID, "id", "id of the packet", TYPE_INT }, + { MATCH_OPCODE, "opcode", "opcode of packet (rfc1035)", TYPE_OPCODE }, + { MATCH_RCODE, "rcode", "response code of packet", TYPE_RCODE }, + { MATCH_PACKETSIZE, "packetsize", "size of packet in bytes", TYPE_INT }, + { MATCH_QR, "qr", "value of qr bit", TYPE_BOOL }, + { MATCH_TC, "tc", "value of tc bit", TYPE_BOOL }, + { MATCH_AD, "ad", "value of ad bit", TYPE_BOOL }, + { MATCH_CD, "cd", "value of cd bit", TYPE_BOOL }, + { MATCH_RD, "rd", "value of rd bit", TYPE_BOOL }, + { MATCH_EDNS, "edns", "existence of edns rr", TYPE_BOOL }, + { MATCH_DO, "do", "value of do bit", TYPE_BOOL }, + { MATCH_QUESTION_SIZE, "questionsize", "number of rrs in the question section", TYPE_INT }, + { MATCH_ANSWER_SIZE, "answersize", "number of rrs in the answer section", TYPE_INT }, + { MATCH_AUTHORITY_SIZE, "authoritysize", "number of rrs in the authority section", TYPE_INT }, + { MATCH_ADDITIONAL_SIZE, "additionalsize", "number of rrs in the additional section", TYPE_INT }, + { MATCH_ANSWER, "answer", "String representation of the answer RRs", TYPE_RR }, + { MATCH_AUTHORITY, "authority", "String representation of the authority RRs", TYPE_RR }, + { MATCH_ADDITIONAL, "additional", "String representation of the additional RRs", TYPE_RR }, + { 0, NULL , NULL, TYPE_INT} +}; + +enum enum_match_expression_operators { + MATCH_EXPR_OR, + MATCH_EXPR_AND, + MATCH_EXPR_LEAF +}; +typedef enum enum_match_expression_operators match_expression_operator; + +struct struct_match_operation { + match_id id; + type_operator operator; + char *value; +}; +typedef struct struct_match_operation match_operation; + +typedef struct struct_match_expression match_expression; +struct struct_match_expression { + /* and or or, or leaf (in which case there are no subtrees, but only a match_table */ + match_expression_operator op; + match_expression *left; + match_expression *right; + match_operation *match; + size_t count; +}; + +typedef struct struct_match_counters match_counters; +struct struct_match_counters { +/* + match_expression **counter; + size_t size; +*/ + match_expression *match; + match_counters *left; + match_counters *right; +}; + +match_table * +get_match_by_name(char *name) { + match_table *mt = (match_table *) matches; + if (name) { + while (mt->name != NULL) { + if (strcasecmp(name, mt->name) == 0) { + return mt; + } + mt++; + } + } + return NULL; +} + +static match_table * +get_match_by_id(match_id id) { + match_table *mt = (match_table *) matches; + + while (mt->name != NULL) { + if (mt->id == id) { + return mt; + } + mt++; + } + return NULL; +} + +static const char * +get_match_name_str(match_id id) { + match_table *mt = get_match_by_id(id); + if (mt) { + return mt->name; + } else { + fprintf(stderr, "Unknown match id: %u\n", id); + exit(1); + return "Unknown match id"; + } +} + +static void +print_match_operation(FILE *output, match_operation *mc) +{ + match_table *mt = NULL; + ldns_lookup_table *lt; + struct timeval time; + time_t time_tt; + int value; + size_t pos; + char *tmp, *tmp2; + + if (mc) { + mt = get_match_by_id(mc->id); + + if (mt) { + fprintf(output, "%s %s ",mt->name, get_op_str(mc->operator)); + + switch (mt->type) { + case TYPE_INT: + case TYPE_STRING: + case TYPE_ADDRESS: + case TYPE_RR: + fprintf(output, "'%s'", mc->value); + break; + case TYPE_BOOL: + if (strncmp(mc->value, "1", 2) == 0) { + fprintf(output,"'true'"); + } else { + fprintf(output,"'false'"); + } + break; + case TYPE_OPCODE: + value = atoi(mc->value); + lt = ldns_lookup_by_id(ldns_opcodes, value); + if (lt) { + fprintf(output, "%s", lt->name); + } else { + fprintf(output, "%s", mc->value); + } + break; + case TYPE_RCODE: + value = atoi(mc->value); + lt = ldns_lookup_by_id(ldns_rcodes, value); + if (lt) { + fprintf(output, "%s", lt->name); + } else { + fprintf(output, "%s", mc->value); + } + break; + case TYPE_TIMESTAMP: +#ifndef S_SPLINT_S + time.tv_sec = (long int) atol(mc->value); +#endif + time_tt = (time_t)time.tv_sec; + tmp = ctime(&time_tt); + tmp2 = malloc(strlen(tmp) + 1); + for (pos = 0; pos < strlen(tmp); pos++) { + if (tmp[pos] == '\n') { + tmp2[pos] = '\0'; + } else { + tmp2[pos] = tmp[pos]; + } + } + tmp2[pos] = '\0'; + fprintf(output, "%s", tmp2); + free(tmp2); + break; + default: + fprintf(output, "'%s'", mc->value); + } + + } else { + fprintf(output, "%u %s '%s'", mc->id, get_op_str(mc->operator), mc->value); + } + } else { + fprintf(output, "(nil)"); + } +} + +static void +print_match_expression(FILE *output, match_expression *expr) +{ + if (expr) { + switch (expr->op) { + case MATCH_EXPR_OR: + fprintf(output, "("); + print_match_expression(output, expr->left); + fprintf(output, " | "); + print_match_expression(output, expr->right); + fprintf(output, ")"); + break; + case MATCH_EXPR_AND: + fprintf(output, "("); + print_match_expression(output, expr->left); + fprintf(output, " & "); + print_match_expression(output, expr->right); + fprintf(output, ")"); + break; + case MATCH_EXPR_LEAF: + print_match_operation(output, expr->match); + break; + default: +/* + fprintf(output, "ERROR PRINTING MATCH: unknown op: %u\n", expr->op); + exit(1); +*/ + fprintf(output, "("); +if (expr->left) { + print_match_expression(output, expr->left); +} + fprintf(output, " ? "); +if (expr->right) { + print_match_expression(output, expr->right); +} + fprintf(output, ") _"); +if (expr->match) { + print_match_operation(output, expr->match); +} +fprintf(output, "_"); + } + } else { + printf("(nil)"); + } +} + +static void +print_counters(FILE *output, match_counters *counters, bool show_percentages, size_t total, int count_minimum) +{ + double percentage; + + if (!counters || !output) { + return; + } + + if (counters->left) { + print_counters(output, counters->left, show_percentages, total, count_minimum); + } + if (counters->match) { + if (count_minimum < (int) counters->match->count) { + print_match_expression(output, counters->match); + printf(": %u", (unsigned int) counters->match->count); + if (show_percentages) { + percentage = (double) counters->match->count / (double) total * 100.0; + printf(" (%.2f%%)", percentage); + } + printf("\n"); + } + } + if (counters->right) { + print_counters(output, counters->right, show_percentages, total, count_minimum); + } + + return; +} + +static void +ldns_pkt2file_hex(FILE *fp, const ldns_pkt *pkt) +{ + uint8_t *wire; + size_t size, i; + ldns_status status; + + status = ldns_pkt2wire(&wire, pkt, &size); + + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Unable to convert packet: error code %u", status); + return; + } + + fprintf(fp, "; 0"); + for (i = 1; i < 20; i++) { + fprintf(fp, " %2u", (unsigned int) i); + } + fprintf(fp, "\n"); + fprintf(fp, ";--"); + for (i = 1; i < 20; i++) { + fprintf(fp, " --"); + } + fprintf(fp, "\n"); + for (i = 0; i < size; i++) { + if (i % 20 == 0 && i > 0) { + fprintf(fp, "\t; %4u-%4u\n", (unsigned int) i-19, (unsigned int) i); + } + fprintf(fp, " %02x", (unsigned int)wire[i]); + } + fprintf(fp, "\n\n"); +} + +/* + * Calculate the total for all match operations with the same id as this one + * (if they are 'under' this one in the tree, which should be the case in + * the unique counter tree + */ +static size_t +calculate_total_value(match_counters *counters, match_operation *cur) +{ + size_t result = 0; + + if (!counters) { + return 0; + } + + if (counters->match->match->id == cur->id) { + result = (size_t) atol(counters->match->match->value) * counters->match->count; + } + + if (counters->left) { + result += calculate_total_value(counters->left, cur); + } + if (counters->right) { + result += calculate_total_value(counters->right, cur); + } + + return result; +} + +static size_t +calculate_total_count_matches(match_counters *counters, match_operation *cur) +{ + size_t result = 0; + + if (!counters) { + return 0; + } + + if (counters->match->match->id == cur->id) { + result = 1; + } + + if (counters->left) { + /* In some cases, you don't want the number of actual + counted matches, for instance when calculating the + average number of queries per second. In this case + you want the number of seconds */ + if (cur->id == MATCH_TIMESTAMP) { + result += (size_t) abs((int) (atol(counters->match->match->value) - atol(counters->left->match->match->value))) - 1; + } + result += calculate_total_count_matches(counters->left, cur); + } + if (counters->right) { + if (cur->id == MATCH_TIMESTAMP) { + result += (size_t) abs((int) (atol(counters->right->match->match->value) - atol(counters->match->match->value))) - 1; + } + result += calculate_total_count_matches(counters->right, cur); + } + + return result; +} + +/** + * Returns true if there is a previous match operation with the given type + * in the counters structure + */ +static bool +has_previous_match(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return false; + } + + if (counters->left) { + if (counters->left->match->match->id == cur->id) { + return true; + } else if (has_previous_match(counters->left, cur)) { + return true; + } else if (counters->left->right) { + if (counters->left->right->match->match->id == cur->id) { + return true; + } else if (has_previous_match(counters->left->right, cur)) { + return true; + } + } + } + return false; +} + +/** + * Returns true if there is a later match operation with the given type + * in the counters structure + */ +static bool +has_next_match(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return false; + } + + if (counters->right) { + if (counters->right->match->match->id == cur->id) { + return true; + } else if (has_next_match(counters->right, cur)) { + return true; + } else if (counters->right->left) { + if (counters->right->left->match->match->id == cur->id) { + return true; + } else if (has_next_match(counters->right->left, cur)) { + return true; + } + } + } + return false; +} + +/** + * Returns the first match with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_first_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_previous_match(counters, cur)) { + return get_first_match_expression(counters->left, cur); + } else if (counters->match->match->id == cur->id) { + return counters->match; + } else if (counters->right) { + return get_first_match_expression(counters->right, cur); + } else { + return NULL; + } +} + +/** + * Returns the second match expression with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_second_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_previous_match(counters, cur)) { + if (has_previous_match(counters->left, cur)) { + return get_second_match_expression(counters->left, cur); + } else { + return counters->left->match; + } +/* + } else if (counters->match->match->id == cur->id) { + return counters->match->match->value; +*/ } else if (counters->right) { + return get_first_match_expression(counters->right, cur); + } else { + return NULL; + } +} + +/** + * Returns the last match expression with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_last_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_next_match(counters, cur)) { + return get_last_match_expression(counters->right, cur); + } else if (counters->match->match->id == cur->id) { + return counters->match; + } else if (counters->left) { + return get_last_match_expression(counters->left, cur); + } else { + return NULL; + } +} + +/** + * Returns the last but one match expression with the same type at *cur in + * the counter list, or NULL if it is not found + */ +static match_expression * +get_last_but_one_match_expression(match_counters *counters, match_operation *cur) +{ + if (!counters) { + return NULL; + } + + if (has_next_match(counters, cur)) { + if (has_next_match(counters->right, cur)) { + return get_last_but_one_match_expression(counters->right, cur); + } else { + return counters->match; + } +/* + } else if (counters->match->match->id == cur->id) { + return counters->match->match->value; +*/ } else if (counters->left) { + return get_last_match_expression(counters->right, cur); + } else { + return NULL; + } +} + +static size_t +get_first_count(match_counters *counters, match_operation *cur) +{ + match_expression *o = get_first_match_expression(counters, cur); + if (o) { + return o->count; + } else { + return 0; + } +} + +static size_t +get_last_count(match_counters *counters, match_operation *cur) +{ + match_expression *o = get_last_match_expression(counters, cur); + if (o) { + return o->count; + } else { + return 0; + } +} + + +static size_t +calculate_total_count(match_counters *counters, match_operation *cur) +{ + size_t result = 0; + + if (!counters) { + return 0; + } + + if (counters->match->match->id == cur->id) { + result = counters->match->count; + } + + if (counters->left) { + result += calculate_total_count(counters->left, cur); + } + if (counters->right) { + result += calculate_total_count(counters->right, cur); + } + + return result; +} + +static void +print_counter_averages(FILE *output, match_counters *counters, match_operation *cur) +{ + size_t total_value; + size_t total_count; + match_table *mt; + + if (!counters || !output) { + return; + } + + if (!cur) { + cur = counters->match->match; + mt = get_match_by_id(cur->id); + total_value = calculate_total_value(counters, cur); + total_count = calculate_total_count(counters, cur); + printf("Average for %s: (%u / %u) %.02f\n", mt->name, (unsigned int) total_value, (unsigned int) total_count, (float) total_value / (float) total_count); + if (counters->left) { + print_counter_averages(output, counters->left, cur); + } + if (counters->right) { + print_counter_averages(output, counters->right, cur); + } + } else { + if (counters->left) { + if (counters->left->match->match->id != cur->id) { + print_counter_averages(output, counters->left, NULL); + } + } + if (counters->right) { + if (counters->right->match->match->id != cur->id) { + print_counter_averages(output, counters->right, NULL); + } + } + } + + return; +} + +static void +print_counter_average_count(FILE *output, match_counters *counters, match_operation *cur, bool remove_first_last) +{ + size_t total_matches; + size_t total_count; + match_table *mt; + + if (!counters || !output) { + return; + } + + if (!cur) { + cur = counters->match->match; + mt = get_match_by_id(cur->id); + total_matches = calculate_total_count_matches(counters, cur); + total_count = calculate_total_count(counters, cur); + /* Remove the first and last for instance for timestamp average counts (half seconds drag down the average) */ + if (remove_first_last) { + total_count -= get_first_count(counters, cur); + total_count -= get_last_count(counters, cur); + printf("Removing first count from average: %u\n", (unsigned int) get_first_count(counters,cur)); + printf("Removing last count from average: %u\n", (unsigned int) get_last_count(counters,cur)); + /* in the case where we count the differences between match values too + * (like with timestamps) we need to subtract from the match count too + */ + if (cur->id == MATCH_TIMESTAMP) { + if (get_first_match_expression(counters, cur) && get_second_match_expression(counters, cur)) { + total_matches -= atol(get_second_match_expression(counters, cur)->match->value) - atol(get_first_match_expression(counters, cur)->match->value); + } + if (get_last_match_expression(counters, cur) && get_last_but_one_match_expression(counters, cur)) { + total_matches -= atol(get_last_match_expression(counters, cur)->match->value) - atol(get_last_but_one_match_expression(counters, cur)->match->value); + } + } else { + total_matches -= 2; + } + } + printf("Average count for %s: (%u / %u) %.02f\n", mt->name, (unsigned int) total_count, (unsigned int) total_matches, (float) total_count / (float) total_matches); + if (counters->left) { + print_counter_averages(output, counters->left, cur); + } + if (counters->right) { + print_counter_averages(output, counters->right, cur); + } + } else { + if (counters->left) { + if (counters->left->match->match->id != cur->id) { + print_counter_averages(output, counters->left, NULL); + } + } + if (counters->right) { + if (counters->right->match->match->id != cur->id) { + print_counter_averages(output, counters->right, NULL); + } + } + } + + return; +} + +static bool +match_int(type_operator operator, + char *value, + char *mvalue) +{ + int a, b; + + if (!value || !mvalue) { + return false; + } + + a = atoi(value); + b = atoi(mvalue); + + switch (operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + case OP_GREATER: + return a > b; + break; + case OP_LESSER: + return a < b; + break; + case OP_GREATEREQUAL: + return a >= b; + break; + case OP_LESSEREQUAL: + return a <= b; + break; + default: + fprintf(stderr, "Unknown operator: %u\n", operator); + exit(2); + } +} + +static bool +match_opcode(type_operator operator, + char *value, + char *mvalue) +{ + ldns_pkt_opcode a, b; + int i; + ldns_lookup_table *lt; + + /* try parse name first, then parse as int */ + lt = ldns_lookup_by_name(ldns_opcodes, value); + if (lt) { + a = lt->id; + } else { + i = atoi(value); + if (i >= 0 && !isdigit(value[0]) == 0) { + lt = ldns_lookup_by_id(ldns_opcodes, i); + if (lt) { + a = lt->id; + } else { + fprintf(stderr, "Unknown opcode: %s\n", value); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown opcode: %s\n", value); + exit(1); + return false; + } + } + + lt = ldns_lookup_by_name(ldns_opcodes, mvalue); + if (lt) { + b = lt->id; + } else { + i = atoi(mvalue); + if (i >= 0 && !isdigit(mvalue[0]) == 0) { + lt = ldns_lookup_by_id(ldns_opcodes, i); + if (lt) { + b = lt->id; + } else { + fprintf(stderr, "Unknown opcode: %s\n", mvalue); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown opcode: %s\n", mvalue); + exit(1); + return false; + } + } + + switch(operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + default: + fprintf(stderr, "Error bad operator for opcode: %s\n", get_op_str(operator)); + return false; + break; + } +} + +static bool +match_str(type_operator operator, + char *value, + char *mvalue) +{ + char *valuedup, *mvaluedup; + size_t i; + bool result; + + if (operator == OP_CONTAINS) { + /* strcasestr is not C89 + return strcasestr(value, mvalue) != 0; + */ + valuedup = strdup(value); + mvaluedup = strdup(mvalue); + for (i = 0; i < strlen(valuedup); i++) { + valuedup[i] = tolower(valuedup[i]); + } + for (i = 0; i < strlen(mvaluedup); i++) { + mvaluedup[i] = tolower(mvaluedup[i]); + } + result = strstr(valuedup, mvaluedup) != 0; + free(valuedup); + free(mvaluedup); + return result; + } else if (operator == OP_EQUAL) { + return strcmp(value, mvalue) == 0; + } else { + return strcmp(value, mvalue) != 0; + } +} + +static bool +match_rr_type(type_operator operator, + char *value, + char *mvalue) +{ + ldns_rr_type a,b; + + a = ldns_get_rr_type_by_name(value); + b = ldns_get_rr_type_by_name(mvalue); + + switch (operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + case OP_GREATER: + return a > b; + break; + case OP_LESSER: + return a < b; + break; + case OP_GREATEREQUAL: + return a >= b; + break; + case OP_LESSEREQUAL: + return a <= b; + break; + default: + fprintf(stderr, "Unknown operator: %u\n", operator); + exit(2); + } +} + +static bool +match_rcode(type_operator operator, + char *value, + char *mvalue) +{ + int a, b; + int i; + ldns_lookup_table *lt; + + /* try parse name first, then parse as int */ + lt = ldns_lookup_by_name(ldns_rcodes, value); + if (lt) { + a = lt->id; + } else { + i = atoi(value); + if (i >= 0 && !isdigit(value[0]) == 0) { + lt = ldns_lookup_by_id(ldns_rcodes, i); + if (lt) { + a = lt->id; + } else { + fprintf(stderr, "Unknown rcode: %s\n", value); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown rcode: %s\n", value); + exit(1); + return false; + } + } + + lt = ldns_lookup_by_name(ldns_rcodes, mvalue); + if (lt) { + b = lt->id; + } else { + i = atoi(mvalue); + + if (i >= 0 && !isdigit(mvalue[0]) == 0) { + lt = ldns_lookup_by_id(ldns_rcodes, i); + if (lt) { + b = lt->id; + } else { + fprintf(stderr, "Unknown rcode: %s\n", mvalue); + exit(1); + return false; + } + } else { + fprintf(stderr, "Unknown rcode: %s\n", mvalue); + exit(1); + return false; + } + } + + switch(operator) { + case OP_EQUAL: + return a == b; + break; + case OP_NOTEQUAL: + return a != b; + break; + default: + fprintf(stderr, "Error bad operator for rcode: %s\n", get_op_str(operator)); + return false; + break; + } +} + +static bool +value_matches(match_id id, + type_operator operator, + char *value, + char *mvalue) +{ + int result; + + if (verbosity >= 5) { + printf("Match %s: %s %s %s: ", get_match_name_str(id), value, get_op_str(operator), mvalue); + } + switch(id) { + case MATCH_OPCODE: + result = match_opcode(operator, value, mvalue); + break; + case MATCH_RCODE: + result = match_rcode(operator, value, mvalue); + break; + case MATCH_ID: + case MATCH_QR: + case MATCH_TC: + case MATCH_AD: + case MATCH_CD: + case MATCH_RD: + case MATCH_DO: + case MATCH_PACKETSIZE: + case MATCH_EDNS: + case MATCH_EDNS_PACKETSIZE: + case MATCH_QUESTION_SIZE: + case MATCH_ANSWER_SIZE: + case MATCH_AUTHORITY_SIZE: + case MATCH_ADDITIONAL_SIZE: + case MATCH_TIMESTAMP: + result = match_int(operator, value, mvalue); + break; + case MATCH_QUERY: + case MATCH_QNAME: + case MATCH_ANSWER: + case MATCH_AUTHORITY: + case MATCH_ADDITIONAL: + result = match_str(operator, value, mvalue); + break; + case MATCH_SRC_ADDRESS: + case MATCH_DST_ADDRESS: + result = match_str(operator, value, mvalue); + break; + case MATCH_QTYPE: + result = match_rr_type(operator, value, mvalue); + break; + default: + fprintf(stderr, "Error: value_matches() for operator %s not implemented yet.\n", get_op_str((type_operator) id)); + exit(3); + } + if (verbosity >= 5) { + if (result) { + printf("true\n"); + } else { + printf("false\n"); + } + } + return result; +} + +static char * +get_string_value(match_id id, ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr) +{ + char *val; + match_table *mt; + size_t valsize = 100; + + val = malloc(valsize); + memset(val, 0, valsize); + + switch(id) { + case MATCH_QR: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_qr(pkt)); + break; + case MATCH_ID: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_id(pkt)); + break; + case MATCH_OPCODE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_get_opcode(pkt)); + break; + case MATCH_RCODE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_get_rcode(pkt)); + break; + case MATCH_PACKETSIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_size(pkt)); + break; + case MATCH_TC: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_tc(pkt)); + break; + case MATCH_AD: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_ad(pkt)); + break; + case MATCH_CD: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_cd(pkt)); + break; + case MATCH_RD: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_rd(pkt)); + break; + case MATCH_EDNS: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns(pkt)); + break; + case MATCH_EDNS_PACKETSIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns_udp_size(pkt)); + break; + case MATCH_DO: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_edns_do(pkt)); + break; + case MATCH_QUESTION_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_qdcount(pkt)); + break; + case MATCH_ANSWER_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_ancount(pkt)); + break; + case MATCH_AUTHORITY_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_nscount(pkt)); + break; + case MATCH_ADDITIONAL_SIZE: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_arcount(pkt)); + break; + case MATCH_SRC_ADDRESS: + free(val); + val = ldns_rdf2str(src_addr); + break; + case MATCH_DST_ADDRESS: + free(val); + val = ldns_rdf2str(dst_addr); + break; + case MATCH_TIMESTAMP: + snprintf(val, valsize, "%u", (unsigned int) ldns_pkt_timestamp(pkt).tv_sec); + break; + case MATCH_QUERY: + if (ldns_pkt_qdcount(pkt) > 0) { + free(val); + val = ldns_rr2str(ldns_rr_list_rr(ldns_pkt_question(pkt), 0)); + /* replace \n for nicer printing later */ + if (strchr(val, '\n')) { + *(strchr(val, '\n')) = '\0'; + } + } else { + val[0] = '\0'; + } + break; + case MATCH_QNAME: + if (ldns_pkt_qdcount(pkt) > 0) { + free(val); + val = ldns_rdf2str(ldns_rr_owner(ldns_rr_list_rr(ldns_pkt_question(pkt), 0))); + /* replace \n for nicer printing later */ + if (strchr(val, '\n')) { + *(strchr(val, '\n')) = '\0'; + } + } else { + val[0] = '\0'; + } + break; + case MATCH_QTYPE: + if (ldns_pkt_qdcount(pkt) > 0) { + free(val); + val = ldns_rr_type2str(ldns_rr_get_type(ldns_rr_list_rr(ldns_pkt_question(pkt), 0))); + } else { + val[0] = '\0'; + } + break; + case MATCH_ANSWER: + if (ldns_pkt_ancount(pkt) > 0) { + free(val); + val = ldns_rr_list2str(ldns_pkt_answer(pkt)); + } else { + val[0] = '\0'; + } + break; + case MATCH_AUTHORITY: + if (ldns_pkt_nscount(pkt) > 0) { + free(val); + val = ldns_rr_list2str(ldns_pkt_authority(pkt)); + } else { + val[0] = '\0'; + } + break; + case MATCH_ADDITIONAL: + if (ldns_pkt_arcount(pkt) > 0) { + free(val); + val = ldns_rr_list2str(ldns_pkt_additional(pkt)); + } else { + val[0] = '\0'; + } + break; + default: + mt = get_match_by_id(id); + if (!mt) { + printf("ERROR UNKNOWN MATCH_TABLE ID %u\n", id); + exit(1); + } + printf("Matcher for %s not implemented yet\n", mt->name); + exit(1); + return NULL; + } + + return val; +} + +static bool +match_packet_to_operation(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_operation *operation) +{ + bool result; + char *val; + + if (!pkt || !operation) { + return false; + } else { + val = get_string_value(operation->id, pkt, src_addr, dst_addr); + if (!val) { + return false; + } + result = value_matches(operation->id, operation->operator, val, operation->value); + free(val); + return result; + } +} + +static int +match_operation_compare(const void *a, const void *b) +{ + match_operation *moa, *mob; + match_table *mt; + long ia, ib; + + if (!a) { + return 1; + } else if (!b) { + return -1; + } else { + moa = (match_operation *) a; + mob = (match_operation *) b; + + if (moa->id < mob->id) { + return -1; + } else if (moa->id > mob->id) { + return 1; + } else { + if (moa->operator < mob->operator) { + return -1; + } else if (moa->operator > mob->operator) { + return 1; + } else { + mt = get_match_by_id(moa->id); + if (mt) { + switch (mt->type) { + case TYPE_INT: + case TYPE_TIMESTAMP: + case TYPE_BOOL: + case TYPE_OPCODE: + case TYPE_RCODE: + ia = atol(moa->value); + ib = atol(mob->value); + return ia - ib; + break; + case TYPE_STRING: + case TYPE_ADDRESS: + case TYPE_RR: + default: + return strcmp(moa->value, mob->value); + break; + } + } else { + return strcmp(moa->value, mob->value); + } + } + } + } +} + +static int +match_expression_compare(const void *a, const void *b) +{ + match_expression *mea, *meb; + + if (!a) { + return 1; + } else if (!b) { + return -1; + } else { + mea = (match_expression *) a; + meb = (match_expression *) b; + + if (mea->op < meb->op) { + return -1; + } else if (mea->op > meb->op) { + return 1; + } else { + switch(mea->op) { + case MATCH_EXPR_AND: + case MATCH_EXPR_OR: + if (match_expression_compare(mea->left, meb->left) < 0) { + return -1; + } else if (match_expression_compare(mea->left, meb->left) > 0) { + return 1; + } else { + return match_expression_compare(mea->right, meb->right); + } + break; + case MATCH_EXPR_LEAF: + return match_operation_compare(mea->match, meb->match); + break; + default: + fprintf(stderr, "Unknown Match Expression logic operator: %u\n", mea->op); + exit(1); + } + } + } +} + +/** + * If count is true, and the counter is found, its count is increased by 1 + */ +static int +add_match_counter(match_counters *counters, + match_expression *expr, + bool count) +{ + int cmp; + match_counters *new; + + if (!counters || !expr) { + return -1; + } else { + if (counters->match) { + cmp = match_expression_compare(counters->match, + expr); + if (cmp > 0) { + if (counters->left) { + return add_match_counter(counters->left, + expr, + count); + } else { + new = malloc(sizeof(match_counters)); + new->left = NULL; + new->right = NULL; + new->match = expr; + counters->left = new; + return 0; + } + } else if (cmp < 0) { + if (counters->right) { + return add_match_counter(counters->right, + expr, + count); + } else { + new = malloc(sizeof(match_counters)); + new->left = NULL; + new->right = NULL; + new->match = expr; + counters->right = new; + return 0; + } + } else { + /* already there? */ + if (count) { + counters->match->count++; + } + return 1; + } + } else { + /* shouldn't happen but anyway */ + counters->match = expr; + } + } + return 0; +} + +static bool +match_dns_packet_to_expr(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_expression *expr) +{ + bool result; + + if (!pkt || !expr) { + return false; + } + + switch(expr->op) { + case MATCH_EXPR_OR: + result = (match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->left) || + match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->right)); + break; + case MATCH_EXPR_AND: + result = (match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->left) && + match_dns_packet_to_expr(pkt, src_addr, dst_addr, expr->right)); + break; + case MATCH_EXPR_LEAF: + result = match_packet_to_operation(pkt, src_addr, dst_addr, expr->match); + break; + default: + fprintf(stderr, "Error, unknown expression operator %u\n", expr->op); + fprintf(stderr, "full expression:\n"); + print_match_expression(stderr, expr); + fprintf(stderr, "\n"); + exit(1); + } + + if (result) { + if (verbosity >= 5) { + printf("Found Match:\n"); + print_match_expression(stdout, expr); + printf("\nCount now %u\n", (unsigned int) expr->count); + } + expr->count++; + } + + return result; +} + +static void +free_match_operation(match_operation *operation) +{ + if (operation) { + if (operation->value) { + free(operation->value); + } + free(operation); + } +} + +static void +free_match_expression(match_expression *expr) +{ + if (expr) { + switch(expr->op) { + case MATCH_EXPR_OR: + case MATCH_EXPR_AND: + free_match_expression(expr->left); + free_match_expression(expr->right); + break; + case MATCH_EXPR_LEAF: + free_match_operation(expr->match); + break; + } + free(expr); + } +} + +static void +free_counters(match_counters *counters) +{ + if (counters) { + if (counters->left) { + free_counters(counters->left); + } + if (counters->match) { + free_match_expression(counters->match); + } + if (counters->right) { + free_counters(counters->right); + } + free(counters); + } +} + +static void +match_pkt_counters(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_counters *counts) +{ + if (counts->left) { + match_pkt_counters(pkt, src_addr, dst_addr, counts->left); + } + if (counts->match) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, counts->match)) { +/* + counts->match->count++; +*/ + } + } + if (counts->right) { + match_pkt_counters(pkt, src_addr, dst_addr, counts->right); + } +} + +static void +match_pkt_uniques(ldns_pkt *pkt, ldns_rdf *src_addr, ldns_rdf *dst_addr, match_counters *uniques, match_id unique_ids[], size_t unique_id_count) +{ + match_expression *me; + size_t i; + match_operation *mo; + int add_result; + + for (i = 0; i < unique_id_count; i++) { + mo = malloc(sizeof(match_operation)); + mo->id = unique_ids[i]; + mo->operator = OP_EQUAL; + mo->value = get_string_value(mo->id, pkt, src_addr, dst_addr); + + me = malloc(sizeof(match_expression)); + me->op = MATCH_EXPR_LEAF; + me->left = NULL; + me->right = NULL; + me->match = mo; + me->count = 1; + + add_result = add_match_counter(uniques, me, true); + /* if result=1 it was already found, so delete new one */ + if (add_result == 1) { + free_match_expression(me); + } + } + +#if 0 + size_t i, j; + bool found; + match_expression *me; + match_operation *mo; + + /* get the value, match uniques for that, if not match, add new */ + /* all unique values should be MATCH_EXPR_LEAF */ + found = false; + for (j = 0; j < uniques->size; j++) { + if (uniques->counter[j]->match->id == unique_ids[i]) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, uniques->counter[j])) { + found = true; + } + } + } + if (!found) { + mo = malloc(sizeof(match_operation)); + mo->id = unique_ids[i]; + mo->operator = OP_EQUAL; + mo->value = get_string_value(mo->id, pkt, src_addr, dst_addr); + + me = malloc(sizeof(match_expression)); + me->match = mo; + me->op = MATCH_EXPR_LEAF; + me->left = NULL; + me->right = NULL; + me->count = 1; + + add_counter(uniques, me); + } + } +#endif +} + +static match_expression * +parse_match_expression(char *string) +{ + match_expression *expr; + size_t i,j; + size_t leftstart, leftend = 0; + char *left_str, *op, *val; + match_table *mt; + match_operation *mo = NULL; + const type_operators *tos; + match_expression *result; + ldns_lookup_table *lt = NULL; + + /* remove whitespace */ + char *str = malloc(strlen(string) + 1); + + j = 0; + for (i = 0; i < strlen(string); i++) { + if(!isspace(string[i])) { + str[j] = string[i]; + j++; + } + } + str[j] = '\0'; + + expr = malloc(sizeof(match_expression)); + expr->left = NULL; + expr->right = NULL; + expr->match = NULL; + expr->count = 0; + leftstart = 0; + for (i = 0; i < strlen(str); i++) { + if (str[i] == '&') { + expr->op = MATCH_EXPR_AND; + if (!expr->left) { + left_str = malloc(leftend - leftstart + 2); + strncpy(left_str, &str[leftstart], leftend-leftstart+1); + left_str[leftend - leftstart + 1] = '\0'; + expr->left = parse_match_expression(left_str); + free(left_str); + } + expr->right = parse_match_expression(&str[i+1]); + if (expr->left && expr->right) { + result = expr; + goto done; + } else { + result = NULL; + goto done; + } + } else if (str[i] == '|') { + expr->op = MATCH_EXPR_OR; + if (!expr->left) { + left_str = malloc(leftend - leftstart + 2); + strncpy(left_str, &str[leftstart], leftend-leftstart+1); + left_str[leftend - leftstart + 1] = '\0'; + expr->left = parse_match_expression(left_str); + free(left_str); + } + expr->right = parse_match_expression(&str[i+1]); + expr->count = 0; + if (expr->left && expr->right) { + result = expr; + goto done; + } else { + result = NULL; + goto done; + } + } else if (str[i] == '(') { + leftstart = i + 1; + j = 1; + while (j > 0) { + i++; + if (i > strlen(str)) { + printf("parse error: no closing bracket: %s\n", str); + printf(" "); + for (j = 0; j < leftstart - 1; j++) { + printf(" "); + } + printf("^\n"); + result = NULL; + goto done; + } + if (str[i] == ')') { + j--; + } else if (str[i] == '(') { + j++; + } else { + } + } + leftend = i-1; + left_str = malloc(leftend - leftstart + 1); + strncpy(left_str, &str[leftstart], leftend - leftstart + 1); + expr->left = parse_match_expression(left_str); + free(left_str); + if (i >= strlen(str)-1) { + result = expr->left; + goto done; + } + } else if (str[i] == ')') { + printf("parse error: ) without (\n"); + result = NULL; + goto done; + } else { + leftend = i; + } + } + + /* no operators or hooks left, expr should be of the form + now */ + for (i = 0; i < strlen(str); i++) { + if (str[i] == '=' || + str[i] == '>' || + str[i] == '<' || + str[i] == '!' || + str[i] == '~' + ) { + leftend = i-1; + op = malloc(3); + j = 0; + op[j] = str[i]; + i++; + j++; + + if (i > strlen(str)) { + printf("parse error no right hand side: %s\n", str); + result = NULL; + goto done; + } + if (str[i] == '=' || + str[i] == '>' || + str[i] == '<' || + str[i] == '!' || + str[i] == '~' + ) { + op[j] = str[i]; + i++; + j++; + if (i > strlen(str)) { + printf("parse error no right hand side: %s\n", str); + result = NULL; + goto done; + } + } + op[j] = '\0'; + left_str = malloc(leftend - leftstart + 2); + strncpy(left_str, &str[leftstart], leftend - leftstart + 1); + left_str[leftend - leftstart + 1] = '\0'; + mt = get_match_by_name(left_str); + if (!mt) { + printf("parse error: unknown match name: %s\n", left_str); + result = NULL; + goto done; + } else { + /* check if operator is allowed */ + tos = get_type_operators(mt->type); + for (j = 0; j < tos->operator_count; j++) { + if (get_op_id(op) == tos->operators[j]) { + mo = malloc(sizeof(match_operation)); + mo->id = mt->id; + mo->operator = get_op_id(op); + switch (mt->type) { + case TYPE_BOOL: + val = malloc(2); + if (strncmp(&str[i], "true", 5) == 0 || + strncmp(&str[i], "TRUE", 5) == 0 || + strncmp(&str[i], "True", 5) == 0 || + strncmp(&str[i], "1", 2) == 0 + ) { + val[0] = '1'; + val[1] = '\0'; + } else if (strncmp(&str[i], "false", 5) == 0 || + strncmp(&str[i], "FALSE", 5) == 0 || + strncmp(&str[i], "False", 5) == 0 || + strncmp(&str[i], "0", 2) == 0 + ) { + + val[0] = '0'; + } else { + fprintf(stderr, "Bad value for bool: %s\n", &str[i]); + exit(EXIT_FAILURE); + } + val[1] = '\0'; + break; + case TYPE_RR: + /* convert first so we have the same strings for the same rrs in match_ later */ + /* + qrr = ldns_rr_new_frm_str(&str[i], LDNS_DEFAULT_TTL, NULL); + if (!qrr) { + fprintf(stderr, "Bad value for RR: %s\n", &str[i]); + exit(EXIT_FAILURE); + } + val = ldns_rr2str(qrr); + */ + /* remove \n for readability */ + /* + if (strchr(val, '\n')) { + *(strchr(val, '\n')) = '\0'; + } + ldns_rr_free(qrr); + */ + val = strdup(&str[i]); + break; + case TYPE_OPCODE: + lt = ldns_lookup_by_name(ldns_opcodes, &str[i]); + if (lt) { + val = malloc(4); + snprintf(val, 3, "%u", (unsigned int) lt->id); + } else { + val = strdup(&str[i]); + } + break; + case TYPE_RCODE: + lt = ldns_lookup_by_name(ldns_rcodes, &str[i]); + if (lt) { + val = malloc(4); + snprintf(val, 3, "%u", (unsigned int) lt->id); + } else { + val = strdup(&str[i]); + } + break; + default: + val = strdup(&str[i]); + break; + } + mo->value = val; + } + } + if (!mo) { + printf("parse error: operator %s not allowed for match %s\n", op, left_str); + result = NULL; + goto done; + } + } + free(left_str); + free(op); + expr->match = mo; + expr->op = MATCH_EXPR_LEAF; + result = expr; + goto done; + } + } + + result = NULL; + + done: + free(str); + if (!result) { + free_match_expression(expr); + } + return result; + +} +/* end of matches and counts */ +void +usage(FILE *output) +{ + fprintf(output, "Usage: ldns-dpa [OPTIONS] \n"); + fprintf(output, "Options:\n"); + fprintf(output, "\t-c :\tCount occurrences of matching expressions\n"); + fprintf(output, "\t-f :\tFilter occurrences of matching expressions\n"); + fprintf(output, "\t-h:\t\tshow this help\n"); + fprintf(output, "\t-p:\t\tshow percentage of -u and -c values (of the total of\n\t\t\tmatching on the -f filter. if no filter is given,\n\t\t\tpercentages are on all correct dns packets)\n"); + fprintf(output, "\t-of :\tWrite pcap packets that match the -f flag to file\n"); + fprintf(output, "\t-ofh :\tWrite pcap packets that match the -f flag to file\n\t\tin a hexadecimal format readable by drill\n"); + fprintf(output, "\t-s:\t\tshow possible match names\n"); + fprintf(output, "\t-s :\tshow possible match operators and values for \n"); + fprintf(output, "\t-sf:\t\tPrint packet that match -f. If no -f is given, print\n\t\t\tall dns packets\n"); + fprintf(output, "\t-u :\tCount all occurrences of matchname\n"); + fprintf(output, "\t-ua:\t\tShow average value of every -u matchname\n"); + fprintf(output, "\t-uac:\t\tShow average count of every -u matchname\n"); + fprintf(output, "\t-um :\tOnly show -u results that occured more than number times\n"); + fprintf(output, "\t-v :\tbe more verbose\n"); + fprintf(output, "\t-notip :\tDump pcap packets that were not recognized as\n\t\t\tIP packets to file\n"); + fprintf(output, "\t-baddns :\tDump mangled dns packets to file\n"); + fprintf(output, "\t-version:\tShow the version and exit\n"); + fprintf(output, "\n"); + fprintf(output, "The filename '-' stands for stdin or stdout, so you can use \"-of -\" if you want to pipe the output to another process\n"); + fprintf(output, "\n"); + fprintf(output, "A is a comma separated list of items\n"); + fprintf(output, "\n"); + fprintf(output, "An expression has the following form:\n"); + fprintf(output, ":\t()\n"); + fprintf(output, "\t | \n"); + fprintf(output, "\t & \n"); + fprintf(output, "\t\n"); + fprintf(output, "\n"); + fprintf(output, ":\t \n"); + fprintf(output, "\n"); + fprintf(output, "See the -s option for possible matchnames, operators and values.\n"); +} + +void +show_match_names(char *name) +{ + size_t j; + match_table *mt; + ldns_lookup_table *lt; + const type_operators *tos; + char *str; + size_t i; + + if (name) { + mt = get_match_by_name(name); + if (mt) { + printf("%s:\n", mt->name); + printf("\t%s.\n", mt->description); + printf("\toperators: "); + printf("\t"); + tos = get_type_operators(mt->type); + if (tos) { + for (j = 0; j < tos->operator_count; j++) { + printf("%s ", get_op_str(tos->operators[j])); +/* + lt = ldns_lookup_by_id((ldns_lookup_table *) lt_operators, tos->operators[j]); + if (lt) { + printf("%s ", lt->name); + } else { + printf("? "); + } +*/ + } + } else { + printf("unknown type"); + } + + printf("\n"); + printf("\tValues:\n"); + switch (mt->type) { + case TYPE_INT: + printf("\t\t\n"); + break; + case TYPE_BOOL: + printf("\t\t0\n"); + printf("\t\t1\n"); + printf("\t\ttrue\n"); + printf("\t\tfalse\n"); + break; + case TYPE_OPCODE: + printf("\t\t\n"); + lt = ldns_opcodes; + while (lt->name != NULL) { + printf("\t\t%s\n", lt->name); + lt++; + } + break; + case TYPE_RCODE: + printf("\t\t\n"); + lt = ldns_rcodes; + while (lt->name != NULL) { + printf("\t\t%s\n", lt->name); + lt++; + } + break; + case TYPE_STRING: + printf("\t\t\n"); + break; + case TYPE_TIMESTAMP: + printf("\t\t (seconds since epoch)\n"); + break; + case TYPE_ADDRESS: + printf("\t\t\n"); + break; + case TYPE_RR: + printf("\t\t\n"); + break; + default: + break; + } + } else { + printf("Unknown match name: %s\n", name); + } + } else { + mt = (match_table *) matches; + while (mt->name != NULL) { + str = (char *) mt->name; + printf("%s:", str); + i = strlen(str) + 1; + while (i < 24) { + printf(" "); + i++; + } + printf("%s\n", mt->description); + mt++; + } + } +} + +int +handle_ether_packet(const u_char *data, struct pcap_pkthdr cur_hdr, match_counters *count, match_expression *match_expr, match_counters *uniques, match_id unique_ids[], size_t unique_id_count) +{ + struct ether_header *eptr; + struct ip *iptr; + struct ip6_hdr *ip6_hdr; + int ip_hdr_size; + uint8_t protocol; + size_t data_offset = 0; + ldns_rdf *src_addr, *dst_addr; + uint8_t *ap; + char *astr; + bpf_u_int32 len = cur_hdr.caplen; + struct timeval timestamp; + uint16_t ip_flags; + uint16_t ip_len; + uint16_t ip_id; + uint16_t ip_f_offset; + const u_char *newdata = NULL; +/* +printf("timeval: %u ; %u\n", cur_hdr.ts.tv_sec, cur_hdr.ts.tv_usec); +*/ + + uint8_t *dnspkt; + + ldns_pkt *pkt; + ldns_status status; + + /* lets start with the ether header... */ + eptr = (struct ether_header *) data; + /* Do a couple of checks to see what packet type we have..*/ + if (ntohs (eptr->ether_type) == ETHERTYPE_IP) + { + if (verbosity >= 5) { + printf("Ethernet type hex:%x dec:%u is an IP packet\n", + (unsigned int) ntohs(eptr->ether_type), + (unsigned int) ntohs(eptr->ether_type)); + } + + data_offset = ETHER_HEADER_LENGTH; + iptr = (struct ip *) (data + data_offset); + /* + printf("IP_OFF: %u (%04x) %04x %04x (%d) (%d)\n", iptr->ip_off, iptr->ip_off, IP_MF, IP_DF, iptr->ip_off & 0x4000, iptr->ip_off & 0x2000); + */ + ip_flags = ldns_read_uint16(&(iptr->ip_off)); + ip_id = ldns_read_uint16(&(iptr->ip_id)); + ip_len = ldns_read_uint16(&(iptr->ip_len)); + ip_f_offset = (ip_flags & IP_OFFMASK)*8; + if (ip_flags & IP_MF && ip_f_offset == 0) { + /*printf("First Frag id %u len\n", ip_id, ip_len);*/ + fragment_p->ip_id = ip_id; + memset(fragment_p->data, 0, 65535); + memcpy(fragment_p->data, iptr, ip_len); + fragment_p->cur_len = ip_len + 20; +/* + for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", ip_len - 19, ip_len); + } + printf("%02x ", fragment_p->data[ip_len]); + } + printf("\t; ??? - %u\n", ip_len); +*/ + return 0; + } else + if (ip_flags & IP_MF && ip_f_offset != 0) { + /*printf("Next frag\n");*/ + if (ip_id == fragment_p->ip_id) { + /*printf("add fragment to current id %u len %u offset %u\n", ip_id, ip_len, ip_f_offset);*/ + memcpy(fragment_p->data + (ip_f_offset) + 20, data+data_offset+20, ip_len - (iptr->ip_hl)*4); + /*printf("COPIED %u\n", ip_len);*/ + fragment_p->cur_len = fragment_p->cur_len + ip_len - 20; + /*printf("cur len now %u\n", fragment_p->cur_len);*/ +/* + for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", ip_len - 19, ip_len); + } + printf("%02x ", fragment_p->data[ip_len]); + } + printf("\t; ??? - %u\n", ip_len); +*/ + return 0; + } else { + /*printf("Lost fragment %u\n", iptr->ip_id);*/ + lost_packet_fragments++; + return 1; + } + } else + if (!(ip_flags & IP_MF) && ip_f_offset != 0) { + /*printf("Last frag\n");*/ + if (ip_id == fragment_p->ip_id) { + /*printf("add fragment to current id %u len %u offset %u\n", ip_id, ip_len, ip_f_offset);*/ + memcpy(fragment_p->data + ip_f_offset + 20, data+data_offset+20, ip_len - 20); + fragment_p->cur_len = fragment_p->cur_len + ip_len - 20; + iptr = (struct ip *) fragment_p->data; + newdata = malloc(fragment_p->cur_len + data_offset); + if (!newdata) { + printf("Malloc failed, out of mem?\n"); + exit(4); + } + memcpy((char *) newdata, data, data_offset); + memcpy((char *) newdata+data_offset, fragment_p->data, fragment_p->cur_len); + iptr->ip_len = (u_short) ldns_read_uint16(&(fragment_p->cur_len)); + iptr->ip_off = 0; + len = (bpf_u_int32) fragment_p->cur_len; + cur_hdr.caplen = len; + fragment_p->ip_id = 0; + fragmented_packets++; +/* + for (ip_len = 0; ip_len < fragment_p->cur_len; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", ip_len - 19, ip_len); + } + printf("%02x ", fragment_p->data[ip_len]); + } + printf("\t; ??? - %u\n", ip_len); +*/ + } else { + /*printf("Lost fragment %u\n", iptr->ip_id);*/ + lost_packet_fragments++; + return 1; + } + } else { + newdata = data; + } +/* + if (iptr->ip_off & 0x0040) { + printf("Don't fragment\n"); + } +*/ + + /* in_addr portability woes, going manual for now */ + /* ipv4 */ + ap = (uint8_t *) &(iptr->ip_src); + astr = malloc(INET_ADDRSTRLEN); + if (inet_ntop(AF_INET, ap, astr, INET_ADDRSTRLEN)) { + if (ldns_str2rdf_a(&src_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + ap = (uint8_t *) &(iptr->ip_dst); + astr = malloc(INET_ADDRSTRLEN); + if (inet_ntop(AF_INET, ap, astr, INET_ADDRSTRLEN)) { + if (ldns_str2rdf_a(&dst_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + + ip_hdr_size = (int) iptr->ip_hl * 4; + protocol = (uint8_t) iptr->ip_p; + + data_offset += ip_hdr_size; + + if (protocol == IPPROTO_UDP) { + udp_packets++; + data_offset += UDP_HEADER_LENGTH; + + dnspkt = (uint8_t *) (newdata + data_offset); + + /*printf("packet starts at byte %u\n", data_offset);*/ + + /*printf("Len: %u\n", len);*/ + + status = ldns_wire2pkt(&pkt, dnspkt, len - data_offset); + + if (status != LDNS_STATUS_OK) { + if (verbosity >= 3) { + printf("No dns packet: %s\n", ldns_get_errorstr_by_id(status)); + } + if (verbosity >= 5) { + for (ip_len = 0; ip_len < len - data_offset; ip_len++) { + if (ip_len > 0 && ip_len % 20 == 0) { + printf("\t; %u - %u\n", (unsigned int) ip_len - 19, (unsigned int) ip_len); + } + printf("%02x ", (unsigned int) dnspkt[ip_len]); + } + printf("\t; ??? - %u\n", (unsigned int) ip_len); + + } + bad_dns_packets++; + if (bad_dns_dump) { + pcap_dump((u_char *)bad_dns_dump, &cur_hdr, newdata); + } + } else { + timestamp.tv_sec = cur_hdr.ts.tv_sec; + timestamp.tv_usec = cur_hdr.ts.tv_usec; + ldns_pkt_set_timestamp(pkt, timestamp); + + if (verbosity >= 4) { + printf("DNS packet\n"); + ldns_pkt_print(stdout, pkt); + printf("\n\n"); + } + + total_nr_of_dns_packets++; + + if (match_expr) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, match_expr)) { + /* if outputfile write */ + if (dumper) { + pcap_dump((u_char *)dumper, &cur_hdr, data); + } + if (hexdumpfile) { + fprintf(hexdumpfile, ";; %u\n", (unsigned int) total_nr_of_dns_packets); + ldns_pkt2file_hex(hexdumpfile, pkt); + } + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } else { + ldns_pkt_free(pkt); + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + return 0; + } + } else { + if (dumper) { + pcap_dump((u_char *)dumper, &cur_hdr, data); + } + if (hexdumpfile) { + fprintf(hexdumpfile, ";; %u\n", (unsigned int) total_nr_of_dns_packets); + ldns_pkt2file_hex(hexdumpfile, pkt); + } + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } + + /* General counters here */ + total_nr_of_filtered_packets++; + + match_pkt_counters(pkt, src_addr, dst_addr, count); + match_pkt_uniques(pkt, src_addr, dst_addr, uniques, unique_ids, unique_id_count); + + ldns_pkt_free(pkt); + pkt = NULL; + } + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + + } else if (protocol == IPPROTO_TCP) { + /* tcp packets are skipped */ + tcp_packets++; + } + /* don't have a define for ethertype ipv6 */ + } else if (ntohs (eptr->ether_type) == ETHERTYPE_IPV6) { + /*printf("IPv6!\n");*/ + + + /* copied from ipv4, move this to function? */ + + data_offset = ETHER_HEADER_LENGTH; + ip6_hdr = (struct ip6_hdr *) (data + data_offset); + + newdata = data; + + /* in_addr portability woes, going manual for now */ + /* ipv6 */ + ap = (uint8_t *) &(ip6_hdr->ip6_src); + astr = malloc(INET6_ADDRSTRLEN); + if (inet_ntop(AF_INET6, ap, astr, INET6_ADDRSTRLEN)) { + if (ldns_str2rdf_aaaa(&src_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + ap = (uint8_t *) &(ip6_hdr->ip6_dst); + astr = malloc(INET6_ADDRSTRLEN); + if (inet_ntop(AF_INET6, ap, astr, INET6_ADDRSTRLEN)) { + if (ldns_str2rdf_aaaa(&dst_addr, astr) == LDNS_STATUS_OK) { + + } + free(astr); + } + + ip_hdr_size = IP6_HEADER_LENGTH; + protocol = (uint8_t) ip6_hdr->ip6_ctlun.ip6_un1.ip6_un1_nxt; + + data_offset += ip_hdr_size; + + if (protocol == IPPROTO_UDP) { + udp_packets++; + /*printf("V6 UDP!\n");*/ + data_offset += UDP_HEADER_LENGTH; + + dnspkt = (uint8_t *) (newdata + data_offset); + + /*printf("Len: %u\n", len);*/ + + status = ldns_wire2pkt(&pkt, dnspkt, len - data_offset); + + if (status != LDNS_STATUS_OK) { + if (verbosity >= 3) { + printf("No dns packet: %s\n", ldns_get_errorstr_by_id(status)); + } + bad_dns_packets++; + if (bad_dns_dump) { + pcap_dump((u_char *)bad_dns_dump, &cur_hdr, newdata); + } + } else { + timestamp.tv_sec = cur_hdr.ts.tv_sec; + timestamp.tv_usec = cur_hdr.ts.tv_usec; + ldns_pkt_set_timestamp(pkt, timestamp); + + if (verbosity >= 4) { + printf("DNS packet\n"); + ldns_pkt_print(stdout, pkt); + printf("\n\n"); + } + + total_nr_of_dns_packets++; + + if (match_expr) { + if (match_dns_packet_to_expr(pkt, src_addr, dst_addr, match_expr)) { + /* if outputfile write */ + if (dumper) { + pcap_dump((u_char *)dumper, &cur_hdr, data); + } + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } else { + ldns_pkt_free(pkt); + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + return 0; + } + } else { + if (show_filter_matches) { + printf(";; From: "); + ldns_rdf_print(stdout, src_addr); + printf("\n"); + printf(";; To: "); + ldns_rdf_print(stdout, dst_addr); + printf("\n"); + ldns_pkt_print(stdout, pkt); + printf("------------------------------------------------------------\n\n"); + } + } + + /* General counters here */ + total_nr_of_filtered_packets++; + + match_pkt_counters(pkt, src_addr, dst_addr, count); + match_pkt_uniques(pkt, src_addr, dst_addr, uniques, unique_ids, unique_id_count); + + ldns_pkt_free(pkt); + pkt = NULL; + } + ldns_rdf_deep_free(src_addr); + ldns_rdf_deep_free(dst_addr); + + } else if (protocol == IPPROTO_TCP) { + /* tcp packets are skipped */ + tcp_packets++; + } else { + printf("ipv6 unknown next header type: %u\n", (unsigned int) protocol); + } + + + + } else if (ntohs (eptr->ether_type) == ETHERTYPE_ARP) { + if (verbosity >= 5) { + printf("Ethernet type hex:%x dec:%u is an ARP packet\n", + (unsigned int) ntohs(eptr->ether_type), + (unsigned int) ntohs(eptr->ether_type)); + } + arp_packets++; + } else { + printf("Ethernet type %x not IP\n", (unsigned int) ntohs(eptr->ether_type)); + if (verbosity >= 5) { + printf("Ethernet type %x not IP\n", (unsigned int) ntohs(eptr->ether_type)); + } + not_ip_packets++; + if (not_ip_dump) { + pcap_dump((u_char *)not_ip_dump, &cur_hdr, data); + } + } + + return 0; +} + +bool +parse_match_list(match_counters *counters, char *string) +{ + size_t i; + match_expression *expr; +/* match_counter *mc;*/ + size_t lastpos = 0; + char *substring; + + /*printf("Parsing match list: '%s'\n", string);*/ + + for (i = 0; i < strlen(string); i++) { + if (string[i] == ',') { + if (i<2) { + fprintf(stderr, "Matchlist cannot start with ,\n"); + return false; + } else { + substring = malloc(strlen(string)+1); + strncpy(substring, &string[lastpos], i - lastpos + 1); + substring[i - lastpos] = '\0'; + expr = parse_match_expression(substring); + if (!expr) { + return false; + } + free(substring); + /* + if (expr->op != MATCH_EXPR_LEAF) { + fprintf(stderr, "Matchlist can only contain , not a logic expression\n"); + return false; + } + */ + add_match_counter(counters, expr, false); + lastpos = i+1; + } + } + } + substring = malloc(strlen(string) + 1); + strncpy(substring, &string[lastpos], i - lastpos + 1); + substring[i - lastpos] = '\0'; + expr = parse_match_expression(substring); + + if (!expr) { + fprintf(stderr, "Bad match: %s\n", substring); + return false; + } + free(substring); + /* + if (expr->op != MATCH_EXPR_LEAF) { + fprintf(stderr, "Matchlist can only contain , not a logic expression\n"); + return false; + } + */ + add_match_counter(counters, expr, false); + return true; +} + +bool +parse_uniques(match_id ids[], size_t *count, char *string) +{ + size_t i, j, lastpos; + char *str, *strpart; + match_table *mt; + + /*printf("Parsing unique counts: '%s'\n", string);*/ + str = malloc(strlen(string) + 1); + j = 0; + for (i = 0; i < strlen(string); i++) { + if (!isspace(string[i])) { + str[j] = string[i]; + j++; + } + } + str[j] = '\0'; + + lastpos = 0; + for (i = 0; i <= strlen(str); i++) { + if (str[i] == ',' || i >= strlen(str)) { + strpart = malloc(i - lastpos + 1); + strncpy(strpart, &str[lastpos], i - lastpos); + strpart[i - lastpos] = '\0'; + if ((mt = get_match_by_name(strpart))) { + ids[*count] = mt->id; + *count = *count + 1; + } else { + printf("Error parsing match list; unknown match name: %s\n", strpart); + return false; + } + free(strpart); + lastpos = i + 1; + } + } + if (i > lastpos) { + strpart = malloc(i - lastpos + 1); + strncpy(strpart, &str[lastpos], i - lastpos); + strpart[i - lastpos] = '\0'; + if ((mt = get_match_by_name(strpart))) { + ids[*count] = mt->id; + *count = *count + 1; + } else { + printf("Error parsing match list; unknown match name: %s\n", strpart); + return false; + } + free(strpart); + lastpos = i + 1; + } + free(str); + return true; +} + +int main(int argc, char *argv[]) { + + int i; + int status = EXIT_SUCCESS; + match_counters *count = malloc(sizeof(match_counters)); + const char *inputfile = NULL; + char errbuf[PCAP_ERRBUF_SIZE]; + pcap_t *pc = NULL; + const u_char *cur; + struct pcap_pkthdr cur_hdr; + match_expression *expr = NULL; + match_id unique_ids[MAX_MATCHES]; + size_t unique_id_count = 0; /* number of unique counters */ + match_counters *uniques = malloc(sizeof(match_counters)); + char *dumpfile = NULL; + char *hexdumpfilename = NULL; + char *not_ip_dumpfile = NULL; + char *bad_dns_dumpfile = NULL; + + bool show_percentages = false; + bool show_averages = false; + bool show_average_count = false; + int unique_minimum = 0; + + count->left = NULL; + count->match = NULL; + count->right = NULL; + uniques->left = NULL; + uniques->match = NULL; + uniques->right = NULL; + + fragment_p = malloc(sizeof(struct fragment_part)); + fragment_p->ip_id = 0; + fragment_p->cur_len = 0; + + for (i = 1; i < argc; i++) { + + if (strncmp(argv[i], "-baddns", 8) == 0) { + if (i + 1 < argc) { + bad_dns_dumpfile = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-notip", 7) == 0) { + if (i + 1 < argc) { + not_ip_dumpfile = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-c", 3) == 0) { + if (i + 1 < argc) { + if (!parse_match_list(count, argv[i + 1])) { + status = EXIT_FAILURE; + goto exit; + } + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-f", 3) == 0) { + if (i + 1 < argc) { + if (expr || strchr(argv[i+1], ',')) { + fprintf(stderr, "You can only specify 1 filter expression.\n"); + status = EXIT_FAILURE; + goto exit; + } + expr = parse_match_expression(argv[i + 1]); + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-h", 3) == 0) { + usage(stdout); + status = EXIT_SUCCESS; + goto exit; + } else if (strncmp(argv[i], "-p", 3) == 0) { + show_percentages = true; + } else if (strncmp(argv[i], "-of", 4) == 0) { + if (i + 1 < argc) { + dumpfile = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-ofh", 5) == 0) { + if (i + 1 < argc) { + hexdumpfilename = argv[i + 1]; + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strncmp(argv[i], "-s", 3) == 0) { + if (i + 1 < argc) { + show_match_names(argv[i + 1]); + } else { + show_match_names(NULL); + } + status = EXIT_SUCCESS; + goto exit; + } else if (strncmp(argv[i], "-sf", 4) == 0) { + show_filter_matches = true; + } else if (strncmp(argv[i], "-u", 3) == 0) { + if (i + 1 < argc) { + if (!parse_uniques(unique_ids, &unique_id_count, argv[i + 1])) { + status = EXIT_FAILURE; + goto exit; + } + i++; + } else { + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strcmp("-ua", argv[i]) == 0) { + show_averages = true; + } else if (strcmp("-uac", argv[i]) == 0) { + show_average_count = true; + } else if (strcmp("-um", argv[i]) == 0) { + if (i + 1 < argc) { + unique_minimum = atoi(argv[i+1]); + i++; + } else { + fprintf(stderr, "-um requires an argument"); + usage(stderr); + status = EXIT_FAILURE; + goto exit; + } + } else if (strcmp("-v", argv[i]) == 0) { + i++; + if (i < argc) { + verbosity = atoi(argv[i]); + } + } else if (strcmp("-version", argv[i]) == 0) { + printf("dns packet analyzer, version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); + goto exit; + } else { + if (inputfile) { + fprintf(stderr, "You can only specify 1 input file\n"); + exit(1); + } + inputfile = argv[i]; + } + } + + if (!inputfile) { + inputfile = "-"; + } + + if (verbosity >= 5) { + printf("Filter:\n"); + print_match_expression(stdout, expr); + printf("\n\n"); + } + + pc = pcap_open_offline(inputfile, errbuf); + + if (!pc) { + if (errno != 0) { + printf("Error opening pcap file %s: %s\n", inputfile, errbuf); + exit(1); + } else { + goto showresult; + } + } + + if (dumpfile) { + dumper = pcap_dump_open(pc, dumpfile); + + if (!dumper) { + printf("Error opening pcap dump file %s: %s\n", dumpfile, errbuf); + exit(1); + } + } + + if (hexdumpfilename) { + if (strncmp(hexdumpfilename, "-", 2) != 0) { + printf("hexdump is file\n"); + hexdumpfile = fopen(hexdumpfilename, "w"); + } else { + printf("hexdump is stdout\n"); + hexdumpfile = stdout; + } + + if (!hexdumpfile) { + printf("Error opening hex dump file %s: %s\n", hexdumpfilename, strerror(errno)); + exit(1); + } + } + + if (not_ip_dumpfile) { + not_ip_dump = pcap_dump_open(pc, not_ip_dumpfile); + if (!not_ip_dump) { + printf("Error opening pcap dump file NOT_IP: %s\n", errbuf); + } + } + if (bad_dns_dumpfile) { + bad_dns_dump = pcap_dump_open(pc, bad_dns_dumpfile); + if (!bad_dns_dump) { + printf("Error opening pcap dump file NOT_IP: %s\n", errbuf); + } + } + + while ((cur = pcap_next(pc, &cur_hdr))) { + if (verbosity >= 5) { + printf("\n\n\n[PKT_HDR] caplen: %u \tlen: %u\n", cur_hdr.caplen, cur_hdr.len); + } + handle_ether_packet(cur, cur_hdr, count, expr, uniques, unique_ids, unique_id_count); + } + + if (not_ip_dump) { + pcap_dump_close(not_ip_dump); + } + + if (bad_dns_dump) { + pcap_dump_close(bad_dns_dump); + } + + if (dumper) { + pcap_dump_close(dumper); + } + + if (hexdumpfile && hexdumpfile != stdout) { + fclose(hexdumpfile); + } + + pcap_close(pc); + + showresult: + if (show_percentages) { + fprintf(stdout, "Packets that are not IP: %u\n", (unsigned int) not_ip_packets); + fprintf(stdout, "bad dns packets: %u\n", (unsigned int) bad_dns_packets); + fprintf(stdout, "arp packets: %u\n", (unsigned int) arp_packets); + fprintf(stdout, "udp packets: %u\n", (unsigned int) udp_packets); + fprintf(stdout, "tcp packets (skipped): %u\n", (unsigned int) tcp_packets); + fprintf(stdout, "reassembled fragmented packets: %u\n", (unsigned int) fragmented_packets); + fprintf(stdout, "packet fragments lost: %u\n", (unsigned int) lost_packet_fragments); + fprintf(stdout, "Total number of DNS packets: %u\n", (unsigned int) total_nr_of_dns_packets); + fprintf(stdout, "Total number of DNS packets after filter: %u\n", (unsigned int) total_nr_of_filtered_packets); + } + if (count->match) { + print_counters(stdout, count, show_percentages, total_nr_of_filtered_packets, 0); + } + if (uniques->match) { + print_counters(stdout, uniques, show_percentages, total_nr_of_filtered_packets, unique_minimum); + if (show_averages) { + print_counter_averages(stdout, uniques, NULL); + } + if (show_average_count) { + print_counter_average_count(stdout, uniques, NULL, true); + } + } + + exit: + + free_match_expression(expr); + free_counters(count); + free_counters(uniques); + + return status; +} + +#else +int main() { + fprintf(stderr, "ldns-dpa was not built because there is no pcap library on this system, or there was no pcap header file at compilation time. Please install pcap and rebuild.\n"); + return 1; +} +#endif +#else +int main() { + fprintf(stderr, "ldns-dpa was not built because there is no pcap library on this system, or there was no pcap header file at compilation time. Please install pcap and rebuild.\n"); + return 1; +} +#endif + + diff --git a/libs/ldns/examples/ldns-key2ds.1 b/libs/ldns/examples/ldns-key2ds.1 new file mode 100644 index 0000000000..6fdbee5f1a --- /dev/null +++ b/libs/ldns/examples/ldns-key2ds.1 @@ -0,0 +1,41 @@ +.TH ldns-key2ds 1 "30 May 2005" +.SH NAME +ldns-key2ds \- transform a DNSKEY RR to a DS RR +.SH SYNOPSIS +.B ldns-key2ds +.IR file + +.SH DESCRIPTION +\fBldns-key2ds\fR is used to transform a public DNSKEY RR to a DS RR. +When run it will read \fIfile\fR with a DNSKEY RR in it and +it will create a .ds file with the DS RR in it. + +It prints out the basename for this file (K++). + +By default it takes a pick of algorithm similar to the key algorithm, +SHA1 for RSASHA1, and so on. + +.SH OPTIONS +.TP +\fB-n\fR +Write the result DS Resource Record to stdout instead of a file + +.TP +\fB-1\fR +Use SHA1 as the hash function. + +.TP +\fB-2\fR +Use SHA256 as the hash function + + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-key2ds.c b/libs/ldns/examples/ldns-key2ds.c new file mode 100644 index 0000000000..a3e54383ab --- /dev/null +++ b/libs/ldns/examples/ldns-key2ds.c @@ -0,0 +1,199 @@ +/* + * key2ds transforms a public key into its DS + * It (currently) prints out the public key + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +#include + +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s [-fn] [-1|-2] keyfile\n", prog); + fprintf(fp, " Generate a DS RR from the DNSKEYS in keyfile\n"); + fprintf(fp, " The following file will be created: "); + fprintf(fp, "K++.ds\n"); + fprintf(fp, " The base name (K++ will be printed to stdout\n"); + fprintf(fp, "Options:\n"); + fprintf(fp, " -f: ignore SEP flag (i.e. make DS records for any key)\n"); + fprintf(fp, " -n: do not write DS records to file(s) but to stdout\n"); + fprintf(fp, " (default) use similar hash to the key algorithm.\n"); + fprintf(fp, " -1: use SHA1 for the DS hash\n"); + fprintf(fp, " -2: use SHA256 for the DS hash\n"); +#ifdef USE_GOST + fprintf(fp, " -g: use GOST for the DS hash\n"); +#endif +#ifdef USE_ECDSA + fprintf(fp, " -4: use SHA384 for the DS hash\n"); +#endif +} + +static int +is_suitable_dnskey(ldns_rr *rr, int sep_only) +{ + if (!rr || ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY) { + return 0; + } + return !sep_only || + (ldns_rdf2native_int16(ldns_rr_dnskey_flags(rr)) & + LDNS_KEY_SEP_KEY); +} + +static ldns_hash +suitable_hash(ldns_signing_algorithm algorithm) +{ + switch (algorithm) { + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + return LDNS_SHA256; + case LDNS_SIGN_ECC_GOST: +#ifdef USE_GOST + return LDNS_HASH_GOST; +#else + return LDNS_SHA256; +#endif +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + return LDNS_SHA256; + case LDNS_SIGN_ECDSAP384SHA384: + return LDNS_SHA384; +#endif + default: + return LDNS_SHA1; + } + return LDNS_SHA1; +} + +int +main(int argc, char *argv[]) +{ + FILE *keyfp, *dsfp; + char *keyname; + char *dsname; + char *owner; + ldns_rr *k, *ds; + ldns_signing_algorithm alg; + ldns_hash h; + int similar_hash=1; + char *program = argv[0]; + int nofile = 0; + ldns_rdf *origin = NULL; + ldns_status result = LDNS_STATUS_OK; + int sep_only = 1; + + alg = 0; + h = LDNS_SHA1; + + argv++, argc--; + while (argc && argv[0][0] == '-') { + if (strcmp(argv[0], "-1") == 0) { + h = LDNS_SHA1; + similar_hash = 0; + } + if (strcmp(argv[0], "-2") == 0) { + h = LDNS_SHA256; + similar_hash = 0; + } +#ifdef USE_GOST + if (strcmp(argv[0], "-g") == 0) { + if(!ldns_key_EVP_load_gost_id()) { + fprintf(stderr, "error: libcrypto does not provide GOST\n"); + exit(EXIT_FAILURE); + } + h = LDNS_HASH_GOST; + similar_hash = 0; + } +#endif +#ifdef USE_ECDSA + if (strcmp(argv[0], "-4") == 0) { + h = LDNS_SHA384; + similar_hash = 0; + } +#endif + if (strcmp(argv[0], "-f") == 0) { + sep_only = 0; + } + if (strcmp(argv[0], "-n") == 0) { + nofile=1; + } + argv++, argc--; + } + + if (argc != 1) { + usage(stderr, program); + exit(EXIT_FAILURE); + } + keyname = strdup(argv[0]); + + keyfp = fopen(keyname, "r"); + if (!keyfp) { + fprintf(stderr, "Failed to open public key file %s: %s\n", keyname, + strerror(errno)); + exit(EXIT_FAILURE); + } + + while (result == LDNS_STATUS_OK) { + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + while (result == LDNS_STATUS_SYNTAX_ORIGIN || + result == LDNS_STATUS_SYNTAX_TTL || + (result == LDNS_STATUS_OK && !is_suitable_dnskey(k, sep_only)) + ) { + if (result == LDNS_STATUS_OK) { + ldns_rr_free(k); + } + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + } + if (result == LDNS_STATUS_SYNTAX_EMPTY) { + /* we're done */ + break; + } + if (result != LDNS_STATUS_OK) { + fprintf(stderr, "Could not read public key from file %s: %s\n", keyname, ldns_get_errorstr_by_id(result)); + exit(EXIT_FAILURE); + } + + owner = ldns_rdf2str(ldns_rr_owner(k)); + alg = ldns_rdf2native_int8(ldns_rr_dnskey_algorithm(k)); + if(similar_hash) + h = suitable_hash(alg); + + ds = ldns_key_rr2ds(k, h); + if (!ds) { + fprintf(stderr, "Conversion to a DS RR failed\n"); + ldns_rr_free(k); + free(owner); + exit(EXIT_FAILURE); + } + + /* print the public key RR to .key */ + dsname = LDNS_XMALLOC(char, strlen(owner) + 16); + snprintf(dsname, strlen(owner) + 15, "K%s+%03u+%05u.ds", owner, alg, (unsigned int) ldns_calc_keytag(k)); + + if (nofile) + ldns_rr_print(stdout,ds); + else { + dsfp = fopen(dsname, "w"); + if (!dsfp) { + fprintf(stderr, "Unable to open %s: %s\n", dsname, strerror(errno)); + exit(EXIT_FAILURE); + } else { + ldns_rr_print(dsfp, ds); + fclose(dsfp); + fprintf(stdout, "K%s+%03u+%05u\n", owner, alg, (unsigned int) ldns_calc_keytag(k)); + } + } + + ldns_rr_free(ds); + ldns_rr_free(k); + free(owner); + LDNS_FREE(dsname); + } + fclose(keyfp); + free(keyname); + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-keyfetcher.1 b/libs/ldns/examples/ldns-keyfetcher.1 new file mode 100644 index 0000000000..6ddc14eacf --- /dev/null +++ b/libs/ldns/examples/ldns-keyfetcher.1 @@ -0,0 +1,64 @@ +.TH ldns-keyfetcher 1 "4 Apr 2006" +.SH NAME +ldns-keyfetcher \- retrieve the DNSSEC DNSKEYs for a zone +.SH SYNOPSIS +.B ldns-keyfetcher +[ +.IR OPTIONS +] +.IR DOMAIN + +.SH DESCRIPTION +\fBldns-keyfetcher\fR is used to retrieve the DNSKEYs of a zone. + +First it finds all authoritative nameservers of the zone by tracing it from +the root down. All authoritative nameservers are then queried (using TCP) +for the DNSKEY RRset of the zone apex. If the results are all the same, +the key resource record set is printed. + + +.SH OPTIONS +\fB-4\fR \fI\fR +Only use IPv4 + +\fB-6\fR \fI\fR +Only use IPv6 + +\fB-h\fR \fI\fR +Show a help text and exit + +\fB-i\fR +Insecurer mode; there will only be one query for the DNSKEYS. There will not +be crosschecking of all authoritative nameservers. + +\fB-v\fR \fIverbosity\fR + +Set the verbosity level. The following levels are available: + + 0: default, only print the DNSKEY RRset found, or an error on failure. + 1: Show the nameservers that are queried + 2: Show more info on what is checked + 3: Show the intermediate results (authority and dnskey rrsets) + 4: Print the answer packets that are returned + +\fB-r\fR \fIfile\fR + +Use file as the root hints file, should contain A records in presentation +format. The default is /etc/named.root. You can get this file from +http://www.internic.net/zones/named.root. + +\fB-s\fR \fI\fR +Don't print the keys to stdout, but store them in files. + +The filenames will be of the format K.+.+.key + +.SH AUTHOR +Written by Jelte Jansen for NLnet Labs. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2006 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-keyfetcher.c b/libs/ldns/examples/ldns-keyfetcher.c new file mode 100644 index 0000000000..c24f5111fe --- /dev/null +++ b/libs/ldns/examples/ldns-keyfetcher.c @@ -0,0 +1,724 @@ +/* + * ldns-keyfetcher retrieves the DNSKEYS for a certain domain + * It traces the authoritatives nameservers down from the root + * And uses TCP, to minimize spoofing danger. + * + * (c) NLnet Labs, 2006 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include + +int verbosity = 0; +/* 0=use both ip4 and ip6 (default). 1=ip4only. 2=ip6only. */ +uint8_t address_family = 0; +bool store_in_file = false; + +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s domain\n", prog); + fprintf(fp, " retrieve the dnskeys for a domain\n"); + fprintf(fp, "Options:\n"); + fprintf(fp, "-4\t\tUse IPv4 only\n"); + fprintf(fp, "-6\t\tUse IPv6 only\n"); + fprintf(fp, "-h\t\tShow this help\n"); + fprintf(fp, "-i\t\tInsecurer mode; don't do checks, just query for the keys\n"); + fprintf(fp, "-r \tUse file to read root hints from\n"); + fprintf(fp, "-s\t\tDon't print the keys but store them in files\n\t\tcalled K.+.+.key\n"); + fprintf(fp, "-v \tVerbosity level (0-5, not verbose-very verbose)\n"); +} + +static ldns_rr_list * +retrieve_dnskeys(ldns_resolver *local_res, ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c, ldns_rr_list *dns_root) +{ + ldns_resolver *res; + ldns_pkt *p; + ldns_rr_list *new_nss_a; + ldns_rr_list *new_nss_aaaa; + ldns_rr_list *final_answer; + ldns_rr_list *new_nss; + ldns_rr_list *ns_addr; + ldns_rr_list *ns_addr2; + uint16_t loop_count; + ldns_rdf *pop; + ldns_status status; + size_t i; + + size_t nss_i; + ldns_rr_list *answer_list = NULL; + ldns_rr_list *authority_list = NULL; + + size_t last_nameserver_count; + ldns_rdf **last_nameservers; + + loop_count = 0; + new_nss_a = NULL; + new_nss_aaaa = NULL; + new_nss = NULL; + ns_addr = NULL; + ns_addr2 = NULL; + final_answer = NULL; + p = ldns_pkt_new(); + res = ldns_resolver_new(); + + if (!p || !res) { + fprintf(stderr, "Memory allocation failed"); + return NULL; + } + + if (verbosity >= 2) { + printf("Finding dnskey data for zone: "); + ldns_rdf_print(stdout, name); + printf("\n\n"); + } + + /* transfer some properties of local_res to res, + * because they were given on the commandline */ + ldns_resolver_set_ip6(res, + ldns_resolver_ip6(local_res)); + ldns_resolver_set_port(res, + ldns_resolver_port(local_res)); + ldns_resolver_set_debug(res, + ldns_resolver_debug(local_res)); + ldns_resolver_set_dnssec(res, + ldns_resolver_dnssec(local_res)); + ldns_resolver_set_fail(res, + ldns_resolver_fail(local_res)); + ldns_resolver_set_usevc(res, + ldns_resolver_usevc(local_res)); + ldns_resolver_set_random(res, + ldns_resolver_random(local_res)); + ldns_resolver_set_recursive(res, false); + + /* setup the root nameserver in the new resolver */ + status = ldns_resolver_push_nameserver_rr_list(res, dns_root); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error setting root nameservers in resolver: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error querying root servers: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } + + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + /* from now on, use TCP */ + ldns_resolver_set_usevc(res, true); + + while(status == LDNS_STATUS_OK && + ldns_pkt_reply_type(p) == LDNS_PACKET_REFERRAL) { + + if (verbosity >= 3) { + printf("This is a delegation!\n\n"); + } + if (address_family == 0 || address_family == 1) { + new_nss_a = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_A, LDNS_SECTION_ADDITIONAL); + } else { + new_nss_a = ldns_rr_list_new(); + } + if (address_family == 0 || address_family == 2) { + new_nss_aaaa = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_AAAA, LDNS_SECTION_ADDITIONAL); + } else { + new_nss_aaaa = ldns_rr_list_new(); + } + new_nss = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_NS, LDNS_SECTION_AUTHORITY); + + /* remove the old nameserver from the resolver */ + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + /* also check for new_nss emptyness */ + + if (!new_nss_aaaa && !new_nss_a) { + /* + * no nameserver found!!! + * try to resolve the names we do got + */ + if (verbosity >= 3) { + printf("Did not get address record for nameserver, doing seperate query.\n"); + } + ns_addr = ldns_rr_list_new(); + for(i = 0; (size_t) i < ldns_rr_list_rr_count(new_nss); i++) { + /* get the name of the nameserver */ + pop = ldns_rr_rdf(ldns_rr_list_rr(new_nss, i), 0); + if (!pop) { + break; + } + + /* retrieve it's addresses */ + ns_addr2 = ldns_get_rr_list_addr_by_name(local_res, pop, c, 0); + if (!ldns_rr_list_cat(ns_addr, ns_addr2)) { + fprintf(stderr, "Internal error adding nameserver address.\n"); + exit(EXIT_FAILURE); + } + ldns_rr_list_free(ns_addr2); + } + + if (ns_addr) { + if (ldns_resolver_push_nameserver_rr_list(res, ns_addr) != + LDNS_STATUS_OK) { + fprintf(stderr, "Error adding new nameservers"); + ldns_pkt_free(p); + return NULL; + } + ldns_rr_list_deep_free(ns_addr); + } else { + ldns_rr_list_print(stdout, ns_addr); + fprintf(stderr, "Could not find the nameserver ip addr; abort"); + ldns_pkt_free(p); + return NULL; + } + } + + /* normally, the first working ns is used, but we need all now, so do it one by one + * if the answer is null, take it from the next resolver + * if the answer is not, compare it to that of the next resolver + * error if different, continue if the same + * if answer list null and no resolvers left die. + */ + + ldns_rr_list_deep_free(answer_list); + ldns_rr_list_deep_free(authority_list); + answer_list = NULL; + authority_list = NULL; + for (nss_i = 0; nss_i < ldns_rr_list_rr_count(new_nss_aaaa); nss_i++) { + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + if (verbosity >= 1) { + fprintf(stdout, "Querying nameserver: "); + ldns_rdf_print(stdout, ldns_rr_owner(ldns_rr_list_rr(new_nss_aaaa, nss_i))); + fprintf(stdout, " ("); + ldns_rdf_print(stdout, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); + fprintf(stdout, ")\n"); + } + status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_aaaa, nss_i), 0)); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + if (status == LDNS_STATUS_OK && p) { + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + if (answer_list) { + if (verbosity >= 2) { + printf("Comparing answer list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { + fprintf(stderr, "ERROR: different answer answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, answer_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_answer(p)); + exit(EXIT_FAILURE); + } + } else { + answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (verbosity >= 2) { + printf("First answer list for this set, nothing to compare with\n\n"); + } + } + if (authority_list) { + if (verbosity >= 2) { + printf("Comparing authority list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (ldns_rr_list_compare(authority_list, ldns_pkt_authority(p)) != 0) { + fprintf(stderr, "ERROR: different authority answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, authority_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_authority(p)); + exit(EXIT_FAILURE); + } + } else { + authority_list = ldns_rr_list_clone(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (verbosity >= 2) { + printf("First authority list for this set, nothing to compare with\n\n"); + } + if (verbosity >= 3) { + printf("NS RRset:\n"); + ldns_rr_list_print(stdout, authority_list); + printf("\n"); + } + } + } + } + + ldns_rr_list_deep_free(answer_list); + ldns_rr_list_deep_free(authority_list); + answer_list = NULL; + authority_list = NULL; + for (nss_i = 0; nss_i < ldns_rr_list_rr_count(new_nss_a); nss_i++) { + + while((pop = ldns_resolver_pop_nameserver(res))) {ldns_rdf_deep_free(pop); } + + if (verbosity >= 1) { + fprintf(stdout, "Querying nameserver: "); + ldns_rdf_print(stdout, ldns_rr_owner(ldns_rr_list_rr(new_nss_a, nss_i))); + fprintf(stdout, " ("); + ldns_rdf_print(stdout, ldns_rr_rdf(ldns_rr_list_rr(new_nss_a, nss_i), 0)); + fprintf(stdout, ")\n"); + } + status = ldns_resolver_push_nameserver(res, ldns_rr_rdf(ldns_rr_list_rr(new_nss_a, nss_i), 0)); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (status == LDNS_STATUS_OK) { + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + if (answer_list) { + if (verbosity >= 2) { + printf("Comparing answer list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { + fprintf(stderr, "ERROR: different answer answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, answer_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_answer(p)); + exit(EXIT_FAILURE); + } + } else { + if (verbosity >= 2) { + printf("First answer list for this set, nothing to compare with\n\n"); + } + answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + } + if (authority_list) { + if (verbosity >= 2) { + printf("Comparing authority list of answer to previous\n\n"); + } + ldns_rr_list_sort(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (ldns_rr_list_compare(authority_list, ldns_pkt_authority(p)) != 0) { + fprintf(stderr, "ERROR: different authority answer from nameserver\n"); + fprintf(stderr, "\nI had (from previous servers):\n"); + ldns_rr_list_print(stderr, authority_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_authority(p)); + exit(EXIT_FAILURE); + } + } else { + if (verbosity >= 2) { + printf("First authority list for this set, nothing to compare with\n\n"); + } + authority_list = ldns_rr_list_clone(ldns_pkt_authority(p)); + ldns_rr_list_sort(authority_list); + if (verbosity >= 3) { + printf("NS RRset:\n"); + ldns_rr_list_print(stdout, authority_list); + printf("\n"); + } + } + } + } + ldns_rr_list_deep_free(authority_list); + authority_list = NULL; + + if (loop_count++ > 20) { + /* unlikely that we are doing something usefull */ + fprintf(stderr, "Looks like we are looping"); + ldns_pkt_free(p); + return NULL; + } + + ldns_pkt_free(p); + + if (verbosity >= 3) { + fprintf(stdout, "This level ok. Continuing to next.\n\n"); + } + + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error querying root servers: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } + + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (verbosity >= 4) { + ldns_pkt_print(stdout, p); + printf("\n\n"); + } + + + ldns_rr_list_deep_free(new_nss_aaaa); + ldns_rr_list_deep_free(new_nss_a); + ldns_rr_list_deep_free(new_nss); + new_nss_aaaa = NULL; + new_nss_a = NULL; + ns_addr = NULL; + } + + ldns_rr_list_deep_free(answer_list); + answer_list = NULL; + /* clone the nameserver list, we are going to handle them one by one */ + last_nameserver_count = 0; + last_nameservers = LDNS_XMALLOC(ldns_rdf *, ldns_resolver_nameserver_count(res)); + + pop = NULL; + while((pop = ldns_resolver_pop_nameserver(res))) { + last_nameservers[last_nameserver_count] = pop; + last_nameserver_count++; + } + + for (nss_i = 0; nss_i < last_nameserver_count; nss_i++) { + /* remove previous nameserver */ + while((pop = ldns_resolver_pop_nameserver(res))) { ldns_rdf_deep_free(pop); } + + if (verbosity >= 1) { + printf("Querying nameserver: "); + ldns_rdf_print(stdout, last_nameservers[nss_i]); + printf("\n"); + } + status = ldns_resolver_push_nameserver(res, last_nameservers[nss_i]); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error adding nameserver to resolver: %s\n", ldns_get_errorstr_by_id(status)); + } + + ldns_pkt_free(p); + status = ldns_resolver_send(&p, res, name, t, c, 0); + + if (!p) { + fprintf(stderr, "no packet received\n"); + return NULL; + } + + if (status == LDNS_STATUS_RES_NO_NS) { + fprintf(stderr, "Error: nameserver at "); + ldns_rdf_print(stderr, last_nameservers[nss_i]); + fprintf(stderr, " not responding. Unable to check RRset here, aborting.\n"); + return NULL; + } + + if (ldns_pkt_get_rcode(p) != LDNS_RCODE_NOERROR) { + printf("Error in packet:\n"); + ldns_pkt_print(stdout, p); + return NULL; + } + + if (answer_list) { + if (verbosity >= 2) { + printf("1Comparing answer rr list of answer to previous\n"); + } + ldns_rr_list_sort(ldns_pkt_answer(p)); + ldns_rr_list_sort(answer_list); + if (ldns_rr_list_compare(answer_list, ldns_pkt_answer(p)) != 0) { + printf("ERROR: different answer section in response from nameserver\n"); + fprintf(stderr, "\nI had:\n"); + ldns_rr_list_print(stderr, answer_list); + fprintf(stderr, "\nI received (from nameserver at "); + ldns_rdf_print(stderr, ldns_resolver_nameservers(res)[0]); + fprintf(stderr, "):\n"); + ldns_rr_list_print(stderr, ldns_pkt_answer(p)); + exit(EXIT_FAILURE); + } + } else { + if (verbosity >= 2) { + printf("First answer rr list for this set, nothing to compare with\n"); + } + answer_list = ldns_rr_list_clone(ldns_pkt_answer(p)); + if (verbosity >= 3) { + printf("DNSKEY RRset:\n"); + ldns_rr_list_print(stdout, answer_list); + } + } + + } + + for (nss_i = 0; nss_i < last_nameserver_count; nss_i++) { + ldns_rdf_deep_free(last_nameservers[nss_i]); + } + LDNS_FREE(last_nameservers); + ldns_resolver_deep_free(res); + ldns_pkt_free(p); + return answer_list; +} + + +/* + * The file with the given path should contain a list of NS RRs + * for the root zone and A records for those NS RRs. + * Read them, check them, and append the a records to the rr list given. + */ +ldns_rr_list * +read_root_hints(const char *filename) +{ + FILE *fp = NULL; + int line_nr = 0; + ldns_zone *z; + ldns_status status; + ldns_rr_list *addresses = NULL; + ldns_rr *rr; + size_t i; + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s for reading: %s\n", filename, strerror(errno)); + return NULL; + } + + status = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, 0, &line_nr); + fclose(fp); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Error reading root hints file: %s\n", ldns_get_errorstr_by_id(status)); + return NULL; + } else { + addresses = ldns_rr_list_new(); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { + rr = ldns_rr_list_rr(ldns_zone_rrs(z), i); + if ((address_family == 0 || address_family == 1) && + ldns_rr_get_type(rr) == LDNS_RR_TYPE_A ) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + if ((address_family == 0 || address_family == 2) && + ldns_rr_get_type(rr) == LDNS_RR_TYPE_AAAA) { + ldns_rr_list_push_rr(addresses, ldns_rr_clone(rr)); + } + } + ldns_zone_deep_free(z); + return addresses; + } +} + + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_rdf *ns; + ldns_rdf *domain; + ldns_rr_list *l = NULL; + + ldns_rr_list *dns_root = NULL; + const char *root_file = "/etc/named.root"; + + ldns_status status; + + int i; + + char *domain_str; + char *outputfile_str; + ldns_buffer *outputfile_buffer; + FILE *outputfile; + ldns_rr *k; + + bool insecure = false; + ldns_pkt *pkt; + + domain = NULL; + res = NULL; + + if (argc < 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + for (i = 1; i < argc; i++) { + if (strncmp("-4", argv[i], 3) == 0) { + if (address_family != 0) { + fprintf(stderr, "Options -4 and -6 cannot be specified at the same time\n"); + exit(EXIT_FAILURE); + } + address_family = 1; + } else if (strncmp("-6", argv[i], 3) == 0) { + if (address_family != 0) { + fprintf(stderr, "Options -4 and -6 cannot be specified at the same time\n"); + exit(EXIT_FAILURE); + } + address_family = 2; + } else if (strncmp("-h", argv[i], 3) == 0) { + usage(stdout, argv[0]); + exit(EXIT_SUCCESS); + } else if (strncmp("-i", argv[i], 2) == 0) { + insecure = true; + } else if (strncmp("-r", argv[i], 2) == 0) { + if (strlen(argv[i]) > 2) { + root_file = argv[i]+2; + } else if (i+1 >= argc) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + root_file = argv[i+1]; + i++; + } + } else if (strncmp("-s", argv[i], 3) == 0) { + store_in_file = true; + } else if (strncmp("-v", argv[i], 2) == 0) { + if (strlen(argv[i]) > 2) { + verbosity = atoi(argv[i]+2); + } else if (i+1 > argc) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + verbosity = atoi(argv[i+1]); + i++; + } + } else { + /* create a rdf from the command line arg */ + if (domain) { + fprintf(stdout, "You can only specify one domain at a time\n"); + exit(EXIT_FAILURE); + } + + domain = ldns_dname_new_frm_str(argv[i]); + } + + } + if (!domain) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + dns_root = read_root_hints(root_file); + if (!dns_root) { + fprintf(stderr, "cannot read the root hints file\n"); + exit(EXIT_FAILURE); + } + + /* create a new resolver from /etc/resolv.conf */ + status = ldns_resolver_new_frm_file(&res, NULL); + + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Warning: Unable to create stub resolver from /etc/resolv.conf:\n"); + fprintf(stderr, "%s\n", ldns_get_errorstr_by_id(status)); + fprintf(stderr, "defaulting to nameserver at 127.0.0.1 for separate nameserver name lookups\n"); + res = ldns_resolver_new(); + ns = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, "127.0.0.1"); + status = ldns_resolver_push_nameserver(res, ns); + if (status != LDNS_STATUS_OK) { + fprintf(stderr, "Unable to create stub resolver: %s\n", ldns_get_errorstr_by_id(status)); + exit(EXIT_FAILURE); + } + ldns_rdf_deep_free(ns); + } + + ldns_resolver_set_ip6(res, address_family); + + if (insecure) { + pkt = ldns_resolver_query(res, domain, LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, LDNS_RD); + if (pkt) { + l = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_DNSKEY, LDNS_SECTION_ANY_NOQUESTION); + } + } else { + l = retrieve_dnskeys(res, domain, LDNS_RR_TYPE_DNSKEY, LDNS_RR_CLASS_IN, dns_root); + } + + /* separator for result data and verbosity data */ + if (verbosity > 0) { + fprintf(stdout, "; ---------------------------\n"); + fprintf(stdout, "; Got the following keys:\n"); + } + if (l) { + if (store_in_file) { + /* create filename: + * K.+.+.key + */ + for (i = 0; (size_t) i < ldns_rr_list_rr_count(l); i++) { + k = ldns_rr_list_rr(l, (size_t) i); + + outputfile_buffer = ldns_buffer_new(300); + domain_str = ldns_rdf2str(ldns_rr_owner(k)); + ldns_buffer_printf(outputfile_buffer, "K%s+%03u+%05u.key", domain_str, ldns_rdf2native_int8(ldns_rr_rdf(k, 2)), + (unsigned int) ldns_calc_keytag(k)); + outputfile_str = ldns_buffer_export(outputfile_buffer); + + if (verbosity >= 1) { + fprintf(stdout, "Writing key to file %s\n", outputfile_str); + } + + outputfile = fopen(outputfile_str, "w"); + if (!outputfile) { + fprintf(stderr, "Error writing key to file %s: %s\n", outputfile_str, strerror(errno)); + } else { + ldns_rr_print(outputfile, k); + fclose(outputfile); + } + + LDNS_FREE(domain_str); + LDNS_FREE(outputfile_str); + LDNS_FREE(outputfile_buffer); + } + } else { + ldns_rr_list_print(stdout, l); + } + } else { + fprintf(stderr, "no answer packet received, stub resolver config:\n"); + ldns_resolver_print(stderr, res); + } + printf("\n"); + + ldns_rdf_deep_free(domain); + ldns_resolver_deep_free(res); + ldns_rr_list_deep_free(l); + ldns_rr_list_deep_free(dns_root); + return EXIT_SUCCESS; +} diff --git a/libs/ldns/examples/ldns-keygen.1 b/libs/ldns/examples/ldns-keygen.1 new file mode 100644 index 0000000000..36124d52a4 --- /dev/null +++ b/libs/ldns/examples/ldns-keygen.1 @@ -0,0 +1,53 @@ +.TH ldns-keygen 1 "27 May 2008" +.SH NAME +ldns-keygen \- generate a DNSSEC key pair +.SH SYNOPSIS +.B ldns-keygen +[ +.IR OPTION +] +.IR DOMAIN + +.SH DESCRIPTION +\fBldns-keygen\fR is used to generate a private/public keypair. When run, it +will create 3 files; a .key file with the public DNSKEY, a .private +file with the private keydata and a .ds with the DS record of the +DNSKEY record. + +It prints out the basename for these files: K++ + +.SH OPTIONS +.TP +\fB-a \fI\fR +Create a key with this algorithm. Specifying 'list' here gives a list of supported algorithms. +Several alias names are also accepted (from older versions and other software), +the list gives names from the RFC. Also the plain algo number is accepted. + +.TP +\fB-b \fI\fR +Use this many bits for the key length. + +.TP +\fB-k\fR +When given, generate a key signing key. This just sets the flag field to +257 instead of 256 in the DNSKEY RR in the .key file. + +.TP +\fB-r \fIdevice\fR +Make ldns-keygen use this file to seed the random generator with. This will +default to /dev/random. + +.TP +\fB-v\fR +Show the version and exit + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005-2008 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-keygen.c b/libs/ldns/examples/ldns-keygen.c new file mode 100644 index 0000000000..576541790c --- /dev/null +++ b/libs/ldns/examples/ldns-keygen.c @@ -0,0 +1,307 @@ +/* + * keygen is a small programs that generate a dnskey and private key + * for a particular domain. + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +#include + +#ifdef HAVE_SSL +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s -a [-b bits] [-r /dev/random] [-v] domain\n", + prog); + fprintf(fp, " generate a new key pair for domain\n"); + fprintf(fp, " -a \tuse the specified algorithm (-a list to"); + fprintf(fp, " show a list)\n"); + fprintf(fp, " -k\t\tset the flags to 257; key signing key\n"); + fprintf(fp, " -b \tspecify the keylength\n"); + fprintf(fp, " -r \tspecify a random device (defaults to /dev/random)\n"); + fprintf(fp, "\t\tto seed the random generator with\n"); + fprintf(fp, " -v\t\tshow the version and exit\n"); + fprintf(fp, " The following files will be created:\n"); + fprintf(fp, " K++.key\tPublic key in RR format\n"); + fprintf(fp, " K++.private\tPrivate key in key format\n"); + fprintf(fp, " K++.ds\tDS in RR format (only for DNSSEC keys)\n"); + fprintf(fp, " The base name (K++ will be printed to stdout\n"); +} + +static void +show_algorithms(FILE *out) +{ + ldns_lookup_table *lt = ldns_signing_algorithms; + fprintf(out, "Possible algorithms:\n"); + + while (lt->name) { + fprintf(out, "%s\n", lt->name); + lt++; + } +} + +int +main(int argc, char *argv[]) +{ + int c; + char *prog; + + /* default key size */ + uint16_t def_bits = 1024; + uint16_t bits = def_bits; + bool ksk; + + FILE *file; + FILE *random; + char *filename; + char *owner; + + ldns_signing_algorithm algorithm; + ldns_rdf *domain; + ldns_rr *pubkey; + ldns_key *key; + ldns_rr *ds; + + prog = strdup(argv[0]); + algorithm = 0; + random = NULL; + ksk = false; /* don't create a ksk per default */ + + while ((c = getopt(argc, argv, "a:kb:r:v25")) != -1) { + switch (c) { + case 'a': + if (algorithm != 0) { + fprintf(stderr, "The -a argument can only be used once\n"); + exit(1); + } + if (strncmp(optarg, "list", 5) == 0) { + show_algorithms(stdout); + exit(EXIT_SUCCESS); + } + algorithm = ldns_get_signing_algorithm_by_name(optarg); + if (algorithm == 0) { + fprintf(stderr, "Algorithm %s not found\n", optarg); + show_algorithms(stderr); + exit(EXIT_FAILURE); + } + break; + case 'b': + bits = (uint16_t) atoi(optarg); + if (bits == 0) { + fprintf(stderr, "%s: %s %d", prog, "Can not parse the -b argument, setting it to the default\n", (int) def_bits); + bits = def_bits; + } + break; + case 'k': + ksk = true; + break; + case 'r': + random = fopen(optarg, "r"); + if (!random) { + fprintf(stderr, "Cannot open random file %s: %s\n", optarg, strerror(errno)); + exit(EXIT_FAILURE); + } + break; + case 'v': + printf("DNSSEC key generator version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); + exit(EXIT_SUCCESS); + break; + default: + usage(stderr, prog); + exit(EXIT_FAILURE); + } + } + argc -= optind; + argv += optind; + + if (algorithm == 0) { + printf("Please use the -a argument to provide an algorithm\n"); + exit(1); + } + + if (argc != 1) { + usage(stderr, prog); + exit(EXIT_FAILURE); + } + free(prog); + + /* check whether key size is within RFC boundaries */ + switch (algorithm) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + if (bits < 512 || bits > 4096) { + fprintf(stderr, "For RSA, the key size must be between "); + fprintf(stderr, " 512 and 4096 bytes. Aborting.\n"); + exit(1); + } + break; + case LDNS_SIGN_DSA: + if (bits < 512 || bits > 4096) { + fprintf(stderr, "For DSA, the key size must be between "); + fprintf(stderr, " 512 and 1024 bytes. Aborting.\n"); + exit(1); + } + break; +#ifdef USE_GOST + case LDNS_SIGN_ECC_GOST: + if(!ldns_key_EVP_load_gost_id()) { + fprintf(stderr, "error: libcrypto does not provide GOST\n"); + exit(EXIT_FAILURE); + } + break; +#endif +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: +#endif + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + default: + break; + } + + if (!random) { + random = fopen("/dev/random", "r"); + if (!random) { + fprintf(stderr, "Cannot open random file %s: %s\n", optarg, strerror(errno)); + exit(EXIT_FAILURE); + } + } + + (void)ldns_init_random(random, (unsigned int) bits/8); + fclose(random); + + /* create an rdf from the domain name */ + domain = ldns_dname_new_frm_str(argv[0]); + + /* generate a new key */ + key = ldns_key_new_frm_algorithm(algorithm, bits); + + /* set the owner name in the key - this is a /seperate/ step */ + ldns_key_set_pubkey_owner(key, domain); + + /* ksk flag */ + if (ksk) { + ldns_key_set_flags(key, ldns_key_flags(key) + 1); + } + + /* create the public from the ldns_key */ + pubkey = ldns_key2rr(key); + if (!pubkey) { + fprintf(stderr, "Could not extract the public key from the key structure..."); + ldns_key_deep_free(key); + exit(EXIT_FAILURE); + } + owner = ldns_rdf2str(ldns_rr_owner(pubkey)); + + /* calculate and set the keytag */ + ldns_key_set_keytag(key, ldns_calc_keytag(pubkey)); + + /* build the DS record */ + switch (algorithm) { +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP384SHA384: + ds = ldns_key_rr2ds(pubkey, LDNS_SHA384); + break; + case LDNS_SIGN_ECDSAP256SHA256: +#endif + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + ds = ldns_key_rr2ds(pubkey, LDNS_SHA256); + break; + case LDNS_SIGN_ECC_GOST: +#ifdef USE_GOST + ds = ldns_key_rr2ds(pubkey, LDNS_HASH_GOST); +#else + ds = ldns_key_rr2ds(pubkey, LDNS_SHA256); +#endif + break; + default: + ds = ldns_key_rr2ds(pubkey, LDNS_SHA1); + break; + } + + /* print the public key RR to .key */ + filename = LDNS_XMALLOC(char, strlen(owner) + 17); + snprintf(filename, strlen(owner) + 16, "K%s+%03u+%05u.key", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + file = fopen(filename, "w"); + if (!file) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + LDNS_FREE(filename); + exit(EXIT_FAILURE); + } else { + /* temporarily set question so that TTL is not printed */ + ldns_rr_set_question(pubkey, true); + ldns_rr_print(file, pubkey); + ldns_rr_set_question(pubkey, false); + fclose(file); + LDNS_FREE(filename); + } + + /* print the priv key to stderr */ + filename = LDNS_XMALLOC(char, strlen(owner) + 21); + snprintf(filename, strlen(owner) + 20, "K%s+%03u+%05u.private", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + file = fopen(filename, "w"); + if (!file) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + LDNS_FREE(filename); + exit(EXIT_FAILURE); + } else { + ldns_key_print(file, key); + fclose(file); + LDNS_FREE(filename); + } + + /* print the DS to .ds */ + if (algorithm != LDNS_SIGN_HMACMD5 && + algorithm != LDNS_SIGN_HMACSHA1 && + algorithm != LDNS_SIGN_HMACSHA256) { + filename = LDNS_XMALLOC(char, strlen(owner) + 16); + snprintf(filename, strlen(owner) + 15, "K%s+%03u+%05u.ds", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + file = fopen(filename, "w"); + if (!file) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + LDNS_FREE(filename); + exit(EXIT_FAILURE); + } else { + /* temporarily set question so that TTL is not printed */ + ldns_rr_set_question(ds, true); + ldns_rr_print(file, ds); + ldns_rr_set_question(ds, false); + fclose(file); + LDNS_FREE(filename); + } + } + + fprintf(stdout, "K%s+%03u+%05u\n", owner, algorithm, (unsigned int) ldns_key_keytag(key)); + ldns_key_deep_free(key); + free(owner); + ldns_rr_free(pubkey); + ldns_rr_free(ds); + exit(EXIT_SUCCESS); +} +#else +int +main(int argc, char **argv) +{ + fprintf(stderr, "ldns-keygen needs OpenSSL support, which has not been compiled in\n"); + return 1; +} +#endif /* HAVE_SSL */ diff --git a/libs/ldns/examples/ldns-mx.1 b/libs/ldns/examples/ldns-mx.1 new file mode 100644 index 0000000000..cad97abcd8 --- /dev/null +++ b/libs/ldns/examples/ldns-mx.1 @@ -0,0 +1,23 @@ +.TH ldns-mx 1 "27 Apr 2005" +.SH NAME +ldns-mx \- print out the mx record(s) for a domain +.SH SYNOPSIS +.B ldns-mx +.IR DOMAIN + +.SH DESCRIPTION +\fBldns-mx\fR is used to print out mx information of a domain. + +.SH OPTIONS +\fBldns-mx\fR has no options. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-mx.c b/libs/ldns/examples/ldns-mx.c new file mode 100644 index 0000000000..873cf55f87 --- /dev/null +++ b/libs/ldns/examples/ldns-mx.c @@ -0,0 +1,88 @@ +/* + * mx is a small program that prints out the mx records + * for a particular domain + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +static int +usage(FILE *fp, char *prog) { + fprintf(fp, "%s domain\n", prog); + fprintf(fp, " print out the mx for domain\n"); + return 0; +} + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_rdf *domain; + ldns_pkt *p; + ldns_rr_list *mx; + ldns_status s; + + p = NULL; + mx = NULL; + domain = NULL; + res = NULL; + + if (argc != 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + /* create a rdf from the command line arg */ + domain = ldns_dname_new_frm_str(argv[1]); + if (!domain) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + /* create a new resolver from /etc/resolv.conf */ + s = ldns_resolver_new_frm_file(&res, NULL); + + if (s != LDNS_STATUS_OK) { + exit(EXIT_FAILURE); + } + + /* use the resolver to send a query for the mx + * records of the domain given on the command line + */ + p = ldns_resolver_query(res, + domain, + LDNS_RR_TYPE_MX, + LDNS_RR_CLASS_IN, + LDNS_RD); + + ldns_rdf_deep_free(domain); + + if (!p) { + exit(EXIT_FAILURE); + } else { + /* retrieve the MX records from the answer section of that + * packet + */ + mx = ldns_pkt_rr_list_by_type(p, + LDNS_RR_TYPE_MX, + LDNS_SECTION_ANSWER); + if (!mx) { + fprintf(stderr, + " *** invalid answer name %s after MX query for %s\n", + argv[1], argv[1]); + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + exit(EXIT_FAILURE); + } else { + ldns_rr_list_sort(mx); + ldns_rr_list_print(stdout, mx); + ldns_rr_list_deep_free(mx); + } + } + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + return 0; +} diff --git a/libs/ldns/examples/ldns-notify.1 b/libs/ldns/examples/ldns-notify.1 new file mode 100644 index 0000000000..7ae77ac046 --- /dev/null +++ b/libs/ldns/examples/ldns-notify.1 @@ -0,0 +1,66 @@ +.TH ldns-notify 1 "9 Jan 2007" +.SH NAME +ldns-notify \- notify DNS servers that updates are available +.SH SYNOPSIS +.B ldns-notify +[options] +-z zone +.IR servers + +.SH DESCRIPTION + +\fBldns-notify\fR sends a NOTIFY message to DNS servers. This tells them +that an updated zone is available at the master servers. It can perform +TSIG signatures and it can add a SOA serial number of the updated zone. +If a server already has that serial number it will disregard the message. + +.SH OPTIONS +.TP +\fB-z zone\fR +The zone that is updated. + +.TP +\fB-h\fR +Show usage and exit + +.TP +\fB-v\fR +Show the version and exit + +.TP +\fB-s serial\fR +Append a SOA record indicating the serial number of the updated zone. + +.TP +\fB-p port\fR +Use port as destination port (default the DNS port 53) for the UDP packets. + +.TP +\fB-y key:data\fR +Use the given TSIG key and base64-data to sign the NOTIFY. Uses the +hmac-md5 algorithm. + +.TP +\fB-d\fR +Print verbose debug information. The query that is sent and the query +that is received. + +.TP +\fB-r num\fR +Specify the maximum number of retries before notify gives up trying to +send the UDP packet. + +.SH EXIT CODE +The program exits with a 0 exit code if all servers replied an +acknowledgement to the notify message, and a failure exit code otherwise. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-notify.c b/libs/ldns/examples/ldns-notify.c new file mode 100644 index 0000000000..258dc09b26 --- /dev/null +++ b/libs/ldns/examples/ldns-notify.c @@ -0,0 +1,329 @@ +/* + * ldns-notify.c - ldns-notify(8) + * + * Copyright (c) 2001-2008, NLnet Labs, All right reserved + * + * See LICENSE for the license + * + * send a notify packet to a server + */ + +#include "config.h" + +/* ldns */ +#include + +#ifdef HAVE_NETDB_H +#include +#endif +#include + +static int verbose = 1; +static int max_num_retry = 15; /* times to try */ + +static void +usage(void) +{ + fprintf(stderr, "usage: ldns-notify [other options] -z zone \n"); + fprintf(stderr, "Ldns notify utility\n\n"); + fprintf(stderr, " Supported options:\n"); + fprintf(stderr, "\t-z zone\t\tThe zone\n"); + fprintf(stderr, "\t-s version\tSOA version number to include\n"); + fprintf(stderr, "\t-y key:data\tTSIG sign the query\n"); + fprintf(stderr, "\t-p port\t\tport to use to send to\n"); + fprintf(stderr, "\t-v\t\tPrint version information\n"); + fprintf(stderr, "\t-d\t\tPrint verbose debug information\n"); + fprintf(stderr, "\t-r num\t\tmax number of retries (%d)\n", + max_num_retry); + fprintf(stderr, "\t-h\t\tPrint this help information\n\n"); + fprintf(stderr, "Report bugs to \n"); + exit(1); +} + +static void +version(void) +{ + fprintf(stderr, "%s version %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf(stderr, "Written by NLnet Labs.\n\n"); + fprintf(stderr, + "Copyright (C) 2001-2008 NLnet Labs. This is free software.\n" + "There is NO warranty; not even for MERCHANTABILITY or FITNESS\n" + "FOR A PARTICULAR PURPOSE.\n"); + exit(0); +} + +static void +notify_host(int s, struct addrinfo* res, uint8_t* wire, size_t wiresize, + const char* addrstr) +{ + int timeout_retry = 5; /* seconds */ + int num_retry = max_num_retry; + fd_set rfds; + struct timeval tv; + int retval = 0; + ssize_t received = 0; + int got_ack = 0; + socklen_t addrlen = 0; + uint8_t replybuf[2048]; + ldns_status status; + ldns_pkt* pkt = NULL; + + while(!got_ack) { + /* send it */ + if(sendto(s, (void*)wire, wiresize, 0, + res->ai_addr, res->ai_addrlen) == -1) { + printf("warning: send to %s failed: %s\n", + addrstr, strerror(errno)); +#ifndef USE_WINSOCK + close(s); +#else + closesocket(s); +#endif + return; + } + + /* wait for ACK packet */ + FD_ZERO(&rfds); + FD_SET(s, &rfds); +#ifndef S_SPLINT_S + tv.tv_sec = timeout_retry; /* seconds */ +#endif + tv.tv_usec = 0; /* microseconds */ + retval = select(s + 1, &rfds, NULL, NULL, &tv); + if (retval == -1) { + printf("error waiting for reply from %s: %s\n", + addrstr, strerror(errno)); +#ifndef USE_WINSOCK + close(s); +#else + closesocket(s); +#endif + return; + } + if(retval == 0) { + num_retry--; + if(num_retry == 0) { + printf("error: failed to send notify to %s.\n", + addrstr); + exit(1); + } + printf("timeout (%d s) expired, retry notify to %s.\n", + timeout_retry, addrstr); + } + if (retval == 1) { + got_ack = 1; + } + } + + /* got reply */ + addrlen = res->ai_addrlen; + received = recvfrom(s, (void*)replybuf, sizeof(replybuf), 0, + res->ai_addr, &addrlen); + res->ai_addrlen = addrlen; + +#ifndef USE_WINSOCK + close(s); +#else + closesocket(s); +#endif + if (received == -1) { + printf("recv %s failed: %s\n", addrstr, strerror(errno)); + return; + } + + /* check reply */ + status = ldns_wire2pkt(&pkt, replybuf, (size_t)received); + if(status != LDNS_STATUS_OK) { + ssize_t i; + printf("Could not parse reply packet: %s\n", + ldns_get_errorstr_by_id(status)); + printf("hexdump of reply: "); + for(i=0; iai_next) { + int s = socket(res->ai_family, res->ai_socktype, + res->ai_protocol); + if(s == -1) + continue; + /* send the notify */ + notify_host(s, res, wire, wiresize, argv[i]); + } + freeaddrinfo(res0); + } + + ldns_pkt_free(notify); + free(wire); + return 0; +} diff --git a/libs/ldns/examples/ldns-nsec3-hash.1 b/libs/ldns/examples/ldns-nsec3-hash.1 new file mode 100644 index 0000000000..1b0f70ce39 --- /dev/null +++ b/libs/ldns/examples/ldns-nsec3-hash.1 @@ -0,0 +1,34 @@ +.TH ldns-nsec3-hash.c 1 "10 Dec 2008" +.SH NAME +ldns-nsec3-hash \- print out the NSEC3 hash for a domain name +.SH SYNOPSIS +.B ldns-nsec3-hash +.IR + +.SH DESCRIPTION +\fBldns-nsec3-hash\fR is used to print out the NSEC3 hash for the given domain name. + +.SH OPTIONS +.TP +\fB-a\fR \fInumber\fR +Use the given algorithm number for the hash calculation. Defaults to 1 (SHA-1). + +.TP +\fB-s\fR \fIsalt\fR +Use the given salt for the hash calculation. Salt value should be in hexadecimal format. + +.TP +\fB-t\fR \fIcount\fR +Use count iterations for the hash calculation. + + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2008 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-nsec3-hash.c b/libs/ldns/examples/ldns-nsec3-hash.c new file mode 100644 index 0000000000..0ba2e68aec --- /dev/null +++ b/libs/ldns/examples/ldns-nsec3-hash.c @@ -0,0 +1,127 @@ +/* + * ldns-signzone signs a zone file + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include + +#include + +#include + +#include +#include + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ + +#define MAX_FILENAME_LEN 250 +int verbosity = 1; + +static void +usage(FILE *fp, const char *prog) { + fprintf(fp, "%s [OPTIONS] \n", prog); + fprintf(fp, " prints the NSEC3 hash of the given domain name\n"); + fprintf(fp, "-a [algorithm] hashing algorithm\n"); + fprintf(fp, "-t [number] number of hash iterations\n"); + fprintf(fp, "-s [string] salt\n"); +} + +int +main(int argc, char *argv[]) +{ + ldns_rdf *dname, *hashed_dname; + uint8_t nsec3_algorithm = 1; + size_t nsec3_iterations_cmd = 1; + uint16_t nsec3_iterations = 1; + uint8_t nsec3_salt_length = 0; + uint8_t *nsec3_salt = NULL; + + char *prog = strdup(argv[0]); + + int c; + while ((c = getopt(argc, argv, "a:s:t:")) != -1) { + switch (c) { + case 'a': + nsec3_algorithm = (uint8_t) atoi(optarg); + break; + case 's': + if (strlen(optarg) % 2 != 0) { + fprintf(stderr, "Salt value is not valid hex data, not a multiple of 2 characters\n"); + exit(EXIT_FAILURE); + } + if (strlen(optarg) > 512) { + fprintf(stderr, "Salt too long\n"); + exit(EXIT_FAILURE); + } + nsec3_salt_length = (uint8_t) (strlen(optarg) / 2); + nsec3_salt = LDNS_XMALLOC(uint8_t, nsec3_salt_length); + for (c = 0; c < (int) strlen(optarg); c += 2) { + if (isxdigit((int) optarg[c]) && isxdigit((int) optarg[c+1])) { + nsec3_salt[c/2] = (uint8_t) ldns_hexdigit_to_int(optarg[c]) * 16 + + ldns_hexdigit_to_int(optarg[c+1]); + } else { + fprintf(stderr, "Salt value is not valid hex data.\n"); + exit(EXIT_FAILURE); + } + } + + break; + case 't': + nsec3_iterations_cmd = (size_t) atol(optarg); + if (nsec3_iterations_cmd > LDNS_NSEC3_MAX_ITERATIONS) { + fprintf(stderr, "Iterations count can not exceed %u, quitting\n", LDNS_NSEC3_MAX_ITERATIONS); + exit(EXIT_FAILURE); + } + nsec3_iterations = (uint16_t) nsec3_iterations_cmd; + break; + default: + usage(stderr, prog); + exit(EXIT_SUCCESS); + } + } + + argc -= optind; + argv += optind; + + if (argc < 1) { + printf("Error: not enough arguments\n"); + usage(stdout, prog); + exit(EXIT_FAILURE); + } else { + dname = ldns_dname_new_frm_str(argv[0]); + if (!dname) { + fprintf(stderr, + "Error: unable to parse domain name\n"); + return EXIT_FAILURE; + } + hashed_dname = ldns_nsec3_hash_name(dname, + nsec3_algorithm, + nsec3_iterations, + nsec3_salt_length, + nsec3_salt); + if (!hashed_dname) { + fprintf(stderr, + "Error creating NSEC3 hash\n"); + return EXIT_FAILURE; + } + ldns_rdf_print(stdout, hashed_dname); + printf("\n"); + ldns_rdf_deep_free(dname); + ldns_rdf_deep_free(hashed_dname); + } + + if (nsec3_salt) { + free(nsec3_salt); + } + + free(prog); + + return EXIT_SUCCESS; +} diff --git a/libs/ldns/examples/ldns-read-zone.1 b/libs/ldns/examples/ldns-read-zone.1 new file mode 100644 index 0000000000..31bedaba62 --- /dev/null +++ b/libs/ldns/examples/ldns-read-zone.1 @@ -0,0 +1,56 @@ +.TH ldns-read-zone 1 "30 May 2005" +.SH NAME +ldns-read-zone \- read a zonefile and print it +.SH SYNOPSIS +.B ldns-read-zone +.IR ZONEFILE + +.SH DESCRIPTION + +\fBldns-read-zone\fR reads a DNS zone file and prints it. The output has 1 +resource record per line, and no pretty-printing makeup. + +.SH OPTIONS +.TP +\fB-c\fR +Canonicalize all resource records in the zone before printing + +.TP +\fB-d\fR +Only print DNSSEC data from the zone. This option skips every record +that is not of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are not +printed. + +.TP +\fB-h\fR +Show usage and exit + +.TP +\fB-n\fR +Do not print the SOA record + +.TP +\fB-s\fR +Strip DNSSEC data from the zone. This option skips every record +that is of type NSEC, NSEC3, RRSIG or DNSKEY. DS records are still +printed. + +.TP +\fB-v\fR +Show the version and exit + +.TP +\fB-z\fR +Sort the zone before printing (this implies -c) + + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-read-zone.c b/libs/ldns/examples/ldns-read-zone.c new file mode 100644 index 0000000000..ea35850fc1 --- /dev/null +++ b/libs/ldns/examples/ldns-read-zone.c @@ -0,0 +1,159 @@ +/* + * read a zone file from disk and prints it, one RR per line + * + * (c) NLnetLabs 2005-2008 + * + * See the file LICENSE for the license + */ + +#include "config.h" +#include +#include + +#include + +#include + +int +main(int argc, char **argv) +{ + char *filename; + FILE *fp; + ldns_zone *z; + int line_nr = 0; + int c; + bool canonicalize = false; + bool sort = false; + bool strip = false; + bool only_dnssec = false; + bool print_soa = true; + ldns_status s; + size_t i; + ldns_rr_list *stripped_list; + ldns_rr *cur_rr; + ldns_rr_type cur_rr_type; + + while ((c = getopt(argc, argv, "cdhnsvz")) != -1) { + switch(c) { + case 'c': + canonicalize = true; + break; + case 'd': + only_dnssec = true; + if (strip) { + fprintf(stderr, "Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"); + } + break; + case 'h': + printf("Usage: %s [-c] [-v] [-z] \n", argv[0]); + printf("\tReads the zonefile and prints it.\n"); + printf("\tThe RR count of the zone is printed to stderr.\n"); + printf("\t-c canonicalize all rrs in the zone.\n"); + printf("\t-d only show DNSSEC data from the zone\n"); + printf("\t-h show this text\n"); + printf("\t-n do not print the SOA record\n"); + printf("\t-s strip DNSSEC data from the zone\n"); + printf("\t-v shows the version and exits\n"); + printf("\t-z sort the zone (implies -c).\n"); + printf("\nif no file is given standard input is read\n"); + exit(EXIT_SUCCESS); + break; + case 'n': + print_soa = false; + break; + case 's': + strip = true; + if (only_dnssec) { + fprintf(stderr, "Warning: stripping both DNSSEC and non-DNSSEC records. Output will be sparse.\n"); + } + break; + case 'v': + printf("read zone version %s (ldns version %s)\n", LDNS_VERSION, ldns_version()); + exit(EXIT_SUCCESS); + break; + case 'z': + canonicalize = true; + sort = true; + break; + } + } + + argc -= optind; + argv += optind; + + if (argc == 0) { + fp = stdin; + } else { + filename = argv[0]; + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + exit(EXIT_FAILURE); + } + } + + s = ldns_zone_new_frm_fp_l(&z, fp, NULL, 0, LDNS_RR_CLASS_IN, &line_nr); + + if (strip) { + stripped_list = ldns_rr_list_new(); + while ((cur_rr = ldns_rr_list_pop_rr(ldns_zone_rrs(z)))) { + cur_rr_type = ldns_rr_get_type(cur_rr); + if (cur_rr_type == LDNS_RR_TYPE_RRSIG || + cur_rr_type == LDNS_RR_TYPE_NSEC || + cur_rr_type == LDNS_RR_TYPE_NSEC3 || + cur_rr_type == LDNS_RR_TYPE_NSEC3PARAMS + ) { + ldns_rr_free(cur_rr); + } else { + ldns_rr_list_push_rr(stripped_list, cur_rr); + } + } + ldns_rr_list_free(ldns_zone_rrs(z)); + ldns_zone_set_rrs(z, stripped_list); + } + if (only_dnssec) { + stripped_list = ldns_rr_list_new(); + while ((cur_rr = ldns_rr_list_pop_rr(ldns_zone_rrs(z)))) { + cur_rr_type = ldns_rr_get_type(cur_rr); + if (cur_rr_type == LDNS_RR_TYPE_RRSIG || + cur_rr_type == LDNS_RR_TYPE_NSEC || + cur_rr_type == LDNS_RR_TYPE_NSEC3 || + cur_rr_type == LDNS_RR_TYPE_NSEC3PARAMS + ) { + ldns_rr_list_push_rr(stripped_list, cur_rr); + } else { + ldns_rr_free(cur_rr); + } + } + ldns_rr_list_free(ldns_zone_rrs(z)); + ldns_zone_set_rrs(z, stripped_list); + } + + if (s == LDNS_STATUS_OK) { + if (canonicalize) { + ldns_rr2canonical(ldns_zone_soa(z)); + for (i = 0; i < ldns_rr_list_rr_count(ldns_zone_rrs(z)); i++) { + ldns_rr2canonical(ldns_rr_list_rr(ldns_zone_rrs(z), i)); + } + } + if (sort) { + ldns_zone_sort(z); + } + + if (print_soa && ldns_zone_soa(z)) { + ldns_rr_print(stdout, ldns_zone_soa(z)); + } + ldns_rr_list_print(stdout, ldns_zone_rrs(z)); + + ldns_zone_deep_free(z); + } else { + fprintf(stderr, "%s at %d\n", + ldns_get_errorstr_by_id(s), + line_nr); + exit(EXIT_FAILURE); + } + fclose(fp); + + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-resolver.1 b/libs/ldns/examples/ldns-resolver.1 new file mode 100644 index 0000000000..9552e6860c --- /dev/null +++ b/libs/ldns/examples/ldns-resolver.1 @@ -0,0 +1,26 @@ +.TH ldns-resolver 1 "27 Apr 2005" +.SH NAME +ldns-resolver \- tries to create a resolver from a resolv.conf file. +.SH SYNOPSIS +.B ldns-resolver +.IR file + +.SH DESCRIPTION +\fBldns-resolver\fR tries to create a resolver from a resolv.conf file. +This is only useful to test the library for robusteness with input data. + +.SH OPTIONS +\fBldns-resolver\fR takes a filename of the resolv.conf file as input. +For example \fIldns-resolver /etc/resolv.conf\fR will show if the file can +be parsed successfully. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-resolver.c b/libs/ldns/examples/ldns-resolver.c new file mode 100644 index 0000000000..04dcc35feb --- /dev/null +++ b/libs/ldns/examples/ldns-resolver.c @@ -0,0 +1,47 @@ +/* + * ldns-resolver tries to create a resolver structure from /dev/urandom + * this is only useful to test the library for robusteness with input data + * + * (c) NLnet Labs 2006 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" +#include "errno.h" + +#include + +int +main(int argc, char **argv) { + + ldns_resolver *r; + int line = 1; + FILE *rand; + ldns_status s; + + if (argc != 2 || strncmp(argv[1], "-h", 3) == 0) { + printf("Usage: ldns-resolver \n"); + printf("Tries to create a stub resolver structure from the given file.\n"); + exit(EXIT_FAILURE); + } + + if (!(rand = fopen(argv[1], "r"))) { + printf("Error opening %s: %s\n", argv[1], strerror(errno)); + exit(EXIT_FAILURE); + } + + printf("Trying to read from %s\n", argv[1]); + s = ldns_resolver_new_frm_fp_l(&r, rand, &line); + if (s != LDNS_STATUS_OK) { + printf("Failed: %s at line %d\n", ldns_get_errorstr_by_id(s), line); + exit(EXIT_FAILURE); + } else { + printf("Succes\n"); + ldns_resolver_print(stdout, r); + ldns_resolver_deep_free(r); + } + + fclose(rand); + + return EXIT_SUCCESS; +} diff --git a/libs/ldns/examples/ldns-revoke.1 b/libs/ldns/examples/ldns-revoke.1 new file mode 100644 index 0000000000..5a16244dac --- /dev/null +++ b/libs/ldns/examples/ldns-revoke.1 @@ -0,0 +1,27 @@ +.TH ldns-revoke 1 "23 Jul 2008" +.SH NAME +ldns-revoke \- sets the revoke bit of a DNSKEY +.SH SYNOPSIS +.B ldns-revoke +.IR file + +.SH DESCRIPTION +\fBldns-revoke\fR is used to revoke a public DNSKEY RR. +When run it will read \fIfile\fR with a DNSKEY RR in it, +sets the revoke bit and write back the output to \fIfile\fR . + +.SH OPTIONS +.TP +\fB-n\fR +Write the result to stdout instead of a file + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2008 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-revoke.c b/libs/ldns/examples/ldns-revoke.c new file mode 100644 index 0000000000..f46c98f010 --- /dev/null +++ b/libs/ldns/examples/ldns-revoke.c @@ -0,0 +1,104 @@ +/* + * revoke sets the revoke bit of a public key. + * + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include +#ifdef HAVE_SSL +#include +#endif /* HAVE_SSL */ + +#include + +static void +usage(FILE *fp, char *prog) { + fprintf(fp, "%s [-n] keyfile\n", prog); + fprintf(fp, " Revokes a key\n"); + fprintf(fp, "Options:\n"); + fprintf(fp, " -n: do not write to file but to stdout\n"); +} + +int +main(int argc, char *argv[]) +{ + FILE *keyfp; + char *keyname; + ldns_rr *k; + uint16_t flags; + char *program = argv[0]; + int nofile = 0; + ldns_rdf *origin = NULL; + ldns_status result; + + argv++, argc--; + while (argc && argv[0][0] == '-') { + if (strcmp(argv[0], "-n") == 0) { + nofile=1; + } + else { + usage(stderr, program); + exit(EXIT_FAILURE); + } + argv++, argc--; + } + + if (argc != 1) { + usage(stderr, program); + exit(EXIT_FAILURE); + } + keyname = strdup(argv[0]); + + keyfp = fopen(keyname, "r"); + if (!keyfp) { + fprintf(stderr, "Failed to open public key file %s: %s\n", keyname, + strerror(errno)); + exit(EXIT_FAILURE); + } + + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + /* what does this while loop do? */ + while (result == LDNS_STATUS_SYNTAX_ORIGIN) { + result = ldns_rr_new_frm_fp(&k, keyfp, 0, &origin, NULL); + } + if (result != LDNS_STATUS_OK) { + fprintf(stderr, "Could not read public key from file %s: %s\n", keyname, ldns_get_errorstr_by_id(result)); + exit(EXIT_FAILURE); + } + fclose(keyfp); + + flags = ldns_read_uint16(ldns_rdf_data(ldns_rr_dnskey_flags(k))); + flags |= LDNS_KEY_REVOKE_KEY; + + if (!ldns_rr_dnskey_set_flags(k, + ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, flags))) + { + fprintf(stderr, "Revocation failed\n"); + exit(EXIT_FAILURE); + } + + /* print the public key RR to .key */ + + if (nofile) + ldns_rr_print(stdout,k); + else { + keyfp = fopen(keyname, "w"); + if (!keyfp) { + fprintf(stderr, "Unable to open %s: %s\n", keyname, + strerror(errno)); + exit(EXIT_FAILURE); + } else { + ldns_rr_print(keyfp, k); + fclose(keyfp); + fprintf(stdout, "DNSKEY revoked\n"); + } + } + + free(keyname); + ldns_rr_free(k); + + exit(EXIT_SUCCESS); +} diff --git a/libs/ldns/examples/ldns-rrsig.1 b/libs/ldns/examples/ldns-rrsig.1 new file mode 100644 index 0000000000..3aee863e05 --- /dev/null +++ b/libs/ldns/examples/ldns-rrsig.1 @@ -0,0 +1,30 @@ +.TH ldns-rrsig 1 "27 Apr 2005" +.SH NAME +ldns-rrsig \- print out the inception and expiration dates in human +readable form +.SH SYNOPSIS +.B ldns-rrsig +.IR domain +[ +.IR type +] + +.SH DESCRIPTION +\fBldns-rrsig\fR is used to print the expiration and inception date of +a RRSIG. The first argument is a domain name. \fBldns-rrsig\fR will +query the authoritative servers for that domain to get a list of RRSIGs. +It will then print out the inception and experiration dates for the RRSIG +covering the SOA record. +.PP +If the second argument \fBtype\fR is given the RRSIG covering that type will be shown. + +.SH AUTHOR +Written by the ldns team as an example for ldns usage. + +.SH REPORTING BUGS +Report bugs to . + +.SH COPYRIGHT +Copyright (C) 2005 NLnet Labs. This is free software. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. diff --git a/libs/ldns/examples/ldns-rrsig.c b/libs/ldns/examples/ldns-rrsig.c new file mode 100644 index 0000000000..5c565b1d4b --- /dev/null +++ b/libs/ldns/examples/ldns-rrsig.c @@ -0,0 +1,207 @@ +/* + * ldns-rrsig prints out the inception and expiration dates in a more readable + * way than the normal RRSIG presentation format + * + * for a particulary domain + * (c) NLnet Labs, 2005 - 2008 + * See the file LICENSE for the license + */ + +#include "config.h" + +#include + +static int +usage(FILE *fp, char *prog) { + fprintf(fp, "%s domain [type]\n", prog); + fprintf(fp, " print out the inception and expiration dates\n"); + fprintf(fp, " in a more human readable form\n"); + fprintf(fp, " \tquery for RRSIG(), defaults to SOA\n"); + return 0; +} + +int +main(int argc, char *argv[]) +{ + ldns_resolver *res; + ldns_resolver *localres; + ldns_rdf *domain; + ldns_pkt *p; + ldns_rr_list *rrsig; + ldns_rr_list *rrsig_type; + ldns_rr_list *ns; + ldns_rr_list *ns_ip; + uint8_t i, j; + ldns_rr_type t; + char * type_name; + time_t incep, expir; + char incep_buf[26]; + char expir_buf[26]; + ldns_status s; + + p = NULL; + rrsig = NULL; + rrsig_type = NULL; + domain = NULL; + + /* option parsing */ + + if (argc < 2) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } else { + /* create a rdf from the command line arg */ + domain = ldns_dname_new_frm_str(argv[1]); + if (!domain) { + usage(stdout, argv[0]); + exit(EXIT_FAILURE); + } + } + + if (argc == 3) { + /* optional type arg */ + type_name = strdup(argv[2]); + t = ldns_rdf2rr_type( + ldns_rdf_new_frm_str(LDNS_RDF_TYPE_TYPE, type_name)); + if (t == 0) { + fprintf(stderr, " *** %s is not a valid RR type\n", type_name); + exit(EXIT_FAILURE); + } + } else { + t = LDNS_RR_TYPE_SOA; + type_name = "SOA"; + } + + /* create a new resolver from /etc/resolv.conf */ + s = ldns_resolver_new_frm_file(&localres, NULL); + if (s != LDNS_STATUS_OK) { + exit(EXIT_FAILURE); + } + + /* first get the nameserver of the domain in question */ + p = ldns_resolver_query(localres, domain, LDNS_RR_TYPE_NS, + LDNS_RR_CLASS_IN, LDNS_RD); + if (!p) { + fprintf(stderr," *** Could not find any nameserver for %s", argv[1]); + ldns_resolver_deep_free(localres); + exit(EXIT_FAILURE); + } + ns = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NS, LDNS_SECTION_ANSWER); + + if (!ns) { + fprintf(stderr," *** Could not find any nameserver for %s", argv[1]); + ldns_pkt_free(p); + ldns_resolver_deep_free(localres); + exit(EXIT_FAILURE); + } + + /* use our local resolver to resolv the names in the for usage in our + * new resolver */ + res = ldns_resolver_new(); + if (!res) { + ldns_pkt_free(p); + ldns_resolver_deep_free(localres); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } + for(i = 0; i < ldns_rr_list_rr_count(ns); i++) { + ns_ip = ldns_get_rr_list_addr_by_name(localres, + ldns_rr_ns_nsdname(ldns_rr_list_rr(ns, i)), + LDNS_RR_CLASS_IN, LDNS_RD); + /* add these to new resolver */ + for(j = 0; j < ldns_rr_list_rr_count(ns_ip); j++) { + if (ldns_resolver_push_nameserver(res, + ldns_rr_a_address(ldns_rr_list_rr(ns_ip, j))) != LDNS_STATUS_OK) { + printf("Error adding nameserver to resolver\n"); + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + ldns_resolver_deep_free(localres); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } + } + ldns_rr_list_deep_free(ns_ip); + + } + + /* enable DNSSEC */ + ldns_resolver_set_dnssec(res, true); + /* also set CD, we want EVERYTHING! */ + ldns_resolver_set_dnssec_cd(res, true); + + /* use the resolver to send it a query for the soa + * records of the domain given on the command line + */ + ldns_pkt_free(p); + p = ldns_resolver_query(res, domain, LDNS_RR_TYPE_RRSIG, LDNS_RR_CLASS_IN, LDNS_RD); + + ldns_rdf_deep_free(domain); + + if (!p) { + ldns_resolver_deep_free(localres); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } else { + /* retrieve the RRSIG records from the answer section of that + * packet + */ + rrsig = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_RRSIG, LDNS_SECTION_ANSWER); + if (!rrsig) { + fprintf(stderr, + " *** invalid answer name %s after RRSIG query for %s\n", + argv[1], argv[1]); + ldns_pkt_free(p); + ldns_resolver_deep_free(res); + ldns_rr_list_deep_free(ns); + exit(EXIT_FAILURE); + } else { + rrsig_type = ldns_rr_list_new(); + + for(i = 0; i < ldns_rr_list_rr_count(rrsig); i++) { + if (ldns_rdf2rr_type( + ldns_rr_rrsig_typecovered( + ldns_rr_list_rr(rrsig, i))) == t) { + ldns_rr_list_push_rr(rrsig_type, + ldns_rr_list_rr(rrsig, i)); + } + } + if (ldns_rr_list_rr_count(rrsig_type) == 0) { + fprintf(stderr, " *** No RRSIG(%s) type found\n", + type_name); + ldns_resolver_deep_free(localres); + ldns_resolver_deep_free(res); + ldns_pkt_free(p); + ldns_rr_list_deep_free(ns); + ldns_rr_list_free(rrsig); + ldns_rr_list_deep_free(rrsig_type); + exit(EXIT_FAILURE); + } + + for(i = 0; i < ldns_rr_list_rr_count(rrsig_type); i++) { + incep = ldns_rdf2native_time_t( + ldns_rr_rrsig_inception( + ldns_rr_list_rr(rrsig_type, i))); + expir = ldns_rdf2native_time_t( + ldns_rr_rrsig_expiration( + ldns_rr_list_rr(rrsig_type, i))); + + /* convert to human readable */ + ctime_r(&incep, incep_buf); + ctime_r(&expir, expir_buf); + /* kill the newline */ + incep_buf[24] = '\0'; + expir_buf[24] = '\0'; + + fprintf(stdout, "%s RRSIG(%s): %s - %s\n", + argv[1], type_name, incep_buf, expir_buf); + } + ldns_rr_list_free(rrsig); + ldns_rr_list_deep_free(rrsig_type); + } + } + ldns_pkt_free(p); + ldns_resolver_deep_free(localres); + ldns_resolver_deep_free(res); + ldns_rr_list_deep_free(ns); + return 0; +} diff --git a/libs/ldns/examples/ldns-signzone.1 b/libs/ldns/examples/ldns-signzone.1 new file mode 100644 index 0000000000..0ac7c8094f --- /dev/null +++ b/libs/ldns/examples/ldns-signzone.1 @@ -0,0 +1,159 @@ +.TH ldns-signzone 1 "30 May 2005" +.SH NAME +ldns-signzone \- sign a zonefile with DNSSEC data +.SH SYNOPSIS +.B ldns-signzone +[ +.IR OPTIONS +] +.IR ZONEFILE +.IR +KEY +[KEY +[KEY] ... +] + +.SH DESCRIPTION + +\fBldns-signzone\fR is used to generate a DNSSEC signed zone. When run it +will create a new zonefile that contains RRSIG and NSEC resource records, as +specified in RFC 4033, RFC 4034 and RFC 4035. + +Keys must be specified by their base name (i.e. without .private). If +the DNSKEY that belongs to the key in the .private file is not present +in the zone, it will be read from the file .key. If that +file does not exist, the DNSKEY value will be generated from the +private key. + +Multiple keys can be specified, Key Signing Keys are used as such when +they are either already present in the zone, or specified in a .key +file, and have the KSK bit set. + +.SH OPTIONS +.TP +\fB-d\fR +Normally, if the DNSKEY RR for a key that is used to sign the zone is +not found in the zone file, it will be read from .key, or derived from +the private key (in that order). This option turns that feature off, +so that only the signatures are added to the zone. + +.TP +\fB-e\fR \fIdate\fR +Set expiration date of the signatures to this date, the format can be +YYYYMMDD[hhmmss], or a timestamp. + +.TP +\fB-f\fR \fIfile\fR +Use this file to store the signed zone in (default .signed) + +.TP +\fB-i\fR \fIdate\fR +Set inception date of the signatures to this date, the format can be +YYYYMMDD[hhmmss], or a timestamp. + +.TP +\fB-l\fR +Leave old DNSSEC RRSIGS and NSEC records intact (by default, they are +removed from the zone) + +.TP +\fB-o\fR \fIorigin\fR +Use this as the origin of the zone + +.TP +\fB-v\fR +Print the version and exit + +.TP +\fB-A\fR +Sign the DNSKEY record with all keys. By default it is signed with a +minimal number of keys, to keep the response size for the DNSKEY query +small, and only the SEP keys that are passed are used. If there are no +SEP keys, the DNSKEY RRset is signed with the non\-SEP keys. This option +turns off the default and all keys are used to sign the DNSKEY RRset. + +.TP +\fB-E\fR \fIname\fR +Use the EVP cryptographic engine with the given name for signing. This +can have some extra options; see ENGINE OPTIONS for more information. + +.TP +\fB-k\fR \fIid,int\fR +Use the key with the given id as the signing key for algorithm int as +a Zone signing key. This option is used when you use an OpenSSL +engine, see ENGINE OPTIONS for more information. + +.TP +\fB-K\fR \fIid,int\fR + +Use the key with the given id as the signing key for algorithm int as +a Key signing key. This options is used when you use an OpenSSL engine, +see ENGINE OPTIONS for more information. + +.TP +\fB-n\fR +Use NSEC3 instead of NSEC. + +.TP +If you use NSEC3, you can specify the following extra options: + +.TP +\fB-a\fR \fIalgorithm\fR +Algorithm used to create the hashed NSEC3 owner names + +.TP +\fB-p\fR +Opt-out. All NSEC3 records in the zone will have the Opt-out flag set. After signing, you can add insecure delegations to the signed zone. + +.TP +\fB-s\fR \fIstring\fR +Salt + +.TP +\fB-t\fR \fInumber\fR +Number of hash iterations + +.SH ENGINE OPTIONS +You can modify the possible engines, if supported, by setting an +OpenSSL configuration file. This is done through the environment +variable OPENSSL_CONF. If you use -E with a non-existent engine name, +ldns-signzone will print a list of engines supported by your +configuration. + +The key options (-k and -K) work as follows; you specify a key id, and a DNSSEC algorithm number (for instance, 5 for RSASHA1). The key id can be any of the following: + + + : + id_ + slot_-id_ + label_
\n"); + fprintf(output, "Listens on the specified port and answers queries for the given zone\n"); + fprintf(output, "This is NOT a full-fledged authoritative nameserver!\n"); +} + +static int udp_bind(int sock, int port, const char *my_address) +{ + struct sockaddr_in addr; + in_addr_t maddr = INADDR_ANY; + + if (my_address) { +#ifdef AF_INET6 + if (inet_pton(AF_INET6, my_address, &maddr) < 1) { +#else + if (0) { +#endif + if (inet_pton(AF_INET, my_address, &maddr) < 1) { + return -2; + } + } + } + + addr.sin_family = AF_INET; + addr.sin_port = (in_port_t) htons((uint16_t)port); + addr.sin_addr.s_addr = maddr; + return bind(sock, (struct sockaddr *)&addr, (socklen_t) sizeof(addr)); +} + +/* this will probably be moved to a better place in the library itself */ +ldns_rr_list * +get_rrset(const ldns_zone *zone, const ldns_rdf *owner_name, const ldns_rr_type qtype, const ldns_rr_class qclass) +{ + uint16_t i; + ldns_rr_list *rrlist = ldns_rr_list_new(); + ldns_rr *cur_rr; + if (!zone || !owner_name) { + fprintf(stderr, "Warning: get_rrset called with NULL zone or owner name\n"); + return rrlist; + } + + for (i = 0; i < ldns_zone_rr_count(zone); i++) { + cur_rr = ldns_rr_list_rr(ldns_zone_rrs(zone), i); + if (ldns_dname_compare(ldns_rr_owner(cur_rr), owner_name) == 0 && + ldns_rr_get_class(cur_rr) == qclass && + ldns_rr_get_type(cur_rr) == qtype + ) { + ldns_rr_list_push_rr(rrlist, ldns_rr_clone(cur_rr)); + } + } + + printf("Found rrset of %u rrs\n", (unsigned int) ldns_rr_list_rr_count(rrlist)); + + return rrlist; +} + +int +main(int argc, char **argv) +{ + /* arguments */ + int port; + const char *zone_file; + + /* network */ + int sock; + ssize_t nb; + struct sockaddr addr_me; + struct sockaddr addr_him; + socklen_t hislen = (socklen_t) sizeof(addr_him); + uint8_t inbuf[INBUF_SIZE]; + uint8_t *outbuf; + + /* dns */ + ldns_status status; + ldns_pkt *query_pkt; + ldns_pkt *answer_pkt; + size_t answer_size; + ldns_rr *query_rr; + ldns_rr_list *answer_qr; + ldns_rr_list *answer_an; + ldns_rr_list *answer_ns; + ldns_rr_list *answer_ad; + ldns_rdf *origin = NULL; + + /* zone */ + ldns_zone *zone; + int line_nr; + FILE *zone_fp; + + /* use this to listen on specified interfaces later? */ + char *my_address = NULL; + + if (argc < 5) { + usage(stderr); + exit(EXIT_FAILURE); + } else { + my_address = argv[1]; + port = atoi(argv[2]); + if (port < 1) { + usage(stderr); + exit(EXIT_FAILURE); + } + if (ldns_str2rdf_dname(&origin, argv[3]) != LDNS_STATUS_OK) { + fprintf(stderr, "Bad origin, not a correct domain name\n"); + usage(stderr); + exit(EXIT_FAILURE); + } + zone_file = argv[4]; + } + + printf("Reading zone file %s\n", zone_file); + zone_fp = fopen(zone_file, "r"); + if (!zone_fp) { + fprintf(stderr, "Unable to open %s: %s\n", zone_file, strerror(errno)); + exit(EXIT_FAILURE); + } + + line_nr = 0; + status = ldns_zone_new_frm_fp_l(&zone, zone_fp, origin, 0, LDNS_RR_CLASS_IN, &line_nr); + + if (status != LDNS_STATUS_OK) { + printf("Zone reader failed, aborting\n"); + exit(EXIT_FAILURE); + } else { + printf("Read %u resource records in zone file\n", (unsigned int) ldns_zone_rr_count(zone)); + } + fclose(zone_fp); + + printf("Listening on port %d\n", port); + sock = socket(AF_INET, SOCK_DGRAM, 0); + if (sock < 0) { + fprintf(stderr, "%s: socket(): %s\n", argv[0], strerror(errno)); + exit(1); + } + memset(&addr_me, 0, sizeof(addr_me)); + + /* bind: try all ports in that range */ + if (udp_bind(sock, port, my_address)) { + fprintf(stderr, "%s: cannot bind(): %s\n", argv[0], strerror(errno)); + exit(errno); + } + + /* Done. Now receive */ + while (1) { + nb = recvfrom(sock, (void*)inbuf, INBUF_SIZE, 0, + &addr_him, &hislen); + if (nb < 1) { + fprintf(stderr, "%s: recvfrom(): %s\n", + argv[0], strerror(errno)); + exit(1); + } + + /* + show(inbuf, nb, nn, hp, sp, ip, bp); + */ + printf("Got query of %u bytes\n", (unsigned int) nb); + status = ldns_wire2pkt(&query_pkt, inbuf, (size_t) nb); + if (status != LDNS_STATUS_OK) { + printf("Got bad packet: %s\n", ldns_get_errorstr_by_id(status)); + } else { + ldns_pkt_print(stdout, query_pkt); + } + + query_rr = ldns_rr_list_rr(ldns_pkt_question(query_pkt), 0); + printf("QUERY RR: \n"); + ldns_rr_print(stdout, query_rr); + + answer_qr = ldns_rr_list_new(); + ldns_rr_list_push_rr(answer_qr, ldns_rr_clone(query_rr)); + + answer_an = get_rrset(zone, ldns_rr_owner(query_rr), ldns_rr_get_type(query_rr), ldns_rr_get_class(query_rr)); + answer_pkt = ldns_pkt_new(); + answer_ns = ldns_rr_list_new(); + answer_ad = ldns_rr_list_new(); + + ldns_pkt_set_qr(answer_pkt, 1); + ldns_pkt_set_aa(answer_pkt, 1); + ldns_pkt_set_id(answer_pkt, ldns_pkt_id(query_pkt)); + + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_QUESTION, answer_qr); + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_ANSWER, answer_an); + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_AUTHORITY, answer_ns); + ldns_pkt_push_rr_list(answer_pkt, LDNS_SECTION_ADDITIONAL, answer_ad); + + status = ldns_pkt2wire(&outbuf, answer_pkt, &answer_size); + + printf("Answer packet size: %u bytes.\n", (unsigned int) answer_size); + if (status != LDNS_STATUS_OK) { + printf("Error creating answer: %s\n", ldns_get_errorstr_by_id(status)); + } else { + nb = sendto(sock, (void*)outbuf, answer_size, 0, + &addr_him, hislen); + } + + ldns_pkt_free(query_pkt); + ldns_pkt_free(answer_pkt); + LDNS_FREE(outbuf); + ldns_rr_list_free(answer_qr); + ldns_rr_list_free(answer_an); + ldns_rr_list_free(answer_ns); + ldns_rr_list_free(answer_ad); + } + + ldns_rdf_deep_free(origin); + ldns_zone_deep_free(zone); + + return 0; +} diff --git a/libs/ldns/higher.c b/libs/ldns/higher.c new file mode 100644 index 0000000000..1563e821b6 --- /dev/null +++ b/libs/ldns/higher.c @@ -0,0 +1,354 @@ +/* + * higher.c + * + * Specify some higher level functions that would + * be usefull to would be developers + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ + +ldns_rr_list * +ldns_get_rr_list_addr_by_name(ldns_resolver *res, ldns_rdf *name, ldns_rr_class c, + uint16_t flags) +{ + ldns_pkt *pkt; + ldns_rr_list *aaaa; + ldns_rr_list *a; + ldns_rr_list *result = NULL; + ldns_rr_list *hostsfilenames; + size_t i; + uint8_t ip6; + + a = NULL; + aaaa = NULL; + result = NULL; + + if (!res) { + return NULL; + } + if (ldns_rdf_get_type(name) != LDNS_RDF_TYPE_DNAME) { + return NULL; + } + + ip6 = ldns_resolver_ip6(res); /* we use INET_ANY here, save + what was there */ + + ldns_resolver_set_ip6(res, LDNS_RESOLV_INETANY); + + hostsfilenames = ldns_get_rr_list_hosts_frm_file(NULL); + for (i = 0; i < ldns_rr_list_rr_count(hostsfilenames); i++) { + if (ldns_rdf_compare(name, + ldns_rr_owner(ldns_rr_list_rr(hostsfilenames, + i))) == 0) { + if (!result) { + result = ldns_rr_list_new(); + } + ldns_rr_list_push_rr(result, + ldns_rr_clone(ldns_rr_list_rr(hostsfilenames, i))); + } + } + ldns_rr_list_deep_free(hostsfilenames); + + if (result) { + return result; + } + + /* add the RD flags, because we want an answer */ + pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_AAAA, c, flags | LDNS_RD); + if (pkt) { + /* extract the data we need */ + aaaa = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_AAAA, + LDNS_SECTION_ANSWER); + ldns_pkt_free(pkt); + } + + pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_A, c, flags | LDNS_RD); + if (pkt) { + /* extract the data we need */ + a = ldns_pkt_rr_list_by_type(pkt, LDNS_RR_TYPE_A, LDNS_SECTION_ANSWER); + ldns_pkt_free(pkt); + } + ldns_resolver_set_ip6(res, ip6); + + if (aaaa && a) { + result = ldns_rr_list_cat_clone(aaaa, a); + ldns_rr_list_deep_free(aaaa); + ldns_rr_list_deep_free(a); + return result; + } + + if (aaaa) { + result = ldns_rr_list_clone(aaaa); + } + + if (a) { + result = ldns_rr_list_clone(a); + } + + ldns_rr_list_deep_free(aaaa); + ldns_rr_list_deep_free(a); + return result; +} + +ldns_rr_list * +ldns_get_rr_list_name_by_addr(ldns_resolver *res, ldns_rdf *addr, ldns_rr_class c, + uint16_t flags) +{ + ldns_pkt *pkt; + ldns_rr_list *names; + ldns_rdf *name; + + names = NULL; + + if (!res || !addr) { + return NULL; + } + + if (ldns_rdf_get_type(addr) != LDNS_RDF_TYPE_A && + ldns_rdf_get_type(addr) != LDNS_RDF_TYPE_AAAA) { + return NULL; + } + + name = ldns_rdf_address_reverse(addr); + + /* add the RD flags, because we want an answer */ + pkt = ldns_resolver_query(res, name, LDNS_RR_TYPE_PTR, c, flags | LDNS_RD); + if (pkt) { + /* extract the data we need */ + names = ldns_pkt_rr_list_by_type(pkt, + LDNS_RR_TYPE_PTR, LDNS_SECTION_ANSWER); + } + return names; +} + +/* read a line, put it in a buffer, parse the buffer */ +ldns_rr_list * +ldns_get_rr_list_hosts_frm_fp(FILE *fp) +{ + return ldns_get_rr_list_hosts_frm_fp_l(fp, NULL); +} + +ldns_rr_list * +ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr) +{ + ssize_t i, j; + size_t cnt; + char *line; + char *word; + char *addr; + char *rr_str; + ldns_buffer *linebuf; + ldns_rr *rr; + ldns_rr_list *list; + ldns_rdf *tmp; + bool ip6; + ldns_status parse_result; + + line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + word = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + addr = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + rr_str = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + ip6 = false; + list = ldns_rr_list_new(); + rr = NULL; + if(!line || !word || !addr || !rr_str || !list) { + LDNS_FREE(line); + LDNS_FREE(word); + LDNS_FREE(addr); + LDNS_FREE(rr_str); + ldns_rr_list_free(list); + return NULL; + } + + for(i = ldns_fget_token_l(fp, line, "\n", LDNS_MAX_LINELEN, line_nr); + i > 0; i = ldns_fget_token_l(fp, line, "\n", LDNS_MAX_LINELEN, line_nr)) { + /* # is comment */ + if (line[0] == '#') { + continue; + } + /* put it in a buffer for further processing */ + linebuf = LDNS_MALLOC(ldns_buffer); + if(!linebuf) { + LDNS_FREE(line); + LDNS_FREE(word); + LDNS_FREE(addr); + LDNS_FREE(rr_str); + ldns_rr_list_deep_free(list); + return NULL; + } + + ldns_buffer_new_frm_data(linebuf, line, (size_t) i); + for(cnt = 0, j = ldns_bget_token(linebuf, word, LDNS_PARSE_NO_NL, LDNS_MAX_LINELEN); + j > 0; + j = ldns_bget_token(linebuf, word, LDNS_PARSE_NO_NL, LDNS_MAX_LINELEN), cnt++) { + if (cnt == 0) { + /* the address */ + if ((tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, + word))) { + /* ip6 */ + ldns_rdf_deep_free(tmp); + ip6 = true; + } else { + if ((tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, + word))) { + /* ip4 */ + ldns_rdf_deep_free(tmp); + ip6 = false; + } else { + /* kaput */ + break; + } + } + (void)strlcpy(addr, word, LDNS_MAX_LINELEN+1); + } else { + /* la al la la */ + if (ip6) { + snprintf(rr_str, LDNS_MAX_LINELEN, + "%s IN AAAA %s", word, addr); + } else { + snprintf(rr_str, LDNS_MAX_LINELEN, + "%s IN A %s", word, addr); + } + parse_result = ldns_rr_new_frm_str(&rr, rr_str, 0, NULL, NULL); + if (parse_result == LDNS_STATUS_OK && ldns_rr_owner(rr) && ldns_rr_rd_count(rr) > 0) { + ldns_rr_list_push_rr(list, ldns_rr_clone(rr)); + } + ldns_rr_free(rr); + } + } + ldns_buffer_free(linebuf); + } + LDNS_FREE(line); + LDNS_FREE(word); + LDNS_FREE(addr); + LDNS_FREE(rr_str); + return list; +} + +ldns_rr_list * +ldns_get_rr_list_hosts_frm_file(char *filename) +{ + ldns_rr_list *names; + FILE *fp; + + if (!filename) { + fp = fopen(LDNS_RESOLV_HOSTS, "r"); + + } else { + fp = fopen(filename, "r"); + } + if (!fp) { + return NULL; + } + + names = ldns_get_rr_list_hosts_frm_fp(fp); + fclose(fp); + return names; +} + +uint16_t +ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, + ldns_rr_list **ret) +{ + ldns_rdf_type t; + uint16_t names_found; + ldns_resolver *r; + ldns_status s; + + t = ldns_rdf_get_type(node); + names_found = 0; + r = res; + + if (res == NULL) { + /* prepare a new resolver, using /etc/resolv.conf as a guide */ + s = ldns_resolver_new_frm_file(&r, NULL); + if (s != LDNS_STATUS_OK) { + return 0; + } + } + + if (t == LDNS_RDF_TYPE_DNAME) { + /* we're asked to query for a name */ + *ret = ldns_get_rr_list_addr_by_name(r, node, c, 0); + names_found = ldns_rr_list_rr_count(*ret); + } + + if (t == LDNS_RDF_TYPE_A || t == LDNS_RDF_TYPE_AAAA) { + /* an address */ + *ret = ldns_get_rr_list_name_by_addr(r, node, c, 0); + names_found = ldns_rr_list_rr_count(*ret); + } + + if (res == NULL) { + ldns_resolver_deep_free(r); + } + + return names_found; +} + +bool +ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t) +{ + /* does the nsec cover the t given? */ + /* copied from host2str.c line 465: ldns_rdf2buffer_str_nsec */ + uint8_t window_block_nr; + uint8_t bitmap_length; + uint16_t type; + uint16_t pos = 0; + uint16_t bit_pos; + ldns_rdf *nsec_type_list = ldns_rr_rdf(nsec, 1); + uint8_t *data = ldns_rdf_data(nsec_type_list); + + while(pos < ldns_rdf_size(nsec_type_list)) { + window_block_nr = data[pos]; + bitmap_length = data[pos + 1]; + pos += 2; + + for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { + if (ldns_get_bit(&data[pos], bit_pos)) { + type = 256 * (uint16_t) window_block_nr + bit_pos; + + if ((ldns_rr_type)type == t) { + /* we have a winner */ + return true; + } + } + } + pos += (uint16_t) bitmap_length; + } + return false; +} + +void +ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...) +{ + int16_t rdf; + ldns_rdf *rd; + va_list va_rdf; + va_start(va_rdf, rdfnum); + + for (rdf = (int16_t)rdfnum; rdf != -1; rdf = (int16_t)va_arg(va_rdf, int)) + { + rd = ldns_rr_rdf(r, rdf); + if (!rd) { + continue; + } else { + ldns_rdf_print(fp, rd); + fprintf(fp, " "); /* not sure if we want to do this */ + } + } + va_end(va_rdf); +} diff --git a/libs/ldns/host2str.c b/libs/ldns/host2str.c new file mode 100644 index 0000000000..6942f6aa3c --- /dev/null +++ b/libs/ldns/host2str.c @@ -0,0 +1,2084 @@ +/* + * host2str.c + * + * conversion routines from the host format + * to the presentation format (strings) + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ +#include + +#include + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#include +#include + +#ifndef INET_ADDRSTRLEN +#define INET_ADDRSTRLEN 16 +#endif +#ifndef INET6_ADDRSTRLEN +#define INET6_ADDRSTRLEN 46 +#endif + +/* lookup tables for standard DNS stuff */ + +/* Taken from RFC 2535, section 7. */ +ldns_lookup_table ldns_algorithms[] = { + { LDNS_RSAMD5, "RSAMD5" }, + { LDNS_DH, "DH" }, + { LDNS_DSA, "DSA" }, + { LDNS_ECC, "ECC" }, + { LDNS_RSASHA1, "RSASHA1" }, + { LDNS_DSA_NSEC3, "DSA-NSEC3-SHA1" }, + { LDNS_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" }, +#ifdef USE_SHA2 + { LDNS_RSASHA256, "RSASHA256"}, + { LDNS_RSASHA512, "RSASHA512"}, +#endif +#ifdef USE_GOST + { LDNS_ECC_GOST, "ECC-GOST"}, +#endif +#ifdef USE_ECDSA + { LDNS_ECDSAP256SHA256, "ECDSAP256SHA256"}, + { LDNS_ECDSAP384SHA384, "ECDSAP384SHA384"}, +#endif + { LDNS_INDIRECT, "INDIRECT" }, + { LDNS_PRIVATEDNS, "PRIVATEDNS" }, + { LDNS_PRIVATEOID, "PRIVATEOID" }, + { 0, NULL } +}; + +/* Taken from RFC 4398 */ +ldns_lookup_table ldns_cert_algorithms[] = { + { LDNS_CERT_PKIX, "PKIX" }, + { LDNS_CERT_SPKI, "SPKI" }, + { LDNS_CERT_PGP, "PGP" }, + { LDNS_CERT_IPKIX, "IPKIX" }, + { LDNS_CERT_ISPKI, "ISPKI" }, + { LDNS_CERT_IPGP, "IPGP" }, + { LDNS_CERT_ACPKIX, "ACPKIX" }, + { LDNS_CERT_IACPKIX, "IACPKIX" }, + { LDNS_CERT_URI, "URI" }, + { LDNS_CERT_OID, "OID" }, + { 0, NULL } +}; + +/* classes */ +ldns_lookup_table ldns_rr_classes[] = { + { LDNS_RR_CLASS_IN, "IN" }, + { LDNS_RR_CLASS_CH, "CH" }, + { LDNS_RR_CLASS_HS, "HS" }, + { LDNS_RR_CLASS_NONE, "NONE" }, + { LDNS_RR_CLASS_ANY, "ANY" }, + { 0, NULL } +}; + +/* if these are used elsewhere */ +ldns_lookup_table ldns_rcodes[] = { + { LDNS_RCODE_NOERROR, "NOERROR" }, + { LDNS_RCODE_FORMERR, "FORMERR" }, + { LDNS_RCODE_SERVFAIL, "SERVFAIL" }, + { LDNS_RCODE_NXDOMAIN, "NXDOMAIN" }, + { LDNS_RCODE_NOTIMPL, "NOTIMPL" }, + { LDNS_RCODE_REFUSED, "REFUSED" }, + { LDNS_RCODE_YXDOMAIN, "YXDOMAIN" }, + { LDNS_RCODE_YXRRSET, "YXRRSET" }, + { LDNS_RCODE_NXRRSET, "NXRRSET" }, + { LDNS_RCODE_NOTAUTH, "NOTAUTH" }, + { LDNS_RCODE_NOTZONE, "NOTZONE" }, + { 0, NULL } +}; + +ldns_lookup_table ldns_opcodes[] = { + { LDNS_PACKET_QUERY, "QUERY" }, + { LDNS_PACKET_IQUERY, "IQUERY" }, + { LDNS_PACKET_STATUS, "STATUS" }, + { LDNS_PACKET_NOTIFY, "NOTIFY" }, + { LDNS_PACKET_UPDATE, "UPDATE" }, + { 0, NULL } +}; + +ldns_status +ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_opcodes, opcode); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "OPCODE%u", opcode); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_rcodes, rcode); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "RCODE%u", rcode); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_algorithm2buffer_str(ldns_buffer *output, + ldns_algorithm algorithm) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_algorithms, + algorithm); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "ALG%u", algorithm); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_cert_algorithm2buffer_str(ldns_buffer *output, + ldns_cert_algorithm cert_algorithm) +{ + ldns_lookup_table *lt = ldns_lookup_by_id(ldns_cert_algorithms, + cert_algorithm); + if (lt && lt->name) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "CERT_ALG%u", + cert_algorithm); + } + return ldns_buffer_status(output); +} + +char * +ldns_pkt_opcode2str(ldns_pkt_opcode opcode) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(12); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_pkt_opcode2buffer_str(buf, opcode) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + +char * +ldns_pkt_rcode2str(ldns_pkt_rcode rcode) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_pkt_rcode2buffer_str(buf, rcode) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + +char * +ldns_pkt_algorithm2str(ldns_algorithm algorithm) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_algorithm2buffer_str(buf, algorithm) + == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + +char * +ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_cert_algorithm2buffer_str(buf, cert_algorithm) + == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + + +/* do NOT pass compressed data here :p */ +ldns_status +ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname) +{ + /* can we do with 1 pos var? or without at all? */ + uint8_t src_pos = 0; + uint8_t len; + uint8_t *data; + uint8_t i; + unsigned char c; + + data = (uint8_t*)ldns_rdf_data(dname); + len = data[src_pos]; + + if (ldns_rdf_size(dname) > LDNS_MAX_DOMAINLEN) { + /* too large, return */ + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + + /* special case: root label */ + if (1 == ldns_rdf_size(dname)) { + ldns_buffer_printf(output, "."); + } else { + while ((len > 0) && src_pos < ldns_rdf_size(dname)) { + src_pos++; + for(i = 0; i < len; i++) { + /* paranoia check for various 'strange' + characters in dnames + */ + c = (unsigned char) data[src_pos]; + if(c == '.' || c == ';' || + c == '(' || c == ')' || + c == '\\') { + ldns_buffer_printf(output, "\\%c", + data[src_pos]); + } else if (!(isascii(c) && isgraph(c))) { + ldns_buffer_printf(output, "\\%03u", + data[src_pos]); + } else { + ldns_buffer_printf(output, "%c", data[src_pos]); + } + src_pos++; + } + + if (src_pos < ldns_rdf_size(dname)) { + ldns_buffer_printf(output, "."); + } + len = data[src_pos]; + } + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint8_t data = ldns_rdf_data(rdf)[0]; + ldns_buffer_printf(output, "%lu", (unsigned long) data); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int16(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + ldns_buffer_printf(output, "%lu", (unsigned long) data); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint32_t data = ldns_read_uint32(ldns_rdf_data(rdf)); + ldns_buffer_printf(output, "%lu", (unsigned long) data); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* create a YYYYMMDDHHMMSS string if possible */ + time_t data_time = (time_t) ldns_read_uint32(ldns_rdf_data(rdf)); + struct tm tm; + char date_buf[16]; + + memset(&tm, 0, sizeof(tm)); + + if (gmtime_r(&data_time, &tm) && strftime(date_buf, 15, "%Y%m%d%H%M%S", &tm)) { + ldns_buffer_printf(output, "%s", date_buf); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf) +{ + char str[INET_ADDRSTRLEN]; + + if (inet_ntop(AF_INET, ldns_rdf_data(rdf), str, INET_ADDRSTRLEN)) { + ldns_buffer_printf(output, "%s", str); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf) +{ + char str[INET6_ADDRSTRLEN]; + + if (inet_ntop(AF_INET6, ldns_rdf_data(rdf), str, INET6_ADDRSTRLEN)) { + ldns_buffer_printf(output, "%s", str); + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf) +{ + const uint8_t *data = ldns_rdf_data(rdf); + uint8_t length = data[0]; + size_t i; + + ldns_buffer_printf(output, "\""); + for (i = 1; i <= length; ++i) { + char ch = (char) data[i]; + if (isprint((int)ch) || ch=='\t') { + if (ch=='\"'||ch=='\\') + ldns_buffer_printf(output, "\\%c", ch); + else + ldns_buffer_printf(output, "%c", ch); + } else { + ldns_buffer_printf(output, "\\%03u", + (unsigned)(uint8_t) ch); + } + } + ldns_buffer_printf(output, "\""); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_b64(ldns_buffer *output, const ldns_rdf *rdf) +{ + size_t size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf)); + char *b64 = LDNS_XMALLOC(char, size); + if(!b64) return LDNS_STATUS_MEM_ERR; + if (ldns_b64_ntop(ldns_rdf_data(rdf), ldns_rdf_size(rdf), b64, size)) { + ldns_buffer_printf(output, "%s", b64); + } + LDNS_FREE(b64); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf) +{ + size_t size; + char *b32; + if(ldns_rdf_size(rdf) == 0) + return LDNS_STATUS_OK; + /* remove -1 for the b32-hash-len octet */ + size = ldns_b32_ntop_calculate_size(ldns_rdf_size(rdf) - 1); + /* add one for the end nul for the string */ + b32 = LDNS_XMALLOC(char, size + 1); + if(!b32) return LDNS_STATUS_MEM_ERR; + size = (size_t) ldns_b32_ntop_extended_hex(ldns_rdf_data(rdf) + 1, + ldns_rdf_size(rdf) - 1, b32, size+1); + if (size > 0) { + ldns_buffer_printf(output, "%s", b32); + } + LDNS_FREE(b32); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf) +{ + size_t i; + for (i = 0; i < ldns_rdf_size(rdf); i++) { + ldns_buffer_printf(output, "%02x", ldns_rdf_data(rdf)[i]); + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + const ldns_rr_descriptor *descriptor; + + descriptor = ldns_rr_descript(data); + if (descriptor && descriptor->_name) { + ldns_buffer_printf(output, "%s", descriptor->_name); + } else { + ldns_buffer_printf(output, "TYPE%u", data); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_class(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + ldns_lookup_table *lt; + + lt = ldns_lookup_by_id(ldns_rr_classes, (int) data); + if (lt) { + ldns_buffer_printf(output, "\t%s", lt->name); + } else { + ldns_buffer_printf(output, "\tCLASS%d", data); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint16_t data = ldns_read_uint16(ldns_rdf_data(rdf)); + ldns_lookup_table *lt; + lt = ldns_lookup_by_id(ldns_cert_algorithms, (int) data); + if (lt) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "%d", data); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_alg(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* don't use algorithm mnemonics in the presentation format + this kind of got sneaked into the rfc's */ + uint8_t data = ldns_rdf_data(rdf)[0]; + ldns_buffer_printf(output, "%d", data); + return ldns_buffer_status(output); +} + +static void +loc_cm_print(ldns_buffer *output, uint8_t mantissa, uint8_t exponent) +{ + uint8_t i; + /* is it 0. ? */ + if(exponent < 2) { + if(exponent == 1) + mantissa *= 10; + ldns_buffer_printf(output, "0.%02ld", (long)mantissa); + return; + } + /* always */ + ldns_buffer_printf(output, "%d", (int)mantissa); + for(i=0; i_name) { + ldns_buffer_printf(output, "%s", descriptor->_name); + } else { + /* exceptions for pseudotypes */ + switch (type) { + case LDNS_RR_TYPE_IXFR: + ldns_buffer_printf(output, "IXFR"); + break; + case LDNS_RR_TYPE_AXFR: + ldns_buffer_printf(output, "AXFR"); + break; + case LDNS_RR_TYPE_MAILA: + ldns_buffer_printf(output, "MAILA"); + break; + case LDNS_RR_TYPE_MAILB: + ldns_buffer_printf(output, "MAILB"); + break; + case LDNS_RR_TYPE_ANY: + ldns_buffer_printf(output, "ANY"); + break; + default: + ldns_buffer_printf(output, "TYPE%u", type); + } + } + return ldns_buffer_status(output); +} + +char * +ldns_rr_type2str(const ldns_rr_type type) +{ + char *str; + ldns_buffer *buf; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_rr_type2buffer_str(buf, type) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + + ldns_buffer_free(buf); + return str; +} + + +ldns_status +ldns_rr_class2buffer_str(ldns_buffer *output, + const ldns_rr_class klass) +{ + ldns_lookup_table *lt; + + lt = ldns_lookup_by_id(ldns_rr_classes, klass); + if (lt) { + ldns_buffer_printf(output, "%s", lt->name); + } else { + ldns_buffer_printf(output, "CLASS%d", klass); + } + return ldns_buffer_status(output); +} + +char * +ldns_rr_class2str(const ldns_rr_class klass) +{ + ldns_buffer *buf; + char *str; + + buf = ldns_buffer_new(10); + if (!buf) { + return NULL; + } + + str = NULL; + if (ldns_rr_class2buffer_str(buf, klass) == LDNS_STATUS_OK) { + str = ldns_buffer2str(buf); + } + ldns_buffer_free(buf); + return str; +} + +ldns_status +ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* we could do checking (ie degrees < 90 etc)? */ + uint8_t version = ldns_rdf_data(rdf)[0]; + uint8_t size; + uint8_t horizontal_precision; + uint8_t vertical_precision; + uint32_t longitude; + uint32_t latitude; + uint32_t altitude; + char northerness; + char easterness; + uint32_t h; + uint32_t m; + double s; + + uint32_t equator = (uint32_t) ldns_power(2, 31); + + if (version == 0) { + size = ldns_rdf_data(rdf)[1]; + horizontal_precision = ldns_rdf_data(rdf)[2]; + vertical_precision = ldns_rdf_data(rdf)[3]; + + latitude = ldns_read_uint32(&ldns_rdf_data(rdf)[4]); + longitude = ldns_read_uint32(&ldns_rdf_data(rdf)[8]); + altitude = ldns_read_uint32(&ldns_rdf_data(rdf)[12]); + + if (latitude > equator) { + northerness = 'N'; + latitude = latitude - equator; + } else { + northerness = 'S'; + latitude = equator - latitude; + } + h = latitude / (1000 * 60 * 60); + latitude = latitude % (1000 * 60 * 60); + m = latitude / (1000 * 60); + latitude = latitude % (1000 * 60); + s = (double) latitude / 1000.0; + ldns_buffer_printf(output, "%02u %02u %0.3f %c ", + h, m, s, northerness); + + if (longitude > equator) { + easterness = 'E'; + longitude = longitude - equator; + } else { + easterness = 'W'; + longitude = equator - longitude; + } + h = longitude / (1000 * 60 * 60); + longitude = longitude % (1000 * 60 * 60); + m = longitude / (1000 * 60); + longitude = longitude % (1000 * 60); + s = (double) longitude / (1000.0); + ldns_buffer_printf(output, "%02u %02u %0.3f %c ", + h, m, s, easterness); + + + s = ((double) altitude) / 100; + s -= 100000; + + if(altitude%100 != 0) + ldns_buffer_printf(output, "%.2f", s); + else + ldns_buffer_printf(output, "%.0f", s); + + ldns_buffer_printf(output, "m "); + + loc_cm_print(output, (size & 0xf0) >> 4, size & 0x0f); + ldns_buffer_printf(output, "m "); + + loc_cm_print(output, (horizontal_precision & 0xf0) >> 4, + horizontal_precision & 0x0f); + ldns_buffer_printf(output, "m "); + + loc_cm_print(output, (vertical_precision & 0xf0) >> 4, + vertical_precision & 0x0f); + ldns_buffer_printf(output, "m"); + + return ldns_buffer_status(output); + } else { + return ldns_rdf2buffer_str_hex(output, rdf); + } +} + +ldns_status +ldns_rdf2buffer_str_unknown(ldns_buffer *output, const ldns_rdf *rdf) +{ + ldns_buffer_printf(output, "\\# %u ", ldns_rdf_size(rdf)); + return ldns_rdf2buffer_str_hex(output, rdf); +} + +ldns_status +ldns_rdf2buffer_str_nsap(ldns_buffer *output, const ldns_rdf *rdf) +{ + ldns_buffer_printf(output, "0x"); + return ldns_rdf2buffer_str_hex(output, rdf); +} + +ldns_status +ldns_rdf2buffer_str_atma(ldns_buffer *output, const ldns_rdf *rdf) +{ + return ldns_rdf2buffer_str_hex(output, rdf); +} + +ldns_status +ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* protocol, followed by bitmap of services */ + struct protoent *protocol; + char *proto_name = NULL; + uint8_t protocol_nr; + struct servent *service; + uint16_t current_service; + + protocol_nr = ldns_rdf_data(rdf)[0]; + protocol = getprotobynumber((int) protocol_nr); + if (protocol && (protocol->p_name != NULL)) { + proto_name = protocol->p_name; + ldns_buffer_printf(output, "%s ", protocol->p_name); + } else { + ldns_buffer_printf(output, "%u ", protocol_nr); + } + +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + + for (current_service = 0; + current_service < ldns_rdf_size(rdf) * 7; current_service++) { + if (ldns_get_bit(&(ldns_rdf_data(rdf)[1]), current_service)) { + service = getservbyport((int) htons(current_service), + proto_name); + if (service && service->s_name) { + ldns_buffer_printf(output, "%s ", service->s_name); + } else { + ldns_buffer_printf(output, "%u ", current_service); + } +#ifdef HAVE_ENDSERVENT + endservent(); +#endif + } + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* Note: this code is duplicated in higher.c in + * ldns_nsec_type_check() function + */ + uint8_t window_block_nr; + uint8_t bitmap_length; + uint16_t type; + uint16_t pos = 0; + uint16_t bit_pos; + uint8_t *data = ldns_rdf_data(rdf); + const ldns_rr_descriptor *descriptor; + + while(pos < ldns_rdf_size(rdf)) { + window_block_nr = data[pos]; + bitmap_length = data[pos + 1]; + pos += 2; + + for (bit_pos = 0; bit_pos < (bitmap_length) * 8; bit_pos++) { + if (ldns_get_bit(&data[pos], bit_pos)) { + type = 256 * (uint16_t) window_block_nr + bit_pos; + descriptor = ldns_rr_descript(type); + + if (descriptor && descriptor->_name) { + ldns_buffer_printf(output, "%s ", + descriptor->_name); + } else { + ldns_buffer_printf(output, "TYPE%u ", type); + } + } + } + + pos += (uint16_t) bitmap_length; + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint8_t salt_length; + uint8_t salt_pos; + + uint8_t *data = ldns_rdf_data(rdf); + + if(ldns_rdf_size(rdf) == 0) { + output->_status = LDNS_STATUS_ERR; + return ldns_buffer_status(output); + } + salt_length = data[0]; + /* from now there are variable length entries so remember pos */ + if (salt_length == 0 || ((size_t)salt_length)+1 > ldns_rdf_size(rdf)) { + ldns_buffer_printf(output, "- "); + } else { + for (salt_pos = 0; salt_pos < salt_length; salt_pos++) { + ldns_buffer_printf(output, "%02x", data[1 + salt_pos]); + } + ldns_buffer_printf(output, " "); + } + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* period is the number of seconds */ + uint32_t p = ldns_read_uint32(ldns_rdf_data(rdf)); + ldns_buffer_printf(output, "%u", p); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_tsigtime(ldns_buffer *output,const ldns_rdf *rdf) +{ + /* tsigtime is 48 bits network order unsigned integer */ + uint64_t tsigtime = 0; + uint8_t *data = ldns_rdf_data(rdf); + + if (ldns_rdf_size(rdf) != 6) { + return LDNS_STATUS_ERR; + } + + tsigtime = ldns_read_uint16(data); + tsigtime *= 65536; + tsigtime += ldns_read_uint16(data+2); + tsigtime *= 65536; + + ldns_buffer_printf(output, "%llu ", tsigtime); + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf) +{ + uint8_t *data = ldns_rdf_data(rdf); + uint16_t address_family; + uint8_t prefix; + bool negation; + uint8_t adf_length; + size_t i; + size_t pos = 0; + + while (pos < (unsigned int) ldns_rdf_size(rdf)) { + if(pos + 3 >= (unsigned)ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + address_family = ldns_read_uint16(&data[pos]); + prefix = data[pos + 2]; + negation = data[pos + 3] & LDNS_APL_NEGATION; + adf_length = data[pos + 3] & LDNS_APL_MASK; + if (address_family == LDNS_APL_IP4) { + /* check if prefix < 32? */ + if (negation) { + ldns_buffer_printf(output, "!"); + } + ldns_buffer_printf(output, "%u:", address_family); + /* address is variable length 0 - 4 */ + for (i = 0; i < 4; i++) { + if (i > 0) { + ldns_buffer_printf(output, "."); + } + if (i < (unsigned short) adf_length) { + if(pos+i+4 >= ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + ldns_buffer_printf(output, "%d", + data[pos + i + 4]); + } else { + ldns_buffer_printf(output, "0"); + } + } + ldns_buffer_printf(output, "/%u ", prefix); + } else if (address_family == LDNS_APL_IP6) { + /* check if prefix < 128? */ + if (negation) { + ldns_buffer_printf(output, "!"); + } + ldns_buffer_printf(output, "%u:", address_family); + /* address is variable length 0 - 16 */ + for (i = 0; i < 16; i++) { + if (i % 2 == 0 && i > 0) { + ldns_buffer_printf(output, ":"); + } + if (i < (unsigned short) adf_length) { + if(pos+i+4 >= ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + ldns_buffer_printf(output, "%02x", + data[pos + i + 4]); + } else { + ldns_buffer_printf(output, "00"); + } + } + ldns_buffer_printf(output, "/%u ", prefix); + + } else { + /* unknown address family */ + ldns_buffer_printf(output, "Unknown address family: %u data: ", + address_family); + for (i = 1; i < (unsigned short) (4 + adf_length); i++) { + if(pos+i >= ldns_rdf_size(rdf)) + return LDNS_STATUS_SYNTAX_RDATA_ERR; + ldns_buffer_printf(output, "%02x", data[i]); + } + } + pos += 4 + adf_length; + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* Subtract the size (2) of the number that specifies the length */ + size_t size = ldns_b64_ntop_calculate_size(ldns_rdf_size(rdf) - 2); + char *b64 = LDNS_XMALLOC(char, size); + if(!b64) + return LDNS_STATUS_MEM_ERR; + + ldns_buffer_printf(output, "%u ", ldns_rdf_size(rdf) - 2); + + if (ldns_rdf_size(rdf) > 2 && + ldns_b64_ntop(ldns_rdf_data(rdf) + 2, + ldns_rdf_size(rdf) - 2, + b64, size)) { + ldns_buffer_printf(output, "%s", b64); + } + LDNS_FREE(b64); + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* wire format from + http://www.ietf.org/internet-drafts/draft-ietf-ipseckey-rr-12.txt + */ + uint8_t *data = ldns_rdf_data(rdf); + uint8_t precedence; + uint8_t gateway_type; + uint8_t algorithm; + + ldns_rdf *gateway = NULL; + uint8_t *gateway_data; + + size_t public_key_size; + uint8_t *public_key_data; + ldns_rdf *public_key; + + size_t offset = 0; + ldns_status status; + + precedence = data[0]; + gateway_type = data[1]; + algorithm = data[2]; + offset = 3; + + switch (gateway_type) { + case 0: + /* no gateway */ + break; + case 1: + gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP4ADDRLEN); + if(!gateway_data) + return LDNS_STATUS_MEM_ERR; + memcpy(gateway_data, &data[offset], LDNS_IP4ADDRLEN); + gateway = ldns_rdf_new(LDNS_RDF_TYPE_A, LDNS_IP4ADDRLEN , gateway_data); + offset += LDNS_IP4ADDRLEN; + if(!gateway) { + LDNS_FREE(gateway_data); + return LDNS_STATUS_MEM_ERR; + } + break; + case 2: + gateway_data = LDNS_XMALLOC(uint8_t, LDNS_IP6ADDRLEN); + if(!gateway_data) + return LDNS_STATUS_MEM_ERR; + memcpy(gateway_data, &data[offset], LDNS_IP6ADDRLEN); + offset += LDNS_IP6ADDRLEN; + gateway = + ldns_rdf_new(LDNS_RDF_TYPE_AAAA, LDNS_IP6ADDRLEN, gateway_data); + if(!gateway) { + LDNS_FREE(gateway_data); + return LDNS_STATUS_MEM_ERR; + } + break; + case 3: + status = ldns_wire2dname(&gateway, data, ldns_rdf_size(rdf), &offset); + if(status != LDNS_STATUS_OK) + return status; + break; + default: + /* error? */ + break; + } + + public_key_size = ldns_rdf_size(rdf) - offset; + public_key_data = LDNS_XMALLOC(uint8_t, public_key_size); + if(!public_key_data) { + ldns_rdf_free(gateway); + return LDNS_STATUS_MEM_ERR; + } + memcpy(public_key_data, &data[offset], public_key_size); + public_key = ldns_rdf_new(LDNS_RDF_TYPE_B64, public_key_size, public_key_data); + if(!public_key) { + LDNS_FREE(public_key_data); + ldns_rdf_free(gateway); + return LDNS_STATUS_MEM_ERR; + } + + ldns_buffer_printf(output, "%u %u %u ", precedence, gateway_type, algorithm); + if (gateway) + (void) ldns_rdf2buffer_str(output, gateway); + else + ldns_buffer_printf(output, "."); + ldns_buffer_printf(output, " "); + (void) ldns_rdf2buffer_str(output, public_key); + + ldns_rdf_free(gateway); + ldns_rdf_free(public_key); + + return ldns_buffer_status(output); +} + +ldns_status +ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf) +{ + /* TSIG RRs have no presentation format, make them #size */ + return ldns_rdf2buffer_str_unknown(output, rdf); +} + + +ldns_status +ldns_rdf2buffer_str(ldns_buffer *buffer, const ldns_rdf *rdf) +{ + ldns_status res = LDNS_STATUS_OK; + + /*ldns_buffer_printf(buffer, "%u:", ldns_rdf_get_type(rdf));*/ + if (rdf) { + switch(ldns_rdf_get_type(rdf)) { + case LDNS_RDF_TYPE_NONE: + break; + case LDNS_RDF_TYPE_DNAME: + res = ldns_rdf2buffer_str_dname(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT8: + res = ldns_rdf2buffer_str_int8(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT16: + res = ldns_rdf2buffer_str_int16(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT32: + res = ldns_rdf2buffer_str_int32(buffer, rdf); + break; + case LDNS_RDF_TYPE_PERIOD: + res = ldns_rdf2buffer_str_period(buffer, rdf); + break; + case LDNS_RDF_TYPE_TSIGTIME: + res = ldns_rdf2buffer_str_tsigtime(buffer, rdf); + break; + case LDNS_RDF_TYPE_A: + res = ldns_rdf2buffer_str_a(buffer, rdf); + break; + case LDNS_RDF_TYPE_AAAA: + res = ldns_rdf2buffer_str_aaaa(buffer, rdf); + break; + case LDNS_RDF_TYPE_STR: + res = ldns_rdf2buffer_str_str(buffer, rdf); + break; + case LDNS_RDF_TYPE_APL: + res = ldns_rdf2buffer_str_apl(buffer, rdf); + break; + case LDNS_RDF_TYPE_B32_EXT: + res = ldns_rdf2buffer_str_b32_ext(buffer, rdf); + break; + case LDNS_RDF_TYPE_B64: + res = ldns_rdf2buffer_str_b64(buffer, rdf); + break; + case LDNS_RDF_TYPE_HEX: + res = ldns_rdf2buffer_str_hex(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSEC: + res = ldns_rdf2buffer_str_nsec(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSEC3_SALT: + res = ldns_rdf2buffer_str_nsec3_salt(buffer, rdf); + break; + case LDNS_RDF_TYPE_TYPE: + res = ldns_rdf2buffer_str_type(buffer, rdf); + break; + case LDNS_RDF_TYPE_CLASS: + res = ldns_rdf2buffer_str_class(buffer, rdf); + break; + case LDNS_RDF_TYPE_CERT_ALG: + res = ldns_rdf2buffer_str_cert_alg(buffer, rdf); + break; + case LDNS_RDF_TYPE_ALG: + res = ldns_rdf2buffer_str_alg(buffer, rdf); + break; + case LDNS_RDF_TYPE_UNKNOWN: + res = ldns_rdf2buffer_str_unknown(buffer, rdf); + break; + case LDNS_RDF_TYPE_TIME: + res = ldns_rdf2buffer_str_time(buffer, rdf); + break; + case LDNS_RDF_TYPE_LOC: + res = ldns_rdf2buffer_str_loc(buffer, rdf); + break; + case LDNS_RDF_TYPE_WKS: + case LDNS_RDF_TYPE_SERVICE: + res = ldns_rdf2buffer_str_wks(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSAP: + res = ldns_rdf2buffer_str_nsap(buffer, rdf); + break; + case LDNS_RDF_TYPE_ATMA: + res = ldns_rdf2buffer_str_atma(buffer, rdf); + break; + case LDNS_RDF_TYPE_IPSECKEY: + res = ldns_rdf2buffer_str_ipseckey(buffer, rdf); + break; + case LDNS_RDF_TYPE_TSIG: + res = ldns_rdf2buffer_str_tsig(buffer, rdf); + break; + case LDNS_RDF_TYPE_INT16_DATA: + res = ldns_rdf2buffer_str_int16_data(buffer, rdf); + break; + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + res = ldns_rdf2buffer_str_b32_ext(buffer, rdf); + break; + } + } else { + ldns_buffer_printf(buffer, "(null) "); + res = ldns_buffer_status(buffer); + } + return res; +} + +ldns_status +ldns_rr2buffer_str(ldns_buffer *output, const ldns_rr *rr) +{ + uint16_t i, flags; + ldns_status status = LDNS_STATUS_OK; + if (!rr) { + ldns_buffer_printf(output, "(null)\n"); + } else { + if (ldns_rr_owner(rr)) { + status = ldns_rdf2buffer_str_dname(output, ldns_rr_owner(rr)); + } + if (status != LDNS_STATUS_OK) { + return status; + } + + /* TTL should NOT be printed if it is a question */ + if (!ldns_rr_is_question(rr)) { + ldns_buffer_printf(output, "\t%d", ldns_rr_ttl(rr)); + } + + ldns_buffer_printf(output, "\t"); + status = ldns_rr_class2buffer_str(output, ldns_rr_get_class(rr)); + if (status != LDNS_STATUS_OK) { + return status; + } + ldns_buffer_printf(output, "\t"); + + status = ldns_rr_type2buffer_str(output, ldns_rr_get_type(rr)); + if (status != LDNS_STATUS_OK) { + return status; + } + + if (ldns_rr_rd_count(rr) > 0) { + ldns_buffer_printf(output, "\t"); + } else if (!ldns_rr_is_question(rr)) { + ldns_buffer_printf(output, "\t\\# 0"); + } + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + status = ldns_rdf2buffer_str(output, ldns_rr_rdf(rr, i)); + if(status != LDNS_STATUS_OK) + return status; + if (i < ldns_rr_rd_count(rr) - 1) { + ldns_buffer_printf(output, " "); + } + } + /* per RR special comments - handy for DNSSEC types */ + /* check to prevent question sec. rr from + * getting here */ + if (ldns_rr_rd_count(rr) > 0) { + switch (ldns_rr_get_type(rr)) { + case LDNS_RR_TYPE_DNSKEY: + if (ldns_rr_rdf(rr, 0)) { + flags = ldns_rdf2native_int16(ldns_rr_rdf(rr, 0)); + if (flags == 256 || flags == 384) { + ldns_buffer_printf(output, + " ;{id = %u (zsk), size = %db}", + (unsigned int) ldns_calc_keytag(rr), + ldns_rr_dnskey_key_size(rr)); + break; + } + if (flags == 257 || flags == 385) { + ldns_buffer_printf(output, + " ;{id = %u (ksk), size = %db}", + (unsigned int) ldns_calc_keytag(rr), + ldns_rr_dnskey_key_size(rr)); + break; + } + ldns_buffer_printf(output, " ;{id = %u, size = %db}", + (unsigned int) ldns_calc_keytag(rr), + ldns_rr_dnskey_key_size(rr)); + } + break; + case LDNS_RR_TYPE_RRSIG: + ldns_buffer_printf(output, " ;{id = %d}", + ldns_rdf2native_int16(ldns_rr_rdf(rr, 6))); + break; + case LDNS_RR_TYPE_DS: + { + uint8_t *data = ldns_rdf_data(ldns_rr_rdf(rr, 3)); + size_t len = ldns_rdf_size(ldns_rr_rdf(rr, 3)); + char *babble = ldns_bubblebabble(data, len); + if(babble) + ldns_buffer_printf(output, " ; %s", babble); + LDNS_FREE(babble); + } + break; + case LDNS_RR_TYPE_NSEC3: + if (ldns_nsec3_optout(rr)) { + ldns_buffer_printf(output, " ; flags: optout"); + } + break; + default: + break; + + } + } + /* last */ + ldns_buffer_printf(output, "\n"); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_rr_list2buffer_str(ldns_buffer *output, const ldns_rr_list *list) +{ + uint16_t i; + + for(i = 0; i < ldns_rr_list_rr_count(list); i++) { + (void) ldns_rr2buffer_str(output, ldns_rr_list_rr(list, i)); + } + return ldns_buffer_status(output); +} + +ldns_status +ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt) +{ + ldns_lookup_table *opcode = ldns_lookup_by_id(ldns_opcodes, + (int) ldns_pkt_get_opcode(pkt)); + ldns_lookup_table *rcode = ldns_lookup_by_id(ldns_rcodes, + (int) ldns_pkt_get_rcode(pkt)); + + ldns_buffer_printf(output, ";; ->>HEADER<<- "); + if (opcode) { + ldns_buffer_printf(output, "opcode: %s, ", opcode->name); + } else { + ldns_buffer_printf(output, "opcode: ?? (%u), ", + ldns_pkt_get_opcode(pkt)); + } + if (rcode) { + ldns_buffer_printf(output, "rcode: %s, ", rcode->name); + } else { + ldns_buffer_printf(output, "rcode: ?? (%u), ", ldns_pkt_get_rcode(pkt)); + } + ldns_buffer_printf(output, "id: %d\n", ldns_pkt_id(pkt)); + ldns_buffer_printf(output, ";; flags: "); + + if (ldns_pkt_qr(pkt)) { + ldns_buffer_printf(output, "qr "); + } + if (ldns_pkt_aa(pkt)) { + ldns_buffer_printf(output, "aa "); + } + if (ldns_pkt_tc(pkt)) { + ldns_buffer_printf(output, "tc "); + } + if (ldns_pkt_rd(pkt)) { + ldns_buffer_printf(output, "rd "); + } + if (ldns_pkt_cd(pkt)) { + ldns_buffer_printf(output, "cd "); + } + if (ldns_pkt_ra(pkt)) { + ldns_buffer_printf(output, "ra "); + } + if (ldns_pkt_ad(pkt)) { + ldns_buffer_printf(output, "ad "); + } + ldns_buffer_printf(output, "; "); + ldns_buffer_printf(output, "QUERY: %u, ", ldns_pkt_qdcount(pkt)); + ldns_buffer_printf(output, "ANSWER: %u, ", ldns_pkt_ancount(pkt)); + ldns_buffer_printf(output, "AUTHORITY: %u, ", ldns_pkt_nscount(pkt)); + ldns_buffer_printf(output, "ADDITIONAL: %u ", ldns_pkt_arcount(pkt)); + return ldns_buffer_status(output); +} + +ldns_status +ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt) +{ + uint16_t i; + ldns_status status = LDNS_STATUS_OK; + char *tmp; + struct timeval time; + time_t time_tt; + + if (!pkt) { + ldns_buffer_printf(output, "null"); + return LDNS_STATUS_OK; + } + + if (ldns_buffer_status_ok(output)) { + status = ldns_pktheader2buffer_str(output, pkt); + if (status != LDNS_STATUS_OK) { + return status; + } + + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; QUESTION SECTION:\n;; "); + + + for (i = 0; i < ldns_pkt_qdcount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_question(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + } + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; ANSWER SECTION:\n"); + for (i = 0; i < ldns_pkt_ancount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_answer(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + + } + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; AUTHORITY SECTION:\n"); + + for (i = 0; i < ldns_pkt_nscount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_authority(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + } + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, ";; ADDITIONAL SECTION:\n"); + for (i = 0; i < ldns_pkt_arcount(pkt); i++) { + status = ldns_rr2buffer_str(output, + ldns_rr_list_rr(ldns_pkt_additional(pkt), i)); + if (status != LDNS_STATUS_OK) { + return status; + } + + } + ldns_buffer_printf(output, "\n"); + /* add some futher fields */ + ldns_buffer_printf(output, ";; Query time: %d msec\n", + ldns_pkt_querytime(pkt)); + if (ldns_pkt_edns(pkt)) { + ldns_buffer_printf(output, + ";; EDNS: version %u; flags:", + ldns_pkt_edns_version(pkt)); + if (ldns_pkt_edns_do(pkt)) { + ldns_buffer_printf(output, " do"); + } + /* the extended rcode is the value set, shifted four bits, + * and or'd with the original rcode */ + if (ldns_pkt_edns_extended_rcode(pkt)) { + ldns_buffer_printf(output, " ; ext-rcode: %d", + (ldns_pkt_edns_extended_rcode(pkt) << 4 | ldns_pkt_get_rcode(pkt))); + } + ldns_buffer_printf(output, " ; udp: %u\n", + ldns_pkt_edns_udp_size(pkt)); + + if (ldns_pkt_edns_data(pkt)) { + ldns_buffer_printf(output, ";; Data: "); + (void)ldns_rdf2buffer_str(output, + ldns_pkt_edns_data(pkt)); + ldns_buffer_printf(output, "\n"); + } + } + if (ldns_pkt_tsig(pkt)) { + ldns_buffer_printf(output, ";; TSIG:\n;; "); + (void) ldns_rr2buffer_str(output, ldns_pkt_tsig(pkt)); + ldns_buffer_printf(output, "\n"); + } + if (ldns_pkt_answerfrom(pkt)) { + tmp = ldns_rdf2str(ldns_pkt_answerfrom(pkt)); + ldns_buffer_printf(output, ";; SERVER: %s\n", tmp); + LDNS_FREE(tmp); + } + time = ldns_pkt_timestamp(pkt); + time_tt = (time_t)time.tv_sec; + ldns_buffer_printf(output, ";; WHEN: %s", + (char*)ctime(&time_tt)); + + ldns_buffer_printf(output, ";; MSG SIZE rcvd: %d\n", + (int)ldns_pkt_size(pkt)); + } else { + return ldns_buffer_status(output); + } + return status; +} + +#ifdef HAVE_SSL +static ldns_status +ldns_hmac_key2buffer_str(ldns_buffer *output, const ldns_key *k) +{ + ldns_status status; + size_t i; + ldns_rdf *b64_bignum; + + ldns_buffer_printf(output, "Key: "); + + i = ldns_key_hmac_size(k); + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, ldns_key_hmac_key(k)); + status = ldns_rdf2buffer_str(output, b64_bignum); + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + return status; +} +#endif + +#if defined(HAVE_SSL) && defined(USE_GOST) +static ldns_status +ldns_gost_key2buffer_str(ldns_buffer *output, EVP_PKEY *p) +{ + unsigned char* pp = NULL; + int ret; + ldns_rdf *b64_bignum; + ldns_status status; + + ldns_buffer_printf(output, "GostAsn1: "); + + ret = i2d_PrivateKey(p, &pp); + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, (size_t)ret, pp); + status = ldns_rdf2buffer_str(output, b64_bignum); + + ldns_rdf_deep_free(b64_bignum); + OPENSSL_free(pp); + ldns_buffer_printf(output, "\n"); + return status; +} +#endif + +ldns_status +ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k) +{ + ldns_status status = LDNS_STATUS_OK; + unsigned char *bignum; +#ifndef S_SPLINT_S + uint16_t i; +#endif + +#ifdef HAVE_SSL + /* not used when ssl is not defined */ + ldns_rdf *b64_bignum = NULL; + + RSA *rsa; + DSA *dsa; +#endif /* HAVE_SSL */ + + if (!k) { + return LDNS_STATUS_ERR; + } + + bignum = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bignum) { + return LDNS_STATUS_ERR; + } + + if (ldns_buffer_status_ok(output)) { +#ifdef HAVE_SSL + switch(ldns_key_algorithm(k)) { + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + case LDNS_SIGN_RSAMD5: + /* copied by looking at dnssec-keygen output */ + /* header */ + rsa = ldns_key_rsa_key(k); + + ldns_buffer_printf(output,"Private-key-format: v1.2\n"); + switch(ldns_key_algorithm(k)) { + case LDNS_SIGN_RSAMD5: + ldns_buffer_printf(output, + "Algorithm: %u (RSA)\n", + LDNS_RSAMD5); + break; + case LDNS_SIGN_RSASHA1: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA1)\n", + LDNS_RSASHA1); + break; + case LDNS_SIGN_RSASHA1_NSEC3: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA1_NSEC3)\n", + LDNS_RSASHA1_NSEC3); + break; +#ifdef USE_SHA2 + case LDNS_SIGN_RSASHA256: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA256)\n", + LDNS_RSASHA256); + break; + case LDNS_SIGN_RSASHA512: + ldns_buffer_printf(output, + "Algorithm: %u (RSASHA512)\n", + LDNS_RSASHA512); + break; +#endif + default: + fprintf(stderr, "Warning: unknown signature "); + fprintf(stderr, + "algorithm type %u\n", + ldns_key_algorithm(k)); + ldns_buffer_printf(output, + "Algorithm: %u (Unknown)\n", + ldns_key_algorithm(k)); + break; + } + + /* print to buf, convert to bin, convert to b64, + * print to buf */ + ldns_buffer_printf(output, "Modulus: "); +#ifndef S_SPLINT_S + i = (uint16_t)BN_bn2bin(rsa->n, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + ldns_buffer_printf(output, "PublicExponent: "); + i = (uint16_t)BN_bn2bin(rsa->e, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + + ldns_buffer_printf(output, "PrivateExponent: "); + if (rsa->d) { + i = (uint16_t)BN_bn2bin(rsa->d, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Prime1: "); + if (rsa->p) { + i = (uint16_t)BN_bn2bin(rsa->p, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Prime2: "); + if (rsa->q) { + i = (uint16_t)BN_bn2bin(rsa->q, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Exponent1: "); + if (rsa->dmp1) { + i = (uint16_t)BN_bn2bin(rsa->dmp1, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Exponent2: "); + if (rsa->dmq1) { + i = (uint16_t)BN_bn2bin(rsa->dmq1, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } + + ldns_buffer_printf(output, "Coefficient: "); + if (rsa->iqmp) { + i = (uint16_t)BN_bn2bin(rsa->iqmp, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + ldns_buffer_printf(output, "(Not available)\n"); + } +#endif /* splint */ + + RSA_free(rsa); + break; + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: + dsa = ldns_key_dsa_key(k); + + ldns_buffer_printf(output,"Private-key-format: v1.2\n"); + if (ldns_key_algorithm(k) == LDNS_SIGN_DSA) { + ldns_buffer_printf(output,"Algorithm: 3 (DSA)\n"); + } else if (ldns_key_algorithm(k) == LDNS_SIGN_DSA_NSEC3) { + ldns_buffer_printf(output,"Algorithm: 6 (DSA_NSEC3)\n"); + } + + /* print to buf, convert to bin, convert to b64, + * print to buf */ + ldns_buffer_printf(output, "Prime(p): "); +#ifndef S_SPLINT_S + if (dsa->p) { + i = (uint16_t)BN_bn2bin(dsa->p, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Subprime(q): "); + if (dsa->q) { + i = (uint16_t)BN_bn2bin(dsa->q, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Base(g): "); + if (dsa->g) { + i = (uint16_t)BN_bn2bin(dsa->g, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Private_value(x): "); + if (dsa->priv_key) { + i = (uint16_t)BN_bn2bin(dsa->priv_key, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } + + ldns_buffer_printf(output, "Public_value(y): "); + if (dsa->pub_key) { + i = (uint16_t)BN_bn2bin(dsa->pub_key, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + } else { + printf("(Not available)\n"); + } +#endif /* splint */ + break; + case LDNS_SIGN_ECC_GOST: + /* no format defined, use blob */ +#if defined(HAVE_SSL) && defined(USE_GOST) + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: %d (ECC-GOST)\n", LDNS_SIGN_ECC_GOST); + status = ldns_gost_key2buffer_str(output, +#ifndef S_SPLINT_S + k->_key.key +#else + NULL +#endif + ); + +#endif + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: %d (", ldns_key_algorithm(k)); + status=ldns_algorithm2buffer_str(output, (ldns_algorithm)ldns_key_algorithm(k)); +#ifndef S_SPLINT_S + ldns_buffer_printf(output, ")\n"); + if(k->_key.key) { + EC_KEY* ec = EVP_PKEY_get1_EC_KEY(k->_key.key); + const BIGNUM* b = EC_KEY_get0_private_key(ec); + ldns_buffer_printf(output, "PrivateKey: "); + i = (uint16_t)BN_bn2bin(b, bignum); + if (i > LDNS_MAX_KEYLEN) { + goto error; + } + b64_bignum = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, i, bignum); + if (ldns_rdf2buffer_str(output, b64_bignum) != LDNS_STATUS_OK) { + goto error; + } + ldns_rdf_deep_free(b64_bignum); + ldns_buffer_printf(output, "\n"); + /* down reference count in EC_KEY + * its still assigned to the PKEY */ + EC_KEY_free(ec); + } +#endif /* splint */ + break; +#endif + case LDNS_SIGN_HMACMD5: + /* there's not much of a format defined for TSIG */ + /* It's just a binary blob, Same for all algorithms */ + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: 157 (HMAC_MD5)\n"); + status = ldns_hmac_key2buffer_str(output, k); + break; + case LDNS_SIGN_HMACSHA1: + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: 158 (HMAC_SHA1)\n"); + status = ldns_hmac_key2buffer_str(output, k); + break; + case LDNS_SIGN_HMACSHA256: + ldns_buffer_printf(output, "Private-key-format: v1.2\n"); + ldns_buffer_printf(output, "Algorithm: 159 (HMAC_SHA256)\n"); + status = ldns_hmac_key2buffer_str(output, k); + break; + } +#endif /* HAVE_SSL */ + } else { +#ifdef HAVE_SSL + LDNS_FREE(b64_bignum); +#endif + LDNS_FREE(bignum); + return ldns_buffer_status(output); + } + LDNS_FREE(bignum); + return status; + +#ifdef HAVE_SSL + /* compiles warn the label isn't used */ +error: + LDNS_FREE(bignum); + return LDNS_STATUS_ERR; +#endif /* HAVE_SSL */ + +} + +/* + * Zero terminate the buffer and fix it to the size of the string. + */ +char * +ldns_buffer2str(ldns_buffer *buffer) +{ + char *tmp_str; + char *str; + + /* check if buffer ends with \0, if not, and + if there is space, add it */ + if (*(ldns_buffer_at(buffer, ldns_buffer_position(buffer))) != 0) { + if (!ldns_buffer_reserve(buffer, 1)) { + return NULL; + } + ldns_buffer_write_u8(buffer, (uint8_t) '\0'); + if (!ldns_buffer_set_capacity(buffer, ldns_buffer_position(buffer))) { + return NULL; + } + } + + tmp_str = ldns_buffer_export(buffer); + str = LDNS_XMALLOC(char, strlen(tmp_str) + 1); + if(!str) { + return NULL; + } + memcpy(str, tmp_str, strlen(tmp_str) + 1); + + return str; +} + +char * +ldns_rdf2str(const ldns_rdf *rdf) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_rdf2buffer_str(tmp_buffer, rdf) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_rr2str(const ldns_rr *rr) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_rr2buffer_str(tmp_buffer, rr) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_pkt2str(const ldns_pkt *pkt) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_pkt2buffer_str(tmp_buffer, pkt) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_key2str(const ldns_key *k) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (ldns_key2buffer_str(tmp_buffer, k) == LDNS_STATUS_OK) { + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + } + ldns_buffer_free(tmp_buffer); + return result; +} + +char * +ldns_rr_list2str(const ldns_rr_list *list) +{ + char *result = NULL; + ldns_buffer *tmp_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + + if (!tmp_buffer) { + return NULL; + } + if (list) { + if (ldns_rr_list2buffer_str(tmp_buffer, list) == LDNS_STATUS_OK) { + } + } else { + ldns_buffer_printf(tmp_buffer, "(null)\n"); + } + + /* export and return string, destroy rest */ + result = ldns_buffer2str(tmp_buffer); + ldns_buffer_free(tmp_buffer); + return result; +} + +void +ldns_rdf_print(FILE *output, const ldns_rdf *rdf) +{ + char *str = ldns_rdf2str(rdf); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert rdf to string\n"); + } + LDNS_FREE(str); +} + +void +ldns_rr_print(FILE *output, const ldns_rr *rr) +{ + char *str = ldns_rr2str(rr); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert rr to string\n"); + } + LDNS_FREE(str); +} + +void +ldns_pkt_print(FILE *output, const ldns_pkt *pkt) +{ + char *str = ldns_pkt2str(pkt); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert packet to string\n"); + } + LDNS_FREE(str); +} + +void +ldns_rr_list_print(FILE *output, const ldns_rr_list *lst) +{ + size_t i; + for (i = 0; i < ldns_rr_list_rr_count(lst); i++) { + ldns_rr_print(output, ldns_rr_list_rr(lst, i)); + } +} + +void +ldns_resolver_print(FILE *output, const ldns_resolver *r) +{ + uint16_t i; + ldns_rdf **n; + ldns_rdf **s; + size_t *rtt; + if (!r) { + return; + } + n = ldns_resolver_nameservers(r); + s = ldns_resolver_searchlist(r); + rtt = ldns_resolver_rtt(r); + + fprintf(output, "port: %d\n", (int)ldns_resolver_port(r)); + fprintf(output, "edns0 size: %d\n", (int)ldns_resolver_edns_udp_size(r)); + fprintf(output, "use ip6: %d\n", (int)ldns_resolver_ip6(r)); + + fprintf(output, "recursive: %d\n", ldns_resolver_recursive(r)); + fprintf(output, "usevc: %d\n", ldns_resolver_usevc(r)); + fprintf(output, "igntc: %d\n", ldns_resolver_igntc(r)); + fprintf(output, "fail: %d\n", ldns_resolver_fail(r)); + fprintf(output, "retry: %d\n", (int)ldns_resolver_retry(r)); + fprintf(output, "retrans: %d\n", (int)ldns_resolver_retrans(r)); + fprintf(output, "fallback: %d\n", ldns_resolver_fallback(r)); + fprintf(output, "random: %d\n", ldns_resolver_random(r)); + fprintf(output, "timeout: %d\n", (int)ldns_resolver_timeout(r).tv_sec); + fprintf(output, "dnssec: %d\n", ldns_resolver_dnssec(r)); + fprintf(output, "dnssec cd: %d\n", ldns_resolver_dnssec_cd(r)); + fprintf(output, "trust anchors (%d listed):\n", + (int)ldns_rr_list_rr_count(ldns_resolver_dnssec_anchors(r))); + ldns_rr_list_print(output, ldns_resolver_dnssec_anchors(r)); + fprintf(output, "tsig: %s %s\n", + ldns_resolver_tsig_keyname(r)?ldns_resolver_tsig_keyname(r):"-", + ldns_resolver_tsig_algorithm(r)?ldns_resolver_tsig_algorithm(r):"-"); + fprintf(output, "debug: %d\n", ldns_resolver_debug(r)); + + fprintf(output, "default domain: "); + ldns_rdf_print(output, ldns_resolver_domain(r)); + fprintf(output, "\n"); + fprintf(output, "apply default domain: %d\n", ldns_resolver_defnames(r)); + + fprintf(output, "searchlist (%d listed):\n", (int)ldns_resolver_searchlist_count(r)); + for (i = 0; i < ldns_resolver_searchlist_count(r); i++) { + fprintf(output, "\t"); + ldns_rdf_print(output, s[i]); + fprintf(output, "\n"); + } + fprintf(output, "apply search list: %d\n", ldns_resolver_dnsrch(r)); + + fprintf(output, "nameservers (%d listed):\n", (int)ldns_resolver_nameserver_count(r)); + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + fprintf(output, "\t"); + ldns_rdf_print(output, n[i]); + + switch ((int)rtt[i]) { + case LDNS_RESOLV_RTT_MIN: + fprintf(output, " - reachable\n"); + break; + case LDNS_RESOLV_RTT_INF: + fprintf(output, " - unreachable\n"); + break; + } + } +} + +void +ldns_zone_print(FILE *output, const ldns_zone *z) +{ + if(ldns_zone_soa(z)) + ldns_rr_print(output, ldns_zone_soa(z)); + ldns_rr_list_print(output, ldns_zone_rrs(z)); +} diff --git a/libs/ldns/host2wire.c b/libs/ldns/host2wire.c new file mode 100644 index 0000000000..1ffb0f5168 --- /dev/null +++ b/libs/ldns/host2wire.c @@ -0,0 +1,433 @@ +/* + * host2wire.c + * + * conversion routines from the host to the wire format. + * This will usually just a re-ordering of the + * data (as we store it in network format) + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +/* TODO Jelte + add a pointer to a 'possiblecompression' structure + to all the needed functions? + something like an array of name, pointer values? + every dname part could be added to it +*/ + +ldns_status +ldns_dname2buffer_wire(ldns_buffer *buffer, const ldns_rdf *name) +{ + if (ldns_buffer_reserve(buffer, ldns_rdf_size(name))) { + ldns_buffer_write(buffer, ldns_rdf_data(name), ldns_rdf_size(name)); + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rdf2buffer_wire(ldns_buffer *buffer, const ldns_rdf *rdf) +{ + if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { + ldns_buffer_write(buffer, ldns_rdf_data(rdf), ldns_rdf_size(rdf)); + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rdf2buffer_wire_canonical(ldns_buffer *buffer, const ldns_rdf *rdf) +{ + size_t i; + uint8_t *rdf_data; + + if (ldns_rdf_get_type(rdf) == LDNS_RDF_TYPE_DNAME) { + if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { + rdf_data = ldns_rdf_data(rdf); + for (i = 0; i < ldns_rdf_size(rdf); i++) { + ldns_buffer_write_u8(buffer, + (uint8_t) LDNS_DNAME_NORMALIZE((int)rdf_data[i])); + } + } + } else { + /* direct copy for all other types */ + if (ldns_buffer_reserve(buffer, ldns_rdf_size(rdf))) { + ldns_buffer_write(buffer, + ldns_rdf_data(rdf), + ldns_rdf_size(rdf)); + } + } + return ldns_buffer_status(buffer); +} + +/* convert a rr list to wireformat */ +ldns_status +ldns_rr_list2buffer_wire(ldns_buffer *buffer,const ldns_rr_list *rr_list) +{ + uint16_t rr_count; + uint16_t i; + + rr_count = ldns_rr_list_rr_count(rr_list); + for(i = 0; i < rr_count; i++) { + (void)ldns_rr2buffer_wire(buffer, ldns_rr_list_rr(rr_list, i), + LDNS_SECTION_ANY); + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rr2buffer_wire_canonical(ldns_buffer *buffer, + const ldns_rr *rr, + int section) +{ + uint16_t i; + uint16_t rdl_pos = 0; + bool pre_rfc3597 = false; + switch (ldns_rr_get_type(rr)) { + case LDNS_RR_TYPE_NS: + case LDNS_RR_TYPE_MD: + case LDNS_RR_TYPE_MF: + case LDNS_RR_TYPE_CNAME: + case LDNS_RR_TYPE_SOA: + case LDNS_RR_TYPE_MB: + case LDNS_RR_TYPE_MG: + case LDNS_RR_TYPE_MR: + case LDNS_RR_TYPE_PTR: + case LDNS_RR_TYPE_HINFO: + case LDNS_RR_TYPE_MINFO: + case LDNS_RR_TYPE_MX: + case LDNS_RR_TYPE_RP: + case LDNS_RR_TYPE_AFSDB: + case LDNS_RR_TYPE_RT: + case LDNS_RR_TYPE_SIG: + case LDNS_RR_TYPE_PX: + case LDNS_RR_TYPE_NXT: + case LDNS_RR_TYPE_NAPTR: + case LDNS_RR_TYPE_KX: + case LDNS_RR_TYPE_SRV: + case LDNS_RR_TYPE_DNAME: + case LDNS_RR_TYPE_A6: + pre_rfc3597 = true; + break; + default: + break; + } + + if (ldns_rr_owner(rr)) { + (void) ldns_rdf2buffer_wire_canonical(buffer, ldns_rr_owner(rr)); + } + + if (ldns_buffer_reserve(buffer, 4)) { + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_type(rr)); + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_class(rr)); + } + + if (section != LDNS_SECTION_QUESTION) { + if (ldns_buffer_reserve(buffer, 6)) { + ldns_buffer_write_u32(buffer, ldns_rr_ttl(rr)); + /* remember pos for later */ + rdl_pos = ldns_buffer_position(buffer); + ldns_buffer_write_u16(buffer, 0); + } + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + if (pre_rfc3597) { + (void) ldns_rdf2buffer_wire_canonical(buffer, + ldns_rr_rdf(rr, i)); + } else { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + } + + if (rdl_pos != 0) { + ldns_buffer_write_u16_at(buffer, rdl_pos, + ldns_buffer_position(buffer) + - rdl_pos - 2); + } + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rr2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr, int section) +{ + uint16_t i; + uint16_t rdl_pos = 0; + + if (ldns_rr_owner(rr)) { + (void) ldns_dname2buffer_wire(buffer, ldns_rr_owner(rr)); + } + + if (ldns_buffer_reserve(buffer, 4)) { + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_type(rr)); + (void) ldns_buffer_write_u16(buffer, ldns_rr_get_class(rr)); + } + + if (section != LDNS_SECTION_QUESTION) { + if (ldns_buffer_reserve(buffer, 6)) { + ldns_buffer_write_u32(buffer, ldns_rr_ttl(rr)); + /* remember pos for later */ + rdl_pos = ldns_buffer_position(buffer); + ldns_buffer_write_u16(buffer, 0); + } + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + + if (rdl_pos != 0) { + ldns_buffer_write_u16_at(buffer, rdl_pos, + ldns_buffer_position(buffer) + - rdl_pos - 2); + } + } + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rrsig2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) +{ + uint16_t i; + + /* it must be a sig RR */ + if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { + return LDNS_STATUS_ERR; + } + + /* Convert all the rdfs, except the actual signature data + * rdf number 8 - the last, hence: -1 */ + for (i = 0; i < ldns_rr_rd_count(rr) - 1; i++) { + if (ldns_rr_rdf(rr, i)) { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + } + + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_rr_rdata2buffer_wire(ldns_buffer *buffer, const ldns_rr *rr) +{ + uint16_t i; + /* convert all the rdf's */ + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + (void) ldns_rdf2buffer_wire(buffer, ldns_rr_rdf(rr, i)); + } + + return ldns_buffer_status(buffer); +} + +/* + * Copies the packet header data to the buffer in wire format + */ +static ldns_status +ldns_hdr2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet) +{ + uint8_t flags; + uint16_t arcount; + + if (ldns_buffer_reserve(buffer, 12)) { + ldns_buffer_write_u16(buffer, ldns_pkt_id(packet)); + + flags = ldns_pkt_qr(packet) << 7 + | ldns_pkt_get_opcode(packet) << 3 + | ldns_pkt_aa(packet) << 2 + | ldns_pkt_tc(packet) << 1 | ldns_pkt_rd(packet); + ldns_buffer_write_u8(buffer, flags); + + flags = ldns_pkt_ra(packet) << 7 + /*| ldns_pkt_z(packet) << 6*/ + | ldns_pkt_ad(packet) << 5 + | ldns_pkt_cd(packet) << 4 | ldns_pkt_get_rcode(packet); + ldns_buffer_write_u8(buffer, flags); + + ldns_buffer_write_u16(buffer, ldns_pkt_qdcount(packet)); + ldns_buffer_write_u16(buffer, ldns_pkt_ancount(packet)); + ldns_buffer_write_u16(buffer, ldns_pkt_nscount(packet)); + /* add EDNS0 and TSIG to additional if they are there */ + arcount = ldns_pkt_arcount(packet); + if (ldns_pkt_tsig(packet)) { + arcount++; + } + if (ldns_pkt_edns(packet)) { + arcount++; + } + ldns_buffer_write_u16(buffer, arcount); + } + + return ldns_buffer_status(buffer); +} + +ldns_status +ldns_pkt2buffer_wire(ldns_buffer *buffer, const ldns_pkt *packet) +{ + ldns_rr_list *rr_list; + uint16_t i; + + /* edns tmp vars */ + ldns_rr *edns_rr; + uint8_t edata[4]; + + (void) ldns_hdr2buffer_wire(buffer, packet); + + rr_list = ldns_pkt_question(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_QUESTION); + } + } + rr_list = ldns_pkt_answer(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_ANSWER); + } + } + rr_list = ldns_pkt_authority(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_AUTHORITY); + } + } + rr_list = ldns_pkt_additional(packet); + if (rr_list) { + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + (void) ldns_rr2buffer_wire(buffer, + ldns_rr_list_rr(rr_list, i), LDNS_SECTION_ADDITIONAL); + } + } + + /* add EDNS to additional if it is needed */ + if (ldns_pkt_edns(packet)) { + edns_rr = ldns_rr_new(); + if(!edns_rr) return LDNS_STATUS_MEM_ERR; + ldns_rr_set_owner(edns_rr, + ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, ".")); + ldns_rr_set_type(edns_rr, LDNS_RR_TYPE_OPT); + ldns_rr_set_class(edns_rr, ldns_pkt_edns_udp_size(packet)); + edata[0] = ldns_pkt_edns_extended_rcode(packet); + edata[1] = ldns_pkt_edns_version(packet); + ldns_write_uint16(&edata[2], ldns_pkt_edns_z(packet)); + ldns_rr_set_ttl(edns_rr, ldns_read_uint32(edata)); + /* don't forget to add the edns rdata (if any) */ + if (packet->_edns_data) + ldns_rr_push_rdf (edns_rr, packet->_edns_data); + (void)ldns_rr2buffer_wire(buffer, edns_rr, LDNS_SECTION_ADDITIONAL); + /* take the edns rdata back out of the rr before we free rr */ + if (packet->_edns_data) + (void)ldns_rr_pop_rdf (edns_rr); + ldns_rr_free(edns_rr); + } + + /* add TSIG to additional if it is there */ + if (ldns_pkt_tsig(packet)) { + (void) ldns_rr2buffer_wire(buffer, + ldns_pkt_tsig(packet), LDNS_SECTION_ADDITIONAL); + } + + return LDNS_STATUS_OK; +} + +ldns_status +ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t *result_size) +{ + ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + uint8_t *result = NULL; + ldns_status status; + *result_size = 0; + *dest = NULL; + if(!buffer) return LDNS_STATUS_MEM_ERR; + + status = ldns_rdf2buffer_wire(buffer, rdf); + if (status == LDNS_STATUS_OK) { + *result_size = ldns_buffer_position(buffer); + result = (uint8_t *) ldns_buffer_export(buffer); + } else { + ldns_buffer_free(buffer); + return status; + } + + if (result) { + *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); + if(!*dest) { + ldns_buffer_free(buffer); + return LDNS_STATUS_MEM_ERR; + } + memcpy(*dest, result, ldns_buffer_position(buffer)); + } + + ldns_buffer_free(buffer); + return status; +} + +ldns_status +ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int section, size_t *result_size) +{ + ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + uint8_t *result = NULL; + ldns_status status; + *result_size = 0; + *dest = NULL; + if(!buffer) return LDNS_STATUS_MEM_ERR; + + status = ldns_rr2buffer_wire(buffer, rr, section); + if (status == LDNS_STATUS_OK) { + *result_size = ldns_buffer_position(buffer); + result = (uint8_t *) ldns_buffer_export(buffer); + } else { + ldns_buffer_free(buffer); + return status; + } + + if (result) { + *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); + if(!*dest) { + ldns_buffer_free(buffer); + return LDNS_STATUS_MEM_ERR; + } + memcpy(*dest, result, ldns_buffer_position(buffer)); + } + + ldns_buffer_free(buffer); + return status; +} + +ldns_status +ldns_pkt2wire(uint8_t **dest, const ldns_pkt *packet, size_t *result_size) +{ + ldns_buffer *buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + uint8_t *result = NULL; + ldns_status status; + *result_size = 0; + *dest = NULL; + if(!buffer) return LDNS_STATUS_MEM_ERR; + + status = ldns_pkt2buffer_wire(buffer, packet); + if (status == LDNS_STATUS_OK) { + *result_size = ldns_buffer_position(buffer); + result = (uint8_t *) ldns_buffer_export(buffer); + } else { + ldns_buffer_free(buffer); + return status; + } + + if (result) { + *dest = LDNS_XMALLOC(uint8_t, ldns_buffer_position(buffer)); + if(!*dest) { + ldns_buffer_free(buffer); + return LDNS_STATUS_MEM_ERR; + } + memcpy(*dest, result, ldns_buffer_position(buffer)); + } + + ldns_buffer_free(buffer); + return status; +} diff --git a/libs/ldns/install-sh b/libs/ldns/install-sh new file mode 100644 index 0000000000..3f83ce9b55 --- /dev/null +++ b/libs/ldns/install-sh @@ -0,0 +1,524 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2010-02-06.18; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# 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. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # 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 $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/libs/ldns/keys.c b/libs/ldns/keys.c new file mode 100644 index 0000000000..c224cd6fe4 --- /dev/null +++ b/libs/ldns/keys.c @@ -0,0 +1,1666 @@ +/* + * keys.c handle private keys for use in DNSSEC + * + * This module should hide some of the openSSL complexities + * and give a general interface for private keys and hmac + * handling + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#ifdef HAVE_SSL +#include +#include +#include +#endif /* HAVE_SSL */ + +ldns_lookup_table ldns_signing_algorithms[] = { + { LDNS_SIGN_RSAMD5, "RSAMD5" }, + { LDNS_SIGN_RSASHA1, "RSASHA1" }, + { LDNS_SIGN_RSASHA1_NSEC3, "RSASHA1-NSEC3-SHA1" }, +#ifdef USE_SHA2 + { LDNS_SIGN_RSASHA256, "RSASHA256" }, + { LDNS_SIGN_RSASHA512, "RSASHA512" }, +#endif +#ifdef USE_GOST + { LDNS_SIGN_ECC_GOST, "ECC-GOST" }, +#endif +#ifdef USE_ECDSA + { LDNS_SIGN_ECDSAP256SHA256, "ECDSAP256SHA256" }, + { LDNS_SIGN_ECDSAP384SHA384, "ECDSAP384SHA384" }, +#endif + { LDNS_SIGN_DSA, "DSA" }, + { LDNS_SIGN_DSA_NSEC3, "DSA-NSEC3-SHA1" }, + { LDNS_SIGN_HMACMD5, "hmac-md5.sig-alg.reg.int" }, + { LDNS_SIGN_HMACSHA1, "hmac-sha1" }, + { LDNS_SIGN_HMACSHA256, "hmac-sha256" }, + { 0, NULL } +}; + +ldns_key_list * +ldns_key_list_new() +{ + ldns_key_list *key_list = LDNS_MALLOC(ldns_key_list); + if (!key_list) { + return NULL; + } else { + key_list->_key_count = 0; + key_list->_keys = NULL; + return key_list; + } +} + +ldns_key * +ldns_key_new() +{ + ldns_key *newkey; + + newkey = LDNS_MALLOC(ldns_key); + if (!newkey) { + return NULL; + } else { + /* some defaults - not sure wether to do this */ + ldns_key_set_use(newkey, true); + ldns_key_set_flags(newkey, LDNS_KEY_ZONE_KEY); + ldns_key_set_origttl(newkey, 0); + ldns_key_set_keytag(newkey, 0); + ldns_key_set_inception(newkey, 0); + ldns_key_set_expiration(newkey, 0); + ldns_key_set_pubkey_owner(newkey, NULL); +#ifdef HAVE_SSL + ldns_key_set_evp_key(newkey, NULL); +#endif /* HAVE_SSL */ + ldns_key_set_hmac_key(newkey, NULL); + ldns_key_set_external_key(newkey, NULL); + return newkey; + } +} + +ldns_status +ldns_key_new_frm_fp(ldns_key **k, FILE *fp) +{ + return ldns_key_new_frm_fp_l(k, fp, NULL); +} + +#ifdef HAVE_SSL +ldns_status +ldns_key_new_frm_engine(ldns_key **key, ENGINE *e, char *key_id, ldns_algorithm alg) +{ + ldns_key *k; + + k = ldns_key_new(); + if(!k) return LDNS_STATUS_MEM_ERR; +#ifndef S_SPLINT_S + k->_key.key = ENGINE_load_private_key(e, key_id, UI_OpenSSL(), NULL); + if(!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_algorithm(k, (ldns_signing_algorithm) alg); + if (!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ENGINE_KEY_NOT_LOADED; + } +#endif /* splint */ + *key = k; + return LDNS_STATUS_OK; +} +#endif + +#ifdef USE_GOST +/** store GOST engine reference loaded into OpenSSL library */ +ENGINE* ldns_gost_engine = NULL; + +int +ldns_key_EVP_load_gost_id(void) +{ + static int gost_id = 0; + const EVP_PKEY_ASN1_METHOD* meth; + ENGINE* e; + + if(gost_id) return gost_id; + + /* see if configuration loaded gost implementation from other engine*/ + meth = EVP_PKEY_asn1_find_str(NULL, "gost2001", -1); + if(meth) { + EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); + return gost_id; + } + + /* see if engine can be loaded already */ + e = ENGINE_by_id("gost"); + if(!e) { + /* load it ourself, in case statically linked */ + ENGINE_load_builtin_engines(); + ENGINE_load_dynamic(); + e = ENGINE_by_id("gost"); + } + if(!e) { + /* no gost engine in openssl */ + return 0; + } + if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) { + ENGINE_finish(e); + ENGINE_free(e); + return 0; + } + + meth = EVP_PKEY_asn1_find_str(&e, "gost2001", -1); + if(!meth) { + /* algo not found */ + ENGINE_finish(e); + ENGINE_free(e); + return 0; + } + /* Note: do not ENGINE_finish and ENGINE_free the acquired engine + * on some platforms this frees up the meth and unloads gost stuff */ + ldns_gost_engine = e; + + EVP_PKEY_asn1_get0_info(&gost_id, NULL, NULL, NULL, NULL, meth); + return gost_id; +} + +void ldns_key_EVP_unload_gost(void) +{ + if(ldns_gost_engine) { + ENGINE_finish(ldns_gost_engine); + ENGINE_free(ldns_gost_engine); + ldns_gost_engine = NULL; + } +} + +/** read GOST private key */ +static EVP_PKEY* +ldns_key_new_frm_fp_gost_l(FILE* fp, int* line_nr) +{ + char token[16384]; + const unsigned char* pp; + int gost_id; + EVP_PKEY* pkey; + ldns_rdf* b64rdf = NULL; + + gost_id = ldns_key_EVP_load_gost_id(); + if(!gost_id) + return NULL; + + if (ldns_fget_keyword_data_l(fp, "GostAsn1", ": ", token, "\n", + sizeof(token), line_nr) == -1) + return NULL; + while(strlen(token) < 96) { + /* read more b64 from the file, b64 split on multiple lines */ + if(ldns_fget_token_l(fp, token+strlen(token), "\n", + sizeof(token)-strlen(token), line_nr) == -1) + return NULL; + } + if(ldns_str2rdf_b64(&b64rdf, token) != LDNS_STATUS_OK) + return NULL; + pp = (unsigned char*)ldns_rdf_data(b64rdf); + pkey = d2i_PrivateKey(gost_id, NULL, &pp, (int)ldns_rdf_size(b64rdf)); + ldns_rdf_deep_free(b64rdf); + return pkey; +} +#endif + +#ifdef USE_ECDSA +/** calculate public key from private key */ +static int +ldns_EC_KEY_calc_public(EC_KEY* ec) +{ + EC_POINT* pub_key; + const EC_GROUP* group; + group = EC_KEY_get0_group(ec); + pub_key = EC_POINT_new(group); + if(!pub_key) return 0; + if(!EC_POINT_copy(pub_key, EC_GROUP_get0_generator(group))) { + EC_POINT_free(pub_key); + return 0; + } + if(!EC_POINT_mul(group, pub_key, EC_KEY_get0_private_key(ec), + NULL, NULL, NULL)) { + EC_POINT_free(pub_key); + return 0; + } + if(EC_KEY_set_public_key(ec, pub_key) == 0) { + EC_POINT_free(pub_key); + return 0; + } + EC_POINT_free(pub_key); + return 1; +} + +/** read ECDSA private key */ +static EVP_PKEY* +ldns_key_new_frm_fp_ecdsa_l(FILE* fp, ldns_algorithm alg, int* line_nr) +{ + char token[16384]; + ldns_rdf* b64rdf = NULL; + unsigned char* pp; + BIGNUM* bn; + EVP_PKEY* evp_key; + EC_KEY* ec; + if (ldns_fget_keyword_data_l(fp, "PrivateKey", ": ", token, "\n", + sizeof(token), line_nr) == -1) + return NULL; + if(ldns_str2rdf_b64(&b64rdf, token) != LDNS_STATUS_OK) + return NULL; + pp = (unsigned char*)ldns_rdf_data(b64rdf); + + if(alg == LDNS_ECDSAP256SHA256) + ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); + else if(alg == LDNS_ECDSAP384SHA384) + ec = EC_KEY_new_by_curve_name(NID_secp384r1); + else ec = NULL; + if(!ec) { + ldns_rdf_deep_free(b64rdf); + return NULL; + } + bn = BN_bin2bn(pp, (int)ldns_rdf_size(b64rdf), NULL); + ldns_rdf_deep_free(b64rdf); + if(!bn) { + EC_KEY_free(ec); + return NULL; + } + EC_KEY_set_private_key(ec, bn); + BN_free(bn); + if(!ldns_EC_KEY_calc_public(ec)) { + EC_KEY_free(ec); + return NULL; + } + + evp_key = EVP_PKEY_new(); + if(!evp_key) { + EC_KEY_free(ec); + return NULL; + } + EVP_PKEY_assign_EC_KEY(evp_key, ec); + + return evp_key; +} +#endif + +ldns_status +ldns_key_new_frm_fp_l(ldns_key **key, FILE *fp, int *line_nr) +{ + ldns_key *k; + char *d; + ldns_signing_algorithm alg; + ldns_rr *key_rr; +#ifdef HAVE_SSL + RSA *rsa; + DSA *dsa; + unsigned char *hmac; + size_t hmac_size; +#endif /* HAVE_SSL */ + + k = ldns_key_new(); + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + if (!k || !d) { + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_MEM_ERR; + } + + alg = 0; + + /* the file is highly structured. Do this in sequence */ + /* RSA: + * Private-key-format: v1.2 + * Algorithm: 1 (RSA) + + */ + /* get the key format version number */ + if (ldns_fget_keyword_data_l(fp, "Private-key-format", ": ", d, "\n", + LDNS_MAX_LINELEN, line_nr) == -1) { + /* no version information */ + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_SYNTAX_ERR; + } + if (strncmp(d, "v1.2", strlen(d)) != 0) { + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_SYNTAX_VERSION_ERR; + } + + /* get the algorithm type, our file function strip ( ) so there are + * not in the return string! */ + if (ldns_fget_keyword_data_l(fp, "Algorithm", ": ", d, "\n", + LDNS_MAX_LINELEN, line_nr) == -1) { + /* no alg information */ + ldns_key_free(k); + LDNS_FREE(d); + return LDNS_STATUS_SYNTAX_ALG_ERR; + } + + if (strncmp(d, "1 RSA", 2) == 0) { + alg = LDNS_SIGN_RSAMD5; + } + if (strncmp(d, "2 DH", 2) == 0) { + alg = (ldns_signing_algorithm)LDNS_DH; + } + if (strncmp(d, "3 DSA", 2) == 0) { + alg = LDNS_SIGN_DSA; + } + if (strncmp(d, "4 ECC", 2) == 0) { + alg = (ldns_signing_algorithm)LDNS_ECC; + } + if (strncmp(d, "5 RSASHA1", 2) == 0) { + alg = LDNS_SIGN_RSASHA1; + } + if (strncmp(d, "6 DSA", 2) == 0) { + alg = LDNS_SIGN_DSA_NSEC3; + } + if (strncmp(d, "7 RSASHA1", 2) == 0) { + alg = LDNS_SIGN_RSASHA1_NSEC3; + } + + if (strncmp(d, "8 RSASHA256", 2) == 0) { +#ifdef USE_SHA2 + alg = LDNS_SIGN_RSASHA256; +#else + fprintf(stderr, "Warning: SHA256 not compiled into this "); + fprintf(stderr, "version of ldns\n"); +#endif + } + if (strncmp(d, "10 RSASHA512", 3) == 0) { +#ifdef USE_SHA2 + alg = LDNS_SIGN_RSASHA512; +#else + fprintf(stderr, "Warning: SHA512 not compiled into this "); + fprintf(stderr, "version of ldns\n"); +#endif + } + if (strncmp(d, "12 ECC-GOST", 3) == 0) { +#ifdef USE_GOST + alg = LDNS_SIGN_ECC_GOST; +#else + fprintf(stderr, "Warning: ECC-GOST not compiled into this "); + fprintf(stderr, "version of ldns, use --enable-gost\n"); +#endif + } +#ifdef USE_ECDSA + if (strncmp(d, "13 ECDSAP256SHA256", 3) == 0) { + alg = LDNS_SIGN_ECDSAP256SHA256; + } + if (strncmp(d, "14 ECDSAP384SHA384", 3) == 0) { + alg = LDNS_SIGN_ECDSAP384SHA384; + } +#endif + if (strncmp(d, "157 HMAC-MD5", 4) == 0) { + alg = LDNS_SIGN_HMACMD5; + } + if (strncmp(d, "158 HMAC-SHA1", 4) == 0) { + alg = LDNS_SIGN_HMACSHA1; + } + if (strncmp(d, "159 HMAC-SHA256", 4) == 0) { + alg = LDNS_SIGN_HMACSHA256; + } + + LDNS_FREE(d); + + switch(alg) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: +#ifdef USE_SHA2 + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: +#endif + ldns_key_set_algorithm(k, alg); +#ifdef HAVE_SSL + rsa = ldns_key_new_frm_fp_rsa_l(fp, line_nr); + if (!rsa) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_rsa_key(k, rsa); + RSA_free(rsa); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: + ldns_key_set_algorithm(k, alg); +#ifdef HAVE_SSL + dsa = ldns_key_new_frm_fp_dsa_l(fp, line_nr); + if (!dsa) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_dsa_key(k, dsa); + DSA_free(dsa); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + ldns_key_set_algorithm(k, alg); +#ifdef HAVE_SSL + hmac = ldns_key_new_frm_fp_hmac_l(fp, line_nr, &hmac_size); + if (!hmac) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } + ldns_key_set_hmac_size(k, hmac_size); + ldns_key_set_hmac_key(k, hmac); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_ECC_GOST: + ldns_key_set_algorithm(k, alg); +#if defined(HAVE_SSL) && defined(USE_GOST) + if(!ldns_key_EVP_load_gost_id()) { + ldns_key_free(k); + return LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL; + } + ldns_key_set_evp_key(k, + ldns_key_new_frm_fp_gost_l(fp, line_nr)); +#ifndef S_SPLINT_S + if(!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } +#endif /* splint */ +#endif + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + ldns_key_set_algorithm(k, alg); + ldns_key_set_evp_key(k, + ldns_key_new_frm_fp_ecdsa_l(fp, (ldns_algorithm)alg, line_nr)); +#ifndef S_SPLINT_S + if(!k->_key.key) { + ldns_key_free(k); + return LDNS_STATUS_ERR; + } +#endif /* splint */ + break; +#endif + default: + ldns_key_free(k); + return LDNS_STATUS_SYNTAX_ALG_ERR; + } + key_rr = ldns_key2rr(k); + ldns_key_set_keytag(k, ldns_calc_keytag(key_rr)); + ldns_rr_free(key_rr); + + if (key) { + *key = k; + return LDNS_STATUS_OK; + } + return LDNS_STATUS_ERR; +} + +#ifdef HAVE_SSL +RSA * +ldns_key_new_frm_fp_rsa(FILE *f) +{ + return ldns_key_new_frm_fp_rsa_l(f, NULL); +} + +RSA * +ldns_key_new_frm_fp_rsa_l(FILE *f, int *line_nr) +{ + /* we parse + * Modulus: + * PublicExponent: + * PrivateExponent: + * Prime1: + * Prime2: + * Exponent1: + * Exponent2: + * Coefficient: + * + * man 3 RSA: + * + * struct + * { + * BIGNUM *n; // public modulus + * BIGNUM *e; // public exponent + * BIGNUM *d; // private exponent + * BIGNUM *p; // secret prime factor + * BIGNUM *q; // secret prime factor + * BIGNUM *dmp1; // d mod (p-1) + * BIGNUM *dmq1; // d mod (q-1) + * BIGNUM *iqmp; // q^-1 mod p + * // ... + * + */ + char *d; + RSA *rsa; + uint8_t *buf; + int i; + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + buf = LDNS_XMALLOC(uint8_t, LDNS_MAX_LINELEN); + rsa = RSA_new(); + if (!d || !rsa || !buf) { + goto error; + } + + /* I could use functions again, but that seems an overkill, + * allthough this also looks tedious + */ + + /* Modules, rsa->n */ + if (ldns_fget_keyword_data_l(f, "Modulus", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); +#ifndef S_SPLINT_S + rsa->n = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->n) { + goto error; + } + + /* PublicExponent, rsa->e */ + if (ldns_fget_keyword_data_l(f, "PublicExponent", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->e = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->e) { + goto error; + } + + /* PrivateExponent, rsa->d */ + if (ldns_fget_keyword_data_l(f, "PrivateExponent", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->d = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->d) { + goto error; + } + + /* Prime1, rsa->p */ + if (ldns_fget_keyword_data_l(f, "Prime1", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->p = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->p) { + goto error; + } + + /* Prime2, rsa->q */ + if (ldns_fget_keyword_data_l(f, "Prime2", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->q = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->q) { + goto error; + } + + /* Exponent1, rsa->dmp1 */ + if (ldns_fget_keyword_data_l(f, "Exponent1", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->dmp1 = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->dmp1) { + goto error; + } + + /* Exponent2, rsa->dmq1 */ + if (ldns_fget_keyword_data_l(f, "Exponent2", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->dmq1 = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->dmq1) { + goto error; + } + + /* Coefficient, rsa->iqmp */ + if (ldns_fget_keyword_data_l(f, "Coefficient", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + rsa->iqmp = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!rsa->iqmp) { + goto error; + } +#endif /* splint */ + + LDNS_FREE(buf); + LDNS_FREE(d); + return rsa; + +error: + RSA_free(rsa); + LDNS_FREE(d); + LDNS_FREE(buf); + return NULL; +} + +DSA * +ldns_key_new_frm_fp_dsa(FILE *f) +{ + return ldns_key_new_frm_fp_dsa_l(f, NULL); +} + +DSA * +ldns_key_new_frm_fp_dsa_l(FILE *f, int *line_nr) +{ + int i; + char *d; + DSA *dsa; + uint8_t *buf; + + line_nr = line_nr; + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + buf = LDNS_XMALLOC(uint8_t, LDNS_MAX_LINELEN); + dsa = DSA_new(); + if (!d || !dsa || !buf) { + goto error; + } + + /* the line parser removes the () from the input... */ + + /* Prime, dsa->p */ + if (ldns_fget_keyword_data_l(f, "Primep", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); +#ifndef S_SPLINT_S + dsa->p = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->p) { + goto error; + } + + /* Subprime, dsa->q */ + if (ldns_fget_keyword_data_l(f, "Subprimeq", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->q = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->q) { + goto error; + } + + /* Base, dsa->g */ + if (ldns_fget_keyword_data_l(f, "Baseg", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->g = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->g) { + goto error; + } + + /* Private key, dsa->priv_key */ + if (ldns_fget_keyword_data_l(f, "Private_valuex", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->priv_key = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->priv_key) { + goto error; + } + + /* Public key, dsa->priv_key */ + if (ldns_fget_keyword_data_l(f, "Public_valuey", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = ldns_b64_pton((const char*)d, buf, ldns_b64_ntop_calculate_size(strlen(d))); + dsa->pub_key = BN_bin2bn((const char unsigned*)buf, i, NULL); + if (!dsa->pub_key) { + goto error; + } +#endif /* splint */ + + LDNS_FREE(buf); + LDNS_FREE(d); + + return dsa; + +error: + LDNS_FREE(d); + LDNS_FREE(buf); + DSA_free(dsa); + return NULL; +} + +unsigned char * +ldns_key_new_frm_fp_hmac(FILE *f, size_t *hmac_size) +{ + return ldns_key_new_frm_fp_hmac_l(f, NULL, hmac_size); +} + +unsigned char * +ldns_key_new_frm_fp_hmac_l(FILE *f, int *line_nr, size_t *hmac_size) +{ + size_t i; + char *d; + unsigned char *buf; + + line_nr = line_nr; + + d = LDNS_XMALLOC(char, LDNS_MAX_LINELEN); + buf = LDNS_XMALLOC(unsigned char, LDNS_MAX_LINELEN); + if(!d || !buf) { + goto error; + } + + if (ldns_fget_keyword_data_l(f, "Key", ": ", d, "\n", LDNS_MAX_LINELEN, line_nr) == -1) { + goto error; + } + i = (size_t) ldns_b64_pton((const char*)d, + buf, + ldns_b64_ntop_calculate_size(strlen(d))); + + *hmac_size = i; + return buf; + + error: + LDNS_FREE(d); + LDNS_FREE(buf); + *hmac_size = 0; + return NULL; +} +#endif /* HAVE_SSL */ + +#ifdef USE_GOST +static EVP_PKEY* +ldns_gen_gost_key(void) +{ + EVP_PKEY_CTX* ctx; + EVP_PKEY* p = NULL; + int gost_id = ldns_key_EVP_load_gost_id(); + if(!gost_id) + return NULL; + ctx = EVP_PKEY_CTX_new_id(gost_id, NULL); + if(!ctx) { + /* the id should be available now */ + return NULL; + } + if(EVP_PKEY_CTX_ctrl_str(ctx, "paramset", "A") <= 0) { + /* cannot set paramset */ + EVP_PKEY_CTX_free(ctx); + return NULL; + } + + if(EVP_PKEY_keygen_init(ctx) <= 0) { + EVP_PKEY_CTX_free(ctx); + return NULL; + } + if(EVP_PKEY_keygen(ctx, &p) <= 0) { + EVP_PKEY_free(p); + EVP_PKEY_CTX_free(ctx); + return NULL; + } + EVP_PKEY_CTX_free(ctx); + return p; +} +#endif + +ldns_key * +ldns_key_new_frm_algorithm(ldns_signing_algorithm alg, uint16_t size) +{ + ldns_key *k; +#ifdef HAVE_SSL + DSA *d; + RSA *r; +# ifdef USE_ECDSA + EC_KEY *ec = NULL; +# endif +#else + int i; + uint16_t offset = 0; +#endif + unsigned char *hmac; + + k = ldns_key_new(); + if (!k) { + return NULL; + } + switch(alg) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: +#ifdef HAVE_SSL + r = RSA_generate_key((int)size, RSA_F4, NULL, NULL); + if(!r) { + ldns_key_free(k); + return NULL; + } + if (RSA_check_key(r) != 1) { + ldns_key_free(k); + return NULL; + } + + ldns_key_set_rsa_key(k, r); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: +#ifdef HAVE_SSL + d = DSA_generate_parameters((int)size, NULL, 0, NULL, NULL, NULL, NULL); + if (!d) { + ldns_key_free(k); + return NULL; + } + if (DSA_generate_key(d) != 1) { + ldns_key_free(k); + return NULL; + } + ldns_key_set_dsa_key(k, d); +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: +#ifdef HAVE_SSL +#ifndef S_SPLINT_S + k->_key.key = NULL; +#endif /* splint */ +#endif /* HAVE_SSL */ + size = size / 8; + ldns_key_set_hmac_size(k, size); + + hmac = LDNS_XMALLOC(unsigned char, size); + if(!hmac) { + ldns_key_free(k); + return NULL; + } +#ifdef HAVE_SSL + if (RAND_bytes(hmac, (int) size) != 1) { + LDNS_FREE(hmac); + ldns_key_free(k); + return NULL; + } +#else + while (offset + sizeof(i) < size) { + i = random(); + memcpy(&hmac[offset], &i, sizeof(i)); + offset += sizeof(i); + } + if (offset < size) { + i = random(); + memcpy(&hmac[offset], &i, size - offset); + } +#endif /* HAVE_SSL */ + ldns_key_set_hmac_key(k, hmac); + + ldns_key_set_flags(k, 0); + break; + case LDNS_SIGN_ECC_GOST: +#if defined(HAVE_SSL) && defined(USE_GOST) + ldns_key_set_evp_key(k, ldns_gen_gost_key()); +#ifndef S_SPLINT_S + if(!k->_key.key) { + ldns_key_free(k); + return NULL; + } +#endif /* splint */ +#endif /* HAVE_SSL and USE_GOST */ + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + if(alg == LDNS_SIGN_ECDSAP256SHA256) + ec = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); + else if(alg == LDNS_SIGN_ECDSAP384SHA384) + ec = EC_KEY_new_by_curve_name(NID_secp384r1); + if(!ec) { + ldns_key_free(k); + return NULL; + } + if(!EC_KEY_generate_key(ec)) { + ldns_key_free(k); + EC_KEY_free(ec); + return NULL; + } +#ifndef S_SPLINT_S + k->_key.key = EVP_PKEY_new(); + if(!k->_key.key) { + ldns_key_free(k); + EC_KEY_free(ec); + return NULL; + } + EVP_PKEY_assign_EC_KEY(k->_key.key, ec); +#endif /* splint */ + break; +#endif + } + ldns_key_set_algorithm(k, alg); + return k; +} + +void +ldns_key_print(FILE *output, const ldns_key *k) +{ + char *str = ldns_key2str(k); + if (str) { + fprintf(output, "%s", str); + } else { + fprintf(output, "Unable to convert private key to string\n"); + } + LDNS_FREE(str); +} + + +void +ldns_key_set_algorithm(ldns_key *k, ldns_signing_algorithm l) +{ + k->_alg = l; +} + +void +ldns_key_set_flags(ldns_key *k, uint16_t f) +{ + k->_extra.dnssec.flags = f; +} + +#ifdef HAVE_SSL +#ifndef S_SPLINT_S +void +ldns_key_set_evp_key(ldns_key *k, EVP_PKEY *e) +{ + k->_key.key = e; +} + +void +ldns_key_set_rsa_key(ldns_key *k, RSA *r) +{ + EVP_PKEY *key = EVP_PKEY_new(); + EVP_PKEY_set1_RSA(key, r); + k->_key.key = key; +} + +void +ldns_key_set_dsa_key(ldns_key *k, DSA *d) +{ + EVP_PKEY *key = EVP_PKEY_new(); + EVP_PKEY_set1_DSA(key, d); + k->_key.key = key; +} +#endif /* splint */ +#endif /* HAVE_SSL */ + +void +ldns_key_set_hmac_key(ldns_key *k, unsigned char *hmac) +{ + k->_key.hmac.key = hmac; +} + +void +ldns_key_set_hmac_size(ldns_key *k, size_t hmac_size) +{ + k->_key.hmac.size = hmac_size; +} + +void +ldns_key_set_external_key(ldns_key *k, void *external_key) +{ + k->_key.external_key = external_key; +} + +void +ldns_key_set_origttl(ldns_key *k, uint32_t t) +{ + k->_extra.dnssec.orig_ttl = t; +} + +void +ldns_key_set_inception(ldns_key *k, uint32_t i) +{ + k->_extra.dnssec.inception = i; +} + +void +ldns_key_set_expiration(ldns_key *k, uint32_t e) +{ + k->_extra.dnssec.expiration = e; +} + +void +ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r) +{ + k->_pubkey_owner = r; +} + +void +ldns_key_set_keytag(ldns_key *k, uint16_t tag) +{ + k->_extra.dnssec.keytag = tag; +} + +/* read */ +size_t +ldns_key_list_key_count(const ldns_key_list *key_list) +{ + return key_list->_key_count; +} + +ldns_key * +ldns_key_list_key(const ldns_key_list *key, size_t nr) +{ + if (nr < ldns_key_list_key_count(key)) { + return key->_keys[nr]; + } else { + return NULL; + } +} + +ldns_signing_algorithm +ldns_key_algorithm(const ldns_key *k) +{ + return k->_alg; +} + +void +ldns_key_set_use(ldns_key *k, bool v) +{ + if (k) { + k->_use = v; + } +} + +bool +ldns_key_use(const ldns_key *k) +{ + if (k) { + return k->_use; + } + return false; +} + +#ifdef HAVE_SSL +#ifndef S_SPLINT_S +EVP_PKEY * +ldns_key_evp_key(const ldns_key *k) +{ + return k->_key.key; +} + +RSA * +ldns_key_rsa_key(const ldns_key *k) +{ + if (k->_key.key) { + return EVP_PKEY_get1_RSA(k->_key.key); + } else { + return NULL; + } +} + +DSA * +ldns_key_dsa_key(const ldns_key *k) +{ + if (k->_key.key) { + return EVP_PKEY_get1_DSA(k->_key.key); + } else { + return NULL; + } +} +#endif /* splint */ +#endif /* HAVE_SSL */ + +unsigned char * +ldns_key_hmac_key(const ldns_key *k) +{ + if (k->_key.hmac.key) { + return k->_key.hmac.key; + } else { + return NULL; + } +} + +size_t +ldns_key_hmac_size(const ldns_key *k) +{ + if (k->_key.hmac.size) { + return k->_key.hmac.size; + } else { + return 0; + } +} + +void * +ldns_key_external_key(const ldns_key *k) +{ + return k->_key.external_key; +} + +uint32_t +ldns_key_origttl(const ldns_key *k) +{ + return k->_extra.dnssec.orig_ttl; +} + +uint16_t +ldns_key_flags(const ldns_key *k) +{ + return k->_extra.dnssec.flags; +} + +uint32_t +ldns_key_inception(const ldns_key *k) +{ + return k->_extra.dnssec.inception; +} + +uint32_t +ldns_key_expiration(const ldns_key *k) +{ + return k->_extra.dnssec.expiration; +} + +uint16_t +ldns_key_keytag(const ldns_key *k) +{ + return k->_extra.dnssec.keytag; +} + +ldns_rdf * +ldns_key_pubkey_owner(const ldns_key *k) +{ + return k->_pubkey_owner; +} + +/* write */ +void +ldns_key_list_set_use(ldns_key_list *keys, bool v) +{ + size_t i; + + for (i = 0; i < ldns_key_list_key_count(keys); i++) { + ldns_key_set_use(ldns_key_list_key(keys, i), v); + } +} + +void +ldns_key_list_set_key_count(ldns_key_list *key, size_t count) +{ + key->_key_count = count; +} + +bool +ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key) +{ + size_t key_count; + ldns_key **keys; + + key_count = ldns_key_list_key_count(key_list); + + /* grow the array */ + keys = LDNS_XREALLOC( + key_list->_keys, ldns_key *, key_count + 1); + if (!keys) { + return false; + } + + /* add the new member */ + key_list->_keys = keys; + key_list->_keys[key_count] = key; + + ldns_key_list_set_key_count(key_list, key_count + 1); + return true; +} + +ldns_key * +ldns_key_list_pop_key(ldns_key_list *key_list) +{ + size_t key_count; + ldns_key** a; + ldns_key *pop; + + if (!key_list) { + return NULL; + } + + key_count = ldns_key_list_key_count(key_list); + if (key_count == 0) { + return NULL; + } + + pop = ldns_key_list_key(key_list, key_count); + + /* shrink the array */ + a = LDNS_XREALLOC(key_list->_keys, ldns_key *, key_count - 1); + if(a) { + key_list->_keys = a; + } + + ldns_key_list_set_key_count(key_list, key_count - 1); + + return pop; +} + +#ifdef HAVE_SSL +#ifndef S_SPLINT_S +/* data pointer must be large enough (LDNS_MAX_KEYLEN) */ +static bool +ldns_key_rsa2bin(unsigned char *data, RSA *k, uint16_t *size) +{ + int i,j; + + if (!k) { + return false; + } + + if (BN_num_bytes(k->e) <= 256) { + /* normally only this path is executed (small factors are + * more common + */ + data[0] = (unsigned char) BN_num_bytes(k->e); + i = BN_bn2bin(k->e, data + 1); + j = BN_bn2bin(k->n, data + i + 1); + *size = (uint16_t) i + j; + } else if (BN_num_bytes(k->e) <= 65536) { + data[0] = 0; + /* BN_bn2bin does bigendian, _uint16 also */ + ldns_write_uint16(data + 1, (uint16_t) BN_num_bytes(k->e)); + + BN_bn2bin(k->e, data + 3); + BN_bn2bin(k->n, data + 4 + BN_num_bytes(k->e)); + *size = (uint16_t) BN_num_bytes(k->n) + 6; + } else { + return false; + } + return true; +} + +/* data pointer must be large enough (LDNS_MAX_KEYLEN) */ +static bool +ldns_key_dsa2bin(unsigned char *data, DSA *k, uint16_t *size) +{ + uint8_t T; + + if (!k) { + return false; + } + + /* See RFC2536 */ + *size = (uint16_t)BN_num_bytes(k->g); + T = (*size - 64) / 8; + memcpy(data, &T, 1); + + if (T > 8) { + fprintf(stderr, "DSA key with T > 8 (ie. > 1024 bits)"); + fprintf(stderr, " not implemented\n"); + return false; + } + + /* size = 64 + (T * 8); */ + data[0] = (unsigned char)T; + BN_bn2bin(k->q, data + 1 ); /* 20 octects */ + BN_bn2bin(k->p, data + 21 ); /* offset octects */ + BN_bn2bin(k->g, data + 21 + *size); /* offset octets */ + BN_bn2bin(k->pub_key, data + 21 + *size + *size); /* offset octets */ + *size = 21 + (*size * 3); + return true; +} + +#ifdef USE_GOST +static bool +ldns_key_gost2bin(unsigned char* data, EVP_PKEY* k, uint16_t* size) +{ + int i; + unsigned char* pp = NULL; + if(i2d_PUBKEY(k, &pp) != 37 + 64) { + /* expect 37 byte(ASN header) and 64 byte(X and Y) */ + CRYPTO_free(pp); + return false; + } + /* omit ASN header */ + for(i=0; i<64; i++) + data[i] = pp[i+37]; + CRYPTO_free(pp); + *size = 64; + return true; +} +#endif /* USE_GOST */ +#endif /* splint */ +#endif /* HAVE_SSL */ + +ldns_rr * +ldns_key2rr(const ldns_key *k) +{ + /* this function will convert a the keydata contained in + * rsa/dsa pointers to a DNSKEY rr. It will fill in as + * much as it can, but it does not know about key-flags + * for instance + */ + ldns_rr *pubkey; + ldns_rdf *keybin; + unsigned char *bin = NULL; + uint16_t size = 0; +#ifdef HAVE_SSL + RSA *rsa = NULL; + DSA *dsa = NULL; +#endif /* HAVE_SSL */ +#ifdef USE_ECDSA + EC_KEY* ec; +#endif + int internal_data = 0; + + pubkey = ldns_rr_new(); + if (!k) { + return NULL; + } + + switch (ldns_key_algorithm(k)) { + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + ldns_rr_set_type(pubkey, LDNS_RR_TYPE_KEY); + break; + default: + ldns_rr_set_type(pubkey, LDNS_RR_TYPE_DNSKEY); + break; + } + /* zero-th rdf - flags */ + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, + ldns_key_flags(k))); + /* first - proto */ + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, LDNS_DNSSEC_KEYPROTO)); + + if (ldns_key_pubkey_owner(k)) { + ldns_rr_set_owner(pubkey, ldns_rdf_clone(ldns_key_pubkey_owner(k))); + } + + /* third - da algorithm */ + switch(ldns_key_algorithm(k)) { + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); +#ifdef HAVE_SSL + rsa = ldns_key_rsa_key(k); + if (rsa) { + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + if (!ldns_key_rsa2bin(bin, rsa, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } + RSA_free(rsa); + internal_data = 1; + } +#endif + size++; + break; + case LDNS_SIGN_DSA: + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, LDNS_DSA)); +#ifdef HAVE_SSL + dsa = ldns_key_dsa_key(k); + if (dsa) { + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + if (!ldns_key_dsa2bin(bin, dsa, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } + DSA_free(dsa); + internal_data = 1; + } +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_DSA_NSEC3: + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, LDNS_DSA_NSEC3)); +#ifdef HAVE_SSL + dsa = ldns_key_dsa_key(k); + if (dsa) { + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + if (!ldns_key_dsa2bin(bin, dsa, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } + DSA_free(dsa); + internal_data = 1; + } +#endif /* HAVE_SSL */ + break; + case LDNS_SIGN_ECC_GOST: + ldns_rr_push_rdf(pubkey, ldns_native2rdf_int8( + LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); +#if defined(HAVE_SSL) && defined(USE_GOST) + bin = LDNS_XMALLOC(unsigned char, LDNS_MAX_KEYLEN); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } +#ifndef S_SPLINT_S + if (!ldns_key_gost2bin(bin, k->_key.key, &size)) { + LDNS_FREE(bin); + ldns_rr_free(pubkey); + return NULL; + } +#endif /* splint */ + internal_data = 1; +#endif /* HAVE_SSL and USE_GOST */ + break; +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + case LDNS_SIGN_ECDSAP384SHA384: + ldns_rr_push_rdf(pubkey, ldns_native2rdf_int8( + LDNS_RDF_TYPE_ALG, ldns_key_algorithm(k))); + bin = NULL; +#ifndef S_SPLINT_S + ec = EVP_PKEY_get1_EC_KEY(k->_key.key); +#endif + EC_KEY_set_conv_form(ec, POINT_CONVERSION_UNCOMPRESSED); + size = (uint16_t)i2o_ECPublicKey(ec, NULL); + if(!i2o_ECPublicKey(ec, &bin)) { + EC_KEY_free(ec); + ldns_rr_free(pubkey); + return NULL; + } + if(size > 1) { + /* move back one byte to shave off the 0x02 + * 'uncompressed' indicator that openssl made + * Actually its 0x04 (from implementation). + */ + assert(bin[0] == POINT_CONVERSION_UNCOMPRESSED); + size -= 1; + memmove(bin, bin+1, size); + } + /* down the reference count for ec, its still assigned + * to the pkey */ + EC_KEY_free(ec); + internal_data = 1; + break; +#endif + case LDNS_SIGN_HMACMD5: + case LDNS_SIGN_HMACSHA1: + case LDNS_SIGN_HMACSHA256: + bin = LDNS_XMALLOC(unsigned char, ldns_key_hmac_size(k)); + if (!bin) { + ldns_rr_free(pubkey); + return NULL; + } + ldns_rr_push_rdf(pubkey, + ldns_native2rdf_int8(LDNS_RDF_TYPE_ALG, + ldns_key_algorithm(k))); + size = ldns_key_hmac_size(k); + memcpy(bin, ldns_key_hmac_key(k), size); + internal_data = 1; + break; + } + /* fourth the key bin material */ + if (internal_data) { + keybin = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_B64, size, bin); + LDNS_FREE(bin); + ldns_rr_push_rdf(pubkey, keybin); + } + return pubkey; +} + +void +ldns_key_free(ldns_key *key) +{ + LDNS_FREE(key); +} + +void +ldns_key_deep_free(ldns_key *key) +{ + if (ldns_key_pubkey_owner(key)) { + ldns_rdf_deep_free(ldns_key_pubkey_owner(key)); + } +#ifdef HAVE_SSL + if (ldns_key_evp_key(key)) { + EVP_PKEY_free(ldns_key_evp_key(key)); + } +#endif /* HAVE_SSL */ + if (ldns_key_hmac_key(key)) { + free(ldns_key_hmac_key(key)); + } + LDNS_FREE(key); +} + +void +ldns_key_list_free(ldns_key_list *key_list) +{ + size_t i; + for (i = 0; i < ldns_key_list_key_count(key_list); i++) { + ldns_key_deep_free(ldns_key_list_key(key_list, i)); + } + LDNS_FREE(key_list->_keys); + LDNS_FREE(key_list); +} + +ldns_rr * +ldns_read_anchor_file(const char *filename) +{ + FILE *fp; + /*char line[LDNS_MAX_PACKETLEN];*/ + char *line = LDNS_XMALLOC(char, LDNS_MAX_PACKETLEN); + int c; + size_t i = 0; + ldns_rr *r; + ldns_status status; + if(!line) { + return NULL; + } + + fp = fopen(filename, "r"); + if (!fp) { + fprintf(stderr, "Unable to open %s: %s\n", filename, strerror(errno)); + LDNS_FREE(line); + return NULL; + } + + while ((c = fgetc(fp)) && i+1 < LDNS_MAX_PACKETLEN && c != EOF) { + line[i] = c; + i++; + } + line[i] = '\0'; + + fclose(fp); + + if (i <= 0) { + fprintf(stderr, "nothing read from %s", filename); + LDNS_FREE(line); + return NULL; + } else { + status = ldns_rr_new_frm_str(&r, line, 0, NULL, NULL); + if (status == LDNS_STATUS_OK && (ldns_rr_get_type(r) == LDNS_RR_TYPE_DNSKEY || ldns_rr_get_type(r) == LDNS_RR_TYPE_DS)) { + LDNS_FREE(line); + return r; + } else { + fprintf(stderr, "Error creating DNSKEY or DS rr from %s: %s\n", filename, ldns_get_errorstr_by_id(status)); + LDNS_FREE(line); + return NULL; + } + } +} + +char * +ldns_key_get_file_base_name(ldns_key *key) +{ + ldns_buffer *buffer; + char *file_base_name; + + buffer = ldns_buffer_new(255); + ldns_buffer_printf(buffer, "K"); + (void)ldns_rdf2buffer_str_dname(buffer, ldns_key_pubkey_owner(key)); + ldns_buffer_printf(buffer, + "+%03u+%05u", + ldns_key_algorithm(key), + ldns_key_keytag(key)); + file_base_name = strdup(ldns_buffer_export(buffer)); + ldns_buffer_free(buffer); + return file_base_name; +} + +int ldns_key_algo_supported(int algo) +{ + ldns_lookup_table *lt = ldns_signing_algorithms; + while(lt->name) { + if(lt->id == algo) + return 1; + lt++; + } + return 0; +} + +ldns_signing_algorithm ldns_get_signing_algorithm_by_name(const char* name) +{ + /* list of (signing algorithm id, alias_name) */ + ldns_lookup_table aliases[] = { + /* from bind dnssec-keygen */ + {LDNS_SIGN_HMACMD5, "HMAC-MD5"}, + {LDNS_SIGN_DSA_NSEC3, "NSEC3DSA"}, + {LDNS_SIGN_RSASHA1_NSEC3, "NSEC3RSASHA1"}, + /* old ldns usage, now RFC names */ + {LDNS_SIGN_DSA_NSEC3, "DSA_NSEC3" }, + {LDNS_SIGN_RSASHA1_NSEC3, "RSASHA1_NSEC3" }, +#ifdef USE_GOST + {LDNS_SIGN_ECC_GOST, "GOST"}, +#endif + /* compat with possible output */ + {LDNS_DH, "DH"}, + {LDNS_ECC, "ECC"}, + {LDNS_INDIRECT, "INDIRECT"}, + {LDNS_PRIVATEDNS, "PRIVATEDNS"}, + {LDNS_PRIVATEOID, "PRIVATEOID"}, + {0, NULL}}; + ldns_lookup_table* lt = ldns_signing_algorithms; + while(lt->name) { + if(strcasecmp(lt->name, name) == 0) + return lt->id; + lt++; + } + lt = aliases; + while(lt->name) { + if(strcasecmp(lt->name, name) == 0) + return lt->id; + lt++; + } + if(atoi(name) != 0) + return atoi(name); + return 0; +} diff --git a/libs/ldns/ldns/buffer.h b/libs/ldns/ldns/buffer.h new file mode 100644 index 0000000000..65b8bdc4ad --- /dev/null +++ b/libs/ldns/ldns/buffer.h @@ -0,0 +1,644 @@ +/* + * buffer.h -- generic memory buffer. + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + * + * The buffer module implements a generic buffer. The API is based on + * the java.nio.Buffer interface. + */ + +#ifndef LDNS_BUFFER_H +#define LDNS_BUFFER_H + +#include +#include +#include + +#include +#include + +#include "ldns/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * number of initial bytes in buffer of + * which we cannot tell the size before hand + */ +#define LDNS_MIN_BUFLEN 512 + +/** + * \file buffer.h + * + * This file contains the definition of ldns_buffer, and functions to manipulate those. + */ + +/** + * implementation of buffers to ease operations + * + * ldns_buffers can contain arbitrary information, per octet. You can write + * to the current end of a buffer, read from the current position, and + * access any data within it. + * + * Example use of buffers is in the source code of \ref host2str.c + */ +struct ldns_struct_buffer +{ + /** The current position used for reading/writing */ + size_t _position; + + /** The read/write limit */ + size_t _limit; + + /** The amount of data the buffer can contain */ + size_t _capacity; + + /** The data contained in the buffer */ + uint8_t *_data; + + /** If the buffer is fixed it cannot be resized */ + unsigned _fixed : 1; + + /** The current state of the buffer. If writing to the buffer fails + * for any reason, this value is changed. This way, you can perform + * multiple writes in sequence and check for success afterwards. */ + ldns_status _status; +}; +typedef struct ldns_struct_buffer ldns_buffer; + + +#ifdef NDEBUG +INLINE void +ldns_buffer_invariant(ldns_buffer *ATTR_UNUSED(buffer)) +{ +} +#else +INLINE void +ldns_buffer_invariant(ldns_buffer *buffer) +{ + assert(buffer != NULL); + assert(buffer->_position <= buffer->_limit); + assert(buffer->_limit <= buffer->_capacity); + assert(buffer->_data != NULL); +} +#endif + +/** + * creates a new buffer with the specified capacity. + * + * \param[in] capacity the size (in bytes) to allocate for the buffer + * \return the created buffer + */ +ldns_buffer *ldns_buffer_new(size_t capacity); + +/** + * creates a buffer with the specified data. The data IS copied + * and MEMORY allocations are done. The buffer is not fixed and can + * be resized using buffer_reserve(). + * + * \param[in] buffer pointer to the buffer to put the data in + * \param[in] data the data to encapsulate in the buffer + * \param[in] size the size of the data + */ +void ldns_buffer_new_frm_data(ldns_buffer *buffer, void *data, size_t size); + +/** + * clears the buffer and make it ready for writing. The buffer's limit + * is set to the capacity and the position is set to 0. + * \param[in] buffer the buffer to clear + */ +INLINE void ldns_buffer_clear(ldns_buffer *buffer) +{ + ldns_buffer_invariant(buffer); + + /* reset status here? */ + + buffer->_position = 0; + buffer->_limit = buffer->_capacity; +} + +/** + * makes the buffer ready for reading the data that has been written to + * the buffer. The buffer's limit is set to the current position and + * the position is set to 0. + * + * \param[in] buffer the buffer to flip + * \return void + */ +INLINE void ldns_buffer_flip(ldns_buffer *buffer) +{ + ldns_buffer_invariant(buffer); + + buffer->_limit = buffer->_position; + buffer->_position = 0; +} + +/** + * make the buffer ready for re-reading the data. The buffer's + * position is reset to 0. + * \param[in] buffer the buffer to rewind + */ +INLINE void ldns_buffer_rewind(ldns_buffer *buffer) +{ + ldns_buffer_invariant(buffer); + + buffer->_position = 0; +} + +/** + * returns the current position in the buffer (as a number of bytes) + * \param[in] buffer the buffer + * \return the current position + */ +INLINE size_t +ldns_buffer_position(ldns_buffer *buffer) +{ + return buffer->_position; +} + +/** + * sets the buffer's position to MARK. The position must be less than + * or equal to the buffer's limit. + * \param[in] buffer the buffer + * \param[in] mark the mark to use + */ +INLINE void +ldns_buffer_set_position(ldns_buffer *buffer, size_t mark) +{ + assert(mark <= buffer->_limit); + buffer->_position = mark; +} + +/** + * changes the buffer's position by COUNT bytes. The position must not + * be moved behind the buffer's limit or before the beginning of the + * buffer. + * \param[in] buffer the buffer + * \param[in] count the count to use + */ +INLINE void +ldns_buffer_skip(ldns_buffer *buffer, ssize_t count) +{ + assert(buffer->_position + count <= buffer->_limit); + buffer->_position += count; +} + +/** + * returns the maximum size of the buffer + * \param[in] buffer + * \return the size + */ +INLINE size_t +ldns_buffer_limit(ldns_buffer *buffer) +{ + return buffer->_limit; +} + +/** + * changes the buffer's limit. If the buffer's position is greater + * than the new limit the position is set to the limit. + * \param[in] buffer the buffer + * \param[in] limit the new limit + */ +INLINE void +ldns_buffer_set_limit(ldns_buffer *buffer, size_t limit) +{ + assert(limit <= buffer->_capacity); + buffer->_limit = limit; + if (buffer->_position > buffer->_limit) + buffer->_position = buffer->_limit; +} + +/** + * returns the number of bytes the buffer can hold. + * \param[in] buffer the buffer + * \return the number of bytes + */ +INLINE size_t +ldns_buffer_capacity(ldns_buffer *buffer) +{ + return buffer->_capacity; +} + +/** + * changes the buffer's capacity. The data is reallocated so any + * pointers to the data may become invalid. The buffer's limit is set + * to the buffer's new capacity. + * \param[in] buffer the buffer + * \param[in] capacity the capacity to use + * \return whether this failed or succeeded + */ +bool ldns_buffer_set_capacity(ldns_buffer *buffer, size_t capacity); + +/** + * ensures BUFFER can contain at least AMOUNT more bytes. The buffer's + * capacity is increased if necessary using buffer_set_capacity(). + * + * The buffer's limit is always set to the (possibly increased) + * capacity. + * \param[in] buffer the buffer + * \param[in] amount amount to use + * \return whether this failed or succeeded + */ +bool ldns_buffer_reserve(ldns_buffer *buffer, size_t amount); + +/** + * returns a pointer to the data at the indicated position. + * \param[in] buffer the buffer + * \param[in] at position + * \return the pointer to the data + */ +INLINE uint8_t * +ldns_buffer_at(const ldns_buffer *buffer, size_t at) +{ + assert(at <= buffer->_limit); + return buffer->_data + at; +} + +/** + * returns a pointer to the beginning of the buffer (the data at + * position 0). + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +ldns_buffer_begin(const ldns_buffer *buffer) +{ + return ldns_buffer_at(buffer, 0); +} + +/** + * returns a pointer to the end of the buffer (the data at the buffer's + * limit). + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +ldns_buffer_end(ldns_buffer *buffer) +{ + return ldns_buffer_at(buffer, buffer->_limit); +} + +/** + * returns a pointer to the data at the buffer's current position. + * \param[in] buffer the buffer + * \return the pointer + */ +INLINE uint8_t * +ldns_buffer_current(ldns_buffer *buffer) +{ + return ldns_buffer_at(buffer, buffer->_position); +} + +/** + * returns the number of bytes remaining between the indicated position and + * the limit. + * \param[in] buffer the buffer + * \param[in] at indicated position + * \return number of bytes + */ +INLINE size_t +ldns_buffer_remaining_at(ldns_buffer *buffer, size_t at) +{ + ldns_buffer_invariant(buffer); + assert(at <= buffer->_limit); + return buffer->_limit - at; +} + +/** + * returns the number of bytes remaining between the buffer's position and + * limit. + * \param[in] buffer the buffer + * \return the number of bytes + */ +INLINE size_t +ldns_buffer_remaining(ldns_buffer *buffer) +{ + return ldns_buffer_remaining_at(buffer, buffer->_position); +} + +/** + * checks if the buffer has at least COUNT more bytes available. + * Before reading or writing the caller needs to ensure enough space + * is available! + * \param[in] buffer the buffer + * \param[in] at indicated position + * \param[in] count how much is available + * \return true or false (as int?) + */ +INLINE int +ldns_buffer_available_at(ldns_buffer *buffer, size_t at, size_t count) +{ + return count <= ldns_buffer_remaining_at(buffer, at); +} + +/** + * checks if the buffer has count bytes available at the current position + * \param[in] buffer the buffer + * \param[in] count how much is available + * \return true or false (as int?) + */ +INLINE int +ldns_buffer_available(ldns_buffer *buffer, size_t count) +{ + return ldns_buffer_available_at(buffer, buffer->_position, count); +} + +/** + * writes the given data to the buffer at the specified position + * \param[in] buffer the buffer + * \param[in] at the position (in number of bytes) to write the data at + * \param[in] data pointer to the data to write to the buffer + * \param[in] count the number of bytes of data to write + */ +INLINE void +ldns_buffer_write_at(ldns_buffer *buffer, size_t at, const void *data, size_t count) +{ + assert(ldns_buffer_available_at(buffer, at, count)); + memcpy(buffer->_data + at, data, count); +} + +/** + * writes count bytes of data to the current position of the buffer + * \param[in] buffer the buffer + * \param[in] data the data to write + * \param[in] count the lenght of the data to write + */ +INLINE void +ldns_buffer_write(ldns_buffer *buffer, const void *data, size_t count) +{ + ldns_buffer_write_at(buffer, buffer->_position, data, count); + buffer->_position += count; +} + +/** + * copies the given (null-delimited) string to the specified position at the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] str the string to write + */ +INLINE void +ldns_buffer_write_string_at(ldns_buffer *buffer, size_t at, const char *str) +{ + ldns_buffer_write_at(buffer, at, str, strlen(str)); +} + +/** + * copies the given (null-delimited) string to the current position at the buffer + * \param[in] buffer the buffer + * \param[in] str the string to write + */ +INLINE void +ldns_buffer_write_string(ldns_buffer *buffer, const char *str) +{ + ldns_buffer_write(buffer, str, strlen(str)); +} + +/** + * writes the given byte of data at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 8 bits to write + */ +INLINE void +ldns_buffer_write_u8_at(ldns_buffer *buffer, size_t at, uint8_t data) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(data))); + buffer->_data[at] = data; +} + +/** + * writes the given byte of data at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 8 bits to write + */ +INLINE void +ldns_buffer_write_u8(ldns_buffer *buffer, uint8_t data) +{ + ldns_buffer_write_u8_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * writes the given 2 byte integer at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 16 bits to write + */ +INLINE void +ldns_buffer_write_u16_at(ldns_buffer *buffer, size_t at, uint16_t data) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(data))); + ldns_write_uint16(buffer->_data + at, data); +} + +/** + * writes the given 2 byte integer at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 16 bits to write + */ +INLINE void +ldns_buffer_write_u16(ldns_buffer *buffer, uint16_t data) +{ + ldns_buffer_write_u16_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * writes the given 4 byte integer at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \param[in] data the 32 bits to write + */ +INLINE void +ldns_buffer_write_u32_at(ldns_buffer *buffer, size_t at, uint32_t data) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(data))); + ldns_write_uint32(buffer->_data + at, data); +} + +/** + * writes the given 4 byte integer at the current position in the buffer + * \param[in] buffer the buffer + * \param[in] data the 32 bits to write + */ +INLINE void +ldns_buffer_write_u32(ldns_buffer *buffer, uint32_t data) +{ + ldns_buffer_write_u32_at(buffer, buffer->_position, data); + buffer->_position += sizeof(data); +} + +/** + * copies count bytes of data at the given position to the given data-array + * \param[in] buffer the buffer + * \param[in] at the position in the buffer to start + * \param[out] data buffer to copy to + * \param[in] count the length of the data to copy + */ +INLINE void +ldns_buffer_read_at(ldns_buffer *buffer, size_t at, void *data, size_t count) +{ + assert(ldns_buffer_available_at(buffer, at, count)); + memcpy(data, buffer->_data + at, count); +} + +/** + * copies count bytes of data at the current position to the given data-array + * \param[in] buffer the buffer + * \param[out] data buffer to copy to + * \param[in] count the length of the data to copy + */ +INLINE void +ldns_buffer_read(ldns_buffer *buffer, void *data, size_t count) +{ + ldns_buffer_read_at(buffer, buffer->_position, data, count); + buffer->_position += count; +} + +/** + * returns the byte value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at the position in the buffer + * \return 1 byte integer + */ +INLINE uint8_t +ldns_buffer_read_u8_at(ldns_buffer *buffer, size_t at) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(uint8_t))); + return buffer->_data[at]; +} + +/** + * returns the byte value at the current position in the buffer + * \param[in] buffer the buffer + * \return 1 byte integer + */ +INLINE uint8_t +ldns_buffer_read_u8(ldns_buffer *buffer) +{ + uint8_t result = ldns_buffer_read_u8_at(buffer, buffer->_position); + buffer->_position += sizeof(uint8_t); + return result; +} + +/** + * returns the 2-byte integer value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at position in the buffer + * \return 2 byte integer + */ +INLINE uint16_t +ldns_buffer_read_u16_at(ldns_buffer *buffer, size_t at) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(uint16_t))); + return ldns_read_uint16(buffer->_data + at); +} + +/** + * returns the 2-byte integer value at the current position in the buffer + * \param[in] buffer the buffer + * \return 2 byte integer + */ +INLINE uint16_t +ldns_buffer_read_u16(ldns_buffer *buffer) +{ + uint16_t result = ldns_buffer_read_u16_at(buffer, buffer->_position); + buffer->_position += sizeof(uint16_t); + return result; +} + +/** + * returns the 4-byte integer value at the given position in the buffer + * \param[in] buffer the buffer + * \param[in] at position in the buffer + * \return 4 byte integer + */ +INLINE uint32_t +ldns_buffer_read_u32_at(ldns_buffer *buffer, size_t at) +{ + assert(ldns_buffer_available_at(buffer, at, sizeof(uint32_t))); + return ldns_read_uint32(buffer->_data + at); +} + +/** + * returns the 4-byte integer value at the current position in the buffer + * \param[in] buffer the buffer + * \return 4 byte integer + */ +INLINE uint32_t +ldns_buffer_read_u32(ldns_buffer *buffer) +{ + uint32_t result = ldns_buffer_read_u32_at(buffer, buffer->_position); + buffer->_position += sizeof(uint32_t); + return result; +} + +/** + * returns the status of the buffer + * \param[in] buffer + * \return the status + */ +INLINE ldns_status +ldns_buffer_status(ldns_buffer *buffer) +{ + return buffer->_status; +} + +/** + * returns true if the status of the buffer is LDNS_STATUS_OK, false otherwise + * \param[in] buffer the buffer + * \return true or false + */ +INLINE bool +ldns_buffer_status_ok(ldns_buffer *buffer) +{ + if (buffer) { + return ldns_buffer_status(buffer) == LDNS_STATUS_OK; + } else { + return false; + } +} + +/** + * prints to the buffer, increasing the capacity if required using + * buffer_reserve(). The buffer's position is set to the terminating + * '\\0'. Returns the number of characters written (not including the + * terminating '\\0') or -1 on failure. + */ +int ldns_buffer_printf(ldns_buffer *buffer, const char *format, ...); +/* ATTR_FORMAT(printf, 2, 3);*/ + +/** + * frees the buffer. + * \param[in] *buffer the buffer to be freed + * \return void + */ +void ldns_buffer_free(ldns_buffer *buffer); + +/** + * Makes the buffer fixed and returns a pointer to the data. The + * caller is responsible for free'ing the result. + * \param[in] *buffer the buffer to be exported + * \return void + */ +void *ldns_buffer_export(ldns_buffer *buffer); + +/** + * Copy contents of the other buffer to this buffer. Silently truncated + * if this buffer is too small. + * \param[out] *result resulting buffer which is copied to. + * \param[in] *from what to copy to result. + */ +void ldns_buffer_copy(ldns_buffer* result, ldns_buffer* from); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_BUFFER_H */ diff --git a/libs/ldns/ldns/common.h b/libs/ldns/ldns/common.h new file mode 100644 index 0000000000..cc7dd89d1a --- /dev/null +++ b/libs/ldns/ldns/common.h @@ -0,0 +1,52 @@ +/** + * \file common.h + * + * Common definitions for LDNS + */ + +/** + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_COMMON_H +#define LDNS_COMMON_H + +#if !defined(__cplusplus) && !defined(__bool_true_false_are_defined) + +#if defined(HAVE_STDBOOL_H) +#include +#else + +/*@ignore@*/ +/* splint barfs on this construct */ +typedef unsigned int bool; +#define bool bool +#define false 0 +#define true 1 +#define __bool_true_false_are_defined 1 +/*@end@*/ + +#endif + +#endif + +#ifdef HAVE_ATTR_FORMAT +#define ATTR_FORMAT(archetype, string_index, first_to_check) \ + __attribute__ ((format (archetype, string_index, first_to_check))) +#else /* !HAVE_ATTR_FORMAT */ +#define ATTR_FORMAT(archetype, string_index, first_to_check) /* empty */ +#endif /* !HAVE_ATTR_FORMAT */ + +#if defined(__cplusplus) +#define ATTR_UNUSED(x) +#elif defined(HAVE_ATTR_UNUSED) +#define ATTR_UNUSED(x) x __attribute__((unused)) +#else /* !HAVE_ATTR_UNUSED */ +#define ATTR_UNUSED(x) x +#endif /* !HAVE_ATTR_UNUSED */ + +#endif /* LDNS_COMMON_H */ diff --git a/libs/ldns/ldns/config.h.in b/libs/ldns/ldns/config.h.in new file mode 100644 index 0000000000..473f1ff7c5 --- /dev/null +++ b/libs/ldns/ldns/config.h.in @@ -0,0 +1,470 @@ +/* ldns/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Whether the C compiler accepts the "format" attribute */ +#undef HAVE_ATTR_FORMAT + +/* Whether the C compiler accepts the "unused" attribute */ +#undef HAVE_ATTR_UNUSED + +/* Define to 1 if you have the `b32_ntop' function. */ +#undef HAVE_B32_NTOP + +/* Define to 1 if you have the `b32_pton' function. */ +#undef HAVE_B32_PTON + +/* Define to 1 if you have the `b64_ntop' function. */ +#undef HAVE_B64_NTOP + +/* Define to 1 if you have the `b64_pton' function. */ +#undef HAVE_B64_PTON + +/* Define to 1 if you have the `ctime_r' function. */ +#undef HAVE_CTIME_R + +/* Define to 1 if you have the declaration of `NID_secp384r1', and to 0 if you + don't. */ +#undef HAVE_DECL_NID_SECP384R1 + +/* Define to 1 if you have the declaration of `NID_X9_62_prime256v1', and to 0 + if you don't. */ +#undef HAVE_DECL_NID_X9_62_PRIME256V1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `endprotoent' function. */ +#undef HAVE_ENDPROTOENT + +/* Define to 1 if you have the `endservent' function. */ +#undef HAVE_ENDSERVENT + +/* Define to 1 if you have the `EVP_sha256' function. */ +#undef HAVE_EVP_SHA256 + +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + +/* Whether getaddrinfo is available */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R + +/* If you have HMAC_CTX_init */ +#undef HAVE_HMAC_CTX_INIT + +/* Define to 1 if you have the `inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define to 1 if you have the `inet_ntop' function. */ +#undef HAVE_INET_NTOP + +/* Define to 1 if you have the `inet_pton' function. */ +#undef HAVE_INET_PTON + +/* define if you have inttypes.h */ +#undef HAVE_INTTYPES_H + +/* if the function 'ioctlsocket' is available */ +#undef HAVE_IOCTLSOCKET + +/* Define to 1 if you have the `isascii' function. */ +#undef HAVE_ISASCII + +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#undef HAVE_MALLOC + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define if you have Python libraries and header files. */ +#undef HAVE_PYTHON + +/* Define to 1 if you have the `random' function. */ +#undef HAVE_RANDOM + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#undef HAVE_REALLOC + +/* Define to 1 if you have the `sleep' function. */ +#undef HAVE_SLEEP + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define if you have the SSL libraries installed. */ +#undef HAVE_SSL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL + +/* Define if you have Swig libraries and header files. */ +#undef HAVE_SWIG + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* define if you have sys/socket.h */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* define if you have sys/types.h */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* define if you have unistd.h */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* System configuration dir */ +#undef SYSCONFDIR + +/* Define this to enable ECDSA support. */ +#undef USE_ECDSA + +/* Define this to enable GOST support. */ +#undef USE_GOST + +/* Define this to enable SHA256 and SHA512 support. */ +#undef USE_SHA2 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Whether the windows socket API is used */ +#undef USE_WINSOCK + +/* the version of the windows API enabled */ +#undef WINVER + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* in_addr_t */ +#undef in_addr_t + +/* in_port_t */ +#undef in_port_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Define to `short' if does not define. */ +#undef int16_t + +/* Define to `int' if does not define. */ +#undef int32_t + +/* Define to `long long' if does not define. */ +#undef int64_t + +/* Define to `char' if does not define. */ +#undef int8_t + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to 'int' if not defined */ +#undef socklen_t + +/* Fallback member name for socket family in struct sockaddr_storage */ +#undef ss_family + +/* Define to `int' if does not define. */ +#undef ssize_t + +/* Define to `unsigned short' if does not define. */ +#undef uint16_t + +/* Define to `unsigned int' if does not define. */ +#undef uint32_t + +/* Define to `unsigned long long' if does not define. */ +#undef uint64_t + +/* Define to `unsigned char' if does not define. */ +#undef uint8_t + + +#include +#include +#include +#include + +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + +#ifndef BYTE_ORDER +#ifdef WORDS_BIGENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* WORDS_BIGENDIAN */ +#endif /* BYTE_ORDER */ + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + + +/* detect if we need to cast to unsigned int for FD_SET to avoid warnings */ +#ifdef HAVE_WINSOCK2_H +#define FD_SET_T (u_int) +#else +#define FD_SET_T +#endif + + + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef B64_PTON +int ldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b64_ntop + */ +/*@unused@*/ +static inline size_t ldns_b64_ntop_calculate_size(size_t srcsize) +{ + return ((((srcsize + 2) / 3) * 4) + 1); +} +#endif /* !B64_PTON */ +#ifndef B64_NTOP +int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of ldns_b64_pton + */ +/*@unused@*/ +static inline size_t ldns_b64_pton_calculate_size(size_t srcsize) +{ + return (((((srcsize + 3) / 4) * 3)) + 1); +} +#endif /* !B64_NTOP */ + +#ifndef HAVE_SLEEP +/* use windows sleep, in millisecs, instead */ +#define sleep(x) Sleep((x)*1000) +#endif + +#ifndef HAVE_RANDOM +#define srandom(x) srand(x) +#define random(x) rand(x) +#endif + +#ifndef HAVE_TIMEGM +#include +time_t timegm (struct tm *tm); +#endif /* !TIMEGM */ +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *timep, struct tm *result); +#endif +#ifndef HAVE_ISBLANK +int isblank(int c); +#endif /* !HAVE_ISBLANK */ +#ifndef HAVE_ISASCII +int isascii(int c); +#endif /* !HAVE_ISASCII */ +#ifndef HAVE_SNPRINTF +#include +int snprintf (char *str, size_t count, const char *fmt, ...); +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); +#endif /* HAVE_SNPRINTF */ +#ifndef HAVE_INET_PTON +int inet_pton(int af, const char* src, void* dst); +#endif /* HAVE_INET_PTON */ +#ifndef HAVE_INET_NTOP +const char *inet_ntop(int af, const void *src, char *dst, size_t size); +#endif +#ifndef HAVE_INET_ATON +int inet_aton(const char *cp, struct in_addr *addr); +#endif +#ifndef HAVE_MEMMOVE +void *memmove(void *dest, const void *src, size_t n); +#endif +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t siz); +#endif +#ifdef __cplusplus +} +#endif +#ifndef HAVE_GETADDRINFO +#include "compat/fake-rfc2553.h" +#endif +#ifndef HAVE_STRTOUL +#define strtoul (unsigned long)strtol +#endif + diff --git a/libs/ldns/ldns/dname.h b/libs/ldns/ldns/dname.h new file mode 100644 index 0000000000..a91f075257 --- /dev/null +++ b/libs/ldns/ldns/dname.h @@ -0,0 +1,201 @@ +/* + * dname.h + * + * dname definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file dname.h + * + * dname contains function to read and manipulate domain names. + * + * Example domain names are "www.nlnetlabs.nl." and "." (the root) + * + * If a domain name ends with a dot ("."), it is called a Fully Qualified + * Domain Name (FQDN). In certain places (for instance when reading a zone + * file), an origin (which is just another domain name) non-FQDNs will be + * placed after the current. For instance, if i have a zone file where the + * origin has been set to "nl.", and my file contains the name + * "www.nlnetlabs", it will result in "www.nlnetlabs.nl.". Internally, dnames are + * always absolute (the dot is added when it is missing and there is no origin). + * + * An FQDN is also + * known as an absolute domain name, therefore the function to check this is + * called \ref ldns_dname_str_absolute + * + * Domain names are stored in \ref ldns_rdf structures, with the type + * \ref LDNS_RDF_TYPE_DNAME + * + * This module is *NOT* about the RR type called DNAME. + */ + + +#ifndef LDNS_DNAME_H +#define LDNS_DNAME_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_DNAME_NORMALIZE tolower + +/** + * concatenates two dnames together + * \param[in] rd1 the leftside + * \param[in] rd2 the rightside + * \return a new rdf with leftside/rightside + */ +ldns_rdf *ldns_dname_cat_clone(const ldns_rdf *rd1, const ldns_rdf *rd2); + +/** + * concatenates rd2 after rd1 (rd2 is copied, rd1 is modified) + * \param[in] rd1 the leftside + * \param[in] rd2 the rightside + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dname_cat(ldns_rdf *rd1, ldns_rdf *rd2); + +/** + * Returns a clone of the given dname with the labels + * reversed + * \param[in] d the dname to reverse + * \return clone of the dname with the labels reversed. + */ +ldns_rdf *ldns_dname_reverse(const ldns_rdf *d); + +/** + * Clones the given dname from the nth label on + * \param[in] d The dname to clone + * \param[in] n the label nr to clone from, if this is 0, the complete + * dname is cloned + * \return A newly allocated *rdf structure, containing the cloned dname, + * or NULL if either d was NULL, not a dname, or if n >= + * label_count + */ +ldns_rdf * +ldns_dname_clone_from(const ldns_rdf *d, uint16_t n); + +/** + * chop one label off the left side of a dname. so + * wwww.nlnetlabs.nl, becomes nlnetlabs.nl + * This new name is a clone and must be freed with ldns_deep_free() + * \param[in] d the dname to chop + * \return the remaining dname + */ +ldns_rdf *ldns_dname_left_chop(const ldns_rdf *d); + +/** + * count the number of labels inside a LDNS_RDF_DNAME type rdf. + * \param[in] *r the rdf + * \return the number of labels + */ +uint8_t ldns_dname_label_count(const ldns_rdf *r); + +/** + * creates a new dname rdf from a string. + * \param[in] str string to use + * \return ldns_rdf* or NULL in case of an error + */ +ldns_rdf *ldns_dname_new_frm_str(const char *str); + +/** + * Create a new dname rdf from a string + * \param[in] s the size of the new dname + * \param[in] *data pointer to the actual data + * \return ldns_rdf* + */ +ldns_rdf *ldns_dname_new(uint16_t s, void *data); + +/** + * Create a new dname rdf from data (the data is copied) + * \param[in] size the size of the data + * \param[in] *data pointer to the actual data + * \return ldns_rdf* + */ +ldns_rdf *ldns_dname_new_frm_data(uint16_t size, const void *data); + +/** + * Put a dname into canonical fmt - ie. lowercase it + * \param[in] rdf the dname to lowercase + * \return void + */ +void ldns_dname2canonical(const ldns_rdf *rdf); + +/** + * test wether the name sub falls under parent (i.e. is a subdomain + * of parent). This function will return false if the given dnames are + * equal. + * \param[in] sub the name to test + * \param[in] parent the parent's name + * \return true if sub falls under parent, otherwise false + */ +bool ldns_dname_is_subdomain(const ldns_rdf *sub, const ldns_rdf *parent); + +/** + * Compares the two dname rdf's according to the algorithm for ordering + * in RFC4034 Section 6. + * \param[in] dname1 First dname rdf to compare + * \param[in] dname2 Second dname rdf to compare + * \return -1 if dname1 comes before dname2, 1 if dname1 comes after dname2, and 0 if they are equal. + */ +int ldns_dname_compare(const ldns_rdf *dname1, const ldns_rdf *dname2); + +/** + * Checks whether the dname matches the given wildcard + * \param[in] dname The dname to check + * \param[in] wildcard The wildcard to check with + * \return 1 If the wildcard matches, OR if 'wildcard' is not a wildcard and + * the names are *exactly* the same + * 0 If the wildcard does not match, or if it is not a wildcard and + * the names are not the same + */ +int ldns_dname_match_wildcard(const ldns_rdf *dname, const ldns_rdf *wildcard); + +/** + * check if middle lays in the interval defined by prev and next + * prev <= middle < next. This is usefull for nsec checking + * \param[in] prev the previous dname + * \param[in] middle the dname to check + * \param[in] next the next dname + * return 0 on error or unknown, -1 when middle is in the interval, +1 when not + */ +int ldns_dname_interval(const ldns_rdf *prev, const ldns_rdf *middle, const ldns_rdf *next); + +/** + * Checks whether the given dname string is absolute (i.e. ends with a '.') + * \param[in] *dname_str a string representing the dname + * \return true or false + */ +bool ldns_dname_str_absolute(const char *dname_str); + +/** + * look inside the rdf and if it is an LDNS_RDF_TYPE_DNAME + * try and retrieve a specific label. The labels are numbered + * starting from 0 (left most). + * \param[in] rdf the rdf to look in + * \param[in] labelpos return the label with this number + * \return a ldns_rdf* with the label as name or NULL on error + */ +ldns_rdf * ldns_dname_label(const ldns_rdf *rdf, uint8_t labelpos); + +/** + * Check if dname is a wildcard, starts with *. + * \param[in] dname: the rdf to look in + * \return true if a wildcard, false if not. + */ +int ldns_dname_is_wildcard(const ldns_rdf* dname); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_DNAME_H */ diff --git a/libs/ldns/ldns/dnssec.h b/libs/ldns/ldns/dnssec.h new file mode 100644 index 0000000000..7bfc70b710 --- /dev/null +++ b/libs/ldns/ldns/dnssec.h @@ -0,0 +1,497 @@ +/* + * dnssec.h -- defines for the Domain Name System (SEC) (DNSSEC) + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + * A bunch of defines that are used in the DNS + */ + +/** + * \file dnssec.h + * + * This module contains base functions for DNSSEC operations + * (RFC4033 t/m RFC4035). + * + * Since those functions heavily rely op cryptographic operations, + * this module is dependent on openssl. + * + */ + + +#ifndef LDNS_DNSSEC_H +#define LDNS_DNSSEC_H + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_MAX_KEYLEN 2048 +#define LDNS_DNSSEC_KEYPROTO 3 +/* default time before sigs expire */ +#define LDNS_DEFAULT_EXP_TIME 2419200 /* 4 weeks */ + +/** return values for the old-signature callback */ +#define LDNS_SIGNATURE_LEAVE_ADD_NEW 0 +#define LDNS_SIGNATURE_LEAVE_NO_ADD 1 +#define LDNS_SIGNATURE_REMOVE_ADD_NEW 2 +#define LDNS_SIGNATURE_REMOVE_NO_ADD 3 + +/** + * Returns the first RRSIG rr that corresponds to the rrset + * with the given name and type + * + * \param[in] name The dname of the RRset covered by the RRSIG to find + * \param[in] type The type of the RRset covered by the RRSIG to find + * \param[in] rrs List of rrs to search in + * \returns Pointer to the first RRsig ldns_rr found, or NULL if it is + * not present + */ +ldns_rr *ldns_dnssec_get_rrsig_for_name_and_type(const ldns_rdf *name, + const ldns_rr_type type, + const ldns_rr_list *rrs); + +/** + * Returns the DNSKEY that corresponds to the given RRSIG rr from the list, if + * any + * + * \param[in] rrsig The rrsig to find the DNSKEY for + * \param[in] rrs The rr list to find the key in + * \return The DNSKEY that corresponds to the given RRSIG, or NULL if it was + * not found. + */ +ldns_rr *ldns_dnssec_get_dnskey_for_rrsig(const ldns_rr *rrsig, const ldns_rr_list *rrs); + +/** + * Returns the rdata field that contains the bitmap of the covered types of + * the given NSEC record + * + * \param[in] nsec The nsec to get the covered type bitmap of + * \return An ldns_rdf containing the bitmap, or NULL on error + */ +ldns_rdf *ldns_nsec_get_bitmap(ldns_rr *nsec); + + +#define LDNS_NSEC3_MAX_ITERATIONS 65535 + +/** + * Returns the dname of the closest (provable) encloser + */ +ldns_rdf * +ldns_dnssec_nsec3_closest_encloser(ldns_rdf *qname, + ldns_rr_type qtype, + ldns_rr_list *nsec3s); + +/** + * Checks whether the packet contains rrsigs + */ +bool +ldns_dnssec_pkt_has_rrsigs(const ldns_pkt *pkt); + +/** + * Returns a ldns_rr_list containing the signatures covering the given name + * and type + */ +ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_name_and_type(const ldns_pkt *pkt, ldns_rdf *name, ldns_rr_type type); + +/** + * Returns a ldns_rr_list containing the signatures covering the given type + */ +ldns_rr_list *ldns_dnssec_pkt_get_rrsigs_for_type(const ldns_pkt *pkt, ldns_rr_type type); + +/** + * calculates a keytag of a key for use in DNSSEC. + * + * \param[in] key the key as an RR to use for the calc. + * \return the keytag + */ +uint16_t ldns_calc_keytag(const ldns_rr *key); + +/** + * Calculates keytag of DNSSEC key, operates on wireformat rdata. + * \param[in] key the key as uncompressed wireformat rdata. + * \param[in] keysize length of key data. + * \return the keytag + */ +uint16_t ldns_calc_keytag_raw(uint8_t* key, size_t keysize); + +#ifdef HAVE_SSL +/** + * converts a buffer holding key material to a DSA key in openssl. + * + * \param[in] key the key to convert + * \return a DSA * structure with the key material + */ +DSA *ldns_key_buf2dsa(ldns_buffer *key); +/** + * Like ldns_key_buf2dsa, but uses raw buffer. + * \param[in] key the uncompressed wireformat of the key. + * \param[in] len length of key data + * \return a DSA * structure with the key material + */ +DSA *ldns_key_buf2dsa_raw(unsigned char* key, size_t len); + +/** + * Utility function to calculate hash using generic EVP_MD pointer. + * \param[in] data the data to hash. + * \param[in] len length of data. + * \param[out] dest the destination of the hash, must be large enough. + * \param[in] md the message digest to use. + * \return true if worked, false on failure. + */ +int ldns_digest_evp(unsigned char* data, unsigned int len, + unsigned char* dest, const EVP_MD* md); + +/** + * Converts a holding buffer with key material to EVP PKEY in openssl. + * Only available if ldns was compiled with GOST. + * \param[in] key data to convert + * \param[in] keylen length of the key data + * \return the key or NULL on error. + */ +EVP_PKEY* ldns_gost2pkey_raw(unsigned char* key, size_t keylen); + +/** + * Converts a holding buffer with key material to EVP PKEY in openssl. + * Only available if ldns was compiled with ECDSA. + * \param[in] key data to convert + * \param[in] keylen length of the key data + * \param[in] algo precise algorithm to initialize ECC group values. + * \return the key or NULL on error. + */ +EVP_PKEY* ldns_ecdsa2pkey_raw(unsigned char* key, size_t keylen, uint8_t algo); + +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * converts a buffer holding key material to a RSA key in openssl. + * + * \param[in] key the key to convert + * \return a RSA * structure with the key material + */ +RSA *ldns_key_buf2rsa(ldns_buffer *key); + +/** + * Like ldns_key_buf2rsa, but uses raw buffer. + * \param[in] key the uncompressed wireformat of the key. + * \param[in] len length of key data + * \return a RSA * structure with the key material + */ +RSA *ldns_key_buf2rsa_raw(unsigned char* key, size_t len); +#endif /* HAVE_SSL */ + +/** + * returns a new DS rr that represents the given key rr. + * + * \param[in] *key the key to convert + * \param[in] h the hash to use LDNS_SHA1/LDNS_SHA256 + * \return ldns_rr* a new rr pointer to a DS + */ +ldns_rr *ldns_key_rr2ds(const ldns_rr *key, ldns_hash h); + +/** + * Create the type bitmap for an NSEC(3) record + */ +ldns_rdf * +ldns_dnssec_create_nsec_bitmap(ldns_rr_type rr_type_list[], + size_t size, + ldns_rr_type nsec_type); + +/** + * Creates NSEC + */ +ldns_rr * +ldns_dnssec_create_nsec(ldns_dnssec_name *from, + ldns_dnssec_name *to, + ldns_rr_type nsec_type); + + +/** + * Creates NSEC3 + */ +ldns_rr * +ldns_dnssec_create_nsec3(ldns_dnssec_name *from, + ldns_dnssec_name *to, + ldns_rdf *zone_name, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/** + * Create a NSEC record + * \param[in] cur_owner the current owner which should be taken as the starting point + * \param[in] next_owner the rrlist which the nsec rr should point to + * \param[in] rrs all rrs from the zone, to find all RR types of cur_owner in + * \return a ldns_rr with the nsec record in it + */ +ldns_rr * ldns_create_nsec(ldns_rdf *cur_owner, ldns_rdf *next_owner, ldns_rr_list *rrs); + +/** + * Calculates the hashed name using the given parameters + * \param[in] *name The owner name to calculate the hash for + * \param[in] algorithm The hash algorithm to use + * \param[in] iterations The number of hash iterations to use + * \param[in] salt_length The length of the salt in bytes + * \param[in] salt The salt to use + * \return The hashed owner name rdf, without the domain name + */ +ldns_rdf *ldns_nsec3_hash_name(ldns_rdf *name, uint8_t algorithm, uint16_t iterations, uint8_t salt_length, uint8_t *salt); + +/** + * Sets all the NSEC3 options. The rr to set them in must be initialized with _new() and + * type LDNS_RR_TYPE_NSEC3 + * \param[in] *rr The RR to set the values in + * \param[in] algorithm The NSEC3 hash algorithm + * \param[in] flags The flags field + * \param[in] iterations The number of hash iterations + * \param[in] salt_length The length of the salt in bytes + * \param[in] salt The salt bytes + */ +void ldns_nsec3_add_param_rdfs(ldns_rr *rr, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/* this will NOT return the NSEC3 completed, you will have to run the + finalize function on the rrlist later! */ +ldns_rr * +ldns_create_nsec3(ldns_rdf *cur_owner, + ldns_rdf *cur_zone, + ldns_rr_list *rrs, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt, + bool emptynonterminal); + +/** + * Returns the hash algorithm used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The algorithm identifier, or 0 on error + */ +uint8_t ldns_nsec3_algorithm(const ldns_rr *nsec3_rr); + +/** + * Returns flags field + */ +uint8_t +ldns_nsec3_flags(const ldns_rr *nsec3_rr); + +/** + * Returns true if the opt-out flag has been set in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return true if the RR has type NSEC3 and the opt-out bit has been set, false otherwise + */ +bool ldns_nsec3_optout(const ldns_rr *nsec3_rr); + +/** + * Returns the number of hash iterations used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The number of iterations + */ +uint16_t ldns_nsec3_iterations(const ldns_rr *nsec3_rr); + +/** + * Returns the salt used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The salt rdf, or NULL on error + */ +ldns_rdf *ldns_nsec3_salt(const ldns_rr *nsec3_rr); + +/** + * Returns the length of the salt used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The length of the salt in bytes + */ +uint8_t ldns_nsec3_salt_length(const ldns_rr *nsec3_rr); + +/** + * Returns the salt bytes used in the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The salt in bytes, this is alloced, so you need to free it + */ +uint8_t *ldns_nsec3_salt_data(const ldns_rr *nsec3_rr); + +/** + * Returns the first label of the next ownername in the NSEC3 chain (ie. without the domain) + * \param[in] nsec3_rr The RR to read from + * \return The first label of the next owner name in the NSEC3 chain, or NULL on error + */ +ldns_rdf *ldns_nsec3_next_owner(const ldns_rr *nsec3_rr); + +/** + * Returns the bitmap specifying the covered types of the given NSEC3 RR + * \param[in] *nsec3_rr The RR to read from + * \return The covered type bitmap rdf + */ +ldns_rdf *ldns_nsec3_bitmap(const ldns_rr *nsec3_rr); + +/** + * Calculates the hashed name using the parameters of the given NSEC3 RR + * \param[in] *nsec The RR to use the parameters from + * \param[in] *name The owner name to calculate the hash for + * \return The hashed owner name rdf, without the domain name + */ +ldns_rdf *ldns_nsec3_hash_name_frm_nsec3(const ldns_rr *nsec, ldns_rdf *name); + +/** + * Checks coverage of NSEC RR type bitmap + * \param[in] nsec_bitmap The NSEC bitmap rdata field to check + * \param[in] type The type to check + * \return true if the NSEC RR covers the type + */ +bool ldns_nsec_bitmap_covers_type(const ldns_rdf *nsec_bitmap, ldns_rr_type type); + +/** + * Checks coverage of NSEC(3) RR name span + * Remember that nsec and name must both be in canonical form (ie use + * \ref ldns_rr2canonical and \ref ldns_dname2canonical prior to calling this + * function) + * + * \param[in] nsec The NSEC RR to check + * \param[in] name The owner dname to check, if the nsec record is a NSEC3 record, this should be the hashed name + * \return true if the NSEC RR covers the owner name + */ +bool ldns_nsec_covers_name(const ldns_rr *nsec, const ldns_rdf *name); + +#ifdef HAVE_SSL +/** + * verify a packet + * \param[in] p the packet + * \param[in] t the rr set type to check + * \param[in] o the rr set name to check + * \param[in] k list of keys + * \param[in] s list of sigs (may be null) + * \param[out] good_keys keys which validated the packet + * \return status + * + */ +ldns_status ldns_pkt_verify(ldns_pkt *p, ldns_rr_type t, ldns_rdf *o, ldns_rr_list *k, ldns_rr_list *s, ldns_rr_list *good_keys); +#endif + +/** + * chains nsec3 list + */ +ldns_status +ldns_dnssec_chain_nsec3_list(ldns_rr_list *nsec3_rrs); + +/** + * compare for nsec3 sort + */ +int +qsort_rr_compare_nsec3(const void *a, const void *b); + +/** + * sort nsec3 list + */ +void +ldns_rr_list_sort_nsec3(ldns_rr_list *unsorted); + +/** + * Default callback function to always leave present signatures, and + * add new ones + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_LEAVE_ADD_NEW + */ +int ldns_dnssec_default_add_to_signatures(ldns_rr *sig, void *n); +/** + * Default callback function to always leave present signatures, and + * add no new ones for the keys of these signatures + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_LEAVE_NO_ADD + */ +int ldns_dnssec_default_leave_signatures(ldns_rr *sig, void *n); +/** + * Default callback function to always remove present signatures, but + * add no new ones + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_REMOVE_NO_ADD + */ +int ldns_dnssec_default_delete_signatures(ldns_rr *sig, void *n); +/** + * Default callback function to always leave present signatures, and + * add new ones + * \param[in] sig The signature to check for removal (unused) + * \param[in] n Optional argument (unused) + * \return LDNS_SIGNATURE_REMOVE_ADD_NEW + */ +int ldns_dnssec_default_replace_signatures(ldns_rr *sig, void *n); + +#ifdef HAVE_SSL +/** + * Converts the DSA signature from ASN1 representation (RFC2459, as + * used by OpenSSL) to raw signature data as used in DNS (rfc2536) + * + * \param[in] sig The signature in RFC2459 format + * \param[in] sig_len The length of the signature + * \return a new rdf with the signature + */ +ldns_rdf * +ldns_convert_dsa_rrsig_asn12rdf(const ldns_buffer *sig, + const long sig_len); + +/** + * Converts the RRSIG signature RDF (in rfc2536 format) to a buffer + * with the signature in rfc2459 format + * + * \param[out] target_buffer buffer to place the signature data + * \param[in] sig_rdf The signature rdf to convert + * \return LDNS_STATUS_OK on success, error code otherwise + */ +ldns_status +ldns_convert_dsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, + const ldns_rdf *sig_rdf); + +/** + * Converts the ECDSA signature from ASN1 representation (as + * used by OpenSSL) to raw signature data as used in DNS + * This routine is only present if ldns is compiled with ecdsa support. + * + * \param[in] sig The signature in ASN1 format + * \param[in] sig_len The length of the signature + * \return a new rdf with the signature + */ +ldns_rdf * +ldns_convert_ecdsa_rrsig_asn12rdf(const ldns_buffer *sig, const long sig_len); + +/** + * Converts the RRSIG signature RDF (from DNS) to a buffer with the + * signature in ASN1 format as openssl uses it. + * This routine is only present if ldns is compiled with ecdsa support. + * + * \param[out] target_buffer buffer to place the signature data in ASN1. + * \param[in] sig_rdf The signature rdf to convert + * \return LDNS_STATUS_OK on success, error code otherwise + */ +ldns_status +ldns_convert_ecdsa_rrsig_rdf2asn1(ldns_buffer *target_buffer, + const ldns_rdf *sig_rdf); + +#endif /* HAVE_SSL */ + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_DNSSEC_H */ diff --git a/libs/ldns/ldns/dnssec_sign.h b/libs/ldns/ldns/dnssec_sign.h new file mode 100644 index 0000000000..5b3921ab20 --- /dev/null +++ b/libs/ldns/ldns/dnssec_sign.h @@ -0,0 +1,318 @@ +/** dnssec_verify */ + +#ifndef LDNS_DNSSEC_SIGN_H +#define LDNS_DNSSEC_SIGN_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* sign functions */ + +/** Sign flag that makes DNSKEY type signed by all keys, not only by SEP keys*/ +#define LDNS_SIGN_DNSKEY_WITH_ZSK 1 + +/** + * Create an empty RRSIG RR (i.e. without the actual signature data) + * \param[in] rrset The RRset to create the signature for + * \param[in] key The key that will create the signature + * \return signature rr + */ +ldns_rr * +ldns_create_empty_rrsig(ldns_rr_list *rrset, + ldns_key *key); + +/** + * Sign the buffer which contains the wiredata of an rrset, and the + * corresponding empty rrsig rr with the given key + * \param[in] sign_buf the buffer with data to sign + * \param[in] key the key to sign with + * \return an rdata field with the signature data + */ +ldns_rdf * +ldns_sign_public_buffer(ldns_buffer *sign_buf, ldns_key *key); + +/** + * Sign an rrset + * \param[in] rrset the rrset + * \param[in] keys the keys to use + * \return a rr_list with the signatures + */ +ldns_rr_list *ldns_sign_public(ldns_rr_list *rrset, ldns_key_list *keys); + +#ifdef HAVE_SSL +/** + * Sign a buffer with the DSA key (hash with SHA1) + * \param[in] to_sign buffer with the data + * \param[in] key the key to use + * \return a ldns_rdf with the signed data + */ +ldns_rdf *ldns_sign_public_dsa(ldns_buffer *to_sign, DSA *key); + +/** + * Sign data with EVP (general method for different algorithms) + * + * \param[in] to_sign The ldns_buffer containing raw data that is + * to be signed + * \param[in] key The EVP_PKEY key structure to sign with + * \param[in] digest_type The digest algorithm to use in the creation of + * the signature + * \return ldns_rdf for the RRSIG ldns_rr + */ +ldns_rdf *ldns_sign_public_evp(ldns_buffer *to_sign, + EVP_PKEY *key, + const EVP_MD *digest_type); + +/** + * Sign a buffer with the RSA key (hash with SHA1) + * \param[in] to_sign buffer with the data + * \param[in] key the key to use + * \return a ldns_rdf with the signed data + */ +ldns_rdf *ldns_sign_public_rsasha1(ldns_buffer *to_sign, RSA *key); + +/** + * Sign a buffer with the RSA key (hash with MD5) + * \param[in] to_sign buffer with the data + * \param[in] key the key to use + * \return a ldns_rdf with the signed data + */ +ldns_rdf *ldns_sign_public_rsamd5(ldns_buffer *to_sign, RSA *key); +#endif /* HAVE_SSL */ + +/** + * Finds the first dnssec_name node in the rbtree that has not been marked + * as glue, starting at the given node + * + * \param[in] node the first node to check + * \return the first node that has not been marked as glue, or NULL + * if not found (TODO: make that LDNS_RBTREE_NULL?) + */ +ldns_rbnode_t *ldns_dnssec_name_node_next_nonglue(ldns_rbnode_t *node); + +/** + * Adds NSEC records to the given dnssec_zone + * + * \param[in] zone the zone to add the records to + * \param[in] new_rrs ldns_rr's created by this function are + * added to this rr list, so the caller can free them later + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_create_nsecs(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs); + +/** + * Adds NSEC3 records to the zone + */ +ldns_status +ldns_dnssec_zone_create_nsec3s(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/** + * remove signatures if callback function tells to + * + * \param[in] signatures list of signatures to check, and + * possibly remove, depending on the value of the + * callback + * \param[in] key_list these are marked to be used or not, + * on the return value of the callback + * \param[in] func this function is called to specify what to + * do with each signature (and corresponding key) + * \param[in] arg Optional argument for the callback function + * \returns pointer to the new signatures rrs (the original + * passed to this function may have been removed) + */ +ldns_dnssec_rrs *ldns_dnssec_remove_signatures(ldns_dnssec_rrs *signatures, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg); + +/** + * Adds signatures to the zone + * + * \param[in] zone the zone to add RRSIG Resource Records to + * \param[in] new_rrs the RRSIG RRs that are created are also + * added to this list, so the caller can free them + * later + * \param[in] key_list list of keys to sign with. + * \param[in] func Callback function to decide what keys to + * use and what to do with old signatures + * \param[in] arg Optional argument for the callback function + * \param[in] flags option flags for signing process. 0 makes DNSKEY + * RRset signed with the minimal key set, that is only SEP keys are used + * for signing. If there are no SEP keys available, non-SEP keys will + * be used. LDNS_SIGN_DNSKEY_WITH_ZSK makes DNSKEY type signed with all + * keys. 0 is the default. + * \return LDNS_STATUS_OK on success, error otherwise + */ +ldns_status ldns_dnssec_zone_create_rrsigs_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void*), + void *arg, + int flags); + +/** + * Adds signatures to the zone + * + * \param[in] zone the zone to add RRSIG Resource Records to + * \param[in] new_rrs the RRSIG RRs that are created are also + * added to this list, so the caller can free them + * later + * \param[in] key_list list of keys to sign with. + * \param[in] func Callback function to decide what keys to + * use and what to do with old signatures + * \param[in] arg Optional argument for the callback function + * \return LDNS_STATUS_OK on success, error otherwise + */ +ldns_status ldns_dnssec_zone_create_rrsigs(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void*), + void *arg); + +/** + * signs the given zone with the given keys + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * This function takes an ldns_rr* and an optional void *arg argument, and returns one of four values: + * LDNS_SIGNATURE_LEAVE_ADD_NEW: + * leave the signature and add a new one for the corresponding key + * LDNS_SIGNATURE_REMOVE_ADD_NEW: + * remove the signature and replace is with a new one from the same key + * LDNS_SIGNATURE_LEAVE_NO_ADD: + * leave the signature and do not add a new one with the corresponding key + * LDNS_SIGNATURE_REMOVE_NO_ADD: + * remove the signature and do not replace + * + * \param[in] arg optional argument for the callback function + * \param[in] flags option flags for signing process. 0 makes DNSKEY + * RRset signed with the minimal key set, that is only SEP keys are used + * for signing. If there are no SEP keys available, non-SEP keys will + * be used. LDNS_SIGN_DNSKEY_WITH_ZSK makes DNSKEY type signed with all + * keys. 0 is the default. + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + int flags); + +/** + * signs the given zone with the given new zone, with NSEC3 + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * \param[in] arg optional argument for the callback function + * \param[in] algorithm the NSEC3 hashing algorithm to use + * \param[in] flags NSEC3 flags + * \param[in] iterations the number of NSEC3 hash iterations to use + * \param[in] salt_length the length (in octets) of the NSEC3 salt + * \param[in] salt the NSEC3 salt data + * \param[in] signflags option flags for signing process. 0 is the default. + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign_nsec3_flg(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt, + int signflags); + +/** + * signs the given zone with the given keys + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * This function takes an ldns_rr* and an optional void *arg argument, and returns one of four values: + * LDNS_SIGNATURE_LEAVE_ADD_NEW: + * leave the signature and add a new one for the corresponding key + * LDNS_SIGNATURE_REMOVE_ADD_NEW: + * remove the signature and replace is with a new one from the same key + * LDNS_SIGNATURE_LEAVE_NO_ADD: + * leave the signature and do not add a new one with the corresponding key + * LDNS_SIGNATURE_REMOVE_NO_ADD: + * remove the signature and do not replace + * + * \param[in] arg optional argument for the callback function + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg); + +/** + * signs the given zone with the given new zone, with NSEC3 + * + * \param[in] zone the zone to sign + * \param[in] key_list the list of keys to sign the zone with + * \param[in] new_rrs newly created resource records are added to this list, to free them later + * \param[in] func callback function that decides what to do with old signatures + * \param[in] arg optional argument for the callback function + * \param[in] algorithm the NSEC3 hashing algorithm to use + * \param[in] flags NSEC3 flags + * \param[in] iterations the number of NSEC3 hash iterations to use + * \param[in] salt_length the length (in octets) of the NSEC3 salt + * \param[in] salt the NSEC3 salt data + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_sign_nsec3(ldns_dnssec_zone *zone, + ldns_rr_list *new_rrs, + ldns_key_list *key_list, + int (*func)(ldns_rr *, void *), + void *arg, + uint8_t algorithm, + uint8_t flags, + uint16_t iterations, + uint8_t salt_length, + uint8_t *salt); + +/** + * Signs the zone, and returns a newly allocated signed zone + * \param[in] zone the zone to sign + * \param[in] key_list list of keys to sign with + * \return signed zone + */ +ldns_zone *ldns_zone_sign(const ldns_zone *zone, ldns_key_list *key_list); + +/** + * Signs the zone with NSEC3, and returns a newly allocated signed zone + * \param[in] zone the zone to sign + * \param[in] key_list list of keys to sign with + * \param[in] algorithm the NSEC3 hashing algorithm to use + * \param[in] flags NSEC3 flags + * \param[in] iterations the number of NSEC3 hash iterations to use + * \param[in] salt_length the length (in octets) of the NSEC3 salt + * \param[in] salt the NSEC3 salt data + * \return signed zone + */ +ldns_zone *ldns_zone_sign_nsec3(ldns_zone *zone, ldns_key_list *key_list, uint8_t algorithm, uint8_t flags, uint16_t iterations, uint8_t salt_length, uint8_t *salt); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libs/ldns/ldns/dnssec_verify.h b/libs/ldns/ldns/dnssec_verify.h new file mode 100644 index 0000000000..8d380f9cee --- /dev/null +++ b/libs/ldns/ldns/dnssec_verify.h @@ -0,0 +1,612 @@ +/** dnssec_verify */ + +#ifndef LDNS_DNSSEC_VERIFY_H +#define LDNS_DNSSEC_VERIFY_H + +#define LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS 10 + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Chain structure that contains all DNSSEC data needed to + * verify an rrset + */ +typedef struct ldns_dnssec_data_chain_struct ldns_dnssec_data_chain; +struct ldns_dnssec_data_chain_struct +{ + ldns_rr_list *rrset; + ldns_rr_list *signatures; + ldns_rr_type parent_type; + ldns_dnssec_data_chain *parent; + ldns_pkt_rcode packet_rcode; + ldns_rr_type packet_qtype; + bool packet_nodata; +}; + +/** + * Creates a new dnssec_chain structure + * \return ldns_dnssec_data_chain * + */ +ldns_dnssec_data_chain *ldns_dnssec_data_chain_new(); + +/** + * Frees a dnssec_data_chain structure + * + * \param[in] *chain The chain to free + */ +void ldns_dnssec_data_chain_free(ldns_dnssec_data_chain *chain); + +/** + * Frees a dnssec_data_chain structure, and all data + * contained therein + * + * \param[in] *chain The dnssec_data_chain to free + */ +void ldns_dnssec_data_chain_deep_free(ldns_dnssec_data_chain *chain); + +/** + * Prints the dnssec_data_chain to the given file stream + * + * \param[in] *out The file stream to print to + * \param[in] *chain The dnssec_data_chain to print + */ +void ldns_dnssec_data_chain_print(FILE *out, const ldns_dnssec_data_chain *chain); + +/** + * Build an ldns_dnssec_data_chain, which contains all + * DNSSEC data that is needed to derive the trust tree later + * + * The data_set will be cloned + * + * \param[in] *res resolver structure for further needed queries + * \param[in] qflags resolution flags + * \param[in] *data_set The original rrset where the chain ends + * \param[in] *pkt optional, can contain the original packet + * (and hence the sigs and maybe the key) + * \param[in] *orig_rr The original Resource Record + * + * \return the DNSSEC data chain + */ +ldns_dnssec_data_chain *ldns_dnssec_build_data_chain(ldns_resolver *res, + const uint16_t qflags, + const ldns_rr_list *data_set, + const ldns_pkt *pkt, + ldns_rr *orig_rr); + +/** + * Tree structure that contains the relation of DNSSEC data, + * and their cryptographic status. + * + * This tree is derived from a data_chain, and can be used + * to look whether there is a connection between an RRSET + * and a trusted key. The tree only contains pointers to the + * data_chain, and therefore one should *never* free() the + * data_chain when there is still a trust tree derived from + * that chain. + * + * Example tree: + * key key key + * \ | / + * \ | / + * \ | / + * ds + * | + * key + * | + * key + * | + * rr + * + * For each signature there is a parent; if the parent + * pointer is null, it couldn't be found and there was no + * denial; otherwise is a tree which contains either a + * DNSKEY, a DS, or a NSEC rr + */ +typedef struct ldns_dnssec_trust_tree_struct ldns_dnssec_trust_tree; +struct ldns_dnssec_trust_tree_struct +{ + ldns_rr *rr; + /* the complete rrset this rr was in */ + ldns_rr_list *rrset; + ldns_dnssec_trust_tree *parents[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; + ldns_status parent_status[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; + /** for debugging, add signatures too (you might want + those if they contain errors) */ + ldns_rr *parent_signature[LDNS_DNSSEC_TRUST_TREE_MAX_PARENTS]; + size_t parent_count; +}; + +/** + * Creates a new (empty) dnssec_trust_tree structure + * + * \return ldns_dnssec_trust_tree * + */ +ldns_dnssec_trust_tree *ldns_dnssec_trust_tree_new(); + +/** + * Frees the dnssec_trust_tree recursively + * + * There is no deep free; all data in the trust tree + * consists of pointers to a data_chain + * + * \param[in] tree The tree to free + */ +void ldns_dnssec_trust_tree_free(ldns_dnssec_trust_tree *tree); + +/** + * returns the depth of the trust tree + * + * \param[in] tree tree to calculate the depth of + * \return The depth of the tree + */ +size_t ldns_dnssec_trust_tree_depth(ldns_dnssec_trust_tree *tree); + +/** + * Prints the dnssec_trust_tree structure to the given file + * stream. + * + * If a link status is not LDNS_STATUS_OK; the status and + * relevant signatures are printed too + * + * \param[in] *out The file stream to print to + * \param[in] tree The trust tree to print + * \param[in] tabs Prepend each line with tabs*2 spaces + * \param[in] extended If true, add little explanation lines to the output + */ +void ldns_dnssec_trust_tree_print(FILE *out, + ldns_dnssec_trust_tree *tree, + size_t tabs, + bool extended); + +/** + * Adds a trust tree as a parent for the given trust tree + * + * \param[in] *tree The tree to add the parent to + * \param[in] *parent The parent tree to add + * \param[in] *parent_signature The RRSIG relevant to this parent/child + * connection + * \param[in] parent_status The DNSSEC status for this parent, child and RRSIG + * \return LDNS_STATUS_OK if the addition succeeds, error otherwise + */ +ldns_status ldns_dnssec_trust_tree_add_parent(ldns_dnssec_trust_tree *tree, + const ldns_dnssec_trust_tree *parent, + const ldns_rr *parent_signature, + const ldns_status parent_status); + +/** + * Generates a dnssec_trust_ttree for the given rr from the + * given data_chain + * + * This does not clone the actual data; Don't free the + * data_chain before you are done with this tree + * + * \param[in] *data_chain The chain to derive the trust tree from + * \param[in] *rr The RR this tree will be about + * \return ldns_dnssec_trust_tree * + */ +ldns_dnssec_trust_tree *ldns_dnssec_derive_trust_tree( + ldns_dnssec_data_chain *data_chain, + ldns_rr *rr); + +/** + * Sub function for derive_trust_tree that is used for a + * 'normal' rrset + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + * \param[in] cur_sig_rr The currently relevant signature + */ +void ldns_dnssec_derive_trust_tree_normal_rrset( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_sig_rr); + +/** + * Sub function for derive_trust_tree that is used for DNSKEY rrsets + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + * \param[in] cur_rr The currently relevant DNSKEY RR + * \param[in] cur_sig_rr The currently relevant signature + */ +void ldns_dnssec_derive_trust_tree_dnskey_rrset( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_rr, + ldns_rr *cur_sig_rr); + +/** + * Sub function for derive_trust_tree that is used for DS rrsets + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + * \param[in] cur_rr The currently relevant DS RR + */ +void ldns_dnssec_derive_trust_tree_ds_rrset( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain, + ldns_rr *cur_rr); + +/** + * Sub function for derive_trust_tree that is used when there are no + * signatures + * + * \param[in] new_tree The trust tree that we are building + * \param[in] data_chain The data chain containing the data for the trust tree + */ +void ldns_dnssec_derive_trust_tree_no_sig( + ldns_dnssec_trust_tree *new_tree, + ldns_dnssec_data_chain *data_chain); + +/** + * Returns OK if there is a trusted path in the tree to one of + * the DNSKEY or DS RRs in the given list + * + * \param *tree The trust tree so search + * \param *keys A ldns_rr_list of DNSKEY and DS rrs to look for + * \return LDNS_STATUS_OK if there is a trusted path to one of + * the keys, or the *first* error encountered + * if there were no paths + */ +ldns_status ldns_dnssec_trust_tree_contains_keys( + ldns_dnssec_trust_tree *tree, + ldns_rr_list *keys); + +/** + * Verifies a list of signatures for one rrset. + * + * \param[in] rrset the rrset to verify + * \param[in] rrsig a list of signatures to check + * \param[in] keys a list of keys to check with + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return status LDNS_STATUS_OK if there is at least one correct key + */ +ldns_status ldns_verify(ldns_rr_list *rrset, + ldns_rr_list *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * Verifies a list of signatures for one rrset, but disregard the time. + * Inception and Expiration are not checked. + * + * \param[in] rrset the rrset to verify + * \param[in] rrsig a list of signatures to check + * \param[in] keys a list of keys to check with + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return status LDNS_STATUS_OK if there is at least one correct key + */ +ldns_status ldns_verify_notime(ldns_rr_list *rrset, + ldns_rr_list *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * Tries to build an authentication chain from the given + * keys down to the queried domain. + * + * If we find a valid trust path, return the valid keys for the domain. + * + * \param[in] res the current resolver + * \param[in] domain the domain we want valid keys for + * \param[in] keys the current set of trusted keys + * \param[out] status pointer to the status variable where the result + * code will be stored + * \return the set of trusted keys for the domain, or NULL if no + * trust path could be built. + */ +ldns_rr_list *ldns_fetch_valid_domain_keys(const ldns_resolver * res, + const ldns_rdf * domain, + const ldns_rr_list * keys, + ldns_status *status); + +/** + * Validates the DNSKEY RRset for the given domain using the provided + * trusted keys. + * + * \param[in] res the current resolver + * \param[in] domain the domain we want valid keys for + * \param[in] keys the current set of trusted keys + * \return the set of trusted keys for the domain, or NULL if the RRSET + * could not be validated + */ +ldns_rr_list *ldns_validate_domain_dnskey (const ldns_resolver *res, + const ldns_rdf *domain, + const ldns_rr_list *keys); + +/** + * Validates the DS RRset for the given domain using the provided trusted keys. + * + * \param[in] res the current resolver + * \param[in] domain the domain we want valid keys for + * \param[in] keys the current set of trusted keys + * \return the set of trusted keys for the domain, or NULL if the RRSET could not be validated + */ +ldns_rr_list *ldns_validate_domain_ds(const ldns_resolver *res, + const ldns_rdf * + domain, + const ldns_rr_list * keys); + +/** + * Verifies a list of signatures for one RRset using a valid trust path. + * + * \param[in] res the current resolver + * \param[in] rrset the rrset to verify + * \param[in] rrsigs a list of signatures to check + * \param[out] validating_keys if this is a (initialized) list, the + * keys from keys that validate one of + * the signatures are added to it + * \return status LDNS_STATUS_OK if there is at least one correct key + */ +ldns_status ldns_verify_trusted(ldns_resolver *res, + ldns_rr_list *rrset, + ldns_rr_list *rrsigs, + ldns_rr_list *validating_keys); + +/** + * denial is not just a river in egypt + * + * \param[in] rr The (query) RR to check the denial of existence for + * \param[in] nsecs The list of NSEC RRs that are supposed to deny the + * existence of the RR + * \param[in] rrsigs The RRSIG RR covering the NSEC RRs + * \return LDNS_STATUS_OK if the NSEC RRs deny the existence, error code + * containing the reason they do not otherwise + */ +ldns_status ldns_dnssec_verify_denial(ldns_rr *rr, + ldns_rr_list *nsecs, + ldns_rr_list *rrsigs); + +/** + * Denial of existence using NSEC3 records + * Since NSEC3 is a bit more complicated than normal denial, some + * context arguments are needed + * + * \param[in] rr The (query) RR to check the denial of existence for + * \param[in] nsecs The list of NSEC3 RRs that are supposed to deny the + * existence of the RR + * \param[in] rrsigs The RRSIG rr covering the NSEC RRs + * \param[in] packet_rcode The RCODE value of the packet that provided the + * NSEC3 RRs + * \param[in] packet_qtype The original query RR type + * \param[in] packet_nodata True if the providing packet had an empty ANSWER + * section + * \return LDNS_STATUS_OK if the NSEC3 RRs deny the existence, error code + * containing the reason they do not otherwise + */ +ldns_status ldns_dnssec_verify_denial_nsec3(ldns_rr *rr, + ldns_rr_list *nsecs, + ldns_rr_list *rrsigs, + ldns_pkt_rcode packet_rcode, + ldns_rr_type packet_qtype, + bool packet_nodata); + +/** + * Verifies the already processed data in the buffers + * This function should probably not be used directly. + * + * \param[in] rawsig_buf Buffer containing signature data to use + * \param[in] verify_buf Buffer containing data to verify + * \param[in] key_buf Buffer containing key data to use + * \param[in] algo Signing algorithm + * \return status LDNS_STATUS_OK if the data verifies. Error if not. + */ +ldns_status ldns_verify_rrsig_buffers(ldns_buffer *rawsig_buf, + ldns_buffer *verify_buf, + ldns_buffer *key_buf, + uint8_t algo); + +/** + * Like ldns_verify_rrsig_buffers, but uses raw data. + * + * \param[in] sig signature data to use + * \param[in] siglen length of signature data to use + * \param[in] verify_buf Buffer containing data to verify + * \param[in] key key data to use + * \param[in] keylen length of key data to use + * \param[in] algo Signing algorithm + * \return status LDNS_STATUS_OK if the data verifies. Error if not. + */ +ldns_status ldns_verify_rrsig_buffers_raw(unsigned char* sig, + size_t siglen, + ldns_buffer *verify_buf, + unsigned char* key, + size_t keylen, + uint8_t algo); + +/** + * Verifies an rrsig. All keys in the keyset are tried. + * \param[in] rrset the rrset to check + * \param[in] rrsig the signature of the rrset + * \param[in] keys the keys to try + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return a list of keys which validate the rrsig + rrset. Returns + * status LDNS_STATUS_OK if at least one key matched. Else an error. + */ +ldns_status ldns_verify_rrsig_keylist(ldns_rr_list *rrset, + ldns_rr *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * Verifies an rrsig. All keys in the keyset are tried. Time is not checked. + * \param[in] rrset the rrset to check + * \param[in] rrsig the signature of the rrset + * \param[in] keys the keys to try + * \param[out] good_keys if this is a (initialized) list, the pointer to keys + * from keys that validate one of the signatures + * are added to it + * \return a list of keys which validate the rrsig + rrset. Returns + * status LDNS_STATUS_OK if at least one key matched. Else an error. + */ +ldns_status ldns_verify_rrsig_keylist_notime(ldns_rr_list *rrset, + ldns_rr *rrsig, + const ldns_rr_list *keys, + ldns_rr_list *good_keys); + +/** + * verify an rrsig with 1 key + * \param[in] rrset the rrset + * \param[in] rrsig the rrsig to verify + * \param[in] key the key to use + * \return status message wether verification succeeded. + */ +ldns_status ldns_verify_rrsig(ldns_rr_list *rrset, + ldns_rr *rrsig, + ldns_rr *key); + +/** + * verifies a buffer with signature data for a buffer with rrset data + * with an EVP_PKEY + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the EVP key structure + * \param[in] digest_type The digest type of the signature + */ +#ifdef HAVE_SSL +ldns_status ldns_verify_rrsig_evp(ldns_buffer *sig, + ldns_buffer *rrset, + EVP_PKEY *key, + const EVP_MD *digest_type); +#endif + +/** + * Like ldns_verify_rrsig_evp, but uses raw signature data. + * \param[in] sig the signature data, wireformat uncompressed + * \param[in] siglen length of the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the EVP key structure + * \param[in] digest_type The digest type of the signature + */ +#ifdef HAVE_SSL +ldns_status ldns_verify_rrsig_evp_raw(unsigned char *sig, + size_t siglen, + ldns_buffer *rrset, + EVP_PKEY *key, + const EVP_MD *digest_type); +#endif + +/** + * verifies a buffer with signature data (DSA) for a buffer with rrset data + * with a buffer with key data. + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the key data + */ +ldns_status ldns_verify_rrsig_dsa(ldns_buffer *sig, + ldns_buffer *rrset, + ldns_buffer *key); + +/** + * verifies a buffer with signature data (RSASHA1) for a buffer with rrset data + * with a buffer with key data. + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the key data + */ +ldns_status ldns_verify_rrsig_rsasha1(ldns_buffer *sig, + ldns_buffer *rrset, + ldns_buffer *key); + +/** + * verifies a buffer with signature data (RSAMD5) for a buffer with rrset data + * with a buffer with key data. + * + * \param[in] sig the signature data + * \param[in] rrset the rrset data, sorted and processed for verification + * \param[in] key the key data + */ +ldns_status ldns_verify_rrsig_rsamd5(ldns_buffer *sig, + ldns_buffer *rrset, + ldns_buffer *key); + +/** + * Like ldns_verify_rrsig_dsa, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_dsa_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsasha1, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_rsasha1_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsasha256, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ + +ldns_status ldns_verify_rrsig_rsasha256_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsasha512, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_rsasha512_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +/** + * Like ldns_verify_rrsig_rsamd5, but uses raw signature and key data. + * \param[in] sig raw uncompressed wireformat signature data + * \param[in] siglen length of signature data + * \param[in] rrset ldns buffer with prepared rrset data. + * \param[in] key raw uncompressed wireformat key data + * \param[in] keylen length of key data + */ +ldns_status ldns_verify_rrsig_rsamd5_raw(unsigned char* sig, + size_t siglen, + ldns_buffer* rrset, + unsigned char* key, + size_t keylen); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/libs/ldns/ldns/dnssec_zone.h b/libs/ldns/ldns/dnssec_zone.h new file mode 100644 index 0000000000..88117dafb3 --- /dev/null +++ b/libs/ldns/ldns/dnssec_zone.h @@ -0,0 +1,366 @@ +/* + * special zone file structures and functions for better dnssec handling + * + * A zone contains a SOA dnssec_zone_rrset, and an AVL tree of 'normal' + * dnssec_zone_rrsets, indexed by name and type + */ + +#ifndef LDNS_DNSSEC_ZONE_H +#define LDNS_DNSSEC_ZONE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Singly linked list of rrs + */ +typedef struct ldns_struct_dnssec_rrs ldns_dnssec_rrs; +struct ldns_struct_dnssec_rrs +{ + ldns_rr *rr; + ldns_dnssec_rrs *next; +}; + +/** + * Singly linked list of RRsets + */ +typedef struct ldns_struct_dnssec_rrsets ldns_dnssec_rrsets; +struct ldns_struct_dnssec_rrsets +{ + ldns_dnssec_rrs *rrs; + ldns_rr_type type; + ldns_dnssec_rrs *signatures; + ldns_dnssec_rrsets *next; +}; + +/** + * Structure containing all resource records for a domain name + * Including the derived NSEC3, if present + */ +typedef struct ldns_struct_dnssec_name ldns_dnssec_name; +struct ldns_struct_dnssec_name +{ + /** + * pointer to a dname containing the name. + * Usually points to the owner name of the first RR of the first RRset + */ + ldns_rdf *name; + /** + * Usually, the name is a pointer to the owner name of the first rr for + * this name, but sometimes there is no actual data to point to, + * for instance in + * names representing empty nonterminals. If so, set alloced to true to + * indicate that this data must also be freed when the name is freed + */ + bool name_alloced; + /** + * The rrsets for this name + */ + ldns_dnssec_rrsets *rrsets; + /** + * NSEC pointing to the next name (or NSEC3 pointing to the next NSEC3) + */ + ldns_rr *nsec; + /** + * signatures for the NSEC record + */ + ldns_dnssec_rrs *nsec_signatures; + /** + * Set to true if this name is glue + * (as marked by ldns_dnssec_zone_mark_glue()) + */ + bool is_glue; + /** + * pointer to store the hashed name (only used when in an NSEC3 zone + */ + ldns_rdf *hashed_name; +}; + +/** + * Structure containing a dnssec zone + */ +struct ldns_struct_dnssec_zone { + /** points to the name containing the SOA RR */ + ldns_dnssec_name *soa; + /** tree of ldns_dnssec_names */ + ldns_rbtree_t *names; +}; +typedef struct ldns_struct_dnssec_zone ldns_dnssec_zone; + +/** + * Creates a new entry for 1 pointer to an rr and 1 pointer to the next rrs + * \return the allocated data + */ +ldns_dnssec_rrs *ldns_dnssec_rrs_new(); + +/** + * Frees the list of rrs, but *not* the individual ldns_rr records + * contained in the list + * + * \param[in] rrs the data structure to free + */ +void ldns_dnssec_rrs_free(ldns_dnssec_rrs *rrs); + +/** + * Frees the list of rrs, and the individual ldns_rr records + * contained in the list + * + * \param[in] rrs the data structure to free + */ +void ldns_dnssec_rrs_deep_free(ldns_dnssec_rrs *rrs); + +/** + * Adds an RR to the list of RRs. The list will remain ordered + * + * \param[in] rrs the list to add to + * \param[in] rr the RR to add + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dnssec_rrs_add_rr(ldns_dnssec_rrs *rrs, ldns_rr *rr); + +/** + * Prints the given rrs to the file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] rrs the list of RRs to print + */ +void ldns_dnssec_rrs_print(FILE *out, ldns_dnssec_rrs *rrs); + +/** + * Creates a new list (entry) of RRsets + * \return the newly allocated structure + */ +ldns_dnssec_rrsets *ldns_dnssec_rrsets_new(); + +/** + * Frees the list of rrsets and their rrs, but *not* the ldns_rr + * records in the sets + * + * \param[in] rrsets the data structure to free + */ +void ldns_dnssec_rrsets_free(ldns_dnssec_rrsets *rrsets); + +/** + * Frees the list of rrsets and their rrs, and the ldns_rr + * records in the sets + * + * \param[in] rrsets the data structure to free + */ +void ldns_dnssec_rrsets_deep_free(ldns_dnssec_rrsets *rrsets); + +/** + * Returns the rr type of the rrset (that is head of the given list) + * + * \param[in] rrsets the rrset to get the type of + * \return the rr type + */ +ldns_rr_type ldns_dnssec_rrsets_type(ldns_dnssec_rrsets *rrsets); + +/** + * Sets the RR type of the rrset (that is head of the given list) + * + * \param[in] rrsets the rrset to set the type of + * \param[in] type the type to set + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dnssec_rrsets_set_type(ldns_dnssec_rrsets *rrsets, + ldns_rr_type type); + +/** + * Add an ldns_rr to the corresponding RRset in the given list of RRsets. + * If it is not present, add it as a new RRset with 1 record. + * + * \param[in] rrsets the list of rrsets to add the RR to + * \param[in] rr the rr to add to the list of rrsets + * \return LDNS_STATUS_OK on success + */ +ldns_status ldns_dnssec_rrsets_add_rr(ldns_dnssec_rrsets *rrsets, ldns_rr *rr); + +/** + * Print the given list of rrsets to the fiven file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] rrsets the list of RRsets to print + * \param[in] follow if set to false, only print the first RRset + */ +void ldns_dnssec_rrsets_print(FILE *out, + ldns_dnssec_rrsets *rrsets, + bool follow); + +/** + * Create a new data structure for a dnssec name + * \return the allocated structure + */ +ldns_dnssec_name *ldns_dnssec_name_new(); + +/** + * Create a new data structure for a dnssec name for the given RR + * + * \param[in] rr the RR to derive properties from, and to add to the name + */ +ldns_dnssec_name *ldns_dnssec_name_new_frm_rr(ldns_rr *rr); + +/** + * Frees the name structure and its rrs and rrsets. + * Individual ldns_rr records therein are not freed + * + * \param[in] name the structure to free + */ +void ldns_dnssec_name_free(ldns_dnssec_name *name); + +/** + * Frees the name structure and its rrs and rrsets. + * Individual ldns_rr records contained in the name are also freed + * + * \param[in] name the structure to free + */ +void ldns_dnssec_name_deep_free(ldns_dnssec_name *name); + +/** + * Returns the domain name of the given dnssec_name structure + * + * \param[in] name the dnssec name to get the domain name from + * \return the domain name + */ +ldns_rdf *ldns_dnssec_name_name(ldns_dnssec_name *name); + + +/** + * Sets the domain name of the given dnssec_name structure + * + * \param[in] name the dnssec name to set the domain name of + * \param[in] dname the domain name to set it to. This data is *not* copied. + */ +void ldns_dnssec_name_set_name(ldns_dnssec_name *name, + ldns_rdf *dname); + +/** + * Sets the NSEC(3) RR of the given dnssec_name structure + * + * \param[in] name the dnssec name to set the domain name of + * \param[in] nsec the nsec rr to set it to. This data is *not* copied. + */ +void ldns_dnssec_name_set_nsec(ldns_dnssec_name *name, ldns_rr *nsec); + +/** + * Compares the domain names of the two arguments in their + * canonical ordening. + * + * \param[in] a The first dnssec_name to compare + * \param[in] b The second dnssec_name to compare + * \return -1 if the domain name of a comes before that of b in canonical + * ordening, 1 if it is the other way around, and 0 if they are + * equal + */ +int ldns_dnssec_name_cmp(const void *a, const void *b); + +/** + * Inserts the given rr at the right place in the current dnssec_name + * No checking is done whether the name matches + * + * \param[in] name The ldns_dnssec_name to add the RR to + * \param[in] rr The RR to add + * \return LDNS_STATUS_OK on success, error code otherwise + */ +ldns_status ldns_dnssec_name_add_rr(ldns_dnssec_name *name, + ldns_rr *rr); + +/** + * Find the RRset with the given type in within this name structure + * + * \param[in] name the name to find the RRset in + * \param[in] type the type of the RRset to find + * \return the RRset, or NULL if not present + */ +ldns_dnssec_rrsets *ldns_dnssec_name_find_rrset(ldns_dnssec_name *name, + ldns_rr_type type); + +/** + * Find the RRset with the given name and type in the zone + * + * \param[in] zone the zone structure to find the RRset in + * \param[in] dname the domain name of the RRset to find + * \param[in] type the type of the RRset to find + * \return the RRset, or NULL if not present + */ +ldns_dnssec_rrsets *ldns_dnssec_zone_find_rrset(ldns_dnssec_zone *zone, + ldns_rdf *dname, + ldns_rr_type type); + +/** + * Prints the RRs in the dnssec name structure to the given + * file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] name the name structure to print the contents of + */ +void ldns_dnssec_name_print(FILE *out, ldns_dnssec_name *name); + +/** + * Creates a new dnssec_zone structure + * \return the allocated structure + */ +ldns_dnssec_zone *ldns_dnssec_zone_new(); + +/** + * Frees the given zone structure, and its rbtree of dnssec_names + * Individual ldns_rr RRs within those names are *not* freed + * \param[in] *zone the zone to free + */ +void ldns_dnssec_zone_free(ldns_dnssec_zone *zone); + +/** + * Frees the given zone structure, and its rbtree of dnssec_names + * Individual ldns_rr RRs within those names are also freed + * \param[in] *zone the zone to free + */ +void ldns_dnssec_zone_deep_free(ldns_dnssec_zone *zone); + +/** + * Adds the given RR to the zone. + * It find whether there is a dnssec_name with that name present. + * If so, add it to that, if not create a new one. + * Special handling of NSEC and RRSIG provided + * + * \param[in] zone the zone to add the RR to + * \param[in] rr The RR to add + * \return LDNS_STATUS_OK on success, an error code otherwise + */ +ldns_status ldns_dnssec_zone_add_rr(ldns_dnssec_zone *zone, + ldns_rr *rr); + +/** + * Prints the rbtree of ldns_dnssec_name structures to the file descriptor + * + * \param[in] out the file descriptor to print the names to + * \param[in] tree the tree of ldns_dnssec_name structures to print + * \param[in] print_soa if true, print SOA records, if false, skip them + */ +void ldns_dnssec_zone_names_print(FILE *out, ldns_rbtree_t *tree, bool print_soa); + +/** + * Prints the complete zone to the given file descriptor + * + * \param[in] out the file descriptor to print to + * \param[in] zone the dnssec_zone to print + */ +void ldns_dnssec_zone_print(FILE *out, ldns_dnssec_zone *zone); + +/** + * Adds explicit dnssec_name structures for the empty nonterminals + * in this zone. (this is needed for NSEC3 generation) + * + * \param[in] zone the zone to check for empty nonterminals + * return LDNS_STATUS_OK on success. + */ +ldns_status ldns_dnssec_zone_add_empty_nonterminals(ldns_dnssec_zone *zone); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libs/ldns/ldns/error.h b/libs/ldns/ldns/error.h new file mode 100644 index 0000000000..e17846f38b --- /dev/null +++ b/libs/ldns/ldns/error.h @@ -0,0 +1,119 @@ +/** + * \file error.h + * + * Defines error numbers and functions to translate those to a readable string. + * + */ + +/** + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_ERROR_H +#define LDNS_ERROR_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum ldns_enum_status { + LDNS_STATUS_OK, + LDNS_STATUS_EMPTY_LABEL, + LDNS_STATUS_LABEL_OVERFLOW, + LDNS_STATUS_DOMAINNAME_OVERFLOW, + LDNS_STATUS_DOMAINNAME_UNDERFLOW, + LDNS_STATUS_DDD_OVERFLOW, + LDNS_STATUS_PACKET_OVERFLOW, + LDNS_STATUS_INVALID_POINTER, + LDNS_STATUS_MEM_ERR, + LDNS_STATUS_INTERNAL_ERR, + LDNS_STATUS_SSL_ERR, + LDNS_STATUS_ERR, + LDNS_STATUS_INVALID_INT, + LDNS_STATUS_INVALID_IP4, + LDNS_STATUS_INVALID_IP6, + LDNS_STATUS_INVALID_STR, + LDNS_STATUS_INVALID_B32_EXT, + LDNS_STATUS_INVALID_B64, + LDNS_STATUS_INVALID_HEX, + LDNS_STATUS_INVALID_TIME, + LDNS_STATUS_NETWORK_ERR, + LDNS_STATUS_ADDRESS_ERR, + LDNS_STATUS_FILE_ERR, + LDNS_STATUS_UNKNOWN_INET, + LDNS_STATUS_NOT_IMPL, + LDNS_STATUS_NULL, + LDNS_STATUS_CRYPTO_UNKNOWN_ALGO, + LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL, + LDNS_STATUS_CRYPTO_NO_RRSIG, + LDNS_STATUS_CRYPTO_NO_DNSKEY, + LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY, + LDNS_STATUS_CRYPTO_NO_DS, + LDNS_STATUS_CRYPTO_NO_TRUSTED_DS, + LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY, + LDNS_STATUS_CRYPTO_VALIDATED, + LDNS_STATUS_CRYPTO_BOGUS, + LDNS_STATUS_CRYPTO_SIG_EXPIRED, + LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED, + LDNS_STATUS_CRYPTO_TSIG_BOGUS, + LDNS_STATUS_CRYPTO_TSIG_ERR, + LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION, + LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR, + LDNS_STATUS_ENGINE_KEY_NOT_LOADED, + LDNS_STATUS_NSEC3_ERR, + LDNS_STATUS_RES_NO_NS, + LDNS_STATUS_RES_QUERY, + LDNS_STATUS_WIRE_INCOMPLETE_HEADER, + LDNS_STATUS_WIRE_INCOMPLETE_QUESTION, + LDNS_STATUS_WIRE_INCOMPLETE_ANSWER, + LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY, + LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL, + LDNS_STATUS_NO_DATA, + LDNS_STATUS_CERT_BAD_ALGORITHM, + LDNS_STATUS_SYNTAX_TYPE_ERR, + LDNS_STATUS_SYNTAX_CLASS_ERR, + LDNS_STATUS_SYNTAX_TTL_ERR, + LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL, + LDNS_STATUS_SYNTAX_RDATA_ERR, + LDNS_STATUS_SYNTAX_DNAME_ERR, + LDNS_STATUS_SYNTAX_VERSION_ERR, + LDNS_STATUS_SYNTAX_ALG_ERR, + LDNS_STATUS_SYNTAX_KEYWORD_ERR, + LDNS_STATUS_SYNTAX_TTL, + LDNS_STATUS_SYNTAX_ORIGIN, + LDNS_STATUS_SYNTAX_INCLUDE, + LDNS_STATUS_SYNTAX_EMPTY, + LDNS_STATUS_SYNTAX_ITERATIONS_OVERFLOW, + LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR, + LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW, + LDNS_STATUS_SYNTAX_BAD_ESCAPE, + LDNS_STATUS_SOCKET_ERROR, + LDNS_STATUS_SYNTAX_ERR, + LDNS_STATUS_DNSSEC_EXISTENCE_DENIED, + LDNS_STATUS_DNSSEC_NSEC_RR_NOT_COVERED, + LDNS_STATUS_DNSSEC_NSEC_WILDCARD_NOT_COVERED, + LDNS_STATUS_DNSSEC_NSEC3_ORIGINAL_NOT_FOUND +}; +typedef enum ldns_enum_status ldns_status; + +extern ldns_lookup_table ldns_error_str[]; + +/** + * look up a descriptive text by each error. This function + * could use a better name + * \param[in] err ldns_status number + * \return the string for that error + */ +const char *ldns_get_errorstr_by_id(ldns_status err); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_ERROR_H */ diff --git a/libs/ldns/ldns/higher.h b/libs/ldns/ldns/higher.h new file mode 100644 index 0000000000..597e1343a9 --- /dev/null +++ b/libs/ldns/ldns/higher.h @@ -0,0 +1,113 @@ +/** + * \file higher.h + * + * Specifies some higher level functions that could + * be useful for certain applications + */ + +/* + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_HIGHER_H +#define LDNS_HIGHER_H + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Ask the resolver about name + * and return all address records + * \param[in] r the resolver to use + * \param[in] name the name to look for + * \param[in] c the class to use + * \param[in] flags give some optional flags to the query + */ +ldns_rr_list *ldns_get_rr_list_addr_by_name(ldns_resolver *r, ldns_rdf *name, ldns_rr_class c, uint16_t flags); + +/** + * ask the resolver about the address + * and return the name + * \param[in] r the resolver to use + * \param[in] addr the addr to look for + * \param[in] c the class to use + * \param[in] flags give some optional flags to the query + */ +ldns_rr_list *ldns_get_rr_list_name_by_addr(ldns_resolver *r, ldns_rdf *addr, ldns_rr_class c, uint16_t flags); + +/** + * wade through fp (a /etc/hosts like file) + * and return a rr_list containing all the + * defined hosts in there + * \param[in] fp the file pointer to use + * \return ldns_rr_list * with the names + */ +ldns_rr_list *ldns_get_rr_list_hosts_frm_fp(FILE *fp); + +/** + * wade through fp (a /etc/hosts like file) + * and return a rr_list containing all the + * defined hosts in there + * \param[in] fp the file pointer to use + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return ldns_rr_list * with the names + */ +ldns_rr_list *ldns_get_rr_list_hosts_frm_fp_l(FILE *fp, int *line_nr); + +/** + * wade through fp (a /etc/hosts like file) + * and return a rr_list containing all the + * defined hosts in there + * \param[in] filename the filename to use (NULL for /etc/hosts) + * \return ldns_rr_list * with the names + */ +ldns_rr_list *ldns_get_rr_list_hosts_frm_file(char *filename); + +/** + * This function is a wrapper function for ldns_get_rr_list_name_by_addr + * and ldns_get_rr_list_addr_by_name. It's name is from the getaddrinfo() + * library call. It tries to mimic that call, but without the lowlevel + * stuff. + * \param[in] res The resolver. If this value is NULL then a resolver will + * be created by ldns_getaddrinfo. + * \param[in] node the name or ip address to look up + * \param[in] c the class to look in + * \param[out] list put the found RR's in this list + * \return the number of RR found. + */ +uint16_t ldns_getaddrinfo(ldns_resolver *res, ldns_rdf *node, ldns_rr_class c, ldns_rr_list **list); + +/** + * Check if t is enumerated in the nsec type rdata + * \param[in] nsec the NSEC Record to look in + * \param[in] t the type to check for + * \return true when t is found, otherwise return false + */ +bool ldns_nsec_type_check(ldns_rr *nsec, ldns_rr_type t); + +/** + * Print a number of rdf's of the RR. The rdfnum-list must + * be ended by -1, otherwise unpredictable things might happen. + * rdfs may be printed multiple times + * \param[in] fp FILE * to write to + * \param[in] r RR to write + * \param[in] rdfnum a list of rdf to print. + */ +void ldns_print_rr_rdf(FILE *fp, ldns_rr *r, int rdfnum, ...); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_HIGHER_H */ diff --git a/libs/ldns/ldns/host2str.h b/libs/ldns/ldns/host2str.h new file mode 100644 index 0000000000..07180bbd28 --- /dev/null +++ b/libs/ldns/ldns/host2str.h @@ -0,0 +1,566 @@ +/** + * host2str.h - txt presentation of RRs + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains functions to translate the main structures to their text + * representation, as well as functions to print them. + */ + +#ifndef LDNS_HOST2STR_H +#define LDNS_HOST2STR_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ldns/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_APL_IP4 1 +#define LDNS_APL_IP6 2 +#define LDNS_APL_MASK 0x7f +#define LDNS_APL_NEGATION 0x80 + +/** + * Converts an ldns packet opcode value to its mnemonic, and adds that + * to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] opcode to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_pkt_opcode2buffer_str(ldns_buffer *output, ldns_pkt_opcode opcode); + +/** + * Converts an ldns packet rcode value to its mnemonic, and adds that + * to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] rcode to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_pkt_rcode2buffer_str(ldns_buffer *output, ldns_pkt_rcode rcode); + +/** + * Converts an ldns algorithm type to its mnemonic, and adds that + * to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] algorithm to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_algorithm2buffer_str(ldns_buffer *output, + ldns_algorithm algorithm); + +/** + * Converts an ldns certificate algorithm type to its mnemonic, + * and adds that to the output buffer + * \param[in] *output the buffer to add the data to + * \param[in] cert_algorithm to find the string representation of + * \return LDNS_STATUS_OK on success, or a buffer failure mode on error + */ +ldns_status +ldns_cert_algorithm2buffer_str(ldns_buffer *output, + ldns_cert_algorithm cert_algorithm); + + +/** + * Converts a packet opcode to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] opcode the opcode to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_opcode2str(ldns_pkt_opcode opcode); + +/** + * Converts a packet rcode to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] rcode the rcode to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_rcode2str(ldns_pkt_rcode rcode); + +/** + * Converts a signing algorithms to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] algorithm the algorithm to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_algorithm2str(ldns_algorithm algorithm); + +/** + * Converts a cert algorithm to its mnemonic and returns that as + * an allocated null-terminated string. + * Remember to free it. + * + * \param[in] cert_algorithm to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt_cert_algorithm2str(ldns_cert_algorithm cert_algorithm); + +/** + * Converts an LDNS_RDF_TYPE_A rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_a(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_AAAA rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_aaaa(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_STR rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_str(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_B64 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_b64(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_B32_EXT rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_b32_ext(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_HEX rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_hex(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TYPE rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_type(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_CLASS rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_class(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_ALG rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_alg(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an ldns_rr_type value to its string representation, + * and places it in the given buffer + * \param[in] *output The buffer to add the data to + * \param[in] type the ldns_rr_type to convert + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rr_type2buffer_str(ldns_buffer *output, + const ldns_rr_type type); + +/** + * Converts an ldns_rr_type value to its string representation, + * and returns that string. For unknown types, the string + * "TYPE" is returned. This function allocates data that must be + * freed by the caller + * \param[in] type the ldns_rr_type to convert + * \return a newly allocated string + */ +char *ldns_rr_type2str(const ldns_rr_type type); + +/** + * Converts an ldns_rr_class value to its string representation, + * and places it in the given buffer + * \param[in] *output The buffer to add the data to + * \param[in] klass the ldns_rr_class to convert + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rr_class2buffer_str(ldns_buffer *output, + const ldns_rr_class klass); + +/** + * Converts an ldns_rr_class value to its string representation, + * and returns that string. For unknown types, the string + * "CLASS" is returned. This function allocates data that must be + * freed by the caller + * \param[in] klass the ldns_rr_class to convert + * \return a newly allocated string + */ +char *ldns_rr_class2str(const ldns_rr_class klass); + + +/** + * Converts an LDNS_RDF_TYPE_CERT rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_cert_alg(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_LOC rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_loc(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_UNKNOWN rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_unknown(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_NSAP rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_nsap(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_ATMA rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_atma(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_WKS rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_wks(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_NSEC rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_nsec(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_PERIOD rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_period(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TSIGTIME rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_tsigtime(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_APL rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_apl(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_INT16_DATA rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int16_data(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_IPSECKEY rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_ipseckey(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TSIG rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_tsig(ldns_buffer *output, const ldns_rdf *rdf); + + +/** + * Converts the data in the rdata field to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] rdf the pointer to the rdafa field containing the data + * \return status + */ +ldns_status ldns_rdf2buffer_str(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts the data in the resource record to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] rr the pointer to the rr field to convert + * \return status + */ +ldns_status ldns_rr2buffer_str(ldns_buffer *output, const ldns_rr *rr); + +/** + * Converts the data in the DNS packet to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] pkt the pointer to the packet to convert + * \return status + */ +ldns_status ldns_pkt2buffer_str(ldns_buffer *output, const ldns_pkt *pkt); + +/** + * Converts an LDNS_RDF_TYPE_NSEC3_SALT rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_nsec3_salt(ldns_buffer *output, const ldns_rdf *rdf); + + +/** + * Converts the data in the DNS packet to presentation + * format (as char *) and appends it to the given buffer + * + * \param[in] output pointer to the buffer to append the data to + * \param[in] k the pointer to the private key to convert + * \return status + */ +ldns_status ldns_key2buffer_str(ldns_buffer *output, const ldns_key *k); + +/** + * Converts an LDNS_RDF_TYPE_INT8 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int8(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_INT16 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int16(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_INT32 rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_int32(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts an LDNS_RDF_TYPE_TIME rdata element to string format and adds it to the output buffer + * \param[in] *rdf The rdata to convert + * \param[in] *output The buffer to add the data to + * \return LDNS_STATUS_OK on success, and error status on failure + */ +ldns_status ldns_rdf2buffer_str_time(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Converts the data in the rdata field to presentation format and + * returns that as a char *. + * Remember to free it. + * + * \param[in] rdf The rdata field to convert + * \return null terminated char * data, or NULL on error + */ +char *ldns_rdf2str(const ldns_rdf *rdf); + +/** + * Converts the data in the resource record to presentation format and + * returns that as a char *. + * Remember to free it. + * + * \param[in] rr The rdata field to convert + * \return null terminated char * data, or NULL on error + */ +char *ldns_rr2str(const ldns_rr *rr); + +/** + * Converts the data in the DNS packet to presentation format and + * returns that as a char *. + * Remember to free it. + * + * \param[in] pkt The rdata field to convert + * \return null terminated char * data, or NULL on error + */ +char *ldns_pkt2str(const ldns_pkt *pkt); + +/** + * Converts a private key to the test presentation fmt and + * returns that as a char *. + * Remember to free it. + * + * \param[in] k the key to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_key2str(const ldns_key *k); + +/** + * Converts a list of resource records to presentation format + * and returns that as a char *. + * Remember to free it. + * + * \param[in] rr_list the rr_list to convert to text + * \return null terminated char * data, or NULL on error + */ +char *ldns_rr_list2str(const ldns_rr_list *rr_list); + +/** + * Returns the data in the buffer as a null terminated char * string + * Buffer data must be char * type, and must be freed by the caller + * + * \param[in] buffer buffer containing char * data + * \return null terminated char * data, or NULL on error + */ +char *ldns_buffer2str(ldns_buffer *buffer); + +/** + * Prints the data in the rdata field to the given file stream + * (in presentation format) + * + * \param[in] output the file stream to print to + * \param[in] rdf the rdata field to print + * \return void + */ +void ldns_rdf_print(FILE *output, const ldns_rdf *rdf); + +/** + * Prints the data in the resource record to the given file stream + * (in presentation format) + * + * \param[in] output the file stream to print to + * \param[in] rr the resource record to print + * \return void + */ +void ldns_rr_print(FILE *output, const ldns_rr *rr); + +/** + * Prints the data in the DNS packet to the given file stream + * (in presentation format) + * + * \param[in] output the file stream to print to + * \param[in] pkt the packet to print + * \return void + */ +void ldns_pkt_print(FILE *output, const ldns_pkt *pkt); + +/** + * Converts a rr_list to presentation format and appends it to + * the output buffer + * \param[in] output the buffer to append output to + * \param[in] list the ldns_rr_list to print + * \return ldns_status + */ +ldns_status ldns_rr_list2buffer_str(ldns_buffer *output, const ldns_rr_list *list); + +/** + * Converts the header of a packet to presentation format and appends it to + * the output buffer + * \param[in] output the buffer to append output to + * \param[in] pkt the packet to convert the header of + * \return ldns_status + */ +ldns_status ldns_pktheader2buffer_str(ldns_buffer *output, const ldns_pkt *pkt); + +/** + * print a rr_list to output + * param[in] output the fd to print to + * param[in] list the rr_list to print + */ +void ldns_rr_list_print(FILE *output, const ldns_rr_list *list); + +/** + * Print a resolver (in sofar that is possible) state + * to output. + * \param[in] output the fd to print to + * \param[in] r the resolver to print + */ +void ldns_resolver_print(FILE *output, const ldns_resolver *r); + +/** + * Print a zone structure * to output. Note the SOA record + * is included in this output + * \param[in] output the fd to print to + * \param[in] z the zone to print + */ +void ldns_zone_print(FILE *output, const ldns_zone *z); + +/** + * Print the ldns_rdf containing a dname to the buffer + * \param[in] output the buffer to print to + * \param[in] dname the dname to print + * \return ldns_status message if the printing succeeded + */ +ldns_status ldns_rdf2buffer_str_dname(ldns_buffer *output, const ldns_rdf *dname); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_HOST2STR_H */ diff --git a/libs/ldns/ldns/host2wire.h b/libs/ldns/ldns/host2wire.h new file mode 100644 index 0000000000..5eafe9ddc4 --- /dev/null +++ b/libs/ldns/ldns/host2wire.h @@ -0,0 +1,164 @@ +/* + * host2wire.h - 2wire conversion routines + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains all functions to translate the main structures to wire format + */ + +#ifndef LDNS_HOST2WIRE_H +#define LDNS_HOST2WIRE_H + +#include +#include +#include +#include +#include +#include +#include + +#include "ldns/util.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Copies the dname data to the buffer in wire format + * \param[out] *buffer buffer to append the result to + * \param[in] *name rdata dname to convert + * \return ldns_status + */ +ldns_status ldns_dname2buffer_wire(ldns_buffer *buffer, const ldns_rdf *name); + +/** + * Copies the rdata data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *rdf rdata to convert + * \return ldns_status + */ +ldns_status ldns_rdf2buffer_wire(ldns_buffer *output, const ldns_rdf *rdf); + +/** + * Copies the rdata data to the buffer in wire format + * If the rdata is a dname, the letters will be lowercased + * during the conversion + * \param[out] *output buffer to append the result to + * \param[in] *rdf rdata to convert + * \return ldns_status + */ +ldns_status ldns_rdf2buffer_wire_canonical(ldns_buffer *output, + const ldns_rdf *rdf); + +/** + * Copies the rr data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *rr resource record to convert + * \param[in] section the section in the packet this rr is supposed to be in + * (to determine whether to add rdata or not) + * \return ldns_status + */ +ldns_status ldns_rr2buffer_wire(ldns_buffer *output, + const ldns_rr *rr, + int section); + +/** + * Copies the rr data to the buffer in wire format, in canonical format + * according to RFC3597 (every dname in rdata fields of RR's mentioned in + * that RFC will be lowercased) + * \param[out] *output buffer to append the result to + * \param[in] *rr resource record to convert + * \param[in] section the section in the packet this rr is supposed to be in + * (to determine whether to add rdata or not) + * \return ldns_status + */ +ldns_status ldns_rr2buffer_wire_canonical(ldns_buffer *output, + const ldns_rr *rr, + int section); + + +/** + * Converts a rrsig to wireformat BUT EXCLUDE the rrsig rdata + * This is needed in DNSSEC verification + * \param[out] output buffer to append the result to + * \param[in] sigrr signature rr to operate on + * \return ldns_status + */ +ldns_status ldns_rrsig2buffer_wire(ldns_buffer *output, const ldns_rr *sigrr); + +/** + * Converts an rr's rdata to wireformat, while excluding + * the ownername and all the stuff before the rdata. + * This is needed in DNSSEC keytag calculation, the ds + * calcalution from the key and maybe elsewhere. + * + * \param[out] *output buffer where to put the result + * \param[in] *rr rr to operate on + * \return ldns_status + */ +ldns_status ldns_rr_rdata2buffer_wire(ldns_buffer *output, const ldns_rr *rr); + +/** + * Copies the packet data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *pkt packet to convert + * \return ldns_status + */ +ldns_status ldns_pkt2buffer_wire(ldns_buffer *output, const ldns_pkt *pkt); + +/** + * Copies the rr_list data to the buffer in wire format + * \param[out] *output buffer to append the result to + * \param[in] *rrlist rr_list to to convert + * \return ldns_status + */ +ldns_status ldns_rr_list2buffer_wire(ldns_buffer *output, const ldns_rr_list *rrlist); + +/** + * Allocates an array of uint8_t at dest, and puts the wireformat of the + * given rdf in that array. The result_size value contains the + * length of the array, if it succeeds, and 0 otherwise (in which case + * the function also returns NULL) + * + * \param[out] dest pointer to the array of bytes to be created + * \param[in] rdf the rdata field to convert + * \param[out] size the size of the converted result + */ +ldns_status ldns_rdf2wire(uint8_t **dest, const ldns_rdf *rdf, size_t *size); + +/** + * Allocates an array of uint8_t at dest, and puts the wireformat of the + * given rr in that array. The result_size value contains the + * length of the array, if it succeeds, and 0 otherwise (in which case + * the function also returns NULL) + * + * If the section argument is LDNS_SECTION_QUESTION, data like ttl and rdata + * are not put into the result + * + * \param[out] dest pointer to the array of bytes to be created + * \param[in] rr the rr to convert + * \param[out] size the size of the converted result + */ +ldns_status ldns_rr2wire(uint8_t **dest, const ldns_rr *rr, int, size_t *size); + +/** + * Allocates an array of uint8_t at dest, and puts the wireformat of the + * given packet in that array. The result_size value contains the + * length of the array, if it succeeds, and 0 otherwise (in which case + * the function also returns NULL) + */ +ldns_status ldns_pkt2wire(uint8_t **dest, const ldns_pkt *p, size_t *size); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_HOST2WIRE_H */ diff --git a/libs/ldns/ldns/keys.h b/libs/ldns/ldns/keys.h new file mode 100644 index 0000000000..e0f568d8f8 --- /dev/null +++ b/libs/ldns/ldns/keys.h @@ -0,0 +1,614 @@ +/* + * + * keys.h + * + * priv key definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Addendum to \ref dnssec.h, this module contains key and algorithm definitions and functions. + */ + + +#ifndef LDNS_KEYS_H +#define LDNS_KEYS_H + +#ifdef HAVE_SSL +#include +#endif /* HAVE_SSL */ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +extern ldns_lookup_table ldns_signing_algorithms[]; + +#define LDNS_KEY_ZONE_KEY 0x0100 /* rfc 4034 */ +#define LDNS_KEY_SEP_KEY 0x0001 /* rfc 4034 */ +#define LDNS_KEY_REVOKE_KEY 0x0080 /* rfc 5011 */ + +/** + * Algorithms used in dns + */ +enum ldns_enum_algorithm +{ + LDNS_RSAMD5 = 1, /* RFC 4034,4035 */ + LDNS_DH = 2, + LDNS_DSA = 3, + LDNS_ECC = 4, + LDNS_RSASHA1 = 5, + LDNS_DSA_NSEC3 = 6, + LDNS_RSASHA1_NSEC3 = 7, + LDNS_RSASHA256 = 8, /* RFC 5702 */ + LDNS_RSASHA512 = 10, /* RFC 5702 */ + LDNS_ECC_GOST = 12, /* RFC 5933 */ +#ifdef USE_ECDSA + /* this ifdef has to be removed once it is no longer experimental, + * to be able to use these values outside of the ldns library itself */ + LDNS_ECDSAP256SHA256 = 13, /* draft-hoffman-dnssec-ecdsa */ + LDNS_ECDSAP384SHA384 = 14, /* EXPERIMENTAL */ +#endif + LDNS_INDIRECT = 252, + LDNS_PRIVATEDNS = 253, + LDNS_PRIVATEOID = 254 +}; +typedef enum ldns_enum_algorithm ldns_algorithm; + +/** + * Hashing algorithms used in the DS record + */ +enum ldns_enum_hash +{ + LDNS_SHA1 = 1, /* RFC 4034 */ + LDNS_SHA256 = 2, /* RFC 4509 */ + LDNS_HASH_GOST = 3 /* RFC 5933 */ +#ifdef USE_ECDSA + /* this ifdef has to be removed once it is no longer experimental, + * to be able to use these values outside of the ldns library itself */ + ,LDNS_SHA384 = 4 /* draft-hoffman-dnssec-ecdsa EXPERIMENTAL */ +#endif +}; +typedef enum ldns_enum_hash ldns_hash; + +/** + * Algorithms used in dns for signing + */ +enum ldns_enum_signing_algorithm +{ + LDNS_SIGN_RSAMD5 = LDNS_RSAMD5, + LDNS_SIGN_RSASHA1 = LDNS_RSASHA1, + LDNS_SIGN_DSA = LDNS_DSA, + LDNS_SIGN_RSASHA1_NSEC3 = LDNS_RSASHA1_NSEC3, + LDNS_SIGN_RSASHA256 = LDNS_RSASHA256, + LDNS_SIGN_RSASHA512 = LDNS_RSASHA512, + LDNS_SIGN_DSA_NSEC3 = LDNS_DSA_NSEC3, + LDNS_SIGN_ECC_GOST = LDNS_ECC_GOST, +#ifdef USE_ECDSA + /* this ifdef has to be removed once it is no longer experimental, + * to be able to use these values outside of the ldns library itself */ + LDNS_SIGN_ECDSAP256SHA256 = LDNS_ECDSAP256SHA256, + LDNS_SIGN_ECDSAP384SHA384 = LDNS_ECDSAP384SHA384, +#endif + LDNS_SIGN_HMACMD5 = 157, /* not official! This type is for TSIG, not DNSSEC */ + LDNS_SIGN_HMACSHA1 = 158, /* not official! This type is for TSIG, not DNSSEC */ + LDNS_SIGN_HMACSHA256 = 159 /* ditto */ +}; +typedef enum ldns_enum_signing_algorithm ldns_signing_algorithm; + +/** + * General key structure, can contain all types of keys that + * are used in DNSSEC. Mostly used to store private keys, since + * public keys can also be stored in a \ref ldns_rr with type + * \ref LDNS_RR_TYPE_DNSKEY. + * + * This structure can also store some variables that influence the + * signatures generated by signing with this key, for instance the + * inception date. + */ +struct ldns_struct_key { + ldns_signing_algorithm _alg; + /** Whether to use this key when signing */ + bool _use; + /** Storage pointers for the types of keys supported */ + /* TODO remove unions? */ + struct { +#ifdef HAVE_SSL +#ifndef S_SPLINT_S + /* The key can be an OpenSSL EVP Key + */ + EVP_PKEY *key; +#endif +#endif /* HAVE_SSL */ + /** + * The key can be an HMAC key + */ + struct { + unsigned char *key; + size_t size; + } hmac; + /** the key structure can also just point to some external + * key data + */ + void *external_key; + } _key; + /** Depending on the key we can have extra data */ + union { + /** Some values that influence generated signatures */ + struct { + /** The TTL of the rrset that is currently signed */ + uint32_t orig_ttl; + /** The inception date of signatures made with this key. */ + uint32_t inception; + /** The expiration date of signatures made with this key. */ + uint32_t expiration; + /** The keytag of this key. */ + uint16_t keytag; + /** The dnssec key flags as specified in RFC4035, like ZSK and KSK */ + uint16_t flags; + } dnssec; + } _extra; + /** Owner name of the key */ + ldns_rdf *_pubkey_owner; +}; +typedef struct ldns_struct_key ldns_key; + +/** + * Same as rr_list, but now for keys + */ +struct ldns_struct_key_list +{ + size_t _key_count; + ldns_key **_keys; +}; +typedef struct ldns_struct_key_list ldns_key_list; + + +/** + * Creates a new empty key list + * \return a new ldns_key_list structure pointer + */ +ldns_key_list *ldns_key_list_new(); + +/** + * Creates a new empty key structure + * \return a new ldns_key * structure + */ +ldns_key *ldns_key_new(); + +/** + * Creates a new key based on the algorithm + * + * \param[in] a The algorithm to use + * \param[in] size the number of bytes for the keysize + * \return a new ldns_key structure with the key + */ +ldns_key *ldns_key_new_frm_algorithm(ldns_signing_algorithm a, uint16_t size); + +/** + * Creates a new priv key based on the + * contents of the file pointed by fp. + * + * The file should be in Private-key-format v1.2. + * + * \param[out] k the new ldns_key structure + * \param[in] fp the file pointer to use + * \return an error or LDNS_STATUS_OK + */ +ldns_status ldns_key_new_frm_fp(ldns_key **k, FILE *fp); + +/** + * Creates a new private key based on the + * contents of the file pointed by fp + * + * The file should be in Private-key-format v1.2. + * + * \param[out] k the new ldns_key structure + * \param[in] fp the file pointer to use + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return an error or LDNS_STATUS_OK + */ +ldns_status ldns_key_new_frm_fp_l(ldns_key **k, FILE *fp, int *line_nr); + +#ifdef HAVE_SSL +/** + * Read the key with the given id from the given engine and store it + * in the given ldns_key structure. The algorithm type is set + */ +ldns_status ldns_key_new_frm_engine(ldns_key **key, ENGINE *e, char *key_id, ldns_algorithm); + + +/** + * frm_fp helper function. This function parses the + * remainder of the (RSA) priv. key file generated from bind9 + * \param[in] fp the file to parse + * \return NULL on failure otherwise a RSA structure + */ +RSA *ldns_key_new_frm_fp_rsa(FILE *fp); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (RSA) priv. key file generated from bind9 + * \param[in] fp the file to parse + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return NULL on failure otherwise a RSA structure + */ +RSA *ldns_key_new_frm_fp_rsa_l(FILE *fp, int *line_nr); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (DSA) priv. key file + * \param[in] fp the file to parse + * \return NULL on failure otherwise a RSA structure + */ +DSA *ldns_key_new_frm_fp_dsa(FILE *fp); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (DSA) priv. key file + * \param[in] fp the file to parse + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return NULL on failure otherwise a RSA structure + */ +DSA *ldns_key_new_frm_fp_dsa_l(FILE *fp, int *line_nr); +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (HMAC-MD5) key file + * This function allocated a buffer that needs to be freed + * \param[in] fp the file to parse + * \param[out] hmac_size the number of bits in the resulting buffer + * \return NULL on failure otherwise a newly allocated char buffer + */ +unsigned char *ldns_key_new_frm_fp_hmac(FILE *fp, size_t *hmac_size); +#endif + +#ifdef HAVE_SSL +/** + * frm_fp helper function. This function parses the + * remainder of the (HMAC-MD5) key file + * This function allocated a buffer that needs to be freed + * \param[in] fp the file to parse + * \param[in] line_nr pointer to an integer containing the current line number (for error reporting purposes) + * \param[out] hmac_size the number of bits in the resulting buffer + * \return NULL on failure otherwise a newly allocated char buffer + */ +unsigned char *ldns_key_new_frm_fp_hmac_l(FILE *fp, int *line_nr, size_t *hmac_size); +#endif /* HAVE_SSL */ + +/* acces write functions */ +/** + * Set the key's algorithm + * \param[in] k the key + * \param[in] l the algorithm + */ +void ldns_key_set_algorithm(ldns_key *k, ldns_signing_algorithm l); +#ifdef HAVE_SSL +/** + * Set the key's evp key + * \param[in] k the key + * \param[in] e the evp key + */ +void ldns_key_set_evp_key(ldns_key *k, EVP_PKEY *e); + +/** + * Set the key's rsa data + * \param[in] k the key + * \param[in] r the rsa data + */ +void ldns_key_set_rsa_key(ldns_key *k, RSA *r); +/** + * Set the key's dsa data + * \param[in] k the key + * \param[in] d the dsa data + */ +void ldns_key_set_dsa_key(ldns_key *k, DSA *d); + +/** + * Get the PKEY id for GOST, loads GOST into openssl as a side effect. + * Only available if GOST is compiled into the library and openssl. + * \return the gost id for EVP_CTX creation. + */ +int ldns_key_EVP_load_gost_id(void); + +/** Release the engine reference held for the GOST engine. */ +void ldns_key_EVP_unload_gost(void); +#endif /* HAVE_SSL */ + +/** + * Set the key's hmac data + * \param[in] k the key + * \param[in] hmac the raw key data + */ +void ldns_key_set_hmac_key(ldns_key *k, unsigned char *hmac); + +/** + * Set the key id data. This is used if the key points to + * some externally stored key data + * + * Only the pointer is set, the data there is not copied, + * and must be freed manually; ldns_key_deep_free() does + * *not* free this data + * \param[in] key the key + * \param[in] external_key key id data + */ +void ldns_key_set_external_key(ldns_key *key, void *external_key); + +/** + * Set the key's hmac size + * \param[in] k the key + * \param[in] hmac_size the size of the hmac data + */ +void ldns_key_set_hmac_size(ldns_key *k, size_t hmac_size); +/** + * Set the key's original ttl + * \param[in] k the key + * \param[in] t the ttl + */ +void ldns_key_set_origttl(ldns_key *k, uint32_t t); +/** + * Set the key's inception date (seconds after epoch) + * \param[in] k the key + * \param[in] i the inception + */ +void ldns_key_set_inception(ldns_key *k, uint32_t i); +/** + * Set the key's expiration date (seconds after epoch) + * \param[in] k the key + * \param[in] e the expiration + */ +void ldns_key_set_expiration(ldns_key *k, uint32_t e); +/** + * Set the key's pubkey owner + * \param[in] k the key + * \param[in] r the owner + */ +void ldns_key_set_pubkey_owner(ldns_key *k, ldns_rdf *r); +/** + * Set the key's key tag + * \param[in] k the key + * \param[in] tag the keytag + */ +void ldns_key_set_keytag(ldns_key *k, uint16_t tag); +/** + * Set the key's flags + * \param[in] k the key + * \param[in] flags the flags + */ +void ldns_key_set_flags(ldns_key *k, uint16_t flags); +/** + * Set the keylist's key count to count + * \param[in] key the key + * \param[in] count the cuont + */ +void ldns_key_list_set_key_count(ldns_key_list *key, size_t count); + +/** + * pushes a key to a keylist + * \param[in] key_list the key_list to push to + * \param[in] key the key to push + * \return false on error, otherwise true + */ +bool ldns_key_list_push_key(ldns_key_list *key_list, ldns_key *key); + +/** + * returns the number of keys in the key list + * \param[in] key_list the key_list + * \return the numbers of keys in the list + */ +size_t ldns_key_list_key_count(const ldns_key_list *key_list); + +/** + * returns a pointer to the key in the list at the given position + * \param[in] key the key + * \param[in] nr the position in the list + * \return the key + */ +ldns_key *ldns_key_list_key(const ldns_key_list *key, size_t nr); + +#ifdef HAVE_SSL +/** + * returns the (openssl) RSA struct contained in the key + * \param[in] k the key to look in + * \return the RSA * structure in the key + */ +RSA *ldns_key_rsa_key(const ldns_key *k); +/** + * returns the (openssl) EVP struct contained in the key + * \param[in] k the key to look in + * \return the RSA * structure in the key + */ +EVP_PKEY *ldns_key_evp_key(const ldns_key *k); +#endif /* HAVE_SSL */ + +/** + * returns the (openssl) DSA struct contained in the key + */ +#ifdef HAVE_SSL +DSA *ldns_key_dsa_key(const ldns_key *k); +#endif /* HAVE_SSL */ + +/** + * return the signing alg of the key + * \param[in] k the key + * \return the algorithm + */ +ldns_signing_algorithm ldns_key_algorithm(const ldns_key *k); +/** + * set the use flag + * \param[in] k the key + * \param[in] v the boolean value to set the _use field to + */ +void ldns_key_set_use(ldns_key *k, bool v); +/** + * return the use flag + * \param[in] k the key + * \return the boolean value of the _use field + */ +bool ldns_key_use(const ldns_key *k); +/** + * return the hmac key data + * \param[in] k the key + * \return the hmac key data + */ +unsigned char *ldns_key_hmac_key(const ldns_key *k); +/** + * return the key id key data + * \param[in] k the key + * \return the key id data + */ +void *ldns_key_external_key(const ldns_key *k); +/** + * return the hmac key size + * \param[in] k the key + * \return the hmac key size + */ +size_t ldns_key_hmac_size(const ldns_key *k); +/** + * return the original ttl of the key + * \param[in] k the key + * \return the original ttl + */ +uint32_t ldns_key_origttl(const ldns_key *k); +/** + * return the key's inception date + * \param[in] k the key + * \return the inception date + */ +uint32_t ldns_key_inception(const ldns_key *k); +/** + * return the key's expiration date + * \param[in] k the key + * \return the experiration date + */ +uint32_t ldns_key_expiration(const ldns_key *k); +/** + * return the keytag + * \param[in] k the key + * \return the keytag + */ +uint16_t ldns_key_keytag(const ldns_key *k); +/** + * return the public key's owner + * \param[in] k the key + * \return the owner + */ +ldns_rdf *ldns_key_pubkey_owner(const ldns_key *k); +/** + * Set the 'use' flag for all keys in the list + * \param[in] keys The key_list + * \param[in] v The value to set the use flags to + */ +void +ldns_key_list_set_use(ldns_key_list *keys, bool v); + +/** + * return the flag of the key + * \param[in] k the key + * \return the flag + */ +uint16_t ldns_key_flags(const ldns_key *k); + +/** + * pops the last rr from a keylist + * \param[in] key_list the rr_list to pop from + * \return NULL if nothing to pop. Otherwise the popped RR + */ +ldns_key *ldns_key_list_pop_key(ldns_key_list *key_list); + +/** + * converts a ldns_key to a public key rr + * If the key data exists at an external point, the corresponding + * rdata field must still be added with ldns_rr_rdf_push() to the + * result rr of this function + * + * \param[in] k the ldns_key to convert + * \return ldns_rr representation of the key + */ +ldns_rr *ldns_key2rr(const ldns_key *k); + +/** + * print a private key to the file ouput + * + * \param[in] output the FILE descriptor where to print to + * \param[in] k the ldns_key to print + */ +void ldns_key_print(FILE *output, const ldns_key *k); + +/** + * frees a key structure, but not its internal data structures + * + * \param[in] key the key object to free + */ +void ldns_key_free(ldns_key *key); + +/** + * frees a key structure and all its internal data structures, except + * the data set by ldns_key_set_external_key() + * + * \param[in] key the key object to free + */ +void ldns_key_deep_free(ldns_key *key); + +/** + * Frees a key list structure + * \param[in] key_list the key list object to free + */ +void ldns_key_list_free(ldns_key_list *key_list); + +/** + * Instantiates a DNSKEY or DS RR from file. + * \param[in] filename the file to read the record from + * \return the corresponding RR, or NULL if the parsing failed + */ +ldns_rr * ldns_read_anchor_file(const char *filename); + +/** + * Returns the 'default base name' for key files; + * IE. K\+\+\ + * (without the .key or .private) + * The memory for this is allocated by this function, + * and should be freed by the caller + * + * \param[in] key the key to get the file name from + * \returns A string containing the file base name + */ +char *ldns_key_get_file_base_name(ldns_key *key); + +/** + * See if a key algorithm is supported + * \param[in] algo the signing algorithm number. + * \returns true if supported. + */ +int ldns_key_algo_supported(int algo); + +/** + * Get signing algorithm by name. Comparison is case insensitive. + * \param[in] name string with the name. + * \returns 0 on parse failure or the algorithm number. + */ +ldns_signing_algorithm ldns_get_signing_algorithm_by_name(const char* name); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_KEYS_H */ diff --git a/libs/ldns/ldns/ldns.h b/libs/ldns/ldns/ldns.h new file mode 100644 index 0000000000..6f57733750 --- /dev/null +++ b/libs/ldns/ldns/ldns.h @@ -0,0 +1,155 @@ +/* + * dns.h -- defines for the Domain Name System + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + * + * This library was created by: + * Jelte Jansen, Erik Rozendaal and Miek Gieben + * + * A bunch of defines that are used in the DNS. + */ + + +/** +\mainpage LDNS Documentation + +\section introduction Introduction + +The goal of ldns is to simplify DNS programming, it supports recent RFCs +like the DNSSEC documents, and allow developers to easily create software +conforming to current RFCs, and experimental software for current Internet +drafts. A secondary benefit of using ldns is speed, because ldns is written +in C, and although it is not optimized for performance, it should be a lot +faster than Perl. + +The first main tool to use ldns is Drill, from which part of the library was +derived. From version 1.0.0 on, drill is included in the ldns release +and will not be distributed seperately anymore. The library also includes some +other examples and tools to show how it can be used. These can be found in the +examples/ directory in the tarball. + +ldns depends on OpenSSL for it's cryptographic functions. +Feature list + + - Transparent IPv4 and IPv6 support (overridable if necessary), + - TSIG support, + - DNSSEC support; signing and verification, + - small size, + - online documentation as well as manual pages. + +If you want to send us patches please use the code from subversion (trunk). + +\section using_ldns Using ldns + +Almost all interaction between an application and ldns goes through the ldns +data structures (\ref ldns_rr, \ref ldns_pkt, etc.). These are input or +output to the functions of ldns. For example, \ref ldns_zone_new_frm_fp +reads a zone from a \c FILE pointer, and returns an \ref ldns_zone +structure. + + +Let's use Drill as an example. Drill is a tool much like dig, whose most +basic function is to send 1 query to a nameserver and print the response. + +To be able to do this, drill uses the resolver module of ldns, which acts as +a stub resolver. The resolver module uses the net module to actually send +the query that drill requested. It then uses the wire2host module to +translate the response and place it in ldns' internal structures. These are +passed back to drill, which then uses the host2str module to print the +response in presentation format. + +\section gettingstarted Getting Started + +See the \ref design page for a very high level description of the design +choices made for ldns. + +For an overview of the functions and types ldns provides, you can check out +the \ref ldns ldns header file descriptions. + +If you want to see some libdns action, you can read our tutorials: + - \ref tutorial1_mx + - \ref tutorial2_zone + - \ref tutorial3_signzone + +Or you can just use the menu above to browse through the API docs. + +
+\image html LogoInGradientBar2-y100.png +
+*/ + +/** + * \file ldns.h + * + * Including this file will include all ldns files, and define some lookup tables. + */ + +#ifndef LDNS_DNS_H +#define LDNS_DNS_H + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_IP4ADDRLEN (32/8) +#define LDNS_IP6ADDRLEN (128/8) +#define LDNS_PORT 53 +#define LDNS_ROOT_LABEL_STR "." +#define LDNS_DEFAULT_TTL 3600 + +/* lookup tables for standard DNS stuff */ + +/** Taken from RFC 2538, section 2.1. */ +extern ldns_lookup_table ldns_certificate_types[]; +/** Taken from RFC 2535, section 7. */ +extern ldns_lookup_table ldns_algorithms[]; +/** Taken from RFC 2538. */ +extern ldns_lookup_table ldns_cert_algorithms[]; +/** rr types */ +extern ldns_lookup_table ldns_rr_classes[]; +/** Response codes */ +extern ldns_lookup_table ldns_rcodes[]; +/** Operation codes */ +extern ldns_lookup_table ldns_opcodes[]; +/** EDNS flags */ +extern ldns_lookup_table ldns_edns_flags[]; + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_DNS_H */ diff --git a/libs/ldns/ldns/net.h.in b/libs/ldns/ldns/net.h.in new file mode 100644 index 0000000000..c3f5a069a6 --- /dev/null +++ b/libs/ldns/ldns/net.h.in @@ -0,0 +1,208 @@ +/* + * net.h + * + * DNS Resolver definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_NET_H +#define LDNS_NET_H + +#include +@include_sys_socket_h@ + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_DEFAULT_TIMEOUT_SEC 2 +#define LDNS_DEFAULT_TIMEOUT_USEC 0 + +/** + * \file + * + * Contains functions to send and receive packets over a network. + */ + +/** + * Sends a buffer to an ip using udp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \param[out] result packet with the answer + * \return status + */ +ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); + +/** + * Send an udp query and don't wait for an answer but return + * the socket + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout *unused*, was the timeout value for the network + * \return the socket used + */ + +int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Send an tcp query and don't wait for an answer but return + * the socket + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the connect attempt + * \return the socket used + */ +int ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Sends a buffer to an ip using tcp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \param[out] result packet with the answer + * \return status + */ +ldns_status ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); + +/** + * Sends ptk to the nameserver at the resolver object. Returns the data + * as a ldns_pkt + * + * \param[out] pkt packet received from the nameserver + * \param[in] r the resolver to use + * \param[in] query_pkt the query to send + * \return status + */ +ldns_status ldns_send(ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt); + +/** + * Sends and ldns_buffer (presumably containing a packet to the nameserver at the resolver object. Returns the data + * as a ldns_pkt + * + * \param[out] pkt packet received from the nameserver + * \param[in] r the resolver to use + * \param[in] qb the buffer to send + * \param[in] tsig_mac the tsig MAC to authenticate the response with (NULL to do no TSIG authentication) + * \return status + */ +ldns_status ldns_send_buffer(ldns_pkt **pkt, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac); + +/** + * Create a tcp socket to the specified address + * \param[in] to ip and family + * \param[in] tolen length of to + * \param[in] timeout timeout for the connect attempt + * \return a socket descriptor + */ +int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Create a udp socket to the specified address + * \param[in] to ip and family + * \param[in] timeout *unused*, was timeout for the socket + * \return a socket descriptor + */ +int ldns_udp_connect(const struct sockaddr_storage *to, struct timeval timeout); + +/** + * send a query via tcp to a server. Don't want for the answer + * + * \param[in] qbin the buffer to send + * \param[in] sockfd the socket to use + * \param[in] to which ip to send it + * \param[in] tolen socketlen + * \return number of bytes sent + */ +ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); + +/** + * send a query via udp to a server. Don;t want for the answer + * + * \param[in] qbin the buffer to send + * \param[in] sockfd the socket to use + * \param[in] to which ip to send it + * \param[in] tolen socketlen + * \return number of bytes sent + */ +ssize_t ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); + +/** + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[out] size the number of bytes that are read + * \param[in] timeout the time allowed between packets. + * \return the data read + */ +uint8_t *ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout); + +/** + * This routine may block. Use ldns_tcp_read_wire_timeout, it checks timeouts. + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[out] size the number of bytes that are read + * \return the data read + */ +uint8_t *ldns_tcp_read_wire(int sockfd, size_t *size); + +/** + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[in] fr the address of the client (if applicable) + * \param[in] *frlen the lenght of the client's addr (if applicable) + * \param[out] size the number of bytes that are read + * \return the data read + */ +uint8_t *ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *fr, socklen_t *frlen); + +/** + * returns the native sockaddr representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \param[in] port what port to use. 0 means; use default (53) + * \param[out] size what is the size of the sockaddr_storage + * \return struct sockaddr* the address in the format so other + * functions can use it (sendto) + */ +struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size); + +/** + * returns an rdf with the sockaddr info. works for ip4 and ip6 + * \param[in] sock the struct sockaddr_storage to convert + * \param[in] port what port was used. When NULL this is not set + * \return ldns_rdf* wth the address + */ +ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port); + +/** + * Prepares the resolver for an axfr query + * The query is sent and the answers can be read with ldns_axfr_next + * \param[in] resolver the resolver to use + * \param[in] domain the domain to exfr + * \param[in] c the class to use + * \return ldns_status the status of the transfer + */ +ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_NET_H */ diff --git a/libs/ldns/ldns/packet.h b/libs/ldns/ldns/packet.h new file mode 100644 index 0000000000..687a6a2595 --- /dev/null +++ b/libs/ldns/ldns/packet.h @@ -0,0 +1,855 @@ +/* + * packet.h + * + * DNS packet definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains the definition of ldns_pkt and its parts, as well + * as functions to manipulate those. + */ + + +#ifndef LDNS_PACKET_H +#define LDNS_PACKET_H + +#define LDNS_MAX_PACKETLEN 65535 + +/* allow flags to be given to mk_query */ +#define LDNS_QR 1 /* QueRy - query flag */ +#define LDNS_AA 2 /* Authoritative Answer - server flag */ +#define LDNS_TC 4 /* TrunCated - server flag */ +#define LDNS_RD 8 /* Recursion Desired - query flag */ +#define LDNS_CD 16 /* Checking Disabled - query flag */ +#define LDNS_RA 32 /* Recursion Available - server flag */ +#define LDNS_AD 64 /* Authenticated Data - server flag */ + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* opcodes for pkt's */ +enum ldns_enum_pkt_opcode { + LDNS_PACKET_QUERY = 0, + LDNS_PACKET_IQUERY = 1, + LDNS_PACKET_STATUS = 2, /* there is no 3?? DNS is weird */ + LDNS_PACKET_NOTIFY = 4, + LDNS_PACKET_UPDATE = 5 +}; +typedef enum ldns_enum_pkt_opcode ldns_pkt_opcode; + +/* rcodes for pkts */ +enum ldns_enum_pkt_rcode { + LDNS_RCODE_NOERROR = 0, + LDNS_RCODE_FORMERR = 1, + LDNS_RCODE_SERVFAIL = 2, + LDNS_RCODE_NXDOMAIN = 3, + LDNS_RCODE_NOTIMPL = 4, + LDNS_RCODE_REFUSED = 5, + LDNS_RCODE_YXDOMAIN = 6, + LDNS_RCODE_YXRRSET = 7, + LDNS_RCODE_NXRRSET = 8, + LDNS_RCODE_NOTAUTH = 9, + LDNS_RCODE_NOTZONE = 10 +}; +typedef enum ldns_enum_pkt_rcode ldns_pkt_rcode; + +/** + * Header of a dns packet + * + * Contains the information about the packet itself, as specified in RFC1035 +
+4.1.1. Header section format
+
+The header contains the following fields:
+
+                                    1  1  1  1  1  1
+      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                      ID                       |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |QR|   Opcode  |AA|TC|RD|RA|   Z    |   RCODE   |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    QDCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    ANCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    NSCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                    ARCOUNT                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
+where:
+
+ID              A 16 bit identifier assigned by the program that
+                generates any kind of query.  This identifier is copied
+                the corresponding reply and can be used by the requester
+                to match up replies to outstanding queries.
+
+QR              A one bit field that specifies whether this message is a
+                query (0), or a response (1).
+
+OPCODE          A four bit field that specifies kind of query in this
+                message.  This value is set by the originator of a query
+                and copied into the response.  The values are:
+
+                0               a standard query (QUERY)
+
+                1               an inverse query (IQUERY)
+
+                2               a server status request (STATUS)
+
+                3-15            reserved for future use
+
+AA              Authoritative Answer - this bit is valid in responses,
+                and specifies that the responding name server is an
+                authority for the domain name in question section.
+
+                Note that the contents of the answer section may have
+                multiple owner names because of aliases.  The AA bit
+
+                corresponds to the name which matches the query name, or
+                the first owner name in the answer section.
+
+TC              TrunCation - specifies that this message was truncated
+                due to length greater than that permitted on the
+                transmission channel.
+
+RD              Recursion Desired - this bit may be set in a query and
+                is copied into the response.  If RD is set, it directs
+                the name server to pursue the query recursively.
+                Recursive query support is optional.
+
+RA              Recursion Available - this be is set or cleared in a
+                response, and denotes whether recursive query support is
+                available in the name server.
+
+Z               Reserved for future use.  Must be zero in all queries
+                and responses.
+
+RCODE           Response code - this 4 bit field is set as part of
+                responses.  The values have the following
+                interpretation:
+
+                0               No error condition
+
+                1               Format error - The name server was
+                                unable to interpret the query.
+
+                2               Server failure - The name server was
+                                unable to process this query due to a
+                                problem with the name server.
+
+                3               Name Error - Meaningful only for
+                                responses from an authoritative name
+                                server, this code signifies that the
+                                domain name referenced in the query does
+                                not exist.
+
+                4               Not Implemented - The name server does
+                                not support the requested kind of query.
+
+                5               Refused - The name server refuses to
+                                perform the specified operation for
+                                policy reasons.  For example, a name
+                                server may not wish to provide the
+                                information to the particular requester,
+                                or a name server may not wish to perform
+                                a particular operation (e.g., zone
+
+                                transfer) for particular data.
+
+                6-15            Reserved for future use.
+
+QDCOUNT         an unsigned 16 bit integer specifying the number of
+                entries in the question section.
+
+ANCOUNT         an unsigned 16 bit integer specifying the number of
+                resource records in the answer section.
+
+NSCOUNT         an unsigned 16 bit integer specifying the number of name
+                server resource records in the authority records
+                section.
+
+ARCOUNT         an unsigned 16 bit integer specifying the number of
+                resource records in the additional records section.
+
+
+ */ +struct ldns_struct_hdr +{ + /** Id of a packet */ + uint16_t _id; + /** Query bit (0=query, 1=answer) */ + bool _qr; + /** Authoritative answer */ + bool _aa; + /** Packet truncated */ + bool _tc; + /** Recursion desired */ + bool _rd; + /** Checking disabled */ + bool _cd; + /** Recursion available */ + bool _ra; + /** Authentic data */ + bool _ad; + /** Query type */ + ldns_pkt_opcode _opcode; /* XXX 8 bits? */ + /** Response code */ + uint8_t _rcode; + /** question sec */ + uint16_t _qdcount; + /** answer sec */ + uint16_t _ancount; + /** auth sec */ + uint16_t _nscount; + /** add sec */ + uint16_t _arcount; +}; +typedef struct ldns_struct_hdr ldns_hdr; + +/** + * DNS packet + * + * This structure contains a complete DNS packet (either a query or an answer) + * + * It is the complete representation of what you actually send to a + * nameserver, and what it sends back (assuming you are the client here). + */ +struct ldns_struct_pkt +{ + /** Header section */ + ldns_hdr *_header; + /* extra items needed in a packet */ + /** The size of the wire format of the packet in octets */ + ldns_rdf *_answerfrom; + /** Timestamp of the time the packet was sent or created */ + struct timeval timestamp; + /** The duration of the query this packet is an answer to */ + uint32_t _querytime; + /** The size of the wire format of the packet in octets */ + size_t _size; + /** Optional tsig rr */ + ldns_rr *_tsig_rr; + /** EDNS0 available buffer size, see RFC2671 */ + uint16_t _edns_udp_size; + /** EDNS0 Extended rcode */ + uint8_t _edns_extended_rcode; + /** EDNS Version */ + uint8_t _edns_version; + /** Reserved EDNS data bits */ + uint16_t _edns_z; + /** Arbitrary EDNS rdata */ + ldns_rdf *_edns_data; + /** Question section */ + ldns_rr_list *_question; + /** Answer section */ + ldns_rr_list *_answer; + /** Authority section */ + ldns_rr_list *_authority; + /** Additional section */ + ldns_rr_list *_additional; +}; +typedef struct ldns_struct_pkt ldns_pkt; + +/** + * The sections of a packet + */ +enum ldns_enum_pkt_section { + LDNS_SECTION_QUESTION = 0, + LDNS_SECTION_ANSWER = 1, + LDNS_SECTION_AUTHORITY = 2, + LDNS_SECTION_ADDITIONAL = 3, + /** bogus section, if not interested */ + LDNS_SECTION_ANY = 4, + /** used to get all non-question rrs from a packet */ + LDNS_SECTION_ANY_NOQUESTION = 5 +}; +typedef enum ldns_enum_pkt_section ldns_pkt_section; + +/** + * The different types of packets + */ +enum ldns_enum_pkt_type { + LDNS_PACKET_QUESTION, + LDNS_PACKET_REFERRAL, + LDNS_PACKET_ANSWER, + LDNS_PACKET_NXDOMAIN, + LDNS_PACKET_NODATA, + LDNS_PACKET_UNKNOWN +}; +typedef enum ldns_enum_pkt_type ldns_pkt_type; + +/* prototypes */ + +/* read */ + +/** + * Read the packet id + * \param[in] p the packet + * \return the packet id + */ +uint16_t ldns_pkt_id(const ldns_pkt *p); +/** + * Read the packet's qr bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_qr(const ldns_pkt *p); +/** + * Read the packet's aa bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_aa(const ldns_pkt *p); +/** + * Read the packet's tc bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_tc(const ldns_pkt *p); +/** + * Read the packet's rd bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_rd(const ldns_pkt *p); +/** + * Read the packet's cd bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_cd(const ldns_pkt *p); +/** + * Read the packet's ra bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_ra(const ldns_pkt *p); +/** + * Read the packet's ad bit + * \param[in] p the packet + * \return value of the bit + */ +bool ldns_pkt_ad(const ldns_pkt *p); +/** + * Read the packet's code + * \param[in] p the packet + * \return the opcode + */ +ldns_pkt_opcode ldns_pkt_get_opcode(const ldns_pkt *p); +/** + * Return the packet's respons code + * \param[in] p the packet + * \return the respons code + */ +ldns_pkt_rcode ldns_pkt_get_rcode(const ldns_pkt *p); +/** + * Return the packet's qd count + * \param[in] p the packet + * \return the qd count + */ +uint16_t ldns_pkt_qdcount(const ldns_pkt *p); +/** + * Return the packet's an count + * \param[in] p the packet + * \return the an count + */ +uint16_t ldns_pkt_ancount(const ldns_pkt *p); +/** + * Return the packet's ns count + * \param[in] p the packet + * \return the ns count + */ +uint16_t ldns_pkt_nscount(const ldns_pkt *p); +/** + * Return the packet's ar count + * \param[in] p the packet + * \return the ar count + */ +uint16_t ldns_pkt_arcount(const ldns_pkt *p); + +/** + * Return the packet's answerfrom + * \param[in] p packet + * \return the name of the server + */ +ldns_rdf *ldns_pkt_answerfrom(const ldns_pkt *p); + +/** + * Return the packet's timestamp + * \param[in] p the packet + * \return the timestamp + */ +struct timeval ldns_pkt_timestamp(const ldns_pkt *p); +/** + * Return the packet's querytime + * \param[in] p the packet + * \return the querytime + */ +uint32_t ldns_pkt_querytime(const ldns_pkt *p); + +/** + * Return the packet's size in bytes + * \param[in] p the packet + * \return the size + */ +size_t ldns_pkt_size(const ldns_pkt *p); + +/** + * Return the packet's tsig pseudo rr's + * \param[in] p the packet + * \return the tsig rr + */ +ldns_rr *ldns_pkt_tsig(const ldns_pkt *p); + +/** + * Return the packet's question section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_question(const ldns_pkt *p); +/** + * Return the packet's answer section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_answer(const ldns_pkt *p); +/** + * Return the packet's authority section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_authority(const ldns_pkt *p); +/** + * Return the packet's additional section + * \param[in] p the packet + * \return the section + */ +ldns_rr_list *ldns_pkt_additional(const ldns_pkt *p); +/** + * Return the packet's question, answer, authority and additional sections + * concatenated, in a new rr_list clone. + * \param[in] p the packet + * \return the rrs + */ +ldns_rr_list *ldns_pkt_all(const ldns_pkt *p); +/** + * Return the packet's answer, authority and additional sections concatenated, + * in a new rr_list clone. Like ldns_pkt_all but without the questions. + * \param[in] p the packet + * \return the rrs except the question rrs + */ +ldns_rr_list *ldns_pkt_all_noquestion(const ldns_pkt *p); + +/** + * return all the rr_list's in the packet. Clone the lists, instead + * of returning pointers. + * \param[in] p the packet to look in + * \param[in] s what section(s) to return + * \return ldns_rr_list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_get_section_clone(const ldns_pkt *p, ldns_pkt_section s); + +/** + * return all the rr with a specific name from a packet. Optionally + * specify from which section in the packet + * \param[in] p the packet + * \param[in] r the name + * \param[in] s the packet's section + * \return a list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_rr_list_by_name(ldns_pkt *p, ldns_rdf *r, ldns_pkt_section s); +/** + * return all the rr with a specific type from a packet. Optionally + * specify from which section in the packet + * \param[in] p the packet + * \param[in] t the type + * \param[in] s the packet's section + * \return a list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_rr_list_by_type(const ldns_pkt *p, ldns_rr_type t, ldns_pkt_section s); +/** + * return all the rr with a specific type and type from a packet. Optionally + * specify from which section in the packet + * \param[in] packet the packet + * \param[in] ownername the name + * \param[in] type the type + * \param[in] sec the packet's section + * \return a list with the rr's or NULL if none were found + */ +ldns_rr_list *ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, const ldns_rdf *ownername, ldns_rr_type type, ldns_pkt_section sec); + + +/** + * check to see if an rr exist in the packet + * \param[in] pkt the packet to examine + * \param[in] sec in which section to look + * \param[in] rr the rr to look for + */ +bool ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr); + + +/** + * sets the flags in a packet. + * \param[in] pkt the packet to operate on + * \param[in] flags ORed values: LDNS_QR| LDNS_AR for instance + * \return true on success otherwise false + */ +bool ldns_pkt_set_flags(ldns_pkt *pkt, uint16_t flags); + +/** + * Set the packet's id + * \param[in] p the packet + * \param[in] id the id to set + */ +void ldns_pkt_set_id(ldns_pkt *p, uint16_t id); +/** + * Set the packet's id to a random value + * \param[in] p the packet + */ +void ldns_pkt_set_random_id(ldns_pkt *p); +/** + * Set the packet's qr bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_qr(ldns_pkt *p, bool b); +/** + * Set the packet's aa bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_aa(ldns_pkt *p, bool b); +/** + * Set the packet's tc bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_tc(ldns_pkt *p, bool b); +/** + * Set the packet's rd bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_rd(ldns_pkt *p, bool b); +/** + * Set the packet's cd bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_cd(ldns_pkt *p, bool b); +/** + * Set the packet's ra bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_ra(ldns_pkt *p, bool b); +/** + * Set the packet's ad bit + * \param[in] p the packet + * \param[in] b the value to set (boolean) + */ +void ldns_pkt_set_ad(ldns_pkt *p, bool b); + +/** + * Set the packet's opcode + * \param[in] p the packet + * \param[in] c the opcode + */ +void ldns_pkt_set_opcode(ldns_pkt *p, ldns_pkt_opcode c); +/** + * Set the packet's respons code + * \param[in] p the packet + * \param[in] c the rcode + */ +void ldns_pkt_set_rcode(ldns_pkt *p, uint8_t c); +/** + * Set the packet's qd count + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_qdcount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's an count + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_ancount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's ns count + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_nscount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's arcount + * \param[in] p the packet + * \param[in] c the count + */ +void ldns_pkt_set_arcount(ldns_pkt *p, uint16_t c); +/** + * Set the packet's answering server + * \param[in] p the packet + * \param[in] r the address + */ +void ldns_pkt_set_answerfrom(ldns_pkt *p, ldns_rdf *r); +/** + * Set the packet's query time + * \param[in] p the packet + * \param[in] t the querytime in msec + */ +void ldns_pkt_set_querytime(ldns_pkt *p, uint32_t t); +/** + * Set the packet's size + * \param[in] p the packet + * \param[in] s the size + */ +void ldns_pkt_set_size(ldns_pkt *p, size_t s); + +/** + * Set the packet's timestamp + * \param[in] p the packet + * \param[in] timeval the timestamp + */ +void ldns_pkt_set_timestamp(ldns_pkt *p, struct timeval timeval); +/** + * Set a packet's section count to x + * \param[in] p the packet + * \param[in] s the section + * \param[in] x the section count + */ +void ldns_pkt_set_section_count(ldns_pkt *p, ldns_pkt_section s, uint16_t x); +/** + * Set the packet's tsig rr + * \param[in] p the packet + * \param[in] t the tsig rr + */ +void ldns_pkt_set_tsig(ldns_pkt *p, ldns_rr *t); + +/** + * looks inside the packet to determine + * what kind of packet it is, AUTH, NXDOMAIN, REFERRAL, etc. + * \param[in] p the packet to examine + * \return the type of packet + */ +ldns_pkt_type ldns_pkt_reply_type(ldns_pkt *p); + +/** + * return the packet's edns udp size + * \param[in] packet the packet + * \return the size + */ +uint16_t ldns_pkt_edns_udp_size(const ldns_pkt *packet); +/** + * return the packet's edns extended rcode + * \param[in] packet the packet + * \return the rcode + */ +uint8_t ldns_pkt_edns_extended_rcode(const ldns_pkt *packet); +/** + * return the packet's edns version + * \param[in] packet the packet + * \return the version + */ +uint8_t ldns_pkt_edns_version(const ldns_pkt *packet); +/** + * return the packet's edns z value + * \param[in] packet the packet + * \return the z value + */ +uint16_t ldns_pkt_edns_z(const ldns_pkt *packet); +/** + * return the packet's edns data + * \param[in] packet the packet + * \return the data + */ +ldns_rdf *ldns_pkt_edns_data(const ldns_pkt *packet); + +/** + * return the packet's edns do bit + * \param[in] packet the packet + * \return the bit's value + */ +bool ldns_pkt_edns_do(const ldns_pkt *packet); +/** + * Set the packet's edns do bit + * \param[in] packet the packet + * \param[in] value the bit's new value + */ +void ldns_pkt_set_edns_do(ldns_pkt *packet, bool value); + +/** + * returns true if this packet needs and EDNS rr to be sent. + * At the moment the only reason is an expected packet + * size larger than 512 bytes, but for instance dnssec would + * be a good reason too. + * + * \param[in] packet the packet to check + * \return true if packet needs edns rr + */ +bool ldns_pkt_edns(const ldns_pkt *packet); + +/** + * Set the packet's edns udp size + * \param[in] packet the packet + * \param[in] s the size + */ +void ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s); +/** + * Set the packet's edns extended rcode + * \param[in] packet the packet + * \param[in] c the code + */ +void ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c); +/** + * Set the packet's edns version + * \param[in] packet the packet + * \param[in] v the version + */ +void ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v); +/** + * Set the packet's edns z value + * \param[in] packet the packet + * \param[in] z the value + */ +void ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z); +/** + * Set the packet's edns data + * \param[in] packet the packet + * \param[in] data the data + */ +void ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data); + +/** + * allocates and initializes a ldns_pkt structure. + * \return pointer to the new packet + */ +ldns_pkt *ldns_pkt_new(); + +/** + * frees the packet structure and all data that it contains. + * \param[in] packet The packet structure to free + * \return void + */ +void ldns_pkt_free(ldns_pkt *packet); + +/** + * creates a query packet for the given name, type, class. + * \param[out] p the packet to be returned + * \param[in] rr_name the name to query for (as string) + * \param[in] rr_type the type to query for + * \param[in] rr_class the class to query for + * \param[in] flags packet flags + * \return LDNS_STATUS_OK or a ldns_status mesg with the error + */ +ldns_status ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class , uint16_t flags); + +/** + * creates a packet with a query in it for the given name, type and class. + * \param[in] rr_name the name to query for + * \param[in] rr_type the type to query for + * \param[in] rr_class the class to query for + * \param[in] flags packet flags + * \return ldns_pkt* a pointer to the new pkt + */ +ldns_pkt *ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, uint16_t flags); + +/** + * clones the given packet, creating a fully allocated copy + * + * \param[in] pkt the packet to clone + * \return ldns_pkt* pointer to the new packet + */ +ldns_pkt *ldns_pkt_clone(ldns_pkt *pkt); + +/** + * directly set the additional section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_additional(ldns_pkt *p, ldns_rr_list *rr); + +/** + * directly set the answer section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_answer(ldns_pkt *p, ldns_rr_list *rr); + +/** + * directly set the question section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_question(ldns_pkt *p, ldns_rr_list *rr); + +/** + * directly set the auhority section + * \param[in] p packet to operate on + * \param[in] rr rrlist to set + */ +void ldns_pkt_set_authority(ldns_pkt *p, ldns_rr_list *rr); + +/** + * push an rr on a packet + * \param[in] packet packet to operate on + * \param[in] section where to put it + * \param[in] rr rr to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr); + +/** + * push an rr on a packet, provided the RR is not there. + * \param[in] pkt packet to operate on + * \param[in] sec where to put it + * \param[in] rr rr to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_safe_push_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr); + +/** + * push a rr_list on a packet + * \param[in] packet packet to operate on + * \param[in] section where to put it + * \param[in] list the rr_list to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_push_rr_list(ldns_pkt *packet, ldns_pkt_section section, ldns_rr_list *list); + +/** + * push an rr_list to a packet, provided the RRs are not already there. + * \param[in] pkt packet to operate on + * \param[in] sec where to put it + * \param[in] list the rr_list to push + * \return a boolean which is true when the rr was added + */ +bool ldns_pkt_safe_push_rr_list(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr_list *list); + +/** + * check if a packet is empty + * \param[in] p packet + * \return true: empty, false: not empty + */ +bool ldns_pkt_empty(ldns_pkt *p); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_PACKET_H */ diff --git a/libs/ldns/ldns/parse.h b/libs/ldns/ldns/parse.h new file mode 100644 index 0000000000..0e9034c341 --- /dev/null +++ b/libs/ldns/ldns/parse.h @@ -0,0 +1,167 @@ +/* + * parse.h + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ + +#ifndef LDNS_PARSE_H +#define LDNS_PARSE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_PARSE_SKIP_SPACE "\f\n\r\v" +#define LDNS_PARSE_NORMAL " \f\n\r\t\v" +#define LDNS_PARSE_NO_NL " \t" +#define LDNS_MAX_LINELEN 10230 +#define LDNS_MAX_KEYWORDLEN 32 + + +/** + * \file + * + * Contains some low-level parsing functions, mostly used in the _frm_str + * family of functions. + */ + +/** + * different type of directives in zone files + * We now deal with $TTL, $ORIGIN and $INCLUDE. + * The latter is not implemented in ldns (yet) + */ +enum ldns_enum_directive +{ + LDNS_DIR_TTL, + LDNS_DIR_ORIGIN, + LDNS_DIR_INCLUDE +}; +typedef enum ldns_enum_directive ldns_directive; + +/** + * returns a token/char from the stream F. + * This function deals with ( and ) in the stream, + * and ignores them when encountered + * \param[in] *f the file to read from + * \param[out] *token the read token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 the builtin maximum is used + * \return 0 on error of EOF of the stream F. Otherwise return the length of what is read + */ +ssize_t ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit); + +/** + * returns a token/char from the stream F. + * This function deals with ( and ) in the stream, + * and ignores when it finds them. + * \param[in] *f the file to read from + * \param[out] *token the token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 use builtin maximum + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return 0 on error of EOF of F otherwise return the length of what is read + */ +ssize_t ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr); + +/** + * returns a token/char from the buffer b. + * This function deals with ( and ) in the buffer, + * and ignores when it finds them. + * \param[in] *b the buffer to read from + * \param[out] *token the token is put here + * \param[in] *delim chars at which the parsing should stop + * \param[in] *limit how much to read. If 0 the builtin maximum is used + * \returns 0 on error of EOF of b. Otherwise return the length of what is read + */ +ssize_t ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit); + +/* + * searches for keyword and delim in a file. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] f file pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \return the number of character read + */ +ssize_t ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); + +/* + * searches for keyword and delim. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] f file pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \param[in] line_nr pointer to an integer containing the current line number (for +debugging purposes) + * \return the number of character read + */ +ssize_t ldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit, int *line_nr); + +/* + * searches for keyword and delim in a buffer. Gives everything back + * after the keyword + k_del until we hit d_del + * \param[in] b buffer pointer to read from + * \param[in] keyword keyword to look for + * \param[in] k_del keyword delimeter + * \param[out] data the data found + * \param[in] d_del the data delimeter + * \param[in] data_limit maximum size the the data buffer + * \return the number of character read + */ +ssize_t ldns_bget_keyword_data(ldns_buffer *b, const char *keyword, const char *k_del, char *data, const char *d_del, size_t data_limit); + +/** + * returns the next character from a buffer. Advances the position pointer with 1. + * When end of buffer is reached returns EOF. This is the buffer's equivalent + * for getc(). + * \param[in] *buffer buffer to read from + * \return EOF on failure otherwise return the character + */ +int ldns_bgetc(ldns_buffer *buffer); + +/** + * skips all of the characters in the given string in the buffer, moving + * the position to the first character that is not in *s. + * \param[in] *buffer buffer to use + * \param[in] *s characters to skip + * \return void + */ +void ldns_bskipcs(ldns_buffer *buffer, const char *s); + +/** + * skips all of the characters in the given string in the fp, moving + * the position to the first character that is not in *s. + * \param[in] *fp file to use + * \param[in] *s characters to skip + * \return void + */ +void ldns_fskipcs(FILE *fp, const char *s); + + +/** + * skips all of the characters in the given string in the fp, moving + * the position to the first character that is not in *s. + * \param[in] *fp file to use + * \param[in] *s characters to skip + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return void + */ +void ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_PARSE_H */ diff --git a/libs/ldns/ldns/rbtree.h b/libs/ldns/ldns/rbtree.h new file mode 100644 index 0000000000..98bd880329 --- /dev/null +++ b/libs/ldns/ldns/rbtree.h @@ -0,0 +1,230 @@ +/* + * rbtree.h -- generic red-black tree + * + * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the NLNET LABS nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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. + * + */ + +/** + * \file + * Red black tree. Implementation taken from NSD 3.0.5, adjusted for use + * in unbound (memory allocation, logging and so on). + */ + +#ifndef LDNS_RBTREE_H_ +#define LDNS_RBTREE_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * This structure must be the first member of the data structure in + * the rbtree. This allows easy casting between an rbnode_t and the + * user data (poor man's inheritance). + * Or you can use the data pointer member to get to your data item. + */ +typedef struct ldns_rbnode_t ldns_rbnode_t; +/** + * The rbnode_t struct definition. + */ +struct ldns_rbnode_t { + /** parent in rbtree, RBTREE_NULL for root */ + ldns_rbnode_t *parent; + /** left node (smaller items) */ + ldns_rbnode_t *left; + /** right node (larger items) */ + ldns_rbnode_t *right; + /** pointer to sorting key */ + const void *key; + /** pointer to data */ + const void *data; + /** colour of this node */ + uint8_t color; +}; + +/** The nullpointer, points to empty node */ +#define LDNS_RBTREE_NULL &ldns_rbtree_null_node +/** the global empty node */ +extern ldns_rbnode_t ldns_rbtree_null_node; + +/** An entire red black tree */ +typedef struct ldns_rbtree_t ldns_rbtree_t; +/** definition for tree struct */ +struct ldns_rbtree_t { + /** The root of the red-black tree */ + ldns_rbnode_t *root; + + /** The number of the nodes in the tree */ + size_t count; + + /** + * Key compare function. <0,0,>0 like strcmp. + * Return 0 on two NULL ptrs. + */ + int (*cmp) (const void *, const void *); +}; + +/** + * Create new tree (malloced) with given key compare function. + * @param cmpf: compare function (like strcmp) takes pointers to two keys. + * @return: new tree, empty. + */ +ldns_rbtree_t *ldns_rbtree_create(int (*cmpf)(const void *, const void *)); + +/** + * Free the complete tree (but not its keys) + * @param rbtree The tree to free + */ +void ldns_rbtree_free(ldns_rbtree_t *rbtree); + +/** + * Init a new tree (malloced by caller) with given key compare function. + * @param rbtree: uninitialised memory for new tree, returned empty. + * @param cmpf: compare function (like strcmp) takes pointers to two keys. + */ +void ldns_rbtree_init(ldns_rbtree_t *rbtree, int (*cmpf)(const void *, const void *)); + +/** + * Insert data into the tree. + * @param rbtree: tree to insert to. + * @param data: element to insert. + * @return: data ptr or NULL if key already present. + */ +ldns_rbnode_t *ldns_rbtree_insert(ldns_rbtree_t *rbtree, ldns_rbnode_t *data); + +/** + * Insert data into the tree (reversed arguments, for use as callback) + * \param[in] data element to insert + * \param[out] rbtree tree to insert in to + * \return data ptr or NULL if key is already present + */ +void ldns_rbtree_insert_vref(ldns_rbnode_t *data, void *rbtree); + +/** + * Delete element from tree. + * @param rbtree: tree to delete from. + * @param key: key of item to delete. + * @return: node that is now unlinked from the tree. User to delete it. + * returns 0 if node not present + */ +ldns_rbnode_t *ldns_rbtree_delete(ldns_rbtree_t *rbtree, const void *key); + +/** + * Find key in tree. Returns NULL if not found. + * @param rbtree: tree to find in. + * @param key: key that must match. + * @return: node that fits or NULL. + */ +ldns_rbnode_t *ldns_rbtree_search(ldns_rbtree_t *rbtree, const void *key); + +/** + * Find, but match does not have to be exact. + * @param rbtree: tree to find in. + * @param key: key to find position of. + * @param result: set to the exact node if present, otherwise to element that + * precedes the position of key in the tree. NULL if no smaller element. + * @return: true if exact match in result. Else result points to <= element, + * or NULL if key is smaller than the smallest key. + */ +int ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key, + ldns_rbnode_t **result); + +/** + * Returns first (smallest) node in the tree + * @param rbtree: tree + * @return: smallest element or NULL if tree empty. + */ +ldns_rbnode_t *ldns_rbtree_first(ldns_rbtree_t *rbtree); + +/** + * Returns last (largest) node in the tree + * @param rbtree: tree + * @return: largest element or NULL if tree empty. + */ +ldns_rbnode_t *ldns_rbtree_last(ldns_rbtree_t *rbtree); + +/** + * Returns next larger node in the tree + * @param rbtree: tree + * @return: next larger element or NULL if no larger in tree. + */ +ldns_rbnode_t *ldns_rbtree_next(ldns_rbnode_t *rbtree); + +/** + * Returns previous smaller node in the tree + * @param rbtree: tree + * @return: previous smaller element or NULL if no previous in tree. + */ +ldns_rbnode_t *ldns_rbtree_previous(ldns_rbnode_t *rbtree); + +/** + * split off 'elements' number of elements from the start + * of the name tree and return a new tree containing those + * elements + */ +ldns_rbtree_t *ldns_rbtree_split(ldns_rbtree_t *tree, size_t elements); + +/** + * add all node from the second tree to the first (removing them from the + * second), and fix up nsec(3)s if present + */ +void ldns_rbtree_join(ldns_rbtree_t *tree1, ldns_rbtree_t *tree2); + +/** + * Call with node=variable of struct* with rbnode_t as first element. + * with type is the type of a pointer to that struct. + */ +#define LDNS_RBTREE_FOR(node, type, rbtree) \ + for(node=(type)ldns_rbtree_first(rbtree); \ + (ldns_rbnode_t*)node != LDNS_RBTREE_NULL; \ + node = (type)ldns_rbtree_next((ldns_rbnode_t*)node)) + +/** + * Call function for all elements in the redblack tree, such that + * leaf elements are called before parent elements. So that all + * elements can be safely free()d. + * Note that your function must not remove the nodes from the tree. + * Since that may trigger rebalances of the rbtree. + * @param tree: the tree + * @param func: function called with element and user arg. + * The function must not alter the rbtree. + * @param arg: user argument. + */ +void ldns_traverse_postorder(ldns_rbtree_t* tree, + void (*func)(ldns_rbnode_t*, void*), void* arg); + +#ifdef __cplusplus +} +#endif + +#endif /* UTIL_RBTREE_H_ */ diff --git a/libs/ldns/ldns/rdata.h b/libs/ldns/ldns/rdata.h new file mode 100644 index 0000000000..90dcbf1381 --- /dev/null +++ b/libs/ldns/ldns/rdata.h @@ -0,0 +1,385 @@ +/* + * rdata.h + * + * rdata definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + + +/** + * \file + * + * Defines ldns_rdf and functions to manipulate those. + */ + + +#ifndef LDNS_RDATA_H +#define LDNS_RDATA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_MAX_RDFLEN 8192 + +#define LDNS_RDF_SIZE_BYTE 1 +#define LDNS_RDF_SIZE_WORD 2 +#define LDNS_RDF_SIZE_DOUBLEWORD 4 +#define LDNS_RDF_SIZE_6BYTES 6 +#define LDNS_RDF_SIZE_16BYTES 16 + +#define LDNS_NSEC3_VARS_OPTOUT_MASK 0x01 + +/** + * The different types of RDATA fields. + */ +enum ldns_enum_rdf_type +{ + /** none */ + LDNS_RDF_TYPE_NONE, + /** domain name */ + LDNS_RDF_TYPE_DNAME, + /** 8 bits */ + LDNS_RDF_TYPE_INT8, + /** 16 bits */ + LDNS_RDF_TYPE_INT16, + /** 32 bits */ + LDNS_RDF_TYPE_INT32, + /** A record */ + LDNS_RDF_TYPE_A, + /** AAAA record */ + LDNS_RDF_TYPE_AAAA, + /** txt string */ + LDNS_RDF_TYPE_STR, + /** apl data */ + LDNS_RDF_TYPE_APL, + /** b32 string */ + LDNS_RDF_TYPE_B32_EXT, + /** b64 string */ + LDNS_RDF_TYPE_B64, + /** hex string */ + LDNS_RDF_TYPE_HEX, + /** nsec type codes */ + LDNS_RDF_TYPE_NSEC, + /** a RR type */ + LDNS_RDF_TYPE_TYPE, + /** a class */ + LDNS_RDF_TYPE_CLASS, + /** certificate algorithm */ + LDNS_RDF_TYPE_CERT_ALG, + /** a key algorithm */ + LDNS_RDF_TYPE_ALG, + /** unknown types */ + LDNS_RDF_TYPE_UNKNOWN, + /** time (32 bits) */ + LDNS_RDF_TYPE_TIME, + /** period */ + LDNS_RDF_TYPE_PERIOD, + /** tsig time 48 bits */ + LDNS_RDF_TYPE_TSIGTIME, + LDNS_RDF_TYPE_TSIG, + /** variable length any type rdata where the length + is specified by the first 2 bytes */ + LDNS_RDF_TYPE_INT16_DATA, + /** protocol and port bitmaps */ + LDNS_RDF_TYPE_SERVICE, + /** location data */ + LDNS_RDF_TYPE_LOC, + /** well known services */ + LDNS_RDF_TYPE_WKS, + /** NSAP */ + LDNS_RDF_TYPE_NSAP, + /** ATMA */ + LDNS_RDF_TYPE_ATMA, + /** IPSECKEY */ + LDNS_RDF_TYPE_IPSECKEY, + /** nsec3 hash salt */ + LDNS_RDF_TYPE_NSEC3_SALT, + /** nsec3 base32 string (with length byte on wire */ + LDNS_RDF_TYPE_NSEC3_NEXT_OWNER +}; +typedef enum ldns_enum_rdf_type ldns_rdf_type; + +/** + * algorithms used in CERT rrs + */ +enum ldns_enum_cert_algorithm +{ + LDNS_CERT_PKIX = 1, + LDNS_CERT_SPKI = 2, + LDNS_CERT_PGP = 3, + LDNS_CERT_IPKIX = 4, + LDNS_CERT_ISPKI = 5, + LDNS_CERT_IPGP = 6, + LDNS_CERT_ACPKIX = 7, + LDNS_CERT_IACPKIX = 8, + LDNS_CERT_URI = 253, + LDNS_CERT_OID = 254 +}; +typedef enum ldns_enum_cert_algorithm ldns_cert_algorithm; + + + +/** + * Resource record data field. + * + * The data is a network ordered array of bytes, which size is specified by + * the (16-bit) size field. To correctly parse it, use the type + * specified in the (16-bit) type field with a value from \ref ldns_rdf_type. + */ +struct ldns_struct_rdf +{ + /** The size of the data (in octets) */ + size_t _size; + /** The type of the data */ + ldns_rdf_type _type; + /** Pointer to the data (raw octets) */ + void *_data; +}; +typedef struct ldns_struct_rdf ldns_rdf; + +/* prototypes */ + +/* write access functions */ + +/** + * sets the size of the rdf. + * \param[in] *rd the rdf to operate on + * \param[in] size the new size + * \return void + */ +void ldns_rdf_set_size(ldns_rdf *rd, size_t size); + +/** + * sets the size of the rdf. + * \param[in] *rd the rdf to operate on + * \param[in] type the new type + * \return void + */ +void ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type); + +/** + * sets the size of the rdf. + * \param[in] *rd the rdf to operate on + * \param[in] *data pointer to the new data + * \return void + */ +void ldns_rdf_set_data(ldns_rdf *rd, void *data); + +/* read access */ + +/** + * returns the size of the rdf. + * \param[in] *rd the rdf to read from + * \return uint16_t with the size + */ +size_t ldns_rdf_size(const ldns_rdf *rd); + +/** + * returns the type of the rdf. We need to insert _get_ + * here to prevent conflict the the rdf_type TYPE. + * \param[in] *rd the rdf to read from + * \return ldns_rdf_type with the type + */ +ldns_rdf_type ldns_rdf_get_type(const ldns_rdf *rd); + +/** + * returns the data of the rdf. + * \param[in] *rd the rdf to read from + * \return uint8_t* pointer to the rdf's data + */ +uint8_t *ldns_rdf_data(const ldns_rdf *rd); + +/* creator functions */ + +/** + * allocates a new rdf structure and fills it. + * This function DOES NOT copy the contents from + * the buffer, unlinke ldns_rdf_new_frm_data() + * \param[in] type type of the rdf + * \param[in] size size of the buffer + * \param[in] data pointer to the buffer to be copied + * \return the new rdf structure or NULL on failure + */ +ldns_rdf *ldns_rdf_new(ldns_rdf_type type, size_t size, void *data); + +/** + * allocates a new rdf structure and fills it. + * This function _does_ copy the contents from + * the buffer, unlinke ldns_rdf_new() + * \param[in] type type of the rdf + * \param[in] size size of the buffer + * \param[in] data pointer to the buffer to be copied + * \return the new rdf structure or NULL on failure + */ +ldns_rdf *ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data); + +/** + * creates a new rdf from a string. + * \param[in] type type to use + * \param[in] str string to use + * \return ldns_rdf* or NULL in case of an error + */ +ldns_rdf *ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str); + +/** + * creates a new rdf from a file containing a string. + * \param[out] r the new rdf + * \param[in] type type to use + * \param[in] fp the file pointer to use + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_rdf_new_frm_fp(ldns_rdf **r, ldns_rdf_type type, FILE *fp); + +/** + * creates a new rdf from a file containing a string. + * \param[out] r the new rdf + * \param[in] type type to use + * \param[in] fp the file pointer to use + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_rdf_new_frm_fp_l(ldns_rdf **r, ldns_rdf_type type, FILE *fp, int *line_nr); + +/* destroy functions */ + +/** + * frees a rdf structure, leaving the + * data pointer intact. + * \param[in] rd the pointer to be freed + * \return void + */ +void ldns_rdf_free(ldns_rdf *rd); + +/** + * frees a rdf structure _and_ frees the + * data. rdf should be created with _new_frm_data + * \param[in] rd the rdf structure to be freed + * \return void + */ +void ldns_rdf_deep_free(ldns_rdf *rd); + +/* conversion functions */ + +/** + * returns the rdf containing the native uint8_t repr. + * \param[in] type the ldns_rdf type to use + * \param[in] value the uint8_t to use + * \return ldns_rdf* with the converted value + */ +ldns_rdf *ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value); + +/** + * returns the rdf containing the native uint16_t representation. + * \param[in] type the ldns_rdf type to use + * \param[in] value the uint16_t to use + * \return ldns_rdf* with the converted value + */ +ldns_rdf *ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value); + +/** + * returns an rdf that contains the given int32 value. + * + * Because multiple rdf types can contain an int32, the + * type must be specified + * \param[in] type the ldns_rdf type to use + * \param[in] value the uint32_t to use + * \return ldns_rdf* with the converted value + */ +ldns_rdf *ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value); + +/** + * returns an int16_data rdf that contains the data in the + * given array, preceded by an int16 specifying the length. + * + * The memory is copied, and an LDNS_RDF_TYPE_INT16DATA is returned + * \param[in] size the size of the data + * \param[in] *data pointer to the actual data + * \return ldns_rd* the rdf with the data + */ +ldns_rdf *ldns_native2rdf_int16_data(size_t size, uint8_t *data); + +/** + * reverses an rdf, only actually useful for AAAA and A records. + * The returned rdf has the type LDNS_RDF_TYPE_DNAME! + * \param[in] *rd rdf to be reversed + * \return the reversed rdf (a newly created rdf) + */ +ldns_rdf *ldns_rdf_address_reverse(ldns_rdf *rd); + +/** + * returns the native uint8_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return uint8_t the value extracted + */ +uint8_t ldns_rdf2native_int8(const ldns_rdf *rd); + +/** + * returns the native uint16_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return uint16_t the value extracted + */ +uint16_t ldns_rdf2native_int16(const ldns_rdf *rd); + +/** + * returns the native uint32_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return uint32_t the value extracted + */ +uint32_t ldns_rdf2native_int32(const ldns_rdf *rd); + +/** + * returns the native time_t representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \return time_t the value extracted (32 bits currently) + */ +time_t ldns_rdf2native_time_t(const ldns_rdf *rd); + +/** + * converts a ttl value (like 5d2h) to a long. + * \param[in] nptr the start of the string + * \param[out] endptr points to the last char in case of error + * \return the convert duration value + */ +uint32_t ldns_str2period(const char *nptr, const char **endptr); + +/** + * removes \\DDD, \\[space] and other escapes from the input. + * See RFC 1035, section 5.1. + * \param[in] word what to check + * \param[in] length the string + * \return ldns_status mesg + */ +ldns_status ldns_octet(char *word, size_t *length); + +/** + * clones a rdf structure. The data is copied. + * \param[in] rd rdf to be copied + * \return a new rdf structure + */ +ldns_rdf *ldns_rdf_clone(const ldns_rdf *rd); + +/** + * compares two rdf's on their wire formats. + * (To order dnames according to rfc4034, use ldns_dname_compare) + * \param[in] rd1 the first one + * \param[in] rd2 the second one + * \return 0 if equal + * \return -1 if rd1 comes before rd2 + * \return +1 if rd2 comes before rd1 + */ +int ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RDATA_H */ diff --git a/libs/ldns/ldns/resolver.h b/libs/ldns/ldns/resolver.h new file mode 100644 index 0000000000..f887aaf676 --- /dev/null +++ b/libs/ldns/ldns/resolver.h @@ -0,0 +1,721 @@ +/* + * resolver.h + * + * DNS Resolver definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Defines the ldns_resolver structure, a stub resolver that can send queries and parse answers. + * + */ + +#ifndef LDNS_RESOLVER_H +#define LDNS_RESOLVER_H + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Default location of the resolv.conf file */ +#define LDNS_RESOLV_CONF "/etc/resolv.conf" +/** Default location of the hosts file */ +#define LDNS_RESOLV_HOSTS "/etc/hosts" + +#define LDNS_RESOLV_KEYWORD -1 +#define LDNS_RESOLV_DEFDOMAIN 0 +#define LDNS_RESOLV_NAMESERVER 1 +#define LDNS_RESOLV_SEARCH 2 +#define LDNS_RESOLV_SORTLIST 3 +#define LDNS_RESOLV_OPTIONS 4 +#define LDNS_RESOLV_ANCHOR 5 +#define LDNS_RESOLV_KEYWORDS 6 + +#define LDNS_RESOLV_INETANY 0 +#define LDNS_RESOLV_INET 1 +#define LDNS_RESOLV_INET6 2 + +#define LDNS_RESOLV_RTT_INF 0 /* infinity */ +#define LDNS_RESOLV_RTT_MIN 1 /* reachable */ + +/** + * DNS stub resolver structure + */ +struct ldns_struct_resolver +{ + /** Port to send queries to */ + uint16_t _port; + + /** Array of nameservers to query (IP addresses or dnames) */ + ldns_rdf **_nameservers; + /** Number of nameservers in \c _nameservers */ + size_t _nameserver_count; /* how many do we have */ + + /** Round trip time; 0 -> infinity. Unit: ms? */ + size_t *_rtt; + + /** Wether or not to be recursive */ + bool _recursive; + + /** Print debug information */ + bool _debug; + + /** Default domain to add to non fully qualified domain names */ + ldns_rdf *_domain; + + /** Searchlist array, add the names in this array if a query cannot be found */ + ldns_rdf **_searchlist; + + /** Number of entries in the searchlist array */ + size_t _searchlist_count; + + /** Number of times to retry before giving up */ + uint8_t _retry; + /** Time to wait before retrying */ + uint8_t _retrans; + /** Use new fallback mechanism (try EDNS, then do TCP) */ + bool _fallback; + + /** Whether to do DNSSEC */ + bool _dnssec; + /** Whether to set the CD bit on DNSSEC requests */ + bool _dnssec_cd; + /** Optional trust anchors for complete DNSSEC validation */ + ldns_rr_list * _dnssec_anchors; + /** Whether to use tcp or udp (tcp if the value is true)*/ + bool _usevc; + /** Whether to ignore the tc bit */ + bool _igntc; + /** Whether to use ip6, 0->does not matter, 1 is IPv4, 2 is IPv6 */ + uint8_t _ip6; + /** If true append the default domain */ + bool _defnames; + /** If true apply the search list */ + bool _dnsrch; + /** Timeout for socket connections */ + struct timeval _timeout; + /** Only try the first nameserver, and return with an error directly if it fails */ + bool _fail; + /** Randomly choose a nameserver */ + bool _random; + /** Keep some things to make AXFR possible */ + int _socket; + /** Count the number of LDNS_RR_TYPE_SOA RRs we have seen so far + * (the second one signifies the end of the AXFR) + */ + int _axfr_soa_count; + /* when axfring we get complete packets from the server + but we want to give the caller 1 rr at a time, so + keep the current pkt */ + /** Packet currently handled when doing part of an AXFR */ + ldns_pkt *_cur_axfr_pkt; + /** Counter for within the AXFR packets */ + uint16_t _axfr_i; + /* EDNS0 available buffer size */ + uint16_t _edns_udp_size; + + /* Optional tsig key for signing queries, + outgoing messages are signed if and only if both are set + */ + /** Name of the key to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values, outgoing messages are automatically signed with TSIG. */ + char *_tsig_keyname; + /** Secret key data to use with TSIG, if _tsig_keyname and _tsig_keydata both contain values, outgoing messages are automatically signed with TSIG. */ + char *_tsig_keydata; + /** TSIG signing algorithm */ + char *_tsig_algorithm; +}; +typedef struct ldns_struct_resolver ldns_resolver; + +/* prototypes */ +/* read access functions */ + +/** + * Get the port the resolver should use + * \param[in] r the resolver + * \return the port number + */ +uint16_t ldns_resolver_port(const ldns_resolver *r); + +/** + * Is the resolver set to recurse + * \param[in] r the resolver + * \return true if so, otherwise false + */ +bool ldns_resolver_recursive(const ldns_resolver *r); + +/** + * Get the debug status of the resolver + * \param[in] r the resolver + * \return true if so, otherwise false + */ +bool ldns_resolver_debug(const ldns_resolver *r); + +/** + * Get the number of retries + * \param[in] r the resolver + * \return the number of retries + */ +uint8_t ldns_resolver_retry(const ldns_resolver *r); + +/** + * Get the retransmit interval + * \param[in] r the resolver + * \return the retransmit interval + */ +uint8_t ldns_resolver_retrans(const ldns_resolver *r); + +/** + * Get the truncation fallback status + * \param[in] r the resolver + * \return whether the truncation fallback mechanism is used + */ +bool ldns_resolver_fallback(const ldns_resolver *r); + +/** + * Does the resolver use ip6 or ip4 + * \param[in] r the resolver + * \return 0: both, 1: ip4, 2:ip6 + */ +uint8_t ldns_resolver_ip6(const ldns_resolver *r); + +/** + * Get the resolver's udp size + * \param[in] r the resolver + * \return the udp mesg size + */ +uint16_t ldns_resolver_edns_udp_size(const ldns_resolver *r); +/** + * Does the resolver use tcp or udp + * \param[in] r the resolver + * \return true: tcp, false: udp + */ +bool ldns_resolver_usevc(const ldns_resolver *r); +/** + * Does the resolver only try the first nameserver + * \param[in] r the resolver + * \return true: yes, fail, false: no, try the others + */ +bool ldns_resolver_fail(const ldns_resolver *r); +/** + * Does the resolver apply default domain name + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_defnames(const ldns_resolver *r); +/** + * Does the resolver apply search list + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_dnsrch(const ldns_resolver *r); +/** + * Does the resolver do DNSSEC + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_dnssec(const ldns_resolver *r); +/** + * Does the resolver set the CD bit + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_dnssec_cd(const ldns_resolver *r); +/** + * Get the resolver's DNSSEC anchors + * \param[in] r the resolver + * \return an rr_list containg trusted DNSSEC anchors + */ +ldns_rr_list * ldns_resolver_dnssec_anchors(const ldns_resolver *r); +/** + * Does the resolver ignore the TC bit (truncated) + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_igntc(const ldns_resolver *r); +/** + * Does the resolver randomize the nameserver before usage + * \param[in] r the resolver + * \return true: yes, false: no + */ +bool ldns_resolver_random(const ldns_resolver *r); +/** + * How many nameserver are configured in the resolver + * \param[in] r the resolver + * \return number of nameservers + */ +size_t ldns_resolver_nameserver_count(const ldns_resolver *r); +/** + * What is the default dname to add to relative queries + * \param[in] r the resolver + * \return the dname which is added + */ +ldns_rdf *ldns_resolver_domain(const ldns_resolver *r); +/** + * What is the timeout on socket connections + * \param[in] r the resolver + * \return the timeout as struct timeval + */ +struct timeval ldns_resolver_timeout(const ldns_resolver *r); +/** + * What is the searchlist as used by the resolver + * \param[in] r the resolver + * \return a ldns_rdf pointer to a list of the addresses + */ +ldns_rdf** ldns_resolver_searchlist(const ldns_resolver *r); +/** + * Return the configured nameserver ip address + * \param[in] r the resolver + * \return a ldns_rdf pointer to a list of the addresses + */ +ldns_rdf** ldns_resolver_nameservers(const ldns_resolver *r); +/** + * Return the used round trip times for the nameservers + * \param[in] r the resolver + * \return a size_t* pointer to the list. + * yet) + */ +size_t * ldns_resolver_rtt(const ldns_resolver *r); +/** + * Return the used round trip time for a specific nameserver + * \param[in] r the resolver + * \param[in] pos the index to the nameserver + * \return the rrt, 0: infinite, >0: undefined (as of * yet) + */ +size_t ldns_resolver_nameserver_rtt(const ldns_resolver *r, size_t pos); +/** + * Return the tsig keyname as used by the nameserver + * \param[in] r the resolver + * \return the name used. + */ +char *ldns_resolver_tsig_keyname(const ldns_resolver *r); +/** + * Return the tsig algorithm as used by the nameserver + * \param[in] r the resolver + * \return the algorithm used. + */ +char *ldns_resolver_tsig_algorithm(const ldns_resolver *r); +/** + * Return the tsig keydata as used by the nameserver + * \param[in] r the resolver + * \return the keydata used. + */ +char *ldns_resolver_tsig_keydata(const ldns_resolver *r); +/** + * pop the last nameserver from the resolver. + * \param[in] r the resolver + * \return the popped address or NULL if empty + */ +ldns_rdf* ldns_resolver_pop_nameserver(ldns_resolver *r); + +/** + * Return the resolver's searchlist count + * \param[in] r the resolver + * \return the searchlist count + */ +size_t ldns_resolver_searchlist_count(const ldns_resolver *r); + +/* write access function */ +/** + * Set the port the resolver should use + * \param[in] r the resolver + * \param[in] p the port number + */ +void ldns_resolver_set_port(ldns_resolver *r, uint16_t p); + +/** + * Set the resolver recursion + * \param[in] r the resolver + * \param[in] b true: set to recurse, false: unset + */ +void ldns_resolver_set_recursive(ldns_resolver *r, bool b); + +/** + * Set the resolver debugging + * \param[in] r the resolver + * \param[in] b true: debug on: false debug off + */ +void ldns_resolver_set_debug(ldns_resolver *r, bool b); + +/** + * Incremental the resolver's nameserver count. + * \param[in] r the resolver + */ +void ldns_resolver_incr_nameserver_count(ldns_resolver *r); + +/** + * Decrement the resolver's nameserver count. + * \param[in] r the resolver + */ +void ldns_resolver_dec_nameserver_count(ldns_resolver *r); + +/** + * Set the resolver's nameserver count directly. + * \param[in] r the resolver + * \param[in] c the nameserver count + */ +void ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c); + +/** + * Set the resolver's nameserver count directly by using an rdf list + * \param[in] r the resolver + * \param[in] rd the resolver addresses + */ +void ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **rd); + +/** + * Set the resolver's default domain. This gets appended when no + * absolute name is given + * \param[in] r the resolver + * \param[in] rd the name to append + */ +void ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *rd); + +/** + * Set the resolver's socket time out when talking to remote hosts + * \param[in] r the resolver + * \param[in] timeout the timeout to use + */ +void ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout); + +/** + * Push a new rd to the resolver's searchlist + * \param[in] r the resolver + * \param[in] rd to push + */ +void ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *rd); + +/** + * Whether the resolver uses the name set with _set_domain + * \param[in] r the resolver + * \param[in] b true: use the defaults, false: don't use them + */ +void ldns_resolver_set_defnames(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses a virtual circuit (TCP) + * \param[in] r the resolver + * \param[in] b true: use TCP, false: don't use TCP + */ +void ldns_resolver_set_usevc(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses the searchlist + * \param[in] r the resolver + * \param[in] b true: use the list, false: don't use the list + */ +void ldns_resolver_set_dnsrch(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses DNSSEC + * \param[in] r the resolver + * \param[in] b true: use DNSSEC, false: don't use DNSSEC + */ +void ldns_resolver_set_dnssec(ldns_resolver *r, bool b); + +/** + * Whether the resolver uses the checking disable bit + * \param[in] r the resolver + * \param[in] b true: enable , false: don't use TCP + */ +void ldns_resolver_set_dnssec_cd(ldns_resolver *r, bool b); +/** + * Set the resolver's DNSSEC anchor list directly. RRs should be of type DS or DNSKEY. + * \param[in] r the resolver + * \param[in] l the list of RRs to use as trust anchors + */ +void ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list * l); + +/** + * Push a new trust anchor to the resolver. It must be a DS or DNSKEY rr + * \param[in] r the resolver. + * \param[in] rr the RR to add as a trust anchor. + * \return a status + */ +ldns_status ldns_resolver_push_dnssec_anchor(ldns_resolver *r, ldns_rr *rr); + +/** + * Set the resolver retrans timeout (in seconds) + * \param[in] r the resolver + * \param[in] re the retransmission interval in seconds + */ +void ldns_resolver_set_retrans(ldns_resolver *r, uint8_t re); + +/** + * Set whether the resolvers truncation fallback mechanism is used + * when ldns_resolver_query() is called. + * \param[in] r the resolver + * \param[in] fallback whether to use the fallback mechanism + */ +void ldns_resolver_set_fallback(ldns_resolver *r, bool fallback); + +/** + * Set the resolver retry interval (in seconds) + * \param[in] r the resolver + * \param[in] re the retry interval + */ +void ldns_resolver_set_retry(ldns_resolver *r, uint8_t re); + +/** + * Whether the resolver uses ip6 + * \param[in] r the resolver + * \param[in] i 0: no pref, 1: ip4, 2: ip6 + */ +void ldns_resolver_set_ip6(ldns_resolver *r, uint8_t i); + +/** + * Whether or not to fail after one failed query + * \param[in] r the resolver + * \param[in] b true: yes fail, false: continue with next nameserver + */ +void ldns_resolver_set_fail(ldns_resolver *r, bool b); + +/** + * Whether or not to ignore the TC bit + * \param[in] r the resolver + * \param[in] b true: yes ignore, false: don't ignore + */ +void ldns_resolver_set_igntc(ldns_resolver *r, bool b); + +/** + * Set maximum udp size + * \param[in] r the resolver + * \param[in] s the udp max size + */ +void ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s); + +/** + * Set the tsig key name + * \param[in] r the resolver + * \param[in] tsig_keyname the tsig key name + */ +void ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname); + +/** + * Set the tsig algorithm + * \param[in] r the resolver + * \param[in] tsig_algorithm the tsig algorithm + */ +void ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm); + +/** + * Set the tsig key data + * \param[in] r the resolver + * \param[in] tsig_keydata the key data + */ +void ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata); + +/** + * Set round trip time for all nameservers. Note this currently + * differentiates between: unreachable and reachable. + * \param[in] r the resolver + * \param[in] rtt a list with the times + */ +void ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt); + +/** + * Set round trip time for a specific nameserver. Note this + * currently differentiates between: unreachable and reachable. + * \param[in] r the resolver + * \param[in] pos the nameserver position + * \param[in] value the rtt + */ +void ldns_resolver_set_nameserver_rtt(ldns_resolver *r, size_t pos, size_t value); + +/** + * Should the nameserver list be randomized before each use + * \param[in] r the resolver + * \param[in] b: true: randomize, false: don't + */ +void ldns_resolver_set_random(ldns_resolver *r, bool b); + +/** + * Push a new nameserver to the resolver. It must be an IP + * address v4 or v6. + * \param[in] r the resolver + * \param[in] n the ip address + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n); + +/** + * Push a new nameserver to the resolver. It must be an + * A or AAAA RR record type + * \param[in] r the resolver + * \param[in] rr the resource record + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr); + +/** + * Push a new nameserver rr_list to the resolver. + * \param[in] r the resolver + * \param[in] rrlist the rr_list to push + * \return ldns_status a status + */ +ldns_status ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist); + +/** + * Send the query for using the resolver and take the search list into account + * The search algorithm is as follows: + * If the name is absolute, try it as-is, otherwise apply the search list + * \param[in] *r operate using this resolver + * \param[in] *rdf query for this name + * \param[in] t query for this type (may be 0, defaults to A) + * \param[in] c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + */ +ldns_pkt* ldns_resolver_search(const ldns_resolver *r, const ldns_rdf *rdf, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + +/** + * Form a query packet from a resolver and name/type/class combo + * \param[out] **q a pointer to a ldns_pkt pointer (initialized by this function) + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] t query for this type (may be 0, defaults to A) + * \param[in] c query for this class (may be 0, default to IN) + * \param[in] f the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + */ +ldns_status ldns_resolver_prepare_query_pkt(ldns_pkt **q, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t f); + +/** + * Send the query for name as-is + * \param[out] **answer a pointer to a ldns_pkt pointer (initialized by this function) + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] t query for this type (may be 0, defaults to A) + * \param[in] c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + */ +ldns_status ldns_resolver_send(ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + +/** + * Send the given packet to a nameserver + * \param[out] **answer a pointer to a ldns_pkt pointer (initialized by this function) + * \param[in] *r operate using this resolver + * \param[in] *query_pkt query + */ +ldns_status ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, ldns_pkt *query_pkt); + +/** + * Send a query to a nameserver + * \param[in] *r operate using this resolver + * \param[in] *name query for this name + * \param[in] *t query for this type (may be 0, defaults to A) + * \param[in] *c query for this class (may be 0, default to IN) + * \param[in] flags the query flags + * \return ldns_pkt* a packet with the reply from the nameserver + * if _defnames is true the default domain will be added + */ +ldns_pkt* ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags); + + +/** + * Create a new resolver structure + * \return ldns_resolver* pointer to new strcture + */ +ldns_resolver* ldns_resolver_new(void); + +/** + * Create a resolver structure from a file like /etc/resolv.conf + * \param[out] r the new resolver + * \param[in] fp file pointer to create new resolver from + * if NULL use /etc/resolv.conf + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_resolver_new_frm_fp(ldns_resolver **r, FILE *fp); + +/** + * Create a resolver structure from a file like /etc/resolv.conf + * \param[out] r the new resolver + * \param[in] fp file pointer to create new resolver from + * if NULL use /etc/resolv.conf + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_resolver_new_frm_fp_l(ldns_resolver **r, FILE *fp, int *line_nr); + +/** + * Configure a resolver by means of a resolv.conf file + * The file may be NULL in which case there will be + * looked the RESOLV_CONF (defaults to /etc/resolv.conf + * \param[out] r the new resolver + * \param[in] filename the filename to use + * \return LDNS_STATUS_OK or the error + */ +ldns_status ldns_resolver_new_frm_file(ldns_resolver **r, const char *filename); + +/** + * Frees the allocated space for this resolver. Only frees the resolver pionter! You should probably be using _deep_free. + * \param res resolver to free + */ +void ldns_resolver_free(ldns_resolver *res); + +/** + * Frees the allocated space for this resolver and all it's data + * \param res resolver to free + */ +void ldns_resolver_deep_free(ldns_resolver *res); + +/** + * Get the next stream of RRs in a AXFR + * \param[in] resolver the resolver to use. First ldns_axfr_start() must be + * called + * \return ldns_rr the next RR from the AXFR stream + * After you get this returned RR (not NULL: on error), then check if + * ldns_axfr_complete() is true to see if the zone transfer has completed. + */ +ldns_rr* ldns_axfr_next(ldns_resolver *resolver); + +/** + * Returns true if the axfr transfer has completed (i.e. 2 SOA RRs and no errors were encountered + * \param[in] resolver the resolver that is used + * \return bool true if axfr transfer was completed without error + */ +bool ldns_axfr_complete(const ldns_resolver *resolver); + +/** + * Returns a pointer to the last ldns_pkt that was sent by the server in the AXFR transfer + * uasable for instance to get the error code on failure + * \param[in] res the resolver that was used in the axfr transfer + * \return ldns_pkt the last packet sent + */ +ldns_pkt *ldns_axfr_last_pkt(const ldns_resolver *res); + +/** + * Randomize the nameserver list in the resolver + * \param[in] r the resolver + */ +void ldns_resolver_nameservers_randomize(ldns_resolver *r); + +/** + * Returns true if at least one of the provided keys is a trust anchor + * \param[in] r the current resolver + * \param[in] keys the keyset to check + * \param[out] trusted_keys the subset of trusted keys in the 'keys' rrset + * \return true if at least one of the provided keys is a configured trust anchor + */ +bool ldns_resolver_trusted_key(const ldns_resolver *r, ldns_rr_list * keys, ldns_rr_list * trusted_keys); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RESOLVER_H */ diff --git a/libs/ldns/ldns/rr.h b/libs/ldns/ldns/rr.h new file mode 100644 index 0000000000..86e31de1f2 --- /dev/null +++ b/libs/ldns/ldns/rr.h @@ -0,0 +1,885 @@ +/* + * rr.h - resource record definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains the definition of ldns_rr and functions to manipulate those. + */ + + +#ifndef LDNS_RR_H +#define LDNS_RR_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** Maximum length of a dname label */ +#define LDNS_MAX_LABELLEN 63 +/** Maximum length of a complete dname */ +#define LDNS_MAX_DOMAINLEN 255 +/** Maximum number of pointers in 1 dname */ +#define LDNS_MAX_POINTERS 65535 +/** The bytes TTL, CLASS and length use up in an rr */ +#define LDNS_RR_OVERHEAD 10 + +/* The first fields are 'common' and can be referenced instantly */ +#define LDNS_RDATA_FIELD_DESCRIPTORS_COMMON 52 + + + +/** + * The different RR classes. + */ +enum ldns_enum_rr_class +{ + /** the Internet */ + LDNS_RR_CLASS_IN = 1, + /** Chaos class */ + LDNS_RR_CLASS_CH = 3, + /** Hesiod (Dyer 87) */ + LDNS_RR_CLASS_HS = 4, + /** None class, dynamic update */ + LDNS_RR_CLASS_NONE = 254, + /** Any class */ + LDNS_RR_CLASS_ANY = 255, + + LDNS_RR_CLASS_FIRST = 0, + LDNS_RR_CLASS_LAST = 65535, + LDNS_RR_CLASS_COUNT = LDNS_RR_CLASS_LAST - LDNS_RR_CLASS_FIRST + 1 +}; +typedef enum ldns_enum_rr_class ldns_rr_class; + +/** + * Used to specify whether compression is allowed. + */ +enum ldns_enum_rr_compress +{ + /** compression is allowed */ + LDNS_RR_COMPRESS, + LDNS_RR_NO_COMPRESS +}; +typedef enum ldns_enum_rr_compress ldns_rr_compress; + +/** + * The different RR types. + */ +enum ldns_enum_rr_type +{ + /** a host address */ + LDNS_RR_TYPE_A = 1, + /** an authoritative name server */ + LDNS_RR_TYPE_NS = 2, + /** a mail destination (Obsolete - use MX) */ + LDNS_RR_TYPE_MD = 3, + /** a mail forwarder (Obsolete - use MX) */ + LDNS_RR_TYPE_MF = 4, + /** the canonical name for an alias */ + LDNS_RR_TYPE_CNAME = 5, + /** marks the start of a zone of authority */ + LDNS_RR_TYPE_SOA = 6, + /** a mailbox domain name (EXPERIMENTAL) */ + LDNS_RR_TYPE_MB = 7, + /** a mail group member (EXPERIMENTAL) */ + LDNS_RR_TYPE_MG = 8, + /** a mail rename domain name (EXPERIMENTAL) */ + LDNS_RR_TYPE_MR = 9, + /** a null RR (EXPERIMENTAL) */ + LDNS_RR_TYPE_NULL = 10, + /** a well known service description */ + LDNS_RR_TYPE_WKS = 11, + /** a domain name pointer */ + LDNS_RR_TYPE_PTR = 12, + /** host information */ + LDNS_RR_TYPE_HINFO = 13, + /** mailbox or mail list information */ + LDNS_RR_TYPE_MINFO = 14, + /** mail exchange */ + LDNS_RR_TYPE_MX = 15, + /** text strings */ + LDNS_RR_TYPE_TXT = 16, + /** RFC1183 */ + LDNS_RR_TYPE_RP = 17, + /** RFC1183 */ + LDNS_RR_TYPE_AFSDB = 18, + /** RFC1183 */ + LDNS_RR_TYPE_X25 = 19, + /** RFC1183 */ + LDNS_RR_TYPE_ISDN = 20, + /** RFC1183 */ + LDNS_RR_TYPE_RT = 21, + /** RFC1706 */ + LDNS_RR_TYPE_NSAP = 22, + /** RFC1348 */ + LDNS_RR_TYPE_NSAP_PTR = 23, + /** 2535typecode */ + LDNS_RR_TYPE_SIG = 24, + /** 2535typecode */ + LDNS_RR_TYPE_KEY = 25, + /** RFC2163 */ + LDNS_RR_TYPE_PX = 26, + /** RFC1712 */ + LDNS_RR_TYPE_GPOS = 27, + /** ipv6 address */ + LDNS_RR_TYPE_AAAA = 28, + /** LOC record RFC1876 */ + LDNS_RR_TYPE_LOC = 29, + /** 2535typecode */ + LDNS_RR_TYPE_NXT = 30, + /** draft-ietf-nimrod-dns-01.txt */ + LDNS_RR_TYPE_EID = 31, + /** draft-ietf-nimrod-dns-01.txt */ + LDNS_RR_TYPE_NIMLOC = 32, + /** SRV record RFC2782 */ + LDNS_RR_TYPE_SRV = 33, + /** http://www.jhsoft.com/rfc/af-saa-0069.000.rtf */ + LDNS_RR_TYPE_ATMA = 34, + /** RFC2915 */ + LDNS_RR_TYPE_NAPTR = 35, + /** RFC2230 */ + LDNS_RR_TYPE_KX = 36, + /** RFC2538 */ + LDNS_RR_TYPE_CERT = 37, + /** RFC2874 */ + LDNS_RR_TYPE_A6 = 38, + /** RFC2672 */ + LDNS_RR_TYPE_DNAME = 39, + /** dnsind-kitchen-sink-02.txt */ + LDNS_RR_TYPE_SINK = 40, + /** Pseudo OPT record... */ + LDNS_RR_TYPE_OPT = 41, + /** RFC3123 */ + LDNS_RR_TYPE_APL = 42, + /** draft-ietf-dnsext-delegation */ + LDNS_RR_TYPE_DS = 43, + /** SSH Key Fingerprint */ + LDNS_RR_TYPE_SSHFP = 44, + /** draft-richardson-ipseckey-rr-11.txt */ + LDNS_RR_TYPE_IPSECKEY = 45, + /** draft-ietf-dnsext-dnssec-25 */ + LDNS_RR_TYPE_RRSIG = 46, + LDNS_RR_TYPE_NSEC = 47, + LDNS_RR_TYPE_DNSKEY = 48, + LDNS_RR_TYPE_DHCID = 49, + + LDNS_RR_TYPE_NSEC3 = 50, + LDNS_RR_TYPE_NSEC3PARAMS = 51, + + /** draft-ietf-dnsop-trust-history */ + LDNS_RR_TYPE_TALINK = 58, + + LDNS_RR_TYPE_SPF = 99, + + LDNS_RR_TYPE_UINFO = 100, + LDNS_RR_TYPE_UID = 101, + LDNS_RR_TYPE_GID = 102, + LDNS_RR_TYPE_UNSPEC = 103, + + LDNS_RR_TYPE_TSIG = 250, + LDNS_RR_TYPE_IXFR = 251, + LDNS_RR_TYPE_AXFR = 252, + /** A request for mailbox-related records (MB, MG or MR) */ + LDNS_RR_TYPE_MAILB = 253, + /** A request for mail agent RRs (Obsolete - see MX) */ + LDNS_RR_TYPE_MAILA = 254, + /** any type (wildcard) */ + LDNS_RR_TYPE_ANY = 255, + + /* RFC 4431, 5074, DNSSEC Lookaside Validation */ + LDNS_RR_TYPE_DLV = 32769, + + /* type codes from nsec3 experimental phase + LDNS_RR_TYPE_NSEC3 = 65324, + LDNS_RR_TYPE_NSEC3PARAMS = 65325, */ + LDNS_RR_TYPE_FIRST = 0, + LDNS_RR_TYPE_LAST = 65535, + LDNS_RR_TYPE_COUNT = LDNS_RR_TYPE_LAST - LDNS_RR_TYPE_FIRST + 1 +}; +typedef enum ldns_enum_rr_type ldns_rr_type; + +/** + * Resource Record + * + * This is the basic DNS element that contains actual data + * + * From RFC1035: + *
+3.2.1. Format
+
+All RRs have the same top level format shown below:
+
+                                    1  1  1  1  1  1
+      0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                                               |
+    /                                               /
+    /                      NAME                     /
+    |                                               |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                      TYPE                     |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                     CLASS                     |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                      TTL                      |
+    |                                               |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+    |                   RDLENGTH                    |
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--|
+    /                     RDATA                     /
+    /                                               /
+    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
+
+where:
+
+NAME            an owner name, i.e., the name of the node to which this
+                resource record pertains.
+
+TYPE            two octets containing one of the RR TYPE codes.
+
+CLASS           two octets containing one of the RR CLASS codes.
+
+TTL             a 32 bit signed integer that specifies the time interval
+                that the resource record may be cached before the source
+                of the information should again be consulted.  Zero
+                values are interpreted to mean that the RR can only be
+                used for the transaction in progress, and should not be
+                cached.  For example, SOA records are always distributed
+                with a zero TTL to prohibit caching.  Zero values can
+                also be used for extremely volatile data.
+
+RDLENGTH        an unsigned 16 bit integer that specifies the length in
+                octets of the RDATA field.
+
+RDATA           a variable length string of octets that describes the
+                resource.  The format of this information varies
+                according to the TYPE and CLASS of the resource record.
+ * 
+ * + * The actual amount and type of rdata fields depend on the RR type of the + * RR, and can be found by using \ref ldns_rr_descriptor functions. + */ +struct ldns_struct_rr +{ + /** Owner name, uncompressed */ + ldns_rdf *_owner; + /** Time to live */ + uint32_t _ttl; + /** Number of data fields */ + size_t _rd_count; + /** the type of the RR. A, MX etc. */ + ldns_rr_type _rr_type; + /** Class of the resource record. */ + ldns_rr_class _rr_class; + /* everything in the rdata is in network order */ + /** The array of rdata's */ + ldns_rdf **_rdata_fields; + /** question rr [it would be nicer if thous is after _rd_count] + ABI change: Fix this in next major release + */ + bool _rr_question; +}; +typedef struct ldns_struct_rr ldns_rr; + +/** + * List or Set of Resource Records + * + * Contains a list of rr's
+ * No official RFC-like checks are made + */ +struct ldns_struct_rr_list +{ + size_t _rr_count; + size_t _rr_capacity; + ldns_rr **_rrs; +}; +typedef struct ldns_struct_rr_list ldns_rr_list; + +/** + * Contains all information about resource record types. + * + * This structure contains, for all rr types, the rdata fields that are defined. + */ +struct ldns_struct_rr_descriptor +{ + /** Type of the RR that is described here */ + ldns_rr_type _type; + /** Textual name of the RR type. */ + const char *_name; + /** Minimum number of rdata fields in the RRs of this type. */ + uint8_t _minimum; + /** Maximum number of rdata fields in the RRs of this type. */ + uint8_t _maximum; + /** Wireformat specification for the rr, i.e. the types of rdata fields in their respective order. */ + const ldns_rdf_type *_wireformat; + /** Special rdf types */ + ldns_rdf_type _variable; + /** Specifies whether compression can be used for dnames in this RR type. */ + ldns_rr_compress _compress; + /** The number of DNAMEs in the _wireformat string, for parsing. */ + uint8_t _dname_count; +}; +typedef struct ldns_struct_rr_descriptor ldns_rr_descriptor; + +/** + * creates a new rr structure. + * \return ldns_rr * + */ +ldns_rr* ldns_rr_new(void); + +/** + * creates a new rr structure, based on the given type. + * alloc enough space to hold all the rdf's + */ +ldns_rr* ldns_rr_new_frm_type(ldns_rr_type t); + +/** + * frees an RR structure + * \param[in] *rr the RR to be freed + * \return void + */ +void ldns_rr_free(ldns_rr *rr); + +/** + * creates an rr from a string. + * The string should be a fully filled-in rr, like + * ownername <space> TTL <space> CLASS <space> + * TYPE <space> RDATA. + * \param[out] n the rr to return + * \param[in] str the string to convert + * \param[in] default_ttl default ttl value for the rr. + * If 0 DEF_TTL will be used + * \param[in] origin when the owner is relative add this. + * The caller must ldns_rdf_deep_free it. + * \param[out] prev the previous ownername. if this value is not NULL, + * the function overwrites this with the ownername found in this + * string. The caller must then ldns_rdf_deep_free it. + * \return a status msg describing an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_frm_str(ldns_rr **n, const char *str, + uint32_t default_ttl, ldns_rdf *origin, + ldns_rdf **prev); + +/** + * creates an rr for the question section from a string, i.e. + * without RDATA fields + * Origin and previous RR functionality are the same as in + * ldns_rr_new_frm_str() + * \param[out] n the rr to return + * \param[in] str the string to convert + * \param[in] origin when the owner is relative add this. + * The caller must ldns_rdf_deep_free it. + * \param prev the previous ownername. the function overwrite this with + * the current found ownername. The caller must ldns_rdf_deep_free it. + * \return a status msg describing an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_question_frm_str(ldns_rr **n, const char *str, + ldns_rdf *origin, ldns_rdf **prev); + +/** + * creates a new rr from a file containing a string. + * \param[out] rr the new rr + * \param[in] fp the file pointer to use + * \param[in] default_ttl pointer to a default ttl for the rr. If NULL DEF_TTL will be used + * the pointer will be updated if the file contains a $TTL directive + * \param[in] origin when the owner is relative add this + * the pointer will be updated if the file contains a $ORIGIN directive + * The caller must ldns_rdf_deep_free it. + * \param[in] prev when the owner is whitespaces use this as the * ownername + * the pointer will be updated after the call + * The caller must ldns_rdf_deep_free it. + * \return a ldns_status with an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_frm_fp(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev); + +/** + * creates a new rr from a file containing a string. + * \param[out] rr the new rr + * \param[in] fp the file pointer to use + * \param[in] default_ttl a default ttl for the rr. If NULL DEF_TTL will be used + * the pointer will be updated if the file contains a $TTL directive + * \param[in] origin when the owner is relative add this + * the pointer will be updated if the file contains a $ORIGIN directive + * The caller must ldns_rdf_deep_free it. + * \param[in] line_nr pointer to an integer containing the current line number (for debugging purposes) + * \param[in] prev when the owner is whitespaces use this as the * ownername + * the pointer will be updated after the call + * The caller must ldns_rdf_deep_free it. + * \return a ldns_status with an error or LDNS_STATUS_OK + */ +ldns_status ldns_rr_new_frm_fp_l(ldns_rr **rr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr); + +/** + * sets the owner in the rr structure. + * \param[in] *rr rr to operate on + * \param[in] *owner set to this owner + * \return void + */ +void ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner); + +/** + * sets the question flag in the rr structure. + * \param[in] *rr rr to operate on + * \param[in] question question flag + * \return void + */ +void ldns_rr_set_question(ldns_rr *rr, bool question); + +/** + * sets the ttl in the rr structure. + * \param[in] *rr rr to operate on + * \param[in] ttl set to this ttl + * \return void + */ +void ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl); + +/** + * sets the rd_count in the rr. + * \param[in] *rr rr to operate on + * \param[in] count set to this count + * \return void + */ +void ldns_rr_set_rd_count(ldns_rr *rr, size_t count); + +/** + * sets the type in the rr. + * \param[in] *rr rr to operate on + * \param[in] rr_type set to this type + * \return void + */ +void ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type); + +/** + * sets the class in the rr. + * \param[in] *rr rr to operate on + * \param[in] rr_class set to this class + * \return void + */ +void ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class); + +/** + * sets a rdf member, it will be set on the + * position given. The old value is returned, like pop. + * \param[in] *rr the rr to operate on + * \param[in] *f the rdf to set + * \param[in] position the position the set the rdf + * \return the old value in the rr, NULL on failyre + */ +ldns_rdf* ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position); + +/** + * sets rd_field member, it will be + * placed in the next available spot. + * \param[in] *rr rr to operate on + * \param[in] *f the data field member to set + * \return bool + */ +bool ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f); + +/** + * removes a rd_field member, it will be + * popped from the last position. + * \param[in] *rr rr to operate on + * \return rdf which was popped (null if nothing) + */ +ldns_rdf* ldns_rr_pop_rdf(ldns_rr *rr); + +/** + * returns the rdata field member counter. + * \param[in] *rr rr to operate on + * \param[in] nr the number of the rdf to return + * \return ldns_rdf * + */ +ldns_rdf* ldns_rr_rdf(const ldns_rr *rr, size_t nr); + +/** + * returns the owner name of an rr structure. + * \param[in] *rr rr to operate on + * \return ldns_rdf * + */ +ldns_rdf* ldns_rr_owner(const ldns_rr *rr); + +/** + * returns the question flag of an rr structure. + * \param[in] *rr rr to operate on + * \return bool true if question + */ +bool ldns_rr_is_question(const ldns_rr *rr); + +/** + * returns the ttl of an rr structure. + * \param[in] *rr the rr to read from + * \return the ttl of the rr + */ +uint32_t ldns_rr_ttl(const ldns_rr *rr); + +/** + * returns the rd_count of an rr structure. + * \param[in] *rr the rr to read from + * \return the rd count of the rr + */ +size_t ldns_rr_rd_count(const ldns_rr *rr); + +/** + * returns the type of the rr. + * \param[in] *rr the rr to read from + * \return the type of the rr + */ +ldns_rr_type ldns_rr_get_type(const ldns_rr *rr); + +/** + * returns the class of the rr. + * \param[in] *rr the rr to read from + * \return the class of the rr + */ +ldns_rr_class ldns_rr_get_class(const ldns_rr *rr); + +/* rr_lists */ + +/** + * returns the number of rr's in an rr_list. + * \param[in] rr_list the rr_list to read from + * \return the number of rr's + */ +size_t ldns_rr_list_rr_count(const ldns_rr_list *rr_list); + +/** + * sets the number of rr's in an rr_list. + * \param[in] rr_list the rr_list to set the count on + * \param[in] count the number of rr in this list + * \return void + */ +void ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count); + +/** + * set a rr on a specific index in a ldns_rr_list + * \param[in] rr_list the rr_list to use + * \param[in] r the rr to set + * \param[in] count index into the rr_list + * \return the old rr which was stored in the rr_list, or + * NULL is the index was too large + * set a specific rr */ +ldns_rr * ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count); + +/** + * returns a specific rr of an rrlist. + * \param[in] rr_list the rr_list to read from + * \param[in] nr return this rr + * \return the rr at position nr + */ +ldns_rr* ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr); + +/** + * creates a new rr_list structure. + * \return a new rr_list structure + */ +ldns_rr_list* ldns_rr_list_new(); + +/** + * frees an rr_list structure. + * \param[in] rr_list the list to free + */ +void ldns_rr_list_free(ldns_rr_list *rr_list); + +/** + * frees an rr_list structure and all rrs contained therein. + * \param[in] rr_list the list to free + */ +void ldns_rr_list_deep_free(ldns_rr_list *rr_list); + +/** + * concatenates two ldns_rr_lists together. This modifies + * *left (to extend it and add the pointers from *right). + * \param[in] left the leftside + * \param[in] right the rightside + * \return a left with right concatenated to it + */ +bool ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right); + +/** + * concatenates two ldns_rr_lists together, but makes clones of the rr's + * (instead of pointer copying). + * \param[in] left the leftside + * \param[in] right the rightside + * \return a new rr_list with leftside/rightside concatenated + */ +ldns_rr_list* ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right); + +/** + * pushes an rr to an rrlist. + * \param[in] rr_list the rr_list to push to + * \param[in] rr the rr to push + * \return false on error, otherwise true + */ +bool ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr); + +/** + * pushes an rr_list to an rrlist. + * \param[in] rr_list the rr_list to push to + * \param[in] push_list the rr_list to push + * \return false on error, otherwise true + */ +bool ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list); + +/** + * pops the last rr from an rrlist. + * \param[in] rr_list the rr_list to pop from + * \return NULL if nothing to pop. Otherwise the popped RR + */ +ldns_rr* ldns_rr_list_pop_rr(ldns_rr_list *rr_list); + +/** + * pops an rr_list of size s from an rrlist. + * \param[in] rr_list the rr_list to pop from + * \param[in] size the number of rr's to pop + * \return NULL if nothing to pop. Otherwise the popped rr_list + */ +ldns_rr_list* ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t size); + +/** + * returns true if the given rr is one of the rrs in the + * list, or if it is equal to one + * \param[in] rr_list the rr_list to check + * \param[in] rr the rr to check + * \return true if rr_list contains rr, false otherwise + */ +bool ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr); + +/** + * checks if an rr_list is a rrset. + * \param[in] rr_list the rr_list to check + * \return true if it is an rrset otherwise false + */ +bool ldns_is_rrset(ldns_rr_list *rr_list); + +/** + * pushes an rr to an rrset (which really are rr_list's). + * \param[in] *rr_list the rrset to push the rr to + * \param[in] *rr the rr to push + * \return true if the push succeeded otherwise false + */ +bool ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr); + +/** + * pops the last rr from an rrset. This function is there only + * for the symmetry. + * \param[in] rr_list the rr_list to pop from + * \return NULL if nothing to pop. Otherwise the popped RR + * + */ +ldns_rr* ldns_rr_set_pop_rr(ldns_rr_list *rr_list); + +/** + * pops the first rrset from the list, + * the list must be sorted, so that all rr's from each rrset + * are next to each other + */ +ldns_rr_list *ldns_rr_list_pop_rrset(ldns_rr_list *rr_list); + + +/** + * retrieves a rrtype by looking up its name. + * \param[in] name a string with the name + * \return the type which corresponds with the name + */ +ldns_rr_type ldns_get_rr_type_by_name(const char *name); + +/** + * retrieves a class by looking up its name. + * \param[in] name string with the name + * \return the cass which corresponds with the name + */ +ldns_rr_class ldns_get_rr_class_by_name(const char *name); + +/** + * clones a rr and all its data + * \param[in] rr the rr to clone + * \return the new rr or NULL on failure + */ +ldns_rr* ldns_rr_clone(const ldns_rr *rr); + +/** + * clones an rrlist. + * \param[in] rrlist the rrlist to clone + * \return the cloned rr list + */ +ldns_rr_list* ldns_rr_list_clone(const ldns_rr_list *rrlist); + +/** + * sorts an rr_list (canonical wire format). the sorting is done inband. + * \param[in] unsorted the rr_list to be sorted + * \return void + */ +void ldns_rr_list_sort(ldns_rr_list *unsorted); + +/** + * compares two rrs. The TTL is not looked at. + * \param[in] rr1 the first one + * \param[in] rr2 the second one + * \return 0 if equal + * -1 if rr1 comes before rr2 + * +1 if rr2 comes before rr1 + */ +int ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2); + +/** + * compares two rrs, up to the rdata. + * \param[in] rr1 the first one + * \param[in] rr2 the second one + * \return 0 if equal + * -1 if rr1 comes before rr2 + * +1 if rr2 comes before rr1 + */ +int ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2); + +/** + * compares the wireformat of two rrs, contained in the given buffers. + * \param[in] rr1_buf the first one + * \param[in] rr2_buf the second one + * \return 0 if equal + * -1 if rr1_buf comes before rr2_buf + * +1 if rr2_buf comes before rr1_buf + */ +int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf); + +/** + * returns true of the given rr's are equal. + * Also returns true if one record is a DS that represents the + * same DNSKEY record as the other record + * \param[in] rr1 the first rr + * \param[in] rr2 the second rr + * \return true if equal otherwise false + */ +bool ldns_rr_compare_ds(const ldns_rr *rr1, const ldns_rr *rr2); + +/** + * compares two rr listss. + * \param[in] rrl1 the first one + * \param[in] rrl2 the second one + * \return 0 if equal + * -1 if rrl1 comes before rrl2 + * +1 if rrl2 comes before rrl1 + */ +int ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2); + +/** + * calculates the uncompressed size of an RR. + * \param[in] r the rr to operate on + * \return size of the rr + */ +size_t ldns_rr_uncompressed_size(const ldns_rr *r); + +/** + * converts each dname in a rr to its canonical form. + * \param[in] rr the rr to work on + * \return void + */ +void ldns_rr2canonical(ldns_rr *rr); + +/** + * converts each dname in each rr in a rr_list to its canonical form. + * \param[in] rr_list the rr_list to work on + * \return void + */ +void ldns_rr_list2canonical(ldns_rr_list *rr_list); + +/** + * counts the number of labels of the ownername. + * \param[in] rr count the labels of this rr + * \return the number of labels + */ +uint8_t ldns_rr_label_count(ldns_rr *rr); + +/** + * returns the resource record descriptor for the given rr type. + * + * \param[in] type the type value of the rr type + *\return the ldns_rr_descriptor for this type + */ +const ldns_rr_descriptor *ldns_rr_descript(uint16_t type); + +/** + * returns the minimum number of rdata fields of the rr type this descriptor describes. + * + * \param[in] descriptor for an rr type + * \return the minimum number of rdata fields + */ +size_t ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor); + +/** + * returns the maximum number of rdata fields of the rr type this descriptor describes. + * + * \param[in] descriptor for an rr type + * \return the maximum number of rdata fields + */ +size_t ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor); + +/** + * returns the rdf type for the given rdata field number of the rr type for the given descriptor. + * + * \param[in] descriptor for an rr type + * \param[in] field the field number + * \return the rdf type for the field + */ +ldns_rdf_type ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, size_t field); + +/** + * Return the rr_list which matches the rdf at position field. Think + * type-covered stuff for RRSIG + * + * \param[in] l the rr_list to look in + * \param[in] r the rdf to use for the comparison + * \param[in] pos at which position can we find the rdf + * + * \return a new rr list with only the RRs that match + * + */ +ldns_rr_list *ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos); + +/** + * convert an rdf of type LDNS_RDF_TYPE_TYPE to an actual + * LDNS_RR_TYPE. This is usefull in the case when inspecting + * the rrtype covered field of an RRSIG. + * \param[in] rd the rdf to look at + * \return a ldns_rr_type with equivalent LDNS_RR_TYPE + * + */ +ldns_rr_type ldns_rdf2rr_type(const ldns_rdf *rd); + +/** + * Returns the type of the first element of the RR + * If there are no elements present, 0 is returned + * + * \param[in] rr_list The rr list + * \return rr_type of the first element, or 0 if the list is empty + */ +ldns_rr_type +ldns_rr_list_type(const ldns_rr_list *rr_list); + +/** + * Returns the owner domain name rdf of the first element of the RR + * If there are no elements present, NULL is returned + * + * \param[in] rr_list The rr list + * \return dname of the first element, or NULL if the list is empty + */ +ldns_rdf * +ldns_rr_list_owner(const ldns_rr_list *rr_list); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RR_H */ diff --git a/libs/ldns/ldns/rr_functions.h b/libs/ldns/ldns/rr_functions.h new file mode 100644 index 0000000000..635a1256f3 --- /dev/null +++ b/libs/ldns/ldns/rr_functions.h @@ -0,0 +1,259 @@ +/* + * rr_functions.h + * + * the .h file with defs for the per rr + * functions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ +#ifndef LDNS_RR_FUNCTIONS_H +#define LDNS_RR_FUNCTIONS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file + * + * Defines some extra convenience functions for ldns_rr structures + */ + +/* A / AAAA */ +/** + * returns the address of a LDNS_RR_TYPE_A rr + * \param[in] r the resource record + * \return a ldns_rdf* with the address or NULL on failure + */ +ldns_rdf* ldns_rr_a_address(const ldns_rr *r); + +/** + * sets the address of a LDNS_RR_TYPE_A rr + * \param[in] r the rr to use + * \param[in] f the address to set + * \return true on success, false otherwise + */ +bool ldns_rr_a_set_address(ldns_rr *r, ldns_rdf *f); + +/* NS */ +/** + * returns the name of a LDNS_RR_TYPE_NS rr + * \param[in] r the resource record + * \return a ldns_rdf* with the name or NULL on failure + */ +ldns_rdf* ldns_rr_ns_nsdname(const ldns_rr *r); + +/* MX */ +/** + * returns the mx pref. of a LDNS_RR_TYPE_MX rr + * \param[in] r the resource record + * \return a ldns_rdf* with the preference or NULL on failure + */ +ldns_rdf* ldns_rr_mx_preference(const ldns_rr *r); +/** + * returns the mx host of a LDNS_RR_TYPE_MX rr + * \param[in] r the resource record + * \return a ldns_rdf* with the name of the MX host or NULL on failure + */ +ldns_rdf* ldns_rr_mx_exchange(const ldns_rr *r); + +/* RRSIG */ +/** + * returns the type covered of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the resource record + * \return a ldns_rdf* with the type covered or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_typecovered(const ldns_rr *r); +/** + * sets the typecovered of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the typecovered to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_typecovered(ldns_rr *r, ldns_rdf *f); +/** + * returns the algorithm of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the algorithm or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_algorithm(const ldns_rr *r); +/** + * sets the algorithm of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the algorithm to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_algorithm(ldns_rr *r, ldns_rdf *f); +/** + * returns the number of labels of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the number of labels or NULL on failure + */ +ldns_rdf *ldns_rr_rrsig_labels(const ldns_rr *r); +/** + * sets the number of labels of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the number of labels to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_labels(ldns_rr *r, ldns_rdf *f); +/** + * returns the original TTL of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the original TTL or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_origttl(const ldns_rr *r); +/** + * sets the original TTL of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the original TTL to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_origttl(ldns_rr *r, ldns_rdf *f); +/** + * returns the expiration time of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the expiration time or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_expiration(const ldns_rr *r); +/** + * sets the expireation date of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the expireation date to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_expiration(ldns_rr *r, ldns_rdf *f); +/** + * returns the inception time of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the inception time or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_inception(const ldns_rr *r); +/** + * sets the inception date of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the inception date to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_inception(ldns_rr *r, ldns_rdf *f); +/** + * returns the keytag of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the keytag or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_keytag(const ldns_rr *r); +/** + * sets the keytag of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the keytag to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_keytag(ldns_rr *r, ldns_rdf *f); +/** + * returns the signers name of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the signers name or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_signame(const ldns_rr *r); +/** + * sets the signers name of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the signers name to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_signame(ldns_rr *r, ldns_rdf *f); +/** + * returns the signature data of a LDNS_RR_TYPE_RRSIG RR + * \param[in] r the resource record + * \return a ldns_rdf* with the signature data or NULL on failure + */ +ldns_rdf* ldns_rr_rrsig_sig(const ldns_rr *r); +/** + * sets the signature data of a LDNS_RR_TYPE_RRSIG rr + * \param[in] r the rr to use + * \param[in] f the signature data to set + * \return true on success, false otherwise + */ +bool ldns_rr_rrsig_set_sig(ldns_rr *r, ldns_rdf *f); + +/* DNSKEY */ +/** + * returns the flags of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the flags or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_flags(const ldns_rr *r); +/** + * sets the flags of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the flags to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_flags(ldns_rr *r, ldns_rdf *f); +/** + * returns the protocol of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the protocol or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_protocol(const ldns_rr *r); +/** + * sets the protocol of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the protocol to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_protocol(ldns_rr *r, ldns_rdf *f); +/** + * returns the algorithm of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the algorithm or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_algorithm(const ldns_rr *r); +/** + * sets the algorithm of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the algorithm to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_algorithm(ldns_rr *r, ldns_rdf *f); +/** + * returns the key data of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the resource record + * \return a ldns_rdf* with the key data or NULL on failure + */ +ldns_rdf* ldns_rr_dnskey_key(const ldns_rr *r); +/** + * sets the key data of a LDNS_RR_TYPE_DNSKEY rr + * \param[in] r the rr to use + * \param[in] f the key data to set + * \return true on success, false otherwise + */ +bool ldns_rr_dnskey_set_key(ldns_rr *r, ldns_rdf *f); + +/** + * get the length of the keydata in bits + * \param[in] keydata the raw key data + * \param[in] len the length of the keydata + * \param[in] alg the cryptographic algorithm this is a key for + * \return the keysize in bits, or 0 on error + */ +size_t ldns_rr_dnskey_key_size_raw(const unsigned char *keydata, + const size_t len, + const ldns_algorithm alg); + +/** + * get the length of the keydata in bits + * \param[in] key the key rr to use + * \return the keysize in bits + */ +size_t ldns_rr_dnskey_key_size(const ldns_rr *key); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_RR_FUNCTIONS_H */ diff --git a/libs/ldns/ldns/sha1.h b/libs/ldns/ldns/sha1.h new file mode 100644 index 0000000000..d5b1082e67 --- /dev/null +++ b/libs/ldns/ldns/sha1.h @@ -0,0 +1,38 @@ +#ifndef LDNS_SHA1_H +#define LDNS_SHA1_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define LDNS_SHA1_BLOCK_LENGTH 64 +#define LDNS_SHA1_DIGEST_LENGTH 20 + +typedef struct { + uint32_t state[5]; + uint64_t count; + unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]; +} ldns_sha1_ctx; + +void ldns_sha1_init(ldns_sha1_ctx * context); +void ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]); +void ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len); +void ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA1_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha1(unsigned char *data, unsigned int data_len, unsigned char *digest); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_SHA1_H */ diff --git a/libs/ldns/ldns/sha2.h b/libs/ldns/ldns/sha2.h new file mode 100644 index 0000000000..beb0b6f368 --- /dev/null +++ b/libs/ldns/ldns/sha2.h @@ -0,0 +1,152 @@ +/* + * FILE: sha2.h + * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ + * + * Copyright (c) 2000-2001, Aaron D. Gifford + * All rights reserved. + * + * Modified by Jelte Jansen to fit in ldns, and not clash with any + * system-defined SHA code. + * Changes: + * - Renamed (external) functions and constants to fit ldns style + * - Removed uintXX vs. u_intXX smartness, since ldns needs uintXX + * anyway + * - BYTE ORDER check replaced by simple ifdef as defined or not by + * configure.ac + * - Removed _End and _Data functions + * - Added ldns_shaX(data, len, digest) functions + * + * 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. Neither the name of the copyright holder nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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. + * + * $Id: sha2.h,v 1.1 2001/11/08 00:02:01 adg Exp adg $ + */ + +#ifndef __LDNS_SHA2_H__ +#define __LDNS_SHA2_H__ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * Import u_intXX_t size_t type definitions from system headers. You + * may need to change this, or define these things yourself in this + * file. + * + * (include ldns/config.h so HAVE_INTTYPES is defined (or not, depending + * on the system)) + */ +#include + +#ifdef HAVE_INTTYPES_H + +#include + +#endif /* HAVE_INTTYPES_H */ + + +/*** SHA-256/384/512 Various Length Definitions ***********************/ +#define LDNS_SHA256_BLOCK_LENGTH 64 +#define LDNS_SHA256_DIGEST_LENGTH 32 +#define LDNS_SHA256_DIGEST_STRING_LENGTH (LDNS_SHA256_DIGEST_LENGTH * 2 + 1) +#define LDNS_SHA384_BLOCK_LENGTH 128 +#define LDNS_SHA384_DIGEST_LENGTH 48 +#define LDNS_SHA384_DIGEST_STRING_LENGTH (LDNS_SHA384_DIGEST_LENGTH * 2 + 1) +#define LDNS_SHA512_BLOCK_LENGTH 128 +#define LDNS_SHA512_DIGEST_LENGTH 64 +#define LDNS_SHA512_DIGEST_STRING_LENGTH (LDNS_SHA512_DIGEST_LENGTH * 2 + 1) + + +/*** SHA-256/384/512 Context Structures *******************************/ + +typedef struct _ldns_sha256_CTX { + uint32_t state[8]; + uint64_t bitcount; + uint8_t buffer[LDNS_SHA256_BLOCK_LENGTH]; +} ldns_sha256_CTX; +typedef struct _ldns_sha512_CTX { + uint64_t state[8]; + uint64_t bitcount[2]; + uint8_t buffer[LDNS_SHA512_BLOCK_LENGTH]; +} ldns_sha512_CTX; + +typedef ldns_sha512_CTX ldns_sha384_CTX; + + +/*** SHA-256/384/512 Function Prototypes ******************************/ +void ldns_sha256_init(ldns_sha256_CTX *); +void ldns_sha256_update(ldns_sha256_CTX*, const uint8_t*, size_t); +void ldns_sha256_final(uint8_t[LDNS_SHA256_DIGEST_LENGTH], ldns_sha256_CTX*); + +void ldns_sha384_init(ldns_sha384_CTX*); +void ldns_sha384_update(ldns_sha384_CTX*, const uint8_t*, size_t); +void ldns_sha384_final(uint8_t[LDNS_SHA384_DIGEST_LENGTH], ldns_sha384_CTX*); + +void ldns_sha512_init(ldns_sha512_CTX*); +void ldns_sha512_update(ldns_sha512_CTX*, const uint8_t*, size_t); +void ldns_sha512_final(uint8_t[LDNS_SHA512_DIGEST_LENGTH], ldns_sha512_CTX*); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA256_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha256(unsigned char *data, unsigned int data_len, unsigned char *digest); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA384_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha384(unsigned char *data, unsigned int data_len, unsigned char *digest); + +/** + * Convenience function to digest a fixed block of data at once. + * + * \param[in] data the data to digest + * \param[in] data_len the length of data in bytes + * \param[out] digest the length of data in bytes + * This pointer MUST have LDNS_SHA512_DIGEST_LENGTH bytes + * available + * \return the SHA1 digest of the given data + */ +unsigned char *ldns_sha512(unsigned char *data, unsigned int data_len, unsigned char *digest); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* __LDNS_SHA2_H__ */ diff --git a/libs/ldns/ldns/str2host.h b/libs/ldns/ldns/str2host.h new file mode 100644 index 0000000000..09416cd225 --- /dev/null +++ b/libs/ldns/ldns/str2host.h @@ -0,0 +1,251 @@ +/** + * str2host.h - conversion from str to the host fmt + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_2HOST_H +#define LDNS_2HOST_H + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file + * + * Defines functions to convert dns data in presentation format or text files + * to internal structures. + */ + +/** + * convert a byte into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] bytestr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr); + +/** + * convert a string to a int16 in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] shortstr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr); + +/** + * convert a strings into a 4 byte int in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] longstr the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr); + +/** + * convert a time string to a time value in wireformat + * \param[in] rd the rdf where to put the data + * \param[in] time the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_time(ldns_rdf **rd, const char *time); + +/* convert string with NSEC3 salt to wireformat) + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * return ldns_status + */ +ldns_status ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *nsec3_salt); + +/* convert a time period (think TTL's) to wireformat) + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * return ldns_status + */ +ldns_status ldns_str2rdf_period(ldns_rdf **rd, const char *str); + +/** + * convert str with an A record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_a(ldns_rdf **rd, const char *str); + +/** + * convert the str with an AAAA record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str); + +/** + * convert a string into wireformat (think txt record) + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted (NULL terminated) + * \return ldns_status + */ +ldns_status ldns_str2rdf_str(ldns_rdf **rd, const char *str); + +/** + * convert str with the apl record into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_apl(ldns_rdf **rd, const char *str); + +/** + * convert the string with the b64 data into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_b64(ldns_rdf **rd, const char *str); + +/** + * convert the string with the b32 ext hex data into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str); + +/** + * convert a hex value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_hex(ldns_rdf **rd, const char *str); + +/** + * convert string with nsec into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_nsec(ldns_rdf **rd, const char *str); + +/** + * convert a rrtype into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_type(ldns_rdf **rd, const char *str); + +/** + * convert string with a classname into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_class(ldns_rdf **rd, const char *str); + +/** + * convert an certificate algorithm value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str); + +/** + * convert and algorithm value into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_alg(ldns_rdf **rd, const char *str); + +/** + * convert a string with a unknown RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_unknown(ldns_rdf **rd, const char *str); + +/** + * convert string with a tsig? RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_tsig(ldns_rdf **rd, const char *str); + +/** + * convert string with a protocol service into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_service(ldns_rdf **rd, const char *str); + +/** + * convert a string with a LOC RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_loc(ldns_rdf **rd, const char *str); + +/** + * convert string with a WKS RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_wks(ldns_rdf **rd, const char *str); + +/** + * convert a str with a NSAP RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_nsap(ldns_rdf **rd, const char *str); + +/** + * convert a str with a ATMA RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_atma(ldns_rdf **rd, const char *str); + +/** + * convert a str with a IPSECKEY RR into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str); + +/** + * convert a dname string into wireformat + * \param[in] rd the rdf where to put the data + * \param[in] str the string to be converted + * \return ldns_status + */ +ldns_status ldns_str2rdf_dname(ldns_rdf **rd, const char *str); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_2HOST_H */ diff --git a/libs/ldns/ldns/tsig.h b/libs/ldns/ldns/tsig.h new file mode 100644 index 0000000000..676045fbb6 --- /dev/null +++ b/libs/ldns/ldns/tsig.h @@ -0,0 +1,101 @@ +/* + * tsig.h -- defines for TSIG [RFC2845] + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + */ + +#ifndef LDNS_TSIG_H +#define LDNS_TSIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * \file + * + * Defines functions for TSIG usage + */ + + +/** + * Contains credentials for TSIG +*/ +typedef struct ldns_tsig_credentials_struct +{ + char *algorithm; + char *keyname; + char *keydata; + /* XXX More eventually. */ +} ldns_tsig_credentials; + +char *ldns_tsig_algorithm(ldns_tsig_credentials *); +char *ldns_tsig_keyname(ldns_tsig_credentials *); +char *ldns_tsig_keydata(ldns_tsig_credentials *); +char *ldns_tsig_keyname_clone(ldns_tsig_credentials *); +char *ldns_tsig_keydata_clone(ldns_tsig_credentials *); + +/** + * verifies the tsig rr for the given packet and key. + * The wire must be given too because tsig does not sign normalized packets. + * \param[in] pkt the packet to verify + * \param[in] wire needed to verify the mac + * \param[in] wire_size size of wire + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] mac original mac + * \return true if tsig is correct, false if not, or if tsig is not set + */ +bool ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac); + +/** + * verifies the tsig rr for the given packet and key. + * The wire must be given too because tsig does not sign normalized packets. + * \param[in] pkt the packet to verify + * \param[in] wire needed to verify the mac + * \param[in] wire_size size of wire + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] mac original mac + * \param[in] tsig_timers_only must be zero for the first packet and positive for subsequent packets. If zero, all digest + components are used to verify the _mac. If non-zero, only the TSIG timers are used to verify the mac. + * \return true if tsig is correct, false if not, or if tsig is not set + */ +bool ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wire_size, const char *key_name, const char *key_data, ldns_rdf *mac, + int tsig_timers_only); + +/** + * creates a tsig rr for the given packet and key. + * \param[in] pkt the packet to sign + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] fudge seconds of error permitted in time signed + * \param[in] algorithm_name the name of the algorithm used + * \param[in] query_mac is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers) + * \return status (OK if success) + */ +ldns_status ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, + const char *algorithm_name, ldns_rdf *query_mac); + +/** + * creates a tsig rr for the given packet and key. + * \param[in] pkt the packet to sign + * \param[in] key_name the name of the shared key + * \param[in] key_data the key in base 64 format + * \param[in] fudge seconds of error permitted in time signed + * \param[in] algorithm_name the name of the algorithm used + * \param[in] query_mac is added to the digest if not NULL (so NULL is for signing queries, not NULL is for signing answers) + * \param[in] tsig_timers_only must be zero for the first packet and positive for subsequent packets. If zero, all digest + components are used to create the query_mac. If non-zero, only the TSIG timers are used to create the query_mac. + * \return status (OK if success) + */ +ldns_status ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data, uint16_t fudge, + const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_TSIG_H */ diff --git a/libs/ldns/ldns/update.h b/libs/ldns/ldns/update.h new file mode 100644 index 0000000000..d3459d325e --- /dev/null +++ b/libs/ldns/ldns/update.h @@ -0,0 +1,115 @@ +/* + * update.h + * + * Functions for RFC 2136 Dynamic Update + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + */ + +/** + * \file + * + * Defines functions to perform UPDATE queries + */ + + +#ifndef LDNS_UPDATE_H +#define LDNS_UPDATE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * create an update packet from zone name, class and the rr lists + * \param[in] zone_rdf name of the zone + * \param[in] clas zone class + * \param[in] pr_rrlist list of Prerequisite Section RRs + * \param[in] up_rrlist list of Updates Section RRs + * \param[in] ad_rrlist list of Additional Data Section RRs (currently unused) + * \return the new packet + */ +ldns_pkt *ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class clas, ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist); + +/** + * add tsig credentials to + * a packet from a resolver + * \param[in] p packet to copy to + * \param[in] r resolver to copy from + * + * \return status wether successfull or not + */ +ldns_status ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r); + +/* access functions */ + +/** + * Get the zo count + * \param[in] p the packet + * \return the zo count + */ +uint16_t ldns_update_zocount(const ldns_pkt *p); +/** + * Get the zo count + * \param[in] p the packet + * \return the pr count + */ +uint16_t ldns_update_prcount(const ldns_pkt *p); +/** + * Get the zo count + * \param[in] p the packet + * \return the up count + */ +uint16_t ldns_update_upcount(const ldns_pkt *p); +/** + * Get the zo count + * \param[in] p the packet + * \return the ad count + */ +uint16_t ldns_update_ad(const ldns_pkt *p); +/** + * Set the zo count + * \param[in] p the packet + * \param[in] c the zo count to set + */ +void ldns_update_set_zo(ldns_pkt *p, uint16_t c); +/** + * Set the pr count + * \param[in] p the packet + * \param[in] c the pr count to set + */ +void ldns_update_set_prcount(ldns_pkt *p, uint16_t c); +/** + * Set the up count + * \param[in] p the packet + * \param[in] c the up count to set + */ +void ldns_update_set_upcount(ldns_pkt *p, uint16_t c); +/** + * Set the ad count + * \param[in] p the packet + * \param[in] c the ad count to set + */ +void ldns_update_set_adcount(ldns_pkt *p, uint16_t c); + +/* soa functions that need to be configured */ +/* + * Not sure if we want to keep these like this, therefore + * not documented + */ +ldns_status ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, ldns_rr_class c, ldns_rdf **mname); +/* + * Not sure if we want to keep these like this, therefore + * not documented + */ +ldns_status ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, ldns_rr_class c, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_UPDATE_H */ diff --git a/libs/ldns/ldns/util.h.in b/libs/ldns/ldns/util.h.in new file mode 100644 index 0000000000..e9af95f673 --- /dev/null +++ b/libs/ldns/ldns/util.h.in @@ -0,0 +1,347 @@ +/* + * util.h + * + * helper function header file + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004 + * + * See the file LICENSE for the license + */ + +#ifndef _UTIL_H +#define _UTIL_H + +@include_inttypes_h@ +@include_systypes_h@ +@include_unistd_h@ +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define dprintf(X,Y) fprintf(stderr, (X), (Y)) +/* #define dprintf(X, Y) */ + +#define LDNS_VERSION "@PACKAGE_VERSION@" +#define LDNS_REVISION ((@LDNS_VERSION_MAJOR@<<16)|(@LDNS_VERSION_MINOR@<<8)|(@LDNS_VERSION_MICRO@)) + +/** + * splint static inline workaround + */ +#ifdef S_SPLINT_S +# define INLINE +#else +# ifdef SWIG +# define INLINE static +# else +# define INLINE static inline +# endif +#endif + +/** + * Memory management macros + */ +#define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1) + +#define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type))) + +#define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1) + +#define LDNS_XREALLOC(ptr, type, count) \ + ((type *) realloc((ptr), (count) * sizeof(type))) + +#define LDNS_FREE(ptr) \ + do { free((ptr)); (ptr) = NULL; } while (0) + +#define LDNS_DEP printf("DEPRECATED FUNCTION!\n"); + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE uint16_t +ldns_read_uint16(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohs(*(uint16_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; +#endif +} + +INLINE uint32_t +ldns_read_uint32(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohl(*(uint32_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ( ((uint32_t) p[0] << 24) + | ((uint32_t) p[1] << 16) + | ((uint32_t) p[2] << 8) + | (uint32_t) p[3]); +#endif +} + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE void +ldns_write_uint16(void *dst, uint16_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint16_t *) dst = htons(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 8) & 0xff); + p[1] = (uint8_t) (data & 0xff); +#endif +} + +INLINE void +ldns_write_uint32(void *dst, uint32_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint32_t *) dst = htonl(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 24) & 0xff); + p[1] = (uint8_t) ((data >> 16) & 0xff); + p[2] = (uint8_t) ((data >> 8) & 0xff); + p[3] = (uint8_t) (data & 0xff); +#endif +} + +/* warning. */ +INLINE void +ldns_write_uint64_as_uint48(void *dst, uint64_t data) +{ + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 40) & 0xff); + p[1] = (uint8_t) ((data >> 32) & 0xff); + p[2] = (uint8_t) ((data >> 24) & 0xff); + p[3] = (uint8_t) ((data >> 16) & 0xff); + p[4] = (uint8_t) ((data >> 8) & 0xff); + p[5] = (uint8_t) (data & 0xff); +} + + +/** + * Structure to do a Schwartzian-like transformation, for instance when + * sorting. If you need a transformation on the objects that are sorted, + * you can sue this to store the transformed values, so you do not + * need to do the transformation again for each comparison + */ +struct ldns_schwartzian_compare_struct { + void *original_object; + void *transformed_object; +}; + +/** A general purpose lookup table + * + * Lookup tables are arrays of (id, name) pairs, + * So you can for instance lookup the RCODE 3, which is "NXDOMAIN", + * and vice versa. The lookup tables themselves are defined wherever needed, + * for instance in \ref host2str.c + */ +struct ldns_struct_lookup_table { + int id; + const char *name; +}; +typedef struct ldns_struct_lookup_table ldns_lookup_table; + +/** + * Looks up the table entry by name, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] name what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[], + const char *name); + +/** + * Looks up the table entry by id, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] id what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id); + +/** + * Returns the value of the specified bit + * The bits are counted from left to right, so bit #0 is the + * left most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return + */ +int ldns_get_bit(uint8_t bits[], size_t index); + + +/** + * Returns the value of the specified bit + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return 1 or 0 depending no the bit state + */ +int ldns_get_bit_r(uint8_t bits[], size_t index); + +/** + * sets the specified bit in the specified byte to + * 1 if value is true, 0 if false + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] byte the bit to set the bit in + * \param[in] bit_nr the bit to set (0 <= n <= 7) + * \param[in] value whether to set the bit to 1 or 0 + * \return 1 or 0 depending no the bit state + */ +void ldns_set_bit(uint8_t *byte, int bit_nr, bool value); + +/** + * Returns the value of a to the power of b + * (or 1 of b < 1) + */ +/*@unused@*/ +INLINE long +ldns_power(long a, long b) { + long result = 1; + while (b > 0) { + if (b & 1) { + result *= a; + if (b == 1) { + return result; + } + } + a *= a; + b /= 2; + } + return result; +} + +/** + * Returns the int value of the given (hex) digit + * \param[in] ch the hex char to convert + * \return the converted decimal value + */ +int ldns_hexdigit_to_int(char ch); + +/** + * Returns the char (hex) representation of the given int + * \param[in] ch the int to convert + * \return the converted hex char + */ +char ldns_int_to_hexdigit(int ch); + +/** + * Converts a hex string to binary data + * + * \param[out] data The binary result is placed here. + * At least strlen(str)/2 bytes should be allocated + * \param[in] str The hex string to convert. + * This string should not contain spaces + * \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number + */ +int +ldns_hexstring_to_data(uint8_t *data, const char *str); + +/** + * Show the internal library version + * \return a string with the version in it + */ +const char * ldns_version(void); + +/** + * Convert TM to seconds since epoch (midnight, January 1st, 1970). + * Like timegm(3), which is not always available. + * \param[in] tm a struct tm* with the date + * \return the seconds since epoch + */ +time_t mktime_from_utc(const struct tm *tm); + +/** + * Seed the random function. + * If the file descriptor is specified, the random generator is seeded with + * data from that file. If not, /dev/urandom is used. + * + * applications should call this if they need entropy data within ldns + * If openSSL is available, it is automatically seeded from /dev/urandom + * or /dev/random. + * + * If you need more entropy, or have no openssl available, this function + * MUST be called at the start of the program + * + * If openssl *is* available, this function just adds more entropy + * + * \param[in] fd a file providing entropy data for the seed + * \param[in] size the number of bytes to use as entropy data. If this is 0, + * only the minimal amount is taken (usually 4 bytes) + * \return 0 if seeding succeeds, 1 if it fails + */ +int ldns_init_random(FILE *fd, unsigned int size); + +/** + * Get random number. + * \return random number. + * + */ +uint16_t ldns_get_random(void); + +/** + * Encode data as BubbleBabble + * + * \param[in] data a pointer to data to be encoded + * \param[in] len size the number of bytes of data + * \return a string of BubbleBabble + */ +char *ldns_bubblebabble(uint8_t *data, size_t len); + +#ifndef B32_NTOP +int ldns_b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_ntop + */ +/*@unused@*/ +INLINE size_t ldns_b32_ntop_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize / 5) * 8) - 2) + 2); + return result; +} +#endif /* !B32_NTOP */ +#ifndef B32_PTON +int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_pton + */ +/*@unused@*/ +INLINE size_t ldns_b32_pton_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize) / 8) * 5)); + return result; +} +#endif /* !B32_PTON */ + +#ifdef __cplusplus +} +#endif + +#endif /* !_UTIL_H */ diff --git a/libs/ldns/ldns/wire2host.h b/libs/ldns/ldns/wire2host.h new file mode 100644 index 0000000000..53155b3066 --- /dev/null +++ b/libs/ldns/ldns/wire2host.h @@ -0,0 +1,197 @@ +/* + * wire2host.h - from wire conversion routines + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Contains functions that translate dns data from the wire format (as sent + * by servers and clients) to the internal structures. + */ + +#ifndef LDNS_WIRE2HOST_H +#define LDNS_WIRE2HOST_H + +#include +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* The length of the header */ +#define LDNS_HEADER_SIZE 12 + +/* First octet of flags */ +#define LDNS_RD_MASK 0x01U +#define LDNS_RD_SHIFT 0 +#define LDNS_RD_WIRE(wirebuf) (*(wirebuf+2) & LDNS_RD_MASK) +#define LDNS_RD_SET(wirebuf) (*(wirebuf+2) |= LDNS_RD_MASK) +#define LDNS_RD_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_RD_MASK) + +#define LDNS_TC_MASK 0x02U +#define LDNS_TC_SHIFT 1 +#define LDNS_TC_WIRE(wirebuf) (*(wirebuf+2) & LDNS_TC_MASK) +#define LDNS_TC_SET(wirebuf) (*(wirebuf+2) |= LDNS_TC_MASK) +#define LDNS_TC_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_TC_MASK) + +#define LDNS_AA_MASK 0x04U +#define LDNS_AA_SHIFT 2 +#define LDNS_AA_WIRE(wirebuf) (*(wirebuf+2) & LDNS_AA_MASK) +#define LDNS_AA_SET(wirebuf) (*(wirebuf+2) |= LDNS_AA_MASK) +#define LDNS_AA_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_AA_MASK) + +#define LDNS_OPCODE_MASK 0x78U +#define LDNS_OPCODE_SHIFT 3 +#define LDNS_OPCODE_WIRE(wirebuf) ((*(wirebuf+2) & LDNS_OPCODE_MASK) >> LDNS_OPCODE_SHIFT) +#define LDNS_OPCODE_SET(wirebuf, opcode) \ + (*(wirebuf+2) = ((*(wirebuf+2)) & ~LDNS_OPCODE_MASK) | ((opcode) << LDNS_OPCODE_SHIFT)) + +#define LDNS_QR_MASK 0x80U +#define LDNS_QR_SHIFT 7 +#define LDNS_QR_WIRE(wirebuf) (*(wirebuf+2) & LDNS_QR_MASK) +#define LDNS_QR_SET(wirebuf) (*(wirebuf+2) |= LDNS_QR_MASK) +#define LDNS_QR_CLR(wirebuf) (*(wirebuf+2) &= ~LDNS_QR_MASK) + +/* Second octet of flags */ +#define LDNS_RCODE_MASK 0x0fU +#define LDNS_RCODE_SHIFT 0 +#define LDNS_RCODE_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RCODE_MASK) +#define LDNS_RCODE_SET(wirebuf, rcode) \ + (*(wirebuf+3) = ((*(wirebuf+3)) & ~LDNS_RCODE_MASK) | (rcode)) + +#define LDNS_CD_MASK 0x10U +#define LDNS_CD_SHIFT 4 +#define LDNS_CD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_CD_MASK) +#define LDNS_CD_SET(wirebuf) (*(wirebuf+3) |= LDNS_CD_MASK) +#define LDNS_CD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_CD_MASK) + +#define LDNS_AD_MASK 0x20U +#define LDNS_AD_SHIFT 5 +#define LDNS_AD_WIRE(wirebuf) (*(wirebuf+3) & LDNS_AD_MASK) +#define LDNS_AD_SET(wirebuf) (*(wirebuf+3) |= LDNS_AD_MASK) +#define LDNS_AD_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_AD_MASK) + +#define LDNS_Z_MASK 0x40U +#define LDNS_Z_SHIFT 6 +#define LDNS_Z_WIRE(wirebuf) (*(wirebuf+3) & LDNS_Z_MASK) +#define LDNS_Z_SET(wirebuf) (*(wirebuf+3) |= LDNS_Z_MASK) +#define LDNS_Z_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_Z_MASK) + +#define LDNS_RA_MASK 0x80U +#define LDNS_RA_SHIFT 7 +#define LDNS_RA_WIRE(wirebuf) (*(wirebuf+3) & LDNS_RA_MASK) +#define LDNS_RA_SET(wirebuf) (*(wirebuf+3) |= LDNS_RA_MASK) +#define LDNS_RA_CLR(wirebuf) (*(wirebuf+3) &= ~LDNS_RA_MASK) + +/* Query ID */ +#define LDNS_ID_WIRE(wirebuf) (ldns_read_uint16(wirebuf)) +#define LDNS_ID_SET(wirebuf, id) (ldns_write_uint16(wirebuf, id)) + +/* Counter of the question section */ +#define LDNS_QDCOUNT_OFF 4 +/* +#define QDCOUNT(wirebuf) (ntohs(*(uint16_t *)(wirebuf+QDCOUNT_OFF))) +*/ +#define LDNS_QDCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_QDCOUNT_OFF)) + +/* Counter of the answer section */ +#define LDNS_ANCOUNT_OFF 6 +#define LDNS_ANCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ANCOUNT_OFF)) + +/* Counter of the authority section */ +#define LDNS_NSCOUNT_OFF 8 +#define LDNS_NSCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_NSCOUNT_OFF)) + +/* Counter of the additional section */ +#define LDNS_ARCOUNT_OFF 10 +#define LDNS_ARCOUNT(wirebuf) (ldns_read_uint16(wirebuf+LDNS_ARCOUNT_OFF)) + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS packet. + * This function will initialize and allocate memory space for the packet + * structure. + * + * \param[in] packet pointer to the structure to hold the packet + * \param[in] data pointer to the buffer with the data + * \param[in] len the length of the data buffer (in bytes) + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2pkt(ldns_pkt **packet, const uint8_t *data, size_t len); + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS packet. + * This function will initialize and allocate memory space for the packet + * structure. + * + * \param[in] packet pointer to the structure to hold the packet + * \param[in] buffer the buffer with the data + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer); + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS + * dname rdata field. This function will initialize and allocate memory + * space for the dname structure. The length of the wiredata of this rdf + * is added to the *pos value. + * + * \param[in] dname pointer to the structure to hold the rdata value + * \param[in] wire pointer to the buffer with the data + * \param[in] max the length of the data buffer (in bytes) + * \param[in] pos the position of the rdf in the buffer (ie. the number of bytes + * from the start of the buffer) + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos); + +/** + * converts the data on the uint8_t bytearray (in wire format) to DNS + * rdata fields, and adds them to the list of rdfs of the given rr. + * This function will initialize and allocate memory space for the dname + * structures. + * The length of the wiredata of these rdfs is added to the *pos value. + * + * All rdfs belonging to the RR are read; the rr should have no rdfs + * yet. An error is returned if the format cannot be parsed. + * + * \param[in] rr pointer to the ldns_rr structure to hold the rdata value + * \param[in] wire pointer to the buffer with the data + * \param[in] max the length of the data buffer (in bytes) + * \param[in] pos the position of the rdf in the buffer (ie. the number of bytes + * from the start of the buffer) + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos); + +/** + * converts the data on the uint8_t bytearray (in wire format) to a DNS + * resource record. + * This function will initialize and allocate memory space for the rr + * structure. + * The length of the wiredata of this rr is added to the *pos value. + * + * \param[in] rr pointer to the structure to hold the rdata value + * \param[in] wire pointer to the buffer with the data + * \param[in] max the length of the data buffer (in bytes) + * \param[in] pos the position of the rr in the buffer (ie. the number of bytes + * from the start of the buffer) + * \param[in] section the section in the packet the rr is meant for + * \return LDNS_STATUS_OK if everything succeeds, error otherwise + */ +ldns_status ldns_wire2rr(ldns_rr **rr, const uint8_t *wire, size_t max, size_t *pos, ldns_pkt_section section); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_WIRE2HOST_H */ diff --git a/libs/ldns/ldns/zone.h b/libs/ldns/ldns/zone.h new file mode 100644 index 0000000000..a683ea87e0 --- /dev/null +++ b/libs/ldns/ldns/zone.h @@ -0,0 +1,175 @@ +/** + * zone.h + * + * zone definitions + * - what is it + * - get_glue function + * - search etc + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +/** + * \file + * + * Defines the ldns_zone structure and functions to manipulate it. + */ + + +#ifndef LDNS_ZONE_H +#define LDNS_ZONE_H + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * DNS Zone + * + * A list of RR's with some + * extra information which comes from the SOA RR + * Note: nothing has been done to make this efficient (yet). + */ +struct ldns_struct_zone +{ + /** the soa defines a zone */ + ldns_rr *_soa; + /* basicly a zone is a list of rr's */ + ldns_rr_list *_rrs; + /* we could change this to be a b-tree etc etc todo */ +}; +typedef struct ldns_struct_zone ldns_zone; + +/** + * create a new ldns_zone structure + * \return a pointer to a ldns_zone structure + */ +ldns_zone * ldns_zone_new(void); + +/** + * Return the soa record of a zone + * \param[in] z the zone to read from + * \return the soa record in the zone + */ +ldns_rr * ldns_zone_soa(const ldns_zone *z); + +/** + * Returns the number of resource records in the zone, NOT counting the SOA record + * \param[in] z the zone to read from + * \return the number of rr's in the zone + */ +size_t ldns_zone_rr_count(const ldns_zone *z); + +/** + * Set the zone's soa record + * \param[in] z the zone to put the new soa in + * \param[in] soa the soa to set + */ +void ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa); + +/** + * Get a list of a zone's content. Note that the SOA + * isn't included in this list. You need to get the + * with ldns_zone_soa. + * \param[in] z the zone to read from + * \return the rrs from this zone + */ +ldns_rr_list * ldns_zone_rrs(const ldns_zone *z); + +/** + * Set the zone's contents + * \param[in] z the zone to put the new soa in + * \param[in] rrlist the rrlist to use + */ +void ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist); + +/** + * push an rrlist to a zone structure. This function use pointer + * copying, so the rr_list structure inside z is modified! + * \param[in] z the zone to add to + * \param[in] list the list to add + * \return a true on succes otherwise falsed + */ +bool ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list); + +/** + * push an single rr to a zone structure. This function use pointer + * copying, so the rr_list structure inside z is modified! + * \param[in] z the zone to add to + * \param[in] rr the rr to add + * \return a true on succes otherwise falsed + */ +bool ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr); + +/** + * Retrieve all resource records from the zone that are glue + * records. The resulting list does are pointer references + * to the zone's data. + * + * Due to the current zone implementation (as a list of rr's), this + * function is extremely slow. Another (probably better) way to do this + * is to use an ldns_dnssec_zone structure and the mark_glue function + * + * \param[in] z the zone to look for glue + * \return the rr_list with the glue + */ +ldns_rr_list *ldns_zone_glue_rr_list(const ldns_zone *z); + +/** + * Create a new zone from a file + * \param[out] z the new zone + * \param[in] *fp the filepointer to use + * \param[in] *origin the zones' origin + * \param[in] ttl default ttl to use + * \param[in] c default class to use (IN) + * + * \return ldns_status mesg with an error or LDNS_STATUS_OK + */ +ldns_status ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c); + +/** + * Create a new zone from a file, keep track of the line numbering + * \param[out] z the new zone + * \param[in] *fp the filepointer to use + * \param[in] *origin the zones' origin + * \param[in] ttl default ttl to use + * \param[in] c default class to use (IN) + * \param[out] line_nr used for error msg, to get to the line number + * + * \return ldns_status mesg with an error or LDNS_STATUS_OK + */ +ldns_status ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c, int *line_nr); + +/** + * Frees the allocated memory for the zone, and the rr_list structure in it + * \param[in] zone the zone to free + */ +void ldns_zone_free(ldns_zone *zone); + +/** + * Frees the allocated memory for the zone, the soa rr in it, + * and the rr_list structure in it, including the rr's in that. etc. + * \param[in] zone the zone to free + */ +void ldns_zone_deep_free(ldns_zone *zone); + +/** + * Sort the rrs in a zone, with the current impl. this is slow + * \param[in] zone the zone to sort + */ +void ldns_zone_sort(ldns_zone *zone); + +#ifdef __cplusplus +} +#endif + +#endif /* LDNS_ZONE_H */ diff --git a/libs/ldns/ldns_symbols.def b/libs/ldns/ldns_symbols.def new file mode 100644 index 0000000000..7b80bf6952 --- /dev/null +++ b/libs/ldns/ldns_symbols.def @@ -0,0 +1,733 @@ +ldns_algorithm2buffer_str +ldns_algorithms +ldns_axfr_complete +ldns_axfr_last_pkt +ldns_axfr_next +ldns_axfr_start +ldns_b32_ntop +ldns_b32_ntop_ar +ldns_b32_ntop_extended_hex +ldns_b32_pton +ldns_b32_pton_ar +ldns_b32_pton_extended_hex +ldns_b64_ntop +ldns_b64_pton +ldns_bgetc +ldns_bget_keyword_data +ldns_bget_token +ldns_bskipc +ldns_bskipcs +ldns_bubblebabble +ldns_buffer2pkt_wire +ldns_buffer2str +ldns_buffer_copy +ldns_buffer_export +ldns_buffer_free +ldns_buffer_new +ldns_buffer_new_frm_data +ldns_buffer_printf +ldns_buffer_reserve +ldns_buffer_set_capacity +ldns_calc_keytag +ldns_calc_keytag_raw +ldns_cert_algorithm2buffer_str +ldns_cert_algorithms +ldns_convert_ecdsa_rrsig_asn12rdf +ldns_convert_ecdsa_rrsig_rdf2asn1 +ldns_convert_dsa_rrsig_asn12rdf +ldns_convert_dsa_rrsig_rdf2asn1 +ldns_create_empty_rrsig +ldns_create_nsec +ldns_create_nsec3 +ldns_directive_types +ldns_dname2buffer_wire +ldns_dname2canonical +ldns_dname_cat +ldns_dname_cat_clone +ldns_dname_clone_from +ldns_dname_compare +ldns_dname_compare_v +ldns_dname_interval +ldns_dname_is_subdomain +ldns_dname_is_wildcard +ldns_dname_label +ldns_dname_label_count +ldns_dname_left_chop +ldns_dname_match_wildcard +ldns_dname_new +ldns_dname_new_frm_data +ldns_dname_new_frm_str +ldns_dname_reverse +ldns_dname_str_absolute +ldns_dnssec_build_data_chain +ldns_dnssec_build_data_chain_nokeyname +ldns_dnssec_chain_nsec3_list +ldns_dnssec_create_nsec +ldns_dnssec_create_nsec3 +ldns_dnssec_create_nsec_bitmap +ldns_dnssec_data_chain_deep_free +ldns_dnssec_data_chain_free +ldns_dnssec_data_chain_new +ldns_dnssec_data_chain_print +ldns_dnssec_default_add_to_signatures +ldns_dnssec_default_delete_signatures +ldns_dnssec_default_leave_signatures +ldns_dnssec_default_replace_signatures +ldns_dnssec_derive_trust_tree +ldns_dnssec_derive_trust_tree_dnskey_rrset +ldns_dnssec_derive_trust_tree_ds_rrset +ldns_dnssec_derive_trust_tree_normal_rrset +ldns_dnssec_derive_trust_tree_no_sig +ldns_dnssec_get_dnskey_for_rrsig +ldns_dnssec_get_rrsig_for_name_and_type +ldns_dnssec_name_add_rr +ldns_dnssec_name_cmp +ldns_dnssec_name_deep_free +ldns_dnssec_name_find_rrset +ldns_dnssec_name_free +ldns_dnssec_name_name +ldns_dnssec_name_new +ldns_dnssec_name_new_frm_rr +ldns_dnssec_name_node_deep_free +ldns_dnssec_name_node_free +ldns_dnssec_name_node_next_nonglue +ldns_dnssec_name_nsec +ldns_dnssec_name_print +ldns_dnssec_name_print_soa +ldns_dnssec_name_set_name +ldns_dnssec_name_set_nsec +ldns_dnssec_nsec3_closest_encloser +ldns_dnssec_pkt_get_rrsigs_for_name_and_type +ldns_dnssec_pkt_get_rrsigs_for_type +ldns_dnssec_pkt_has_rrsigs +ldns_dnssec_remove_signatures +ldns_dnssec_rrs_add_rr +ldns_dnssec_rrs_deep_free +ldns_dnssec_rrsets_add_rr +ldns_dnssec_rrsets_contains_type +ldns_dnssec_rrsets_deep_free +ldns_dnssec_rrsets_free +ldns_dnssec_rrsets_new +ldns_dnssec_rrsets_new_frm_rr +ldns_dnssec_rrsets_print +ldns_dnssec_rrsets_print_soa +ldns_dnssec_rrsets_set_type +ldns_dnssec_rrsets_type +ldns_dnssec_rrs_free +ldns_dnssec_rrs_new +ldns_dnssec_rrs_print +ldns_dnssec_trust_tree_add_parent +ldns_dnssec_trust_tree_contains_keys +ldns_dnssec_trust_tree_depth +ldns_dnssec_trust_tree_free +ldns_dnssec_trust_tree_new +ldns_dnssec_trust_tree_print +ldns_dnssec_trust_tree_print_sm +ldns_dnssec_verify_denial +ldns_dnssec_verify_denial_nsec3 +ldns_dnssec_zone_add_empty_nonterminals +ldns_dnssec_zone_add_rr +ldns_dnssec_zone_create_nsec3s +ldns_dnssec_zone_create_nsecs +ldns_dnssec_zone_create_rrsigs +ldns_dnssec_zone_create_rrsigs_flg +ldns_dnssec_zone_deep_free +ldns_dnssec_zone_find_nsec3_original +ldns_dnssec_zone_find_rrset +ldns_dnssec_zone_free +ldns_dnssec_zone_mark_glue +ldns_dnssec_zone_names_print +ldns_dnssec_zone_new +ldns_dnssec_zone_print +ldns_dnssec_zone_sign +ldns_dnssec_zone_sign_flg +ldns_dnssec_zone_sign_nsec3 +ldns_dnssec_zone_sign_nsec3_flg +ldns_ecdsa2pkey_raw +ldns_edns_flags +ldns_error_str +ldns_fetch_valid_domain_keys +ldns_fget_keyword_data +ldns_fget_keyword_data_l +ldns_fget_token +ldns_fget_token_l +ldns_fskipc +ldns_fskipcs +ldns_fskipcs_l +ldns_getaddrinfo +ldns_get_bit +ldns_get_bit_r +ldns_get_errorstr_by_id +ldns_get_random +ldns_get_rr_class_by_name +ldns_get_rr_list_addr_by_name +ldns_get_rr_list_hosts_frm_file +ldns_get_rr_list_hosts_frm_fp +ldns_get_rr_list_hosts_frm_fp_l +ldns_get_rr_list_name_by_addr +ldns_get_rr_type_by_name +ldns_get_signing_algorithm_by_name +ldns_gost2pkey_raw +ldns_digest_evp +ldns_key_EVP_load_gost_id +ldns_key_EVP_unload_gost +ldns_hexdigit_to_int +ldns_hexstring_to_data +ldns_init_random +ldns_int_to_hexdigit +ldns_is_rrset +ldns_key2buffer_str +ldns_key2rr +ldns_key2str +ldns_key_algo_supported +ldns_key_algorithm +ldns_key_buf2dsa +ldns_key_buf2dsa_raw +ldns_key_buf2rsa +ldns_key_buf2rsa_raw +ldns_key_deep_free +ldns_key_dsa_key +ldns_key_evp_key +ldns_key_expiration +ldns_key_external_key +ldns_key_flags +ldns_key_free +ldns_key_get_file_base_name +ldns_key_hmac_key +ldns_key_hmac_size +ldns_key_inception +ldns_key_keytag +ldns_key_list_free +ldns_key_list_key +ldns_key_list_key_count +ldns_key_list_new +ldns_key_list_pop_key +ldns_key_list_push_key +ldns_key_list_set_key_count +ldns_key_list_set_use +ldns_key_new +ldns_key_new_frm_algorithm +ldns_key_new_frm_engine +ldns_key_new_frm_fp +ldns_key_new_frm_fp_dsa +ldns_key_new_frm_fp_dsa_l +ldns_key_new_frm_fp_hmac +ldns_key_new_frm_fp_hmac_l +ldns_key_new_frm_fp_l +ldns_key_new_frm_fp_rsa +ldns_key_new_frm_fp_rsa_l +ldns_key_origttl +ldns_key_print +ldns_key_pubkey_owner +ldns_key_rr2ds +ldns_key_rsa_key +ldns_key_set_algorithm +ldns_key_set_dsa_key +ldns_key_set_evp_key +ldns_key_set_expiration +ldns_key_set_external_key +ldns_key_set_flags +ldns_key_set_hmac_key +ldns_key_set_hmac_size +ldns_key_set_inception +ldns_key_set_keytag +ldns_key_set_origttl +ldns_key_set_pubkey_owner +ldns_key_set_rsa_key +ldns_key_set_use +ldns_key_use +ldns_lookup_by_id +ldns_lookup_by_name +ldns_native2rdf_int16 +ldns_native2rdf_int16_data +ldns_native2rdf_int32 +ldns_native2rdf_int8 +ldns_nsec3_add_param_rdfs +ldns_nsec3_algorithm +ldns_nsec3_bitmap +ldns_nsec3_flags +ldns_nsec3_hash_name +ldns_nsec3_hash_name_frm_nsec3 +ldns_nsec3_iterations +ldns_nsec3_next_owner +ldns_nsec3_optout +ldns_nsec3_salt +ldns_nsec3_salt_data +ldns_nsec3_salt_length +ldns_nsec_bitmap_covers_type +ldns_nsec_covers_name +ldns_nsec_get_bitmap +ldns_nsec_type_check +ldns_octet +ldns_opcodes +ldns_pkt2buffer_str +ldns_pkt2buffer_wire +ldns_pkt2str +ldns_pkt2wire +ldns_pkt_aa +ldns_pkt_ad +ldns_pkt_additional +ldns_pkt_algorithm2str +ldns_pkt_all +ldns_pkt_all_noquestion +ldns_pkt_ancount +ldns_pkt_answer +ldns_pkt_answerfrom +ldns_pkt_arcount +ldns_pkt_authority +ldns_pkt_cd +ldns_pkt_cert_algorithm2str +ldns_pkt_clone +ldns_pkt_edns +ldns_pkt_edns_data +ldns_pkt_edns_do +ldns_pkt_edns_extended_rcode +ldns_pkt_edns_udp_size +ldns_pkt_edns_version +ldns_pkt_edns_z +ldns_pkt_empty +ldns_pkt_free +ldns_pkt_get_opcode +ldns_pkt_get_rcode +ldns_pkt_get_section_clone +ldns_pktheader2buffer_str +ldns_pkt_id +ldns_pkt_new +ldns_pkt_nscount +ldns_pkt_opcode2buffer_str +ldns_pkt_opcode2str +ldns_pkt_print +ldns_pkt_push_rr +ldns_pkt_push_rr_list +ldns_pkt_qdcount +ldns_pkt_qr +ldns_pkt_query_new +ldns_pkt_query_new_frm_str +ldns_pkt_querytime +ldns_pkt_question +ldns_pkt_ra +ldns_pkt_rcode2buffer_str +ldns_pkt_rcode2str +ldns_pkt_rd +ldns_pkt_reply_type +ldns_pkt_rr +ldns_pkt_rr_list_by_name +ldns_pkt_rr_list_by_name_and_type +ldns_pkt_rr_list_by_type +ldns_pkt_safe_push_rr +ldns_pkt_safe_push_rr_list +ldns_pkt_section_count +ldns_pkt_set_aa +ldns_pkt_set_ad +ldns_pkt_set_additional +ldns_pkt_set_ancount +ldns_pkt_set_answer +ldns_pkt_set_answerfrom +ldns_pkt_set_arcount +ldns_pkt_set_authority +ldns_pkt_set_cd +ldns_pkt_set_edns_data +ldns_pkt_set_edns_do +ldns_pkt_set_edns_extended_rcode +ldns_pkt_set_edns_udp_size +ldns_pkt_set_edns_version +ldns_pkt_set_edns_z +ldns_pkt_set_flags +ldns_pkt_set_id +ldns_pkt_set_nscount +ldns_pkt_set_opcode +ldns_pkt_set_qdcount +ldns_pkt_set_qr +ldns_pkt_set_querytime +ldns_pkt_set_question +ldns_pkt_set_ra +ldns_pkt_set_random_id +ldns_pkt_set_rcode +ldns_pkt_set_rd +ldns_pkt_set_section_count +ldns_pkt_set_size +ldns_pkt_set_tc +ldns_pkt_set_timestamp +ldns_pkt_set_tsig +ldns_pkt_size +ldns_pkt_tc +ldns_pkt_timestamp +ldns_pkt_tsig +ldns_pkt_tsig_sign +ldns_pkt_tsig_sign_next +ldns_pkt_tsig_verify +ldns_pkt_tsig_verify_next +ldns_pkt_verify +ldns_print_rr_rdf +ldns_rbtree_create +ldns_rbtree_delete +ldns_rbtree_find_less_equal +ldns_rbtree_first +ldns_rbtree_free +ldns_rbtree_init +ldns_rbtree_insert +ldns_rbtree_insert_vref +ldns_rbtree_join +ldns_rbtree_last +ldns_rbtree_next +ldns_rbtree_null_node +ldns_rbtree_previous +ldns_rbtree_search +ldns_rbtree_split +ldns_rcodes +ldns_rdf2buffer_str +ldns_rdf2buffer_str_a +ldns_rdf2buffer_str_aaaa +ldns_rdf2buffer_str_alg +ldns_rdf2buffer_str_apl +ldns_rdf2buffer_str_b32_ext +ldns_rdf2buffer_str_b64 +ldns_rdf2buffer_str_cert_alg +ldns_rdf2buffer_str_class +ldns_rdf2buffer_str_dname +ldns_rdf2buffer_str_hex +ldns_rdf2buffer_str_int16 +ldns_rdf2buffer_str_int16_data +ldns_rdf2buffer_str_int32 +ldns_rdf2buffer_str_int8 +ldns_rdf2buffer_str_ipseckey +ldns_rdf2buffer_str_loc +ldns_rdf2buffer_str_nsap +ldns_rdf2buffer_str_nsec +ldns_rdf2buffer_str_nsec3_salt +ldns_rdf2buffer_str_period +ldns_rdf2buffer_str_str +ldns_rdf2buffer_str_time +ldns_rdf2buffer_str_tsig +ldns_rdf2buffer_str_tsigtime +ldns_rdf2buffer_str_type +ldns_rdf2buffer_str_unknown +ldns_rdf2buffer_str_wks +ldns_rdf2buffer_wire +ldns_rdf2buffer_wire_canonical +ldns_rdf2native_int16 +ldns_rdf2native_int32 +ldns_rdf2native_int8 +ldns_rdf2native_sockaddr_storage +ldns_rdf2native_time_t +ldns_rdf2rr_type +ldns_rdf2str +ldns_rdf2wire +ldns_rdf_address_reverse +ldns_rdf_clone +ldns_rdf_compare +ldns_rdf_data +ldns_rdf_deep_free +ldns_rdf_free +ldns_rdf_get_type +ldns_rdf_new +ldns_rdf_new_frm_data +ldns_rdf_new_frm_fp +ldns_rdf_new_frm_fp_l +ldns_rdf_new_frm_str +ldns_rdf_print +ldns_rdf_set_data +ldns_rdf_set_size +ldns_rdf_set_type +ldns_rdf_size +ldns_read_anchor_file +ldns_resolver_debug +ldns_resolver_dec_nameserver_count +ldns_resolver_deep_free +ldns_resolver_defnames +ldns_resolver_dnsrch +ldns_resolver_dnssec +ldns_resolver_dnssec_anchors +ldns_resolver_dnssec_cd +ldns_resolver_domain +ldns_resolver_edns_udp_size +ldns_resolver_fail +ldns_resolver_fallback +ldns_resolver_free +ldns_resolver_igntc +ldns_resolver_incr_nameserver_count +ldns_resolver_ip6 +ldns_resolver_nameserver_count +ldns_resolver_nameserver_rtt +ldns_resolver_nameservers +ldns_resolver_nameservers_randomize +ldns_resolver_new +ldns_resolver_new_frm_file +ldns_resolver_new_frm_fp +ldns_resolver_new_frm_fp_l +ldns_resolver_pop_nameserver +ldns_resolver_port +ldns_resolver_prepare_query_pkt +ldns_resolver_print +ldns_resolver_push_dnssec_anchor +ldns_resolver_push_nameserver +ldns_resolver_push_nameserver_rr +ldns_resolver_push_nameserver_rr_list +ldns_resolver_push_searchlist +ldns_resolver_query +ldns_resolver_random +ldns_resolver_recursive +ldns_resolver_retrans +ldns_resolver_retry +ldns_resolver_rtt +ldns_resolver_search +ldns_resolver_searchlist +ldns_resolver_searchlist_count +ldns_resolver_send +ldns_resolver_send_pkt +ldns_resolver_set_debug +ldns_resolver_set_defnames +ldns_resolver_set_dnsrch +ldns_resolver_set_dnssec +ldns_resolver_set_dnssec_anchors +ldns_resolver_set_dnssec_cd +ldns_resolver_set_domain +ldns_resolver_set_edns_udp_size +ldns_resolver_set_fail +ldns_resolver_set_fallback +ldns_resolver_set_igntc +ldns_resolver_set_ip6 +ldns_resolver_set_nameserver_count +ldns_resolver_set_nameserver_rtt +ldns_resolver_set_nameservers +ldns_resolver_set_port +ldns_resolver_set_random +ldns_resolver_set_recursive +ldns_resolver_set_retrans +ldns_resolver_set_retry +ldns_resolver_set_rtt +ldns_resolver_set_searchlist_count +ldns_resolver_set_timeout +ldns_resolver_set_tsig_algorithm +ldns_resolver_set_tsig_keydata +ldns_resolver_set_tsig_keyname +ldns_resolver_set_usevc +ldns_resolver_timeout +ldns_resolver_trusted_key +ldns_resolver_tsig_algorithm +ldns_resolver_tsig_keydata +ldns_resolver_tsig_keyname +ldns_resolver_usevc +ldns_rr2buffer_str +ldns_rr2buffer_wire +ldns_rr2buffer_wire_canonical +ldns_rr2canonical +ldns_rr2str +ldns_rr2wire +ldns_rr_a_address +ldns_rr_a_set_address +ldns_rr_class2buffer_str +ldns_rr_class2str +ldns_rr_classes +ldns_rr_clone +ldns_rr_compare +ldns_rr_compare_ds +ldns_rr_compare_no_rdata +ldns_rr_compare_wire +ldns_rr_descript +ldns_rr_descriptor_field_type +ldns_rr_descriptor_maximum +ldns_rr_descriptor_minimum +ldns_rr_dnskey_algorithm +ldns_rr_dnskey_flags +ldns_rr_dnskey_key +ldns_rr_dnskey_key_size +ldns_rr_dnskey_key_size_raw +ldns_rr_dnskey_protocol +ldns_rr_dnskey_set_algorithm +ldns_rr_dnskey_set_flags +ldns_rr_dnskey_set_key +ldns_rr_dnskey_set_protocol +ldns_rr_free +ldns_rr_get_class +ldns_rr_get_type +ldns_rr_label_count +ldns_rr_list2buffer_str +ldns_rr_list2buffer_wire +ldns_rr_list2canonical +ldns_rr_list2str +ldns_rr_list_cat +ldns_rr_list_cat_clone +ldns_rr_list_clone +ldns_rr_list_compare +ldns_rr_list_contains_rr +ldns_rr_list_deep_free +ldns_rr_list_free +ldns_rr_list_new +ldns_rr_list_owner +ldns_rr_list_pop_rr +ldns_rr_list_pop_rr_list +ldns_rr_list_pop_rrset +ldns_rr_list_print +ldns_rr_list_push_rr +ldns_rr_list_push_rr_list +ldns_rr_list_rr +ldns_rr_list_rr_count +ldns_rr_list_set_rr +ldns_rr_list_set_rr_count +ldns_rr_list_sort +ldns_rr_list_sort_nsec3 +ldns_rr_list_subtype_by_rdf +ldns_rr_list_type +ldns_rr_mx_exchange +ldns_rr_mx_preference +ldns_rr_new +ldns_rr_new_frm_fp +ldns_rr_new_frm_fp_l +ldns_rr_new_frm_str +ldns_rr_new_frm_type +ldns_rr_new_question_frm_str +ldns_rr_ns_nsdname +ldns_rr_owner +ldns_rr_pop_rdf +ldns_rr_print +ldns_rr_push_rdf +ldns_rr_rdata2buffer_wire +ldns_rr_rd_count +ldns_rr_rdf +ldns_rr_rrsig_algorithm +ldns_rr_rrsig_expiration +ldns_rr_rrsig_inception +ldns_rr_rrsig_keytag +ldns_rr_rrsig_labels +ldns_rr_rrsig_origttl +ldns_rr_rrsig_set_algorithm +ldns_rr_rrsig_set_expiration +ldns_rr_rrsig_set_inception +ldns_rr_rrsig_set_keytag +ldns_rr_rrsig_set_labels +ldns_rr_rrsig_set_origttl +ldns_rr_rrsig_set_sig +ldns_rr_rrsig_set_signame +ldns_rr_rrsig_set_typecovered +ldns_rr_rrsig_sig +ldns_rr_rrsig_signame +ldns_rr_rrsig_typecovered +ldns_rr_set_class +ldns_rr_set_owner +ldns_rr_set_pop_rr +ldns_rr_set_push_rr +ldns_rr_set_rd_count +ldns_rr_set_rdf +ldns_rr_set_ttl +ldns_rr_set_type +ldns_rrsig2buffer_wire +ldns_rr_ttl +ldns_rr_type2buffer_str +ldns_rr_type2str +ldns_rr_uncompressed_size +ldns_send +ldns_send_buffer +ldns_set_bit +ldns_sha1 +ldns_sha1_final +ldns_sha1_init +ldns_sha1_transform +ldns_sha1_update +ldns_signing_algorithms +ldns_sign_public +ldns_sign_public_buffer +ldns_sign_public_dsa +ldns_sign_public_evp +ldns_sign_public_rsamd5 +ldns_sign_public_rsasha1 +ldns_sockaddr_storage2rdf +ldns_str2period +ldns_str2rdf_a +ldns_str2rdf_aaaa +ldns_str2rdf_alg +ldns_str2rdf_apl +ldns_str2rdf_b32_ext +ldns_str2rdf_b64 +ldns_str2rdf_cert_alg +ldns_str2rdf_class +ldns_str2rdf_dname +ldns_str2rdf_hex +ldns_str2rdf_int16 +ldns_str2rdf_int32 +ldns_str2rdf_int8 +ldns_str2rdf_loc +ldns_str2rdf_nsap +ldns_str2rdf_nsec +ldns_str2rdf_nsec3_salt +ldns_str2rdf_period +ldns_str2rdf_service +ldns_str2rdf_str +ldns_str2rdf_time +ldns_str2rdf_tsig +ldns_str2rdf_type +ldns_str2rdf_unknown +ldns_str2rdf_wks +ldns_tcp_bgsend +ldns_tcp_connect +ldns_tcp_read_wire +ldns_tcp_read_wire_timeout +ldns_tcp_send +ldns_tcp_send_query +ldns_traverse_postorder +ldns_tsig_algorithm +ldns_tsig_keydata +ldns_tsig_keydata_clone +ldns_tsig_keyname +ldns_tsig_keyname_clone +ldns_tsig_prepare_pkt_wire +ldns_udp_bgsend +ldns_udp_connect +ldns_udp_read_wire +ldns_udp_send +ldns_udp_send_query +ldns_update_ad +ldns_update_pkt_new +ldns_update_pkt_tsig_add +ldns_update_prcount +ldns_update_set_adcount +ldns_update_set_prcount +ldns_update_set_upcount +ldns_update_set_zo +ldns_update_soa_mname +ldns_update_soa_zone_mname +ldns_update_upcount +ldns_update_zocount +ldns_validate_domain_dnskey +ldns_validate_domain_ds +ldns_verify +ldns_verify_notime +ldns_verify_rrsig +ldns_verify_rrsig_buffers +ldns_verify_rrsig_buffers_raw +ldns_verify_rrsig_dsa +ldns_verify_rrsig_dsa_raw +ldns_verify_rrsig_evp +ldns_verify_rrsig_evp_raw +ldns_verify_rrsig_keylist +ldns_verify_rrsig_keylist_notime +ldns_verify_rrsig_rsamd5 +ldns_verify_rrsig_rsamd5_raw +ldns_verify_rrsig_rsasha1 +ldns_verify_rrsig_rsasha1_raw +ldns_verify_rrsig_rsasha256_raw +ldns_verify_rrsig_rsasha512_raw +ldns_verify_trusted +ldns_version +ldns_wire2dname +ldns_wire2pkt +ldns_wire2rdf +ldns_wire2rr +ldns_zone_deep_free +ldns_zone_free +ldns_zone_glue_rr_list +ldns_zone_new +ldns_zone_new_frm_fp +ldns_zone_new_frm_fp_l +ldns_zone_print +ldns_zone_push_rr +ldns_zone_push_rr_list +ldns_zone_rr_count +ldns_zone_rrs +ldns_zone_set_rrs +ldns_zone_set_soa +ldns_zone_sign +ldns_zone_sign_nsec3 +ldns_zone_soa +ldns_zone_sort +ldns_zone_strip_glue_rrs diff --git a/libs/ldns/libdns.doxygen b/libs/ldns/libdns.doxygen new file mode 100644 index 0000000000..b81c7362bb --- /dev/null +++ b/libs/ldns/libdns.doxygen @@ -0,0 +1,1130 @@ +# Doxyfile 1.3.9.1 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project +# +# All text after a hash (#) is considered a comment and will be ignored +# The format is: +# TAG = value [value, ...] +# For lists items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (" ") + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded +# by quotes) that should identify the project. + +PROJECT_NAME = ldns + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. +# This could be handy for archiving the generated documentation or +# if some version control system is used. + +PROJECT_NUMBER = 1.6.7 + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) +# base path where the generated documentation will be put. +# If a relative path is entered, it will be relative to the location +# where doxygen was started. If left blank the current directory will be used. + +OUTPUT_DIRECTORY = doc/ + +# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create +# 4096 sub-directories (in 2 levels) under the output directory of each output +# format and will distribute the generated files over these directories. +# Enabling this option can be useful when feeding doxygen a huge amount of source +# files, where putting all generated files in the same directory would otherwise +# cause performance problems for the file system. + +CREATE_SUBDIRS = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# The default language is English, other supported languages are: +# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, +# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, +# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, +# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, +# Swedish, and Ukrainian. + +OUTPUT_LANGUAGE = English + +# This tag can be used to specify the encoding used in the generated output. +# The encoding is not always determined by the language that is chosen, +# but also whether or not the output is meant for Windows or non-Windows users. +# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will +# include brief member descriptions after the members that are listed in +# the file and class documentation (similar to JavaDoc). +# Set to NO to disable this. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend +# the brief description of a member or function before the detailed description. +# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator +# that is used to form the text in various listings. Each string +# in this list, if found as the leading text of the brief description, will be +# stripped from the text and the result after processing the whole list, is used +# as the annotated text. Otherwise, the brief description is used as-is. If left +# blank, the following values are used ("$name" is automatically replaced with the +# name of the entity): "The $name class" "The $name widget" "The $name file" +# "is" "provides" "specifies" "contains" "represents" "a" "an" "the" + +ABBREVIATE_BRIEF = + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# Doxygen will generate a detailed section even if there is only a brief +# description. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all inherited +# members of a class in the documentation of that class as if those members were +# ordinary class members. Constructors, destructors and assignment operators of +# the base classes will not be shown. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full +# path before files name in the file list and in the header files. If set +# to NO the shortest path that makes the file name unique will be used. + +FULL_PATH_NAMES = YES + +# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag +# can be used to strip a user-defined part of the path. Stripping is +# only done if one of the specified strings matches the left-hand part of +# the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the +# path to strip. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of +# the path mentioned in the documentation of a class, which tells +# the reader which header file to include in order to use a class. +# If left blank only the name of the header file containing the class +# definition is used. Otherwise one should specify the include paths that +# are normally passed to the compiler using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter +# (but less readable) file names. This can be useful is your file systems +# doesn't support long names like on DOS, Mac, or CD-ROM. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen +# will interpret the first line (until the first dot) of a JavaDoc-style +# comment as the brief description. If set to NO, the JavaDoc +# comments will behave just like the Qt-style comments (thus requiring an +# explicit @brief command for a brief description. + +JAVADOC_AUTOBRIEF = YES + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen +# treat a multi-line C++ special comment block (i.e. a block of //! or /// +# comments) as a brief description. This used to be the default behaviour. +# The new default is to treat a multi-line C++ comment block as a detailed +# description. Set this tag to YES if you prefer the old behaviour instead. + +MULTILINE_CPP_IS_BRIEF = NO + +# If the DETAILS_AT_TOP tag is set to YES then Doxygen +# will output the detailed description near the top, like JavaDoc. +# If set to NO, the detailed description appears after the member +# documentation. + +DETAILS_AT_TOP = NO + +# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented +# member inherits the documentation from any documented member that it +# re-implements. + +INHERIT_DOCS = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES, then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. + +DISTRIBUTE_GROUP_DOC = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. +# Doxygen uses this value to replace tabs by spaces in code fragments. + +TAB_SIZE = 8 + +# This tag can be used to specify a number of aliases that acts +# as commands in the documentation. An alias has the form "name=value". +# For example adding "sideeffect=\par Side Effects:\n" will allow you to +# put the command \sideeffect (or @sideeffect) in the documentation, which +# will result in a user-defined paragraph with heading "Side Effects:". +# You can put \n's in the value part of an alias to insert newlines. + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. +# For instance, some of the names that are used will be different. The list +# of all members will be omitted, etc. + +OPTIMIZE_OUTPUT_FOR_C = YES + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java sources +# only. Doxygen will then generate output that is more tailored for Java. +# For instance, namespaces will be presented as packages, qualified scopes +# will look different, etc. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the SUBGROUPING tag to YES (the default) to allow class member groups of +# the same type (for instance a group of public functions) to be put as a +# subgroup of that type (e.g. under the Public Functions section). Set it to +# NO to prevent subgrouping. Alternatively, this can be done per class using +# the \nosubgrouping command. + +SUBGROUPING = YES + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in +# documentation are documented, even if no documentation was available. +# Private class members and static file members will be hidden unless +# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES all private members of a class +# will be included in the documentation. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_STATIC tag is set to YES all static members of a file +# will be included in the documentation. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) +# defined locally in source files will be included in the documentation. +# If set to NO only classes defined in header files are included. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. When set to YES local +# methods, which are defined in the implementation section but not in +# the interface are included in the documentation. +# If set to NO (the default) only methods in the interface are included. + +EXTRACT_LOCAL_METHODS = NO + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all +# undocumented members of documented classes, files or namespaces. +# If set to NO (the default) these members will be included in the +# various overviews, but no documentation section is generated. +# This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. +# If set to NO (the default) these classes will be included in the various +# overviews. This option has no effect if EXTRACT_ALL is enabled. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all +# friend (class|struct|union) declarations. +# If set to NO (the default) these declarations will be included in the +# documentation. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any +# documentation blocks found inside the body of a function. +# If set to NO (the default) these blocks will be appended to the +# function's detailed documentation block. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation +# that is typed after a \internal command is included. If the tag is set +# to NO (the default) then the documentation will be excluded. +# Set it to YES to include the internal documentation. + +INTERNAL_DOCS = NO + +# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate +# file names in lower-case letters. If set to YES upper-case letters are also +# allowed. This is useful if you have classes or files whose names only differ +# in case and if your file system supports case sensitive file names. Windows +# and Mac users are advised to set this option to NO. + +CASE_SENSE_NAMES = YES + +# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen +# will show members with their full class and namespace scopes in the +# documentation. If set to YES the scope will be hidden. + +HIDE_SCOPE_NAMES = NO + +# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen +# will put a list of the files that are included by a file in the documentation +# of that file. + +SHOW_INCLUDE_FILES = NO + +# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] +# is inserted in the documentation for inline members. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen +# will sort the (detailed) documentation of file and class members +# alphabetically by member name. If set to NO the members will appear in +# declaration order. + +SORT_MEMBER_DOCS = NO + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the +# brief documentation of file, namespace and class members alphabetically +# by member name. If set to NO (the default) the members will appear in +# declaration order. + +SORT_BRIEF_DOCS = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be +# sorted by fully-qualified names, including namespaces. If set to +# NO (the default), the class list will be sorted only by class name, +# not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the +# alphabetical list. + +SORT_BY_SCOPE_NAME = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or +# disable (NO) the todo list. This list is created by putting \todo +# commands in the documentation. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or +# disable (NO) the test list. This list is created by putting \test +# commands in the documentation. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or +# disable (NO) the bug list. This list is created by putting \bug +# commands in the documentation. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or +# disable (NO) the deprecated list. This list is created by putting +# \deprecated commands in the documentation. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional +# documentation sections, marked by \if sectionname ... \endif. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines +# the initial value of a variable or define consists of for it to appear in +# the documentation. If the initializer consists of more lines than specified +# here it will be hidden. Use a value of 0 to hide initializers completely. +# The appearance of the initializer of individual variables and defines in the +# documentation can be controlled using \showinitializer or \hideinitializer +# command in the documentation regardless of this setting. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated +# at the bottom of the documentation of classes and structs. If set to YES the +# list will mention the files that were used to generate the documentation. + +SHOW_USED_FILES = NO + +# If the sources in your project are distributed over multiple directories +# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy +# in the documentation. + +SHOW_DIRECTORIES = YES + +#--------------------------------------------------------------------------- +# configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated +# by doxygen. Possible values are YES and NO. If left blank NO is used. + +QUIET = YES + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated by doxygen. Possible values are YES and NO. If left blank +# NO is used. + +WARNINGS = YES + +# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings +# for undocumented members. If EXTRACT_ALL is set to YES then this flag will +# automatically be disabled. + +WARN_IF_UNDOCUMENTED = YES + +# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as not documenting some +# parameters in a documented function, or documenting parameters that +# don't exist or using markup commands wrongly. + +WARN_IF_DOC_ERROR = YES + +# The WARN_FORMAT tag determines the format of the warning messages that +# doxygen can produce. The string should contain the $file, $line, and $text +# tags, which will be replaced by the file and line number from which the +# warning originated and the warning text. + +WARN_FORMAT = "doxygen: $file:$line: $text" + +# The WARN_LOGFILE tag can be used to specify a file to which warning +# and error messages should be written. If left blank the output is written +# to stderr. + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag can be used to specify the files and/or directories that contain +# documented source files. You may enter file names like "myfile.cpp" or +# directories like "/usr/src/myproject". Separate the files or directories +# with spaces. + +INPUT = . ldns/ doc/ examples/ldns-mx.c examples/ldns-read-zone.c examples/ldns-signzone.c + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank the following patterns are tested: +# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp +# *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm + +#FILE_PATTERNS = *.h *.c *.dox +#FILE_PATTERNS = *.h *.dox + +# The RECURSIVE tag can be used to turn specify whether or not subdirectories +# should be searched for input files as well. Possible values are YES and NO. +# If left blank NO is used. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used select whether or not files or directories +# that are symbolic links (a Unix filesystem feature) are excluded from the input. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. + +EXCLUDE_PATTERNS = + +# The EXAMPLE_PATH tag can be used to specify one or more files or +# directories that contain example code fragments that are included (see +# the \include command). + +EXAMPLE_PATH = examples + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp +# and *.h) to filter out the source-files in the directories. If left +# blank all files are included. + +EXAMPLE_PATTERNS = + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude +# commands irrespective of the value of the RECURSIVE tag. +# Possible values are YES and NO. If left blank NO is used. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or +# directories that contain image that are included in the documentation (see +# the \image command). + +IMAGE_PATH = doc/images + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command , where +# is the value of the INPUT_FILTER tag, and is the name of an +# input file. Doxygen will then use the output that the filter program writes +# to standard output. If FILTER_PATTERNS is specified, this tag will be +# ignored. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: +# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further +# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER +# is applied to all files. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will be used to filter the input files when producing source +# files to browse (i.e. when SOURCE_BROWSER is set to YES). + +FILTER_SOURCE_FILES = NO + +#--------------------------------------------------------------------------- +# configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will +# be generated. Documented entities will be cross-referenced with these sources. +# Note: To get rid of all source code in the generated output, make sure also +# VERBATIM_HEADERS is set to NO. + +SOURCE_BROWSER = YES + +# Setting the INLINE_SOURCES tag to YES will include the body +# of functions and classes directly in the documentation. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct +# doxygen to hide any special comment blocks from generated source code +# fragments. Normal C and C++ comments will always remain visible. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES (the default) +# then for each documented function all documented +# functions referencing it will be listed. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES (the default) +# then for each documented function all documented entities +# called/used by that function will be listed. + +REFERENCES_RELATION = NO + +# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen +# will generate a verbatim copy of the header file for each class for +# which an include is specified. Set to NO to disable this. + +VERBATIM_HEADERS = YES + +#--------------------------------------------------------------------------- +# configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index +# of all compounds will be generated. Enable this if the project +# contains a lot of classes, structs, unions or interfaces. + +ALPHABETICAL_INDEX = YES + +# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then +# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns +# in which this list will be split (can be a number in the range [1..20]) + +COLS_IN_ALPHA_INDEX = 3 + +# In case all classes in a project start with a common prefix, all +# classes will be put under the same header in the alphabetical index. +# The IGNORE_PREFIX tag can be used to specify one or more prefixes that +# should be ignored while generating the index headers. + +IGNORE_PREFIX = ldns_ + +#--------------------------------------------------------------------------- +# configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES (the default) Doxygen will +# generate HTML output. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `html' will be used as the default path. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for +# each generated HTML page (for example: .htm,.php,.asp). If it is left blank +# doxygen will generate files with .html extension. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a personal HTML header for +# each generated HTML page. If it is left blank doxygen will generate a +# standard header. + +HTML_HEADER = doc/header.html + +# The HTML_FOOTER tag can be used to specify a personal HTML footer for +# each generated HTML page. If it is left blank doxygen will generate a +# standard footer. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading +# style sheet that is used by each HTML page. It can be used to +# fine-tune the look of the HTML output. If the tag is left blank doxygen +# will generate a default style sheet. Note that doxygen will try to copy +# the style sheet file to the HTML output directory, so don't put your own +# stylesheet in the HTML output directory as well, or it will be erased! + +#HTML_STYLESHEET = doc/libdns.css + +# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, +# files or namespaces will be aligned in HTML using tables. If set to +# NO a bullet list will be used. + +HTML_ALIGN_MEMBERS = YES + +# If the GENERATE_HTMLHELP tag is set to YES, additional index files +# will be generated that can be used as input for tools like the +# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) +# of the generated HTML documentation. + +GENERATE_HTMLHELP = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can +# be used to specify the file name of the resulting .chm file. You +# can add a path in front of the file if the result should not be +# written to the html output directory. + +CHM_FILE = + +# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can +# be used to specify the location (absolute path including file name) of +# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run +# the HTML help compiler on the generated index.hhp. + +HHC_LOCATION = + +# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag +# controls if a separate .chi index file is generated (YES) or that +# it should be included in the master .chm file (NO). + +GENERATE_CHI = NO + +# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag +# controls whether a binary table of contents is generated (YES) or a +# normal table of contents (NO) in the .chm file. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members +# to the contents of the HTML help documentation and to the tree view. + +TOC_EXPAND = NO + +# The DISABLE_INDEX tag can be used to turn on/off the condensed index at +# top of each HTML page. The value NO (the default) enables the index and +# the value YES disables it. + +DISABLE_INDEX = NO + +# This tag can be used to set the number of enum values (range [1..20]) +# that doxygen will group on one line in the generated HTML documentation. + +ENUM_VALUES_PER_LINE = 4 + +# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be +# generated containing a tree-like index structure (just like the one that +# is generated for HTML Help). For this to work a browser that supports +# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, +# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are +# probably better off using the HTML help feature. + +GENERATE_TREEVIEW = NO + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be +# used to set the initial width (in pixels) of the frame in which the tree +# is shown. + +TREEVIEW_WIDTH = 250 + +#--------------------------------------------------------------------------- +# configuration options related to the LaTeX output +#--------------------------------------------------------------------------- + +# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will +# generate Latex output. + +GENERATE_LATEX = NO + +# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `latex' will be used as the default path. + +LATEX_OUTPUT = latex + +# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be +# invoked. If left blank `latex' will be used as the default command name. + +LATEX_CMD_NAME = latex + +# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to +# generate index for LaTeX. If left blank `makeindex' will be used as the +# default command name. + +MAKEINDEX_CMD_NAME = makeindex + +# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact +# LaTeX documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_LATEX = NO + +# The PAPER_TYPE tag can be used to set the paper type that is used +# by the printer. Possible values are: a4, a4wide, letter, legal and +# executive. If left blank a4wide will be used. + +PAPER_TYPE = a4wide + +# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX +# packages that should be included in the LaTeX output. + +EXTRA_PACKAGES = + +# The LATEX_HEADER tag can be used to specify a personal LaTeX header for +# the generated latex document. The header should contain everything until +# the first chapter. If it is left blank doxygen will generate a +# standard header. Notice: only use this tag if you know what you are doing! + +LATEX_HEADER = + +# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated +# is prepared for conversion to pdf (using ps2pdf). The pdf file will +# contain links (just like the HTML output) instead of page references +# This makes the output suitable for online browsing using a pdf viewer. + +PDF_HYPERLINKS = YES + +# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of +# plain latex in the generated Makefile. Set this option to YES to get a +# higher quality PDF documentation. + +USE_PDFLATEX = YES + +# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. +# command to the generated LaTeX files. This will instruct LaTeX to keep +# running if errors occur, instead of asking the user for help. +# This option is also used when generating formulas in HTML. + +LATEX_BATCHMODE = YES + +# If LATEX_HIDE_INDICES is set to YES then doxygen will not +# include the index chapters (such as File Index, Compound Index, etc.) +# in the output. + +LATEX_HIDE_INDICES = NO + +#--------------------------------------------------------------------------- +# configuration options related to the RTF output +#--------------------------------------------------------------------------- + +# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output +# The RTF output is optimized for Word 97 and may not look very pretty with +# other RTF readers or editors. + +GENERATE_RTF = NO + +# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `rtf' will be used as the default path. + +RTF_OUTPUT = rtf + +# If the COMPACT_RTF tag is set to YES Doxygen generates more compact +# RTF documents. This may be useful for small projects and may help to +# save some trees in general. + +COMPACT_RTF = NO + +# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated +# will contain hyperlink fields. The RTF file will +# contain links (just like the HTML output) instead of page references. +# This makes the output suitable for online browsing using WORD or other +# programs which support those fields. +# Note: wordpad (write) and others do not support links. + +RTF_HYPERLINKS = NO + +# Load stylesheet definitions from file. Syntax is similar to doxygen's +# config file, i.e. a series of assignments. You only have to provide +# replacements, missing definitions are set to their default value. + +RTF_STYLESHEET_FILE = + +# Set optional variables used in the generation of an rtf document. +# Syntax is similar to doxygen's config file. + +RTF_EXTENSIONS_FILE = + +#--------------------------------------------------------------------------- +# configuration options related to the man page output +#--------------------------------------------------------------------------- + +# If the GENERATE_MAN tag is set to YES (the default) Doxygen will +# generate man pages + +GENERATE_MAN = NO + +# The MAN_OUTPUT tag is used to specify where the man pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `man' will be used as the default path. + +MAN_OUTPUT = man + +# The MAN_EXTENSION tag determines the extension that is added to +# the generated man pages (default is the subroutine's section .3) + +MAN_EXTENSION = .3 + +# If the MAN_LINKS tag is set to YES and Doxygen generates man output, +# then it will generate one additional man file for each entity +# documented in the real man page(s). These additional files +# only source the real man page, but without them the man command +# would be unable to find the correct page. The default is NO. + +MAN_LINKS = NO + +#--------------------------------------------------------------------------- +# configuration options related to the XML output +#--------------------------------------------------------------------------- + +# If the GENERATE_XML tag is set to YES Doxygen will +# generate an XML file that captures the structure of +# the code including all documentation. + +GENERATE_XML = NO + +# The XML_OUTPUT tag is used to specify where the XML pages will be put. +# If a relative path is entered the value of OUTPUT_DIRECTORY will be +# put in front of it. If left blank `xml' will be used as the default path. + +XML_OUTPUT = xml + +# The XML_SCHEMA tag can be used to specify an XML schema, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_SCHEMA = + +# The XML_DTD tag can be used to specify an XML DTD, +# which can be used by a validating XML parser to check the +# syntax of the XML files. + +XML_DTD = + +# If the XML_PROGRAMLISTING tag is set to YES Doxygen will +# dump the program listings (including syntax highlighting +# and cross-referencing information) to the XML output. Note that +# enabling this will significantly increase the size of the XML output. + +XML_PROGRAMLISTING = YES + +#--------------------------------------------------------------------------- +# configuration options for the AutoGen Definitions output +#--------------------------------------------------------------------------- + +# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will +# generate an AutoGen Definitions (see autogen.sf.net) file +# that captures the structure of the code including all +# documentation. Note that this feature is still experimental +# and incomplete at the moment. + +GENERATE_AUTOGEN_DEF = NO + +#--------------------------------------------------------------------------- +# configuration options related to the Perl module output +#--------------------------------------------------------------------------- + +# If the GENERATE_PERLMOD tag is set to YES Doxygen will +# generate a Perl module file that captures the structure of +# the code including all documentation. Note that this +# feature is still experimental and incomplete at the +# moment. + +GENERATE_PERLMOD = NO + +# If the PERLMOD_LATEX tag is set to YES Doxygen will generate +# the necessary Makefile rules, Perl scripts and LaTeX code to be able +# to generate PDF and DVI output from the Perl module output. + +PERLMOD_LATEX = NO + +# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be +# nicely formatted so it can be parsed by a human reader. This is useful +# if you want to understand what is going on. On the other hand, if this +# tag is set to NO the size of the Perl module output will be much smaller +# and Perl will parse it just the same. + +PERLMOD_PRETTY = YES + +# The names of the make variables in the generated doxyrules.make file +# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. +# This is useful so different doxyrules.make files included by the same +# Makefile don't overwrite each other's variables. + +PERLMOD_MAKEVAR_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the preprocessor +#--------------------------------------------------------------------------- + +# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will +# evaluate all C-preprocessor directives found in the sources and include +# files. + +ENABLE_PREPROCESSING = YES + +# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro +# names in the source code. If set to NO (the default) only conditional +# compilation will be performed. Macro expansion can be done in a controlled +# way by setting EXPAND_ONLY_PREDEF to YES. + +MACRO_EXPANSION = YES + +# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES +# then the macro expansion is limited to the macros specified with the +# PREDEFINED and EXPAND_AS_PREDEFINED tags. + +EXPAND_ONLY_PREDEF = NO + +# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files +# in the INCLUDE_PATH (see below) will be search if a #include is found. + +SEARCH_INCLUDES = YES + +# The INCLUDE_PATH tag can be used to specify one or more directories that +# contain include files that are not input files but should be processed by +# the preprocessor. + +INCLUDE_PATH = + +# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard +# patterns (like *.h and *.hpp) to filter out the header-files in the +# directories. If left blank, the patterns specified with FILE_PATTERNS will +# be used. + +INCLUDE_FILE_PATTERNS = + +# The PREDEFINED tag can be used to specify one or more macro names that +# are defined before the preprocessor is started (similar to the -D option of +# gcc). The argument of the tag is a list of macros of the form: name +# or name=definition (no spaces). If the definition and the = are +# omitted =1 is assumed. To prevent a macro definition from being +# undefined via #undef or recursively expanded use the := operator +# instead of the = operator. + +PREDEFINED = HAVE_SSL + +# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then +# this tag can be used to specify a list of macro names that should be expanded. +# The macro definition that is found in the sources will be used. +# Use the PREDEFINED tag if you want to use a different macro definition. + +EXPAND_AS_DEFINED = + +# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then +# doxygen's preprocessor will remove all function-like macros that are alone +# on a line, have an all uppercase name, and do not end with a semicolon. Such +# function macros are typically used for boiler-plate code, and will confuse the +# parser if not removed. + +SKIP_FUNCTION_MACROS = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to external references +#--------------------------------------------------------------------------- + +# The TAGFILES option can be used to specify one or more tagfiles. +# Optionally an initial location of the external documentation +# can be added for each tagfile. The format of a tag file without +# this location is as follows: +# TAGFILES = file1 file2 ... +# Adding location for the tag files is done as follows: +# TAGFILES = file1=loc1 "file2 = loc2" ... +# where "loc1" and "loc2" can be relative or absolute paths or +# URLs. If a location is present for each tag, the installdox tool +# does not have to be run to correct the links. +# Note that each tag file must have a unique name +# (where the name does NOT include the path) +# If a tag file is not located in the directory in which doxygen +# is run, you must also specify the path to the tagfile here. + +TAGFILES = + +# When a file name is specified after GENERATE_TAGFILE, doxygen will create +# a tag file that is based on the input files it reads. + +GENERATE_TAGFILE = + +# If the ALLEXTERNALS tag is set to YES all external classes will be listed +# in the class index. If set to NO only the inherited external classes +# will be listed. + +ALLEXTERNALS = NO + +# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed +# in the modules index. If set to NO, only the current project's groups will +# be listed. + +EXTERNAL_GROUPS = YES + +# The PERL_PATH should be the absolute path and name of the perl script +# interpreter (i.e. the result of `which perl'). + +PERL_PATH = /usr/bin/perl + +#--------------------------------------------------------------------------- +# Configuration options related to the dot tool +#--------------------------------------------------------------------------- + +# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will +# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base or +# super classes. Setting the tag to NO turns the diagrams off. Note that this +# option is superseded by the HAVE_DOT option below. This is only a fallback. It is +# recommended to install and use dot, since it yields more powerful graphs. + +CLASS_DIAGRAMS = YES + +# If set to YES, the inheritance and collaboration graphs will hide +# inheritance and usage relations if the target is undocumented +# or is not a class. + +HIDE_UNDOC_RELATIONS = YES + +# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is +# available from the path. This tool is part of Graphviz, a graph visualization +# toolkit from AT&T and Lucent Bell Labs. The other options in this section +# have no effect if this option is set to NO (the default) + +HAVE_DOT = NO + +# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect inheritance relations. Setting this tag to YES will force the +# the CLASS_DIAGRAMS tag to NO. + +CLASS_GRAPH = YES + +# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen +# will generate a graph for each documented class showing the direct and +# indirect implementation dependencies (inheritance, containment, and +# class references variables) of the class with other documented classes. + +COLLABORATION_GRAPH = YES + +# If the UML_LOOK tag is set to YES doxygen will generate inheritance and +# collaboration diagrams in a style similar to the OMG's Unified Modeling +# Language. + +UML_LOOK = NO + +# If set to YES, the inheritance and collaboration graphs will show the +# relations between templates and their instances. + +TEMPLATE_RELATIONS = NO + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT +# tags are set to YES then doxygen will generate a graph for each documented +# file showing the direct and indirect include dependencies of the file with +# other documented files. + +INCLUDE_GRAPH = YES + +# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and +# HAVE_DOT tags are set to YES then doxygen will generate a graph for each +# documented header file showing the documented files that directly or +# indirectly include this file. + +INCLUDED_BY_GRAPH = YES + +# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will +# generate a call dependency graph for every global function or class method. +# Note that enabling this option will significantly increase the time of a run. +# So in most cases it will be better to enable call graphs for selected +# functions only using the \callgraph command. + +CALL_GRAPH = YES +SOURCE_BROWSER = YES +REFERENCES_RELATION = YES + +# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen +# will graphical hierarchy of all classes instead of a textual one. + +GRAPHICAL_HIERARCHY = YES + +# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images +# generated by dot. Possible values are png, jpg, or gif +# If left blank png will be used. + +DOT_IMAGE_FORMAT = png + +# The tag DOT_PATH can be used to specify the path where the dot tool can be +# found. If left blank, it is assumed the dot tool can be found on the path. + +DOT_PATH = + +# The DOTFILE_DIRS tag can be used to specify one or more directories that +# contain dot files that are included in the documentation (see the +# \dotfile command). + +DOTFILE_DIRS = + +# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will +# generate a legend page explaining the meaning of the various boxes and +# arrows in the dot generated graphs. + +GENERATE_LEGEND = YES + +# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will +# remove the intermediate dot files that are used to generate +# the various graphs. + +DOT_CLEANUP = YES + +#--------------------------------------------------------------------------- +# Configuration::additions related to the search engine +#--------------------------------------------------------------------------- + +# The SEARCHENGINE tag specifies whether or not a search engine should be +# used. If set to NO the values of all tags below this one will be ignored. + +SEARCHENGINE = NO diff --git a/libs/ldns/libdns.vim b/libs/ldns/libdns.vim new file mode 100644 index 0000000000..69ec067150 --- /dev/null +++ b/libs/ldns/libdns.vim @@ -0,0 +1,332 @@ +" Vim syntax file +" Language: C libdns +" Maintainer: miekg +" Last change: 2004-12-15 + +" util.h +syn keyword ldnsMacro LDNS_MALLOC +syn keyword ldnsMacro LDNS_XMALLOC +syn keyword ldnsMacro LDNS_REALLOC +syn keyword ldnsMacro LDNS_XREALLOC +syn keyword ldnsMacro LDNS_FREE +syn keyword ldnsMacro LDNS_DEP + +" ldns/tsig.h +syn keyword ldnsType ldns_tsig_credentials + +" ldns/rdata.h +syn keyword ldnsType ldns_rdf +syn keyword ldnsType ldns_rdf_type +syn keyword ldnsType ldns_hdr +syn keyword ldnsType ldns_status +syn keyword ldnsType ldns_rrset +syn keyword ldnsType ldns_dname +syn keyword ldnsConstant true +syn keyword ldnsConstant false +syn keyword ldnsFunction ldns_rdf_get_type + +syn keyword ldnsConstant LDNS_RDF_TYPE_NONE +syn keyword ldnsConstant LDNS_RDF_TYPE_DNAME +syn keyword ldnsConstant LDNS_RDF_TYPE_INT8 +syn keyword ldnsConstant LDNS_RDF_TYPE_INT16 +syn keyword ldnsConstant LDNS_RDF_TYPE_INT16_DATA +syn keyword ldnsConstant LDNS_RDF_TYPE_INT32 +syn keyword ldnsConstant LDNS_RDF_TYPE_A +syn keyword ldnsConstant LDNS_RDF_TYPE_AAAA +syn keyword ldnsConstant LDNS_RDF_TYPE_STR +syn keyword ldnsConstant LDNS_RDF_TYPE_APL +syn keyword ldnsConstant LDNS_RDF_TYPE_B64 +syn keyword ldnsConstant LDNS_RDF_TYPE_HEX +syn keyword ldnsConstant LDNS_RDF_TYPE_NSEC +syn keyword ldnsConstant LDNS_RDF_TYPE_TYPE +syn keyword ldnsConstant LDNS_RDF_TYPE_CLASS +syn keyword ldnsConstant LDNS_RDF_TYPE_CERT +syn keyword ldnsConstant LDNS_RDF_TYPE_CERT_ALG +syn keyword ldnsConstant LDNS_RDF_TYPE_ALG +syn keyword ldnsConstant LDNS_RDF_TYPE_UNKNOWN +syn keyword ldnsConstant LDNS_RDF_TYPE_TIME +syn keyword ldnsConstant LDNS_RDF_TYPE_PERIOD +syn keyword ldnsConstant LDNS_RDF_TYPE_TSIGTIME +syn keyword ldnsConstant LDNS_RDF_TYPE_SERVICE +syn keyword ldnsConstant LDNS_RDF_TYPE_LOC +syn keyword ldnsConstant LDNS_RDF_TYPE_WKS +syn keyword ldnsConstant LDNS_RDF_TYPE_NSAP +syn keyword ldnsConstant LDNS_RDF_TYPE_IPSECKEY +syn keyword ldnsConstant LDNS_RDF_TYPE_TSIG +syn keyword ldnsConstant LDNS_MAX_RDFLEN +syn keyword ldnsConstant LDNS_RDF_SIZE_BYTE +syn keyword ldnsConstant LDNS_RDF_SIZE_WORD +syn keyword ldnsConstant LDNS_RDF_SIZE_DOUBLEWORD +syn keyword ldnsConstant LDNS_RDF_SIZE_6BYTES +syn keyword ldnsConstant LDNS_RDF_SIZE_16BYTES + +" ldns/ldns.h +syn keyword ldnsConstant LDNS_PORT +syn keyword ldnsConstant LDNS_IP4ADDRLEN +syn keyword ldnsConstant LDNS_IP6ADDRLEN +syn keyword ldnsConstant LDNS_ROOT_LABEL +syn keyword ldnsConstant LDNS_DEFAULT_TTL + +" ldns/packet.h +syn keyword ldnsType ldns_pkt +syn keyword ldnsType ldns_pkt_section +syn keyword ldnsType ldns_pkt_type +syn keyword ldnsType ldns_pkt_opcode +syn keyword ldnsType ldns_pkt_rcode +syn keyword ldnsConstant LDNS_QR +syn keyword ldnsConstant LDNS_AA +syn keyword ldnsConstant LDNS_TC +syn keyword ldnsConstant LDNS_CD +syn keyword ldnsConstant LDNS_RA +syn keyword ldnsConstant LDNS_AD +syn keyword ldnsConstant LDNS_PACKET_QUESTION +syn keyword ldnsConstant LDNS_PACKET_REFERRAL +syn keyword ldnsConstant LDNS_PACKET_ANSWER +syn keyword ldnsConstant LDNS_PACKET_NXDOMAIN +syn keyword ldnsConstant LDNS_PACKET_NODATA +syn keyword ldnsConstant LDNS_PACKET_UNKNOWN +syn keyword ldnsConstant LDNS_SECTION_QUESTION +syn keyword ldnsConstant LDNS_SECTION_ANSWER +syn keyword ldnsConstant LDNS_SECTION_AUTHORITY +syn keyword ldnsConstant LDNS_SECTION_ADDITIONAL +syn keyword ldnsConstant LDNS_SECTION_ANY +syn keyword ldnsConstant LDNS_SECTION_ANY_NOQUESTION +syn keyword ldnsConstant LDNS_MAX_PACKETLEN +syn keyword ldnsConstant LDNS_PACKET_QUERY +syn keyword ldnsConstant LDNS_PACKET_IQUERY +syn keyword ldnsConstant LDNS_PACKET_STATUS +syn keyword ldnsConstant LDNS_PACKET_NOTIFY +syn keyword ldnsConstant LDNS_PACKET_UPDATE + +syn keyword ldnsConstant LDNS_RCODE_NOERROR +syn keyword ldnsConstant LDNS_RCODE_FORMERR +syn keyword ldnsConstant LDNS_RCODE_SERVFAIL +syn keyword ldnsConstant LDNS_RCODE_NXDOMAIN +syn keyword ldnsConstant LDNS_RCODE_NOTIMPL +syn keyword ldnsConstant LDNS_RCODE_REFUSED +syn keyword ldnsConstant LDNS_RCODE_YXDOMAIN +syn keyword ldnsConstant LDNS_RCODE_YXRRSET +syn keyword ldnsConstant LDNS_RCODE_NXRRSET +syn keyword ldnsConstant LDNS_RCODE_NOTAUTH +syn keyword ldnsConstant LDNS_RCODE_NOTZONE + +" dns/error.h +syn keyword ldnsMacro LDNS_STATUS_OK +syn keyword ldnsMacro LDNS_STATUS_EMPTY_LABEL +syn keyword ldnsMacro LDNS_STATUS_LABEL_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_LABEL_UNDERFLOW +syn keyword ldnsMacro LDNS_STATUS_DOMAINNAME_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_DOMAINNAME_UNDERFLOW +syn keyword ldnsMacro LDNS_STATUS_DDD_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_PACKET_OVERFLOW +syn keyword ldnsMacro LDNS_STATUS_MEM_ERR +syn keyword ldnsMacro LDNS_STATUS_INTERNAL_ERR +syn keyword ldnsMacro LDNS_STATUS_ERR +syn keyword ldnsMacro LDNS_STATUS_ADDRESS_ERR +syn keyword ldnsMacro LDNS_STATUS_NETWORK_ERR +syn keyword ldnsMacro LDNS_STATUS_NO_NAMESERVERS_ERR +syn keyword ldnsMacro LDNS_STATUS_INVALID_POINTER +syn keyword ldnsMacro LDNS_STATUS_INVALID_INT +syn keyword ldnsMacro LDNS_STATUS_INVALID_IP4 +syn keyword ldnsMacro LDNS_STATUS_INVALID_IP6 +syn keyword ldnsMacro LDNS_STATUS_INVALID_STR +syn keyword ldnsMacro LDNS_STATUS_INVALID_B64 +syn keyword ldnsMacro LDNS_STATUS_INVALID_HEX +syn keyword ldnsMacro LDNS_STATUS_UNKNOWN_INET +syn keyword ldnsMacro LDNS_STATUS_NOT_IMPL +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_UNKNOWN_ALGO +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_VALIDATED +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_BOGUS +syn keyword ldnsMacro LDNS_STATUS_INVALID_INT +syn keyword ldnsMacro LDNS_STATUS_INVALID_TIME +syn keyword ldnsMacro LDNS_STATUS_NETWORK_ERR +syn keyword ldnsMacro LDNS_STATUS_ADDRESS_ERR +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_RRSIG +syn keyword ldnsMacro LDNS_STATUS_NULL +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_ALGO_NOT_IMPL +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_DNSKEY +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_TRUSTED_DNSKEY +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_NO_MATCHING_KEYTAG_DNSKEY +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_SIG_EXPIRED +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_SIG_NOT_INCEPTED +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_ERR +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TYPE_COVERED_ERR +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_BOGUS +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_EXPIRATION_BEFORE_INCEPTION +syn keyword ldnsMacro LDNS_STATUS_CRYPTO_TSIG_ERR +syn keyword ldnsMacro LDNS_STATUS_RES_NO_NS +syn keyword ldnsMacro LDNS_STATUS_RES_QUERY +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_HEADER +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_QUESTION +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_ANSWER +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY +syn keyword ldnsMacro LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL +syn keyword ldnsMacro LDNS_STATUS_NO_DATA +syn keyword ldnsMacro LDNS_STATUS_CERT_BAD_ALGORITHM + +" ldns/resolver.h +syn keyword ldnsType ldns_resolver + +" ldns/zone.h +syn keyword ldnsType ldns_zone + +" ldns/rr.h +syn keyword ldnsType ldns_rr_list +syn keyword ldnsType ldns_rr_descriptor +syn keyword ldnsType ldns_rr +syn keyword ldnsType ldns_rr_type +syn keyword ldnsType ldns_rr_class +syn keyword ldnsType ldns_rr_compress + +syn keyword ldnsConstant LDNS_RR_CLASS_IN +syn keyword ldnsConstant LDNS_RR_CLASS_CH +syn keyword ldnsConstant LDNS_RR_CLASS_HS +syn keyword ldnsConstant LDNS_RR_CLASS_NONE +syn keyword ldnsConstant LDNS_RR_CLASS_ANY + +syn keyword ldnsConstant LDNS_RR_TYPE_A +syn keyword ldnsConstant LDNS_RR_TYPE_NS +syn keyword ldnsConstant LDNS_RR_TYPE_MD +syn keyword ldnsConstant LDNS_RR_TYPE_MF +syn keyword ldnsConstant LDNS_RR_TYPE_CNAME +syn keyword ldnsConstant LDNS_RR_TYPE_SOA +syn keyword ldnsConstant LDNS_RR_TYPE_MB +syn keyword ldnsConstant LDNS_RR_TYPE_MG +syn keyword ldnsConstant LDNS_RR_TYPE_MR +syn keyword ldnsConstant LDNS_RR_TYPE_NULL +syn keyword ldnsConstant LDNS_RR_TYPE_WKS +syn keyword ldnsConstant LDNS_RR_TYPE_PTR +syn keyword ldnsConstant LDNS_RR_TYPE_HINFO +syn keyword ldnsConstant LDNS_RR_TYPE_MINFO +syn keyword ldnsConstant LDNS_RR_TYPE_MX +syn keyword ldnsConstant LDNS_RR_TYPE_TXT +syn keyword ldnsConstant LDNS_RR_TYPE_RP +syn keyword ldnsConstant LDNS_RR_TYPE_AFSDB +syn keyword ldnsConstant LDNS_RR_TYPE_X25 +syn keyword ldnsConstant LDNS_RR_TYPE_ISDN +syn keyword ldnsConstant LDNS_RR_TYPE_RT +syn keyword ldnsConstant LDNS_RR_TYPE_NSAP +syn keyword ldnsConstant LDNS_RR_TYPE_SIG +syn keyword ldnsConstant LDNS_RR_TYPE_KEY +syn keyword ldnsConstant LDNS_RR_TYPE_PX +syn keyword ldnsConstant LDNS_RR_TYPE_GPOS +syn keyword ldnsConstant LDNS_RR_TYPE_AAAA +syn keyword ldnsConstant LDNS_RR_TYPE_LOC +syn keyword ldnsConstant LDNS_RR_TYPE_NXT +syn keyword ldnsConstant LDNS_RR_TYPE_SRV +syn keyword ldnsConstant LDNS_RR_TYPE_NAPTR +syn keyword ldnsConstant LDNS_RR_TYPE_KX +syn keyword ldnsConstant LDNS_RR_TYPE_CERT +syn keyword ldnsConstant LDNS_RR_TYPE_DNAME +syn keyword ldnsConstant LDNS_RR_TYPE_OPT +syn keyword ldnsConstant LDNS_RR_TYPE_APL +syn keyword ldnsConstant LDNS_RR_TYPE_DS +syn keyword ldnsConstant LDNS_RR_TYPE_SSHFP +syn keyword ldnsConstant LDNS_RR_TYPE_RRSIG +syn keyword ldnsConstant LDNS_RR_TYPE_NSEC +syn keyword ldnsConstant LDNS_RR_TYPE_DNSKEY +syn keyword ldnsConstant LDNS_RR_TYPE_EID +syn keyword ldnsConstant LDNS_RR_TYPE_NIMLOC +syn keyword ldnsConstant LDNS_RR_TYPE_ATMA +syn keyword ldnsConstant LDNS_RR_TYPE_A6 +syn keyword ldnsConstant LDNS_RR_TYPE_SINK +syn keyword ldnsConstant LDNS_RR_TYPE_IPSECKEY +syn keyword ldnsConstant LDNS_RR_TYPE_UINFO +syn keyword ldnsConstant LDNS_RR_TYPE_UID +syn keyword ldnsConstant LDNS_RR_TYPE_GID +syn keyword ldnsConstant LDNS_RR_TYPE_UNSPEC +syn keyword ldnsConstant LDNS_RR_TYPE_TSIG +syn keyword ldnsConstant LDNS_RR_TYPE_IXFR +syn keyword ldnsConstant LDNS_RR_TYPE_AXFR +syn keyword ldnsConstant LDNS_RR_TYPE_MAILB +syn keyword ldnsConstant LDNS_RR_TYPE_MAILA +syn keyword ldnsConstant LDNS_RR_TYPE_ANY +syn keyword ldnsConstant LDNS_MAX_LABELLEN +syn keyword ldnsConstant LDNS_MAX_DOMAINLEN +syn keyword ldnsConstant LDNS_RR_COMPRESS +syn keyword ldnsConstant LDNS_RR_NO_COMPRESS + +syn keyword ldnsMacro QHEADERSZ +syn keyword ldnsMacro RD_MASK +syn keyword ldnsMacro RD_SHIFT +syn keyword ldnsMacro LDNS_RD +syn keyword ldnsMacro RD_SET +syn keyword ldnsMacro RD_CLR +syn keyword ldnsMacro TC_MASK +syn keyword ldnsMacro TC_SHIFT +syn keyword ldnsMacro LDNS_TC +syn keyword ldnsMacro TC_SET +syn keyword ldnsMacro TC_CLR +syn keyword ldnsMacro AA_MASK +syn keyword ldnsMacro AA_SHIFT +syn keyword ldnsMacro LDNS_AA +syn keyword ldnsMacro AA_SET +syn keyword ldnsMacro AA_CLR +syn keyword ldnsMacro OPCODE_MASK +syn keyword ldnsMacro OPCODE_SHIFT +syn keyword ldnsMacro OPCODE +syn keyword ldnsMacro OPCODE_SET +syn keyword ldnsMacro QR_MASK +syn keyword ldnsMacro QR_SHIFT +syn keyword ldnsMacro LDNS_QR +syn keyword ldnsMacro QR_SET +syn keyword ldnsMacro QR_CLR +syn keyword ldnsMacro RCODE_MASK +syn keyword ldnsMacro RCODE_SHIFT +syn keyword ldnsMacro RCODE +syn keyword ldnsMacro RCODE_SET +syn keyword ldnsMacro CD_MASK +syn keyword ldnsMacro CD_SHIFT +syn keyword ldnsMacro LDNS_CD +syn keyword ldnsMacro CD_SET +syn keyword ldnsMacro CD_CLR +syn keyword ldnsMacro AD_MASK +syn keyword ldnsMacro AD_SHIFT +syn keyword ldnsMacro LDNS_AD +syn keyword ldnsMacro AD_SET +syn keyword ldnsMacro AD_CLR +syn keyword ldnsMacro Z_MASK +syn keyword ldnsMacro Z_SHIFT +syn keyword ldnsMacro LDNS_Z +syn keyword ldnsMacro Z_SET +syn keyword ldnsMacro Z_CLR +syn keyword ldnsMacro RA_MASK +syn keyword ldnsMacro RA_SHIFT +syn keyword ldnsMacro LDNS_RA +syn keyword ldnsMacro RA_SET +syn keyword ldnsMacro RA_CLR +syn keyword ldnsMacro LDNS_ID +syn keyword ldnsMacro QDCOUNT_OFF +syn keyword ldnsMacro QDCOUNT +syn keyword ldnsMacro ANCOUNT_OFF +syn keyword ldnsMacro ANCOUNT +syn keyword ldnsMacro NSCOUNT_OFF +syn keyword ldnsMacro NSCOUNT +syn keyword ldnsMacro ARCOUNT_OFF +syn keyword ldnsMacro ARCOUNT + +" ldns/buffer.h +syn keyword ldnsType ldns_buffer +syn keyword ldnsConstant LDNS_MIN_BUFLEN + +" ldns/host2str.h +syn keyword ldnsType ldns_lookup_table +syn keyword ldnsConstant LDNS_APL_IP4 +syn keyword ldnsConstant LDNS_APL_IP6 + +" ldns/keys.h +syn keyword ldnsType ldns_key +syn keyword ldnsType ldns_key_list +syn keyword ldnsType ldns_signing_algorithm +syn keyword ldnsType ldns_hash + +" ldns/dnssec.h +syn keyword ldnsConstant LDNS_MAX_KEYLEN + +" Default highlighting +command -nargs=+ HiLink hi def link +HiLink ldnsType Type +HiLink ldnsFunction Function +HiLink ldnsMacro Macro +HiLink ldnsConstant Constant +delcommand HiLink diff --git a/libs/ldns/linktest.c b/libs/ldns/linktest.c new file mode 100644 index 0000000000..c21753a53f --- /dev/null +++ b/libs/ldns/linktest.c @@ -0,0 +1,13 @@ + +#include "ldns/config.h" +#include + +int +main(void) +{ + ldns_rr *rr = ldns_rr_new(); + + ldns_rr_free(rr); + return 0; +} + diff --git a/libs/ldns/ltmain.sh b/libs/ldns/ltmain.sh new file mode 100644 index 0000000000..6dfcfd58a9 --- /dev/null +++ b/libs/ldns/ltmain.sh @@ -0,0 +1,9687 @@ + +# libtool (GNU libtool) 2.4 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [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 +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# 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. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4 +TIMESTAMP="" +package_revision=1.3293 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${EGREP="grep -E"} +: ${FGREP="grep -F"} +: ${GREP="grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# 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' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_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 $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + + # FreeBSD-specific: where we install compilers with non-standard names + tag_compilers_CC="*cc cc* *gcc gcc* clang" + tag_compilers_CXX="*c++ c++* *g++ g++* clang++" + base_compiler=`set -- "$@"; echo $1` + + # If $tagname isn't set, then try to infer if the default "CC" tag applies + if test -z "$tagname"; then + for zp in $tag_compilers_CC; do + case $base_compiler in + $zp) tagname="CC"; break;; + esac + done + fi + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + + # FreeBSD-specific: try compilers based on inferred tag + if test -z "$tagname"; then + eval "tag_compilers=\$tag_compilers_${z}" + if test -n "$tag_compilers"; then + for zp in $tag_compilers; do + case $base_compiler in + $zp) tagname=$z; break;; + esac + done + if test -n "$tagname"; then + break + fi + fi + fi + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # 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 "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + 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 $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "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." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # 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 + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + 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." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + 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." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build 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, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [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 + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [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 + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -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-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -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 + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +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: $progname [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." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + 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 + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + 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 $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + 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 the \`-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" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # 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 || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + 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 + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append 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 + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # 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" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + 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/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + 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*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *-*-freebsd*) + # FreeBSD doesn't need this... + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + 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 "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# 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. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED '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 \"\$file\" | $SED '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 \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + 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 "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $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 "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # 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 \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${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\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' + + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # 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 invocation. + # 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 + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_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 + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append 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 + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + 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 + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + deplibs="$deplibs $arg" + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + fi + + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + ;; + *) + ;; + esac # linkmode + + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $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" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # 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_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + 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." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + 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 + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + 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 + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # 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 behavior. + 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. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + 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 "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $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" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $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" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + 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 + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + 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." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + 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 + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # 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 + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + 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"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_apped 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" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_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 + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_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 and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${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" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + 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 "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append 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"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + 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"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append 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" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + 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 + func_append 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 + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + 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" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED '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 "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + 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 $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/libs/ldns/net.c b/libs/ldns/net.c new file mode 100644 index 0000000000..bf8766b990 --- /dev/null +++ b/libs/ldns/net.c @@ -0,0 +1,884 @@ +/* + * net.c + * + * Network implementation + * All network related functions are grouped here + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#ifdef HAVE_NETINET_IN_H +#include +#endif +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_NETDB_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#include +#include +#include + +ldns_status +ldns_send(ldns_pkt **result_packet, ldns_resolver *r, const ldns_pkt *query_pkt) +{ + ldns_buffer *qb; + ldns_status result; + ldns_rdf *tsig_mac = NULL; + + qb = ldns_buffer_new(LDNS_MIN_BUFLEN); + + if (query_pkt && ldns_pkt_tsig(query_pkt)) { + tsig_mac = ldns_rr_rdf(ldns_pkt_tsig(query_pkt), 3); + } + + if (!query_pkt || + ldns_pkt2buffer_wire(qb, query_pkt) != LDNS_STATUS_OK) { + result = LDNS_STATUS_ERR; + } else { + result = ldns_send_buffer(result_packet, r, qb, tsig_mac); + } + + ldns_buffer_free(qb); + + return result; +} + +ldns_status +ldns_send_buffer(ldns_pkt **result, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac) +{ + uint8_t i; + + struct sockaddr_storage *ns; + size_t ns_len; + struct timeval tv_s; + struct timeval tv_e; + + ldns_rdf **ns_array; + size_t *rtt; + ldns_pkt *reply; + bool all_servers_rtt_inf; + uint8_t retries; + + uint8_t *reply_bytes = NULL; + size_t reply_size = 0; + ldns_status status, send_status; + + assert(r != NULL); + + status = LDNS_STATUS_OK; + rtt = ldns_resolver_rtt(r); + ns_array = ldns_resolver_nameservers(r); + reply = NULL; + ns_len = 0; + + all_servers_rtt_inf = true; + + if (ldns_resolver_random(r)) { + ldns_resolver_nameservers_randomize(r); + } + + /* loop through all defined nameservers */ + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + if (rtt[i] == LDNS_RESOLV_RTT_INF) { + /* not reachable nameserver! */ + continue; + } + + /* maybe verbosity setting? + printf("Sending to "); + ldns_rdf_print(stdout, ns_array[i]); + printf("\n"); + */ + ns = ldns_rdf2native_sockaddr_storage(ns_array[i], + ldns_resolver_port(r), &ns_len); + + if ((ns->ss_family == AF_INET) && + (ldns_resolver_ip6(r) == LDNS_RESOLV_INET6)) { + /* not reachable */ + continue; + } + + if ((ns->ss_family == AF_INET6) && + (ldns_resolver_ip6(r) == LDNS_RESOLV_INET)) { + /* not reachable */ + continue; + } + + all_servers_rtt_inf = false; + + gettimeofday(&tv_s, NULL); + + send_status = LDNS_STATUS_ERR; + + /* reply_bytes implicitly handles our error */ + if (1 == ldns_resolver_usevc(r)) { + for (retries = ldns_resolver_retry(r); retries > 0; retries--) { + send_status = + ldns_tcp_send(&reply_bytes, qb, ns, + (socklen_t)ns_len, ldns_resolver_timeout(r), + &reply_size); + if (send_status == LDNS_STATUS_OK) { + break; + } + } + } else { + for (retries = ldns_resolver_retry(r); retries > 0; retries--) { + /* ldns_rdf_print(stdout, ns_array[i]); */ + send_status = + ldns_udp_send(&reply_bytes, qb, ns, + (socklen_t)ns_len, ldns_resolver_timeout(r), + &reply_size); + + if (send_status == LDNS_STATUS_OK) { + break; + } + } + } + + if (send_status != LDNS_STATUS_OK) { + ldns_resolver_set_nameserver_rtt(r, i, LDNS_RESOLV_RTT_INF); + status = send_status; + } + + /* obey the fail directive */ + if (!reply_bytes) { + /* the current nameserver seems to have a problem, blacklist it */ + if (ldns_resolver_fail(r)) { + LDNS_FREE(ns); + return LDNS_STATUS_ERR; + } else { + LDNS_FREE(ns); + continue; + } + } + + status = ldns_wire2pkt(&reply, reply_bytes, reply_size); + if (status != LDNS_STATUS_OK) { + LDNS_FREE(reply_bytes); + LDNS_FREE(ns); + return status; + } + + LDNS_FREE(ns); + gettimeofday(&tv_e, NULL); + + if (reply) { + ldns_pkt_set_querytime(reply, (uint32_t) + ((tv_e.tv_sec - tv_s.tv_sec) * 1000) + + (tv_e.tv_usec - tv_s.tv_usec) / 1000); + ldns_pkt_set_answerfrom(reply, ns_array[i]); + ldns_pkt_set_timestamp(reply, tv_s); + ldns_pkt_set_size(reply, reply_size); + break; + } else { + if (ldns_resolver_fail(r)) { + /* if fail is set bail out, after the first + * one */ + break; + } + } + + /* wait retrans seconds... */ + sleep((unsigned int) ldns_resolver_retrans(r)); + } + + if (all_servers_rtt_inf) { + LDNS_FREE(reply_bytes); + return LDNS_STATUS_RES_NO_NS; + } +#ifdef HAVE_SSL + if (tsig_mac && reply_bytes) { + if (!ldns_pkt_tsig_verify(reply, + reply_bytes, + reply_size, + ldns_resolver_tsig_keyname(r), + ldns_resolver_tsig_keydata(r), tsig_mac)) { + status = LDNS_STATUS_CRYPTO_TSIG_BOGUS; + } + } +#else + (void)tsig_mac; +#endif /* HAVE_SSL */ + + LDNS_FREE(reply_bytes); + if (result) { + *result = reply; + } + + return status; +} + +/** best effort to set nonblocking */ +static void +ldns_sock_nonblock(int sockfd) +{ +#ifdef HAVE_FCNTL + int flag; + if((flag = fcntl(sockfd, F_GETFL)) != -1) { + flag |= O_NONBLOCK; + if(fcntl(sockfd, F_SETFL, flag) == -1) { + /* ignore error, continue blockingly */ + } + } +#elif defined(HAVE_IOCTLSOCKET) + unsigned long on = 1; + if(ioctlsocket(sockfd, FIONBIO, &on) != 0) { + /* ignore error, continue blockingly */ + } +#endif +} + +/** best effort to set blocking */ +static void +ldns_sock_block(int sockfd) +{ +#ifdef HAVE_FCNTL + int flag; + if((flag = fcntl(sockfd, F_GETFL)) != -1) { + flag &= ~O_NONBLOCK; + if(fcntl(sockfd, F_SETFL, flag) == -1) { + /* ignore error, continue */ + } + } +#elif defined(HAVE_IOCTLSOCKET) + unsigned long off = 0; + if(ioctlsocket(sockfd, FIONBIO, &off) != 0) { + /* ignore error, continue */ + } +#endif +} + +/** wait for a socket to become ready */ +static int +ldns_sock_wait(int sockfd, struct timeval timeout, int write) +{ + fd_set fds; + int ret; +#ifndef S_SPLINT_S + FD_ZERO(&fds); + FD_SET(FD_SET_T sockfd, &fds); +#endif + if(write) + ret = select(sockfd+1, NULL, &fds, NULL, &timeout); + else + ret = select(sockfd+1, &fds, NULL, NULL, &timeout); + if(ret == 0) + /* timeout expired */ + return 0; + else if(ret == -1) + /* error */ + return 0; + return 1; +} + +ldns_status +ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, + socklen_t tolen, struct timeval timeout, size_t *answer_size) +{ + int sockfd; + uint8_t *answer; + + sockfd = ldns_udp_bgsend(qbin, to, tolen, timeout); + + if (sockfd == 0) { + return LDNS_STATUS_SOCKET_ERROR; + } + + /* wait for an response*/ + if(!ldns_sock_wait(sockfd, timeout, 0)) { +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + return LDNS_STATUS_NETWORK_ERR; + } + + /* set to nonblocking, so if the checksum is bad, it becomes + * an EGAIN error and the ldns_udp_send function does not block, + * but returns a 'NETWORK_ERROR' much like a timeout. */ + ldns_sock_nonblock(sockfd); + + answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL); +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + + if (*answer_size == 0) { + /* oops */ + return LDNS_STATUS_NETWORK_ERR; + } + + *result = answer; + return LDNS_STATUS_OK; +} + +int +ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + int sockfd; + + sockfd = ldns_udp_connect(to, timeout); + + if (sockfd == 0) { + return 0; + } + + if (ldns_udp_send_query(qbin, sockfd, to, tolen) == 0) { + return 0; + } + return sockfd; +} + +int +ldns_udp_connect(const struct sockaddr_storage *to, struct timeval ATTR_UNUSED(timeout)) +{ + int sockfd; + + if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM, + IPPROTO_UDP)) + == -1) { + return 0; + } + return sockfd; +} + +int +ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + int sockfd; + + if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_STREAM, + IPPROTO_TCP)) == -1) { + return 0; + } + + /* perform nonblocking connect, to be able to wait with select() */ + ldns_sock_nonblock(sockfd); + if (connect(sockfd, (struct sockaddr*)to, tolen) == -1) { +#ifndef USE_WINSOCK +#ifdef EINPROGRESS + if(errno != EINPROGRESS) { +#else + if(1) { +#endif + close(sockfd); + return 0; + } +#else /* USE_WINSOCK */ + if(WSAGetLastError() != WSAEINPROGRESS && + WSAGetLastError() != WSAEWOULDBLOCK) { + closesocket(sockfd); + return 0; + } +#endif + /* error was only telling us that it would block */ + } + + /* wait(write) until connected or error */ + while(1) { + int error = 0; + socklen_t len = (socklen_t)sizeof(error); + + if(!ldns_sock_wait(sockfd, timeout, 1)) { +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + return 0; + } + + /* check if there is a pending error for nonblocking connect */ + if(getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void*)&error, + &len) < 0) { +#ifndef USE_WINSOCK + error = errno; /* on solaris errno is error */ +#else + error = WSAGetLastError(); +#endif + } +#ifndef USE_WINSOCK +#if defined(EINPROGRESS) && defined(EWOULDBLOCK) + if(error == EINPROGRESS || error == EWOULDBLOCK) + continue; /* try again */ +#endif + else if(error != 0) { + close(sockfd); + /* error in errno for our user */ + errno = error; + return 0; + } +#else /* USE_WINSOCK */ + if(error == WSAEINPROGRESS) + continue; + else if(error == WSAEWOULDBLOCK) + continue; + else if(error != 0) { + closesocket(sockfd); + errno = error; + return 0; + } +#endif /* USE_WINSOCK */ + /* connected */ + break; + } + + /* set the socket blocking again */ + ldns_sock_block(sockfd); + + return sockfd; +} + +ssize_t +ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, + const struct sockaddr_storage *to, socklen_t tolen) +{ + uint8_t *sendbuf; + ssize_t bytes; + + /* add length of packet */ + sendbuf = LDNS_XMALLOC(uint8_t, ldns_buffer_position(qbin) + 2); + if(!sendbuf) return 0; + ldns_write_uint16(sendbuf, ldns_buffer_position(qbin)); + memcpy(sendbuf + 2, ldns_buffer_export(qbin), ldns_buffer_position(qbin)); + + bytes = sendto(sockfd, (void*)sendbuf, + ldns_buffer_position(qbin) + 2, 0, (struct sockaddr *)to, tolen); + + LDNS_FREE(sendbuf); + + if (bytes == -1 || (size_t) bytes != ldns_buffer_position(qbin) + 2 ) { + return 0; + } + return bytes; +} + +/* don't wait for an answer */ +ssize_t +ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, + socklen_t tolen) +{ + ssize_t bytes; + + bytes = sendto(sockfd, (void*)ldns_buffer_begin(qbin), + ldns_buffer_position(qbin), 0, (struct sockaddr *)to, tolen); + + if (bytes == -1 || (size_t)bytes != ldns_buffer_position(qbin)) { + return 0; + } + if ((size_t) bytes != ldns_buffer_position(qbin)) { + return 0; + } + return bytes; +} + +uint8_t * +ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *from, + socklen_t *fromlen) +{ + uint8_t *wire, *wireout; + ssize_t wire_size; + + wire = LDNS_XMALLOC(uint8_t, LDNS_MAX_PACKETLEN); + if (!wire) { + *size = 0; + return NULL; + } + + wire_size = recvfrom(sockfd, (void*)wire, LDNS_MAX_PACKETLEN, 0, + (struct sockaddr *)from, fromlen); + + /* recvfrom can also return 0 */ + if (wire_size == -1 || wire_size == 0) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + + *size = (size_t)wire_size; + wireout = LDNS_XREALLOC(wire, uint8_t, (size_t)wire_size); + if(!wireout) LDNS_FREE(wire); + + return wireout; +} + +uint8_t * +ldns_tcp_read_wire_timeout(int sockfd, size_t *size, struct timeval timeout) +{ + uint8_t *wire; + uint16_t wire_size; + ssize_t bytes = 0, rc = 0; + + wire = LDNS_XMALLOC(uint8_t, 2); + if (!wire) { + *size = 0; + return NULL; + } + + while (bytes < 2) { + if(!ldns_sock_wait(sockfd, timeout, 0)) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (2 - bytes), 0); + if (rc == -1 || rc == 0) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + bytes += rc; + } + + wire_size = ldns_read_uint16(wire); + + LDNS_FREE(wire); + wire = LDNS_XMALLOC(uint8_t, wire_size); + if (!wire) { + *size = 0; + return NULL; + } + bytes = 0; + + while (bytes < (ssize_t) wire_size) { + if(!ldns_sock_wait(sockfd, timeout, 0)) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (wire_size - bytes), 0); + if (rc == -1 || rc == 0) { + LDNS_FREE(wire); + *size = 0; + return NULL; + } + bytes += rc; + } + + *size = (size_t) bytes; + return wire; +} + +uint8_t * +ldns_tcp_read_wire(int sockfd, size_t *size) +{ + uint8_t *wire; + uint16_t wire_size; + ssize_t bytes = 0, rc = 0; + + wire = LDNS_XMALLOC(uint8_t, 2); + if (!wire) { + *size = 0; + return NULL; + } + + while (bytes < 2) { + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (2 - bytes), 0); + if (rc == -1 || rc == 0) { + *size = 0; + LDNS_FREE(wire); + return NULL; + } + bytes += rc; + } + + wire_size = ldns_read_uint16(wire); + + LDNS_FREE(wire); + wire = LDNS_XMALLOC(uint8_t, wire_size); + if (!wire) { + *size = 0; + return NULL; + } + bytes = 0; + + while (bytes < (ssize_t) wire_size) { + rc = recv(sockfd, (void*) (wire + bytes), + (size_t) (wire_size - bytes), 0); + if (rc == -1 || rc == 0) { + LDNS_FREE(wire); + *size = 0; + return NULL; + } + bytes += rc; + } + + *size = (size_t) bytes; + return wire; +} + +/* keep in mind that in DNS tcp messages the first 2 bytes signal the + * amount data to expect + */ +ldns_status +ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, + socklen_t tolen, struct timeval timeout, size_t *answer_size) +{ + int sockfd; + uint8_t *answer; + + sockfd = ldns_tcp_bgsend(qbin, to, tolen, timeout); + + if (sockfd == 0) { + return LDNS_STATUS_ERR; + } + + answer = ldns_tcp_read_wire_timeout(sockfd, answer_size, timeout); +#ifndef USE_WINSOCK + close(sockfd); +#else + closesocket(sockfd); +#endif + + if (*answer_size == 0) { + /* oops */ + return LDNS_STATUS_NETWORK_ERR; + } + + /* resize accordingly */ + *result = (uint8_t*)LDNS_XREALLOC(answer, uint8_t *, (size_t)*answer_size); + if(!*result) { + LDNS_FREE(answer); + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +int +ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, + struct timeval timeout) +{ + int sockfd; + + sockfd = ldns_tcp_connect(to, tolen, timeout); + + if (sockfd == 0) { + return 0; + } + + if (ldns_tcp_send_query(qbin, sockfd, to, tolen) == 0) { + return 0; + } + + return sockfd; +} + +/* code from rdata.c */ +struct sockaddr_storage * +ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size) +{ + struct sockaddr_storage *data; + struct sockaddr_in *data_in; + struct sockaddr_in6 *data_in6; + + data = LDNS_MALLOC(struct sockaddr_storage); + if (!data) { + return NULL; + } + /* zero the structure for portability */ + memset(data, 0, sizeof(struct sockaddr_storage)); + if (port == 0) { + port = LDNS_PORT; + } + + switch(ldns_rdf_get_type(rd)) { + case LDNS_RDF_TYPE_A: + data->ss_family = AF_INET; + data_in = (struct sockaddr_in*) data; + data_in->sin_port = (in_port_t)htons(port); + memcpy(&(data_in->sin_addr), ldns_rdf_data(rd), ldns_rdf_size(rd)); + *size = sizeof(struct sockaddr_in); + return data; + case LDNS_RDF_TYPE_AAAA: + data->ss_family = AF_INET6; + data_in6 = (struct sockaddr_in6*) data; + data_in6->sin6_port = (in_port_t)htons(port); + memcpy(&data_in6->sin6_addr, ldns_rdf_data(rd), ldns_rdf_size(rd)); + *size = sizeof(struct sockaddr_in6); + return data; + default: + LDNS_FREE(data); + return NULL; + } +} + +ldns_rdf * +ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port) +{ + ldns_rdf *addr; + struct sockaddr_in *data_in; + struct sockaddr_in6 *data_in6; + + switch(sock->ss_family) { + case AF_INET: + data_in = (struct sockaddr_in*)sock; + if (port) { + *port = ntohs((uint16_t)data_in->sin_port); + } + addr = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_A, + LDNS_IP4ADDRLEN, &data_in->sin_addr); + break; + case AF_INET6: + data_in6 = (struct sockaddr_in6*)sock; + if (port) { + *port = ntohs((uint16_t)data_in6->sin6_port); + } + addr = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_AAAA, + LDNS_IP6ADDRLEN, &data_in6->sin6_addr); + break; + default: + if (port) { + *port = 0; + } + return NULL; + } + return addr; +} + +/* code from resolver.c */ +ldns_status +ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) +{ + ldns_pkt *query; + ldns_buffer *query_wire; + + struct sockaddr_storage *ns = NULL; + size_t ns_len = 0; + size_t ns_i; + ldns_status status; + + if (!resolver || ldns_resolver_nameserver_count(resolver) < 1) { + return LDNS_STATUS_ERR; + } + + query = ldns_pkt_query_new(ldns_rdf_clone(domain), LDNS_RR_TYPE_AXFR, class, 0); + + if (!query) { + return LDNS_STATUS_ADDRESS_ERR; + } + /* For AXFR, we have to make the connection ourselves */ + /* try all nameservers (which usually would mean v4 fallback if + * @hostname is used */ + for (ns_i = 0; + ns_i < ldns_resolver_nameserver_count(resolver) && + resolver->_socket == 0; + ns_i++) { + ns = ldns_rdf2native_sockaddr_storage( + resolver->_nameservers[ns_i], + ldns_resolver_port(resolver), &ns_len); + + resolver->_socket = ldns_tcp_connect(ns, (socklen_t)ns_len, + ldns_resolver_timeout(resolver)); + } + + if (resolver->_socket == 0) { + ldns_pkt_free(query); + LDNS_FREE(ns); + return LDNS_STATUS_NETWORK_ERR; + } + +#ifdef HAVE_SSL + if (ldns_resolver_tsig_keyname(resolver) && ldns_resolver_tsig_keydata(resolver)) { + status = ldns_pkt_tsig_sign(query, + ldns_resolver_tsig_keyname(resolver), + ldns_resolver_tsig_keydata(resolver), + 300, ldns_resolver_tsig_algorithm(resolver), NULL); + if (status != LDNS_STATUS_OK) { + /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start + we have to close the socket here! */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return LDNS_STATUS_CRYPTO_TSIG_ERR; + } + } +#endif /* HAVE_SSL */ + + /* Convert the query to a buffer + * Is this necessary? + */ + query_wire = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if(!query_wire) { + ldns_pkt_free(query); + LDNS_FREE(ns); +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return LDNS_STATUS_MEM_ERR; + } + status = ldns_pkt2buffer_wire(query_wire, query); + if (status != LDNS_STATUS_OK) { + ldns_pkt_free(query); + ldns_buffer_free(query_wire); + LDNS_FREE(ns); + + /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start + we have to close the socket here! */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return status; + } + /* Send the query */ + if (ldns_tcp_send_query(query_wire, resolver->_socket, ns, + (socklen_t)ns_len) == 0) { + ldns_pkt_free(query); + ldns_buffer_free(query_wire); + LDNS_FREE(ns); + + /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start + we have to close the socket here! */ + +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return LDNS_STATUS_NETWORK_ERR; + } + + ldns_pkt_free(query); + ldns_buffer_free(query_wire); + LDNS_FREE(ns); + + /* + * The AXFR is done once the second SOA record is sent + */ + resolver->_axfr_soa_count = 0; + return LDNS_STATUS_OK; +} diff --git a/libs/ldns/packaging/fedora/ldns.spec b/libs/ldns/packaging/fedora/ldns.spec new file mode 100644 index 0000000000..abcdc81308 --- /dev/null +++ b/libs/ldns/packaging/fedora/ldns.spec @@ -0,0 +1,276 @@ +%{?!with_python: %global with_python 1} + +%if %{with_python} +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} +%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} +%endif + +Summary: Lowlevel DNS(SEC) library with API +Name: ldns +Version: 1.6.9 +Release: 2%{?dist} +License: BSD +Url: http://www.nlnetlabs.nl/%{name}/ +Source: http://www.nlnetlabs.nl/downloads/%{name}-%{version}.tar.gz +Group: System Environment/Libraries +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: libtool, autoconf, automake, gcc-c++, doxygen, +BuildRequires: perl, libpcap-devel, openssl-devel + +%if %{with_python} +BuildRequires: python-devel, swig +%endif + +%description +ldns is a library with the aim to simplify DNS programing in C. All +lowlevel DNS/DNSSEC operations are supported. We also define a higher +level API which allows a programmer to (for instance) create or sign +packets. + +%package devel +Summary: Development package that includes the ldns header files +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +The devel package contains the ldns library and the include files + +%if %{with_python} +%package python +Summary: Python extensions for ldns +Group: Applications/System +Requires: %{name} = %{version}-%{release} + +%description python +Python extensions for ldns +%endif + + +%prep +%setup -q +# To built svn snapshots +#rm config.guess config.sub ltmain.sh +#aclocal +#libtoolize -c --install +#autoreconf --install + +%build +%configure --disable-rpath --disable-static --with-sha2 \ +%if %{with_python} + --with-pyldns +%endif + +(cd drill ; %configure --disable-rpath --disable-static --with-ldns=%{buildroot}/lib/ ) +(cd examples ; %configure --disable-rpath --disable-static --with-ldns=%{buildroot}/lib/ ) + +make %{?_smp_mflags} +( cd drill ; make %{?_smp_mflags} ) +( cd examples ; make %{?_smp_mflags} ) +make %{?_smp_mflags} doc + +%install +rm -rf %{buildroot} + +make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install +make DESTDIR=%{buildroot} INSTALL="%{__install} -p" install-doc + +# don't package building script in doc +rm doc/doxyparse.pl +#remove doc stubs +rm -rf doc/.svn +#remove double set of man pages +rm -rf doc/man + +# remove .la files +rm -rf %{buildroot}%{_libdir}/*.la %{buildroot}%{python_sitelib}/*.la +(cd drill ; make DESTDIR=%{buildroot} install) +(cd examples; make DESTDIR=%{buildroot} install) + +%clean +rm -rf %{buildroot} + +%files +%defattr(-,root,root) +%{_libdir}/libldns*so.* +%{_bindir}/drill +%{_bindir}/ldnsd +#%{_bindir}/ldns-* +%{_bindir}/ldns-chaos +%{_bindir}/ldns-compare-zones +%{_bindir}/ldns-[d-z]* +%doc README LICENSE +%{_mandir}/*/* + +%files devel +%defattr(-,root,root,-) +%{_libdir}/libldns*so +%{_bindir}/ldns-config +%dir %{_includedir}/ldns +%{_includedir}/ldns/*.h +%doc doc Changelog README + +%if %{with_python} +%files python +%defattr(-,root,root) +%{python_sitelib}/* +%endif + +%post -p /sbin/ldconfig + +%postun -p /sbin/ldconfig + +%changelog +* Wed Mar 16 2011 Willem Toorop - 1.6.9 +- Upgraded to 1.6.9. + +* Mon Nov 8 2010 Matthijs Mekking - 1.6.8 +- Upgraded to 1.6.8. + +* Tue Aug 24 2010 Matthijs Mekking - 1.6.7 +- Upgraded to 1.6.7. + +* Fri Jan 22 2010 Paul Wouters - 1.6.4-2 +- Fix missing _ldns.so causing ldns-python to not work +- Patch for installing ldns-python files +- Patch for rpath in ldns-python +- Don't install .a file for ldns-python + +* Wed Jan 20 2010 Paul Wouters - 1.6.4-1 +- Upgraded to 1.6.4. +- Added ldns-python sub package + +* Fri Dec 04 2009 Paul Wouters - 1.6.3-1 +- Upgraded to 1.6.3, which has minor bugfixes + +* Fri Nov 13 2009 Paul Wouters - 1.6.2-1 +- Upgraded to 1.6.2. This fixes various bugs. + (upstream released mostly to default with sha2 for the imminent + signed root, but we already enabled that in our builds) + +* Tue Aug 25 2009 Tomas Mraz - 1.6.1-3 +- rebuilt with new openssl + +* Sun Aug 16 2009 Paul Wouters - 1.6.1-2 +- Added openssl dependancy back in, since we get more functionality + when using openssl. Especially in 'drill'. + +* Sun Aug 16 2009 Paul Wouters - 1.6.1-1 +- Updated to 1.6.1 + +* Fri Jul 24 2009 Fedora Release Engineering - 1.6.0-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Mon Jul 13 2009 Paul Wouters - 1.6.0-4 +- Fixed the ssl patch so it can now compile --without-ssl + +* Sat Jul 11 2009 Paul Wouters - 1.6.0-3 +- Added patch to compile with --without-ssl +- Removed openssl dependancies +- Recompiled with --without-ssl + +* Sat Jul 11 2009 Paul Wouters - 1.6.0-2 +- Updated to 1.6.0 +- (did not yet compile with --without-ssl due to compile failures) + +* Fri Jul 10 2009 Paul Wouters - 1.6.0-1 +- Updated to 1.6.0 +- Compile without openssl + +* Thu Apr 16 2009 Paul Wouters - 1.5.1-4 +- Memory management bug when generating a sha256 key, see: + https://bugzilla.redhat.com/show_bug.cgi?id=493953 + +* Wed Feb 25 2009 Fedora Release Engineering - 1.5.1-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Mon Feb 10 2009 Paul Wouters - 1.5.1-1 +- Updated to new version, 1.5.0 had a bug preventing + zone signing. + +* Mon Feb 9 2009 Paul Wouters - 1.5.0-1 +- Updated to new version + +* Thu Feb 05 2009 Adam Tkac - 1.4.0-3 +- fixed configure flags + +* Sat Jan 17 2009 Tomas Mraz - 1.4.0-2 +- rebuild with new openssl + +* Fri Nov 7 2008 Paul Wouters - 1.4.0-1 +- Updated to 1.4.0 + +* Wed May 28 2008 Paul Wouters - 1.3.0-3 +- enable SHA2 functionality + +* Wed May 28 2008 Paul Wouters - 1.3.0-2 +- re-tag (don't do builds while renaming local repo dirs) + +* Wed May 28 2008 Paul Wouters - 1.3.0-1 +- Updated to latest release + +* Tue Feb 19 2008 Fedora Release Engineering - 1.2.2-3 +- Autorebuild for GCC 4.3 + +* Wed Dec 5 2007 Paul Wouters - 1.2.2-2 +- Rebuild for new libcrypto + +* Thu Nov 29 2007 Paul Wouters - 1.2.2-1 +- Upgraded to 1.2.2. Removed no longer needed race workaround + +* Tue Nov 13 2007 Paul Wouters - 1.2.1-4 +- Try to fix racing ln -s statements in parallel builds + +* Fri Nov 9 2007 Paul Wouters - 1.2.1-3 +- Added patch for ldns-read-zone that does not put @. in RRDATA + +* Fri Oct 19 2007 Paul Wouters - 1.2.1-2 +- Use install -p to work around multilib conflicts for .h files + +* Wed Oct 10 2007 Paul Wouters - 1.2.1-1 +- Updated to 1.2.1 +- Removed patches that got moved into upstream + +* Wed Aug 8 2007 Paul Wouters 1.2.0-11 +- Patch for ldns-key2ds to write to stdout +- Again remove extra set of man pages from doc +- own /usr/include/ldns (bug 233858) + +* Wed Aug 8 2007 Paul Wouters 1.2.0-10 +- Added sha256 DS record patch to ldns-key2ds +- Minor tweaks for proper doc/man page installation. +- Workaround for parallel builds + +* Mon Aug 6 2007 Paul Wouters 1.2.0-2 +- Own the /usr/include/ldns directory (bug #233858) +- Removed obsoleted patch +- Remove files form previous libtool run accidentally packages by upstream + +* Mon Sep 11 2006 Paul Wouters 1.0.1-4 +- Commented out 1.1.0 make targets, put make 1.0.1 targets. + +* Mon Sep 11 2006 Paul Wouters 1.0.1-3 +- Fixed changelog typo in date +- Rebuild requested for PT_GNU_HASH support from gcc +- Did not upgrade to 1.1.0 due to compile issues on x86_64 + +* Fri Jan 6 2006 Paul Wouters 1.0.1-1 +- Upgraded to 1.0.1. Removed temporary clean hack from spec file. + +* Sun Dec 18 2005 Paul Wouters 1.0.0-8 +- Cannot use make clean because there are no Makefiles. Use hardcoded rm. + +* Sun Dec 18 2005 Paul Wouters 1.0.0-7 +- Patched 'make clean' target to get rid of object files shipped with 1.0.0 + +* Sun Dec 13 2005 Paul Wouters 1.0.0-6 +- added a make clean for 2.3.3 since .o files were left behind upstream, + causing failure on ppc platform + +* Sun Dec 11 2005 Tom "spot" Callaway 1.0.0-5 +- minor cleanups + +* Wed Oct 5 2005 Paul Wouters 0.70_1205 +- reworked for svn version + +* Sun Sep 25 2005 Paul Wouters - 0.70 +- Initial version diff --git a/libs/ldns/packaging/ldns-config.in b/libs/ldns/packaging/ldns-config.in new file mode 100644 index 0000000000..b728ba544e --- /dev/null +++ b/libs/ldns/packaging/ldns-config.in @@ -0,0 +1,31 @@ +#!/bin/sh + +prefix="@prefix@" +exec_prefix="@exec_prefix@" +VERSION="@PACKAGE_VERSION@" +CFLAGS="@CFLAGS@" +CPPFLAGS="@CPPFLAGS@ @LIBSSL_CPPFLAGS@ @PYTHON_CPPFLAGS@" +LDFLAGS="@LDFLAGS@ @LIBSSL_LDFLAGS@ @PYTHON_LDFLAGS@" +LIBS="@LIBS@ @LIBSSL_LIBS@" +LIBDIR="@libdir@" +INCLUDEDIR="@includedir@" + +for arg in $@ +do + if [ $arg = "--cflags" ] + then + echo "-I${INCLUDEDIR}" + fi + if [ $arg = "--libs" ] + then + echo "${LDFLAGS} -L${LIBDIR} ${LIBS} -lldns" + fi + if [ $arg = "-h" ] || [ $arg = "--help" ] + then + echo "Usage: $0 [--cflags] [--libs] [--version]" + fi + if [ $arg = "--version" ] + then + echo "${VERSION}" + fi +done diff --git a/libs/ldns/packaging/libldns.pc.in b/libs/ldns/packaging/libldns.pc.in new file mode 100644 index 0000000000..923b688379 --- /dev/null +++ b/libs/ldns/packaging/libldns.pc.in @@ -0,0 +1,13 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: ldns +Description: Library for DNS programming +URL: http://www.nlnetlabs.nl/projects/ldns +Version: @PACKAGE_VERSION@ +Requires: +Libs: -L${libdir} -lldns +Libs.private: @LDFLAGS@ +Cflags: -I${includedir} diff --git a/libs/ldns/packet.c b/libs/ldns/packet.c new file mode 100644 index 0000000000..0ac5ca8ba3 --- /dev/null +++ b/libs/ldns/packet.c @@ -0,0 +1,1007 @@ +/* + * packet.c + * + * dns packet implementation + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +#include +#include + +#ifdef HAVE_SSL +#include +#endif + +/* Access functions + * do this as functions to get type checking + */ + +#define LDNS_EDNS_MASK_DO_BIT 0x8000 + +/* TODO defines for 3600 */ +/* convert to and from numerical flag values */ +ldns_lookup_table ldns_edns_flags[] = { + { 3600, "do"}, + { 0, NULL} +}; + +/* read */ +uint16_t +ldns_pkt_id(const ldns_pkt *packet) +{ + return packet->_header->_id; +} + +bool +ldns_pkt_qr(const ldns_pkt *packet) +{ + return packet->_header->_qr; +} + +bool +ldns_pkt_aa(const ldns_pkt *packet) +{ + return packet->_header->_aa; +} + +bool +ldns_pkt_tc(const ldns_pkt *packet) +{ + return packet->_header->_tc; +} + +bool +ldns_pkt_rd(const ldns_pkt *packet) +{ + return packet->_header->_rd; +} + +bool +ldns_pkt_cd(const ldns_pkt *packet) +{ + return packet->_header->_cd; +} + +bool +ldns_pkt_ra(const ldns_pkt *packet) +{ + return packet->_header->_ra; +} + +bool +ldns_pkt_ad(const ldns_pkt *packet) +{ + return packet->_header->_ad; +} + +ldns_pkt_opcode +ldns_pkt_get_opcode(const ldns_pkt *packet) +{ + return packet->_header->_opcode; +} + +ldns_pkt_rcode +ldns_pkt_get_rcode(const ldns_pkt *packet) +{ + return packet->_header->_rcode; +} + +uint16_t +ldns_pkt_qdcount(const ldns_pkt *packet) +{ + return packet->_header->_qdcount; +} + +uint16_t +ldns_pkt_ancount(const ldns_pkt *packet) +{ + return packet->_header->_ancount; +} + +uint16_t +ldns_pkt_nscount(const ldns_pkt *packet) +{ + return packet->_header->_nscount; +} + +uint16_t +ldns_pkt_arcount(const ldns_pkt *packet) +{ + return packet->_header->_arcount; +} + +ldns_rr_list * +ldns_pkt_question(const ldns_pkt *packet) +{ + return packet->_question; +} + +ldns_rr_list * +ldns_pkt_answer(const ldns_pkt *packet) +{ + return packet->_answer; +} + +ldns_rr_list * +ldns_pkt_authority(const ldns_pkt *packet) +{ + return packet->_authority; +} + +ldns_rr_list * +ldns_pkt_additional(const ldns_pkt *packet) +{ + return packet->_additional; +} + +/* return ALL section concatenated */ +ldns_rr_list * +ldns_pkt_all(const ldns_pkt *packet) +{ + ldns_rr_list *all, *prev_all; + + all = ldns_rr_list_cat_clone( + ldns_pkt_question(packet), + ldns_pkt_answer(packet)); + prev_all = all; + all = ldns_rr_list_cat_clone(all, + ldns_pkt_authority(packet)); + ldns_rr_list_deep_free(prev_all); + prev_all = all; + all = ldns_rr_list_cat_clone(all, + ldns_pkt_additional(packet)); + ldns_rr_list_deep_free(prev_all); + return all; +} + +ldns_rr_list * +ldns_pkt_all_noquestion(const ldns_pkt *packet) +{ + ldns_rr_list *all, *all2; + + all = ldns_rr_list_cat_clone( + ldns_pkt_answer(packet), + ldns_pkt_authority(packet)); + all2 = ldns_rr_list_cat_clone(all, + ldns_pkt_additional(packet)); + + ldns_rr_list_deep_free(all); + return all2; +} + +size_t +ldns_pkt_size(const ldns_pkt *packet) +{ + return packet->_size; +} + +uint32_t +ldns_pkt_querytime(const ldns_pkt *packet) +{ + return packet->_querytime; +} + +ldns_rdf * +ldns_pkt_answerfrom(const ldns_pkt *packet) +{ + return packet->_answerfrom; +} + +struct timeval +ldns_pkt_timestamp(const ldns_pkt *packet) +{ + return packet->timestamp; +} + +uint16_t +ldns_pkt_edns_udp_size(const ldns_pkt *packet) +{ + return packet->_edns_udp_size; +} + +uint8_t +ldns_pkt_edns_extended_rcode(const ldns_pkt *packet) +{ + return packet->_edns_extended_rcode; +} + +uint8_t +ldns_pkt_edns_version(const ldns_pkt *packet) +{ + return packet->_edns_version; +} + +uint16_t +ldns_pkt_edns_z(const ldns_pkt *packet) +{ + return packet->_edns_z; +} + +bool +ldns_pkt_edns_do(const ldns_pkt *packet) +{ + return (packet->_edns_z & LDNS_EDNS_MASK_DO_BIT); +} + +void +ldns_pkt_set_edns_do(ldns_pkt *packet, bool value) +{ + if (value) { + packet->_edns_z = packet->_edns_z | LDNS_EDNS_MASK_DO_BIT; + } else { + packet->_edns_z = packet->_edns_z & ~LDNS_EDNS_MASK_DO_BIT; + } +} + +ldns_rdf * +ldns_pkt_edns_data(const ldns_pkt *packet) +{ + return packet->_edns_data; +} + +/* return only those rr that share the ownername */ +ldns_rr_list * +ldns_pkt_rr_list_by_name(ldns_pkt *packet, + ldns_rdf *ownername, + ldns_pkt_section sec) +{ + ldns_rr_list *rrs; + ldns_rr_list *new; + ldns_rr_list *ret; + uint16_t i; + + if (!packet) { + return NULL; + } + + rrs = ldns_pkt_get_section_clone(packet, sec); + new = ldns_rr_list_new(); + ret = NULL; + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + if (ldns_rdf_compare(ldns_rr_owner( + ldns_rr_list_rr(rrs, i)), + ownername) == 0) { + /* owner names match */ + ldns_rr_list_push_rr(new, ldns_rr_list_rr(rrs, i)); + ret = new; + } + } + return ret; +} + +/* return only those rr that share a type */ +ldns_rr_list * +ldns_pkt_rr_list_by_type(const ldns_pkt *packet, + ldns_rr_type type, + ldns_pkt_section sec) +{ + ldns_rr_list *rrs; + ldns_rr_list *new; + uint16_t i; + + if(!packet) { + return NULL; + } + + rrs = ldns_pkt_get_section_clone(packet, sec); + new = ldns_rr_list_new(); + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + if (type == ldns_rr_get_type(ldns_rr_list_rr(rrs, i))) { + /* types match */ + ldns_rr_list_push_rr(new, + ldns_rr_clone( + ldns_rr_list_rr(rrs, i)) + ); + } + } + ldns_rr_list_deep_free(rrs); + + if (ldns_rr_list_rr_count(new) == 0) { + ldns_rr_list_free(new); + return NULL; + } else { + return new; + } +} + +/* return only those rrs that share name and type */ +ldns_rr_list * +ldns_pkt_rr_list_by_name_and_type(const ldns_pkt *packet, + const ldns_rdf *ownername, + ldns_rr_type type, + ldns_pkt_section sec) +{ + ldns_rr_list *rrs; + ldns_rr_list *new; + ldns_rr_list *ret; + uint16_t i; + + if(!packet) { + return NULL; + } + + rrs = ldns_pkt_get_section_clone(packet, sec); + new = ldns_rr_list_new(); + ret = NULL; + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + if (type == ldns_rr_get_type(ldns_rr_list_rr(rrs, i)) && + ldns_rdf_compare(ldns_rr_owner(ldns_rr_list_rr(rrs, i)), + ownername + ) == 0 + ) { + /* types match */ + ldns_rr_list_push_rr(new, ldns_rr_clone(ldns_rr_list_rr(rrs, i))); + ret = new; + } + } + ldns_rr_list_deep_free(rrs); + if (!ret) { + ldns_rr_list_free(new); + } + return ret; +} + +bool +ldns_pkt_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr) +{ + bool result = false; + + switch (sec) { + case LDNS_SECTION_QUESTION: + return ldns_rr_list_contains_rr(ldns_pkt_question(pkt), rr); + case LDNS_SECTION_ANSWER: + return ldns_rr_list_contains_rr(ldns_pkt_answer(pkt), rr); + case LDNS_SECTION_AUTHORITY: + return ldns_rr_list_contains_rr(ldns_pkt_authority(pkt), rr); + case LDNS_SECTION_ADDITIONAL: + return ldns_rr_list_contains_rr(ldns_pkt_additional(pkt), rr); + case LDNS_SECTION_ANY: + result = ldns_rr_list_contains_rr(ldns_pkt_question(pkt), rr); + case LDNS_SECTION_ANY_NOQUESTION: + result = result + || ldns_rr_list_contains_rr(ldns_pkt_answer(pkt), rr) + || ldns_rr_list_contains_rr(ldns_pkt_authority(pkt), rr) + || ldns_rr_list_contains_rr(ldns_pkt_additional(pkt), rr); + } + + return result; +} + +uint16_t +ldns_pkt_section_count(const ldns_pkt *packet, ldns_pkt_section s) +{ + switch(s) { + case LDNS_SECTION_QUESTION: + return ldns_pkt_qdcount(packet); + case LDNS_SECTION_ANSWER: + return ldns_pkt_ancount(packet); + case LDNS_SECTION_AUTHORITY: + return ldns_pkt_nscount(packet); + case LDNS_SECTION_ADDITIONAL: + return ldns_pkt_arcount(packet); + case LDNS_SECTION_ANY: + return ldns_pkt_qdcount(packet) + + ldns_pkt_ancount(packet) + + ldns_pkt_nscount(packet) + + ldns_pkt_arcount(packet); + case LDNS_SECTION_ANY_NOQUESTION: + return ldns_pkt_ancount(packet) + + ldns_pkt_nscount(packet) + + ldns_pkt_arcount(packet); + default: + return 0; + } +} + +bool +ldns_pkt_empty(ldns_pkt *p) +{ + if (!p) { + return true; /* NULL is empty? */ + } + if (ldns_pkt_section_count(p, LDNS_SECTION_ANY) > 0) { + return false; + } else { + return true; + } +} + + +ldns_rr_list * +ldns_pkt_get_section_clone(const ldns_pkt *packet, ldns_pkt_section s) +{ + switch(s) { + case LDNS_SECTION_QUESTION: + return ldns_rr_list_clone(ldns_pkt_question(packet)); + case LDNS_SECTION_ANSWER: + return ldns_rr_list_clone(ldns_pkt_answer(packet)); + case LDNS_SECTION_AUTHORITY: + return ldns_rr_list_clone(ldns_pkt_authority(packet)); + case LDNS_SECTION_ADDITIONAL: + return ldns_rr_list_clone(ldns_pkt_additional(packet)); + case LDNS_SECTION_ANY: + /* these are already clones */ + return ldns_pkt_all(packet); + case LDNS_SECTION_ANY_NOQUESTION: + return ldns_pkt_all_noquestion(packet); + default: + return NULL; + } +} + +ldns_rr *ldns_pkt_tsig(const ldns_pkt *pkt) { + return pkt->_tsig_rr; +} + +/* write */ +void +ldns_pkt_set_id(ldns_pkt *packet, uint16_t id) +{ + packet->_header->_id = id; +} + +void +ldns_pkt_set_random_id(ldns_pkt *packet) +{ + uint16_t rid = ldns_get_random(); + ldns_pkt_set_id(packet, rid); +} + + +void +ldns_pkt_set_qr(ldns_pkt *packet, bool qr) +{ + packet->_header->_qr = qr; +} + +void +ldns_pkt_set_aa(ldns_pkt *packet, bool aa) +{ + packet->_header->_aa = aa; +} + +void +ldns_pkt_set_tc(ldns_pkt *packet, bool tc) +{ + packet->_header->_tc = tc; +} + +void +ldns_pkt_set_rd(ldns_pkt *packet, bool rd) +{ + packet->_header->_rd = rd; +} + +void +ldns_pkt_set_additional(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_additional = rr; +} + +void +ldns_pkt_set_question(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_question = rr; +} + +void +ldns_pkt_set_answer(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_answer = rr; +} + +void +ldns_pkt_set_authority(ldns_pkt *p, ldns_rr_list *rr) +{ + p->_authority = rr; +} + +void +ldns_pkt_set_cd(ldns_pkt *packet, bool cd) +{ + packet->_header->_cd = cd; +} + +void +ldns_pkt_set_ra(ldns_pkt *packet, bool ra) +{ + packet->_header->_ra = ra; +} + +void +ldns_pkt_set_ad(ldns_pkt *packet, bool ad) +{ + packet->_header->_ad = ad; +} + +void +ldns_pkt_set_opcode(ldns_pkt *packet, ldns_pkt_opcode opcode) +{ + packet->_header->_opcode = opcode; +} + +void +ldns_pkt_set_rcode(ldns_pkt *packet, uint8_t rcode) +{ + packet->_header->_rcode = rcode; +} + +void +ldns_pkt_set_qdcount(ldns_pkt *packet, uint16_t qdcount) +{ + packet->_header->_qdcount = qdcount; +} + +void +ldns_pkt_set_ancount(ldns_pkt *packet, uint16_t ancount) +{ + packet->_header->_ancount = ancount; +} + +void +ldns_pkt_set_nscount(ldns_pkt *packet, uint16_t nscount) +{ + packet->_header->_nscount = nscount; +} + +void +ldns_pkt_set_arcount(ldns_pkt *packet, uint16_t arcount) +{ + packet->_header->_arcount = arcount; +} + +void +ldns_pkt_set_querytime(ldns_pkt *packet, uint32_t time) +{ + packet->_querytime = time; +} + +void +ldns_pkt_set_answerfrom(ldns_pkt *packet, ldns_rdf *answerfrom) +{ + packet->_answerfrom = answerfrom; +} + +void +ldns_pkt_set_timestamp(ldns_pkt *packet, struct timeval timeval) +{ + packet->timestamp.tv_sec = timeval.tv_sec; + packet->timestamp.tv_usec = timeval.tv_usec; +} + +void +ldns_pkt_set_size(ldns_pkt *packet, size_t s) +{ + packet->_size = s; +} + +void +ldns_pkt_set_edns_udp_size(ldns_pkt *packet, uint16_t s) +{ + packet->_edns_udp_size = s; +} + +void +ldns_pkt_set_edns_extended_rcode(ldns_pkt *packet, uint8_t c) +{ + packet->_edns_extended_rcode = c; +} + +void +ldns_pkt_set_edns_version(ldns_pkt *packet, uint8_t v) +{ + packet->_edns_version = v; +} + +void +ldns_pkt_set_edns_z(ldns_pkt *packet, uint16_t z) +{ + packet->_edns_z = z; +} + +void +ldns_pkt_set_edns_data(ldns_pkt *packet, ldns_rdf *data) +{ + packet->_edns_data = data; +} + +void +ldns_pkt_set_section_count(ldns_pkt *packet, ldns_pkt_section s, uint16_t count) +{ + switch(s) { + case LDNS_SECTION_QUESTION: + ldns_pkt_set_qdcount(packet, count); + break; + case LDNS_SECTION_ANSWER: + ldns_pkt_set_ancount(packet, count); + break; + case LDNS_SECTION_AUTHORITY: + ldns_pkt_set_nscount(packet, count); + break; + case LDNS_SECTION_ADDITIONAL: + ldns_pkt_set_arcount(packet, count); + break; + case LDNS_SECTION_ANY: + case LDNS_SECTION_ANY_NOQUESTION: + break; + } +} + +void ldns_pkt_set_tsig(ldns_pkt *pkt, ldns_rr *rr) +{ + pkt->_tsig_rr = rr; +} + +bool +ldns_pkt_push_rr(ldns_pkt *packet, ldns_pkt_section section, ldns_rr *rr) +{ + switch(section) { + case LDNS_SECTION_QUESTION: + ldns_rr_list_push_rr(ldns_pkt_question(packet), rr); + ldns_pkt_set_qdcount(packet, ldns_pkt_qdcount(packet) + 1); + break; + case LDNS_SECTION_ANSWER: + ldns_rr_list_push_rr(ldns_pkt_answer(packet), rr); + ldns_pkt_set_ancount(packet, ldns_pkt_ancount(packet) + 1); + break; + case LDNS_SECTION_AUTHORITY: + ldns_rr_list_push_rr(ldns_pkt_authority(packet), rr); + ldns_pkt_set_nscount(packet, ldns_pkt_nscount(packet) + 1); + break; + case LDNS_SECTION_ADDITIONAL: + ldns_rr_list_push_rr(ldns_pkt_additional(packet), rr); + ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) + 1); + break; + case LDNS_SECTION_ANY: + case LDNS_SECTION_ANY_NOQUESTION: + /* shouldn't this error? */ + break; + } + return true; +} + +bool +ldns_pkt_safe_push_rr(ldns_pkt *pkt, ldns_pkt_section sec, ldns_rr *rr) +{ + + /* check to see if its there */ + if (ldns_pkt_rr(pkt, sec, rr)) { + /* already there */ + return false; + } + return ldns_pkt_push_rr(pkt, sec, rr); +} + +bool +ldns_pkt_push_rr_list(ldns_pkt *p, ldns_pkt_section s, ldns_rr_list *list) +{ + size_t i; + for(i = 0; i < ldns_rr_list_rr_count(list); i++) { + if (!ldns_pkt_push_rr(p, s, ldns_rr_list_rr(list, i))) { + return false; + } + } + return true; +} + +bool +ldns_pkt_safe_push_rr_list(ldns_pkt *p, ldns_pkt_section s, ldns_rr_list *list) +{ + size_t i; + for(i = 0; i < ldns_rr_list_rr_count(list); i++) { + if (!ldns_pkt_safe_push_rr(p, s, ldns_rr_list_rr(list, i))) { + return false; + } + } + return true; +} + +bool +ldns_pkt_edns(const ldns_pkt *pkt) { + return (ldns_pkt_edns_udp_size(pkt) > 0 || + ldns_pkt_edns_extended_rcode(pkt) > 0 || + ldns_pkt_edns_data(pkt) || + ldns_pkt_edns_do(pkt) + ); +} + + +/* Create/destroy/convert functions + */ +ldns_pkt * +ldns_pkt_new() +{ + ldns_pkt *packet; + packet = LDNS_MALLOC(ldns_pkt); + if (!packet) { + return NULL; + } + + packet->_header = LDNS_MALLOC(ldns_hdr); + if (!packet->_header) { + LDNS_FREE(packet); + return NULL; + } + + packet->_question = ldns_rr_list_new(); + packet->_answer = ldns_rr_list_new(); + packet->_authority = ldns_rr_list_new(); + packet->_additional = ldns_rr_list_new(); + + /* default everything to false */ + ldns_pkt_set_qr(packet, false); + ldns_pkt_set_aa(packet, false); + ldns_pkt_set_tc(packet, false); + ldns_pkt_set_rd(packet, false); + ldns_pkt_set_ra(packet, false); + ldns_pkt_set_ad(packet, false); + ldns_pkt_set_cd(packet, false); + + ldns_pkt_set_opcode(packet, LDNS_PACKET_QUERY); + ldns_pkt_set_rcode(packet, 0); + ldns_pkt_set_id(packet, 0); + ldns_pkt_set_size(packet, 0); + ldns_pkt_set_querytime(packet, 0); + memset(&packet->timestamp, 0, sizeof(packet->timestamp)); + ldns_pkt_set_answerfrom(packet, NULL); + ldns_pkt_set_section_count(packet, LDNS_SECTION_QUESTION, 0); + ldns_pkt_set_section_count(packet, LDNS_SECTION_ANSWER, 0); + ldns_pkt_set_section_count(packet, LDNS_SECTION_AUTHORITY, 0); + ldns_pkt_set_section_count(packet, LDNS_SECTION_ADDITIONAL, 0); + + ldns_pkt_set_edns_udp_size(packet, 0); + ldns_pkt_set_edns_extended_rcode(packet, 0); + ldns_pkt_set_edns_version(packet, 0); + ldns_pkt_set_edns_z(packet, 0); + ldns_pkt_set_edns_data(packet, NULL); + + ldns_pkt_set_tsig(packet, NULL); + + return packet; +} + +void +ldns_pkt_free(ldns_pkt *packet) +{ + if (packet) { + LDNS_FREE(packet->_header); + ldns_rr_list_deep_free(packet->_question); + ldns_rr_list_deep_free(packet->_answer); + ldns_rr_list_deep_free(packet->_authority); + ldns_rr_list_deep_free(packet->_additional); + ldns_rr_free(packet->_tsig_rr); + ldns_rdf_deep_free(packet->_edns_data); + LDNS_FREE(packet); + } +} + +bool +ldns_pkt_set_flags(ldns_pkt *packet, uint16_t flags) +{ + if (!packet) { + return false; + } + if ((flags & LDNS_QR) == LDNS_QR) { + ldns_pkt_set_qr(packet, true); + } + if ((flags & LDNS_AA) == LDNS_AA) { + ldns_pkt_set_aa(packet, true); + } + if ((flags & LDNS_RD) == LDNS_RD) { + ldns_pkt_set_rd(packet, true); + } + if ((flags & LDNS_TC) == LDNS_TC) { + ldns_pkt_set_tc(packet, true); + } + if ((flags & LDNS_CD) == LDNS_CD) { + ldns_pkt_set_cd(packet, true); + } + if ((flags & LDNS_RA) == LDNS_RA) { + ldns_pkt_set_ra(packet, true); + } + if ((flags & LDNS_AD) == LDNS_AD) { + ldns_pkt_set_ad(packet, true); + } + return true; +} + +ldns_status +ldns_pkt_query_new_frm_str(ldns_pkt **p, const char *name, ldns_rr_type rr_type, + ldns_rr_class rr_class, uint16_t flags) +{ + ldns_pkt *packet; + ldns_rr *question_rr; + ldns_rdf *name_rdf; + + packet = ldns_pkt_new(); + if (!packet) { + return LDNS_STATUS_MEM_ERR; + } + + if (!ldns_pkt_set_flags(packet, flags)) { + return LDNS_STATUS_ERR; + } + + question_rr = ldns_rr_new(); + if (!question_rr) { + return LDNS_STATUS_MEM_ERR; + } + + if (rr_type == 0) { + rr_type = LDNS_RR_TYPE_A; + } + if (rr_class == 0) { + rr_class = LDNS_RR_CLASS_IN; + } + + if (ldns_str2rdf_dname(&name_rdf, name) == LDNS_STATUS_OK) { + ldns_rr_set_owner(question_rr, name_rdf); + ldns_rr_set_type(question_rr, rr_type); + ldns_rr_set_class(question_rr, rr_class); + ldns_rr_set_question(question_rr, true); + + ldns_pkt_push_rr(packet, LDNS_SECTION_QUESTION, question_rr); + } else { + ldns_rr_free(question_rr); + ldns_pkt_free(packet); + return LDNS_STATUS_ERR; + } + + packet->_tsig_rr = NULL; + + ldns_pkt_set_answerfrom(packet, NULL); + if (p) { + *p = packet; + return LDNS_STATUS_OK; + } else { + return LDNS_STATUS_NULL; + } +} + +ldns_pkt * +ldns_pkt_query_new(ldns_rdf *rr_name, ldns_rr_type rr_type, ldns_rr_class rr_class, + uint16_t flags) +{ + ldns_pkt *packet; + ldns_rr *question_rr; + + packet = ldns_pkt_new(); + if (!packet) { + return NULL; + } + + if (!ldns_pkt_set_flags(packet, flags)) { + return NULL; + } + + question_rr = ldns_rr_new(); + if (!question_rr) { + return NULL; + } + + if (rr_type == 0) { + rr_type = LDNS_RR_TYPE_A; + } + if (rr_class == 0) { + rr_class = LDNS_RR_CLASS_IN; + } + + ldns_rr_set_owner(question_rr, rr_name); + ldns_rr_set_type(question_rr, rr_type); + ldns_rr_set_class(question_rr, rr_class); + ldns_rr_set_question(question_rr, true); + + packet->_tsig_rr = NULL; + + ldns_pkt_push_rr(packet, LDNS_SECTION_QUESTION, question_rr); + + return packet; +} + +ldns_pkt_type +ldns_pkt_reply_type(ldns_pkt *p) +{ + ldns_rr_list *tmp; + + if (!p) { + return LDNS_PACKET_UNKNOWN; + } + + if (ldns_pkt_get_rcode(p) == LDNS_RCODE_NXDOMAIN) { + return LDNS_PACKET_NXDOMAIN; + } + + if (ldns_pkt_ancount(p) == 0 && ldns_pkt_arcount(p) == 0 + && ldns_pkt_nscount(p) == 1) { + + /* check for SOA */ + tmp = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_SOA, + LDNS_SECTION_AUTHORITY); + if (tmp) { + ldns_rr_list_deep_free(tmp); + return LDNS_PACKET_NODATA; + } else { + /* I have no idea ... */ + } + } + + if (ldns_pkt_ancount(p) == 0 && ldns_pkt_nscount(p) > 0) { + tmp = ldns_pkt_rr_list_by_type(p, LDNS_RR_TYPE_NS, + LDNS_SECTION_AUTHORITY); + if (tmp) { + /* there are nameservers here */ + ldns_rr_list_deep_free(tmp); + return LDNS_PACKET_REFERRAL; + } else { + /* I have no idea */ + } + ldns_rr_list_deep_free(tmp); + } + + /* if we cannot determine the packet type, we say it's an + * answer... + */ + return LDNS_PACKET_ANSWER; +} + +ldns_pkt * +ldns_pkt_clone(ldns_pkt *pkt) +{ + ldns_pkt *new_pkt; + + if (!pkt) { + return NULL; + } + new_pkt = ldns_pkt_new(); + + ldns_pkt_set_id(new_pkt, ldns_pkt_id(pkt)); + ldns_pkt_set_qr(new_pkt, ldns_pkt_qr(pkt)); + ldns_pkt_set_aa(new_pkt, ldns_pkt_aa(pkt)); + ldns_pkt_set_tc(new_pkt, ldns_pkt_tc(pkt)); + ldns_pkt_set_rd(new_pkt, ldns_pkt_rd(pkt)); + ldns_pkt_set_cd(new_pkt, ldns_pkt_cd(pkt)); + ldns_pkt_set_ra(new_pkt, ldns_pkt_ra(pkt)); + ldns_pkt_set_ad(new_pkt, ldns_pkt_ad(pkt)); + ldns_pkt_set_opcode(new_pkt, ldns_pkt_get_opcode(pkt)); + ldns_pkt_set_rcode(new_pkt, ldns_pkt_get_rcode(pkt)); + ldns_pkt_set_qdcount(new_pkt, ldns_pkt_qdcount(pkt)); + ldns_pkt_set_ancount(new_pkt, ldns_pkt_ancount(pkt)); + ldns_pkt_set_nscount(new_pkt, ldns_pkt_nscount(pkt)); + ldns_pkt_set_arcount(new_pkt, ldns_pkt_arcount(pkt)); + ldns_pkt_set_answerfrom(new_pkt, ldns_pkt_answerfrom(pkt)); + ldns_pkt_set_querytime(new_pkt, ldns_pkt_querytime(pkt)); + ldns_pkt_set_size(new_pkt, ldns_pkt_size(pkt)); + ldns_pkt_set_tsig(new_pkt, ldns_rr_clone(ldns_pkt_tsig(pkt))); + + ldns_pkt_set_edns_udp_size(new_pkt, ldns_pkt_edns_udp_size(pkt)); + ldns_pkt_set_edns_extended_rcode(new_pkt, + ldns_pkt_edns_extended_rcode(pkt)); + ldns_pkt_set_edns_version(new_pkt, ldns_pkt_edns_version(pkt)); + ldns_pkt_set_edns_z(new_pkt, ldns_pkt_edns_z(pkt)); + if(ldns_pkt_edns_data(pkt)) + ldns_pkt_set_edns_data(new_pkt, + ldns_rdf_clone(ldns_pkt_edns_data(pkt))); + ldns_pkt_set_edns_do(new_pkt, ldns_pkt_edns_do(pkt)); + + ldns_rr_list_deep_free(new_pkt->_question); + ldns_rr_list_deep_free(new_pkt->_answer); + ldns_rr_list_deep_free(new_pkt->_authority); + ldns_rr_list_deep_free(new_pkt->_additional); + new_pkt->_question = ldns_rr_list_clone(ldns_pkt_question(pkt)); + new_pkt->_answer = ldns_rr_list_clone(ldns_pkt_answer(pkt)); + new_pkt->_authority = ldns_rr_list_clone(ldns_pkt_authority(pkt)); + new_pkt->_additional = ldns_rr_list_clone(ldns_pkt_additional(pkt)); + return new_pkt; +} diff --git a/libs/ldns/parse.c b/libs/ldns/parse.c new file mode 100644 index 0000000000..0487873520 --- /dev/null +++ b/libs/ldns/parse.c @@ -0,0 +1,445 @@ +/* + * a generic (simple) parser. Use to parse rr's, private key + * information and /etc/resolv.conf files + * + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ +#include +#include + +#include +#include + +ldns_lookup_table ldns_directive_types[] = { + { LDNS_DIR_TTL, "$TTL" }, + { LDNS_DIR_ORIGIN, "$ORIGIN" }, + { LDNS_DIR_INCLUDE, "$INCLUDE" }, + { 0, NULL } +}; + +/* add max_limit here? */ +ssize_t +ldns_fget_token(FILE *f, char *token, const char *delim, size_t limit) +{ + return ldns_fget_token_l(f, token, delim, limit, NULL); +} + +ssize_t +ldns_fget_token_l(FILE *f, char *token, const char *delim, size_t limit, int *line_nr) +{ + int c, prev_c; + int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ + int com, quoted; + char *t; + size_t i; + const char *d; + const char *del; + + /* standard delimeters */ + if (!delim) { + /* from isspace(3) */ + del = LDNS_PARSE_NORMAL; + } else { + del = delim; + } + + p = 0; + i = 0; + com = 0; + quoted = 0; + prev_c = 0; + t = token; + if (del[0] == '"') { + quoted = 1; + } + while ((c = getc(f)) != EOF) { + if (c == '(' && prev_c != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p++; + } + prev_c = c; + continue; + } + + if (c == ')' && prev_c != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p--; + } + prev_c = c; + continue; + } + + if (p < 0) { + /* more ) then ( - close off the string */ + *t = '\0'; + return 0; + } + + /* do something with comments ; */ + if (c == ';' && quoted == 0) { + if (prev_c != '\\') { + com = 1; + } + } + if (c == '\"' && com == 0 && prev_c != '\\') { + quoted = 1 - quoted; + } + + if (c == '\n' && com != 0) { + /* comments */ + com = 0; + *t = ' '; + if (line_nr) { + *line_nr = *line_nr + 1; + } + if (p == 0 && i > 0) { + goto tokenread; + } else { + prev_c = c; + continue; + } + } + + if (com == 1) { + *t = ' '; + prev_c = c; + continue; + } + + + if (c == '\n' && p != 0 && t > token) { + /* in parentheses */ + if (line_nr) { + *line_nr = *line_nr + 1; + } + *t++ = ' '; + prev_c = c; + continue; + } + + /* check if we hit the delim */ + for (d = del; *d; d++) { + if (c == *d && i > 0 && prev_c != '\\') { + if (c == '\n' && line_nr) { + *line_nr = *line_nr + 1; + } + goto tokenread; + } + } + if (c != '\0' && c != '\n') { + *t++ = c; + i++; + } + if (limit > 0 && i >= limit) { + *t = '\0'; + return -1; + } + if (c == '\\' && prev_c == '\\') + prev_c = 0; + else prev_c = c; + } + *t = '\0'; + if (c == EOF) { + return (ssize_t)i; + } + + if (i == 0) { + /* nothing read */ + return -1; + } + if (p != 0) { + return -1; + } + return (ssize_t)i; + +tokenread: + ldns_fskipcs_l(f, delim, line_nr); + *t = '\0'; + if (p != 0) { + return -1; + } + + return (ssize_t)i; +} + +ssize_t +ldns_fget_keyword_data(FILE *f, const char *keyword, const char *k_del, char *data, + const char *d_del, size_t data_limit) +{ + return ldns_fget_keyword_data_l(f, keyword, k_del, data, d_del, + data_limit, NULL); +} + +ssize_t +ldns_fget_keyword_data_l(FILE *f, const char *keyword, const char *k_del, char *data, + const char *d_del, size_t data_limit, int *line_nr) +{ + /* we assume: keyword|sep|data */ + char *fkeyword; + ssize_t i; + + if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) + return -1; + fkeyword = LDNS_XMALLOC(char, LDNS_MAX_KEYWORDLEN); + if(!fkeyword) + return -1; + + i = ldns_fget_token(f, fkeyword, k_del, LDNS_MAX_KEYWORDLEN); + if(i==0 || i==-1) { + LDNS_FREE(fkeyword); + return -1; + } + + /* case??? i instead of strlen? */ + if (strncmp(fkeyword, keyword, LDNS_MAX_KEYWORDLEN - 1) == 0) { + /* whee! */ + /* printf("%s\n%s\n", "Matching keyword", fkeyword); */ + i = ldns_fget_token_l(f, data, d_del, data_limit, line_nr); + LDNS_FREE(fkeyword); + return i; + } else { + /*printf("no match for %s (read: %s)\n", keyword, fkeyword);*/ + LDNS_FREE(fkeyword); + return -1; + } +} + + +ssize_t +ldns_bget_token(ldns_buffer *b, char *token, const char *delim, size_t limit) +{ + int c, lc; + int p; /* 0 -> no parenthese seen, >0 nr of ( seen */ + int com, quoted; + char *t; + size_t i; + const char *d; + const char *del; + + /* standard delimiters */ + if (!delim) { + /* from isspace(3) */ + del = LDNS_PARSE_NORMAL; + } else { + del = delim; + } + + p = 0; + i = 0; + com = 0; + quoted = 0; + t = token; + lc = 0; + if (del[0] == '"') { + quoted = 1; + } + + while ((c = ldns_bgetc(b)) != EOF) { + if (c == '(' && lc != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p++; + } + lc = c; + continue; + } + + if (c == ')' && lc != '\\' && !quoted) { + /* this only counts for non-comments */ + if (com == 0) { + p--; + } + lc = c; + continue; + } + + if (p < 0) { + /* more ) then ( */ + *t = '\0'; + return 0; + } + + /* do something with comments ; */ + if (c == ';' && quoted == 0) { + if (lc != '\\') { + com = 1; + } + } + if (c == '"' && com == 0 && lc != '\\') { + quoted = 1 - quoted; + } + + if (c == '\n' && com != 0) { + /* comments */ + com = 0; + *t = ' '; + lc = c; + continue; + } + + if (com == 1) { + *t = ' '; + lc = c; + continue; + } + + if (c == '\n' && p != 0) { + /* in parentheses */ + *t++ = ' '; + lc = c; + continue; + } + + /* check if we hit the delim */ + for (d = del; *d; d++) { + if (c == *d && lc != '\\') { + goto tokenread; + } + } + + *t++ = c; + i++; + if (limit > 0 && i >= limit) { + *t = '\0'; + return -1; + } + + if (c == '\\' && lc == '\\') { + lc = 0; + } else { + lc = c; + } + } + *t = '\0'; + if (i == 0) { + /* nothing read */ + return -1; + } + if (p != 0) { + return -1; + } + return (ssize_t)i; + +tokenread: + ldns_bskipcs(b, delim); + *t = '\0'; + + if (p != 0) { + return -1; + } + return (ssize_t)i; +} + +void +ldns_bskipc(ldns_buffer *buffer, char c) +{ + while (c == (char) ldns_buffer_read_u8_at(buffer, ldns_buffer_position(buffer))) { + if (ldns_buffer_available_at(buffer, + buffer->_position + sizeof(char), sizeof(char))) { + buffer->_position += sizeof(char); + } else { + return; + } + } +} + +void +ldns_bskipcs(ldns_buffer *buffer, const char *s) +{ + bool found; + char c; + const char *d; + + while(ldns_buffer_available_at(buffer, buffer->_position, sizeof(char))) { + c = (char) ldns_buffer_read_u8_at(buffer, buffer->_position); + found = false; + for (d = s; *d; d++) { + if (*d == c) { + found = true; + } + } + if (found && buffer->_limit > buffer->_position) { + buffer->_position += sizeof(char); + } else { + return; + } + } +} + +void +ldns_fskipc(FILE *fp, char c) +{ + fp = fp; + c = c; +} + + +void +ldns_fskipcs(FILE *fp, const char *s) +{ + ldns_fskipcs_l(fp, s, NULL); +} + +void +ldns_fskipcs_l(FILE *fp, const char *s, int *line_nr) +{ + bool found; + int c; + const char *d; + + while ((c = fgetc(fp)) != EOF) { + if (line_nr && c == '\n') { + *line_nr = *line_nr + 1; + } + found = false; + for (d = s; *d; d++) { + if (*d == c) { + found = true; + } + } + if (!found) { + /* with getc, we've read too far */ + ungetc(c, fp); + return; + } + } +} + +ssize_t +ldns_bget_keyword_data(ldns_buffer *b, const char *keyword, const char *k_del, char +*data, const char *d_del, size_t data_limit) +{ + /* we assume: keyword|sep|data */ + char *fkeyword; + ssize_t i; + + if(strlen(keyword) >= LDNS_MAX_KEYWORDLEN) + return -1; + fkeyword = LDNS_XMALLOC(char, LDNS_MAX_KEYWORDLEN); + if(!fkeyword) + return -1; /* out of memory */ + + i = ldns_bget_token(b, fkeyword, k_del, data_limit); + if(i==0 || i==-1) { + LDNS_FREE(fkeyword); + return -1; /* nothing read */ + } + + /* case??? */ + if (strncmp(fkeyword, keyword, strlen(keyword)) == 0) { + LDNS_FREE(fkeyword); + /* whee, the match! */ + /* retrieve it's data */ + i = ldns_bget_token(b, data, d_del, 0); + return i; + } else { + LDNS_FREE(fkeyword); + return -1; + } +} + diff --git a/libs/ldns/rbtree.c b/libs/ldns/rbtree.c new file mode 100644 index 0000000000..217e61d275 --- /dev/null +++ b/libs/ldns/rbtree.c @@ -0,0 +1,669 @@ +/* + * rbtree.c -- generic red black tree + * + * Taken from Unbound, modified for ldns + * + * Copyright (c) 2001-2008, NLnet Labs. All rights reserved. + * + * This software is open source. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of the NLNET LABS nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 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. + * + */ + +/** + * \file + * Implementation of a redblack tree. + */ + +#include +#include +#include + +/** Node colour black */ +#define BLACK 0 +/** Node colour red */ +#define RED 1 + +/** the NULL node, global alloc */ +ldns_rbnode_t ldns_rbtree_null_node = { + LDNS_RBTREE_NULL, /* Parent. */ + LDNS_RBTREE_NULL, /* Left. */ + LDNS_RBTREE_NULL, /* Right. */ + NULL, /* Key. */ + NULL, /* Data. */ + BLACK /* Color. */ +}; + +/** rotate subtree left (to preserve redblack property) */ +static void ldns_rbtree_rotate_left(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); +/** rotate subtree right (to preserve redblack property) */ +static void ldns_rbtree_rotate_right(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); +/** Fixup node colours when insert happened */ +static void ldns_rbtree_insert_fixup(ldns_rbtree_t *rbtree, ldns_rbnode_t *node); +/** Fixup node colours when delete happened */ +static void ldns_rbtree_delete_fixup(ldns_rbtree_t* rbtree, ldns_rbnode_t* child, ldns_rbnode_t* child_parent); + +/* + * Creates a new red black tree, intializes and returns a pointer to it. + * + * Return NULL on failure. + * + */ +ldns_rbtree_t * +ldns_rbtree_create (int (*cmpf)(const void *, const void *)) +{ + ldns_rbtree_t *rbtree; + + /* Allocate memory for it */ + rbtree = (ldns_rbtree_t *) malloc(sizeof(ldns_rbtree_t)); + if (!rbtree) { + return NULL; + } + + /* Initialize it */ + ldns_rbtree_init(rbtree, cmpf); + + return rbtree; +} + +void +ldns_rbtree_init(ldns_rbtree_t *rbtree, int (*cmpf)(const void *, const void *)) +{ + /* Initialize it */ + rbtree->root = LDNS_RBTREE_NULL; + rbtree->count = 0; + rbtree->cmp = cmpf; +} + +void +ldns_rbtree_free(ldns_rbtree_t *rbtree) +{ + free(rbtree); +} + +/* + * Rotates the node to the left. + * + */ +static void +ldns_rbtree_rotate_left(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) +{ + ldns_rbnode_t *right = node->right; + node->right = right->left; + if (right->left != LDNS_RBTREE_NULL) + right->left->parent = node; + + right->parent = node->parent; + + if (node->parent != LDNS_RBTREE_NULL) { + if (node == node->parent->left) { + node->parent->left = right; + } else { + node->parent->right = right; + } + } else { + rbtree->root = right; + } + right->left = node; + node->parent = right; +} + +/* + * Rotates the node to the right. + * + */ +static void +ldns_rbtree_rotate_right(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) +{ + ldns_rbnode_t *left = node->left; + node->left = left->right; + if (left->right != LDNS_RBTREE_NULL) + left->right->parent = node; + + left->parent = node->parent; + + if (node->parent != LDNS_RBTREE_NULL) { + if (node == node->parent->right) { + node->parent->right = left; + } else { + node->parent->left = left; + } + } else { + rbtree->root = left; + } + left->right = node; + node->parent = left; +} + +static void +ldns_rbtree_insert_fixup(ldns_rbtree_t *rbtree, ldns_rbnode_t *node) +{ + ldns_rbnode_t *uncle; + + /* While not at the root and need fixing... */ + while (node != rbtree->root && node->parent->color == RED) { + /* If our parent is left child of our grandparent... */ + if (node->parent == node->parent->parent->left) { + uncle = node->parent->parent->right; + + /* If our uncle is red... */ + if (uncle->color == RED) { + /* Paint the parent and the uncle black... */ + node->parent->color = BLACK; + uncle->color = BLACK; + + /* And the grandparent red... */ + node->parent->parent->color = RED; + + /* And continue fixing the grandparent */ + node = node->parent->parent; + } else { /* Our uncle is black... */ + /* Are we the right child? */ + if (node == node->parent->right) { + node = node->parent; + ldns_rbtree_rotate_left(rbtree, node); + } + /* Now we're the left child, repaint and rotate... */ + node->parent->color = BLACK; + node->parent->parent->color = RED; + ldns_rbtree_rotate_right(rbtree, node->parent->parent); + } + } else { + uncle = node->parent->parent->left; + + /* If our uncle is red... */ + if (uncle->color == RED) { + /* Paint the parent and the uncle black... */ + node->parent->color = BLACK; + uncle->color = BLACK; + + /* And the grandparent red... */ + node->parent->parent->color = RED; + + /* And continue fixing the grandparent */ + node = node->parent->parent; + } else { /* Our uncle is black... */ + /* Are we the right child? */ + if (node == node->parent->left) { + node = node->parent; + ldns_rbtree_rotate_right(rbtree, node); + } + /* Now we're the right child, repaint and rotate... */ + node->parent->color = BLACK; + node->parent->parent->color = RED; + ldns_rbtree_rotate_left(rbtree, node->parent->parent); + } + } + } + rbtree->root->color = BLACK; +} + +void +ldns_rbtree_insert_vref(ldns_rbnode_t *data, void *rbtree) +{ + (void) ldns_rbtree_insert((ldns_rbtree_t *) rbtree, + data); +} + +/* + * Inserts a node into a red black tree. + * + * Returns NULL on failure or the pointer to the newly added node + * otherwise. + */ +ldns_rbnode_t * +ldns_rbtree_insert (ldns_rbtree_t *rbtree, ldns_rbnode_t *data) +{ + /* XXX Not necessary, but keeps compiler quiet... */ + int r = 0; + + /* We start at the root of the tree */ + ldns_rbnode_t *node = rbtree->root; + ldns_rbnode_t *parent = LDNS_RBTREE_NULL; + + /* Lets find the new parent... */ + while (node != LDNS_RBTREE_NULL) { + /* Compare two keys, do we have a duplicate? */ + if ((r = rbtree->cmp(data->key, node->key)) == 0) { + return NULL; + } + parent = node; + + if (r < 0) { + node = node->left; + } else { + node = node->right; + } + } + + /* Initialize the new node */ + data->parent = parent; + data->left = data->right = LDNS_RBTREE_NULL; + data->color = RED; + rbtree->count++; + + /* Insert it into the tree... */ + if (parent != LDNS_RBTREE_NULL) { + if (r < 0) { + parent->left = data; + } else { + parent->right = data; + } + } else { + rbtree->root = data; + } + + /* Fix up the red-black properties... */ + ldns_rbtree_insert_fixup(rbtree, data); + + return data; +} + +/* + * Searches the red black tree, returns the data if key is found or NULL otherwise. + * + */ +ldns_rbnode_t * +ldns_rbtree_search (ldns_rbtree_t *rbtree, const void *key) +{ + ldns_rbnode_t *node; + + if (ldns_rbtree_find_less_equal(rbtree, key, &node)) { + return node; + } else { + return NULL; + } +} + +/** helpers for delete: swap node colours */ +static void swap_int8(uint8_t* x, uint8_t* y) +{ + uint8_t t = *x; *x = *y; *y = t; +} + +/** helpers for delete: swap node pointers */ +static void swap_np(ldns_rbnode_t** x, ldns_rbnode_t** y) +{ + ldns_rbnode_t* t = *x; *x = *y; *y = t; +} + +/** Update parent pointers of child trees of 'parent' */ +static void change_parent_ptr(ldns_rbtree_t* rbtree, ldns_rbnode_t* parent, ldns_rbnode_t* old, ldns_rbnode_t* new) +{ + if(parent == LDNS_RBTREE_NULL) + { + if(rbtree->root == old) rbtree->root = new; + return; + } + if(parent->left == old) parent->left = new; + if(parent->right == old) parent->right = new; +} +/** Update parent pointer of a node 'child' */ +static void change_child_ptr(ldns_rbnode_t* child, ldns_rbnode_t* old, ldns_rbnode_t* new) +{ + if(child == LDNS_RBTREE_NULL) return; + if(child->parent == old) child->parent = new; +} + +ldns_rbnode_t* +ldns_rbtree_delete(ldns_rbtree_t *rbtree, const void *key) +{ + ldns_rbnode_t *to_delete; + ldns_rbnode_t *child; + if((to_delete = ldns_rbtree_search(rbtree, key)) == 0) return 0; + rbtree->count--; + + /* make sure we have at most one non-leaf child */ + if(to_delete->left != LDNS_RBTREE_NULL && + to_delete->right != LDNS_RBTREE_NULL) + { + /* swap with smallest from right subtree (or largest from left) */ + ldns_rbnode_t *smright = to_delete->right; + while(smright->left != LDNS_RBTREE_NULL) + smright = smright->left; + /* swap the smright and to_delete elements in the tree, + * but the ldns_rbnode_t is first part of user data struct + * so cannot just swap the keys and data pointers. Instead + * readjust the pointers left,right,parent */ + + /* swap colors - colors are tied to the position in the tree */ + swap_int8(&to_delete->color, &smright->color); + + /* swap child pointers in parents of smright/to_delete */ + change_parent_ptr(rbtree, to_delete->parent, to_delete, smright); + if(to_delete->right != smright) + change_parent_ptr(rbtree, smright->parent, smright, to_delete); + + /* swap parent pointers in children of smright/to_delete */ + change_child_ptr(smright->left, smright, to_delete); + change_child_ptr(smright->left, smright, to_delete); + change_child_ptr(smright->right, smright, to_delete); + change_child_ptr(smright->right, smright, to_delete); + change_child_ptr(to_delete->left, to_delete, smright); + if(to_delete->right != smright) + change_child_ptr(to_delete->right, to_delete, smright); + if(to_delete->right == smright) + { + /* set up so after swap they work */ + to_delete->right = to_delete; + smright->parent = smright; + } + + /* swap pointers in to_delete/smright nodes */ + swap_np(&to_delete->parent, &smright->parent); + swap_np(&to_delete->left, &smright->left); + swap_np(&to_delete->right, &smright->right); + + /* now delete to_delete (which is at the location where the smright previously was) */ + } + + if(to_delete->left != LDNS_RBTREE_NULL) child = to_delete->left; + else child = to_delete->right; + + /* unlink to_delete from the tree, replace to_delete with child */ + change_parent_ptr(rbtree, to_delete->parent, to_delete, child); + change_child_ptr(child, to_delete, to_delete->parent); + + if(to_delete->color == RED) + { + /* if node is red then the child (black) can be swapped in */ + } + else if(child->color == RED) + { + /* change child to BLACK, removing a RED node is no problem */ + if(child!=LDNS_RBTREE_NULL) child->color = BLACK; + } + else ldns_rbtree_delete_fixup(rbtree, child, to_delete->parent); + + /* unlink completely */ + to_delete->parent = LDNS_RBTREE_NULL; + to_delete->left = LDNS_RBTREE_NULL; + to_delete->right = LDNS_RBTREE_NULL; + to_delete->color = BLACK; + return to_delete; +} + +static void ldns_rbtree_delete_fixup(ldns_rbtree_t* rbtree, ldns_rbnode_t* child, ldns_rbnode_t* child_parent) +{ + ldns_rbnode_t* sibling; + int go_up = 1; + + /* determine sibling to the node that is one-black short */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + + while(go_up) + { + if(child_parent == LDNS_RBTREE_NULL) + { + /* removed parent==black from root, every path, so ok */ + return; + } + + if(sibling->color == RED) + { /* rotate to get a black sibling */ + child_parent->color = RED; + sibling->color = BLACK; + if(child_parent->right == child) + ldns_rbtree_rotate_right(rbtree, child_parent); + else ldns_rbtree_rotate_left(rbtree, child_parent); + /* new sibling after rotation */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + + if(child_parent->color == BLACK + && sibling->color == BLACK + && sibling->left->color == BLACK + && sibling->right->color == BLACK) + { /* fixup local with recolor of sibling */ + if(sibling != LDNS_RBTREE_NULL) + sibling->color = RED; + + child = child_parent; + child_parent = child_parent->parent; + /* prepare to go up, new sibling */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + else go_up = 0; + } + + if(child_parent->color == RED + && sibling->color == BLACK + && sibling->left->color == BLACK + && sibling->right->color == BLACK) + { + /* move red to sibling to rebalance */ + if(sibling != LDNS_RBTREE_NULL) + sibling->color = RED; + child_parent->color = BLACK; + return; + } + + /* get a new sibling, by rotating at sibling. See which child + of sibling is red */ + if(child_parent->right == child + && sibling->color == BLACK + && sibling->right->color == RED + && sibling->left->color == BLACK) + { + sibling->color = RED; + sibling->right->color = BLACK; + ldns_rbtree_rotate_left(rbtree, sibling); + /* new sibling after rotation */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + else if(child_parent->left == child + && sibling->color == BLACK + && sibling->left->color == RED + && sibling->right->color == BLACK) + { + sibling->color = RED; + sibling->left->color = BLACK; + ldns_rbtree_rotate_right(rbtree, sibling); + /* new sibling after rotation */ + if(child_parent->right == child) sibling = child_parent->left; + else sibling = child_parent->right; + } + + /* now we have a black sibling with a red child. rotate and exchange colors. */ + sibling->color = child_parent->color; + child_parent->color = BLACK; + if(child_parent->right == child) + { + sibling->left->color = BLACK; + ldns_rbtree_rotate_right(rbtree, child_parent); + } + else + { + sibling->right->color = BLACK; + ldns_rbtree_rotate_left(rbtree, child_parent); + } +} + +int +ldns_rbtree_find_less_equal(ldns_rbtree_t *rbtree, const void *key, ldns_rbnode_t **result) +{ + int r; + ldns_rbnode_t *node; + + /* We start at root... */ + node = rbtree->root; + + *result = NULL; + + /* While there are children... */ + while (node != LDNS_RBTREE_NULL) { + r = rbtree->cmp(key, node->key); + if (r == 0) { + /* Exact match */ + *result = node; + return 1; + } + if (r < 0) { + node = node->left; + } else { + /* Temporary match */ + *result = node; + node = node->right; + } + } + return 0; +} + +/* + * Finds the first element in the red black tree + * + */ +ldns_rbnode_t * +ldns_rbtree_first (ldns_rbtree_t *rbtree) +{ + ldns_rbnode_t *node = rbtree->root; + + if (rbtree->root != LDNS_RBTREE_NULL) { + for (node = rbtree->root; node->left != LDNS_RBTREE_NULL; node = node->left); + } + return node; +} + +ldns_rbnode_t * +ldns_rbtree_last (ldns_rbtree_t *rbtree) +{ + ldns_rbnode_t *node = rbtree->root; + + if (rbtree->root != LDNS_RBTREE_NULL) { + for (node = rbtree->root; node->right != LDNS_RBTREE_NULL; node = node->right); + } + return node; +} + +/* + * Returns the next node... + * + */ +ldns_rbnode_t * +ldns_rbtree_next (ldns_rbnode_t *node) +{ + ldns_rbnode_t *parent; + + if (node->right != LDNS_RBTREE_NULL) { + /* One right, then keep on going left... */ + for (node = node->right; + node->left != LDNS_RBTREE_NULL; + node = node->left); + } else { + parent = node->parent; + while (parent != LDNS_RBTREE_NULL && node == parent->right) { + node = parent; + parent = parent->parent; + } + node = parent; + } + return node; +} + +ldns_rbnode_t * +ldns_rbtree_previous(ldns_rbnode_t *node) +{ + ldns_rbnode_t *parent; + + if (node->left != LDNS_RBTREE_NULL) { + /* One left, then keep on going right... */ + for (node = node->left; + node->right != LDNS_RBTREE_NULL; + node = node->right); + } else { + parent = node->parent; + while (parent != LDNS_RBTREE_NULL && node == parent->left) { + node = parent; + parent = parent->parent; + } + node = parent; + } + return node; +} + +/** + * split off elements number of elements from the start + * of the name tree and return a new tree + */ +ldns_rbtree_t * +ldns_rbtree_split(ldns_rbtree_t *tree, + size_t elements) +{ + ldns_rbtree_t *new_tree; + ldns_rbnode_t *cur_node; + ldns_rbnode_t *move_node; + size_t count = 0; + + new_tree = ldns_rbtree_create(tree->cmp); + + cur_node = ldns_rbtree_first(tree); + while (count < elements && cur_node != LDNS_RBTREE_NULL) { + move_node = ldns_rbtree_delete(tree, cur_node->key); + (void)ldns_rbtree_insert(new_tree, move_node); + cur_node = ldns_rbtree_first(tree); + count++; + } + + return new_tree; +} + +/* + * add all node from the second tree to the first (removing them from the + * second), and fix up nsec(3)s if present + */ +void +ldns_rbtree_join(ldns_rbtree_t *tree1, ldns_rbtree_t *tree2) +{ + ldns_traverse_postorder(tree2, ldns_rbtree_insert_vref, tree1); +} + +/** recursive descent traverse */ +static void +traverse_post(void (*func)(ldns_rbnode_t*, void*), void* arg, + ldns_rbnode_t* node) +{ + if(!node || node == LDNS_RBTREE_NULL) + return; + /* recurse */ + traverse_post(func, arg, node->left); + traverse_post(func, arg, node->right); + /* call user func */ + (*func)(node, arg); +} + +void +ldns_traverse_postorder(ldns_rbtree_t* tree, + void (*func)(ldns_rbnode_t*, void*), void* arg) +{ + traverse_post(func, arg, tree->root); +} diff --git a/libs/ldns/rdata.c b/libs/ldns/rdata.c new file mode 100644 index 0000000000..8af16a13a1 --- /dev/null +++ b/libs/ldns/rdata.c @@ -0,0 +1,675 @@ +/* + * rdata.c + * + * rdata implementation + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include + +/* + * Access functions + * do this as functions to get type checking + */ + +/* read */ +size_t +ldns_rdf_size(const ldns_rdf *rd) +{ + assert(rd != NULL); + return rd->_size; +} + +ldns_rdf_type +ldns_rdf_get_type(const ldns_rdf *rd) +{ + assert(rd != NULL); + return rd->_type; +} + +uint8_t * +ldns_rdf_data(const ldns_rdf *rd) +{ + assert(rd != NULL); + return rd->_data; +} + +/* write */ +void +ldns_rdf_set_size(ldns_rdf *rd, size_t size) +{ + assert(rd != NULL); + rd->_size = size; +} + +void +ldns_rdf_set_type(ldns_rdf *rd, ldns_rdf_type type) +{ + assert(rd != NULL); + rd->_type = type; +} + +void +ldns_rdf_set_data(ldns_rdf *rd, void *data) +{ + /* only copy the pointer */ + assert(rd != NULL); + rd->_data = data; +} + +/* for types that allow it, return + * the native/host order type */ +uint8_t +ldns_rdf2native_int8(const ldns_rdf *rd) +{ + uint8_t data; + + /* only allow 8 bit rdfs */ + if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_BYTE) { + return 0; + } + + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return data; +} + +uint16_t +ldns_rdf2native_int16(const ldns_rdf *rd) +{ + uint16_t data; + + /* only allow 16 bit rdfs */ + if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_WORD) { + return 0; + } + + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return ntohs(data); +} + +uint32_t +ldns_rdf2native_int32(const ldns_rdf *rd) +{ + uint32_t data; + + /* only allow 32 bit rdfs */ + if (ldns_rdf_size(rd) != LDNS_RDF_SIZE_DOUBLEWORD) { + return 0; + } + + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return ntohl(data); +} + +time_t +ldns_rdf2native_time_t(const ldns_rdf *rd) +{ + uint32_t data; + + switch(ldns_rdf_get_type(rd)) { + case LDNS_RDF_TYPE_TIME: + memcpy(&data, ldns_rdf_data(rd), sizeof(data)); + return (time_t)ntohl(data); + default: + return 0; + } +} + +ldns_rdf * +ldns_native2rdf_int8(ldns_rdf_type type, uint8_t value) +{ + return ldns_rdf_new_frm_data(type, LDNS_RDF_SIZE_BYTE, &value); +} + +ldns_rdf * +ldns_native2rdf_int16(ldns_rdf_type type, uint16_t value) +{ + uint16_t *rdf_data = LDNS_XMALLOC(uint16_t, 1); + ldns_rdf* rdf; + if (!rdf_data) { + return NULL; + } + ldns_write_uint16(rdf_data, value); + rdf = ldns_rdf_new(type, LDNS_RDF_SIZE_WORD, rdf_data); + if(!rdf) + LDNS_FREE(rdf_data); + return rdf; +} + +ldns_rdf * +ldns_native2rdf_int32(ldns_rdf_type type, uint32_t value) +{ + uint32_t *rdf_data = LDNS_XMALLOC(uint32_t, 1); + ldns_rdf* rdf; + if (!rdf_data) { + return NULL; + } + ldns_write_uint32(rdf_data, value); + rdf = ldns_rdf_new(type, LDNS_RDF_SIZE_DOUBLEWORD, rdf_data); + if(!rdf) + LDNS_FREE(rdf_data); + return rdf; +} + +ldns_rdf * +ldns_native2rdf_int16_data(size_t size, uint8_t *data) +{ + uint8_t *rdf_data = LDNS_XMALLOC(uint8_t, size + 2); + ldns_rdf* rdf; + if (!rdf_data) { + return NULL; + } + ldns_write_uint16(rdf_data, size); + memcpy(rdf_data + 2, data, size); + rdf = ldns_rdf_new(LDNS_RDF_TYPE_INT16_DATA, size + 2, rdf_data); + if(!rdf) + LDNS_FREE(rdf_data); + return rdf; +} + +/* note: data must be allocated memory */ +ldns_rdf * +ldns_rdf_new(ldns_rdf_type type, size_t size, void *data) +{ + ldns_rdf *rd; + rd = LDNS_MALLOC(ldns_rdf); + if (!rd) { + return NULL; + } + ldns_rdf_set_size(rd, size); + ldns_rdf_set_type(rd, type); + ldns_rdf_set_data(rd, data); + return rd; +} + +ldns_rdf * +ldns_rdf_new_frm_data(ldns_rdf_type type, size_t size, const void *data) +{ + ldns_rdf *rdf; + + /* if the size is too big, fail */ + if (size > LDNS_MAX_RDFLEN) { + return NULL; + } + + /* allocate space */ + rdf = LDNS_MALLOC(ldns_rdf); + if (!rdf) { + return NULL; + } + rdf->_data = LDNS_XMALLOC(uint8_t, size); + if (!rdf->_data) { + LDNS_FREE(rdf); + return NULL; + } + + /* set the values */ + ldns_rdf_set_type(rdf, type); + ldns_rdf_set_size(rdf, size); + memcpy(rdf->_data, data, size); + + return rdf; +} + +ldns_rdf * +ldns_rdf_clone(const ldns_rdf *rd) +{ + assert(rd != NULL); + return (ldns_rdf_new_frm_data( ldns_rdf_get_type(rd), + ldns_rdf_size(rd), ldns_rdf_data(rd))); +} + +void +ldns_rdf_deep_free(ldns_rdf *rd) +{ + if (rd) { + if (rd->_data) { + LDNS_FREE(rd->_data); + } + LDNS_FREE(rd); + } +} + +void +ldns_rdf_free(ldns_rdf *rd) +{ + if (rd) { + LDNS_FREE(rd); + } +} + +ldns_rdf * +ldns_rdf_new_frm_str(ldns_rdf_type type, const char *str) +{ + ldns_rdf *rdf = NULL; + ldns_status status; + + switch (type) { + case LDNS_RDF_TYPE_DNAME: + status = ldns_str2rdf_dname(&rdf, str); + break; + case LDNS_RDF_TYPE_INT8: + status = ldns_str2rdf_int8(&rdf, str); + break; + case LDNS_RDF_TYPE_INT16: + status = ldns_str2rdf_int16(&rdf, str); + break; + case LDNS_RDF_TYPE_INT32: + status = ldns_str2rdf_int32(&rdf, str); + break; + case LDNS_RDF_TYPE_A: + status = ldns_str2rdf_a(&rdf, str); + break; + case LDNS_RDF_TYPE_AAAA: + status = ldns_str2rdf_aaaa(&rdf, str); + break; + case LDNS_RDF_TYPE_STR: + status = ldns_str2rdf_str(&rdf, str); + break; + case LDNS_RDF_TYPE_APL: + status = ldns_str2rdf_apl(&rdf, str); + break; + case LDNS_RDF_TYPE_B64: + status = ldns_str2rdf_b64(&rdf, str); + break; + case LDNS_RDF_TYPE_B32_EXT: + status = ldns_str2rdf_b32_ext(&rdf, str); + break; + case LDNS_RDF_TYPE_HEX: + status = ldns_str2rdf_hex(&rdf, str); + break; + case LDNS_RDF_TYPE_NSEC: + status = ldns_str2rdf_nsec(&rdf, str); + break; + case LDNS_RDF_TYPE_TYPE: + status = ldns_str2rdf_type(&rdf, str); + break; + case LDNS_RDF_TYPE_CLASS: + status = ldns_str2rdf_class(&rdf, str); + break; + case LDNS_RDF_TYPE_CERT_ALG: + status = ldns_str2rdf_cert_alg(&rdf, str); + break; + case LDNS_RDF_TYPE_ALG: + status = ldns_str2rdf_alg(&rdf, str); + break; + case LDNS_RDF_TYPE_UNKNOWN: + status = ldns_str2rdf_unknown(&rdf, str); + break; + case LDNS_RDF_TYPE_TIME: + status = ldns_str2rdf_time(&rdf, str); + break; + case LDNS_RDF_TYPE_PERIOD: + status = ldns_str2rdf_period(&rdf, str); + break; + case LDNS_RDF_TYPE_TSIG: + status = ldns_str2rdf_tsig(&rdf, str); + break; + case LDNS_RDF_TYPE_SERVICE: + status = ldns_str2rdf_service(&rdf, str); + break; + case LDNS_RDF_TYPE_LOC: + status = ldns_str2rdf_loc(&rdf, str); + break; + case LDNS_RDF_TYPE_WKS: + status = ldns_str2rdf_wks(&rdf, str); + break; + case LDNS_RDF_TYPE_NSAP: + status = ldns_str2rdf_nsap(&rdf, str); + break; + case LDNS_RDF_TYPE_ATMA: + status = ldns_str2rdf_atma(&rdf, str); + break; + case LDNS_RDF_TYPE_IPSECKEY: + status = ldns_str2rdf_ipseckey(&rdf, str); + break; + case LDNS_RDF_TYPE_NSEC3_SALT: + status = ldns_str2rdf_nsec3_salt(&rdf, str); + break; + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + status = ldns_str2rdf_b32_ext(&rdf, str); + break; + case LDNS_RDF_TYPE_NONE: + default: + /* default default ??? */ + status = LDNS_STATUS_ERR; + break; + } + if (LDNS_STATUS_OK == status) { + ldns_rdf_set_type(rdf, type); + return rdf; + } + if (rdf) { + LDNS_FREE(rdf); + } + return NULL; +} + +ldns_status +ldns_rdf_new_frm_fp(ldns_rdf **rdf, ldns_rdf_type type, FILE *fp) +{ + return ldns_rdf_new_frm_fp_l(rdf, type, fp, NULL); +} + +ldns_status +ldns_rdf_new_frm_fp_l(ldns_rdf **rdf, ldns_rdf_type type, FILE *fp, int *line_nr) +{ + char *line; + ldns_rdf *r; + ssize_t t; + + line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + if (!line) { + return LDNS_STATUS_MEM_ERR; + } + + /* read an entire line in from the file */ + if ((t = ldns_fget_token_l(fp, line, LDNS_PARSE_SKIP_SPACE, 0, line_nr)) == -1 || t == 0) { + LDNS_FREE(line); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + r = ldns_rdf_new_frm_str(type, (const char*) line); + LDNS_FREE(line); + if (rdf) { + *rdf = r; + return LDNS_STATUS_OK; + } else { + return LDNS_STATUS_NULL; + } +} + +ldns_rdf * +ldns_rdf_address_reverse(ldns_rdf *rd) +{ + uint8_t buf_4[LDNS_IP4ADDRLEN]; + uint8_t buf_6[LDNS_IP6ADDRLEN * 2]; + ldns_rdf *rev; + ldns_rdf *in_addr; + ldns_rdf *ret_dname; + uint8_t octet; + uint8_t nnibble; + uint8_t nibble; + uint8_t i, j; + + char *char_dname; + int nbit; + + if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_A && + ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_AAAA) { + return NULL; + } + + in_addr = NULL; + ret_dname = NULL; + + switch(ldns_rdf_get_type(rd)) { + case LDNS_RDF_TYPE_A: + /* the length of the buffer is 4 */ + buf_4[3] = ldns_rdf_data(rd)[0]; + buf_4[2] = ldns_rdf_data(rd)[1]; + buf_4[1] = ldns_rdf_data(rd)[2]; + buf_4[0] = ldns_rdf_data(rd)[3]; + in_addr = ldns_dname_new_frm_str("in-addr.arpa."); + if (!in_addr) { + return NULL; + } + /* make a new rdf and convert that back */ + rev = ldns_rdf_new_frm_data( LDNS_RDF_TYPE_A, + LDNS_IP4ADDRLEN, (void*)&buf_4); + if (!rev) { + LDNS_FREE(in_addr); + return NULL; + } + + /* convert rev to a string */ + char_dname = ldns_rdf2str(rev); + if (!char_dname) { + LDNS_FREE(in_addr); + ldns_rdf_deep_free(rev); + return NULL; + } + /* transform back to rdf with type dname */ + ret_dname = ldns_dname_new_frm_str(char_dname); + if (!ret_dname) { + LDNS_FREE(in_addr); + ldns_rdf_deep_free(rev); + LDNS_FREE(char_dname); + return NULL; + } + /* not needed anymore */ + ldns_rdf_deep_free(rev); + LDNS_FREE(char_dname); + break; + case LDNS_RDF_TYPE_AAAA: + /* some foo magic to reverse the nibbles ... */ + + for (nbit = 127; nbit >= 0; nbit = nbit - 4) { + /* calculate octett (8 bit) */ + octet = ( ((unsigned int) nbit) & 0x78) >> 3; + /* calculate nibble */ + nnibble = ( ((unsigned int) nbit) & 0x04) >> 2; + /* extract nibble */ + nibble = (ldns_rdf_data(rd)[octet] & ( 0xf << (4 * (1 - + nnibble)) ) ) >> ( 4 * (1 - + nnibble)); + + buf_6[(LDNS_IP6ADDRLEN * 2 - 1) - + (octet * 2 + nnibble)] = + (uint8_t)ldns_int_to_hexdigit((int)nibble); + } + + char_dname = LDNS_XMALLOC(char, (LDNS_IP6ADDRLEN * 4)); + if (!char_dname) { + return NULL; + } + char_dname[LDNS_IP6ADDRLEN * 4 - 1] = '\0'; /* closure */ + + /* walk the string and add . 's */ + for (i = 0, j = 0; i < LDNS_IP6ADDRLEN * 2; i++, j = j + 2) { + char_dname[j] = (char)buf_6[i]; + if (i != LDNS_IP6ADDRLEN * 2 - 1) { + char_dname[j + 1] = '.'; + } + } + in_addr = ldns_dname_new_frm_str("ip6.arpa."); + if (!in_addr) { + LDNS_FREE(char_dname); + return NULL; + } + + /* convert rev to a string */ + ret_dname = ldns_dname_new_frm_str(char_dname); + LDNS_FREE(char_dname); + if (!ret_dname) { + ldns_rdf_deep_free(in_addr); + return NULL; + } + break; + default: + break; + } + /* add the suffix */ + rev = ldns_dname_cat_clone(ret_dname, in_addr); + + ldns_rdf_deep_free(ret_dname); + ldns_rdf_deep_free(in_addr); + return rev; +} + +ldns_status +ldns_octet(char *word, size_t *length) +{ + char *s; + char *p; + *length = 0; + + for (s = p = word; *s != '\0'; s++,p++) { + switch (*s) { + case '.': + if (s[1] == '.') { + return LDNS_STATUS_EMPTY_LABEL; + } + *p = *s; + (*length)++; + break; + case '\\': + if ('0' <= s[1] && s[1] <= '9' && + '0' <= s[2] && s[2] <= '9' && + '0' <= s[3] && s[3] <= '9') { + /* \DDD seen */ + int val = ((s[1] - '0') * 100 + + (s[2] - '0') * 10 + (s[3] - '0')); + + if (0 <= val && val <= 255) { + /* this also handles \0 */ + s += 3; + *p = val; + (*length)++; + } else { + return LDNS_STATUS_DDD_OVERFLOW; + } + } else { + /* an espaced character, like \ ? + * remove the '\' keep the rest */ + *p = *++s; + (*length)++; + } + break; + case '\"': + /* non quoted " Is either first or the last character in + * the string */ + + *p = *++s; /* skip it */ + (*length)++; + /* I'm not sure if this is needed in libdns... MG */ + if ( *s == '\0' ) { + /* ok, it was the last one */ + *p = '\0'; + return LDNS_STATUS_OK; + } + break; + default: + *p = *s; + (*length)++; + break; + } + } + *p = '\0'; + return LDNS_STATUS_OK; +} + +int +ldns_rdf_compare(const ldns_rdf *rd1, const ldns_rdf *rd2) +{ + uint16_t i1, i2, i; + uint8_t *d1, *d2; + + /* only when both are not NULL we can say anything about them */ + if (!rd1 && !rd2) { + return 0; + } + if (!rd1 || !rd2) { + return -1; + } + i1 = ldns_rdf_size(rd1); + i2 = ldns_rdf_size(rd2); + + if (i1 < i2) { + return -1; + } else if (i1 > i2) { + return +1; + } else { + d1 = (uint8_t*)ldns_rdf_data(rd1); + d2 = (uint8_t*)ldns_rdf_data(rd2); + for(i = 0; i < i1; i++) { + if (d1[i] < d2[i]) { + return -1; + } else if (d1[i] > d2[i]) { + return +1; + } + } + } + return 0; +} + +uint32_t +ldns_str2period(const char *nptr, const char **endptr) +{ + int sign = 0; + uint32_t i = 0; + uint32_t seconds = 0; + + for(*endptr = nptr; **endptr; (*endptr)++) { + switch (**endptr) { + case ' ': + case '\t': + break; + case '-': + if(sign == 0) { + sign = -1; + } else { + return seconds; + } + break; + case '+': + if(sign == 0) { + sign = 1; + } else { + return seconds; + } + break; + case 's': + case 'S': + seconds += i; + i = 0; + break; + case 'm': + case 'M': + seconds += i * 60; + i = 0; + break; + case 'h': + case 'H': + seconds += i * 60 * 60; + i = 0; + break; + case 'd': + case 'D': + seconds += i * 60 * 60 * 24; + i = 0; + break; + case 'w': + case 'W': + seconds += i * 60 * 60 * 24 * 7; + i = 0; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + i *= 10; + i += (**endptr - '0'); + break; + default: + seconds += i; + /* disregard signedness */ + return seconds; + } + } + seconds += i; + /* disregard signedness */ + return seconds; +} diff --git a/libs/ldns/resolver.c b/libs/ldns/resolver.c new file mode 100644 index 0000000000..735e6f147d --- /dev/null +++ b/libs/ldns/resolver.c @@ -0,0 +1,1309 @@ +/* + * resolver.c + * + * resolver implementation + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include +#include + +/* Access function for reading + * and setting the different Resolver + * options */ + +/* read */ +uint16_t +ldns_resolver_port(const ldns_resolver *r) +{ + return r->_port; +} + +uint16_t +ldns_resolver_edns_udp_size(const ldns_resolver *r) +{ + return r->_edns_udp_size; +} + +uint8_t +ldns_resolver_retry(const ldns_resolver *r) +{ + return r->_retry; +} + +uint8_t +ldns_resolver_retrans(const ldns_resolver *r) +{ + return r->_retrans; +} + +bool +ldns_resolver_fallback(const ldns_resolver *r) +{ + return r->_fallback; +} + +uint8_t +ldns_resolver_ip6(const ldns_resolver *r) +{ + return r->_ip6; +} + +bool +ldns_resolver_recursive(const ldns_resolver *r) +{ + return r->_recursive; +} + +bool +ldns_resolver_debug(const ldns_resolver *r) +{ + return r->_debug; +} + +bool +ldns_resolver_dnsrch(const ldns_resolver *r) +{ + return r->_dnsrch; +} + +bool +ldns_resolver_fail(const ldns_resolver *r) +{ + return r->_fail; +} + +bool +ldns_resolver_defnames(const ldns_resolver *r) +{ + return r->_defnames; +} + +ldns_rdf * +ldns_resolver_domain(const ldns_resolver *r) +{ + return r->_domain; +} + +ldns_rdf ** +ldns_resolver_searchlist(const ldns_resolver *r) +{ + return r->_searchlist; +} + +ldns_rdf ** +ldns_resolver_nameservers(const ldns_resolver *r) +{ + return r->_nameservers; +} + +size_t +ldns_resolver_nameserver_count(const ldns_resolver *r) +{ + return r->_nameserver_count; +} + +bool +ldns_resolver_dnssec(const ldns_resolver *r) +{ + return r->_dnssec; +} + +bool +ldns_resolver_dnssec_cd(const ldns_resolver *r) +{ + return r->_dnssec_cd; +} + +ldns_rr_list * +ldns_resolver_dnssec_anchors(const ldns_resolver *r) +{ + return r->_dnssec_anchors; +} + +bool +ldns_resolver_trusted_key(const ldns_resolver *r, ldns_rr_list * keys, ldns_rr_list * trusted_keys) +{ + size_t i; + bool result = false; + + ldns_rr_list * trust_anchors; + ldns_rr * cur_rr; + + if (!r || !keys) { return false; } + + trust_anchors = ldns_resolver_dnssec_anchors(r); + + if (!trust_anchors) { return false; } + + for (i = 0; i < ldns_rr_list_rr_count(keys); i++) { + + cur_rr = ldns_rr_list_rr(keys, i); + if (ldns_rr_list_contains_rr(trust_anchors, cur_rr)) { + if (trusted_keys) { ldns_rr_list_push_rr(trusted_keys, cur_rr); } + result = true; + } + } + + return result; +} + +bool +ldns_resolver_igntc(const ldns_resolver *r) +{ + return r->_igntc; +} + +bool +ldns_resolver_usevc(const ldns_resolver *r) +{ + return r->_usevc; +} + +size_t * +ldns_resolver_rtt(const ldns_resolver *r) +{ + return r->_rtt; +} + +size_t +ldns_resolver_nameserver_rtt(const ldns_resolver *r, size_t pos) +{ + size_t *rtt; + + assert(r != NULL); + + rtt = ldns_resolver_rtt(r); + + if (pos >= ldns_resolver_nameserver_count(r)) { + /* error ?*/ + return 0; + } else { + return rtt[pos]; + } + +} + +struct timeval +ldns_resolver_timeout(const ldns_resolver *r) +{ + return r->_timeout; +} + +char * +ldns_resolver_tsig_keyname(const ldns_resolver *r) +{ + return r->_tsig_keyname; +} + +char * +ldns_resolver_tsig_algorithm(const ldns_resolver *r) +{ + return r->_tsig_algorithm; +} + +char * +ldns_resolver_tsig_keydata(const ldns_resolver *r) +{ + return r->_tsig_keydata; +} + +bool +ldns_resolver_random(const ldns_resolver *r) +{ + return r->_random; +} + +size_t +ldns_resolver_searchlist_count(const ldns_resolver *r) +{ + return r->_searchlist_count; +} + +/* write */ +void +ldns_resolver_set_port(ldns_resolver *r, uint16_t p) +{ + r->_port = p; +} + +ldns_rdf * +ldns_resolver_pop_nameserver(ldns_resolver *r) +{ + ldns_rdf **nameservers; + ldns_rdf *pop; + size_t ns_count; + size_t *rtt; + + assert(r != NULL); + + ns_count = ldns_resolver_nameserver_count(r); + nameservers = ldns_resolver_nameservers(r); + rtt = ldns_resolver_rtt(r); + if (ns_count == 0 || !nameservers) { + return NULL; + } + + pop = nameservers[ns_count - 1]; + + nameservers = LDNS_XREALLOC(nameservers, ldns_rdf *, (ns_count - 1)); + rtt = LDNS_XREALLOC(rtt, size_t, (ns_count - 1)); + + if(nameservers) + ldns_resolver_set_nameservers(r, nameservers); + if(rtt) + ldns_resolver_set_rtt(r, rtt); + /* decr the count */ + ldns_resolver_dec_nameserver_count(r); + return pop; +} + +ldns_status +ldns_resolver_push_nameserver(ldns_resolver *r, ldns_rdf *n) +{ + ldns_rdf **nameservers; + size_t ns_count; + size_t *rtt; + + if (ldns_rdf_get_type(n) != LDNS_RDF_TYPE_A && + ldns_rdf_get_type(n) != LDNS_RDF_TYPE_AAAA) { + return LDNS_STATUS_ERR; + } + + ns_count = ldns_resolver_nameserver_count(r); + nameservers = ldns_resolver_nameservers(r); + rtt = ldns_resolver_rtt(r); + + /* make room for the next one */ + if (ns_count == 0) { + nameservers = LDNS_XMALLOC(ldns_rdf *, 1); + } else { + nameservers = LDNS_XREALLOC(nameservers, ldns_rdf *, (ns_count + 1)); + } + if(!nameservers) + return LDNS_STATUS_MEM_ERR; + + /* set the new value in the resolver */ + ldns_resolver_set_nameservers(r, nameservers); + + /* don't forget the rtt */ + if (ns_count == 0) { + rtt = LDNS_XMALLOC(size_t, 1); + } else { + rtt = LDNS_XREALLOC(rtt, size_t, (ns_count + 1)); + } + if(!rtt) + return LDNS_STATUS_MEM_ERR; + + /* slide n in its slot. */ + /* we clone it here, because then we can free the original + * rr's where it stood */ + nameservers[ns_count] = ldns_rdf_clone(n); + rtt[ns_count] = LDNS_RESOLV_RTT_MIN; + ldns_resolver_incr_nameserver_count(r); + ldns_resolver_set_rtt(r, rtt); + return LDNS_STATUS_OK; +} + +ldns_status +ldns_resolver_push_nameserver_rr(ldns_resolver *r, ldns_rr *rr) +{ + ldns_rdf *address; + if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_A && + ldns_rr_get_type(rr) != LDNS_RR_TYPE_AAAA)) { + return LDNS_STATUS_ERR; + } + address = ldns_rr_rdf(rr, 0); /* extract the ip number */ + if (address) { + return ldns_resolver_push_nameserver(r, address); + } else { + return LDNS_STATUS_ERR; + } +} + +ldns_status +ldns_resolver_push_nameserver_rr_list(ldns_resolver *r, ldns_rr_list *rrlist) +{ + ldns_rr *rr; + ldns_status stat; + size_t i; + + stat = LDNS_STATUS_OK; + if (rrlist) { + for(i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { + rr = ldns_rr_list_rr(rrlist, i); + if (ldns_resolver_push_nameserver_rr(r, rr) != LDNS_STATUS_OK) { + stat = LDNS_STATUS_ERR; + break; + } + } + return stat; + } else { + return LDNS_STATUS_ERR; + } +} + +void +ldns_resolver_set_edns_udp_size(ldns_resolver *r, uint16_t s) +{ + r->_edns_udp_size = s; +} + +void +ldns_resolver_set_recursive(ldns_resolver *r, bool re) +{ + r->_recursive = re; +} + +void +ldns_resolver_set_dnssec(ldns_resolver *r, bool d) +{ + r->_dnssec = d; +} + +void +ldns_resolver_set_dnssec_cd(ldns_resolver *r, bool d) +{ + r->_dnssec_cd = d; +} + +void +ldns_resolver_set_dnssec_anchors(ldns_resolver *r, ldns_rr_list * l) +{ + r->_dnssec_anchors = l; +} + +ldns_status +ldns_resolver_push_dnssec_anchor(ldns_resolver *r, ldns_rr *rr) +{ + ldns_rr_list * trust_anchors; + + if ((!rr) || (ldns_rr_get_type(rr) != LDNS_RR_TYPE_DNSKEY)) { + return LDNS_STATUS_ERR; + } + + if (!(trust_anchors = ldns_resolver_dnssec_anchors(r))) { /* Initialize */ + trust_anchors = ldns_rr_list_new(); + ldns_resolver_set_dnssec_anchors(r, trust_anchors); + } + + return (ldns_rr_list_push_rr(trust_anchors, ldns_rr_clone(rr))) ? LDNS_STATUS_OK : LDNS_STATUS_ERR; +} + +void +ldns_resolver_set_igntc(ldns_resolver *r, bool i) +{ + r->_igntc = i; +} + +void +ldns_resolver_set_usevc(ldns_resolver *r, bool vc) +{ + r->_usevc = vc; +} + +void +ldns_resolver_set_debug(ldns_resolver *r, bool d) +{ + r->_debug = d; +} + +void +ldns_resolver_set_ip6(ldns_resolver *r, uint8_t ip6) +{ + r->_ip6 = ip6; +} + +void +ldns_resolver_set_fail(ldns_resolver *r, bool f) +{ + r->_fail =f; +} + +void +ldns_resolver_set_searchlist_count(ldns_resolver *r, size_t c) +{ + r->_searchlist_count = c; +} + +void +ldns_resolver_set_nameserver_count(ldns_resolver *r, size_t c) +{ + r->_nameserver_count = c; +} + +void +ldns_resolver_set_dnsrch(ldns_resolver *r, bool d) +{ + r->_dnsrch = d; +} + +void +ldns_resolver_set_retry(ldns_resolver *r, uint8_t retry) +{ + r->_retry = retry; +} + +void +ldns_resolver_set_retrans(ldns_resolver *r, uint8_t retrans) +{ + r->_retrans = retrans; +} + +void +ldns_resolver_set_fallback(ldns_resolver *r, bool fallback) +{ + r->_fallback = fallback; +} + +void +ldns_resolver_set_nameservers(ldns_resolver *r, ldns_rdf **n) +{ + r->_nameservers = n; +} + +void +ldns_resolver_set_defnames(ldns_resolver *r, bool d) +{ + r->_defnames = d; +} + +void +ldns_resolver_set_rtt(ldns_resolver *r, size_t *rtt) +{ + r->_rtt = rtt; +} + +void +ldns_resolver_set_nameserver_rtt(ldns_resolver *r, size_t pos, size_t value) +{ + size_t *rtt; + + assert(r != NULL); + + rtt = ldns_resolver_rtt(r); + + if (pos >= ldns_resolver_nameserver_count(r)) { + /* error ?*/ + } else { + rtt[pos] = value; + } + +} + +void +ldns_resolver_incr_nameserver_count(ldns_resolver *r) +{ + size_t c; + + c = ldns_resolver_nameserver_count(r); + ldns_resolver_set_nameserver_count(r, ++c); +} + +void +ldns_resolver_dec_nameserver_count(ldns_resolver *r) +{ + size_t c; + + c = ldns_resolver_nameserver_count(r); + if (c == 0) { + return; + } else { + ldns_resolver_set_nameserver_count(r, --c); + } +} + +void +ldns_resolver_set_domain(ldns_resolver *r, ldns_rdf *d) +{ + r->_domain = d; +} + +void +ldns_resolver_set_timeout(ldns_resolver *r, struct timeval timeout) +{ + r->_timeout.tv_sec = timeout.tv_sec; + r->_timeout.tv_usec = timeout.tv_usec; +} + +void +ldns_resolver_push_searchlist(ldns_resolver *r, ldns_rdf *d) +{ + ldns_rdf **searchlist; + size_t list_count; + + if (ldns_rdf_get_type(d) != LDNS_RDF_TYPE_DNAME) { + return; + } + + list_count = ldns_resolver_searchlist_count(r); + searchlist = ldns_resolver_searchlist(r); + + searchlist = LDNS_XREALLOC(searchlist, ldns_rdf *, (list_count + 1)); + if (searchlist) { + r->_searchlist = searchlist; + + searchlist[list_count] = ldns_rdf_clone(d); + ldns_resolver_set_searchlist_count(r, list_count + 1); + } /* no way to report mem err */ +} + +void +ldns_resolver_set_tsig_keyname(ldns_resolver *r, char *tsig_keyname) +{ + LDNS_FREE(r->_tsig_keyname); + r->_tsig_keyname = strdup(tsig_keyname); +} + +void +ldns_resolver_set_tsig_algorithm(ldns_resolver *r, char *tsig_algorithm) +{ + LDNS_FREE(r->_tsig_algorithm); + r->_tsig_algorithm = strdup(tsig_algorithm); +} + +void +ldns_resolver_set_tsig_keydata(ldns_resolver *r, char *tsig_keydata) +{ + LDNS_FREE(r->_tsig_keydata); + r->_tsig_keydata = strdup(tsig_keydata); +} + +void +ldns_resolver_set_random(ldns_resolver *r, bool b) +{ + r->_random = b; +} + +/* more sophisticated functions */ +ldns_resolver * +ldns_resolver_new(void) +{ + ldns_resolver *r; + + r = LDNS_MALLOC(ldns_resolver); + if (!r) { + return NULL; + } + + r->_searchlist = NULL; + r->_nameservers = NULL; + r->_rtt = NULL; + + /* defaults are filled out */ + ldns_resolver_set_searchlist_count(r, 0); + ldns_resolver_set_nameserver_count(r, 0); + ldns_resolver_set_usevc(r, 0); + ldns_resolver_set_port(r, LDNS_PORT); + ldns_resolver_set_domain(r, NULL); + ldns_resolver_set_defnames(r, false); + ldns_resolver_set_retry(r, 3); + ldns_resolver_set_retrans(r, 2); + ldns_resolver_set_fallback(r, true); + ldns_resolver_set_fail(r, false); + ldns_resolver_set_edns_udp_size(r, 0); + ldns_resolver_set_dnssec(r, false); + ldns_resolver_set_dnssec_cd(r, false); + ldns_resolver_set_dnssec_anchors(r, NULL); + ldns_resolver_set_ip6(r, LDNS_RESOLV_INETANY); + ldns_resolver_set_igntc(r, false); + ldns_resolver_set_recursive(r, false); + ldns_resolver_set_dnsrch(r, true); + + /* randomize the nameserver to be queried + * when there are multiple + */ + ldns_resolver_set_random(r, true); + + ldns_resolver_set_debug(r, 0); + + r->_timeout.tv_sec = LDNS_DEFAULT_TIMEOUT_SEC; + r->_timeout.tv_usec = LDNS_DEFAULT_TIMEOUT_USEC; + + /* TODO: fd=0 is actually a valid socket (stdin), + replace with -1 */ + r->_socket = 0; + r->_axfr_soa_count = 0; + r->_axfr_i = 0; + r->_cur_axfr_pkt = NULL; + + r->_tsig_keyname = NULL; + r->_tsig_keydata = NULL; + r->_tsig_algorithm = NULL; + return r; +} + +ldns_status +ldns_resolver_new_frm_fp(ldns_resolver **res, FILE *fp) +{ + return ldns_resolver_new_frm_fp_l(res, fp, NULL); +} + +ldns_status +ldns_resolver_new_frm_fp_l(ldns_resolver **res, FILE *fp, int *line_nr) +{ + ldns_resolver *r; + const char *keyword[LDNS_RESOLV_KEYWORDS]; + char word[LDNS_MAX_LINELEN + 1]; + int8_t expect; + uint8_t i; + ldns_rdf *tmp; +#ifdef HAVE_SSL + ldns_rr *tmp_rr; +#endif + ssize_t gtr, bgtr; + ldns_buffer *b; + int lnr = 0, oldline; + if(!line_nr) line_nr = &lnr; + + /* do this better + * expect = + * 0: keyword + * 1: default domain dname + * 2: NS aaaa or a record + */ + + /* recognized keywords */ + keyword[LDNS_RESOLV_NAMESERVER] = "nameserver"; + keyword[LDNS_RESOLV_DEFDOMAIN] = "domain"; + keyword[LDNS_RESOLV_SEARCH] = "search"; + /* these two are read but not used atm TODO */ + keyword[LDNS_RESOLV_SORTLIST] = "sortlist"; + keyword[LDNS_RESOLV_OPTIONS] = "options"; + keyword[LDNS_RESOLV_ANCHOR] = "anchor"; + expect = LDNS_RESOLV_KEYWORD; + + r = ldns_resolver_new(); + if (!r) { + return LDNS_STATUS_MEM_ERR; + } + + gtr = 1; + word[0] = 0; + oldline = *line_nr; + expect = LDNS_RESOLV_KEYWORD; + while (gtr > 0) { + /* check comments */ + if (word[0] == '#') { + word[0]='x'; + if(oldline == *line_nr) { + /* skip until end of line */ + int c; + do { + c = fgetc(fp); + } while(c != EOF && c != '\n'); + if(c=='\n' && line_nr) (*line_nr)++; + } + /* and read next to prepare for further parsing */ + oldline = *line_nr; + continue; + } + oldline = *line_nr; + switch(expect) { + case LDNS_RESOLV_KEYWORD: + /* keyword */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr != 0) { + if(word[0] == '#') continue; + for(i = 0; i < LDNS_RESOLV_KEYWORDS; i++) { + if (strcasecmp(keyword[i], word) == 0) { + /* chosen the keyword and + * expect values carefully + */ + expect = i; + break; + } + } + /* no keyword recognized */ + if (expect == LDNS_RESOLV_KEYWORD) { + /* skip line */ + /* + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_KEYWORD_ERR; + */ + } + } + break; + case LDNS_RESOLV_DEFDOMAIN: + /* default domain dname */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr == 0) { + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + continue; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word); + if (!tmp) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_DNAME_ERR; + } + + /* DOn't free, because we copy the pointer */ + ldns_resolver_set_domain(r, tmp); + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_NAMESERVER: + /* NS aaaa or a record */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr == 0) { + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + continue; + } + if(strchr(word, '%')) { + /* snip off interface labels, + * fe80::222:19ff:fe31:4222%eth0 */ + strchr(word, '%')[0]=0; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_AAAA, word); + if (!tmp) { + /* try ip4 */ + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_A, word); + } + /* could not parse it, exit */ + if (!tmp) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_ERR; + } + (void)ldns_resolver_push_nameserver(r, tmp); + ldns_rdf_deep_free(tmp); + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_SEARCH: + /* search list domain dname */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + b = LDNS_MALLOC(ldns_buffer); + if(!b) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_MEM_ERR; + } + + ldns_buffer_new_frm_data(b, word, (size_t) gtr); + if(ldns_buffer_status(b) != LDNS_STATUS_OK) { + LDNS_FREE(b); + ldns_resolver_deep_free(r); + return LDNS_STATUS_MEM_ERR; + } + bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, (size_t) gtr + 1); + while (bgtr > 0) { + gtr -= bgtr; + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + ldns_buffer_free(b); + continue; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, word); + if (!tmp) { + ldns_resolver_deep_free(r); + ldns_buffer_free(b); + return LDNS_STATUS_SYNTAX_DNAME_ERR; + } + + ldns_resolver_push_searchlist(r, tmp); + + ldns_rdf_deep_free(tmp); + bgtr = ldns_bget_token(b, word, LDNS_PARSE_NORMAL, + (size_t) gtr + 1); + } + ldns_buffer_free(b); + gtr = 1; + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_SORTLIST: + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + /* sortlist not implemented atm */ + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_OPTIONS: + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_SKIP_SPACE, 0, line_nr); + /* options not implemented atm */ + expect = LDNS_RESOLV_KEYWORD; + break; + case LDNS_RESOLV_ANCHOR: + /* a file containing a DNSSEC trust anchor */ + gtr = ldns_fget_token_l(fp, word, LDNS_PARSE_NORMAL, 0, line_nr); + if (gtr == 0) { + ldns_resolver_deep_free(r); + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + if(word[0] == '#') { + expect = LDNS_RESOLV_KEYWORD; + continue; + } + +#ifdef HAVE_SSL + tmp_rr = ldns_read_anchor_file(word); + (void) ldns_resolver_push_dnssec_anchor(r, tmp_rr); + ldns_rr_free(tmp_rr); +#endif + expect = LDNS_RESOLV_KEYWORD; + break; + } + } + + if (res) { + *res = r; + return LDNS_STATUS_OK; + } else { + ldns_resolver_deep_free(r); + return LDNS_STATUS_NULL; + } +} + +ldns_status +ldns_resolver_new_frm_file(ldns_resolver **res, const char *filename) +{ + ldns_resolver *r; + FILE *fp; + ldns_status s; + + if (!filename) { + fp = fopen(LDNS_RESOLV_CONF, "r"); + + } else { + fp = fopen(filename, "r"); + } + if (!fp) { + return LDNS_STATUS_FILE_ERR; + } + + s = ldns_resolver_new_frm_fp(&r, fp); + fclose(fp); + if (s == LDNS_STATUS_OK) { + if (res) { + *res = r; + return LDNS_STATUS_OK; + } else { + return LDNS_STATUS_NULL; + } + } + return s; +} + +void +ldns_resolver_free(ldns_resolver *res) +{ + LDNS_FREE(res); +} + +void +ldns_resolver_deep_free(ldns_resolver *res) +{ + size_t i; + + if (res) { + if (res->_searchlist) { + for (i = 0; i < ldns_resolver_searchlist_count(res); i++) { + ldns_rdf_deep_free(res->_searchlist[i]); + } + LDNS_FREE(res->_searchlist); + } + if (res->_nameservers) { + for (i = 0; i < res->_nameserver_count; i++) { + ldns_rdf_deep_free(res->_nameservers[i]); + } + LDNS_FREE(res->_nameservers); + } + if (ldns_resolver_domain(res)) { + ldns_rdf_deep_free(ldns_resolver_domain(res)); + } + if (res->_tsig_keyname) { + LDNS_FREE(res->_tsig_keyname); + } + if (res->_tsig_keydata) { + LDNS_FREE(res->_tsig_keydata); + } + if (res->_tsig_algorithm) { + LDNS_FREE(res->_tsig_algorithm); + } + + if (res->_cur_axfr_pkt) { + ldns_pkt_free(res->_cur_axfr_pkt); + } + + if (res->_rtt) { + LDNS_FREE(res->_rtt); + } + if (res->_dnssec_anchors) { + ldns_rr_list_deep_free(res->_dnssec_anchors); + } + LDNS_FREE(res); + } +} + +ldns_pkt * +ldns_resolver_search(const ldns_resolver *r,const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + + char *str_dname; + ldns_rdf *new_name; + ldns_rdf **search_list; + size_t i; + ldns_pkt *p; + + str_dname = ldns_rdf2str(name); + + if (ldns_dname_str_absolute(str_dname)) { + /* query as-is */ + return ldns_resolver_query(r, name, t, c, flags); + } else if (ldns_resolver_dnsrch(r)) { + search_list = ldns_resolver_searchlist(r); + for (i = 0; i < ldns_resolver_searchlist_count(r); i++) { + new_name = ldns_dname_cat_clone(name, search_list[i]); + + p = ldns_resolver_query(r, new_name, t, c, flags); + ldns_rdf_free(new_name); + if (p) { + if (ldns_pkt_get_rcode(p) == LDNS_RCODE_NOERROR) { + return p; + } else { + ldns_pkt_free(p); + p = NULL; + } + } + } + } + return NULL; +} + +ldns_pkt * +ldns_resolver_query(const ldns_resolver *r, const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + ldns_rdf *newname; + ldns_pkt *pkt; + ldns_status status; + + pkt = NULL; + + if (!ldns_resolver_defnames(r)) { + status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, + t, c, flags); + if (status == LDNS_STATUS_OK) { + return pkt; + } else { + if (pkt) { + ldns_pkt_free(pkt); + } + return NULL; + } + } + + if (!ldns_resolver_domain(r)) { + /* _defnames is set, but the domain is not....?? */ + status = ldns_resolver_send(&pkt, (ldns_resolver *)r, name, + t, c, flags); + if (status == LDNS_STATUS_OK) { + return pkt; + } else { + if (pkt) { + ldns_pkt_free(pkt); + } + return NULL; + } + } + + newname = ldns_dname_cat_clone((const ldns_rdf*)name, ldns_resolver_domain(r)); + if (!newname) { + if (pkt) { + ldns_pkt_free(pkt); + } + return NULL; + } + + (void)ldns_resolver_send(&pkt, (ldns_resolver *)r, newname, t, c, + flags); + + ldns_rdf_free(newname); + + return pkt; +} + +ldns_status +ldns_resolver_send_pkt(ldns_pkt **answer, ldns_resolver *r, + ldns_pkt *query_pkt) +{ + ldns_pkt *answer_pkt = NULL; + ldns_status stat = LDNS_STATUS_OK; + + stat = ldns_send(&answer_pkt, (ldns_resolver *)r, query_pkt); + if (stat != LDNS_STATUS_OK) { + if(answer_pkt) { + ldns_pkt_free(answer_pkt); + answer_pkt = NULL; + } + } else { + /* if tc=1 fall back to EDNS and/or TCP */ + /* check for tcp first (otherwise we don't care about tc=1) */ + if (!ldns_resolver_usevc(r) && ldns_resolver_fallback(r)) { + if (ldns_pkt_tc(answer_pkt)) { + /* was EDNS0 set? */ + if (ldns_pkt_edns_udp_size(query_pkt) == 0) { + ldns_pkt_set_edns_udp_size(query_pkt, 4096); + ldns_pkt_free(answer_pkt); + stat = ldns_send(&answer_pkt, r, query_pkt); + } + /* either way, if it is still truncated, use TCP */ + if (stat != LDNS_STATUS_OK || + ldns_pkt_tc(answer_pkt)) { + ldns_resolver_set_usevc(r, true); + ldns_pkt_free(answer_pkt); + stat = ldns_send(&answer_pkt, r, query_pkt); + ldns_resolver_set_usevc(r, false); + } + } + } + } + + if (answer) { + *answer = answer_pkt; + } + + return stat; +} + +ldns_status +ldns_resolver_prepare_query_pkt(ldns_pkt **query_pkt, ldns_resolver *r, + const ldns_rdf *name, ldns_rr_type t, + ldns_rr_class c, uint16_t flags) +{ + struct timeval now; + + /* prepare a question pkt from the parameters + * and then send this */ + *query_pkt = ldns_pkt_query_new(ldns_rdf_clone(name), t, c, flags); + if (!*query_pkt) { + return LDNS_STATUS_ERR; + } + + /* set DO bit if necessary */ + if (ldns_resolver_dnssec(r)) { + if (ldns_resolver_edns_udp_size(r) == 0) { + ldns_resolver_set_edns_udp_size(r, 4096); + } + ldns_pkt_set_edns_do(*query_pkt, true); + if (ldns_resolver_dnssec_cd(r) || (flags & LDNS_CD)) { + ldns_pkt_set_cd(*query_pkt, true); + } + } + + /* transfer the udp_edns_size from the resolver to the packet */ + if (ldns_resolver_edns_udp_size(r) != 0) { + ldns_pkt_set_edns_udp_size(*query_pkt, ldns_resolver_edns_udp_size(r)); + } + + /* set the timestamp */ + now.tv_sec = time(NULL); + now.tv_usec = 0; + ldns_pkt_set_timestamp(*query_pkt, now); + + + if (ldns_resolver_debug(r)) { + ldns_pkt_print(stdout, *query_pkt); + } + + /* only set the id if it is not set yet */ + if (ldns_pkt_id(*query_pkt) == 0) { + ldns_pkt_set_random_id(*query_pkt); + } + + return LDNS_STATUS_OK; +} + + +ldns_status +ldns_resolver_send(ldns_pkt **answer, ldns_resolver *r, const ldns_rdf *name, + ldns_rr_type t, ldns_rr_class c, uint16_t flags) +{ + ldns_pkt *query_pkt; + ldns_pkt *answer_pkt; + ldns_status status; + + assert(r != NULL); + assert(name != NULL); + + answer_pkt = NULL; + + /* do all the preprocessing here, then fire of an query to + * the network */ + + if (0 == t) { + t= LDNS_RR_TYPE_A; + } + if (0 == c) { + c= LDNS_RR_CLASS_IN; + } + if (0 == ldns_resolver_nameserver_count(r)) { + return LDNS_STATUS_RES_NO_NS; + } + if (ldns_rdf_get_type(name) != LDNS_RDF_TYPE_DNAME) { + return LDNS_STATUS_RES_QUERY; + } + + status = ldns_resolver_prepare_query_pkt(&query_pkt, r, name, + t, c, flags); + if (status != LDNS_STATUS_OK) { + return status; + } + + /* if tsig values are set, tsign it */ + /* TODO: make last 3 arguments optional too? maybe make complete + rr instead of seperate values in resolver (and packet) + Jelte + should this go in pkt_prepare? + */ + if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) { +#ifdef HAVE_SSL + status = ldns_pkt_tsig_sign(query_pkt, + ldns_resolver_tsig_keyname(r), + ldns_resolver_tsig_keydata(r), + 300, ldns_resolver_tsig_algorithm(r), NULL); + if (status != LDNS_STATUS_OK) { + return LDNS_STATUS_CRYPTO_TSIG_ERR; + } +#else + return LDNS_STATUS_CRYPTO_TSIG_ERR; +#endif /* HAVE_SSL */ + } + + status = ldns_resolver_send_pkt(&answer_pkt, r, query_pkt); + ldns_pkt_free(query_pkt); + + /* allows answer to be NULL when not interested in return value */ + if (answer) { + *answer = answer_pkt; + } + return status; +} + +ldns_rr * +ldns_axfr_next(ldns_resolver *resolver) +{ + ldns_rr *cur_rr; + uint8_t *packet_wire; + size_t packet_wire_size; + ldns_lookup_table *rcode; + ldns_status status; + + /* check if start() has been called */ + if (!resolver || resolver->_socket == 0) { + return NULL; + } + + if (resolver->_cur_axfr_pkt) { + if (resolver->_axfr_i == ldns_pkt_ancount(resolver->_cur_axfr_pkt)) { + ldns_pkt_free(resolver->_cur_axfr_pkt); + resolver->_cur_axfr_pkt = NULL; + return ldns_axfr_next(resolver); + } + cur_rr = ldns_rr_clone(ldns_rr_list_rr( + ldns_pkt_answer(resolver->_cur_axfr_pkt), + resolver->_axfr_i)); + resolver->_axfr_i++; + if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) { + resolver->_axfr_soa_count++; + if (resolver->_axfr_soa_count >= 2) { +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + ldns_pkt_free(resolver->_cur_axfr_pkt); + resolver->_cur_axfr_pkt = NULL; + } + } + return cur_rr; + } else { + packet_wire = ldns_tcp_read_wire(resolver->_socket, &packet_wire_size); + if(!packet_wire) + return NULL; + + status = ldns_wire2pkt(&resolver->_cur_axfr_pkt, packet_wire, + packet_wire_size); + free(packet_wire); + + resolver->_axfr_i = 0; + if (status != LDNS_STATUS_OK) { + /* TODO: make status return type of this function (...api change) */ + fprintf(stderr, "Error parsing rr during AXFR: %s\n", ldns_get_errorstr_by_id(status)); + + /* RoRi: we must now also close the socket, otherwise subsequent uses of the + same resolver structure will fail because the link is still open or + in an undefined state */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return NULL; + } else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) { + rcode = ldns_lookup_by_id(ldns_rcodes, (int) ldns_pkt_get_rcode(resolver->_cur_axfr_pkt)); + fprintf(stderr, "Error in AXFR: %s\n", rcode->name); + + /* RoRi: we must now also close the socket, otherwise subsequent uses of the + same resolver structure will fail because the link is still open or + in an undefined state */ +#ifndef USE_WINSOCK + close(resolver->_socket); +#else + closesocket(resolver->_socket); +#endif + resolver->_socket = 0; + + return NULL; + } else { + return ldns_axfr_next(resolver); + } + + } + +} + +bool +ldns_axfr_complete(const ldns_resolver *res) +{ + /* complete when soa count is 2? */ + return res->_axfr_soa_count == 2; +} + +ldns_pkt * +ldns_axfr_last_pkt(const ldns_resolver *res) +{ + return res->_cur_axfr_pkt; +} + +/* random isn't really that good */ +void +ldns_resolver_nameservers_randomize(ldns_resolver *r) +{ + uint16_t i, j; + ldns_rdf **ns, *tmp; + + /* should I check for ldns_resolver_random?? */ + assert(r != NULL); + + ns = ldns_resolver_nameservers(r); + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + j = ldns_get_random() % ldns_resolver_nameserver_count(r); + tmp = ns[i]; + ns[i] = ns[j]; + ns[j] = tmp; + } + ldns_resolver_set_nameservers(r, ns); +} + diff --git a/libs/ldns/rr.c b/libs/ldns/rr.c new file mode 100644 index 0000000000..7b799b9b56 --- /dev/null +++ b/libs/ldns/rr.c @@ -0,0 +1,2403 @@ +/* rr.c + * + * access functions for ldns_rr - + * a Net::DNS like library for C + * LibDNS Team @ NLnet Labs + * + * (c) NLnet Labs, 2004-2006 + * See the file LICENSE for the license + */ +#include + +#include + +#include +#include + +#include + +#define LDNS_SYNTAX_DATALEN 16 +#define LDNS_TTL_DATALEN 21 +#define LDNS_RRLIST_INIT 8 + +ldns_rr * +ldns_rr_new(void) +{ + ldns_rr *rr; + rr = LDNS_MALLOC(ldns_rr); + if (!rr) { + return NULL; + } + + ldns_rr_set_owner(rr, NULL); + ldns_rr_set_question(rr, false); + ldns_rr_set_rd_count(rr, 0); + rr->_rdata_fields = NULL; + ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); + ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); + return rr; +} + +ldns_rr * +ldns_rr_new_frm_type(ldns_rr_type t) +{ + ldns_rr *rr; + const ldns_rr_descriptor *desc; + size_t i; + + rr = LDNS_MALLOC(ldns_rr); + if (!rr) { + return NULL; + } + + desc = ldns_rr_descript(t); + + rr->_rdata_fields = LDNS_XMALLOC(ldns_rdf *, ldns_rr_descriptor_minimum(desc)); + if(!rr->_rdata_fields) { + LDNS_FREE(rr); + return NULL; + } + for (i = 0; i < ldns_rr_descriptor_minimum(desc); i++) { + rr->_rdata_fields[i] = NULL; + } + + ldns_rr_set_owner(rr, NULL); + ldns_rr_set_question(rr, false); + /* set the count to minimum */ + ldns_rr_set_rd_count(rr, ldns_rr_descriptor_minimum(desc)); + ldns_rr_set_class(rr, LDNS_RR_CLASS_IN); + ldns_rr_set_ttl(rr, LDNS_DEFAULT_TTL); + ldns_rr_set_type(rr, t); + return rr; +} + +void +ldns_rr_free(ldns_rr *rr) +{ + size_t i; + if (rr) { + if (ldns_rr_owner(rr)) { + ldns_rdf_deep_free(ldns_rr_owner(rr)); + } + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + ldns_rdf_deep_free(ldns_rr_rdf(rr, i)); + } + LDNS_FREE(rr->_rdata_fields); + LDNS_FREE(rr); + } +} + +/* + * trailing spaces are allowed + * leading spaces are not allowed + * allow ttl to be optional + * class is optional too + * if ttl is missing, and default_ttl is 0, use DEF_TTL + * allow ttl to be written as 1d3h + * So the RR should look like. e.g. + * miek.nl. 3600 IN MX 10 elektron.atoom.net + * or + * miek.nl. 1h IN MX 10 elektron.atoom.net + * or + * miek.nl. IN MX 10 elektron.atoom.net + */ +static ldns_status +ldns_rr_new_frm_str_internal(ldns_rr **newrr, const char *str, + uint32_t default_ttl, ldns_rdf *origin, + ldns_rdf **prev, bool question) +{ + ldns_rr *new; + const ldns_rr_descriptor *desc; + ldns_rr_type rr_type; + ldns_buffer *rr_buf = NULL; + ldns_buffer *rd_buf = NULL; + uint32_t ttl_val; + char *owner = NULL; + char *ttl = NULL; + ldns_rr_class clas_val; + char *clas = NULL; + char *type = NULL; + char *rdata = NULL; + char *rd = NULL; + char *b64 = NULL; + size_t rd_strlen; + const char *delimiters; + ssize_t c; + ldns_rdf *owner_dname; + const char* endptr; + int was_unknown_rr_format = 0; + ldns_status status = LDNS_STATUS_OK; + + /* used for types with unknown number of rdatas */ + bool done; + bool quoted; + + ldns_rdf *r = NULL; + uint16_t r_cnt; + uint16_t r_min; + uint16_t r_max; + size_t pre_data_pos; + + new = ldns_rr_new(); + + owner = LDNS_XMALLOC(char, LDNS_MAX_DOMAINLEN + 1); + ttl = LDNS_XMALLOC(char, LDNS_TTL_DATALEN); + clas = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); + rdata = LDNS_XMALLOC(char, LDNS_MAX_PACKETLEN + 1); + rr_buf = LDNS_MALLOC(ldns_buffer); + rd_buf = LDNS_MALLOC(ldns_buffer); + rd = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); + b64 = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); + if (!new || !owner || !ttl || !clas || !rdata || !rr_buf || !rd_buf || !rd || !b64 ) { + status = LDNS_STATUS_MEM_ERR; + LDNS_FREE(rr_buf); + goto ldnserror; + } + + ldns_buffer_new_frm_data(rr_buf, (char*)str, strlen(str)); + + /* split the rr in its parts -1 signals trouble */ + if (ldns_bget_token(rr_buf, owner, "\t\n ", LDNS_MAX_DOMAINLEN) == -1) { + status = LDNS_STATUS_SYNTAX_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + + if (ldns_bget_token(rr_buf, ttl, "\t\n ", LDNS_TTL_DATALEN) == -1) { + status = LDNS_STATUS_SYNTAX_TTL_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + ttl_val = (uint32_t) ldns_str2period(ttl, &endptr); + + if (strlen(ttl) > 0 && !isdigit((int) ttl[0])) { + /* ah, it's not there or something */ + if (default_ttl == 0) { + ttl_val = LDNS_DEFAULT_TTL; + } else { + ttl_val = default_ttl; + } + /* we not ASSUMING the TTL is missing and that + * the rest of the RR is still there. That is + * CLASS TYPE RDATA + * so ttl value we read is actually the class + */ + clas_val = ldns_get_rr_class_by_name(ttl); + /* class can be left out too, assume IN, current + * token must be type + */ + if (clas_val == 0) { + clas_val = LDNS_RR_CLASS_IN; + type = LDNS_XMALLOC(char, strlen(ttl) + 1); + if(!type) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + strncpy(type, ttl, strlen(ttl) + 1); + } + } else { + if (ldns_bget_token(rr_buf, clas, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { + status = LDNS_STATUS_SYNTAX_CLASS_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + clas_val = ldns_get_rr_class_by_name(clas); + /* class can be left out too, assume IN, current + * token must be type + */ + if (clas_val == 0) { + clas_val = LDNS_RR_CLASS_IN; + type = LDNS_XMALLOC(char, strlen(clas) + 1); + if(!type) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + strncpy(type, clas, strlen(clas) + 1); + } + } + /* the rest should still be waiting for us */ + + if (!type) { + type = LDNS_XMALLOC(char, LDNS_SYNTAX_DATALEN); + if(!type) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + if (ldns_bget_token(rr_buf, type, "\t\n ", LDNS_SYNTAX_DATALEN) == -1) { + status = LDNS_STATUS_SYNTAX_TYPE_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + + if (ldns_bget_token(rr_buf, rdata, "\0", LDNS_MAX_PACKETLEN) == -1) { + /* apparently we are done, and it's only a question RR + * so do not set status and go to ldnserror here + */ + } + + ldns_buffer_new_frm_data(rd_buf, rdata, strlen(rdata)); + + if (strlen(owner) <= 1 && strncmp(owner, "@", 1) == 0) { + if (origin) { + ldns_rr_set_owner(new, ldns_rdf_clone(origin)); + } else if (prev && *prev) { + ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); + } else { + /* default to root */ + ldns_rr_set_owner(new, ldns_dname_new_frm_str(".")); + } + + /* @ also overrides prev */ + if (prev) { + ldns_rdf_deep_free(*prev); + *prev = ldns_rdf_clone(ldns_rr_owner(new)); + if (!*prev) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + } else { + if (strlen(owner) == 0) { + /* no ownername was given, try prev, if that fails + * origin, else default to root */ + if (prev && *prev) { + ldns_rr_set_owner(new, ldns_rdf_clone(*prev)); + } else if (origin) { + ldns_rr_set_owner(new, ldns_rdf_clone(origin)); + } else { + ldns_rr_set_owner(new, ldns_dname_new_frm_str(".")); + } + if(!ldns_rr_owner(new)) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } else { + owner_dname = ldns_dname_new_frm_str(owner); + if (!owner_dname) { + status = LDNS_STATUS_SYNTAX_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + + ldns_rr_set_owner(new, owner_dname); + if (!ldns_dname_str_absolute(owner) && origin) { + if(ldns_dname_cat(ldns_rr_owner(new), + origin) != LDNS_STATUS_OK) { + status = LDNS_STATUS_SYNTAX_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + if (prev) { + ldns_rdf_deep_free(*prev); + *prev = ldns_rdf_clone(ldns_rr_owner(new)); + if(!*prev) { + status = LDNS_STATUS_MEM_ERR; + ldns_buffer_free(rr_buf); + goto ldnserror; + } + } + } + } + LDNS_FREE(owner); + owner = NULL; + + ldns_rr_set_question(new, question); + + ldns_rr_set_ttl(new, ttl_val); + LDNS_FREE(ttl); + ttl = NULL; + + ldns_rr_set_class(new, clas_val); + LDNS_FREE(clas); + clas = NULL; + + rr_type = ldns_get_rr_type_by_name(type); + LDNS_FREE(type); + type = NULL; + + desc = ldns_rr_descript((uint16_t)rr_type); + ldns_rr_set_type(new, rr_type); + if (desc) { + /* only the rdata remains */ + r_max = ldns_rr_descriptor_maximum(desc); + r_min = ldns_rr_descriptor_minimum(desc); + } else { + r_min = 0; + r_max = 1; + } + + /* depending on the rr_type we need to extract + * the rdata differently, e.g. NSEC/NSEC3 */ + switch(rr_type) { + default: + done = false; + + for (r_cnt = 0; !done && r_cnt < r_max; r_cnt++) { + quoted = false; + /* if type = B64, the field may contain spaces */ + if (ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_B64 || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_HEX || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_LOC || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_WKS || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_IPSECKEY || + ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_NSEC) { + delimiters = "\n\t"; + } else { + delimiters = "\n\t "; + } + + if (ldns_rr_descriptor_field_type(desc, + r_cnt) == LDNS_RDF_TYPE_STR && + ldns_buffer_remaining(rd_buf) > 0) { + /* skip spaces */ + while (*(ldns_buffer_current(rd_buf)) == ' ') { + ldns_buffer_skip(rd_buf, 1); + } + + if (*(ldns_buffer_current(rd_buf)) == '\"') { + delimiters = "\"\0"; + ldns_buffer_skip(rd_buf, 1); + quoted = true; + } + } + + /* because number of fields can be variable, we can't + rely on _maximum() only */ + /* skip spaces */ + while (ldns_buffer_position(rd_buf) < ldns_buffer_limit(rd_buf) && + *(ldns_buffer_current(rd_buf)) == ' ' && !quoted + ) { + ldns_buffer_skip(rd_buf, 1); + } + + pre_data_pos = ldns_buffer_position(rd_buf); + if ((c = ldns_bget_token(rd_buf, rd, delimiters, + LDNS_MAX_RDFLEN)) != -1) { + /* hmmz, rfc3597 specifies that any type can be represented with + * \# method, which can contain spaces... + * it does specify size though... + */ + rd_strlen = strlen(rd); + + /* unknown RR data */ + if (strncmp(rd, "\\#", 2) == 0 && !quoted && (rd_strlen == 2 || rd[2]==' ')) { + uint16_t hex_data_size; + char *hex_data_str; + uint16_t cur_hex_data_size; + + was_unknown_rr_format = 1; + /* go back to before \# and skip it while setting delimiters better */ + ldns_buffer_set_position(rd_buf, pre_data_pos); + delimiters = "\n\t "; + (void)ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); + /* read rdata octet length */ + c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); + if (c == -1) { + /* something goes very wrong here */ + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + hex_data_size = (uint16_t) atoi(rd); + /* copy the hex chars into hex str (which is 2 chars per byte) */ + hex_data_str = LDNS_XMALLOC(char, 2 * hex_data_size + 1); + if (!hex_data_str) { + /* malloc error */ + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + cur_hex_data_size = 0; + while(cur_hex_data_size < 2 * hex_data_size) { + c = ldns_bget_token(rd_buf, rd, delimiters, LDNS_MAX_RDFLEN); + rd_strlen = strlen(rd); + strncpy(hex_data_str + cur_hex_data_size, rd, rd_strlen); + cur_hex_data_size += rd_strlen; + } + hex_data_str[cur_hex_data_size] = '\0'; + + /* correct the rdf type */ + /* if *we* know the type, interpret it as wireformat */ + if (desc) { + size_t hex_pos = 0; + uint8_t *hex_data = LDNS_XMALLOC(uint8_t, hex_data_size + 2); + ldns_status s; + if(!hex_data) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_MEM_ERR; + } + ldns_write_uint16(hex_data, hex_data_size); + ldns_hexstring_to_data(hex_data + 2, hex_data_str); + s = ldns_wire2rdf(new, hex_data, + hex_data_size+2, &hex_pos); + if(s != LDNS_STATUS_OK) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return s; + } + LDNS_FREE(hex_data); + } else { + r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_HEX, hex_data_str); + if(!r) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_MEM_ERR; + } + ldns_rdf_set_type(r, LDNS_RDF_TYPE_UNKNOWN); + if(!ldns_rr_push_rdf(new, r)) { + LDNS_FREE(hex_data_str); + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_MEM_ERR; + } + } + LDNS_FREE(hex_data_str); + } else { + /* Normal RR */ + switch(ldns_rr_descriptor_field_type(desc, r_cnt)) { + case LDNS_RDF_TYPE_HEX: + case LDNS_RDF_TYPE_B64: + /* can have spaces, and will always be the last + * record of the rrdata. Read in the rest */ + if ((c = ldns_bget_token(rd_buf, + b64, + "\n", + LDNS_MAX_RDFLEN)) + != -1) { + rd = strncat(rd, + b64, + LDNS_MAX_RDFLEN + - strlen(rd) - 1); + } + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type(desc, r_cnt), + rd); + break; + case LDNS_RDF_TYPE_DNAME: + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type(desc, r_cnt), + rd); + + /* check if the origin should be used or concatenated */ + if (r && ldns_rdf_size(r) > 1 && ldns_rdf_data(r)[0] == 1 + && ldns_rdf_data(r)[1] == '@') { + ldns_rdf_deep_free(r); + if (origin) { + r = ldns_rdf_clone(origin); + } else { + /* if this is the SOA, use its own owner name */ + if (rr_type == LDNS_RR_TYPE_SOA) { + r = ldns_rdf_clone(ldns_rr_owner(new)); + } else { + r = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, "."); + } + } + } else if (r && rd_strlen >= 1 && !ldns_dname_str_absolute(rd) && origin) { + if (ldns_dname_cat(r, origin) != LDNS_STATUS_OK) { + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_ERR; + } + } + break; + default: + r = ldns_rdf_new_frm_str( + ldns_rr_descriptor_field_type(desc, r_cnt), + rd); + break; + } + if (r) { + ldns_rr_push_rdf(new, r); + } else { + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_RDATA_ERR; + } + } + if (quoted) { + if (ldns_buffer_available(rd_buf, 1)) { + ldns_buffer_skip(rd_buf, 1); + } else { + done = true; + } + } + } else { + done = true; + } + } + } + LDNS_FREE(rd); + LDNS_FREE(b64); + ldns_buffer_free(rd_buf); + ldns_buffer_free(rr_buf); + LDNS_FREE(rdata); + + if (!question && desc && !was_unknown_rr_format && ldns_rr_rd_count(new) < r_min) { + ldns_rr_free(new); + return LDNS_STATUS_SYNTAX_MISSING_VALUE_ERR; + } + + if (newrr) { + *newrr = new; + } + return LDNS_STATUS_OK; + +ldnserror: + LDNS_FREE(type); + LDNS_FREE(owner); + LDNS_FREE(ttl); + LDNS_FREE(clas); + LDNS_FREE(rdata); + LDNS_FREE(rd); + LDNS_FREE(rd_buf); + LDNS_FREE(b64); + ldns_rr_free(new); + return status; +} + +ldns_status +ldns_rr_new_frm_str(ldns_rr **newrr, const char *str, + uint32_t default_ttl, ldns_rdf *origin, + ldns_rdf **prev) +{ + return ldns_rr_new_frm_str_internal(newrr, + str, + default_ttl, + origin, + prev, + false); +} + +ldns_status +ldns_rr_new_question_frm_str(ldns_rr **newrr, const char *str, + ldns_rdf *origin, ldns_rdf **prev) +{ + return ldns_rr_new_frm_str_internal(newrr, + str, + 0, + origin, + prev, + true); +} + +ldns_status +ldns_rr_new_frm_fp(ldns_rr **newrr, FILE *fp, uint32_t *ttl, ldns_rdf **origin, ldns_rdf **prev) +{ + return ldns_rr_new_frm_fp_l(newrr, fp, ttl, origin, prev, NULL); +} + +ldns_status +ldns_rr_new_frm_fp_l(ldns_rr **newrr, FILE *fp, uint32_t *default_ttl, ldns_rdf **origin, ldns_rdf **prev, int *line_nr) +{ + char *line; + const char *endptr; /* unused */ + ldns_rr *rr; + uint32_t ttl; + ldns_rdf *tmp; + ldns_status s; + ssize_t size; + int offset = 0; + + if (default_ttl) { + ttl = *default_ttl; + } else { + ttl = 0; + } + + line = LDNS_XMALLOC(char, LDNS_MAX_LINELEN + 1); + if (!line) { + return LDNS_STATUS_MEM_ERR; + } + + /* read an entire line in from the file */ + if ((size = ldns_fget_token_l(fp, line, LDNS_PARSE_SKIP_SPACE, LDNS_MAX_LINELEN, line_nr)) == -1) { + LDNS_FREE(line); + /* if last line was empty, we are now at feof, which is not + * always a parse error (happens when for instance last line + * was a comment) + */ + return LDNS_STATUS_SYNTAX_ERR; + } + + /* we can have the situation, where we've read ok, but still got + * no bytes to play with, in this case size is 0 + */ + if (size == 0) { + LDNS_FREE(line); + return LDNS_STATUS_SYNTAX_EMPTY; + } + + if (strncmp(line, "$ORIGIN", 7) == 0 && isspace(line[7])) { + if (*origin) { + ldns_rdf_deep_free(*origin); + *origin = NULL; + } + offset = 8; + while (isspace(line[offset])) { + offset++; + } + tmp = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, line + offset); + if (!tmp) { + /* could not parse what next to $ORIGIN */ + LDNS_FREE(line); + return LDNS_STATUS_SYNTAX_DNAME_ERR; + } + *origin = tmp; + s = LDNS_STATUS_SYNTAX_ORIGIN; + } else if (strncmp(line, "$TTL", 4) == 0 && isspace(line[4])) { + offset = 5; + while (isspace(line[offset])) { + offset++; + } + if (default_ttl) { + *default_ttl = ldns_str2period(line + offset, &endptr); + } + s = LDNS_STATUS_SYNTAX_TTL; + } else if (strncmp(line, "$INCLUDE", 8) == 0) { + s = LDNS_STATUS_SYNTAX_INCLUDE; + } else { + if (origin && *origin) { + s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, *origin, prev); + } else { + s = ldns_rr_new_frm_str(&rr, (const char*) line, ttl, NULL, prev); + } + } + LDNS_FREE(line); + if (newrr && s == LDNS_STATUS_OK) { + *newrr = rr; + } + return s; +} + +void +ldns_rr_set_owner(ldns_rr *rr, ldns_rdf *owner) +{ + rr->_owner = owner; +} + +void +ldns_rr_set_question(ldns_rr *rr, bool question) +{ + rr->_rr_question = question; +} + +void +ldns_rr_set_ttl(ldns_rr *rr, uint32_t ttl) +{ + rr->_ttl = ttl; +} + +void +ldns_rr_set_rd_count(ldns_rr *rr, size_t count) +{ + rr->_rd_count = count; +} + +void +ldns_rr_set_type(ldns_rr *rr, ldns_rr_type rr_type) +{ + rr->_rr_type = rr_type; +} + +void +ldns_rr_set_class(ldns_rr *rr, ldns_rr_class rr_class) +{ + rr->_rr_class = rr_class; +} + +ldns_rdf * +ldns_rr_set_rdf(ldns_rr *rr, const ldns_rdf *f, size_t position) +{ + size_t rd_count; + ldns_rdf *pop; + + rd_count = ldns_rr_rd_count(rr); + if (position < rd_count) { + /* dicard the old one */ + pop = rr->_rdata_fields[position]; + rr->_rdata_fields[position] = (ldns_rdf*)f; + return pop; + } else { + return NULL; + } +} + +bool +ldns_rr_push_rdf(ldns_rr *rr, const ldns_rdf *f) +{ + size_t rd_count; + ldns_rdf **rdata_fields; + + rd_count = ldns_rr_rd_count(rr); + + /* grow the array */ + rdata_fields = LDNS_XREALLOC( + rr->_rdata_fields, ldns_rdf *, rd_count + 1); + if (!rdata_fields) { + return false; + } + + /* add the new member */ + rr->_rdata_fields = rdata_fields; + rr->_rdata_fields[rd_count] = (ldns_rdf*)f; + + ldns_rr_set_rd_count(rr, rd_count + 1); + return true; +} + +ldns_rdf * +ldns_rr_pop_rdf(ldns_rr *rr) +{ + size_t rd_count; + ldns_rdf *pop; + ldns_rdf** newrd; + + rd_count = ldns_rr_rd_count(rr); + + if (rd_count == 0) { + return NULL; + } + + pop = rr->_rdata_fields[rd_count - 1]; + + /* try to shrink the array */ + if(rd_count > 1) { + newrd = LDNS_XREALLOC( + rr->_rdata_fields, ldns_rdf *, rd_count - 1); + if(newrd) + rr->_rdata_fields = newrd; + } else { + LDNS_FREE(rr->_rdata_fields); + } + + ldns_rr_set_rd_count(rr, rd_count - 1); + return pop; +} + +ldns_rdf * +ldns_rr_rdf(const ldns_rr *rr, size_t nr) +{ + if (nr < ldns_rr_rd_count(rr)) { + return rr->_rdata_fields[nr]; + } else { + return NULL; + } +} + +ldns_rdf * +ldns_rr_owner(const ldns_rr *rr) +{ + return rr->_owner; +} + +bool +ldns_rr_is_question(const ldns_rr *rr) +{ + return rr->_rr_question; +} + +uint32_t +ldns_rr_ttl(const ldns_rr *rr) +{ + return rr->_ttl; +} + +size_t +ldns_rr_rd_count(const ldns_rr *rr) +{ + return rr->_rd_count; +} + +ldns_rr_type +ldns_rr_get_type(const ldns_rr *rr) +{ + return rr->_rr_type; +} + +ldns_rr_class +ldns_rr_get_class(const ldns_rr *rr) +{ + return rr->_rr_class; +} + +/* rr_lists */ + +size_t +ldns_rr_list_rr_count(const ldns_rr_list *rr_list) +{ + if (rr_list) { + return rr_list->_rr_count; + } else { + return 0; + } +} + +ldns_rr * +ldns_rr_list_set_rr(ldns_rr_list *rr_list, const ldns_rr *r, size_t count) +{ + ldns_rr *old; + + if (count > ldns_rr_list_rr_count(rr_list)) { + return NULL; + } + + old = ldns_rr_list_rr(rr_list, count); + + /* overwrite old's pointer */ + rr_list->_rrs[count] = (ldns_rr*)r; + return old; +} + +void +ldns_rr_list_set_rr_count(ldns_rr_list *rr_list, size_t count) +{ + assert(count <= rr_list->_rr_capacity); + rr_list->_rr_count = count; +} + +ldns_rr * +ldns_rr_list_rr(const ldns_rr_list *rr_list, size_t nr) +{ + if (nr < ldns_rr_list_rr_count(rr_list)) { + return rr_list->_rrs[nr]; + } else { + return NULL; + } +} + +ldns_rr_list * +ldns_rr_list_new() +{ + ldns_rr_list *rr_list = LDNS_MALLOC(ldns_rr_list); + if(!rr_list) return NULL; + rr_list->_rr_count = 0; + rr_list->_rr_capacity = 0; + rr_list->_rrs = NULL; + return rr_list; +} + +void +ldns_rr_list_free(ldns_rr_list *rr_list) +{ + if (rr_list) { + LDNS_FREE(rr_list->_rrs); + LDNS_FREE(rr_list); + } +} + +void +ldns_rr_list_deep_free(ldns_rr_list *rr_list) +{ + size_t i; + + if (rr_list) { + for (i=0; i < ldns_rr_list_rr_count(rr_list); i++) { + ldns_rr_free(ldns_rr_list_rr(rr_list, i)); + } + LDNS_FREE(rr_list->_rrs); + LDNS_FREE(rr_list); + } +} + + +/* add right to left. So we modify *left! */ +bool +ldns_rr_list_cat(ldns_rr_list *left, ldns_rr_list *right) +{ + size_t r_rr_count; + size_t i; + + if (!left) { + return false; + } + + if (right) { + r_rr_count = ldns_rr_list_rr_count(right); + } else { + r_rr_count = 0; + } + + /* push right to left */ + for(i = 0; i < r_rr_count; i++) { + ldns_rr_list_push_rr(left, ldns_rr_list_rr(right, i)); + } + return true; +} + +ldns_rr_list * +ldns_rr_list_cat_clone(ldns_rr_list *left, ldns_rr_list *right) +{ + size_t l_rr_count; + size_t r_rr_count; + size_t i; + ldns_rr_list *cat; + + if (left) { + l_rr_count = ldns_rr_list_rr_count(left); + } else { + return ldns_rr_list_clone(right); + } + + if (right) { + r_rr_count = ldns_rr_list_rr_count(right); + } else { + r_rr_count = 0; + } + + cat = ldns_rr_list_new(); + + if (!cat) { + return NULL; + } + + /* left */ + for(i = 0; i < l_rr_count; i++) { + ldns_rr_list_push_rr(cat, + ldns_rr_clone(ldns_rr_list_rr(left, i))); + } + /* right */ + for(i = 0; i < r_rr_count; i++) { + ldns_rr_list_push_rr(cat, + ldns_rr_clone(ldns_rr_list_rr(right, i))); + } + return cat; +} + +ldns_rr_list * +ldns_rr_list_subtype_by_rdf(ldns_rr_list *l, ldns_rdf *r, size_t pos) +{ + size_t i; + ldns_rr_list *subtyped; + ldns_rdf *list_rdf; + + subtyped = ldns_rr_list_new(); + + for(i = 0; i < ldns_rr_list_rr_count(l); i++) { + list_rdf = ldns_rr_rdf( + ldns_rr_list_rr(l, i), + pos); + if (!list_rdf) { + /* pos is too large or any other error */ + ldns_rr_list_deep_free(subtyped); + return NULL; + } + + if (ldns_rdf_compare(list_rdf, r) == 0) { + /* a match */ + ldns_rr_list_push_rr(subtyped, + ldns_rr_clone(ldns_rr_list_rr(l, i))); + } + } + + if (ldns_rr_list_rr_count(subtyped) > 0) { + return subtyped; + } else { + ldns_rr_list_free(subtyped); + return NULL; + } +} + +bool +ldns_rr_list_push_rr(ldns_rr_list *rr_list, const ldns_rr *rr) +{ + size_t rr_count; + size_t cap; + + rr_count = ldns_rr_list_rr_count(rr_list); + cap = rr_list->_rr_capacity; + + /* grow the array */ + if(rr_count+1 > cap) { + ldns_rr **rrs; + + if(cap == 0) + cap = LDNS_RRLIST_INIT; /* initial list size */ + else cap *= 2; + rrs = LDNS_XREALLOC(rr_list->_rrs, ldns_rr *, cap); + if (!rrs) { + return false; + } + rr_list->_rrs = rrs; + rr_list->_rr_capacity = cap; + } + + /* add the new member */ + rr_list->_rrs[rr_count] = (ldns_rr*)rr; + + ldns_rr_list_set_rr_count(rr_list, rr_count + 1); + return true; +} + +bool +ldns_rr_list_push_rr_list(ldns_rr_list *rr_list, const ldns_rr_list *push_list) +{ + size_t i; + + for(i = 0; i < ldns_rr_list_rr_count(push_list); i++) { + if (!ldns_rr_list_push_rr(rr_list, + ldns_rr_list_rr(push_list, i))) { + return false; + } + } + return true; +} + +ldns_rr * +ldns_rr_list_pop_rr(ldns_rr_list *rr_list) +{ + size_t rr_count; + size_t cap; + ldns_rr *pop; + + rr_count = ldns_rr_list_rr_count(rr_list); + + if (rr_count == 0) { + return NULL; + } + + cap = rr_list->_rr_capacity; + pop = ldns_rr_list_rr(rr_list, rr_count - 1); + + /* shrink the array */ + if(cap > LDNS_RRLIST_INIT && rr_count-1 <= cap/2) { + ldns_rr** a; + cap /= 2; + a = LDNS_XREALLOC(rr_list->_rrs, ldns_rr *, cap); + if(a) { + rr_list->_rrs = a; + rr_list->_rr_capacity = cap; + } + } + + ldns_rr_list_set_rr_count(rr_list, rr_count - 1); + + return pop; +} + +ldns_rr_list * +ldns_rr_list_pop_rr_list(ldns_rr_list *rr_list, size_t howmany) +{ + /* pop a number of rr's and put them in a rr_list */ + ldns_rr_list *popped; + ldns_rr *p; + size_t i = howmany; + + popped = ldns_rr_list_new(); + + if (!popped) { + return NULL; + } + + + while(i > 0 && + (p = ldns_rr_list_pop_rr(rr_list)) != NULL) { + ldns_rr_list_push_rr(popped, p); + i--; + } + + if (i == howmany) { + return NULL; + } else { + return popped; + } +} + + +bool +ldns_rr_list_contains_rr(const ldns_rr_list *rr_list, ldns_rr *rr) +{ + size_t i; + + if (!rr_list || !rr || ldns_rr_list_rr_count(rr_list) == 0) { + return false; + } + + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + if (rr == ldns_rr_list_rr(rr_list, i)) { + return true; + } else if (ldns_rr_compare(rr, ldns_rr_list_rr(rr_list, i)) == 0) { + return true; + } + } + return false; +} + +bool +ldns_is_rrset(ldns_rr_list *rr_list) +{ + ldns_rr_type t; + ldns_rr_class c; + ldns_rdf *o; + ldns_rr *tmp; + size_t i; + + if (!rr_list || ldns_rr_list_rr_count(rr_list) == 0) { + return false; + } + + tmp = ldns_rr_list_rr(rr_list, 0); + + t = ldns_rr_get_type(tmp); + c = ldns_rr_get_class(tmp); + o = ldns_rr_owner(tmp); + + /* compare these with the rest of the rr_list, start with 1 */ + for (i = 1; i < ldns_rr_list_rr_count(rr_list); i++) { + tmp = ldns_rr_list_rr(rr_list, i); + if (t != ldns_rr_get_type(tmp)) { + return false; + } + if (c != ldns_rr_get_class(tmp)) { + return false; + } + if (ldns_rdf_compare(o, ldns_rr_owner(tmp)) != 0) { + return false; + } + } + return true; +} + +bool +ldns_rr_set_push_rr(ldns_rr_list *rr_list, ldns_rr *rr) +{ + size_t rr_count; + size_t i; + ldns_rr *last; + + assert(rr != NULL); + + rr_count = ldns_rr_list_rr_count(rr_list); + + if (rr_count == 0) { + /* nothing there, so checking it is + * not needed */ + return ldns_rr_list_push_rr(rr_list, rr); + } else { + /* check with the final rr in the rr_list */ + last = ldns_rr_list_rr(rr_list, rr_count - 1); + + if (ldns_rr_get_class(last) != ldns_rr_get_class(rr)) { + return false; + } + if (ldns_rr_get_type(last) != ldns_rr_get_type(rr)) { + return false; + } + /* only check if not equal to RRSIG */ + if (ldns_rr_get_type(rr) != LDNS_RR_TYPE_RRSIG) { + if (ldns_rr_ttl(last) != ldns_rr_ttl(rr)) { + return false; + } + } + if (ldns_rdf_compare(ldns_rr_owner(last), + ldns_rr_owner(rr)) != 0) { + return false; + } + /* ok, still alive - check if the rr already + * exists - if so, dont' add it */ + for(i = 0; i < rr_count; i++) { + if(ldns_rr_compare( + ldns_rr_list_rr(rr_list, i), rr) == 0) { + return false; + } + } + /* it's safe, push it */ + return ldns_rr_list_push_rr(rr_list, rr); + } +} + +ldns_rr * +ldns_rr_set_pop_rr(ldns_rr_list *rr_list) +{ + return ldns_rr_list_pop_rr(rr_list); +} + +ldns_rr_list * +ldns_rr_list_pop_rrset(ldns_rr_list *rr_list) +{ + ldns_rr_list *rrset; + ldns_rr *last_rr = NULL; + ldns_rr *next_rr; + + if (!rr_list) { + return NULL; + } + + rrset = ldns_rr_list_new(); + if (!last_rr) { + last_rr = ldns_rr_list_pop_rr(rr_list); + if (!last_rr) { + ldns_rr_list_free(rrset); + return NULL; + } else { + ldns_rr_list_push_rr(rrset, last_rr); + } + } + + if (ldns_rr_list_rr_count(rr_list) > 0) { + next_rr = ldns_rr_list_rr(rr_list, ldns_rr_list_rr_count(rr_list) - 1); + } else { + next_rr = NULL; + } + + while (next_rr) { + if ( + ldns_rdf_compare(ldns_rr_owner(next_rr), + ldns_rr_owner(last_rr)) == 0 + && + ldns_rr_get_type(next_rr) == ldns_rr_get_type(last_rr) + && + ldns_rr_get_class(next_rr) == ldns_rr_get_class(last_rr) + ) { + ldns_rr_list_push_rr(rrset, ldns_rr_list_pop_rr(rr_list)); + if (ldns_rr_list_rr_count(rr_list) > 0) { + last_rr = next_rr; + next_rr = ldns_rr_list_rr(rr_list, ldns_rr_list_rr_count(rr_list) - 1); + } else { + next_rr = NULL; + } + } else { + next_rr = NULL; + } + } + + return rrset; +} + +ldns_rr * +ldns_rr_clone(const ldns_rr *rr) +{ + size_t i; + ldns_rr *new_rr; + + if (!rr) { + return NULL; + } + + new_rr = ldns_rr_new(); + if (!new_rr) { + return NULL; + } + if (ldns_rr_owner(rr)) { + ldns_rr_set_owner(new_rr, ldns_rdf_clone(ldns_rr_owner(rr))); + } + ldns_rr_set_ttl(new_rr, ldns_rr_ttl(rr)); + ldns_rr_set_type(new_rr, ldns_rr_get_type(rr)); + ldns_rr_set_class(new_rr, ldns_rr_get_class(rr)); + ldns_rr_set_question(new_rr, ldns_rr_is_question(rr)); + + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + if (ldns_rr_rdf(rr,i)) { + ldns_rr_push_rdf(new_rr, ldns_rdf_clone(ldns_rr_rdf(rr, i))); + } + } + + return new_rr; +} + +ldns_rr_list * +ldns_rr_list_clone(const ldns_rr_list *rrlist) +{ + size_t i; + ldns_rr_list *new_list; + ldns_rr *r; + + if (!rrlist) { + return NULL; + } + + new_list = ldns_rr_list_new(); + if (!new_list) { + return NULL; + } + for (i = 0; i < ldns_rr_list_rr_count(rrlist); i++) { + r = ldns_rr_clone( + ldns_rr_list_rr(rrlist, i) + ); + if (!r) { + /* huh, failure in cloning */ + ldns_rr_list_deep_free(new_list); + return NULL; + } + ldns_rr_list_push_rr(new_list, r); + } + return new_list; +} + + +int +qsort_rr_compare(const void *a, const void *b) +{ + const ldns_rr *rr1 = * (const ldns_rr **) a; + const ldns_rr *rr2 = * (const ldns_rr **) b; + + if (rr1 == NULL && rr2 == NULL) { + return 0; + } + if (rr1 == NULL) { + return -1; + } + if (rr2 == NULL) { + return 1; + } + return ldns_rr_compare(rr1, rr2); +} + +int +qsort_schwartz_rr_compare(const void *a, const void *b) +{ + int result = 0; + ldns_rr *rr1, *rr2; + ldns_buffer *rr1_buf, *rr2_buf; + struct ldns_schwartzian_compare_struct *sa = *(struct ldns_schwartzian_compare_struct **) a; + struct ldns_schwartzian_compare_struct *sb = *(struct ldns_schwartzian_compare_struct **) b; + /* if we are doing 2wire, we need to do lowercasing on the dname (and maybe on the rdata) + * this must be done for comparison only, so we need to have a temp var for both buffers, + * which is only used when the transformed object value isn't there yet + */ + ldns_rr *canonical_a, *canonical_b; + + rr1 = (ldns_rr *) sa->original_object; + rr2 = (ldns_rr *) sb->original_object; + + result = ldns_rr_compare_no_rdata(rr1, rr2); + + if (result == 0) { + if (!sa->transformed_object) { + canonical_a = ldns_rr_clone(sa->original_object); + ldns_rr2canonical(canonical_a); + sa->transformed_object = ldns_buffer_new(ldns_rr_uncompressed_size(canonical_a)); + if (ldns_rr2buffer_wire(sa->transformed_object, canonical_a, LDNS_SECTION_ANY) != LDNS_STATUS_OK) { + ldns_buffer_free((ldns_buffer *)sa->transformed_object); + sa->transformed_object = NULL; + ldns_rr_free(canonical_a); + return 0; + } + ldns_rr_free(canonical_a); + } + if (!sb->transformed_object) { + canonical_b = ldns_rr_clone(sb->original_object); + ldns_rr2canonical(canonical_b); + sb->transformed_object = ldns_buffer_new(ldns_rr_uncompressed_size(canonical_b)); + if (ldns_rr2buffer_wire(sb->transformed_object, canonical_b, LDNS_SECTION_ANY) != LDNS_STATUS_OK) { + ldns_buffer_free((ldns_buffer *)sa->transformed_object); + ldns_buffer_free((ldns_buffer *)sb->transformed_object); + sa->transformed_object = NULL; + sb->transformed_object = NULL; + ldns_rr_free(canonical_b); + return 0; + } + ldns_rr_free(canonical_b); + } + rr1_buf = (ldns_buffer *) sa->transformed_object; + rr2_buf = (ldns_buffer *) sb->transformed_object; + + result = ldns_rr_compare_wire(rr1_buf, rr2_buf); + } + + return result; +} + +void +ldns_rr_list_sort(ldns_rr_list *unsorted) +{ + struct ldns_schwartzian_compare_struct **sortables; + size_t item_count; + size_t i; + + if (unsorted) { + item_count = ldns_rr_list_rr_count(unsorted); + + sortables = LDNS_XMALLOC(struct ldns_schwartzian_compare_struct *, + item_count); + if(!sortables) return; /* no way to return error */ + for (i = 0; i < item_count; i++) { + sortables[i] = LDNS_XMALLOC(struct ldns_schwartzian_compare_struct, 1); + if(!sortables[i]) { + /* free the allocated parts */ + while(i>0) { + i--; + LDNS_FREE(sortables[i]); + } + /* no way to return error */ + return; + } + sortables[i]->original_object = ldns_rr_list_rr(unsorted, i); + sortables[i]->transformed_object = NULL; + } + qsort(sortables, + item_count, + sizeof(struct ldns_schwartzian_compare_struct *), + qsort_schwartz_rr_compare); + for (i = 0; i < item_count; i++) { + unsorted->_rrs[i] = sortables[i]->original_object; + if (sortables[i]->transformed_object) { + ldns_buffer_free(sortables[i]->transformed_object); + } + LDNS_FREE(sortables[i]); + } + LDNS_FREE(sortables); + } +} + +int +ldns_rr_compare_no_rdata(const ldns_rr *rr1, const ldns_rr *rr2) +{ + size_t rr1_len; + size_t rr2_len; + size_t offset; + + assert(rr1 != NULL); + assert(rr2 != NULL); + + rr1_len = ldns_rr_uncompressed_size(rr1); + rr2_len = ldns_rr_uncompressed_size(rr2); + + if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) < 0) { + return -1; + } else if (ldns_dname_compare(ldns_rr_owner(rr1), ldns_rr_owner(rr2)) > 0) { + return 1; + } + + /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */ + if (ldns_rr_get_class(rr1) != ldns_rr_get_class(rr2)) { + return ldns_rr_get_class(rr1) - ldns_rr_get_class(rr2); + } + + /* should return -1 if rr1 comes before rr2, so need to do rr1 - rr2, not rr2 - rr1 */ + if (ldns_rr_get_type(rr1) != ldns_rr_get_type(rr2)) { + return ldns_rr_get_type(rr1) - ldns_rr_get_type(rr2); + } + + /* offset is the owername length + ttl + type + class + rdlen == start of wire format rdata */ + offset = ldns_rdf_size(ldns_rr_owner(rr1)) + 4 + 2 + 2 + 2; + /* if either record doesn't have any RDATA... */ + if (offset > rr1_len || offset > rr2_len) { + if (rr1_len == rr2_len) { + return 0; + } + return ((int) rr2_len - (int) rr1_len); + } + + return 0; +} + +int ldns_rr_compare_wire(ldns_buffer *rr1_buf, ldns_buffer *rr2_buf) +{ + size_t rr1_len, rr2_len, min_len, i, offset; + + rr1_len = ldns_buffer_capacity(rr1_buf); + rr2_len = ldns_buffer_capacity(rr2_buf); + + /* jump past dname (checked in earlier part) + * and especially past TTL */ + offset = 0; + while (offset < rr1_len && *ldns_buffer_at(rr1_buf, offset) != 0) { + offset += *ldns_buffer_at(rr1_buf, offset) + 1; + } + /* jump to rdata section (PAST the rdata length field, otherwise + rrs with different lengths might be sorted erroneously */ + offset += 11; + min_len = (rr1_len < rr2_len) ? rr1_len : rr2_len; + /* Compare RRs RDATA byte for byte. */ + for(i = offset; i < min_len; i++) { + if (*ldns_buffer_at(rr1_buf,i) < *ldns_buffer_at(rr2_buf,i)) { + return -1; + } else if (*ldns_buffer_at(rr1_buf,i) > *ldns_buffer_at(rr2_buf,i)) { + return +1; + } + } + + /* If both RDATAs are the same up to min_len, then the shorter one sorts first. */ + if (rr1_len < rr2_len) { + return -1; + } else if (rr1_len > rr2_len) { + return +1; + } + /* The RDATAs are equal. */ + return 0; + +} + +int +ldns_rr_compare(const ldns_rr *rr1, const ldns_rr *rr2) +{ + int result; + size_t rr1_len, rr2_len; + + ldns_buffer *rr1_buf; + ldns_buffer *rr2_buf; + + result = ldns_rr_compare_no_rdata(rr1, rr2); + if (result == 0) { + rr1_len = ldns_rr_uncompressed_size(rr1); + rr2_len = ldns_rr_uncompressed_size(rr2); + + rr1_buf = ldns_buffer_new(rr1_len); + rr2_buf = ldns_buffer_new(rr2_len); + + if (ldns_rr2buffer_wire_canonical(rr1_buf, + rr1, + LDNS_SECTION_ANY) + != LDNS_STATUS_OK) { + ldns_buffer_free(rr1_buf); + ldns_buffer_free(rr2_buf); + return 0; + } + if (ldns_rr2buffer_wire_canonical(rr2_buf, + rr2, + LDNS_SECTION_ANY) + != LDNS_STATUS_OK) { + ldns_buffer_free(rr1_buf); + ldns_buffer_free(rr2_buf); + return 0; + } + + result = ldns_rr_compare_wire(rr1_buf, rr2_buf); + + ldns_buffer_free(rr1_buf); + ldns_buffer_free(rr2_buf); + } + + return result; +} + +/* convert dnskey to a ds with the given algorithm, + * then compare the result with the given ds */ +static int +ldns_rr_compare_ds_dnskey(ldns_rr *ds, + ldns_rr *dnskey) +{ + ldns_rr *ds_gen; + bool result = false; + ldns_hash algo; + + if (!dnskey || !ds || + ldns_rr_get_type(ds) != LDNS_RR_TYPE_DS || + ldns_rr_get_type(dnskey) != LDNS_RR_TYPE_DNSKEY) { + return false; + } + +algo = ldns_rdf2native_int8(ldns_rr_rdf(ds, 2)); + + ds_gen = ldns_key_rr2ds(dnskey, algo); + if (ds_gen) { + result = ldns_rr_compare(ds, ds_gen) == 0; + ldns_rr_free(ds_gen); + } + return result; +} + +bool +ldns_rr_compare_ds(const ldns_rr *orr1, const ldns_rr *orr2) +{ + bool result; + ldns_rr *rr1 = ldns_rr_clone(orr1); + ldns_rr *rr2 = ldns_rr_clone(orr2); + + /* set ttls to zero */ + ldns_rr_set_ttl(rr1, 0); + ldns_rr_set_ttl(rr2, 0); + + if (ldns_rr_get_type(rr1) == LDNS_RR_TYPE_DS && + ldns_rr_get_type(rr2) == LDNS_RR_TYPE_DNSKEY) { + result = ldns_rr_compare_ds_dnskey(rr1, rr2); + } else if (ldns_rr_get_type(rr1) == LDNS_RR_TYPE_DNSKEY && + ldns_rr_get_type(rr2) == LDNS_RR_TYPE_DS) { + result = ldns_rr_compare_ds_dnskey(rr2, rr1); + } else { + result = (ldns_rr_compare(rr1, rr2) == 0); + } + + ldns_rr_free(rr1); + ldns_rr_free(rr2); + + return result; +} + +int +ldns_rr_list_compare(const ldns_rr_list *rrl1, const ldns_rr_list *rrl2) +{ + size_t i = 0; + int rr_cmp; + + assert(rrl1 != NULL); + assert(rrl2 != NULL); + + for (i = 0; i < ldns_rr_list_rr_count(rrl1) && i < ldns_rr_list_rr_count(rrl2); i++) { + rr_cmp = ldns_rr_compare(ldns_rr_list_rr(rrl1, i), ldns_rr_list_rr(rrl2, i)); + if (rr_cmp != 0) { + return rr_cmp; + } + } + + if (i == ldns_rr_list_rr_count(rrl1) && + i != ldns_rr_list_rr_count(rrl2)) { + return 1; + } else if (i == ldns_rr_list_rr_count(rrl2) && + i != ldns_rr_list_rr_count(rrl1)) { + return -1; + } else { + return 0; + } +} + +size_t +ldns_rr_uncompressed_size(const ldns_rr *r) +{ + size_t rrsize; + size_t i; + + rrsize = 0; + /* add all the rdf sizes */ + for(i = 0; i < ldns_rr_rd_count(r); i++) { + rrsize += ldns_rdf_size(ldns_rr_rdf(r, i)); + } + /* ownername */ + rrsize += ldns_rdf_size(ldns_rr_owner(r)); + rrsize += LDNS_RR_OVERHEAD; + return rrsize; +} + +void +ldns_rr2canonical(ldns_rr *rr) +{ + uint16_t i; + + if (!rr) { + return; + } + + ldns_dname2canonical(ldns_rr_owner(rr)); + + /* + * lowercase the rdata dnames if the rr type is one + * of the list in chapter 7 of RFC3597 + */ + switch(ldns_rr_get_type(rr)) { + case LDNS_RR_TYPE_NS: + case LDNS_RR_TYPE_MD: + case LDNS_RR_TYPE_MF: + case LDNS_RR_TYPE_CNAME: + case LDNS_RR_TYPE_SOA: + case LDNS_RR_TYPE_MB: + case LDNS_RR_TYPE_MG: + case LDNS_RR_TYPE_MR: + case LDNS_RR_TYPE_PTR: + case LDNS_RR_TYPE_HINFO: + case LDNS_RR_TYPE_MINFO: + case LDNS_RR_TYPE_MX: + case LDNS_RR_TYPE_RP: + case LDNS_RR_TYPE_AFSDB: + case LDNS_RR_TYPE_RT: + case LDNS_RR_TYPE_SIG: + case LDNS_RR_TYPE_PX: + case LDNS_RR_TYPE_NXT: + case LDNS_RR_TYPE_NAPTR: + case LDNS_RR_TYPE_KX: + case LDNS_RR_TYPE_SRV: + case LDNS_RR_TYPE_DNAME: + case LDNS_RR_TYPE_A6: + for (i = 0; i < ldns_rr_rd_count(rr); i++) { + ldns_dname2canonical(ldns_rr_rdf(rr, i)); + } + return; + default: + /* do nothing */ + return; + } +} + +void +ldns_rr_list2canonical(ldns_rr_list *rr_list) +{ + size_t i; + for (i = 0; i < ldns_rr_list_rr_count(rr_list); i++) { + ldns_rr2canonical(ldns_rr_list_rr(rr_list, i)); + } +} + +uint8_t +ldns_rr_label_count(ldns_rr *rr) +{ + if (!rr) { + return 0; + } + return ldns_dname_label_count( + ldns_rr_owner(rr)); +} + +/** \cond */ +static const ldns_rdf_type type_0_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; +static const ldns_rdf_type type_a_wireformat[] = { LDNS_RDF_TYPE_A }; +static const ldns_rdf_type type_ns_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_md_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_mf_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_cname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_soa_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, LDNS_RDF_TYPE_PERIOD, + LDNS_RDF_TYPE_PERIOD +}; +static const ldns_rdf_type type_mb_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_mg_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_mr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_wks_wireformat[] = { + LDNS_RDF_TYPE_A, LDNS_RDF_TYPE_WKS +}; +static const ldns_rdf_type type_ptr_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_hinfo_wireformat[] = { + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_minfo_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_mx_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_rp_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_afsdb_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_x25_wireformat[] = { LDNS_RDF_TYPE_STR }; +static const ldns_rdf_type type_isdn_wireformat[] = { + LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_rt_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_nsap_wireformat[] = { + LDNS_RDF_TYPE_NSAP +}; +static const ldns_rdf_type type_nsap_ptr_wireformat[] = { + LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_sig_wireformat[] = { + LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_key_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_px_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_gpos_wireformat[] = { + LDNS_RDF_TYPE_STR, + LDNS_RDF_TYPE_STR, + LDNS_RDF_TYPE_STR +}; +static const ldns_rdf_type type_aaaa_wireformat[] = { LDNS_RDF_TYPE_AAAA }; +static const ldns_rdf_type type_loc_wireformat[] = { LDNS_RDF_TYPE_LOC }; +static const ldns_rdf_type type_nxt_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_UNKNOWN +}; +static const ldns_rdf_type type_eid_wireformat[] = { + LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_nimloc_wireformat[] = { + LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_srv_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_atma_wireformat[] = { + LDNS_RDF_TYPE_ATMA +}; +static const ldns_rdf_type type_naptr_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_STR, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_kx_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME +}; +static const ldns_rdf_type type_cert_wireformat[] = { + LDNS_RDF_TYPE_CERT_ALG, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_a6_wireformat[] = { LDNS_RDF_TYPE_UNKNOWN }; +static const ldns_rdf_type type_dname_wireformat[] = { LDNS_RDF_TYPE_DNAME }; +static const ldns_rdf_type type_sink_wireformat[] = { LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_apl_wireformat[] = { + LDNS_RDF_TYPE_APL +}; +static const ldns_rdf_type type_ds_wireformat[] = { + LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_sshfp_wireformat[] = { + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_HEX +}; +static const ldns_rdf_type type_ipseckey_wireformat[] = { + LDNS_RDF_TYPE_IPSECKEY +}; +static const ldns_rdf_type type_rrsig_wireformat[] = { + LDNS_RDF_TYPE_TYPE, LDNS_RDF_TYPE_ALG, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT32, + LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_TIME, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_nsec_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_NSEC +}; +static const ldns_rdf_type type_dhcid_wireformat[] = { + LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_talink_wireformat[] = { + LDNS_RDF_TYPE_DNAME, LDNS_RDF_TYPE_DNAME +}; +/* nsec3 is some vars, followed by same type of data of nsec */ +static const ldns_rdf_type type_nsec3_wireformat[] = { +/* LDNS_RDF_TYPE_NSEC3_VARS, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC*/ + LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT8, LDNS_RDF_TYPE_INT16, LDNS_RDF_TYPE_NSEC3_SALT, LDNS_RDF_TYPE_NSEC3_NEXT_OWNER, LDNS_RDF_TYPE_NSEC +}; + +static const ldns_rdf_type type_nsec3params_wireformat[] = { +/* LDNS_RDF_TYPE_NSEC3_PARAMS_VARS*/ + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_NSEC3_SALT +}; + +static const ldns_rdf_type type_dnskey_wireformat[] = { + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT8, + LDNS_RDF_TYPE_ALG, + LDNS_RDF_TYPE_B64 +}; +static const ldns_rdf_type type_tsig_wireformat[] = { + LDNS_RDF_TYPE_DNAME, + LDNS_RDF_TYPE_TSIGTIME, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16, + LDNS_RDF_TYPE_INT16_DATA +}; +/** \endcond */ + +/** \cond */ +/* All RR's defined in 1035 are well known and can thus + * be compressed. See RFC3597. These RR's are: + * CNAME HINFO MB MD MF MG MINFO MR MX NULL NS PTR SOA TXT + */ +static ldns_rr_descriptor rdata_field_descriptors[] = { + /* 0 */ + { 0, NULL, 0, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 1 */ + {LDNS_RR_TYPE_A, "A", 1, 1, type_a_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 2 */ + {LDNS_RR_TYPE_NS, "NS", 1, 1, type_ns_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 3 */ + {LDNS_RR_TYPE_MD, "MD", 1, 1, type_md_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 4 */ + {LDNS_RR_TYPE_MF, "MF", 1, 1, type_mf_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 5 */ + {LDNS_RR_TYPE_CNAME, "CNAME", 1, 1, type_cname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 6 */ + {LDNS_RR_TYPE_SOA, "SOA", 7, 7, type_soa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, + /* 7 */ + {LDNS_RR_TYPE_MB, "MB", 1, 1, type_mb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 8 */ + {LDNS_RR_TYPE_MG, "MG", 1, 1, type_mg_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 9 */ + {LDNS_RR_TYPE_MR, "MR", 1, 1, type_mr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 10 */ + {LDNS_RR_TYPE_NULL, "NULL", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 11 */ + {LDNS_RR_TYPE_WKS, "WKS", 2, 2, type_wks_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 12 */ + {LDNS_RR_TYPE_PTR, "PTR", 1, 1, type_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 13 */ + {LDNS_RR_TYPE_HINFO, "HINFO", 2, 2, type_hinfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 14 */ + {LDNS_RR_TYPE_MINFO, "MINFO", 2, 2, type_minfo_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 2 }, + /* 15 */ + {LDNS_RR_TYPE_MX, "MX", 2, 2, type_mx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_COMPRESS, 1 }, + /* 16 */ + {LDNS_RR_TYPE_TXT, "TXT", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, + /* 17 */ + {LDNS_RR_TYPE_RP, "RP", 2, 2, type_rp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + /* 18 */ + {LDNS_RR_TYPE_AFSDB, "AFSDB", 2, 2, type_afsdb_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 19 */ + {LDNS_RR_TYPE_X25, "X25", 1, 1, type_x25_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 20 */ + {LDNS_RR_TYPE_ISDN, "ISDN", 1, 2, type_isdn_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 21 */ + {LDNS_RR_TYPE_RT, "RT", 2, 2, type_rt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 22 */ + {LDNS_RR_TYPE_NSAP, "NSAP", 1, 1, type_nsap_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 23 */ + {LDNS_RR_TYPE_NSAP_PTR, "NSAP-PTR", 1, 1, type_nsap_ptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 24 */ + {LDNS_RR_TYPE_SIG, "SIG", 9, 9, type_sig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 25 */ + {LDNS_RR_TYPE_KEY, "KEY", 4, 4, type_key_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 26 */ + {LDNS_RR_TYPE_PX, "PX", 3, 3, type_px_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, + /* 27 */ + {LDNS_RR_TYPE_GPOS, "GPOS", 1, 1, type_gpos_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 28 */ + {LDNS_RR_TYPE_AAAA, "AAAA", 1, 1, type_aaaa_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 29 */ + {LDNS_RR_TYPE_LOC, "LOC", 1, 1, type_loc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 30 */ + {LDNS_RR_TYPE_NXT, "NXT", 2, 2, type_nxt_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 31 */ + {LDNS_RR_TYPE_EID, "EID", 1, 1, type_eid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 32 */ + {LDNS_RR_TYPE_NIMLOC, "NIMLOC", 1, 1, type_nimloc_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 33 */ + {LDNS_RR_TYPE_SRV, "SRV", 4, 4, type_srv_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 34 */ + {LDNS_RR_TYPE_ATMA, "ATMA", 1, 1, type_atma_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 35 */ + {LDNS_RR_TYPE_NAPTR, "NAPTR", 6, 6, type_naptr_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 36 */ + {LDNS_RR_TYPE_KX, "KX", 2, 2, type_kx_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 37 */ + {LDNS_RR_TYPE_CERT, "CERT", 4, 4, type_cert_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 38 */ + {LDNS_RR_TYPE_A6, "A6", 1, 1, type_a6_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 39 */ + {LDNS_RR_TYPE_DNAME, "DNAME", 1, 1, type_dname_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 40 */ + {LDNS_RR_TYPE_SINK, "SINK", 1, 1, type_sink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 41 */ + {LDNS_RR_TYPE_OPT, "OPT", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 42 */ + {LDNS_RR_TYPE_APL, "APL", 0, 0, type_apl_wireformat, LDNS_RDF_TYPE_APL, LDNS_RR_NO_COMPRESS, 0 }, + /* 43 */ + {LDNS_RR_TYPE_DS, "DS", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 44 */ + {LDNS_RR_TYPE_SSHFP, "SSHFP", 3, 3, type_sshfp_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 45 */ + {LDNS_RR_TYPE_IPSECKEY, "IPSECKEY", 1, 1, type_ipseckey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 46 */ + {LDNS_RR_TYPE_RRSIG, "RRSIG", 9, 9, type_rrsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 1 }, + /* 47 */ + {LDNS_RR_TYPE_NSEC, "NSEC", 1, 2, type_nsec_wireformat, LDNS_RDF_TYPE_NSEC, LDNS_RR_NO_COMPRESS, 1 }, + /* 48 */ + {LDNS_RR_TYPE_DNSKEY, "DNSKEY", 4, 4, type_dnskey_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 49 */ +{LDNS_RR_TYPE_DHCID, "DHCID", 1, 1, type_dhcid_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 50 */ + {LDNS_RR_TYPE_NSEC3, "NSEC3", 5, 6, type_nsec3_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 51 */ +{LDNS_RR_TYPE_NSEC3PARAMS, "NSEC3PARAM", 4, 4, type_nsec3params_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, + /* 52 */ +{LDNS_RR_TYPE_NULL, "TYPE52", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE53", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE54", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE55", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE56", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE57", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_TALINK, "TALINK", 2, 2, type_talink_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 2 }, +{LDNS_RR_TYPE_NULL, "TYPE59", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE60", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE61", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE62", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE63", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE64", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE65", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE66", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE67", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE68", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE69", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE70", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE71", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE72", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE73", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE74", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE75", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE76", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE77", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE78", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE79", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE80", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE81", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE82", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE83", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE84", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE85", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE86", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE87", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE88", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE89", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE90", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE91", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE92", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE93", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE94", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE95", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE96", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE97", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE98", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_SPF, "SPF", 1, 0, NULL, LDNS_RDF_TYPE_STR, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE100", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE101", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE102", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE103", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE104", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE105", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE106", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE107", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE108", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE109", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE110", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE111", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE112", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE113", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE114", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE115", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE116", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE117", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE118", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE119", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE120", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE121", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE122", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE123", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE124", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE125", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE126", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE127", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE128", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE129", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE130", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE131", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE132", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE133", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE134", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE135", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE136", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE137", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE138", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE139", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE140", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE141", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE142", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE143", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE144", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE145", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE146", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE147", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE148", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE149", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE150", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE151", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE152", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE153", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE154", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE155", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE156", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE157", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE158", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE159", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE160", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE161", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE162", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE163", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE164", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE165", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE166", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE167", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE168", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE169", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE170", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE171", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE172", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE173", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE174", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE175", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE176", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE177", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE178", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE179", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE180", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE181", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE182", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE183", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE184", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE185", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE186", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE187", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE188", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE189", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE190", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE191", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE192", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE193", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE194", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE195", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE196", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE197", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE198", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE199", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE200", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE201", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE202", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE203", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE204", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE205", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE206", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE207", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE208", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE209", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE210", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE211", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE212", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE213", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE214", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE215", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE216", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE217", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE218", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE219", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE220", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE221", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE222", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE223", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE224", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE225", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE226", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE227", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE228", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE229", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE230", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE231", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE232", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE233", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE234", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE235", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE236", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE237", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE238", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE239", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE240", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE241", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE242", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE243", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE244", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE245", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE246", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE247", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE248", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_NULL, "TYPE249", 1, 1, type_0_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +{LDNS_RR_TYPE_TSIG, "TSIG", 8, 9, type_tsig_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 }, +/* split in array, no longer contiguous */ +{LDNS_RR_TYPE_DLV, "DLV", 4, 4, type_ds_wireformat, LDNS_RDF_TYPE_NONE, LDNS_RR_NO_COMPRESS, 0 } +}; +/** \endcond */ + +/** + * \def LDNS_RDATA_FIELD_DESCRIPTORS_COUNT + * computes the number of rdata fields + */ +#define LDNS_RDATA_FIELD_DESCRIPTORS_COUNT \ + (sizeof(rdata_field_descriptors)/sizeof(rdata_field_descriptors[0])) + +const ldns_rr_descriptor * +ldns_rr_descript(uint16_t type) +{ + size_t i; + if (type <= LDNS_RDATA_FIELD_DESCRIPTORS_COMMON) { + return &rdata_field_descriptors[type]; + } else { + /* because not all array index equals type code */ + for (i = LDNS_RDATA_FIELD_DESCRIPTORS_COMMON; + i < LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; + i++) { + if (rdata_field_descriptors[i]._type == type) { + return &rdata_field_descriptors[i]; + } + } + return &rdata_field_descriptors[0]; + } +} + +size_t +ldns_rr_descriptor_minimum(const ldns_rr_descriptor *descriptor) +{ + if (descriptor) { + return descriptor->_minimum; + } else { + return 0; + } +} + +size_t +ldns_rr_descriptor_maximum(const ldns_rr_descriptor *descriptor) +{ + if (descriptor) { + if (descriptor->_variable != LDNS_RDF_TYPE_NONE) { + /* Should really be SIZE_MAX... bad FreeBSD. */ + return UINT_MAX; + } else { + return descriptor->_maximum; + } + } else { + return 0; + } +} + +ldns_rdf_type +ldns_rr_descriptor_field_type(const ldns_rr_descriptor *descriptor, + size_t index) +{ + assert(descriptor != NULL); + assert(index < descriptor->_maximum + || descriptor->_variable != LDNS_RDF_TYPE_NONE); + if (index < descriptor->_maximum) { + return descriptor->_wireformat[index]; + } else { + return descriptor->_variable; + } +} + +ldns_rr_type +ldns_get_rr_type_by_name(const char *name) +{ + unsigned int i; + const char *desc_name; + const ldns_rr_descriptor *desc; + + /* TYPEXX representation */ + if (strlen(name) > 4 && strncasecmp(name, "TYPE", 4) == 0) { + return atoi(name + 4); + } + + /* Normal types */ + for (i = 0; i < (unsigned int) LDNS_RDATA_FIELD_DESCRIPTORS_COUNT; i++) { + desc = &rdata_field_descriptors[i]; + desc_name = desc->_name; + if(desc_name && + strlen(name) == strlen(desc_name) && + strncasecmp(name, desc_name, strlen(desc_name)) == 0) { + /* because not all array index equals type code */ + return desc->_type; + } + } + + /* special cases for query types */ + if (strlen(name) == 4 && strncasecmp(name, "IXFR", 4) == 0) { + return 251; + } else if (strlen(name) == 4 && strncasecmp(name, "AXFR", 4) == 0) { + return 252; + } else if (strlen(name) == 5 && strncasecmp(name, "MAILB", 5) == 0) { + return 253; + } else if (strlen(name) == 5 && strncasecmp(name, "MAILA", 5) == 0) { + return 254; + } else if (strlen(name) == 3 && strncasecmp(name, "ANY", 3) == 0) { + return 255; + } + + return 0; +} + +ldns_rr_class +ldns_get_rr_class_by_name(const char *name) +{ + ldns_lookup_table *lt; + + /* CLASSXX representation */ + if (strlen(name) > 5 && strncasecmp(name, "CLASS", 5) == 0) { + return atoi(name + 5); + } + + /* Normal types */ + lt = ldns_lookup_by_name(ldns_rr_classes, name); + + if (lt) { + return lt->id; + } + return 0; +} + + +ldns_rr_type +ldns_rdf2rr_type(const ldns_rdf *rd) +{ + ldns_rr_type r; + + if (!rd) { + return 0; + } + + if (ldns_rdf_get_type(rd) != LDNS_RDF_TYPE_TYPE) { + return 0; + } + + r = (ldns_rr_type) ldns_rdf2native_int16(rd); + return r; +} + +ldns_rr_type +ldns_rr_list_type(const ldns_rr_list *rr_list) +{ + if (rr_list && ldns_rr_list_rr_count(rr_list) > 0) { + return ldns_rr_get_type(ldns_rr_list_rr(rr_list, 0)); + } else { + return 0; + } +} + +ldns_rdf * +ldns_rr_list_owner(const ldns_rr_list *rr_list) +{ + if (rr_list && ldns_rr_list_rr_count(rr_list) > 0) { + return ldns_rr_owner(ldns_rr_list_rr(rr_list, 0)); + } else { + return NULL; + } +} diff --git a/libs/ldns/rr_functions.c b/libs/ldns/rr_functions.c new file mode 100644 index 0000000000..700372b91c --- /dev/null +++ b/libs/ldns/rr_functions.c @@ -0,0 +1,341 @@ +/* + * rr_function.c + * + * function that operate on specific rr types + * + * (c) NLnet Labs, 2004-2006 + * See the file LICENSE for the license + */ + +/* + * These come strait from perldoc Net::DNS::RR::xxx + * first the read variant, then the write. This is + * not complete. + */ + +#include + +#include + +#include +#include + +/** + * return a specific rdf + * \param[in] type type of RR + * \param[in] rr the rr itself + * \param[in] pos at which postion to get it + * \return the rdf sought + */ +static ldns_rdf * +ldns_rr_function(ldns_rr_type type, const ldns_rr *rr, size_t pos) +{ + if (!rr || ldns_rr_get_type(rr) != type) { + return NULL; + } + return ldns_rr_rdf(rr, pos); +} + +/** + * set a specific rdf + * \param[in] type type of RR + * \param[in] rr the rr itself + * \param[in] rdf the rdf to set + * \param[in] pos at which postion to set it + * \return true or false + */ +static bool +ldns_rr_set_function(ldns_rr_type type, ldns_rr *rr, ldns_rdf *rdf, size_t pos) +{ + ldns_rdf *pop; + if (!rr || ldns_rr_get_type(rr) != type) { + return false; + } + pop = ldns_rr_set_rdf(rr, rdf, pos); + ldns_rdf_deep_free(pop); + return true; +} + +/* A/AAAA records */ +ldns_rdf * +ldns_rr_a_address(const ldns_rr *r) +{ + /* 2 types to check, cannot use the macro */ + if (!r || (ldns_rr_get_type(r) != LDNS_RR_TYPE_A && + ldns_rr_get_type(r) != LDNS_RR_TYPE_AAAA)) { + return NULL; + } + return ldns_rr_rdf(r, 0); +} + +bool +ldns_rr_a_set_address(ldns_rr *r, ldns_rdf *f) +{ + /* 2 types to check, cannot use the macro... */ + ldns_rdf *pop; + if (!r || (ldns_rr_get_type(r) != LDNS_RR_TYPE_A && + ldns_rr_get_type(r) != LDNS_RR_TYPE_AAAA)) { + return false; + } + pop = ldns_rr_set_rdf(r, f, 0); + if (pop) { + LDNS_FREE(pop); + return true; + } else { + return false; + } +} + +/* NS record */ +ldns_rdf * +ldns_rr_ns_nsdname(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_NS, r, 0); +} + +/* MX record */ +ldns_rdf * +ldns_rr_mx_preference(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_MX, r, 0); +} + +ldns_rdf * +ldns_rr_mx_exchange(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_MX, r, 1); +} + +/* RRSIG record */ +ldns_rdf * +ldns_rr_rrsig_typecovered(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 0); +} + +bool +ldns_rr_rrsig_set_typecovered(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 0); +} + +ldns_rdf * +ldns_rr_rrsig_algorithm(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 1); +} + +bool +ldns_rr_rrsig_set_algorithm(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 1); +} + +ldns_rdf * +ldns_rr_rrsig_labels(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 2); +} + +bool +ldns_rr_rrsig_set_labels(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 2); +} + +ldns_rdf * +ldns_rr_rrsig_origttl(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 3); +} + +bool +ldns_rr_rrsig_set_origttl(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 3); +} + +ldns_rdf * +ldns_rr_rrsig_expiration(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 4); +} + +bool +ldns_rr_rrsig_set_expiration(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 4); +} + +ldns_rdf * +ldns_rr_rrsig_inception(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 5); +} + +bool +ldns_rr_rrsig_set_inception(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 5); +} + +ldns_rdf * +ldns_rr_rrsig_keytag(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 6); +} + +bool +ldns_rr_rrsig_set_keytag(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 6); +} + +ldns_rdf * +ldns_rr_rrsig_signame(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 7); +} + +bool +ldns_rr_rrsig_set_signame(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 7); +} + +ldns_rdf * +ldns_rr_rrsig_sig(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_RRSIG, r, 8); +} + +bool +ldns_rr_rrsig_set_sig(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_RRSIG, r, f, 8); +} + +/* DNSKEY record */ +ldns_rdf * +ldns_rr_dnskey_flags(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 0); +} + +bool +ldns_rr_dnskey_set_flags(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 0); +} + +ldns_rdf * +ldns_rr_dnskey_protocol(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 1); +} + +bool +ldns_rr_dnskey_set_protocol(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 1); +} + +ldns_rdf * +ldns_rr_dnskey_algorithm(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 2); +} + +bool +ldns_rr_dnskey_set_algorithm(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 2); +} + +ldns_rdf * +ldns_rr_dnskey_key(const ldns_rr *r) +{ + return ldns_rr_function(LDNS_RR_TYPE_DNSKEY, r, 3); +} + +bool +ldns_rr_dnskey_set_key(ldns_rr *r, ldns_rdf *f) +{ + return ldns_rr_set_function(LDNS_RR_TYPE_DNSKEY, r, f, 3); +} + +size_t +ldns_rr_dnskey_key_size_raw(const unsigned char* keydata, + const size_t len, + const ldns_algorithm alg) +{ + /* for DSA keys */ + uint8_t t; + + /* for RSA keys */ + uint16_t exp; + uint16_t int16; + + switch ((ldns_signing_algorithm)alg) { + case LDNS_SIGN_DSA: + case LDNS_SIGN_DSA_NSEC3: + if (len > 0) { + t = keydata[0]; + return (64 + t*8)*8; + } else { + return 0; + } + break; + case LDNS_SIGN_RSAMD5: + case LDNS_SIGN_RSASHA1: + case LDNS_SIGN_RSASHA1_NSEC3: +#ifdef USE_SHA2 + case LDNS_SIGN_RSASHA256: + case LDNS_SIGN_RSASHA512: +#endif + if (len > 0) { + if (keydata[0] == 0) { + /* big exponent */ + if (len > 3) { + memmove(&int16, keydata + 1, 2); + exp = ntohs(int16); + return (len - exp - 3)*8; + } else { + return 0; + } + } else { + exp = keydata[0]; + return (len-exp-1)*8; + } + } else { + return 0; + } + break; +#ifdef USE_GOST + case LDNS_SIGN_ECC_GOST: + return 512; +#endif +#ifdef USE_ECDSA + case LDNS_SIGN_ECDSAP256SHA256: + return 256; + case LDNS_SIGN_ECDSAP384SHA384: + return 384; +#endif + case LDNS_SIGN_HMACMD5: + return len; + default: + return 0; + } +} + +size_t +ldns_rr_dnskey_key_size(const ldns_rr *key) +{ + if (!key) { + return 0; + } + return ldns_rr_dnskey_key_size_raw((unsigned char*)ldns_rdf_data(ldns_rr_dnskey_key(key)), + ldns_rdf_size(ldns_rr_dnskey_key(key)), + ldns_rdf2native_int8(ldns_rr_dnskey_algorithm(key)) + ); +} diff --git a/libs/ldns/sha1.c b/libs/ldns/sha1.c new file mode 100644 index 0000000000..5dec680a1b --- /dev/null +++ b/libs/ldns/sha1.c @@ -0,0 +1,177 @@ +/* + * modified for ldns by Jelte Jansen, original taken from OpenBSD: + * + * SHA-1 in C + * By Steve Reid + * 100% Public Domain + * + * Test Vectors (from FIPS PUB 180-1) + * "abc" + * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D + * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" + * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 + * A million repetitions of "a" + * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F +*/ + +/* #define LITTLE_ENDIAN * This should be #define'd already, if true. */ +/* #define SHA1HANDSOFF * Copies data before messing with it. */ + +#include +#include +#include + +#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) + +/* blk0() and blk() perform the initial expand. */ +/* I got the idea of expanding during the round function from SSLeay */ +#if BYTE_ORDER == LITTLE_ENDIAN +#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ + |(rol(block->l[i],8)&0x00FF00FF)) +#else +#define blk0(i) block->l[i] +#endif +#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ + ^block->l[(i+2)&15]^block->l[i&15],1)) + +/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ +#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); +#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); +#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); +#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); + +/* Hash a single 512-bit block. This is the core of the algorithm. */ + +void +ldns_sha1_transform(uint32_t state[5], const unsigned char buffer[LDNS_SHA1_BLOCK_LENGTH]) +{ + uint32_t a, b, c, d, e; + typedef union { + unsigned char c[64]; + unsigned int l[16]; + } CHAR64LONG16; + CHAR64LONG16* block; +#ifdef SHA1HANDSOFF + unsigned char workspace[LDNS_SHA1_BLOCK_LENGTH]; + + block = (CHAR64LONG16 *)workspace; + memmove(block, buffer, LDNS_SHA1_BLOCK_LENGTH); +#else + block = (CHAR64LONG16 *)buffer; +#endif + /* Copy context->state[] to working vars */ + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + /* 4 rounds of 20 operations each. Loop unrolled. */ + R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); + R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); + R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); + R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); + R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); + R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); + R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); + R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); + R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); + R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); + R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); + R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); + R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); + R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); + R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); + R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); + R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); + R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); + R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); + R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); + + /* Add the working vars back into context.state[] */ + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + state[4] += e; + /* Wipe variables */ + a = b = c = d = e = 0; +} + + +/* SHA1Init - Initialize new context */ + +void +ldns_sha1_init(ldns_sha1_ctx *context) +{ + /* SHA1 initialization constants */ + context->count = 0; + context->state[0] = 0x67452301; + context->state[1] = 0xEFCDAB89; + context->state[2] = 0x98BADCFE; + context->state[3] = 0x10325476; + context->state[4] = 0xC3D2E1F0; +} + + +/* Run your data through this. */ + +void +ldns_sha1_update(ldns_sha1_ctx *context, const unsigned char *data, unsigned int len) +{ + unsigned int i; + unsigned int j; + + j = (unsigned)(uint32_t)((context->count >> 3) & 63); + context->count += (len << 3); + if ((j + len) > 63) { + memmove(&context->buffer[j], data, (i = 64 - j)); + ldns_sha1_transform(context->state, context->buffer); + for ( ; i + 63 < len; i += 64) { + ldns_sha1_transform(context->state, &data[i]); + } + j = 0; + } + else i = 0; + memmove(&context->buffer[j], &data[i], len - i); +} + + +/* Add padding and return the message digest. */ + +void +ldns_sha1_final(unsigned char digest[LDNS_SHA1_DIGEST_LENGTH], ldns_sha1_ctx *context) +{ + unsigned int i; + unsigned char finalcount[8]; + + for (i = 0; i < 8; i++) { + finalcount[i] = (unsigned char)((context->count >> + ((7 - (i & 7)) * 8)) & 255); /* Endian independent */ + } + ldns_sha1_update(context, (unsigned char *)"\200", 1); + while ((context->count & 504) != 448) { + ldns_sha1_update(context, (unsigned char *)"\0", 1); + } + ldns_sha1_update(context, finalcount, 8); /* Should cause a SHA1Transform() */ + + if (digest != NULL) + for (i = 0; i < LDNS_SHA1_DIGEST_LENGTH; i++) { + digest[i] = (unsigned char)((context->state[i >> 2] >> + ((3 - (i & 3)) * 8)) & 255); + } +#ifdef SHA1HANDSOFF /* make SHA1Transform overwrite its own static vars */ + ldns_sha1_transform(context->state, context->buffer); +#endif +} + +unsigned char * +ldns_sha1(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha1_ctx ctx; + ldns_sha1_init(&ctx); + ldns_sha1_update(&ctx, data, data_len); + ldns_sha1_final(digest, &ctx); + return digest; +} diff --git a/libs/ldns/sha2.c b/libs/ldns/sha2.c new file mode 100644 index 0000000000..26b7716a66 --- /dev/null +++ b/libs/ldns/sha2.c @@ -0,0 +1,982 @@ +/* + * FILE: sha2.c + * AUTHOR: Aaron D. Gifford - http://www.aarongifford.com/ + * + * Copyright (c) 2000-2001, Aaron D. Gifford + * All rights reserved. + * + * Modified by Jelte Jansen to fit in ldns, and not clash with any + * system-defined SHA code. + * Changes: + * - Renamed (external) functions and constants to fit ldns style + * - Removed _End and _Data functions + * - Added ldns_shaX(data, len, digest) convenience functions + * - Removed prototypes of _Transform functions and made those static + * + * 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. Neither the name of the copyright holder nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTOR(S) ``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 AUTHOR OR CONTRIBUTOR(S) 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. + * + * $Id: sha2.c,v 1.1 2001/11/08 00:01:51 adg Exp adg $ + */ + +#include +#include /* memcpy()/memset() or bcopy()/bzero() */ +#include /* assert() */ +#include + +/* + * ASSERT NOTE: + * Some sanity checking code is included using assert(). On my FreeBSD + * system, this additional code can be removed by compiling with NDEBUG + * defined. Check your own systems manpage on assert() to see how to + * compile WITHOUT the sanity checking code on your system. + * + * UNROLLED TRANSFORM LOOP NOTE: + * You can define SHA2_UNROLL_TRANSFORM to use the unrolled transform + * loop version for the hash transform rounds (defined using macros + * later in this file). Either define on the command line, for example: + * + * cc -DSHA2_UNROLL_TRANSFORM -o sha2 sha2.c sha2prog.c + * + * or define below: + * + * #define SHA2_UNROLL_TRANSFORM + * + */ + + +/*** SHA-256/384/512 Machine Architecture Definitions *****************/ +/* + * BYTE_ORDER NOTE: + * + * Please make sure that your system defines BYTE_ORDER. If your + * architecture is little-endian, make sure it also defines + * LITTLE_ENDIAN and that the two (BYTE_ORDER and LITTLE_ENDIAN) are + * equivilent. + * + * If your system does not define the above, then you can do so by + * hand like this: + * + * #define LITTLE_ENDIAN 1234 + * #define BIG_ENDIAN 4321 + * + * And for little-endian machines, add: + * + * #define BYTE_ORDER LITTLE_ENDIAN + * + * Or for big-endian machines: + * + * #define BYTE_ORDER BIG_ENDIAN + * + * The FreeBSD machine this was written on defines BYTE_ORDER + * appropriately by including (which in turn includes + * where the appropriate definitions are actually + * made). + */ +#if !defined(BYTE_ORDER) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN) +#error Define BYTE_ORDER to be equal to either LITTLE_ENDIAN or BIG_ENDIAN +#endif + +typedef uint8_t sha2_byte; /* Exactly 1 byte */ +typedef uint32_t sha2_word32; /* Exactly 4 bytes */ +#ifdef S_SPLINT_S +typedef unsigned long long sha2_word64; /* lint 8 bytes */ +#else +typedef uint64_t sha2_word64; /* Exactly 8 bytes */ +#endif + +/*** SHA-256/384/512 Various Length Definitions ***********************/ +/* NOTE: Most of these are in sha2.h */ +#define ldns_sha256_SHORT_BLOCK_LENGTH (LDNS_SHA256_BLOCK_LENGTH - 8) +#define ldns_sha384_SHORT_BLOCK_LENGTH (LDNS_SHA384_BLOCK_LENGTH - 16) +#define ldns_sha512_SHORT_BLOCK_LENGTH (LDNS_SHA512_BLOCK_LENGTH - 16) + + +/*** ENDIAN REVERSAL MACROS *******************************************/ +#if BYTE_ORDER == LITTLE_ENDIAN +#define REVERSE32(w,x) { \ + sha2_word32 tmp = (w); \ + tmp = (tmp >> 16) | (tmp << 16); \ + (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ +} +#ifndef S_SPLINT_S +#define REVERSE64(w,x) { \ + sha2_word64 tmp = (w); \ + tmp = (tmp >> 32) | (tmp << 32); \ + tmp = ((tmp & 0xff00ff00ff00ff00ULL) >> 8) | \ + ((tmp & 0x00ff00ff00ff00ffULL) << 8); \ + (x) = ((tmp & 0xffff0000ffff0000ULL) >> 16) | \ + ((tmp & 0x0000ffff0000ffffULL) << 16); \ +} +#else /* splint */ +#define REVERSE64(w,x) /* splint */ +#endif /* splint */ +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +/* + * Macro for incrementally adding the unsigned 64-bit integer n to the + * unsigned 128-bit integer (represented using a two-element array of + * 64-bit words): + */ +#define ADDINC128(w,n) { \ + (w)[0] += (sha2_word64)(n); \ + if ((w)[0] < (n)) { \ + (w)[1]++; \ + } \ +} +#ifdef S_SPLINT_S +#undef ADDINC128 +#define ADDINC128(w,n) /* splint */ +#endif + +/* + * Macros for copying blocks of memory and for zeroing out ranges + * of memory. Using these macros makes it easy to switch from + * using memset()/memcpy() and using bzero()/bcopy(). + * + * Please define either SHA2_USE_MEMSET_MEMCPY or define + * SHA2_USE_BZERO_BCOPY depending on which function set you + * choose to use: + */ +#if !defined(SHA2_USE_MEMSET_MEMCPY) && !defined(SHA2_USE_BZERO_BCOPY) +/* Default to memset()/memcpy() if no option is specified */ +#define SHA2_USE_MEMSET_MEMCPY 1 +#endif +#if defined(SHA2_USE_MEMSET_MEMCPY) && defined(SHA2_USE_BZERO_BCOPY) +/* Abort with an error if BOTH options are defined */ +#error Define either SHA2_USE_MEMSET_MEMCPY or SHA2_USE_BZERO_BCOPY, not both! +#endif + +#ifdef SHA2_USE_MEMSET_MEMCPY +#define MEMSET_BZERO(p,l) memset((p), 0, (l)) +#define MEMCPY_BCOPY(d,s,l) memcpy((d), (s), (l)) +#endif +#ifdef SHA2_USE_BZERO_BCOPY +#define MEMSET_BZERO(p,l) bzero((p), (l)) +#define MEMCPY_BCOPY(d,s,l) bcopy((s), (d), (l)) +#endif + + +/*** THE SIX LOGICAL FUNCTIONS ****************************************/ +/* + * Bit shifting and rotation (used by the six SHA-XYZ logical functions: + * + * NOTE: The naming of R and S appears backwards here (R is a SHIFT and + * S is a ROTATION) because the SHA-256/384/512 description document + * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this + * same "backwards" definition. + */ +/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ +#define R(b,x) ((x) >> (b)) +/* 32-bit Rotate-right (used in SHA-256): */ +#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) +/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ +#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) + +/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */ +#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) +#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +/* Four of six logical functions used in SHA-256: */ +#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) +#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) +#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) +#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) + +/* Four of six logical functions used in SHA-384 and SHA-512: */ +#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) +#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) +#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) +#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) + +/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ +/* Hash constant words K for SHA-256: */ +static const sha2_word32 K256[64] = { + 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, + 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, + 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, + 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, + 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, + 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, + 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, + 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, + 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, + 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, + 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, + 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, + 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, + 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, + 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, + 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL +}; + +/* initial hash value H for SHA-256: */ +static const sha2_word32 ldns_sha256_initial_hash_value[8] = { + 0x6a09e667UL, + 0xbb67ae85UL, + 0x3c6ef372UL, + 0xa54ff53aUL, + 0x510e527fUL, + 0x9b05688cUL, + 0x1f83d9abUL, + 0x5be0cd19UL +}; + +/* Hash constant words K for SHA-384 and SHA-512: */ +static const sha2_word64 K512[80] = { + 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, + 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, + 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, + 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, + 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, + 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, + 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, + 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, + 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, + 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, + 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, + 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, + 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, + 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, + 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, + 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, + 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, + 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, + 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, + 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, + 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, + 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, + 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, + 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, + 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, + 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, + 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, + 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, + 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, + 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, + 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, + 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, + 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, + 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, + 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, + 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, + 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, + 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, + 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, + 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL +}; + +/* initial hash value H for SHA-384 */ +static const sha2_word64 sha384_initial_hash_value[8] = { + 0xcbbb9d5dc1059ed8ULL, + 0x629a292a367cd507ULL, + 0x9159015a3070dd17ULL, + 0x152fecd8f70e5939ULL, + 0x67332667ffc00b31ULL, + 0x8eb44a8768581511ULL, + 0xdb0c2e0d64f98fa7ULL, + 0x47b5481dbefa4fa4ULL +}; + +/* initial hash value H for SHA-512 */ +static const sha2_word64 sha512_initial_hash_value[8] = { + 0x6a09e667f3bcc908ULL, + 0xbb67ae8584caa73bULL, + 0x3c6ef372fe94f82bULL, + 0xa54ff53a5f1d36f1ULL, + 0x510e527fade682d1ULL, + 0x9b05688c2b3e6c1fULL, + 0x1f83d9abfb41bd6bULL, + 0x5be0cd19137e2179ULL +}; + +/*** SHA-256: *********************************************************/ +void ldns_sha256_init(ldns_sha256_CTX* context) { + if (context == (ldns_sha256_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, ldns_sha256_initial_hash_value, LDNS_SHA256_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, LDNS_SHA256_BLOCK_LENGTH); + context->bitcount = 0; +} + +#ifdef SHA2_UNROLL_TRANSFORM + +/* Unrolled SHA-256 round macros: */ + +#if BYTE_ORDER == LITTLE_ENDIAN + +#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + REVERSE32(*data++, W256[j]); \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ + K256[j] + W256[j]; \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + + +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ + K256[j] + (W256[j] = *data++); \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND256(a,b,c,d,e,f,g,h) \ + s0 = W256[(j+1)&0x0f]; \ + s0 = sigma0_256(s0); \ + s1 = W256[(j+14)&0x0f]; \ + s1 = sigma1_256(s1); \ + T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \ + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \ + (d) += T1; \ + (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ + j++ + +static void ldns_sha256_Transform(ldns_sha256_CTX* context, + const sha2_word32* data) { + sha2_word32 a, b, c, d, e, f, g, h, s0, s1; + sha2_word32 T1, *W256; + int j; + + W256 = (sha2_word32*)context->buffer; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { + /* Rounds 0 to 15 (unrolled): */ + ROUND256_0_TO_15(a,b,c,d,e,f,g,h); + ROUND256_0_TO_15(h,a,b,c,d,e,f,g); + ROUND256_0_TO_15(g,h,a,b,c,d,e,f); + ROUND256_0_TO_15(f,g,h,a,b,c,d,e); + ROUND256_0_TO_15(e,f,g,h,a,b,c,d); + ROUND256_0_TO_15(d,e,f,g,h,a,b,c); + ROUND256_0_TO_15(c,d,e,f,g,h,a,b); + ROUND256_0_TO_15(b,c,d,e,f,g,h,a); + } while (j < 16); + + /* Now for the remaining rounds to 64: */ + do { + ROUND256(a,b,c,d,e,f,g,h); + ROUND256(h,a,b,c,d,e,f,g); + ROUND256(g,h,a,b,c,d,e,f); + ROUND256(f,g,h,a,b,c,d,e); + ROUND256(e,f,g,h,a,b,c,d); + ROUND256(d,e,f,g,h,a,b,c); + ROUND256(c,d,e,f,g,h,a,b); + ROUND256(b,c,d,e,f,g,h,a); + } while (j < 64); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = 0; +} + +#else /* SHA2_UNROLL_TRANSFORM */ + +static void ldns_sha256_Transform(ldns_sha256_CTX* context, + const sha2_word32* data) { + sha2_word32 a, b, c, d, e, f, g, h, s0, s1; + sha2_word32 T1, T2, *W256; + int j; + + W256 = (sha2_word32*)context->buffer; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { +#if BYTE_ORDER == LITTLE_ENDIAN + /* Copy data while converting to host byte order */ + REVERSE32(*data++,W256[j]); + /* Apply the SHA-256 compression function to update a..h */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j]; +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* Apply the SHA-256 compression function to update a..h with copy */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + (W256[j] = *data++); +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + T2 = Sigma0_256(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 16); + + do { + /* Part of the message block expansion: */ + s0 = W256[(j+1)&0x0f]; + s0 = sigma0_256(s0); + s1 = W256[(j+14)&0x0f]; + s1 = sigma1_256(s1); + + /* Apply the SHA-256 compression function to update a..h */ + T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + + (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); + T2 = Sigma0_256(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 64); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = T2 = 0; +} + +#endif /* SHA2_UNROLL_TRANSFORM */ + +void ldns_sha256_update(ldns_sha256_CTX* context, const sha2_byte *data, size_t len) { + size_t freespace, usedspace; + + if (len == 0) { + /* Calling with no data is valid - we do nothing */ + return; + } + + /* Sanity check: */ + assert(context != (ldns_sha256_CTX*)0 && data != (sha2_byte*)0); + + usedspace = (context->bitcount >> 3) % LDNS_SHA256_BLOCK_LENGTH; + if (usedspace > 0) { + /* Calculate how much free space is available in the buffer */ + freespace = LDNS_SHA256_BLOCK_LENGTH - usedspace; + + if (len >= freespace) { + /* Fill the buffer completely and process it */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); + context->bitcount += freespace << 3; + len -= freespace; + data += freespace; + ldns_sha256_Transform(context, (sha2_word32*)context->buffer); + } else { + /* The buffer is not yet full */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, len); + context->bitcount += len << 3; + /* Clean up: */ + usedspace = freespace = 0; + return; + } + } + while (len >= LDNS_SHA256_BLOCK_LENGTH) { + /* Process as many complete blocks as we can */ + ldns_sha256_Transform(context, (sha2_word32*)data); + context->bitcount += LDNS_SHA256_BLOCK_LENGTH << 3; + len -= LDNS_SHA256_BLOCK_LENGTH; + data += LDNS_SHA256_BLOCK_LENGTH; + } + if (len > 0) { + /* There's left-overs, so save 'em */ + MEMCPY_BCOPY(context->buffer, data, len); + context->bitcount += len << 3; + } + /* Clean up: */ + usedspace = freespace = 0; +} + +void ldns_sha256_final(sha2_byte digest[], ldns_sha256_CTX* context) { + sha2_word32 *d = (sha2_word32*)digest; + size_t usedspace; + + /* Sanity check: */ + assert(context != (ldns_sha256_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + usedspace = (context->bitcount >> 3) % LDNS_SHA256_BLOCK_LENGTH; +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert FROM host byte order */ + REVERSE64(context->bitcount,context->bitcount); +#endif + if (usedspace > 0) { + /* Begin padding with a 1 bit: */ + context->buffer[usedspace++] = 0x80; + + if (usedspace <= ldns_sha256_SHORT_BLOCK_LENGTH) { + /* Set-up for the last transform: */ + MEMSET_BZERO(&context->buffer[usedspace], ldns_sha256_SHORT_BLOCK_LENGTH - usedspace); + } else { + if (usedspace < LDNS_SHA256_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA256_BLOCK_LENGTH - usedspace); + } + /* Do second-to-last transform: */ + ldns_sha256_Transform(context, (sha2_word32*)context->buffer); + + /* And set-up for the last transform: */ + MEMSET_BZERO(context->buffer, ldns_sha256_SHORT_BLOCK_LENGTH); + } + } else { + /* Set-up for the last transform: */ + MEMSET_BZERO(context->buffer, ldns_sha256_SHORT_BLOCK_LENGTH); + + /* Begin padding with a 1 bit: */ + *context->buffer = 0x80; + } + /* Set the bit count: */ + *(sha2_word64*)&context->buffer[ldns_sha256_SHORT_BLOCK_LENGTH] = context->bitcount; + + /* final transform: */ + ldns_sha256_Transform(context, (sha2_word32*)context->buffer); + +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 8; j++) { + REVERSE32(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, LDNS_SHA256_DIGEST_LENGTH); +#endif + } + + /* Clean up state data: */ + MEMSET_BZERO(context, sizeof(context)); + usedspace = 0; +} + +unsigned char * +ldns_sha256(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha256_CTX ctx; + ldns_sha256_init(&ctx); + ldns_sha256_update(&ctx, data, data_len); + ldns_sha256_final(digest, &ctx); + return digest; +} + +/*** SHA-512: *********************************************************/ +void ldns_sha512_init(ldns_sha512_CTX* context) { + if (context == (ldns_sha512_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, sha512_initial_hash_value, LDNS_SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH); + context->bitcount[0] = context->bitcount[1] = 0; +} + +#ifdef SHA2_UNROLL_TRANSFORM + +/* Unrolled SHA-512 round macros: */ +#if BYTE_ORDER == LITTLE_ENDIAN + +#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + REVERSE64(*data++, W512[j]); \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ + K512[j] + W512[j]; \ + (d) += T1, \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \ + j++ + + +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ + K512[j] + (W512[j] = *data++); \ + (d) += T1; \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ + j++ + +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + +#define ROUND512(a,b,c,d,e,f,g,h) \ + s0 = W512[(j+1)&0x0f]; \ + s0 = sigma0_512(s0); \ + s1 = W512[(j+14)&0x0f]; \ + s1 = sigma1_512(s1); \ + T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \ + (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ + (d) += T1; \ + (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ + j++ + +static void ldns_sha512_Transform(ldns_sha512_CTX* context, + const sha2_word64* data) { + sha2_word64 a, b, c, d, e, f, g, h, s0, s1; + sha2_word64 T1, *W512 = (sha2_word64*)context->buffer; + int j; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { + ROUND512_0_TO_15(a,b,c,d,e,f,g,h); + ROUND512_0_TO_15(h,a,b,c,d,e,f,g); + ROUND512_0_TO_15(g,h,a,b,c,d,e,f); + ROUND512_0_TO_15(f,g,h,a,b,c,d,e); + ROUND512_0_TO_15(e,f,g,h,a,b,c,d); + ROUND512_0_TO_15(d,e,f,g,h,a,b,c); + ROUND512_0_TO_15(c,d,e,f,g,h,a,b); + ROUND512_0_TO_15(b,c,d,e,f,g,h,a); + } while (j < 16); + + /* Now for the remaining rounds up to 79: */ + do { + ROUND512(a,b,c,d,e,f,g,h); + ROUND512(h,a,b,c,d,e,f,g); + ROUND512(g,h,a,b,c,d,e,f); + ROUND512(f,g,h,a,b,c,d,e); + ROUND512(e,f,g,h,a,b,c,d); + ROUND512(d,e,f,g,h,a,b,c); + ROUND512(c,d,e,f,g,h,a,b); + ROUND512(b,c,d,e,f,g,h,a); + } while (j < 80); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = 0; +} + +#else /* SHA2_UNROLL_TRANSFORM */ + +static void ldns_sha512_Transform(ldns_sha512_CTX* context, + const sha2_word64* data) { + sha2_word64 a, b, c, d, e, f, g, h, s0, s1; + sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer; + int j; + + /* initialize registers with the prev. intermediate value */ + a = context->state[0]; + b = context->state[1]; + c = context->state[2]; + d = context->state[3]; + e = context->state[4]; + f = context->state[5]; + g = context->state[6]; + h = context->state[7]; + + j = 0; + do { +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert TO host byte order */ + REVERSE64(*data++, W512[j]); + /* Apply the SHA-512 compression function to update a..h */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j]; +#else /* BYTE_ORDER == LITTLE_ENDIAN */ + /* Apply the SHA-512 compression function to update a..h with copy */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + (W512[j] = *data++); +#endif /* BYTE_ORDER == LITTLE_ENDIAN */ + T2 = Sigma0_512(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 16); + + do { + /* Part of the message block expansion: */ + s0 = W512[(j+1)&0x0f]; + s0 = sigma0_512(s0); + s1 = W512[(j+14)&0x0f]; + s1 = sigma1_512(s1); + + /* Apply the SHA-512 compression function to update a..h */ + T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + + (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); + T2 = Sigma0_512(a) + Maj(a, b, c); + h = g; + g = f; + f = e; + e = d + T1; + d = c; + c = b; + b = a; + a = T1 + T2; + + j++; + } while (j < 80); + + /* Compute the current intermediate hash value */ + context->state[0] += a; + context->state[1] += b; + context->state[2] += c; + context->state[3] += d; + context->state[4] += e; + context->state[5] += f; + context->state[6] += g; + context->state[7] += h; + + /* Clean up */ + a = b = c = d = e = f = g = h = T1 = T2 = 0; +} + +#endif /* SHA2_UNROLL_TRANSFORM */ + +void ldns_sha512_update(ldns_sha512_CTX* context, const sha2_byte *data, size_t len) { + size_t freespace, usedspace; + + if (len == 0) { + /* Calling with no data is valid - we do nothing */ + return; + } + + /* Sanity check: */ + assert(context != (ldns_sha512_CTX*)0 && data != (sha2_byte*)0); + + usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; + if (usedspace > 0) { + /* Calculate how much free space is available in the buffer */ + freespace = LDNS_SHA512_BLOCK_LENGTH - usedspace; + + if (len >= freespace) { + /* Fill the buffer completely and process it */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, freespace); + ADDINC128(context->bitcount, freespace << 3); + len -= freespace; + data += freespace; + ldns_sha512_Transform(context, (sha2_word64*)context->buffer); + } else { + /* The buffer is not yet full */ + MEMCPY_BCOPY(&context->buffer[usedspace], data, len); + ADDINC128(context->bitcount, len << 3); + /* Clean up: */ + usedspace = freespace = 0; + return; + } + } + while (len >= LDNS_SHA512_BLOCK_LENGTH) { + /* Process as many complete blocks as we can */ + ldns_sha512_Transform(context, (sha2_word64*)data); + ADDINC128(context->bitcount, LDNS_SHA512_BLOCK_LENGTH << 3); + len -= LDNS_SHA512_BLOCK_LENGTH; + data += LDNS_SHA512_BLOCK_LENGTH; + } + if (len > 0) { + /* There's left-overs, so save 'em */ + MEMCPY_BCOPY(context->buffer, data, len); + ADDINC128(context->bitcount, len << 3); + } + /* Clean up: */ + usedspace = freespace = 0; +} + +static void ldns_sha512_Last(ldns_sha512_CTX* context) { + size_t usedspace; + + usedspace = (context->bitcount[0] >> 3) % LDNS_SHA512_BLOCK_LENGTH; +#if BYTE_ORDER == LITTLE_ENDIAN + /* Convert FROM host byte order */ + REVERSE64(context->bitcount[0],context->bitcount[0]); + REVERSE64(context->bitcount[1],context->bitcount[1]); +#endif + if (usedspace > 0) { + /* Begin padding with a 1 bit: */ + context->buffer[usedspace++] = 0x80; + + if (usedspace <= ldns_sha512_SHORT_BLOCK_LENGTH) { + /* Set-up for the last transform: */ + MEMSET_BZERO(&context->buffer[usedspace], ldns_sha512_SHORT_BLOCK_LENGTH - usedspace); + } else { + if (usedspace < LDNS_SHA512_BLOCK_LENGTH) { + MEMSET_BZERO(&context->buffer[usedspace], LDNS_SHA512_BLOCK_LENGTH - usedspace); + } + /* Do second-to-last transform: */ + ldns_sha512_Transform(context, (sha2_word64*)context->buffer); + + /* And set-up for the last transform: */ + MEMSET_BZERO(context->buffer, LDNS_SHA512_BLOCK_LENGTH - 2); + } + } else { + /* Prepare for final transform: */ + MEMSET_BZERO(context->buffer, ldns_sha512_SHORT_BLOCK_LENGTH); + + /* Begin padding with a 1 bit: */ + *context->buffer = 0x80; + } + /* Store the length of input data (in bits): */ + *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; + *(sha2_word64*)&context->buffer[ldns_sha512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + + /* final transform: */ + ldns_sha512_Transform(context, (sha2_word64*)context->buffer); +} + +void ldns_sha512_final(sha2_byte digest[], ldns_sha512_CTX* context) { + sha2_word64 *d = (sha2_word64*)digest; + + /* Sanity check: */ + assert(context != (ldns_sha512_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + ldns_sha512_Last(context); + + /* Save the hash data for output: */ +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 8; j++) { + REVERSE64(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, LDNS_SHA512_DIGEST_LENGTH); +#endif + } + + /* Zero out state data */ + MEMSET_BZERO(context, sizeof(context)); +} + +unsigned char * +ldns_sha512(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha512_CTX ctx; + ldns_sha512_init(&ctx); + ldns_sha512_update(&ctx, data, data_len); + ldns_sha512_final(digest, &ctx); + return digest; +} + +/*** SHA-384: *********************************************************/ +void ldns_sha384_init(ldns_sha384_CTX* context) { + if (context == (ldns_sha384_CTX*)0) { + return; + } + MEMCPY_BCOPY(context->state, sha384_initial_hash_value, LDNS_SHA512_DIGEST_LENGTH); + MEMSET_BZERO(context->buffer, LDNS_SHA384_BLOCK_LENGTH); + context->bitcount[0] = context->bitcount[1] = 0; +} + +void ldns_sha384_update(ldns_sha384_CTX* context, const sha2_byte* data, size_t len) { + ldns_sha512_update((ldns_sha512_CTX*)context, data, len); +} + +void ldns_sha384_final(sha2_byte digest[], ldns_sha384_CTX* context) { + sha2_word64 *d = (sha2_word64*)digest; + + /* Sanity check: */ + assert(context != (ldns_sha384_CTX*)0); + + /* If no digest buffer is passed, we don't bother doing this: */ + if (digest != (sha2_byte*)0) { + ldns_sha512_Last((ldns_sha512_CTX*)context); + + /* Save the hash data for output: */ +#if BYTE_ORDER == LITTLE_ENDIAN + { + /* Convert TO host byte order */ + int j; + for (j = 0; j < 6; j++) { + REVERSE64(context->state[j],context->state[j]); + *d++ = context->state[j]; + } + } +#else + MEMCPY_BCOPY(d, context->state, LDNS_SHA384_DIGEST_LENGTH); +#endif + } + + /* Zero out state data */ + MEMSET_BZERO(context, sizeof(context)); +} + +unsigned char * +ldns_sha384(unsigned char *data, unsigned int data_len, unsigned char *digest) +{ + ldns_sha384_CTX ctx; + ldns_sha384_init(&ctx); + ldns_sha384_update(&ctx, data, data_len); + ldns_sha384_final(digest, &ctx); + return digest; +} diff --git a/libs/ldns/str2host.c b/libs/ldns/str2host.c new file mode 100644 index 0000000000..2eda2f805b --- /dev/null +++ b/libs/ldns/str2host.c @@ -0,0 +1,1313 @@ +/* + * str2host.c + * + * conversion routines from the presentation format + * to the host format + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ +#include + +#include + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_ARPA_INET_H +#include +#endif +#include + +#include +#ifdef HAVE_NETDB_H +#include +#endif + +#include +#ifdef HAVE_SYS_PARAM_H +#include +#endif + +ldns_status +ldns_str2rdf_int16(ldns_rdf **rd, const char *shortstr) +{ + char *end = NULL; + uint16_t *r; + r = LDNS_MALLOC(uint16_t); + if(!r) return LDNS_STATUS_MEM_ERR; + + *r = htons((uint16_t)strtol((char *)shortstr, &end, 10)); + + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_INVALID_INT; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT16, sizeof(uint16_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } +} + +ldns_status +ldns_str2rdf_time(ldns_rdf **rd, const char *time) +{ + /* convert a time YYYYDDMMHHMMSS to wireformat */ + uint16_t *r = NULL; + struct tm tm; + uint32_t l; + char *end; + + /* Try to scan the time... */ + r = (uint16_t*)LDNS_MALLOC(uint32_t); + if(!r) return LDNS_STATUS_MEM_ERR; + + memset(&tm, 0, sizeof(tm)); + + if (strlen(time) == 14 && + sscanf(time, "%4d%2d%2d%2d%2d%2d", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) == 6 + ) { + tm.tm_year -= 1900; + tm.tm_mon--; + /* Check values */ + if (tm.tm_year < 70) { + goto bad_format; + } + if (tm.tm_mon < 0 || tm.tm_mon > 11) { + goto bad_format; + } + if (tm.tm_mday < 1 || tm.tm_mday > 31) { + goto bad_format; + } + + if (tm.tm_hour < 0 || tm.tm_hour > 23) { + goto bad_format; + } + + if (tm.tm_min < 0 || tm.tm_min > 59) { + goto bad_format; + } + + if (tm.tm_sec < 0 || tm.tm_sec > 59) { + goto bad_format; + } + + l = htonl(mktime_from_utc(&tm)); + memcpy(r, &l, sizeof(uint32_t)); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_TIME, sizeof(uint32_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } else { + /* handle it as 32 bits timestamp */ + l = htonl((uint32_t)strtol((char*)time, &end, 10)); + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_ERR; + } else { + memcpy(r, &l, sizeof(uint32_t)); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT32, sizeof(uint32_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } + } + + bad_format: + LDNS_FREE(r); + return LDNS_STATUS_INVALID_TIME; +} + +ldns_status +ldns_str2rdf_nsec3_salt(ldns_rdf **rd, const char *salt_str) +{ + uint8_t salt_length; + int c; + int salt_length_str; + + uint8_t *salt; + uint8_t *data; + if(rd == NULL) { + return LDNS_STATUS_NULL; + } + + salt_length_str = (int)strlen(salt_str); + if (salt_length_str == 1 && salt_str[0] == '-') { + salt_length_str = 0; + } else if (salt_length_str % 2 != 0) { + return LDNS_STATUS_INVALID_HEX; + } + if (salt_length_str > 512) { + return LDNS_STATUS_INVALID_HEX; + } + + salt = LDNS_XMALLOC(uint8_t, salt_length_str / 2); + if(!salt) { + return LDNS_STATUS_MEM_ERR; + } + for (c = 0; c < salt_length_str; c += 2) { + if (isxdigit((int) salt_str[c]) && isxdigit((int) salt_str[c+1])) { + salt[c/2] = (uint8_t) ldns_hexdigit_to_int(salt_str[c]) * 16 + + ldns_hexdigit_to_int(salt_str[c+1]); + } else { + LDNS_FREE(salt); + return LDNS_STATUS_INVALID_HEX; + } + } + salt_length = (uint8_t) (salt_length_str / 2); + + data = LDNS_XMALLOC(uint8_t, 1 + salt_length); + if(!data) { + LDNS_FREE(salt); + return LDNS_STATUS_MEM_ERR; + } + data[0] = salt_length; + memcpy(&data[1], salt, salt_length); + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_NSEC3_SALT, 1 + salt_length, data); + LDNS_FREE(data); + LDNS_FREE(salt); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_period(ldns_rdf **rd,const char *period) +{ + uint32_t p; + const char *end; + + /* Allocate required space... */ + p = ldns_str2period(period, &end); + + if (*end != 0) { + return LDNS_STATUS_ERR; + } else { + p = (uint32_t) htonl(p); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_PERIOD, sizeof(uint32_t), &p); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_int32(ldns_rdf **rd, const char *longstr) +{ + char *end; + uint16_t *r = NULL; + uint32_t l; + + r = (uint16_t*)LDNS_MALLOC(uint32_t); + if(!r) return LDNS_STATUS_MEM_ERR; + errno = 0; /* must set to zero before call, + note race condition on errno */ + if(*longstr == '-') + l = htonl((uint32_t)strtol((char*)longstr, &end, 10)); + else l = htonl((uint32_t)strtoul((char*)longstr, &end, 10)); + + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_ERR; + } else { + if (errno == ERANGE) { + LDNS_FREE(r); + return LDNS_STATUS_SYNTAX_INTEGER_OVERFLOW; + } + memcpy(r, &l, sizeof(uint32_t)); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT32, sizeof(uint32_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } +} + +ldns_status +ldns_str2rdf_int8(ldns_rdf **rd, const char *bytestr) +{ + char *end; + uint8_t *r = NULL; + + r = LDNS_MALLOC(uint8_t); + if(!r) return LDNS_STATUS_MEM_ERR; + + *r = (uint8_t)strtol((char*)bytestr, &end, 10); + + if(*end != 0) { + LDNS_FREE(r); + return LDNS_STATUS_ERR; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT8, sizeof(uint8_t), r); + LDNS_FREE(r); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; + } +} + + +/* + * Checks whether the escaped value at **s is an octal value or + * a 'normally' escaped character (and not eos) + * + * The string pointer at *s is increased by either 0 (on error), 1 (on + * normal escapes), or 3 (on octals) + * + * Returns the number of bytes read from the escaped string, or + * 0 on error + */ +static int +parse_escape(uint8_t *s, uint8_t *q) { + uint8_t val; + if (strlen((char *)s) > 3 && + isdigit((int) s[1]) && + isdigit((int) s[2]) && + isdigit((int) s[3])) { + /* cast this so it fits */ + val = (uint8_t) ldns_hexdigit_to_int((char) s[1]) * 100 + + ldns_hexdigit_to_int((char) s[2]) * 10 + + ldns_hexdigit_to_int((char) s[3]); + *q = val; + return 3; + } else { + s++; + if (*s == '\0' || isdigit((int) *s)) { + /* apparently the string terminator + * or a digit has been escaped... + */ + return 0; + } + *q = *s; + return 1; + } +} + +/* + * No special care is taken, all dots are translated into + * label seperators. + * Could be made more efficient....we do 3 memcpy's in total... + */ +ldns_status +ldns_str2rdf_dname(ldns_rdf **d, const char *str) +{ + size_t len; + + int esc; + uint8_t *s, *q, *pq, label_len; + uint8_t buf[LDNS_MAX_DOMAINLEN + 1]; + *d = NULL; + + len = strlen((char*)str); + /* octet representation can make strings a lot longer than actual length */ + if (len > LDNS_MAX_DOMAINLEN * 4) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + if (0 == len) { + return LDNS_STATUS_DOMAINNAME_UNDERFLOW; + } + + /* root label */ + if (1 == len && *str == '.') { + *d = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, 1, "\0"); + return LDNS_STATUS_OK; + } + + /* get on with the rest */ + + /* s is on the current character in the string + * pq points to where the labellength is going to go + * label_len keeps track of the current label's length + * q builds the dname inside the buf array + */ + len = 0; + q = buf+1; + pq = buf; + label_len = 0; + for (s = (uint8_t *)str; *s; s++, q++) { + if (q > buf + LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + *q = 0; + switch (*s) { + case '.': + if (label_len > LDNS_MAX_LABELLEN) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + if (label_len == 0) { + return LDNS_STATUS_EMPTY_LABEL; + } + len += label_len + 1; + *pq = label_len; + label_len = 0; + pq = q; + break; + case '\\': + /* octet value or literal char */ + esc = parse_escape(s, q); + if (esc > 0) { + s += esc; + label_len++; + } else { + return LDNS_STATUS_SYNTAX_BAD_ESCAPE; + } + break; + default: + *q = *s; + label_len++; + } + } + + /* add root label if last char was not '.' */ + if (!ldns_dname_str_absolute(str)) { + if (q > buf + LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + if (label_len > LDNS_MAX_LABELLEN) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + if (label_len == 0) { /* label_len 0 but not . at end? */ + return LDNS_STATUS_EMPTY_LABEL; + } + len += label_len + 1; + *pq = label_len; + *q = 0; + } + len++; + + *d = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, len, buf); + return LDNS_STATUS_OK; +} + +ldns_status +ldns_str2rdf_a(ldns_rdf **rd, const char *str) +{ + in_addr_t address; + if (inet_pton(AF_INET, (char*)str, &address) != 1) { + return LDNS_STATUS_INVALID_IP4; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_A, sizeof(address), &address); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_aaaa(ldns_rdf **rd, const char *str) +{ + uint8_t address[LDNS_IP6ADDRLEN + 1]; + + if (inet_pton(AF_INET6, (char*)str, address) != 1) { + return LDNS_STATUS_INVALID_IP6; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_AAAA, sizeof(address) - 1, &address); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_str(ldns_rdf **rd, const char *str) +{ + uint8_t *data; + size_t i, str_i, esc_i; + + if (strlen(str) > 255) { + return LDNS_STATUS_INVALID_STR; + } + + data = LDNS_XMALLOC(uint8_t, strlen(str) + 1); + if(!data) return LDNS_STATUS_MEM_ERR; + i = 1; + + for (str_i = 0; str_i < strlen(str); str_i++) { + if (str[str_i] == '\\') { + /* octet value or literal char */ + esc_i = (size_t) parse_escape((uint8_t*) &str[str_i], (uint8_t*) &data[i]); + if (esc_i == 0) { + LDNS_FREE(data); + return LDNS_STATUS_SYNTAX_BAD_ESCAPE; + } + str_i += esc_i; + } else { + data[i] = (uint8_t) str[str_i]; + } + i++; + } + data[0] = i - 1; + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_STR, i, data); + + LDNS_FREE(data); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_apl(ldns_rdf **rd, const char *str) +{ + const char *my_str = str; + + char *my_ip_str; + size_t ip_str_len; + + uint16_t family; + bool negation; + uint8_t afdlength = 0; + uint8_t *afdpart; + uint8_t prefix; + + uint8_t *data; + + size_t i = 0; + + /* [!]afi:address/prefix */ + if (strlen(my_str) < 2) { + return LDNS_STATUS_INVALID_STR; + } + + if (my_str[0] == '!') { + negation = true; + my_str += 1; + } else { + negation = false; + } + + family = (uint16_t) atoi(my_str); + + my_str = strchr(my_str, ':') + 1; + + /* need ip addr and only ip addr for inet_pton */ + ip_str_len = (size_t) (strchr(my_str, '/') - my_str); + my_ip_str = LDNS_XMALLOC(char, ip_str_len + 1); + if(!my_ip_str) return LDNS_STATUS_MEM_ERR; + strncpy(my_ip_str, my_str, ip_str_len + 1); + my_ip_str[ip_str_len] = '\0'; + + if (family == 1) { + /* ipv4 */ + afdpart = LDNS_XMALLOC(uint8_t, 4); + if(!afdpart) { + LDNS_FREE(my_ip_str); + return LDNS_STATUS_MEM_ERR; + } + if (inet_pton(AF_INET, my_ip_str, afdpart) == 0) { + LDNS_FREE(my_ip_str); + LDNS_FREE(afdpart); + return LDNS_STATUS_INVALID_STR; + } + for (i = 0; i < 4; i++) { + if (afdpart[i] != 0) { + afdlength = i + 1; + } + } + } else if (family == 2) { + /* ipv6 */ + afdpart = LDNS_XMALLOC(uint8_t, 16); + if(!afdpart) { + LDNS_FREE(my_ip_str); + return LDNS_STATUS_MEM_ERR; + } + if (inet_pton(AF_INET6, my_ip_str, afdpart) == 0) { + LDNS_FREE(my_ip_str); + LDNS_FREE(afdpart); + return LDNS_STATUS_INVALID_STR; + } + for (i = 0; i < 16; i++) { + if (afdpart[i] != 0) { + afdlength = i + 1; + } + } + } else { + /* unknown family */ + LDNS_FREE(my_ip_str); + return LDNS_STATUS_INVALID_STR; + } + + my_str = strchr(my_str, '/') + 1; + prefix = (uint8_t) atoi(my_str); + + data = LDNS_XMALLOC(uint8_t, 4 + afdlength); + if(!data) { + LDNS_FREE(my_ip_str); + return LDNS_STATUS_INVALID_STR; + } + ldns_write_uint16(data, family); + data[2] = prefix; + data[3] = afdlength; + if (negation) { + /* set bit 1 of byte 3 */ + data[3] = data[3] | 0x80; + } + + memcpy(data + 4, afdpart, afdlength); + + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_APL, afdlength + 4, data); + LDNS_FREE(afdpart); + LDNS_FREE(data); + LDNS_FREE(my_ip_str); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_b64(ldns_rdf **rd, const char *str) +{ + uint8_t *buffer; + int16_t i; + + buffer = LDNS_XMALLOC(uint8_t, ldns_b64_ntop_calculate_size(strlen(str))); + if(!buffer) { + return LDNS_STATUS_MEM_ERR; + } + + i = (uint16_t)ldns_b64_pton((const char*)str, buffer, + ldns_b64_ntop_calculate_size(strlen(str))); + if (-1 == i) { + LDNS_FREE(buffer); + return LDNS_STATUS_INVALID_B64; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_B64, (uint16_t) i, buffer); + } + LDNS_FREE(buffer); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_b32_ext(ldns_rdf **rd, const char *str) +{ + uint8_t *buffer; + int i; + /* first byte contains length of actual b32 data */ + uint8_t len = ldns_b32_pton_calculate_size(strlen(str)); + buffer = LDNS_XMALLOC(uint8_t, len + 1); + if(!buffer) { + return LDNS_STATUS_MEM_ERR; + } + buffer[0] = len; + + i = ldns_b32_pton_extended_hex((const char*)str, strlen(str), buffer + 1, + ldns_b32_ntop_calculate_size(strlen(str))); + if (i < 0) { + LDNS_FREE(buffer); + return LDNS_STATUS_INVALID_B32_EXT; + } else { + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_B32_EXT, (uint16_t) i + 1, buffer); + } + LDNS_FREE(buffer); + + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_hex(ldns_rdf **rd, const char *str) +{ + uint8_t *t, *t_orig; + int i; + size_t len; + + len = strlen(str); + + if (len > LDNS_MAX_RDFLEN * 2) { + return LDNS_STATUS_LABEL_OVERFLOW; + } else { + t = LDNS_XMALLOC(uint8_t, (len / 2) + 1); + if(!t) { + return LDNS_STATUS_MEM_ERR; + } + t_orig = t; + /* Now process octet by octet... */ + while (*str) { + *t = 0; + if (isspace((int) *str)) { + str++; + } else { + for (i = 16; i >= 1; i -= 15) { + while (*str && isspace((int) *str)) { str++; } + if (*str) { + if (isxdigit((int) *str)) { + *t += ldns_hexdigit_to_int(*str) * i; + } else { + LDNS_FREE(t_orig); + return LDNS_STATUS_ERR; + } + ++str; + } + } + ++t; + } + } + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_HEX, + (size_t) (t - t_orig), + t_orig); + LDNS_FREE(t_orig); + } + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_nsec(ldns_rdf **rd, const char *str) +{ + const char *delimiters = "\n\t "; + char *token = LDNS_XMALLOC(char, LDNS_MAX_RDFLEN); + ldns_buffer *str_buf; + ssize_t c; + uint16_t cur_type; + size_t type_count = 0; + ldns_rr_type type_list[65536]; + if(!token) return LDNS_STATUS_MEM_ERR; + if(rd == NULL) { + LDNS_FREE(token); + return LDNS_STATUS_NULL; + } + + str_buf = LDNS_MALLOC(ldns_buffer); + if(!str_buf) { + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); + if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + + while ((c = ldns_bget_token(str_buf, token, delimiters, LDNS_MAX_RDFLEN)) != -1 && c != 0) { + if(type_count >= sizeof(type_list)) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_ERR; + } + cur_type = ldns_get_rr_type_by_name(token); + type_list[type_count] = cur_type; + type_count++; + } + + *rd = ldns_dnssec_create_nsec_bitmap(type_list, + type_count, + LDNS_RR_TYPE_NSEC); + + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_type(ldns_rdf **rd, const char *str) +{ + uint16_t type; + type = htons(ldns_get_rr_type_by_name(str)); + /* ldns_rr_type is a 16 bit value */ + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_TYPE, sizeof(uint16_t), &type); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_class(ldns_rdf **rd, const char *str) +{ + uint16_t klass; + klass = htons(ldns_get_rr_class_by_name(str)); + /* class is 16 bit */ + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_CLASS, sizeof(uint16_t), &klass); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +/* An certificate alg field can either be specified as a 8 bits number + * or by its symbolic name. Handle both + */ +ldns_status +ldns_str2rdf_cert_alg(ldns_rdf **rd, const char *str) +{ + ldns_lookup_table *lt; + ldns_status st; + uint8_t idd[2]; + lt = ldns_lookup_by_name(ldns_cert_algorithms, str); + st = LDNS_STATUS_OK; + + if (lt) { + ldns_write_uint16(idd, (uint16_t) lt->id); + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_INT16, sizeof(uint16_t), idd); + if (!*rd) { + st = LDNS_STATUS_ERR; + } + } else { + /* try as-is (a number) */ + st = ldns_str2rdf_int16(rd, str); + if (st == LDNS_STATUS_OK && + ldns_rdf2native_int16(*rd) == 0) { + st = LDNS_STATUS_CERT_BAD_ALGORITHM; + } + } + + return st; +} + +/* An alg field can either be specified as a 8 bits number + * or by its symbolic name. Handle both + */ +ldns_status +ldns_str2rdf_alg(ldns_rdf **rd, const char *str) +{ + ldns_lookup_table *lt; + ldns_status st; + + lt = ldns_lookup_by_name(ldns_algorithms, str); + st = LDNS_STATUS_OK; + + if (lt) { + /* it was given as a integer */ + *rd = ldns_native2rdf_int8(LDNS_RDF_TYPE_INT8, (uint8_t) lt->id); + if (!*rd) { + st = LDNS_STATUS_ERR; + } + } else { + /* try as-is (a number) */ + st = ldns_str2rdf_int8(rd, str); + } + return st; +} + +ldns_status +ldns_str2rdf_unknown(ldns_rdf **rd, const char *str) +{ + /* this should be caught in an earlier time (general str2host for + rr's */ + rd = rd; + str = str; + return LDNS_STATUS_NOT_IMPL; +} + +ldns_status +ldns_str2rdf_tsig(ldns_rdf **rd, const char *str) +{ + /* there is no strign representation for TSIG rrs */ + rd = rd; + str = str; + return LDNS_STATUS_NOT_IMPL; +} + +ldns_status +ldns_str2rdf_service(ldns_rdf **rd, const char *str) +{ + /* is this used? is this actually WKS? or SRV? */ + rd = rd; + str = str; + return LDNS_STATUS_NOT_IMPL; +} + +static int +loc_parse_cm(char* my_str, char** endstr, uint8_t* m, uint8_t* e) +{ + /* read [.][mM] */ + /* into mantissa exponent format for LOC type */ + uint32_t meters = 0, cm = 0, val; + while (isblank(*my_str)) { + my_str++; + } + meters = (uint32_t)strtol(my_str, &my_str, 10); + if (*my_str == '.') { + my_str++; + cm = (uint32_t)strtol(my_str, &my_str, 10); + } + if (meters >= 1) { + *e = 2; + val = meters; + } else { + *e = 0; + val = cm; + } + while(val >= 10) { + (*e)++; + val /= 10; + } + *m = (uint8_t)val; + + if (*e > 9) + return 0; + if (*my_str == 'm' || *my_str == 'M') { + my_str++; + } + *endstr = my_str; + return 1; +} + +ldns_status +ldns_str2rdf_loc(ldns_rdf **rd, const char *str) +{ + uint32_t latitude = 0; + uint32_t longitude = 0; + uint32_t altitude = 0; + + uint8_t *data; + uint32_t equator = (uint32_t) ldns_power(2, 31); + + uint32_t h = 0; + uint32_t m = 0; + uint8_t size_b = 1, size_e = 2; + uint8_t horiz_pre_b = 1, horiz_pre_e = 6; + uint8_t vert_pre_b = 1, vert_pre_e = 3; + + double s = 0.0; + bool northerness; + bool easterness; + + char *my_str = (char *) str; + + /* only support version 0 */ + if (isdigit((int) *my_str)) { + h = (uint32_t) strtol(my_str, &my_str, 10); + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + m = (uint32_t) strtol(my_str, &my_str, 10); + } else if (*my_str == 'N' || *my_str == 'S') { + goto north; + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + s = strtod(my_str, &my_str); + } +north: + while (isblank((int) *my_str)) { + my_str++; + } + + if (*my_str == 'N') { + northerness = true; + } else if (*my_str == 'S') { + northerness = false; + } else { + return LDNS_STATUS_INVALID_STR; + } + + my_str++; + + /* store number */ + s = 1000.0 * s; + /* add a little to make floor in conversion a round */ + s += 0.0005; + latitude = (uint32_t) s; + latitude += 1000 * 60 * m; + latitude += 1000 * 60 * 60 * h; + if (northerness) { + latitude = equator + latitude; + } else { + latitude = equator - latitude; + } + while (isblank(*my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + h = (uint32_t) strtol(my_str, &my_str, 10); + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank((int) *my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + m = (uint32_t) strtol(my_str, &my_str, 10); + } else if (*my_str == 'E' || *my_str == 'W') { + goto east; + } else { + return LDNS_STATUS_INVALID_STR; + } + + while (isblank(*my_str)) { + my_str++; + } + + if (isdigit((int) *my_str)) { + s = strtod(my_str, &my_str); + } + +east: + while (isblank(*my_str)) { + my_str++; + } + + if (*my_str == 'E') { + easterness = true; + } else if (*my_str == 'W') { + easterness = false; + } else { + return LDNS_STATUS_INVALID_STR; + } + + my_str++; + + /* store number */ + s *= 1000.0; + /* add a little to make floor in conversion a round */ + s += 0.0005; + longitude = (uint32_t) s; + longitude += 1000 * 60 * m; + longitude += 1000 * 60 * 60 * h; + + if (easterness) { + longitude += equator; + } else { + longitude = equator - longitude; + } + + altitude = (uint32_t)(strtod(my_str, &my_str)*100.0 + + 10000000.0 + 0.5); + if (*my_str == 'm' || *my_str == 'M') { + my_str++; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &size_b, &size_e)) + return LDNS_STATUS_INVALID_STR; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &horiz_pre_b, &horiz_pre_e)) + return LDNS_STATUS_INVALID_STR; + } + + if (strlen(my_str) > 0) { + if(!loc_parse_cm(my_str, &my_str, &vert_pre_b, &vert_pre_e)) + return LDNS_STATUS_INVALID_STR; + } + + data = LDNS_XMALLOC(uint8_t, 16); + if(!data) { + return LDNS_STATUS_MEM_ERR; + } + data[0] = 0; + data[1] = 0; + data[1] = ((size_b << 4) & 0xf0) | (size_e & 0x0f); + data[2] = ((horiz_pre_b << 4) & 0xf0) | (horiz_pre_e & 0x0f); + data[3] = ((vert_pre_b << 4) & 0xf0) | (vert_pre_e & 0x0f); + ldns_write_uint32(data + 4, latitude); + ldns_write_uint32(data + 8, longitude); + ldns_write_uint32(data + 12, altitude); + + *rd = ldns_rdf_new_frm_data( + LDNS_RDF_TYPE_LOC, 16, data); + + LDNS_FREE(data); + return *rd?LDNS_STATUS_OK:LDNS_STATUS_MEM_ERR; +} + +ldns_status +ldns_str2rdf_wks(ldns_rdf **rd, const char *str) +{ + uint8_t *bitmap = NULL; + uint8_t *data; + int bm_len = 0; + + struct protoent *proto = NULL; + struct servent *serv = NULL; + int serv_port; + + ldns_buffer *str_buf; + + char *proto_str = NULL; + char *token; + if(strlen(str) == 0) + token = LDNS_XMALLOC(char, 50); + else token = LDNS_XMALLOC(char, strlen(str)+2); + if(!token) return LDNS_STATUS_MEM_ERR; + + str_buf = LDNS_MALLOC(ldns_buffer); + if(!str_buf) {LDNS_FREE(token); return LDNS_STATUS_MEM_ERR;} + ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); + if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + + while(ldns_bget_token(str_buf, token, "\t\n ", strlen(str)) > 0) { + if (!proto_str) { + proto_str = strdup(token); + if (!proto_str) { + LDNS_FREE(bitmap); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + } else { + serv = getservbyname(token, proto_str); + if (serv) { + serv_port = (int) ntohs((uint16_t) serv->s_port); + } else { + serv_port = atoi(token); + } + if (serv_port / 8 >= bm_len) { + uint8_t *b2 = LDNS_XREALLOC(bitmap, uint8_t, (serv_port / 8) + 1); + if(!b2) { + LDNS_FREE(bitmap); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + free(proto_str); + return LDNS_STATUS_INVALID_STR; + } + bitmap = b2; + /* set to zero to be sure */ + for (; bm_len <= serv_port / 8; bm_len++) { + bitmap[bm_len] = 0; + } + } + ldns_set_bit(bitmap + (serv_port / 8), 7 - (serv_port % 8), true); + } + } + + if (!proto_str || !bitmap) { + LDNS_FREE(bitmap); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + free(proto_str); + return LDNS_STATUS_INVALID_STR; + } + + data = LDNS_XMALLOC(uint8_t, bm_len + 1); + if(!data) { + LDNS_FREE(token); + ldns_buffer_free(str_buf); + LDNS_FREE(bitmap); + free(proto_str); + return LDNS_STATUS_INVALID_STR; + } + if (proto_str) + proto = getprotobyname(proto_str); + if (proto) { + data[0] = (uint8_t) proto->p_proto; + } else if (proto_str) { + data[0] = (uint8_t) atoi(proto_str); + } else { + data[0] = 0; + } + memcpy(data + 1, bitmap, (size_t) bm_len); + + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_WKS, (uint16_t) (bm_len + 1), data); + + LDNS_FREE(data); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + LDNS_FREE(bitmap); + free(proto_str); +#ifdef HAVE_ENDSERVENT + endservent(); +#endif +#ifdef HAVE_ENDPROTOENT + endprotoent(); +#endif + + if(!*rd) return LDNS_STATUS_MEM_ERR; + + return LDNS_STATUS_OK; +} + +ldns_status +ldns_str2rdf_nsap(ldns_rdf **rd, const char *str) +{ + size_t len, i; + char* nsap_str = (char*) str; + + /* just a hex string with optional dots? */ + if (str[0] != '0' || str[1] != 'x') { + return LDNS_STATUS_INVALID_STR; + } else { + len = strlen(str); + for (i=0; i < len; i++) { + if (nsap_str[i] == '.') + nsap_str[i] = ' '; + } + return ldns_str2rdf_hex(rd, str+2); + } +} + +ldns_status +ldns_str2rdf_atma(ldns_rdf **rd, const char *str) +{ + size_t len, i; + char* atma_str = (char*) str; + ldns_status status; + + /* just a hex string with optional dots? */ + len = strlen(str); + for (i=0; i < len; i++) { + if (atma_str[i] == '.') + atma_str[i] = ' '; + } + status = ldns_str2rdf_hex(rd, str); + if (status != LDNS_STATUS_OK) { + ; /* probably in e.164 format than */ + } + return status; +} + +ldns_status +ldns_str2rdf_ipseckey(ldns_rdf **rd, const char *str) +{ + uint8_t precedence = 0; + uint8_t gateway_type = 0; + uint8_t algorithm = 0; + char* gateway = NULL; + char* publickey = NULL; + uint8_t *data; + ldns_buffer *str_buf; + char *token; + int token_count = 0; + int ipseckey_len = 0; + ldns_rdf* gateway_rdf = NULL; + ldns_rdf* publickey_rdf = NULL; + ldns_status status = LDNS_STATUS_OK; + + if(strlen(str) == 0) + token = LDNS_XMALLOC(char, 256); + else token = LDNS_XMALLOC(char, strlen(str)+2); + if(!token) return LDNS_STATUS_MEM_ERR; + + str_buf = LDNS_MALLOC(ldns_buffer); + if(!str_buf) {LDNS_FREE(token); return LDNS_STATUS_MEM_ERR;} + ldns_buffer_new_frm_data(str_buf, (char *)str, strlen(str)); + if(ldns_buffer_status(str_buf) != LDNS_STATUS_OK) { + LDNS_FREE(str_buf); + LDNS_FREE(token); + return LDNS_STATUS_MEM_ERR; + } + while(ldns_bget_token(str_buf, token, "\t\n ", strlen(str)) > 0) { + switch (token_count) { + case 0: + precedence = (uint8_t)atoi(token); + break; + case 1: + gateway_type = (uint8_t)atoi(token); + break; + case 2: + algorithm = (uint8_t)atoi(token); + break; + case 3: + gateway = strdup(token); + if (!gateway || (gateway_type == 0 && + (token[0] != '.' || token[1] != '\0'))) { + LDNS_FREE(gateway); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + break; + case 4: + publickey = strdup(token); + break; + default: + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + break; + } + token_count++; + } + + if (!gateway || !publickey) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + + if (gateway_type == 1) { + status = ldns_str2rdf_a(&gateway_rdf, gateway); + } else if (gateway_type == 2) { + status = ldns_str2rdf_aaaa(&gateway_rdf, gateway); + } else if (gateway_type == 3) { + status = ldns_str2rdf_dname(&gateway_rdf, gateway); + } + + if (status != LDNS_STATUS_OK) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + return LDNS_STATUS_INVALID_STR; + } + + status = ldns_str2rdf_b64(&publickey_rdf, publickey); + + if (status != LDNS_STATUS_OK) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + if (gateway_rdf) ldns_rdf_free(gateway_rdf); + return LDNS_STATUS_INVALID_STR; + } + + /* now copy all into one ipseckey rdf */ + if (gateway_type) + ipseckey_len = 3 + (int)ldns_rdf_size(gateway_rdf) + (int)ldns_rdf_size(publickey_rdf); + else + ipseckey_len = 3 + (int)ldns_rdf_size(publickey_rdf); + + data = LDNS_XMALLOC(uint8_t, ipseckey_len); + if(!data) { + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + if (gateway_rdf) ldns_rdf_free(gateway_rdf); + if (publickey_rdf) ldns_rdf_free(publickey_rdf); + return LDNS_STATUS_MEM_ERR; + } + + data[0] = precedence; + data[1] = gateway_type; + data[2] = algorithm; + + if (gateway_type) { + memcpy(data + 3, + ldns_rdf_data(gateway_rdf), ldns_rdf_size(gateway_rdf)); + memcpy(data + 3 + ldns_rdf_size(gateway_rdf), + ldns_rdf_data(publickey_rdf), ldns_rdf_size(publickey_rdf)); + } else { + memcpy(data + 3, + ldns_rdf_data(publickey_rdf), ldns_rdf_size(publickey_rdf)); + } + + *rd = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_IPSECKEY, (uint16_t) ipseckey_len, data); + + if (gateway) + LDNS_FREE(gateway); + if (publickey) + LDNS_FREE(publickey); + LDNS_FREE(token); + ldns_buffer_free(str_buf); + ldns_rdf_free(gateway_rdf); + ldns_rdf_free(publickey_rdf); + LDNS_FREE(data); + if(!*rd) return LDNS_STATUS_MEM_ERR; + return LDNS_STATUS_OK; +} diff --git a/libs/ldns/tsig.c b/libs/ldns/tsig.c new file mode 100644 index 0000000000..7fcf21da0e --- /dev/null +++ b/libs/ldns/tsig.c @@ -0,0 +1,458 @@ +/* + * tsig.c + * + * contains the functions needed for TSIG [RFC2845] + * + * (c) 2005-2006 NLnet Labs + * See the file LICENSE for the license + */ + +#include + +#include + +#include + +#ifdef HAVE_SSL +#include +#include +#endif /* HAVE_SSL */ + +char * +ldns_tsig_algorithm(ldns_tsig_credentials *tc) +{ + return tc->algorithm; +} + +char * +ldns_tsig_keyname(ldns_tsig_credentials *tc) +{ + return tc->keyname; +} + +char * +ldns_tsig_keydata(ldns_tsig_credentials *tc) +{ + return tc->keydata; +} + +char * +ldns_tsig_keyname_clone(ldns_tsig_credentials *tc) +{ + return strdup(tc->keyname); +} + +char * +ldns_tsig_keydata_clone(ldns_tsig_credentials *tc) +{ + return strdup(tc->keydata); +} + +/* + * Makes an exact copy of the wire, but with the tsig rr removed + */ +uint8_t * +ldns_tsig_prepare_pkt_wire(uint8_t *wire, size_t wire_len, size_t *result_len) +{ + uint8_t *wire2 = NULL; + uint16_t qd_count; + uint16_t an_count; + uint16_t ns_count; + uint16_t ar_count; + ldns_rr *rr; + + size_t pos; + uint16_t i; + + ldns_status status; + + if(wire_len < LDNS_HEADER_SIZE) { + return NULL; + } + /* fake parse the wire */ + qd_count = LDNS_QDCOUNT(wire); + an_count = LDNS_ANCOUNT(wire); + ns_count = LDNS_NSCOUNT(wire); + ar_count = LDNS_ARCOUNT(wire); + + if (ar_count > 0) { + ar_count--; + } else { + return NULL; + } + + pos = LDNS_HEADER_SIZE; + + for (i = 0; i < qd_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_QUESTION); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + for (i = 0; i < an_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_ANSWER); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + for (i = 0; i < ns_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, LDNS_SECTION_AUTHORITY); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + for (i = 0; i < ar_count; i++) { + status = ldns_wire2rr(&rr, wire, wire_len, &pos, + LDNS_SECTION_ADDITIONAL); + if (status != LDNS_STATUS_OK) { + return NULL; + } + ldns_rr_free(rr); + } + + *result_len = pos; + wire2 = LDNS_XMALLOC(uint8_t, *result_len); + if(!wire2) { + return NULL; + } + memcpy(wire2, wire, *result_len); + + ldns_write_uint16(wire2 + LDNS_ARCOUNT_OFF, ar_count); + + return wire2; +} + +#ifdef HAVE_SSL +static const EVP_MD * +ldns_digest_function(char *name) +{ + /* these are the mandatory algorithms from RFC4635 */ + /* The optional algorithms are not yet implemented */ + if (strlen(name) == 12 && strncasecmp(name, "hmac-sha256.", 11) == 0) { +#ifdef HAVE_EVP_SHA256 + return EVP_sha256(); +#else + return NULL; +#endif + } else if (strlen(name) == 10 && strncasecmp(name, "hmac-sha1.", 9) == 0) + return EVP_sha1(); + else if (strlen(name) == 25 && strncasecmp(name, + "hmac-md5.sig-alg.reg.int.", 25) == 0) + return EVP_md5(); + else + return NULL; +} +#endif + +#ifdef HAVE_SSL +static ldns_status +ldns_tsig_mac_new(ldns_rdf **tsig_mac, uint8_t *pkt_wire, size_t pkt_wire_size, + const char *key_data, ldns_rdf *key_name_rdf, ldns_rdf *fudge_rdf, + ldns_rdf *algorithm_rdf, ldns_rdf *time_signed_rdf, ldns_rdf *error_rdf, + ldns_rdf *other_data_rdf, ldns_rdf *orig_mac_rdf, int tsig_timers_only) +{ + char *wireformat; + int wiresize; + unsigned char *mac_bytes; + unsigned char *key_bytes; + int key_size; + const EVP_MD *digester; + char *algorithm_name; + unsigned int md_len = EVP_MAX_MD_SIZE; + ldns_rdf *result = NULL; + ldns_buffer *data_buffer = NULL; + + /* + * prepare the digestable information + */ + data_buffer = ldns_buffer_new(LDNS_MAX_PACKETLEN); + if(!data_buffer) { + return LDNS_STATUS_MEM_ERR; + } + /* if orig_mac is not NULL, add it too */ + if (orig_mac_rdf) { + (void) ldns_rdf2buffer_wire(data_buffer, orig_mac_rdf); + } + ldns_buffer_write(data_buffer, pkt_wire, pkt_wire_size); + if (!tsig_timers_only) { + (void)ldns_rdf2buffer_wire(data_buffer, key_name_rdf); + ldns_buffer_write_u16(data_buffer, LDNS_RR_CLASS_ANY); + ldns_buffer_write_u32(data_buffer, 0); + (void)ldns_rdf2buffer_wire(data_buffer, algorithm_rdf); + } + (void)ldns_rdf2buffer_wire(data_buffer, time_signed_rdf); + (void)ldns_rdf2buffer_wire(data_buffer, fudge_rdf); + if (!tsig_timers_only) { + (void)ldns_rdf2buffer_wire(data_buffer, error_rdf); + (void)ldns_rdf2buffer_wire(data_buffer, other_data_rdf); + } + + wireformat = (char *) data_buffer->_data; + wiresize = (int) ldns_buffer_position(data_buffer); + + algorithm_name = ldns_rdf2str(algorithm_rdf); + if(!algorithm_name) { + ldns_buffer_free(data_buffer); + return LDNS_STATUS_MEM_ERR; + } + + /* prepare the key */ + key_bytes = LDNS_XMALLOC(unsigned char, + ldns_b64_pton_calculate_size(strlen(key_data))); + if(!key_bytes) { + LDNS_FREE(algorithm_name); + ldns_buffer_free(data_buffer); + return LDNS_STATUS_MEM_ERR; + } + key_size = ldns_b64_pton(key_data, key_bytes, + ldns_b64_pton_calculate_size(strlen(key_data))); + if (key_size < 0) { + LDNS_FREE(algorithm_name); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + /* LDNS_STATUS_INVALID_B64 */ + return LDNS_STATUS_INVALID_B64; + } + /* hmac it */ + /* 2 spare bytes for the length */ + mac_bytes = LDNS_XMALLOC(unsigned char, md_len+2); + if(!mac_bytes) { + LDNS_FREE(algorithm_name); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + return LDNS_STATUS_MEM_ERR; + } + memset(mac_bytes, 0, md_len+2); + + digester = ldns_digest_function(algorithm_name); + + if (digester) { + (void) HMAC(digester, key_bytes, key_size, (void *)wireformat, + (size_t) wiresize, mac_bytes + 2, &md_len); + + ldns_write_uint16(mac_bytes, md_len); + result = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_INT16_DATA, md_len + 2, + mac_bytes); + } else { + LDNS_FREE(algorithm_name); + LDNS_FREE(mac_bytes); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + return LDNS_STATUS_CRYPTO_UNKNOWN_ALGO; + } + + LDNS_FREE(algorithm_name); + LDNS_FREE(mac_bytes); + LDNS_FREE(key_bytes); + ldns_buffer_free(data_buffer); + + *tsig_mac = result; + + return LDNS_STATUS_OK; +} +#endif /* HAVE_SSL */ + + +#ifdef HAVE_SSL +bool +ldns_pkt_tsig_verify(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char *key_name, + const char *key_data, ldns_rdf *orig_mac_rdf) +{ + return ldns_pkt_tsig_verify_next(pkt, wire, wirelen, key_name, key_data, orig_mac_rdf, 0); +} + +bool +ldns_pkt_tsig_verify_next(ldns_pkt *pkt, uint8_t *wire, size_t wirelen, const char* key_name, + const char *key_data, ldns_rdf *orig_mac_rdf, int tsig_timers_only) +{ + ldns_rdf *fudge_rdf; + ldns_rdf *algorithm_rdf; + ldns_rdf *time_signed_rdf; + ldns_rdf *orig_id_rdf; + ldns_rdf *error_rdf; + ldns_rdf *other_data_rdf; + ldns_rdf *pkt_mac_rdf; + ldns_rdf *my_mac_rdf; + ldns_rdf *key_name_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, key_name); + uint16_t pkt_id, orig_pkt_id; + ldns_status status; + + uint8_t *prepared_wire = NULL; + size_t prepared_wire_size = 0; + + ldns_rr *orig_tsig = ldns_pkt_tsig(pkt); + + if (!orig_tsig) { + ldns_rdf_deep_free(key_name_rdf); + return false; + } + algorithm_rdf = ldns_rr_rdf(orig_tsig, 0); + time_signed_rdf = ldns_rr_rdf(orig_tsig, 1); + fudge_rdf = ldns_rr_rdf(orig_tsig, 2); + pkt_mac_rdf = ldns_rr_rdf(orig_tsig, 3); + orig_id_rdf = ldns_rr_rdf(orig_tsig, 4); + error_rdf = ldns_rr_rdf(orig_tsig, 5); + other_data_rdf = ldns_rr_rdf(orig_tsig, 6); + + /* remove temporarily */ + ldns_pkt_set_tsig(pkt, NULL); + /* temporarily change the id to the original id */ + pkt_id = ldns_pkt_id(pkt); + orig_pkt_id = ldns_rdf2native_int16(orig_id_rdf); + ldns_pkt_set_id(pkt, orig_pkt_id); + + prepared_wire = ldns_tsig_prepare_pkt_wire(wire, wirelen, &prepared_wire_size); + + status = ldns_tsig_mac_new(&my_mac_rdf, prepared_wire, prepared_wire_size, + key_data, key_name_rdf, fudge_rdf, algorithm_rdf, + time_signed_rdf, error_rdf, other_data_rdf, orig_mac_rdf, tsig_timers_only); + + LDNS_FREE(prepared_wire); + + if (status != LDNS_STATUS_OK) { + ldns_rdf_deep_free(key_name_rdf); + return false; + } + /* Put back the values */ + ldns_pkt_set_tsig(pkt, orig_tsig); + ldns_pkt_set_id(pkt, pkt_id); + + ldns_rdf_deep_free(key_name_rdf); + + if (ldns_rdf_compare(pkt_mac_rdf, my_mac_rdf) == 0) { + ldns_rdf_deep_free(my_mac_rdf); + return true; + } else { + ldns_rdf_deep_free(my_mac_rdf); + return false; + } +} +#endif /* HAVE_SSL */ + +#ifdef HAVE_SSL +ldns_status +ldns_pkt_tsig_sign(ldns_pkt *pkt, const char *key_name, const char *key_data, + uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac) +{ + return ldns_pkt_tsig_sign_next(pkt, key_name, key_data, fudge, algorithm_name, query_mac, 0); +} + +ldns_status +ldns_pkt_tsig_sign_next(ldns_pkt *pkt, const char *key_name, const char *key_data, + uint16_t fudge, const char *algorithm_name, ldns_rdf *query_mac, int tsig_timers_only) +{ + ldns_rr *tsig_rr; + ldns_rdf *key_name_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, key_name); + ldns_rdf *fudge_rdf = NULL; + ldns_rdf *orig_id_rdf = NULL; + ldns_rdf *algorithm_rdf; + ldns_rdf *error_rdf = NULL; + ldns_rdf *mac_rdf = NULL; + ldns_rdf *other_data_rdf = NULL; + + ldns_status status = LDNS_STATUS_OK; + + uint8_t *pkt_wire = NULL; + size_t pkt_wire_len; + + struct timeval tv_time_signed; + uint8_t *time_signed = NULL; + ldns_rdf *time_signed_rdf = NULL; + + algorithm_rdf = ldns_rdf_new_frm_str(LDNS_RDF_TYPE_DNAME, algorithm_name); + if(!key_name_rdf || !algorithm_rdf) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + + /* eww don't have create tsigtime rdf yet :( */ + /* bleh :p */ + if (gettimeofday(&tv_time_signed, NULL) == 0) { + time_signed = LDNS_XMALLOC(uint8_t, 6); + if(!time_signed) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + ldns_write_uint64_as_uint48(time_signed, + (uint64_t)tv_time_signed.tv_sec); + } else { + status = LDNS_STATUS_INTERNAL_ERR; + goto clean; + } + + time_signed_rdf = ldns_rdf_new(LDNS_RDF_TYPE_TSIGTIME, 6, time_signed); + if(!time_signed_rdf) { + LDNS_FREE(time_signed); + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + + fudge_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, fudge); + + orig_id_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, ldns_pkt_id(pkt)); + + error_rdf = ldns_native2rdf_int16(LDNS_RDF_TYPE_INT16, 0); + + other_data_rdf = ldns_native2rdf_int16_data(0, NULL); + + if(!fudge_rdf || !orig_id_rdf || !error_rdf || !other_data_rdf) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + + if (ldns_pkt2wire(&pkt_wire, pkt, &pkt_wire_len) != LDNS_STATUS_OK) { + status = LDNS_STATUS_ERR; + goto clean; + } + + status = ldns_tsig_mac_new(&mac_rdf, pkt_wire, pkt_wire_len, + key_data, key_name_rdf, fudge_rdf, algorithm_rdf, + time_signed_rdf, error_rdf, other_data_rdf, query_mac, tsig_timers_only); + + if (!mac_rdf) { + goto clean; + } + + LDNS_FREE(pkt_wire); + + /* Create the TSIG RR */ + tsig_rr = ldns_rr_new(); + if(!tsig_rr) { + status = LDNS_STATUS_MEM_ERR; + goto clean; + } + ldns_rr_set_owner(tsig_rr, key_name_rdf); + ldns_rr_set_class(tsig_rr, LDNS_RR_CLASS_ANY); + ldns_rr_set_type(tsig_rr, LDNS_RR_TYPE_TSIG); + ldns_rr_set_ttl(tsig_rr, 0); + + ldns_rr_push_rdf(tsig_rr, algorithm_rdf); + ldns_rr_push_rdf(tsig_rr, time_signed_rdf); + ldns_rr_push_rdf(tsig_rr, fudge_rdf); + ldns_rr_push_rdf(tsig_rr, mac_rdf); + ldns_rr_push_rdf(tsig_rr, orig_id_rdf); + ldns_rr_push_rdf(tsig_rr, error_rdf); + ldns_rr_push_rdf(tsig_rr, other_data_rdf); + + ldns_pkt_set_tsig(pkt, tsig_rr); + + return status; + + clean: + LDNS_FREE(pkt_wire); + ldns_rdf_free(key_name_rdf); + ldns_rdf_free(algorithm_rdf); + ldns_rdf_free(time_signed_rdf); + ldns_rdf_free(fudge_rdf); + ldns_rdf_free(orig_id_rdf); + ldns_rdf_free(error_rdf); + ldns_rdf_free(other_data_rdf); + return status; +} +#endif /* HAVE_SSL */ diff --git a/libs/ldns/update.c b/libs/ldns/update.c new file mode 100644 index 0000000000..01e67aa069 --- /dev/null +++ b/libs/ldns/update.c @@ -0,0 +1,315 @@ +/* update.c + * + * Functions for RFC 2136 Dynamic Update + * + * Copyright (c) 2005-2008, NLnet Labs. All rights reserved. + * + * See LICENSE for the license. + */ + +#include + +#include + +#include +#include +#include + +/* + * RFC 2136 sections mapped to RFC 1035: + * zone/ZO -- QD/question + * prerequisites/PR -- AN/answers + * updates/UP -- NS/authority records + * additional data/AD -- AR/additional records + */ + +ldns_pkt * +ldns_update_pkt_new(ldns_rdf *zone_rdf, ldns_rr_class c, + ldns_rr_list *pr_rrlist, ldns_rr_list *up_rrlist, ldns_rr_list *ad_rrlist) +{ + ldns_pkt *p; + + if (!zone_rdf || !up_rrlist) { + return NULL; + } + + if (c == 0) { + c = LDNS_RR_CLASS_IN; + } + + /* Create packet, fill in Zone Section. */ + p = ldns_pkt_query_new(zone_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); + if (!p) { + return NULL; + } + zone_rdf = NULL; /* No longer safe to use. */ + + ldns_pkt_set_opcode(p, LDNS_PACKET_UPDATE); + + ldns_rr_list_deep_free(p->_authority); + + ldns_pkt_set_authority(p, ldns_rr_list_clone(up_rrlist)); + + ldns_update_set_upcount(p, ldns_rr_list_rr_count(up_rrlist)); + + if (pr_rrlist) { + ldns_rr_list_deep_free(p->_answer); /*XXX access function */ + ldns_pkt_set_answer(p, ldns_rr_list_clone(pr_rrlist)); + ldns_update_set_prcount(p, ldns_rr_list_rr_count(pr_rrlist)); + } + + if (ad_rrlist) { + ldns_rr_list_deep_free(p->_additional); + ldns_pkt_set_additional(p, ldns_rr_list_clone(ad_rrlist)); + ldns_update_set_adcount(p, ldns_rr_list_rr_count(ad_rrlist)); + } + return p; +} + +ldns_status +ldns_update_pkt_tsig_add(ldns_pkt *p, ldns_resolver *r) +{ +#ifdef HAVE_SSL + uint16_t fudge = 300; /* Recommended fudge. [RFC2845 6.4] */ + if (ldns_resolver_tsig_keyname(r) && ldns_resolver_tsig_keydata(r)) + return ldns_pkt_tsig_sign(p, ldns_resolver_tsig_keyname(r), + ldns_resolver_tsig_keydata(r), fudge, + ldns_resolver_tsig_algorithm(r), NULL); +#else + /* do nothing */ + (void)p; + (void)r; +#endif /* HAVE_SSL */ + /* No TSIG to do. */ + return LDNS_STATUS_OK; +} + +/* Move to higher.c or similar? */ +/* XXX doc */ +ldns_status +ldns_update_soa_mname(ldns_rdf *zone, ldns_resolver *r, + ldns_rr_class c, ldns_rdf **mname) +{ + ldns_rr *soa_rr; + ldns_pkt *query, *resp; + + /* Nondestructive, so clone 'zone' here */ + query = ldns_pkt_query_new(ldns_rdf_clone(zone), LDNS_RR_TYPE_SOA, + c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + /* Expect a SOA answer. */ + *mname = NULL; + while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_answer(resp)))) { + if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) + continue; + /* [RFC1035 3.3.13] */ + *mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); + break; + } + ldns_pkt_free(resp); + + return *mname ? LDNS_STATUS_OK : LDNS_STATUS_ERR; +} + +/* Try to get zone and MNAME from SOA queries. */ +ldns_status +ldns_update_soa_zone_mname(const char *fqdn, ldns_resolver *r, + ldns_rr_class c, ldns_rdf **zone_rdf, ldns_rdf **mname_rdf) +{ + ldns_rr *soa_rr, *rr; + ldns_rdf *soa_zone = NULL, *soa_mname = NULL; + ldns_rdf *ipaddr, *fqdn_rdf, *tmp; + ldns_rdf **nslist; + ldns_pkt *query, *resp; + size_t i; + + /* + * XXX Ok, this cannot be the best way to find this...? + * XXX (I run into weird cache-related stuff here) + */ + + /* Step 1 - first find a nameserver that should know *something* */ + fqdn_rdf = ldns_dname_new_frm_str(fqdn); + query = ldns_pkt_query_new(fqdn_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + fqdn_rdf = NULL; + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + /* XXX Is it safe to only look in authority section here? */ + while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_authority(resp)))) { + if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) + continue; + /* [RFC1035 3.3.13] */ + soa_mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); + break; + } + ldns_pkt_free(resp); + if (!soa_rr) { + return LDNS_STATUS_ERR; + } + + /* Step 2 - find SOA MNAME IP address, add to resolver */ + query = ldns_pkt_query_new(soa_mname, LDNS_RR_TYPE_A, c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + soa_mname = NULL; + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + if (ldns_pkt_ancount(resp) == 0) { + ldns_pkt_free(resp); + return LDNS_STATUS_ERR; + } + + /* XXX There may be more than one answer RR here. */ + rr = ldns_rr_list_pop_rr(ldns_pkt_answer(resp)); + ipaddr = ldns_rr_rdf(rr, 0); + + /* Put the SOA mname IP first in the nameserver list. */ + nslist = ldns_resolver_nameservers(r); + for (i = 0; i < ldns_resolver_nameserver_count(r); i++) { + if (ldns_rdf_compare(ipaddr, nslist[i]) == 0) { + if (i) { + tmp = nslist[0]; + nslist[0] = nslist[i]; + nslist[i] = tmp; + } + break; + } + } + if (i >= ldns_resolver_nameserver_count(r)) { + /* SOA mname was not part of the resolver so add it first. */ + (void) ldns_resolver_push_nameserver(r, ipaddr); + nslist = ldns_resolver_nameservers(r); + i = ldns_resolver_nameserver_count(r) - 1; + tmp = nslist[0]; + nslist[0] = nslist[i]; + nslist[i] = tmp; + } + ldns_pkt_free(resp); + + /* Make sure to ask the first in the list, i.e SOA mname */ + ldns_resolver_set_random(r, false); + + /* Step 3 - Redo SOA query, sending to SOA MNAME directly. */ + fqdn_rdf = ldns_dname_new_frm_str(fqdn); + query = ldns_pkt_query_new(fqdn_rdf, LDNS_RR_TYPE_SOA, c, LDNS_RD); + if (!query) { + return LDNS_STATUS_ERR; + } + fqdn_rdf = NULL; + + ldns_pkt_set_random_id(query); + if (ldns_resolver_send_pkt(&resp, r, query) != LDNS_STATUS_OK) { + ldns_pkt_free(query); + return LDNS_STATUS_ERR; + } + ldns_pkt_free(query); + if (!resp) { + return LDNS_STATUS_ERR; + } + + /* XXX Is it safe to only look in authority section here, too? */ + while ((soa_rr = ldns_rr_list_pop_rr(ldns_pkt_authority(resp)))) { + if (ldns_rr_get_type(soa_rr) != LDNS_RR_TYPE_SOA) + continue; + /* [RFC1035 3.3.13] */ + soa_mname = ldns_rdf_clone(ldns_rr_rdf(soa_rr, 0)); + soa_zone = ldns_rdf_clone(ldns_rr_owner(soa_rr)); + break; + } + ldns_pkt_free(resp); + if (!soa_rr) { + return LDNS_STATUS_ERR; + } + + /* That seems to have worked, pass results to caller. */ + *zone_rdf = soa_zone; + *mname_rdf = soa_mname; + return LDNS_STATUS_OK; +} + +/* + * ldns_update_{get,set}_{zo,pr,up,ad}count + */ + +uint16_t +ldns_update_zocount(const ldns_pkt *p) +{ + return ldns_pkt_qdcount(p); +} + +uint16_t +ldns_update_prcount(const ldns_pkt *p) +{ + return ldns_pkt_ancount(p); +} + +uint16_t +ldns_update_upcount(const ldns_pkt *p) +{ + return ldns_pkt_nscount(p); +} + +uint16_t +ldns_update_ad(const ldns_pkt *p) +{ + return ldns_pkt_arcount(p); +} + +void +ldns_update_set_zo(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_qdcount(p, v); +} + +void +ldns_update_set_prcount(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_ancount(p, v); +} + +void +ldns_update_set_upcount(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_nscount(p, v); +} + +void +ldns_update_set_adcount(ldns_pkt *p, uint16_t v) +{ + ldns_pkt_set_arcount(p, v); +} diff --git a/libs/ldns/util.c b/libs/ldns/util.c new file mode 100644 index 0000000000..eb24f81dbe --- /dev/null +++ b/libs/ldns/util.c @@ -0,0 +1,391 @@ +/* + * util.c + * + * some general memory functions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SSL +#include +#endif + +/* put this here tmp. for debugging */ +void +xprintf_rdf(ldns_rdf *rd) +{ + /* assume printable string */ + fprintf(stderr, "size\t:%u\n", (unsigned int)ldns_rdf_size(rd)); + fprintf(stderr, "type\t:%u\n", (unsigned int)ldns_rdf_get_type(rd)); + fprintf(stderr, "data\t:[%.*s]\n", (int)ldns_rdf_size(rd), + (char*)ldns_rdf_data(rd)); +} + +void +xprintf_rr(ldns_rr *rr) +{ + /* assume printable string */ + uint16_t count, i; + + count = ldns_rr_rd_count(rr); + + for(i = 0; i < count; i++) { + fprintf(stderr, "print rd %u\n", (unsigned int) i); + xprintf_rdf(rr->_rdata_fields[i]); + } +} + +void xprintf_hex(uint8_t *data, size_t len) +{ + size_t i; + for (i = 0; i < len; i++) { + if (i > 0 && i % 20 == 0) { + printf("\t; %u - %u\n", (unsigned int) i - 19, (unsigned int) i); + } + printf("%02x ", (unsigned int) data[i]); + } + printf("\n"); +} + +ldns_lookup_table * +ldns_lookup_by_name(ldns_lookup_table *table, const char *name) +{ + while (table->name != NULL) { + if (strcasecmp(name, table->name) == 0) + return table; + table++; + } + return NULL; +} + +ldns_lookup_table * +ldns_lookup_by_id(ldns_lookup_table *table, int id) +{ + while (table->name != NULL) { + if (table->id == id) + return table; + table++; + } + return NULL; +} + +int +ldns_get_bit(uint8_t bits[], size_t index) +{ + /* + * The bits are counted from left to right, so bit #0 is the + * left most bit. + */ + return (int) (bits[index / 8] & (1 << (7 - index % 8))); +} + +int +ldns_get_bit_r(uint8_t bits[], size_t index) +{ + /* + * The bits are counted from right to left, so bit #0 is the + * right most bit. + */ + return (int) bits[index / 8] & (1 << (index % 8)); +} + +void +ldns_set_bit(uint8_t *byte, int bit_nr, bool value) +{ + if (bit_nr >= 0 && bit_nr < 8) { + if (value) { + *byte = *byte | (0x01 << bit_nr); + } else { + *byte = *byte & ~(0x01 << bit_nr); + } + } +} + +int +ldns_hexdigit_to_int(char ch) +{ + switch (ch) { + case '0': return 0; + case '1': return 1; + case '2': return 2; + case '3': return 3; + case '4': return 4; + case '5': return 5; + case '6': return 6; + case '7': return 7; + case '8': return 8; + case '9': return 9; + case 'a': case 'A': return 10; + case 'b': case 'B': return 11; + case 'c': case 'C': return 12; + case 'd': case 'D': return 13; + case 'e': case 'E': return 14; + case 'f': case 'F': return 15; + default: + return -1; + } +} + +char +ldns_int_to_hexdigit(int i) +{ + switch (i) { + case 0: return '0'; + case 1: return '1'; + case 2: return '2'; + case 3: return '3'; + case 4: return '4'; + case 5: return '5'; + case 6: return '6'; + case 7: return '7'; + case 8: return '8'; + case 9: return '9'; + case 10: return 'a'; + case 11: return 'b'; + case 12: return 'c'; + case 13: return 'd'; + case 14: return 'e'; + case 15: return 'f'; + default: + abort(); + } +} + +int +ldns_hexstring_to_data(uint8_t *data, const char *str) +{ + size_t i; + + if (!str || !data) { + return -1; + } + + if (strlen(str) % 2 != 0) { + return -2; + } + + for (i = 0; i < strlen(str) / 2; i++) { + data[i] = + 16 * (uint8_t) ldns_hexdigit_to_int(str[i*2]) + + (uint8_t) ldns_hexdigit_to_int(str[i*2 + 1]); + } + + return (int) i; +} + +const char * +ldns_version(void) +{ + return (char*)LDNS_VERSION; +} + +/* Number of days per month (except for February in leap years). */ +static const int mdays[] = { + 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 +}; + +static int +is_leap_year(int year) +{ + return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0); +} + +static int +leap_days(int y1, int y2) +{ + --y1; + --y2; + return (y2/4 - y1/4) - (y2/100 - y1/100) + (y2/400 - y1/400); +} + +/* + * Code adapted from Python 2.4.1 sources (Lib/calendar.py). + */ +time_t +mktime_from_utc(const struct tm *tm) +{ + int year = 1900 + tm->tm_year; + time_t days = 365 * ((time_t) year - 1970) + leap_days(1970, year); + time_t hours; + time_t minutes; + time_t seconds; + int i; + + for (i = 0; i < tm->tm_mon; ++i) { + days += mdays[i]; + } + if (tm->tm_mon > 1 && is_leap_year(year)) { + ++days; + } + days += tm->tm_mday - 1; + + hours = days * 24 + tm->tm_hour; + minutes = hours * 60 + tm->tm_min; + seconds = minutes * 60 + tm->tm_sec; + + return seconds; +} + +/** + * Init the random source + * applications should call this if they need entropy data within ldns + * If openSSL is available, it is automatically seeded from /dev/urandom + * or /dev/random + * + * If you need more entropy, or have no openssl available, this function + * MUST be called at the start of the program + * + * If openssl *is* available, this function just adds more entropy + **/ +int +ldns_init_random(FILE *fd, unsigned int size) +{ + /* if fp is given, seed srandom with data from file + otherwise use /dev/urandom */ + FILE *rand_f; + uint8_t *seed; + size_t read = 0; + unsigned int seed_i; + struct timeval tv; + + /* we'll need at least sizeof(unsigned int) bytes for the + standard prng seed */ + if (size < (unsigned int) sizeof(seed_i)){ + size = (unsigned int) sizeof(seed_i); + } + + seed = LDNS_XMALLOC(uint8_t, size); + if(!seed) { + return 1; + } + + if (!fd) { + if ((rand_f = fopen("/dev/urandom", "r")) == NULL) { + /* no readable /dev/urandom, try /dev/random */ + if ((rand_f = fopen("/dev/random", "r")) == NULL) { + /* no readable /dev/random either, and no entropy + source given. we'll have to improvise */ + for (read = 0; read < size; read++) { + gettimeofday(&tv, NULL); + seed[read] = (uint8_t) (tv.tv_usec % 256); + } + } else { + read = fread(seed, 1, size, rand_f); + } + } else { + read = fread(seed, 1, size, rand_f); + } + } else { + rand_f = fd; + read = fread(seed, 1, size, rand_f); + } + + if (read < size) { + LDNS_FREE(seed); + return 1; + } else { +#ifdef HAVE_SSL + /* Seed the OpenSSL prng (most systems have it seeded + automatically, in that case this call just adds entropy */ + RAND_seed(seed, (int) size); +#else + /* Seed the standard prng, only uses the first + * unsigned sizeof(unsiged int) bytes found in the entropy pool + */ + memcpy(&seed_i, seed, sizeof(seed_i)); + srandom(seed_i); +#endif + LDNS_FREE(seed); + } + + if (!fd) { + if (rand_f) fclose(rand_f); + } + + return 0; +} + +/** + * Get random number. + * + */ +uint16_t +ldns_get_random(void) +{ + uint16_t rid = 0; +#ifdef HAVE_SSL + if (RAND_bytes((unsigned char*)&rid, 2) != 1) { + rid = (uint16_t) random(); + } +#else + rid = (uint16_t) random(); +#endif + return rid; +} + +/* + * BubbleBabble code taken from OpenSSH + * Copyright (c) 2001 Carsten Raskgaard. All rights reserved. + */ +char * +ldns_bubblebabble(uint8_t *data, size_t len) +{ + char vowels[] = { 'a', 'e', 'i', 'o', 'u', 'y' }; + char consonants[] = { 'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', + 'n', 'p', 'r', 's', 't', 'v', 'z', 'x' }; + size_t i, j = 0, rounds, seed = 1; + char *retval; + + rounds = (len / 2) + 1; + retval = LDNS_XMALLOC(char, rounds * 6); + if(!retval) return NULL; + retval[j++] = 'x'; + for (i = 0; i < rounds; i++) { + size_t idx0, idx1, idx2, idx3, idx4; + if ((i + 1 < rounds) || (len % 2 != 0)) { + idx0 = (((((size_t)(data[2 * i])) >> 6) & 3) + + seed) % 6; + idx1 = (((size_t)(data[2 * i])) >> 2) & 15; + idx2 = ((((size_t)(data[2 * i])) & 3) + + (seed / 6)) % 6; + retval[j++] = vowels[idx0]; + retval[j++] = consonants[idx1]; + retval[j++] = vowels[idx2]; + if ((i + 1) < rounds) { + idx3 = (((size_t)(data[(2 * i) + 1])) >> 4) & 15; + idx4 = (((size_t)(data[(2 * i) + 1]))) & 15; + retval[j++] = consonants[idx3]; + retval[j++] = '-'; + retval[j++] = consonants[idx4]; + seed = ((seed * 5) + + ((((size_t)(data[2 * i])) * 7) + + ((size_t)(data[(2 * i) + 1])))) % 36; + } + } else { + idx0 = seed % 6; + idx1 = 16; + idx2 = seed / 6; + retval[j++] = vowels[idx0]; + retval[j++] = consonants[idx1]; + retval[j++] = vowels[idx2]; + } + } + retval[j++] = 'x'; + retval[j++] = '\0'; + return retval; +} diff --git a/libs/ldns/wire2host.c b/libs/ldns/wire2host.c new file mode 100644 index 0000000000..e87fcdf5df --- /dev/null +++ b/libs/ldns/wire2host.c @@ -0,0 +1,456 @@ +/* + * wire2host.c + * + * conversion routines from the wire to the host + * format. + * This will usually just a re-ordering of the + * data (as we store it in network format) + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004-2006 + * + * See the file LICENSE for the license + */ + + +#include + +#include +/*#include */ + +#include +#include + + + +/* + * Set of macro's to deal with the dns message header as specified + * in RFC1035 in portable way. + * + */ + +/* + * + * 1 1 1 1 1 1 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ID | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * |QR| Opcode |AA|TC|RD|RA| Z|AD|CD| RCODE | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | QDCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ANCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | NSCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * | ARCOUNT | + * +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ + * + */ + + +/* allocates memory to *dname! */ +ldns_status +ldns_wire2dname(ldns_rdf **dname, const uint8_t *wire, size_t max, size_t *pos) +{ + uint8_t label_size; + uint16_t pointer_target; + uint8_t pointer_target_buf[2]; + size_t dname_pos = 0; + size_t uncompressed_length = 0; + size_t compression_pos = 0; + uint8_t tmp_dname[LDNS_MAX_DOMAINLEN]; + unsigned int pointer_count = 0; + + if (*pos >= max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + + label_size = wire[*pos]; + while (label_size > 0) { + /* compression */ + while (label_size >= 192) { + if (compression_pos == 0) { + compression_pos = *pos + 2; + } + + pointer_count++; + + /* remove first two bits */ + if (*pos + 2 > max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + pointer_target_buf[0] = wire[*pos] & 63; + pointer_target_buf[1] = wire[*pos + 1]; + pointer_target = ldns_read_uint16(pointer_target_buf); + + if (pointer_target == 0) { + return LDNS_STATUS_INVALID_POINTER; + } else if (pointer_target >= max) { + return LDNS_STATUS_INVALID_POINTER; + } else if (pointer_count > LDNS_MAX_POINTERS) { + return LDNS_STATUS_INVALID_POINTER; + } + *pos = pointer_target; + label_size = wire[*pos]; + } + if(label_size == 0) + break; /* break from pointer to 0 byte */ + if (label_size > LDNS_MAX_LABELLEN) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + if (*pos + 1 + label_size > max) { + return LDNS_STATUS_LABEL_OVERFLOW; + } + + /* check space for labelcount itself */ + if (dname_pos + 1 > LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + tmp_dname[dname_pos] = label_size; + if (label_size > 0) { + dname_pos++; + } + *pos = *pos + 1; + if (dname_pos + label_size > LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + memcpy(&tmp_dname[dname_pos], &wire[*pos], label_size); + uncompressed_length += label_size + 1; + dname_pos += label_size; + *pos = *pos + label_size; + + if (*pos < max) { + label_size = wire[*pos]; + } + } + + if (compression_pos > 0) { + *pos = compression_pos; + } else { + *pos = *pos + 1; + } + + if (dname_pos >= LDNS_MAX_DOMAINLEN) { + return LDNS_STATUS_DOMAINNAME_OVERFLOW; + } + + tmp_dname[dname_pos] = 0; + dname_pos++; + + *dname = ldns_rdf_new_frm_data(LDNS_RDF_TYPE_DNAME, + (uint16_t) dname_pos, tmp_dname); + if (!*dname) { + return LDNS_STATUS_MEM_ERR; + } + return LDNS_STATUS_OK; +} + +/* maybe make this a goto error so data can be freed or something/ */ +#define LDNS_STATUS_CHECK_RETURN(st) {if (st != LDNS_STATUS_OK) { return st; }} +#define LDNS_STATUS_CHECK_GOTO(st, label) {if (st != LDNS_STATUS_OK) { /*printf("STG %s:%d: status code %d\n", __FILE__, __LINE__, st);*/ goto label; }} + +ldns_status +ldns_wire2rdf(ldns_rr *rr, const uint8_t *wire, size_t max, size_t *pos) +{ + size_t end; + size_t cur_rdf_length; + uint8_t rdf_index; + uint8_t *data; + uint16_t rd_length; + ldns_rdf *cur_rdf = NULL; + ldns_rdf_type cur_rdf_type; + const ldns_rr_descriptor *descriptor = ldns_rr_descript(ldns_rr_get_type(rr)); + ldns_status status; + + if (*pos + 2 > max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + + rd_length = ldns_read_uint16(&wire[*pos]); + *pos = *pos + 2; + + if (*pos + rd_length > max) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + + end = *pos + (size_t) rd_length; + + for (rdf_index = 0; + rdf_index < ldns_rr_descriptor_maximum(descriptor); rdf_index++) { + if (*pos >= end) { + break; + } + cur_rdf_length = 0; + + cur_rdf_type = ldns_rr_descriptor_field_type(descriptor, rdf_index); + /* handle special cases immediately, set length + for fixed length rdata and do them below */ + switch (cur_rdf_type) { + case LDNS_RDF_TYPE_DNAME: + status = ldns_wire2dname(&cur_rdf, wire, max, pos); + LDNS_STATUS_CHECK_RETURN(status); + break; + case LDNS_RDF_TYPE_CLASS: + case LDNS_RDF_TYPE_ALG: + case LDNS_RDF_TYPE_INT8: + cur_rdf_length = LDNS_RDF_SIZE_BYTE; + break; + case LDNS_RDF_TYPE_TYPE: + case LDNS_RDF_TYPE_INT16: + case LDNS_RDF_TYPE_CERT_ALG: + cur_rdf_length = LDNS_RDF_SIZE_WORD; + break; + case LDNS_RDF_TYPE_TIME: + case LDNS_RDF_TYPE_INT32: + case LDNS_RDF_TYPE_A: + case LDNS_RDF_TYPE_PERIOD: + cur_rdf_length = LDNS_RDF_SIZE_DOUBLEWORD; + break; + case LDNS_RDF_TYPE_TSIGTIME: + cur_rdf_length = LDNS_RDF_SIZE_6BYTES; + break; + case LDNS_RDF_TYPE_AAAA: + cur_rdf_length = LDNS_RDF_SIZE_16BYTES; + break; + case LDNS_RDF_TYPE_STR: + case LDNS_RDF_TYPE_NSEC3_SALT: + /* len is stored in first byte + * it should be in the rdf too, so just + * copy len+1 from this position + */ + cur_rdf_length = ((size_t) wire[*pos]) + 1; + break; + case LDNS_RDF_TYPE_INT16_DATA: + cur_rdf_length = (size_t) ldns_read_uint16(&wire[*pos]) + 2; + break; + case LDNS_RDF_TYPE_B32_EXT: + case LDNS_RDF_TYPE_NSEC3_NEXT_OWNER: + /* length is stored in first byte */ + cur_rdf_length = ((size_t) wire[*pos]) + 1; + break; + case LDNS_RDF_TYPE_APL: + case LDNS_RDF_TYPE_B64: + case LDNS_RDF_TYPE_HEX: + case LDNS_RDF_TYPE_NSEC: + case LDNS_RDF_TYPE_UNKNOWN: + case LDNS_RDF_TYPE_SERVICE: + case LDNS_RDF_TYPE_LOC: + case LDNS_RDF_TYPE_WKS: + case LDNS_RDF_TYPE_NSAP: + case LDNS_RDF_TYPE_ATMA: + case LDNS_RDF_TYPE_IPSECKEY: + case LDNS_RDF_TYPE_TSIG: + case LDNS_RDF_TYPE_NONE: + /* + * Read to end of rr rdata + */ + cur_rdf_length = end - *pos; + break; + } + + /* fixed length rdata */ + if (cur_rdf_length > 0) { + if (cur_rdf_length + *pos > end) { + return LDNS_STATUS_PACKET_OVERFLOW; + } + data = LDNS_XMALLOC(uint8_t, rd_length); + if (!data) { + return LDNS_STATUS_MEM_ERR; + } + memcpy(data, &wire[*pos], cur_rdf_length); + + cur_rdf = ldns_rdf_new(cur_rdf_type, cur_rdf_length, data); + *pos = *pos + cur_rdf_length; + } + + if (cur_rdf) { + ldns_rr_push_rdf(rr, cur_rdf); + cur_rdf = NULL; + } + } + + return LDNS_STATUS_OK; +} + + +/* TODO: + can *pos be incremented at READ_INT? or maybe use something like + RR_CLASS(wire)? + uhhm Jelte?? +*/ +ldns_status +ldns_wire2rr(ldns_rr **rr_p, const uint8_t *wire, size_t max, + size_t *pos, ldns_pkt_section section) +{ + ldns_rdf *owner = NULL; + ldns_rr *rr = ldns_rr_new(); + ldns_status status; + + status = ldns_wire2dname(&owner, wire, max, pos); + LDNS_STATUS_CHECK_GOTO(status, status_error); + + ldns_rr_set_owner(rr, owner); + + if (*pos + 4 > max) { + status = LDNS_STATUS_PACKET_OVERFLOW; + goto status_error; + } + + ldns_rr_set_type(rr, ldns_read_uint16(&wire[*pos])); + *pos = *pos + 2; + + ldns_rr_set_class(rr, ldns_read_uint16(&wire[*pos])); + *pos = *pos + 2; + + if (section != LDNS_SECTION_QUESTION) { + if (*pos + 4 > max) { + status = LDNS_STATUS_PACKET_OVERFLOW; + goto status_error; + } + ldns_rr_set_ttl(rr, ldns_read_uint32(&wire[*pos])); + + *pos = *pos + 4; + status = ldns_wire2rdf(rr, wire, max, pos); + + LDNS_STATUS_CHECK_GOTO(status, status_error); + ldns_rr_set_question(rr, false); + } else { + ldns_rr_set_question(rr, true); + } + + *rr_p = rr; + return LDNS_STATUS_OK; + +status_error: + ldns_rr_free(rr); + return status; +} + +static ldns_status +ldns_wire2pkt_hdr(ldns_pkt *packet, const uint8_t *wire, size_t max, size_t *pos) +{ + if (*pos + LDNS_HEADER_SIZE > max) { + return LDNS_STATUS_WIRE_INCOMPLETE_HEADER; + } else { + ldns_pkt_set_id(packet, LDNS_ID_WIRE(wire)); + ldns_pkt_set_qr(packet, LDNS_QR_WIRE(wire)); + ldns_pkt_set_opcode(packet, LDNS_OPCODE_WIRE(wire)); + ldns_pkt_set_aa(packet, LDNS_AA_WIRE(wire)); + ldns_pkt_set_tc(packet, LDNS_TC_WIRE(wire)); + ldns_pkt_set_rd(packet, LDNS_RD_WIRE(wire)); + ldns_pkt_set_ra(packet, LDNS_RA_WIRE(wire)); + ldns_pkt_set_ad(packet, LDNS_AD_WIRE(wire)); + ldns_pkt_set_cd(packet, LDNS_CD_WIRE(wire)); + ldns_pkt_set_rcode(packet, LDNS_RCODE_WIRE(wire)); + + ldns_pkt_set_qdcount(packet, LDNS_QDCOUNT(wire)); + ldns_pkt_set_ancount(packet, LDNS_ANCOUNT(wire)); + ldns_pkt_set_nscount(packet, LDNS_NSCOUNT(wire)); + ldns_pkt_set_arcount(packet, LDNS_ARCOUNT(wire)); + + *pos += LDNS_HEADER_SIZE; + + return LDNS_STATUS_OK; + } +} + +ldns_status +ldns_buffer2pkt_wire(ldns_pkt **packet, ldns_buffer *buffer) +{ + /* lazy */ + return ldns_wire2pkt(packet, ldns_buffer_begin(buffer), + ldns_buffer_limit(buffer)); + +} + +ldns_status +ldns_wire2pkt(ldns_pkt **packet_p, const uint8_t *wire, size_t max) +{ + size_t pos = 0; + uint16_t i; + ldns_rr *rr; + ldns_pkt *packet = ldns_pkt_new(); + ldns_status status = LDNS_STATUS_OK; + int have_edns = 0; + + uint8_t data[4]; + + status = ldns_wire2pkt_hdr(packet, wire, max, &pos); + LDNS_STATUS_CHECK_GOTO(status, status_error); + + for (i = 0; i < ldns_pkt_qdcount(packet); i++) { + + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_QUESTION); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_QUESTION; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + if (!ldns_rr_list_push_rr(ldns_pkt_question(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + for (i = 0; i < ldns_pkt_ancount(packet); i++) { + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_ANSWER); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_ANSWER; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + if (!ldns_rr_list_push_rr(ldns_pkt_answer(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + for (i = 0; i < ldns_pkt_nscount(packet); i++) { + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_AUTHORITY); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_AUTHORITY; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + if (!ldns_rr_list_push_rr(ldns_pkt_authority(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + for (i = 0; i < ldns_pkt_arcount(packet); i++) { + status = ldns_wire2rr(&rr, wire, max, &pos, LDNS_SECTION_ADDITIONAL); + if (status == LDNS_STATUS_PACKET_OVERFLOW) { + status = LDNS_STATUS_WIRE_INCOMPLETE_ADDITIONAL; + } + LDNS_STATUS_CHECK_GOTO(status, status_error); + + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_OPT) { + ldns_pkt_set_edns_udp_size(packet, ldns_rr_get_class(rr)); + ldns_write_uint32(data, ldns_rr_ttl(rr)); + ldns_pkt_set_edns_extended_rcode(packet, data[0]); + ldns_pkt_set_edns_version(packet, data[1]); + ldns_pkt_set_edns_z(packet, ldns_read_uint16(&data[2])); + /* edns might not have rdfs */ + if (ldns_rr_rdf(rr, 0)) { + ldns_pkt_set_edns_data(packet, ldns_rdf_clone(ldns_rr_rdf(rr, 0))); + } + ldns_rr_free(rr); + have_edns += 1; + } else if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_TSIG) { + ldns_pkt_set_tsig(packet, rr); + ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) - 1); + } else if (!ldns_rr_list_push_rr(ldns_pkt_additional(packet), rr)) { + ldns_pkt_free(packet); + return LDNS_STATUS_INTERNAL_ERR; + } + } + ldns_pkt_set_size(packet, max); + if(have_edns) + ldns_pkt_set_arcount(packet, ldns_pkt_arcount(packet) + - have_edns); + + *packet_p = packet; + return status; + +status_error: + ldns_pkt_free(packet); + return status; +} diff --git a/libs/ldns/zone.c b/libs/ldns/zone.c new file mode 100644 index 0000000000..917af8befc --- /dev/null +++ b/libs/ldns/zone.c @@ -0,0 +1,430 @@ +/* zone.c + * + * Functions for ldns_zone structure + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * See the file LICENSE for the license + */ +#include + +#include + +#include +#include + +ldns_rr * +ldns_zone_soa(const ldns_zone *z) +{ + return z->_soa; +} + +size_t +ldns_zone_rr_count(const ldns_zone *z) +{ + return ldns_rr_list_rr_count(z->_rrs); +} + +void +ldns_zone_set_soa(ldns_zone *z, ldns_rr *soa) +{ + z->_soa = soa; +} + +ldns_rr_list * +ldns_zone_rrs(const ldns_zone *z) +{ + return z->_rrs; +} + +void +ldns_zone_set_rrs(ldns_zone *z, ldns_rr_list *rrlist) +{ + z->_rrs = rrlist; +} + +bool +ldns_zone_push_rr_list(ldns_zone *z, ldns_rr_list *list) +{ + return ldns_rr_list_cat(ldns_zone_rrs(z), list); + +} + +bool +ldns_zone_push_rr(ldns_zone *z, ldns_rr *rr) +{ + return ldns_rr_list_push_rr( ldns_zone_rrs(z), rr); +} + +/* return a clone of the given rr list, without the glue records + * rr list should be the complete zone + * if present, stripped records are added to the list *glue_records + */ +ldns_rr_list * +ldns_zone_strip_glue_rrs(const ldns_rdf *zone_name, const ldns_rr_list *rrs, ldns_rr_list *glue_rrs) +{ + ldns_rr_list *new_list; + + /* when do we find glue? It means we find an IP address + * (AAAA/A) for a nameserver listed in the zone + * + * Alg used here: + * first find all the zonecuts (NS records) + * find all the AAAA or A records (can be done it the + * above loop). + * + * Check if the aaaa/a list are subdomains under the + * NS domains. + * If yes -> glue, if no -> not glue + */ + + ldns_rr_list *zone_cuts; + ldns_rr_list *addr; + ldns_rr *r, *ns, *a; + ldns_rdf *dname_a, *ns_owner; + uint16_t i,j; + + new_list = NULL; + zone_cuts = NULL; + addr = NULL; + + new_list = ldns_rr_list_new(); + if (!new_list) goto memory_error; + zone_cuts = ldns_rr_list_new(); + if (!zone_cuts) goto memory_error; + addr = ldns_rr_list_new(); + if (!addr) goto memory_error; + + for(i = 0; i < ldns_rr_list_rr_count(rrs); i++) { + r = ldns_rr_list_rr(rrs, i); + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_A || + ldns_rr_get_type(r) == LDNS_RR_TYPE_AAAA) { + /* possibly glue */ + if (!ldns_rr_list_push_rr(addr, r)) goto memory_error; + continue; + } + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_NS) { + /* multiple zones will end up here - + * for now; not a problem + */ + /* don't add NS records for the current zone itself */ + if (ldns_rdf_compare(ldns_rr_owner(r), + zone_name) != 0) { + if (!ldns_rr_list_push_rr(zone_cuts, r)) goto memory_error; + } + continue; + } + } + + /* will sorting make it quicker ?? */ + for(i = 0; i < ldns_rr_list_rr_count(zone_cuts); i++) { + ns = ldns_rr_list_rr(zone_cuts, i); + ns_owner = ldns_rr_owner(ns); + for(j = 0; j < ldns_rr_list_rr_count(addr); j++) { + a = ldns_rr_list_rr(addr, j); + dname_a = ldns_rr_owner(a); + + if (ldns_dname_is_subdomain(dname_a, ns_owner)) { + /* GLUE! */ + if (glue_rrs) { + if (!ldns_rr_list_push_rr(glue_rrs, a)) goto memory_error; + } + break; + } else { + if (!ldns_rr_list_push_rr(new_list, a)) goto memory_error; + } + } + } + + ldns_rr_list_free(addr); + ldns_rr_list_free(zone_cuts); + + return new_list; + +memory_error: + if (new_list) { + ldns_rr_list_free(new_list); + } + if (zone_cuts) { + ldns_rr_list_free(zone_cuts); + } + if (addr) { + ldns_rr_list_free(addr); + } + return NULL; +} + +/* + * Get the list of glue records in a zone + * XXX: there should be a way for this to return error, other than NULL, + * since NULL is a valid return + */ +ldns_rr_list * +ldns_zone_glue_rr_list(const ldns_zone *z) +{ + /* when do we find glue? It means we find an IP address + * (AAAA/A) for a nameserver listed in the zone + * + * Alg used here: + * first find all the zonecuts (NS records) + * find all the AAAA or A records (can be done it the + * above loop). + * + * Check if the aaaa/a list are subdomains under the + * NS domains. + * If yes -> glue, if no -> not glue + */ + + ldns_rr_list *zone_cuts; + ldns_rr_list *addr; + ldns_rr_list *glue; + ldns_rr *r, *ns, *a; + ldns_rdf *dname_a, *ns_owner; + size_t i,j; + + zone_cuts = NULL; + addr = NULL; + glue = NULL; + + /* we cannot determine glue in a 'zone' without a SOA */ + if (!ldns_zone_soa(z)) { + return NULL; + } + + zone_cuts = ldns_rr_list_new(); + if (!zone_cuts) goto memory_error; + addr = ldns_rr_list_new(); + if (!addr) goto memory_error; + glue = ldns_rr_list_new(); + if (!glue) goto memory_error; + + for(i = 0; i < ldns_zone_rr_count(z); i++) { + r = ldns_rr_list_rr(ldns_zone_rrs(z), i); + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_A || + ldns_rr_get_type(r) == LDNS_RR_TYPE_AAAA) { + /* possibly glue */ + if (!ldns_rr_list_push_rr(addr, r)) goto memory_error; + continue; + } + if (ldns_rr_get_type(r) == LDNS_RR_TYPE_NS) { + /* multiple zones will end up here - + * for now; not a problem + */ + /* don't add NS records for the current zone itself */ + if (ldns_rdf_compare(ldns_rr_owner(r), + ldns_rr_owner(ldns_zone_soa(z))) != 0) { + if (!ldns_rr_list_push_rr(zone_cuts, r)) goto memory_error; + } + continue; + } + } + + /* will sorting make it quicker ?? */ + for(i = 0; i < ldns_rr_list_rr_count(zone_cuts); i++) { + ns = ldns_rr_list_rr(zone_cuts, i); + ns_owner = ldns_rr_owner(ns); + + for(j = 0; j < ldns_rr_list_rr_count(addr); j++) { + a = ldns_rr_list_rr(addr, j); + dname_a = ldns_rr_owner(a); + + if (ldns_dname_is_subdomain(dname_a, ns_owner)) { + /* GLUE! */ + if (!ldns_rr_list_push_rr(glue, a)) goto memory_error; + } + } + } + + ldns_rr_list_free(addr); + ldns_rr_list_free(zone_cuts); + + if (ldns_rr_list_rr_count(glue) == 0) { + ldns_rr_list_free(glue); + return NULL; + } else { + return glue; + } + +memory_error: + if (zone_cuts) { + LDNS_FREE(zone_cuts); + } + if (addr) { + ldns_rr_list_free(addr); + } + if (glue) { + ldns_rr_list_free(glue); + } + return NULL; +} + +ldns_zone * +ldns_zone_new(void) +{ + ldns_zone *z; + + z = LDNS_MALLOC(ldns_zone); + if (!z) { + return NULL; + } + + z->_rrs = ldns_rr_list_new(); + if (!z->_rrs) { + LDNS_FREE(z); + return NULL; + } + ldns_zone_set_soa(z, NULL); + return z; +} + +/* we regocnize: + * $TTL, $ORIGIN + */ +ldns_status +ldns_zone_new_frm_fp(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, ldns_rr_class c) +{ + return ldns_zone_new_frm_fp_l(z, fp, origin, ttl, c, NULL); +} + +/* XXX: class is never used */ +ldns_status +ldns_zone_new_frm_fp_l(ldns_zone **z, FILE *fp, ldns_rdf *origin, uint32_t ttl, + ldns_rr_class ATTR_UNUSED(c), int *line_nr) +{ + ldns_zone *newzone; + ldns_rr *rr; + uint32_t my_ttl; + ldns_rdf *my_origin; + ldns_rdf *my_prev; + bool soa_seen = false; /* 2 soa are an error */ + ldns_status s; + ldns_status ret; + + /* most cases of error are memory problems */ + ret = LDNS_STATUS_MEM_ERR; + + newzone = NULL; + my_origin = NULL; + my_prev = NULL; + + my_ttl = ttl; + + if (origin) { + my_origin = ldns_rdf_clone(origin); + if (!my_origin) goto error; + /* also set the prev */ + my_prev = ldns_rdf_clone(origin); + if (!my_prev) goto error; + } + + newzone = ldns_zone_new(); + if (!newzone) goto error; + + while(!feof(fp)) { + s = ldns_rr_new_frm_fp_l(&rr, fp, &my_ttl, &my_origin, &my_prev, line_nr); + switch (s) { + case LDNS_STATUS_OK: + if (ldns_rr_get_type(rr) == LDNS_RR_TYPE_SOA) { + if (soa_seen) { + /* second SOA + * just skip, maybe we want to say + * something??? */ + ldns_rr_free(rr); + continue; + } + soa_seen = true; + ldns_zone_set_soa(newzone, rr); + /* set origin to soa if not specified */ + if (!my_origin) { + my_origin = ldns_rdf_clone(ldns_rr_owner(rr)); + } + continue; + } + + /* a normal RR - as sofar the DNS is normal */ + if (!ldns_zone_push_rr(newzone, rr)) goto error; + + case LDNS_STATUS_SYNTAX_EMPTY: + /* empty line was seen */ + case LDNS_STATUS_SYNTAX_TTL: + /* the function set the ttl */ + break; + case LDNS_STATUS_SYNTAX_ORIGIN: + /* the function set the origin */ + break; + case LDNS_STATUS_SYNTAX_INCLUDE: + ret = LDNS_STATUS_SYNTAX_INCLUDE_ERR_NOTIMPL; + break; + default: + ret = s; + goto error; + } + } + + if (my_origin) { + ldns_rdf_deep_free(my_origin); + } + if (my_prev) { + ldns_rdf_deep_free(my_prev); + } + if (z) { + *z = newzone; + } else { + ldns_zone_free(newzone); + } + + return LDNS_STATUS_OK; + +error: + if (my_origin) { + ldns_rdf_deep_free(my_origin); + } + if (my_prev) { + ldns_rdf_deep_free(my_prev); + } + if (newzone) { + ldns_zone_free(newzone); + } + return ret; +} + +void +ldns_zone_sort(ldns_zone *zone) +{ + ldns_rr_list *zrr; + assert(zone != NULL); + + zrr = ldns_zone_rrs(zone); + ldns_rr_list_sort(zrr); +} + +#if 0 +/** + * ixfr function. Work on a ldns_zone and remove and add + * the rrs from the rrlist + * \param[in] z the zone to work on + * \param[in] del rr_list to remove from the zone + * \param[in] add rr_list to add to the zone + * \return Tja, wat zouden we eens returnen TODO + */ +void +ldns_zone_ixfr_del_add(ldns_zone *z, ldns_rr_list *del, ldns_rr_list *add) +{ + +} +#endif + +void +ldns_zone_free(ldns_zone *zone) +{ + ldns_rr_list_free(zone->_rrs); + LDNS_FREE(zone); +} + +void +ldns_zone_deep_free(ldns_zone *zone) +{ + ldns_rr_free(zone->_soa); + ldns_rr_list_deep_free(zone->_rrs); + LDNS_FREE(zone); +} From 710fc7a7759274be154d3cae2f54a2a6dc765303 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 25 Mar 2011 11:31:12 -0500 Subject: [PATCH 138/558] select on FD > 1024 get this patch to ldns ppl --- libs/ldns/ldns/ldns.h | 10 +++++ libs/ldns/net.c | 99 ++++++++++++++++++++----------------------- libs/ldns/resolver.c | 33 +++++---------- 3 files changed, 67 insertions(+), 75 deletions(-) diff --git a/libs/ldns/ldns/ldns.h b/libs/ldns/ldns/ldns.h index 6f57733750..7ad5a3a2d7 100644 --- a/libs/ldns/ldns/ldns.h +++ b/libs/ldns/ldns/ldns.h @@ -148,6 +148,16 @@ extern ldns_lookup_table ldns_opcodes[]; /** EDNS flags */ extern ldns_lookup_table ldns_edns_flags[]; + +#ifdef USE_WINSOCK +#define SOCK_INVALID INVALID_SOCKET +#define close_socket(_s) if (_s > SOCK_INVALID) {closesocket(_s); _s = SOCK_INVALID;} +#else +#define SOCK_INVALID -1 +#define close_socket(_s) if (_s > SOCK_INVALID) {close(_s); _s = SOCK_INVALID;} +#endif + + #ifdef __cplusplus } #endif diff --git a/libs/ldns/net.c b/libs/ldns/net.c index bf8766b990..f613ac3083 100644 --- a/libs/ldns/net.c +++ b/libs/ldns/net.c @@ -261,12 +261,18 @@ ldns_sock_block(int sockfd) #endif } +#ifndef WIN32 +#include +#endif + /** wait for a socket to become ready */ static int ldns_sock_wait(int sockfd, struct timeval timeout, int write) { - fd_set fds; int ret; + +#ifdef WIN32 + fd_set fds; #ifndef S_SPLINT_S FD_ZERO(&fds); FD_SET(FD_SET_T sockfd, &fds); @@ -275,6 +281,26 @@ ldns_sock_wait(int sockfd, struct timeval timeout, int write) ret = select(sockfd+1, NULL, &fds, NULL, &timeout); else ret = select(sockfd+1, &fds, NULL, NULL, &timeout); +#else + + struct pollfd pfds[2]; + int x = 0; + + memset(&pfds[0], 0, sizeof(pfds[0]) * 2); + + pfds[0].fd = sockfd; + pfds[0].events = POLLIN|POLLERR; + + if (write) { + pfds[0].events |= POLLOUT; + } + + ret = poll(pfds, 1, timeout.tv_sec * 1000 + timeout.tv_usec / 1000); + +#endif + + + if(ret == 0) /* timeout expired */ return 0; @@ -299,11 +325,7 @@ ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage /* wait for an response*/ if(!ldns_sock_wait(sockfd, timeout, 0)) { -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif + close_socket(sockfd); return LDNS_STATUS_NETWORK_ERR; } @@ -313,11 +335,7 @@ ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage ldns_sock_nonblock(sockfd); answer = ldns_udp_read_wire(sockfd, answer_size, NULL, NULL); -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif + close_socket(sockfd); if (*answer_size == 0) { /* oops */ @@ -353,9 +371,10 @@ ldns_udp_connect(const struct sockaddr_storage *to, struct timeval ATTR_UNUSED(t if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_DGRAM, IPPROTO_UDP)) - == -1) { + == SOCK_INVALID) { return 0; } + return sockfd; } @@ -366,20 +385,20 @@ ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, int sockfd; if ((sockfd = socket((int)((struct sockaddr*)to)->sa_family, SOCK_STREAM, - IPPROTO_TCP)) == -1) { + IPPROTO_TCP)) == SOCK_INVALID) { return 0; } /* perform nonblocking connect, to be able to wait with select() */ ldns_sock_nonblock(sockfd); - if (connect(sockfd, (struct sockaddr*)to, tolen) == -1) { + if (connect(sockfd, (struct sockaddr*)to, tolen) == SOCK_INVALID) { #ifndef USE_WINSOCK #ifdef EINPROGRESS if(errno != EINPROGRESS) { #else if(1) { #endif - close(sockfd); + close_socket(sockfd); return 0; } #else /* USE_WINSOCK */ @@ -398,11 +417,7 @@ ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, socklen_t len = (socklen_t)sizeof(error); if(!ldns_sock_wait(sockfd, timeout, 1)) { -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif + close_socket(sockfd); return 0; } @@ -421,7 +436,7 @@ ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, continue; /* try again */ #endif else if(error != 0) { - close(sockfd); + close_socket(sockfd); /* error in errno for our user */ errno = error; return 0; @@ -645,11 +660,7 @@ ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storag } answer = ldns_tcp_read_wire_timeout(sockfd, answer_size, timeout); -#ifndef USE_WINSOCK - close(sockfd); -#else - closesocket(sockfd); -#endif + close_socket(sockfd); if (*answer_size == 0) { /* oops */ @@ -782,7 +793,7 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) * @hostname is used */ for (ns_i = 0; ns_i < ldns_resolver_nameserver_count(resolver) && - resolver->_socket == 0; + resolver->_socket == SOCK_INVALID; ns_i++) { ns = ldns_rdf2native_sockaddr_storage( resolver->_nameservers[ns_i], @@ -792,7 +803,7 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) ldns_resolver_timeout(resolver)); } - if (resolver->_socket == 0) { + if (resolver->_socket == SOCK_INVALID) { ldns_pkt_free(query); LDNS_FREE(ns); return LDNS_STATUS_NETWORK_ERR; @@ -807,13 +818,7 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) if (status != LDNS_STATUS_OK) { /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start we have to close the socket here! */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; - + close_socket(resolver->_socket); return LDNS_STATUS_CRYPTO_TSIG_ERR; } } @@ -826,12 +831,8 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) if(!query_wire) { ldns_pkt_free(query); LDNS_FREE(ns); -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; + + close_socket(resolver->_socket); return LDNS_STATUS_MEM_ERR; } @@ -843,12 +844,8 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start we have to close the socket here! */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; + + close_socket(resolver->_socket); return status; } @@ -862,12 +859,8 @@ ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class class) /* RoRi: to prevent problems on subsequent calls to ldns_axfr_start we have to close the socket here! */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; + + close_socket(resolver->_socket); return LDNS_STATUS_NETWORK_ERR; } diff --git a/libs/ldns/resolver.c b/libs/ldns/resolver.c index 735e6f147d..ace59f6944 100644 --- a/libs/ldns/resolver.c +++ b/libs/ldns/resolver.c @@ -627,9 +627,7 @@ ldns_resolver_new(void) r->_timeout.tv_sec = LDNS_DEFAULT_TIMEOUT_SEC; r->_timeout.tv_usec = LDNS_DEFAULT_TIMEOUT_USEC; - /* TODO: fd=0 is actually a valid socket (stdin), - replace with -1 */ - r->_socket = 0; + r->_socket = -1; r->_axfr_soa_count = 0; r->_axfr_i = 0; r->_cur_axfr_pkt = NULL; @@ -903,6 +901,8 @@ ldns_resolver_deep_free(ldns_resolver *res) size_t i; if (res) { + close_socket(res->_socket); + if (res->_searchlist) { for (i = 0; i < ldns_resolver_searchlist_count(res); i++) { ldns_rdf_deep_free(res->_searchlist[i]); @@ -1198,7 +1198,7 @@ ldns_axfr_next(ldns_resolver *resolver) ldns_status status; /* check if start() has been called */ - if (!resolver || resolver->_socket == 0) { + if (!resolver || resolver->_socket == -1) { return NULL; } @@ -1215,12 +1215,9 @@ ldns_axfr_next(ldns_resolver *resolver) if (ldns_rr_get_type(cur_rr) == LDNS_RR_TYPE_SOA) { resolver->_axfr_soa_count++; if (resolver->_axfr_soa_count >= 2) { -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; + + close_socket(resolver->_socket); + ldns_pkt_free(resolver->_cur_axfr_pkt); resolver->_cur_axfr_pkt = NULL; } @@ -1243,12 +1240,8 @@ ldns_axfr_next(ldns_resolver *resolver) /* RoRi: we must now also close the socket, otherwise subsequent uses of the same resolver structure will fail because the link is still open or in an undefined state */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; + + close_socket(resolver->_socket); return NULL; } else if (ldns_pkt_get_rcode(resolver->_cur_axfr_pkt) != 0) { @@ -1258,12 +1251,8 @@ ldns_axfr_next(ldns_resolver *resolver) /* RoRi: we must now also close the socket, otherwise subsequent uses of the same resolver structure will fail because the link is still open or in an undefined state */ -#ifndef USE_WINSOCK - close(resolver->_socket); -#else - closesocket(resolver->_socket); -#endif - resolver->_socket = 0; + + close_socket(resolver->_socket); return NULL; } else { From e0eb284ef49d9ebe231dbae78ff897047558503b Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 25 Mar 2011 11:46:58 -0500 Subject: [PATCH 139/558] ldns initial round for windows compatibility --- libs/ldns/compat/b32_ntop.c | 2 ++ libs/ldns/compat/b32_pton.c | 2 ++ libs/ldns/compat/b64_ntop.c | 2 ++ libs/ldns/compat/b64_pton.c | 2 ++ libs/ldns/compat/fake-rfc2553.c | 2 ++ libs/ldns/compat/fake-rfc2553.h | 4 +++ libs/ldns/compat/gettimeofday.c | 50 +++++++++++++++++++++++++++++++++ libs/ldns/compat/gettimeofday.h | 11 ++++++++ libs/ldns/compat/inet_aton.c | 2 ++ libs/ldns/compat/inet_ntop.c | 2 ++ libs/ldns/compat/malloc.c | 2 ++ libs/ldns/compat/memmove.c | 2 ++ libs/ldns/compat/realloc.c | 2 ++ libs/ldns/dnssec.c | 4 +++ libs/ldns/dnssec_sign.c | 4 +++ libs/ldns/dnssec_verify.c | 4 +++ libs/ldns/host2str.c | 2 ++ libs/ldns/ldns/packet.h | 4 +++ libs/ldns/ldns/resolver.h | 4 +++ libs/ldns/net.c | 7 ++++- libs/ldns/packet.c | 4 +++ libs/ldns/parse.c | 4 +++ libs/ldns/resolver.c | 4 +++ libs/ldns/rr.c | 4 +++ libs/ldns/rr_functions.c | 4 +++ libs/ldns/sha1.c | 4 +++ libs/ldns/tsig.c | 4 +++ libs/ldns/update.c | 4 +++ libs/ldns/util.c | 8 ++++++ libs/ldns/wire2host.c | 4 +++ libs/ldns/zone.c | 4 +++ 31 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 libs/ldns/compat/gettimeofday.c create mode 100644 libs/ldns/compat/gettimeofday.h diff --git a/libs/ldns/compat/b32_ntop.c b/libs/ldns/compat/b32_ntop.c index 038ebdc958..f6fa95c58c 100644 --- a/libs/ldns/compat/b32_ntop.c +++ b/libs/ldns/compat/b32_ntop.c @@ -42,7 +42,9 @@ #include #include +#ifndef _MSC_VER #include +#endif #ifdef HAVE_SYS_SOCKET_H #include #endif diff --git a/libs/ldns/compat/b32_pton.c b/libs/ldns/compat/b32_pton.c index 9c261e615b..766f5fa4b4 100644 --- a/libs/ldns/compat/b32_pton.c +++ b/libs/ldns/compat/b32_pton.c @@ -42,7 +42,9 @@ #include #include +#ifndef _MSC_VER #include +#endif #ifdef HAVE_SYS_SOCKET_H #include #endif diff --git a/libs/ldns/compat/b64_ntop.c b/libs/ldns/compat/b64_ntop.c index d0b52b514b..c9f605e901 100644 --- a/libs/ldns/compat/b64_ntop.c +++ b/libs/ldns/compat/b64_ntop.c @@ -42,7 +42,9 @@ #include #include +#ifndef _MSC_VER #include +#endif #ifdef HAVE_SYS_SOCKET_H #include #endif diff --git a/libs/ldns/compat/b64_pton.c b/libs/ldns/compat/b64_pton.c index aa637d2275..98fdddb6d3 100644 --- a/libs/ldns/compat/b64_pton.c +++ b/libs/ldns/compat/b64_pton.c @@ -42,7 +42,9 @@ #include #include +#ifndef _MSC_VER #include +#endif #ifdef HAVE_SYS_SOCKET_H #include #endif diff --git a/libs/ldns/compat/fake-rfc2553.c b/libs/ldns/compat/fake-rfc2553.c index 431e04a215..28e8b4211f 100644 --- a/libs/ldns/compat/fake-rfc2553.c +++ b/libs/ldns/compat/fake-rfc2553.c @@ -38,7 +38,9 @@ #include #include +#ifndef _MSC_VER #include +#endif #include #include #include diff --git a/libs/ldns/compat/fake-rfc2553.h b/libs/ldns/compat/fake-rfc2553.h index 4c277ee902..2eab0c8bc4 100644 --- a/libs/ldns/compat/fake-rfc2553.h +++ b/libs/ldns/compat/fake-rfc2553.h @@ -40,8 +40,12 @@ #define _FAKE_RFC2553_H #include +#ifdef _MSC_VER +#include +#else #include #include +#endif #include #ifdef __cplusplus diff --git a/libs/ldns/compat/gettimeofday.c b/libs/ldns/compat/gettimeofday.c new file mode 100644 index 0000000000..3d1fb12810 --- /dev/null +++ b/libs/ldns/compat/gettimeofday.c @@ -0,0 +1,50 @@ +#include + +#ifndef HAVE_GETTIMEOFDAY + +#include < time.h > +#include < windows.h> +#include + +#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS) +#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64 +#else +#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL +#endif + +int gettimeofday(struct timeval *tv, struct timezone *tz) +{ + FILETIME ft; + unsigned __int64 tmpres = 0; + static int tzflag; + + if (NULL != tv) + { + GetSystemTimeAsFileTime(&ft); + + tmpres |= ft.dwHighDateTime; + tmpres <<= 32; + tmpres |= ft.dwLowDateTime; + + /*converting file time to unix epoch*/ + tmpres /= 10; /*convert into microseconds*/ + tmpres -= DELTA_EPOCH_IN_MICROSECS; + tv->tv_sec = (long)(tmpres / 1000000UL); + tv->tv_usec = (long)(tmpres % 1000000UL); + } + + if (NULL != tz) + { + if (!tzflag) + { + _tzset(); + tzflag++; + } + tz->tz_minuteswest = _timezone / 60; + tz->tz_dsttime = _daylight; + } + + return 0; +} + +#endif \ No newline at end of file diff --git a/libs/ldns/compat/gettimeofday.h b/libs/ldns/compat/gettimeofday.h new file mode 100644 index 0000000000..5a929fe082 --- /dev/null +++ b/libs/ldns/compat/gettimeofday.h @@ -0,0 +1,11 @@ +#ifndef HAVE_GETTIMEOFDAY + +struct timezone +{ + int tz_minuteswest; /* minutes W of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +int gettimeofday(struct timeval *tv, struct timezone *tz); + +#endif \ No newline at end of file diff --git a/libs/ldns/compat/inet_aton.c b/libs/ldns/compat/inet_aton.c index e8c3a57b9a..86cd1125a5 100644 --- a/libs/ldns/compat/inet_aton.c +++ b/libs/ldns/compat/inet_aton.c @@ -55,7 +55,9 @@ #if !defined(HAVE_INET_ATON) #include +#ifndef _MSC_VER #include +#endif #ifdef HAVE_NETINET_IN_H #include #endif diff --git a/libs/ldns/compat/inet_ntop.c b/libs/ldns/compat/inet_ntop.c index 57509c7c98..bb7b067ec3 100644 --- a/libs/ldns/compat/inet_ntop.c +++ b/libs/ldns/compat/inet_ntop.c @@ -21,7 +21,9 @@ #ifndef HAVE_INET_NTOP +#ifndef _MSC_VER #include +#endif #include #ifdef HAVE_SYS_SOCKET_H #include diff --git a/libs/ldns/compat/malloc.c b/libs/ldns/compat/malloc.c index bbc632e4f6..d51d4b0a92 100644 --- a/libs/ldns/compat/malloc.c +++ b/libs/ldns/compat/malloc.c @@ -8,7 +8,9 @@ #include +#ifndef _MSC_VER void *malloc (); +#endif /* Allocate an N-byte block of memory from the heap. If N is zero, allocate a 1-byte block. */ diff --git a/libs/ldns/compat/memmove.c b/libs/ldns/compat/memmove.c index e458092c33..8f3f54f5cc 100644 --- a/libs/ldns/compat/memmove.c +++ b/libs/ldns/compat/memmove.c @@ -9,6 +9,7 @@ #include #include +#ifndef _MSC_VER void *memmove(void *dest, const void *src, size_t n); void *memmove(void *dest, const void *src, size_t n) @@ -41,3 +42,4 @@ void *memmove(void *dest, const void *src, size_t n) memcpy(dest, src, n); return dest; } +#endif diff --git a/libs/ldns/compat/realloc.c b/libs/ldns/compat/realloc.c index bdaf76d026..348d3a28f4 100644 --- a/libs/ldns/compat/realloc.c +++ b/libs/ldns/compat/realloc.c @@ -8,8 +8,10 @@ #include +#ifndef _MSC_VER void *realloc (void*, size_t); void *malloc (size_t); +#endif /* Changes allocation to new sizes, copies over old data. * if oldptr is NULL, does a malloc. diff --git a/libs/ldns/dnssec.c b/libs/ldns/dnssec.c index ce02ef36fd..9a444cf9c3 100644 --- a/libs/ldns/dnssec.c +++ b/libs/ldns/dnssec.c @@ -14,7 +14,11 @@ #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #include #ifdef HAVE_SSL diff --git a/libs/ldns/dnssec_sign.c b/libs/ldns/dnssec_sign.c index b21094465f..4da125ee31 100644 --- a/libs/ldns/dnssec_sign.c +++ b/libs/ldns/dnssec_sign.c @@ -5,7 +5,11 @@ #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #include #ifdef HAVE_SSL diff --git a/libs/ldns/dnssec_verify.c b/libs/ldns/dnssec_verify.c index 352e44066b..23d9a43d8a 100644 --- a/libs/ldns/dnssec_verify.c +++ b/libs/ldns/dnssec_verify.c @@ -2,7 +2,11 @@ #include +#ifdef _MSC_VER +#include +#else #include +#endif #include #ifdef HAVE_SSL diff --git a/libs/ldns/host2str.c b/libs/ldns/host2str.c index 6942f6aa3c..7f2ed574fa 100644 --- a/libs/ldns/host2str.c +++ b/libs/ldns/host2str.c @@ -26,7 +26,9 @@ #include #endif #include +#ifndef _MSC_VER #include +#endif #ifndef INET_ADDRSTRLEN #define INET_ADDRSTRLEN 16 diff --git a/libs/ldns/ldns/packet.h b/libs/ldns/ldns/packet.h index 687a6a2595..35d5832d76 100644 --- a/libs/ldns/ldns/packet.h +++ b/libs/ldns/ldns/packet.h @@ -35,7 +35,11 @@ #include #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #ifdef __cplusplus extern "C" { diff --git a/libs/ldns/ldns/resolver.h b/libs/ldns/ldns/resolver.h index f887aaf676..d61f524d84 100644 --- a/libs/ldns/ldns/resolver.h +++ b/libs/ldns/ldns/resolver.h @@ -26,7 +26,11 @@ #include #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #ifdef __cplusplus extern "C" { diff --git a/libs/ldns/net.c b/libs/ldns/net.c index f613ac3083..5523a6f0f5 100644 --- a/libs/ldns/net.c +++ b/libs/ldns/net.c @@ -27,7 +27,12 @@ #ifdef HAVE_ARPA_INET_H #include #endif +#ifdef _MSC_VER +#include +#include +#else #include +#endif #include #include @@ -275,7 +280,7 @@ ldns_sock_wait(int sockfd, struct timeval timeout, int write) fd_set fds; #ifndef S_SPLINT_S FD_ZERO(&fds); - FD_SET(FD_SET_T sockfd, &fds); + FD_SET(sockfd, &fds); #endif if(write) ret = select(sockfd+1, NULL, &fds, NULL, &timeout); diff --git a/libs/ldns/packet.c b/libs/ldns/packet.c index 0ac5ca8ba3..3bced3b69e 100644 --- a/libs/ldns/packet.c +++ b/libs/ldns/packet.c @@ -14,7 +14,11 @@ #include +#ifdef _MSC_VER +#include +#else #include +#endif #include #ifdef HAVE_SSL diff --git a/libs/ldns/parse.c b/libs/ldns/parse.c index 0487873520..56c05be47c 100644 --- a/libs/ldns/parse.c +++ b/libs/ldns/parse.c @@ -11,7 +11,11 @@ #include #include +#ifdef _MSC_VER +#include +#else #include +#endif ldns_lookup_table ldns_directive_types[] = { { LDNS_DIR_TTL, "$TTL" }, diff --git a/libs/ldns/resolver.c b/libs/ldns/resolver.c index ace59f6944..4aca068300 100644 --- a/libs/ldns/resolver.c +++ b/libs/ldns/resolver.c @@ -13,7 +13,11 @@ #include #include +#ifdef _MSC_VER +#include +#else #include +#endif /* Access function for reading * and setting the different Resolver diff --git a/libs/ldns/rr.c b/libs/ldns/rr.c index 7b799b9b56..25c7cc72ff 100644 --- a/libs/ldns/rr.c +++ b/libs/ldns/rr.c @@ -11,7 +11,11 @@ #include +#ifdef _MSC_VER +#include +#else #include +#endif #include #include diff --git a/libs/ldns/rr_functions.c b/libs/ldns/rr_functions.c index 700372b91c..1a4a75868d 100644 --- a/libs/ldns/rr_functions.c +++ b/libs/ldns/rr_functions.c @@ -18,7 +18,11 @@ #include #include +#ifdef _MSC_VER +#include +#else #include +#endif /** * return a specific rdf diff --git a/libs/ldns/sha1.c b/libs/ldns/sha1.c index 5dec680a1b..89da614c10 100644 --- a/libs/ldns/sha1.c +++ b/libs/ldns/sha1.c @@ -19,7 +19,11 @@ #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) diff --git a/libs/ldns/tsig.c b/libs/ldns/tsig.c index 7fcf21da0e..c9001a9994 100644 --- a/libs/ldns/tsig.c +++ b/libs/ldns/tsig.c @@ -11,7 +11,11 @@ #include +#ifdef _MSC_VER +#include +#else #include +#endif #ifdef HAVE_SSL #include diff --git a/libs/ldns/update.c b/libs/ldns/update.c index 01e67aa069..a6b2abc902 100644 --- a/libs/ldns/update.c +++ b/libs/ldns/update.c @@ -11,7 +11,11 @@ #include +#ifdef _MSC_VER +#include +#else #include +#endif #include #include diff --git a/libs/ldns/util.c b/libs/ldns/util.c index eb24f81dbe..355da14e8e 100644 --- a/libs/ldns/util.c +++ b/libs/ldns/util.c @@ -15,10 +15,18 @@ #include #include #include +#ifdef _MSC_VER +#include +#else #include +#endif #include #include +#ifndef _MSC_VER #include +#else +#include +#endif #include #ifdef HAVE_SSL diff --git a/libs/ldns/wire2host.c b/libs/ldns/wire2host.c index e87fcdf5df..9b94046c61 100644 --- a/libs/ldns/wire2host.c +++ b/libs/ldns/wire2host.c @@ -19,7 +19,11 @@ #include /*#include */ +#ifdef _MSC_VER +#include +#else #include +#endif #include diff --git a/libs/ldns/zone.c b/libs/ldns/zone.c index 917af8befc..c71f123e58 100644 --- a/libs/ldns/zone.c +++ b/libs/ldns/zone.c @@ -10,7 +10,11 @@ #include +#ifdef _MSC_VER +#include +#else #include +#endif #include ldns_rr * From 294b0779779aefac4eef9f7fa8f6062e625f7da3 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Fri, 25 Mar 2011 12:17:13 -0500 Subject: [PATCH 140/558] FS-3182: fix mod_dingaling/iksemel/gnutls link error when using newer autotools --- acinclude.m4 | 1 + build/modmake.rules.in | 1 + configure.in | 2 ++ src/mod/endpoints/mod_dingaling/Makefile | 2 ++ 4 files changed, 6 insertions(+) diff --git a/acinclude.m4 b/acinclude.m4 index 705b9458b5..aeba17b5c3 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -12,4 +12,5 @@ m4_include([build/config/sched_setaffinity.m4]) m4_include([libs/apr/build/apr_common.m4]) m4_include([libs/sofia-sip/m4/sac-pkg-config.m4]) m4_include([libs/sofia-sip/m4/sac-openssl.m4]) +m4_include([libs/iksemel/build/libgnutls.m4]) m4_include([build/config/libcurl.m4]) diff --git a/build/modmake.rules.in b/build/modmake.rules.in index f1b30c8a18..51923ec3dd 100644 --- a/build/modmake.rules.in +++ b/build/modmake.rules.in @@ -27,6 +27,7 @@ INSTALL=@INSTALL@ GETLIB=@GETLIB@ LIBTOOL=@LIBTOOL@ AR=@AR@ +LIBGNUTLS_LIBS=@LIBGNUTLS_LIBS@ LTINSTALL=$(LIBTOOL) --quiet --mode=install $(INSTALL) LTUNINSTALL=$(LIBTOOL) --mode=uninstall rm -f CCLD = $(CC) diff --git a/configure.in b/configure.in index d56116a9a6..4ae6dc7b59 100644 --- a/configure.in +++ b/configure.in @@ -144,6 +144,8 @@ if test "${enable_optimizer}" = "yes" ; then AX_CC_MAXOPT fi +AX_PATH_LIBGNUTLS() + # set defaults for use on all platforms SWITCH_AM_CFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src" SWITCH_AM_CXXFLAGS="-I${switch_srcdir}/src/include -I${switch_builddir}/src/include -I${switch_srcdir}/libs/libteletone/src" diff --git a/src/mod/endpoints/mod_dingaling/Makefile b/src/mod/endpoints/mod_dingaling/Makefile index d23c3b200c..f2ac13bb7a 100644 --- a/src/mod/endpoints/mod_dingaling/Makefile +++ b/src/mod/endpoints/mod_dingaling/Makefile @@ -10,8 +10,10 @@ DING_DIR=$(BASE)/libs/libdingaling LOCAL_CFLAGS += -I$(DING_DIR)/src -I$(BASE)/libs/iksemel/include LOCAL_OBJS=$(DING_DIR)/src/libdingaling.o $(DING_DIR)/src/sha1.o $(IKS_LA) LOCAL_SOURCES=$(DING_DIR)/src/libdingaling.c $(DING_DIR)/src/sha1.c +LOCAL_LDFLAGS=$(LIBGNUTLS_LIBS) include $(BASE)/build/modmake.rules + $(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update @cd $(IKS_DIR) && $(MAKE) @$(TOUCH_TARGET) From 85602f9b8cd374b2f502babd5c0210d8cc7dab12 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 25 Mar 2011 12:43:12 -0500 Subject: [PATCH 141/558] add win ldns project for vs2010 --- libs/win32/ldns/ldns-lib/config.h | 439 ++++++++++++++++++ .../win32/ldns/ldns-lib/ldns-lib.2010.vcxproj | 231 +++++++++ .../ldns-lib/ldns-lib.2010.vcxproj.filters | 258 ++++++++++ libs/win32/ldns/ldns-lib/net.h | 195 ++++++++ libs/win32/ldns/ldns-lib/util.h | 326 +++++++++++++ 5 files changed, 1449 insertions(+) create mode 100644 libs/win32/ldns/ldns-lib/config.h create mode 100644 libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj create mode 100644 libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj.filters create mode 100644 libs/win32/ldns/ldns-lib/net.h create mode 100644 libs/win32/ldns/ldns-lib/util.h diff --git a/libs/win32/ldns/ldns-lib/config.h b/libs/win32/ldns/ldns-lib/config.h new file mode 100644 index 0000000000..49b455a0a3 --- /dev/null +++ b/libs/win32/ldns/ldns-lib/config.h @@ -0,0 +1,439 @@ +/* ldns/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H + +/* Whether the C compiler accepts the "format" attribute */ +#undef HAVE_ATTR_FORMAT + +/* Whether the C compiler accepts the "unused" attribute */ +#undef HAVE_ATTR_UNUSED + +/* Define to 1 if you have the `b32_ntop' function. */ +#undef HAVE_B32_NTOP + +/* Define to 1 if you have the `b32_pton' function. */ +#undef HAVE_B32_PTON + +/* Define to 1 if you have the `b64_ntop' function. */ +#undef HAVE_B64_NTOP + +/* Define to 1 if you have the `b64_pton' function. */ +#undef HAVE_B64_PTON + +/* Define to 1 if you have the `ctime_r' function. */ +#undef HAVE_CTIME_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `endprotoent' function. */ +#undef HAVE_ENDPROTOENT + +/* Define to 1 if you have the `endservent' function. */ +#undef HAVE_ENDSERVENT + +/* Define to 1 if you have the `EVP_sha256' function. */ +#undef HAVE_EVP_SHA256 + +/* Whether getaddrinfo is available */ +#undef HAVE_GETADDRINFO + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `gmtime_r' function. */ +#undef HAVE_GMTIME_R + +/* If you have HMAC_CTX_init */ +#undef HAVE_HMAC_CTX_INIT + +/* Define to 1 if you have the `inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define to 1 if you have the `inet_ntop' function. */ +#undef HAVE_INET_NTOP + +/* Define to 1 if you have the `inet_pton' function. */ +#undef HAVE_INET_PTON + +/* define if you have inttypes.h */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `isblank' function. */ +#undef HAVE_ISBLANK + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#undef HAVE_LIBCRYPTO + +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define to 1 if you have the `socket' library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define to 1 if your system has a GNU libc compatible `malloc' function, and + to 0 otherwise. */ +#define HAVE_MALLOC 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_ERR_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_RAND_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_OPENSSL_SSL_H + +/* Define to 1 if you have the `random' function. */ +#define HAVE_RANDOM 1 + +/* Define to 1 if your system has a GNU libc compatible `realloc' function, + and to 0 otherwise. */ +#define HAVE_REALLOC 1 + +/* Define to 1 if you have the `sleep' function. */ +#undef HAVE_SLEEP + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define if you have the SSL libraries installed. */ +#undef HAVE_SSL + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDBOOL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strlcpy' function. */ +#undef HAVE_STRLCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MOUNT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* define if you have sys/socket.h */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_WS2TCPIP_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* System configuration dir */ +#undef SYSCONFDIR + +/* Define this to enable GOST support. */ +#undef USE_GOST + +/* Define this to enable SHA256 and SHA512 support. */ +#undef USE_SHA2 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif + + +/* Whether the windows socket API is used */ +#define USE_WINSOCK + +/* the version of the windows API enabled */ +//#undef WINVER + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to 1 if on MINIX. */ +#undef _MINIX + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +#undef _POSIX_1_SOURCE + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +#undef _POSIX_SOURCE + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* in_addr_t */ +#undef in_addr_t + +/* in_port_t */ +#undef in_port_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#define inline +#endif + +/* Define to `short' if does not define. */ +#undef int16_t + +/* Define to `int' if does not define. */ +#undef int32_t + +/* Define to `long long' if does not define. */ +#undef int64_t + +/* Define to `char' if does not define. */ +#undef int8_t + +/* Define to rpl_malloc if the replacement function should be used. */ +#undef malloc + +/* Define to rpl_realloc if the replacement function should be used. */ +#undef realloc + +/* Define to 'int' if not defined */ +#undef socklen_t + +/* Define to `int' if does not define. */ +#define ssize_t int + +/* Define to `unsigned short' if does not define. */ +#define uint16_t unsigned short + +#define int16_t short + +/* Define to `unsigned int' if does not define. */ +#define uint32_t unsigned int + +/* Define to `unsigned long long' if does not define. */ +#define uint64_t unsigned long long + +/* Define to `unsigned char' if does not define. */ +#define uint8_t unsigned char + +#define int8_t char + +#include +#include +//#include +#include + +#ifndef LITTLE_ENDIAN +#define LITTLE_ENDIAN 1234 +#endif + +#ifndef BIG_ENDIAN +#define BIG_ENDIAN 4321 +#endif + +#ifndef BYTE_ORDER +#ifdef WORDS_BIGENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif /* WORDS_BIGENDIAN */ +#endif /* BYTE_ORDER */ + +#if STDC_HEADERS +#include +#include +#endif + +#ifdef HAVE_STDINT_H +#include +#endif + +#ifdef HAVE_SYS_SOCKET_H +#include +#endif + +#ifdef HAVE_NETINET_IN_H +#include +#endif + +#ifdef HAVE_ARPA_INET_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + +#ifdef _MSC_VER +#define snprintf _snprintf +#define vsnprintf _vsnprintf +#define strcasecmp _stricmp +#define strncasecmp _strnicmp +#define strdup _strdup +/* +#define gmtime gmtime_s +#define ctime ctime_s +#define strcpy strcpu_s +*/ +#define putenv _putenv +#define srandom srand +#define random rand +#endif + +#ifndef B64_PTON +int ldns_b64_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b64_ntop + */ +/*@unused@*/ +inline static size_t ldns_b64_ntop_calculate_size(size_t srcsize) +{ + return ((((srcsize + 2) / 3) * 4) + 1); +} +#endif /* !B64_PTON */ +#ifndef B64_NTOP +int ldns_b64_pton(char const *src, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of ldns_b64_pton + */ +/*@unused@*/ +inline static size_t ldns_b64_pton_calculate_size(size_t srcsize) +{ + return ((((srcsize / 4) * 3) - 2) + 2); +} +#endif /* !B64_NTOP */ + +#ifndef HAVE_SLEEP +/* use windows sleep, in millisecs, instead */ +#define sleep(x) Sleep((x)*1000) +#endif + +#ifndef HAVE_RANDOM +#define srandom(x) srand(x) +#define random(x) rand(x) +#endif + +#ifndef HAVE_TIMEGM +#include +time_t timegm (struct tm *tm); +#endif /* !TIMEGM */ +#ifndef HAVE_GMTIME_R +struct tm *gmtime_r(const time_t *timep, struct tm *result); +#endif +#ifndef HAVE_ISBLANK +int isblank(int c); +#endif /* !HAVE_ISBLANK */ +#ifndef HAVE_SNPRINTF +#include +int snprintf (char *str, size_t count, const char *fmt, ...); +int vsnprintf (char *str, size_t count, const char *fmt, va_list arg); +#endif /* HAVE_SNPRINTF */ +#ifndef HAVE_INET_PTON +int inet_pton(int af, const char* src, void* dst); +#endif /* HAVE_INET_PTON */ +#ifndef HAVE_INET_NTOP +const char *inet_ntop(int af, const void *src, char *dst, size_t size); +#endif +#ifndef HAVE_INET_ATON +int inet_aton(const char *cp, struct in_addr *addr); +#endif +#ifndef HAVE_MEMMOVE +void *memmove(void *dest, const void *src, size_t n); +#endif +#ifndef HAVE_STRLCPY +size_t strlcpy(char *dst, const char *src, size_t siz); +#endif +#ifndef HAVE_GETADDRINFO +#include "compat/fake-rfc2553.h" +#endif + diff --git a/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj new file mode 100644 index 0000000000..e10a283c3d --- /dev/null +++ b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj @@ -0,0 +1,231 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + ldns + {23B4D303-79FC-49E0-89E2-2280E7E28940} + ldns + + + + StaticLibrary + MultiByte + true + + + StaticLibrary + MultiByte + true + + + StaticLibrary + MultiByte + + + StaticLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + AllRules.ruleset + AllRules.ruleset + + + + + AllRules.ruleset + AllRules.ruleset + + + + + + + + Disabled + .;%(AdditionalIncludeDirectories) + HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + Level3 + EditAndContinue + + + + + Disabled + .;%(AdditionalIncludeDirectories) + HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) + EnableFastChecks + MultiThreadedDebugDLL + Level3 + ProgramDatabase + + + + + MaxSpeed + true + MultiThreadedDLL + true + Level3 + ProgramDatabase + HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;_MBCS;%(PreprocessorDefinitions) + + + true + true + true + MachineX86 + + + + + MaxSpeed + true + MultiThreadedDLL + true + Level3 + ProgramDatabase + HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;_MBCS;%(PreprocessorDefinitions) + ..\..\..\ldns\;. + + + true + true + true + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" > "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" > "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" > "$(ProjectDir)..\..\..\ldns\ldns\net.h" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj.filters b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj.filters new file mode 100644 index 0000000000..c76a57ea6f --- /dev/null +++ b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj.filters @@ -0,0 +1,258 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Header Files + + + + \ No newline at end of file diff --git a/libs/win32/ldns/ldns-lib/net.h b/libs/win32/ldns/ldns-lib/net.h new file mode 100644 index 0000000000..19b6d784e6 --- /dev/null +++ b/libs/win32/ldns/ldns-lib/net.h @@ -0,0 +1,195 @@ +/* + * net.h + * + * DNS Resolver definitions + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2005-2006 + * + * See the file LICENSE for the license + */ + +#ifndef LDNS_NET_H +#define LDNS_NET_H + +#include +#ifdef _MSC_VER +#include +#define socklen_t int +#define in_port_t USHORT +#define in_addr_t UINT +#else +#include +#include +#endif + +#define LDNS_DEFAULT_TIMEOUT_SEC 2 +#define LDNS_DEFAULT_TIMEOUT_USEC 0 + +/** + * \file + * + * Contains functions to send and receive packets over a network. + */ + +/** + * Sends a buffer to an ip using udp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \param[out] result packet with the answer + * \return status + */ +ldns_status ldns_udp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); + +/** + * Send an udp query and don't wait for an answer but return + * the socket + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \return the socket used + */ + +int ldns_udp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Send an tcp query and don't wait for an answer but return + * the socket + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \return the socket used + */ +int ldns_tcp_bgsend(ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Sends a buffer to an ip using tcp and return the respons as a ldns_pkt + * \param[in] qbin the ldns_buffer to be send + * \param[in] qbin the ldns_buffer to be send + * \param[in] to the ip addr to send to + * \param[in] tolen length of the ip addr + * \param[in] timeout the timeout value for the network + * \param[out] answersize size of the packet + * \param[out] result packet with the answer + * \return status + */ +ldns_status ldns_tcp_send(uint8_t **result, ldns_buffer *qbin, const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout, size_t *answersize); + +/** + * Sends ptk to the nameserver at the resolver object. Returns the data + * as a ldns_pkt + * + * \param[out] pkt packet received from the nameserver + * \param[in] r the resolver to use + * \param[in] query_pkt the query to send + * \return status + */ +ldns_status ldns_send(ldns_pkt **pkt, ldns_resolver *r, const ldns_pkt *query_pkt); + +/** + * Sends and ldns_buffer (presumably containing a packet to the nameserver at the resolver object. Returns the data + * as a ldns_pkt + * + * \param[out] pkt packet received from the nameserver + * \param[in] r the resolver to use + * \param[in] qb the buffer to send + * \param[in] tsig_mac the tsig MAC to authenticate the response with (NULL to do no TSIG authentication) + * \return status + */ +ldns_status ldns_send_buffer(ldns_pkt **pkt, ldns_resolver *r, ldns_buffer *qb, ldns_rdf *tsig_mac); + +/** + * Create a tcp socket to the specified address + * \param[in] to ip and family + * \param[in] tolen length of to + * \param[in] timeout timeout for the socket + * \return a socket descriptor + */ +int ldns_tcp_connect(const struct sockaddr_storage *to, socklen_t tolen, struct timeval timeout); + +/** + * Create a udp socket to the specified address + * \param[in] to ip and family + * \param[in] timeout timeout for the socket + * \return a socket descriptor + */ +int ldns_udp_connect(const struct sockaddr_storage *to, struct timeval timeout); + +/** + * send a query via tcp to a server. Don't want for the answer + * + * \param[in] qbin the buffer to send + * \param[in] sockfd the socket to use + * \param[in] to which ip to send it + * \param[in] tolen socketlen + * \return number of bytes sent + */ +ssize_t ldns_tcp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); + +/** + * send a query via udp to a server. Don;t want for the answer + * + * \param[in] qbin the buffer to send + * \param[in] sockfd the socket to use + * \param[in] to which ip to send it + * \param[in] tolen socketlen + * \return number of bytes sent + */ +ssize_t ldns_udp_send_query(ldns_buffer *qbin, int sockfd, const struct sockaddr_storage *to, socklen_t tolen); +/** + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[out] size the number of bytes that are read + * \return the data read + */ +uint8_t *ldns_tcp_read_wire(int sockfd, size_t *size); + +/** + * Gives back a raw packet from the wire and reads the header data from the given + * socket. Allocates the data (of size size) itself, so don't forget to free + * + * \param[in] sockfd the socket to read from + * \param[in] fr the address of the client (if applicable) + * \param[in] *frlen the lenght of the client's addr (if applicable) + * \param[out] size the number of bytes that are read + * \return the data read + */ +uint8_t *ldns_udp_read_wire(int sockfd, size_t *size, struct sockaddr_storage *fr, socklen_t *frlen); + +/** + * returns the native sockaddr representation from the rdf. + * \param[in] rd the ldns_rdf to operate on + * \param[in] port what port to use. 0 means; use default (53) + * \param[out] size what is the size of the sockaddr_storage + * \return struct sockaddr* the address in the format so other + * functions can use it (sendto) + */ +struct sockaddr_storage * ldns_rdf2native_sockaddr_storage(const ldns_rdf *rd, uint16_t port, size_t *size); + +/** + * returns an rdf with the sockaddr info. works for ip4 and ip6 + * \param[in] sock the struct sockaddr_storage to convert + * \param[in] port what port was used. When NULL this is not set + * \return ldns_rdf* wth the address + */ +ldns_rdf * ldns_sockaddr_storage2rdf(struct sockaddr_storage *sock, uint16_t *port); + +/** + * Prepares the resolver for an axfr query + * The query is sent and the answers can be read with ldns_axfr_next + * \param[in] resolver the resolver to use + * \param[in] domain the domain to exfr + * \param[in] c the class to use + * \return ldns_status the status of the transfer + */ +ldns_status ldns_axfr_start(ldns_resolver *resolver, ldns_rdf *domain, ldns_rr_class c); + +#endif /* LDNS_NET_H */ diff --git a/libs/win32/ldns/ldns-lib/util.h b/libs/win32/ldns/ldns-lib/util.h new file mode 100644 index 0000000000..add9a79c33 --- /dev/null +++ b/libs/win32/ldns/ldns-lib/util.h @@ -0,0 +1,326 @@ +/* + * util.h + * + * helper function header file + * + * a Net::DNS like library for C + * + * (c) NLnet Labs, 2004 + * + * See the file LICENSE for the license + */ + +#ifndef _UTIL_H +#define _UTIL_H + +//@include_inttypes_h@ +#include +#include +#include + +#define dprintf(X,Y) fprintf(stderr, (X), (Y)) +/* #define dprintf(X, Y) */ + +#define LDNS_VERSION "@PACKAGE_VERSION@" + +/** + * splint static inline workaround + */ +#ifdef S_SPLINT_S +#define INLINE +#else +#define INLINE static inline +#endif + +/** + * Memory management macros + */ +#define LDNS_MALLOC(type) LDNS_XMALLOC(type, 1) + +#define LDNS_XMALLOC(type, count) ((type *) malloc((count) * sizeof(type))) + +#define LDNS_REALLOC(ptr, type) LDNS_XREALLOC((ptr), type, 1) + +#define LDNS_XREALLOC(ptr, type, count) \ + ((type *) realloc((ptr), (count) * sizeof(type))) + +#define LDNS_FREE(ptr) \ + do { free((ptr)); (ptr) = NULL; } while (0) + +#define LDNS_DEP printf("DEPRECATED FUNCTION!\n"); + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE uint16_t +ldns_read_uint16(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohs(*(uint16_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ((uint16_t) p[0] << 8) | (uint16_t) p[1]; +#endif +} + +INLINE uint32_t +ldns_read_uint32(const void *src) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + return ntohl(*(uint32_t *) src); +#else + uint8_t *p = (uint8_t *) src; + return ( ((uint32_t) p[0] << 24) + | ((uint32_t) p[1] << 16) + | ((uint32_t) p[2] << 8) + | (uint32_t) p[3]); +#endif +} + +/* + * Copy data allowing for unaligned accesses in network byte order + * (big endian). + */ +INLINE void +ldns_write_uint16(void *dst, uint16_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint16_t *) dst = htons(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 8) & 0xff); + p[1] = (uint8_t) (data & 0xff); +#endif +} + +INLINE void +ldns_write_uint32(void *dst, uint32_t data) +{ +#ifdef ALLOW_UNALIGNED_ACCESSES + * (uint32_t *) dst = htonl(data); +#else + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 24) & 0xff); + p[1] = (uint8_t) ((data >> 16) & 0xff); + p[2] = (uint8_t) ((data >> 8) & 0xff); + p[3] = (uint8_t) (data & 0xff); +#endif +} + +/* warning. */ +INLINE void +ldns_write_uint64_as_uint48(void *dst, uint64_t data) +{ + uint8_t *p = (uint8_t *) dst; + p[0] = (uint8_t) ((data >> 40) & 0xff); + p[1] = (uint8_t) ((data >> 32) & 0xff); + p[2] = (uint8_t) ((data >> 24) & 0xff); + p[3] = (uint8_t) ((data >> 16) & 0xff); + p[4] = (uint8_t) ((data >> 8) & 0xff); + p[5] = (uint8_t) (data & 0xff); +} + + +/** + * Structure to do a Schwartzian-like transformation, for instance when + * sorting. If you need a transformation on the objects that are sorted, + * you can sue this to store the transformed values, so you do not + * need to do the transformation again for each comparison + */ +struct ldns_schwartzian_compare_struct { + void *original_object; + void *transformed_object; +}; + +/** A general purpose lookup table + * + * Lookup tables are arrays of (id, name) pairs, + * So you can for instance lookup the RCODE 3, which is "NXDOMAIN", + * and vice versa. The lookup tables themselves are defined wherever needed, + * for instance in \ref host2str.c + */ +struct ldns_struct_lookup_table { + int id; + const char *name; +}; +typedef struct ldns_struct_lookup_table ldns_lookup_table; + +/** + * Looks up the table entry by name, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] name what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_name(ldns_lookup_table table[], + const char *name); + +/** + * Looks up the table entry by id, returns NULL if not found. + * \param[in] table the lookup table to search in + * \param[in] id what to search for + * \return the item found + */ +ldns_lookup_table *ldns_lookup_by_id(ldns_lookup_table table[], int id); + +/** + * Returns the value of the specified bit + * The bits are counted from left to right, so bit #0 is the + * left most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return + */ +int ldns_get_bit(uint8_t bits[], size_t index); + + +/** + * Returns the value of the specified bit + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] bits array holding the bits + * \param[in] index to the wanted bit + * \return 1 or 0 depending no the bit state + */ +int ldns_get_bit_r(uint8_t bits[], size_t index); + +/** + * sets the specified bit in the specified byte to + * 1 if value is true, 0 if false + * The bits are counted from right to left, so bit #0 is the + * right most bit. + * \param[in] byte the bit to set the bit in + * \param[in] bit_nr the bit to set (0 <= n <= 7) + * \param[in] value whether to set the bit to 1 or 0 + * \return 1 or 0 depending no the bit state + */ +void ldns_set_bit(uint8_t *byte, int bit_nr, bool value); + +/** + * Returns the value of a to the power of b + * (or 1 of b < 1) + */ +/*@unused@*/ +INLINE long +ldns_power(long a, long b) { + long result = 1; + while (b > 0) { + if (b & 1) { + result *= a; + if (b == 1) { + return result; + } + } + a *= a; + b /= 2; + } + return result; +} + +/** + * Returns the int value of the given (hex) digit + * \param[in] ch the hex char to convert + * \return the converted decimal value + */ +int ldns_hexdigit_to_int(char ch); + +/** + * Returns the char (hex) representation of the given int + * \param[in] ch the int to convert + * \return the converted hex char + */ +char ldns_int_to_hexdigit(int ch); + +/** + * Converts a hex string to binary data + * + * \param[out] data The binary result is placed here. + * At least strlen(str)/2 bytes should be allocated + * \param[in] str The hex string to convert. + * This string should not contain spaces + * \return The number of bytes of converted data, or -1 if one of the arguments * is NULL, or -2 if the string length is not an even number + */ +int +ldns_hexstring_to_data(uint8_t *data, const char *str); + +/** + * Show the internal library version + * \return a string with the version in it + */ +const char * ldns_version(void); + +/** + * Convert TM to seconds since epoch (midnight, January 1st, 1970). + * Like timegm(3), which is not always available. + * \param[in] tm a struct tm* with the date + * \return the seconds since epoch + */ +time_t mktime_from_utc(const struct tm *tm); + +/** + * Seed the random function. + * If the file descriptor is specified, the random generator is seeded with + * data from that file. If not, /dev/urandom is used. + * + * applications should call this if they need entropy data within ldns + * If openSSL is available, it is automatically seeded from /dev/urandom + * or /dev/random. + * + * If you need more entropy, or have no openssl available, this function + * MUST be called at the start of the program + * + * If openssl *is* available, this function just adds more entropy + * + * \param[in] fd a file providing entropy data for the seed + * \param[in] size the number of bytes to use as entropy data. If this is 0, + * only the minimal amount is taken (usually 4 bytes) + * \return 0 if seeding succeeds, 1 if it fails + */ +int ldns_init_random(FILE *fd, unsigned int size); + + +/** + * Encode data as BubbleBabble + * + * \param[in] data a pointer to data to be encoded + * \param[in] len size the number of bytes of data + * \return a string of BubbleBabble + */ +char *ldns_bubblebabble(uint8_t *data, size_t len); + +#ifndef B32_NTOP +int ldns_b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int ldns_b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +int b32_ntop_extended_hex(uint8_t const *src, size_t srclength, + char *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_ntop + */ +/*@unused@*/ +static inline size_t ldns_b32_ntop_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize / 5) * 8) - 2) + 2); + return result; +} +#endif /* !B32_NTOP */ +#ifndef B32_PTON +int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize); +/** + * calculates the size needed to store the result of b32_pton + */ +/*@unused@*/ +static inline size_t ldns_b32_pton_calculate_size(size_t srcsize) +{ + size_t result = ((((srcsize) / 8) * 5)); + return result; +} +#endif /* !B32_PTON */ + +#endif /* !_UTIL_H */ From ffa45b8a0a930a2adc9ea67812877cf25ee96c0c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 25 Mar 2011 14:49:14 -0400 Subject: [PATCH 142/558] freetdm: ISDN - fixed channel restart command not specifying channel ID --- .../ftmod_sangoma_isdn_stack_hndl.c | 2 +- .../ftmod_sangoma_isdn_stack_out.c | 19 ++++++++++++++----- .../ftmod_sangoma_isdn_support.c | 4 ---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 01d5de7f8d..b1af8a61c3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -662,7 +662,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing RELEASE but channel in RESET state, ignoring\n"); break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RELEASE in an invalid state (%s)\n", diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index b56c95b10d..674e642719 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -60,7 +60,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - set_chan_id_ie(ftdmchan, &conEvnt.chanId); + set_chan_id_ie(ftdmchan, &conEvnt.chanId); set_bear_cap_ie(ftdmchan, &conEvnt.bearCap[0]); set_called_num(ftdmchan, &conEvnt.cdPtyNmb); set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); @@ -125,8 +125,11 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) } memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + + /* Indicate channel ID only in first response */ + if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + } ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT COMPL (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -152,7 +155,10 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_i memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + /* Indicate channel ID only in first response */ + if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + } set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); @@ -238,7 +244,10 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + /* Indicate channel ID only in first response */ + if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + } set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 0f9a5ebeb3..0ac52b085c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -830,10 +830,6 @@ ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId) return FTDM_SUCCESS; } - if (ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { - /* Indicate channel ID only in first response */ - return FTDM_SUCCESS; - } ftdm_set_flag(sngisdn_info, FLAG_SENT_CHAN_ID); chanId->eh.pres = PRSNT_NODEF; From 9f449b338f270e444d7359d04fb1e79767a3d98e Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 25 Mar 2011 14:49:14 -0400 Subject: [PATCH 143/558] freetdm: ISDN - fixed channel restart command not specifying channel ID --- .../ftmod_sangoma_isdn_stack_hndl.c | 2 +- .../ftmod_sangoma_isdn_stack_out.c | 19 ++++++++++++++----- .../ftmod_sangoma_isdn_support.c | 4 ---- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index 01d5de7f8d..b1af8a61c3 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -662,7 +662,7 @@ void sngisdn_process_rel_ind (sngisdn_event_data_t *sngisdn_event) } break; case FTDM_CHANNEL_STATE_RESET: - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing SETUP but channel in RESET state, ignoring\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Processing RELEASE but channel in RESET state, ignoring\n"); break; default: ftdm_log_chan(ftdmchan, FTDM_LOG_CRIT, "Received RELEASE in an invalid state (%s)\n", diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c index b56c95b10d..674e642719 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_out.c @@ -60,7 +60,7 @@ void sngisdn_snd_setup(ftdm_channel_t *ftdmchan) } ftdm_log_chan(sngisdn_info->ftdmchan, FTDM_LOG_INFO, "Outgoing call: Called No:[%s] Calling No:[%s]\n", ftdmchan->caller_data.dnis.digits, ftdmchan->caller_data.cid_num.digits); - set_chan_id_ie(ftdmchan, &conEvnt.chanId); + set_chan_id_ie(ftdmchan, &conEvnt.chanId); set_bear_cap_ie(ftdmchan, &conEvnt.bearCap[0]); set_called_num(ftdmchan, &conEvnt.cdPtyNmb); set_calling_num(ftdmchan, &conEvnt.cgPtyNmb); @@ -125,8 +125,11 @@ void sngisdn_snd_con_complete(ftdm_channel_t *ftdmchan) } memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + + /* Indicate channel ID only in first response */ + if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + } ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Sending CONNECT COMPL (suId:%d suInstId:%u spInstId:%u dchan:%d ces:%d)\n", signal_data->cc_id, sngisdn_info->suInstId, sngisdn_info->spInstId, signal_data->dchan_id, sngisdn_info->ces); @@ -152,7 +155,10 @@ void sngisdn_snd_proceed(ftdm_channel_t *ftdmchan, ftdm_sngisdn_progind_t prog_i memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + /* Indicate channel ID only in first response */ + if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + } set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); @@ -238,7 +244,10 @@ void sngisdn_snd_connect(ftdm_channel_t *ftdmchan) memset(&cnStEvnt, 0, sizeof(cnStEvnt)); - set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + /* Indicate channel ID only in first response */ + if (!ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { + set_chan_id_ie(ftdmchan, &cnStEvnt.chanId); + } set_prog_ind_ie(ftdmchan, &cnStEvnt.progInd, prog_ind); set_facility_ie(ftdmchan, &cnStEvnt.facilityStr); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 0f9a5ebeb3..0ac52b085c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -830,10 +830,6 @@ ftdm_status_t set_chan_id_ie(ftdm_channel_t *ftdmchan, ChanId *chanId) return FTDM_SUCCESS; } - if (ftdm_test_flag(sngisdn_info, FLAG_SENT_CHAN_ID)) { - /* Indicate channel ID only in first response */ - return FTDM_SUCCESS; - } ftdm_set_flag(sngisdn_info, FLAG_SENT_CHAN_ID); chanId->eh.pres = PRSNT_NODEF; From dc35bb965b5eb3f92030596570f84936228efb1d Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 25 Mar 2011 14:16:23 -0500 Subject: [PATCH 144/558] ldns windows add vs2008 project and tweak --- libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj | 632 ++++++++++++++++++ .../win32/ldns/ldns-lib/ldns-lib.2010.vcxproj | 28 +- 2 files changed, 654 insertions(+), 6 deletions(-) create mode 100644 libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj diff --git a/libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj b/libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj new file mode 100644 index 0000000000..12509c6666 --- /dev/null +++ b/libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj @@ -0,0 +1,632 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj index e10a283c3d..cc21a20de0 100644 --- a/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj +++ b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj @@ -80,7 +80,7 @@ Disabled - .;%(AdditionalIncludeDirectories) + ..\..\..\ldns\;.;%(AdditionalIncludeDirectories) HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) true EnableFastChecks @@ -88,17 +88,27 @@ Level3 EditAndContinue + + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" + Disabled - .;%(AdditionalIncludeDirectories) + ..\..\..\ldns\;.;%(AdditionalIncludeDirectories) HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Level3 ProgramDatabase + + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" + @@ -109,6 +119,7 @@ Level3 ProgramDatabase HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;_MBCS;%(PreprocessorDefinitions) + ..\..\..\ldns\;.;%(AdditionalIncludeDirectories) true @@ -116,6 +127,11 @@ true MachineX86 + + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" + @@ -126,7 +142,7 @@ Level3 ProgramDatabase HAVE_STRUCT_ADDRINFO;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE;_MBCS;%(PreprocessorDefinitions) - ..\..\..\ldns\;. + ..\..\..\ldns\;.;%(AdditionalIncludeDirectories) true @@ -135,9 +151,9 @@ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" > "$(ProjectDir)..\..\..\ldns\ldns\config.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" > "$(ProjectDir)..\..\..\ldns\ldns\util.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" > "$(ProjectDir)..\..\..\ldns\ldns\net.h" + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" From 81bfe43589caac269c363881c43b5dd7bea699f0 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 25 Mar 2011 15:50:52 -0400 Subject: [PATCH 145/558] mod_sofia: Correct a problem where restarting profile would cause some profile hash entry to remain. --- src/mod/endpoints/mod_sofia/sofia_glue.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index cbb8cb3485..acb0a05aaa 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -5210,12 +5210,14 @@ void sofia_glue_del_profile(sofia_profile_t *profile) } for (gp = profile->gateways; gp; gp = gp->next) { + char *pkey = switch_mprintf("%s::%s", profile->name, gp->name); + switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->name); - switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->register_from); - switch_core_hash_delete(mod_sofia_globals.gateway_hash, gp->register_contact); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "deleted gateway %s\n", gp->name); - profile->gateways = NULL; + switch_core_hash_delete(mod_sofia_globals.gateway_hash, pkey); + switch_safe_free(pkey); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "deleted gateway %s from profile %s\n", gp->name, profile->name); } + profile->gateways = NULL; } switch_mutex_unlock(mod_sofia_globals.hash_mutex); } From bc0b702cf621cd50f4537e4e44ace24846344863 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 25 Mar 2011 15:11:31 -0500 Subject: [PATCH 146/558] add ldns and mod_enum to vs2010 solution - not tested yet --- Freeswitch.2010.sln | 24 +++++++++++++++++++ .../mod_enum/mod_enum.2008.vcproj | 8 +++---- .../mod_enum/mod_enum.2010.vcxproj | 13 +++++----- src/mod/applications/mod_enum/mod_enum.c | 3 +++ 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 93d2c4ace0..5f36859568 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -709,6 +709,8 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "Setup", "w32\Setup\Setup.wi EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_pt", "src\mod\say\mod_say_pt\mod_say_pt.2010.vcxproj", "{7C22BDFF-CC09-400C-8A09-660733980028}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldns-lib\ldns-lib.2010.vcxproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1494,11 +1496,15 @@ Global {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64 Setup.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x86 Setup.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64 Setup.ActiveCfg = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x86 Setup.ActiveCfg = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64 Setup.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x86 Setup.ActiveCfg = Release|Win32 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64 @@ -3630,6 +3636,23 @@ Global {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x64.Build.0 = Release|x64 {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x64 Setup.ActiveCfg = Release|x64 {7C22BDFF-CC09-400C-8A09-660733980028}.Release|x86 Setup.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|Win32.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x64.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x64.Build.0 = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x64 Setup.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x86 Setup.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.ActiveCfg = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.Build.0 = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x64.ActiveCfg = Debug|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x64.Build.0 = Debug|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.Build.0 = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.Build.0 = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64 Setup.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x86 Setup.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3734,6 +3757,7 @@ Global {56B91D01-9150-4BBF-AFA1-5B68AB991B76} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {E4D29906-8B73-4F8A-B5F4-CA8BFA648F5A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {23B4D303-79FC-49E0-89E2-2280E7E28940} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000} {ACFFF684-4D19-4D48-AF12-88EA1D778BDF} = {0C808854-54D1-4230-BFF5-77B5FD905000} diff --git a/src/mod/applications/mod_enum/mod_enum.2008.vcproj b/src/mod/applications/mod_enum/mod_enum.2008.vcproj index 6f7cecb24a..611aef66e1 100644 --- a/src/mod/applications/mod_enum/mod_enum.2008.vcproj +++ b/src/mod/applications/mod_enum/mod_enum.2008.vcproj @@ -42,7 +42,7 @@ /> - %(RootDir)%(Directory)..\..\..\..\libs\udns;%(AdditionalIncludeDirectories) + %(RootDir)%(Directory)..\..\..\..\libs\ldns;%(AdditionalIncludeDirectories) @@ -82,7 +82,7 @@ X64 - %(RootDir)%(Directory)..\..\..\..\libs\udns;%(AdditionalIncludeDirectories) + %(RootDir)%(Directory)..\..\..\..\libs\ldns;%(AdditionalIncludeDirectories) @@ -96,7 +96,7 @@ - %(RootDir)%(Directory)..\..\..\..\libs\udns;%(AdditionalIncludeDirectories) + %(RootDir)%(Directory)..\..\..\..\libs\ldns;%(AdditionalIncludeDirectories) @@ -112,7 +112,7 @@ X64 - %(RootDir)%(Directory)..\..\..\..\libs\udns;%(AdditionalIncludeDirectories) + %(RootDir)%(Directory)..\..\..\..\libs\ldns;%(AdditionalIncludeDirectories) @@ -128,9 +128,8 @@ - - {4043fc6a-9a30-4577-8ad5-9b233c9575d8} - false + + {23b4d303-79fc-49e0-89e2-2280e7e28940} {202d7a4e-760d-4d0e-afa1-d7459ced30ff} diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index cf716b8e04..09f04a373a 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -30,6 +30,9 @@ */ #include +#ifdef _MSC_VER +#define ssize_t int +#endif #include SWITCH_MODULE_LOAD_FUNCTION(mod_enum_load); From 2fba00576459ccfe04a08e8c028c5d848a305024 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 25 Mar 2011 16:48:57 -0400 Subject: [PATCH 147/558] freetdm: added support to restart all channels on a span --- libs/freetdm/mod_freetdm/mod_freetdm.c | 40 +++++++++++++++++++------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 4fd79f8a03..9c3805329a 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3615,7 +3615,7 @@ void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t * "--------------------------------------------------------------------------------\n" \ "ftdm list\n" \ "ftdm start|stop \n" \ -"ftdm restart \n" \ +"ftdm restart []\n" \ "ftdm dump []\n" \ "ftdm sigstatus get|set [] [] []\n" \ "ftdm trace []\n" \ @@ -4141,10 +4141,11 @@ SWITCH_STANDARD_API(ft_function) stream->write_function(stream, "+OK queue sizes set to Rx %d and Tx %d\n", rxsize, txsize); } else if (!strcasecmp(argv[0], "restart")) { uint32_t chan_id = 0; + uint32_t ccount = 0; ftdm_channel_t *chan; ftdm_span_t *span = NULL; - if (argc < 3) { - stream->write_function(stream, "-ERR Usage: ftdm restart \n"); + if (argc < 2) { + stream->write_function(stream, "-ERR Usage: ftdm restart []\n"); goto end; } ftdm_span_find_by_name(argv[1], &span); @@ -4152,15 +4153,32 @@ SWITCH_STANDARD_API(ft_function) stream->write_function(stream, "-ERR invalid span\n"); goto end; } - - chan_id = atoi(argv[2]); - chan = ftdm_span_get_channel(span, chan_id); - if (!chan) { - stream->write_function(stream, "-ERR Could not find chan\n"); - goto end; + + if (argc > 2) { + chan_id = atoi(argv[2]); + if (chan_id > ftdm_span_get_chan_count(span)) { + stream->write_function(stream, "-ERR invalid chan\n"); + goto end; + } } - stream->write_function(stream, "Resetting channel %s:%s\n", argv[2], argv[3]); - ftdm_channel_reset(chan); + if (chan_id) { + chan = ftdm_span_get_channel(span, chan_id); + if (!chan) { + stream->write_function(stream, "-ERR Could not find chan\n"); + goto end; + } + stream->write_function(stream, "Resetting channel %s:%s\n", argv[1], argv[2]); + ftdm_channel_reset(chan); + } else { + uint32_t i = 0; + ccount = ftdm_span_get_chan_count(span); + for (i = 1; i < ccount; i++) { + chan = ftdm_span_get_channel(span, i); + stream->write_function(stream, "Resetting channel %s:%d\n", argv[1], i); + ftdm_channel_reset(chan); + } + } + } else { char *rply = ftdm_api_execute(cmd); From f305605b1015859318768448045cb274839e06b0 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 25 Mar 2011 14:56:37 -0600 Subject: [PATCH 148/558] ldns vs express add project to build and tweak --- Freeswitch.2008.express.sln | 26 +++++++++---------- Freeswitch.2010.express.sln | 24 ++++++++--------- .../win32/ldns/ldns-lib/ldns-lib.2010.vcxproj | 24 ++++++++--------- 3 files changed, 35 insertions(+), 39 deletions(-) diff --git a/Freeswitch.2008.express.sln b/Freeswitch.2008.express.sln index d9cb441e2f..b4f1f60201 100644 --- a/Freeswitch.2008.express.sln +++ b/Freeswitch.2008.express.sln @@ -230,12 +230,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.2008.vcproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.2008.vcproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}" ProjectSection(ProjectDependencies) = postProject + {23B4D303-79FC-49E0-89E2-2280E7E28940} = {23B4D303-79FC-49E0-89E2-2280E7E28940} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_odbc.2008.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}" @@ -664,6 +662,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\ap {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldns-lib\ldns-lib.2008.vcproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1139,17 +1139,6 @@ Global {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.Build.0 = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64 @@ -2137,6 +2126,15 @@ Global {42E721FD-43D6-4B04-A34B-42567199FFB8}.Debug|x64.ActiveCfg = Debug|Win32 {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|Win32.ActiveCfg = Release|Win32 {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|x64.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|Win32.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|Win32.Build.0 = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x64.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.ActiveCfg = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.Build.0 = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x64.ActiveCfg = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.Build.0 = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index e999721ba8..a4044348bd 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -85,8 +85,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_core_db", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_teletone.2010.vcxproj", "{8F992C49-6C51-412F-B2A3-34EAB708EB65}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.2010.vcxproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.2010.vcxproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_odbc.2010.vcxproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}" @@ -317,6 +315,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\opens EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\applications\mod_directory\mod_directory.2010.vcxproj", "{B889A18E-70A7-44B5-B2C9-47798D4F43B3}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldns-lib\ldns-lib.2010.vcxproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -781,17 +781,6 @@ Global {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.Build.0 = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.Build.0 = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.Build.0 = Debug|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.Build.0 = Release|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64 @@ -1990,6 +1979,15 @@ Global {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Debug|x64.ActiveCfg = Debug|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|Win32.ActiveCfg = Release|Win32 {B889A18E-70A7-44B5-B2C9-47798D4F43B3}.Release|x64.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|Win32.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|Win32.Build.0 = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x64.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.ActiveCfg = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.Build.0 = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x64.ActiveCfg = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.Build.0 = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj index cc21a20de0..9341b0828d 100644 --- a/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj +++ b/libs/win32/ldns/ldns-lib/ldns-lib.2010.vcxproj @@ -89,9 +89,9 @@ EditAndContinue - if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" > "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" > "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" > "$(ProjectDir)..\..\..\ldns\ldns\net.h" @@ -105,9 +105,9 @@ if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" ProgramDatabase - if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" > "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" > "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" > "$(ProjectDir)..\..\..\ldns\ldns\net.h" @@ -128,9 +128,9 @@ if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" MachineX86 - if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" > "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" > "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" > "$(ProjectDir)..\..\..\ldns\ldns\net.h" @@ -151,9 +151,9 @@ if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) - if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\config.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\util.h" -if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" &gt; "$(ProjectDir)..\..\..\ldns\ldns\net.h" + if not exist "$(ProjectDir)..\..\..\ldns\ldns\config.h" type "$(ProjectDir)\config.h" > "$(ProjectDir)..\..\..\ldns\ldns\config.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\util.h" type "$(ProjectDir)\util.h" > "$(ProjectDir)..\..\..\ldns\ldns\util.h" +if not exist "$(ProjectDir)..\..\..\ldns\ldns\net.h" type "$(ProjectDir)\net.h" > "$(ProjectDir)..\..\..\ldns\ldns\net.h" From 2bbc37e3d1c0fdb3129396cc4e34663521f0d663 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 Mar 2011 15:54:13 -0500 Subject: [PATCH 149/558] switch mod_enum to use new portable in-tree version --- src/mod/applications/mod_enum/Makefile | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/mod/applications/mod_enum/Makefile b/src/mod/applications/mod_enum/Makefile index 3036df195a..e9abd18654 100644 --- a/src/mod/applications/mod_enum/Makefile +++ b/src/mod/applications/mod_enum/Makefile @@ -1,17 +1,6 @@ -# LDNS=ldns-1.6.9 -# BASE=../../../.. - -# LDNS_DIR=$(switch_srcdir)/libs/$(LDNS) -# LDNS_BUILDDIR=$(switch_builddir)/libs/$(LDNS) -# LDNSLA=$(LDNS_BUILDDIR)/libldns.la - -# include $(BASE)/build/modmake.rules -# LOCAL_LIBADD=$(LDNSLA) - - BASE=../../../.. -LDNS=ldns-1.6.9 +LDNS=ldns LDNS_DIR=$(switch_srcdir)/libs/$(LDNS) LDNS_BUILDDIR=$(switch_builddir)/libs/$(LDNS) @@ -20,11 +9,6 @@ LDNS_LA=$(LDNS_BUILDDIR)/libldns.la LOCAL_LIBADD=$(LDNS_LA) include $(BASE)/build/modmake.rules -$(LDNS_DIR)/Makefile.in: - $(GETLIB) $(LDNS).tar.gz - cp ldns.diff $(LDNS_BUILDDIR) - cd $(LDNS_BUILDDIR) && patch -p1 -i ldns.diff - $(LDNS_BUILDDIR)/Makefile: $(LDNS_DIR)/Makefile.in mkdir -p $(LDNS_BUILDDIR) cd $(LDNS_BUILDDIR) && $(DEFAULT_VARS) $(LDNS_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(LDNS_DIR) --disable-gost --without-ssl --disable-sha2 From 3e4957c0b311bb840aebc4458760eb093adc1ee0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 Mar 2011 16:30:16 -0500 Subject: [PATCH 150/558] revert 4f6d888152febb9b8c28854192d13fd6e7228b1d --- src/mod/endpoints/mod_sofia/mod_sofia.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 9a52d79a93..93e0588b11 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3497,12 +3497,12 @@ static void select_from_profile(sofia_profile_t *profile, if (exclude_contact) { sql = switch_mprintf("select contact, profile_name, '%q' " - "from sip_registrations where (sip_user='%q' or sip_username='%q') and (sip_host='%q' or presence_hosts like '%%%q%%') " - "and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, user, domain, domain, exclude_contact); + "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%') " + "and contact not like '%%%s%%'", (concat != NULL) ? concat : "", user, domain, domain, exclude_contact); } else { sql = switch_mprintf("select contact, profile_name, '%q' " - "from sip_registrations where (sip_user='%q' or sip_username='%q') and (sip_host='%q' or presence_hosts like '%%%q%%')", - (concat != NULL) ? concat : "", user, user, domain, domain); + "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", + (concat != NULL) ? concat : "", user, domain, domain); } switch_assert(sql); From 7556ec57e9e077c4d45a274d816cc4ccc116153d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 Mar 2011 16:35:30 -0500 Subject: [PATCH 151/558] FS-3187 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 91 +++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 93e0588b11..4723618fa8 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3480,6 +3480,96 @@ SWITCH_STANDARD_API(sofia_count_reg_function) return SWITCH_STATUS_SUCCESS; } +SWITCH_STANDARD_API(sofia_username_of_function) +{ + char *data; + char *user = NULL; + char *domain = NULL; + char *profile_name = NULL; + char *p; + char *reply = ""; + sofia_profile_t *profile = NULL; + + if (!cmd) { + stream->write_function(stream, "%s", ""); + return SWITCH_STATUS_SUCCESS; + } + + data = strdup(cmd); + switch_assert(data); + + if ((p = strchr(data, '/'))) { + profile_name = data; + *p++ = '\0'; + user = p; + } else { + user = data; + } + + if ((domain = strchr(user, '@'))) { + *domain++ = '\0'; + } + + if (!profile_name && domain) { + profile_name = domain; + } + + if (user && profile_name) { + char *sql; + + if (!(profile = sofia_glue_find_profile(profile_name))) { + profile_name = domain; + domain = NULL; + } + + if (!profile && profile_name) { + profile = sofia_glue_find_profile(profile_name); + } + + if (profile) { + struct cb_helper_sql2str cb; + char username[256] = ""; + + cb.buf = username; + cb.len = sizeof(username); + + if (!domain || !strchr(domain, '.')) { + domain = profile->name; + } + + switch_assert(!zstr(user)); + + sql = switch_mprintf("select sip_username " + "from sip_registrations where sip_user='%q' and (sip_host='%q' or presence_hosts like '%%%q%%')", + user, domain, domain); + + switch_assert(sql); + + sofia_glue_execute_sql_callback(profile, profile->ireg_mutex, sql, sql2str_callback, &cb); + switch_safe_free(sql); + if (!zstr(username)) { + stream->write_function(stream, "%s", username); + } else { + stream->write_function(stream, ""); + } + reply = NULL; + + } + } + + if (reply) { + stream->write_function(stream, "%s", reply); + } + + switch_safe_free(data); + + if (profile) { + sofia_glue_release_profile(profile); + } + + return SWITCH_STATUS_SUCCESS; +} + static void select_from_profile(sofia_profile_t *profile, const char *user, const char *domain, @@ -4993,6 +5083,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_console_add_complete_func("::sofia::list_profile_gateway", list_profile_gateway); + SWITCH_ADD_API(api_interface, "sofia_username_of", "Sofia Username Lookup", sofia_username_of_function, "[profile/]@"); SWITCH_ADD_API(api_interface, "sofia_contact", "Sofia Contacts", sofia_contact_function, "[profile/]@"); SWITCH_ADD_API(api_interface, "sofia_count_reg", "Count Sofia registration", sofia_count_reg_function, "[profile/]@"); SWITCH_ADD_API(api_interface, "sofia_dig", "SIP DIG", sip_dig_function, ""); From fa151503c4727ba0c4ca2f39fffce8698d84862e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 Mar 2011 16:53:44 -0500 Subject: [PATCH 152/558] fix perms --- libs/ldns/configure | 0 libs/ldns/install-sh | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 libs/ldns/configure mode change 100644 => 100755 libs/ldns/install-sh diff --git a/libs/ldns/configure b/libs/ldns/configure old mode 100644 new mode 100755 diff --git a/libs/ldns/install-sh b/libs/ldns/install-sh old mode 100644 new mode 100755 From 159efea47ccd865e9aa3cbd81ecad95c0680cdf6 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 25 Mar 2011 17:18:16 -0500 Subject: [PATCH 153/558] ldns for windows first working version --- Freeswitch.2008.sln | 19 +++++++++++++++++ src/mod/applications/mod_enum/mod_enum.c | 26 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index f65dbdae61..8528d19e28 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -606,6 +606,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.2008.vcproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}" ProjectSection(ProjectDependencies) = postProject + {23B4D303-79FC-49E0-89E2-2280E7E28940} = {23B4D303-79FC-49E0-89E2-2280E7E28940} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8} EndProjectSection @@ -1135,6 +1136,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "openssl", "libs\win32\opens EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\applications\mod_directory\mod_directory.2008.vcproj", "{42E721FD-43D6-4B04-A34B-42567199FFB8}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldns-lib\ldns-lib.2008.vcproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1615,9 +1618,13 @@ Global {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.ActiveCfg = Debug|Win32 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|Win32.Build.0 = Debug|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.ActiveCfg = Debug|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Debug|x64.Build.0 = Debug|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.ActiveCfg = Release|Win32 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|Win32.Build.0 = Release|Win32 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.ActiveCfg = Release|x64 + {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.Release|x64.Build.0 = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|Win32.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.ActiveCfg = Release|x64 {0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}.All|x64.Build.0 = Release|x64 @@ -2848,6 +2855,17 @@ Global {42E721FD-43D6-4B04-A34B-42567199FFB8}.Debug|x64.ActiveCfg = Debug|x64 {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|Win32.ActiveCfg = Release|Win32 {42E721FD-43D6-4B04-A34B-42567199FFB8}.Release|x64.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|Win32.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x64.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.All|x64.Build.0 = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.ActiveCfg = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|Win32.Build.0 = Debug|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x64.ActiveCfg = Debug|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Debug|x64.Build.0 = Debug|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.ActiveCfg = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.Build.0 = Release|Win32 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.ActiveCfg = Release|x64 + {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2969,6 +2987,7 @@ Global {9778F1C0-09BC-4698-8EBC-BD982247209A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {56B91D01-9150-4BBF-AFA1-5B68AB991B76} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {B376D494-D7DD-4B2A-99E2-52916D5A8CD8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} + {23B4D303-79FC-49E0-89E2-2280E7E28940} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {8B3B4C4C-13C2-446C-BEB0-F412CC2CFB9A} = {C120A020-773F-4EA3-923F-B67AF28B750D} {4F92B672-DADB-4047-8D6A-4BB3796733FD} = {C120A020-773F-4EA3-923F-B67AF28B750D} {2DEE4895-1134-439C-B688-52203E57D878} = {C120A020-773F-4EA3-923F-B67AF28B750D} diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 09f04a373a..0e70e8267c 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -144,6 +144,32 @@ static switch_status_t load_config(void) } done: +#ifdef _MSC_VER + if (!globals.server) { + HKEY hKey; + DWORD data_sz; + char* buf; + RegOpenKeyEx(HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", + 0, KEY_QUERY_VALUE, &hKey); + + RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz); + if (globals.server) { + free(globals.server); + } + buf = (char*)malloc(data_sz + 1); + + RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz); + + RegCloseKey(hKey); + + if(buf[data_sz - 1] != 0) { + buf[data_sz] = 0; + } + globals.server = buf; + } +#endif + if (xml) { switch_xml_free(xml); From b8d93de097664ce94876c3e976c7870c107bbd57 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 Mar 2011 17:05:13 -0500 Subject: [PATCH 154/558] memset str on cache_db_sql2str --- src/switch_core_sqldb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 27bac6d4b4..7f2c9c712f 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -606,6 +606,8 @@ SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t if (io_mutex) switch_mutex_lock(io_mutex); + memset(str, 0, len); + switch (dbh->type) { case SCDB_TYPE_CORE_DB: { From 4d5540671764ae7c9bc50d66501cc5ecfa5a60ab Mon Sep 17 00:00:00 2001 From: Josh Perry Date: Fri, 25 Mar 2011 18:28:53 -0600 Subject: [PATCH 155/558] Intitial mod_event_zmq code --- src/mod/event_handlers/mod_event_zmq/Makefile | 27 ++++ .../mod_event_zmq/mod_event_zmq.cpp | 124 ++++++++++++++++++ 2 files changed, 151 insertions(+) create mode 100644 src/mod/event_handlers/mod_event_zmq/Makefile create mode 100644 src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp diff --git a/src/mod/event_handlers/mod_event_zmq/Makefile b/src/mod/event_handlers/mod_event_zmq/Makefile new file mode 100644 index 0000000000..46d03f4bea --- /dev/null +++ b/src/mod/event_handlers/mod_event_zmq/Makefile @@ -0,0 +1,27 @@ +BASE=../../../.. + +ZMQ=zeromq-2.1.3 + +ZMQ_BASEURL=http://download.zeromq.org + +ZMQ_DIR=$(switch_srcdir)/libs/$(ZMQ) +ZMQ_BUILDDIR=$(switch_builddir)/libs/$(ZMQ) +LOCAL_CFLAGS=-I$(ZMQ_DIR)/include +ZMQ_LA=$(ZMQ_BUILDDIR)/src/libzmq.la +LOCAL_LIBADD=$(ZMQ_LA) + +include $(BASE)/build/modmake.rules + +$(ZMQ_DIR): + $(GETLIB) $(ZMQ_BASEURL) $(ZMQ).tar.gz + cd $(ZMQ_DIR) && ./autogen.sh + +$(ZMQ_BUILDDIR)/Makefile: $(ZMQ_DIR) + mkdir -p $(ZMQ_DIR) + cd $(ZMQ_BUILDDIR) && $(DEFAULT_VARS) $(ZMQ_DIR)/configure $(DEFAULT_ARGS) --srcdir=$(ZMQ_DIR) + $(TOUCH_TARGET) + +$(ZMQ_LA): $(ZMQ_BUILDDIR)/Makefile + cd $(ZMQ_BUILDDIR) && $(MAKE) + $(TOUCH_TARGET) + diff --git a/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp b/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp new file mode 100644 index 0000000000..7c99345712 --- /dev/null +++ b/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp @@ -0,0 +1,124 @@ +#include +#include +#include +#include +#include +#include + +namespace mod_event_zmq { + +SWITCH_MODULE_LOAD_FUNCTION(load); +SWITCH_MODULE_SHUTDOWN_FUNCTION(shutdown); +SWITCH_MODULE_RUNTIME_FUNCTION(runtime); + +extern "C" { +SWITCH_MODULE_DEFINITION(mod_event_zmq, load, shutdown, runtime); +}; + +class ZmqStringMessage : public zmq::message_t { +public: + ZmqStringMessage(const std::string &msg) { + + } +}; + +// Handles publishing events out to clients +class ZmqEventPublisher { +public: + ZmqEventPublisher() : + context(1), + event_publisher(context, ZMQ_PUB) + { + event_publisher.bind("tcp://*.5556"); + } + + void PublishEvent(const switch_event_t *event) { + char* pjson; + switch_event_serialize_json(const_cast(event), &pjson); + std::auto_ptr json(pjson); + + ZmqStringMessage msg(json.get()); + event_publisher.send(msg); + } + +private: + zmq::context_t context; + zmq::socket_t event_publisher; +}; + +// Handles global inititalization and teardown of the module +class ZmqModule { +public: + ZmqModule(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) { + // Subscribe to all switch events of any subclass + // Store a pointer to ourself in the user data + if (switch_event_bind_removable(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, (void*)this, &_node) + != SWITCH_STATUS_SUCCESS) { + throw std::runtime_error("Couldn't bind to switch events."); + } + + // Create our module interface registration + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + } + + void Listen() { + _publisher.reset(new ZmqEventPublisher()); + } + + ~ZmqModule() { + // Unsubscribe from the switch events + switch_event_unbind(&_node); + } + +private: + // Dispatches events to the publisher + static void event_handler(switch_event_t *event) { + try { + ZmqModule *module = (ZmqModule*)event->bind_user_data; + if(module->_publisher.get()) + module->_publisher->PublishEvent(event); + } catch(std::exception ex) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error publishing event via 0MQ: %s\n", ex.what()); + } + } + + switch_event_node_t *_node; + std::auto_ptr _publisher; +}; + +//*****************************// +// GLOBALS // +//*****************************// +std::auto_ptr module; + + +//*****************************// +// Module interface funtions // +//*****************************// +SWITCH_MODULE_LOAD_FUNCTION(load) { + try { + module.reset(new ZmqModule(module_interface, pool)); + return SWITCH_STATUS_SUCCESS; + } catch(const std::exception &ex) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading 0MQ module: %s\n", ex.what()); + return SWITCH_STATUS_GENERR; + } + +} + +SWITCH_MODULE_RUNTIME_FUNCTION(runtime) { + try { + // Begin listening for clients + module->Listen(); + } catch(...) { } + + // Tell the switch to stop calling this runtime loop + return SWITCH_STATUS_FALSE; +} + +SWITCH_MODULE_SHUTDOWN_FUNCTION(shutdown) { + // Free the module object + module.reset(); +} + +} From 608b9abd5a719f546b594a400f5ae8d720d6d7e1 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 26 Mar 2011 10:20:06 -0400 Subject: [PATCH 156/558] mod_callcenter: Temporary fix for some race condition with loopback agent. Need to find the root cause of this problem --- src/mod/applications/mod_callcenter/mod_callcenter.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index b8c5eede74..6f74d3ade9 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1449,8 +1449,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Loopback special case */ if (other_loopback_leg_uuid) { - switch_core_session_t *other_loopback_session = switch_core_session_locate(other_loopback_leg_uuid); - if (other_loopback_session) { + switch_core_session_t *other_loopback_session = NULL; + + switch_yield(20000); // Wait 20ms for the channel to be ready + if ((other_loopback_session = switch_core_session_locate(other_loopback_leg_uuid))) { switch_channel_t *other_loopback_channel = switch_core_session_get_channel(other_loopback_session); const char *real_uuid = switch_channel_get_variable(other_loopback_channel, SWITCH_SIGNAL_BOND_VARIABLE); From ae595cd529e4618611c2a2258e73d949f2856bb9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 26 Mar 2011 10:59:48 -0500 Subject: [PATCH 157/558] use poll instead of select in ESL client lib because select is not your friend.... --- libs/esl/src/esl.c | 215 +++++++++++++++++++++++++++---------- libs/esl/src/include/esl.h | 7 ++ 2 files changed, 168 insertions(+), 54 deletions(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 27000f6071..fab8b4ad42 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -31,6 +31,30 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +/* Use select on windows and poll everywhere else. + Select is the devil. Especially if you are doing a lot of small socket connections. + If your FD number is bigger than 1024 you will silently create memory corruption. + + If you have build errors on your platform because you don't have poll find a way to detect it and #define ESL_USE_SELECT and #undef ESL_USE_POLL + All of this will be upgraded to autoheadache eventually. +*/ + +/* TBD for win32 figure out how to tell if you have WSAPoll (vista or higher) and use it when available by #defining ESL_USE_WSAPOLL (see below) */ + +#ifdef _MSC_VER +#define FD_SETSIZE 8192 +#define ESL_USE_SELECT +#else +#define ESL_USE_POLL +#endif +#ifdef ESL_USE_POLL +#include +#endif + + + + #include #ifndef WIN32 #define closesocket(x) close(x) @@ -614,6 +638,135 @@ ESL_DECLARE(esl_status_t) esl_listen(const char *host, esl_port_t port, esl_list } + +/* USE WSAPoll on vista or higher */ +#ifdef ESL_USE_WSAPOLL +ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) +{ +} +#endif + + +#ifdef ESL_USE_SELECT +ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) +{ + int s = 0, r = 0; + fd_set rfds; + fd_set wfds; + fd_set efds; + struct timeval tv; + + /* Wouldn't you rather know?? */ + assert(sock <= FD_SETSIZE); + + + if ((flags & ESL_POLL_READ)) { + FD_ZERO(&rfds); + +#ifdef WIN32 +#pragma warning( push ) +#pragma warning( disable : 4127 ) + FD_SET(sock, &rfds); +#pragma warning( pop ) +#else + FD_SET(sock, &rfds); +#endif + } + + if ((flags & ESL_POLL_WRITE)) { + FD_ZERO(&wfds); + +#ifdef WIN32 +#pragma warning( push ) +#pragma warning( disable : 4127 ) + FD_SET(sock, &wfds); +#pragma warning( pop ) +#else + FD_SET(sock, &wfds); +#endif + } + + if ((flags & ESL_POLL_ERROR)) { + FD_ZERO(&efds); + +#ifdef WIN32 +#pragma warning( push ) +#pragma warning( disable : 4127 ) + FD_SET(sock, &efds); +#pragma warning( pop ) +#else + FD_SET(sock, &efds); +#endif + } + + tv.tv_sec = ms / 1000; + tv.tv_usec = (ms % 1000) * ms; + + s = select(sock + 1, (flags & ESL_POLL_READ) ? &rfds : NULL, (flags & ESL_POLL_WRITE) ? &wfds : NULL, (flags & ESL_POLL_ERROR) ? &efds : NULL, &tv); + + if (s < 0) { + r = s; + } else if (s > 0) { + if ((flags & ESL_POLL_READ) && FD_ISSET(sock, &rfds)) { + r |= ESL_POLL_READ; + } + + if ((flags & ESL_POLL_WRITE) && FD_ISSET(sock, &wfds)) { + r |= ESL_POLL_WRITE; + } + + if ((flags & ESL_POLL_ERROR) && FD_ISSET(sock, &efds)) { + r |= ESL_POLL_ERROR; + } + } + + return r; + +} +#endif + +#ifdef ESL_USE_POLL +ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) +{ + struct pollfd pfds[2] = { { 0 } }; + int s = 0, r = 0; + + pfds[0].fd = sock; + + if ((flags & ESL_POLL_READ)) { + pfds[0].events |= POLLIN; + } + + if ((flags & ESL_POLL_WRITE)) { + pfds[0].events |= POLLOUT; + } + + if ((flags & ESL_POLL_ERROR)) { + pfds[0].events |= POLLERR; + } + + s = poll(pfds, 1, ms); + + if (s < 0) { + r = s; + } else if (s > 0) { + if ((pfds[0].revents & POLLIN)) { + r |= ESL_POLL_READ; + } + if ((pfds[0].revents & POLLOUT)) { + r |= ESL_POLL_WRITE; + } + if ((pfds[0].revents & POLLERR)) { + r |= ESL_POLL_ERROR; + } + } + + return r; + +} +#endif + + ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char *host, esl_port_t port, const char *user, const char *password, uint32_t timeout) { char sendbuf[256]; @@ -681,30 +834,17 @@ ESL_DECLARE(esl_status_t) esl_connect_timeout(esl_handle_t *handle, const char * rval = connect(handle->sock, (struct sockaddr*)&handle->sockaddr, sizeof(handle->sockaddr)); if (timeout) { - fd_set wfds; - struct timeval tv; int r; - tv.tv_sec = timeout / 1000; - tv.tv_usec = (timeout % 1000) * 1000; - FD_ZERO(&wfds); -#ifdef WIN32 -#pragma warning( push ) -#pragma warning( disable : 4127 ) - FD_SET(handle->sock, &wfds); -#pragma warning( pop ) -#else - FD_SET(handle->sock, &wfds); -#endif - r = select(handle->sock + 1, NULL, &wfds, NULL, &tv); + r = esl_wait_sock(handle->sock, timeout, ESL_POLL_WRITE); if (r <= 0) { snprintf(handle->err, sizeof(handle->err), "Connection timed out"); goto fail; } - if (!FD_ISSET(handle->sock, &wfds)) { + if (!(r & ESL_POLL_WRITE)) { snprintf(handle->err, sizeof(handle->err), "Connection timed out"); goto fail; } @@ -823,9 +963,7 @@ ESL_DECLARE(esl_status_t) esl_disconnect(esl_handle_t *handle) ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms, int check_q, esl_event_t **save_event) { - fd_set rfds, efds; - struct timeval tv = { 0 }; - int max, activity; + int activity; esl_status_t status = ESL_SUCCESS; if (!ms) { @@ -845,55 +983,24 @@ ESL_DECLARE(esl_status_t) esl_recv_event_timed(esl_handle_t *handle, uint32_t ms esl_mutex_unlock(handle->mutex); } - tv.tv_usec = ms * 1000; - - FD_ZERO(&rfds); - FD_ZERO(&efds); - -#ifdef WIN32 -#pragma warning( push ) -#pragma warning( disable : 4127 ) - FD_SET(handle->sock, &rfds); - FD_SET(handle->sock, &efds); -#pragma warning( pop ) -#else - FD_SET(handle->sock, &rfds); - FD_SET(handle->sock, &efds); -#endif - - max = handle->sock + 1; + activity = esl_wait_sock(handle->sock, ms, ESL_POLL_READ|ESL_POLL_ERROR); - if ((activity = select(max, &rfds, NULL, &efds, &tv)) < 0) { + if (activity < 0) { handle->connected = 0; return ESL_FAIL; } - if (activity == 0 || !FD_ISSET(handle->sock, &rfds) || (esl_mutex_trylock(handle->mutex) != ESL_SUCCESS)) { + if (activity == 0 || !(activity & ESL_POLL_READ) || (esl_mutex_trylock(handle->mutex) != ESL_SUCCESS)) { return ESL_BREAK; } - tv.tv_usec = 0; + activity = esl_wait_sock(handle->sock, ms, ESL_POLL_READ|ESL_POLL_ERROR); - FD_ZERO(&rfds); - FD_ZERO(&efds); - -#ifdef WIN32 -#pragma warning( push ) -#pragma warning( disable : 4127 ) - FD_SET(handle->sock, &rfds); - FD_SET(handle->sock, &efds); -#pragma warning( pop ) -#else - FD_SET(handle->sock, &rfds); - FD_SET(handle->sock, &efds); -#endif - - activity = select(max, &rfds, NULL, &efds, &tv); if (activity < 0) { handle->connected = 0; status = ESL_FAIL; - } else if (activity > 0 && FD_ISSET(handle->sock, &rfds)) { + } else if (activity > 0 && (activity & ESL_POLL_READ)) { if (esl_recv_event(handle, check_q, save_event)) { status = ESL_FAIL; } diff --git a/libs/esl/src/include/esl.h b/libs/esl/src/include/esl.h index 99ab53ae95..17ebf26ee1 100644 --- a/libs/esl/src/include/esl.h +++ b/libs/esl/src/include/esl.h @@ -46,6 +46,11 @@ extern "C" { typedef struct esl_event_header esl_event_header_t; typedef struct esl_event esl_event_t; +typedef enum { + ESL_POLL_READ = (1 << 0), + ESL_POLL_WRITE = (1 << 1), + ESL_POLL_ERROR = (1 << 2) +} esl_poll_t; typedef enum { ESL_EVENT_TYPE_PLAIN, @@ -446,6 +451,8 @@ ESL_DECLARE(esl_status_t) esl_filter(esl_handle_t *handle, const char *header, c */ ESL_DECLARE(esl_status_t) esl_events(esl_handle_t *handle, esl_event_type_t etype, const char *value); +ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags); + #define esl_recv(_h) esl_recv_event(_h, 0, NULL) #define esl_recv_timed(_h, _ms) esl_recv_event_timed(_h, _ms, 0, NULL) From 9795dd2f0a7d561c6c808306823021da038adbe4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sat, 26 Mar 2011 11:07:34 -0500 Subject: [PATCH 158/558] fix finicky build --- libs/esl/src/esl.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index fab8b4ad42..45cf785cd8 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -48,12 +48,6 @@ #else #define ESL_USE_POLL #endif -#ifdef ESL_USE_POLL -#include -#endif - - - #include #ifndef WIN32 @@ -66,6 +60,10 @@ #pragma warning (default:6386) #endif +#ifdef ESL_USE_POLL +#include +#endif + /* Written by Marc Espie, public domain */ #define ESL_CTYPE_NUM_CHARS 256 From e83af319602b616c8cee5efc89386be3d5af61b5 Mon Sep 17 00:00:00 2001 From: Josh Perry Date: Sat, 26 Mar 2011 12:34:22 -0600 Subject: [PATCH 159/558] Updated message creation --- .../mod_event_zmq/mod_event_zmq.cpp | 62 +++++++++++++------ 1 file changed, 44 insertions(+), 18 deletions(-) diff --git a/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp b/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp index 7c99345712..c8975ebe5d 100644 --- a/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp +++ b/src/mod/event_handlers/mod_event_zmq/mod_event_zmq.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include #include @@ -15,13 +14,6 @@ extern "C" { SWITCH_MODULE_DEFINITION(mod_event_zmq, load, shutdown, runtime); }; -class ZmqStringMessage : public zmq::message_t { -public: - ZmqStringMessage(const std::string &msg) { - - } -}; - // Handles publishing events out to clients class ZmqEventPublisher { public: @@ -29,19 +21,28 @@ public: context(1), event_publisher(context, ZMQ_PUB) { - event_publisher.bind("tcp://*.5556"); + event_publisher.bind("tcp://*:5556"); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Listening for clients\n"); } void PublishEvent(const switch_event_t *event) { + // Serialize the event into a JSON string char* pjson; switch_event_serialize_json(const_cast(event), &pjson); - std::auto_ptr json(pjson); - ZmqStringMessage msg(json.get()); + // Use the JSON string as the message body + zmq::message_t msg(pjson, strlen(pjson), free_message_data, NULL); + + // Send the message event_publisher.send(msg); } private: + static void free_message_data(void *data, void *hint) { + free (data); + } + zmq::context_t context; zmq::socket_t event_publisher; }; @@ -49,25 +50,39 @@ private: // Handles global inititalization and teardown of the module class ZmqModule { public: - ZmqModule(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) { + ZmqModule(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) : + _running(false) { // Subscribe to all switch events of any subclass // Store a pointer to ourself in the user data if (switch_event_bind_removable(modname, SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, (void*)this, &_node) != SWITCH_STATUS_SUCCESS) { throw std::runtime_error("Couldn't bind to switch events."); } + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Subscribed to events\n"); // Create our module interface registration *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Module loaded\n"); } void Listen() { + if(_running) + return; + _publisher.reset(new ZmqEventPublisher()); + _running = true; + + while(_running) { + switch_yield(100000); + } } ~ZmqModule() { // Unsubscribe from the switch events + _running = false; switch_event_unbind(&_node); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Module shut down\n"); } private: @@ -79,11 +94,14 @@ private: module->_publisher->PublishEvent(event); } catch(std::exception ex) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error publishing event via 0MQ: %s\n", ex.what()); + } catch(...) { // Exceptions must not propogate to C caller + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown error publishing event via 0MQ\n"); } } switch_event_node_t *_node; std::auto_ptr _publisher; + bool _running; }; //*****************************// @@ -99,8 +117,8 @@ SWITCH_MODULE_LOAD_FUNCTION(load) { try { module.reset(new ZmqModule(module_interface, pool)); return SWITCH_STATUS_SUCCESS; - } catch(const std::exception &ex) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading 0MQ module: %s\n", ex.what()); + } catch(...) { // Exceptions must not propogate to C caller + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error loading 0MQ module\n"); return SWITCH_STATUS_GENERR; } @@ -110,15 +128,23 @@ SWITCH_MODULE_RUNTIME_FUNCTION(runtime) { try { // Begin listening for clients module->Listen(); - } catch(...) { } + } catch(std::exception &ex) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error listening for clients: %s\n", ex.what()); + } catch(...) { // Exceptions must not propogate to C caller + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown error listening for clients\n"); + } // Tell the switch to stop calling this runtime loop - return SWITCH_STATUS_FALSE; + return SWITCH_STATUS_TERM; } SWITCH_MODULE_SHUTDOWN_FUNCTION(shutdown) { - // Free the module object - module.reset(); + try { + // Free the module object + module.reset(); + } catch(...) { // Exceptions must not propogate to C caller + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error shutting down module\n"); + } } } From 0629b31c87e967fab08e45272c3b2b8172de8b45 Mon Sep 17 00:00:00 2001 From: Josh Perry Date: Sat, 26 Mar 2011 12:46:00 -0600 Subject: [PATCH 160/558] Added module to modules.conf source file --- build/modules.conf.in | 1 + 1 file changed, 1 insertion(+) diff --git a/build/modules.conf.in b/build/modules.conf.in index 287bd9a540..1147ad4863 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -76,6 +76,7 @@ endpoints/mod_loopback #asr_tts/mod_tts_commandline #event_handlers/mod_event_multicast event_handlers/mod_event_socket +#event_handlers/mod_event_zmq event_handlers/mod_cdr_csv event_handlers/mod_cdr_sqlite #event_handlers/mod_cdr_pg_csv From 6ebc52d3556ab5f4465b2934fb5dd4c0a0b7a59b Mon Sep 17 00:00:00 2001 From: Josh Perry Date: Sat, 26 Mar 2011 12:47:47 -0600 Subject: [PATCH 161/558] Added module to modules.conf.xml --- conf/autoload_configs/modules.conf.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 9a2b1db482..8553a6dba1 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -22,6 +22,7 @@ + From 92671067f04d838adff3f70587d76ea21205553c Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sun, 27 Mar 2011 00:34:07 -0400 Subject: [PATCH 162/558] media_bug: Fix for rare race condition. More work required to make media bug safe. --- src/switch_core_io.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/switch_core_io.c b/src/switch_core_io.c index 14cec65808..31c8d5fb25 100644 --- a/src/switch_core_io.c +++ b/src/switch_core_io.c @@ -346,13 +346,16 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi memset(session->raw_read_frame.data, 255, session->raw_read_frame.datalen); status = SWITCH_STATUS_SUCCESS; } else { - status = switch_core_codec_decode(use_codec, + switch_thread_rwlock_rdlock(session->bug_rwlock); + status = switch_core_codec_decode(use_codec->implementation?use_codec:read_frame->codec, session->read_codec, read_frame->data, read_frame->datalen, session->read_impl.actual_samples_per_second, session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &read_frame->flags); + switch_thread_rwlock_unlock(session->bug_rwlock); + } if (status == SWITCH_STATUS_SUCCESS) { From 1ec4939a1f847771c772efaa07b568a061b3724e Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Sun, 27 Mar 2011 16:36:41 +0200 Subject: [PATCH 163/558] ringback tones defs - remove redundant second 0Hz freq where applicable, add some more complex examples --- conf/vars.xml | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/conf/vars.xml b/conf/vars.xml index a342c4565c..f24cc5ccee 100644 --- a/conf/vars.xml +++ b/conf/vars.xml @@ -199,26 +199,30 @@ - + - - - - - - - - + + + + + + + + + - - + + + + - - - - - - + + + + + + + From 0cde6bc0398fcc3a4d2618ca4102d8fa81d3ce2d Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 27 Mar 2011 12:09:10 -0500 Subject: [PATCH 164/558] code analysis warnings fix and acknowledge stack usage warning --- libs/esl/src/esl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 45cf785cd8..95e9615107 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -646,6 +646,10 @@ ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) #ifdef ESL_USE_SELECT +#ifdef WIN32 +#pragma warning( push ) +#pragma warning( disable : 6262 ) /* warning C6262: Function uses '98348' bytes of stack: exceeds /analyze:stacksize'16384'. Consider moving some data to heap */ +#endif ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) { int s = 0, r = 0; @@ -654,12 +658,15 @@ ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) fd_set efds; struct timeval tv; + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&efds); + /* Wouldn't you rather know?? */ assert(sock <= FD_SETSIZE); if ((flags & ESL_POLL_READ)) { - FD_ZERO(&rfds); #ifdef WIN32 #pragma warning( push ) @@ -672,7 +679,6 @@ ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) } if ((flags & ESL_POLL_WRITE)) { - FD_ZERO(&wfds); #ifdef WIN32 #pragma warning( push ) @@ -685,7 +691,6 @@ ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) } if ((flags & ESL_POLL_ERROR)) { - FD_ZERO(&efds); #ifdef WIN32 #pragma warning( push ) @@ -721,6 +726,9 @@ ESL_DECLARE(int) esl_wait_sock(esl_socket_t sock, uint32_t ms, esl_poll_t flags) return r; } +#ifdef WIN32 +#pragma warning( pop ) +#endif #endif #ifdef ESL_USE_POLL From 48273745744543d9fb1869c4833c4249a5fcb1b5 Mon Sep 17 00:00:00 2001 From: Brian West Date: Sun, 27 Mar 2011 22:35:26 -0500 Subject: [PATCH 165/558] FS-3192 FS-3191 --- .../endpoints/mod_dingaling/mod_dingaling.c | 39 +++++++++++-------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 7cd9e5618b..64dcf50906 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -65,19 +65,20 @@ typedef enum { TFLAG_CODEC_READY = (1 << 8), TFLAG_TRANSPORT = (1 << 9), TFLAG_ANSWER = (1 << 10), - TFLAG_VAD_IN = (1 << 11), - TFLAG_VAD_OUT = (1 << 12), - TFLAG_VAD = (1 << 13), - TFLAG_DO_CAND = (1 << 14), - TFLAG_DO_DESC = (1 << 15), - TFLAG_LANADDR = (1 << 16), - TFLAG_AUTO = (1 << 17), - TFLAG_DTMF = (1 << 18), - TFLAG_TIMER = (1 << 19), - TFLAG_TERM = (1 << 20), - TFLAG_TRANSPORT_ACCEPT = (1 << 21), - TFLAG_READY = (1 << 22), - TFLAG_NAT_MAP = (1 << 22) + TFLAG_VAD_NONE = (1 << 11), + TFLAG_VAD_IN = (1 << 12), + TFLAG_VAD_OUT = (1 << 13), + TFLAG_VAD = (1 << 14), + TFLAG_DO_CAND = (1 << 15), + TFLAG_DO_DESC = (1 << 16), + TFLAG_LANADDR = (1 << 17), + TFLAG_AUTO = (1 << 18), + TFLAG_DTMF = (1 << 19), + TFLAG_TIMER = (1 << 20), + TFLAG_TERM = (1 << 21), + TFLAG_TRANSPORT_ACCEPT = (1 << 22), + TFLAG_READY = (1 << 23), + TFLAG_NAT_MAP = (1 << 24) } TFLAGS; typedef enum { @@ -966,7 +967,7 @@ static int do_candidates(struct private_object *tech_pvt, int force) if (force || !switch_test_flag(tech_pvt, TFLAG_RTP_READY)) { ldl_candidate_t cand[1]; char *advip = tech_pvt->profile->extip ? tech_pvt->profile->extip : tech_pvt->profile->ip; - char *err = NULL; + char *err = NULL, *address = NULL; memset(cand, 0, sizeof(cand)); switch_stun_random_string(tech_pvt->local_user, 16, NULL); @@ -975,10 +976,14 @@ static int do_candidates(struct private_object *tech_pvt, int force) if (switch_test_flag(tech_pvt, TFLAG_LANADDR)) { advip = tech_pvt->profile->ip; } + address = advip; + if(address && !strncasecmp(address, "host:", 5)) { + address = address + 5; + } cand[0].port = tech_pvt->adv_local_port; - cand[0].address = advip; + cand[0].address = address; if (!strncasecmp(advip, "stun:", 5)) { char *stun_ip = advip + 5; @@ -2110,8 +2115,10 @@ static void set_profile_val(mdl_profile_t *profile, char *var, char *val) } else if (!strcasecmp(val, "both")) { switch_set_flag(profile, TFLAG_VAD_IN); switch_set_flag(profile, TFLAG_VAD_OUT); + } else if (!strcasecmp(val, "none")) { + switch_set_flag(profile, TFLAG_VAD_NONE); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invald option %s for VAD\n", val); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val); } } } From 7bee6d3d77a9f920480f68b33cb5c925a3b01e55 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 28 Mar 2011 09:54:04 -0500 Subject: [PATCH 166/558] vs 2008 remove libudns from solution --- Freeswitch.2008.sln | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 8528d19e28..4cfd581dad 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -602,13 +602,10 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_teletone", {204FA0DE-305D-4414-AE2E-F195A23F390D} = {204FA0DE-305D-4414-AE2E-F195A23F390D} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libudns", "libs\win32\udns\libudns.2008.vcproj", "{4043FC6A-9A30-4577-8AD5-9B233C9575D8}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_enum", "src\mod\applications\mod_enum\mod_enum.2008.vcproj", "{71A967D5-0E99-4CEF-A587-98836EE6F2EF}" ProjectSection(ProjectDependencies) = postProject {23B4D303-79FC-49E0-89E2-2280E7E28940} = {23B4D303-79FC-49E0-89E2-2280E7E28940} {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {4043FC6A-9A30-4577-8AD5-9B233C9575D8} EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_spidermonkey_odbc", "src\mod\languages\mod_spidermonkey\mod_spidermonkey_odbc.2008.vcproj", "{0A6B5EA5-6E9B-4A51-931F-ED25AA87B4DF}" @@ -1607,13 +1604,6 @@ Global {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.ActiveCfg = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|Win32.Build.0 = Release|Win32 {8F992C49-6C51-412F-B2A3-34EAB708EB65}.Release|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|Win32.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.ActiveCfg = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.All|x64.Build.0 = Release|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|Win32.ActiveCfg = Debug|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Debug|x64.ActiveCfg = Debug|x64 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|Win32.ActiveCfg = Release|Win32 - {4043FC6A-9A30-4577-8AD5-9B233C9575D8}.Release|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|Win32.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.ActiveCfg = Release|x64 {71A967D5-0E99-4CEF-A587-98836EE6F2EF}.All|x64.Build.0 = Release|x64 @@ -2958,7 +2948,6 @@ Global {204FA0DE-305D-4414-AE2E-F195A23F390D} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {70A49BC2-7500-41D0-B75D-EDCC5BE987A0} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} - {4043FC6A-9A30-4577-8AD5-9B233C9575D8} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {0A18A071-125E-442F-AFF7-A3F68ABECF99} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {CEE544A9-0303-44C2-8ECE-EFA7D7BCBBBA} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} From 484a397d88ef72bb79f91b26857ff49df592f261 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 28 Mar 2011 09:49:48 -0500 Subject: [PATCH 167/558] FS-3194 see comitted patch. I made the function assert rather than tolerate NULL and fixed the imporper usage. --- src/include/switch_utils.h | 6 +++++- src/switch_event.c | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 7fcb1e8c75..1f65b0ff43 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -151,7 +151,11 @@ static inline char *switch_strchr_strict(const char *in, char find, const char * #endif static inline int switch_string_has_escaped_data(const char *in) { - const char *i = strchr(in, '\\'); + const char *i; + + switch_assert(in); + + i = strchr(in, '\\'); while (i && *i == '\\') { i++; diff --git a/src/switch_event.c b/src/switch_event.c index 56ee9e9a9c..b7687c2041 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1565,6 +1565,10 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const int nv = 0; char *gvar = NULL; + if (zstr(in)) { + return (char *) in; + } + nv = switch_string_var_check_const(in) || switch_string_has_escaped_data(in); if (!nv) { From c735e28a5579e2aca3e7365c7e593aa8fef01781 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 28 Mar 2011 10:27:06 -0500 Subject: [PATCH 168/558] FS-3190 --- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 6963bd3c12..802e66abc5 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -800,7 +800,7 @@ void sofia_reg_auth_challenge(nua_t *nua, sofia_profile_t *profile, nua_handle_t sql = switch_mprintf("insert into sip_authentication (nonce,expires,profile_name,hostname, last_nc) " "values('%q', %ld, '%q', '%q', 0)", uuid_str, - switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL), + (long) switch_epoch_time_now(NULL) + (profile->nonce_ttl ? profile->nonce_ttl : DEFAULT_NONCE_TTL), profile->name, mod_sofia_globals.hostname); switch_assert(sql != NULL); sofia_glue_actually_execute_sql(profile, sql, profile->ireg_mutex); From 3d838d5daee0154af003f49d2ed3975fc48106a0 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 28 Mar 2011 10:55:23 -0500 Subject: [PATCH 169/558] FS-3197 - thanks Peter --- libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj | 30 ++++--------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj b/libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj index 12509c6666..41f164a0eb 100644 --- a/libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj +++ b/libs/win32/ldns/ldns-lib/ldns-lib.2008.vcproj @@ -84,7 +84,7 @@ Name="Release|Win32" OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" - ConfigurationType="1" + ConfigurationType="4" CharacterSet="2" WholeProgramOptimization="1" > @@ -109,6 +109,7 @@ Optimization="2" EnableIntrinsicFunctions="true" AdditionalIncludeDirectories="..\..\..\ldns\;." + PreprocessorDefinitions="HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE" RuntimeLibrary="2" EnableFunctionLevelLinking="true" WarningLevel="3" @@ -124,18 +125,11 @@ Name="VCPreLinkEventTool" /> - @@ -145,9 +139,6 @@ - @@ -219,7 +210,7 @@ Name="Release|x64" OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)" IntermediateDirectory="$(PlatformName)\$(ConfigurationName)" - ConfigurationType="1" + ConfigurationType="4" CharacterSet="2" WholeProgramOptimization="1" > @@ -245,6 +236,7 @@ Optimization="2" EnableIntrinsicFunctions="true" AdditionalIncludeDirectories="..\..\..\ldns\;." + PreprocessorDefinitions="HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE" RuntimeLibrary="2" EnableFunctionLevelLinking="true" WarningLevel="3" @@ -260,18 +252,11 @@ Name="VCPreLinkEventTool" /> - @@ -281,9 +266,6 @@ - From 6cf8c8f6b0ba63e8118387cb05f6d5a48a870c2f Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 28 Mar 2011 12:33:07 -0400 Subject: [PATCH 170/558] =?UTF-8?q?mod=5Fcallcenter:=20Fix=20potential=20s?= =?UTF-8?q?egfault=20on=20loopback=20agent.=20=20Thanks=20to=20Fran=C3=A7o?= =?UTF-8?q?is=20Delawarde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 6f74d3ade9..69055c132d 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1461,8 +1461,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Switch the agent session */ if (real_uuid) { switch_core_session_rwunlock(agent_session); - agent_uuid = real_uuid; agent_session = switch_core_session_locate(agent_uuid); + agent_uuid = switch_core_session_get_uuid(agent_session); agent_channel = switch_core_session_get_channel(agent_session); switch_channel_set_variable(agent_channel, "cc_queue", h->queue_name); From d04b9a85a5501de8957ec1a8c345dcf5dcf3d87a Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 28 Mar 2011 15:10:59 -0400 Subject: [PATCH 171/558] mod_callcenter: Fix error from previous commit --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 69055c132d..4240a71aae 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1461,7 +1461,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Switch the agent session */ if (real_uuid) { switch_core_session_rwunlock(agent_session); - agent_session = switch_core_session_locate(agent_uuid); + agent_session = switch_core_session_locate(real_uuid); agent_uuid = switch_core_session_get_uuid(agent_session); agent_channel = switch_core_session_get_channel(agent_session); From 6388e03d075f4b1cb43eca3ebc8e56eec727e709 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 28 Mar 2011 13:50:42 -0500 Subject: [PATCH 172/558] allow 100 microsecond tolerance on timer loop --- src/switch_core.c | 10 +++++----- src/switch_time.c | 7 ++++++- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index 68186d9a07..53f21dfb79 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1655,18 +1655,18 @@ static void switch_load_core_config(const char *file) switch_core_default_dtmf_duration((uint32_t) tmp); } } else if (!strcasecmp(var, "enable-monotonic-timing")) { - switch_time_set_monotonic(switch_true(var)); + switch_time_set_monotonic(switch_true(val)); } else if (!strcasecmp(var, "enable-softtimer-timerfd")) { - switch_time_set_timerfd(switch_true(var)); + switch_time_set_timerfd(switch_true(val)); if (switch_true(val)) { switch_clear_flag((&runtime), SCF_CALIBRATE_CLOCK); } } else if (!strcasecmp(var, "enable-clock-nanosleep")) { - switch_time_set_nanosleep(switch_true(var)); + switch_time_set_nanosleep(switch_true(val)); } else if (!strcasecmp(var, "enable-cond-yield")) { - switch_time_set_cond_yield(switch_true(var)); + switch_time_set_cond_yield(switch_true(val)); } else if (!strcasecmp(var, "enable-timer-matrix")) { - switch_time_set_matrix(switch_true(var)); + switch_time_set_matrix(switch_true(val)); } else if (!strcasecmp(var, "max-sessions") && !zstr(val)) { switch_core_session_limit(atoi(val)); } else if (!strcasecmp(var, "verbose-channel-events") && !zstr(val)) { diff --git a/src/switch_time.c b/src/switch_time.c index 375682e005..70972a660b 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -756,7 +756,8 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) while (globals.RUNNING == 1) { runtime.reference += STEP_MIC; - while ((ts = time_now(runtime.offset)) < runtime.reference) { + + while (((ts = time_now(runtime.offset)) + 100) < runtime.reference) { if (ts < last) { if (MONO) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Virtual Migration Detected! Syncing Clock\n"); @@ -770,6 +771,10 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) runtime.initiated += diff; rev_errs++; } + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, + "If you see this message many times try setting the param enable-clock-nanosleep to true in switch.conf.xml or consider a nicer machine to run me on. I AM *FREE* afterall.\n"); + } else { rev_errs = 0; } From 87884c5c678f50a8cb1ad1c60f40d28691e36e93 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Mon, 28 Mar 2011 21:17:52 +0200 Subject: [PATCH 173/558] mod_enum: fix race condition between ldns configure creating ldns/util.h and mod_enum Unbreaking make -jX parallel builds... Signed-off-by: Stefan Knoblich --- src/mod/applications/mod_enum/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_enum/Makefile b/src/mod/applications/mod_enum/Makefile index e9abd18654..638990607e 100644 --- a/src/mod/applications/mod_enum/Makefile +++ b/src/mod/applications/mod_enum/Makefile @@ -18,3 +18,4 @@ $(LDNS_LA): $(LDNS_BUILDDIR)/Makefile cd $(LDNS_BUILDDIR) && $(MAKE) $(TOUCH_TARGET) +$(MODNAME).lo: $(LDNS_LA) From 246b21952df20afbbf548feab718300e6087727a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 28 Mar 2011 14:44:23 -0500 Subject: [PATCH 174/558] FS-3095 --comment-only This patch removes the existing conference transfer function and replaces it using the core transfer it also introduces a new tracking method where the same conference id is reserved for a particular member for the lifetime of the call allowing a user to transfer in and out of conferences and ivr and bridges etc and retain the same member id for the duration of that call --- .../mod_conference/mod_conference.c | 151 +++--------------- 1 file changed, 25 insertions(+), 126 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 0f5ea26e09..8103a39abc 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -4511,18 +4511,17 @@ static switch_status_t conf_api_sub_bgdial(conference_obj_t *conference, switch_ return SWITCH_STATUS_SUCCESS; } + + static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { switch_status_t ret_status = SWITCH_STATUS_SUCCESS; char *conf_name = NULL, *profile_name; switch_event_t *params = NULL; - conference_obj_t *new_conference = NULL; - int locked = 0; - switch_core_session_message_t msg = { 0 }; switch_assert(conference != NULL); switch_assert(stream != NULL); - + if (argc > 3 && !zstr(argv[2])) { int x; @@ -4539,124 +4538,21 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc uint32_t id = atoi(argv[x]); switch_channel_t *channel; switch_event_t *event; - switch_xml_t cxml = NULL, cfg = NULL, profiles = NULL; - + char *xdest = NULL; + if (!id || !(member = conference_member_get(conference, id))) { stream->write_function(stream, "No Member %u in conference %s.\n", id, conference->name); continue; } channel = switch_core_session_get_channel(member->session); - - if (!new_conference) { - if (!locked) { - switch_mutex_lock(globals.setup_mutex); - locked = 1; - } - - if ((new_conference = conference_find(conf_name))) { - if (locked) { - switch_mutex_unlock(globals.setup_mutex); - locked = 0; - } - } - - if (!(new_conference = conference_find(conf_name))) { - /* build a new conference if it doesn't exist */ - switch_memory_pool_t *pool = NULL; - conf_xml_cfg_t xml_cfg = { 0 }; - - /* Setup a memory pool to use. */ - if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n"); - switch_thread_rwlock_unlock(member->rwlock); - goto done; - } - - switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); - switch_assert(params); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "conf_name", conf_name); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "profile_name", profile_name); - switch_channel_event_set_data(channel, params); - - /* Open the config from the xml registry */ - if (!(cxml = switch_xml_open_cfg(global_cf_name, &cfg, params))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf_name); - switch_thread_rwlock_unlock(member->rwlock); - goto done; - } - - if ((profiles = switch_xml_child(cfg, "profiles"))) { - xml_cfg.profile = switch_xml_find_child(profiles, "profile", "name", profile_name); - } - - /* Create the conference object. */ - new_conference = conference_new(conf_name, xml_cfg, member->session, pool); - - /* Release the config registry handle */ - if (cxml) { - switch_xml_free(cxml); - cxml = NULL; - } - - if (!new_conference) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - if (pool != NULL) { - switch_core_destroy_memory_pool(&pool); - } - switch_thread_rwlock_unlock(member->rwlock); - goto done; - } - - if (locked) { - switch_mutex_unlock(globals.setup_mutex); - locked = 0; - } - - /* Set the minimum number of members (once you go above it you cannot go below it) */ - new_conference->min = 1; - - /* Indicate the conference is dynamic */ - switch_set_flag_locked(new_conference, CFLAG_DYNAMIC); - - switch_mutex_lock(new_conference->mutex); - - /* Start the conference thread for this conference */ - launch_conference_thread(new_conference); - } else { - switch_mutex_lock(new_conference->mutex); - } - } - - /* move the member from the old conference to the new one */ - lock_member(member); - switch_thread_rwlock_unlock(member->rwlock); - - if (conference != new_conference) { - conference_del_member(conference, member); - conference_add_member(new_conference, member); - - if (conference->rate != new_conference->rate) { - if (setup_media(member, new_conference)) { - switch_clear_flag_locked(member, MFLAG_RUNNING); - } else { - switch_channel_set_app_flag(channel, CF_APP_TAGGED); - switch_set_flag_locked(member, MFLAG_RESTART); - } - } - } - - switch_channel_set_variable(channel, "last_transfered_conference", argv[2]); - - /* Sync the recovery data */ - msg.from = __FILE__; - msg.message_id = SWITCH_MESSAGE_INDICATE_RECOVERY_REFRESH; - switch_core_session_receive_message(member->session, &msg); - - unlock_member(member); + xdest = switch_core_session_sprintf(member->session, "conference:%s@%s", conf_name, profile_name); + switch_ivr_session_transfer(member->session, xdest, "inline", NULL); + + switch_channel_set_variable(channel, "last_transfered_conference", conf_name); stream->write_function(stream, "OK Member '%d' sent to conference %s.\n", member->id, argv[2]); - + /* tell them what happened */ if (test_eflag(conference, EFLAG_TRANSFER) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { @@ -4666,30 +4562,23 @@ static switch_status_t conf_api_sub_transfer(conference_obj_t *conference, switc switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "transfer"); switch_event_fire(&event); } - } - if (new_conference) { - switch_mutex_unlock(new_conference->mutex); + switch_thread_rwlock_unlock(member->rwlock); } - } else { ret_status = SWITCH_STATUS_GENERR; } - done: - - if (locked) { - switch_mutex_unlock(globals.setup_mutex); - locked = 0; - } - if (params) { switch_event_destroy(¶ms); } + switch_safe_free(conf_name); + return ret_status; } + static switch_status_t conf_api_sub_record(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { switch_assert(conference != NULL); @@ -5621,6 +5510,7 @@ SWITCH_STANDARD_APP(conference_function) conf_xml_cfg_t xml_cfg = { 0 }; switch_event_t *params = NULL; int locked = 0; + uint32_t *mid; if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_DONE) && (switch_channel_test_flag(channel, CF_RECOVERED) || switch_true(switch_channel_get_variable(channel, "conference_silent_entry")))) { @@ -5993,8 +5883,17 @@ SWITCH_STANDARD_APP(conference_function) goto done; } + + if (!(mid = switch_channel_get_private(channel, "__confmid"))) { + mid = switch_core_session_alloc(session, sizeof(*mid)); + *mid = next_member_id(); + switch_channel_set_private(channel, "__confmid", mid); + } + + switch_channel_set_variable_printf(channel, "conference_member_id", "%u", *mid); + /* Prepare MUTEXS */ - member.id = next_member_id(); + member.id = *mid; switch_mutex_init(&member.flag_mutex, SWITCH_MUTEX_NESTED, member.pool); switch_mutex_init(&member.write_mutex, SWITCH_MUTEX_NESTED, member.pool); switch_mutex_init(&member.read_mutex, SWITCH_MUTEX_NESTED, member.pool); From 084819a3314fcb8508a6ec42e45f525da31d9508 Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Mon, 28 Mar 2011 18:17:59 -0500 Subject: [PATCH 175/558] Fix FS-3199 --- src/mod/applications/mod_lcr/mod_lcr.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 593117942a..17bbb443b1 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -153,6 +153,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_lcr_load); SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_lcr_shutdown); SWITCH_MODULE_DEFINITION(mod_lcr, mod_lcr_load, mod_lcr_shutdown, NULL); +static void lcr_destroy(lcr_route route) +{ + while(route) { + switch_event_destroy(&route->fields); + route=route->next; + } +} + static const char *do_cid(switch_memory_pool_t *pool, const char *cid, const char *number, switch_core_session_t *session) { switch_regex_t *re = NULL; @@ -717,7 +725,7 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa end: - switch_event_destroy(&additional->fields); + /* event is freed in lcr_destroy() switch_event_destroy(&additional->fields); */ return r; @@ -900,6 +908,7 @@ static switch_bool_t test_profile(char *lcr_profile) routes.lookup_number = "15555551212"; routes.cid = "18005551212"; + lcr_destroy(routes.head); return (lcr_do_lookup(&routes) == SWITCH_STATUS_SUCCESS) ? SWITCH_TRUE : SWITCH_FALSE; } @@ -1378,6 +1387,7 @@ static switch_call_cause_t lcr_outgoing_channel(switch_core_session_t *session, if (mysession) { switch_core_session_rwunlock(mysession); } + lcr_destroy(routes.head); switch_core_destroy_memory_pool(&pool); switch_safe_free(dest); @@ -1475,6 +1485,7 @@ SWITCH_STANDARD_DIALPLAN(lcr_dialplan_hunt) } end: + lcr_destroy(routes.head); if (event) { switch_event_destroy(&event); } @@ -1607,6 +1618,7 @@ SWITCH_STANDARD_APP(lcr_app_function) } end: + lcr_destroy(routes.head); if (routes.event) { switch_event_destroy(&event); } @@ -1819,6 +1831,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function) } end: + lcr_destroy(cb_struct.head); if (!session) { if (pool) { switch_core_destroy_memory_pool(&pool); From 98a950165a356d57906a2e3f49a80c02ffea4bd0 Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Mon, 28 Mar 2011 18:24:01 -0500 Subject: [PATCH 176/558] =?UTF-8?q?FS-1792=20-=20add=20API=20uuid=5Flimit?= =?UTF-8?q?=20-=20thanks=20to=20Fran=E7ois=20Delawarde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applications/mod_commands/mod_commands.c | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index a6df087cb0..fd2081e31d 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -4843,6 +4843,87 @@ end: return SWITCH_STATUS_SUCCESS; } +#define LIMIT_SYNTAX " [[/interval]] [number [dialplan [context]]]" +SWITCH_STANDARD_API(uuid_limit_function) +{ + int argc = 0; + char *argv[8] = { 0 }; + char *mydata = NULL; + char *realm = NULL; + char *resource = NULL; + char *xfer_exten = NULL; + int max = -1; + int interval = 0; + switch_core_session_t *sess = NULL; + switch_status_t res = SWITCH_STATUS_SUCCESS; + + if (!zstr(cmd)) { + mydata = strdup(cmd); + switch_assert(mydata); + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argc < 4) { + stream->write_function(stream, "USAGE: uuid_limit %s\n", LIMIT_SYNTAX); + goto end; + } + + realm = argv[2]; + resource = argv[3]; + + /* If max is omitted or negative, only act as a counter and skip maximum checks */ + if (argc > 4) { + if (argv[4][0] == '-') { + max = -1; + } else { + char *szinterval = NULL; + if ((szinterval = strchr(argv[4], '/'))) { + *szinterval++ = '\0'; + interval = atoi(szinterval); + } + + max = atoi(argv[4]); + + if (max < 0) { + max = 0; + } + } + } + + if (argc > 5) { + xfer_exten = argv[5]; + } else { + xfer_exten = LIMIT_DEF_XFER_EXTEN; + } + + sess = switch_core_session_locate(argv[0]); + if (!sess) { + stream->write_function(stream, "-ERR did not find a session with uuid %s\n", argv[0]); + goto end; + } + + res = switch_limit_incr(argv[1], sess, realm, resource, max, interval); + + if (res != SWITCH_STATUS_SUCCESS) { + /* Limit exceeded */ + if (*xfer_exten == '!') { + switch_channel_t *channel = switch_core_session_get_channel(sess); + switch_channel_hangup(channel, switch_channel_str2cause(xfer_exten + 1)); + } else { + switch_ivr_session_transfer(sess, xfer_exten, argv[6], argv[7]); + } + } + + switch_core_session_rwunlock(sess); + + stream->write_function(stream, "+OK"); + +end: + switch_safe_free(mydata); + + return SWITCH_STATUS_SUCCESS; +} + #define LIMIT_RELEASE_SYNTAX " [realm] [resource]" SWITCH_STANDARD_API(uuid_limit_release_function) { @@ -5063,6 +5144,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "uuid_getvar", "uuid_getvar", uuid_getvar_function, GETVAR_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_hold", "hold", uuid_hold_function, HOLD_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_kill", "Kill Channel", kill_function, KILL_SYNTAX); + SWITCH_ADD_API(commands_api_interface, "uuid_limit", "Increase limit resource", uuid_limit_function, LIMIT_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_limit_release", "Release limit resource", uuid_limit_release_function, LIMIT_RELEASE_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_loglevel", "set loglevel on session", uuid_loglevel, UUID_LOGLEVEL_SYNTAX); SWITCH_ADD_API(commands_api_interface, "uuid_media", "media", uuid_media_function, MEDIA_SYNTAX); @@ -5181,6 +5263,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) switch_console_set_complete("add uuid_hold ::console::list_uuid"); switch_console_set_complete("add uuid_jitterbuffer ::console::list_uuid"); switch_console_set_complete("add uuid_kill ::console::list_uuid"); + switch_console_set_complete("add uuid_limit ::console::list_uuid"); switch_console_set_complete("add uuid_limit_release ::console::list_uuid"); switch_console_set_complete("add uuid_loglevel ::console::list_uuid console"); switch_console_set_complete("add uuid_loglevel ::console::list_uuid alert"); From 9d8e54b500a663962097a029a36598a790c9fdd5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 28 Mar 2011 18:31:40 -0500 Subject: [PATCH 177/558] FS-2751 --comment-only Please try latest patch with profile param NDLB-force-rport set to server-only or disabled. The parameter you were hacking on only applies to inbound calls not outbound calls. Its confusing but in in sip lingo client and server are outbound and inbound call direction respectively. --- src/mod/endpoints/mod_sofia/mod_sofia.h | 3 ++- src/mod/endpoints/mod_sofia/sofia.c | 29 +++++++++++++++---------- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 +- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 156a69d5a7..65404050e4 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -564,7 +564,8 @@ struct sofia_profile { uint32_t reg_acl_count; char *nat_acl[SOFIA_MAX_ACL]; uint32_t nat_acl_count; - int rport_level; + int server_rport_level; + int client_rport_level; sofia_presence_type_t pres_type; sofia_media_options_t media_options; uint32_t force_subscription_expires; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d657fdd410..ca9b0cd974 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1516,7 +1516,8 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void TAG_IF(sofia_test_pflag(profile, PFLAG_DISABLE_NAPTR), NTATAG_USE_NAPTR(0)), NTATAG_DEFAULT_PROXY(profile->outbound_proxy), - NTATAG_SERVER_RPORT(profile->rport_level), + NTATAG_SERVER_RPORT(profile->server_rport_level), + NTATAG_CLIENT_RPORT(profile->client_rport_level), TPTAG_LOG(sofia_test_flag(profile, TFLAG_TPORT_LOG)), TAG_IF(sofia_test_pflag(profile, PFLAG_SIPCOMPACT), NTATAG_SIPFLAGS(MSG_DO_COMPACT)), @@ -1579,7 +1580,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void node->nua = nua_create(profile->s_root, /* Event loop */ sofia_event_callback, /* Callback for processing events */ profile, /* Additional data to pass to callback */ - NTATAG_SERVER_RPORT(profile->rport_level), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */ + NTATAG_SERVER_RPORT(profile->server_rport_level), NUTAG_URL(node->url), TAG_END()); /* Last tag should always finish the sequence */ nua_set_params(node->nua, NUTAG_APPL_METHOD("OPTIONS"), @@ -2342,7 +2343,6 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } /* you could change profile->foo here if it was a minor change like context or dialplan ... */ - profile->rport_level = 1; /* default setting */ profile->acl_count = 0; profile->reg_acl_count = 0; profile->proxy_acl_count = 0; @@ -2493,12 +2493,6 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile) } else { profile->dtmf_type = DTMF_NONE; } - } else if (!strcasecmp(var, "NDLB-force-rport")) { - if (val && !strcasecmp(val, "safe")) { - profile->rport_level = 3; - } else if (switch_true(val)) { - profile->rport_level = 2; - } } else if (!strcasecmp(var, "caller-id-type")) { profile->cid_type = sofia_cid_name2type(val); } else if (!strcasecmp(var, "record-template")) { @@ -3064,7 +3058,8 @@ switch_status_t config_sofia(int reload, char *profile_name) profile->dtmf_duration = 100; profile->tls_version = 0; profile->mflags = MFLAG_REFER | MFLAG_REGISTER; - profile->rport_level = 1; + profile->server_rport_level = 1; + profile->client_rport_level = 1; sofia_set_pflag(profile, PFLAG_STUN_ENABLED); sofia_set_pflag(profile, PFLAG_DISABLE_100REL); profile->auto_restart = 1; @@ -3206,9 +3201,19 @@ switch_status_t config_sofia(int reload, char *profile_name) } } else if (!strcasecmp(var, "NDLB-force-rport")) { if (val && !strcasecmp(val, "safe")) { - profile->rport_level = 3; + profile->server_rport_level = 3; + profile->client_rport_level = 1; + } else if (val && !strcasecmp(val, "disabled")) { + profile->server_rport_level = 0; + profile->client_rport_level = 0; + } else if (val && !strcasecmp(val, "client-only")) { + profile->client_rport_level = 1; + } else if (val && !strcasecmp(val, "server-only")) { + profile->client_rport_level = 0; + profile->client_rport_level = 1; } else if (switch_true(val)) { - profile->rport_level = 2; + profile->server_rport_level = 2; + profile->client_rport_level = 1; } } else if (!strcasecmp(var, "auto-rtp-bugs")) { sofia_glue_parse_rtp_bugs(&profile->auto_rtp_bugs, val); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 802e66abc5..cac1d2f051 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -1104,7 +1104,7 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand to_user = force_user; } - if (profile->rport_level == 3 && sip->sip_user_agent && + if (profile->server_rport_level == 3 && sip->sip_user_agent && sip->sip_user_agent->g_string && !strncasecmp(sip->sip_user_agent->g_string, "Polycom", 7)) { if (sip && sip->sip_via) { const char *host = sip->sip_via->v_host; From 7e52acf8ea0e0ad35de205b1c24dccd497e8fc4d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 28 Mar 2011 22:18:47 -0500 Subject: [PATCH 178/558] reduce flags to buy time. Solaris thinks enum should be int32 not uint32 and cries about overflow in enum shifted by 31 --- src/include/switch_types.h | 6 ++---- src/mod/endpoints/mod_dingaling/mod_dingaling.c | 14 -------------- 2 files changed, 2 insertions(+), 18 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 3383a9d88c..e732bca597 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -515,7 +515,6 @@ typedef enum { SWITCH_RTP_FLAG_NOBLOCK - Do not block SWITCH_RTP_FLAG_IO - IO is ready SWITCH_RTP_FLAG_USE_TIMER - Timeout Reads and replace with a CNG Frame - SWITCH_RTP_FLAG_TIMER_RECLOCK - Resync the timer to the current clock on slips SWITCH_RTP_FLAG_SECURE - Secure RTP SWITCH_RTP_FLAG_AUTOADJ - Auto-Adjust the dest based on the source SWITCH_RTP_FLAG_RAW_WRITE - Try to forward packets unscathed @@ -532,7 +531,7 @@ typedef enum { SWITCH_RTP_FLAG_NOBLOCK = (1 << 0), SWITCH_RTP_FLAG_IO = (1 << 1), SWITCH_RTP_FLAG_USE_TIMER = (1 << 2), - SWITCH_RTP_FLAG_TIMER_RECLOCK = (1 << 3), + SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 3), SWITCH_RTP_FLAG_SECURE_SEND = (1 << 4), SWITCH_RTP_FLAG_SECURE_RECV = (1 << 5), SWITCH_RTP_FLAG_AUTOADJ = (1 << 6), @@ -559,8 +558,7 @@ typedef enum { SWITCH_RTP_FLAG_DEBUG_RTP_READ = (1 << 27), SWITCH_RTP_FLAG_DEBUG_RTP_WRITE = (1 << 28), SWITCH_RTP_FLAG_VIDEO = (1 << 29), - SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30), - SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 31) + SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30) /* don't add any more 31 is the limit! gotta chnge to an array to add more */ } switch_rtp_flag_enum_t; typedef uint32_t switch_rtp_flag_t; diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 64dcf50906..b0bfeada97 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -1573,22 +1573,8 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s channel_answer_channel(session); break; case SWITCH_MESSAGE_INDICATE_BRIDGE: - /* - if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) { - switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "De-activate timed RTP!\n"); - //switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK); - } - */ break; case SWITCH_MESSAGE_INDICATE_UNBRIDGE: - /* - if (tech_pvt->rtp_session && switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) { - switch_rtp_set_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_USE_TIMER); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Re-activate timed RTP!\n"); - //switch_rtp_clear_flag(tech_pvt->rtp_session, SWITCH_RTP_FLAG_TIMER_RECLOCK); - } - */ break; default: break; From 74bbd4be84b2b0633116b9a2dff6b726eb065b8f Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 29 Mar 2011 13:09:45 +0200 Subject: [PATCH 179/558] mod_opus: Use libtool archives for linking, add dependencies to fix parallel builds Signed-off-by: Stefan Knoblich --- src/mod/codecs/mod_opus/Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mod/codecs/mod_opus/Makefile b/src/mod/codecs/mod_opus/Makefile index a34695678b..21a526a671 100644 --- a/src/mod/codecs/mod_opus/Makefile +++ b/src/mod/codecs/mod_opus/Makefile @@ -6,9 +6,9 @@ OPUS_DIR=$(switch_srcdir)/libs/$(OPUS) OPUS_BUILDDIR=$(switch_builddir)/libs/$(OPUS) LOCAL_CFLAGS=-I$(OPUS_DIR)/src -g -O2 -IETF_LA=$(OPUS_BUILDDIR)/src/.libs/libietfcodec.a -CELT_LA=$(OPUS_BUILDDIR)/celt/libcelt/.libs/libcelt0.a -SILK_LA=$(OPUS_BUILDDIR)/silk/.libs/libSKP_SILK_SDK.a +IETF_LA=$(OPUS_BUILDDIR)/src/libietfcodec.la +CELT_LA=$(OPUS_BUILDDIR)/celt/libcelt/libcelt0.la +SILK_LA=$(OPUS_BUILDDIR)/silk/libSKP_SILK_SDK.la LOCAL_LIBADD=$(IETF_LA) $(CELT_LA) $(SILK_LA) -lm -lz @@ -26,3 +26,7 @@ $(IETF_LA): $(OPUS_BUILDDIR)/Makefile cd $(OPUS_BUILDDIR) && $(MAKE) $(TOUCH_TARGET) +$(CELT_LA): $(IETF_LA) +$(SILK_LA): $(IETF_LA) + +$(MODNAME).lo: $(IETF_LA) $(CELT_LA) $(SILK_LA) From 6e37a8b25cbb5cff17a06f366cce924daeaa7698 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 29 Mar 2011 13:11:59 +0200 Subject: [PATCH 180/558] mod_celt: Add dependency to fix parallel builds Signed-off-by: Stefan Knoblich --- src/mod/codecs/mod_celt/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/codecs/mod_celt/Makefile b/src/mod/codecs/mod_celt/Makefile index 2d2e27f04c..a3cf7b36c5 100644 --- a/src/mod/codecs/mod_celt/Makefile +++ b/src/mod/codecs/mod_celt/Makefile @@ -21,3 +21,4 @@ $(CELT_LA): $(CELT_BUILDDIR)/Makefile cd $(CELT_BUILDDIR) && $(MAKE) $(TOUCH_TARGET) +$(MODNAME).lo: $(CELT_LA) From 32ff931329b6ce41c7e2deea4dc3d5b9eaff900c Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 29 Mar 2011 08:56:34 -0500 Subject: [PATCH 181/558] JANITOR-11 --- libs/.gitignore | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libs/.gitignore b/libs/.gitignore index df284b71b6..b9aa87286c 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -263,6 +263,19 @@ /js/nsprpub/pr/tests/dll/Makefile /js/src/jsautocfg.h /js/src/perlconnect/Makefile.PL +/ldns/Makefile +/ldns/doc/ldns_manpages +/ldns/include/ +/ldns/ldns/config.h +/ldns/ldns/net.h +/ldns/ldns/util.h +/ldns/lib +/ldns/libtool +/ldns/linktest +/ldns/linktest.dSYM/ +/ldns/packaging/ldns-config +/ldns/packaging/libldns.pc +/ldns-1.6.9/ /libdingaling/Makefile /libdingaling/Makefile.in /libdingaling/aclocal.m4 @@ -346,6 +359,7 @@ /libg722_1/tests/Makefile /libg722_1/tests/Makefile.in /libg722_1/tests/regression_tests.sh +/libg722_1/g722_1.pc /libsndfile/Cfg/compile /libsndfile/Cfg/config.guess /libsndfile/Cfg/config.sub @@ -1126,3 +1140,6 @@ BuildLog*.htm /win32/celt/*/*/libcelt.log /win32/libg722_1/*/*/libg722_1.log /win32/libshout/*/*/libshout.log +openssl_manifest.rc +libeay32_manifest.rc +ssleay32_manifest.rc From 68b98f4bd05f0ccd57a9ed7a292ed55bf8cf481d Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 29 Mar 2011 11:50:05 -0400 Subject: [PATCH 182/558] freetdm - SS7:Fix for VETO when trying to indicate ring-ready --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 17 +++++++++++++++-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 8e57473202..70a99ef901 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -109,7 +109,15 @@ ftdm_state_map_t sangoma_ss7_state_map = { {FTDM_CHANNEL_STATE_RING, FTDM_END}, {FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART, FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, - FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + FTDM_CHANNEL_STATE_RINGING, FTDM_CHANNEL_STATE_PROGRESS, FTDM_END} + }, + { + ZSD_INBOUND, + ZSM_UNACCEPTABLE, + {FTDM_CHANNEL_STATE_RINGING, FTDM_END}, + {FTDM_CHANNEL_STATE_TERMINATING, FTDM_CHANNEL_STATE_HANGUP, + FTDM_CHANNEL_STATE_PROGRESS, FTDM_CHANNEL_STATE_PROGRESS_MEDIA, + FTDM_CHANNEL_STATE_UP, FTDM_END}, }, { ZSD_INBOUND, @@ -609,6 +617,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) break; /**************************************************************************/ + /* We handle RING indication the same way we would indicate PROGRESS */ + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS: if (ftdmchan->last_state == FTDM_CHANNEL_STATE_SUSPENDED) { @@ -626,7 +636,10 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA); } else { /* inbound call so we need to send out ACM */ - ft_to_sngss7_acm(ftdmchan); + if (!sngss7_test_ckt_flag(sngss7_info, FLAG_SENT_ACM)) { + sngss7_set_ckt_flag(sngss7_info, FLAG_SENT_ACM); + ft_to_sngss7_acm(ftdmchan); + } } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index df8b086c49..c9ec787fae 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -503,6 +503,7 @@ typedef enum { FLAG_GLARE = (1 << 13), FLAG_INFID_RESUME = (1 << 14), FLAG_INFID_PAUSED = (1 << 15), + FLAG_SENT_ACM = (1 << 16), FLAG_RELAY_DOWN = (1 << 30), FLAG_CKT_RECONFIG = (1 << 31) } sng_ckt_flag_t; From 06bccf280147802792792b959bfdcd98195993cc Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 29 Mar 2011 12:08:07 -0500 Subject: [PATCH 183/558] FS-3202 --- src/mod/say/mod_say_de/mod_say_de.c | 2 +- src/mod/say/mod_say_en/mod_say_en.c | 4 ++-- src/mod/say/mod_say_es/mod_say_es.c | 2 +- src/mod/say/mod_say_fr/mod_say_fr.c | 2 +- src/mod/say/mod_say_hr/mod_say_hr.c | 2 +- src/mod/say/mod_say_hu/mod_say_hu.c | 2 +- src/mod/say/mod_say_it/mod_say_it.c | 2 +- src/mod/say/mod_say_ja/mod_say_ja.c | 2 +- src/mod/say/mod_say_nl/mod_say_nl.c | 2 +- src/mod/say/mod_say_pt/mod_say_pt.c | 4 ++-- src/mod/say/mod_say_ru/mod_say_ru.c | 2 +- src/mod/say/mod_say_th/mod_say_th.c | 2 +- src/mod/say/mod_say_zh/mod_say_zh.c | 2 +- 13 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/mod/say/mod_say_de/mod_say_de.c b/src/mod/say/mod_say_de/mod_say_de.c index ea0b380e4e..7b2c349299 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -130,7 +130,7 @@ static switch_status_t de_say_general_count(switch_core_session_t *session, char char sbuf[13] = ""; switch_status_t status; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 03bea87bc1..202f0d6ff2 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -126,7 +126,7 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char switch_status_t status; if (say_args->method == SSM_ITERATED) { - if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)))) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { char *p; for (p = tosay; p && *p; p++) { say_file("digits/%c.wav", *p); @@ -138,7 +138,7 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char return SWITCH_STATUS_SUCCESS; } - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index ff0ee944c2..7f806f4c7c 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -158,7 +158,7 @@ static switch_status_t es_say_general_count(switch_core_session_t *session, char char sbuf[13] = ""; switch_status_t status; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_fr/mod_say_fr.c b/src/mod/say/mod_say_fr/mod_say_fr.c index cf3ebabcdb..eb6f6d526c 100644 --- a/src/mod/say/mod_say_fr/mod_say_fr.c +++ b/src/mod/say/mod_say_fr/mod_say_fr.c @@ -147,7 +147,7 @@ static switch_status_t fr_say_general_count(switch_core_session_t *session, char char sbuf[13] = ""; switch_status_t status; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_hr/mod_say_hr.c b/src/mod/say/mod_say_hr/mod_say_hr.c index af2aa972c5..df124a8c74 100644 --- a/src/mod/say/mod_say_hr/mod_say_hr.c +++ b/src/mod/say/mod_say_hr/mod_say_hr.c @@ -232,7 +232,7 @@ static switch_status_t hr_say_count(switch_core_session_t *session, char* gen, strcpy(tgen, gen); - if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_hu/mod_say_hu.c b/src/mod/say/mod_say_hu/mod_say_hu.c index 6a3dfdc65e..caa26f70cf 100644 --- a/src/mod/say/mod_say_hu/mod_say_hu.c +++ b/src/mod/say/mod_say_hu/mod_say_hu.c @@ -126,7 +126,7 @@ static switch_status_t hu_say_general_count(switch_core_session_t *session, char int number; switch_status_t status; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_it/mod_say_it.c b/src/mod/say/mod_say_it/mod_say_it.c index 7a3c7bc99c..e131dde327 100644 --- a/src/mod/say/mod_say_it/mod_say_it.c +++ b/src/mod/say/mod_say_it/mod_say_it.c @@ -134,7 +134,7 @@ static switch_status_t it_say_general_count(switch_core_session_t *session, char char sbuf[13] = ""; switch_status_t status; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c index 407d2d4a91..8874748462 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -88,7 +88,7 @@ static switch_status_t ja_say_general_count(switch_core_session_t *session, char char digits[11]; int i; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_nl/mod_say_nl.c b/src/mod/say/mod_say_nl/mod_say_nl.c index 4f4ec7edd0..3a9c89fb94 100644 --- a/src/mod/say/mod_say_nl/mod_say_nl.c +++ b/src/mod/say/mod_say_nl/mod_say_nl.c @@ -121,7 +121,7 @@ static switch_status_t nl_say_general_count(switch_core_session_t *session, char char sbuf[13] = ""; switch_status_t status; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_pt/mod_say_pt.c b/src/mod/say/mod_say_pt/mod_say_pt.c index 747a0c8984..4dd6fba81f 100644 --- a/src/mod/say/mod_say_pt/mod_say_pt.c +++ b/src/mod/say/mod_say_pt/mod_say_pt.c @@ -154,7 +154,7 @@ static switch_status_t pt_say_general_count(switch_core_session_t *session, char switch_status_t status; if (say_args->method == SSM_ITERATED) { - if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)))) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { char *p; for (p = tosay; p && *p; p++) { say_file("digits/%c.wav", *p); @@ -166,7 +166,7 @@ static switch_status_t pt_say_general_count(switch_core_session_t *session, char return SWITCH_STATUS_SUCCESS; } - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 21e3017ef9..559075785f 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -164,7 +164,7 @@ static switch_status_t ru_say_count(switch_core_session_t *session, char *tosay, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say_count %s!\n", tosay); - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_th/mod_say_th.c b/src/mod/say/mod_say_th/mod_say_th.c index 59b077a0fe..1b83363165 100644 --- a/src/mod/say/mod_say_th/mod_say_th.c +++ b/src/mod/say/mod_say_th/mod_say_th.c @@ -94,7 +94,7 @@ static switch_status_t th_say_general_count(switch_core_session_t *session, char char digits[11]; int i; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_zh/mod_say_zh.c b/src/mod/say/mod_say_zh/mod_say_zh.c index e448ea6b63..24f8aa927a 100644 --- a/src/mod/say/mod_say_zh/mod_say_zh.c +++ b/src/mod/say/mod_say_zh/mod_say_zh.c @@ -93,7 +93,7 @@ static switch_status_t zh_say_general_count(switch_core_session_t *session, char char digits[11]; int i; - if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } From cfe087ec57864296ffbefafcd3f62cd65418d356 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 29 Mar 2011 13:09:15 -0500 Subject: [PATCH 184/558] FS-3202 --- src/mod/say/mod_say_de/mod_say_de.c | 2 +- src/mod/say/mod_say_en/mod_say_en.c | 2 +- src/mod/say/mod_say_es/mod_say_es.c | 2 +- src/mod/say/mod_say_fr/mod_say_fr.c | 2 +- src/mod/say/mod_say_hr/mod_say_hr.c | 2 +- src/mod/say/mod_say_hu/mod_say_hu.c | 2 +- src/mod/say/mod_say_it/mod_say_it.c | 2 +- src/mod/say/mod_say_ja/mod_say_ja.c | 2 +- src/mod/say/mod_say_nl/mod_say_nl.c | 2 +- src/mod/say/mod_say_pt/mod_say_pt.c | 2 +- src/mod/say/mod_say_ru/mod_say_ru.c | 2 +- src/mod/say/mod_say_th/mod_say_th.c | 2 +- src/mod/say/mod_say_zh/mod_say_zh.c | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/mod/say/mod_say_de/mod_say_de.c b/src/mod/say/mod_say_de/mod_say_de.c index 7b2c349299..fec6ddb680 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -327,7 +327,7 @@ static switch_status_t de_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 202f0d6ff2..6c604f208e 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -394,7 +394,7 @@ static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index 7f806f4c7c..0576e16c6c 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -362,7 +362,7 @@ static switch_status_t es_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_fr/mod_say_fr.c b/src/mod/say/mod_say_fr/mod_say_fr.c index eb6f6d526c..5ddd8fb58e 100644 --- a/src/mod/say/mod_say_fr/mod_say_fr.c +++ b/src/mod/say/mod_say_fr/mod_say_fr.c @@ -399,7 +399,7 @@ static switch_status_t fr_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_hr/mod_say_hr.c b/src/mod/say/mod_say_hr/mod_say_hr.c index df124a8c74..4c560db80a 100644 --- a/src/mod/say/mod_say_hr/mod_say_hr.c +++ b/src/mod/say/mod_say_hr/mod_say_hr.c @@ -1016,7 +1016,7 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay, int zadnja_lipa = 0; int predzadnja_lipa = 0; - if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) + if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; diff --git a/src/mod/say/mod_say_hu/mod_say_hu.c b/src/mod/say/mod_say_hu/mod_say_hu.c index caa26f70cf..ca1b90f584 100644 --- a/src/mod/say/mod_say_hu/mod_say_hu.c +++ b/src/mod/say/mod_say_hu/mod_say_hu.c @@ -356,7 +356,7 @@ static switch_status_t hu_say_money(switch_core_session_t *session, char *tosay, char sbuf[16] = ""; char *forint; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_it/mod_say_it.c b/src/mod/say/mod_say_it/mod_say_it.c index e131dde327..e3d5131ed1 100644 --- a/src/mod/say/mod_say_it/mod_say_it.c +++ b/src/mod/say/mod_say_it/mod_say_it.c @@ -355,7 +355,7 @@ static switch_status_t it_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c index 8874748462..f493d8974a 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -398,7 +398,7 @@ static switch_status_t ja_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_nl/mod_say_nl.c b/src/mod/say/mod_say_nl/mod_say_nl.c index 3a9c89fb94..116c20ec91 100644 --- a/src/mod/say/mod_say_nl/mod_say_nl.c +++ b/src/mod/say/mod_say_nl/mod_say_nl.c @@ -319,7 +319,7 @@ static switch_status_t nl_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_pt/mod_say_pt.c b/src/mod/say/mod_say_pt/mod_say_pt.c index 4dd6fba81f..e3e7280c45 100644 --- a/src/mod/say/mod_say_pt/mod_say_pt.c +++ b/src/mod/say/mod_say_pt/mod_say_pt.c @@ -428,7 +428,7 @@ static switch_status_t pt_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 559075785f..f75ab3b3d8 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -261,7 +261,7 @@ static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n", tosay); - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_th/mod_say_th.c b/src/mod/say/mod_say_th/mod_say_th.c index 1b83363165..f61cdbce82 100644 --- a/src/mod/say/mod_say_th/mod_say_th.c +++ b/src/mod/say/mod_say_th/mod_say_th.c @@ -422,7 +422,7 @@ static switch_status_t th_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } diff --git a/src/mod/say/mod_say_zh/mod_say_zh.c b/src/mod/say/mod_say_zh/mod_say_zh.c index 24f8aa927a..3f4098d856 100644 --- a/src/mod/say/mod_say_zh/mod_say_zh.c +++ b/src/mod/say/mod_say_zh/mod_say_zh.c @@ -386,7 +386,7 @@ static switch_status_t zh_say_money(switch_core_session_t *session, char *tosay, char *dollars = NULL; char *cents = NULL; - if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)))) { + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } From 45edec4ce360dacd4ceaf3e3d127141f05988cbc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 12:52:06 -0500 Subject: [PATCH 185/558] FS-3193 note I changed the variable name to auto_cause --- .../applications/mod_dptools/mod_dptools.c | 64 ++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 346cdaa9f8..1500ff1b5e 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2473,6 +2473,11 @@ SWITCH_STANDARD_APP(audio_bridge_function) { switch_channel_t *caller_channel = switch_core_session_get_channel(session); switch_core_session_t *peer_session = NULL; + + const char *transfer_on_fail = NULL; + char *tof_data = NULL; + char *tof_array[4] = { 0 }; + int tof_arrayc = 0; const char *continue_on_fail = NULL, *failure_causes = NULL, *v_campon = NULL, *v_campon_retries, *v_campon_sleep, *v_campon_timeout, *v_campon_fallback_exten = NULL; switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; @@ -2489,8 +2494,14 @@ SWITCH_STANDARD_APP(audio_bridge_function) } continue_on_fail = switch_channel_get_variable(caller_channel, "continue_on_fail"); - failure_causes = switch_channel_get_variable(caller_channel, "failure_causes"); + transfer_on_fail = switch_channel_get_variable(caller_channel, "transfer_on_fail"); + tof_data = switch_core_session_strdup(session, transfer_on_fail); + tof_arrayc = switch_split(tof_data, ' ', tof_array); + transfer_on_fail = tof_array[0]; + + failure_causes = switch_channel_get_variable(caller_channel, "failure_causes"); + if ((v_campon = switch_channel_get_variable(caller_channel, "campon")) && switch_true(v_campon)) { const char *cid_name = NULL; const char *cid_number = NULL; @@ -2681,6 +2692,57 @@ SWITCH_STANDARD_APP(audio_bridge_function) return; } } + + if (transfer_on_fail || failure_causes) { + const char *cause_str; + char cause_num[35] = ""; + + cause_str = switch_channel_cause2str(cause); + switch_snprintf(cause_num, sizeof(cause_num), "%u", cause); + + if ((tof_array[1] == NULL ) || (!strcasecmp(tof_array[1], "auto_cause"))){ + tof_array[1] = (char *) cause_str; + } + + if (failure_causes) { + char *lbuf = switch_core_session_strdup(session, failure_causes); + char *argv[256] = { 0 }; + int argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + int i, x = 0; + + for (i = 0; i < argc; i++) { + if (!strcasecmp(argv[i], cause_str) || !strcasecmp(argv[i], cause_num)) { + x++; + break; + } + } + if (!x) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "Failure causes [%s]: Cause: %s\n", failure_causes, cause_str); + + switch_ivr_session_transfer(session, tof_array[1], tof_array[2], tof_array[3]); + } + } + + if (transfer_on_fail) { + if (switch_true(transfer_on_fail)) { + return; + } else { + char *lbuf = switch_core_session_strdup(session, transfer_on_fail); + char *argv[256] = { 0 }; + int argc = switch_separate_string(lbuf, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + int i; + + for (i = 0; i < argc; i++) { + if (!strcasecmp(argv[i], cause_str) || !strcasecmp(argv[i], cause_num)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "Transfer on fail [%s]: Cause: %s\n", transfer_on_fail, cause_str); + switch_ivr_session_transfer(session, tof_array[1], tof_array[2], tof_array[3]); + } + } + } + } + } } if (!switch_channel_test_flag(caller_channel, CF_TRANSFER) && switch_channel_get_state(caller_channel) != CS_ROUTING) { switch_channel_hangup(caller_channel, cause); From 37c4f658cbbed6d62c7f913b4054d2886ac4a351 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 29 Mar 2011 13:17:00 -0700 Subject: [PATCH 186/558] More to-be-recorded prompts --- docs/phrase/phrase_en.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 36d986bb61..56a8094d22 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -429,6 +429,12 @@ + + + + + + From f0c0a2951e8105eed57131fd4206653852956356 Mon Sep 17 00:00:00 2001 From: Buklov Boris Date: Wed, 30 Mar 2011 00:50:28 +0400 Subject: [PATCH 187/558] add new phrases --- docs/phrase/phrase_ru.xml | 105 ++++++++++++++++++++++++++++++++------ 1 file changed, 88 insertions(+), 17 deletions(-) diff --git a/docs/phrase/phrase_ru.xml b/docs/phrase/phrase_ru.xml index e8423e7aaa..aef35c8855 100644 --- a/docs/phrase/phrase_ru.xml +++ b/docs/phrase/phrase_ru.xml @@ -431,26 +431,39 @@ + + + + + + + - + - + - - + + - - - + + + + ^ + + + + + @@ -460,7 +473,7 @@ - + @@ -471,6 +484,15 @@ + + + + + + + + + @@ -479,11 +501,11 @@ - - - - - + + + + + @@ -508,7 +530,7 @@ - + @@ -545,7 +567,7 @@ - + @@ -554,17 +576,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + + + + From 135bac5b6d9af42c708b5ec92cb23d8e6ff3076a Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 29 Mar 2011 17:08:02 -0400 Subject: [PATCH 188/558] freetdm: change a-law and u-law for alaw and ulaw as valid strings for bearer layer 1 --- libs/freetdm/src/include/freetdm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index d2c0a7e267..6ab518a6e3 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -291,7 +291,7 @@ typedef enum { FTDM_USER_LAYER1_PROT_ALAW = 0x03, FTDM_USER_LAYER1_PROT_INVALID } ftdm_user_layer1_prot_t; -#define USER_LAYER1_PROT_STRINGS "V.110", "u-law", "a-law", "Invalid" +#define USER_LAYER1_PROT_STRINGS "V.110", "ulaw", "alaw", "Invalid" FTDM_STR2ENUM_P(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_user_layer1_prot_t) /*! Calling Party Category */ From dae2cb4aac64e605e3c2680b5beb0e8bf7f3b8bf Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 29 Mar 2011 18:05:05 -0500 Subject: [PATCH 189/558] Fix X-PREPROCESS exec to wait pid --- src/switch_xml.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_xml.c b/src/switch_xml.c index d6cac65c65..124dab9ab0 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -56,6 +56,7 @@ #include #ifndef WIN32 +#include #include #include #else /* we're on windoze :( */ @@ -1245,6 +1246,7 @@ static int preprocess_exec(const char *cwd, const char *command, int write_fd, i } } close(fds[0]); + waitpid(pid, NULL, 0); } else { /* child */ close(fds[0]); dup2(fds[1], STDOUT_FILENO); From 1552ecf54afdfb14d15c5cfa517449e22d049cd6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 19:53:26 -0500 Subject: [PATCH 190/558] prevent race condition on conference join/exit --- .../mod_conference/mod_conference.c | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 8103a39abc..ef3000d287 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -155,7 +155,8 @@ typedef enum { CFLAG_WAIT_MOD = (1 << 7), CFLAG_VID_FLOOR = (1 << 8), CFLAG_WASTE_BANDWIDTH = (1 << 9), - CFLAG_OUTCALL = (1 << 10) + CFLAG_OUTCALL = (1 << 10), + CFLAG_INHASH = (1 << 11) } conf_flag_t; typedef enum { @@ -667,7 +668,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe lock_member(member); switch_mutex_lock(conference->member_mutex); - switch_clear_flag(conference, CFLAG_DESTRUCT); + member->join_time = switch_epoch_time_now(NULL); member->conference = conference; member->next = conference->members; @@ -1491,29 +1492,30 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, v } } - if (switch_test_flag(conference, CFLAG_DESTRUCT)) { - switch_core_timer_destroy(&timer); - switch_mutex_lock(globals.hash_mutex); + + switch_core_timer_destroy(&timer); + switch_mutex_lock(globals.hash_mutex); + if (switch_test_flag(conference, CFLAG_INHASH)) { switch_core_hash_delete(globals.conference_hash, conference->name); - switch_mutex_unlock(globals.hash_mutex); + } + switch_mutex_unlock(globals.hash_mutex); - /* Wait till everybody is out */ - switch_clear_flag_locked(conference, CFLAG_RUNNING); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock ON\n"); - switch_thread_rwlock_wrlock(conference->rwlock); - switch_thread_rwlock_unlock(conference->rwlock); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock OFF\n"); + /* Wait till everybody is out */ + switch_clear_flag_locked(conference, CFLAG_RUNNING); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock ON\n"); + switch_thread_rwlock_wrlock(conference->rwlock); + switch_thread_rwlock_unlock(conference->rwlock); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Lock OFF\n"); - if (conference->sh) { - switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; - switch_core_speech_close(&conference->lsh, &flags); - conference->sh = NULL; - } + if (conference->sh) { + switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; + switch_core_speech_close(&conference->lsh, &flags); + conference->sh = NULL; + } - if (conference->pool) { - switch_memory_pool_t *pool = conference->pool; - switch_core_destroy_memory_pool(&pool); - } + if (conference->pool) { + switch_memory_pool_t *pool = conference->pool; + switch_core_destroy_memory_pool(&pool); } switch_mutex_lock(globals.hash_mutex); @@ -6118,7 +6120,13 @@ static conference_obj_t *conference_find(char *name) conference_obj_t *conference; switch_mutex_lock(globals.hash_mutex); - conference = switch_core_hash_find(globals.conference_hash, name); + if ((conference = switch_core_hash_find(globals.conference_hash, name))) { + if (switch_test_flag(conference, CFLAG_DESTRUCT)) { + switch_core_hash_delete(globals.conference_hash, conference->name); + switch_clear_flag(conference, CFLAG_INHASH); + conference = NULL; + } + } switch_mutex_unlock(globals.hash_mutex); return conference; @@ -6568,7 +6576,9 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool); switch_thread_rwlock_create(&conference->rwlock, conference->pool); switch_mutex_init(&conference->member_mutex, SWITCH_MUTEX_NESTED, conference->pool); + switch_mutex_lock(globals.hash_mutex); + switch_set_flag(conference, CFLAG_INHASH); switch_core_hash_insert(globals.conference_hash, conference->name, conference); switch_mutex_unlock(globals.hash_mutex); From d5ef86d7788ef0080ca3be7e2ff39bda989d4b4d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 19:55:28 -0500 Subject: [PATCH 191/558] introduce new say_string method of doing say and use it in mod_say_en as an example. try: eval ${say_string en.gsm en current_date_time pronounced ${strepoch()}} from the cli with this patch. We can do more to centralize the say things and go back and apply it to other langs, using this method you can set the desired file ext as well which I think is a bounty.... --- src/include/switch_apr.h | 2 + src/include/switch_core.h | 9 + src/include/switch_ivr.h | 10 + src/include/switch_module_interfaces.h | 25 +- src/include/switch_types.h | 17 ++ .../applications/mod_commands/mod_commands.c | 54 ++++ src/mod/say/mod_say_en/mod_say_en.c | 288 +++++++++++++----- src/switch_channel.c | 17 +- src/switch_event.c | 18 +- src/switch_ivr.c | 128 ++++++++ src/switch_loadable_module.c | 91 ++++++ 11 files changed, 548 insertions(+), 111 deletions(-) diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 62559faf63..2306075e1f 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -145,6 +145,8 @@ SWITCH_DECLARE(int) switch_snprintf(_Out_z_cap_(len) SWITCH_DECLARE(int) switch_vasprintf(_Out_opt_ char **buf, _In_z_ _Printf_format_string_ const char *format, _In_ va_list ap); +SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap); + SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) char *dst, _In_z_ const char *src, _In_ switch_size_t dst_size); diff --git a/src/include/switch_core.h b/src/include/switch_core.h index e54de72027..2946478c89 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2240,6 +2240,15 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c */ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force); + +SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var); +SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t *sh); +SWITCH_DECLARE(char *) switch_say_file_handle_detach_path(switch_say_file_handle_t *sh); +SWITCH_DECLARE(void) switch_say_file_handle_destroy(switch_say_file_handle_t **sh); +SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_handle_t **sh, const char *ext, switch_event_t **var_event); +SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *fmt, ...); + + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 9b353f3ded..36eaaec9ca 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -859,6 +859,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *say_gender, switch_input_args_t *args); +SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *session, + const char *lang, + const char *ext, + const char *tosay, + const char *module_name, + const char *say_type, + const char *say_method, + const char *say_gender, + char **rstr); + SWITCH_DECLARE(switch_say_method_t) switch_ivr_get_say_method_by_name(const char *name); SWITCH_DECLARE(switch_say_gender_t) switch_ivr_get_say_gender_by_name(const char *name); SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name); diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index 90d7342ef4..33c4c22bac 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -103,29 +103,9 @@ struct switch_stream_handle { }; struct switch_io_event_hooks; +struct switch_say_file_handle; - - -typedef switch_call_cause_t (*switch_io_outgoing_channel_t) - - - - - - - - - - - - - - - - - - - +typedef switch_call_cause_t (*switch_io_outgoing_channel_t) (switch_core_session_t *, switch_event_t *, switch_caller_profile_t *, switch_core_session_t **, switch_memory_pool_t **, switch_originate_flag_t, switch_call_cause_t *); typedef switch_status_t (*switch_io_read_frame_t) (switch_core_session_t *, switch_frame_t **, switch_io_flag_t, int); @@ -490,6 +470,7 @@ struct switch_say_interface { const char *interface_name; /*! function to pass down to the module */ switch_say_callback_t say_function; + switch_say_string_callback_t say_string_function; switch_thread_rwlock_t *rwlock; int refs; switch_mutex_t *reflock; diff --git a/src/include/switch_types.h b/src/include/switch_types.h index e732bca597..81cc3fb719 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -36,6 +36,7 @@ #define SWITCH_TYPES_H #include + SWITCH_BEGIN_EXTERN_C #define SWITCH_ENT_ORIGINATE_DELIM ":_:" #define SWITCH_BLANK_STRING "" @@ -1735,6 +1736,7 @@ typedef switch_status_t (*switch_stream_handle_raw_write_function_t) (switch_str typedef switch_status_t (*switch_api_function_t) (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream); + #define SWITCH_STANDARD_API(name) static switch_status_t name (_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) typedef switch_status_t (*switch_input_callback_function_t) (switch_core_session_t *session, void *input, @@ -1772,17 +1774,32 @@ typedef struct { switch_ivr_dmachine_t *dmachine; } switch_input_args_t; + typedef struct { switch_say_type_t type; switch_say_method_t method; switch_say_gender_t gender; + const char *ext; } switch_say_args_t; + typedef switch_status_t (*switch_say_callback_t) (switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args); +typedef switch_status_t (*switch_say_string_callback_t) (switch_core_session_t *session, + char *tosay, + switch_say_args_t *say_args, char **rstr); + +struct switch_say_file_handle; +typedef struct switch_say_file_handle switch_say_file_handle_t; + +typedef switch_status_t (*switch_new_say_callback_t) (switch_say_file_handle_t *sh, + char *tosay, + switch_say_args_t *say_args); + + typedef struct switch_xml *switch_xml_t; typedef struct switch_core_time_duration switch_core_time_duration_t; typedef switch_xml_t(*switch_xml_search_function_t) (const char *section, diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index fd2081e31d..6fb35598c2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -116,6 +116,59 @@ static switch_status_t select_url(const char *user, return SWITCH_STATUS_SUCCESS; } + +#define SAY_STRING_SYNTAX "[.] [.] [] " +SWITCH_STANDARD_API(say_string_function) +{ + char *argv[6] = { 0 }; + int argc; + char *lbuf = NULL, *string = NULL; + int err = 1, par = 0; + char *p, *ext = "wav"; + + if (cmd) { + lbuf = strdup(cmd); + } + + if (lbuf && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) && (argc == 5 || argc == 6)) { + + if ((p = strchr(argv[0], '.'))) { + *p++ = '\0'; + ext = p; + par++; + } + + if (!par && (p = strchr(argv[1], '.'))) { + *p++ = '\0'; + ext = p; + } + switch_ivr_say_string(session, + argv[1], + ext, + (argc == 5) ? argv[4] : argv[5], + argv[0], + argv[2], + argv[3], + (argc == 6) ? argv[4] : NULL , + &string); + if (string) { + stream->write_function(stream, "%s", string); + free(string); + err = 0; + } + } + + if (err) { + stream->write_function(stream, "-ERR Usage: %s\n", SAY_STRING_SYNTAX); + } + + free(lbuf); + + return SWITCH_STATUS_SUCCESS; + +} + + SWITCH_STANDARD_API(reg_url_function) { char *data; @@ -5105,6 +5158,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "reload", "Reload Module", reload_function, UNLOAD_SYNTAX); SWITCH_ADD_API(commands_api_interface, "reloadxml", "Reload XML", reload_xml_function, ""); SWITCH_ADD_API(commands_api_interface, "replace", "replace a string", replace_function, "||"); + SWITCH_ADD_API(commands_api_interface, "say_string", "", say_string_function, SAY_STRING_SYNTAX); SWITCH_ADD_API(commands_api_interface, "sched_api", "Schedule an api command", sched_api_function, SCHED_SYNTAX); SWITCH_ADD_API(commands_api_interface, "sched_broadcast", "Schedule a broadcast event to a running call", sched_broadcast_function, SCHED_BROADCAST_SYNTAX); diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 6c604f208e..ec577374dc 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -51,7 +51,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load); SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL); -#define say_num(num, meth) { \ + +#define say_num(_sh, num, meth) { \ char tmp[80]; \ switch_status_t tstatus; \ switch_say_method_t smeth = say_args->method; \ @@ -59,7 +60,7 @@ SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL); say_args->type = SST_ITEMS; say_args->method = meth; \ switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \ if ((tstatus = \ - en_say_general_count(session, tmp, say_args, args)) \ + en_say_general_count(_sh, tmp, say_args)) \ != SWITCH_STATUS_SUCCESS) { \ return tstatus; \ } \ @@ -67,57 +68,44 @@ SWITCH_MODULE_DEFINITION(mod_say_en, mod_say_en_load, NULL, NULL); } \ -#define say_file(...) { \ - char tmp[80]; \ - switch_status_t tstatus; \ - switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__); \ - if ((tstatus = \ - switch_ivr_play_file(session, NULL, tmp, args)) \ - != SWITCH_STATUS_SUCCESS){ \ - return tstatus; \ - } \ - if (!switch_channel_ready(switch_core_session_get_channel(session))) { \ - return SWITCH_STATUS_FALSE; \ - }} \ - -static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args) +static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_say_file_handle_t *sh) { if (a) { - say_file("digits/%d.wav", a); - say_file("digits/hundred.wav"); + switch_say_file(sh, "digits/%d", a); + switch_say_file(sh, "digits/hundred"); } if (b) { if (b > 1) { if ((c == 0) && (method == SSM_COUNTED)) { - say_file("digits/h-%d0.wav", b); + switch_say_file(sh, "digits/h-%d0", b); } else { - say_file("digits/%d0.wav", b); + switch_say_file(sh, "digits/%d0", b); } } else { - say_file("digits/%d%d.wav", b, c); + switch_say_file(sh, "digits/%d%d", b, c); c = 0; } } if (c) { if (method == SSM_COUNTED) { - say_file("digits/h-%d.wav", c); + switch_say_file(sh, "digits/h-%d", c); } else { - say_file("digits/%d.wav", c); + switch_say_file(sh, "digits/%d", c); } } if (what && (a || b || c)) { - say_file(what); + switch_say_file(sh, what); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t en_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t en_say_general_count(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { int in; int x = 0; @@ -129,7 +117,7 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { char *p; for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); + switch_say_file(sh, "digits/%c", *p); } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); @@ -156,13 +144,13 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char switch (say_args->method) { case SSM_COUNTED: case SSM_PRONOUNCED: - if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million", sh)) != SWITCH_STATUS_SUCCESS) { return status; } - if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand", sh)) != SWITCH_STATUS_SUCCESS) { return status; } - if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, sh)) != SWITCH_STATUS_SUCCESS) { return status; } break; @@ -170,20 +158,21 @@ static switch_status_t en_say_general_count(switch_core_session_t *session, char break; } } else { - say_file("digits/0.wav"); + switch_say_file(sh, "digits/0"); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { int32_t t; switch_time_t target = 0, target_now = 0; switch_time_exp_t tm, tm_now; uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0; - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *tz = switch_channel_get_variable(channel, "timezone"); + const char *tz = NULL; + + tz = switch_say_file_handle_get_variable(sh, "timezone"); if (say_args->type == SST_TIME_MEASUREMENT) { int64_t hours = 0; @@ -192,7 +181,7 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, int64_t r = 0; if (strchr(tosay, ':')) { - char *tme = switch_core_session_strdup(session, tosay); + char *tme = strdup(tosay); char *p; if ((p = strrchr(tme, ':'))) { @@ -208,6 +197,7 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, minutes = atoi(tme); } } + free(tme); } else { if ((seconds = atol(tosay)) <= 0) { seconds = (int64_t) switch_epoch_time_now(NULL); @@ -227,39 +217,39 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, } if (hours) { - say_num(hours, SSM_PRONOUNCED); + say_num(sh, hours, SSM_PRONOUNCED); if (hours == 1) { - say_file("time/hour.wav"); + switch_say_file(sh, "time/hour"); } else { - say_file("time/hours.wav"); + switch_say_file(sh, "time/hours"); } } else { - say_file("digits/0.wav"); - say_file("time/hours.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/hours"); } if (minutes) { - say_num(minutes, SSM_PRONOUNCED); + say_num(sh, minutes, SSM_PRONOUNCED); if (minutes == 1) { - say_file("time/minute.wav"); + switch_say_file(sh, "time/minute"); } else { - say_file("time/minutes.wav"); + switch_say_file(sh, "time/minutes"); } } else { - say_file("digits/0.wav"); - say_file("time/minutes.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/minutes"); } if (seconds) { - say_num(seconds, SSM_PRONOUNCED); + say_num(sh, seconds, SSM_PRONOUNCED); if (seconds == 1) { - say_file("time/second.wav"); + switch_say_file(sh, "time/second"); } else { - say_file("time/seconds.wav"); + switch_say_file(sh, "time/seconds"); } } else { - say_file("digits/0.wav"); - say_file("time/seconds.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/seconds"); } return SWITCH_STATUS_SUCCESS; @@ -275,7 +265,7 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, if (tz) { int check = atoi(tz); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); if (check) { switch_time_exp_tz(&tm, target, check); switch_time_exp_tz(&tm_now, target_now, check); @@ -329,13 +319,13 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, } if (say_today) { - say_file("time/today.wav"); + switch_say_file(sh, "time/today"); } if (say_yesterday) { - say_file("time/yesterday.wav"); + switch_say_file(sh, "time/yesterday"); } if (say_dow) { - say_file("time/day-%d.wav", tm.tm_wday); + switch_say_file(sh, "time/day-%d", tm.tm_wday); } if (say_date) { @@ -344,20 +334,20 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, } if (say_month) { - say_file("time/mon-%d.wav", tm.tm_mon); + switch_say_file(sh, "time/mon-%d", tm.tm_mon); } if (say_day) { - say_num(tm.tm_mday, SSM_COUNTED); + say_num(sh, tm.tm_mday, SSM_COUNTED); } if (say_year) { - say_num(tm.tm_year + 1900, SSM_PRONOUNCED); + say_num(sh, tm.tm_year + 1900, SSM_PRONOUNCED); } if (say_time) { int32_t hour = tm.tm_hour, pm = 0; if (say_date || say_today || say_yesterday || say_dow) { - say_file("time/at.wav"); + switch_say_file(sh, "time/at"); } if (hour > 12) { @@ -370,25 +360,25 @@ static switch_status_t en_say_time(switch_core_session_t *session, char *tosay, pm = 0; } - say_num(hour, SSM_PRONOUNCED); + say_num(sh, hour, SSM_PRONOUNCED); if (tm.tm_min > 9) { - say_num(tm.tm_min, SSM_PRONOUNCED); + say_num(sh, tm.tm_min, SSM_PRONOUNCED); } else if (tm.tm_min) { - say_file("time/oh.wav"); - say_num(tm.tm_min, SSM_PRONOUNCED); + switch_say_file(sh, "time/oh"); + say_num(sh, tm.tm_min, SSM_PRONOUNCED); } else { - say_file("time/oclock.wav"); + switch_say_file(sh, "time/oclock"); } - say_file("time/%s.wav", pm ? "p-m" : "a-m"); + switch_say_file(sh, "time/%s", pm ? "p-m" : "a-m"); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t en_say_money(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ char *dollars = NULL; @@ -415,43 +405,108 @@ static switch_status_t en_say_money(switch_core_session_t *session, char *tosay, /* If negative say "negative" */ if (sbuf[0] == '-') { - say_file("currency/negative.wav"); + switch_say_file(sh, "currency/negative"); dollars++; } /* Say dollar amount */ - en_say_general_count(session, dollars, say_args, args); + en_say_general_count(sh, dollars, say_args); if (atoi(dollars) == 1) { - say_file("currency/dollar.wav"); + switch_say_file(sh, "currency/dollar"); } else { - say_file("currency/dollars.wav"); + switch_say_file(sh, "currency/dollars"); } /* Say "and" */ - say_file("currency/and.wav"); + switch_say_file(sh, "currency/and"); /* Say cents */ if (cents) { - en_say_general_count(session, cents, say_args, args); + en_say_general_count(sh, cents, say_args); if (atoi(cents) == 1) { - say_file("currency/cent.wav"); + switch_say_file(sh, "currency/cent"); } else { - say_file("currency/cents.wav"); + switch_say_file(sh, "currency/cents"); } } else { - say_file("digits/0.wav"); - say_file("currency/cents.wav"); + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "currency/cents"); } return SWITCH_STATUS_SUCCESS; } - -static switch_status_t en_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t say_ip(switch_say_file_handle_t *sh, + char *tosay, + switch_say_args_t *say_args) + { + char *a, *b, *c, *d; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (!(a = strdup(tosay))) { + abort(); + } - switch_say_callback_t say_cb = NULL; + if (!(b = strchr(a, '.'))) { + goto end; + } + + *b++ = '\0'; + + if (!(c = strchr(b, '.'))) { + goto end; + } + + *c++ = '\0'; + + if (!(d = strchr(c, '.'))) { + goto end; + } + + *d++ = '\0'; + + say_num(sh, atoi(a), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(b), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(c), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(d), say_args->method); + + end: + + free(a); + + return status; +} + + +static switch_status_t say_spell(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) +{ + char *p; + + for (p = tosay; p && *p; p++) { + int a = tolower((int) *p); + if (a >= '0' && a <= '9') { + switch_say_file(sh, "digits/%d", a - '0'); + } else { + if (say_args->type == SST_NAME_SPELLED) { + switch_say_file(sh, "ascii/%d", a); + } else if (say_args->type == SST_NAME_PHONETIC) { + switch_say_file(sh, "phonetic-ascii/%d", a); + } + } + } + + return SWITCH_STATUS_SUCCESS; +} + + +static switch_new_say_callback_t choose_callback(switch_say_args_t *say_args) +{ + switch_new_say_callback_t say_cb = NULL; switch (say_args->type) { case SST_NUMBER: @@ -468,11 +523,11 @@ static switch_status_t en_say(switch_core_session_t *session, char *tosay, switc say_cb = en_say_time; break; case SST_IP_ADDRESS: - return switch_ivr_say_ip(session, tosay, en_say_general_count, say_args, args); + say_cb = say_ip; break; case SST_NAME_SPELLED: case SST_NAME_PHONETIC: - return switch_ivr_say_spell(session, tosay, say_args, args); + say_cb = say_spell; break; case SST_CURRENCY: say_cb = en_say_money; @@ -482,11 +537,77 @@ static switch_status_t en_say(switch_core_session_t *session, char *tosay, switc break; } - if (say_cb) { - return say_cb(session, tosay, say_args, args); + return say_cb; +} + + +static switch_status_t run_callback(switch_new_say_callback_t say_cb, char *tosay, switch_say_args_t *say_args, switch_core_session_t *session, char **rstr) +{ + switch_say_file_handle_t *sh; + switch_status_t status = SWITCH_STATUS_FALSE; + switch_event_t *var_event = NULL; + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_get_variables(channel, &var_event); } - return SWITCH_STATUS_FALSE; + switch_say_file_handle_create(&sh, say_args->ext, &var_event); + + status = say_cb(sh, tosay, say_args); + + if ((*rstr = switch_say_file_handle_detach_path(sh))) { + status = SWITCH_STATUS_SUCCESS; + } + + switch_say_file_handle_destroy(&sh); + + return status; +} + + +static switch_status_t en_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + + switch_new_say_callback_t say_cb = NULL; + char *string = NULL; + + switch_status_t status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (session && string) { + status = switch_ivr_play_file(session, NULL, string, args); + } + + switch_safe_free(string); + } + + return status; +} + + +static switch_status_t en_say_string(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, char **rstr) +{ + + switch_new_say_callback_t say_cb = NULL; + char *string = NULL; + + switch_status_t status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (string) { + status = SWITCH_STATUS_SUCCESS; + *rstr = string; + } + } + + return status; } SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load) @@ -497,7 +618,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_en_load) say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); say_interface->interface_name = "en"; say_interface->say_function = en_say; - + say_interface->say_string_function = en_say_string; + /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_channel.c b/src/switch_channel.c index 7d246893f7..52542e12d6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2943,7 +2943,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel char *data, *indup, *endof_indup; size_t sp = 0, len = 0, olen = 0, vtype = 0, br = 0, cpos, block = 128; char *cloned_sub_val = NULL, *sub_val = NULL; - char *func_val = NULL; + char *func_val = NULL, *sb = NULL; int nv = 0; if (zstr(in)) { @@ -3033,8 +3033,19 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables(switch_channel_t *channel } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { - if (*vval == '(') br = 1; + vval = NULL; + for(sb = vname; sb && *sb; sb++) { + if (*sb == ' ') { + vval = sb; + break; + } else if (*sb == '(') { + vval = sb; + br = 1; + break; + } + } + + if (vval) { e = vval - 1; *vval++ = '\0'; while (*e == ' ') { diff --git a/src/switch_event.c b/src/switch_event.c index b7687c2041..e290987248 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1563,7 +1563,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const char *cloned_sub_val = NULL; char *func_val = NULL; int nv = 0; - char *gvar = NULL; + char *gvar = NULL, *sb = NULL; if (zstr(in)) { return (char *) in; @@ -1651,10 +1651,22 @@ SWITCH_DECLARE(char *) switch_event_expand_headers(switch_event_t *event, const } p = e > endof_indup ? endof_indup : e; - if ((vval = strchr(vname, '(')) || (vval = strchr(vname, ' '))) { - if (*vval == '(') br = 1; + vval = NULL; + for(sb = vname; sb && *sb; sb++) { + if (*sb == ' ') { + vval = sb; + break; + } else if (*sb == '(') { + vval = sb; + br = 1; + break; + } + } + + if (vval) { e = vval - 1; *vval++ = '\0'; + while (*e == ' ') { *e-- = '\0'; } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 5a082763b2..b6dac4d71d 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2432,6 +2432,134 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, return status; } +SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *session, + const char *lang, + const char *ext, + const char *tosay, + const char *module_name, + const char *say_type, + const char *say_method, + const char *say_gender, + char **rstr) +{ + switch_say_interface_t *si; + switch_channel_t *channel = NULL; + switch_status_t status = SWITCH_STATUS_FALSE; + const char *save_path = NULL, *chan_lang = NULL, *lname = NULL, *sound_path = NULL; + switch_event_t *hint_data; + switch_xml_t cfg, xml = NULL, language, macros; + + if (session) { + channel = switch_core_session_get_channel(session); + + if (!lang) { + lang = switch_channel_get_variable(channel, "language"); + + if (!lang) { + chan_lang = switch_channel_get_variable(channel, "default_language"); + if (!chan_lang) { + chan_lang = "en"; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang); + } else { + chan_lang = lang; + } + } + } + + if (!lang) lang = "en"; + if (!chan_lang) chan_lang = lang; + + switch_event_create(&hint_data, SWITCH_EVENT_REQUEST_PARAMS); + switch_assert(hint_data); + + switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "macro_name", "say_app"); + switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "lang", chan_lang); + + if (channel) { + switch_channel_event_set_data(channel, hint_data); + } + + if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of phrases failed.\n"); + goto done; + } + + if (!(macros = switch_xml_child(cfg, "macros"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macros tag.\n"); + goto done; + } + + if (!(language = switch_xml_child(macros, "language"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language tag.\n"); + goto done; + } + + while (language) { + if ((lname = (char *) switch_xml_attr(language, "name")) && !strcasecmp(lname, chan_lang)) { + const char *tmp; + + if ((tmp = switch_xml_attr(language, "module"))) { + module_name = tmp; + } + break; + } + language = language->next; + } + + if (!language) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language %s.\n", chan_lang); + goto done; + } + + if (!module_name) { + module_name = chan_lang; + } + + if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { + sound_path = (char *) switch_xml_attr(language, "sound_path"); + } + + if (channel) { + save_path = switch_channel_get_variable(channel, "sound_prefix"); + } + + if (sound_path && channel) { + switch_channel_set_variable(channel, "sound_prefix", sound_path); + } + + if ((si = switch_loadable_module_get_say_interface(module_name))) { + /* should go back and proto all the say mods to const.... */ + switch_say_args_t say_args = {0}; + + say_args.type = switch_ivr_get_say_type_by_name(say_type); + say_args.method = switch_ivr_get_say_method_by_name(say_method); + say_args.gender = switch_ivr_get_say_gender_by_name(say_gender); + say_args.ext = ext; + status = si->say_string_function(session, (char *) tosay, &say_args, rstr); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Invalid SAY Interface [%s]!\n", module_name); + status = SWITCH_STATUS_FALSE; + } + + done: + + if (hint_data) { + switch_event_destroy(&hint_data); + } + + if (save_path && channel) { + switch_channel_set_variable(channel, "sound_prefix", save_path); + } + + if (xml) { + switch_xml_free(xml); + } + + return status; +} + + static const char *get_prefixed_str(char *buffer, size_t buffer_size, const char *prefix, size_t prefix_size, const char *str) { size_t str_len; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index d6796c8119..ea7bc73684 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1918,6 +1918,97 @@ SWITCH_DECLARE(void *) switch_loadable_module_create_interface(switch_loadable_m } } +struct switch_say_file_handle { + char *ext; + int cnt; + struct switch_stream_handle stream; + switch_event_t *param_event; +}; + +SWITCH_DECLARE(char *) switch_say_file_handle_get_variable(switch_say_file_handle_t *sh, const char *var) +{ + char *ret = NULL; + + if (sh->param_event) { + ret = switch_event_get_header(sh->param_event, var); + } + + return ret; + +} + +SWITCH_DECLARE(char *) switch_say_file_handle_get_path(switch_say_file_handle_t *sh) +{ + return (char *) sh->stream.data; +} + +SWITCH_DECLARE(char *) switch_say_file_handle_detach_path(switch_say_file_handle_t *sh) +{ + char *path; + + switch_assert(sh); + path = (char *) sh->stream.data; + sh->stream.data = NULL; + return path; +} + + +SWITCH_DECLARE(void) switch_say_file_handle_destroy(switch_say_file_handle_t **sh) +{ + switch_assert(sh); + + switch_safe_free((*sh)->stream.data); + switch_safe_free((*sh)->ext); + + if ((*sh)->param_event) { + switch_event_destroy(&(*sh)->param_event); + } + free(*sh); + *sh = NULL; +} + +SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_handle_t **sh, const char *ext, switch_event_t **var_event) +{ + switch_assert(sh); + + *sh = malloc(sizeof(**sh)); + memset(*sh, 0, sizeof(**sh)); + + SWITCH_STANDARD_STREAM((*sh)->stream); + + if (var_event) { + (*sh)->param_event = *var_event; + *var_event = NULL; + } + + (*sh)->ext = strdup(ext); + + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *fmt, ...) +{ + char buf[256] = ""; + int ret; + va_list ap; + + va_start(ap, fmt); + + if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { + if (!sh->cnt++) { + sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); + } else { + sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); + } + + } + + va_end(ap); +} + + + + /* For Emacs: * Local Variables: * mode:c From eefdb764cfe7ebaca6308be022e6f252cb970de0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 20:35:34 -0500 Subject: [PATCH 192/558] merge file_string into dptools --- build/modules.conf.in | 1 - conf/autoload_configs/modules.conf.xml | 1 - .../applications/mod_dptools/mod_dptools.c | 171 +++++++++++ src/mod/formats/mod_file_string/Makefile | 2 - .../mod_file_string.2008.vcproj | 283 ------------------ .../mod_file_string.2010.vcxproj | 131 -------- .../formats/mod_file_string/mod_file_string.c | 221 -------------- .../mod_file_string/mod_file_string.vcproj | 51 ---- 8 files changed, 171 insertions(+), 690 deletions(-) delete mode 100644 src/mod/formats/mod_file_string/Makefile delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.2008.vcproj delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.c delete mode 100644 src/mod/formats/mod_file_string/mod_file_string.vcproj diff --git a/build/modules.conf.in b/build/modules.conf.in index 1147ad4863..ee9aea41d2 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -88,7 +88,6 @@ formats/mod_sndfile #formats/mod_shout formats/mod_local_stream formats/mod_tone_stream -formats/mod_file_string #formats/mod_portaudio_stream #formats/mod_shell_stream #languages/mod_python diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 8553a6dba1..14a5bc8084 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -93,7 +93,6 @@ - diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 1500ff1b5e..70bc193a7f 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -29,6 +29,7 @@ * Neal Horman * Bret McDanel * Luke Dashjr (OpenMethods, LLC) + * Cesar Cepeda * * mod_dptools.c -- Raw Audio File Streaming Application Module * @@ -3525,6 +3526,164 @@ SWITCH_STANDARD_APP(limit_hash_execute_function) } } + + +/* FILE STRING INTERFACE */ + +/* for apr_pstrcat */ +#define DEFAULT_PREBUFFER_SIZE 1024 * 64 + +struct file_string_source; + +struct file_string_context { + char *argv[128]; + int argc; + int index; + int samples; + switch_file_handle_t fh; +}; + +typedef struct file_string_context file_string_context_t; + + +static int next_file(switch_file_handle_t *handle) +{ + file_string_context_t *context = handle->private_info; + char *file; + const char *prefix = handle->prefix; + + top: + + context->index++; + + if (switch_test_flag((&context->fh), SWITCH_FILE_OPEN)) { + switch_core_file_close(&context->fh); + } + + if (context->index >= context->argc) { + return 0; + } + + + if (!prefix) { + if (!(prefix = switch_core_get_variable_pdup("sound_prefix", handle->memory_pool))) { + prefix = SWITCH_GLOBAL_dirs.sounds_dir; + } + } + + if (!prefix || switch_is_file_path(context->argv[context->index])) { + file = context->argv[context->index]; + } else { + file = switch_core_sprintf(handle->memory_pool, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, context->argv[context->index]); + } + + if (switch_core_file_open(&context->fh, + file, handle->channels, handle->samplerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + goto top; + } + + handle->samples = context->fh.samples; + handle->samplerate = context->fh.samplerate; + handle->channels = context->fh.channels; + handle->format = context->fh.format; + handle->sections = context->fh.sections; + handle->seekable = context->fh.seekable; + handle->speed = context->fh.speed; + handle->interval = context->fh.interval; + + if (context->index == 0) { + context->samples = (handle->samplerate / 1000) * 250; + } + + return 1; +} + + +static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) +{ + file_string_context_t *context = handle->private_info; + + if (samples == 0 && whence == SEEK_SET) { + context->index = -1; + return SWITCH_STATUS_SUCCESS; + } + + if (!handle->seekable) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); + return SWITCH_STATUS_NOTIMPL; + } + + return switch_core_file_seek(&context->fh, cur_sample, samples, whence); +} + +static switch_status_t file_string_file_open(switch_file_handle_t *handle, const char *path) +{ + file_string_context_t *context; + char *file_dup; + + if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n"); + return SWITCH_STATUS_FALSE; + } + + context = switch_core_alloc(handle->memory_pool, sizeof(*context)); + + file_dup = switch_core_strdup(handle->memory_pool, path); + context->argc = switch_separate_string(file_dup, '!', context->argv, (sizeof(context->argv) / sizeof(context->argv[0]))); + context->index = -1; + + handle->private_info = context; + + return next_file(handle) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + +static switch_status_t file_string_file_close(switch_file_handle_t *handle) +{ + file_string_context_t *context = handle->private_info; + + switch_core_file_close(&context->fh); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t file_string_file_read(switch_file_handle_t *handle, void *data, size_t *len) +{ + file_string_context_t *context = handle->private_info; + switch_status_t status; + size_t llen = *len; + + if (context->samples > 0) { + if (*len > (size_t) context->samples) { + *len = context->samples; + } + + context->samples -= *len; + switch_generate_sln_silence((int16_t *) data, *len, 400); + status = SWITCH_STATUS_SUCCESS; + } else { + status = switch_core_file_read(&context->fh, data, len); + } + + if (status != SWITCH_STATUS_SUCCESS) { + if (!next_file(handle)) { + return SWITCH_STATUS_FALSE; + } + *len = llen; + status = switch_core_file_read(&context->fh, data, len); + } + + return SWITCH_STATUS_SUCCESS; +} + +/* Registration */ + +static char *file_string_supported_formats[SWITCH_MAX_CODECS] = { 0 }; + + +/* /FILE STRING INTERFACE */ + + + #define SPEAK_DESC "Speak text to a channel via the tts interface" #define DISPLACE_DESC "Displace audio from a file to the channels input" #define SESS_REC_DESC "Starts a background recording of the entire session" @@ -3546,10 +3705,22 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dptools_load) switch_application_interface_t *app_interface; switch_dialplan_interface_t *dp_interface; switch_chat_interface_t *chat_interface; + switch_file_interface_t *file_interface; /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); + file_string_supported_formats[0] = "file_string"; + + file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); + file_interface->interface_name = modname; + file_interface->extens = file_string_supported_formats; + file_interface->file_open = file_string_file_open; + file_interface->file_close = file_string_file_close; + file_interface->file_read = file_string_file_read; + file_interface->file_seek = file_string_file_seek; + + error_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); error_endpoint_interface->interface_name = "error"; error_endpoint_interface->io_routines = &error_io_routines; diff --git a/src/mod/formats/mod_file_string/Makefile b/src/mod/formats/mod_file_string/Makefile deleted file mode 100644 index 2c35e6e98f..0000000000 --- a/src/mod/formats/mod_file_string/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -BASE=../../../.. -include $(BASE)/build/modmake.rules diff --git a/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj b/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj deleted file mode 100644 index 5168a7029a..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.2008.vcproj +++ /dev/null @@ -1,283 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj b/src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj deleted file mode 100644 index 9a543f0a12..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.2010.vcxproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_file_string - {70564D74-199A-4452-9C60-19ED5F242F0D} - mod_file_string - Win32Proj - - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - DynamicLibrary - MultiByte - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - - - - - false - - - - - - - X64 - - - - - - - false - - - MachineX64 - - - - - - - - - false - - - - - - - X64 - - - - - - - false - - - MachineX64 - - - - - - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - \ No newline at end of file diff --git a/src/mod/formats/mod_file_string/mod_file_string.c b/src/mod/formats/mod_file_string/mod_file_string.c deleted file mode 100644 index 92d3800f24..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.c +++ /dev/null @@ -1,221 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Anthony Minessale II - * Cesar Cepeda - * - * - * mod_file_string.c -- Local Streaming Audio - * - */ -#include -/* for apr_pstrcat */ -#define DEFAULT_PREBUFFER_SIZE 1024 * 64 - -SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load); - -SWITCH_MODULE_DEFINITION(mod_file_string, mod_file_string_load, NULL, NULL); - - -struct file_string_source; - -static struct { - switch_mutex_t *mutex; - switch_hash_t *source_hash; -} globals; - -struct file_string_context { - char *argv[128]; - int argc; - int index; - int samples; - switch_file_handle_t fh; -}; - -typedef struct file_string_context file_string_context_t; - - -static int next_file(switch_file_handle_t *handle) -{ - file_string_context_t *context = handle->private_info; - char *file; - const char *prefix = handle->prefix; - - top: - - context->index++; - - if (switch_test_flag((&context->fh), SWITCH_FILE_OPEN)) { - switch_core_file_close(&context->fh); - } - - if (context->index >= context->argc) { - return 0; - } - - - if (!prefix) { - if (!(prefix = switch_core_get_variable_pdup("sound_prefix", handle->memory_pool))) { - prefix = SWITCH_GLOBAL_dirs.sounds_dir; - } - } - - if (!prefix || switch_is_file_path(context->argv[context->index])) { - file = context->argv[context->index]; - } else { - file = switch_core_sprintf(handle->memory_pool, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, context->argv[context->index]); - } - - if (switch_core_file_open(&context->fh, - file, handle->channels, handle->samplerate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { - goto top; - } - - handle->samples = context->fh.samples; - handle->samplerate = context->fh.samplerate; - handle->channels = context->fh.channels; - handle->format = context->fh.format; - handle->sections = context->fh.sections; - handle->seekable = context->fh.seekable; - handle->speed = context->fh.speed; - handle->interval = context->fh.interval; - - if (context->index == 0) { - context->samples = (handle->samplerate / 1000) * 250; - } - - return 1; -} - - -static switch_status_t file_string_file_seek(switch_file_handle_t *handle, unsigned int *cur_sample, int64_t samples, int whence) -{ - file_string_context_t *context = handle->private_info; - - if (samples == 0 && whence == SEEK_SET) { - context->index = -1; - return SWITCH_STATUS_SUCCESS; - } - - if (!handle->seekable) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "File is not seekable\n"); - return SWITCH_STATUS_NOTIMPL; - } - - return switch_core_file_seek(&context->fh, cur_sample, samples, whence); -} - -static switch_status_t file_string_file_open(switch_file_handle_t *handle, const char *path) -{ - file_string_context_t *context; - char *file_dup; - - if (switch_test_flag(handle, SWITCH_FILE_FLAG_WRITE)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "This format does not support writing!\n"); - return SWITCH_STATUS_FALSE; - } - - context = switch_core_alloc(handle->memory_pool, sizeof(*context)); - - file_dup = switch_core_strdup(handle->memory_pool, path); - context->argc = switch_separate_string(file_dup, '!', context->argv, (sizeof(context->argv) / sizeof(context->argv[0]))); - context->index = -1; - - handle->private_info = context; - - return next_file(handle) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; -} - -static switch_status_t file_string_file_close(switch_file_handle_t *handle) -{ - file_string_context_t *context = handle->private_info; - - switch_core_file_close(&context->fh); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t file_string_file_read(switch_file_handle_t *handle, void *data, size_t *len) -{ - file_string_context_t *context = handle->private_info; - switch_status_t status; - size_t llen = *len; - - if (context->samples > 0) { - if (*len > (size_t) context->samples) { - *len = context->samples; - } - - context->samples -= *len; - switch_generate_sln_silence((int16_t *) data, *len, 400); - status = SWITCH_STATUS_SUCCESS; - } else { - status = switch_core_file_read(&context->fh, data, len); - } - - if (status != SWITCH_STATUS_SUCCESS) { - if (!next_file(handle)) { - return SWITCH_STATUS_FALSE; - } - *len = llen; - status = switch_core_file_read(&context->fh, data, len); - } - - return SWITCH_STATUS_SUCCESS; -} - -/* Registration */ - -static char *supported_formats[SWITCH_MAX_CODECS] = { 0 }; - -SWITCH_MODULE_LOAD_FUNCTION(mod_file_string_load) -{ - switch_file_interface_t *file_interface; - supported_formats[0] = "file_string"; - - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); - file_interface->interface_name = modname; - file_interface->extens = supported_formats; - file_interface->file_open = file_string_file_open; - file_interface->file_close = file_string_file_close; - file_interface->file_read = file_string_file_read; - file_interface->file_seek = file_string_file_seek; - - memset(&globals, 0, sizeof(globals)); - /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; -} - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ diff --git a/src/mod/formats/mod_file_string/mod_file_string.vcproj b/src/mod/formats/mod_file_string/mod_file_string.vcproj deleted file mode 100644 index 639300296c..0000000000 --- a/src/mod/formats/mod_file_string/mod_file_string.vcproj +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - From 8806ba8c2fa2e54b54eafb2a9e7c899dfe8b5926 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 20:39:21 -0500 Subject: [PATCH 193/558] missed a spot --- src/switch_loadable_module.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index ea7bc73684..9804e53238 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1971,6 +1971,10 @@ SWITCH_DECLARE(switch_status_t) switch_say_file_handle_create(switch_say_file_ha { switch_assert(sh); + if (zstr(ext)) { + ext = "wav"; + } + *sh = malloc(sizeof(**sh)); memset(*sh, 0, sizeof(**sh)); From 7dcbe7bda688e0523ab889fd09f2736beb6e3858 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 29 Mar 2011 21:05:04 -0500 Subject: [PATCH 194/558] FS-3189 ok, patch added, but have you discovered why you trigger this because its not typical and is the sign of a problem I would assume? --- conf/sip_profiles/internal.xml | 6 ++++-- src/mod/endpoints/mod_sofia/sofia.c | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/conf/sip_profiles/internal.xml b/conf/sip_profiles/internal.xml index b78ea20070..b803bcea6d 100644 --- a/conf/sip_profiles/internal.xml +++ b/conf/sip_profiles/internal.xml @@ -47,8 +47,8 @@ Sometimes, in extremely rare edge cases, the Sofia SIP stack may stop responding. These options allow you to enable and control a watchdog on the Sofia SIP stack so that if it stops responding for the - specified number of milliseconds, it will cause FreeSWITCH to shut - down immediately. This is useful if you run in an HA environment and + specified number of milliseconds, it will cause FreeSWITCH to crash + immediately. This is useful if you run in an HA environment and need to ensure automated recovery from such a condition. Note that if your server is idle a lot, the watchdog may fire due to not receiving any SIP messages. Thus, if you expect your system to be idle, you @@ -57,6 +57,8 @@ globally for all profiles. So, if you run in an HA environment with a master and slave, you should use the CLI to make sure the watchdog is only enabled on the master. + If such crash occurs, FreeSWITCH will dump core if allowed. The + stacktrace will include function watchdog_triggered_abort(). --> diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index ca9b0cd974..5a3ad76680 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1275,6 +1275,11 @@ static void sofia_perform_profile_start_failure(sofia_profile_t *profile, char * } } +/* not a static function so that it's still visible on stacktraces */ +void watchdog_triggered_abort(void) { + abort(); +} + #define sofia_profile_start_failure(p, xp) sofia_perform_profile_start_failure(p, xp, __FILE__, __LINE__) @@ -1390,10 +1395,10 @@ void *SWITCH_THREAD_FUNC sofia_profile_worker_thread_run(switch_thread_t *thread } if (event_fail || step_fail) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED!\n" + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Profile %s: SIP STACK FAILURE DETECTED BY WATCHDOG!\n" "GOODBYE CRUEL WORLD, I'M LEAVING YOU TODAY....GOODBYE, GOODBYE, GOOD BYE\n", profile->name); switch_yield(2000000); - abort(); + watchdog_triggered_abort(); } } From 3d47df436c7ef08f4a203eed5c5db6dfde2a62e1 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 29 Mar 2011 19:35:20 -0700 Subject: [PATCH 195/558] Update ChangeLog through Mar 9 (more coming) --- docs/ChangeLog | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index 63cdce2379..55bec755fc 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -205,16 +205,27 @@ freeswitch (1.0.7) core: use strdup instead of core_session_strdup in hangup hook (r:3a10d6a1) core: fix jb + no timer situations (r:61d3c56f) core: Add events PLAYBACK_START and PLAYBACK_STOP, plus some minor improvments for RECORD_STOP (r:bc397ab6/FS-2971) + core: Fix event queue from needlessly filling up (r:2044a749/FS-3105) + core: Fix issue that was preventing the sqlite handles from being recycled properly (r:11451c10/FS-3106) + core: clear timestamp when generating a fake empty frame to fix edge-case sending the same timestamp over and over (r:08496cd7) + core: wait for state change to avoid race (r:f33e9c6e/FS-2966) + core: Fix freeswitch.session in Lua, etc. (r:0ba25358/FS-3119) + core: try to reduce contention by not creating handles with the global mutex locked (r:b3a2fa1c) + core: add limits to simo open sql handles (r:61cdf0da) + core: Fix db locks affecting mod_callcenter (r:8da371c7/FS-3127) + core: improve flow of dtmf through a bridge when timer is disabled (r:59da356d) embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) embedded languages: add insertFile front end to switch_ivr_insert_file and reswig (r:c4e350ab) fs_cli: block control-z from fs cli and print a warning how to exit properly (r:dc436b82) fs_cli: skip blocking writes on fs_cli to avoid backing up event socket (r:2ec2a9b0) fs_cli: let ctl-c work until you are connected (r:986f258d) + fs_cli: add -i --interrupt to fs_cli to allow control-c to exit the program (r:e7b3c3b1) lang: Improve French phrase files (FSCONFIG-23) lang: Update langs - Add pt_PT, update es to have es_ES and es_MX, update mod_say_es and add mod_say_pt (FS-2937) (r:c81a9448/FS-2937) libapr: Fix issue where after a bridge with a member, uuid of Agent is set to single quote character ' (r:3fee704d/FS-2738) libdingaling: fix race on shutdown causing crash (FSMOD-47) libdingaling: Fix crash in new GV interface when exceeding 24 calls (r:be00609a/FS-2171) + libdingaling: fix crash when GV call ends (r:687140b5/FS-3139) libesl: Fix potential race condition (ESL-36) libesl: Add /uuid command to fs_cli to filter logs by uuid libesl: Increase buffer in fs_cli for Win (r:d1d6be88/FSCORE-611) @@ -238,6 +249,7 @@ freeswitch (1.0.7) libesl: null terminate buffer after reading from the socket to prevent cross-over to old data that confuses the parser and throws off framing (r:e8a10558/ESL-56) libesl: add optional job-uuid param to bgapi in oop mod (r:e96acac3) libesl: fix linger support in esl client lib (r:0444626b) + libesl: fix segfault (r:30813ca5/FS-3130) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) @@ -252,6 +264,7 @@ freeswitch (1.0.7) libsofiasip: Fix T.38 bug in sofia_glue (r:2843f1ad/MODSOFIA-94) libsofiasip: VS2010 sofia posix problem (r:46dd24c2/SFSIP-220) libsofiasip: set minimum initital sip t1 timer to 1000ms to work around race condition on retry timer firing before all the things that are supposed to be handled by the timer are set. The base resolution on this timer is 500ms, so doubling up makes sure we always hit the initial retry timer on the next run, where everything should be set. The side effect was, 1/2 the time on a request that did not get immediate response, the timer would be fired and cleared, but the action (sending retry) was never done, and a new timer was not set, causing the request to just sit zombied and never retry. A better solution would be to find and correct the race condition so the timer is never set to early and we never hit this condition. (r:20c2740c) + libsofiasip: fix bad assert (r:56404641/FS-3133) libspandsp: Fixed a typo in spandsp's msvc/inttypes.h Updated sig_tone processing in spandsp to the latest, to allow moy to proceed with his signaling work. libspandsp: removed a saturate16 from spandsp that was causing problems fixed a typo in the MSVC inttypes.h file for spandsp libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) @@ -335,6 +348,9 @@ freeswitch (1.0.7) mod_conference: don't switch to CS_SOFT_EXECUTE before setting the current extension (r:4b5bcba0) mod_conference: play files saying vol level in conf in lieu of making a function of say modules to return file_string urls (we need that) (r:94b680fb) mod_conference: fire auto gain level events (r:d8ef36ed) + mod_conference: clear talk flag when you mute (r:b7419add) + mod_conference: fix pthread mutex lock error and add some tab completion and help messages from cli (r:547d5393/FS-3095) + mod_conference: Use the channel's sound_prefix if it's not set in the conference's config (r:0911ed74/FS-3124) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) @@ -531,6 +547,8 @@ freeswitch (1.0.7) mod_sndfile: Add support for .alaw and .ulaw to mod_sndfile (r:facf09b8/MODFORM-41) mod_sndfile: return break in mod_sndfile when seek returns failure (r:564dc7e4) mod_snmp: initial checkin of mod_snmp (r:6e2b1bd3) + mod_snmp: fix segfault when getting channel list (r:b6b4e6b5/FS-3114) + mod_snmp: fix segv when snmpwalking ringing channels, fix segv in snmp getBulkRequest (r:9c4c1e81/FS-3120) mod_sofia: Send SIP MESSAGE to unregistered users by prefixing sip: to user@domain mod_sofia: fix callee being updated with callee information mod_sofia: set appearance-index in update statement for SLA @@ -665,6 +683,12 @@ freeswitch (1.0.7) mod_sofia: segfault with sofia_contact when invalid parameters are given (r:4e60f14a/FS-3072) mod_sofia: Fix minupnpd nat_map updated IP not getting set in SIP profiles (r:e7acd4d1/FS-3054) mod_sofia: add sip_execute_on_image variable similar to execute_on_answer etc so you can run t38_gateway or rxfax etc when you get a T.38 re-invite but no CNG tone or you want to ignore the tone and only react when getting a T.38 re-invite (r:53fc3f7f) + mod_sofia: add sip_jitter_buffer_during_bridge which you can set to true to keep a jitter buffer on both ends of the call when you are NormT (r:01073a79) + mod_sofia: fix race condition in sofia recover for atom processors (r:3eeb4995/FS-3117) + mod_sofia: improve codec ordering in ep_codec_string (r:8fe24a29/FS-3121) + mod_sofia: Send BYE to endpoints that lose race even if they answered (r:8c3651fa/FS-640) + mod_sofia: do not renegotiate codecs on hold re-invites (r:bfd0ba97) + mod_sofia: add rtp-notimer-during-bridge (alternative to rtp-autoflush-during-bridge (r:2a35dfb5) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -689,6 +713,7 @@ freeswitch (1.0.7) mod_valet_parking: add event data to valet parking hold event mod_valet_parking: add event for Valet Parking action exit mod_valet_parking: pass hold class on transfer (r:76a065ec) + mod_valet_parking: add valet_announce_slot variable (r:293d7254) mod_voicemail: Fix vm_prefs profile lock (MODAPP-417) mod_voicemail: add 'vm-enabled' param (default true) mod_voicemail: fix vm msg being deleted when pressing key to forward to email (MODAPP-403) From d41902d1dc2b8ff886818bfbbc4c6a287343f822 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 29 Mar 2011 22:22:56 -0600 Subject: [PATCH 196/558] VS2010 Express build fixes and remove mod_file_string --- Freeswitch.2010.express.sln | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Freeswitch.2010.express.sln b/Freeswitch.2010.express.sln index a4044348bd..b0df7d9c35 100644 --- a/Freeswitch.2010.express.sln +++ b/Freeswitch.2010.express.sln @@ -54,6 +54,9 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsqlite", "libs\win32\sqlite\sqlite.2010.vcxproj", "{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre", "libs\win32\pcre\libpcre.2010.vcxproj", "{8D04B550-D240-4A44-8A18-35DA3F7038D9}" + ProjectSection(ProjectDependencies) = postProject + {1CED5987-A529-46DC-B30F-870D85FF9C94} = {1CED5987-A529-46DC-B30F-870D85FF9C94} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libapr", "libs\win32\apr\libapr.2010.vcxproj", "{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}" EndProject @@ -249,8 +252,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16khz music", "libs\win32\S EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\Sound_Files\32khzmusic.2010.vcxproj", "{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_file_string", "src\mod\formats\mod_file_string\mod_file_string.2010.vcxproj", "{70564D74-199A-4452-9C60-19ED5F242F0D}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_nibblebill", "src\mod\applications\mod_nibblebill\mod_nibblebill.2010.vcxproj", "{3C977801-FE88-48F2-83D3-FA2EBFF6688E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj", "{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}" @@ -317,6 +318,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_directory", "src\mod\ap EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldns-lib\ldns-lib.2010.vcxproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpcre Generate pcre_chartables.c", "libs\win32\pcre\pcre_chartables.c.2010.vcxproj", "{1CED5987-A529-46DC-B30F-870D85FF9C94}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -1634,17 +1637,6 @@ Global {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 @@ -1988,6 +1980,15 @@ Global {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.ActiveCfg = Release|Win32 {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|Win32.Build.0 = Release|Win32 {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|Win32.Build.0 = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.All|x64.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.ActiveCfg = Debug|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|Win32.Build.0 = Debug|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Debug|x64.ActiveCfg = Debug|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.ActiveCfg = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|Win32.Build.0 = Release|Win32 + {1CED5987-A529-46DC-B30F-870D85FF9C94}.Release|x64.ActiveCfg = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE From de96c09d96b2008f9dd6cacc042f2f61c733fef6 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 29 Mar 2011 23:37:55 -0500 Subject: [PATCH 197/558] VS2008 VS2010 remove mod_file_string from solutions --- Freeswitch.2008.sln | 17 ----------------- Freeswitch.2010.sln | 21 --------------------- w32/Setup/Setup.wixproj | 9 --------- 3 files changed, 47 deletions(-) diff --git a/Freeswitch.2008.sln b/Freeswitch.2008.sln index 4cfd581dad..f915005e7c 100644 --- a/Freeswitch.2008.sln +++ b/Freeswitch.2008.sln @@ -981,11 +981,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\S {1F0A8A77-E661-418F-BB92-82172AE43803} = {1F0A8A77-E661-418F-BB92-82172AE43803} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_file_string", "src\mod\formats\mod_file_string\mod_file_string.2008.vcproj", "{70564D74-199A-4452-9C60-19ED5F242F0D}" - ProjectSection(ProjectDependencies) = postProject - {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} - EndProjectSection -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_nibblebill", "src\mod\applications\mod_nibblebill\mod_nibblebill.2008.vcproj", "{3C977801-FE88-48F2-83D3-FA2EBFF6688E}" ProjectSection(ProjectDependencies) = postProject {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} = {202D7A4E-760D-4D0E-AFA1-D7459CED30FF} @@ -2490,17 +2485,6 @@ Global {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Debug|x64.ActiveCfg = Debug|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|Win32.ActiveCfg = Release|Win32 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 @@ -2913,7 +2897,6 @@ Global {2CA40887-1622-46A1-A7F9-17FD7E7E545B} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D} - {70564D74-199A-4452-9C60-19ED5F242F0D} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {1A1FF289-4FD6-4285-A422-D31DD67A4723} = {CBD81696-EFB4-4D2F-8451-1B8DAA86155A} {EC3E5C7F-EE09-47E2-80FE-546363D14A98} = {B8F5B47B-8568-46EB-B320-64C17D2A98BC} {1AD3F51E-BBB6-4090-BA39-9DFAB1EF1F5F} = {0C808854-54D1-4230-BFF5-77B5FD905000} diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 5f36859568..63b3ad12f2 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -631,8 +631,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "16khz music", "libs\win32\S EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "32khz music", "libs\win32\Sound_Files\32khzmusic.2010.vcxproj", "{EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_file_string", "src\mod\formats\mod_file_string\mod_file_string.2010.vcxproj", "{70564D74-199A-4452-9C60-19ED5F242F0D}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_nibblebill", "src\mod\applications\mod_nibblebill\mod_nibblebill.2010.vcxproj", "{3C977801-FE88-48F2-83D3-FA2EBFF6688E}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_ru", "src\mod\say\mod_say_ru\mod_say_ru.2010.vcxproj", "{0382E8FD-CFDC-41C0-8B03-792C7C84FC31}" @@ -2971,24 +2969,6 @@ Global {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64.ActiveCfg = Release|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x64 Setup.ActiveCfg = Release|x64 {EED13FC7-4F81-4E6F-93DB-CDB7DF5CF959}.Release|x86 Setup.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|Win32.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64 Setup.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x64 Setup.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.All|x86 Setup.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|Win32.Build.0 = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64.Build.0 = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x64 Setup.ActiveCfg = Debug|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Debug|x86 Setup.ActiveCfg = Debug|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.ActiveCfg = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|Win32.Build.0 = Release|Win32 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64.Build.0 = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x64 Setup.ActiveCfg = Release|x64 - {70564D74-199A-4452-9C60-19ED5F242F0D}.Release|x86 Setup.ActiveCfg = Release|Win32 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|Win32.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.ActiveCfg = Release|x64 {3C977801-FE88-48F2-83D3-FA2EBFF6688E}.All|x64.Build.0 = Release|x64 @@ -3711,7 +3691,6 @@ Global {2CA40887-1622-46A1-A7F9-17FD7E7E545B} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {6FF941AC-82C5-429F-AA4C-AD2FB9E5DA52} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {38FE0559-9910-43A8-9E45-3E5004C27692} = {A5A27244-AD24-46E5-B01B-840CD296C91D} - {70564D74-199A-4452-9C60-19ED5F242F0D} = {A5A27244-AD24-46E5-B01B-840CD296C91D} {CBD81696-EFB4-4D2F-8451-1B8DAA86155A} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {62F27B1A-C919-4A70-8478-51F178F3B18F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} {89385C74-5860-4174-9CAF-A39E7C48909C} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B} diff --git a/w32/Setup/Setup.wixproj b/w32/Setup/Setup.wixproj index f97000b585..d9d34b1952 100644 --- a/w32/Setup/Setup.wixproj +++ b/w32/Setup/Setup.wixproj @@ -525,15 +525,6 @@ Binaries;Content;Satellites MODLOCATION - - mod_file_string - {70564d74-199a-4452-9c60-19ed5f242f0d} - True - - - Binaries;Content;Satellites - MODLOCATION - mod_local_stream {2ca40887-1622-46a1-a7f9-17fd7e7e545b} From eb218cf935fdbef04895b2e05634a87f29f7fe9d Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Wed, 30 Mar 2011 11:38:29 +0200 Subject: [PATCH 198/558] removed mod_file_string from specfile since it has been merged into dptools --- freeswitch.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index 6437a7b4fe..45e2daec7f 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -473,7 +473,7 @@ EVENT_HANDLERS_MODULES="event_handlers/mod_cdr_csv event_handlers/mod_cdr_sqlite # File and Audio Format Handlers # ###################################################################################################################### -FORMATS_MODULES="formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ +FORMATS_MODULES="formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ formats/mod_shout formats/mod_sndfile formats/mod_tone_stream" ###################################################################################################################### @@ -891,7 +891,6 @@ fi %{prefix}/mod/mod_event_socket.so* %{prefix}/mod/mod_expr.so* %{prefix}/mod/mod_fifo.so* -%{prefix}/mod/mod_file_string.so* %{prefix}/mod/mod_flite.so* %{prefix}/mod/mod_fsv.so* %{prefix}/mod/mod_hash.so* @@ -1098,6 +1097,8 @@ fi # ###################################################################################################################### %changelog +* Wed Mar 30 2011 - michal.bielicki@seventhsignal.de +- removed mod_file_string since it has been merged into dptools * Wed Feb 16 2011 - michal.bielicki@seventhsignal.de - added mod_skinny - added sangoma libraries From 326886d0fbff701e54ce3649fdbf7598331179da Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Wed, 30 Mar 2011 11:40:52 +0200 Subject: [PATCH 199/558] removed mod_file_string from debian build since it has been merged into dptools --- debian/changelog | 6 ++++++ debian/rules | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 158984b9b9..d9608d68d5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +freeswitch (1.0.head-git.master.20110330.1-1) unstable; urgency=low + + * removed mod_file_string since it has been merged into dptoolsa + + -- Michal Bielicki Wed, 30 Mar 2011 11:39:02 +0200 + freeswitch (1.0.head~git.master.20101222.1-1) unstable; urgency=low * cleaning work diff --git a/debian/rules b/debian/rules index 244c5849ac..3cda88d794 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,7 @@ export DIALPLANS_MODULES= dialplans/mod_dialplan_asterisk dialplans/mod_dialplan export ENDPOINTS_MODULES= endpoints/mod_dingaling endpoints/mod_portaudio endpoints/mod_sofia endpoints/mod_loopback \ ../../libs/freetdm/mod_freetdm endpoints/mod_skypopen endpoints/mod_skinny export EVENT_HANDLERS_MODULES=event_handlers/mod_event_multicast event_handlers/mod_event_socket event_handlers/mod_cdr_csv -export FORMATS_MODULES= formats/mod_file_string formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ +export FORMATS_MODULES= formats/mod_local_stream formats/mod_native_file formats/mod_portaudio_stream \ formats/mod_shout formats/mod_sndfile formats/mod_tone_stream export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua languages/mod_python export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog From 6e78f6f57ea78069af575d67e52c9f2eca79866e Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Wed, 30 Mar 2011 11:41:45 +0200 Subject: [PATCH 200/558] removed mod_file_string from debian build since it has been merged into dptools --- debian/freeswitch.install | 1 - 1 file changed, 1 deletion(-) diff --git a/debian/freeswitch.install b/debian/freeswitch.install index ef54c351d6..37c1407d9c 100644 --- a/debian/freeswitch.install +++ b/debian/freeswitch.install @@ -129,7 +129,6 @@ opt/freeswitch/mod/mod_esf.so* opt/freeswitch/mod/mod_event_*.so* opt/freeswitch/mod/mod_expr.so* opt/freeswitch/mod/mod_fifo.so* -opt/freeswitch/mod/mod_file_string.so* opt/freeswitch/mod/mod_flite.so* opt/freeswitch/mod/mod_fsv.so* opt/freeswitch/mod/mod_hash.so* From 3a2e1d0337e24a4fb5d4c7518a96fd525d5b4c55 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 10:55:40 -0500 Subject: [PATCH 201/558] FS-3176 --comment-only try this patch, native is a special case so use the extension native e.g. en.native --- src/switch_loadable_module.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 9804e53238..0c803a71b4 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1995,14 +1995,23 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f char buf[256] = ""; int ret; va_list ap; + int native = !strcasecmp(sh->ext, "native"); va_start(ap, fmt); if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { if (!sh->cnt++) { - sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); + if (native) { + sh->stream.write_function(&sh->stream, "file_string://%s", buf); + } else { + sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); + } } else { - sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); + if (native) { + sh->stream.write_function(&sh->stream, "!%s", buf); + } else { + sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); + } } } From e53487af571e4b1d725094e5c4740cd24b4fe27c Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 30 Mar 2011 11:20:57 -0500 Subject: [PATCH 202/558] FS-3204 --- src/mod/say/mod_say_ru/mod_say_ru.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index f75ab3b3d8..771f997f8a 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -496,10 +496,10 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, ru_say_count(session, buf, male_h, genitivus, args); say_file("time/h-year.wav"); } - if (say_month || say_year || say_date || say_dow) { - say_file("time/at.wav"); - } if (say_time) { + if (say_month || say_year || say_date || say_dow) { + say_file("time/at.wav"); + } switch_snprintf(buf, sizeof(buf), "%d:%d:%d", tm.tm_hour, tm.tm_min, tm.tm_sec); say_args->type = SST_TIME_MEASUREMENT; ru_say_time(session, buf, say_args, args); From 8312d741215811010e8f9f3beff2a6c0d27561e5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 11:26:14 -0500 Subject: [PATCH 203/558] FS-2819 --comment-only please try this patch --- src/mod/endpoints/mod_sofia/sofia_glue.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index acb0a05aaa..7e16f8c01e 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -505,7 +505,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 ptime = tech_pvt->read_codec.implementation->microseconds_per_packet / 1000; } - + if (tech_pvt->dtmf_type == DTMF_2833 && tech_pvt->te > 95) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te); } @@ -4754,6 +4754,11 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s switch_rtp_set_telephony_recv_event(tech_pvt->rtp_session, te); } } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Disable 2833 dtmf\n"); + switch_channel_set_variable(tech_pvt->channel, "dtmf_type", "none"); + tech_pvt->dtmf_type = DTMF_NONE; + te = tech_pvt->recv_te = 0; } From 31273b428d0c81fd61ee85e8c1c3834af659df0a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 11:35:19 -0500 Subject: [PATCH 204/558] pass failure across in T.38 passthru mode --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 5a3ad76680..9161f23eb5 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4414,7 +4414,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status if (switch_channel_test_flag(channel, CF_PROXY_MODE) || switch_channel_test_flag(channel, CF_PROXY_MEDIA) || - (sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38)) { + (sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && (has_t38 || status > 299))) { if (sofia_test_flag(tech_pvt, TFLAG_SENT_UPDATE)) { sofia_clear_flag_locked(tech_pvt, TFLAG_SENT_UPDATE); From aeb446a1cb6e01a79765ecdbbddbc5e1b97531c5 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 30 Mar 2011 14:55:06 -0500 Subject: [PATCH 205/558] FS-3201 make changes similar to en support --- src/mod/say/mod_say_de/mod_say_de.c | 23 ++++++++++++--------- src/mod/say/mod_say_es/mod_say_es.c | 23 ++++++++++++--------- src/mod/say/mod_say_fr/mod_say_fr.c | 31 +++++++++++++++++------------ src/mod/say/mod_say_hr/mod_say_hr.c | 23 ++++++++++++--------- src/mod/say/mod_say_hu/mod_say_hu.c | 23 ++++++++++++--------- src/mod/say/mod_say_it/mod_say_it.c | 23 ++++++++++++--------- src/mod/say/mod_say_ja/mod_say_ja.c | 22 ++++++++++++-------- src/mod/say/mod_say_nl/mod_say_nl.c | 23 ++++++++++++--------- src/mod/say/mod_say_ru/mod_say_ru.c | 2 +- src/mod/say/mod_say_th/mod_say_th.c | 24 ++++++++++++---------- src/mod/say/mod_say_zh/mod_say_zh.c | 24 ++++++++++++---------- 11 files changed, 145 insertions(+), 96 deletions(-) diff --git a/src/mod/say/mod_say_de/mod_say_de.c b/src/mod/say/mod_say_de/mod_say_de.c index fec6ddb680..7212a5f581 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -127,9 +127,22 @@ static switch_status_t de_say_general_count(switch_core_session_t *session, char int in; int x = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; switch_status_t status; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -158,14 +171,6 @@ static switch_status_t de_say_general_count(switch_core_session_t *session, char return status; } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_es/mod_say_es.c b/src/mod/say/mod_say_es/mod_say_es.c index 0576e16c6c..91675aa872 100644 --- a/src/mod/say/mod_say_es/mod_say_es.c +++ b/src/mod/say/mod_say_es/mod_say_es.c @@ -155,9 +155,22 @@ static switch_status_t es_say_general_count(switch_core_session_t *session, char int in; int x = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; switch_status_t status; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -191,14 +204,6 @@ static switch_status_t es_say_general_count(switch_core_session_t *session, char return status; } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_fr/mod_say_fr.c b/src/mod/say/mod_say_fr/mod_say_fr.c index 5ddd8fb58e..37e126ecb2 100644 --- a/src/mod/say/mod_say_fr/mod_say_fr.c +++ b/src/mod/say/mod_say_fr/mod_say_fr.c @@ -144,9 +144,26 @@ static switch_status_t fr_say_general_count(switch_core_session_t *session, char int in; int x = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; switch_status_t status; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + if (*p == '1' && say_args->gender == SSG_FEMININE) { + say_file("digits/%c_f.wav", *p); + } else { + say_file("digits/%c.wav", *p); + } + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -175,18 +192,6 @@ static switch_status_t fr_say_general_count(switch_core_session_t *session, char return status; } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - if (*p == '1' && say_args->gender == SSG_FEMININE) { - say_file("digits/%c_f.wav", *p); - } else { - say_file("digits/%c.wav", *p); - } - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_hr/mod_say_hr.c b/src/mod/say/mod_say_hr/mod_say_hr.c index 4c560db80a..f08a0de0a2 100644 --- a/src/mod/say/mod_say_hr/mod_say_hr.c +++ b/src/mod/say/mod_say_hr/mod_say_hr.c @@ -356,10 +356,23 @@ static switch_status_t hr_say_general_count(switch_core_session_t *session, char int in; int x = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; int number; switch_status_t status; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = strip_commas(tosay, sbuf, sizeof(sbuf))) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -391,14 +404,6 @@ static switch_status_t hr_say_general_count(switch_core_session_t *session, char return status; } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_hu/mod_say_hu.c b/src/mod/say/mod_say_hu/mod_say_hu.c index ca1b90f584..847d6f811d 100644 --- a/src/mod/say/mod_say_hu/mod_say_hu.c +++ b/src/mod/say/mod_say_hu/mod_say_hu.c @@ -122,10 +122,23 @@ static switch_status_t hu_say_general_count(switch_core_session_t *session, char int in; int x = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; int number; switch_status_t status; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -157,14 +170,6 @@ static switch_status_t hu_say_general_count(switch_core_session_t *session, char return status; } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_it/mod_say_it.c b/src/mod/say/mod_say_it/mod_say_it.c index e3d5131ed1..ef4b3d2bda 100644 --- a/src/mod/say/mod_say_it/mod_say_it.c +++ b/src/mod/say/mod_say_it/mod_say_it.c @@ -131,9 +131,22 @@ static switch_status_t it_say_general_count(switch_core_session_t *session, char int in; int places_count = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; switch_status_t status; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -202,14 +215,6 @@ static switch_status_t it_say_general_count(switch_core_session_t *session, char return status; } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_ja/mod_say_ja.c b/src/mod/say/mod_say_ja/mod_say_ja.c index f493d8974a..aa11a87ebf 100644 --- a/src/mod/say/mod_say_ja/mod_say_ja.c +++ b/src/mod/say/mod_say_ja/mod_say_ja.c @@ -84,10 +84,23 @@ SWITCH_MODULE_DEFINITION(mod_say_ja, mod_say_ja_load, NULL, NULL); static switch_status_t ja_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) { int in; - char sbuf[13] = ""; + char sbuf[128] = ""; char digits[11]; int i; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -218,13 +231,6 @@ static switch_status_t ja_say_general_count(switch_core_session_t *session, char } } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) - say_file("digits/%c.wav", *p); - } - break; default: break; } diff --git a/src/mod/say/mod_say_nl/mod_say_nl.c b/src/mod/say/mod_say_nl/mod_say_nl.c index 116c20ec91..e1e822b2f6 100644 --- a/src/mod/say/mod_say_nl/mod_say_nl.c +++ b/src/mod/say/mod_say_nl/mod_say_nl.c @@ -118,9 +118,22 @@ static switch_status_t nl_say_general_count(switch_core_session_t *session, char int in; int x = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; switch_status_t status; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -149,14 +162,6 @@ static switch_status_t nl_say_general_count(switch_core_session_t *session, char return status; } break; - case SSM_ITERATED: - { - char *p; - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 771f997f8a..9c8db5732e 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -157,7 +157,7 @@ static switch_status_t ru_say_count(switch_core_session_t *session, char *tosay, int in; int x = 0; int places[9] = { 0 }; - char sbuf[13] = ""; + char sbuf[128] = ""; int in_; switch_status_t status; diff --git a/src/mod/say/mod_say_th/mod_say_th.c b/src/mod/say/mod_say_th/mod_say_th.c index f61cdbce82..675c1a44e6 100644 --- a/src/mod/say/mod_say_th/mod_say_th.c +++ b/src/mod/say/mod_say_th/mod_say_th.c @@ -90,10 +90,23 @@ SWITCH_MODULE_DEFINITION(mod_say_th, mod_say_th_load, NULL, NULL); static switch_status_t th_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) { int in; - char sbuf[13] = ""; + char sbuf[128] = ""; char digits[11]; int i; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -206,15 +219,6 @@ static switch_status_t th_say_general_count(switch_core_session_t *session, char } } break; - case SSM_ITERATED: - { - char *p; - - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } diff --git a/src/mod/say/mod_say_zh/mod_say_zh.c b/src/mod/say/mod_say_zh/mod_say_zh.c index 3f4098d856..0dc566289a 100644 --- a/src/mod/say/mod_say_zh/mod_say_zh.c +++ b/src/mod/say/mod_say_zh/mod_say_zh.c @@ -89,10 +89,23 @@ SWITCH_MODULE_DEFINITION(mod_say_zh, mod_say_zh_load, NULL, NULL); static switch_status_t zh_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) { int in; - char sbuf[13] = ""; + char sbuf[128] = ""; char digits[11]; int i; + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + say_file("digits/%c.wav", *p); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; @@ -170,15 +183,6 @@ static switch_status_t zh_say_general_count(switch_core_session_t *session, char } } break; - case SSM_ITERATED: - { - char *p; - - for (p = tosay; p && *p; p++) { - say_file("digits/%c.wav", *p); - } - } - break; default: break; } From 3ad4ae0a54ec52a6ac3692ed6af497eb93a98c7f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 15:10:40 -0500 Subject: [PATCH 206/558] fix null printf --- src/switch_channel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 52542e12d6..0476981331 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2456,8 +2456,8 @@ SWITCH_DECLARE(void) switch_channel_flip_cid(switch_channel_t *channel) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(channel->session), SWITCH_LOG_INFO, "%s Flipping CID from \"%s\" <%s> to \"%s\" <%s>\n", switch_channel_get_name(channel), - switch_channel_get_variable(channel, "pre_transfer_caller_id_name"), - switch_channel_get_variable(channel, "pre_transfer_caller_id_number"), + switch_str_nil(switch_channel_get_variable(channel, "pre_transfer_caller_id_name")), + switch_str_nil(switch_channel_get_variable(channel, "pre_transfer_caller_id_number")), channel->caller_profile->caller_id_name, channel->caller_profile->caller_id_number ); From 3253bcb3632d5831401c1bd712a18d59746c31be Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 19:17:54 -0500 Subject: [PATCH 207/558] FS-3147 --resolve I finally tracked this down to the actual recordings generated by mod_conference. This patch delays the recording slightly to allow time for the buffer to fill up, we were riding it so closely that sometimes we would come up short and inject silence into the file to preserve time passing --- .../mod_conference/mod_conference.c | 83 ++++++++++++++----- 1 file changed, 60 insertions(+), 23 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index ef3000d287..e198d8aa74 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2823,6 +2823,9 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th uint32_t rlen; switch_size_t data_buf_len; switch_event_t *event; + int no_data = 0; + int lead_in = 20; + switch_size_t len = 0; data_buf_len = samples * sizeof(int16_t); @@ -2910,9 +2913,15 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th switch_event_fire(&event); } - while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(conference, CFLAG_RUNNING) && conference->count) { - switch_size_t len = 0; + + len = 0; + + if (lead_in) { + lead_in--; + goto loop; + } + mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); if (switch_test_flag(member, MFLAG_FLUSH_BUFFER)) { @@ -2925,36 +2934,64 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th switch_clear_flag_locked(member, MFLAG_FLUSH_BUFFER); } + again: + if (switch_test_flag((&fh), SWITCH_FILE_PAUSE)) { switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER); - } else { - if (mux_used) { - /* Flush the output buffer and write all the data (presumably muxed) to the file */ - switch_mutex_lock(member->audio_out_mutex); - low_count = 0; - - if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) { - len = (switch_size_t) rlen / sizeof(int16_t); - } - switch_mutex_unlock(member->audio_out_mutex); - } - - if (len < (switch_size_t) samples) { - memset(data_buf + (len * sizeof(int16_t)), 255, ((switch_size_t) samples - len) * sizeof(int16_t)); - len = (switch_size_t) samples; - } - - if (!len || switch_core_file_write(&fh, data_buf, &len) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Failed\n"); - switch_clear_flag_locked(member, MFLAG_RUNNING); - } + goto loop; } + if (mux_used >= data_buf_len) { + /* Flush the output buffer and write all the data (presumably muxed) to the file */ + switch_mutex_lock(member->audio_out_mutex); + low_count = 0; + + if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) { + len = (switch_size_t) rlen / sizeof(int16_t); + no_data = 0; + } + switch_mutex_unlock(member->audio_out_mutex); + } + + if (len == 0) { + mux_used = (uint32_t) switch_buffer_inuse(member->mux_buffer); + + if (mux_used >= data_buf_len) { + goto again; + } + + if (++no_data < 2) { + goto loop; + } + + memset(data_buf, 255, (switch_size_t) data_buf_len); + len = (switch_size_t) samples; + } + + if (!len || switch_core_file_write(&fh, data_buf, &len) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Write Failed\n"); + switch_clear_flag_locked(member, MFLAG_RUNNING); + } + + loop: + switch_core_timer_next(&timer); } /* Rinse ... Repeat */ end: + for(;;) { + switch_mutex_lock(member->audio_out_mutex); + if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) { + len = (switch_size_t) rlen / sizeof(int16_t); + switch_core_file_write(&fh, data_buf, &len); + } else { + break; + } + switch_mutex_unlock(member->audio_out_mutex); + } + + switch_safe_free(data_buf); switch_core_timer_destroy(&timer); conference_del_member(conference, member); From b8063c3d34e7805c665d745e10920f76cb87609e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 20:12:25 -0500 Subject: [PATCH 208/558] wait for channels to come up in paging mode --- .../mod_conference/mod_conference.c | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index e198d8aa74..5249adda70 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2559,10 +2559,6 @@ static void conference_loop_output(conference_member_t *member) write_frame.codec = &member->write_codec; - if (!switch_test_flag(member->conference, CFLAG_ANSWERED)) { - switch_channel_answer(channel); - } - if (!restarting) { /* Start the input thread */ launch_conference_loop_input(member, switch_core_session_get_pool(member->session)); @@ -2609,8 +2605,22 @@ static void conference_loop_output(conference_member_t *member) } switch_safe_free(cpstr); } + + do { + switch_ivr_play_file(member->session, NULL, "tone_stream://%(500,0,640)", NULL); + } while(switch_channel_up(channel) && member->conference->originating); + + if (!switch_channel_ready(channel)) { + member->conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL; + goto end; + } + } } + + if (!switch_test_flag(member->conference, CFLAG_ANSWERED)) { + switch_channel_answer(channel); + } if (restarting) { switch_channel_clear_app_flag(channel, CF_APP_TAGGED); @@ -2788,8 +2798,9 @@ static void conference_loop_output(conference_member_t *member) switch_cond_next(); } - } /* Rinse ... Repeat */ + } /* Rinse ... Repeat */ + end: switch_clear_flag_locked(member, MFLAG_RUNNING); switch_core_timer_destroy(&timer); From 31580d6661f36ef18f5769940ea51d3468312df3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 20:44:45 -0500 Subject: [PATCH 209/558] tweak --- src/mod/applications/mod_conference/mod_conference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 5249adda70..59638c8787 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2607,7 +2607,7 @@ static void conference_loop_output(conference_member_t *member) } do { - switch_ivr_play_file(member->session, NULL, "tone_stream://%(500,0,640)", NULL); + switch_ivr_gentones(member->session, "%(1000,0,640)", 1, NULL); } while(switch_channel_up(channel) && member->conference->originating); if (!switch_channel_ready(channel)) { From 4e3d1f3f86dabc468aaa3ef3d628b49375e7aee4 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 30 Mar 2011 21:09:48 -0500 Subject: [PATCH 210/558] windows mod_enum fix potential seg --- src/mod/applications/mod_enum/mod_enum.c | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 0e70e8267c..b8b380a66e 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -153,20 +153,20 @@ static switch_status_t load_config(void) "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters", 0, KEY_QUERY_VALUE, &hKey); - RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz); - if (globals.server) { - free(globals.server); + if (hKey) { + RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, NULL, &data_sz); + if (data_sz) { + buf = (char*)malloc(data_sz + 1); + + RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz); + RegCloseKey(hKey); + + if(buf[data_sz - 1] != 0) { + buf[data_sz] = 0; + } + globals.server = buf; + } } - buf = (char*)malloc(data_sz + 1); - - RegQueryValueEx(hKey, "DhcpNameServer", NULL, NULL, (LPBYTE)buf, &data_sz); - - RegCloseKey(hKey); - - if(buf[data_sz - 1] != 0) { - buf[data_sz] = 0; - } - globals.server = buf; } #endif From b986e13a58d7090fef9827e07b11870c8822262e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 30 Mar 2011 21:03:25 -0500 Subject: [PATCH 211/558] again --- src/mod/applications/mod_conference/mod_conference.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 59638c8787..7de7f4fdea 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2607,7 +2607,7 @@ static void conference_loop_output(conference_member_t *member) } do { - switch_ivr_gentones(member->session, "%(1000,0,640)", 1, NULL); + switch_ivr_sleep(member->session, 500, SWITCH_TRUE, NULL); } while(switch_channel_up(channel) && member->conference->originating); if (!switch_channel_ready(channel)) { @@ -2615,6 +2615,8 @@ static void conference_loop_output(conference_member_t *member) goto end; } + conference_member_play_file(member, "tone_stream://%(500,0,640)", 0); + } } From b63a72f8b3e93f7c8658885041eecb7f65a59c5a Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 31 Mar 2011 05:17:04 -0400 Subject: [PATCH 212/558] mod_callcenter: Generate per member uuid different from the member session uuid. Might fix transfer between queue. More changes are commings --- .../mod_callcenter/mod_callcenter.c | 208 ++++++++++++------ 1 file changed, 135 insertions(+), 73 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 4240a71aae..892f6fe7ac 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -177,6 +177,7 @@ static char members_sql[] = " queue VARCHAR(255),\n" " system VARCHAR(255),\n" " uuid VARCHAR(255) NOT NULL DEFAULT '',\n" +" session_uuid VARCHAR(255) NOT NULL DEFAULT '',\n" " caller_number VARCHAR(255),\n" " caller_name VARCHAR(255),\n" " system_epoch INTEGER NOT NULL DEFAULT 0,\n" @@ -704,7 +705,7 @@ static cc_queue_t *load_queue(const char *queue_name) goto end; } - switch_cache_db_test_reactive(dbh, "select count(rejoined_epoch) from members", "drop table members", members_sql); + switch_cache_db_test_reactive(dbh, "select count(session_uuid) from members", "drop table members", members_sql); switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", NULL, "alter table agents add ready_time integer not null default 0;" "alter table agents add reject_delay_time integer not null default 0;" "alter table agents add busy_delay_time integer not null default 0;"); @@ -718,7 +719,7 @@ static cc_queue_t *load_queue(const char *queue_name) /* Reset a unclean shutdown */ sql = switch_mprintf("UPDATE agents SET state = 'Waiting', uuid = '' WHERE system = 'single_box';" "UPDATE tiers SET state = 'Ready' WHERE agent IN (SELECT name FROM agents WHERE system = 'single_box');" - "UPDATE members SET state = '%q', uuid = '' WHERE system = 'single_box';", + "UPDATE members SET state = '%q', session_uuid = '' WHERE system = 'single_box';", cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(NULL, sql, NULL); @@ -756,6 +757,7 @@ static cc_queue_t *get_queue(const char *queue_name) struct call_helper { const char *member_uuid; + const char *member_session_uuid; const char *queue_name; const char *queue_strategy; const char *member_joined_epoch; @@ -1356,7 +1358,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa char *sql = NULL; char *dialstr = NULL; cc_tier_state_t tiers_state = CC_TIER_STATE_READY; - switch_core_session_t *member_session = switch_core_session_locate(h->member_uuid); + switch_core_session_t *member_session = switch_core_session_locate(h->member_session_uuid); switch_event_t *ovars; switch_time_t t_agent_called = 0; switch_time_t t_agent_answered = 0; @@ -1369,7 +1371,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* member is gone before we could process it */ if (!member_session) { - sql = switch_mprintf("UPDATE members SET state = '%q', uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(NULL, sql, NULL); @@ -1384,7 +1386,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-Type", h->agent_type); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); switch_event_fire(&event); @@ -1395,9 +1398,11 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_queue", "%s", h->queue_name); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_uuid", "%s", h->member_uuid); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_session_uuid", "%s", h->member_session_uuid); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_member_pre_answer_uuid", "%s", h->member_uuid); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent", "%s", h->agent_name); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_agent_type", "%s", h->agent_type); + switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_side", "%s", "agent"); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); t_agent_called = switch_epoch_time_now(NULL); @@ -1414,10 +1419,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_t *event; const char *cc_warning_tone = switch_channel_get_variable(agent_channel, "cc_warning_tone"); + switch_channel_set_variable(agent_channel, "cc_side", "agent"); switch_channel_set_variable(agent_channel, "cc_queue", h->queue_name); switch_channel_set_variable(agent_channel, "cc_agent", h->agent_name); switch_channel_set_variable(agent_channel, "cc_agent_type", h->agent_type); switch_channel_set_variable(agent_channel, "cc_member_uuid", h->member_uuid); + switch_channel_set_variable(agent_channel, "cc_member_session_uuid", h->member_session_uuid); /* Playback this to the agent */ if (cc_warning_tone && switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { @@ -1469,6 +1476,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_set_variable(agent_channel, "cc_agent", h->agent_name); switch_channel_set_variable(agent_channel, "cc_agent_type", h->agent_type); switch_channel_set_variable(agent_channel, "cc_member_uuid", h->member_uuid); + switch_channel_set_variable(agent_channel, "cc_member_session_uuid", h->member_session_uuid); } switch_core_session_rwunlock(other_loopback_session); } @@ -1511,7 +1519,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); switch_event_fire(&event); @@ -1544,7 +1553,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" <%s> from queue %s%s\n", h->agent_name, h->member_caller_name, h->member_caller_number, h->queue_name, (h->record_template?" (Recorded)":"")); - switch_ivr_uuid_bridge(h->member_uuid, switch_core_session_get_uuid(agent_session)); + switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); /* This is used for the waiting caller to quit waiting for a agent */ switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); @@ -1567,7 +1576,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%ld", (long) switch_epoch_time_now(NULL)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); switch_event_fire(&event); @@ -1601,7 +1611,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); switch_event_fire(&event); @@ -1669,7 +1680,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Hangup-Cause", switch_channel_cause2str(cause)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); switch_event_fire(&event); @@ -1713,10 +1725,12 @@ done: struct agent_callback { const char *queue_name; const char *system; - const char *uuid; - const char *caller_number; - const char *caller_name; - const char *joined_epoch; + const char *member_uuid; + const char *member_session_uuid; + const char *member_caller_number; + const char *member_caller_name; + const char *member_joined_epoch; + const char *member_score; const char *strategy; const char *record_template; switch_bool_t tier_rules_apply; @@ -1735,15 +1749,23 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames agent_callback_t *cbt = (agent_callback_t *) pArg; char *sql = NULL; char res[256]; - char *agent_status = argv[2]; - char *agent_tier_state = argv[9]; - char *agent_last_bridge_end = argv[10]; - char *agent_wrap_up_time = argv[11]; - char *agent_state = argv[12]; - char *agent_ready_time = argv[13]; - char *agent_tier_level = argv[14]; - char *agent_type = argv[15]; - char *agent_uuid = argv[16]; + const char *agent_system = argv[0]; + const char *agent_name = argv[1]; + const char *agent_status = argv[2]; + const char *agent_originate_string = argv[3]; + const char *agent_no_answer_count = argv[4]; + const char *agent_max_no_answer = argv[5]; + const char *agent_reject_delay_time = argv[6]; + const char *agent_busy_delay_time = argv[7]; + const char *agent_no_answer_delay_time = argv[8]; + const char *agent_tier_state = argv[9]; + const char *agent_last_bridge_end = argv[10]; + const char *agent_wrap_up_time = argv[11]; + const char *agent_state = argv[12]; + const char *agent_ready_time = argv[13]; + const char *agent_tier_level = argv[14]; + const char *agent_type = argv[15]; + const char *agent_uuid = argv[16]; switch_bool_t contact_agent = SWITCH_TRUE; @@ -1756,11 +1778,11 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames if (cbt->tier_rule_no_agent_no_wait == SWITCH_TRUE && cbt->tier_agent_available == 0) { cbt->tier = atoi(agent_tier_level); /* Multiple the tier level by the tier wait time */ - } else if (cbt->tier_rule_wait_multiply_level == SWITCH_TRUE && (long) switch_epoch_time_now(NULL) - atol(cbt->joined_epoch) >= atoi(agent_tier_level) * cbt->tier_rule_wait_second) { + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_TRUE && (long) switch_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= atoi(agent_tier_level) * cbt->tier_rule_wait_second) { cbt->tier = atoi(agent_tier_level); cbt->tier_agent_available = 0; /* Just check if joined is bigger than next tier wait time */ - } else if (cbt->tier_rule_wait_multiply_level == SWITCH_FALSE && (long) switch_epoch_time_now(NULL) - atol(cbt->joined_epoch) >= cbt->tier_rule_wait_second) { + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_FALSE && (long) switch_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= cbt->tier_rule_wait_second) { cbt->tier = atoi(agent_tier_level); cbt->tier_agent_available = 0; } else { @@ -1792,7 +1814,7 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames } /* If agent isn't on this box */ - if (strcasecmp(argv[0],"single_box" /* SELF */)) { + if (strcasecmp(agent_system,"single_box" /* SELF */)) { if (!strcasecmp(cbt->strategy, "ring-all")) { return 1; /* Abort finding agent for member if we found a match but for a different Server */ } else { @@ -1802,7 +1824,7 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames if (!strcasecmp(cbt->strategy,"ring-all")) { /* Check if member is a ring-all mode */ - sql = switch_mprintf("SELECT count(*) FROM members WHERE serving_agent = 'ring-all' AND uuid = '%q' AND system = 'single_box'", cbt->uuid); + sql = switch_mprintf("SELECT count(*) FROM members WHERE serving_agent = 'ring-all' AND uuid = '%q' AND system = 'single_box'", cbt->member_uuid); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); @@ -1810,14 +1832,14 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames /* Map the Agent to the member */ sql = switch_mprintf("UPDATE members SET serving_agent = '%q', serving_system = 'single_box', state = '%q'" " WHERE state = '%q' AND uuid = '%q' AND system = 'single_box'", - argv[1], cc_member_state2str(CC_MEMBER_STATE_TRYING), - cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt->uuid); + agent_name, cc_member_state2str(CC_MEMBER_STATE_TRYING), + cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt->member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); /* Check if we won the race to get the member to our selected agent (Used for Multi system purposes) */ sql = switch_mprintf("SELECT count(*) FROM members WHERE serving_agent = '%q' AND serving_system = 'single_box' AND uuid = '%q' AND system = 'single_box'", - argv[1], cbt->uuid); + agent_name, cbt->member_uuid); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); } @@ -1836,24 +1858,25 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames switch_core_new_memory_pool(&pool); h = switch_core_alloc(pool, sizeof(*h)); h->pool = pool; - h->member_uuid = switch_core_strdup(h->pool, cbt->uuid); + h->member_uuid = switch_core_strdup(h->pool, cbt->member_uuid); + h->member_session_uuid = switch_core_strdup(h->pool, cbt->member_session_uuid); h->queue_strategy = switch_core_strdup(h->pool, cbt->strategy); - h->originate_string = switch_core_strdup(h->pool, argv[3]); - h->agent_name = switch_core_strdup(h->pool, argv[1]); + h->originate_string = switch_core_strdup(h->pool, agent_originate_string); + h->agent_name = switch_core_strdup(h->pool, agent_name); h->agent_system = switch_core_strdup(h->pool, "single_box"); - h->agent_status = switch_core_strdup(h->pool, argv[2]); + h->agent_status = switch_core_strdup(h->pool, agent_status); h->agent_type = switch_core_strdup(h->pool, agent_type); h->agent_uuid = switch_core_strdup(h->pool, agent_uuid); - h->member_joined_epoch = switch_core_strdup(h->pool, cbt->joined_epoch); - h->member_caller_name = switch_core_strdup(h->pool, cbt->caller_name); - h->member_caller_number = switch_core_strdup(h->pool, cbt->caller_number); + h->member_joined_epoch = switch_core_strdup(h->pool, cbt->member_joined_epoch); + h->member_caller_name = switch_core_strdup(h->pool, cbt->member_caller_name); + h->member_caller_number = switch_core_strdup(h->pool, cbt->member_caller_number); h->queue_name = switch_core_strdup(h->pool, cbt->queue_name); h->record_template = switch_core_strdup(h->pool, cbt->record_template); - h->no_answer_count = atoi(argv[4]); - h->max_no_answer = atoi(argv[5]); - h->reject_delay_time = atoi(argv[6]); - h->busy_delay_time = atoi(argv[7]); - h->no_answer_delay_time = atoi(argv[8]); + h->no_answer_count = atoi(agent_no_answer_count); + h->max_no_answer = atoi(agent_max_no_answer); + h->reject_delay_time = atoi(agent_reject_delay_time); + h->busy_delay_time = atoi(agent_busy_delay_time); + h->no_answer_delay_time = atoi(agent_no_answer_delay_time); cc_agent_update("state", cc_agent_state2str(CC_AGENT_STATE_RECEIVING), h->agent_name); @@ -1897,9 +1920,22 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName uint32_t discard_abandoned_after; switch_bool_t abandoned_resume_allowed; agent_callback_t cbt; + const char *member_state = NULL; + const char *member_abandoned_epoch = NULL; + memset(&cbt, 0, sizeof(cbt)); - if (!argv[0] || !(queue = get_queue(argv[0]))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found locally, skip this member\n", argv[0]); + cbt.queue_name = argv[0]; + cbt.member_uuid = argv[1]; + cbt.member_session_uuid = argv[2]; + cbt.member_caller_number = argv[3]; + cbt.member_caller_name = argv[4]; + cbt.member_joined_epoch = argv[5]; + cbt.member_score = argv[6]; + member_state = argv[7]; + member_abandoned_epoch = argv[8]; + + if (!cbt.queue_name || !(queue = get_queue(cbt.queue_name))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found locally, skip this member\n", cbt.queue_name); goto end; } else { queue_name = strdup(queue->name); @@ -1917,21 +1953,27 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName queue_rwunlock(queue); } - if (!strcasecmp(argv[6], cc_member_state2str(CC_MEMBER_STATE_ABANDONED))) { - long abandoned_epoch = atol(argv[7]); + /* Checking for cleanup Abandonded calls from the db */ + if (!strcasecmp(member_state, cc_member_state2str(CC_MEMBER_STATE_ABANDONED))) { + long abandoned_epoch = atol(member_abandoned_epoch); if (abandoned_epoch == 0) { - abandoned_epoch = atol(argv[4]); + abandoned_epoch = atol(cbt.member_joined_epoch); } /* Once we pass a certain point, we want to get rid of the abandoned call */ if (abandoned_epoch + discard_abandoned_after < (long) switch_epoch_time_now(NULL)) { - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%ld' OR joined_epoch = '%q')", argv[1], abandoned_epoch, argv[4]); + sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%ld' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); } /* Skip this member */ goto end; } - memset(&cbt, 0, sizeof(cbt)); + + /* Check if member is in the queue waiting */ + if (zstr(cbt.member_session_uuid)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Member %s <%s> in Queue %s have no session uuid, skip this member\n", cbt.member_caller_name, cbt.member_caller_number, cbt.queue_name); + } + cbt.tier = 0; cbt.tier_agent_available = 0; @@ -1940,11 +1982,6 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.tier_rule_wait_multiply_level = tier_rule_wait_multiply_level; cbt.tier_rule_no_agent_no_wait = tier_rule_no_agent_no_wait; - cbt.uuid = argv[1]; - cbt.caller_number = argv[2]; - cbt.caller_name = argv[3]; - cbt.joined_epoch = argv[4]; - cbt.queue_name = argv[0]; cbt.strategy = queue_strategy; cbt.record_template = queue_record_template; cbt.agent_found = SWITCH_FALSE; @@ -1957,7 +1994,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName sql_order_by = switch_mprintf("level, agents.calls_answered, position"); } else if (!strcasecmp(queue_strategy, "ring-all")) { sql = switch_mprintf("UPDATE members SET state = '%q' WHERE state = '%q' AND uuid = '%q' AND system = 'single_box'", - cc_member_state2str(CC_MEMBER_STATE_TRYING), cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt.uuid); + cc_member_state2str(CC_MEMBER_STATE_TRYING), cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt.member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); sql_order_by = switch_mprintf("level, position"); @@ -1982,8 +2019,8 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName switch_safe_free(sql_order_by); /* We update a field in the queue struct so we can kick caller out if waiting for too long with no agent */ - if (!argv[0] || !(queue = get_queue(argv[0]))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found locally, skip this member\n", argv[0]); + if (!cbt.queue_name || !(queue = get_queue(cbt.queue_name))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found locally, skip this member\n", cbt.queue_name); goto end; } else { queue->last_agent_exist_check = switch_epoch_time_now(NULL); @@ -2025,7 +2062,7 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; - sql = switch_mprintf("SELECT queue,uuid,caller_number,caller_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" + sql = switch_mprintf("SELECT queue,uuid,session_uuid,caller_number,caller_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", (long) switch_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); @@ -2073,8 +2110,9 @@ void cc_agent_dispatch_thread_start(void) } struct member_thread_helper { - const char *member_uuid; const char *queue_name; + const char *member_uuid; + const char *member_session_uuid; switch_time_t t_member_called; cc_member_cancel_reason_t member_cancel_reason; @@ -2085,7 +2123,7 @@ struct member_thread_helper { void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj) { struct member_thread_helper *m = (struct member_thread_helper *) obj; - switch_core_session_t *member_session = switch_core_session_locate(m->member_uuid); + switch_core_session_t *member_session = switch_core_session_locate(m->member_session_uuid); switch_channel_t *member_channel = NULL; switch_mutex_lock(globals.mutex); @@ -2150,8 +2188,8 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj } struct moh_dtmf_helper { - const char *queue_name; - char dtmf; + const char *queue_name; + char dtmf; }; static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) { @@ -2188,7 +2226,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_core_session_t *member_session = session; switch_channel_t *member_channel = switch_core_session_get_channel(member_session); char *sql = NULL; - char *member_uuid = switch_core_session_get_uuid(member_session); + char *member_session_uuid = switch_core_session_get_uuid(member_session); struct member_thread_helper *h = NULL; switch_thread_t *thread; switch_threadattr_t *thd_attr = NULL; @@ -2203,6 +2241,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_time_t t_member_called = switch_epoch_time_now(NULL); long abandoned_epoch = 0; const char *agent_uuid = NULL; + switch_uuid_t smember_uuid; + char member_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = ""; if (!zstr(data)) { mydata = switch_core_session_strdup(member_session, data); @@ -2233,13 +2273,29 @@ SWITCH_STANDARD_APP(callcenter_function) char res[256]; /* Check to see if agent already exist */ - sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE queue = '%q' AND caller_number = '%q' AND state = '%q' ORDER BY abandoned_epoch DESC", + sql = switch_mprintf("SELECT uuid FROM members WHERE queue = '%q' AND caller_number = '%q' AND state = '%q' ORDER BY abandoned_epoch DESC", queue_name, switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); - abandoned_epoch = atol(res); + strncpy(member_uuid, res, sizeof(member_uuid)); + + if (!zstr(member_uuid)) { + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q'", member_uuid); + cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); + switch_safe_free(sql); + abandoned_epoch = atol(res); + } } + /* If no existing uuid is restored, let create a new one */ + if (abandoned_epoch == 0) { + switch_uuid_get(&smember_uuid); + switch_uuid_format(member_uuid, &smember_uuid); + } + + switch_channel_set_variable(member_channel, "cc_side", "member"); + switch_channel_set_variable(member_channel, "cc_member_uuid", member_uuid); + /* Add manually imported score */ if (cc_base_score) { cc_base_score_int += atoi(cc_base_score); @@ -2254,7 +2310,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-%s", (abandoned_epoch==0?"start":"resume")); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); @@ -2266,10 +2323,11 @@ SWITCH_STANDARD_APP(callcenter_function) if (abandoned_epoch == 0) { /* Add the caller to the member queue */ sql = switch_mprintf("INSERT INTO members" - " (queue,system,uuid,system_epoch,joined_epoch,base_score,skill_score,caller_number,caller_name,serving_agent,serving_system,state)" - " VALUES('%q','single_box','%q','%q','%ld','%d','%d','%q','%q','%q','','%q')", + " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,caller_number,caller_name,serving_agent,serving_system,state)" + " VALUES('%q','single_box','%q','%q','%q','%ld','%d','%d','%q','%q','%q','','%q')", queue_name, member_uuid, + member_session_uuid, start_epoch, (long) switch_epoch_time_now(NULL), cc_base_score_int, @@ -2283,18 +2341,20 @@ SWITCH_STANDARD_APP(callcenter_function) } else { char res[256]; /* Update abandoned member */ - sql = switch_mprintf("UPDATE members SET uuid = '%q', state = '%q', rejoined_epoch = '%ld' WHERE caller_number = '%q' AND abandoned_epoch = '%ld' AND state = '%q' AND queue = '%q'", - member_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), abandoned_epoch, cc_member_state2str(CC_MEMBER_STATE_ABANDONED), queue_name); + sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%ld' WHERE uuid = '%q' AND state = '%q'", + member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); /* Confirm we took that member in */ - sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND state = '%q' AND queue = '%q'", member_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), queue_name); + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND session_uuid = '%q' AND state = '%q' AND queue = '%q'", member_session, member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), queue_name); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); if (atol(res) == 0) { /* Failed to get the member !!! */ + /* TODO Loop back to just create a uuid and add the member as a new member */ + /* TODO ERROR MSG */ queue_rwunlock(queue); goto end; } @@ -2310,6 +2370,7 @@ SWITCH_STANDARD_APP(callcenter_function) h->pool = pool; h->member_uuid = switch_core_strdup(h->pool, member_uuid); + h->member_session_uuid = switch_core_strdup(h->pool, member_session_uuid); h->queue_name = switch_core_strdup(h->pool, queue_name); h->t_member_called = t_member_called; h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NONE; @@ -2376,7 +2437,7 @@ SWITCH_STANDARD_APP(callcenter_function) /* Canceled for some reason */ if (!switch_channel_up(member_channel) || h->member_cancel_reason != CC_MEMBER_CANCEL_REASON_NONE) { /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2393,7 +2454,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Cancel"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cancel-Reason", cc_member_cancel_reason2str(h->member_cancel_reason)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", member_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); From 40a134bdf5f33d0a2013d158790ee20736d80ca6 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 31 Mar 2011 05:22:50 -0400 Subject: [PATCH 213/558] mod_callcenter: Remove the concept of Caller for Members. Event Socket event have been changed (CC-Caller.* to CC-Member.*) Also CC-Caller-UUID is renamed to CC-Member-Session-UUID. The reason for this is you could actually put people to be call in the queue. So they are not caller per say. But they are a member of a queue. --- .../mod_callcenter/mod_callcenter.c | 86 +++++++++---------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 892f6fe7ac..f8beb7c0f7 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -178,8 +178,8 @@ static char members_sql[] = " system VARCHAR(255),\n" " uuid VARCHAR(255) NOT NULL DEFAULT '',\n" " session_uuid VARCHAR(255) NOT NULL DEFAULT '',\n" -" caller_number VARCHAR(255),\n" -" caller_name VARCHAR(255),\n" +" cid_number VARCHAR(255),\n" +" cid_name VARCHAR(255),\n" " system_epoch INTEGER NOT NULL DEFAULT 0,\n" " joined_epoch INTEGER NOT NULL DEFAULT 0,\n" " rejoined_epoch INTEGER NOT NULL DEFAULT 0,\n" @@ -761,8 +761,8 @@ struct call_helper { const char *queue_name; const char *queue_strategy; const char *member_joined_epoch; - const char *member_caller_name; - const char *member_caller_number; + const char *member_cid_name; + const char *member_cid_number; const char *agent_name; const char *agent_system; const char *agent_status; @@ -1387,9 +1387,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-Type", h->agent_type); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Number", h->member_cid_number); switch_event_fire(&event); } @@ -1407,7 +1407,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa t_agent_called = switch_epoch_time_now(NULL); dialstr = switch_mprintf("%s", h->originate_string); - status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, h->member_caller_name, h->member_caller_number, NULL, ovars, SOF_NONE, NULL); + status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, h->member_cid_name, h->member_cid_number, NULL, ovars, SOF_NONE, NULL); switch_safe_free(dialstr); switch_event_destroy(&ovars); @@ -1518,11 +1518,11 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Number", h->member_cid_number); switch_event_fire(&event); } /* for xml_cdr needs */ @@ -1552,7 +1552,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" <%s> from queue %s%s\n", - h->agent_name, h->member_caller_name, h->member_caller_number, h->queue_name, (h->record_template?" (Recorded)":"")); + h->agent_name, h->member_cid_name, h->member_cid_number, h->queue_name, (h->record_template?" (Recorded)":"")); switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); /* This is used for the waiting caller to quit waiting for a agent */ @@ -1574,12 +1574,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%ld", (long) switch_epoch_time_now(NULL)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Number", h->member_cid_number); switch_event_fire(&event); } /* for xml_cdr needs */ @@ -1609,12 +1609,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Number", h->member_cid_number); switch_event_fire(&event); } @@ -1681,9 +1681,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", h->member_session_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", h->member_caller_name); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", h->member_caller_number); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Number", h->member_cid_number); switch_event_fire(&event); } @@ -1727,8 +1727,8 @@ struct agent_callback { const char *system; const char *member_uuid; const char *member_session_uuid; - const char *member_caller_number; - const char *member_caller_name; + const char *member_cid_number; + const char *member_cid_name; const char *member_joined_epoch; const char *member_score; const char *strategy; @@ -1868,8 +1868,8 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames h->agent_type = switch_core_strdup(h->pool, agent_type); h->agent_uuid = switch_core_strdup(h->pool, agent_uuid); h->member_joined_epoch = switch_core_strdup(h->pool, cbt->member_joined_epoch); - h->member_caller_name = switch_core_strdup(h->pool, cbt->member_caller_name); - h->member_caller_number = switch_core_strdup(h->pool, cbt->member_caller_number); + h->member_cid_name = switch_core_strdup(h->pool, cbt->member_cid_name); + h->member_cid_number = switch_core_strdup(h->pool, cbt->member_cid_number); h->queue_name = switch_core_strdup(h->pool, cbt->queue_name); h->record_template = switch_core_strdup(h->pool, cbt->record_template); h->no_answer_count = atoi(agent_no_answer_count); @@ -1927,8 +1927,8 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.queue_name = argv[0]; cbt.member_uuid = argv[1]; cbt.member_session_uuid = argv[2]; - cbt.member_caller_number = argv[3]; - cbt.member_caller_name = argv[4]; + cbt.member_cid_number = argv[3]; + cbt.member_cid_name = argv[4]; cbt.member_joined_epoch = argv[5]; cbt.member_score = argv[6]; member_state = argv[7]; @@ -1971,7 +1971,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName /* Check if member is in the queue waiting */ if (zstr(cbt.member_session_uuid)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Member %s <%s> in Queue %s have no session uuid, skip this member\n", cbt.member_caller_name, cbt.member_caller_number, cbt.queue_name); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Member %s <%s> in Queue %s have no session uuid, skip this member\n", cbt.member_cid_name, cbt.member_cid_number, cbt.queue_name); } cbt.tier = 0; @@ -2062,7 +2062,7 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; - sql = switch_mprintf("SELECT queue,uuid,session_uuid,caller_number,caller_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" + sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", (long) switch_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); @@ -2273,7 +2273,7 @@ SWITCH_STANDARD_APP(callcenter_function) char res[256]; /* Check to see if agent already exist */ - sql = switch_mprintf("SELECT uuid FROM members WHERE queue = '%q' AND caller_number = '%q' AND state = '%q' ORDER BY abandoned_epoch DESC", + sql = switch_mprintf("SELECT uuid FROM members WHERE queue = '%q' AND cid_number = '%q' AND state = '%q' ORDER BY abandoned_epoch DESC", queue_name, switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); @@ -2311,9 +2311,9 @@ SWITCH_STANDARD_APP(callcenter_function) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-%s", (abandoned_epoch==0?"start":"resume")); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_session_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", member_session_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); } /* for xml_cdr needs */ @@ -2323,7 +2323,7 @@ SWITCH_STANDARD_APP(callcenter_function) if (abandoned_epoch == 0) { /* Add the caller to the member queue */ sql = switch_mprintf("INSERT INTO members" - " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,caller_number,caller_name,serving_agent,serving_system,state)" + " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,cid_number,cid_name,serving_agent,serving_system,state)" " VALUES('%q','single_box','%q','%q','%q','%ld','%d','%d','%q','%q','%q','','%q')", queue_name, member_uuid, @@ -2450,14 +2450,14 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Caller-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Cancel"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cancel-Reason", cc_member_cancel_reason2str(h->member_cancel_reason)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", member_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-UUID", member_session_uuid); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Caller-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", member_session_uuid); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Number", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); switch_event_fire(&event); } From 73a9e05eaaca4e8d4007c6be18810425b8e46bc1 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Thu, 31 Mar 2011 15:29:32 +0200 Subject: [PATCH 214/558] fixed a couple of typos --- libs/freetdm/mod_freetdm/mod_freetdm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 4fd79f8a03..4db6854bb7 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3818,7 +3818,7 @@ SWITCH_STANDARD_API(ft_function) "dial_regex: %s\n" "fail_dial_regex: %s\n" "hold_music: %s\n" - "analog_options %s\n", + "analog_options: %s\n", j, ftdm_span_get_name(SPAN_CONFIG[j].span), SPAN_CONFIG[j].type, @@ -3844,7 +3844,7 @@ SWITCH_STANDARD_API(ft_function) "dial_regex: %s\n" "fail_dial_regex: %s\n" "hold_music: %s\n" - "analog_options %s\n", + "analog_options: %s\n", j, ftdm_span_get_name(SPAN_CONFIG[j].span), SPAN_CONFIG[j].type, @@ -4280,7 +4280,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_freetdm_load) SWITCH_ADD_API(commands_api_interface, "ftdm", "FreeTDM commands", ft_function, FT_SYNTAX); switch_console_set_complete("add ftdm start"); switch_console_set_complete("add ftdm stop"); - switch_console_set_complete("add ftdm retart"); + switch_console_set_complete("add ftdm restart"); switch_console_set_complete("add ftdm dump"); switch_console_set_complete("add ftdm sigstatus get"); switch_console_set_complete("add ftdm sigstatus set"); From 78e16b86e6b3a8f6b398415c7140b524cd3a7263 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 31 Mar 2011 09:38:48 -0500 Subject: [PATCH 215/558] fix regression from Commit:4ae8282e6c6df0e296113e9b4b4a1383e1af8ad7 --- src/mod/applications/mod_dptools/mod_dptools.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 70bc193a7f..7f079239af 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2852,7 +2852,7 @@ static switch_call_cause_t group_outgoing_channel(switch_core_session_t *session if ((domain = strchr(group, '@'))) { *domain++ = '\0'; } else { - domain = switch_core_get_variable_pdup("domain", switch_core_session_get_pool(session)); + domain = switch_core_get_variable_dup("domain"); dup_domain = domain; } From 426a4e76dfa664f0d3644b18d3ef58ab2ea9d7b9 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 31 Mar 2011 11:30:57 -0500 Subject: [PATCH 216/558] FS-2922 --- src/mod/say/mod_say_en/mod_say_en.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index ec577374dc..0128b679ad 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -417,20 +417,17 @@ static switch_status_t en_say_money(switch_say_file_handle_t *sh, char *tosay, s switch_say_file(sh, "currency/dollars"); } - /* Say "and" */ - switch_say_file(sh, "currency/and"); - /* Say cents */ if (cents) { + /* Say "and" */ + switch_say_file(sh, "currency/and"); + en_say_general_count(sh, cents, say_args); if (atoi(cents) == 1) { switch_say_file(sh, "currency/cent"); } else { switch_say_file(sh, "currency/cents"); } - } else { - switch_say_file(sh, "digits/0"); - switch_say_file(sh, "currency/cents"); } return SWITCH_STATUS_SUCCESS; From 88c83420bfc3ca057ed10f86bfefbeb0d4257a5c Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 31 Mar 2011 12:10:02 -0500 Subject: [PATCH 217/558] FS-3210 remove unneeded log message already logged in docall --- src/mod/languages/mod_lua/freeswitch_lua.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index c3a63f5396..7bc3d50b8a 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -142,11 +142,6 @@ void Session::do_hangup_hook() } docall(L, arg_count, 1, 1); - err = lua_tostring(L, -1); - - if (!zstr(err)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err); - } if (channel) { switch_channel_set_private(channel, "CoreSession", NULL); From 8f9e46b58cf613a33c7daae751c9bd676e449a63 Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Mon, 28 Mar 2011 14:27:05 -0400 Subject: [PATCH 218/558] chlog: freetdm: ss7 - updated handling of internal global structure to allow for jumps in IDs fixes Sangoma Ticket #112 --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c | 86 +++++++++++-------- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 50 +++++------ .../ftmod_sangoma_ss7_cntrl.c | 21 +++-- .../ftmod_sangoma_ss7_logger.c | 14 +-- .../ftmod_sangoma_ss7_main.c | 37 ++++---- .../ftmod_sangoma_ss7_support.c | 4 +- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 16 +++- 7 files changed, 128 insertions(+), 100 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c index b7eaa37639..34d79837f0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cfg.c @@ -207,9 +207,10 @@ int ft_to_sngss7_cfg_all(void) /* go through all the relays channels and configure it */ x = 1; - while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) { + while (x < (MAX_RELAY_CHANNELS)) { /* check if this relay channel has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED)) { + if ((g_ftdm_sngss7_data.cfg.relay[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED))) { /* send the specific configuration */ if (ftmod_ss7_relay_chan_config(x)) { @@ -223,13 +224,13 @@ int ft_to_sngss7_cfg_all(void) g_ftdm_sngss7_data.cfg.relay[x].flags |= SNGSS7_CONFIGURED; } /* if !SNGSS7_CONFIGURED */ x++; - } /* while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) */ + } /* while (x < (MAX_RELAY_CHANNELS)) */ x = 1; - while (x < (MAX_MTP_LINKS + 1)) { + while (x < (MAX_MTP_LINKS)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.mtp1Link[x].flags & SNGSS7_CONFIGURED) && - (g_ftdm_sngss7_data.cfg.mtp1Link[x].id != 0)) { + if ((g_ftdm_sngss7_data.cfg.mtp1Link[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.mtp1Link[x].flags & SNGSS7_CONFIGURED))) { /* configure mtp1 */ if (ftmod_ss7_mtp1_psap_config(x)) { @@ -243,13 +244,13 @@ int ft_to_sngss7_cfg_all(void) g_ftdm_sngss7_data.cfg.mtp1Link[x].flags |= SNGSS7_CONFIGURED; } x++; - } /* while (g_ftdm_sngss7_data.cfg.mtp1Link[x].id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ x = 1; - while (x < (MAX_MTP_LINKS + 1)) { + while (x < (MAX_MTP_LINKS)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.mtp2Link[x].flags & SNGSS7_CONFIGURED) && - (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0)) { + if ((g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.mtp2Link[x].flags & SNGSS7_CONFIGURED))) { /* configure mtp2 */ if (ftmod_ss7_mtp2_dlsap_config(x)) { @@ -263,13 +264,13 @@ int ft_to_sngss7_cfg_all(void) g_ftdm_sngss7_data.cfg.mtp2Link[x].flags |= SNGSS7_CONFIGURED; } x++; - } /* while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ x = 1; - while (x < (MAX_MTP_LINKS + 1)) { + while (x < (MAX_MTP_LINKS)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.mtp3Link[x].flags & SNGSS7_CONFIGURED) && - (g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0)) { + if ((g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.mtp3Link[x].flags & SNGSS7_CONFIGURED))) { /* configure mtp3 */ if (ftmod_ss7_mtp3_dlsap_config(x)) { @@ -284,12 +285,13 @@ int ft_to_sngss7_cfg_all(void) } x++; - } /* while (g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ x = 1; - while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) { + while (x < (MAX_NSAPS)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_CONFIGURED)) { + if ((g_ftdm_sngss7_data.cfg.nsap[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_CONFIGURED))) { ret = ftmod_ss7_mtp3_nsap_config(x); if (ret) { @@ -312,12 +314,13 @@ int ft_to_sngss7_cfg_all(void) } /* if !SNGSS7_CONFIGURED */ x++; - } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */ + } /* while (x < (MAX_NSAPS)) */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + while (x < (MAX_MTP_LINKSETS+1)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_CONFIGURED)) { + if ((g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_CONFIGURED))) { if (ftmod_ss7_mtp3_linkset_config(x)) { SS7_CRITICAL("MTP3 LINKSET %d configuration FAILED!\n", x); @@ -331,12 +334,13 @@ int ft_to_sngss7_cfg_all(void) } /* if !SNGSS7_CONFIGURED */ x++; - } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */ + } /* while (x < (MAX_MTP_LINKSETS+1)) */ x = 1; - while ((g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0)) { + while (x < (MAX_MTP_ROUTES+1)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.mtpRoute[x].flags & SNGSS7_CONFIGURED)) { + if ((g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.mtpRoute[x].flags & SNGSS7_CONFIGURED))) { if (ftmod_ss7_mtp3_route_config(x)) { SS7_CRITICAL("MTP3 ROUTE %d configuration FAILED!\n", x); @@ -350,12 +354,13 @@ int ft_to_sngss7_cfg_all(void) } /* if !SNGSS7_CONFIGURED */ x++; - } /* while (g_ftdm_sngss7_data.cfg.mtpRoute[x].id != 0) */ + } /* while (x < (MAX_MTP_ROUTES+1)) */ x = 1; - while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) { + while (x < (MAX_ISAPS)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_CONFIGURED)) { + if ((g_ftdm_sngss7_data.cfg.isap[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_CONFIGURED))) { if (ftmod_ss7_isup_isap_config(x)) { SS7_CRITICAL("ISUP ISAP %d configuration FAILED!\n", x); @@ -369,13 +374,14 @@ int ft_to_sngss7_cfg_all(void) } /* if !SNGSS7_CONFIGURED */ x++; - } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */ + } /* while (x < (MAX_ISAPS)) */ if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) { x = 1; - while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) { + while (x < (MAX_ISUP_INFS)) { /* check if this link has been configured already */ - if (!(g_ftdm_sngss7_data.cfg.isupIntf[x].flags & SNGSS7_CONFIGURED)) { + if ((g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.isupIntf[x].flags & SNGSS7_CONFIGURED))) { if (ftmod_ss7_isup_intf_config(x)) { SS7_CRITICAL("ISUP INTF %d configuration FAILED!\n", x); @@ -391,21 +397,25 @@ int ft_to_sngss7_cfg_all(void) } /* if !SNGSS7_CONFIGURED */ x++; - } /* while (g_ftdm_sngss7_data.cfg.isupIntf[x].id != 0) */ + } /* while (x < (MAX_ISUP_INFS)) */ } /* if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_ISUP)) */ x = (g_ftdm_sngss7_data.cfg.procId * 1000) + 1; while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) { + /* check if this link has been configured already */ + if ((g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.isupCkt[x].flags & SNGSS7_CONFIGURED))) { - if (ftmod_ss7_isup_ckt_config(x)) { - SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x); - return 1; - } else { - SS7_INFO("ISUP CKT %d configuration DONE!\n", x); - } + if (ftmod_ss7_isup_ckt_config(x)) { + SS7_CRITICAL("ISUP CKT %d configuration FAILED!\n", x); + return 1; + } else { + SS7_INFO("ISUP CKT %d configuration DONE!\n", x); + } - /* set the SNGSS7_CONFIGURED flag */ - g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED; + /* set the SNGSS7_CONFIGURED flag */ + g_ftdm_sngss7_data.cfg.isupCkt[x].flags |= SNGSS7_CONFIGURED; + } /* if !SNGSS7_CONFIGURED */ x++; } /* while (g_ftdm_sngss7_data.cfg.isupCkt[x].id != 0) */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 2cd3a13e30..887c742282 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -1366,7 +1366,7 @@ static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char * /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the status request */ @@ -1392,7 +1392,7 @@ static ftdm_status_t handle_status_mtp3link(ftdm_stream_handle_t *stream, char * /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Failed to find link=\"%s\"\n", name); @@ -1408,7 +1408,7 @@ static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char * /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp2Link[x].name, name)) { /* send the status request */ @@ -1436,7 +1436,7 @@ static ftdm_status_t handle_status_mtp2link(ftdm_stream_handle_t *stream, char * /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Failed to find link=\"%s\"\n", name); @@ -1452,7 +1452,7 @@ static ftdm_status_t handle_status_linkset(ftdm_stream_handle_t *stream, char *n /* find the linkset request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + while(x < (MAX_MTP_LINKSETS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { /* send the status request */ @@ -1487,7 +1487,7 @@ static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the inhibit request */ @@ -1504,7 +1504,7 @@ static ftdm_status_t handle_set_inhibit(ftdm_stream_handle_t *stream, char *name /* move to the next linkset */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Failed to find link=\"%s\"\n", name); @@ -1519,7 +1519,7 @@ static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *na /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the uninhibit request */ @@ -1536,7 +1536,7 @@ static ftdm_status_t handle_set_uninhibit(ftdm_stream_handle_t *stream, char *na /* move to the next linkset */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Failed to find link=\"%s\"\n", name); @@ -1891,7 +1891,7 @@ static ftdm_status_t handle_bind_link(ftdm_stream_handle_t *stream, char *name) /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the uninhibit request */ @@ -1907,7 +1907,7 @@ static ftdm_status_t handle_bind_link(ftdm_stream_handle_t *stream, char *name) /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Could not find link=%s\n", name); @@ -1922,7 +1922,7 @@ static ftdm_status_t handle_unbind_link(ftdm_stream_handle_t *stream, char *name /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the uninhibit request */ @@ -1938,7 +1938,7 @@ static ftdm_status_t handle_unbind_link(ftdm_stream_handle_t *stream, char *name /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Could not find link=%s\n", name); @@ -1953,7 +1953,7 @@ static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *na /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the uninhibit request */ @@ -1969,7 +1969,7 @@ static ftdm_status_t handle_activate_link(ftdm_stream_handle_t *stream, char *na /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Could not find link=%s\n", name); @@ -1984,7 +1984,7 @@ static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char * /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the deactivate request */ @@ -2000,7 +2000,7 @@ static ftdm_status_t handle_deactivate_link(ftdm_stream_handle_t *stream, char * /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Could not find link=%s\n", name); @@ -2015,7 +2015,7 @@ static ftdm_status_t handle_activate_linkset(ftdm_stream_handle_t *stream, char /* find the linkset request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + while(x < (MAX_MTP_LINKSETS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { /* send the activate request */ @@ -2046,7 +2046,7 @@ static ftdm_status_t handle_deactivate_linkset(ftdm_stream_handle_t *stream, cha /* find the linkset request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + while(x < (MAX_MTP_LINKSETS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name, name)) { /* send the deactivate request */ @@ -2078,7 +2078,7 @@ static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name) /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the uninhibit request */ @@ -2094,7 +2094,7 @@ static ftdm_status_t handle_tx_lpo(ftdm_stream_handle_t *stream, char *name) /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Could not find link=%s\n", name); @@ -2109,7 +2109,7 @@ static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name) /* find the link request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while(x < (MAX_MTP_LINKS+1)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.mtp3Link[x].name, name)) { /* send the uninhibit request */ @@ -2125,7 +2125,7 @@ static ftdm_status_t handle_tx_lpr(ftdm_stream_handle_t *stream, char *name) /* move to the next link */ x++; - } /* while (id != 0) */ + } /* while (x < (MAX_MTP_LINKS+1)) */ stream->write_function(stream, "Could not find link=%s\n", name); @@ -2144,7 +2144,7 @@ static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *nam /* find the channel request by it's name */ x = 1; - while(g_ftdm_sngss7_data.cfg.relay[x].id != 0) { + while(x < (MAX_RELAY_CHANNELS)) { if (!strcasecmp(g_ftdm_sngss7_data.cfg.relay[x].name, name)) { if (ftmod_ss7_relay_status(g_ftdm_sngss7_data.cfg.relay[x].id, &sta)) { @@ -2168,7 +2168,7 @@ static ftdm_status_t handle_status_relay(ftdm_stream_handle_t *stream, char *nam /* move to the next link */ x++; - } /* g_ftdm_sngss7_data.cfg.relay[x].id */ + } /* x < (MAX_RELAY_CHANNELS) */ success: return FTDM_SUCCESS; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c index 8a7b095675..b0a2163fdd 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cntrl.c @@ -85,9 +85,10 @@ int ft_to_sngss7_activate_all(void) int x; x = 1; - while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) { + while (x < (MAX_ISAPS)) { /* check if this link has already been actived */ - if (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_ACTIVE)) { + if ((g_ftdm_sngss7_data.cfg.isap[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.isap[x].flags & SNGSS7_ACTIVE))) { if (ftmod_ss7_enable_isap(x)) { SS7_CRITICAL("ISAP %d Enable: NOT OK\n", x); @@ -101,12 +102,13 @@ int ft_to_sngss7_activate_all(void) } /* if !SNGSS7_ACTIVE */ x++; - } /* while (g_ftdm_sngss7_data.cfg.isap[x].id != 0) */ + } /* while (x < (MAX_ISAPS)) */ x = 1; - while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) { + while (x < (MAX_NSAPS)) { /* check if this link has already been actived */ - if (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_ACTIVE)) { + if ((g_ftdm_sngss7_data.cfg.nsap[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.nsap[x].flags & SNGSS7_ACTIVE))) { if (ftmod_ss7_enable_nsap(x)) { SS7_CRITICAL("NSAP %d Enable: NOT OK\n", x); @@ -120,13 +122,14 @@ int ft_to_sngss7_activate_all(void) } /* if !SNGSS7_ACTIVE */ x++; - } /* while (g_ftdm_sngss7_data.cfg.nsap[x].id != 0) */ + } /* while (x < (MAX_NSAPS)) */ if (g_ftdm_sngss7_data.cfg.mtpRoute[1].id != 0) { x = 1; - while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) { + while (x < (MAX_MTP_LINKSETS+1)) { /* check if this link has already been actived */ - if (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_ACTIVE)) { + if ((g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) && + (!(g_ftdm_sngss7_data.cfg.mtpLinkSet[x].flags & SNGSS7_ACTIVE))) { if (ftmod_ss7_enable_mtpLinkSet(x)) { SS7_CRITICAL("LinkSet \"%s\" Enable: NOT OK\n", g_ftdm_sngss7_data.cfg.mtpLinkSet[x].name); @@ -140,7 +143,7 @@ int ft_to_sngss7_activate_all(void) } /* if !SNGSS7_ACTIVE */ x++; - } /* while (g_ftdm_sngss7_data.cfg.mtpLinkSet[x].id != 0) */ + } /* while (x < (MAX_MTP_LINKSETS+1)) */ } return 0; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c index 2a395c9ad1..2e6fc7e8a0 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -134,7 +134,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) /* find the name for the sap in question */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) { + while (x < (MAX_MTP_LINKS+1)) { if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { break; } @@ -175,7 +175,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) /* find the name for the sap in question */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) { + while (x < (MAX_MTP_LINKS+1)) { if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { break; } @@ -198,7 +198,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) /* find the name for the sap in question */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) { + while (x < (MAX_MTP_LINKS+1)) { if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { break; } @@ -222,7 +222,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) /* find the name for the sap in question */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) { + while (x < (MAX_MTP_LINKS+1)) { if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { break; } @@ -248,7 +248,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) /* find the name for the sap in question */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) { + while (x < (MAX_MTP_LINKS+1)) { if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { break; } @@ -271,7 +271,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) /* find the name for the sap in question */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtp2Link[x].id != 0) { + while (x < (MAX_MTP_LINKS+1)) { if (g_ftdm_sngss7_data.cfg.mtp2Link[x].id == sta->t.usta.evntParm[0]) { break; } @@ -366,7 +366,7 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) /* find the name for the sap in question */ x = 1; - while (g_ftdm_sngss7_data.cfg.mtp3Link[x].id != 0) { + while (x < (MAX_MTP_LINKS+1)) { if (g_ftdm_sngss7_data.cfg.mtp3Link[x].id == sta->hdr.elmId.elmntInst1) { break; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 70a99ef901..374c8473d2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1062,18 +1062,22 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } } /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */ - if ((sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) && - (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) { + if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { SS7_DEBUG_CHAN(ftdmchan, "Processing PAUSE%s\n", ""); - /* bring the sig status down */ - sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { + /* bring the sig status down */ + sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; + sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; + ftdm_span_send_signal(ftdmchan->span, &sigev); + } } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */ /**********************************************************************/ - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX) && + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX))&& !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); /* bring the sig status down */ @@ -1089,8 +1093,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) goto suspend_goto_last; } - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX) && - !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX_DN)){ + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_RX)){ SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_RX flag %s\n", ""); /* clear the block flags */ @@ -1113,6 +1116,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /**********************************************************************/ if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX) && !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_TX_DN)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_TX flag %s\n", ""); /* bring the sig status down */ @@ -1128,8 +1132,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) goto suspend_goto_last; } - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX) && - !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX_DN)){ + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_UNBLK_TX)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_UNBLK_TX flag %s\n", ""); /* clear the block flags */ @@ -1152,6 +1156,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /**********************************************************************/ if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX) && !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_BLOCK_RX_DN)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_BLOCK_RX flag %s\n", ""); /* send a BLA */ @@ -1164,8 +1169,8 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) goto suspend_goto_last; } - if (sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX) && - !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_LC_UNBLK_RX_DN)) { + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_LC_UNBLK_RX)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_LC_UNBLK_RX flag %s\n", ""); /* clear the block flags */ @@ -1185,6 +1190,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /**********************************************************************/ if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK) && !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_BLOCK_DN)) { + SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_BLOCK flag %s\n", ""); /* bring the channel signaling status to down */ @@ -1205,8 +1211,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) goto suspend_goto_last; } - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK) && - !sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK_DN)) { + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_UCIC_UNBLK)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_UCIC_UNBLK flag %s\n", ""); /* remove the UCIC block flag */ @@ -1223,7 +1228,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) goto suspend_goto_restart; } - SS7_ERROR_CHAN(ftdmchan,"No block flag processed!%s\n", ""); + SS7_DEBUG_CHAN(ftdmchan,"No block flag processed!%s\n", ""); suspend_goto_last: state_flag = 0; @@ -1645,7 +1650,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) if (sngss7_test_flag(&g_ftdm_sngss7_data.cfg, SNGSS7_RY)) { /* go through all the relays channels and configure it */ x = 1; - while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) { + while (x < (MAX_RELAY_CHANNELS)) { /* check if this relay channel has been configured already */ if ((g_ftdm_sngss7_data.cfg.relay[x].flags & SNGSS7_CONFIGURED)) { @@ -1661,7 +1666,7 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_ss7_unload) g_ftdm_sngss7_data.cfg.relay[x].flags &= !SNGSS7_CONFIGURED; } /* if !SNGSS7_CONFIGURED */ x++; - } /* while (g_ftdm_sngss7_data.cfg.relay[x].id != 0) */ + } /* while (x < (MAX_RELAY_CHANNELS)) */ ftmod_ss7_shutdown_relay(); sng_isup_free_relay(); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 2b915b1053..4513deebea 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -1319,7 +1319,7 @@ ftdm_status_t check_status_of_all_isup_intf(void) /* go through all the isupIntfs and ask the stack to give their current state */ x = 1; - for (x = 1; x < (MAX_ISUP_INFS + 1); x++) { + for (x = 1; x < (MAX_ISUP_INFS); x++) { /**************************************************************************/ if (g_ftdm_sngss7_data.cfg.isupIntf[x].id == 0) continue; @@ -1376,7 +1376,7 @@ ftdm_status_t check_status_of_all_isup_intf(void) } /* switch (status) */ /**************************************************************************/ - } /* for (x = 1; x < MAX_ISUP_INFS + 1); i++) */ + } /* for (x = 1; x < MAX_ISUP_INFS); i++) */ return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 49da10cdf1..dd4bb60dd1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -1215,7 +1215,7 @@ static int ftmod_ss7_parse_mtp_linkset(ftdm_conf_node_t *mtp_linkset) /* go through all the mtp3 links and fill in the apc */ i = 1; - while (g_ftdm_sngss7_data.cfg.mtp3Link[i].id != 0) { + while (i < (MAX_MTP_LINKS)) { if (g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId == mtpLinkSet.id) { g_ftdm_sngss7_data.cfg.mtp3Link[i].apc = mtpLinkSet.apc; } @@ -1757,7 +1757,7 @@ static int ftmod_ss7_parse_isup_interface(ftdm_conf_node_t *isup_interface) /**************************************************************************/ /* go through all the links and check if they belong to this linkset*/ i = 1; - while (g_ftdm_sngss7_data.cfg.mtp3Link[i].id != 0) { + while (i < (MAX_MTP_LINKS)) { /* check if this link is in the linkset */ if (g_ftdm_sngss7_data.cfg.mtp3Link[i].linkSetId == lnkSet->lsId) { /* fill in the spc */ @@ -2461,7 +2461,7 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i { int i = 1; - while (g_ftdm_sngss7_data.cfg.mtpRoute[i].id != 0) { + while (i < (MAX_MTP_ROUTES)) { if (g_ftdm_sngss7_data.cfg.mtpRoute[i].dpc == spc) { /* we have a match so break out of this loop */ break; @@ -2471,6 +2471,16 @@ static int ftmod_ss7_fill_in_self_route(int spc, int linkType, int switchType, i } if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) { + /* this is a new route...find the first free spot */ + i = 1; + while (i < (MAX_MTP_ROUTES)) { + if (g_ftdm_sngss7_data.cfg.mtpRoute[i].id == 0) { + /* we have a match so break out of this loop */ + break; + } + /* move on to the next one */ + i++; + } g_ftdm_sngss7_data.cfg.mtpRoute[i].id = i; SS7_DEBUG("found new mtp3 self route\n"); } else { From 022815adc2e1402750bff4eb13a16226783cba17 Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Tue, 29 Mar 2011 09:47:39 -0400 Subject: [PATCH 219/558] freetdm: ss7 - fix for outgoing IAM failing when using ANSI --- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index dd4bb60dd1..bf347f0019 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -1891,28 +1891,6 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) SS7_DEBUG("Found an ccSpan typeCntrl = %s\n", sng_cic_cntrl_type_map[ret].sng_type); } /**********************************************************************/ - } else if (!strcasecmp(parm->var, "ssf")) { - /**********************************************************************/ - ret = find_ssf_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid ccSpan ssf = %s\n", parm->var); - return FTDM_FAIL; - } else { - sng_ccSpan.ssf = sng_ssf_type_map[ret].tril_type; - SS7_DEBUG("Found an ccSpan ssf = %s\n", sng_ssf_type_map[ret].sng_type); - } - /**********************************************************************/ - } else if (!strcasecmp(parm->var, "switchType")) { - /**********************************************************************/ - ret = find_switch_type_in_map(parm->val); - if (ret == -1) { - SS7_ERROR("Found an invalid ccSpan switchType = %s\n", parm->var); - return FTDM_FAIL; - } else { - sng_ccSpan.switchType = sng_switch_type_map[ret].tril_isup_type; - SS7_DEBUG("Found an ccSpan switchType = %s\n", sng_switch_type_map[ret].sng_type); - } - /**********************************************************************/ } else if (!strcasecmp(parm->var, "cicbase")) { /**********************************************************************/ sng_ccSpan.cicbase = atoi(parm->val); @@ -2034,6 +2012,10 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) sng_ccSpan.clg_nadi = 0x03; } + /* pull up the SSF and Switchtype from the isup interface */ + sng_ccSpan.ssf = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].ssf; + sng_ccSpan.switchType = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].switchType; + /* add this span to our global listing */ ftmod_ss7_fill_in_ccSpan(&sng_ccSpan); From 0b72c4884f661c4d94d6a0d61fd9795dd029b3e7 Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Thu, 31 Mar 2011 13:24:30 -0400 Subject: [PATCH 220/558] freetdm: ss7 - bug fixes for handling the blocking flags. These bugs were caused when the block flags got their own functions and bit flag --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 4 ++-- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 887c742282..4aa2483d22 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -1207,8 +1207,8 @@ static ftdm_status_t handle_show_status(ftdm_stream_handle_t *stream, int span, stream->write_function(stream, "r_hw=N|"); } - if (sngss7_test_ckt_flag(ss7_info, FLAG_RELAY_DOWN)) { - stream->write_function(stream, "relay=Y"); + if (sngss7_test_ckt_blk_flag(ss7_info, FLAG_RELAY_DOWN)) { + stream->write_function(stream, "relay=Y|"); }else { stream->write_function(stream, "relay=N"); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 3981cd6597..40a712f8e2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -1565,6 +1565,9 @@ ftdm_status_t handle_ubl_req(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* throw the unblock flag */ sngss7_set_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_UNBLK_RX); + /* clear the block flag */ + sngss7_clear_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX); + /* set the channel to suspended state */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED); From fe420783899442a7f41594204da2133e6dc42ac4 Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Thu, 31 Mar 2011 13:28:25 -0400 Subject: [PATCH 221/558] freetdm: ss7 - bug fix for bug introduced by adding support for RING state --- .../freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 1 + .../freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h | 1 + 2 files changed, 2 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 374c8473d2..c2b32b6092 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -890,6 +890,7 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) /* clear any call related flags */ sngss7_clear_ckt_flag (sngss7_info, FLAG_REMOTE_REL); sngss7_clear_ckt_flag (sngss7_info, FLAG_LOCAL_REL); + sngss7_clear_ckt_flag (sngss7_info, FLAG_SENT_ACM); if (ftdm_test_flag (ftdmchan, FTDM_CHANNEL_OPEN)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index c9ec787fae..e7372ecd28 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -525,6 +525,7 @@ typedef enum { "GLARE", \ "INF_RESUME", \ "INF_PAUSED", \ + "TX_ACM_SENT" \ "RELAY_DOWN", \ "CKT_RECONFIG" FTDM_STR2ENUM_P(ftmod_ss7_ckt_state2flag, ftmod_ss7_ckt_flag2str, sng_ckt_flag_t) From 90ca2de3cfee386a632d8de605a1aae19ac8db2f Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Thu, 31 Mar 2011 14:30:38 -0400 Subject: [PATCH 222/558] freetdm: ss7 - bug fix for bugs added by recent cherry-picks --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index c2b32b6092..d61d822ba2 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1069,14 +1069,12 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { /* bring the sig status down */ - sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED; - sigev.ev_data.sigstatus.status = FTDM_SIG_STATE_DOWN; - ftdm_span_send_signal(ftdmchan->span, &sigev); + sngss7_set_sig_status(sngss7_info, FTDM_SIG_STATE_DOWN); } } /* if (sngss7_test_ckt_flag(sngss7_info, FLAG_INFID_PAUSED)) { */ /**********************************************************************/ - if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX))&& + if (sngss7_test_ckt_blk_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX) && !sngss7_test_ckt_blk_flag(sngss7_info, FLAG_CKT_MN_BLOCK_RX_DN)) { SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", ""); From 4714ed438006290648733656f675175c349ac1fa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 13:43:36 -0500 Subject: [PATCH 223/558] revert 471bd6df1ae73ca410f0b4051ee050e21401b17b and implement reference counting on the xml roots to achieve the same end result --- src/include/switch_xml.h | 1 + src/mod/applications/mod_enum/mod_enum.c | 3 +- src/switch_xml.c | 115 ++++++++++------------- 3 files changed, 51 insertions(+), 68 deletions(-) diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index bd9e6a06da..f1164cee2e 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -98,6 +98,7 @@ struct switch_xml { uint32_t flags; /*! is_switch_xml_root bool */ switch_bool_t is_switch_xml_root_t; + uint32_t refs; }; /*! diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index b8b380a66e..d1bb286857 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -795,8 +795,9 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_enum_shutdown) } switch_safe_free(globals.root); + switch_safe_free(globals.server); switch_safe_free(globals.isn_root); - + return SWITCH_STATUS_UNLOAD; } diff --git a/src/switch_xml.c b/src/switch_xml.c index 124dab9ab0..c4b643f511 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -118,11 +118,6 @@ struct switch_xml_root { /* additional data for the root tag */ char ***pi; /* processing instructions */ short standalone; /* non-zero if */ char err[SWITCH_XML_ERRL]; /* error string */ - /*! is_main_xml_root */ - switch_bool_t is_main_xml_root; - /*! rwlock */ - switch_thread_rwlock_t *rwlock; - }; char *SWITCH_XML_NIL[] = { NULL }; /* empty, null terminated array of strings */ @@ -138,11 +133,12 @@ struct switch_xml_binding { static switch_xml_binding_t *BINDINGS = NULL; static switch_xml_t MAIN_XML_ROOT = NULL; static switch_memory_pool_t *XML_MEMORY_POOL = NULL; + static switch_thread_rwlock_t *B_RWLOCK = NULL; -static switch_thread_rwlock_t *XML_RWLOCK = NULL; +static switch_mutex_t *XML_LOCK = NULL; +static switch_mutex_t *REFLOCK = NULL; static switch_mutex_t *XML_GEN_LOCK = NULL; -static switch_mutex_t *XML_FREE_LOCK = NULL; -static switch_mutex_t *XML_RWFILE_LOCK = NULL; + struct xml_section_t { const char *name; @@ -1530,11 +1526,9 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file) } else { abs = file; } - /* Protection against running this code twice on the same filename */ - switch_mutex_lock(XML_RWFILE_LOCK); if (!(new_file = switch_mprintf("%s%s%s.fsxml", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, abs))) { - goto done; + return NULL; } if ((write_fd = open(new_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) < 0) { @@ -1561,7 +1555,6 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file) if (fd > -1) { close(fd); } - switch_mutex_unlock(XML_RWFILE_LOCK); switch_safe_free(new_file); return xml; } @@ -1924,16 +1917,14 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key, SWITCH_DECLARE(switch_xml_t) switch_xml_root(void) { - switch_xml_root_t root = NULL; + switch_xml_t xml; - switch_thread_rwlock_rdlock(XML_RWLOCK); - if (MAIN_XML_ROOT) { - root = (switch_xml_root_t) MAIN_XML_ROOT; - switch_thread_rwlock_rdlock(root->rwlock); - } - switch_thread_rwlock_unlock(XML_RWLOCK); - - return (switch_xml_t) root; + switch_mutex_lock(REFLOCK); + xml = MAIN_XML_ROOT; + xml->refs++; + switch_mutex_unlock(REFLOCK); + + return xml; } struct destroy_xml { @@ -1977,14 +1968,15 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e { char path_buf[1024]; uint8_t errcnt = 0; - switch_xml_t r = NULL, new_main; + switch_xml_t new_main, r = NULL; - if (!reload) { - r = switch_xml_root(); - } + switch_mutex_lock(XML_LOCK); - if (r) { - goto done; + if (MAIN_XML_ROOT) { + if (!reload) { + r = switch_xml_root(); + goto done; + } } switch_snprintf(path_buf, sizeof(path_buf), "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "freeswitch.xml"); @@ -1997,28 +1989,28 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e new_main = NULL; errcnt++; } else { - switch_xml_t old_root = NULL; - switch_xml_root_t new_main_root = (switch_xml_root_t) new_main; - - new_main_root->is_main_xml_root = SWITCH_TRUE; - + switch_xml_t old_root; *err = "Success"; - old_root = switch_xml_root(); + switch_mutex_lock(REFLOCK); - switch_set_flag(new_main, SWITCH_XML_ROOT); - - switch_thread_rwlock_wrlock(XML_RWLOCK); + old_root = MAIN_XML_ROOT; MAIN_XML_ROOT = new_main; - switch_thread_rwlock_unlock(XML_RWLOCK); + switch_set_flag(MAIN_XML_ROOT, SWITCH_XML_ROOT); + MAIN_XML_ROOT->refs++; + + if (old_root) { + if (old_root->refs) { + old_root->refs--; + } - if (old_root) { - switch_clear_flag(old_root, SWITCH_XML_ROOT); + if (!old_root->refs) { + switch_xml_free(old_root); + } } - switch_xml_free(old_root); + switch_mutex_unlock(REFLOCK); - /* switch_xml_free_in_thread(old_root); */ } } else { *err = "Cannot Open log directory or XML Root!"; @@ -2037,6 +2029,8 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(uint8_t reload, const char **e done: + switch_mutex_unlock(XML_LOCK); + return r; } @@ -2058,11 +2052,11 @@ SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, cons XML_MEMORY_POOL = pool; *err = "Success"; + switch_mutex_init(&XML_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); + switch_mutex_init(&REFLOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); switch_mutex_init(&XML_GEN_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); - switch_mutex_init(&XML_FREE_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); - switch_mutex_init(&XML_RWFILE_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); + switch_thread_rwlock_create(&B_RWLOCK, XML_MEMORY_POOL); - switch_thread_rwlock_create(&XML_RWLOCK, XML_MEMORY_POOL); assert(pool != NULL); @@ -2077,7 +2071,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, cons SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void) { switch_status_t status = SWITCH_STATUS_FALSE; - switch_thread_rwlock_wrlock(XML_RWLOCK); + switch_mutex_lock(XML_LOCK); if (MAIN_XML_ROOT) { switch_xml_t xml = MAIN_XML_ROOT; @@ -2086,7 +2080,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void) status = SWITCH_STATUS_SUCCESS; } - switch_thread_rwlock_unlock(XML_RWLOCK); + switch_mutex_unlock(XML_LOCK); return status; } @@ -2372,35 +2366,25 @@ SWITCH_DECLARE(void) switch_xml_free(switch_xml_t xml) int i, j; char **a, *s; switch_xml_t orig_xml; + int refs = 0; + tailrecurse: root = (switch_xml_root_t) xml; if (!xml) { return; } - /* If xml is currenly the MAIN_XML_ROOT, dont even bother to check to empty it */ if (switch_test_flag(xml, SWITCH_XML_ROOT)) { - switch_thread_rwlock_unlock(root->rwlock); - return; - } + switch_mutex_lock(REFLOCK); - /* This is a trick to find if the struct is still in use or not */ - switch_mutex_lock(XML_FREE_LOCK); - if (xml->is_switch_xml_root_t == SWITCH_TRUE && root->is_main_xml_root == SWITCH_TRUE) { - switch_thread_rwlock_unlock(root->rwlock); - if (switch_thread_rwlock_trywrlock(root->rwlock) != SWITCH_STATUS_SUCCESS) { - /* XML Struct is still in used, person who free it will clean it */ - switch_mutex_unlock(XML_FREE_LOCK); - return; + if (xml->refs) { + xml->refs--; + refs = xml->refs; } - switch_thread_rwlock_unlock(root->rwlock); - switch_thread_rwlock_destroy(root->rwlock); + switch_mutex_unlock(REFLOCK); } - switch_mutex_unlock(XML_FREE_LOCK); - tailrecurse: - root = (switch_xml_root_t) xml; - if (!xml) { + if (refs) { return; } @@ -2449,7 +2433,6 @@ SWITCH_DECLARE(void) switch_xml_free(switch_xml_t xml) } switch_xml_free_attr(xml->attr); /* tag attributes */ - if ((xml->flags & SWITCH_XML_TXTM)) free(xml->txt); /* character content */ if ((xml->flags & SWITCH_XML_NAMEM)) @@ -2487,8 +2470,6 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_new(const char *name) root->ent = (char **) memcpy(malloc(sizeof(ent)), ent, sizeof(ent)); root->attr = root->pi = (char ***) (root->xml.attr = SWITCH_XML_NIL); root->xml.is_switch_xml_root_t = SWITCH_TRUE; - root->is_main_xml_root = SWITCH_FALSE; - switch_thread_rwlock_create(&root->rwlock, XML_MEMORY_POOL); return &root->xml; } From e52e44e39ceb37a70c9550adf1f0c4130a299f2f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 13:44:15 -0500 Subject: [PATCH 224/558] change mod_dptools to use the better method of fetching user xml that does not hang onto the xml root --- .../applications/mod_dptools/mod_dptools.c | 53 ++----------------- 1 file changed, 5 insertions(+), 48 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 7f079239af..038304b672 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2953,7 +2953,7 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) { - switch_xml_t x_domain = NULL, xml = NULL, x_user = NULL, x_group = NULL, x_param, x_params; + switch_xml_t xml = NULL, x_user = NULL, x_param, x_params; char *user = NULL, *domain = NULL, *dup_domain = NULL; const char *dest = NULL; switch_call_cause_t cause = SWITCH_CAUSE_NONE; @@ -3000,48 +3000,12 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, var_event = NULL; } - if (switch_xml_locate_user("id", user, domain, NULL, &xml, &x_domain, &x_user, &x_group, params) != SWITCH_STATUS_SUCCESS) { + if (switch_xml_locate_user_merged("id", user, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", user, domain); cause = SWITCH_CAUSE_SUBSCRIBER_ABSENT; goto done; } - if ((x_params = switch_xml_child(x_domain, "params"))) { - for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - - if (!strcasecmp(pvar, "dial-string")) { - dest = val; - } else if (!strncasecmp(pvar, "dial-var-", 9)) { - if (!var_event) { - switch_event_create(&var_event, SWITCH_EVENT_GENERAL); - } else { - switch_event_del_header(var_event, pvar + 9); - } - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val); - } - } - } - - if ((x_params = switch_xml_child(x_group, "params"))) { - for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - - if (!strcasecmp(pvar, "dial-string")) { - dest = val; - } else if (!strncasecmp(pvar, "dial-var-", 9)) { - if (!var_event) { - switch_event_create(&var_event, SWITCH_EVENT_GENERAL); - } else { - switch_event_del_header(var_event, pvar + 9); - } - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val); - } - } - } - if ((x_params = switch_xml_child(x_user, "params"))) { for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { const char *pvar = switch_xml_attr(x_param, "name"); @@ -3059,8 +3023,9 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, } } } - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_user", user); - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_domain", domain); + + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_user", user); + switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "dialed_domain", domain); if (!dest) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n"); @@ -3153,14 +3118,6 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session, } if (new_channel && xml) { - if ((x_params = switch_xml_child(x_domain, "variables"))) { - for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { - const char *pvar = switch_xml_attr(x_param, "name"); - const char *val = switch_xml_attr(x_param, "value"); - switch_channel_set_variable(new_channel, pvar, val); - } - } - if ((x_params = switch_xml_child(x_user, "variables"))) { for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) { const char *pvar = switch_xml_attr(x_param, "name"); From 913ec9861e07e3f432444f0ffdc57ac03148a3a3 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 15:01:58 -0500 Subject: [PATCH 225/558] FS-3176 forget the last patch I forgot there is no way to know the right codec using it the file string way, you will just have to manually specify en.PCMA as before but now it should work --- .../applications/mod_dptools/mod_dptools.c | 13 ++- src/switch_ivr_play_say.c | 110 ++++++++++-------- src/switch_loadable_module.c | 13 +-- 3 files changed, 76 insertions(+), 60 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 038304b672..85bd718345 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3548,8 +3548,17 @@ static int next_file(switch_file_handle_t *handle) handle->speed = context->fh.speed; handle->interval = context->fh.interval; - if (context->index == 0) { - context->samples = (handle->samplerate / 1000) * 250; + if (switch_test_flag((&context->fh), SWITCH_FILE_NATIVE)) { + switch_set_flag(handle, SWITCH_FILE_NATIVE); + } else { + switch_clear_flag(handle, SWITCH_FILE_NATIVE); + } + + + if (!switch_test_flag(handle, SWITCH_FILE_NATIVE)) { + if (context->index == 0) { + context->samples = (handle->samplerate / 1000) * 250; + } } return 1; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 98dfd0f71e..39980f30d1 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1000,7 +1000,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_file_handle_t lfh; const char *p; char *title = "", *copyright = "", *software = "", *artist = "", *comment = "", *date = ""; - uint8_t asis = 0; char *ext; const char *prefix; const char *timer_name; @@ -1024,6 +1023,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess int more_data = 0; char *playback_vars, *tmp; switch_event_t *event; + uint32_t test_native = 0, last_native = 0; if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; @@ -1073,7 +1073,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess for (cur = 0; switch_channel_ready(channel) && !done && cur < argc; cur++) { file = argv[cur]; - asis = 0; eof = 0; if (cur) { @@ -1168,7 +1167,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } else { ext = read_impl.iananame; file = switch_core_session_sprintf(session, "%s.%s", file, ext); - asis = 1; } } @@ -1221,9 +1219,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_channel_set_private(channel, "__fh", fh); switch_core_session_io_rwunlock(session); - if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) { - asis = 1; - } if (!abuf) { switch_zmalloc(abuf, FILE_STARTSAMPLES * sizeof(*abuf)); @@ -1275,43 +1270,46 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_assert(fh->audio_buffer); } - if (asis) { + codec_name = "L16"; + + if (!switch_core_codec_ready((&codec))) { + if (switch_core_codec_init(&codec, + codec_name, + NULL, + fh->samplerate, + interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), + SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); + + + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, + "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); + switch_core_session_io_write_lock(session); + switch_channel_set_private(channel, "__fh", NULL); + switch_core_session_io_rwunlock(session); + + switch_core_file_close(fh); + + switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE); + status = SWITCH_STATUS_GENERR; + continue; + } + } + + test_native = switch_test_flag(fh, SWITCH_FILE_NATIVE); + + if (test_native) { write_frame.codec = switch_core_session_get_read_codec(session); samples = read_impl.samples_per_packet; framelen = read_impl.encoded_bytes_per_packet; } else { - codec_name = "L16"; - - if (!switch_core_codec_ready((&codec))) { - if (switch_core_codec_init(&codec, - codec_name, - NULL, - fh->samplerate, - interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), - SWITCH_LOG_DEBUG, "Codec Activated %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); - - - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, - "Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate, fh->channels, interval); - switch_core_session_io_write_lock(session); - switch_channel_set_private(channel, "__fh", NULL); - switch_core_session_io_rwunlock(session); - - switch_core_file_close(fh); - - switch_core_session_reset(session, SWITCH_TRUE, SWITCH_FALSE); - status = SWITCH_STATUS_GENERR; - continue; - } - } - write_frame.codec = &codec; - samples = codec.implementation->samples_per_packet; framelen = codec.implementation->decoded_bytes_per_packet; } + + last_native = test_native; if (timer_name && !timer.samplecount) { uint32_t len; @@ -1429,7 +1427,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess memset(abuf + bread, 255, framelen - bread); } - olen = asis ? framelen : ilen; + olen = switch_test_flag(fh, SWITCH_FILE_NATIVE) ? framelen : ilen; do_speed = 0; } else if (fh->audio_buffer && (eof || (switch_buffer_inuse(fh->audio_buffer) > (switch_size_t) (framelen)))) { if (!(bread = switch_buffer_read(fh->audio_buffer, abuf, framelen))) { @@ -1440,30 +1438,48 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } - fh->offset_pos += asis ? bread : bread / 2; + fh->offset_pos += switch_test_flag(fh, SWITCH_FILE_NATIVE) ? bread : bread / 2; if (bread < framelen) { memset(abuf + bread, 255, framelen - bread); } - olen = asis ? framelen : ilen; + olen = switch_test_flag(fh, SWITCH_FILE_NATIVE) ? framelen : ilen; } else { if (eof) { break; } olen = FILE_STARTSAMPLES; - if (!asis) { + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE)) { olen /= 2; } if (switch_core_file_read(fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) { eof++; continue; } - switch_buffer_write(fh->audio_buffer, abuf, asis ? olen : olen * 2); + + test_native = switch_test_flag(fh, SWITCH_FILE_NATIVE); + + if (test_native != last_native) { + if (test_native) { + write_frame.codec = switch_core_session_get_read_codec(session); + samples = read_impl.samples_per_packet; + framelen = read_impl.encoded_bytes_per_packet; + } else { + write_frame.codec = &codec; + samples = codec.implementation->samples_per_packet; + framelen = codec.implementation->decoded_bytes_per_packet; + } + switch_buffer_zero(fh->audio_buffer); + } + + last_native = test_native; + + switch_buffer_write(fh->audio_buffer, abuf, switch_test_flag(fh, SWITCH_FILE_NATIVE) ? olen : olen * 2); olen = switch_buffer_read(fh->audio_buffer, abuf, framelen); fh->offset_pos += olen / 2; - if (!asis) { + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE)) { olen /= 2; } @@ -1473,7 +1489,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess break; } - if (!asis) { + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE)) { if (fh->speed > 2) { fh->speed = 2; } else if (fh->speed < -2) { @@ -1481,7 +1497,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } - if (!asis && fh->audio_buffer && last_speed > -1 && last_speed != fh->speed) { + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->audio_buffer && last_speed > -1 && last_speed != fh->speed) { switch_buffer_zero(fh->sp_audio_buffer); } @@ -1492,7 +1508,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } - if (!asis && fh->speed && do_speed) { + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->speed && do_speed) { float factor = 0.25f * abs(fh->speed); switch_size_t newlen, supplement, step; short *bp = write_frame.data; @@ -1583,7 +1599,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess more_data = 0; write_frame.samples = (uint32_t) olen; - if (asis) { + if (switch_test_flag(fh, SWITCH_FILE_NATIVE)) { write_frame.datalen = (uint32_t) olen; } else { write_frame.datalen = write_frame.samples * 2; @@ -1596,12 +1612,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } #ifndef WIN32 #if SWITCH_BYTE_ORDER == __BIG_ENDIAN - if (!asis && l16) { + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && l16) { switch_swap_linear(write_frame.data, (int) write_frame.datalen / 2); } #endif #endif - if (!asis && fh->vol) { + if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->vol) { switch_change_sln_volume(write_frame.data, write_frame.datalen / 2, fh->vol); } diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 0c803a71b4..9804e53238 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1995,23 +1995,14 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f char buf[256] = ""; int ret; va_list ap; - int native = !strcasecmp(sh->ext, "native"); va_start(ap, fmt); if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { if (!sh->cnt++) { - if (native) { - sh->stream.write_function(&sh->stream, "file_string://%s", buf); - } else { - sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); - } + sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); } else { - if (native) { - sh->stream.write_function(&sh->stream, "!%s", buf); - } else { - sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); - } + sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); } } From 3ed59f1d1f7ba6944f76f9d4ed32154dfa36ecb6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 16:28:12 -0500 Subject: [PATCH 226/558] take back in some elements from the reverted patch that still make sense based on code review by Moc, thanks --- src/switch_xml.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index c4b643f511..00f6ddd48e 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -137,6 +137,7 @@ static switch_memory_pool_t *XML_MEMORY_POOL = NULL; static switch_thread_rwlock_t *B_RWLOCK = NULL; static switch_mutex_t *XML_LOCK = NULL; static switch_mutex_t *REFLOCK = NULL; +static switch_mutex_t *FILE_LOCK = NULL; static switch_mutex_t *XML_GEN_LOCK = NULL; @@ -1526,9 +1527,11 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file) } else { abs = file; } + + switch_mutex_lock(FILE_LOCK); if (!(new_file = switch_mprintf("%s%s%s.fsxml", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, abs))) { - return NULL; + goto done; } if ((write_fd = open(new_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) < 0) { @@ -1549,13 +1552,19 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_parse_file(const char *file) } done: + + switch_mutex_unlock(FILE_LOCK); + if (write_fd > -1) { close(write_fd); } + if (fd > -1) { close(fd); } + switch_safe_free(new_file); + return xml; } @@ -2054,6 +2063,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, cons switch_mutex_init(&XML_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); switch_mutex_init(&REFLOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); + switch_mutex_init(&FILE_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); switch_mutex_init(&XML_GEN_LOCK, SWITCH_MUTEX_NESTED, XML_MEMORY_POOL); switch_thread_rwlock_create(&B_RWLOCK, XML_MEMORY_POOL); @@ -2071,7 +2081,9 @@ SWITCH_DECLARE(switch_status_t) switch_xml_init(switch_memory_pool_t *pool, cons SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void) { switch_status_t status = SWITCH_STATUS_FALSE; + switch_mutex_lock(XML_LOCK); + switch_mutex_lock(REFLOCK); if (MAIN_XML_ROOT) { switch_xml_t xml = MAIN_XML_ROOT; @@ -2081,6 +2093,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_destroy(void) } switch_mutex_unlock(XML_LOCK); + switch_mutex_unlock(REFLOCK); return status; } From 7c143da409a31bcbc8d8877f240ed2aa084ffb0e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 18:17:52 -0500 Subject: [PATCH 227/558] FS-3214 try this patch --- src/mod/endpoints/mod_sofia/sofia.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9161f23eb5..12f1b233fc 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4423,6 +4423,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status const char *r_sdp = NULL; switch_core_session_message_t *msg; private_object_t *other_tech_pvt = switch_core_session_get_private(other_session); + switch_channel_t *other_channel = switch_core_session_get_channel(other_session); if (sip->sip_payload && sip->sip_payload->pl_data && sip->sip_content_type && sip->sip_content_type->c_subtype && switch_stristr("sdp", sip->sip_content_type->c_subtype)) { @@ -4433,9 +4434,14 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Passing %d %s to other leg\n", status, phrase); - if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) { + if (status > 299) { + switch_channel_set_private(channel, "t38_options", NULL); + switch_channel_set_private(other_channel, "t38_options", NULL); + sofia_clear_flag(tech_pvt, TFLAG_T38_PASSTHRU); + sofia_clear_flag(other_tech_pvt, TFLAG_T38_PASSTHRU); + } else if (status == 200 && sofia_test_flag(tech_pvt, TFLAG_T38_PASSTHRU) && has_t38 && sip->sip_payload && sip->sip_payload->pl_data) { switch_t38_options_t *t38_options = sofia_glue_extract_t38_options(session, sip->sip_payload->pl_data); - + if (!t38_options) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_WARNING, "%s Error parsing SDP:\n%s\n", switch_channel_get_name(tech_pvt->channel), sip->sip_payload->pl_data); From 0871b8c53a475a97a2ac1e6974b9003a24668b6c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 18:29:49 -0500 Subject: [PATCH 228/558] FS-3217 --resolve --- src/switch_ivr_play_say.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 39980f30d1..5980ea41c7 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1060,9 +1060,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess l16++; } - - - if (play_delimiter) { file_dup = switch_core_session_strdup(session, file); argc = switch_separate_string(file_dup, play_delimiter, argv, (sizeof(argv) / sizeof(argv[0]))); @@ -1071,6 +1068,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess argv[0] = (char *) file; } + if (!fh) { + fh = &lfh; + memset(fh, 0, sizeof(lfh)); + } + + if (fh->samples > 0) { + sample_start = fh->samples; + fh->samples = 0; + } + for (cur = 0; switch_channel_ready(channel) && !done && cur < argc; cur++) { file = argv[cur]; eof = 0; @@ -1184,16 +1191,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } } - if (!fh) { - fh = &lfh; - memset(fh, 0, sizeof(lfh)); - } - - if (fh->samples > 0) { - sample_start = fh->samples; - fh->samples = 0; - } - if ((prebuf = switch_channel_get_variable(channel, "stream_prebuffer"))) { int maybe = atoi(prebuf); if (maybe > 0) { From 05cb400a512cae14d2846067134493d43f4587c7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 19:04:27 -0500 Subject: [PATCH 229/558] FS-3205 --resolve --- src/switch_utils.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/src/switch_utils.c b/src/switch_utils.c index eb5ed7f830..3cc13f7ae4 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -2579,13 +2579,13 @@ SWITCH_DECLARE(int) switch_isxdigit(int c) return (c < 0 ? 0 : c > 255 ? 0 : ((_switch_ctype_ + 1)[(unsigned char) c] & (_N | _X))); } static const char *DOW[] = { - "sat", "sun", "mon", "tue", "wed", "thu", - "fri" + "fri", + "sat" }; SWITCH_DECLARE(const char *) switch_dow_int2str(int val) { @@ -2601,7 +2601,7 @@ SWITCH_DECLARE(int) switch_dow_str2int(const char *exp) { for (x = 0; x < switch_arraylen(DOW); x++) { if (!strncasecmp(DOW[x], exp, 3)) { - ret = x; + ret = x + 1; break; } } @@ -2611,13 +2611,13 @@ SWITCH_DECLARE(int) switch_dow_str2int(const char *exp) { typedef enum { DOW_ERR = -2, DOW_EOF = -1, - DOW_SAT = 0, - DOW_SUN, + DOW_SUN = 1, DOW_MON, DOW_TUE, DOW_WED, DOW_THU, DOW_FRI, + DOW_SAT, DOW_HYPHEN = '-', DOW_COMA = ',' } dow_t; @@ -2632,7 +2632,7 @@ static inline dow_t _dow_read_token(const char **s) } else if (**s == ',') { (*s)++; return DOW_COMA; - } else if (**s >= '0' && **s <= '9') { + } else if (**s >= '1' && **s <= '7') { dow_t r = **s - '0'; (*s)++; return r; @@ -2664,14 +2664,8 @@ SWITCH_DECLARE(switch_bool_t) switch_dow_cmp(const char *exp, int val) } else { /* Valid day found */ if (range_start != DOW_EOF) { /* Evaluating a range */ - if (range_start < cur) { - if (val >= range_start && val <= cur) { - return SWITCH_TRUE; - } - } else { - if (val >= cur && val <= range_start) { - return SWITCH_TRUE; - } + if (val >= range_start && val <= cur) { + return SWITCH_TRUE; } range_start = DOW_EOF; } else if (val == cur) { From cdcd36337a1d76a2781a78aa631126bc3b4c68f6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 19:12:05 -0500 Subject: [PATCH 230/558] FS-3207 --resolve --- src/mod/say/mod_say_en/mod_say_en.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 0128b679ad..01409c7b21 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -487,7 +487,7 @@ static switch_status_t say_spell(switch_say_file_handle_t *sh, char *tosay, swit for (p = tosay; p && *p; p++) { int a = tolower((int) *p); if (a >= '0' && a <= '9') { - switch_say_file(sh, "digits/%d", a - '0'); + switch_say_file(sh, "digits/%c", a); } else { if (say_args->type == SST_NAME_SPELLED) { switch_say_file(sh, "ascii/%d", a); From 44304f4962f3e1552f813428f35b93c47c06807c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 19:44:29 -0500 Subject: [PATCH 231/558] the intent for having the module and lang separate is for things where the same module can use different sets of sounds like en module and en-male or en-female lang (sound dirs) there was indeed a disconnect in the dialplan version of this app. Originally say was only available in phrase macros so I change the syntax of the say app so you can specify both the module and the lang absolte from the dp with something like he:he as the module name. BTW: Going forward can you attach the patch or give me instructions on how to get it in raw format or merge it to our local git, I don't really have the time to figure it out just to pull in a patch...... --- .../applications/mod_dptools/mod_dptools.c | 2 +- src/switch_ivr.c | 46 +++++++++++++------ 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 85bd718345..42c1203380 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2078,7 +2078,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function) prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex, digit_timeout); } -#define SAY_SYNTAX " [] " +#define SAY_SYNTAX ": [] " SWITCH_STANDARD_APP(say_function) { char *argv[5] = { 0 }; diff --git a/src/switch_ivr.c b/src/switch_ivr.c index b6dac4d71d..07c341a580 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2330,22 +2330,38 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, const char *save_path = NULL, *chan_lang = NULL, *lang = NULL, *lname = NULL, *sound_path = NULL; switch_event_t *hint_data; switch_xml_t cfg, xml = NULL, language, macros; - + char *p; switch_assert(session); channel = switch_core_session_get_channel(session); switch_assert(channel); - lang = switch_channel_get_variable(channel, "language"); + if (zstr(module_name)) { + module_name = "en"; + } - if (!lang) { - chan_lang = switch_channel_get_variable(channel, "default_language"); - if (!chan_lang) { - chan_lang = "en"; + if (module_name) { + p = switch_core_session_strdup(session, module_name); + module_name = p; + + if ((p = strchr(module_name, ':'))) { + *p++ = '\0'; + chan_lang = p; + } + } + + if (!chan_lang) { + lang = switch_channel_get_variable(channel, "language"); + + if (!lang) { + chan_lang = switch_channel_get_variable(channel, "default_language"); + if (!chan_lang) { + chan_lang = module_name; + } + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang); + } else { + chan_lang = lang; } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "No language specified - Using [%s]\n", chan_lang); - } else { - chan_lang = lang; } switch_event_create(&hint_data, SWITCH_EVENT_REQUEST_PARAMS); @@ -2399,8 +2415,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, if (sound_path) { switch_channel_set_variable(channel, "sound_prefix", sound_path); + p = switch_core_session_strdup(session, sound_path); + sound_path = p; } + if (xml) { + switch_xml_free(xml); + } + if ((si = switch_loadable_module_get_say_interface(module_name))) { /* should go back and proto all the say mods to const.... */ switch_say_args_t say_args = {0}; @@ -2424,11 +2446,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, if (save_path) { switch_channel_set_variable(channel, "sound_prefix", save_path); } - - if (xml) { - switch_xml_free(xml); - } - + return status; } From c5daf80ef84d3e70bf0946cdc0f842dd0c272480 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 31 Mar 2011 20:03:31 -0500 Subject: [PATCH 232/558] FS-3218 --resolve --- src/switch_core_state_machine.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index e2d50704b5..e69c408013 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -306,7 +306,12 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) while ((state = switch_channel_get_state(session->channel)) != CS_DESTROY) { - switch_channel_wait_for_flag(session->channel, CF_BLOCK_STATE, SWITCH_FALSE, 0, NULL); + if (switch_channel_test_flag(session->channel, CF_BLOCK_STATE)) { + switch_channel_wait_for_flag(session->channel, CF_BLOCK_STATE, SWITCH_FALSE, 0, NULL); + if ((state = switch_channel_get_state(session->channel)) == CS_DESTROY) { + break; + } + } midstate = state; if (state != switch_channel_get_running_state(session->channel) || state >= CS_HANGUP) { From 5382972a39a17fa2c76519cd13d230d594959e48 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 10:35:20 -0500 Subject: [PATCH 233/558] FS-3215 --- src/mod/applications/mod_dptools/mod_dptools.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 42c1203380..f2da2c5d7d 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2078,7 +2078,7 @@ SWITCH_STANDARD_APP(play_and_get_digits_function) prompt_audio_file, bad_input_audio_file, var_name, digit_buffer, sizeof(digit_buffer), digits_regex, digit_timeout); } -#define SAY_SYNTAX ": [] " +#define SAY_SYNTAX "[:] [] " SWITCH_STANDARD_APP(say_function) { char *argv[5] = { 0 }; @@ -2094,6 +2094,11 @@ SWITCH_STANDARD_APP(say_function) switch_channel_set_variable(channel, SWITCH_PLAYBACK_TERMINATOR_USED, ""); + /* Set default langauge according to the */ + if (!strchr(argv[0], ':')) { + argv[0] = switch_core_session_sprintf(session, "%s:%s", argv[0], argv[0]); + } + switch_ivr_say(session, (argc == 4) ? argv[3] : argv[4], argv[0], argv[1], argv[2], (argc == 5) ? argv[3] : NULL ,&args); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", SAY_SYNTAX); From 008f988990e20c2ebec322c5c65a6a3afe9a90b6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 12:30:24 -0500 Subject: [PATCH 234/558] FS-3208 --resolve --- src/include/switch_nat.h | 7 +++++- src/include/switch_types.h | 3 ++- .../applications/mod_commands/mod_commands.c | 21 ++++++++++++++++- src/switch.c | 10 ++++++-- src/switch_core.c | 2 +- src/switch_nat.c | 23 +++++++++++++++++-- 6 files changed, 58 insertions(+), 8 deletions(-) diff --git a/src/include/switch_nat.h b/src/include/switch_nat.h index 9e40546345..492dbfb29d 100644 --- a/src/include/switch_nat.h +++ b/src/include/switch_nat.h @@ -56,7 +56,7 @@ SWITCH_DECLARE(const char *) switch_nat_get_type(void); \param pool the memory pool to use for long term allocations \note Generally called by the core_init */ -SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool); +SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool, switch_bool_t mapping); /*! \brief Initilize the rest of the NAT Traversal System @@ -86,6 +86,11 @@ SWITCH_DECLARE(void) switch_nat_republish(void); */ SWITCH_DECLARE(void) switch_nat_reinit(void); +/*! + \brief Update the setting if port mapping will be created +*/ +SWITCH_DECLARE(void) switch_nat_set_mapping(switch_bool_t mapping); + /*! \brief Maps a port through the NAT Traversal System \param port Internal port to map diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 81cc3fb719..2ab4a18b85 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -265,7 +265,8 @@ typedef enum { SCF_VERBOSE_EVENTS = (1 << 11), SCF_USE_WIN32_MONOTONIC = (1 << 12), SCF_AUTO_SCHEMAS = (1 << 13), - SCF_MINIMAL = (1 << 14) + SCF_MINIMAL = (1 << 14), + SCF_USE_NAT_MAPPING = (1 << 15) } switch_core_flag_enum_t; typedef uint32_t switch_core_flag_t; diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 6fb35598c2..ab402db8f5 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -329,6 +329,7 @@ SWITCH_STANDARD_API(nat_map_function) switch_port_t external_port = 0; char *tmp = NULL; switch_bool_t sticky = SWITCH_FALSE; + switch_bool_t mapping = SWITCH_TRUE; if (!cmd) { goto usage; @@ -363,6 +364,24 @@ SWITCH_STANDARD_API(nat_map_function) goto ok; } + if (argc < 2) { + goto usage; + } + + if (argv[0] && switch_stristr("mapping", argv[0])) { + if (argv[1] && switch_stristr("enable", argv[1])) { + mapping = SWITCH_TRUE; + } else if (argv[1] && switch_stristr("disable", argv[1])) { + mapping = SWITCH_FALSE; + } + + switch_nat_set_mapping(mapping); + tmp = switch_nat_status(); + stream->write_function(stream, tmp); + switch_safe_free(tmp); + goto ok; + } + if (argc < 3) { goto error; } @@ -395,7 +414,7 @@ SWITCH_STANDARD_API(nat_map_function) goto ok; usage: - stream->write_function(stream, "USAGE: nat_map [status|reinit|republish] | [add|del] [tcp|udp] [sticky]"); + stream->write_function(stream, "USAGE: nat_map [status|reinit|republish] | [add|del] [tcp|udp] [sticky] | [mapping] "); ok: diff --git a/src/switch.c b/src/switch.c index ad9cdf8e6e..7d4d1a8217 100644 --- a/src/switch.c +++ b/src/switch.c @@ -200,7 +200,7 @@ void WINAPI ServiceCtrlHandler(DWORD control) /* the main service entry point */ void WINAPI service_main(DWORD numArgs, char **args) { - switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT; + switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_USE_NAT_MAPPING | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT; const char *err = NULL; /* error value for return from freeswitch initialization */ /* Override flags if they have been set earlier */ @@ -364,7 +364,7 @@ int main(int argc, char *argv[]) #ifdef __sun switch_core_flag_t flags = SCF_USE_SQL; #else - switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT; + switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_USE_NAT_MAPPING | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT; #endif int ret = 0; switch_status_t destroy_status; @@ -412,6 +412,7 @@ int main(int argc, char *argv[]) "\t-nosql -- disable internal sql scoreboard\n" "\t-heavy-timer -- Heavy Timer, possibly more accurate but at a cost\n" "\t-nonat -- disable auto nat detection\n" + "\t-nonatmap -- disable auto nat port mapping\n" "\t-nocal -- disable clock calibration\n" "\t-nort -- disable clock clock_realtime\n" "\t-stop -- stop freeswitch\n" @@ -580,6 +581,11 @@ int main(int argc, char *argv[]) known_opt++; } + if (local_argv[x] && !strcmp(local_argv[x], "-nonatmap")) { + flags &= ~SCF_USE_NAT_MAPPING; + known_opt++; + } + if (local_argv[x] && !strcmp(local_argv[x], "-heavy-timer")) { flags |= SCF_USE_HEAVY_TIMING; known_opt++; diff --git a/src/switch_core.c b/src/switch_core.c index 53f21dfb79..85e795c408 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1398,7 +1398,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc } if (switch_test_flag((&runtime), SCF_USE_AUTO_NAT)) { - switch_nat_init(runtime.memory_pool); + switch_nat_init(runtime.memory_pool, switch_test_flag((&runtime), SCF_USE_NAT_MAPPING)); } switch_log_init(runtime.memory_pool, runtime.colorize_console); diff --git a/src/switch_nat.c b/src/switch_nat.c index d9110efe18..e9d4b2b9ca 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -51,6 +51,7 @@ typedef struct { char *descURL; char pub_addr[IP_LEN]; char pvt_addr[IP_LEN]; + switch_bool_t mapping; } nat_globals_t; static nat_globals_t nat_globals; @@ -207,9 +208,14 @@ static int init_pmp(void) return get_pmp_pubaddr(nat_globals.pub_addr); } +SWITCH_DECLARE(void) switch_nat_set_mapping(switch_bool_t mapping) +{ + nat_globals.mapping = mapping; +} + SWITCH_DECLARE(void) switch_nat_reinit(void) { - switch_nat_init(nat_globals_perm.pool); + switch_nat_init(nat_globals_perm.pool, nat_globals.mapping); } switch_status_t init_nat_monitor(switch_memory_pool_t *pool) @@ -392,7 +398,7 @@ SWITCH_DECLARE(void) switch_nat_thread_stop(void) } -SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool) +SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool, switch_bool_t mapping) { /* try free dynamic data structures prior to resetting to 0 */ FreeUPNPUrls(&nat_globals.urls); @@ -405,6 +411,8 @@ SWITCH_DECLARE(void) switch_nat_init(switch_memory_pool_t *pool) nat_globals_perm.pool = pool; } + nat_globals.mapping = mapping; + switch_find_local_ip(nat_globals.pvt_addr, sizeof(nat_globals.pvt_addr), NULL, AF_INET); @@ -577,6 +585,11 @@ SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t po switch_status_t status = SWITCH_STATUS_FALSE; switch_event_t *event = NULL; + if (!nat_globals.mapping) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NAT port mapping disabled\n"); + return status; + } + switch (nat_globals.nat_type) { case SWITCH_NAT_TYPE_PMP: status = switch_nat_add_mapping_pmp(port, proto, external_port); @@ -710,6 +723,12 @@ SWITCH_DECLARE(char *) switch_nat_status(void) (nat_globals.nat_type == SWITCH_NAT_TYPE_UPNP) ? "UPNP" : (nat_globals.nat_type == SWITCH_NAT_TYPE_PMP ? "NAT-PMP" : "UNKNOWN"), nat_globals.pub_addr); + if (nat_globals.mapping) { + stream.write_function(&stream, "NAT port mapping enabled.\n"); + } else { + stream.write_function(&stream, "NAT port mapping disabled.\n"); + } + switch_api_execute("show", "nat_map", NULL, &stream); return stream.data; /* caller frees */ From ebd9c83ed60889f7d580fc314c63f5008ca2e193 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 12:39:32 -0500 Subject: [PATCH 235/558] FS-3211 --resolve --- build/modules.conf.in | 3 ++- conf/freeswitch.xml | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/build/modules.conf.in b/build/modules.conf.in index ee9aea41d2..d31bb31b76 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -108,10 +108,11 @@ say/mod_say_en #say/mod_say_it #say/mod_say_nl #say/mod_say_pt -say/mod_say_ru +#say/mod_say_ru #say/mod_say_zh #say/mod_say_hu #say/mod_say_th +#say/mod_say_he #timers/mod_timerfd ## Experimental Modules (don't cry if they're broken) diff --git a/conf/freeswitch.xml b/conf/freeswitch.xml index 6914128e55..65f6e1812d 100644 --- a/conf/freeswitch.xml +++ b/conf/freeswitch.xml @@ -59,6 +59,7 @@ + From 71dd91d8d8c53a9dd7306e3435817806ca0031a2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 12:50:04 -0500 Subject: [PATCH 236/558] FS-3211 checkin --- src/mod/say/mod_say_he/Makefile | 2 + src/mod/say/mod_say_he/mod_say_he.2008.vcproj | 283 ++++++ .../say/mod_say_he/mod_say_he.2010.vcxproj | 135 +++ src/mod/say/mod_say_he/mod_say_he.c | 866 ++++++++++++++++++ src/mod/say/mod_say_he/mod_say_he.vcproj | 51 ++ 5 files changed, 1337 insertions(+) create mode 100644 src/mod/say/mod_say_he/Makefile create mode 100644 src/mod/say/mod_say_he/mod_say_he.2008.vcproj create mode 100644 src/mod/say/mod_say_he/mod_say_he.2010.vcxproj create mode 100644 src/mod/say/mod_say_he/mod_say_he.c create mode 100644 src/mod/say/mod_say_he/mod_say_he.vcproj diff --git a/src/mod/say/mod_say_he/Makefile b/src/mod/say/mod_say_he/Makefile new file mode 100644 index 0000000000..2c35e6e98f --- /dev/null +++ b/src/mod/say/mod_say_he/Makefile @@ -0,0 +1,2 @@ +BASE=../../../.. +include $(BASE)/build/modmake.rules diff --git a/src/mod/say/mod_say_he/mod_say_he.2008.vcproj b/src/mod/say/mod_say_he/mod_say_he.2008.vcproj new file mode 100644 index 0000000000..1a06c2470e --- /dev/null +++ b/src/mod/say/mod_say_he/mod_say_he.2008.vcproj @@ -0,0 +1,283 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/say/mod_say_he/mod_say_he.2010.vcxproj b/src/mod/say/mod_say_he/mod_say_he.2010.vcxproj new file mode 100644 index 0000000000..f80f2de90f --- /dev/null +++ b/src/mod/say/mod_say_he/mod_say_he.2010.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_say_he + {0E1117D4-56BF-4B5F-926C-273FD99593DE} + mod_say_he + Win32Proj + + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + {f6c55d93-b927-4483-bb69-15aef3dd2dff} + false + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + false + + + + + + diff --git a/src/mod/say/mod_say_he/mod_say_he.c b/src/mod/say/mod_say_he/mod_say_he.c new file mode 100644 index 0000000000..62f0b59ba2 --- /dev/null +++ b/src/mod/say/mod_say_he/mod_say_he.c @@ -0,0 +1,866 @@ +/* + * Copyright (c) 2011, Shahar Hadas + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of the original author; nor the names of any contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * The Initial Developers of the Original Code are + * Anthony Minessale II + * Michael B. Murdock + * Marc O. Chouinard + * Yehavi Bourvine + * Eli Hayun + * Portions created by the Initial Developers are Copyright (C) + * the Initial Developers. All Rights Reserved. + * + * Contributor(s): + * + * mod_say_he.c -- Say for Hebrew + * + */ + +#include +#include +#include + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_he_load); +SWITCH_MODULE_DEFINITION(mod_say_he, mod_say_he_load, NULL, NULL); + +#define say_num(_sh, num, meth) { \ + char tmp[80]; \ + switch_status_t tstatus; \ + switch_say_method_t smeth = say_args->method; \ + switch_say_type_t stype = say_args->type; \ + say_args->type = SST_ITEMS; say_args->method = meth; \ + switch_snprintf(tmp, sizeof(tmp), "%u", (unsigned)num); \ + if ((tstatus = \ + he_say_general_count(_sh, tmp, say_args)) \ + != SWITCH_STATUS_SUCCESS) { \ + return tstatus; \ + } \ + say_args->method = smeth; say_args->type = stype; \ + } \ + + +typedef enum { + PGR_HUNDREDS = 1000, + PGR_THOUSANDS = 100000, + PGR_MILLIONS = 100000000, +} play_group_range_t; + +static switch_status_t play_group(switch_say_method_t method, switch_say_gender_t gender, int total, play_group_range_t range, int a, int b, int c, char *what, switch_say_file_handle_t *sh) +{ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "** total=[%d] range=[%d] a=[%d] b=[%d] c=[%d] gender=[%d] method=[%d] what=[%s]\n", total, range, a, b, c, gender, method, what); + + /* Check for special cases of thousands */ + if (range == PGR_THOUSANDS && a == 0) { + /* Check for special cases of 1000, 2000 ... 8000, 9000 */ + if (b == 0 && c != 0) { + switch_say_file(sh, "digits/%d000", c); + return SWITCH_STATUS_SUCCESS; + } + + /* Check for special case of 10,000 */ + if (b == 1 && c == 0) { + switch_say_file(sh, "digits/10000"); + return SWITCH_STATUS_SUCCESS; + } + } + + /* Check for special case of million */ + if (range == PGR_MILLIONS && a == 0 && b == 0 && c == 1) { + switch_say_file(sh, "digits/million"); + return SWITCH_STATUS_SUCCESS; + } + + /* Check for Hebrew SSM_COUNTED special case. Anything above 10 needs to said differently */ + if (method == SSM_COUNTED && range == PGR_HUNDREDS && total <= 10) { + if (b) { + switch_say_file(sh, "digits/h-10%s", gender == SSG_MASCULINE ? "_m" : ""); + } else { + switch_say_file(sh, "digits/h-%d%s", c, gender == SSG_MASCULINE ? "_m" : ""); + } + return SWITCH_STATUS_SUCCESS; + } + + /* In Hebrew, hundreds can be said as " hundreds", but the more correct + * form of pronunciation required it to be recorded separately. + * Note that hundreds are always pronounced in SSG_FEMININE form in hebrew, and were recorded as such. + */ + if (a) { + switch_say_file(sh, "digits/%d00", a); + } + + if (b) { + /* Check for two digits playback (10 to 19) */ + if (b > 1) { + switch_say_file(sh, "digits/%d0", b); + } else { + if (range != PGR_HUNDREDS || gender == SSG_MASCULINE) { + if ((range == PGR_MILLIONS && a) || (range != PGR_MILLIONS && total > 9)){ /* Check if need to say "and" */ + switch (c) { + case 0: + case 5: + switch_say_file(sh, "digits/va"); + break; + + case 2: + case 3: + case 8: + case 9: + switch_say_file(sh, "digits/uu"); + break; + + case 1: + case 4: + case 6: + case 7: + switch_say_file(sh, "digits/ve"); + break; + + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_MASCULINE)\n", c); + break; + } + } + switch_say_file(sh, "digits/%d%d_m", b, c); + } else { + if ((range == PGR_MILLIONS && a) || (range != PGR_MILLIONS && total > 9)){ /* Check if need to say "and" */ + switch (c) { + case 2: + case 3: + case 7: + case 8: + case 9: + switch_say_file(sh, "digits/uu"); + break; + + case 0: + case 1: + case 4: + case 5: + case 6: + switch_say_file(sh, "digits/ve"); + break; + + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_FEMININE)\n", c); + break; + } + } + switch_say_file(sh, "digits/%d%d", b, c); + } + c = 0; /* Skip the pronunciation on the c value */ + } + } + + if (c) { + if (range != PGR_HUNDREDS || gender == SSG_MASCULINE) { + if ((range == PGR_MILLIONS && (b || a)) || (range != PGR_MILLIONS && total > 9)){ /* Check if need to say "and" */ + switch (c) { + case 5: + switch_say_file(sh, "digits/va"); + break; + + case 2: + case 3: + case 8: + switch_say_file(sh, "digits/uu"); + break; + + case 1: + case 4: + case 6: + case 7: + case 9: + switch_say_file(sh, "digits/ve"); + break; + + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_MASCULINE)\n", c); + break; + } + } + switch_say_file(sh, "digits/%d_m", c); + } else { + if ((range == PGR_MILLIONS && (b || a)) || (range != PGR_MILLIONS && total > 9)){ /* Check if need to say "and" */ + switch (c) { + case 2: + case 8: + switch_say_file(sh, "digits/uu"); + break; + + case 1: + case 3: + case 4: + case 5: + case 6: + case 7: + case 9: + switch_say_file(sh, "digits/ve"); + break; + + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "play_group unkonwn digit (%d) Error! (SSG_FEMININE)\n", c); + break; + } + } + switch_say_file(sh, "digits/%d", c); + } + } + + if (what && (a || b || c)) { + switch_say_file(sh, what); + } + + /* Incase of SSM_COUNTED, in the case of total > 10, after the number was said, we need to say "be'mispar" (in number). + * Although we shouldn't be here if total <= 10, I still preferred to have the criteria tested again. */ + if (method == SSM_COUNTED && range == PGR_HUNDREDS && total > 10) { + switch_say_file(sh, "digits/in_number", c); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t he_say_general_count(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) +{ + int in, inCopy; + int x = 0; + int places[9] = { 0 }; + char sbuf[128] = ""; + switch_status_t status; + + if (say_args->method == SSM_ITERATED) { + if ((tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1))) { + char *p; + for (p = tosay; p && *p; p++) { + if (*p != '0' && say_args->gender == SSG_MASCULINE) { + switch_say_file(sh, "digits/%c_m", *p); + } else { + switch_say_file(sh, "digits/%c", *p); + } + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + return SWITCH_STATUS_SUCCESS; + } + + if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + in = inCopy = atoi(tosay); + + if (in != 0) { + for (x = 8; x >= 0; x--) { + int num = (int) pow(10, x); + if ((places[(uint32_t) x] = in / num)) { + in -= places[(uint32_t) x] * num; + } + } + switch (say_args->method) { + case SSM_COUNTED: + /* TODO add 'ha' (the)? */ + case SSM_PRONOUNCED: + if ((status = play_group(SSM_PRONOUNCED, say_args->gender, inCopy, PGR_MILLIONS, places[8], places[7], places[6], "digits/million", sh)) != SWITCH_STATUS_SUCCESS) { + return status; + } + if ((status = play_group(SSM_PRONOUNCED, say_args->gender, inCopy, PGR_THOUSANDS, places[5], places[4], places[3], "digits/thousand", sh)) != SWITCH_STATUS_SUCCESS) { + return status; + } + if ((status = play_group(say_args->method, say_args->gender, inCopy, PGR_HUNDREDS, places[2], places[1], places[0], NULL, sh)) != SWITCH_STATUS_SUCCESS) { + return status; + } + break; + default: + break; + } + } else { + switch_say_file(sh, "digits/0"); + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t he_say_time(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) +{ + int32_t t; + switch_time_t target = 0, target_now = 0; + switch_time_exp_t tm, tm_now; + uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0; + const char *tz = NULL; + + tz = switch_say_file_handle_get_variable(sh, "timezone"); + + if (say_args->type == SST_TIME_MEASUREMENT) { + int64_t hours = 0; + int64_t minutes = 0; + int64_t seconds = 0; + int64_t r = 0; + + if (strchr(tosay, ':')) { + char *tme = strdup(tosay); + char *p; + + if ((p = strrchr(tme, ':'))) { + *p++ = '\0'; + seconds = atoi(p); + if ((p = strchr(tme, ':'))) { + *p++ = '\0'; + minutes = atoi(p); + if (tme) { + hours = atoi(tme); + } + } else { + minutes = atoi(tme); + } + } + free(tme); + } else { + if ((seconds = atol(tosay)) <= 0) { + seconds = (int64_t) switch_epoch_time_now(NULL); + } + + if (seconds >= 60) { + minutes = seconds / 60; + r = seconds % 60; + seconds = r; + } + + if (minutes >= 60) { + hours = minutes / 60; + r = minutes % 60; + minutes = r; + } + } + + say_args->gender = SSG_FEMININE; + + if (hours) { + switch_say_file(sh, "time/hour"); + say_num(sh, hours, SSM_PRONOUNCED); + } else { + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/hours"); + } + + if (minutes) { + if (minutes == 1) { + switch_say_file(sh, "time/minute"); + say_num(sh, minutes, SSM_PRONOUNCED); + } else { + say_num(sh, minutes, SSM_PRONOUNCED); + switch_say_file(sh, "time/minutes"); + } + } else { + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/minutes"); + } + + if (seconds) { + if (seconds == 1) { + switch_say_file(sh, "time/second"); + say_num(sh, seconds, SSM_PRONOUNCED); + } else { + say_num(sh, seconds, SSM_PRONOUNCED); + switch_say_file(sh, "time/seconds"); + } + } else { + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "time/seconds"); + } + + return SWITCH_STATUS_SUCCESS; + } + + if ((t = atol(tosay)) > 0) { + target = switch_time_make(t, 0); + target_now = switch_micro_time_now(); + } else { + target = switch_micro_time_now(); + target_now = switch_micro_time_now(); + } + + if (tz) { + int check = atoi(tz); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); + if (check) { + switch_time_exp_tz(&tm, target, check); + switch_time_exp_tz(&tm_now, target_now, check); + } else { + switch_time_exp_tz_name(tz, &tm, target); + switch_time_exp_tz_name(tz, &tm_now, target_now); + } + } else { + switch_time_exp_lt(&tm, target); + switch_time_exp_lt(&tm_now, target_now); + } + + switch (say_args->type) { + case SST_CURRENT_DATE_TIME: + say_date = say_time = 1; + break; + case SST_CURRENT_DATE: + say_date = 1; + break; + case SST_CURRENT_TIME: + say_time = 1; + break; + case SST_SHORT_DATE_TIME: + say_time = 1; + if (tm.tm_year != tm_now.tm_year) { + say_date = 1; + break; + } + if (tm.tm_yday == tm_now.tm_yday) { + say_today = 1; + break; + } + if (tm.tm_yday == tm_now.tm_yday - 1) { + say_yesterday = 1; + break; + } + if (tm.tm_yday >= tm_now.tm_yday - 5) { + say_dow = 1; + break; + } + if (tm.tm_mon != tm_now.tm_mon) { + say_month = say_day = say_dow = 1; + break; + } + + say_month = say_day = say_dow = 1; + + break; + default: + break; + } + + if (say_today) { + switch_say_file(sh, "time/today"); + } + if (say_yesterday) { + switch_say_file(sh, "time/yesterday"); + } + if (say_dow) { + switch_say_file(sh, "time/day-%d", tm.tm_wday); + } + + if (say_date) { + say_year = say_month = say_day = say_dow = 1; + say_today = say_yesterday = 0; + } + + /* In Hebrew it's costumed to speak the day before the month. */ + if (say_day) { + say_args->gender = SSG_MASCULINE; + say_num(sh, tm.tm_mday, SSM_PRONOUNCED); + } + if (say_month) { + switch_say_file(sh, "time/at"); + switch_say_file(sh, "time/mon-%d", tm.tm_mon); + } + if (say_year) { + say_args->gender = SSG_FEMININE; + say_num(sh, tm.tm_year + 1900, SSM_PRONOUNCED); + } + + if (say_time) { + int32_t hour = tm.tm_hour, pm = 0; + + if (say_date || say_today || say_yesterday || say_dow) { + switch_say_file(sh, "time/at-hour"); + } + else { + switch_say_file(sh, "time/hour"); + } + + if (hour > 12) { + hour -= 12; + pm = 1; + } else if (hour == 12) { + pm = 1; + } else if (hour == 0) { + hour = 12; + pm = 0; + } + + say_args->gender = SSG_FEMININE; + say_num(sh, hour, SSM_PRONOUNCED); + + if (tm.tm_min) { + switch (tm.tm_min) { + case 2: + case 8: + case 12: + case 13: + case 17: + case 18: + case 19: + case 30: + switch_say_file(sh, "digits/uu"); + break; + + case 50: + switch_say_file(sh, "digits/va"); + break; + + default: + switch_say_file(sh, "digits/ve"); + break; + } + + if (tm.tm_min == 1) { + switch_say_file(sh, "time/minute"); + switch_say_file(sh, "digits/1"); + } else { + say_num(sh, tm.tm_min, SSM_PRONOUNCED); + switch_say_file(sh, "time/minutes"); + } + } + + switch_say_file(sh, "time/%s", pm ? "p-m" : "a-m"); + } + + return SWITCH_STATUS_SUCCESS; +} + + +static switch_status_t he_say_money(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) +{ + char sbuf[16] = ""; /* enough for 999,999,999,999.99 (w/o the commas or leading $) */ + char *currency = NULL; + char *cents = NULL; + int icents = 0; + + if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + return SWITCH_STATUS_GENERR; + } + + currency = sbuf; + + if ((cents = strchr(sbuf, '.'))) { + *cents++ = '\0'; + if (strlen(cents) > 2) { + cents[2] = '\0'; + } + } + + /* If positive sign - skip over" */ + if (sbuf[0] == '+') { + ++currency; + } + + /* If negative say "negative" */ + if (sbuf[0] == '-') { + switch_say_file(sh, "currency/negative"); + ++currency; + } + + /* Say shekel amount (Israel currency) */ + switch (atoi(currency)) { + case 1: + switch_say_file(sh, "currency/shekel"); + switch_say_file(sh, "digits/1_m"); + break; + + case 2: + /* In the case of 2, because currency, we need a special case of 2 pronunciation */ + switch_say_file(sh, "digits/shney"); + switch_say_file(sh, "currency/shkalim"); + break; + + default: + say_args->gender = SSG_MASCULINE; + he_say_general_count(sh, currency, say_args); + switch_say_file(sh, "currency/shkalim"); + break; + } + + if (cents) { + /* We need to use the value twice, so speed it up by atoi only once */ + icents = atoi(cents); + + /* Say "and" */ + switch (icents) { + case 2: + case 8: + case 12: + case 13: + case 17: + case 18: + case 19: + case 30: + case 80: + switch_say_file(sh, "digits/uu"); + break; + + case 50: + switch_say_file(sh, "digits/va"); + break; + + default: + switch_say_file(sh, "digits/ve"); + break; + } + + /* Say agorot (Israel currency equivalent for "cents") */ + switch (icents) { + case 0: + switch_say_file(sh, "digits/0"); + switch_say_file(sh, "currency/agorot"); + break; + + case 1: + switch_say_file(sh, "currency/agora"); + switch_say_file(sh, "digits/1"); + break; + + case 2: + /* In the case of 2, because currency, we need a special case of 2 pronunciation */ + switch_say_file(sh, "digits/shtey"); + switch_say_file(sh, "currency/agorot"); + break; + + default: + say_args->gender = SSG_FEMININE; + he_say_general_count(sh, cents, say_args); + switch_say_file(sh, "currency/agorot"); + break; + } + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t say_ip(switch_say_file_handle_t *sh, + char *tosay, + switch_say_args_t *say_args) + +{ + char *a, *b, *c, *d; + switch_status_t status = SWITCH_STATUS_FALSE; + + if (!(a = strdup(tosay))) { + abort(); + } + + if (!(b = strchr(a, '.'))) { + goto end; + } + + *b++ = '\0'; + + if (!(c = strchr(b, '.'))) { + goto end; + } + + *c++ = '\0'; + + if (!(d = strchr(c, '.'))) { + goto end; + } + + *d++ = '\0'; + + say_num(sh, atoi(a), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(b), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(c), say_args->method); + switch_say_file(sh, "digits/dot"); + say_num(sh, atoi(d), say_args->method); + + end: + + free(a); + + return status; +} + +static switch_status_t say_spell(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) +{ + char *p; + + for (p = tosay; p && *p; p++) { + int a = tolower((int) *p); + if (a >= '0' && a <= '9') { + if (a != '0' && say_args->gender == SSG_MASCULINE) { + switch_say_file(sh, "digits/%c_m", a); + } else { + switch_say_file(sh, "digits/%c", a); + } + } else { + if (say_args->type == SST_NAME_SPELLED) { + switch_say_file(sh, "ascii/%d", a); + } else if (say_args->type == SST_NAME_PHONETIC) { + switch_say_file(sh, "phonetic-ascii/%d", a); + } + } + } + + return SWITCH_STATUS_SUCCESS; +} + +static switch_new_say_callback_t choose_callback(switch_say_args_t *say_args) +{ + switch_new_say_callback_t say_cb = NULL; + + switch (say_args->type) { + case SST_NUMBER: + case SST_ITEMS: + case SST_PERSONS: + case SST_MESSAGES: + say_cb = he_say_general_count; + break; + case SST_TIME_MEASUREMENT: + case SST_CURRENT_DATE: + case SST_CURRENT_TIME: + case SST_CURRENT_DATE_TIME: + case SST_SHORT_DATE_TIME: + say_cb = he_say_time; + break; + case SST_IP_ADDRESS: + say_cb = say_ip; + break; + case SST_NAME_SPELLED: + case SST_NAME_PHONETIC: + say_cb = say_spell; + break; + case SST_CURRENCY: + say_cb = he_say_money; + break; + default: + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); + break; + } + + return say_cb; +} + + +static switch_status_t run_callback(switch_new_say_callback_t say_cb, char *tosay, switch_say_args_t *say_args, switch_core_session_t *session, char **rstr) +{ + switch_say_file_handle_t *sh; + switch_status_t status = SWITCH_STATUS_FALSE; + switch_event_t *var_event = NULL; + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_get_variables(channel, &var_event); + } + + switch_say_file_handle_create(&sh, say_args->ext, &var_event); + + status = say_cb(sh, tosay, say_args); + + if ((*rstr = switch_say_file_handle_detach_path(sh))) { + status = SWITCH_STATUS_SUCCESS; + } + + switch_say_file_handle_destroy(&sh); + + return status; +} + + +static switch_status_t he_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + + switch_new_say_callback_t say_cb = NULL; + char *string = NULL; + + switch_status_t status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (session && string) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "** he_say [%s]\n", string); + status = switch_ivr_play_file(session, NULL, string, args); + } + + switch_safe_free(string); + } + + return status; +} + + +static switch_status_t he_say_string(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, char **rstr) +{ + + switch_new_say_callback_t say_cb = NULL; + char *string = NULL; + + switch_status_t status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (string) { + status = SWITCH_STATUS_SUCCESS; + *rstr = string; + } + } + + return status; +} + + +SWITCH_MODULE_LOAD_FUNCTION(mod_say_he_load) +{ + switch_say_interface_t *say_interface; + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); + say_interface->interface_name = "he"; + say_interface->say_function = he_say; + say_interface->say_string_function = he_say_string; + + /* indicate that the module should continue to be loaded */ + return SWITCH_STATUS_SUCCESS; +} + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4: + */ diff --git a/src/mod/say/mod_say_he/mod_say_he.vcproj b/src/mod/say/mod_say_he/mod_say_he.vcproj new file mode 100644 index 0000000000..9195ce6b5f --- /dev/null +++ b/src/mod/say/mod_say_he/mod_say_he.vcproj @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + From 1ddc19994f1752687160b782e7bdcfac91680fdd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 13:07:41 -0500 Subject: [PATCH 237/558] FS-3211 checkin --- conf/lang/he/demo/demo-ivr.xml | 148 ++++++++++++ conf/lang/he/demo/demo.xml | 71 ++++++ conf/lang/he/dir/sounds.xml | 121 ++++++++++ conf/lang/he/he.xml | 7 + conf/lang/he/vm/sounds.xml | 404 +++++++++++++++++++++++++++++++++ 5 files changed, 751 insertions(+) create mode 100644 conf/lang/he/demo/demo-ivr.xml create mode 100644 conf/lang/he/demo/demo.xml create mode 100644 conf/lang/he/dir/sounds.xml create mode 100644 conf/lang/he/he.xml create mode 100644 conf/lang/he/vm/sounds.xml diff --git a/conf/lang/he/demo/demo-ivr.xml b/conf/lang/he/demo/demo-ivr.xml new file mode 100644 index 0000000000..ec7d7bccd2 --- /dev/null +++ b/conf/lang/he/demo/demo-ivr.xml @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/lang/he/demo/demo.xml b/conf/lang/he/demo/demo.xml new file mode 100644 index 0000000000..e3e6f02142 --- /dev/null +++ b/conf/lang/he/demo/demo.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/lang/he/dir/sounds.xml b/conf/lang/he/dir/sounds.xml new file mode 100644 index 0000000000..15ecec304a --- /dev/null +++ b/conf/lang/he/dir/sounds.xml @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/lang/he/he.xml b/conf/lang/he/he.xml new file mode 100644 index 0000000000..006195bf9a --- /dev/null +++ b/conf/lang/he/he.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/conf/lang/he/vm/sounds.xml b/conf/lang/he/vm/sounds.xml new file mode 100644 index 0000000000..5a090411d7 --- /dev/null +++ b/conf/lang/he/vm/sounds.xml @@ -0,0 +1,404 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From e177d377aa0f64e58bc486b1d5e8473c12fd3931 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 13:20:35 -0500 Subject: [PATCH 238/558] FS-3214 try this --- src/mod/endpoints/mod_sofia/sofia.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 12f1b233fc..23f1fd0e88 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4928,7 +4928,11 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, match = sofia_glue_negotiate_sdp(session, r_sdp); } - if (match) { + if (!match) { + if (switch_channel_get_state(channel) != CS_NEW) { + nua_respond(tech_pvt->nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); + } + } else { nua_handle_t *bnh; sip_replaces_t *replaces; su_home_t *home = NULL; @@ -4936,6 +4940,8 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_set_flag_locked(tech_pvt, TFLAG_READY); if (switch_channel_get_state(channel) == CS_NEW) { switch_channel_set_state(channel, CS_INIT); + } else { + nua_respond(tech_pvt->nh, SIP_200_OK, TAG_END()); } sofia_set_flag(tech_pvt, TFLAG_SDP); if (replaces_str) { From 3dcebdb9197cf69c2816de9e608689842218a6e4 Mon Sep 17 00:00:00 2001 From: Konrad Hammel Date: Thu, 31 Mar 2011 16:03:46 -0400 Subject: [PATCH 239/558] freetdm: ss7 - bug fix for starting ckts controlled via Relay --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c | 3 +++ .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c index 4aa2483d22..1dd9717c9f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_cli.c @@ -724,6 +724,9 @@ static ftdm_status_t handle_print_usuage(ftdm_stream_handle_t *stream) stream->write_function(stream, "ftdm ss7 lpo link X\n"); stream->write_function(stream, "ftdm ss7 lpr link X\n"); stream->write_function(stream, "\n"); + stream->write_function(stream, "Ftmod_sangoma_ss7 Relay status:\n"); + stream->write_function(stream, "ftdm ss7 show status relay X\n"); + stream->write_function(stream, "\n"); return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index d61d822ba2..4f8c069b71 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -1387,6 +1387,9 @@ static ftdm_status_t ftdm_sangoma_ss7_start(ftdm_span_t * span) ftdm_clear_flag (span, FTDM_SPAN_STOP_THREAD); ftdm_clear_flag (span, FTDM_SPAN_IN_THREAD); + /* check the status of all isup interfaces */ + check_status_of_all_isup_intf(); + /* throw the channels in pause */ for (x = 1; x < (span->chan_count + 1); x++) { /* extract the channel structure and sngss7 channel data */ From 8b5ecd2faab1c4a4d657b71d087067ab25327230 Mon Sep 17 00:00:00 2001 From: Buklov Boris Date: Fri, 1 Apr 2011 22:53:52 +0400 Subject: [PATCH 240/558] mod_say_ru now support say_string like mod_say_en. Now support channel variables gender,cases can be set in english and russian for example: --- src/mod/say/mod_say_ru/mod_say_ru.c | 449 +++++++++++++++++++--------- src/mod/say/mod_say_ru/mod_say_ru.h | 63 ++-- 2 files changed, 352 insertions(+), 160 deletions(-) diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 9c8db5732e..b1bff61205 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -61,60 +61,50 @@ struct say_t matrix[7][8] = { {m_00, m_01, m_02, m_03, m_04, m_05, m_06, m_07}, SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load); SWITCH_MODULE_DEFINITION(mod_say_ru, mod_say_ru_load, NULL, NULL); -#define say_file(...) {\ - char tmp[80];\ - switch_status_t tstatus;\ - switch_snprintf(tmp, sizeof(tmp), __VA_ARGS__);\ - if ((tstatus = switch_ivr_play_file(session, NULL, tmp, args)) != SWITCH_STATUS_SUCCESS){ \ - return tstatus;\ - }\ - if (!switch_channel_ready(switch_core_session_get_channel(session))) {\ - return SWITCH_STATUS_FALSE;\ - }} -static switch_status_t play_group(say_type_t say_type, casus_t casus, int a, int b, int c, - unit_t what, switch_core_session_t *session, switch_input_args_t *args) +static switch_status_t play_group(say_gender_t gender, cases_t cases, int a, int b, int c, unit_t what, switch_say_file_handle_t *sh) { +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play_group ! %d%d%d gender=%d causes=%d\n",a,b,c,gender,cases); if (a) { - if (((b == 0) && (c == 0)) || (matrix[casus][say_type].all == 1)) { //еÑли b и Ñ Ñ€Ð°Ð²Ð½Ñ‹ 0 то Ñказать шеÑтьÑот, ÑеÑтиÑотый, шеÑтиÑÐ¾Ñ‚Ð°Ñ + if (((b == 0) && (c == 0)) || (matrix[cases][gender].all == 1)) { //еÑли b и Ñ Ñ€Ð°Ð²Ð½Ñ‹ 0 то Ñказать шеÑтьÑот, ÑеÑтиÑотый, шеÑтиÑÐ¾Ñ‚Ð°Ñ if (what == million) { //Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ Ñ‡Ð¸Ñло окончание - say_file("digits/%s%d00%s.wav", matrix[casus][say_type].million[12], a, matrix[casus][say_type].million[13]); - say_file("digits/%s.wav", matrix[casus][say_type].million[11]); + switch_say_file(sh, "digits/%s%d00%s", matrix[cases][gender].million[12], a, matrix[cases][gender].million[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].million[11]); } else if (what == thousand) { - say_file("digits/%s%d00%s.wav", matrix[casus][say_type].thousand[12], a, matrix[casus][say_type].thousand[13]); - say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]); + switch_say_file(sh, "digits/%s%d00%s", matrix[cases][gender].thousand[12], a, matrix[cases][gender].thousand[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].thousand[11]); } else { - say_file("digits/%s%d00%s.wav", matrix[casus][say_type].num[6], a, matrix[casus][say_type].num[7]); + switch_say_file(sh, "digits/%s%d00%s", matrix[cases][gender].num[6], a, matrix[cases][gender].num[7]); } } else { //еÑли дальше еÑть цифры то тыÑÑчи и миллионы не прозноÑить пока - say_file("digits/%d00.wav", a); + switch_say_file(sh, "digits/%d00", a); } } if (b) { if (b > 1) { //еÑли 20 и больше - if ((c == 0) || (matrix[casus][say_type].all == 1)) { //еÑли Ñ Ñ€Ð°Ð²Ð½Ñ‹ 0 то Ñказать 20, двадцати, Ð´Ð²Ð°Ð´Ñ†Ð°Ñ‚Ð°Ñ + if ((c == 0) || (matrix[cases][gender].all == 1)) { //еÑли Ñ Ñ€Ð°Ð²Ð½Ñ‹ 0 то Ñказать 20, двадцати, Ð´Ð²Ð°Ð´Ñ†Ð°Ñ‚Ð°Ñ if (what == million) { //Ð¿Ñ€ÐµÑ„Ð¸ÐºÑ Ñ‡Ð¸Ñло окончание - say_file("digits/%s%d0%s.wav", matrix[casus][say_type].million[12], b, matrix[casus][say_type].million[13]); - say_file("digits/%s.wav", matrix[casus][say_type].million[11]); + switch_say_file(sh, "digits/%s%d0%s", matrix[cases][gender].million[12], b, matrix[cases][gender].million[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].million[11]); } else if (what == thousand) { - say_file("digits/%s%d0%s.wav", matrix[casus][say_type].thousand[12], b, matrix[casus][say_type].thousand[13]); - say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]); + switch_say_file(sh, "digits/%s%d0%s", matrix[cases][gender].thousand[12], b, matrix[cases][gender].thousand[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].thousand[11]); } else { - say_file("digits/%s%d0%s.wav", matrix[casus][say_type].num[6], b, matrix[casus][say_type].num[7]); + switch_say_file(sh, "digits/%s%d0%s", matrix[cases][gender].num[6], b, matrix[cases][gender].num[7]); } } else { //еÑли еÑть дальше цифры - say_file("digits/%d0.wav", b); + switch_say_file(sh, "digits/%d0", b); } } else { //от 10 до 19 if (what == million) { - say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].million[12], b, c, matrix[casus][say_type].million[13]); - say_file("digits/%s.wav", matrix[casus][say_type].million[11]); + switch_say_file(sh, "digits/%s%d%d%s", matrix[cases][gender].million[12], b, c, matrix[cases][gender].million[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].million[11]); } else if (what == thousand) { - say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].thousand[12], b, c, matrix[casus][say_type].thousand[13]); - say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]); + switch_say_file(sh, "digits/%s%d%d%s", matrix[cases][gender].thousand[12], b, c, matrix[cases][gender].thousand[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].thousand[11]); } else { //проÑто произнеÑти цифры Ñ Ð¿Ñ€ÐµÑ„Ð¸ÐºÑом и окончанием - say_file("digits/%s%d%d%s.wav", matrix[casus][say_type].num[6], b, c, matrix[casus][say_type].num[7]); + switch_say_file(sh, "digits/%s%d%d%s", matrix[cases][gender].num[6], b, c, matrix[cases][gender].num[7]); } c = 0; } @@ -123,28 +113,28 @@ static switch_status_t play_group(say_type_t say_type, casus_t casus, int a, int if (c || what == zero) { if (c <= 5) { if (what == million) { - if ((strlen(matrix[casus][say_type].million[c * 2])) > 0) { // не произноÑить еÑли не заданно например 1 миллион а проÑто миллион - say_file("digits/%s.wav", matrix[casus][say_type].million[c * 2]) + if ((strlen(matrix[cases][gender].million[c * 2])) > 0) { // не произноÑить еÑли не заданно например 1 миллион а проÑто миллион + switch_say_file(sh, "digits/%s", matrix[cases][gender].million[c * 2]); } - say_file("digits/%s.wav", matrix[casus][say_type].million[c * 2 + 1]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].million[c * 2 + 1]); } else if (what == thousand) { - if ((strlen(matrix[casus][say_type].thousand[c * 2])) > 0) { // не произноÑить еÑли не заданно например одна тыÑÑÑ‡Ð°Ñ Ð° проÑто тыÑÑча - say_file("digits/%s.wav", matrix[casus][say_type].thousand[c * 2]) + if ((strlen(matrix[cases][gender].thousand[c * 2])) > 0) { // не произноÑить еÑли не заданно например одна тыÑÑÑ‡Ð°Ñ Ð° проÑто тыÑÑча + switch_say_file(sh, "digits/%s", matrix[cases][gender].thousand[c * 2]); } - say_file("digits/%s.wav", matrix[casus][say_type].thousand[c * 2 + 1]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].thousand[c * 2 + 1]); } else { //проÑто произнеÑти цифры Ñ Ð¿Ñ€ÐµÑ„Ð¸ÐºÑом и окончанием - say_file("digits/%s.wav", matrix[casus][say_type].num[c]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].num[c]); } } else { /* больше 5 */ if (what == million) { - say_file("digits/%s%d%s.wav", matrix[casus][say_type].million[12], c, matrix[casus][say_type].million[13]); - say_file("digits/%s.wav", matrix[casus][say_type].million[11]); + switch_say_file(sh, "digits/%s%d%s", matrix[cases][gender].million[12], c, matrix[cases][gender].million[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].million[11]); } else if (what == thousand) { - say_file("digits/%s%d%s.wav", matrix[casus][say_type].thousand[12], c, matrix[casus][say_type].thousand[13]); - say_file("digits/%s.wav", matrix[casus][say_type].thousand[11]); + switch_say_file(sh, "digits/%s%d%s", matrix[cases][gender].thousand[12], c, matrix[cases][gender].thousand[13]); + switch_say_file(sh, "digits/%s", matrix[cases][gender].thousand[11]); } else { //проÑто произнеÑти цифры Ñ Ð¿Ñ€ÐµÑ„Ð¸ÐºÑом и окончанием - say_file("digits/%s%d%s.wav", matrix[casus][say_type].num[6], c, matrix[casus][say_type].num[7]); + switch_say_file(sh, "digits/%s%d%s", matrix[cases][gender].num[6], c, matrix[cases][gender].num[7]); } } } @@ -152,20 +142,20 @@ static switch_status_t play_group(say_type_t say_type, casus_t casus, int a, int } -static switch_status_t ru_say_count(switch_core_session_t *session, char *tosay, say_type_t say_type, casus_t casus, switch_input_args_t *args) +static switch_status_t ru_say_count(switch_say_file_handle_t *sh, char *tosay, say_gender_t gender, cases_t cases) { int in; int x = 0; int places[9] = { 0 }; - char sbuf[128] = ""; + char sbuf[13] = ""; int in_; switch_status_t status; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say_count %s!\n", tosay); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say_count %s! gender=%d causes=%d\n", tosay,gender,cases); if (!(tosay = switch_strip_commas(tosay, sbuf, sizeof(sbuf)-1)) || strlen(tosay) > 9) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } @@ -182,44 +172,40 @@ static switch_status_t ru_say_count(switch_core_session_t *session, char *tosay, //миллионы if (places[8] || places[7] || places[6]) { - if ((in_ % 1000000 > 0) && (matrix[casus][say_type].all != 1)) { // еÑли поле миллионов еÑть цифры поизнеÑти как чиÑлительое именительного падежа - if ((status = play_group(male_c, nominativus, places[8], places[7], places[6], million, session, args)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6], - status); + if ((in_ % 1000000 > 0) && (matrix[cases][gender].all != 1)) { // еÑли поле миллионов еÑть цифры поизнеÑти как чиÑлительое именительного падежа + if ((status = play_group(male, nominativus, places[8], places[7], places[6], million, sh)) != SWITCH_STATUS_SUCCESS) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6], status); return status; } } else { // иначе произнеÑти в нужном падеже - if ((status = play_group(say_type, casus, places[8], places[7], places[6], million, session, args)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6], - status); + if ((status = play_group(gender, cases, places[8], places[7], places[6], million, sh)) != SWITCH_STATUS_SUCCESS) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d million! status=%d\n", places[8], places[7], places[6], status); return status; } } } //тыÑÑчи if (places[5] || places[4] || places[3]) { - if ((in_ % 1000 > 0) && (matrix[casus][say_type].all != 1)) { // еÑли поле миллионов еÑть цифры поизнеÑти как чиÑлительое именительного падежа - if ((status = play_group(male_c, nominativus, places[5], places[4], places[3], thousand, session, args)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3], - status); + if ((in_ % 1000 > 0) && (matrix[cases][gender].all != 1)) { // еÑли поле миллионов еÑть цифры поизнеÑти как чиÑлительое именительного падежа + if ((status = play_group(male, nominativus, places[5], places[4], places[3], thousand, sh)) != SWITCH_STATUS_SUCCESS) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3], status); return status; } } else { // иначе произнеÑти в нужном падеже - if ((status = play_group(say_type, casus, places[5], places[4], places[3], thousand, session, args)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3], - status); + if ((status = play_group(gender, cases, places[5], places[4], places[3], thousand, sh)) != SWITCH_STATUS_SUCCESS) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3], status); return status; } } } // Ñотни - if ((status = play_group(say_type, casus, places[2], places[1], places[0], empty, session, args)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3], status); + if ((status = play_group(gender, cases, places[2], places[1], places[0], empty, sh)) != SWITCH_STATUS_SUCCESS) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d thousand! status=%d\n", places[5], places[4], places[3], status); return status; } } else { - if ((status = play_group(say_type, casus, places[2], places[1], places[0], zero, session, args)) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d other!\n", places[2], places[1], places[0]); + if ((status = play_group(gender, cases, places[2], places[1], places[0], zero, sh)) != SWITCH_STATUS_SUCCESS) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "play group %d %d %d other!\n", places[2], places[1], places[0]); return status; } } @@ -228,28 +214,37 @@ static switch_status_t ru_say_count(switch_core_session_t *session, char *tosay, } //допиÑать -static switch_status_t ru_say_general_count(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t ru_say_general_count(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt) { switch_status_t status; - casus_t casus; //падеж - say_type_t say_type; //тип Ð¿Ñ€Ð¾Ð¸Ð·Ð½Ð¾ÑˆÐµÐ½Ð¸Ñ + cases_t cases; //падеж + say_gender_t gender; //тип Ð¿Ñ€Ð¾Ð¸Ð·Ð½Ð¾ÑˆÐµÐ½Ð¸Ñ switch (say_args->type) { case SST_MESSAGES: - say_type = it_c; - casus = nominativus; + gender = it; + cases = nominativus; break; default: - say_type = male_c; - casus = nominativus; + gender = male; + cases = nominativus; + if (say_opt->gender>0) { + gender=say_opt->gender; +// //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " opt_gender=%d type=%d cases=%d\n", gender, cases,say_opt->gender); + } + if (say_opt->cases>0) { + cases=say_opt->cases; +// //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " opt_gender=%d type=%d cases=%d\n", gender, cases,say_opt->gender); + + } break; }; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " type=%d casus=%d\n", say_type, casus); - status = ru_say_count(session, tosay, say_type, casus, args); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " opt_gender=%d type=%d cases=%d\n", gender, cases,say_opt->gender); + status = ru_say_count(sh, tosay, (say_gender_t)gender, (cases_t)cases); return status; } -static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt) { char sbuf[16] = ""; char *rubles = NULL; @@ -259,10 +254,10 @@ static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, int ikopecks = 0; int ikopeck = 0; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n", tosay); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n", tosay); if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; } @@ -279,11 +274,11 @@ static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, } if (sbuf[0] == '-') { - say_file("currency/minus.wav"); + switch_say_file(sh, "currency/minus"); rubles++; } - ru_say_count(session, rubles, male_c, nominativus, args); + ru_say_count(sh, rubles, male, nominativus); if (rubles) { irubles = atoi(rubles) % 100; @@ -291,16 +286,16 @@ static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, } if (irubles == 1 || (irubles > 20 && iruble == 1)) { /* рубль */ - say_file("currency/ruble.wav"); + switch_say_file(sh, "currency/ruble"); } else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5)) { /*Ñ€ÑƒÐ±Ð»Ñ */ - say_file("currency/ruble-a.wav"); + switch_say_file(sh, "currency/ruble-a"); } else { /*рублей */ - say_file("currency/rubles.wav"); + switch_say_file(sh, "currency/rubles"); } /* Say kopecks */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n", kopecks); - ru_say_count(session, kopecks, female_c, nominativus, args); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n", kopecks); + ru_say_count(sh, kopecks, female, nominativus); if (kopecks) { ikopecks = atoi(kopecks) % 100; @@ -309,28 +304,28 @@ static switch_status_t ru_say_money(switch_core_session_t *session, char *tosay, if (ikopecks == 1 || (ikopecks > 20 && ikopeck == 1)) { /* копейка */ - say_file("currency/kopeck.wav"); + switch_say_file(sh, "currency/kopeck"); } else if ((ikopecks > 1 && ikopecks < 5) || (ikopecks > 20 && ikopeck > 1 && ikopeck < 5)) { /* копейки */ - say_file("currency/kopeck-i.wav"); + switch_say_file(sh, "currency/kopeck-i"); } else { /* копеек */ - say_file("currency/kopecks.wav"); + switch_say_file(sh, "currency/kopecks"); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t ru_say_time(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt) { int32_t t; char buf[80]; switch_time_t target = 0, target_now = 0; switch_time_exp_t tm, tm_now; uint8_t say_date = 0, say_time = 0, say_year = 0, say_month = 0, say_dow = 0, say_day = 0, say_yesterday = 0, say_today = 0; - switch_channel_t *channel = switch_core_session_get_channel(session); - const char *tz = switch_channel_get_variable(channel, "timezone"); + const char *tz = NULL; + tz = switch_say_file_handle_get_variable(sh, "timezone"); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s type=%d method=%d\n", tosay, say_args->type, say_args->method); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_time %s type=%d method=%d\n", tosay, say_args->type, say_args->method); if (say_args->type == SST_TIME_MEASUREMENT) { int64_t hours = 0; @@ -339,7 +334,7 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, int64_t r = 0; if (strchr(tosay, ':')) { - char *tme = switch_core_session_strdup(session, tosay); + char *tme = strdup(tosay); char *p; if ((p = strrchr(tme, ':'))) { @@ -355,6 +350,7 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, minutes = atoi(tme); } } + free(tme); } else { if ((seconds = atol(tosay)) <= 0) { seconds = (int64_t) switch_epoch_time_now(NULL); @@ -373,37 +369,37 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, } switch_snprintf(buf, sizeof(buf), "%u", (unsigned) hours); - ru_say_count(session, buf, male_c, nominativus, args); + ru_say_count(sh, buf, male, nominativus); if (((hours % 10) == 1) && (hours != 11)) { /* Ñ‡Ð°Ñ */ - say_file("time/hour.wav"); + switch_say_file(sh, "time/hour"); } else if (((hours % 10 > 1) && (hours % 10 < 5)) && ((hours < 12) || (hours > 14))) { - say_file("time/hours-a.wav"); /* чаÑа */ + switch_say_file(sh, "time/hours-a"); /* чаÑа */ } else { - say_file("time/hours.wav"); /* чаÑов */ + switch_say_file(sh, "time/hours"); /* чаÑов */ } switch_snprintf(buf, sizeof(buf), "%u", (unsigned) minutes); //перевеÑти минуты в *char - ru_say_count(session, buf, female_c, nominativus, args); + ru_say_count(sh, buf, female, nominativus); if (((minutes % 10) == 1) && (minutes != 11)) { - say_file("time/minute.wav"); //минута + switch_say_file(sh, "time/minute"); //минута } else if (((minutes % 10 > 1) && (minutes % 10 < 5)) && ((minutes < 12) || (minutes > 14))) { - say_file("time/minutes-i.wav"); // минуты + switch_say_file(sh, "time/minutes-i"); // минуты } else { - say_file("time/minutes.wav"); //минут + switch_say_file(sh, "time/minutes"); //минут } if (seconds != 0) { switch_snprintf(buf, sizeof(buf), "%u", (unsigned) seconds); - ru_say_count(session, buf, female_c, nominativus, args); + ru_say_count(sh, buf, female, nominativus); if (((seconds % 10) == 1) && (seconds != 11)) { - say_file("time/second.wav"); // Ñекунда + switch_say_file(sh, "time/second"); // Ñекунда } else if (((seconds % 10 > 1) && (seconds % 10 < 5)) && ((seconds < 12) || (seconds > 14))) { - say_file("time/seconds-i.wav"); // Ñекуны + switch_say_file(sh, "time/seconds-i"); // Ñекуны } else { - say_file("time/seconds.wav"); //Ñекунд + switch_say_file(sh, "time/seconds"); //Ñекунд } } return SWITCH_STATUS_SUCCESS; @@ -419,6 +415,7 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, if (tz) { int check = atoi(tz); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Timezone is [%s]\n", tz); if (check) { switch_time_exp_tz(&tm, target, check); switch_time_exp_tz(&tm_now, target_now, check); @@ -472,13 +469,13 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, } if (say_today) { - say_file("time/today.wav"); + switch_say_file(sh, "time/today"); } if (say_yesterday) { - say_file("time/yesterday.wav"); + switch_say_file(sh, "time/yesterday"); } if (say_dow) { - say_file("time/day-%d.wav", tm.tm_wday); + switch_say_file(sh, "time/day-%d", tm.tm_wday); } if (say_date) { say_year = say_month = say_day = say_dow = 1; @@ -486,74 +483,103 @@ static switch_status_t ru_say_time(switch_core_session_t *session, char *tosay, } if (say_day) { switch_snprintf(buf, sizeof(buf), "%u", (unsigned) tm.tm_mday); - ru_say_count(session, buf, male_h, genitivus, args); + ru_say_count(sh, buf, male_h, genitivus); } if (say_month) { - say_file("time/mon-%d.wav", tm.tm_mon); + switch_say_file(sh, "time/mon-%d", tm.tm_mon); } if (say_year) { switch_snprintf(buf, sizeof(buf), "%u", (unsigned) (tm.tm_year + 1900)); - ru_say_count(session, buf, male_h, genitivus, args); - say_file("time/h-year.wav"); + ru_say_count(sh, buf, male_h, genitivus); + switch_say_file(sh, "time/h-year"); } if (say_time) { if (say_month || say_year || say_date || say_dow) { - say_file("time/at.wav"); + switch_say_file(sh, "time/at"); } switch_snprintf(buf, sizeof(buf), "%d:%d:%d", tm.tm_hour, tm.tm_min, tm.tm_sec); say_args->type = SST_TIME_MEASUREMENT; - ru_say_time(session, buf, say_args, args); + ru_say_time(sh, buf, say_args,say_opt); } return SWITCH_STATUS_SUCCESS; } -static switch_status_t ru_ip(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +static switch_status_t ru_ip(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt) { char *a, *b, *c, *d; - if (!(a = switch_core_session_strdup(session, tosay))) { - return SWITCH_STATUS_FALSE; + switch_status_t status = SWITCH_STATUS_FALSE; + if (!(a = strdup(tosay))) { + abort(); +// return SWITCH_STATUS_FALSE; } if (!(b = strchr(a, '.'))) { - return SWITCH_STATUS_FALSE; + goto end; } *b++ = '\0'; if (!(c = strchr(b, '.'))) { - return SWITCH_STATUS_FALSE; + goto end; } *c++ = '\0'; if (!(d = strchr(c, '.'))) { - return SWITCH_STATUS_FALSE; + goto end; } *d++ = '\0'; - ru_say_count(session, a, male_c, nominativus, args); - say_file("digits/dot.wav"); + ru_say_count(sh, a, male, nominativus); + switch_say_file(sh, "digits/dot"); - ru_say_count(session, b, male_c, nominativus, args); - say_file("digits/dot.wav"); + ru_say_count(sh, b, male, nominativus); + switch_say_file(sh, "digits/dot"); - ru_say_count(session, c, male_c, nominativus, args); - say_file("digits/dot.wav"); + ru_say_count(sh, c, male, nominativus); + switch_say_file(sh, "digits/dot"); - ru_say_count(session, d, male_c, nominativus, args); - return SWITCH_STATUS_SUCCESS; + ru_say_count(sh, d, male, nominativus); +end: + free(a); + return status; } -static switch_status_t ru_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) -{ - switch_say_callback_t say_cb = NULL; +static switch_status_t ru_say_spell(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt) +{ + char *p; + + for (p = tosay; p && *p; p++) { + int a = tolower((int) *p); + if (a >= '0' && a <= '9') { + switch_say_file(sh, "digits/%c", a); + } else { + if (say_args->type == SST_NAME_SPELLED) { + switch_say_file(sh, "ascii/%d", a); + } else if (say_args->type == SST_NAME_PHONETIC) { + switch_say_file(sh, "phonetic-ascii/%d", a); + } + } + } + + return SWITCH_STATUS_SUCCESS; +} + + + + +static switch_new_say_callback_ru_t choose_callback(switch_say_args_t *say_args) +{ + + switch_new_say_callback_ru_t say_cb = NULL; switch (say_args->type) { case SST_NUMBER: case SST_ITEMS: case SST_PERSONS: case SST_MESSAGES: + say_cb = ru_say_general_count; break; case SST_TIME_MEASUREMENT: @@ -576,23 +602,171 @@ static switch_status_t ru_say(switch_core_session_t *session, char *tosay, switc break; case SST_NAME_SPELLED: case SST_NAME_PHONETIC: - return switch_ivr_say_spell(session, tosay, say_args, args); + say_cb = ru_say_spell; break; case SST_CURRENCY: say_cb = ru_say_money; break; default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); break; } - if (say_cb) { - return say_cb(session, tosay, say_args, args); - } - - return SWITCH_STATUS_FALSE; + return say_cb; } + + + + +static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *tosay, switch_say_args_t *say_args, switch_core_session_t *session, char **rstr) +{ + switch_say_file_handle_t *sh; + switch_status_t status = SWITCH_STATUS_FALSE; + switch_event_t *var_event = NULL; + const char *cases=NULL; + const char *gender=NULL; + const char *currency=NULL; + say_opt_t say_opt; + + if (session) { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_channel_get_variables(channel, &var_event); +// проверÑем не заданы ли канальные переменные род, падеж, валюта + gender = switch_channel_get_variable(channel, "gender"); + cases = switch_channel_get_variable(channel, "cases"); + currency = switch_channel_get_variable(channel, "currency"); + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s %s %s !\n",gender, cases,currency); + if (cases) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", cases); + + if ((strcmp(cases,"nominativus")==0) || (strcmp(cases,"именительный")==0)) { + say_opt.cases=(cases_t)0; + } + if ((strcmp(cases,"genitivus")==0) || (strcmp(cases,"родительный")==0)) { + say_opt.cases=(cases_t)1; + } + if ((strcmp(cases,"dativus")==0) || (strcmp(cases,"дательный")==0)) { + say_opt.cases=(cases_t)2; + } + if ((strcmp(cases,"accusativus_a")==0) || (strcmp(cases,"винительный_о")==0)) { + say_opt.cases=(cases_t)3; + } + if ((strcmp(cases,"accusativus_i")==0) || (strcmp(cases,"винительный_н")==0)) { + say_opt.cases=(cases_t)4; + } + if ((strcmp(cases,"instrumentalis")==0) || (strcmp(cases,"творительный")==0)) { + say_opt.cases=(cases_t)5; + } + if ((strcmp(cases,"prepositive")==0) || (strcmp(cases,"предложный")==0)) { + say_opt.cases=(cases_t)6; + } + } + if (gender) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", gender); + + if ((strcmp(gender,"male")==0) || (strcmp(gender,"мужÑкой")==0)) { + say_opt.gender=(say_gender_t)0; + } + if ((strcmp(gender,"it")==0) || (strcmp(gender,"Ñредний")==0)) { + say_opt.gender=(say_gender_t)1; + } + if ((strcmp(gender,"female")==0) || (strcmp(gender,"женÑкий")==0)) { + say_opt.gender=(say_gender_t)2; + } + if ((strcmp(gender,"plural")==0) || (strcmp(gender,"множеÑтвенное")==0)) { + say_opt.gender=(say_gender_t)3; + } + if ((strcmp(gender,"male_h")==0) || (strcmp(gender,"мужÑкой_порÑдковый")==0)) { + say_opt.gender=(say_gender_t)4; + } + if ((strcmp(gender,"it_h")==0) || (strcmp(gender,"Ñредний_порÑдковый")==0)) { + say_opt.gender=(say_gender_t)5; + } + if ((strcmp(gender,"female_h")==0) || (strcmp(gender,"женÑкий_порÑдковый")==0)) { + say_opt.gender=(say_gender_t)6; + } + if ((strcmp(gender,"plural_h")==0) || (strcmp(gender,"множеÑтвенное_порÑдковый")==0)) { + say_opt.gender=(say_gender_t)7; + } + + } + if (currency) { + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", currency); + + if (strcmp(currency,"rubl") || strcmp(currency,"рубль")) { + say_opt.currency=(currency_t)0; + } + if (strcmp(gender,"dollar") || strcmp(gender,"доллар")) { + say_opt.currency=(currency_t)1; + } + } + //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s! say_opt.gender=%d say_opt.cases=%d\n", tosay,say_opt.gender,say_opt.cases); + + } + switch_say_file_handle_create(&sh, say_args->ext, &var_event); +//запуÑк ru_ip,ru_say_money ... + status = say_cb(sh, tosay, say_args,&say_opt); + + if ((*rstr = switch_say_file_handle_detach_path(sh))) { + status = SWITCH_STATUS_SUCCESS; + } + + switch_say_file_handle_destroy(&sh); + + return status; +} + + + +static switch_status_t ru_say(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, switch_input_args_t *args) +{ + + switch_new_say_callback_ru_t say_cb = NULL; + char *string = NULL; + switch_status_t status; + + status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (session && string) { + status = switch_ivr_play_file(session, NULL, string, args); + } + + switch_safe_free(string); + } + + return status; +} + + + +static switch_status_t ru_say_string(switch_core_session_t *session, char *tosay, switch_say_args_t *say_args, char **rstr) +{ + + switch_new_say_callback_ru_t say_cb = NULL; + char *string = NULL; + + switch_status_t status = SWITCH_STATUS_FALSE; + + say_cb = choose_callback(say_args); + + if (say_cb) { + status = run_callback(say_cb, tosay, say_args, session, &string); + if (string) { + status = SWITCH_STATUS_SUCCESS; + *rstr = string; + } + } + + return status; +} + + + SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load) { switch_say_interface_t *say_interface; @@ -601,6 +775,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load) say_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_SAY_INTERFACE); say_interface->interface_name = "ru"; say_interface->say_function = ru_say; + say_interface->say_string_function = ru_say_string; /* indicate that the module should continue to be loaded */ return SWITCH_STATUS_SUCCESS; diff --git a/src/mod/say/mod_say_ru/mod_say_ru.h b/src/mod/say/mod_say_ru/mod_say_ru.h index 3c460126d3..d7769ad246 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.h +++ b/src/mod/say/mod_say_ru/mod_say_ru.h @@ -12,6 +12,8 @@ //http://ru.wiktionary.org/wiki/%D0%BE%D0%B4%D0%B8%D0%BD //http://ru.wiktionary.org/wiki/%D0%BF%D0%B5%D1%80%D0%B2%D1%8B%D0%B9 + + typedef enum { million, thousand, @@ -22,29 +24,41 @@ typedef enum { //тип чиÑла порÑдковое или количеÑтвенное typedef enum { nominativus, // именительный Кто? Что? - genitivus, // Родительный Кого? Чего? - dativus, // дательный Кого? Что? + genitivus, // Родительный Кого? Чего? + dativus, // дательный Кого? Что? accusativus_a, // Винительный Кого? animate - одушевлённый accusativus_i, // Винительный Что? inanimate - неодушевлённый instrumentalis, // Творительный Кем? Чем? - prepositive // Предложный О ком? О чём? -} casus_t; + prepositive // Предложный О ком? О чём? +} cases_t; typedef enum { //количеÑтвенный - male_c, //мужÑкого пола - it_c, //Ñреднего - female_c, //женÑкого - plural_c, //множеÑтвенное чиÑло + male, //мужÑкого пола + it, //Ñреднего + female, //женÑкого + plural, //множеÑтвенное чиÑло //порÑдковый - male_h, //порÑдковое мужÑкого пола - it_h, //порÑдковое Ñреднего - female_h, //порÑдковое женÑкого - plural_h //порÑдковое множеÑтвенное чиÑло -} say_type_t; + male_h, //порÑдковое мужÑкого пола + it_h, //порÑдковое Ñреднего + female_h, //порÑдковое женÑкого + plural_h //порÑдковое множеÑтвенное чиÑло +} say_gender_t; +typedef enum { + ruble, + dollar +} currency_t; + + +typedef struct { + say_gender_t gender; + cases_t cases; + currency_t currency; +} say_opt_t; + struct say_t { char *num[8]; @@ -53,6 +67,7 @@ struct say_t { int all; }; +typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt); //именительный //именительный количеÑтвенный/чиÑлительное @@ -60,7 +75,7 @@ struct say_t { //мужÑкой род родительный падеж //Ð¿ÐµÑ€Ð²Ð°Ñ Ñтрока опиÑывае как произноÑить цифры от 0 до 5 потом приÑтаÑтавка и Ð¾ÐºÐ¾Ð½Ñ‡Ð°Ð½Ð¸Ñ Ð´Ð»Ñ Ð¾Ñтальных -// тоже Ñамое Ð´Ð»Ñ Ñ‚Ñ‹ÑÑч и миллионов, только ещё Ñ Ð¿Ñ€Ð¾Ð¸Ð·Ð½Ð¾ÑˆÐµÐ½Ð¸ÐµÐ¼ тыÑÑч и миллионов в вонце так же окончание Ð´Ð»Ñ Ñ†Ð¸Ñ„Ñ€ +// тоже Ñамое Ð´Ð»Ñ Ñ‚Ñ‹ÑÑч и миллионов, только ещё Ñ Ð¿Ñ€Ð¾Ð¸Ð·Ð½Ð¾ÑˆÐµÐ½Ð¸ÐµÐ¼ тыÑÑч и миллионов в конце так же окончание Ð´Ð»Ñ Ñ†Ð¸Ñ„Ñ€ // как произноÑить тыÑÑчи и миллионы берёт Ñ Ñ†Ð¸Ñ„Ñ€Ñ‹ 5 #define m_00 {\ @@ -96,23 +111,25 @@ struct say_t { //порÑдковый //мужÑкой #define m_04 {\ - {"","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ + {"h-0m","h-1m","h-2m","h-3m","h-4m","h-5m","h-","m"},\ + {"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\ + {"","","","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\ 0,\ }\ //Ñредний + #define m_05 {\ - {"","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ + {"0","1n","2","3","4","5","",""},\ + {"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\ + {"","","","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\ 0,\ }\ + //женÑкий #define m_06 {\ - {"","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ - {"","","","","","","","","","","","","",""},\ + {"h-0f","h-1f","h-2f","h-3f","h-4f","h-5f","h-","f"},\ + {"","","1f","thousand","2f","thousands-i","3","thousands-i","4","thousands-i","5","thousands","",""},\ + {"","","1","million","2","million-a","3","million-a","4","million-a","5","millions","",""},\ 0,\ }\ From 0630c54c0c311269372af4ead1e82c3cebd85cb6 Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Fri, 1 Apr 2011 21:26:33 +0200 Subject: [PATCH 241/558] added FS-3211 changes to freeswitch.spec --- freeswitch.spec | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index 45e2daec7f..aa00292f28 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -283,19 +283,26 @@ Group: System/LibrariesRequires: %{name} = %{version}-%{release} Russian language phrases module and directory structure for say module and voicemail %package lang-fr -Summary: Provides french language dependand modules and speech config for the FreeSWITCH Open Source telephone platform. +Summary: Provides french language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. Group: System/LibrariesRequires: %{name} = %{version}-%{release} %description lang-fr French language phrases module and directory structure for say module and voicemail %package lang-de -Summary: Provides german language dependand modules and speech config for the FreeSWITCH Open Source telephone platform. +Summary: Provides german language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. Group: System/LibrariesRequires: %{name} = %{version}-%{release} %description lang-de German language phrases module and directory structure for say module and voicemail +%package lang-he +Summary: Provides hebrew language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. +Group: System/LibrariesRequires: %{name} = %{version}-%{release} + +%description lang-he +Hebrew language phrases module and directory structure for say module and voicemail + %package freetdm Summary: Provides a unified interface to hardware TDM cards and ss7 stacks for FreeSWITCH @@ -499,7 +506,7 @@ PASSTHRU_CODEC_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_g723_1 codecs # Phrase engine language modules # ###################################################################################################################### -SAY_MODULES="say/mod_say_de say/mod_say_en say/mod_say_fr say/mod_say_ru" +SAY_MODULES="say/mod_say_de say/mod_say_en say/mod_say_fr say/mod_say_hu say/mod_say_ru" ###################################################################################################################### # # Timers @@ -1091,12 +1098,25 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/dir/*.xml %{prefix}/mod/mod_say_ru.so* +%files lang-he +%defattr(-, freeswitch, daemon) +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/he/ +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/he/demo +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/he/vm +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/he/*.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/he/demo/*.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/he/vm/*.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/he/dir/*.xml +%{prefix}/mod/mod_say_he.so* + ###################################################################################################################### # # Changelog # ###################################################################################################################### %changelog +* Fri Apr 01 2011 - michal.bielicki@seventhsignal.de +- added hebrew language stuff * Wed Mar 30 2011 - michal.bielicki@seventhsignal.de - removed mod_file_string since it has been merged into dptools * Wed Feb 16 2011 - michal.bielicki@seventhsignal.de From 8c5586b2bc45b9aeed540321b106740b705c32c1 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 14:22:36 -0500 Subject: [PATCH 242/558] add option for from-domain to be set to auto-aleg in gateway config --- src/mod/endpoints/mod_sofia/mod_sofia.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 4723618fa8..507dcadd8d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -3980,6 +3980,7 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session const char *hval = NULL; char *not_const = NULL; int cid_locked = 0; + switch_channel_t *o_channel = NULL; *new_session = NULL; @@ -4008,6 +4009,11 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session nchannel = switch_core_session_get_channel(nsession); + if (session) { + o_channel = switch_core_session_get_channel(session); + } + + if ((hval = switch_event_get_header(var_event, "sip_invite_to_uri"))) { dest_to = switch_core_session_strdup(nsession, hval); } @@ -4114,7 +4120,15 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session gateway_ptr->ob_calls++; if (!zstr(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) { - switch_channel_set_variable(nchannel, "sip_invite_domain", gateway_ptr->from_domain); + if (!strcasecmp(gateway_ptr->from_domain, "auto-aleg")) { + const char *sip_from_host = switch_channel_get_variable(o_channel, "sip_from_host"); + + if (!zstr(sip_from_host)) { + switch_channel_set_variable(nchannel, "sip_invite_domain", sip_from_host); + } + } else { + switch_channel_set_variable(nchannel, "sip_invite_domain", gateway_ptr->from_domain); + } } if (!zstr(gateway_ptr->outbound_sticky_proxy) && !switch_channel_get_variable(nchannel, "sip_route_uri")) { @@ -4313,7 +4327,6 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session } if (session) { - switch_channel_t *o_channel = switch_core_session_get_channel(session); const char *vval = NULL; if ((vval = switch_channel_get_variable(o_channel, "sip_auto_answer")) && switch_true(vval)) { From dff8d4636f9238efce28c20ee4fd106b02f92464 Mon Sep 17 00:00:00 2001 From: Buklov Boris Date: Sat, 2 Apr 2011 00:54:07 +0400 Subject: [PATCH 243/558] fix --- docs/phrase/phrase_ru.xml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/phrase/phrase_ru.xml b/docs/phrase/phrase_ru.xml index aef35c8855..fdbccddfa4 100644 --- a/docs/phrase/phrase_ru.xml +++ b/docs/phrase/phrase_ru.xml @@ -318,9 +318,12 @@ + + + @@ -395,6 +398,7 @@ + @@ -432,10 +436,10 @@ - + - - + + @@ -615,7 +619,7 @@ - + From d4722b4bbc3d6138551a43ffce034d8a11e60f84 Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Sat, 2 Apr 2011 00:32:50 +0200 Subject: [PATCH 244/558] typo in spec file --- freeswitch.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/freeswitch.spec b/freeswitch.spec index aa00292f28..987b47c180 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -506,7 +506,7 @@ PASSTHRU_CODEC_MODULES="codecs/mod_amr codecs/mod_amrwb codecs/mod_g723_1 codecs # Phrase engine language modules # ###################################################################################################################### -SAY_MODULES="say/mod_say_de say/mod_say_en say/mod_say_fr say/mod_say_hu say/mod_say_ru" +SAY_MODULES="say/mod_say_de say/mod_say_en say/mod_say_fr say/mod_say_he say/mod_say_ru" ###################################################################################################################### # # Timers From ddb345636a31696037909cf6230df1d4f7b7c6f5 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 1 Apr 2011 17:38:58 -0500 Subject: [PATCH 245/558] FS-3220: more than just typos --- src/include/switch.h | 5 +++++ src/include/switch_core.h | 2 +- src/include/switch_utils.h | 6 +++--- src/mod/endpoints/mod_portaudio/mod_portaudio.c | 4 ++-- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/include/switch.h b/src/include/switch.h index ce2ba7867f..de099f1b94 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -150,6 +150,7 @@ * * - Linux (x86 & x86_64) * - Windows (MSVC 2008 & VC++ EE 2008) + * - Windows (MSVC 2010 & VC++ EE 2010) * - Mac OS X (intel & ppc ) * - FreeBSD 6 * @@ -176,6 +177,10 @@ * mod_pocketsphinx * - PocketSphinx (http://www.speech.cs.cmu.edu/pocketsphinx/) * + * mod_unimrcp + * - MRCP (http://www.unimrcp.org/) + * + * * Codecs * mod_speex * - libspeex (http://www.speex.org/) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 2946478c89..684cc4f777 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1183,7 +1183,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_recv_dtmf(_In_ switch_core_s ///\ingroup core1 ///\{ /*! - \brief Initilize a hash table + \brief Initialize a hash table \param hash a NULL pointer to a hash table to aim at the new hash \param pool the pool to use for the new hash \return SWITCH_STATUS_SUCCESS if the hash is created diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 1f65b0ff43..b08c204889 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -635,7 +635,7 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in); #define switch_time_from_sec(sec) ((switch_time_t)(sec) * 1000000) /*! - \brief Declares a function designed to set a dymaic global string + \brief Declares a function designed to set a dynamic global string \param fname the function name to declare \param vname the name of the global pointer to modify with the new function */ @@ -643,9 +643,9 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in); if (vname) {free(vname); vname = NULL;}vname = strdup(string);} static void fname(const char *string) /*! - \brief Separate a string into an array based on a character delimeter + \brief Separate a string into an array based on a character delimiter \param buf the string to parse - \param delim the character delimeter + \param delim the character delimiter \param array the array to split the values into \param arraylen the max number of elements in the array \return the number of elements added to the array diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index baa33d456e..c710fc352a 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -1198,14 +1198,14 @@ static switch_status_t load_config(void) if (globals.outdev > -1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Switching to default output device\n"); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an input device\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Cannot find an output device\n"); status = SWITCH_STATUS_GENERR; } } if (globals.ringdev < 0) { if (globals.outdev > -1) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid ring device configured using output device\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Invalid or no ring device configured, using output device as ring device\n"); globals.ringdev = globals.outdev; } } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 23f1fd0e88..b9aec74563 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -6151,7 +6151,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t /* Barf if we didn't get our private */ assert(switch_core_session_get_private(session)); - if (sip->sip_content_type && sip->sip_content_type->c_subtype && sip->sip_content_type->c_type && + if (sip && sip->sip_content_type && sip->sip_content_type->c_subtype && sip->sip_content_type->c_type && !strncasecmp(sip->sip_content_type->c_type, "message", 7) && !strcasecmp(sip->sip_content_type->c_subtype, "update_display")) { sofia_update_callee_id(session, profile, sip, SWITCH_TRUE); From 27c6d1111c8eb9929cedf707632b33405019e03a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 17:39:20 -0500 Subject: [PATCH 246/558] add execute_on function so you can have execute_on_answer_1 execute_on_answer_2 execute_on_answer_3 etc --- src/include/switch_channel.h | 3 ++ src/switch_channel.c | 87 +++++++++++++++++------------------- src/switch_ivr_originate.c | 18 +------- 3 files changed, 46 insertions(+), 62 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index fdbbc9ab91..febaf40f75 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -615,6 +615,9 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_ /** @} */ +SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix); + + SWITCH_END_EXTERN_C #endif /* For Emacs: diff --git a/src/switch_channel.c b/src/switch_channel.c index 0476981331..19eb92ad8d 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2588,8 +2588,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi switch_ring_ready_t rv, const char *file, const char *func, int line) { - const char *var; - char *app; switch_event_t *event; if (!switch_channel_test_flag(channel, CF_RING_READY) && @@ -2619,21 +2617,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_ring_ready_value(swi switch_event_fire(&event); } - var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE); - if (var) { - char *arg = NULL; - app = switch_core_session_strdup(channel->session, var); - - if (strstr(app, "::")) { - switch_core_session_execute_application_async(channel->session, app, arg); - } else { - if ((arg = strchr(app, ' '))) { - *arg++ = '\0'; - } - - switch_core_session_execute_application(channel->session, app, arg); - } - } + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE); return SWITCH_STATUS_SUCCESS; } @@ -2645,7 +2629,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ { switch_event_t *event; const char *var = NULL; - char *app; if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && !switch_channel_test_flag(channel, CF_ANSWERED)) { const char *uuid; @@ -2678,20 +2661,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_mutex_unlock(channel->profile_mutex); } - if (((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE)) || - (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE))) && !zstr(var)) { - char *arg = NULL; - app = switch_core_session_strdup(channel->session, var); - - - if (strstr(app, "::")) { - switch_core_session_execute_application_async(channel->session, app, arg); - } else { - if ((arg = strchr(app, ' '))) { - *arg++ = '\0'; - } - - switch_core_session_execute_application(channel->session, app, arg); + if (switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE) != SWITCH_STATUS_SUCCESS) { + if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); } } @@ -2785,6 +2757,40 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_c return status; } +SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix) +{ + switch_event_header_t *hi; + int x = 0; + + if ((hi = switch_channel_variable_first(channel))) { + for (; hi; hi = hi->next) { + char *var = hi->name; + char *val = hi->value; + char *app; + + if (!strncasecmp(var, variable_prefix, strlen(variable_prefix))) { + char *arg = NULL; + x++; + + app = switch_core_session_strdup(channel->session, val); + + if (strstr(app, "::")) { + switch_core_session_execute_application_async(channel->session, app, arg); + } else { + if ((arg = strchr(app, ' '))) { + *arg++ = '\0'; + } + + switch_core_session_execute_application(channel->session, app, arg); + } + } + } + switch_channel_variable_last(channel); + } + + return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; +} + SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_channel_t *channel, const char *file, const char *func, int line) { switch_event_t *event; @@ -2852,21 +2858,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_channel_get_uuid(channel), SWITCH_LOG_NOTICE, "Channel [%s] has been answered\n", channel->name); - if (((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE)) || - (!switch_channel_test_flag(channel, CF_EARLY_MEDIA) && (var = switch_channel_get_variable(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE)))) - && !zstr(var)) { - char *arg = NULL; - app = switch_core_session_strdup(channel->session, var); - - if (strstr(app, "::")) { - switch_core_session_execute_application_async(channel->session, app, arg); - } else { - if ((arg = strchr(app, ' '))) { - *arg++ = '\0'; - } - - switch_core_session_execute_application(channel->session, app, arg); + if (switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE) != SWITCH_STATUS_SUCCESS) { + if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); } } diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 33e9d9a0bc..0c4c336e51 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2762,23 +2762,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_channel_set_variable(originate_status[i].peer_channel, "originating_leg_uuid", switch_core_session_get_uuid(session)); } - if ((vvar = switch_channel_get_variable_dup(originate_status[i].peer_channel, "execute_on_originate", SWITCH_FALSE))) { - char *app = switch_core_session_strdup(originate_status[i].peer_session, vvar); - char *arg = NULL; - - if (strstr(app, "::")) { - switch_core_session_execute_application_async(originate_status[i].peer_session, app, arg); - } else { - if ((arg = strchr(app, ' '))) { - *arg++ = '\0'; - } - - switch_core_session_execute_application(originate_status[i].peer_session, app, arg); - } - - } + switch_channel_execute_on(originate_status[i].peer_channel, "execute_on_originate"); } - + if (table) { switch_channel_add_state_handler(originate_status[i].peer_channel, table); } From 046fb90da5f51667a5b47b8bab0325e1bbe0cb8a Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Sat, 2 Apr 2011 02:44:10 +0200 Subject: [PATCH 247/558] FS-3221 --- freeswitch.spec | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index 987b47c180..5e2ad85271 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -277,28 +277,32 @@ English language phrases module and directory structure for say module and voice %package lang-ru Summary: Provides russian language dependand modules and speech config for the FreeSWITCH Open Source telephone platform. -Group: System/LibrariesRequires: %{name} = %{version}-%{release} +Group: System/Libraries +Requires: %{name} = %{version}-%{release} %description lang-ru Russian language phrases module and directory structure for say module and voicemail %package lang-fr Summary: Provides french language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. -Group: System/LibrariesRequires: %{name} = %{version}-%{release} +Group: System/Libraries +Requires: %{name} = %{version}-%{release} %description lang-fr French language phrases module and directory structure for say module and voicemail %package lang-de Summary: Provides german language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. -Group: System/LibrariesRequires: %{name} = %{version}-%{release} +Group: System/Libraries +Requires: %{name} = %{version}-%{release} %description lang-de German language phrases module and directory structure for say module and voicemail %package lang-he Summary: Provides hebrew language dependend modules and speech config for the FreeSWITCH Open Source telephone platform. -Group: System/LibrariesRequires: %{name} = %{version}-%{release} +Group: System/Libraries +Requires: %{name} = %{version}-%{release} %description lang-he Hebrew language phrases module and directory structure for say module and voicemail From ef17574193a38af9df175c9f5bbe101a69d889a4 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 1 Apr 2011 19:46:48 -0500 Subject: [PATCH 248/558] do this slightly safer so we don't have the mutex locked when we exec the app --- src/switch_channel.c | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 19eb92ad8d..2dd7d987da 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2760,33 +2760,35 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_ring_ready_value(switch_c SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *channel, const char *variable_prefix) { switch_event_header_t *hi; + switch_event_t *event; int x = 0; - - if ((hi = switch_channel_variable_first(channel))) { - for (; hi; hi = hi->next) { - char *var = hi->name; - char *val = hi->value; - char *app; - - if (!strncasecmp(var, variable_prefix, strlen(variable_prefix))) { - char *arg = NULL; - x++; - app = switch_core_session_strdup(channel->session, val); + switch_channel_get_variables(channel, &event); + + for (hi = event->headers; hi; hi = hi->next) { + char *var = hi->name; + char *val = hi->value; + char *app; + + if (!strncasecmp(var, variable_prefix, strlen(variable_prefix))) { + char *arg = NULL; + x++; + + app = switch_core_session_strdup(channel->session, val); - if (strstr(app, "::")) { - switch_core_session_execute_application_async(channel->session, app, arg); - } else { - if ((arg = strchr(app, ' '))) { - *arg++ = '\0'; - } - - switch_core_session_execute_application(channel->session, app, arg); + if (strstr(app, "::")) { + switch_core_session_execute_application_async(channel->session, app, arg); + } else { + if ((arg = strchr(app, ' '))) { + *arg++ = '\0'; } + + switch_core_session_execute_application(channel->session, app, arg); } } - switch_channel_variable_last(channel); } + + switch_event_destroy(&event); return x ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_FALSE; } From 0e4a1ce873baceed4c00316861cd94402ebc84db Mon Sep 17 00:00:00 2001 From: Michal Bielicki Date: Sat, 2 Apr 2011 03:13:06 +0200 Subject: [PATCH 249/558] Added Hebrew Language package to debian buildsystem --- debian/changelog | 6 ++++++ debian/control | 13 +++++++++++++ debian/freeswitch-lang-he.conffiles | 7 +++++++ debian/freeswitch-lang-he.install | 8 ++++++++ debian/rules | 2 +- 5 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 debian/freeswitch-lang-he.conffiles create mode 100644 debian/freeswitch-lang-he.install diff --git a/debian/changelog b/debian/changelog index d9608d68d5..35a8787d38 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +freeswitch (1.0.head-git.master.20110402.1-1) unstable; urgency=low + + * Added Hebrew lang package + + -- Michal Bielicki Sat, 02 Apr 2011 03:12:02 +0200 + freeswitch (1.0.head-git.master.20110330.1-1) unstable; urgency=low * removed mod_file_string since it has been merged into dptoolsa diff --git a/debian/control b/debian/control index 6e3bbe2c07..193833700c 100644 --- a/debian/control +++ b/debian/control @@ -250,6 +250,19 @@ Description: Russian language files for FreeSWITCH This package contains the mod_say_ru module and available language configuration files. +Package: freeswitch-lang-he +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch +Description: Hebrew language files for FreeSWITCH + FreeSWITCH is an open source telephony platform designed to facilitate the + creation of voice and chat driven products scaling from a soft-phone up to a + soft-switch. It can be used as a simple switching engine, a PBX, a media + gateway or a media server to host IVR applications using simple scripts or XML + to control the callflow. + . + This package contains the mod_say_he module and available language + configuration files. + Package: freeswitch-freetdm Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, freeswitch diff --git a/debian/freeswitch-lang-he.conffiles b/debian/freeswitch-lang-he.conffiles new file mode 100644 index 0000000000..bf2a188fca --- /dev/null +++ b/debian/freeswitch-lang-he.conffiles @@ -0,0 +1,7 @@ +/opt/freeswitch/conf/lang/he/demo/demo-ivr.xml +/opt/freeswitch/conf/lang/he/demo/demo.xml +/opt/freeswitch/conf/lang/he/dir/sounds.xml +/opt/freeswitch/conf/lang/he/dir/tts.xml +/opt/freeswitch/conf/lang/he/ru.xml +/opt/freeswitch/conf/lang/he/vm/sounds.xml +/opt/freeswitch/conf/lang/he/vm/tts.xml diff --git a/debian/freeswitch-lang-he.install b/debian/freeswitch-lang-he.install new file mode 100644 index 0000000000..f164b9bd72 --- /dev/null +++ b/debian/freeswitch-lang-he.install @@ -0,0 +1,8 @@ +opt/freeswitch/conf/lang/he/demo/demo-ivr.xml +opt/freeswitch/conf/lang/he/demo/demo.xml +opt/freeswitch/conf/lang/he/dir/sounds.xml +opt/freeswitch/conf/lang/he/dir/tts.xml +opt/freeswitch/conf/lang/he/ru.xml +opt/freeswitch/conf/lang/he/vm/sounds.xml +opt/freeswitch/conf/lang/he/vm/tts.xml +opt/freeswitch/mod/mod_say_he.so* diff --git a/debian/rules b/debian/rules index 3cda88d794..d6b1915c88 100755 --- a/debian/rules +++ b/debian/rules @@ -28,7 +28,7 @@ export FORMATS_MODULES= formats/mod_local_stream formats/mod_native_file formats formats/mod_shout formats/mod_sndfile formats/mod_tone_stream export LANGUAGES_MODULES=languages/mod_spidermonkey languages/mod_perl languages/mod_lua languages/mod_python export LOGGERS_MODULES=loggers/mod_console loggers/mod_logfile loggers/mod_syslog -export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru +export SAY_MODULES=say/mod_say_en say/mod_say_it say/mod_say_de say/mod_say_fr say/mod_say_es say/mod_say_nl say/mod_say_ru say/mod_say_he export XML_INT_MODULES=xml_int/mod_xml_rpc xml_int/mod_xml_curl xml_int/mod_xml_cdr export TIMER_MODULES=timers/mod_timerfd From fda2283bbda72b8638661429d5d64b608c00dd91 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 3 Apr 2011 12:03:29 -0500 Subject: [PATCH 250/558] auto-aleg-full and auto-aleg-domain for from_domain field in gateway --- src/mod/endpoints/mod_sofia/mod_sofia.c | 10 +++++++++- src/mod/endpoints/mod_sofia/sofia_glue.c | 11 +++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 507dcadd8d..9af3963dee 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4120,7 +4120,15 @@ static switch_call_cause_t sofia_outgoing_channel(switch_core_session_t *session gateway_ptr->ob_calls++; if (!zstr(gateway_ptr->from_domain) && !switch_channel_get_variable(nchannel, "sip_invite_domain")) { - if (!strcasecmp(gateway_ptr->from_domain, "auto-aleg")) { + + if (!strcasecmp(gateway_ptr->from_domain, "auto-aleg-full")) { + const char *sip_full_from = switch_channel_get_variable(o_channel, "sip_full_from"); + + if (!zstr(sip_full_from)) { + switch_channel_set_variable(nchannel, "sip_force_full_from", sip_full_from); + } + + } else if (!strcasecmp(gateway_ptr->from_domain, "auto-aleg-domain")) { const char *sip_from_host = switch_channel_get_variable(o_channel, "sip_from_host"); if (!zstr(sip_from_host)) { diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 7e16f8c01e..701b730fcc 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1893,6 +1893,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) const char *invite_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_invite_full_to"); const char *handle_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_handle_full_from"); const char *handle_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_handle_full_to"); + const char *force_full_from = switch_channel_get_variable(tech_pvt->channel, "sip_force_full_from"); + const char *force_full_to = switch_channel_get_variable(tech_pvt->channel, "sip_force_full_to"); char *mp = NULL, *mp_type = NULL; rep = switch_channel_get_variable(channel, SOFIA_REPLACES_HEADER); @@ -2125,6 +2127,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) } + if (force_full_from) { + from_str = (char *) force_full_from; + } + + if (force_full_to) { + to_str = (char *) force_full_to; + } + + if (invite_req_uri) { url_str = (char *) invite_req_uri; } From 12310fa32a847fcc58e0e9d90e67521351ba345e Mon Sep 17 00:00:00 2001 From: cypromis Date: Sun, 3 Apr 2011 20:14:07 +0200 Subject: [PATCH 251/558] one should not copy files over ... copy and paste errors suck. --- debian/freeswitch-lang-he.conffiles | 4 +--- debian/freeswitch-lang-he.install | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/debian/freeswitch-lang-he.conffiles b/debian/freeswitch-lang-he.conffiles index bf2a188fca..37ec6015db 100644 --- a/debian/freeswitch-lang-he.conffiles +++ b/debian/freeswitch-lang-he.conffiles @@ -1,7 +1,5 @@ /opt/freeswitch/conf/lang/he/demo/demo-ivr.xml /opt/freeswitch/conf/lang/he/demo/demo.xml /opt/freeswitch/conf/lang/he/dir/sounds.xml -/opt/freeswitch/conf/lang/he/dir/tts.xml -/opt/freeswitch/conf/lang/he/ru.xml +/opt/freeswitch/conf/lang/he/he.xml /opt/freeswitch/conf/lang/he/vm/sounds.xml -/opt/freeswitch/conf/lang/he/vm/tts.xml diff --git a/debian/freeswitch-lang-he.install b/debian/freeswitch-lang-he.install index f164b9bd72..ed0c65813e 100644 --- a/debian/freeswitch-lang-he.install +++ b/debian/freeswitch-lang-he.install @@ -1,8 +1,6 @@ opt/freeswitch/conf/lang/he/demo/demo-ivr.xml opt/freeswitch/conf/lang/he/demo/demo.xml opt/freeswitch/conf/lang/he/dir/sounds.xml -opt/freeswitch/conf/lang/he/dir/tts.xml -opt/freeswitch/conf/lang/he/ru.xml +opt/freeswitch/conf/lang/he/he.xml opt/freeswitch/conf/lang/he/vm/sounds.xml -opt/freeswitch/conf/lang/he/vm/tts.xml opt/freeswitch/mod/mod_say_he.so* From a39025fd2ee2331657db84e9c686c2e9d004f451 Mon Sep 17 00:00:00 2001 From: cypromis Date: Sun, 3 Apr 2011 20:30:33 +0200 Subject: [PATCH 252/558] mpg123 version changed --- freeswitch.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/freeswitch.spec b/freeswitch.spec index 5e2ad85271..8fcbd07772 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -63,12 +63,12 @@ Vendor: http://www.freeswitch.org/ # Source files and where to get them # ###################################################################################################################### -Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 +Source0: http://files.freeswitch.org/%{name}-%{version}.tar.bz2 Source1: http://files.freeswitch.org/downloads/libs/celt-0.10.0.tar.gz Source2: http://files.freeswitch.org/downloads/libs/flite-1.3.99-latest.tar.gz Source3: http://files.freeswitch.org/downloads/libs/lame-3.97.tar.gz Source4: http://files.freeswitch.org/downloads/libs/libshout-2.2.2.tar.gz -Source5: http://files.freeswitch.org/downloads/libs/mpg123.tar.gz +Source5: http://files.freeswitch.org/downloads/libs/mpg123-1.13.2.tar.gz Source6: http://files.freeswitch.org/downloads/libs/openldap-2.4.11.tar.gz Source7: http://files.freeswitch.org/downloads/libs/pocketsphinx-0.5.99-20091212.tar.gz Source8: http://files.freeswitch.org/downloads/libs/soundtouch-1.3.1.tar.gz From 8bf9133fee5a8144e2cd8e74151e14b2d352f625 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 3 Apr 2011 17:53:06 -0500 Subject: [PATCH 253/558] FS-3224 this is comfort noise. i guess its not comforting, i'll remove it. --- src/mod/applications/mod_dptools/mod_dptools.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index f2da2c5d7d..0f40c8ba33 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3629,7 +3629,8 @@ static switch_status_t file_string_file_read(switch_file_handle_t *handle, void } context->samples -= *len; - switch_generate_sln_silence((int16_t *) data, *len, 400); + //switch_generate_sln_silence((int16_t *) data, *len, 400); + memset(data, 255, *len *2); status = SWITCH_STATUS_SUCCESS; } else { status = switch_core_file_read(&context->fh, data, len); From 6eba56d2cbea207ce05f57eaf5895123e5ec87de Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Sun, 3 Apr 2011 17:55:07 -0500 Subject: [PATCH 254/558] FS-3224 --resolve --- src/mod/applications/mod_dptools/mod_dptools.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 0f40c8ba33..c51c5422a5 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -3629,7 +3629,6 @@ static switch_status_t file_string_file_read(switch_file_handle_t *handle, void } context->samples -= *len; - //switch_generate_sln_silence((int16_t *) data, *len, 400); memset(data, 255, *len *2); status = SWITCH_STATUS_SUCCESS; } else { From 6fb73a4c319ebe8e5c2f484036ca79e565ba82a2 Mon Sep 17 00:00:00 2001 From: Buklov Boris Date: Mon, 4 Apr 2011 17:56:58 +0400 Subject: [PATCH 255/558] fix and add support multy currency dollar or other --- docs/phrase/phrase_ru.xml | 5 ++- src/mod/say/mod_say_ru/mod_say_ru.c | 68 ++++++++++++++++++----------- src/mod/say/mod_say_ru/mod_say_ru.h | 27 +++++++++++- 3 files changed, 71 insertions(+), 29 deletions(-) diff --git a/docs/phrase/phrase_ru.xml b/docs/phrase/phrase_ru.xml index fdbccddfa4..fb873dd9da 100644 --- a/docs/phrase/phrase_ru.xml +++ b/docs/phrase/phrase_ru.xml @@ -316,6 +316,7 @@ + @@ -326,9 +327,9 @@ - + - + diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index b1bff61205..5e628ccf47 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -58,6 +58,10 @@ struct say_t matrix[7][8] = { {m_00, m_01, m_02, m_03, m_04, m_05, m_06, m_07}, {m_60, m_61, m_62, m_63, m_64, m_65, m_66, m_67} }; + +struct say_cur_t matrix_currency[3] = {c_0, c_1, c_2}; + + SWITCH_MODULE_LOAD_FUNCTION(mod_say_ru_load); SWITCH_MODULE_DEFINITION(mod_say_ru, mod_say_ru_load, NULL, NULL); @@ -253,8 +257,7 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s int iruble = 0; int ikopecks = 0; int ikopeck = 0; - - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s\n", tosay); +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " ru_say_money %s say_opt->currency=%d\n", tosay,say_opt->currency); if (strlen(tosay) > 15 || !(tosay = switch_strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) { //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); @@ -278,40 +281,48 @@ static switch_status_t ru_say_money(switch_say_file_handle_t *sh, char *tosay, s rubles++; } - ru_say_count(sh, rubles, male, nominativus); + + ru_say_count(sh, rubles, matrix_currency[say_opt->currency].first_gender,matrix_currency[say_opt->currency].first_cases); if (rubles) { irubles = atoi(rubles) % 100; iruble = atoi(rubles) % 10; } - - if (irubles == 1 || (irubles > 20 && iruble == 1)) { /* рубль */ - switch_say_file(sh, "currency/ruble"); - } else if ((irubles > 1 && irubles < 5) || (irubles > 20 && iruble > 1 && iruble < 5)) { /*Ñ€ÑƒÐ±Ð»Ñ */ - switch_say_file(sh, "currency/ruble-a"); - } else { /*рублей */ - switch_say_file(sh, "currency/rubles"); + if (iruble<5) { + if ((irubles>10)&&(irubles<15)) { + switch_say_file(sh, "currency/%s",matrix_currency->first[5]); + } + else { + switch_say_file(sh, "currency/%s",matrix_currency->first[iruble]); + } } - + else { + switch_say_file(sh, "currency/%s",matrix_currency->first[5]); + } + + /* Say kopecks */ - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, " %s\n", kopecks); - ru_say_count(sh, kopecks, female, nominativus); + ru_say_count(sh, kopecks, matrix_currency[say_opt->currency].second_gender,matrix_currency[say_opt->currency].second_cases); if (kopecks) { ikopecks = atoi(kopecks) % 100; ikopeck = atoi(kopecks) % 10; } - if (ikopecks == 1 || (ikopecks > 20 && ikopeck == 1)) { - /* копейка */ - switch_say_file(sh, "currency/kopeck"); - } else if ((ikopecks > 1 && ikopecks < 5) || (ikopecks > 20 && ikopeck > 1 && ikopeck < 5)) { - /* копейки */ - switch_say_file(sh, "currency/kopeck-i"); - } else { - /* копеек */ - switch_say_file(sh, "currency/kopecks"); + if (ikopeck<5) { + if ((ikopecks>10)&&(ikopecks<15)) { + switch_say_file(sh, "currency/%s",matrix_currency->second[5]); + } + else { + switch_say_file(sh, "currency/%s",matrix_currency->second[ikopeck]); + } } + else { + switch_say_file(sh, "currency/%s",matrix_currency->second[5]); + } + + + return SWITCH_STATUS_SUCCESS; } @@ -628,7 +639,9 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t const char *gender=NULL; const char *currency=NULL; say_opt_t say_opt; - + say_opt.cases=0; + say_opt.gender=0; + say_opt.currency=0; if (session) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_get_variables(channel, &var_event); @@ -692,12 +705,15 @@ static switch_status_t run_callback(switch_new_say_callback_ru_t say_cb, char *t } if (currency) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", currency); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ru_say!!! %s!\n", currency); - if (strcmp(currency,"rubl") || strcmp(currency,"рубль")) { + if ((strcmp(currency,"ruble")==0) || (strcmp(currency,"рубль")==0)) { say_opt.currency=(currency_t)0; +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "rul!!! \n"); + } - if (strcmp(gender,"dollar") || strcmp(gender,"доллар")) { + if ((strcmp(currency,"dollar")==0) || (strcmp(currency,"доллар")==0)) { +// switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "dollar!!! !\n"); say_opt.currency=(currency_t)1; } } diff --git a/src/mod/say/mod_say_ru/mod_say_ru.h b/src/mod/say/mod_say_ru/mod_say_ru.h index d7769ad246..92ed89a1fb 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.h +++ b/src/mod/say/mod_say_ru/mod_say_ru.h @@ -49,10 +49,12 @@ typedef enum { typedef enum { ruble, - dollar + dollar, + euro } currency_t; + typedef struct { say_gender_t gender; cases_t cases; @@ -66,6 +68,29 @@ struct say_t { char *million[14]; int all; }; +struct say_cur_t { + char *first[6]; + say_gender_t first_gender; + cases_t first_cases; + char *second[6]; + say_gender_t second_gender; + cases_t second_cases; + +}; + +// опиÑываем как произноÑить валÑюты от 0 до 5 дальше идёт номер рода и падежа (Ñ Ð½ÑƒÐ»Ñ) +//рубли +#define c_0 {{"rubles","ruble","ruble-a","ruble-a","ruble-a","rubles"},male,nominativus,\ + {"kopecks","kopeck","kopeck-i","kopeck-i","kopeck-i","kopecks"},female,nominativus} + +#define c_1 {{"dollars","dollar","dollara","dollara","dollara","dollars"},male,nominativus,\ + {"centov","cent","centa","centa","centa","centov"},male,nominativus} + +#define c_2 {{"rubles","ruble","ruble-a","ruble-a","ruble-a","rubles"},male,nominativus,\ + {"kopecks","kopeck","kopeck-i","kopeck-i","kopeck-i","kopecks"},female,nominativus} + + + typedef switch_status_t (*switch_new_say_callback_ru_t) (switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args,say_opt_t *say_opt); From 7eae7f375b31d928da9ffee6cd55a30eb90aaa03 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Apr 2011 11:39:39 -0500 Subject: [PATCH 256/558] FS-2877 After further review I can concede the point that we should always say partial considering how we do things. With this commit we should at least be sending separate partial updates for each existing dialog to everyone with a subscription. If we need to introduce more data, consolidate them etc. We need to do it in small chunks and keep things sane. --- src/mod/endpoints/mod_sofia/sofia_presence.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index a9a762e00e..cbc45024e1 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -1506,9 +1506,9 @@ static int sofia_presence_sub_callback(void *pArg, int argc, char **argv, char * stream.write_function(&stream, "\n" "\n", - version, - zstr(uuid) ? "partial" : "full", clean_id); + "version=\"%s\" state=\"partial\" entity=\"%s\">\n", version, clean_id); + + } //if (strcasecmp(event_status, "Registered")) { From 4b706dac51aec34deabca8a938b977d6d5265405 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Apr 2011 11:55:05 -0500 Subject: [PATCH 257/558] FS-3227 --resolve this looks like sane changes. My only complaint was the formatting. Watch for whitespace indentation by looking at the code in emacs or vi where it should be tabed properly. --- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 +++ src/mod/endpoints/mod_sofia/sofia.c | 11 +++++++++++ src/mod/endpoints/mod_sofia/sofia_glue.c | 2 ++ src/switch_ivr_bridge.c | 6 ++++-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 9af3963dee..bcc8f75692 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -1655,6 +1655,9 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi const char *ip = NULL, *port = NULL; switch_channel_set_flag(channel, CF_PROXY_MODE); + if (tech_pvt->rm_encoding) { + tech_pvt->rm_encoding = NULL; + } sofia_glue_tech_set_local_sdp(tech_pvt, NULL, SWITCH_FALSE); if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index b9aec74563..582b06d933 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5710,6 +5710,11 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_core_event_hook_add_state_change(a_session, xfer_hanguphook); switch_channel_set_variable(a_channel, "att_xfer_kill_uuid", switch_core_session_get_uuid(b_session)); + if (profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) { + switch_channel_set_flag(a_channel, CF_BYPASS_MEDIA_AFTER_BRIDGE); + } + + if ((tmp = switch_channel_get_hold_music(a_channel))) { moh = tmp; } @@ -5769,6 +5774,12 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t switch_core_session_rwunlock(tmp); } + if ((profile->media_options & MEDIA_OPT_BYPASS_AFTER_ATT_XFER) && (tmp = switch_core_session_locate(br_a))) { + switch_channel_t *tchannel = switch_core_session_get_channel(tmp); + switch_channel_set_flag(tchannel, CF_BYPASS_MEDIA_AFTER_BRIDGE); + switch_core_session_rwunlock(tmp); + } + switch_ivr_uuid_bridge(br_b, br_a); switch_channel_set_variable(channel_b, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "ATTENDED_TRANSFER"); nua_notify(tech_pvt->nh, NUTAG_NEWSUB(1), SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"), diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 701b730fcc..66bf8ea644 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -729,6 +729,8 @@ void sofia_glue_tech_prepare_codecs(private_object_t *tech_pvt) return; } + tech_pvt->payload_space = 0; + switch_assert(tech_pvt->session != NULL); if ((abs = switch_channel_get_variable(tech_pvt->channel, "absolute_codec_string"))) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index dbe3b811fe..f1a6bdba22 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -357,11 +357,11 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) } - if ((bypass_media_after_bridge || switch_channel_test_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED) + if ((bypass_media_after_bridge || switch_channel_test_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE)) && switch_channel_test_flag(chan_a, CF_ANSWERED) && switch_channel_test_flag(chan_b, CF_ANSWERED)) { switch_ivr_nomedia(switch_core_session_get_uuid(session_a), SMF_REBRIDGE); bypass_media_after_bridge = 0; - switch_channel_clear_flag(chan_a, CF_BYPASS_MEDIA_AFTER_BRIDGE); + switch_channel_clear_flag(chan_b, CF_BYPASS_MEDIA_AFTER_BRIDGE); goto end_of_bridge_loop; } } @@ -1367,6 +1367,8 @@ static void cleanup_proxy_mode_a(switch_core_session_t *session) const char *sbv = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE); if (!zstr(sbv) && (sbsession = switch_core_session_locate(sbv))) { switch_channel_t *sbchannel = switch_core_session_get_channel(sbsession); + /* Clear this now, otherwise will cause the one we're interested in to hang up too...*/ + switch_channel_set_variable(sbchannel, SWITCH_SIGNAL_BRIDGE_VARIABLE, NULL); switch_channel_hangup(sbchannel, SWITCH_CAUSE_ATTENDED_TRANSFER); switch_core_session_rwunlock(sbsession); } From 07b9186da6041d4ab1ff166f50275f2cb7a49b8d Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Apr 2011 14:14:38 -0500 Subject: [PATCH 258/558] FS-3226 --resolve SO, If the RFC told you to jump off a cliff......? --- src/mod/endpoints/mod_sofia/sofia.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 582b06d933..2bf27d5ba8 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -76,14 +76,15 @@ void sofia_handle_sip_r_notify(switch_core_session_t *session, int status, char const *phrase, nua_t *nua, sofia_profile_t *profile, nua_handle_t *nh, sofia_private_t *sofia_private, sip_t const *sip, tagi_t tags[]) { -#if 0 + if (status >= 300 && sip && sip->sip_call_id) { char *sql; sql = switch_mprintf("delete from sip_subscriptions where call_id='%q'", sip->sip_call_id->i_id); switch_assert(sql != NULL); sofia_glue_execute_sql(profile, &sql, SWITCH_TRUE); + nua_handle_destroy(nh); } -#endif + } #define url_set_chanvars(session, url, varprefix) _url_set_chanvars(session, url, #varprefix "_user", #varprefix "_host", #varprefix "_port", #varprefix "_uri", #varprefix "_params") From b42fdd1cf3bc707a991c33f5edad09594f528bd6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Apr 2011 16:51:30 -0500 Subject: [PATCH 259/558] fix regression from 27c6d1111c8eb9929cedf707632b33405019e03a --- src/switch_channel.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 2dd7d987da..6830bd0bc6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2661,11 +2661,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_pre_answered(switch_ switch_mutex_unlock(channel->profile_mutex); } - if (switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE) != SWITCH_STATUS_SUCCESS) { - if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { - switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); - } - } + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_PRE_ANSWER_VARIABLE); + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); + + if ((var = switch_channel_get_variable(channel, SWITCH_PASSTHRU_PTIME_MISMATCH_VARIABLE))) { switch_channel_set_flag(channel, CF_PASSTHRU_PTIME_MISMATCH); @@ -2861,10 +2860,10 @@ SWITCH_DECLARE(switch_status_t) switch_channel_perform_mark_answered(switch_chan channel->name); - if (switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE) != SWITCH_STATUS_SUCCESS) { - if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { - switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); - } + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_ANSWER_VARIABLE); + + if (!switch_channel_test_flag(channel, CF_EARLY_MEDIA)) { + switch_channel_execute_on(channel, SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE); } if ((var = switch_channel_get_variable(channel, SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE)) && !zstr(var)) { From 6a70fa4c4dc85c0e3a88013a7b5ae05a4a5a323e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Apr 2011 17:43:05 -0500 Subject: [PATCH 260/558] fix another regression from 27c6d1111c8eb9929cedf707632b33405019e03a this probably broke the mad boss extension --- src/switch_channel.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 6830bd0bc6..bc8daabbc6 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2771,17 +2771,27 @@ SWITCH_DECLARE(switch_status_t) switch_channel_execute_on(switch_channel_t *chan if (!strncasecmp(var, variable_prefix, strlen(variable_prefix))) { char *arg = NULL; + char *p; + int bg = 0; x++; app = switch_core_session_strdup(channel->session, val); - - if (strstr(app, "::")) { + + for(p = app; p && *p; p++) { + if (*p == ' ') { + *p++ = '\0'; + arg = p; + break; + } else if (*p == ':' && (*(p+1) == ':')) { + bg++; + break; + } + } + + + if (bg) { switch_core_session_execute_application_async(channel->session, app, arg); } else { - if ((arg = strchr(app, ' '))) { - *arg++ = '\0'; - } - switch_core_session_execute_application(channel->session, app, arg); } } From 38c3a67a7eb185073310710e4e82ebdd2833dc8a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 4 Apr 2011 18:50:46 -0500 Subject: [PATCH 261/558] FS-3229 --resolve --- src/include/switch_types.h | 1 + .../applications/mod_dptools/mod_dptools.c | 15 ++++++--- src/switch_ivr_async.c | 32 ++++++++++--------- 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 2ab4a18b85..988d2da641 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -136,6 +136,7 @@ SWITCH_BEGIN_EXTERN_C #define SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE "execute_on_media" #define SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE "api_on_answer" #define SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE "execute_on_ring" +#define SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE "execute_on_tone_detect" #define SWITCH_CALL_TIMEOUT_VARIABLE "call_timeout" #define SWITCH_HOLDING_UUID_VARIABLE "holding_uuid" #define SWITCH_SOFT_HOLDING_UUID_VARIABLE "soft_holding_uuid" diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index c51c5422a5..5d51ffdb60 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1552,7 +1552,8 @@ SWITCH_STANDARD_APP(tone_detect_session_function) int argc; char *mydata = NULL; time_t to = 0; - int hits = 1; + int hits = 0; + const char *hp = NULL; if (zstr(data) || !(mydata = switch_core_session_strdup(session, data))) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n"); @@ -1582,10 +1583,16 @@ SWITCH_STANDARD_APP(tone_detect_session_function) } } - if (argv[6]) { - hits = atoi(argv[6]); + if (argv[4] && argv[5]) { + hp = argv[6]; + } else if (argv[4] && !argv[6]) { + hp = argv[4]; + } + + if (hp) { + hits = atoi(hp); if (hits < 0) { - hits = 1; + hits = 0; } } diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 3afbfb6397..9fb2eea95c 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -2392,7 +2392,6 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch { switch_channel_t *channel = switch_core_session_get_channel(session); switch_tone_container_t *cont = switch_channel_get_private(channel, "_tone_detect_"); - switch_event_t *event; int i; if (!cont || !cont->detect_fax || dtmf->digit != 'f') { @@ -2403,13 +2402,10 @@ static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch if (cont->list[i].callback) { cont->list[i].callback(cont->session, cont->list[i].app, cont->list[i].data); - } else if (cont->list[i].app) { - if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", cont->list[i].app); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cont->list[i].data); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_core_session_queue_private_event(cont->session, &event, SWITCH_FALSE); + } else { + switch_channel_execute_on(switch_core_session_get_channel(cont->session), SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE); + if (cont->list[i].app) { + switch_core_session_execute_application_async(cont->session, cont->list[i].app, cont->list[i].data); } } @@ -2491,13 +2487,10 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da cont->list[i].sleep = 0; cont->list[i].expires = 0; } - } else if (cont->list[i].app) { - if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-name", cont->list[i].app); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute-app-arg", cont->list[i].data); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "lead-frames", "%d", 5); - switch_core_session_queue_private_event(cont->session, &event, SWITCH_FALSE); + } else { + switch_channel_execute_on(switch_core_session_get_channel(cont->session), SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE); + if (cont->list[i].app) { + switch_core_session_execute_application_async(cont->session, cont->list[i].app, cont->list[i].data); } } @@ -2605,6 +2598,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi return SWITCH_STATUS_MEMERR; } + if ((var = switch_channel_get_variable(channel, "tone_detect_hits"))) { + int tmp = atoi(var); + if (tmp > 0) { + hits = tmp; + } + } + + if (!hits) hits = 1; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Adding tone spec %s index %d hits %d\n", tone_spec, cont->index, hits); i = 0; From ee1a840cefe9e991901238296249aa3ee69ea2d5 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 4 Apr 2011 20:55:56 -0500 Subject: [PATCH 262/558] FS-3228 --resolve --- src/mod/applications/mod_enum/mod_enum.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index d1bb286857..043dbab16f 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -164,6 +164,7 @@ static switch_status_t load_config(void) if(buf[data_sz - 1] != 0) { buf[data_sz] = 0; } + switch_replace_char(buf, ' ', 0, SWITCH_FALSE); /* only use the first entry ex "192.168.1.1 192.168.1.2" */ globals.server = buf; } } From e8f10ea3624da4fd4ab445ea365e3161e094181b Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 4 Apr 2011 21:53:11 -0700 Subject: [PATCH 263/558] Add pa devlist to portaudio webapi --- src/mod/endpoints/mod_portaudio/mod_portaudio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index c710fc352a..8564a771e5 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -2415,7 +2415,7 @@ SWITCH_STANDARD_API(pa_cmd) } else if (!strcmp(action, "call")) { switch_snprintf(cmd_buf, sizeof(cmd_buf), "call %s", wcmd); cmd = cmd_buf; - } else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "answer")) { + } else if (!strcmp(action, "hangup") || !strcmp(action, "list") || !strcmp(action, "devlist") || !strcmp(action, "answer")) { cmd = action; } } @@ -2543,6 +2543,7 @@ SWITCH_STANDARD_API(pa_cmd) " " " " " " + "
" " " " " " " From 9b099f474b8a677095d301a467c6f5446fde3512 Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Tue, 5 Apr 2011 13:05:22 +0200 Subject: [PATCH 264/558] Added copyright headers for sponsored work --- .../mod_cdr_pg_csv/mod_cdr_pg_csv.c | 2 ++ .../mod_cdr_sqlite/mod_cdr_sqlite.c | 2 ++ .../event_handlers/mod_snmp/FREESWITCH-MIB | 33 +++++++++++++++++++ src/mod/event_handlers/mod_snmp/mod_snmp.c | 2 ++ src/mod/event_handlers/mod_snmp/subagent.c | 2 ++ src/mod/event_handlers/mod_snmp/subagent.h | 33 +++++++++++++++++++ 6 files changed, 74 insertions(+) diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 51194f4b14..0b96db82a1 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Michal Bielicki diff --git a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c index 9a286d454f..abdb8101f6 100644 --- a/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c +++ b/src/mod/event_handlers/mod_cdr_sqlite/mod_cdr_sqlite.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Daniel Swarbrick diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB index 84485269f9..e2fc1998fd 100644 --- a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB +++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB @@ -1,3 +1,36 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. + * + * Contributor(s): + * Daniel Swarbrick + * Stefan Knoblich + * + * MIB Definition for mod_snmp + * + */ + FREESWITCH-MIB DEFINITIONS ::= BEGIN IMPORTS diff --git a/src/mod/event_handlers/mod_snmp/mod_snmp.c b/src/mod/event_handlers/mod_snmp/mod_snmp.c index d415d4fe1c..059646bc19 100644 --- a/src/mod/event_handlers/mod_snmp/mod_snmp.c +++ b/src/mod/event_handlers/mod_snmp/mod_snmp.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Daniel Swarbrick diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index 871fb5ad75..8d58667687 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -20,6 +20,8 @@ * Anthony Minessale II * Portions created by the Initial Developer are Copyright (C) * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. * * Contributor(s): * Daniel Swarbrick diff --git a/src/mod/event_handlers/mod_snmp/subagent.h b/src/mod/event_handlers/mod_snmp/subagent.h index 5da87a6c4e..ba3c523d49 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.h +++ b/src/mod/event_handlers/mod_snmp/subagent.h @@ -1,3 +1,36 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) + * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. + * + * Contributor(s): + * Daniel Swarbrick + * Stefan Knoblich + * + * subagent.h -- SNMP Agent Definitions + * + */ + #ifndef subagent_H #define subagent_H From 31cebd4fb336806d6fe0a8434c4d22fd792df99c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 5 Apr 2011 10:35:52 -0500 Subject: [PATCH 265/558] --resolve FS-3219 --- .../mod_conference/mod_conference.c | 144 ++++++++++++++++-- 1 file changed, 132 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 7de7f4fdea..16451b66a9 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -156,7 +156,9 @@ typedef enum { CFLAG_VID_FLOOR = (1 << 8), CFLAG_WASTE_BANDWIDTH = (1 << 9), CFLAG_OUTCALL = (1 << 10), - CFLAG_INHASH = (1 << 11) + CFLAG_INHASH = (1 << 11), + CFLAG_EXIT_SOUND = (1 << 12), + CFLAG_ENTER_SOUND = (1 << 13) } conf_flag_t; typedef enum { @@ -717,12 +719,14 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe if (!switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ) && !zstr(conference->enter_sound)) { const char * enter_sound = switch_channel_get_variable(channel, "conference_enter_sound"); - if (!zstr(enter_sound)) { - conference_play_file(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, - switch_core_session_get_channel(member->session), !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); - } else { - conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), - !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + if (switch_test_flag(conference, CFLAG_ENTER_SOUND)) { + if (!zstr(enter_sound)) { + conference_play_file(conference, (char *)enter_sound, CONF_DEFAULT_LEADIN, + switch_core_session_get_channel(member->session), !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } else { + conference_play_file(conference, conference->enter_sound, CONF_DEFAULT_LEADIN, switch_core_session_get_channel(member->session), + !switch_test_flag(conference, CFLAG_WAIT_MOD) ? 0 : 1); + } } } } @@ -906,7 +910,7 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe || (switch_test_flag(conference, CFLAG_DYNAMIC) && conference->count == 0)) { switch_set_flag(conference, CFLAG_DESTRUCT); } else { - if (conference->exit_sound) { + if (conference->exit_sound && switch_test_flag(conference, CFLAG_EXIT_SOUND)) { conference_play_file(conference, conference->exit_sound, 0, switch_core_session_get_channel(member->session), 0); } if (conference->count == 1 && conference->alone_sound && !switch_test_flag(conference, CFLAG_WAIT_MOD)) { @@ -4023,7 +4027,7 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_snprintf(i, sizeof(i), "%u", conference->rate); switch_xml_set_attr_d(x_conference, "rate", ival); switch_xml_set_attr_d(x_conference, "uuid", conference->uuid_str); - + if (switch_test_flag(conference, CFLAG_LOCKED)) { switch_xml_set_attr_d(x_conference, "locked", "true"); } @@ -4056,6 +4060,14 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_xml_set_attr_d(x_conference, "dynamic", "true"); } + if (switch_test_flag(conference, CFLAG_EXIT_SOUND)) { + switch_xml_set_attr_d(x_conference, "exit_sound", "true"); + } + + if (switch_test_flag(conference, CFLAG_ENTER_SOUND)) { + switch_xml_set_attr_d(x_conference, "enter_sound", "true"); + } + if (conference->record_count > 0) { switch_xml_set_attr_d(x_conference, "recording", "true"); } @@ -4516,6 +4528,107 @@ static switch_status_t conf_api_sub_unlock(conference_obj_t *conference, switch_ return 0; } +static switch_status_t conf_api_sub_exit_sound(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + switch_event_t *event; + + switch_assert(conference != NULL); + switch_assert(stream != NULL); + + if (argc <= 2) { + stream->write_function(stream, "Not enough args\n"); + return SWITCH_STATUS_GENERR; + } + + if ( !strcasecmp(argv[2], "on") ) { + switch_set_flag_locked(conference, CFLAG_EXIT_SOUND); + stream->write_function(stream, "OK %s exit sounds on (%s)\n", argv[0], conference->exit_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sounds-on"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "off") || !strcasecmp(argv[2], "none") ) { + switch_clear_flag_locked(conference, CFLAG_EXIT_SOUND); + stream->write_function(stream, "OK %s exit sounds off (%s)\n", argv[0], conference->exit_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sounds-off"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "file") ) { + if (! argv[3]) { + stream->write_function(stream, "No filename specified\n"); + } else { + /* TODO: if possible, verify file exists before setting it */ + stream->write_function(stream,"Old exit sound: [%s]\n", conference->exit_sound); + conference->exit_sound = switch_core_strdup(conference->pool, argv[3]); + stream->write_function(stream, "OK %s exit sound file set to %s\n", argv[0], conference->exit_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "exit-sound-file-changed"); + switch_event_fire(&event); + } + } + } else { + stream->write_function(stream, "Bad args\n"); + return SWITCH_STATUS_GENERR; + } + + return 0; +} + + +static switch_status_t conf_api_sub_enter_sound(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) +{ + switch_event_t *event; + + switch_assert(conference != NULL); + switch_assert(stream != NULL); + + if (argc <= 2) { + stream->write_function(stream, "Not enough args\n"); + return SWITCH_STATUS_GENERR; + } + + if ( !strcasecmp(argv[2], "on") ) { + switch_set_flag_locked(conference, CFLAG_ENTER_SOUND); + stream->write_function(stream, "OK %s enter sounds on (%s)\n", argv[0], conference->enter_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sounds-on"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "off") || !strcasecmp(argv[2], "none") ) { + switch_clear_flag_locked(conference, CFLAG_ENTER_SOUND); + stream->write_function(stream, "OK %s enter sounds off (%s)\n", argv[0], conference->enter_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sounds-off"); + switch_event_fire(&event); + } + } else if ( !strcasecmp(argv[2], "file") ) { + if (! argv[3]) { + stream->write_function(stream, "No filename specified\n"); + } else { + /* TODO: verify file exists before setting it */ + conference->enter_sound = switch_core_strdup(conference->pool, argv[3]); + stream->write_function(stream, "OK %s enter sound file set to %s\n", argv[0], conference->enter_sound); + if (test_eflag(conference, EFLAG_LOCK) && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { + conference_add_event_data(conference, event); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Action", "enter-sound-file-changed"); + switch_event_fire(&event); + } + } + } else { + stream->write_function(stream, "Bad args\n"); + return SWITCH_STATUS_GENERR; + } + + return 0; +} + + static switch_status_t conf_api_sub_dial(conference_obj_t *conference, switch_stream_handle_t *stream, int argc, char **argv) { switch_call_cause_t cause; @@ -4720,7 +4833,9 @@ typedef enum { CONF_API_COMMAND_BGDIAL, CONF_API_COMMAND_TRANSFER, CONF_API_COMMAND_RECORD, - CONF_API_COMMAND_NORECORD + CONF_API_COMMAND_NORECORD, + CONF_API_COMMAND_EXIT_SOUND, + CONF_API_COMMAND_ENTER_SOUND, } api_command_type_t; /* API Interface Function sub-commands */ @@ -4750,6 +4865,8 @@ static api_command_t conf_api_sub_commands[] = { {"transfer", (void_fn_t) & conf_api_sub_transfer, CONF_API_SUB_ARGS_SPLIT, "transfer", " [...]"}, {"record", (void_fn_t) & conf_api_sub_record, CONF_API_SUB_ARGS_SPLIT, "record", ""}, {"norecord", (void_fn_t) & conf_api_sub_norecord, CONF_API_SUB_ARGS_SPLIT, "norecord", "<[filename|all]>"}, + {"exit_sound", (void_fn_t) & conf_api_sub_exit_sound, CONF_API_SUB_ARGS_SPLIT, "exit_sound", "on|off|none|file "}, + {"enter_sound", (void_fn_t) & conf_api_sub_enter_sound, CONF_API_SUB_ARGS_SPLIT, "enter_sound", "on|off|none|file "}, {"pin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "pin", ""}, {"nopin", (void_fn_t) & conf_api_sub_pin, CONF_API_SUB_ARGS_SPLIT, "nopin", ""}, }; @@ -5330,7 +5447,7 @@ static void set_cflags(const char *flags, uint32_t *f) } else if (!strcasecmp(argv[i], "waste-bandwidth")) { *f |= CFLAG_WASTE_BANDWIDTH; } - } + } free(dup); } @@ -6620,7 +6737,10 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c switch_uuid_format(uuid_str, &uuid); conference->uuid_str = switch_core_strdup(conference->pool, uuid_str); - + /* Set enter sound and exit sound flags so that default is on */ + switch_set_flag(conference, CFLAG_ENTER_SOUND); + switch_set_flag(conference, CFLAG_EXIT_SOUND); + /* Activate the conference mutex for exclusivity */ switch_mutex_init(&conference->mutex, SWITCH_MUTEX_NESTED, conference->pool); switch_mutex_init(&conference->flag_mutex, SWITCH_MUTEX_NESTED, conference->pool); From 0632d22cc887506d2ff46933412b707d382ebb19 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Tue, 5 Apr 2011 23:02:50 +0200 Subject: [PATCH 266/558] SNMP MIBs have their own comment style --- .../event_handlers/mod_snmp/FREESWITCH-MIB | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB index e2fc1998fd..68d83fe433 100644 --- a/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB +++ b/src/mod/event_handlers/mod_snmp/FREESWITCH-MIB @@ -1,35 +1,33 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is - * Anthony Minessale II - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) - * Seventh Signal Ltd. & Co. KG, All Rights Reserverd. - * - * Contributor(s): - * Daniel Swarbrick - * Stefan Knoblich - * - * MIB Definition for mod_snmp - * - */ + +-- FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application +-- Copyright (C) 2005-2011, Anthony Minessale II +-- +-- Version: MPL 1.1 +-- +-- The contents of this file are subject to the Mozilla Public License Version +-- 1.1 (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- http://www.mozilla.org/MPL/ +-- +-- Software distributed under the License is distributed on an "AS IS" basis, +-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +-- for the specific language governing rights and limitations under the +-- License. +-- +-- The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application +-- +-- The Initial Developer of the Original Code is +-- Anthony Minessale II +-- Portions created by the Initial Developer are Copyright (C) +-- the Initial Developer. All Rights Reserved. +-- Portions created by Seventh Signal Ltd. & Co. KG and its employees are Copyright (C) +-- Seventh Signal Ltd. & Co. KG, All Rights Reserverd. +-- +-- Contributor(s): +-- Daniel Swarbrick +-- Stefan Knoblich +-- +-- MIB Definition for mod_snmp FREESWITCH-MIB DEFINITIONS ::= BEGIN From 95072fee6659cccdf0afa61c678f01c11ae3b969 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 5 Apr 2011 17:12:33 -0400 Subject: [PATCH 267/558] freetdm: SS7 decreased some unsollicited status messages from Trillium to debug level --- .../ftmod_sangoma_ss7_logger.c | 37 ++++++++----------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c index 2e6fc7e8a0..4b5787c0cb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_logger.c @@ -149,24 +149,19 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) switch (sta->t.usta.alarm.cause) { - /******************************************************************/ - case (LCM_CAUSE_UNKNOWN): - ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event)); - break; - /******************************************************************/ - case (LCM_CAUSE_MGMT_INITIATED): - ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s[MGMT] %s\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event)); - break; - /******************************************************************/ - default: - ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s (***unknown cause***)\n", - buf, - DECODE_LSD_EVENT(sta->t.usta.alarm.event)); - break; + case (LCM_CAUSE_MGMT_INITIATED): + ftdm_log(FTDM_LOG_DEBUG,"[MTP2]%s[MGMT] cause:%s event:%s\n", + buf, + DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), + DECODE_LSD_EVENT(sta->t.usta.alarm.event)); + break; + case (LCM_CAUSE_UNKNOWN): + default: + ftdm_log(FTDM_LOG_DEBUG,"[MTP2]%s cause:%s event:%s\n", + buf, + DECODE_LCM_CAUSE(sta->t.usta.alarm.cause), + DECODE_LSD_EVENT(sta->t.usta.alarm.event)); + break; /******************************************************************/ } /* switch (sta->t.usta.alarm.cause) */ break; @@ -211,7 +206,7 @@ void handle_sng_mtp2_alarm(Pst *pst, SdMngmt *sta) sprintf(buf, "[%s]", g_ftdm_sngss7_data.cfg.mtp2Link[x].name); } - ftdm_log(FTDM_LOG_ERROR,"[MTP2]%s %s : %s\n", + ftdm_log(FTDM_LOG_DEBUG,"[MTP2]%s %s : %s\n", buf, DECODE_LSD_EVENT(sta->t.usta.alarm.event), DECODE_DISC_REASON(sta->t.usta.evntParm[1])); @@ -402,7 +397,7 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) break; /**********************************************************************/ default: - ftdm_log(FTDM_LOG_ERROR,"[MTP3]%s %s(%d) : %s(%d)\n", + ftdm_log(FTDM_LOG_DEBUG,"[MTP3]%s %s(%d) : %s(%d)\n", buf, DECODE_LSN_EVENT(sta->t.usta.alarm.event), sta->t.usta.alarm.event, @@ -421,7 +416,7 @@ void handle_sng_mtp3_alarm(Pst *pst, SnMngmt *sta) break; /**************************************************************************/ case (STLNKSET): - ftdm_log(FTDM_LOG_ERROR,"[MTP3][LNKSET:%d] %s : %s\n", + ftdm_log(FTDM_LOG_DEBUG,"[MTP3][LNKSET:%d] %s : %s\n", sta->hdr.elmId.elmntInst1, DECODE_LSN_EVENT(sta->t.usta.alarm.event), DECODE_LSN_CAUSE(sta->t.usta.alarm.cause)); From 8c98328433fb64125e37c97024c1662196eedad7 Mon Sep 17 00:00:00 2001 From: Daniel Swarbrick Date: Wed, 6 Apr 2011 15:36:35 +0200 Subject: [PATCH 268/558] Allow longer input regexes to be used in phrases --- src/switch_ivr_play_say.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 5980ea41c7..6c769ecfd8 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -193,7 +193,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio if (pattern) { switch_regex_t *re = NULL; - int proceed = 0, ovector[30]; + int proceed = 0, ovector[100]; char *substituted = NULL; uint32_t len = 0; char *odata = NULL; From 358e9aab2211769d6e6dd190c47b13a0d909ad02 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 6 Apr 2011 17:25:29 -0400 Subject: [PATCH 269/558] chlog:FreeTDM - SS7 Support for transmitting Redirecting Number --- libs/freetdm/mod_freetdm/mod_freetdm.c | 22 ++- .../ftmod_sangoma_ss7_main.h | 11 +- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 14 +- .../ftmod_sangoma_ss7_support.c | 174 ++++++++++++++++-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 17 +- 5 files changed, 204 insertions(+), 34 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index b8bd67fc1b..8739c4c0bf 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1264,6 +1264,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_data.ani.plan = (uint8_t)atoi(sipvar); } + /* Used by ftmod_sangoma_ss7 only */ + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI-NADI"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_clg_nadi", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-ANI2"); if (sipvar) { ftdm_set_string(caller_data.aniII, sipvar); @@ -1284,6 +1290,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_data.dnis.plan = (uint8_t)atoi(sipvar); } + /* Used by ftmod_sangoma_ss7 only */ + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-DNIS-NADI"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_clg_nadi", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS"); if (sipvar) { ftdm_set_string(caller_data.rdnis.digits, sipvar); @@ -1299,6 +1311,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi caller_data.rdnis.plan = (uint8_t)atoi(sipvar); } + /* Used by ftmod_sangoma_ss7 only */ + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_nadi", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); if (sipvar) { caller_data.screen = (uint8_t)atoi(sipvar); @@ -1308,6 +1326,8 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi if (sipvar) { caller_data.pres = (uint8_t)atoi(sipvar); } + + } if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) { @@ -1568,7 +1588,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS", "%s", channel_caller_data->rdnis.digits); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-TON", "%d", channel_caller_data->rdnis.type); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan); - + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index e7372ecd28..ea31a89c5b 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -316,8 +316,11 @@ typedef struct sng_isup_ckt { uint32_t typeCntrl; uint32_t ssf; uint32_t switchType; + uint32_t clg_nadi; uint32_t cld_nadi; + uint8_t rdnis_nadi; + uint32_t min_digits; void *obj; uint16_t t3; @@ -786,8 +789,12 @@ uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); -uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); -uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); +ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); + + +ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); +ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); +ftdm_status_t copy_tknStr_to_sngss7(char* str, TknStr *tknStr, TknU8 *oddEven); int check_for_state_change(ftdm_channel_t *ftdmchan); int check_cics_in_range(sngss7_chan_data_t *sngss7_info); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 96446b4215..0e73c05c07 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -182,19 +182,9 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* copy down the called number information */ copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); - /* copy down the calling number information */ - + /* copy down the calling number information */ copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); - /* check if the user would like a custom NADI value for the calling Pty Num */ - clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); - if ((clg_nadi != NULL) && (*clg_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); - iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); - } else { - iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].clg_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val); - } cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); if ((cld_nadi != NULL) && (*cld_nadi)) { @@ -244,6 +234,8 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /* if (subAddrIE[0] != '0') */ } + copy_redirgNum_to_sngss7(ftdmchan, &iam.redirgNum); + /* check if the user would like us to send a cld_sub-address */ cld_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_subaddr"); if ((cld_subAddr != NULL) && (*cld_subAddr)) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 4513deebea..22b522409f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -43,13 +43,6 @@ uint32_t sngss7_id; /******************************************************************************/ /* PROTOTYPES *****************************************************************/ -uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); -uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); -uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); -uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); -uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); -uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); - int check_for_state_change(ftdm_channel_t *ftdmchan); int check_cics_in_range(sngss7_chan_data_t *sngss7_info); int check_for_reset(sngss7_chan_data_t *sngss7_info); @@ -134,11 +127,12 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) cgPtyNum->niInd.val = 0x00; /**************************************************************************/ cgPtyNum->addrSig.pres = PRSNT_NODEF; - + /* atoi will search through memory starting from the pointer it is given until * it finds the \0...since tmp is on the stack it will start going through the * possibly causing corruption. Hard code a \0 to prevent this */ + tmp[1] = '\0'; k = 0; j = 0; @@ -334,8 +328,68 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) return 0; } -/******************************************************************************/ -uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) + +ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum) +{ + const char* val = NULL; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + uint8_t len = strlen(caller_data->rdnis.digits); + if (!len) { + return FTDM_SUCCESS; + } + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number %s\n", caller_data->rdnis.digits); + + redirgNum->eh.pres = PRSNT_NODEF; + + /* Nature of address indicator */ + redirgNum->natAddr.pres = PRSNT_NODEF; + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_nadi"); + if (!ftdm_strlen_zero(val)) { + redirgNum->natAddr.val = atoi(val); + } else { + redirgNum->natAddr.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].rdnis_nadi; + } + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val); + + /* Screening indicator */ + redirgNum->scrInd.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_screen_ind"); + if (!ftdm_strlen_zero(val)) { + redirgNum->scrInd.val = atoi(val); + } else { + redirgNum->scrInd.val = FTDM_SCREENING_VERIFIED_PASSED; + } + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val); + + /* Address presentation restricted ind */ + redirgNum->presRest.pres = PRSNT_NODEF; + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_pres_ind"); + if (!ftdm_strlen_zero(val)) { + redirgNum->presRest.val = atoi(val); + } else { + redirgNum->presRest.val = FTDM_PRES_ALLOWED; + } + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val); + + /* Numbering plan */ + redirgNum->numPlan.pres = PRSNT_NODEF; + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_plan"); + if (!ftdm_strlen_zero(val)) { + redirgNum->numPlan.val = atoi(val); + } else { + redirgNum->numPlan.val = caller_data->rdnis.plan; + } + + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val); + + return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven); +} + +ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) { uint8_t i; uint8_t j; @@ -362,14 +416,14 @@ uint8_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) } else { SS7_ERROR("Asked to copy tknStr that is not present!\n"); - return 1; + return FTDM_FAIL; } - return 0; + return FTDM_SUCCESS; } /******************************************************************************/ -uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) +ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) { int i = 0; int j = 0; @@ -382,7 +436,7 @@ uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) /* confirm that we found an acceptable length */ if ( j > 25 ) { SS7_ERROR("string length exceeds maxium value...aborting append!\n"); - return 1; + return FTDM_FAIL; } /* if ( j > 25 ) */ /* copy in digits */ @@ -405,12 +459,100 @@ uint8_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) } /* if ((oddEven.pres == 1) && (oddEven.val == 1)) */ } else { SS7_ERROR("Asked to copy tknStr that is not present!\n"); - return 1; + return FTDM_FAIL; } /* if (str.pres == 1) */ - return 0; + return FTDM_SUCCESS; } + +ftdm_status_t copy_tknStr_to_sngss7(char* val, TknStr *tknStr, TknU8 *oddEven) +{ + char tmp[2]; + int k = 0; + int j = 0; + uint8_t flag = 0; + uint8_t odd = 0; + + uint8_t lower = 0x0; + uint8_t upper = 0x0; + + tknStr->pres = PRSNT_NODEF; + + /* atoi will search through memory starting from the pointer it is given until + * it finds the \0...since tmp is on the stack it will start going through the + * possibly causing corruption. Hard code a \0 to prevent this + */ + tmp[1] = '\0'; + + while (1) { + /* grab a digit from the ftdm digits */ + tmp[0] = val[k]; + + /* check if the digit is a number and that is not null */ + while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); + /* move on to the next value */ + k++; + tmp[0] = val[k]; + } /* while(!(isdigit(tmp))) */ + + /* check if tmp is null or a digit */ + if (tmp[0] != '\0') { + /* push it into the lower nibble */ + lower = strtol(&tmp[0], (char **)NULL, 16); + /* move to the next digit */ + k++; + /* grab a digit from the ftdm digits */ + tmp[0] = val[k]; + + /* check if the digit is a number and that is not null */ + while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { + SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); + k++; + tmp[0] = val[k]; + } /* while(!(isdigit(tmp))) */ + + /* check if tmp is null or a digit */ + if (tmp[0] != '\0') { + /* push the digit into the upper nibble */ + upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; + } else { + /* there is no upper ... fill in 0 */ + upper = 0x0; + /* throw the odd flag */ + odd = 1; + /* throw the end flag */ + flag = 1; + } /* if (tmp != '\0') */ + } else { + /* keep the odd flag down */ + odd = 0; + /* break right away since we don't need to write the digits */ + break; + } + + /* push the digits into the trillium structure */ + tknStr->val[j] = upper | lower; + + /* increment the trillium pointer */ + j++; + + /* if the flag is up we're through all the digits */ + if (flag) break; + + /* move to the next digit */ + k++; + } /* while(1) */ + + tknStr->len = j; + oddEven->pres = PRSNT_NODEF; + oddEven->val = odd; + return FTDM_SUCCESS; +} + + + /******************************************************************************/ int check_for_state_change(ftdm_channel_t *ftdmchan) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index bf347f0019..815377b476 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -122,6 +122,7 @@ typedef struct sng_ccSpan uint32_t ssf; uint32_t clg_nadi; uint32_t cld_nadi; + uint32_t rdnis_nadi; uint32_t min_digits; uint32_t t3; uint32_t t12; @@ -1841,6 +1842,7 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) int num_parms = cc_span->n_parameters; int flag_clg_nadi = 0; int flag_cld_nadi = 0; + int flag_rdnis_nadi = 0; int i; int ret; @@ -1912,16 +1914,17 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) flag_clg_nadi = 1; sng_ccSpan.clg_nadi = atoi(parm->val); SS7_DEBUG("Found default CLG_NADI parm->value = %d\n", sng_ccSpan.clg_nadi); - /**********************************************************************/ } else if (!strcasecmp(parm->var, "cld_nadi")) { - /**********************************************************************/ /* throw the flag so that we know we got this optional parameter */ flag_cld_nadi = 1; sng_ccSpan.cld_nadi = atoi(parm->val); SS7_DEBUG("Found default CLD_NADI parm->value = %d\n", sng_ccSpan.cld_nadi); - /**********************************************************************/ + } else if (!strcasecmp(parm->var, "rdnis_nadi")) { + /* throw the flag so that we know we got this optional parameter */ + flag_rdnis_nadi = 1; + sng_ccSpan.rdnis_nadi = atoi(parm->val); + SS7_DEBUG("Found default RDNIS_NADI parm->value = %d\n", sng_ccSpan.rdnis_nadi); } else if (!strcasecmp(parm->var, "obci_bita")) { - /**********************************************************************/ if (*parm->val == '1') { sngss7_set_options(&sng_ccSpan, SNGSS7_ACM_OBCI_BITA); SS7_DEBUG("Found Optional Backwards Indicator: Bit A (early media) enable option\n"); @@ -2012,6 +2015,11 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) sng_ccSpan.clg_nadi = 0x03; } + if (!flag_rdnis_nadi) { + /* default the nadi value to national */ + sng_ccSpan.rdnis_nadi = 0x03; + } + /* pull up the SSF and Switchtype from the isup interface */ sng_ccSpan.ssf = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].ssf; sng_ccSpan.switchType = g_ftdm_sngss7_data.cfg.isupIntf[sng_ccSpan.isupInf].switchType; @@ -2901,6 +2909,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) g_ftdm_sngss7_data.cfg.isupCkt[x].ssf = ccSpan->ssf; g_ftdm_sngss7_data.cfg.isupCkt[x].cld_nadi = ccSpan->cld_nadi; g_ftdm_sngss7_data.cfg.isupCkt[x].clg_nadi = ccSpan->clg_nadi; + g_ftdm_sngss7_data.cfg.isupCkt[x].rdnis_nadi = ccSpan->rdnis_nadi; g_ftdm_sngss7_data.cfg.isupCkt[x].options = ccSpan->options; g_ftdm_sngss7_data.cfg.isupCkt[x].switchType = ccSpan->switchType; g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits = ccSpan->min_digits; From 8e54baf4bdecc865a590ade5485001181cfa3866 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 6 Apr 2011 17:58:30 -0400 Subject: [PATCH 270/558] freetdm:fixed errors introduced when Redirection Number was implemented --- .../ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 0e73c05c07..9fe279d7c5 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -185,7 +185,16 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* copy down the calling number information */ copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); - + /* check if the user would like a custom NADI value for the calling Pty Num */ + clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); + if ((clg_nadi != NULL) && (*clg_nadi)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); + iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); + } else { + iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].clg_nadi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val); + } + cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); if ((cld_nadi != NULL) && (*cld_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); From b33015327ee7dc1fa536f45750e5331e46ce7173 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Wed, 6 Apr 2011 18:42:01 -0400 Subject: [PATCH 271/558] freetdm: apply gain before dumping to file --- libs/freetdm/src/ftdm_io.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 96fd235ad2..1ecd816658 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3565,6 +3565,14 @@ static FIO_READ_FUNCTION(ftdm_raw_read) ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen); if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) { ftdm_size_t dlen = *datalen; + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) + && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { + int i = 0; + unsigned char *rdata = data; + for (i = 0; i < *datalen; i++) { + rdata[i] = ftdmchan->rxgain_table[rdata[i]]; + } + } if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, (int)dlen) != dlen) { ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %"FTDM_SIZE_FMT" bytes\n", dlen); } @@ -3730,7 +3738,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data ftdm_status_t status = FTDM_FAIL; fio_codec_t codec_func = NULL; ftdm_size_t max = *datalen; - unsigned i = 0; ftdm_assert_return(ftdmchan != NULL, FTDM_FAIL, "ftdmchan is null\n"); ftdm_assert_return(ftdmchan->fio != NULL, FTDM_FAIL, "No I/O module attached to ftdmchan\n"); @@ -3769,13 +3776,6 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data goto done; } - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) - && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { - unsigned char *rdata = data; - for (i = 0; i < *datalen; i++) { - rdata[i] = ftdmchan->rxgain_table[rdata[i]]; - } - } handle_tone_generation(ftdmchan); if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { From 8270ccb1ad856bf3e9aa0f21f899a1eff4a0c2b3 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Thu, 7 Apr 2011 11:21:50 -0400 Subject: [PATCH 272/558] freetdm: fix rx gain --- libs/freetdm/src/ftdm_io.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1ecd816658..1d7a0d1eb1 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3563,16 +3563,18 @@ static FIO_WRITE_FUNCTION(ftdm_raw_write) static FIO_READ_FUNCTION(ftdm_raw_read) { ftdm_status_t status = ftdmchan->fio->read(ftdmchan, data, datalen); + + if (status == FTDM_SUCCESS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) + && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { + int i = 0; + unsigned char *rdata = data; + for (i = 0; i < *datalen; i++) { + rdata[i] = ftdmchan->rxgain_table[rdata[i]]; + } + } + if (status == FTDM_SUCCESS && ftdmchan->fds[FTDM_READ_TRACE_INDEX] > -1) { ftdm_size_t dlen = *datalen; - if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) - && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { - int i = 0; - unsigned char *rdata = data; - for (i = 0; i < *datalen; i++) { - rdata[i] = ftdmchan->rxgain_table[rdata[i]]; - } - } if ((ftdm_size_t)write(ftdmchan->fds[FTDM_READ_TRACE_INDEX], data, (int)dlen) != dlen) { ftdm_log(FTDM_LOG_WARNING, "Raw input trace failed to write all of the %"FTDM_SIZE_FMT" bytes\n", dlen); } From 5310735c5f257c52be63efb1dd12221c4c330460 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 7 Apr 2011 15:47:30 -0500 Subject: [PATCH 273/558] FS-3232 --resolve using relative path in windows script --- src/switch_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/switch_core.c b/src/switch_core.c index 85e795c408..0ee4708a3d 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -480,9 +480,13 @@ SWITCH_DECLARE(void) switch_core_set_globals(void) DWORD dwBufSize = BUFSIZE; char base_dir[1024]; char *lastbacklash; + GetModuleFileName(NULL, base_dir, BUFSIZE); lastbacklash = strrchr(base_dir, '\\'); base_dir[(lastbacklash - base_dir)] = '\0'; + /* set base_dir as cwd, to be able to use relative paths in scripting languages (e.g. mod_lua) when FS is running as a service or while debugging FS using visual studio */ + SetCurrentDirectory(base_dir); + #else char base_dir[1024] = SWITCH_PREFIX_DIR; #endif From 3de9b51a8632b0e41af03a1dbdfb2e5ed8e135fb Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 8 Apr 2011 14:53:59 +0200 Subject: [PATCH 274/558] ftmod_isdn: Fix warnings No guarantee this module still works, but it compiles again. Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c index a7b84ea5d8..4abddf16e1 100644 --- a/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_isdn/ftmod_isdn.c @@ -979,7 +979,6 @@ static L3INT ftdm_isdn_931_34(void *pvt, struct Q931_Call *call, Q931mes_Generic { Q931ie_CallingNum *callingnum = Q931GetIEPtr(gen->CallingNum, gen->buf); Q931ie_CalledNum *callednum = Q931GetIEPtr(gen->CalledNum, gen->buf); - uint32_t cplen = mlen; int overlap_dial = 0; int fail_cause = 0; int fail = 1; @@ -2128,7 +2127,7 @@ static int ftdm_isdn_q921_log(void *pvt, Q921LogLevel_t level, char *msg, L2INT return 0; } -static L3INT ftdm_isdn_q931_log(void *pvt, Q931LogLevel_t level, char *msg, L3INT size) +static L3INT ftdm_isdn_q931_log(void *pvt, Q931LogLevel_t level, const char *msg, L3INT size) { ftdm_span_t *span = (ftdm_span_t *) pvt; From 1604f08e33c8acf24aab21194684cb5685284f90 Mon Sep 17 00:00:00 2001 From: Brian West Date: Fri, 8 Apr 2011 13:46:02 -0500 Subject: [PATCH 275/558] rebind sighandlers --- src/include/switch_core.h | 1 + src/switch_core.c | 49 ++++++++++++++++++++---------------- src/switch_loadable_module.c | 2 ++ 3 files changed, 31 insertions(+), 21 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 684cc4f777..5a2b8992b2 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -2205,6 +2205,7 @@ SWITCH_DECLARE(switch_bool_t) switch_cache_db_test_reactive(switch_cache_db_hand SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute(switch_cache_db_handle_t *dbh, const char *sql, uint32_t retries); SWITCH_DECLARE(switch_status_t) switch_cache_db_persistant_execute_trans(switch_cache_db_handle_t *dbh, char *sql, uint32_t retries); +SWITCH_DECLARE(void) switch_core_set_signal_handlers(void); SWITCH_DECLARE(uint32_t) switch_core_debug_level(void); SWITCH_DECLARE(void) switch_cache_db_flush_handles(void); SWITCH_DECLARE(const char *) switch_core_banner(void); diff --git a/src/switch_core.c b/src/switch_core.c index 0ee4708a3d..623f1067a4 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1772,27 +1772,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t runtime.runlevel++; - /* set signal handlers */ - signal(SIGINT, SIG_IGN); -#ifdef SIGPIPE - signal(SIGPIPE, handle_SIGPIPE); -#endif -#ifdef SIGQUIT - signal(SIGQUIT, handle_SIGQUIT); -#endif -#ifdef SIGPOLL - signal(SIGPOLL, handle_SIGPOLL); -#endif -#ifdef SIGIO - signal(SIGIO, handle_SIGIO); -#endif -#ifdef TRAP_BUS - signal(SIGBUS, handle_SIGBUS); -#endif -#ifdef SIGUSR1 - signal(SIGUSR1, handle_SIGHUP); -#endif - signal(SIGHUP, handle_SIGHUP); + switch_core_set_signal_handlers(); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Bringing up environment.\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Loading Modules.\n"); @@ -1806,6 +1786,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init_and_modload(switch_core_flag_t switch_load_core_config("post_load_switch.conf"); + switch_core_set_signal_handlers(); + if (switch_event_create(&event, SWITCH_EVENT_STARTUP) == SWITCH_STATUS_SUCCESS) { switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Event-Info", "System Ready"); switch_event_fire(&event); @@ -1869,6 +1851,31 @@ static void win_shutdown(void) } #endif +SWITCH_DECLARE(void) switch_core_set_signal_handlers(void) +{ + /* set signal handlers */ + signal(SIGINT, SIG_IGN); +#ifdef SIGPIPE + signal(SIGPIPE, handle_SIGPIPE); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, handle_SIGQUIT); +#endif +#ifdef SIGPOLL + signal(SIGPOLL, handle_SIGPOLL); +#endif +#ifdef SIGIO + signal(SIGIO, handle_SIGIO); +#endif +#ifdef TRAP_BUS + signal(SIGBUS, handle_SIGBUS); +#endif +#ifdef SIGUSR1 + signal(SIGUSR1, handle_SIGHUP); +#endif + signal(SIGHUP, handle_SIGHUP); +} + SWITCH_DECLARE(uint32_t) switch_core_debug_level(void) { return runtime.debug_level; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 9804e53238..627aa46707 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -945,6 +945,8 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena *new_module = module; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Successfully Loaded [%s]\n", module_interface->module_name); + switch_core_set_signal_handlers(); + return SWITCH_STATUS_SUCCESS; } From a909940385c51ac668af03b683f95ce9543a5218 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 8 Apr 2011 15:13:11 -0400 Subject: [PATCH 276/558] conf: Only english is built by default.y --- conf/autoload_configs/modules.conf.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/autoload_configs/modules.conf.xml b/conf/autoload_configs/modules.conf.xml index 14a5bc8084..96079cd227 100644 --- a/conf/autoload_configs/modules.conf.xml +++ b/conf/autoload_configs/modules.conf.xml @@ -113,7 +113,7 @@ - + From bcd6c3a1881e7517ca54f4e4ee3533e5b4588b70 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Apr 2011 14:04:01 -0500 Subject: [PATCH 277/558] FS-3137 --resolve less of a memory leak more of a pool swelling, replaced a pool strdup that could recur with a strdup/free to avoid it --- .../mod_conference/mod_conference.c | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 16451b66a9..07a24355cf 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1996,22 +1996,20 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont switch_event_fire(&event); } - if ((mydata = switch_core_session_strdup(member->session, action->expanded_data))) { - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { - if (argc > 0) { - app = argv[0]; - } - if (argc > 1) { - arg = argv[1]; - } + mydata = strdup(action->expanded_data); + switch_assert(mydata); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", - (char *) action->expanded_data); - goto done; + if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (argc > 0) { + app = argv[0]; } + if (argc > 1) { + arg = argv[1]; + } + } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Unable to allocate memory to duplicate execute_app data.\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_ERROR, "Empty execute app string [%s]\n", + (char *) action->expanded_data); goto done; } @@ -2029,8 +2027,11 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont switch_core_session_execute_application(member->session, app, arg); switch_core_session_set_read_codec(member->session, &member->read_codec); switch_channel_clear_app_flag(channel, CF_APP_TAGGED); + done: + switch_safe_free(mydata); + return; } From 758949cda71c9c840ae8914cd5000ab08e9ac0bf Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 8 Apr 2011 14:23:16 -0500 Subject: [PATCH 278/558] move sig messages up to DEBUG1 --- src/switch_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index 623f1067a4..d3a696bef5 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1444,7 +1444,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc static void handle_SIGQUIT(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig Quit!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig Quit!\n"); return; } #endif @@ -1453,7 +1453,7 @@ static void handle_SIGQUIT(int sig) static void handle_SIGPIPE(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig Pipe!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig Pipe!\n"); return; } #endif @@ -1462,7 +1462,7 @@ static void handle_SIGPIPE(int sig) static void handle_SIGPOLL(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig Poll!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig Poll!\n"); return; } #endif @@ -1471,7 +1471,7 @@ static void handle_SIGPOLL(int sig) static void handle_SIGIO(int sig) { if (sig); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig I/O!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig I/O!\n"); return; } #endif @@ -1479,7 +1479,7 @@ static void handle_SIGIO(int sig) #ifdef TRAP_BUS static void handle_SIGBUS(int sig) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Sig BUS!\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Sig BUS!\n"); return; } #endif From 84b1f7483f32f29e30dadb2891671b608bdb57e3 Mon Sep 17 00:00:00 2001 From: Buklov Boris Date: Fri, 8 Apr 2011 23:55:33 +0400 Subject: [PATCH 279/558] fix SST_SHORT_DATE_TIME thanks sibsvt@gmail.com --- src/mod/say/mod_say_ru/mod_say_ru.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 5e628ccf47..51a0cc4e2b 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -451,6 +451,7 @@ static switch_status_t ru_say_time(switch_say_file_handle_t *sh, char *tosay, sw break; case SST_SHORT_DATE_TIME: say_time = 1; + tm.tm_sec = 0; // Ð’ коротком варианте Ñекунды не проговариваем if (tm.tm_year != tm_now.tm_year) { say_date = 1; break; @@ -619,7 +620,7 @@ static switch_new_say_callback_ru_t choose_callback(switch_say_args_t *say_args) say_cb = ru_say_money; break; default: - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown Say type=[%d]\n", say_args->type); break; } From f44c90e04f7214c8873e03f505e41d460c7cd114 Mon Sep 17 00:00:00 2001 From: Raymond Chandler Date: Fri, 8 Apr 2011 17:03:50 -0400 Subject: [PATCH 280/558] more logging, cleanup, etc --- src/mod/applications/mod_lcr/mod_lcr.c | 43 +++++++++++++++++--------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 17bbb443b1..93f9c9617d 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -133,6 +133,7 @@ struct callback_obj { profile_t *profile; switch_core_session_t *session; switch_event_t *event; + float sell_rate; }; typedef struct callback_obj callback_t; @@ -666,8 +667,11 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa r = 0; goto end; } - + for (current = cbt->head; current; current = current->next) { + if (cbt->sell_rate && cbt->sell_rate > current->rate) { + continue; + } key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix); if (switch_core_hash_find(cbt->dedup_hash, key)) { @@ -760,10 +764,14 @@ static switch_status_t is_intrastatelata(callback_t *cb_struct) */ if (!cb_struct->lookup_number || strlen(cb_struct->lookup_number) != 11 || *cb_struct->lookup_number != '1' || !switch_is_number(cb_struct->lookup_number)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, + "%s doesn't appear to be a NANP number\n", cb_struct->lookup_number); /* dest doesn't appear to be NANP number */ return SWITCH_STATUS_GENERR; } if (!cb_struct->cid || strlen(cb_struct->cid) != 11 || *cb_struct->cid != '1' || !switch_is_number(cb_struct->cid)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, + "%s doesn't appear to be a NANP number\n", cb_struct->cid); /* cid not NANP */ return SWITCH_STATUS_GENERR; } @@ -821,6 +829,7 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct) digits_expanded = expand_digits(cb_struct->pool, digits_copy, cb_struct->profile->quote_in_list); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "Has NPA NXX: [%u == %u]\n", profile->profile_has_npanxx, SWITCH_TRUE); if (profile->profile_has_npanxx == SWITCH_TRUE) { is_intrastatelata(cb_struct); } @@ -843,6 +852,10 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct) if (cb_struct->session) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "we have a session\n"); if ((channel = switch_core_session_get_channel(cb_struct->session))) { + const char *sell_rate = switch_channel_get_variable(channel, "sell_rate"); + if (!zstr(sell_rate)) { + cb_struct->sell_rate = atof(sell_rate); + } switch_channel_set_variable_var_check(channel, "lcr_rate_field", rate_field, SWITCH_FALSE); switch_channel_set_variable_var_check(channel, "lcr_user_rate_field", user_rate_field, SWITCH_FALSE); switch_channel_set_variable_var_check(channel, "lcr_query_digits", digits_copy, SWITCH_FALSE); @@ -1062,13 +1075,17 @@ static switch_status_t lcr_load_config() if (zstr(custom_sql)) { /* use default sql */ sql_stream.write_function(&sql_stream, - "SELECT l.digits AS lcr_digits, c.carrier_name AS lcr_carrier_name, l.${lcr_rate_field} AS lcr_rate_field, cg.prefix AS lcr_gw_prefix, cg.suffix AS lcr_gw_suffix, l.lead_strip AS lcr_lead_strip, l.trail_strip AS lcr_trail_strip, l.prefix AS lcr_prefix, l.suffix AS lcr_suffix " + "SELECT l.digits AS lcr_digits, c.carrier_name AS lcr_carrier_name, l.${lcr_rate_field} AS lcr_rate_field, \ + cg.prefix AS lcr_gw_prefix, cg.suffix AS lcr_gw_suffix, l.lead_strip AS lcr_lead_strip, \ + l.trail_strip AS lcr_trail_strip, l.prefix AS lcr_prefix, l.suffix AS lcr_suffix " ); if (db_check("SELECT codec from carrier_gateway limit 1") == SWITCH_TRUE) { sql_stream.write_function(&sql_stream, ", cg.codec AS lcr_codec "); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "codec field defined.\n"); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "codec field not defined, please update your lcr carrier_gateway database schema.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "codec field not defined, please update your lcr carrier_gateway database schema.\n" + ); } if (db_check("SELECT cid from lcr limit 1") == SWITCH_TRUE) { sql_stream.write_function(&sql_stream, ", l.cid AS lcr_cid "); @@ -1076,12 +1093,15 @@ static switch_status_t lcr_load_config() } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "cid field not defined, please update your lcr database schema.\n"); } - sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN ("); + sql_stream.write_function(&sql_stream, "FROM lcr l JOIN carriers c ON l.carrier_id=c.id \ + JOIN carrier_gateway cg ON c.id=cg.carrier_id WHERE \ + c.enabled = '1' AND cg.enabled = '1' AND l.enabled = '1' AND digits IN ("); sql_stream.write_function(&sql_stream, "${lcr_query_expanded_digits}"); sql_stream.write_function(&sql_stream, ") AND CURRENT_TIMESTAMP BETWEEN date_start AND date_end "); if (profile->id > 0) { sql_stream.write_function(&sql_stream, "AND lcr_profile=%d ", profile->id); } + sql_stream.write_function(&sql_stream, "ORDER BY digits DESC%s", profile->order_by); if (db_random) { @@ -1880,16 +1900,11 @@ SWITCH_STANDARD_API(dialplan_lcr_admin_function) stream->write_function(stream, " has intrastate:\t%s\n", profile->profile_has_intrastate ? "true" : "false"); stream->write_function(stream, " has intralata:\t%s\n", profile->profile_has_intralata ? "true" : "false"); stream->write_function(stream, " has npanxx:\t%s\n", profile->profile_has_npanxx ? "true" : "false"); - stream->write_function(stream, " Reorder rate:\t%s\n", - profile->reorder_by_rate ? "enabled" : "disabled"); - stream->write_function(stream, " Info in headers:\t%s\n", - profile->info_in_headers ? "enabled" : "disabled"); - stream->write_function(stream, " Quote IN() List:\t%s\n", - profile->quote_in_list ? "enabled" : "disabled"); - stream->write_function(stream, " Sip Redirection Mode:\t%s\n", - profile->enable_sip_redir ? "enabled" : "disabled"); - stream->write_function(stream, " Import fields:\t%s\n", - profile->export_fields_str ? profile->export_fields_str : "(null)"); + stream->write_function(stream, " Reorder rate:\t%s\n", profile->reorder_by_rate ? "enabled" : "disabled"); + stream->write_function(stream, " Info in headers:\t%s\n", profile->info_in_headers ? "enabled" : "disabled"); + stream->write_function(stream, " Quote IN() List:\t%s\n", profile->quote_in_list ? "enabled" : "disabled"); + stream->write_function(stream, " Sip Redirection Mode:\t%s\n", profile->enable_sip_redir ? "enabled" : "disabled"); + stream->write_function(stream, " Import fields:\t%s\n", profile->export_fields_str ? profile->export_fields_str : "(null)"); stream->write_function(stream, " Limit type:\t%s\n", profile->limit_type); stream->write_function(stream, "\n"); } From f564d3838596a0541719282e42ad0194693797e9 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Fri, 8 Apr 2011 16:33:17 -0700 Subject: [PATCH 281/558] Add digit_timeout to ESL::IVR's playAndGetDigits method --- libs/esl/perl/ESL/IVR.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/esl/perl/ESL/IVR.pm b/libs/esl/perl/ESL/IVR.pm index f7919c1b94..5dc6088236 100644 --- a/libs/esl/perl/ESL/IVR.pm +++ b/libs/esl/perl/ESL/IVR.pm @@ -73,13 +73,13 @@ sub setVar($;) { sub playAndGetDigits($;) { my $self = shift; - my ($min, $max, $tries, $to, $term, $file, $invalid_file, $var, $regex) = @_; + my ($min, $max, $tries, $to, $term, $file, $invalid_file, $var, $regex, $digit_timeout) = @_; if (!$self->{_esl}->connected()) { return undef; } - $self->execute("play_and_get_digits", "$min $max $tries $to $term $file $invalid_file $var $regex"); + $self->execute("play_and_get_digits", "$min $max $tries $to $term $file $invalid_file $var $regex $digit_timeout"); return $self->getVar($var); From 04cf1770910a6ef2539a7c511d607d278001dff3 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Sun, 10 Apr 2011 08:21:47 -0700 Subject: [PATCH 282/558] Update phrase_en.xml to reflect newest prompts --- docs/phrase/phrase_en.xml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 56a8094d22..34901054e9 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -268,7 +268,9 @@ - + + + @@ -425,16 +427,17 @@ - - - - - + + + + + + From bd03d578d1563efd7da841b7f499682d33fff2e7 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Sun, 10 Apr 2011 22:58:09 +0200 Subject: [PATCH 283/558] Skinny: add CP-7921G and reindent --- src/mod/endpoints/mod_skinny/skinny_tables.c | 185 ++++++++++--------- src/mod/endpoints/mod_skinny/skinny_tables.h | 2 +- 2 files changed, 94 insertions(+), 93 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index e8e56568b3..0752a9531e 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -109,145 +109,146 @@ SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMes SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1) struct skinny_table SKINNY_DEVICE_TYPES[] = { - {"Cisco 30 SP+", 1}, - {"Cisco 12 SP+", 2}, - {"Cisco 12 SP", 3}, - {"Cisco 12", 4}, - {"Cisco 30 VIP", 5}, - {"Cisco IP Phone 7910", 6}, - {"Cisco IP Phone 7960", 7}, - {"Cisco IP Phone 7940", 8}, - {"Cisco IP Phone 7935", 9}, - {"Cisco ATA 186", 12}, + {"Cisco 30 SP+", 1}, + {"Cisco 12 SP+", 2}, + {"Cisco 12 SP", 3}, + {"Cisco 12", 4}, + {"Cisco 30 VIP", 5}, + {"Cisco IP Phone 7910", 6}, + {"Cisco IP Phone 7960", 7}, + {"Cisco IP Phone 7940", 8}, + {"Cisco IP Phone 7935", 9}, + {"Cisco ATA 186", 12}, + {"Cisco IP Phone CP-7921G", 365}, {"Cisco IP Phone CP-7962G", 404}, {"Cisco IP Phone CP-7965G", 436}, - {"Cisco IP Phone CP-7961G", 30018}, - {"Cisco IP Phone 7936", 30019}, - {NULL, 0} + {"Cisco IP Phone CP-7961G", 30018}, + {"Cisco IP Phone 7936", 30019}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType") SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1) struct skinny_table SKINNY_RING_TYPES[] = { - {"RingOff", SKINNY_RING_OFF}, - {"RingInside", SKINNY_RING_INSIDE}, - {"RingOutside", SKINNY_RING_OUTSIDE}, - {"RingFeature", SKINNY_RING_FEATURE}, - {NULL, 0} + {"RingOff", SKINNY_RING_OFF}, + {"RingInside", SKINNY_RING_INSIDE}, + {"RingOutside", SKINNY_RING_OUTSIDE}, + {"RingFeature", SKINNY_RING_FEATURE}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1) struct skinny_table SKINNY_RING_MODES[] = { - {"RingForever", SKINNY_RING_FOREVER}, - {"RingOnce", SKINNY_RING_ONCE}, - {NULL, 0} + {"RingForever", SKINNY_RING_FOREVER}, + {"RingOnce", SKINNY_RING_ONCE}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1) struct skinny_table SKINNY_BUTTONS[] = { - {"Unknown", SKINNY_BUTTON_UNKNOWN}, - {"LastNumberRedial", SKINNY_BUTTON_LAST_NUMBER_REDIAL}, - {"SpeedDial", SKINNY_BUTTON_SPEED_DIAL}, - {"Hold", SKINNY_BUTTON_HOLD}, - {"Transfer", SKINNY_BUTTON_TRANSFER}, - {"Line", SKINNY_BUTTON_LINE}, - {"Voicemail", SKINNY_BUTTON_VOICEMAIL}, - {"Privacy", SKINNY_BUTTON_PRIVACY}, - {"ServiceUrl", SKINNY_BUTTON_SERVICE_URL}, - {"Undefined", SKINNY_BUTTON_UNDEFINED}, - {NULL, 0} + {"Unknown", SKINNY_BUTTON_UNKNOWN}, + {"LastNumberRedial", SKINNY_BUTTON_LAST_NUMBER_REDIAL}, + {"SpeedDial", SKINNY_BUTTON_SPEED_DIAL}, + {"Hold", SKINNY_BUTTON_HOLD}, + {"Transfer", SKINNY_BUTTON_TRANSFER}, + {"Line", SKINNY_BUTTON_LINE}, + {"Voicemail", SKINNY_BUTTON_VOICEMAIL}, + {"Privacy", SKINNY_BUTTON_PRIVACY}, + {"ServiceUrl", SKINNY_BUTTON_SERVICE_URL}, + {"Undefined", SKINNY_BUTTON_UNDEFINED}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1) struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = { - {"SoftkeyRedial", SOFTKEY_REDIAL}, - {"SoftkeyNewcall", SOFTKEY_NEWCALL}, - {"SoftkeyHold", SOFTKEY_HOLD}, - {"SoftkeyTransfer", SOFTKEY_TRANSFER}, - {"SoftkeyCfwdall", SOFTKEY_CFWDALL}, - {"SoftkeyCfwdbusy", SOFTKEY_CFWDBUSY}, - {"SoftkeyCfwdnoanswer", SOFTKEY_CFWDNOANSWER}, - {"SoftkeyBackspace", SOFTKEY_BACKSPACE}, - {"SoftkeyEndcall", SOFTKEY_ENDCALL}, - {"SoftkeyResume", SOFTKEY_RESUME}, - {"SoftkeyAnswer", SOFTKEY_ANSWER }, - {"SoftkeyInfo", SOFTKEY_INFO}, - {"SoftkeyConfrm", SOFTKEY_CONFRM}, - {"SoftkeyPark", SOFTKEY_PARK}, - {"SoftkeyJoin", SOFTKEY_JOIN}, - {"SoftkeyMeetmeconfrm", SOFTKEY_MEETMECONFRM}, - {"SoftkeyCallpickup", SOFTKEY_CALLPICKUP}, - {"SoftkeyGrpcallpickup", SOFTKEY_GRPCALLPICKUP}, - {"SoftkeyDnd", SOFTKEY_DND}, - {"SoftkeyIdivert", SOFTKEY_IDIVERT}, - {NULL, 0} + {"SoftkeyRedial", SOFTKEY_REDIAL}, + {"SoftkeyNewcall", SOFTKEY_NEWCALL}, + {"SoftkeyHold", SOFTKEY_HOLD}, + {"SoftkeyTransfer", SOFTKEY_TRANSFER}, + {"SoftkeyCfwdall", SOFTKEY_CFWDALL}, + {"SoftkeyCfwdbusy", SOFTKEY_CFWDBUSY}, + {"SoftkeyCfwdnoanswer", SOFTKEY_CFWDNOANSWER}, + {"SoftkeyBackspace", SOFTKEY_BACKSPACE}, + {"SoftkeyEndcall", SOFTKEY_ENDCALL}, + {"SoftkeyResume", SOFTKEY_RESUME}, + {"SoftkeyAnswer", SOFTKEY_ANSWER }, + {"SoftkeyInfo", SOFTKEY_INFO}, + {"SoftkeyConfrm", SOFTKEY_CONFRM}, + {"SoftkeyPark", SOFTKEY_PARK}, + {"SoftkeyJoin", SOFTKEY_JOIN}, + {"SoftkeyMeetmeconfrm", SOFTKEY_MEETMECONFRM}, + {"SoftkeyCallpickup", SOFTKEY_CALLPICKUP}, + {"SoftkeyGrpcallpickup", SOFTKEY_GRPCALLPICKUP}, + {"SoftkeyDnd", SOFTKEY_DND}, + {"SoftkeyIdivert", SOFTKEY_IDIVERT}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown") SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0) struct skinny_table SKINNY_LAMP_MODES[] = { - {"Off", SKINNY_LAMP_OFF}, - {"On", SKINNY_LAMP_ON}, - {"Wink", SKINNY_LAMP_WINK}, - {"Flash", SKINNY_LAMP_FLASH}, - {"Blink", SKINNY_LAMP_BLINK}, - {NULL, 0} + {"Off", SKINNY_LAMP_OFF}, + {"On", SKINNY_LAMP_ON}, + {"Wink", SKINNY_LAMP_WINK}, + {"Flash", SKINNY_LAMP_FLASH}, + {"Blink", SKINNY_LAMP_BLINK}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1) struct skinny_table SKINNY_SPEAKER_MODES[] = { - {"SpeakerOn", SKINNY_SPEAKER_ON}, - {"SpeakerOff", SKINNY_SPEAKER_OFF}, - {NULL, 0} + {"SpeakerOn", SKINNY_SPEAKER_ON}, + {"SpeakerOff", SKINNY_SPEAKER_OFF}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1) struct skinny_table SKINNY_KEY_SETS[] = { - {"KeySetOnHook", SKINNY_KEY_SET_ON_HOOK}, - {"KeySetConnected", SKINNY_KEY_SET_CONNECTED}, - {"KeySetOnHold", SKINNY_KEY_SET_ON_HOLD}, - {"KeySetRingIn", SKINNY_KEY_SET_RING_IN}, - {"KeySetOffHook", SKINNY_KEY_SET_OFF_HOOK}, - {"KeySetConnectedWithTransfer", SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER}, - {"KeySetDigitsAfterDialingFirstDigit", SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT}, - {"KeySetConnectedWithConference", SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE}, - {"KeySetRingOut", SKINNY_KEY_SET_RING_OUT}, - {"KeySetOffHookWithFeatures", SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES}, - {"KeySetInUseHint", SKINNY_KEY_SET_IN_USE_HINT}, - {NULL, 0} + {"KeySetOnHook", SKINNY_KEY_SET_ON_HOOK}, + {"KeySetConnected", SKINNY_KEY_SET_CONNECTED}, + {"KeySetOnHold", SKINNY_KEY_SET_ON_HOLD}, + {"KeySetRingIn", SKINNY_KEY_SET_RING_IN}, + {"KeySetOffHook", SKINNY_KEY_SET_OFF_HOOK}, + {"KeySetConnectedWithTransfer", SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER}, + {"KeySetDigitsAfterDialingFirstDigit", SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT}, + {"KeySetConnectedWithConference", SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE}, + {"KeySetRingOut", SKINNY_KEY_SET_RING_OUT}, + {"KeySetOffHookWithFeatures", SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES}, + {"KeySetInUseHint", SKINNY_KEY_SET_IN_USE_HINT}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET") SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1) struct skinny_table SKINNY_CALL_STATES[] = { - {"OffHook", SKINNY_OFF_HOOK}, - {"OnHook", SKINNY_ON_HOOK}, - {"RingOut", SKINNY_RING_OUT}, - {"RingIn", SKINNY_RING_IN}, - {"Connected", SKINNY_CONNECTED}, - {"Busy", SKINNY_BUSY}, - {"LineInUse", SKINNY_LINE_IN_USE}, - {"Hold", SKINNY_HOLD}, - {"CallWaiting", SKINNY_CALL_WAITING}, - {"CallTransfer", SKINNY_CALL_TRANSFER}, - {"CallPark", SKINNY_CALL_PARK}, - {"Proceed", SKINNY_PROCEED}, - {"InUseRemotely", SKINNY_IN_USE_REMOTELY}, - {"InvalidNumber", SKINNY_INVALID_NUMBER}, - {NULL, 0} + {"OffHook", SKINNY_OFF_HOOK}, + {"OnHook", SKINNY_ON_HOOK}, + {"RingOut", SKINNY_RING_OUT}, + {"RingIn", SKINNY_RING_IN}, + {"Connected", SKINNY_CONNECTED}, + {"Busy", SKINNY_BUSY}, + {"LineInUse", SKINNY_LINE_IN_USE}, + {"Hold", SKINNY_HOLD}, + {"CallWaiting", SKINNY_CALL_WAITING}, + {"CallTransfer", SKINNY_CALL_TRANSFER}, + {"CallPark", SKINNY_CALL_PARK}, + {"Proceed", SKINNY_PROCEED}, + {"InUseRemotely", SKINNY_IN_USE_REMOTELY}, + {"InvalidNumber", SKINNY_INVALID_NUMBER}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown") SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1) struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = { - {"DeviceReset", SKINNY_DEVICE_RESET}, - {"DeviceRestart", SKINNY_DEVICE_RESTART}, - {NULL, 0} + {"DeviceReset", SKINNY_DEVICE_RESET}, + {"DeviceRestart", SKINNY_DEVICE_RESTART}, + {NULL, 0} }; SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1) diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 00ddf0c74d..84f2b6c297 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -92,7 +92,7 @@ const char *skinny_message_type2str(uint32_t id); uint32_t skinny_str2message_type(const char *str); #define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES) -extern struct skinny_table SKINNY_DEVICE_TYPES[15]; +extern struct skinny_table SKINNY_DEVICE_TYPES[16]; const char *skinny_device_type2str(uint32_t id); uint32_t skinny_str2device_type(const char *str); #define SKINNY_PUSH_DEVICE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_TYPES) From 8c814c82cfbad1eb92e56394b27153865807d565 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Sun, 10 Apr 2011 23:08:46 +0200 Subject: [PATCH 284/558] Skinny: put tables the other way (more standard) Done with: sed -i 's/{\(".*"\|NULL\), \(.*\)}/{\2, \1}/' src/mod/endpoints/mod_skinny/skinny_tables.c --- src/mod/endpoints/mod_skinny/skinny_tables.c | 328 +++++++++---------- src/mod/endpoints/mod_skinny/skinny_tables.h | 2 +- 2 files changed, 165 insertions(+), 165 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 0752a9531e..04237ad3ea 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -35,220 +35,220 @@ /* Translation tables */ struct skinny_table SKINNY_MESSAGE_TYPES[] = { - {"KeepAliveMessage", KEEP_ALIVE_MESSAGE}, - {"RegisterMessage", REGISTER_MESSAGE}, - {"PortMessage", PORT_MESSAGE}, - {"KeypadButtonMessage", KEYPAD_BUTTON_MESSAGE}, - {"EnblocCallMessage", ENBLOC_CALL_MESSAGE}, - {"StimulusMessage", STIMULUS_MESSAGE}, - {"OffHookMessage", OFF_HOOK_MESSAGE}, - {"OnHookMessage", ON_HOOK_MESSAGE}, - {"ForwardStatReqMessage", FORWARD_STAT_REQ_MESSAGE}, - {"SpeedDialStatReqMessage", SPEED_DIAL_STAT_REQ_MESSAGE}, - {"LineStatReqMessage", LINE_STAT_REQ_MESSAGE}, - {"ConfigStatReqMessage", CONFIG_STAT_REQ_MESSAGE}, - {"TimeDateReqMessage", TIME_DATE_REQ_MESSAGE}, - {"ButtonTemplateReqMessage", BUTTON_TEMPLATE_REQ_MESSAGE}, - {"VersionReqMessage", VERSION_REQ_MESSAGE}, - {"CapabilitiesReqMessage", CAPABILITIES_RES_MESSAGE}, - {"AlarmMessage", ALARM_MESSAGE}, - {"OpenReceiveChannelAckMessage", OPEN_RECEIVE_CHANNEL_ACK_MESSAGE}, - {"SoftKeySetReqMessage", SOFT_KEY_SET_REQ_MESSAGE}, - {"SoftKeyEventMessage", SOFT_KEY_EVENT_MESSAGE}, - {"UnregisterMessage", UNREGISTER_MESSAGE}, - {"SoftKeyTemplateReqMessage", SOFT_KEY_TEMPLATE_REQ_MESSAGE}, - {"HeadsetStatusMessage", HEADSET_STATUS_MESSAGE}, - {"RegisterAvailableLinesMessage", REGISTER_AVAILABLE_LINES_MESSAGE}, - {"DeviceToUserDataMessage", DEVICE_TO_USER_DATA_MESSAGE}, - {"DeviceToUserDataResponseMessage", DEVICE_TO_USER_DATA_RESPONSE_MESSAGE}, - {"ServiceUrlStatReqMessage", SERVICE_URL_STAT_REQ_MESSAGE}, - {"FeatureStatReqMessage", FEATURE_STAT_REQ_MESSAGE}, - {"DeviceToUserDataVersion1Message", DEVICE_TO_USER_DATA_VERSION1_MESSAGE}, - {"DeviceToUserDataResponseVersion1Message", DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE}, - {"RegisterAckMessage", REGISTER_ACK_MESSAGE}, - {"StartToneMessage", START_TONE_MESSAGE}, - {"StopToneMessage", STOP_TONE_MESSAGE}, - {"SetRingerMessage", SET_RINGER_MESSAGE}, - {"SetLampMessage", SET_LAMP_MESSAGE}, - {"SetSpeakerModeMessage", SET_SPEAKER_MODE_MESSAGE}, - {"StartMediaTransmissionMessage", START_MEDIA_TRANSMISSION_MESSAGE}, - {"StopMediaTransmissionMessage", STOP_MEDIA_TRANSMISSION_MESSAGE}, - {"CallInfoMessage", CALL_INFO_MESSAGE}, - {"ForwardStatMessage", FORWARD_STAT_MESSAGE}, - {"SpeedDialStatResMessage", SPEED_DIAL_STAT_RES_MESSAGE}, - {"LineStatResMessage", LINE_STAT_RES_MESSAGE}, - {"ConfigStatResMessage", CONFIG_STAT_RES_MESSAGE}, - {"DefineTimeDateMessage", DEFINE_TIME_DATE_MESSAGE}, - {"ButtonTemplateResMessage", BUTTON_TEMPLATE_RES_MESSAGE}, - {"VersionMessage", VERSION_MESSAGE}, - {"CapabilitiesReqMessage", CAPABILITIES_REQ_MESSAGE}, - {"RegisterRejectMessage", REGISTER_REJECT_MESSAGE}, - {"ResetMessage", RESET_MESSAGE}, - {"KeepAliveAckMessage", KEEP_ALIVE_ACK_MESSAGE}, - {"OpenReceiveChannelMessage", OPEN_RECEIVE_CHANNEL_MESSAGE}, - {"CloseReceiveChannelMessage", CLOSE_RECEIVE_CHANNEL_MESSAGE}, - {"SoftKeyTemplateResMessage", SOFT_KEY_TEMPLATE_RES_MESSAGE}, - {"SoftKeySetResMessage", SOFT_KEY_SET_RES_MESSAGE}, - {"SelectSoftKeysMessage", SELECT_SOFT_KEYS_MESSAGE}, - {"CallStateMessage", CALL_STATE_MESSAGE}, - {"DisplayPromptStatusMessage", DISPLAY_PROMPT_STATUS_MESSAGE}, - {"ClearPromptStatusMessage", CLEAR_PROMPT_STATUS_MESSAGE}, - {"ActivateCallPlaneMessage", ACTIVATE_CALL_PLANE_MESSAGE}, - {"UnregisterAckMessage", UNREGISTER_ACK_MESSAGE}, - {"BackSpaceReqMessage", BACK_SPACE_REQ_MESSAGE}, - {"DialedNumberMessage", DIALED_NUMBER_MESSAGE}, - {"UserToDeviceDataMessage", USER_TO_DEVICE_DATA_MESSAGE}, - {"FeatureResMessage", FEATURE_STAT_RES_MESSAGE}, - {"DisplayPriNotifyMessage", DISPLAY_PRI_NOTIFY_MESSAGE}, - {"ServiceUrlStatMessage", SERVICE_URL_STAT_RES_MESSAGE}, - {"UserToDeviceDataVersion1Message", USER_TO_DEVICE_DATA_VERSION1_MESSAGE}, - {"XMLAlarmMessage", XML_ALARM_MESSAGE}, - {NULL, 0} + {KEEP_ALIVE_MESSAGE, "KeepAliveMessage"}, + {REGISTER_MESSAGE, "RegisterMessage"}, + {PORT_MESSAGE, "PortMessage"}, + {KEYPAD_BUTTON_MESSAGE, "KeypadButtonMessage"}, + {ENBLOC_CALL_MESSAGE, "EnblocCallMessage"}, + {STIMULUS_MESSAGE, "StimulusMessage"}, + {OFF_HOOK_MESSAGE, "OffHookMessage"}, + {ON_HOOK_MESSAGE, "OnHookMessage"}, + { FORWARD_STAT_REQ_MESSAGE, "ForwardStatReqMessage"}, + {SPEED_DIAL_STAT_REQ_MESSAGE, "SpeedDialStatReqMessage"}, + {LINE_STAT_REQ_MESSAGE, "LineStatReqMessage"}, + {CONFIG_STAT_REQ_MESSAGE, "ConfigStatReqMessage"}, + {TIME_DATE_REQ_MESSAGE, "TimeDateReqMessage"}, + {BUTTON_TEMPLATE_REQ_MESSAGE, "ButtonTemplateReqMessage"}, + {VERSION_REQ_MESSAGE, "VersionReqMessage"}, + {CAPABILITIES_RES_MESSAGE, "CapabilitiesReqMessage"}, + {ALARM_MESSAGE, "AlarmMessage"}, + {OPEN_RECEIVE_CHANNEL_ACK_MESSAGE, "OpenReceiveChannelAckMessage"}, + {SOFT_KEY_SET_REQ_MESSAGE, "SoftKeySetReqMessage"}, + {SOFT_KEY_EVENT_MESSAGE, "SoftKeyEventMessage"}, + {UNREGISTER_MESSAGE, "UnregisterMessage"}, + {SOFT_KEY_TEMPLATE_REQ_MESSAGE, "SoftKeyTemplateReqMessage"}, + {HEADSET_STATUS_MESSAGE, "HeadsetStatusMessage"}, + {REGISTER_AVAILABLE_LINES_MESSAGE, "RegisterAvailableLinesMessage"}, + {DEVICE_TO_USER_DATA_MESSAGE, "DeviceToUserDataMessage"}, + {DEVICE_TO_USER_DATA_RESPONSE_MESSAGE, "DeviceToUserDataResponseMessage"}, + {SERVICE_URL_STAT_REQ_MESSAGE, "ServiceUrlStatReqMessage"}, + {FEATURE_STAT_REQ_MESSAGE, "FeatureStatReqMessage"}, + {DEVICE_TO_USER_DATA_VERSION1_MESSAGE, "DeviceToUserDataVersion1Message"}, + {DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE, "DeviceToUserDataResponseVersion1Message"}, + {REGISTER_ACK_MESSAGE, "RegisterAckMessage"}, + {START_TONE_MESSAGE, "StartToneMessage"}, + {STOP_TONE_MESSAGE, "StopToneMessage"}, + {SET_RINGER_MESSAGE, "SetRingerMessage"}, + {SET_LAMP_MESSAGE, "SetLampMessage"}, + {SET_SPEAKER_MODE_MESSAGE, "SetSpeakerModeMessage"}, + {START_MEDIA_TRANSMISSION_MESSAGE, "StartMediaTransmissionMessage"}, + {STOP_MEDIA_TRANSMISSION_MESSAGE, "StopMediaTransmissionMessage"}, + {CALL_INFO_MESSAGE, "CallInfoMessage"}, + {FORWARD_STAT_MESSAGE, "ForwardStatMessage"}, + {SPEED_DIAL_STAT_RES_MESSAGE, "SpeedDialStatResMessage"}, + {LINE_STAT_RES_MESSAGE, "LineStatResMessage"}, + {CONFIG_STAT_RES_MESSAGE, "ConfigStatResMessage"}, + {DEFINE_TIME_DATE_MESSAGE, "DefineTimeDateMessage"}, + {BUTTON_TEMPLATE_RES_MESSAGE, "ButtonTemplateResMessage"}, + {VERSION_MESSAGE, "VersionMessage"}, + {CAPABILITIES_REQ_MESSAGE, "CapabilitiesReqMessage"}, + {REGISTER_REJECT_MESSAGE, "RegisterRejectMessage"}, + {RESET_MESSAGE, "ResetMessage"}, + {KEEP_ALIVE_ACK_MESSAGE, "KeepAliveAckMessage"}, + {OPEN_RECEIVE_CHANNEL_MESSAGE, "OpenReceiveChannelMessage"}, + {CLOSE_RECEIVE_CHANNEL_MESSAGE, "CloseReceiveChannelMessage"}, + {SOFT_KEY_TEMPLATE_RES_MESSAGE, "SoftKeyTemplateResMessage"}, + {SOFT_KEY_SET_RES_MESSAGE, "SoftKeySetResMessage"}, + {SELECT_SOFT_KEYS_MESSAGE, "SelectSoftKeysMessage"}, + {CALL_STATE_MESSAGE, "CallStateMessage"}, + {DISPLAY_PROMPT_STATUS_MESSAGE, "DisplayPromptStatusMessage"}, + {CLEAR_PROMPT_STATUS_MESSAGE, "ClearPromptStatusMessage"}, + {ACTIVATE_CALL_PLANE_MESSAGE, "ActivateCallPlaneMessage"}, + {UNREGISTER_ACK_MESSAGE, "UnregisterAckMessage"}, + {BACK_SPACE_REQ_MESSAGE, "BackSpaceReqMessage"}, + {DIALED_NUMBER_MESSAGE, "DialedNumberMessage"}, + {USER_TO_DEVICE_DATA_MESSAGE, "UserToDeviceDataMessage"}, + {FEATURE_STAT_RES_MESSAGE, "FeatureResMessage"}, + {DISPLAY_PRI_NOTIFY_MESSAGE, "DisplayPriNotifyMessage"}, + {SERVICE_URL_STAT_RES_MESSAGE, "ServiceUrlStatMessage"}, + {USER_TO_DEVICE_DATA_VERSION1_MESSAGE, "UserToDeviceDataVersion1Message"}, + {XML_ALARM_MESSAGE, "XMLAlarmMessage"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_message_type2str, SKINNY_MESSAGE_TYPES, "UnknownMessage") SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1) struct skinny_table SKINNY_DEVICE_TYPES[] = { - {"Cisco 30 SP+", 1}, - {"Cisco 12 SP+", 2}, - {"Cisco 12 SP", 3}, - {"Cisco 12", 4}, - {"Cisco 30 VIP", 5}, - {"Cisco IP Phone 7910", 6}, - {"Cisco IP Phone 7960", 7}, - {"Cisco IP Phone 7940", 8}, - {"Cisco IP Phone 7935", 9}, - {"Cisco ATA 186", 12}, - {"Cisco IP Phone CP-7921G", 365}, - {"Cisco IP Phone CP-7962G", 404}, - {"Cisco IP Phone CP-7965G", 436}, - {"Cisco IP Phone CP-7961G", 30018}, - {"Cisco IP Phone 7936", 30019}, - {NULL, 0} + {1, "Cisco 30 SP+"}, + {2, "Cisco 12 SP+"}, + {3, "Cisco 12 SP"}, + {4, "Cisco 12"}, + {5, "Cisco 30 VIP"}, + {6, "Cisco IP Phone 7910"}, + {7, "Cisco IP Phone 7960"}, + {8, "Cisco IP Phone 7940"}, + {9, "Cisco IP Phone 7935"}, + {12, "Cisco ATA 186"}, + {365, "Cisco IP Phone CP-7921G"}, + {404, "Cisco IP Phone CP-7962G"}, + {436, "Cisco IP Phone CP-7965G"}, + {30018, "Cisco IP Phone CP-7961G"}, + {30019, "Cisco IP Phone 7936"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType") SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1) struct skinny_table SKINNY_RING_TYPES[] = { - {"RingOff", SKINNY_RING_OFF}, - {"RingInside", SKINNY_RING_INSIDE}, - {"RingOutside", SKINNY_RING_OUTSIDE}, - {"RingFeature", SKINNY_RING_FEATURE}, - {NULL, 0} + {SKINNY_RING_OFF, "RingOff"}, + {SKINNY_RING_INSIDE, "RingInside"}, + {SKINNY_RING_OUTSIDE, "RingOutside"}, + {SKINNY_RING_FEATURE, "RingFeature"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_ring_type2str, SKINNY_RING_TYPES, "RingTypeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2ring_type, SKINNY_RING_TYPES, -1) struct skinny_table SKINNY_RING_MODES[] = { - {"RingForever", SKINNY_RING_FOREVER}, - {"RingOnce", SKINNY_RING_ONCE}, - {NULL, 0} + {SKINNY_RING_FOREVER, "RingForever"}, + {SKINNY_RING_ONCE, "RingOnce"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_ring_mode2str, SKINNY_RING_MODES, "RingModeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1) struct skinny_table SKINNY_BUTTONS[] = { - {"Unknown", SKINNY_BUTTON_UNKNOWN}, - {"LastNumberRedial", SKINNY_BUTTON_LAST_NUMBER_REDIAL}, - {"SpeedDial", SKINNY_BUTTON_SPEED_DIAL}, - {"Hold", SKINNY_BUTTON_HOLD}, - {"Transfer", SKINNY_BUTTON_TRANSFER}, - {"Line", SKINNY_BUTTON_LINE}, - {"Voicemail", SKINNY_BUTTON_VOICEMAIL}, - {"Privacy", SKINNY_BUTTON_PRIVACY}, - {"ServiceUrl", SKINNY_BUTTON_SERVICE_URL}, - {"Undefined", SKINNY_BUTTON_UNDEFINED}, - {NULL, 0} + {SKINNY_BUTTON_UNKNOWN, "Unknown"}, + {SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"}, + {SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"}, + {SKINNY_BUTTON_HOLD, "Hold"}, + {SKINNY_BUTTON_TRANSFER, "Transfer"}, + {SKINNY_BUTTON_LINE, "Line"}, + {SKINNY_BUTTON_VOICEMAIL, "Voicemail"}, + {SKINNY_BUTTON_PRIVACY, "Privacy"}, + {SKINNY_BUTTON_SERVICE_URL, "ServiceUrl"}, + {SKINNY_BUTTON_UNDEFINED, "Undefined"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_button2str, SKINNY_BUTTONS, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2button, SKINNY_BUTTONS, -1) struct skinny_table SKINNY_SOFT_KEY_EVENTS[] = { - {"SoftkeyRedial", SOFTKEY_REDIAL}, - {"SoftkeyNewcall", SOFTKEY_NEWCALL}, - {"SoftkeyHold", SOFTKEY_HOLD}, - {"SoftkeyTransfer", SOFTKEY_TRANSFER}, - {"SoftkeyCfwdall", SOFTKEY_CFWDALL}, - {"SoftkeyCfwdbusy", SOFTKEY_CFWDBUSY}, - {"SoftkeyCfwdnoanswer", SOFTKEY_CFWDNOANSWER}, - {"SoftkeyBackspace", SOFTKEY_BACKSPACE}, - {"SoftkeyEndcall", SOFTKEY_ENDCALL}, - {"SoftkeyResume", SOFTKEY_RESUME}, - {"SoftkeyAnswer", SOFTKEY_ANSWER }, - {"SoftkeyInfo", SOFTKEY_INFO}, - {"SoftkeyConfrm", SOFTKEY_CONFRM}, - {"SoftkeyPark", SOFTKEY_PARK}, - {"SoftkeyJoin", SOFTKEY_JOIN}, - {"SoftkeyMeetmeconfrm", SOFTKEY_MEETMECONFRM}, - {"SoftkeyCallpickup", SOFTKEY_CALLPICKUP}, - {"SoftkeyGrpcallpickup", SOFTKEY_GRPCALLPICKUP}, - {"SoftkeyDnd", SOFTKEY_DND}, - {"SoftkeyIdivert", SOFTKEY_IDIVERT}, - {NULL, 0} + {SOFTKEY_REDIAL, "SoftkeyRedial"}, + {SOFTKEY_NEWCALL, "SoftkeyNewcall"}, + {SOFTKEY_HOLD, "SoftkeyHold"}, + {SOFTKEY_TRANSFER, "SoftkeyTransfer"}, + {SOFTKEY_CFWDALL, "SoftkeyCfwdall"}, + {SOFTKEY_CFWDBUSY, "SoftkeyCfwdbusy"}, + {SOFTKEY_CFWDNOANSWER, "SoftkeyCfwdnoanswer"}, + {SOFTKEY_BACKSPACE, "SoftkeyBackspace"}, + {SOFTKEY_ENDCALL, "SoftkeyEndcall"}, + {SOFTKEY_RESUME, "SoftkeyResume"}, + {SOFTKEY_ANSWER , "SoftkeyAnswer"}, + {SOFTKEY_INFO, "SoftkeyInfo"}, + {SOFTKEY_CONFRM, "SoftkeyConfrm"}, + {SOFTKEY_PARK, "SoftkeyPark"}, + {SOFTKEY_JOIN, "SoftkeyJoin"}, + {SOFTKEY_MEETMECONFRM, "SoftkeyMeetmeconfrm"}, + {SOFTKEY_CALLPICKUP, "SoftkeyCallpickup"}, + {SOFTKEY_GRPCALLPICKUP, "SoftkeyGrpcallpickup"}, + {SOFTKEY_DND, "SoftkeyDnd"}, + {SOFTKEY_IDIVERT, "SoftkeyIdivert"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_soft_key_event2str, SKINNY_SOFT_KEY_EVENTS, "SoftkeyUnknown") SKINNY_DECLARE_STR2ID(skinny_str2soft_key_event, SKINNY_SOFT_KEY_EVENTS, 0) struct skinny_table SKINNY_LAMP_MODES[] = { - {"Off", SKINNY_LAMP_OFF}, - {"On", SKINNY_LAMP_ON}, - {"Wink", SKINNY_LAMP_WINK}, - {"Flash", SKINNY_LAMP_FLASH}, - {"Blink", SKINNY_LAMP_BLINK}, - {NULL, 0} + {SKINNY_LAMP_OFF, "Off"}, + {SKINNY_LAMP_ON, "On"}, + {SKINNY_LAMP_WINK, "Wink"}, + {SKINNY_LAMP_FLASH, "Flash"}, + {SKINNY_LAMP_BLINK, "Blink"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_lamp_mode2str, SKINNY_LAMP_MODES, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2lamp_mode, SKINNY_LAMP_MODES, -1) struct skinny_table SKINNY_SPEAKER_MODES[] = { - {"SpeakerOn", SKINNY_SPEAKER_ON}, - {"SpeakerOff", SKINNY_SPEAKER_OFF}, - {NULL, 0} + {SKINNY_SPEAKER_ON, "SpeakerOn"}, + {SKINNY_SPEAKER_OFF, "SpeakerOff"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_speaker_mode2str, SKINNY_SPEAKER_MODES, "Unknown") SKINNY_DECLARE_STR2ID(skinny_str2speaker_mode, SKINNY_SPEAKER_MODES, -1) struct skinny_table SKINNY_KEY_SETS[] = { - {"KeySetOnHook", SKINNY_KEY_SET_ON_HOOK}, - {"KeySetConnected", SKINNY_KEY_SET_CONNECTED}, - {"KeySetOnHold", SKINNY_KEY_SET_ON_HOLD}, - {"KeySetRingIn", SKINNY_KEY_SET_RING_IN}, - {"KeySetOffHook", SKINNY_KEY_SET_OFF_HOOK}, - {"KeySetConnectedWithTransfer", SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER}, - {"KeySetDigitsAfterDialingFirstDigit", SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT}, - {"KeySetConnectedWithConference", SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE}, - {"KeySetRingOut", SKINNY_KEY_SET_RING_OUT}, - {"KeySetOffHookWithFeatures", SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES}, - {"KeySetInUseHint", SKINNY_KEY_SET_IN_USE_HINT}, - {NULL, 0} + {SKINNY_KEY_SET_ON_HOOK, "KeySetOnHook"}, + {SKINNY_KEY_SET_CONNECTED, "KeySetConnected"}, + {SKINNY_KEY_SET_ON_HOLD, "KeySetOnHold"}, + {SKINNY_KEY_SET_RING_IN, "KeySetRingIn"}, + {SKINNY_KEY_SET_OFF_HOOK, "KeySetOffHook"}, + {SKINNY_KEY_SET_CONNECTED_WITH_TRANSFER, "KeySetConnectedWithTransfer"}, + {SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, "KeySetDigitsAfterDialingFirstDigit"}, + {SKINNY_KEY_SET_CONNECTED_WITH_CONFERENCE, "KeySetConnectedWithConference"}, + {SKINNY_KEY_SET_RING_OUT, "KeySetRingOut"}, + {SKINNY_KEY_SET_OFF_HOOK_WITH_FEATURES, "KeySetOffHookWithFeatures"}, + {SKINNY_KEY_SET_IN_USE_HINT, "KeySetInUseHint"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_soft_key_set2str, SKINNY_KEY_SETS, "UNKNOWN_SOFT_KEY_SET") SKINNY_DECLARE_STR2ID(skinny_str2soft_key_set, SKINNY_KEY_SETS, -1) struct skinny_table SKINNY_CALL_STATES[] = { - {"OffHook", SKINNY_OFF_HOOK}, - {"OnHook", SKINNY_ON_HOOK}, - {"RingOut", SKINNY_RING_OUT}, - {"RingIn", SKINNY_RING_IN}, - {"Connected", SKINNY_CONNECTED}, - {"Busy", SKINNY_BUSY}, - {"LineInUse", SKINNY_LINE_IN_USE}, - {"Hold", SKINNY_HOLD}, - {"CallWaiting", SKINNY_CALL_WAITING}, - {"CallTransfer", SKINNY_CALL_TRANSFER}, - {"CallPark", SKINNY_CALL_PARK}, - {"Proceed", SKINNY_PROCEED}, - {"InUseRemotely", SKINNY_IN_USE_REMOTELY}, - {"InvalidNumber", SKINNY_INVALID_NUMBER}, - {NULL, 0} + {SKINNY_OFF_HOOK, "OffHook"}, + {SKINNY_ON_HOOK, "OnHook"}, + {SKINNY_RING_OUT, "RingOut"}, + {SKINNY_RING_IN, "RingIn"}, + {SKINNY_CONNECTED, "Connected"}, + {SKINNY_BUSY, "Busy"}, + {SKINNY_LINE_IN_USE, "LineInUse"}, + {SKINNY_HOLD, "Hold"}, + {SKINNY_CALL_WAITING, "CallWaiting"}, + {SKINNY_CALL_TRANSFER, "CallTransfer"}, + {SKINNY_CALL_PARK, "CallPark"}, + {SKINNY_PROCEED, "Proceed"}, + {SKINNY_IN_USE_REMOTELY, "InUseRemotely"}, + {SKINNY_INVALID_NUMBER, "InvalidNumber"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_call_state2str, SKINNY_CALL_STATES, "CallStateUnknown") SKINNY_DECLARE_STR2ID(skinny_str2call_state, SKINNY_CALL_STATES, -1) struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = { - {"DeviceReset", SKINNY_DEVICE_RESET}, - {"DeviceRestart", SKINNY_DEVICE_RESTART}, - {NULL, 0} + {SKINNY_DEVICE_RESET, "DeviceReset"}, + {SKINNY_DEVICE_RESTART, "DeviceRestart"}, + {0, NULL} }; SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1) diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 84f2b6c297..abfdfc2aa0 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -36,8 +36,8 @@ /* SKINNY TABLES */ /*****************************************************************************/ struct skinny_table { - const char *name; uint32_t id; + const char *name; }; #define SKINNY_DECLARE_ID2STR(func, TABLE, DEFAULT_STR) \ From 496fd5df0fb0fa20e586b2a2f4e2a9750021882e Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Sun, 10 Apr 2011 23:16:56 +0200 Subject: [PATCH 285/558] Skinny: more verbose log when pre-register message received --- src/mod/endpoints/mod_skinny/skinny_server.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index dac75facd7..2c338d6ce5 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -2041,8 +2041,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re listener->device_name, listener->device_instance); } if(zstr(listener->device_name) && request->type != REGISTER_MESSAGE && request->type != ALARM_MESSAGE && request->type != XML_ALARM_MESSAGE) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Device should send a register message first.\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, + "Device should send a register message first. Received %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); return SWITCH_STATUS_FALSE; } switch(request->type) { @@ -2110,7 +2110,7 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re return skinny_handle_xml_alarm(listener, request); default: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Unhandled request %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); + "Unhandled %s (type=%x,length=%d).\n", skinny_message_type2str(request->type), request->type, request->length); return SWITCH_STATUS_SUCCESS; } } From 02b9a3d5443647ea6afafd919b801a5230648bd0 Mon Sep 17 00:00:00 2001 From: Buklov Boris Date: Mon, 11 Apr 2011 17:48:19 +0400 Subject: [PATCH 286/558] fix SST_SHORT_DATE_TIME --- src/mod/say/mod_say_ru/mod_say_ru.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/say/mod_say_ru/mod_say_ru.c b/src/mod/say/mod_say_ru/mod_say_ru.c index 51a0cc4e2b..15d95438be 100644 --- a/src/mod/say/mod_say_ru/mod_say_ru.c +++ b/src/mod/say/mod_say_ru/mod_say_ru.c @@ -605,7 +605,7 @@ static switch_new_say_callback_ru_t choose_callback(switch_say_args_t *say_args) case SST_CURRENT_TIME: say_cb = ru_say_time; break; - + case SST_SHORT_DATE_TIME: case SST_CURRENT_DATE_TIME: say_cb = ru_say_time; break; From 6ea214c18080bb57dc7b8d71503bf63e78d4ca4c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Apr 2011 09:30:15 -0500 Subject: [PATCH 287/558] move other more obscure L16 slices to dynamic payload --- src/switch_pcm.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/switch_pcm.c b/src/switch_pcm.c index f0dfe86da3..d7ae48a28e 100644 --- a/src/switch_pcm.c +++ b/src/switch_pcm.c @@ -420,7 +420,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 3; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 24000, /* samples transferred per second */ @@ -451,7 +451,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 5; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 48000, /* samples transferred per second */ @@ -481,7 +481,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 4; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 8000, /* samples transferred per second */ @@ -510,7 +510,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 4; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 16000, /* samples transferred per second */ @@ -540,7 +540,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) for (x = 0; x < 4; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 32000, /* samples transferred per second */ @@ -569,7 +569,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) /* 10ms is already registered */ for (x = 0; x < 3; x++) { switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 48000, /* samples transferred per second */ @@ -591,7 +591,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) } switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 22050, /* samples transferred per second */ @@ -609,7 +609,7 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ - 10, /* the IANA code number */ + 70, /* the IANA code number */ "L16", /* the IANA code name */ NULL, /* default fmtp to send (can be overridden by the init function) */ 11025, /* samples transferred per second */ From 82e3d49fd20ca91306a87d43bb88613938b2c6fd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Apr 2011 09:47:11 -0500 Subject: [PATCH 288/558] add L16 def for 32ms and allow timer matrix to drop to 1ms to support nelly --- .../applications/mod_commands/mod_commands.c | 2 +- src/switch_pcm.c | 19 +++++++++++++++++++ src/switch_time.c | 5 +++-- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index ab402db8f5..501b3f88b2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -520,7 +520,7 @@ SWITCH_STANDARD_API(timer_test_function) timer_name = argv[2]; } - if (mss != 10 && mss != 20 && mss != 30 && mss != 40 && mss != 60 && mss != 120) { + if (mss != 10 && mss != 20 && mss != 30 && mss != 32 && mss != 40 && mss != 60 && mss != 120) { stream->write_function(stream, "parameter missing: %s\n", TIMER_TEST_SYNTAX); goto end; } diff --git a/src/switch_pcm.c b/src/switch_pcm.c index d7ae48a28e..51d1ced182 100644 --- a/src/switch_pcm.c +++ b/src/switch_pcm.c @@ -627,6 +627,25 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load) switch_raw_destroy); /* deinitalize a codec handle using this implementation */ + switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */ + 70, /* the IANA code number */ + "L16", /* the IANA code name */ + NULL, /* default fmtp to send (can be overridden by the init function) */ + 11025, /* samples transferred per second */ + 11025, /* actual samples transferred per second */ + 176400, /* bits transferred per second */ + 32000, /* number of microseconds per frame */ + 256, /* number of samples per frame */ + 512, /* number of bytes per frame decompressed */ + 512, /* number of bytes per frame compressed */ + 1, /* number of channels represented */ + 1, /* number of frames per network packet */ + switch_raw_init, /* function to initialize a codec handle using this implementation */ + switch_raw_encode, /* function to encode raw data into encoded data */ + switch_raw_decode, /* function to decode encoded data into raw data */ + switch_raw_destroy); /* deinitalize a codec handle using this implementation */ + + /* indicate that the module should continue to be loaded */ diff --git a/src/switch_time.c b/src/switch_time.c index 70972a660b..0fd7d9ee49 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -502,8 +502,9 @@ static switch_status_t timer_init(switch_timer_t *timer) private_info->roll = TIMER_MATRIX[timer->interval].roll; private_info->ready = 1; - if (timer->interval > 0 && timer->interval < MS_PER_TICK) { - MS_PER_TICK = timer->interval; + if (timer->interval > 0 && (timer->interval < MS_PER_TICK || (timer->interval % 10) != 0)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Increasing global timer resolution to 1ms to handle interval %d\n", timer->interval); + MS_PER_TICK = 1; switch_time_sync(); } From c8eaef60570a20d2b7f04d48b659fdadb6d354ea Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 12 Apr 2011 09:29:44 -0700 Subject: [PATCH 289/558] Bump sounds to 1.0.15 --- build/sounds_version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/sounds_version.txt b/build/sounds_version.txt index 20cb29cbd7..cb456d76eb 100644 --- a/build/sounds_version.txt +++ b/build/sounds_version.txt @@ -1,3 +1,3 @@ -en-us-callie 1.0.14 +en-us-callie 1.0.15 ru-RU-elena 1.0.12 From e4c8edef54ce864ccbba09df90d7d947ec867dd2 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 12 Apr 2011 09:33:45 -0700 Subject: [PATCH 290/558] Directory sound file: dir-for_prev.wav -> dir-for_previous.wav --- conf/lang/en/dir/sounds.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/lang/en/dir/sounds.xml b/conf/lang/en/dir/sounds.xml index 15ecec304a..e7a2e8f925 100644 --- a/conf/lang/en/dir/sounds.xml +++ b/conf/lang/en/dir/sounds.xml @@ -99,7 +99,7 @@ - + From 0fd36364c55228cec69edf8ec256fd8f39c0503e Mon Sep 17 00:00:00 2001 From: Eduardo Nunes Pereira Date: Tue, 12 Apr 2011 14:51:32 -0300 Subject: [PATCH 291/558] - Improvements in getk3l script, now a option to download only the k3lclient --- src/mod/endpoints/mod_khomp/tools/getk3l.sh | 89 +++++++++++++-------- 1 file changed, 56 insertions(+), 33 deletions(-) diff --git a/src/mod/endpoints/mod_khomp/tools/getk3l.sh b/src/mod/endpoints/mod_khomp/tools/getk3l.sh index 57364cdd7e..59e3f4b5e3 100755 --- a/src/mod/endpoints/mod_khomp/tools/getk3l.sh +++ b/src/mod/endpoints/mod_khomp/tools/getk3l.sh @@ -41,28 +41,25 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ############################################################################### +K3L_FILE="k3l_2.1_client.sh" +PARAM="0" -clean() +if [ "$1" ] +then + PARAM=$1 +fi + +help() { - printf "$1" - exit 1 + echo "Usage: getk3l.sh [OPTION]" + echo + echo " -h, --help print this help" + echo " -d, --download only download the k3l package withou doing the installation" + echo } -if [ `whoami` != 'root' ] -then - clean "Need to be root\n" -fi - -#if [ "w$FREESWITCH_PATH" == "w" ] -#then -# clean "FreeSWITCH source PATH is needed: \n\tSet \"FREESWITCH_PATH=\"\n" -#fi - -if ! which 'kserver' &> /dev/null -then - echo "k3l will be installed" - K3L_FILE="k3l_2.1_client.sh" - +download() +{ if [ "w`uname -m | grep x86_64`" == "w" ] then echo "Downloading i686 package" @@ -71,23 +68,49 @@ then echo "Downloading x86_64 package" wget -t15 -c --progress=bar:force -O $K3L_FILE.gz http://www.khomp.com.br/binaries/softpbx/freeswitch/k3l_2.1_client_x86-64.sh.gz fi +} - gunzip $K3L_FILE.gz - chmod 0755 $K3L_FILE +clean() +{ + printf "$1" + exit 1 +} - (./$K3L_FILE) || clean "Error on k3l install\n" - - rm $K3L_FILE -fi +install() +{ + if [ `whoami` != 'root' ] + then + clean "Need to be root to install !\n" + exit 1 + fi -if [ "w`kserver --version | grep 2.1`" == "w" ] + if ! which 'kserver' &> /dev/null + then + download + gunzip $K3L_FILE.gz + chmod 0755 $K3L_FILE + (./$K3L_FILE) || clean "Error on k3l install\n" + rm $K3L_FILE + fi +} + +if [ $PARAM == '--help' -o $PARAM == '-h' ] then - clean "k3l version 2.1 must be installed: \n\tUninstall the old version of k3l and try again\n" + help + exit 0 +elif [ $PARAM == '--download' -o $PARAM == '-d' ] +then + download + exit 0 +else + echo "k3l will be installed" + install + + if [ "w`kserver --version | grep 2.1`" == "w" ] + then + clean "k3l version 2.1 must be installed: \n\tUninstall the old version of k3l and try again\n" + exit 1 + fi + + echo "Successfully installed!" fi - -#make || clean "Error on compilation\n" - -#make install || clean "Error on installation\n" - -echo "Successfully installed!" - From 54e5011d7440269db89b3fec086e76d2f71f968e Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 12 Apr 2011 13:35:33 -0500 Subject: [PATCH 292/558] declinatio mortuus obfirmo! --- src/mod/applications/mod_conference/mod_conference.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 07a24355cf..57b241c57d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2998,14 +2998,14 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th end: - for(;;) { - switch_mutex_lock(member->audio_out_mutex); + while(!no_data) { + switch_mutex_lock(member->audio_out_mutex); if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) { len = (switch_size_t) rlen / sizeof(int16_t); switch_core_file_write(&fh, data_buf, &len); } else { - break; - } + no_data = 1; + } switch_mutex_unlock(member->audio_out_mutex); } From 15f4825c53c44820d49a17a2d7eec5604aa19d11 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 12 Apr 2011 17:30:25 -0700 Subject: [PATCH 293/558] Update ChangeLog through March 31 --- docs/ChangeLog | 73 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/docs/ChangeLog b/docs/ChangeLog index 55bec755fc..4d0760a982 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -41,6 +41,7 @@ freeswitch (1.0.7) config: docs for acl (r:57b410eb) config: add default to conf to demonstrate min-idle-cpu (r:b8b7266a) config: change min/max enforcements to >= instead of > (r:0d5fcf65) + config: Add README_IMPORTANT.txt to default configuration (r:6cd5ce72) core: Add RTCP support (FSRTP-14) core: handle some errors on missing db handle conditions core: add ... and shutdown as a fail-safe when no modules are loaded @@ -214,6 +215,22 @@ freeswitch (1.0.7) core: add limits to simo open sql handles (r:61cdf0da) core: Fix db locks affecting mod_callcenter (r:8da371c7/FS-3127) core: improve flow of dtmf through a bridge when timer is disabled (r:59da356d) + core: Fix Freeswitch crash on Debian ARM (r:a80fae92/FS-3126) + core: switch_xml: reloadxml will(should) never lock again. It will load the XML structure into a new XML structure, and just replace the currently available ROOT XML. It then the job of the last user of the switch_xml structure to free it. (r:471bd6df) + core: switch_xml: Remove commented out mmap. With the changes in the past 2 year, mmap can't really be put back in it current state. (r:34bd0e5e) + core: Fix jitterbuffer with SRTP enabled (r:069f5f7d/FS-3075) + core: this will remove the reported symptom but does not change the fact that 1khz resolution is ideal for proper performance (r:5f18ec94/FS-3168) + core: this was specific to the user channel which is not a real channel in every sense of the word as it has no running thread or any usable state changes so this new line of code in 233d3164be4412aaaf8f9f42d8042e48279a018a to wait for the state machine to stabilize before returning from originate caused an issue with user/ channels (r:88a6ac2f/FS-3170) + core: this also fixes the incorrect usage of L16 on payload 10 which may or may not break interop with other sip devices if we do it right. also added rtp_disable_byteswap variable that can be set to false to disable byteswap when a device is encountered that is incompat (including all previous version of FS up till now) (r:e657e32f/FS-3172) + core: dont calibrate clock when timerfd enabled (r:26f5ebd4) + core: fix DTMF in SRTP/ZRTP (r:fd608901/FS-3165) + core: add switch_atomic_* type and functions switch_apr.c and switch_apr.h (r:3b56c119/FS-3173) + core: improve some defaults to tune performance if you use -heavy_timer, try not using it (r:5d783134) + core: Fix api_hangup_hook with no args (r:484a397d/FS-3194) + core: allow 100 microsecond tolerance on timer loop (r:6388e03d) + core: Fix X-PREPROCESS exec to wait pid (r:dae2cb4a) + core: Ability to use mod_say with native files; native is a special case so use the extension native e.g. en.native (r:3a2e1d03/FS-3176) + core: Fix: Bridging a call to multiple legs and using leg_delay_start, legs that lost the race before the leg_delay_start time is up still get originated for a brief moment (r:c5daf80e/FS-3218) embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) embedded languages: add insertFile front end to switch_ivr_insert_file and reswig (r:c4e350ab) fs_cli: block control-z from fs cli and print a warning how to exit properly (r:dc436b82) @@ -250,12 +267,17 @@ freeswitch (1.0.7) libesl: add optional job-uuid param to bgapi in oop mod (r:e96acac3) libesl: fix linger support in esl client lib (r:0444626b) libesl: fix segfault (r:30813ca5/FS-3130) + libesl: Don't destroy last_event pointer until it's being set to a new pointer - fixes rare segfault (r:e8474d60/ESL-57) + libesl: Add 'make perlmod-install' to ESL (please test) (r:06c42179) + libesl: build python esl bindings and ship them in freeswitch-python-package (r:44bfcf1d/FS-3128) + libesl: use poll instead of select in ESL client lib because select is not your friend.... (r:ae595cd5) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) libg7221: A bunch of tweaks to the G.722.1 codec (r:5d548570) libgnutls: link to libgcrypt as well, please report any platforms this breaks, but it should be portable (r:c569fb0f/FS-1248) libjs: non-portable comment syntax in .s files + libldns: select on FD > 1024 get this patch to ldns ppl (r:710fc7a7/FS-3110) libopenzap: Add CLI tracing libs: Merged OpenZAP and FreeTDM into the FreeSWITCH tree. libs: Add support for TLS on Windows using openssl (r:1abe3b93/MODSOFIA-92) @@ -265,6 +287,7 @@ freeswitch (1.0.7) libsofiasip: VS2010 sofia posix problem (r:46dd24c2/SFSIP-220) libsofiasip: set minimum initital sip t1 timer to 1000ms to work around race condition on retry timer firing before all the things that are supposed to be handled by the timer are set. The base resolution on this timer is 500ms, so doubling up makes sure we always hit the initial retry timer on the next run, where everything should be set. The side effect was, 1/2 the time on a request that did not get immediate response, the timer would be fired and cleared, but the action (sending retry) was never done, and a new timer was not set, causing the request to just sit zombied and never retry. A better solution would be to find and correct the race condition so the timer is never set to early and we never hit this condition. (r:20c2740c) libsofiasip: fix bad assert (r:56404641/FS-3133) + libsofiasip: lower stack and boost priority of sofia schedule thread (r:257bc9ff) libspandsp: Fixed a typo in spandsp's msvc/inttypes.h Updated sig_tone processing in spandsp to the latest, to allow moy to proceed with his signaling work. libspandsp: removed a saturate16 from spandsp that was causing problems fixed a typo in the MSVC inttypes.h file for spandsp libspandsp: Changes to the signaling tone detector to detect concurrent 2400Hz + 2600Hz tones. This passes voice immunity and other key tests, but it bounces a bit when transitions like 2400 -> 2400+2600 -> 2600 occur. Transitions between tone off and tone on are clean. (r:bc13e944) @@ -272,6 +295,7 @@ freeswitch (1.0.7) libspandsp: Fix for T.30 processing of operator interrupts, to improve compatibility with some machines, which seem to send them when no operator is around. (r:84ee0ae6) libspandsp: spandsp t38 fax receiving error in win XP - regression from f029f7ef (r:761cec8f/FS-2766) libspandsp: Added missing error codes when an ECM FAX is abandoned with the T30_ERR message (r:ec57dc7a) + libspandsp: Fixed a vulnerability in T.4 and T.6 processing which is similar to
http://bugzilla.maptools.org/show_bug.cgi?id=2297 in libtiff. A really screwed up 2D T.4 image, or a maliciously constructed T.4 2D or T.6 image should potential run off the end of an image decoder buffer. (r:c6f67322) libstfu: add param to jb to try to recapture latency (disabled by default) (r:d59d41d7) mod_avmd: Initial check in - Advanced Voicemail Detect (r:10c6a30a) (by Eric Des Courtis) mod_avmd: Add to windows build (r:df4bd935) @@ -299,11 +323,20 @@ freeswitch (1.0.7) mod_callcenter: IMPORTANT UPDATE, DTMF during moh created an loop to reactivate MOH but got canceled right away because of pending DTMF in the queue never been cleaned. Could cause masive disk write of debug, and can cause problem to the rest of FS stability. This patch also include basic fundation for DTMF capture support for member waiting. (r:cd1982ce) mod_callcenter: force loopback_bowout=false on originate. This will need to be reworked, but should fix basic issues call to an agent using loopback (r:2e399b0b) mod_callcenter: segfault using busy-delay-time parameter (r:c6f044d5/FS-3067) + mod_callcenter: Fix a bug when an caller leave the queue from a BREAK Call (Transfer...), it doesn't think an agent answered. (r:51a531aa) + mod_callcenter: Add new CLI cmd and change some to be more standard. Patch from Francois Delawarde, thanks. (r:30dd1774) + mod_callcenter: >WARNING, some event value got removed< Adding new event time value that can then be used to calculate the Wait;Talk;Total duration of a member were on call. CC-Wait-Time CC-Talk-Time and CC-Total-Time are no longer returned. Visit the code or check the wiki for the updated variable. (r:5f233785) + mod_callcenter: Add better support when agent doesn't answer, including creating a new variable for the delay that is different than reject or busy. Thanks to Francois Delawarde (r:26303c5c) + mod_callcenter: Add better handle of failed agent, member channel getting a break, and debuging info upon leaving. Thanks to Fran?ois Delawarde (with some changes) (r:25cee255) + mod_callcenter: New Agent order Possibility: Agent order by Level and Position by agents.last_offered_call. Change the default and sequentially-by-agent-order strategy to include the longest-idle-agent. This should offer a default consistant way to go through all the agent within the same tier/position. (Before, it was left to the DB to return the order of the result) (r:dcafff20/FS-3158) + mod_callcenter: Generate per member uuid different from the member session uuid. Might fix transfer between queue. More changes are coming (r:b63a72f8) + mod_callcenter: Remove the concept of Caller for Members. Event Socket event have been changed (CC-Caller.* to CC-Member.*) Also CC-Caller-UUID is renamed to CC-Member-Session-UUID. The reason for this is you could actually put people to be call in the queue. So they are not caller per say. But they are a member of a queue. (r:40a134bd) mod_cdr_sqlite: initial commit (r:f625fe3b) mod_cdr_sqlite: config file for mod_cdr_sqlite (r:25bc8fe3) mod_cdr_sqlite: Drop transaction BEGIN/END around INSERT. We're only executing one command, and autocommit will automatically rollback if the INSERT fails. Sync state_handlers with mod_cdr_csv. Minor libpq fixups. (r:0f95b870) mod_celt: Bump celt to 0.10.0 (r:231fbe5e) mod_celt: update code in mod_celt to match API of 0.10.0 (r:6e4c30ea) + mod_celt: Add dependency to fix parallel builds (r:6e37a8b2) mod_cidlookup: null xml is bad (r:095815f8) mod_cid_lookup: honor skipcitystate when using whitepages (r:a66654de/FSMOD-53) mod_commands: make break uuid_break and add cascade flag @@ -326,6 +359,7 @@ freeswitch (1.0.7) mod_commands: add uuid_buglist to fetch the current media-bugs attached to a given session uuid (r:f6eab64c) mod_commands: add recovery_refresh app and api and use it in mod_conference to send a message to the channel telling it to sync its recovery snapshot (r:650393fb) mod_commands: add moh by default to uuid_broadcast when only broadcasting to A leg use aleg arg to disable this (r:d164a797) + mod_commands: add API uuid_limit - thanks to Francois Delawarde (r:98a95016/FS-1792) mod_conference: Fix reporting of volume up/down (MODAPP-419) mod_conference: add last talking time per member to conference xml list mod_conference: add terminate-on-silence conference param @@ -351,6 +385,11 @@ freeswitch (1.0.7) mod_conference: clear talk flag when you mute (r:b7419add) mod_conference: fix pthread mutex lock error and add some tab completion and help messages from cli (r:547d5393/FS-3095) mod_conference: Use the channel's sound_prefix if it's not set in the conference's config (r:0911ed74/FS-3124) + mod_conference: Add conf_uuid chan var for djbinter (Thanks Math) (r:3c9ee25a) + mod_conference: removes the existing conference transfer function and replaces it using the core transfer it also introduces a new tracking method where the same conference id is reserved for a particular member for the lifetime of the call allowing a user to transfer in and out of conferences and ivr and bridges etc and retain the same member id for the duration of that call (r:246b2195/FS-3095) + mod_conference: prevent race condition on conference join/exit (r:1552ecf5) + mod_conference: I finally tracked this down to the actual recordings generated by mod_conference. This patch delays the recording slightly to allow time for the buffer to fill up, we were riding it so closely that sometimes we would come up short and inject silence into the file to preserve time passing (r:3253bcb3/FS-3147) + mod_conference: wait for channels to come up in paging mode (r:b8063c3d) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) @@ -360,6 +399,7 @@ freeswitch (1.0.7) mod_dingaling: Fix NULL pointer (r:e3eff816/FS-1103) mod_dingaling: fix leak in chat_send (r:eb109a85) mod_dingaling: use the login as message source when not in component mode. (chat_send) (r:58c28aab) + mod_dingaling: fix mod_dingaling/iksemel/gnutls link error when using newer autotools (r:294b0779/FS-3182) mod_directory: Add variable directory_search_order to allow to search by first name by default is set to "first_name" (r:163ca31f) mod_distributor: Add mod_distributor to VS2010 - not built by default (r:bac79ba1) mod_dptools: add eavesdrop_enable_dtmf chan var (r:596c0012) @@ -371,7 +411,13 @@ freeswitch (1.0.7) mod_dptools: Log error when there's no IVR menus configured when you call 'ivr' DP app (r:30034891) mod_dptools: reset signal_bond variable back to its original value on failed dial in att_xfer (r:330d7418) mod_dptools: Fix storage class for 'cause' in user_outgoing_channel() so that each call has its very own hangup cause (r:cb6f1ed6) + mod_dptools: transfer_on_fail note I changed the variable name to auto_cause (r:45edec4c/FS-3193) + mod_dptools: merge file_string into dptools (r:eefdb764) + mod_dptools: change mod_dptools to use the better method of fetching user xml that does not hang onto the xml root (r:e52e44e3) + mod_dptools: the intent for having the module and lang separate is for things where the same module can use different sets of sounds like en module and en-male or en-female lang (sound dirs) there was indeed a disconnect in the dialplan version of this app. Originally say was only available in phrase macros so I change the syntax of the say app so you can specify both the module and the lang absolte from the dp with something like he:he as the module name. (r:44304f49) mod_easyroute: Fix possible segfaults and memory leak during unload, and add new setting odbc-retries (r:7fbc47f8/FS-2973) + mod_enum: switch mod_enum to use new portable in-tree version (r:2bbc37e3) + mod_enum: fix race condition between ldns configure creating ldns/util.h and mod_enum (r:87884c5c) mod_erlang_event: Make XML fetch reply ACKs distinguishable, update freeswitch.erl (r:9d44ed04) mod_erlang_event: Add 3 new commands; session_event, session_noevents, session_nixevent (r:698fa045) mod_erlang_event: generate long node names the same as erlang does (r:9ad509c2) @@ -384,6 +430,8 @@ freeswitch (1.0.7) mod_event_socket: Fix small mem leaks (r:e4f90584/MODEVENT-68) mod_event_socket: Add "-ERR" to api cmd response when failure occurs (r:58759052/FS-2827) mod_event_socket: clear unique headers on event_socket filters (r:436413e0) + mod_event_socket: Unlock mutex to prevent mortuus obfirmo (r:64bc1938/FS-3156/FS-3157) + mod_event_zmq: Intitial mod_event_zmq code (r:4d554067) mod_fifo: allow multiple dtmf to exit fifo, set fifo_caller_exit_key to specify which (MODAPP-420) mod_fifo: cancel outbound call if customer hangs up (r:cadb4d94) mod_fifo: add taking_calls param to fifo member add and config file (r:821488bf) @@ -396,6 +444,7 @@ freeswitch (1.0.7) mod_fifo: Fix crash when using fifo_destroy_after_use (r:ee562c82/FS-2879) mod_fifo: don't seg in edge case error conditions (r:9ee13b72) mod_fifo: set tracking data before enabling hooks (r:34267869) + mod_file_string: Fix segfault when using file string in conference (r:9c40e8e9/FS-3122) mod_freetdm: Fix for TON and NPI not passed through to channel variables on incoming calls mod_freetdm: add pvt data to freetdm channels fix fxs features (r:9d456900) mod_freetdm: export and import boost custom data (r:edb2d582) @@ -459,6 +508,8 @@ freeswitch (1.0.7) mod_json_cdr: Fix segfault in mod_json_cdr.c (r:f347698a/MODEVENT-66) mod_khomp: Added mod_khomp Endpoint. (r:5fea197b) mod_khomp: Removed alternative contexts / extensions - New struct for matchs - On calls originated from an FXS branch, the Endpoint searches for a valid extension (digits sent) after the DTMF '#' or after the timeout (option fxs-digit-timeout). That search is done in the context defined in section , or if no context configured, the search is done in context defined in context-fxs. - Added "dialplan" configuration: Name of the dialplan module in use (default XML) - Group context enabled. If set, the search for a valid extension is done only in that context. - Updated documentation (r:1ef3fc9a) + mod_ladspa: Add mod_ladspa (Audio plugin framework for linux) (r:2d3d8f8d) + mod_ladspa: add string params to ladspa so you can connect files to audio ports (string params don't count towards number params) (r:b7891511) mod_lcr: Expand variables (MODAPP-418) mod_lcr: add enable_sip_redir parameter (r:70bf7a0a/MODAPP-427) mod_lcr: don't validate profiles with ${} vars since they are dynamic and we can't guess what the proper value should be (r:af33afaa) @@ -466,6 +517,7 @@ freeswitch (1.0.7) mod_lcr: assign default profile even if testing is skipped (r:6420099c) mod_lcr: fix compiler warning on newer gcc (r:bfa414cb) mod_lcr: don't count twice (r:eaeabc7b/FS-1810) + mod_lcr: properly destroy lcr object when done (r:084819a3/FS-3199) mod_loopback: add loopback_bowout_on_execute var to make 1 legged loopback calls bow out of the picture mod_loopback: only execute app once in app mode (r:64f58f2d) mod_loopback: fix bug in mod_loopback where bowout=false (r:e9ab5368) @@ -479,6 +531,7 @@ freeswitch (1.0.7) mod_lua: Make dbh:connected accessible from Lua - thanks Grmt (r:09e6fd3f) mod_lua: Added optional core: prefix to first arg passed to freeswitch.Dbh for giving direct access to sqlite db (r:a0181479) mod_lua: expose switch_simple_email as "email" method (r:89c5f3bf/FS-3023) + mod_lua: Fix setInputCallback crash (r:c49c1fde/FS-3161) mod_managed: Added wrapper for switch_event_bind for .net (r:a5f07a80/MODLANG-165) mod_managed: add additional support (r:5be58aac) mod_managed: add mono 2.8 patch file see FS-2774 (r:6a948bd9/FS-2774) @@ -495,6 +548,7 @@ freeswitch (1.0.7) mod_openzap: disable dtmf app and cmd line option (r:fb4b7f7a) mod_openzap: add enable dtmf app (r:3c95106e) mod_opus: add mod_opus (r:8f565277) + mod_opus: Use libtool archives for linking, add dependencies to fix parallel builds (r:74bbd4be) mod_osp: initial check (Open Settlement Protocol) mod_osp:Changed OSP TCP port from 1080 to 5045. (r:03abefdf) mod_portaudio: Fix inbound state (CS_ROUTING not CS_INIT) (MODENDP-302) @@ -513,6 +567,9 @@ freeswitch (1.0.7) mod_sangoma_codec: add G722 (r:ca8c2336) mod_sangoma_codec: add siren7 32kbps (r:fcaf2677) mod_sangoma_codec: add SIREN7 24kbps (r:3acc5fdb) + mod_say: Fix crash for Say Number Pronounced with numbers of more than 9 digits (r:06bccf28/FS-3202) + mod_say_en: introduce new say_string method of doing say and use it in mod_say_en as an example. try: eval ${say_string en.gsm en current_date_time pronounced ${strepoch()}} from the cli with this patch. We can do more to centralize the say things and go back and apply it to other langs, using this method you can set the desired file ext as well which I think is a bounty.... (r:d5ef86d7) + mod_say_en: If you only tell SAY CURRENCY to say 100 it should only say 100 dollars without the "0 cents" (r:426a4e76/FS-2922) mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) mod_say_ja: initial commit, still needs sound files (r:b2423158/FS-2755) mod_say_ru: Fix saying time with +1 hour of current time (r:68d74c31/MODAPP-444) @@ -689,6 +746,13 @@ freeswitch (1.0.7) mod_sofia: Send BYE to endpoints that lose race even if they answered (r:8c3651fa/FS-640) mod_sofia: do not renegotiate codecs on hold re-invites (r:bfd0ba97) mod_sofia: add rtp-notimer-during-bridge (alternative to rtp-autoflush-during-bridge (r:2a35dfb5) + mod_sofia: send another presence event on calls that were cancelled from LOSE_RACE to fix winnable race in Broadsoft SCA (r:59f6654e) + mod_sofia: pass header in X-FS headers on attended transfer CID update to indicate specific situation to flip callee/caller id when targeting a 1 legged call (r:24a97292) + mod_sofia: change text of error message to be more descriptive (r:4c435ec5) + mod_sofia: Correct a problem where restarting profile would cause some profile hash entry to remain. (r:81bfe435) + mod_sofia: New Sofia API to look up the username of a given user (r:7556ec57/FS-3187) + mod_sofia: sip_authentication was not cleared after nonce expired -caused sofia_reg_internal.db grow bigger and bigger with time (r:c735e28a/FS-3190) + mod_sofia: pass failure across in T.38 passthru mode (r:31273b42) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) @@ -707,9 +771,13 @@ freeswitch (1.0.7) mod_spidermonkey: Add session.ringReady() to check for CF_RING_READY (r:7386b9f8) mod_spy: add support for loopback endpoint (MODAPP-416) mod_spy: fix crash when session can't be located (r:c4154633/FS-2929) + mod_timer_fd: external timerfd module by Timo Ter?s (r:48b11935) + mod_timer_fd: add timerfd support to the core for now you must enable it in switch.conf.xml with the param enable-softtimer-timerfd=true later if it proves to work well we can make it on by default, please test if you have a new kernel that supports this option kernel >= 2.6.25 and libc >= 2.8 (r:10174ea6) mod_tts_commandline: fix core dump, temp file problem. flush can be called several times (FSMOD-35) mod_unimrcp: fix fortify findings for mod_unimrcp (r:336f0b4e/FSMOD-67) mod_unimrcp: fix truncated TTS (r:e37dd41e/FS-3201) + mod_unimrcp: Destroy schannel only *after* cleanup of its contents is done (r:0f17bcc5) + mod_unimrcp: add locking to mrcp dtmf generator (r:f5704114/FS-3163) mod_valet_parking: add event data to valet parking hold event mod_valet_parking: add event for Valet Parking action exit mod_valet_parking: pass hold class on transfer (r:76a065ec) @@ -734,14 +802,17 @@ freeswitch (1.0.7) mod_xml_cdr: fix locked sessions (XML-26) mod_xml_cdr: fix minor memory leaks and config bug (r:19253d83/MODEVENT-62) mod_xml_cdr: Fix prefix-a-leg not respected for url submission (r:ea9021a2/FS-2998) + mod_xml_cdr: Fix delay to 5 sec from 5000 sec (r:34a38009/FS-2815) mod_xml_rpc: Fix crash if unauthorized XML RPC is attempted (r:9835395c/FS-184) scripts: added honeypot.pl and blacklist.pl which add extra SIP security options (r:b6a81ba7) scripts: do simple verification to make sure we are getting IP addresses from VoIP abuse blacklist (r:b0049160) scripts: add_user - cmd line utility that lets admin create new users very easily. (r:ec8f2c2b) sofia-sip: fix null derefernce segfault in soa (r:f356c5e6) sofia-sip: extend timeout for session expires on short timeouts to be 90% of timeout instead of 1/3 to handle devices that do not refresh in time such as polycom (r:a7f48928/SFSIP-212) + support: update fscore_pb to work with git (r:8f67e93a) tools: Add fs_encode tool (r:89b17601) tools: Add randomize-passwords.pl script to main tree (r:5e6123ef) + tools: Change logger.pl host flag to -H from -h (conflicted w/ -h for help); add -H/--host to usage (r:73ca862c) freeswitch (1.0.6) @@ -1513,7 +1584,7 @@ freeswitch (1.0.4) build: use different version file for moh version (r:13093) build: de-couple version numbers and builds of sound files and moh files (FSBUILD-153/r:13096) build: use sound_version.txt and moh_version.txt to determine sound file version on windows (FSBUILD-152/r:13097) - build: use in tree libtiff for msvc build and fix some header generation checks (r:13150) + build: use in tree libtiff for msvc build and fix some header generation checks (r:13097) build: clean esl on make current (r:13204,13205) build: fix warning-as-error that stops MSVC from building solution (FSCORE-367/r:13301) build: fix MSVC build issue from r13294 (FSBUILD-159/r:13302) From 2330b340a45415d61523b995123eff8f51377f47 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 12 Apr 2011 19:33:58 -0500 Subject: [PATCH 294/558] fix segfault in zrtp srtcp --- src/switch_rtp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index e59810b05b..15424b3153 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2670,10 +2670,11 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t break; case zrtp_status_drop: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection drop with code %d\n", stat); - bytes = 0; + *bytes = 0; break; case zrtp_status_fail: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error: zRTP protection fail with code %d\n", stat); + *bytes = 0; break; default: break; From 36bfef53dec67532525500a71682c918192b06c7 Mon Sep 17 00:00:00 2001 From: Brian West Date: Tue, 12 Apr 2011 19:34:34 -0500 Subject: [PATCH 295/558] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 206 ++++++++++++++++ src/mod/languages/mod_managed/managed/swig.cs | 220 +++++++++++++++++- 2 files changed, 422 insertions(+), 4 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index b3ce7997b9..33c18dab84 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -1191,6 +1191,17 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *) "execute_on_tone_detect"; + + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -4486,6 +4497,35 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_say_args_t_gender_get(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_args_t_ext_set(void * jarg1, char * jarg2) { + switch_say_args_t *arg1 = (switch_say_args_t *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_say_args_t *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->ext = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->ext, (const char *)arg2); + } else { + arg1->ext = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_args_t_ext_get(void * jarg1) { + char * jresult ; + switch_say_args_t *arg1 = (switch_say_args_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_args_t *)jarg1; + result = (char *) ((arg1)->ext); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_say_args_t() { void * jresult ; switch_say_args_t *result = 0 ; @@ -10631,6 +10671,11 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_persistant_execute_trans(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_signal_handlers() { + switch_core_set_signal_handlers(); +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_debug_level() { unsigned long jresult ; uint32_t result; @@ -10736,6 +10781,79 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_expire_registration(int jarg1) { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_file_handle_get_variable(void * jarg1, char * jarg2) { + char * jresult ; + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + arg2 = (char *)jarg2; + result = (char *)switch_say_file_handle_get_variable(arg1,(char const *)arg2); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_file_handle_get_path(void * jarg1) { + char * jresult ; + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + result = (char *)switch_say_file_handle_get_path(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_file_handle_detach_path(void * jarg1) { + char * jresult ; + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + result = (char *)switch_say_file_handle_detach_path(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_file_handle_destroy(void * jarg1) { + switch_say_file_handle_t **arg1 = (switch_say_file_handle_t **) 0 ; + + arg1 = (switch_say_file_handle_t **)jarg1; + switch_say_file_handle_destroy(arg1); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_say_file_handle_create(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_say_file_handle_t **arg1 = (switch_say_file_handle_t **) 0 ; + char *arg2 = (char *) 0 ; + switch_event_t **arg3 = (switch_event_t **) 0 ; + switch_status_t result; + + arg1 = (switch_say_file_handle_t **)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_event_t **)jarg3; + result = (switch_status_t)switch_say_file_handle_create(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_file(void * jarg1, char * jarg2) { + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + arg2 = (char *)jarg2; + switch_say_file(arg1,(char const *)arg2,arg3); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -19902,6 +20020,29 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_say_function_get(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_say_string_function_set(void * jarg1, void * jarg2) { + switch_say_interface *arg1 = (switch_say_interface *) 0 ; + switch_say_string_callback_t arg2 = (switch_say_string_callback_t) 0 ; + + arg1 = (switch_say_interface *)jarg1; + arg2 = (switch_say_string_callback_t)jarg2; + if (arg1) (arg1)->say_string_function = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_say_string_function_get(void * jarg1) { + void * jresult ; + switch_say_interface *arg1 = (switch_say_interface *) 0 ; + switch_say_string_callback_t result; + + arg1 = (switch_say_interface *)jarg1; + result = (switch_say_string_callback_t) ((arg1)->say_string_function); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_rwlock_set(void * jarg1, void * jarg2) { switch_say_interface *arg1 = (switch_say_interface *) 0 ; switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ; @@ -24635,6 +24776,20 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_mark_hold(void * jarg1, int ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_execute_on(void * jarg1, char * jarg2) { + int jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_channel_execute_on(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create(void * jarg1, void * jarg2, void * jarg3) { int jresult ; switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ; @@ -28318,6 +28473,34 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_say(void * jarg1, char * jarg2, cha } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_say_string(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, void * jarg9) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) 0 ; + char *arg7 = (char *) 0 ; + char *arg8 = (char *) 0 ; + char **arg9 = (char **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + arg5 = (char *)jarg5; + arg6 = (char *)jarg6; + arg7 = (char *)jarg7; + arg8 = (char *)jarg8; + arg9 = (char **)jarg9; + result = (switch_status_t)switch_ivr_say_string(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_say_method_by_name(char * jarg1) { int jresult ; char *arg1 = (char *) 0 ; @@ -30441,6 +30624,29 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_is_switch_xml_root_t_get(void * jar } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_refs_set(void * jarg1, unsigned long jarg2) { + switch_xml *arg1 = (switch_xml *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_xml *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->refs = arg2; + +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_refs_get(void * jarg1) { + unsigned long jresult ; + switch_xml *arg1 = (switch_xml *) 0 ; + uint32_t result; + + arg1 = (switch_xml *)jarg1; + result = (uint32_t) ((arg1)->refs); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_xml() { void * jresult ; switch_xml *result = 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 08e2e08e13..400acef378 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2412,6 +2412,10 @@ public class freeswitch { return ret; } + public static void switch_core_set_signal_handlers() { + freeswitchPINVOKE.switch_core_set_signal_handlers(); + } + public static uint switch_core_debug_level() { uint ret = freeswitchPINVOKE.switch_core_debug_level(); return ret; @@ -2451,6 +2455,34 @@ public class freeswitch { return ret; } + public static string switch_say_file_handle_get_variable(SWIGTYPE_p_switch_say_file_handle sh, string var) { + string ret = freeswitchPINVOKE.switch_say_file_handle_get_variable(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh), var); + return ret; + } + + public static string switch_say_file_handle_get_path(SWIGTYPE_p_switch_say_file_handle sh) { + string ret = freeswitchPINVOKE.switch_say_file_handle_get_path(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh)); + return ret; + } + + public static string switch_say_file_handle_detach_path(SWIGTYPE_p_switch_say_file_handle sh) { + string ret = freeswitchPINVOKE.switch_say_file_handle_detach_path(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh)); + return ret; + } + + public static void switch_say_file_handle_destroy(SWIGTYPE_p_p_switch_say_file_handle sh) { + freeswitchPINVOKE.switch_say_file_handle_destroy(SWIGTYPE_p_p_switch_say_file_handle.getCPtr(sh)); + } + + public static switch_status_t switch_say_file_handle_create(SWIGTYPE_p_p_switch_say_file_handle sh, string ext, SWIGTYPE_p_p_switch_event var_event) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_say_file_handle_create(SWIGTYPE_p_p_switch_say_file_handle.getCPtr(sh), ext, SWIGTYPE_p_p_switch_event.getCPtr(var_event)); + return ret; + } + + public static void switch_say_file(SWIGTYPE_p_switch_say_file_handle sh, string fmt) { + freeswitchPINVOKE.switch_say_file(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh), fmt); + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -3713,6 +3745,11 @@ public class freeswitch { freeswitchPINVOKE.switch_channel_mark_hold(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)on); } + public static switch_status_t switch_channel_execute_on(SWIGTYPE_p_switch_channel channel, string variable_prefix) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_execute_on(SWIGTYPE_p_switch_channel.getCPtr(channel), variable_prefix); + return ret; + } + public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -4509,6 +4546,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_say_string(SWIGTYPE_p_switch_core_session session, string lang, string ext, string tosay, string module_name, string say_type, string say_method, string say_gender, ref string rstr) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_say_string(SWIGTYPE_p_switch_core_session.getCPtr(session), lang, ext, tosay, module_name, say_type, say_method, say_gender, ref rstr); + return ret; + } + public static switch_say_method_t switch_ivr_get_say_method_by_name(string name) { switch_say_method_t ret = (switch_say_method_t)freeswitchPINVOKE.switch_ivr_get_say_method_by_name(name); return ret; @@ -5525,6 +5567,7 @@ public class freeswitch { public static readonly string SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get(); + public static readonly string SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get(); public static readonly string SWITCH_CALL_TIMEOUT_VARIABLE = freeswitchPINVOKE.SWITCH_CALL_TIMEOUT_VARIABLE_get(); public static readonly string SWITCH_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_HOLDING_UUID_VARIABLE_get(); public static readonly string SWITCH_SOFT_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_SOFT_HOLDING_UUID_VARIABLE_get(); @@ -6072,6 +6115,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get")] public static extern string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get")] + public static extern string SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")] public static extern string SWITCH_CALL_TIMEOUT_VARIABLE_get(); @@ -6906,6 +6952,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_say_args_t_gender_get")] public static extern int switch_say_args_t_gender_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_args_t_ext_set")] + public static extern void switch_say_args_t_ext_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_args_t_ext_get")] + public static extern string switch_say_args_t_ext_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_say_args_t")] public static extern IntPtr new_switch_say_args_t(); @@ -8322,6 +8374,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_persistant_execute_trans")] public static extern int switch_cache_db_persistant_execute_trans(HandleRef jarg1, string jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_signal_handlers")] + public static extern void switch_core_set_signal_handlers(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_debug_level")] public static extern uint switch_core_debug_level(); @@ -8346,6 +8401,24 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_expire_registration")] public static extern int switch_core_expire_registration(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_get_variable")] + public static extern string switch_say_file_handle_get_variable(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_get_path")] + public static extern string switch_say_file_handle_get_path(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_detach_path")] + public static extern string switch_say_file_handle_detach_path(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_destroy")] + public static extern void switch_say_file_handle_destroy(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_create")] + public static extern int switch_say_file_handle_create(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file")] + public static extern void switch_say_file(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -10536,6 +10609,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_function_get")] public static extern IntPtr switch_say_interface_say_function_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_string_function_set")] + public static extern void switch_say_interface_say_string_function_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_string_function_get")] + public static extern IntPtr switch_say_interface_say_string_function_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_rwlock_set")] public static extern void switch_say_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2); @@ -11694,6 +11773,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_mark_hold")] public static extern void switch_channel_mark_hold(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_execute_on")] + public static extern int switch_channel_execute_on(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")] public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); @@ -12441,6 +12523,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_say")] public static extern int switch_ivr_say(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_say_string")] + public static extern int switch_ivr_say_string(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, ref string jarg9); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_say_method_by_name")] public static extern int switch_ivr_get_say_method_by_name(string jarg1); @@ -12924,6 +13009,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_is_switch_xml_root_t_get")] public static extern int switch_xml_is_switch_xml_root_t_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_refs_set")] + public static extern void switch_xml_refs_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_refs_get")] + public static extern uint switch_xml_refs_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_xml")] public static extern IntPtr new_switch_xml(); @@ -15285,6 +15376,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t { private HandleRef swigCPtr; @@ -17835,6 +17956,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_say_file_handle { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_say_file_handle(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_say_file_handle() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_say_file_handle obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_xml_binding { private HandleRef swigCPtr; @@ -18885,6 +19036,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_switch_say_file_handle { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_say_file_handle(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_say_file_handle() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_switch_say_file_handle obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 1.3.35 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_switch_size_t { private HandleRef swigCPtr; @@ -23051,7 +23232,8 @@ namespace FreeSWITCH.Native { SCF_VERBOSE_EVENTS = (1 << 11), SCF_USE_WIN32_MONOTONIC = (1 << 12), SCF_AUTO_SCHEMAS = (1 << 13), - SCF_MINIMAL = (1 << 14) + SCF_MINIMAL = (1 << 14), + SCF_USE_NAT_MAPPING = (1 << 15) } } @@ -28641,7 +28823,7 @@ namespace FreeSWITCH.Native { SWITCH_RTP_FLAG_NOBLOCK = (1 << 0), SWITCH_RTP_FLAG_IO = (1 << 1), SWITCH_RTP_FLAG_USE_TIMER = (1 << 2), - SWITCH_RTP_FLAG_TIMER_RECLOCK = (1 << 3), + SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 3), SWITCH_RTP_FLAG_SECURE_SEND = (1 << 4), SWITCH_RTP_FLAG_SECURE_RECV = (1 << 5), SWITCH_RTP_FLAG_AUTOADJ = (1 << 6), @@ -28668,8 +28850,7 @@ namespace FreeSWITCH.Native { SWITCH_RTP_FLAG_DEBUG_RTP_READ = (1 << 27), SWITCH_RTP_FLAG_DEBUG_RTP_WRITE = (1 << 28), SWITCH_RTP_FLAG_VIDEO = (1 << 29), - SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30), - SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 31) + SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30) } } @@ -29133,6 +29314,16 @@ public class switch_say_args_t : IDisposable { } } + public string ext { + set { + freeswitchPINVOKE.switch_say_args_t_ext_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_say_args_t_ext_get(swigCPtr); + return ret; + } + } + public switch_say_args_t() : this(freeswitchPINVOKE.new_switch_say_args_t(), true) { } @@ -29218,6 +29409,17 @@ public class switch_say_interface : IDisposable { } } + public SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t say_string_function { + set { + freeswitchPINVOKE.switch_say_interface_say_string_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_say_string_function_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_switch_thread_rwlock_t rwlock { set { freeswitchPINVOKE.switch_say_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value)); @@ -31490,6 +31692,16 @@ public class switch_xml : IDisposable { } } + public uint refs { + set { + freeswitchPINVOKE.switch_xml_refs_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_xml_refs_get(swigCPtr); + return ret; + } + } + public switch_xml() : this(freeswitchPINVOKE.new_switch_xml(), true) { } From 5d2a13ade440b1d903958f7e2e27ce6daefd6410 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 12 Apr 2011 18:45:29 -0700 Subject: [PATCH 296/558] Update ChangeLog through April 12 --- docs/ChangeLog | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/ChangeLog b/docs/ChangeLog index 4d0760a982..9aae7053a2 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -24,6 +24,7 @@ freeswitch (1.0.7) build: VS2010 libportaudio project improvements for DirectX builds and switch to build DirectX by default (r:e9e33f51/FS-3033) build: add make targets for mod_com_g729 mod_com_g729-activate mod_com_g729-install mod_com_g729-clean mod_com_g729-uninstall (r:17d52112) build: add support for bz2 to getlibs (r:b61fc396) + build: Bump callie sounds to 1.0.15 (r:c8eaef60) codec2: working prototype, still for testing only (r:04ca0751) config: move limit.conf to db.conf config: Update VM phrase macros to voice option then action on main, config menus @@ -231,6 +232,12 @@ freeswitch (1.0.7) core: Fix X-PREPROCESS exec to wait pid (r:dae2cb4a) core: Ability to use mod_say with native files; native is a special case so use the extension native e.g. en.native (r:3a2e1d03/FS-3176) core: Fix: Bridging a call to multiple legs and using leg_delay_start, legs that lost the race before the leg_delay_start time is up still get originated for a brief moment (r:c5daf80e/FS-3218) + core: Have UPNP/PMP active without opening port mappings in the router/firewall (r:008f9889/FS-3208) + core: add execute_on function so you can have execute_on_answer_1 execute_on_answer_2 execute_on_answer_3 etc (r:27c6d111) + core: do this slightly safer so we don't have the mutex locked when we exec the app (r:ef175741) + core: Fix argument parsing for tone_detect app (r:38c3a67a/FS-3229) + core: add L16 def for 32ms and allow timer matrix to drop to 1ms to support nelly (r:82e3d49f) + core: fix segfault in zrtp srtcp (r:2330b340) embedded languages: Provide core level support for conditional Set Global Variable (r:c017c24b/FSCORE-612) embedded languages: add insertFile front end to switch_ivr_insert_file and reswig (r:c4e350ab) fs_cli: block control-z from fs cli and print a warning how to exit properly (r:dc436b82) @@ -271,6 +278,7 @@ freeswitch (1.0.7) libesl: Add 'make perlmod-install' to ESL (please test) (r:06c42179) libesl: build python esl bindings and ship them in freeswitch-python-package (r:44bfcf1d/FS-3128) libesl: use poll instead of select in ESL client lib because select is not your friend.... (r:ae595cd5) + libesl: Add digit_timeout to ESL::IVR's playAndGetDigits method (r:f564d383) libfreetdm: implemented freetdm config nodes and ss7 initial configuration libfreetdm: fix codec for CAS signaling (r:b76e7f18) libfreetdm: freetdm: ss7- added support for incoming group blocks, started adding support for ansi (r:c219a73c) @@ -390,6 +398,8 @@ freeswitch (1.0.7) mod_conference: prevent race condition on conference join/exit (r:1552ecf5) mod_conference: I finally tracked this down to the actual recordings generated by mod_conference. This patch delays the recording slightly to allow time for the buffer to fill up, we were riding it so closely that sometimes we would come up short and inject silence into the file to preserve time passing (r:3253bcb3/FS-3147) mod_conference: wait for channels to come up in paging mode (r:b8063c3d) + mod_conference: Conference APIs for enabling/disabling enter/exit sounds for active conferences (r:31cebd4f/FS-3219) + mod_conference: Fix pool swelling, replaced a pool strdup that could recur with a strdup/free to avoid it (r:bcd6c3a1/FS-3137) mod_curl: use method=post when post requested (r:c6a4ddd0/FSMOD-69) mod_db: fix stack corruption (MODAPP-407) mod_dialplan_xml: Add in the INFO log the caller id number when processing a request (Currenly only show the caller name) (r:e1df5e13) @@ -415,6 +425,7 @@ freeswitch (1.0.7) mod_dptools: merge file_string into dptools (r:eefdb764) mod_dptools: change mod_dptools to use the better method of fetching user xml that does not hang onto the xml root (r:e52e44e3) mod_dptools: the intent for having the module and lang separate is for things where the same module can use different sets of sounds like en module and en-male or en-female lang (sound dirs) there was indeed a disconnect in the dialplan version of this app. Originally say was only available in phrase macros so I change the syntax of the say app so you can specify both the module and the lang absolte from the dp with something like he:he as the module name. (r:44304f49) + mod_dptools: Set the default lang if not supplied (mod_say_en) (r:5382972a/FS-3215) mod_easyroute: Fix possible segfaults and memory leak during unload, and add new setting odbc-retries (r:7fbc47f8/FS-2973) mod_enum: switch mod_enum to use new portable in-tree version (r:2bbc37e3) mod_enum: fix race condition between ldns configure creating ldns/util.h and mod_enum (r:87884c5c) @@ -553,6 +564,7 @@ freeswitch (1.0.7) mod_osp:Changed OSP TCP port from 1080 to 5045. (r:03abefdf) mod_portaudio: Fix inbound state (CS_ROUTING not CS_INIT) (MODENDP-302) mod_portaudio: mod_portaudio improvements and bug fixes (r:33b74ca8/FS-3006) + mod_portaudio: Add pa devlist to portaudio webapi (r:e8f10ea3) mod_sangoma_codec: Add sample config file mod_sangoma_codec: added load/noload options for the supported codecs mod_sangoma_codec: rename load/noload to register/noregister @@ -571,8 +583,10 @@ freeswitch (1.0.7) mod_say_en: introduce new say_string method of doing say and use it in mod_say_en as an example. try: eval ${say_string en.gsm en current_date_time pronounced ${strepoch()}} from the cli with this patch. We can do more to centralize the say things and go back and apply it to other langs, using this method you can set the desired file ext as well which I think is a bounty.... (r:d5ef86d7) mod_say_en: If you only tell SAY CURRENCY to say 100 it should only say 100 dollars without the "0 cents" (r:426a4e76/FS-2922) mod_say_es: fix grammar when saying dates and time (r:6bed19b2/MODAPP-429) + mod_say_he: Add Hebrew say module (r:ebd9c83e/FS-3211) mod_say_ja: initial commit, still needs sound files (r:b2423158/FS-2755) mod_say_ru: Fix saying time with +1 hour of current time (r:68d74c31/MODAPP-444) + mod_say_ru: now support say_string like mod_say_en. Now support channel variables gender,cases can be set in english and russian for example: (r:8b5ecd2f) mod_say_zh: Number reading should now be OK for the whole range of integers for Cantonese and Mandarin mod_shout: bump mod_shout to use mpg123-1.13.2 to hopefully address unwanted calls to exit() and inherit other upstream fixes (r:079f3f73) mod_silk: Fix mod_silk compliance and performance issues (r:2ddbc457/MODCODEC-20) @@ -753,6 +767,10 @@ freeswitch (1.0.7) mod_sofia: New Sofia API to look up the username of a given user (r:7556ec57/FS-3187) mod_sofia: sip_authentication was not cleared after nonce expired -caused sofia_reg_internal.db grow bigger and bigger with time (r:c735e28a/FS-3190) mod_sofia: pass failure across in T.38 passthru mode (r:31273b42) + mod_sofia: auto-aleg-full and auto-aleg-domain for from_domain field in gateway (r:fda2283b) + mod_sofia: After further review I can concede the point that we should always say partial considering how we do things. With this commit we should at least be sending separate partial updates for each existing dialog to everyone with a subscription. If we need to introduce more data, consolidate them etc. We need to do it in small chunks and keep things sane. (r:7eae7f37/FS-2877) + mod_sofia: Fix:Attended transfer with bypass media fails in various ways (r:4b706dac/FS-3227) + mod_sofia: SO, If the RFC told you to jump off a cliff......? (r:07b9186d/FS-3226) mod_spandsp: initial checkin of mod_fax/mod_voipcodecs merge into mod_spandsp (r:fa9a59a8) mod_spandsp: rework of new mod_spandsp to have functions broken up into different c files (r:65400642) mod_spandsp: improve duplicate digit detection and add 'min_dup_digit_spacing_ms' channel variable for use with the dtmf detector (r:eab4f246/FSMOD-45) From 4a494ff930bbc8eab082ecb9ecdc0b26d2d51601 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Wed, 13 Apr 2011 20:13:50 +0200 Subject: [PATCH 297/558] Skinny: incomplete support for DialedPhoneBookMessage --- .../endpoints/mod_skinny/skinny_protocol.h | 22 ++++++++++++++++++- src/mod/endpoints/mod_skinny/skinny_server.c | 18 +++++++++++++++ src/mod/endpoints/mod_skinny/skinny_tables.c | 2 ++ src/mod/endpoints/mod_skinny/skinny_tables.h | 2 +- 4 files changed, 42 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index 8f8911f2a7..eff0091c07 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -234,6 +234,15 @@ struct PACKED extended_data_message { #define DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE 0x0042 /* See struct PACKED extended_data_message */ +/* DialedPhoneBookMessage */ +#define DIALED_PHONE_BOOK_MESSAGE 0x0048 +struct PACKED dialed_phone_book_message { + uint32_t number_index; /* must be shifted 4 bits right */ + uint32_t line_instance; + uint32_t unknown; + char phone_number[256]; +}; + /* RegisterAckMessage */ #define REGISTER_ACK_MESSAGE 0x0081 struct PACKED register_ack_message { @@ -507,7 +516,7 @@ struct PACKED display_prompt_status_message { }; /* ClearPromptStatusMessage */ -#define CLEAR_PROMPT_STATUS_MESSAGE 0x0113 +#define CLEAR_PROMPT_STATUS_MESSAGE 0x0113 struct PACKED clear_prompt_status_message { uint32_t line_instance; uint32_t call_id; @@ -573,6 +582,15 @@ struct PACKED service_url_stat_res_message { #define USER_TO_DEVICE_DATA_VERSION1_MESSAGE 0x013F /* See struct PACKED extended_data_message */ +/* DialedPhoneBookAckMessage */ +#define DIALED_PHONE_BOOK_ACK_MESSAGE 0x0152 +struct PACKED dialed_phone_book_ack_message { + uint32_t number_index; /* must be shifted 4 bits right */ + uint32_t line_instance; + uint32_t unknown; + uint32_t unknown2; +}; + /* XMLAlarmMessage */ #define XML_ALARM_MESSAGE 0x015A @@ -614,6 +632,7 @@ union skinny_data { struct feature_stat_req_message feature_req; /* see field "extended_data" for DEVICE_TO_USER_DATA_VERSION1_MESSAGE */ /* see field "extended_data" for DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE */ + struct dialed_phone_book_message dialed_phone_book; struct register_ack_message reg_ack; struct start_tone_message start_tone; struct stop_tone_message stop_tone; @@ -651,6 +670,7 @@ union skinny_data { struct display_pri_notify_message display_pri_notify; struct service_url_stat_res_message service_url_res; /* see field "extended_data" for USER_TO_DEVICE_DATA_VERSION1_MESSAGE */ + struct dialed_phone_book_ack_message dialed_phone_book_ack; struct data_message data; struct extended_data_message extended_data; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 2c338d6ce5..12c83b846a 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -2012,6 +2012,22 @@ switch_status_t skinny_handle_extended_data_message(listener_t *listener, skinny return SWITCH_STATUS_SUCCESS; } +switch_status_t skinny_handle_dialed_phone_book_message(listener_t *listener, skinny_message_t *request) +{ + skinny_message_t *message; + + skinny_check_data_length(request, sizeof(request->data.dialed_phone_book)); + + message = switch_core_alloc(listener->pool, 12+sizeof(message->data.dialed_phone_book_ack)); + message->type = DIALED_PHONE_BOOK_ACK_MESSAGE; + message->length = 4 + sizeof(message->data.dialed_phone_book_ack); + message->data.dialed_phone_book_ack.number_index = request->data.dialed_phone_book.number_index; + message->data.dialed_phone_book_ack.line_instance = request->data.dialed_phone_book.line_instance; + message->data.dialed_phone_book_ack.unknown = request->data.dialed_phone_book.unknown; + message->data.dialed_phone_book_ack.unknown2 = 0; + + return SWITCH_STATUS_SUCCESS; +} switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t *request) { @@ -2106,6 +2122,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re return skinny_handle_extended_data_message(listener, request); case DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE: return skinny_handle_extended_data_message(listener, request); + case DIALED_PHONE_BOOK_MESSAGE: + return skinny_handle_dialed_phone_book_message(listener, request); case XML_ALARM_MESSAGE: return skinny_handle_xml_alarm(listener, request); default: diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 04237ad3ea..5a627dba0b 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -65,6 +65,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = { {FEATURE_STAT_REQ_MESSAGE, "FeatureStatReqMessage"}, {DEVICE_TO_USER_DATA_VERSION1_MESSAGE, "DeviceToUserDataVersion1Message"}, {DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE, "DeviceToUserDataResponseVersion1Message"}, + {DIALED_PHONE_BOOK_MESSAGE, "DialedPhoneBookMessage"}, {REGISTER_ACK_MESSAGE, "RegisterAckMessage"}, {START_TONE_MESSAGE, "StartToneMessage"}, {STOP_TONE_MESSAGE, "StopToneMessage"}, @@ -102,6 +103,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = { {DISPLAY_PRI_NOTIFY_MESSAGE, "DisplayPriNotifyMessage"}, {SERVICE_URL_STAT_RES_MESSAGE, "ServiceUrlStatMessage"}, {USER_TO_DEVICE_DATA_VERSION1_MESSAGE, "UserToDeviceDataVersion1Message"}, + {DIALED_PHONE_BOOK_ACK_MESSAGE, "DialedPhoneBookAckMessage"}, {XML_ALARM_MESSAGE, "XMLAlarmMessage"}, {0, NULL} }; diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index abfdfc2aa0..0e0c9b1b5b 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -87,7 +87,7 @@ uint32_t func(const char *str)\ } -extern struct skinny_table SKINNY_MESSAGE_TYPES[69]; +extern struct skinny_table SKINNY_MESSAGE_TYPES[71]; const char *skinny_message_type2str(uint32_t id); uint32_t skinny_str2message_type(const char *str); #define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES) From c323efbf72ede1414731d2adbee1565cdde6b689 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Wed, 13 Apr 2011 13:39:18 -0700 Subject: [PATCH 298/558] Measure twice, cut once... --- conf/lang/en/dir/sounds.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/lang/en/dir/sounds.xml b/conf/lang/en/dir/sounds.xml index e7a2e8f925..15ecec304a 100644 --- a/conf/lang/en/dir/sounds.xml +++ b/conf/lang/en/dir/sounds.xml @@ -99,7 +99,7 @@ - + From 2bf69d621f2264f6a101add04129d8344e3b9c07 Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Wed, 13 Apr 2011 23:15:53 +0200 Subject: [PATCH 299/558] Skinny: handle AccessoryStatusMessage --- src/mod/endpoints/mod_skinny/mod_skinny.h | 3 ++ .../endpoints/mod_skinny/skinny_protocol.h | 11 ++++++- src/mod/endpoints/mod_skinny/skinny_server.c | 29 ++++++++++++++++++- src/mod/endpoints/mod_skinny/skinny_tables.c | 20 +++++++++++++ src/mod/endpoints/mod_skinny/skinny_tables.h | 23 ++++++++++++++- 5 files changed, 83 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index eb7e45ebc0..8cd893284c 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -136,6 +136,9 @@ struct listener { char device_name[16]; uint32_t device_instance; uint32_t device_type; + uint32_t headset; + uint32_t handset; + uint32_t speaker; char firmware_version[16]; char *soft_key_set_set; diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index eff0091c07..1eed692157 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -178,7 +178,7 @@ struct PACKED soft_key_event_message { /* HeadsetStatusMessage */ #define HEADSET_STATUS_MESSAGE 0x002B struct PACKED headset_status_message { - uint32_t mode; + uint32_t mode; /* 1=HeadsetOn; 2=HeadsetOff */ }; /* RegisterAvailableLinesMessage */ @@ -243,6 +243,14 @@ struct PACKED dialed_phone_book_message { char phone_number[256]; }; +/* AccessoryStatusMessage */ +#define ACCESSORY_STATUS_MESSAGE 0x0049 +struct PACKED accessory_status_message { + uint32_t accessory_id; + uint32_t accessory_status; + uint32_t unknown; +}; + /* RegisterAckMessage */ #define REGISTER_ACK_MESSAGE 0x0081 struct PACKED register_ack_message { @@ -633,6 +641,7 @@ union skinny_data { /* see field "extended_data" for DEVICE_TO_USER_DATA_VERSION1_MESSAGE */ /* see field "extended_data" for DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE */ struct dialed_phone_book_message dialed_phone_book; + struct accessory_status_message accessory_status; struct register_ack_message reg_ack; struct start_tone_message start_tone; struct stop_tone_message stop_tone; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 12c83b846a..efe02a9811 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1902,7 +1902,14 @@ switch_status_t skinny_headset_status_message(listener_t *listener, skinny_messa { skinny_check_data_length(request, sizeof(request->data.headset_status)); - /* Nothing to do */ + switch(request->data.headset_status.mode) { + case 1: + listener->headset = SKINNY_ACCESSORY_STATE_OFFHOOK; + break; + default: + listener->headset = SKINNY_ACCESSORY_STATE_ONHOOK; + break; + } return SWITCH_STATUS_SUCCESS; } @@ -2028,6 +2035,24 @@ switch_status_t skinny_handle_dialed_phone_book_message(listener_t *listener, sk return SWITCH_STATUS_SUCCESS; } +switch_status_t skinny_handle_accessory_status_message(listener_t *listener, skinny_message_t *request) +{ + skinny_check_data_length(request, sizeof(request->data.accessory_status)); + + switch(request->data.accessory_status.accessory_id) { + case SKINNY_ACCESSORY_HEADSET: + listener->headset = request->data.accessory_status.accessory_status; + break; + case SKINNY_ACCESSORY_HANDSET: + listener->handset = request->data.accessory_status.accessory_status; + break; + case SKINNY_ACCESSORY_SPEAKER: + listener->speaker = request->data.accessory_status.accessory_status; + break; + } + + return SWITCH_STATUS_SUCCESS; +} switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t *request) { @@ -2124,6 +2149,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re return skinny_handle_extended_data_message(listener, request); case DIALED_PHONE_BOOK_MESSAGE: return skinny_handle_dialed_phone_book_message(listener, request); + case ACCESSORY_STATUS_MESSAGE: + return skinny_handle_accessory_status_message(listener, request); case XML_ALARM_MESSAGE: return skinny_handle_xml_alarm(listener, request); default: diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index 5a627dba0b..59bb4a1f2f 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -66,6 +66,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = { {DEVICE_TO_USER_DATA_VERSION1_MESSAGE, "DeviceToUserDataVersion1Message"}, {DEVICE_TO_USER_DATA_RESPONSE_VERSION1_MESSAGE, "DeviceToUserDataResponseVersion1Message"}, {DIALED_PHONE_BOOK_MESSAGE, "DialedPhoneBookMessage"}, + {ACCESSORY_STATUS_MESSAGE, "AccessoryStatusMessage"}, {REGISTER_ACK_MESSAGE, "RegisterAckMessage"}, {START_TONE_MESSAGE, "StartToneMessage"}, {STOP_TONE_MESSAGE, "StopToneMessage"}, @@ -255,6 +256,25 @@ struct skinny_table SKINNY_DEVICE_RESET_TYPES[] = { SKINNY_DECLARE_ID2STR(skinny_device_reset_type2str, SKINNY_DEVICE_RESET_TYPES, "DeviceResetTypeUnknown") SKINNY_DECLARE_STR2ID(skinny_str2device_reset_type, SKINNY_DEVICE_RESET_TYPES, -1) +struct skinny_table SKINNY_ACCESSORY_TYPES[] = { + {SKINNY_ACCESSORY_NONE, "AccessoryNone"}, + {SKINNY_ACCESSORY_HEADSET, "Headset"}, + {SKINNY_ACCESSORY_HANDSET, "Handset"}, + {SKINNY_ACCESSORY_SPEAKER, "Speaker"}, + {0, NULL} +}; +SKINNY_DECLARE_ID2STR(skinny_accessory_type2str, SKINNY_ACCESSORY_TYPES, "AccessoryUnknown") +SKINNY_DECLARE_STR2ID(skinny_str2accessory_type, SKINNY_ACCESSORY_TYPES, -1) + +struct skinny_table SKINNY_ACCESSORY_STATES[] = { + {SKINNY_ACCESSORY_STATE_NONE, "AccessoryNoState"}, + {SKINNY_ACCESSORY_STATE_OFFHOOK, "OffHook"}, + {SKINNY_ACCESSORY_STATE_ONHOOK, "OnHook"}, + {0, NULL} +}; +SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown") +SKINNY_DECLARE_STR2ID(skinny_str2accessory_state, SKINNY_ACCESSORY_STATES, -1) + /* For Emacs: * Local Variables: * mode:c diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index 0e0c9b1b5b..383e5bb2b1 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -87,7 +87,7 @@ uint32_t func(const char *str)\ } -extern struct skinny_table SKINNY_MESSAGE_TYPES[71]; +extern struct skinny_table SKINNY_MESSAGE_TYPES[72]; const char *skinny_message_type2str(uint32_t id); uint32_t skinny_str2message_type(const char *str); #define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES) @@ -248,6 +248,27 @@ const char *skinny_device_reset_type2str(uint32_t id); uint32_t skinny_str2device_reset_type(const char *str); #define SKINNY_PUSH_DEVICE_RESET_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_DEVICE_RESET_TYPES) +enum skinny_accessory_types { + SKINNY_ACCESSORY_NONE = 0x00, + SKINNY_ACCESSORY_HEADSET = 0x01, + SKINNY_ACCESSORY_HANDSET = 0x02, + SKINNY_ACCESSORY_SPEAKER = 0x03 +}; +extern struct skinny_table SKINNY_ACCESSORY_TYPES[5]; +const char *skinny_accessory_type2str(uint32_t id); +uint32_t skinny_str2accessory_type(const char *str); +#define SKINNY_PUSH_ACCESSORY_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_ACCESSORY_TYPES) + +enum skinny_accessory_states { + SKINNY_ACCESSORY_STATE_NONE = 0x00, + SKINNY_ACCESSORY_STATE_OFFHOOK = 0x01, + SKINNY_ACCESSORY_STATE_ONHOOK = 0x02 +}; +extern struct skinny_table SKINNY_ACCESSORY_STATES[4]; +const char *skinny_accessory_state2str(uint32_t id); +uint32_t skinny_str2accessory_state(const char *str); +#define SKINNY_PUSH_ACCESSORY_STATES SKINNY_DECLARE_PUSH_MATCH(SKINNY_ACCESSORY_STATES) + #endif /* _SKINNY_TABLES_H */ /* For Emacs: From 2b6f70708c05db037bb7240798aafb9ced630790 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 13 Apr 2011 16:15:15 -0500 Subject: [PATCH 300/558] FS-3244 --resolve next time also attach a backtrace --- src/mod/endpoints/mod_sofia/sofia.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 2bf27d5ba8..cf25aae369 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7047,8 +7047,9 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } if (!gateway && gw_param_name) { - gateway = sofia_reg_find_gateway(gw_param_name); - extension = gateway->real_extension; + if ((gateway = sofia_reg_find_gateway(gw_param_name))) { + extension = gateway->real_extension; + } } if (gateway) { From 61057578983e38dae97d98d2899574794ae8395d Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Thu, 14 Apr 2011 13:02:27 +0200 Subject: [PATCH 301/558] Skinny: store accessory status in db instead of memory (this is not used yet) --- src/mod/endpoints/mod_skinny/mod_skinny.c | 13 +++-- src/mod/endpoints/mod_skinny/mod_skinny.h | 3 -- src/mod/endpoints/mod_skinny/skinny_server.c | 50 ++++++++++++++++---- 3 files changed, 48 insertions(+), 18 deletions(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index b05806b8d9..65ff5b8f71 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -58,7 +58,10 @@ static char devices_sql[] = " type INTEGER,\n" " max_streams INTEGER,\n" " port INTEGER,\n" - " codec_string VARCHAR(255)\n" + " codec_string VARCHAR(255),\n" + " headset INTEGER,\n" + " handset INTEGER,\n" + " speaker INTEGER\n" ");\n"; static char lines_sql[] = @@ -1916,10 +1919,10 @@ static switch_status_t load_skinny_config(void) switch_odbc_handle_exec(profile->master_odbc, active_lines_sql, NULL, NULL); } else { if ((db = switch_core_db_open_file(profile->dbname))) { - switch_core_db_test_reactive(db, "SELECT * FROM skinny_devices", NULL, devices_sql); - switch_core_db_test_reactive(db, "SELECT * FROM skinny_lines", NULL, lines_sql); - switch_core_db_test_reactive(db, "SELECT * FROM skinny_buttons", NULL, buttons_sql); - switch_core_db_test_reactive(db, "SELECT * FROM skinny_active_lines", NULL, active_lines_sql); + switch_core_db_test_reactive(db, "SELECT headset FROM skinny_devices", "DROP TABLE skinny_devices", devices_sql); + switch_core_db_test_reactive(db, "SELECT * FROM skinny_lines", "DROP TABLE skinny_lines", lines_sql); + switch_core_db_test_reactive(db, "SELECT * FROM skinny_buttons", "DROP TABLE skinny_buttons", buttons_sql); + switch_core_db_test_reactive(db, "SELECT * FROM skinny_active_lines", "DROP TABLE skinny_active_lines", active_lines_sql); } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open SQL Database!\n"); continue; diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 8cd893284c..eb7e45ebc0 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -136,9 +136,6 @@ struct listener { char device_name[16]; uint32_t device_instance; uint32_t device_type; - uint32_t headset; - uint32_t handset; - uint32_t speaker; char firmware_version[16]; char *soft_key_set_set; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index efe02a9811..35cb74adb5 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -1900,16 +1900,20 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk switch_status_t skinny_headset_status_message(listener_t *listener, skinny_message_t *request) { + char *sql; + skinny_check_data_length(request, sizeof(request->data.headset_status)); - switch(request->data.headset_status.mode) { - case 1: - listener->headset = SKINNY_ACCESSORY_STATE_OFFHOOK; - break; - default: - listener->headset = SKINNY_ACCESSORY_STATE_ONHOOK; - break; + if ((sql = switch_mprintf( + "UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d", + (request->data.headset_status.mode==1) ? SKINNY_ACCESSORY_STATE_OFFHOOK : SKINNY_ACCESSORY_STATE_ONHOOK, + listener->device_name, + listener->device_instance + ))) { + skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex); + switch_safe_free(sql); } + return SWITCH_STATUS_SUCCESS; } @@ -2037,17 +2041,43 @@ switch_status_t skinny_handle_dialed_phone_book_message(listener_t *listener, sk } switch_status_t skinny_handle_accessory_status_message(listener_t *listener, skinny_message_t *request) { + char *sql; + skinny_check_data_length(request, sizeof(request->data.accessory_status)); switch(request->data.accessory_status.accessory_id) { case SKINNY_ACCESSORY_HEADSET: - listener->headset = request->data.accessory_status.accessory_status; + if ((sql = switch_mprintf( + "UPDATE skinny_devices SET headset=%d WHERE name='%s' and instance=%d", + request->data.accessory_status.accessory_status, + listener->device_name, + listener->device_instance + ))) { + skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex); + switch_safe_free(sql); + } break; case SKINNY_ACCESSORY_HANDSET: - listener->handset = request->data.accessory_status.accessory_status; + if ((sql = switch_mprintf( + "UPDATE skinny_devices SET handset=%d WHERE name='%s' and instance=%d", + request->data.accessory_status.accessory_status, + listener->device_name, + listener->device_instance + ))) { + skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex); + switch_safe_free(sql); + } break; case SKINNY_ACCESSORY_SPEAKER: - listener->speaker = request->data.accessory_status.accessory_status; + if ((sql = switch_mprintf( + "UPDATE skinny_devices SET speaker=%d WHERE name='%s' and instance=%d", + request->data.accessory_status.accessory_status, + listener->device_name, + listener->device_instance + ))) { + skinny_execute_sql(listener->profile, sql, listener->profile->sql_mutex); + switch_safe_free(sql); + } break; } From b337b8554ccee2498a1f7db59fd3e32aecb808de Mon Sep 17 00:00:00 2001 From: Mathieu Parent Date: Thu, 14 Apr 2011 13:23:03 +0200 Subject: [PATCH 302/558] Skinny: display accessories status on CLI --- src/mod/endpoints/mod_skinny/mod_skinny.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 65ff5b8f71..38ab78553a 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -1320,6 +1320,9 @@ static int dump_device_callback(void *pArg, int argc, char **argv, char **column char *max_streams = argv[5]; char *port = argv[6]; char *codec_string = argv[7]; + char *headset = argv[8]; + char *handset = argv[9]; + char *speaker = argv[10]; const char *line = "================================================================================================="; stream->write_function(stream, "%s\n", line); @@ -1332,6 +1335,12 @@ static int dump_device_callback(void *pArg, int argc, char **argv, char **column stream->write_function(stream, "MaxStreams \t%s\n", max_streams); stream->write_function(stream, "Port \t%s\n", port); stream->write_function(stream, "Codecs \t%s\n", codec_string); + stream->write_function(stream, "HeadsetId \t%s\n", headset); + stream->write_function(stream, "Headset \t%s\n", skinny_accessory_state2str(atoi(headset))); + stream->write_function(stream, "HandsetId \t%s\n", handset); + stream->write_function(stream, "Handset \t%s\n", skinny_accessory_state2str(atoi(handset))); + stream->write_function(stream, "SpeakerId \t%s\n", speaker); + stream->write_function(stream, "Speaker \t%s\n", skinny_accessory_state2str(atoi(speaker))); stream->write_function(stream, "%s\n", line); return 0; @@ -1340,7 +1349,7 @@ static int dump_device_callback(void *pArg, int argc, char **argv, char **column switch_status_t dump_device(skinny_profile_t *profile, const char *device_name, switch_stream_handle_t *stream) { char *sql; - if ((sql = switch_mprintf("SELECT name, user_id, instance, ip, type, max_streams, port, codec_string " + if ((sql = switch_mprintf("SELECT name, user_id, instance, ip, type, max_streams, port, codec_string, headset, handset, speaker " "FROM skinny_devices WHERE name='%s'", device_name))) { skinny_execute_sql_callback(profile, profile->sql_mutex, sql, dump_device_callback, stream); From 478d51860d15b81f507b4fcce09743de2951c305 Mon Sep 17 00:00:00 2001 From: Christopher Rienzo Date: Thu, 14 Apr 2011 14:50:41 +0000 Subject: [PATCH 303/558] FS-3247 check for NULL recog_hdr --- src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c index 9d7c21574a..53281bc389 100644 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c @@ -3369,7 +3369,7 @@ static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING); } else if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) { /* RECOGNIZE failed to start */ - if (recog_hdr->completion_cause == RECOGNIZER_COMPLETION_CAUSE_UNKNOWN) { + if (!recog_hdr || recog_hdr->completion_cause == RECOGNIZER_COMPLETION_CAUSE_UNKNOWN) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d\n", schannel->name, message->start_line.status_code); } else { From 1f4cb48880e7d4a2d548f7c7943ae9d7f6c243af Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 14 Apr 2011 15:21:13 -0400 Subject: [PATCH 304/558] mod_voicemail: Implement 10 new standard api function call that allow you to control fs voicemail storage system. The goal is to have a standard API set for any additional storage system we wish the voicemail to run off. Current list of added api name are : vm_fsdb_msg_count, vm_fsdb_msg_list, vm_fsdb_msg_get, vm_fsdb_msg_delete, vm_fsdb_msg_undelete, vm_fsdb_msg_purge, vm_fsdb_msg_save, vm_fsdb_pref_greeting_set, vm_fsdb_pref_recname_set, vm_fsdb_pref_password_set. --- .../mod_voicemail/mod_voicemail.c | 742 ++++++++++++++++++ 1 file changed, 742 insertions(+) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index a046021034..16584e97d2 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -204,6 +204,36 @@ static switch_status_t vm_execute_sql(vm_profile_t *profile, char *sql, switch_m return status; } +char *vm_execute_sql2str(vm_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len) +{ + switch_cache_db_handle_t *dbh = NULL; + + char *ret = NULL; + + if (mutex) { + switch_mutex_lock(mutex); + } + + if (!(dbh = vm_get_db_handle(profile))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); + goto end; + } + + ret = switch_cache_db_execute_sql2str(dbh, sql, resbuf, len, NULL); + +end: + + switch_cache_db_release_db_handle(&dbh); + + if (mutex) { + switch_mutex_unlock(mutex); + } + + return ret; + +} + + static switch_bool_t vm_execute_sql_callback(vm_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, void *pdata) { @@ -4480,6 +4510,704 @@ SWITCH_STANDARD_API(voicemail_api_function) return SWITCH_STATUS_SUCCESS; } +struct msg_get_callback { + switch_event_t *my_params; +}; +typedef struct msg_get_callback msg_get_callback_t; + +static int message_get_callback(void *pArg, int argc, char **argv, char **columnNames) +{ + msg_get_callback_t *cbt = (msg_get_callback_t *) pArg; + + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Received-Epoch", "%s", argv[0]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Read-Epoch", "%s", argv[1]); + /* switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, user, argv[2], 255); */ + /* switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, domain, argv[3], 255); */ + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-UUID", "%s", argv[4]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Caller-Name", "%s", argv[5]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Caller-Number", "%s", argv[6]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Folder", "%s", argv[7]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-File-Path", "%s", argv[8]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Duration", "%s", argv[9]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Flags", "%s", argv[10]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Read-Flags", "%s", argv[11]); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, "VM-Message-Forwarded-By", "%s", argv[12]); + + return 0; +} + +struct msg_lst_callback { + char *buf; + size_t len; + switch_event_t *my_params; +}; +typedef struct msg_lst_callback msg_lst_callback_t; + +static int message_list_callback(void *pArg, int argc, char **argv, char **columnNames) +{ + msg_lst_callback_t *cbt = (msg_lst_callback_t *) pArg; + char *varname = NULL; + /* Message # never start with 0 */ + varname = switch_mprintf("VM-List-Message-%ld-UUID", ++cbt->len); + switch_event_add_header(cbt->my_params, SWITCH_STACK_BOTTOM, varname, "%s", argv[0]); + switch_safe_free(varname); + return 0; +} + +static int message_purge_callback(void *pArg, int argc, char **argv, char **columnNames) +{ + const char *profile_name = argv[0]; + const char *uuid = argv[1]; + const char *id = argv[2]; + const char *domain = argv[3]; + const char *file_path = argv[4]; + char *sql; + vm_profile_t *profile = get_profile(profile_name); + + if (unlink(file_path) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete file [%s]\n", file_path); + } else { + sql = switch_mprintf("DELETE FROM voicemail_msgs WHERE username='%q' AND domain='%q' AND uuid = '%q'", id, domain, uuid); + vm_execute_sql(profile, sql, profile->mutex); + switch_safe_free(sql); + } + profile_rwunlock(profile); + + return 0; +} + +/* Preference API */ +#define VM_FSDB_PREF_GREETING_SET_USAGE " [file-path]" +SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function) +{ + int slot = -1; + const char *file_path = NULL; + char *sql = NULL; + char res[254] = ""; + + char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + if (argv[3]) + slot = atoi(argv[3]); + if (argv[4]) + file_path = argv[4]; + + if (!profile_name || !domain || !id || !slot) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } else { + char *dir_path = switch_core_sprintf(pool, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, + SWITCH_PATH_SEPARATOR, + SWITCH_PATH_SEPARATOR, + profile->name, SWITCH_PATH_SEPARATOR, domain, SWITCH_PATH_SEPARATOR, id); + char *final_file_path = switch_core_sprintf(pool, "%s%sgreeting_%d.%s", dir_path, SWITCH_PATH_SEPARATOR, slot, profile->file_ext); + + if (file_path) { + if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Filename doesn't exist\n"); + profile_rwunlock(profile); + goto done; + } + + switch_file_rename(file_path, final_file_path, pool); + } + + if (switch_file_exists(final_file_path, pool) == SWITCH_STATUS_SUCCESS) { + + sql = switch_mprintf("SELECT count(*) FROM voicemail_prefs WHERE username = '%q' AND domain = '%q'", id, domain); + vm_execute_sql2str(profile, profile->mutex, sql, res, sizeof(res)); + switch_safe_free(sql); + + if (atoi(res) == 0) { + sql = switch_mprintf("INSERT INTO voicemail_prefs (username, domain, greeting_path) VALUES('%q', '%q', '%q')", id, domain, final_file_path); + } else { + sql = switch_mprintf("UPDATE voicemail_prefs SET greeting_path = '%q' WHERE username = '%q' AND domain = '%q'", final_file_path, id, domain); + } + vm_execute_sql(profile, sql, profile->mutex); + switch_safe_free(sql); + } else { + stream->write_function(stream, "-ERR Recording doesn't exist [%s]\n", final_file_path); + } + profile_rwunlock(profile); + } + + stream->write_function(stream, "-OK\n"); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_PREF_RECNAME_SET_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_pref_recname_set_function) +{ + const char *file_path = NULL; + + char *sql = NULL; + char res[254] = ""; + + char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + if (argv[3]) + file_path = argv[3]; + + if (!profile_name || !domain || !id || !file_path) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Filename doesn't exist\n"); + profile_rwunlock(profile); + goto done; + } + + sql = switch_mprintf("SELECT count(*) FROM voicemail_prefs WHERE username = '%q' AND domain = '%q'", id, domain); + vm_execute_sql2str(profile, profile->mutex, sql, res, sizeof(res)); + switch_safe_free(sql); + + if (atoi(res) == 0) { + sql = switch_mprintf("INSERT INTO voicemail_prefs (username, domain, name_path) VALUES('%q', '%q', '%q')", id, domain, file_path); + } else { + sql = switch_mprintf("UPDATE voicemail_prefs SET name_path = '%q' WHERE username = '%q' AND domain = '%q'", file_path, id, domain); + } + vm_execute_sql(profile, sql, profile->mutex); + switch_safe_free(sql); + { + char *dir_path = switch_core_sprintf(pool, "%s%svoicemail%s%s%s%s%s%s", SWITCH_GLOBAL_dirs.storage_dir, + SWITCH_PATH_SEPARATOR, + SWITCH_PATH_SEPARATOR, + profile->name, SWITCH_PATH_SEPARATOR, domain, SWITCH_PATH_SEPARATOR, id); + char *final_file_path = switch_core_sprintf(pool, "%s%srecorded_name.%s", dir_path, SWITCH_PATH_SEPARATOR, profile->file_ext); + + if (switch_file_exists(file_path, pool) != SWITCH_STATUS_SUCCESS) { + stream->write_function(stream, "-ERR Filename doesn't exist\n"); + profile_rwunlock(profile); + goto done; + } + + switch_file_rename(file_path, final_file_path, pool); + + } + profile_rwunlock(profile); + stream->write_function(stream, "-OK\n"); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_PREF_PASSWORD_SET_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_pref_password_set_function) +{ + const char *password = NULL; + + char *sql = NULL; + char res[254] = ""; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + if (argv[3]) + password = argv[3]; + + if (!profile_name || !domain || !id || !password) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + sql = switch_mprintf("SELECT count(*) FROM voicemail_prefs WHERE username = '%q' AND domain = '%q'", id, domain); + vm_execute_sql2str(profile, profile->mutex, sql, res, sizeof(res)); + switch_safe_free(sql); + + if (atoi(res) == 0) { + sql = switch_mprintf("INSERT INTO voicemail_prefs (username, domain, password) VALUES('%q', '%q', '%q')", id, domain, password); + } else { + sql = switch_mprintf("UPDATE voicemail_prefs SET password = '%q' WHERE username = '%q' AND domain = '%q'", password, id, domain); + } + vm_execute_sql(profile, sql, profile->mutex); + switch_safe_free(sql); + profile_rwunlock(profile); + + stream->write_function(stream, "-OK\n"); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + + + +/* Message API */ + +#define VM_FSDB_MSG_LIST_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_msg_list_function) +{ + char *sql; + msg_lst_callback_t cbt = { 0 }; + char *ebuf = NULL; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[1]) + profile_name = argv[1]; + if (argv[2]) + domain = argv[2]; + if (argv[3]) + id = argv[3]; + + if (!profile_name || !domain || !id) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + sql = switch_mprintf("SELECT uuid FROM voicemail_msgs WHERE username = '%q' AND domain = '%q' AND read_epoch = 0 ORDER BY read_flags, created_epoch", id, domain); + + memset(&cbt, 0, sizeof(cbt)); + + switch_event_create(&cbt.my_params, SWITCH_EVENT_REQUEST_PARAMS); + + vm_execute_sql_callback(profile, profile->mutex, sql, message_list_callback, &cbt); + + profile_rwunlock(profile); + + switch_event_add_header(cbt.my_params, SWITCH_STACK_BOTTOM, "VM-List-Count", "%ld", cbt.len); + switch_event_serialize_json(cbt.my_params, &ebuf); + switch_event_destroy(&cbt.my_params); + + switch_safe_free(sql); + stream->write_function(stream, "%s", ebuf); + switch_safe_free(ebuf); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_MSG_PURGE_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_msg_purge_function) +{ + char *sql; + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + + if (!profile_name || !domain || !id) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + sql = switch_mprintf("SELECT '%q', uuid, username, domain, file_path FROM voicemail_msgs WHERE username = '%q' AND domain = '%q' AND flags = 'delete'", profile_name, id, domain); + vm_execute_sql_callback(profile, profile->mutex, sql, message_purge_callback, NULL); + profile_rwunlock(profile); + + stream->write_function(stream, "-OK\n"); + +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_MSG_DELETE_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_msg_delete_function) +{ + char *sql; + const char *uuid = NULL; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + if (argv[3]) + uuid = argv[3]; + + if (!profile_name || !domain || !id || !uuid) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + sql = switch_mprintf("UPDATE voicemail_msgs SET flags = 'delete' WHERE username = '%q' AND domain = '%q' AND uuid = '%q'", id, domain, uuid); + vm_execute_sql(profile, sql, profile->mutex); + profile_rwunlock(profile); + + stream->write_function(stream, "-OK\n"); + +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_MSG_SAVE_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_msg_save_function) +{ + char *sql; + const char *uuid = NULL; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + if (argv[3]) + uuid = argv[3]; + + if (!profile_name || !domain || !id || !uuid) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + sql = switch_mprintf("UPDATE voicemail_msgs SET flags='save' WHERE username='%q' AND domain='%q' AND uuid = '%q'", id, domain, uuid); + vm_execute_sql(profile, sql, profile->mutex); + profile_rwunlock(profile); + + stream->write_function(stream, "-OK\n"); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_MSG_UNDELETE_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_msg_undelete_function) +{ + char *sql; + const char *uuid = NULL; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + if (argv[3]) + uuid = argv[3]; + + if (!profile_name || !domain || !id || !uuid) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + sql = switch_mprintf("UPDATE voicemail_msgs SET flags='' WHERE username='%q' AND domain='%q' AND uuid = '%q'", id, domain, uuid); + vm_execute_sql(profile, sql, profile->mutex); + profile_rwunlock(profile); + + stream->write_function(stream, "-OK\n"); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_MSG_GET_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_msg_get_function) +{ + char *sql; + msg_get_callback_t cbt = { 0 }; + char *ebuf = NULL; + char *uuid = NULL; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[1]) + profile_name = argv[1]; + if (argv[2]) + domain = argv[2]; + if (argv[3]) + id = argv[3]; + if (argv[4]) + uuid = argv[4]; + + if (!profile_name || !domain || !id || !uuid) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + sql = switch_mprintf("SELECT * FROM voicemail_msgs WHERE username = '%q' AND domain = '%q' AND uuid = '%q' ORDER BY read_flags, created_epoch", id, domain, uuid); + + + memset(&cbt, 0, sizeof(cbt)); + + switch_event_create(&cbt.my_params, SWITCH_EVENT_REQUEST_PARAMS); + + vm_execute_sql_callback(profile, profile->mutex, sql, message_get_callback, &cbt); + + profile_rwunlock(profile); + + switch_event_serialize_json(cbt.my_params, &ebuf); + switch_event_destroy(&cbt.my_params); + + switch_safe_free(sql); + stream->write_function(stream, "%s", ebuf); + switch_safe_free(ebuf); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + +#define VM_FSDB_MSG_COUNT_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_msg_count_function) +{ + char *sql; + msg_cnt_callback_t cbt = { 0 }; + switch_event_t *my_params = NULL; + char *ebuf = NULL; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[1]) + profile_name = argv[1]; + if (argv[2]) + domain = argv[2]; + if (argv[3]) + id = argv[3]; + + if (!profile_name || !domain || !id) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + sql = switch_mprintf( + "SELECT 1, read_flags, count(read_epoch) FROM voicemail_msgs WHERE username = '%q' AND domain = '%q' AND in_folder = '%q' AND read_epoch = 0 GROUP BY read_flags " + "UNION " + "SELECT 0, read_flags, count(read_epoch) FROM voicemail_msgs WHERE username = '%q' AND domain = '%q' AND in_folder = '%q' AND read_epoch <> 0 GROUP BY read_flags;", + id, domain, "inbox", + id, domain, "inbox"); + + + vm_execute_sql_callback(profile, profile->mutex, sql, message_count_callback, &cbt); + + profile_rwunlock(profile); + + switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); + switch_event_add_header(my_params, SWITCH_STACK_BOTTOM, "VM-Total-New-Messages", "%d", cbt.total_new_messages + cbt.total_new_urgent_messages); + switch_event_add_header(my_params, SWITCH_STACK_BOTTOM, "VM-Total-New-Urgent-Messages", "%d", cbt.total_new_urgent_messages); + switch_event_add_header(my_params, SWITCH_STACK_BOTTOM, "VM-Total-Saved-Messages", "%d", cbt.total_saved_messages + cbt.total_saved_urgent_messages); + switch_event_add_header(my_params, SWITCH_STACK_BOTTOM, "VM-Total-Saved-Urgent-Messages", "%d", cbt.total_saved_urgent_messages); + switch_event_serialize_json(my_params, &ebuf); + switch_event_destroy(&my_params); + + switch_safe_free(sql); + stream->write_function(stream, "%s", ebuf); + switch_safe_free(ebuf); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_load) { switch_application_interface_t *app_interface; @@ -4521,6 +5249,20 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_load) SWITCH_ADD_API(commands_api_interface, "vm_read", "vm_read", voicemail_read_api_function, VM_READ_USAGE); SWITCH_ADD_API(commands_api_interface, "vm_list", "vm_list", voicemail_list_api_function, VM_LIST_USAGE); + /* Message Targeted API */ + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_count", "vm_fsdb_msg_count", vm_fsdb_msg_count_function, VM_FSDB_MSG_COUNT_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_list", "vm_fsdb_msg_list", vm_fsdb_msg_list_function, VM_FSDB_MSG_LIST_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_get", "vm_fsdb_msg_get", vm_fsdb_msg_get_function, VM_FSDB_MSG_GET_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_delete", "vm_fsdb_msg_delete", vm_fsdb_msg_delete_function, VM_FSDB_MSG_DELETE_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_undelete", "vm_fsdb_msg_undelete", vm_fsdb_msg_undelete_function, VM_FSDB_MSG_UNDELETE_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_purge", "vm_fsdb_msg_purge", vm_fsdb_msg_purge_function, VM_FSDB_MSG_PURGE_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_save", "vm_fsdb_msg_save", vm_fsdb_msg_save_function, VM_FSDB_MSG_SAVE_USAGE); + + /* Preferences */ + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_pref_greeting_set", "vm_fsdb_pref_greeting_set", vm_fsdb_pref_greeting_set_function, VM_FSDB_PREF_GREETING_SET_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_pref_recname_set", "vm_fsdb_pref_recname_set", vm_fsdb_pref_recname_set_function, VM_FSDB_PREF_RECNAME_SET_USAGE); + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_pref_password_set", "vm_fsdb_pref_password_set", vm_fsdb_pref_password_set_function, VM_FSDB_PREF_PASSWORD_SET_USAGE); + return SWITCH_STATUS_SUCCESS; } From 244048f8f57d190c129e18ae782d8a238628bf13 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 14 Apr 2011 17:51:45 -0400 Subject: [PATCH 305/558] add switch_clean_name_string to strip out caller id name chars that can cause issues --- src/include/switch_utils.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index b08c204889..4135ade091 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -500,6 +500,23 @@ static inline char *switch_clean_string(char *s) } +static inline char *switch_clean_name_string(char *s) +{ + char *p; + for (p = s; p && *p; p++) { + uint8_t x = (uint8_t) * p; + if ((x < 32) || x == '\'' || x == '"' || x == '<' || x == '>' || x == '\\' || x == ':' || x == '@' || x == '/') { + *p = ' '; + } + if ( (p == s) && (*p == ' ') ) { + s++; + } + } + + return s; +} + + /*! \brief Free a pointer and set it to NULL unless it already is NULL From ceed7658e2f00c4bc7ec49889d16ee761ce696a6 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 14 Apr 2011 19:09:11 -0400 Subject: [PATCH 306/558] check_decode the caller id name in this case too --- src/mod/endpoints/mod_sofia/sofia_glue.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 66bf8ea644..2601a087e2 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2110,8 +2110,9 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!from_display && !strcasecmp(tech_pvt->caller_profile->caller_id_name, "_undef_")) { from_str = switch_core_session_sprintf(session, "<%s>", use_from_str); } else { - from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", from_display ? from_display : - tech_pvt->caller_profile->caller_id_name, use_from_str); + char *name = switch_core_session_strdup(session, from_display ? from_display : tech_pvt->caller_profile->caller_id_name); + check_decode(name, session); + from_str = switch_core_session_sprintf(session, "\"%s\" <%s>", name, use_from_str); } if (!(call_id = switch_channel_get_variable(channel, "sip_invite_call_id"))) { From aaef33cccfecfcd3b2cf3a5782db6611d108ae4a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Apr 2011 17:44:18 -0500 Subject: [PATCH 307/558] clear pointer on release --- src/switch_core_sqldb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 7f2c9c712f..940b1c4698 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -289,6 +289,8 @@ SWITCH_DECLARE(void) switch_cache_db_release_db_handle(switch_cache_db_handle_t switch_mutex_lock(sql_manager.dbh_mutex); (*dbh)->last_used = switch_epoch_time_now(NULL); + (*dbh)->io_mutex = NULL; + if ((*dbh)->use_count) { if (--(*dbh)->use_count == 0) { (*dbh)->thread_hash = 1; From 4c4bf59e45f8102815b654a9f73f56eb26e95bfb Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Apr 2011 17:44:22 -0500 Subject: [PATCH 308/558] FS-3246 --resolve all [] {} and <> can be stacked and override the delim per set <><^^:>{}{^^:}{^^;}[][^^:] --- src/include/switch_event.h | 2 +- src/mod/applications/mod_fifo/mod_fifo.c | 4 +- src/switch_event.c | 38 +- src/switch_ivr_originate.c | 427 +++++++---------------- 4 files changed, 149 insertions(+), 322 deletions(-) diff --git a/src/include/switch_event.h b/src/include/switch_event.h index 56acbd3a4b..9046bc711a 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -285,7 +285,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_free_subclass_detailed(const char * SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, char **str, switch_bool_t encode); SWITCH_DECLARE(switch_status_t) switch_event_serialize_json(switch_event_t *event, char **str); SWITCH_DECLARE(switch_status_t) switch_event_create_json(switch_event_t **event, const char *json); -SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data); +SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup); #ifndef SWIG /*! diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 2e074138ba..dd945b9bc7 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1238,7 +1238,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void struct call_helper *h = cbh->rows[i]; char *parsed = NULL; - switch_event_create_brackets(h->originate_string, '{', '}', ',', &ovars, &parsed); + switch_event_create_brackets(h->originate_string, '{', '}', ',', &ovars, &parsed, SWITCH_TRUE); switch_event_del_header(ovars, "fifo_outbound_uuid"); if (!h->timeout) h->timeout = node->ring_timeout; @@ -3870,7 +3870,7 @@ static void extract_fifo_outbound_uuid(char *string, char *uuid, switch_size_t l switch_event_create(&ovars, SWITCH_EVENT_REQUEST_PARAMS); - switch_event_create_brackets(string, '{', '}', ',', &ovars, &parsed); + switch_event_create_brackets(string, '{', '}', ',', &ovars, &parsed, SWITCH_TRUE); if ((fifo_outbound_uuid = switch_event_get_header(ovars, "fifo_outbound_uuid"))) { switch_snprintf(uuid, len, "%s", fifo_outbound_uuid); diff --git a/src/switch_event.c b/src/switch_event.c index e290987248..86bf0c245c 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1075,17 +1075,21 @@ SWITCH_DECLARE(switch_status_t) switch_event_serialize(switch_event_t *event, ch } -SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data) +SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, char b, char c, switch_event_t **event, char **new_data, switch_bool_t dup) { - char *vdata, *vdatap; + char *vdata, *vdatap = NULL; char *end, *check_a, *check_b; switch_event_t *e = *event; char *var_array[1024] = { 0 }; int var_count = 0; char *next; - - vdatap = strdup(data); - vdata = vdatap; + + if (dup) { + vdatap = strdup(data); + vdata = vdatap; + } else { + vdata = data; + } end = switch_find_end_paren(vdata, a, b); @@ -1103,7 +1107,9 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, vdata++; *end++ = '\0'; } else { - free(vdatap); + if (dup) { + free(vdatap); + } return SWITCH_STATUS_FALSE; } @@ -1121,7 +1127,15 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, next = pnext + 1; } } - + + + if (vdata) { + if (*vdata == '^' && *(vdata + 1) == '^') { + vdata += 2; + c = *vdata++; + } + } + if ((var_count = switch_separate_string(vdata, c, var_array, (sizeof(var_array) / sizeof(var_array[0]))))) { int x = 0; for (x = 0; x < var_count; x++) { @@ -1130,6 +1144,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, if ((inner_var_count = switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parsing variable [%s]=[%s]\n", inner_var_array[0], inner_var_array[1]); switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]); } } @@ -1144,9 +1159,14 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, } *event = e; - *new_data = strdup(end); - free(vdatap); + if (dup) { + *new_data = strdup(end); + free(vdatap); + } else { + *new_data = end; + } + return SWITCH_STATUS_SUCCESS; } diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 0c4c336e51..b0a159eea9 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -1346,9 +1346,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess switch_event_header_t *hi = NULL; struct ent_originate_ringback rb_data = { 0 }; const char *ringback_data = NULL; - char *vars = NULL; - int var_block_count = 0; - char *e = NULL; switch_event_t *var_event = NULL; switch_core_new_memory_pool(&pool); @@ -1360,53 +1357,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess data = switch_core_strdup(pool, bridgeto); - /* strip leading spaces */ - while (data && *data && *data == ' ') { - data++; - } - - /* extract channel variables, allowing multiple sets of braces */ - while (*data == '<') { - if (!var_block_count) { - e = switch_find_end_paren(data, '<', '>'); - if (!e || !*e) { - goto var_extract_error; - } - vars = data + 1; - *e = '\0'; - data = e + 1; - } else { - int j = 0, k = 0; - if (e) { - *e = ','; - } - e = switch_find_end_paren(data, '<', '>'); - if (!e || !*e) { - goto var_extract_error; - } - /* swallow the opening bracket */ - while ((data + k) && *(data + k)) { - j = k; - k++; - /* note that this affects vars[] */ - data[j] = data[k]; - } - *(--e) = '\0'; - data = e + 1; - } - var_block_count++; - continue; - - var_extract_error: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n"); - switch_goto_status(SWITCH_STATUS_GENERR, done); - } - - /* strip leading spaces (again) */ - while (data && *data && *data == ' ') { - data++; - } - if (session) { switch_caller_profile_t *cpp = NULL; channel = switch_core_session_get_channel(session); @@ -1430,23 +1380,28 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess if (channel) { switch_channel_process_export(channel, NULL, var_event, SWITCH_EXPORT_VARS_VARIABLE); } - - if (vars) { /* Parse parameters specified from the dialstring */ - char *var_array[1024] = { 0 }; - int var_count = 0; - if ((var_count = switch_separate_string(vars, ',', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) { - int x = 0; - for (x = 0; x < var_count; x++) { - char *inner_var_array[2] = { 0 }; - int inner_var_count; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "variable string %d = [%s]\n", x, var_array[x]); - if ((inner_var_count = - switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { - switch_event_del_header(var_event, inner_var_array[0]); - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]); - } - } + + /* strip leading spaces */ + while (data && *data && *data == ' ') { + data++; + } + + /* extract channel variables, allowing multiple sets of braces */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parsing ultra-global variables\n"); + while (*data == '<') { + char *parsed = NULL; + + if (switch_event_create_brackets(data, '<', '>', ',', &var_event, &parsed, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS || !parsed) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n"); + switch_goto_status(SWITCH_STATUS_GENERR, done); } + + data = parsed; + } + + /* strip leading spaces (again) */ + while (data && *data && *data == ' ') { + data++; } if (ovars && ovars != var_event) { @@ -1751,9 +1706,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_call_cause_t reason = SWITCH_CAUSE_NONE; switch_call_cause_t force_reason = SWITCH_CAUSE_NONE; uint8_t to = 0; - char *var_val, *vars = NULL; - int var_block_count = 0; - char *e = NULL; + char *var_val; const char *ringback_data = NULL; switch_event_t *var_event = NULL; int8_t fail_on_single_reject = 0; @@ -1870,59 +1823,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess data = odata; - /* strip leading spaces */ - while (data && *data && *data == ' ') { - data++; - } - - /* extract channel variables, allowing multiple sets of braces */ - while (*data == '{') { - if (!var_block_count) { - e = switch_find_end_paren(data, '{', '}'); - if (!e || !*e) { - goto var_extract_error; - } - vars = data + 1; - *e = '\0'; - data = e + 1; - } else { - int j = 0, k = 0; - if (e) { - *e = ','; - } - e = switch_find_end_paren(data, '{', '}'); - if (!e || !*e) { - goto var_extract_error; - } - /* swallow the opening bracket */ - while ((data + k) && *(data + k)) { - j = k; - k++; - /* note that this affects vars[] */ - data[j] = data[k]; - } - *(--e) = '\0'; - data = e + 1; - } - var_block_count++; - continue; - - var_extract_error: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n"); - status = SWITCH_STATUS_GENERR; - goto done; - } - - /* strip leading spaces (again) */ - while (data && *data && *data == ' ') { - data++; - } - - if (zstr(data)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No origination URL specified!\n"); - status = SWITCH_STATUS_GENERR; - goto done; - } /* Some channel are created from an originating channel and some aren't so not all outgoing calls have a way to get params so we will normalize dialstring params and channel variables (when there is an originator) into an event that we @@ -1962,24 +1862,39 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_channel_process_export(caller_channel, NULL, var_event, SWITCH_EXPORT_VARS_VARIABLE); } - if (vars) { /* Parse parameters specified from the dialstring */ - char *var_array[1024] = { 0 }; - int var_count = 0; - if ((var_count = switch_separate_string(vars, ',', var_array, (sizeof(var_array) / sizeof(var_array[0]))))) { - int x = 0; - for (x = 0; x < var_count; x++) { - char *inner_var_array[2] = { 0 }; - int inner_var_count; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "variable string %d = [%s]\n", x, var_array[x]); - if ((inner_var_count = - switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { - switch_event_del_header(var_event, inner_var_array[0]); - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]); - } - } - } + + + /* strip leading spaces */ + while (data && *data && *data == ' ') { + data++; } + /* extract channel variables, allowing multiple sets of braces */ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parsing global variables\n"); + while (*data == '{') { + char *parsed = NULL; + + if (switch_event_create_brackets(data, '{', '}', ',', &var_event, &parsed, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS || !parsed) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n"); + switch_goto_status(SWITCH_STATUS_GENERR, done); + } + + data = parsed; + } + + + /* strip leading spaces (again) */ + while (data && *data && *data == ' ') { + data++; + } + + if (zstr(data)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "No origination URL specified!\n"); + status = SWITCH_STATUS_GENERR; + goto done; + } + + if (oglobals.session) { switch_event_header_t *hi; const char *cdr_total_var; @@ -2271,8 +2186,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess for (r = 0; r < or_argc; r++) { char *p, *end = NULL; - const char *var_begin, *var_end; - int q = 0; + int q = 0, alt = 0; + check_reject = 1; oglobals.hups = 0; @@ -2309,19 +2224,27 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess switch_yield(sleep_ms * 1000); } } - + p = pipe_names[r]; + while (p && *p) { if (*p == '[') { end = switch_find_end_paren(p, '[', ']'); + if (*(p+1) == '^' && *(p + 2) == '^') { + alt = 1; + } else { + alt = 0; + } + q = 0; } - + if (*p == '\'') { q = !q; } if (end && p < end && *p == ',') { - if (q) { + + if (q || alt) { *p = QUOTED_ESC_COMMA; } else { *p = UNQUOTED_ESC_COMMA; @@ -2343,41 +2266,55 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } for (i = 0; i < and_argc; i++) { - char *vdata; const char *current_variable; - char variable_buffer[512] = ""; switch_event_t *local_var_event = NULL, *originate_var_event = NULL, *event = NULL; - char *check_a = NULL, *check_b = NULL; end = NULL; chan_type = peer_names[i]; + + /* strip leading spaces */ + while (chan_type && *chan_type && *chan_type == ' ') { + chan_type++; + } + + /* extract channel variables, allowing multiple sets of braces */ + + if (*chan_type == '[') { + switch_event_create_plain(&local_var_event, SWITCH_EVENT_CHANNEL_DATA); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parsing session specific variables\n"); + } + + while (*chan_type == '[') { + char *parsed = NULL; + + for (p = chan_type; p && *p && *p != ']'; p++) { + if (*p == QUOTED_ESC_COMMA) { + *p = ','; + } + } + + if (switch_event_create_brackets(chan_type, '[', ']', UNQUOTED_ESC_COMMA, + &local_var_event, &parsed, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS || !parsed) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Parse Error!\n"); + switch_goto_status(SWITCH_STATUS_GENERR, done); + } + + chan_type = parsed; + } + + + /* strip leading spaces (again) */ + while (chan_type && *chan_type && *chan_type == ' ') { + chan_type++; + } + while (chan_type && *chan_type && *chan_type == ' ') { chan_type++; } - vdata = chan_type; - end = switch_find_end_paren(vdata, '[', ']'); - - check_a = end; - - while (check_a && (check_b = strchr(check_a, '['))) { - if ((check_b = switch_find_end_paren(check_b, '[', ']'))) { - check_a = check_b; - } - } - - if (check_a) end = check_a; - - if (end) { - vdata++; - *end++ = '\0'; - chan_type = end; - } else { - vdata = NULL; - } - + if ((chan_data = strchr(chan_type, '/')) != 0) { *chan_data = '\0'; chan_data++; @@ -2440,7 +2377,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess if (and_argc > 1 || or_argc > 1) { myflags |= SOF_FORKED_DIAL; } - + if (var_event) { const char *vvar; if ((vvar = switch_event_get_header(var_event, "forked_dial")) && switch_true(vvar)) { @@ -2451,80 +2388,30 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } - /* only valid in [] since it's unique to each channel leg */ + + /* Valid in both {} and [] with [] taking precedence */ - if (vdata && (var_begin = switch_stristr("origination_uuid=", vdata))) { - char tmp[512] = ""; - var_begin += strlen("origination_uuid="); - var_end = strchr(var_begin, UNQUOTED_ESC_COMMA); + /* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel + so if something like the user channel does another originate our options will be passed down properly + */ + + switch_event_dup(&originate_var_event, var_event); - if (var_end) { - strncpy(tmp, var_begin, var_end - var_begin); - } else { - strncpy(tmp, var_begin, strlen(var_begin)); - } - - switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "origination_uuid", tmp); + if (local_var_event) { + switch_event_merge(originate_var_event, local_var_event); } - /* The rest are valid in both {} and [] with [] taking precedence */ - - current_variable = NULL; - - if (vdata && (var_begin = switch_stristr("origination_caller_id_number=", vdata))) { - var_begin += strlen("origination_caller_id_number="); - var_end = strchr(var_begin, UNQUOTED_ESC_COMMA); - - if (var_end) { - strncpy(variable_buffer, var_begin, var_end - var_begin); - } else { - strncpy(variable_buffer, var_begin, strlen(var_begin)); - } - - current_variable = variable_buffer; - } - - if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_caller_id_number"))) { + if ((current_variable = switch_event_get_header(originate_var_event, "origination_caller_id_number"))) { new_profile->caller_id_number = switch_core_strdup(new_profile->pool, current_variable); myflags |= SOF_NO_EFFECTIVE_CID_NUM; } - current_variable = NULL; - - if (vdata && (var_begin = switch_stristr("origination_caller_id_name=", vdata))) { - var_begin += strlen("origination_caller_id_name="); - var_end = strchr(var_begin, UNQUOTED_ESC_COMMA); - - if (var_end) { - strncpy(variable_buffer, var_begin, var_end - var_begin); - } else { - strncpy(variable_buffer, var_begin, strlen(var_begin)); - } - - current_variable = variable_buffer; - } - - if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_caller_id_name"))) { + if ((current_variable = switch_event_get_header(originate_var_event, "origination_caller_id_name"))) { new_profile->caller_id_name = switch_core_strdup(new_profile->pool, current_variable); myflags |= SOF_NO_EFFECTIVE_CID_NAME; } - current_variable = NULL; - - if (vdata && (var_begin = switch_stristr("origination_privacy=", vdata))) { - var_begin += strlen("origination_privacy="); - var_end = strchr(var_begin, UNQUOTED_ESC_COMMA); - - if (var_end) { - strncpy(variable_buffer, var_begin, var_end - var_begin); - } else { - strncpy(variable_buffer, var_begin, strlen(var_begin)); - } - - current_variable = variable_buffer; - } - - if (current_variable || (current_variable = switch_event_get_header(var_event, "origination_privacy"))) { + if ((current_variable = switch_event_get_header(originate_var_event, "origination_privacy"))) { new_profile->flags = SWITCH_CPF_NONE; if (switch_stristr("screen", current_variable)) { @@ -2540,79 +2427,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess } } - current_variable = NULL; switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "originate_early_media", oglobals.early_ok ? "true" : "false"); - if (vdata) { - char *var_array[1024] = { 0 }; - int var_count = 0; - char *next; - - - switch_event_create_plain(&local_var_event, SWITCH_EVENT_CHANNEL_DATA); - - - for (;;) { - if ((next = strchr(vdata, ']'))) { - char *pnext; - *next++ = '\0'; - - if ((pnext = switch_strchr_strict(next, '[', " "))) { - next = pnext + 1; - } - } - - if ((var_count = switch_separate_string(vdata, UNQUOTED_ESC_COMMA, var_array, (sizeof(var_array) / sizeof(var_array[0]))))) { - int x = 0; - for (x = 0; x < var_count; x++) { - char *inner_var_array[2] = { 0 }; - int inner_var_count; - char *p; - - for (p = var_array[x]; p && *p; p++) { - if (*p == QUOTED_ESC_COMMA) { - *p = ','; - } - } - - - - if ((inner_var_count = - switch_separate_string(var_array[x], '=', - inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { - - /* this is stupid but necessary: if the value begins with ^^ take the very next char as a delim, - increment the string to start the next char after that and replace every instance of the delim with a , */ - - if (*inner_var_array[1] == '^' && *(inner_var_array[1] + 1) == '^') { - char *iv; - char d = 0; - inner_var_array[1] += 2; - d = *inner_var_array[1]++; - - if (d) { - for(iv = inner_var_array[1]; iv && *iv; iv++) { - if (*iv == d) *iv = ','; - } - } - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "local variable string %d = [%s=%s]\n", - x, inner_var_array[0], inner_var_array[1]); - switch_event_add_header_string(local_var_event, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]); - - } - } - } - - if (next) { - vdata = next; - } else { - break; - } - - } - } if (caller_channel && switch_true(switch_channel_get_variable(caller_channel, "push_channel_name"))) { char *new_name = switch_core_session_sprintf(session, "%s__B", switch_channel_get_name(caller_channel)); @@ -2620,16 +2436,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess new_name = switch_core_session_sprintf(session, "_%s", switch_channel_get_name(caller_channel)); switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, "sip_h_X-FS-Channel-Name", new_name); } - - /* make a special var event with mixture of the {} and the [] vars to pass down as global vars to the outgoing channel - so if something like the user channel does another originate our options will be passed down properly - */ - switch_event_dup(&originate_var_event, var_event); - - if (local_var_event) { - switch_event_merge(originate_var_event, local_var_event); - } reason = switch_core_session_outgoing_channel(oglobals.session, originate_var_event, chan_type, new_profile, &new_session, NULL, myflags, cancel_cause); From 9c7d50b4e89a9f487bbff0be1652c2fc1ca7fea6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 14 Apr 2011 17:50:43 -0500 Subject: [PATCH 309/558] fix 32/64 format --- src/mod/applications/mod_voicemail/mod_voicemail.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 16584e97d2..877e3e8601 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -4860,7 +4860,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_list_function) profile_rwunlock(profile); - switch_event_add_header(cbt.my_params, SWITCH_STACK_BOTTOM, "VM-List-Count", "%ld", cbt.len); + switch_event_add_header(cbt.my_params, SWITCH_STACK_BOTTOM, "VM-List-Count", "%"SWITCH_SIZE_T_FMT, cbt.len); switch_event_serialize_json(cbt.my_params, &ebuf); switch_event_destroy(&cbt.my_params); From 4e3f1b1e8e623b116cecf9ac5fccd7c9f6306aec Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Thu, 14 Apr 2011 20:23:12 -0400 Subject: [PATCH 310/558] mod_callcenter: Fix an issues recently introduice that a max_wait time reach didn't continue the dialplan --- src/mod/applications/mod_callcenter/mod_callcenter.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index f8beb7c0f7..ff1c71ec11 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -943,7 +943,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); if (!switch_strlen_zero(res)) { - switch_core_session_hupall_matching_var("cc_member_uuid", res, SWITCH_CAUSE_ORIGINATOR_CANCEL); + switch_core_session_hupall_matching_var("cc_member_pre_answer_uuid", res, SWITCH_CAUSE_ORIGINATOR_CANCEL); } } @@ -2113,6 +2113,8 @@ struct member_thread_helper { const char *queue_name; const char *member_uuid; const char *member_session_uuid; + const char *member_cid_name; + const char *member_cid_number; switch_time_t t_member_called; cc_member_cancel_reason_t member_cancel_reason; @@ -2146,6 +2148,7 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj } /* Make the Caller Leave if he went over his max wait time */ if (queue->max_wait_time > 0 && queue->max_wait_time <= switch_epoch_time_now(NULL) - m->t_member_called) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait time\n", m->member_cid_name, m->member_cid_number, m->queue_name); m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_TIMEOUT; switch_channel_set_flag_value(member_channel, CF_BREAK, 2); } @@ -2153,6 +2156,7 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj /* Will drop the caller if no agent was found for more than X seconds */ if (queue->max_wait_time_with_no_agent > 0 && m->t_member_called < queue->last_agent_exist_check - queue->max_wait_time_with_no_agent_time_reached && queue->last_agent_exist_check - queue->last_agent_exist >= queue->max_wait_time_with_no_agent) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait with no agent time\n", m->member_cid_name, m->member_cid_number, m->queue_name); m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT; switch_channel_set_flag_value(member_channel, CF_BREAK, 2); } @@ -2371,6 +2375,8 @@ SWITCH_STANDARD_APP(callcenter_function) h->pool = pool; h->member_uuid = switch_core_strdup(h->pool, member_uuid); h->member_session_uuid = switch_core_strdup(h->pool, member_session_uuid); + h->member_cid_name = switch_core_strdup(h->pool, switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name"))); + h->member_cid_number = switch_core_strdup(h->pool, switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number"))); h->queue_name = switch_core_strdup(h->pool, queue_name); h->t_member_called = t_member_called; h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NONE; @@ -2443,7 +2449,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_safe_free(sql); /* Hangup any callback agents */ - switch_core_session_hupall_matching_var("cc_member_uuid", member_uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); + switch_core_session_hupall_matching_var("cc_member_pre_answer_uuid", member_uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); /* Generate an event */ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { From 413d590fb650829b8e85ce7b6ae911bf5128adeb Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 14 Apr 2011 19:56:45 -0500 Subject: [PATCH 311/558] vs2010 reswig --- .../mod_managed/freeswitch_wrap.2010.cxx | 221 ++++++++++++++++- .../mod_managed/managed/swig.2010.cs | 234 +++++++++++++++++- 2 files changed, 446 insertions(+), 9 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index e08ed5c253..7165efc483 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -1121,6 +1121,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get } +SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get() { + char * jresult ; + char *result = 0 ; + + result = (char *)("execute_on_tone_detect"); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get() { char * jresult ; char *result = 0 ; @@ -4263,6 +4273,35 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_say_args_t_gender_get(void * jarg1) { } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_args_t_ext_set(void * jarg1, char * jarg2) { + switch_say_args_t *arg1 = (switch_say_args_t *) 0 ; + char *arg2 = (char *) 0 ; + + arg1 = (switch_say_args_t *)jarg1; + arg2 = (char *)jarg2; + { + if (arg2) { + arg1->ext = (char const *) (new char[strlen((const char *)arg2)+1]); + strcpy((char *)arg1->ext, (const char *)arg2); + } else { + arg1->ext = 0; + } + } +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_args_t_ext_get(void * jarg1) { + char * jresult ; + switch_say_args_t *arg1 = (switch_say_args_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_args_t *)jarg1; + result = (char *) ((arg1)->ext); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_say_args_t() { void * jresult ; switch_say_args_t *result = 0 ; @@ -10331,6 +10370,11 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_cache_db_persistant_execute_trans(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_signal_handlers() { + switch_core_set_signal_handlers(); +} + + SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_core_debug_level() { unsigned long jresult ; uint32_t result; @@ -10436,6 +10480,79 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_core_expire_registration(int jarg1) { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_file_handle_get_variable(void * jarg1, char * jarg2) { + char * jresult ; + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *arg2 = (char *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + arg2 = (char *)jarg2; + result = (char *)switch_say_file_handle_get_variable(arg1,(char const *)arg2); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_file_handle_get_path(void * jarg1) { + char * jresult ; + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + result = (char *)switch_say_file_handle_get_path(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_say_file_handle_detach_path(void * jarg1) { + char * jresult ; + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *result = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + result = (char *)switch_say_file_handle_detach_path(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_file_handle_destroy(void * jarg1) { + switch_say_file_handle_t **arg1 = (switch_say_file_handle_t **) 0 ; + + arg1 = (switch_say_file_handle_t **)jarg1; + switch_say_file_handle_destroy(arg1); +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_say_file_handle_create(void * jarg1, char * jarg2, void * jarg3) { + int jresult ; + switch_say_file_handle_t **arg1 = (switch_say_file_handle_t **) 0 ; + char *arg2 = (char *) 0 ; + switch_event_t **arg3 = (switch_event_t **) 0 ; + switch_status_t result; + + arg1 = (switch_say_file_handle_t **)jarg1; + arg2 = (char *)jarg2; + arg3 = (switch_event_t **)jarg3; + result = (switch_status_t)switch_say_file_handle_create(arg1,(char const *)arg2,arg3); + jresult = result; + return jresult; +} + + +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_file(void * jarg1, char * jarg2) { + switch_say_file_handle_t *arg1 = (switch_say_file_handle_t *) 0 ; + char *arg2 = (char *) 0 ; + void *arg3 = 0 ; + + arg1 = (switch_say_file_handle_t *)jarg1; + arg2 = (char *)jarg2; + switch_say_file(arg1,(char const *)arg2,arg3); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_loadable_module_interface_module_name_set(void * jarg1, char * jarg2) { switch_loadable_module_interface *arg1 = (switch_loadable_module_interface *) 0 ; char *arg2 = (char *) 0 ; @@ -12246,6 +12363,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_string(char * jarg1) { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_name_string(char * jarg1) { + char * jresult ; + char *arg1 = (char *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + result = (char *)switch_clean_name_string(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_safe_strdup(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -19356,6 +19485,28 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_say_function_get(void } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_say_string_function_set(void * jarg1, void * jarg2) { + switch_say_interface *arg1 = (switch_say_interface *) 0 ; + switch_say_string_callback_t arg2 = (switch_say_string_callback_t) 0 ; + + arg1 = (switch_say_interface *)jarg1; + arg2 = (switch_say_string_callback_t)jarg2; + if (arg1) (arg1)->say_string_function = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_say_interface_say_string_function_get(void * jarg1) { + void * jresult ; + switch_say_interface *arg1 = (switch_say_interface *) 0 ; + switch_say_string_callback_t result; + + arg1 = (switch_say_interface *)jarg1; + result = (switch_say_string_callback_t) ((arg1)->say_string_function); + jresult = (void *)result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_say_interface_rwlock_set(void * jarg1, void * jarg2) { switch_say_interface *arg1 = (switch_say_interface *) 0 ; switch_thread_rwlock_t *arg2 = (switch_thread_rwlock_t *) 0 ; @@ -23972,6 +24123,20 @@ SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_mark_hold(void * jarg1, int ja } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_execute_on(void * jarg1, char * jarg2) { + int jresult ; + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + char *arg2 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_channel_t *)jarg1; + arg2 = (char *)jarg2; + result = (switch_status_t)switch_channel_execute_on(arg1,(char const *)arg2); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_buffer_create(void * jarg1, void * jarg2, void * jarg3) { int jresult ; switch_memory_pool_t *arg1 = (switch_memory_pool_t *) 0 ; @@ -25072,7 +25237,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_json(void * jarg1, char * } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, char jarg2, char jarg3, char jarg4, void * jarg5, void * jarg6) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, char jarg2, char jarg3, char jarg4, void * jarg5, void * jarg6, int jarg7) { int jresult ; char *arg1 = (char *) 0 ; char arg2 ; @@ -25080,6 +25245,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, cha char arg4 ; switch_event_t **arg5 = (switch_event_t **) 0 ; char **arg6 = (char **) 0 ; + switch_bool_t arg7 ; switch_status_t result; arg1 = (char *)jarg1; @@ -25088,7 +25254,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, cha arg4 = (char)jarg4; arg5 = (switch_event_t **)jarg5; arg6 = (char **)jarg6; - result = (switch_status_t)switch_event_create_brackets(arg1,arg2,arg3,arg4,arg5,arg6); + arg7 = (switch_bool_t)jarg7; + result = (switch_status_t)switch_event_create_brackets(arg1,arg2,arg3,arg4,arg5,arg6,arg7); jresult = result; return jresult; } @@ -27618,6 +27785,34 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_say(void * jarg1, char * jarg2, cha } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_say_string(void * jarg1, char * jarg2, char * jarg3, char * jarg4, char * jarg5, char * jarg6, char * jarg7, char * jarg8, void * jarg9) { + int jresult ; + switch_core_session_t *arg1 = (switch_core_session_t *) 0 ; + char *arg2 = (char *) 0 ; + char *arg3 = (char *) 0 ; + char *arg4 = (char *) 0 ; + char *arg5 = (char *) 0 ; + char *arg6 = (char *) 0 ; + char *arg7 = (char *) 0 ; + char *arg8 = (char *) 0 ; + char **arg9 = (char **) 0 ; + switch_status_t result; + + arg1 = (switch_core_session_t *)jarg1; + arg2 = (char *)jarg2; + arg3 = (char *)jarg3; + arg4 = (char *)jarg4; + arg5 = (char *)jarg5; + arg6 = (char *)jarg6; + arg7 = (char *)jarg7; + arg8 = (char *)jarg8; + arg9 = (char **)jarg9; + result = (switch_status_t)switch_ivr_say_string(arg1,(char const *)arg2,(char const *)arg3,(char const *)arg4,(char const *)arg5,(char const *)arg6,(char const *)arg7,(char const *)arg8,arg9); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_ivr_get_say_method_by_name(char * jarg1) { int jresult ; char *arg1 = (char *) 0 ; @@ -29723,6 +29918,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_is_switch_xml_root_t_get(void * jar } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_xml_refs_set(void * jarg1, unsigned long jarg2) { + switch_xml *arg1 = (switch_xml *) 0 ; + uint32_t arg2 ; + + arg1 = (switch_xml *)jarg1; + arg2 = (uint32_t)jarg2; + if (arg1) (arg1)->refs = arg2; +} + + +SWIGEXPORT unsigned long SWIGSTDCALL CSharp_switch_xml_refs_get(void * jarg1) { + unsigned long jresult ; + switch_xml *arg1 = (switch_xml *) 0 ; + uint32_t result; + + arg1 = (switch_xml *)jarg1; + result = (uint32_t) ((arg1)->refs); + jresult = (unsigned long)result; + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_xml() { void * jresult ; switch_xml *result = 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 42ae909ebf..6d8c374d44 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -2422,6 +2422,10 @@ public class freeswitch { return ret; } + public static void switch_core_set_signal_handlers() { + freeswitchPINVOKE.switch_core_set_signal_handlers(); + } + public static uint switch_core_debug_level() { uint ret = freeswitchPINVOKE.switch_core_debug_level(); return ret; @@ -2461,6 +2465,34 @@ public class freeswitch { return ret; } + public static string switch_say_file_handle_get_variable(SWIGTYPE_p_switch_say_file_handle sh, string var) { + string ret = freeswitchPINVOKE.switch_say_file_handle_get_variable(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh), var); + return ret; + } + + public static string switch_say_file_handle_get_path(SWIGTYPE_p_switch_say_file_handle sh) { + string ret = freeswitchPINVOKE.switch_say_file_handle_get_path(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh)); + return ret; + } + + public static string switch_say_file_handle_detach_path(SWIGTYPE_p_switch_say_file_handle sh) { + string ret = freeswitchPINVOKE.switch_say_file_handle_detach_path(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh)); + return ret; + } + + public static void switch_say_file_handle_destroy(SWIGTYPE_p_p_switch_say_file_handle sh) { + freeswitchPINVOKE.switch_say_file_handle_destroy(SWIGTYPE_p_p_switch_say_file_handle.getCPtr(sh)); + } + + public static switch_status_t switch_say_file_handle_create(SWIGTYPE_p_p_switch_say_file_handle sh, string ext, SWIGTYPE_p_p_switch_event var_event) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_say_file_handle_create(SWIGTYPE_p_p_switch_say_file_handle.getCPtr(sh), ext, SWIGTYPE_p_p_switch_event.getCPtr(var_event)); + return ret; + } + + public static void switch_say_file(SWIGTYPE_p_switch_say_file_handle sh, string fmt) { + freeswitchPINVOKE.switch_say_file(SWIGTYPE_p_switch_say_file_handle.getCPtr(sh), fmt); + } + public static switch_status_t switch_loadable_module_init(switch_bool_t autoload) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_init((int)autoload); return ret; @@ -2923,6 +2955,11 @@ public class freeswitch { return ret; } + public static string switch_clean_name_string(string s) { + string ret = freeswitchPINVOKE.switch_clean_name_string(s); + return ret; + } + public static string switch_safe_strdup(string it) { string ret = freeswitchPINVOKE.switch_safe_strdup(it); return ret; @@ -3723,6 +3760,11 @@ public class freeswitch { freeswitchPINVOKE.switch_channel_mark_hold(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)on); } + public static switch_status_t switch_channel_execute_on(SWIGTYPE_p_switch_channel channel, string variable_prefix) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_execute_on(SWIGTYPE_p_switch_channel.getCPtr(channel), variable_prefix); + return ret; + } + public static switch_status_t switch_buffer_create(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_switch_size_t max_len) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_switch_size_t.getCPtr(max_len)); if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); @@ -3943,8 +3985,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_event_create_brackets(string data, char a, char b, char c, SWIGTYPE_p_p_switch_event arg4, ref string new_data) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_brackets(data, a, b, c, SWIGTYPE_p_p_switch_event.getCPtr(arg4), ref new_data); + public static switch_status_t switch_event_create_brackets(string data, char a, char b, char c, SWIGTYPE_p_p_switch_event arg4, ref string new_data, switch_bool_t dup) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_brackets(data, a, b, c, SWIGTYPE_p_p_switch_event.getCPtr(arg4), ref new_data, (int)dup); return ret; } @@ -4519,6 +4561,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_ivr_say_string(SWIGTYPE_p_switch_core_session session, string lang, string ext, string tosay, string module_name, string say_type, string say_method, string say_gender, ref string rstr) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_say_string(SWIGTYPE_p_switch_core_session.getCPtr(session), lang, ext, tosay, module_name, say_type, say_method, say_gender, ref rstr); + return ret; + } + public static switch_say_method_t switch_ivr_get_say_method_by_name(string name) { switch_say_method_t ret = (switch_say_method_t)freeswitchPINVOKE.switch_ivr_get_say_method_by_name(name); return ret; @@ -5535,6 +5582,7 @@ public class freeswitch { public static readonly string SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_MEDIA_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_API_ON_ANSWER_VARIABLE_get(); public static readonly string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get(); + public static readonly string SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE = freeswitchPINVOKE.SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get(); public static readonly string SWITCH_CALL_TIMEOUT_VARIABLE = freeswitchPINVOKE.SWITCH_CALL_TIMEOUT_VARIABLE_get(); public static readonly string SWITCH_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_HOLDING_UUID_VARIABLE_get(); public static readonly string SWITCH_SOFT_HOLDING_UUID_VARIABLE = freeswitchPINVOKE.SWITCH_SOFT_HOLDING_UUID_VARIABLE_get(); @@ -6086,6 +6134,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get")] public static extern string SWITCH_CHANNEL_EXECUTE_ON_RING_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get")] + public static extern string SWITCH_CHANNEL_EXECUTE_ON_TONE_DETECT_VARIABLE_get(); + [DllImport("mod_managed", EntryPoint="CSharp_SWITCH_CALL_TIMEOUT_VARIABLE_get")] public static extern string SWITCH_CALL_TIMEOUT_VARIABLE_get(); @@ -6920,6 +6971,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_say_args_t_gender_get")] public static extern int switch_say_args_t_gender_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_args_t_ext_set")] + public static extern void switch_say_args_t_ext_set(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_args_t_ext_get")] + public static extern string switch_say_args_t_ext_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_say_args_t")] public static extern IntPtr new_switch_say_args_t(); @@ -8336,6 +8393,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_cache_db_persistant_execute_trans")] public static extern int switch_cache_db_persistant_execute_trans(HandleRef jarg1, string jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_signal_handlers")] + public static extern void switch_core_set_signal_handlers(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_debug_level")] public static extern uint switch_core_debug_level(); @@ -8360,6 +8420,24 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_expire_registration")] public static extern int switch_core_expire_registration(int jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_get_variable")] + public static extern string switch_say_file_handle_get_variable(HandleRef jarg1, string jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_get_path")] + public static extern string switch_say_file_handle_get_path(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_detach_path")] + public static extern string switch_say_file_handle_detach_path(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_destroy")] + public static extern void switch_say_file_handle_destroy(HandleRef jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file_handle_create")] + public static extern int switch_say_file_handle_create(HandleRef jarg1, string jarg2, HandleRef jarg3); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_file")] + public static extern void switch_say_file(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_loadable_module_interface_module_name_set")] public static extern void switch_loadable_module_interface_module_name_set(HandleRef jarg1, string jarg2); @@ -8768,6 +8846,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_clean_string")] public static extern string switch_clean_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_clean_name_string")] + public static extern string switch_clean_name_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_safe_strdup")] public static extern string switch_safe_strdup(string jarg1); @@ -10550,6 +10631,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_function_get")] public static extern IntPtr switch_say_interface_say_function_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_string_function_set")] + public static extern void switch_say_interface_say_string_function_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_say_string_function_get")] + public static extern IntPtr switch_say_interface_say_string_function_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_say_interface_rwlock_set")] public static extern void switch_say_interface_rwlock_set(HandleRef jarg1, HandleRef jarg2); @@ -11708,6 +11795,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_mark_hold")] public static extern void switch_channel_mark_hold(HandleRef jarg1, int jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_execute_on")] + public static extern int switch_channel_execute_on(HandleRef jarg1, string jarg2); + [DllImport("mod_managed", EntryPoint="CSharp_switch_buffer_create")] public static extern int switch_buffer_create(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3); @@ -11949,7 +12039,7 @@ class freeswitchPINVOKE { public static extern int switch_event_create_json(HandleRef jarg1, string jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_brackets")] - public static extern int switch_event_create_brackets(string jarg1, char jarg2, char jarg3, char jarg4, HandleRef jarg5, ref string jarg6); + public static extern int switch_event_create_brackets(string jarg1, char jarg2, char jarg3, char jarg4, HandleRef jarg5, ref string jarg6, int jarg7); [DllImport("mod_managed", EntryPoint="CSharp_switch_event_running")] public static extern int switch_event_running(); @@ -12455,6 +12545,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_say")] public static extern int switch_ivr_say(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, HandleRef jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_say_string")] + public static extern int switch_ivr_say_string(HandleRef jarg1, string jarg2, string jarg3, string jarg4, string jarg5, string jarg6, string jarg7, string jarg8, ref string jarg9); + [DllImport("mod_managed", EntryPoint="CSharp_switch_ivr_get_say_method_by_name")] public static extern int switch_ivr_get_say_method_by_name(string jarg1); @@ -12938,6 +13031,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_is_switch_xml_root_t_get")] public static extern int switch_xml_is_switch_xml_root_t_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_refs_set")] + public static extern void switch_xml_refs_set(HandleRef jarg1, uint jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_refs_get")] + public static extern uint switch_xml_refs_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_xml")] public static extern IntPtr new_switch_xml(); @@ -15309,6 +15408,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_switch_input_args_t__switch_status_t { private HandleRef swigCPtr; @@ -17889,6 +18018,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_p_switch_say_file_handle { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_p_switch_say_file_handle(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_p_switch_say_file_handle() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_p_switch_say_file_handle obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_p_switch_xml { private HandleRef swigCPtr; @@ -18909,6 +19068,36 @@ namespace FreeSWITCH.Native { using System; using System.Runtime.InteropServices; +public class SWIGTYPE_p_switch_say_file_handle { + private HandleRef swigCPtr; + + internal SWIGTYPE_p_switch_say_file_handle(IntPtr cPtr, bool futureUse) { + swigCPtr = new HandleRef(this, cPtr); + } + + protected SWIGTYPE_p_switch_say_file_handle() { + swigCPtr = new HandleRef(null, IntPtr.Zero); + } + + internal static HandleRef getCPtr(SWIGTYPE_p_switch_say_file_handle obj) { + return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; + } +} + +} +/* ---------------------------------------------------------------------------- + * This file was automatically generated by SWIG (http://www.swig.org). + * Version 2.0.1 + * + * Do not make changes to this file unless you know what you are doing--modify + * the SWIG interface file instead. + * ----------------------------------------------------------------------------- */ + +namespace FreeSWITCH.Native { + +using System; +using System.Runtime.InteropServices; + public class SWIGTYPE_p_switch_size_t { private HandleRef swigCPtr; @@ -23123,7 +23312,8 @@ namespace FreeSWITCH.Native { SCF_VERBOSE_EVENTS = (1 << 11), SCF_USE_WIN32_MONOTONIC = (1 << 12), SCF_AUTO_SCHEMAS = (1 << 13), - SCF_MINIMAL = (1 << 14) + SCF_MINIMAL = (1 << 14), + SCF_USE_NAT_MAPPING = (1 << 15) } } @@ -28791,7 +28981,7 @@ namespace FreeSWITCH.Native { SWITCH_RTP_FLAG_NOBLOCK = (1 << 0), SWITCH_RTP_FLAG_IO = (1 << 1), SWITCH_RTP_FLAG_USE_TIMER = (1 << 2), - SWITCH_RTP_FLAG_TIMER_RECLOCK = (1 << 3), + SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 3), SWITCH_RTP_FLAG_SECURE_SEND = (1 << 4), SWITCH_RTP_FLAG_SECURE_RECV = (1 << 5), SWITCH_RTP_FLAG_AUTOADJ = (1 << 6), @@ -28818,8 +29008,7 @@ namespace FreeSWITCH.Native { SWITCH_RTP_FLAG_DEBUG_RTP_READ = (1 << 27), SWITCH_RTP_FLAG_DEBUG_RTP_WRITE = (1 << 28), SWITCH_RTP_FLAG_VIDEO = (1 << 29), - SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30), - SWITCH_RTP_FLAG_RTCP_PASSTHRU = (1 << 31) + SWITCH_RTP_FLAG_ENABLE_RTCP = (1 << 30) } } @@ -29291,6 +29480,16 @@ public class switch_say_args_t : IDisposable { } } + public string ext { + set { + freeswitchPINVOKE.switch_say_args_t_ext_set(swigCPtr, value); + } + get { + string ret = freeswitchPINVOKE.switch_say_args_t_ext_get(swigCPtr); + return ret; + } + } + public switch_say_args_t() : this(freeswitchPINVOKE.new_switch_say_args_t(), true) { } @@ -29378,6 +29577,17 @@ public class switch_say_interface : IDisposable { } } + public SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t say_string_function { + set { + freeswitchPINVOKE.switch_say_interface_say_string_function_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t.getCPtr(value)); + } + get { + IntPtr cPtr = freeswitchPINVOKE.switch_say_interface_say_string_function_get(swigCPtr); + SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_char_p_switch_say_args_t_p_p_char__switch_status_t(cPtr, false); + return ret; + } + } + public SWIGTYPE_p_switch_thread_rwlock_t rwlock { set { freeswitchPINVOKE.switch_say_interface_rwlock_set(swigCPtr, SWIGTYPE_p_switch_thread_rwlock_t.getCPtr(value)); @@ -31672,6 +31882,16 @@ public class switch_xml : IDisposable { } } + public uint refs { + set { + freeswitchPINVOKE.switch_xml_refs_set(swigCPtr, value); + } + get { + uint ret = freeswitchPINVOKE.switch_xml_refs_get(swigCPtr); + return ret; + } + } + public switch_xml() : this(freeswitchPINVOKE.new_switch_xml(), true) { } From 5857495e06f00ed6f773ee97d5a81372508fec96 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 15 Apr 2011 11:17:36 -0500 Subject: [PATCH 312/558] offer both avp and savp when using srtp --- src/mod/endpoints/mod_sofia/sofia_glue.c | 42 +++++++++++++++++------- 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 2601a087e2..3c08f37011 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -187,7 +187,7 @@ void sofia_glue_set_image_sdp(private_object_t *tech_pvt, switch_t38_options_t * static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, switch_port_t port, - int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map, int verbose_sdp) + int cur_ptime, const char *append_audio, const char *sr, int use_cng, int cng_type, switch_event_t *map, int verbose_sdp, int secure) { int i = 0; int rate; @@ -195,7 +195,7 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, int ptime = 0, noptime = 0; switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "m=audio %d RTP/%sAVP", - port, (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) ? "S" : ""); + port, secure ? "S" : ""); @@ -312,6 +312,11 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d telephone-event/8000\na=fmtp:%d 0-16\n", tech_pvt->te, tech_pvt->te); } + if (secure) { + switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key); + //switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n"); + } + if (!cng_type) { //switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=rtpmap:%d CN/8000\n", cng_type); //} else { @@ -333,7 +338,6 @@ static void generate_m(private_object_t *tech_pvt, char *buf, size_t buflen, if (sr) { switch_snprintf(buf + strlen(buf), buflen - strlen(buf), "a=%s\n", sr); } - } void sofia_glue_check_dtmf_type(private_object_t *tech_pvt) @@ -529,7 +533,11 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 if (sr) { switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=%s\n", sr); } - + + if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) { + switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key); + //switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n"); + } } else if (tech_pvt->num_codecs) { int i; @@ -545,7 +553,15 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 } if (!switch_true(switch_channel_get_variable(tech_pvt->channel, "sdp_m_per_ptime"))) { - generate_m(tech_pvt, buf, sizeof(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp); + char *bp = buf; + + if ((!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE))) { + generate_m(tech_pvt, buf, sizeof(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1); + bp = (buf + strlen(buf)); + } + + generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, 0, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0); + } else { for (i = 0; i < tech_pvt->num_codecs; i++) { @@ -558,8 +574,15 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 this_ptime = imp->microseconds_per_packet / 1000; if (cur_ptime != this_ptime) { - cur_ptime = this_ptime; - generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp); + char *bp = buf; + cur_ptime = this_ptime; + + if ((!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE))) { + generate_m(tech_pvt, buf, sizeof(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 1); + bp = (buf + strlen(buf)); + } + + generate_m(tech_pvt, bp, sizeof(buf) - strlen(buf), port, cur_ptime, append_audio, sr, use_cng, cng_type, map, verbose_sdp, 0); } } @@ -567,11 +590,6 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32 } - if (!zstr(tech_pvt->local_crypto_key) && sofia_test_flag(tech_pvt, TFLAG_SECURE)) { - switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=crypto:%s\n", tech_pvt->local_crypto_key); - //switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=encryption:optional\n"); - } - if (sofia_test_flag(tech_pvt, TFLAG_VIDEO)) { if (!tech_pvt->local_sdp_video_port) { sofia_glue_tech_choose_video_port(tech_pvt, 0); From c5ae5de0a0398a1cd008c4057c1cc2303dcedb03 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 15 Apr 2011 13:53:04 -0400 Subject: [PATCH 313/558] FS-3250 --resolve mod_callcenter: Reload a queue wont delete all the currently waiting members. Only a reload of the module will. --- .../mod_callcenter/mod_callcenter.c | 61 +++++++++++-------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index ff1c71ec11..8ab3390e67 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -656,8 +656,6 @@ static cc_queue_t *load_queue(const char *queue_name) cc_queue_t *queue = NULL; switch_xml_t x_queues, x_queue, cfg, xml; switch_event_t *event = NULL; - switch_cache_db_handle_t *dbh = NULL; - char *sql = NULL; if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf); @@ -700,30 +698,10 @@ static cc_queue_t *load_queue(const char *queue_name) queue->last_agent_exist = 0; queue->last_agent_exist_check = 0; - if (!(dbh = cc_get_db_handle())) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n"); - goto end; - } - - switch_cache_db_test_reactive(dbh, "select count(session_uuid) from members", "drop table members", members_sql); - switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", NULL, "alter table agents add ready_time integer not null default 0;" - "alter table agents add reject_delay_time integer not null default 0;" - "alter table agents add busy_delay_time integer not null default 0;"); - switch_cache_db_test_reactive(dbh, "select count(no_answer_delay_time) from agents", NULL, "alter table agents add no_answer_delay_time integer not null default 0;"); - switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", "drop table agents", agents_sql); - switch_cache_db_test_reactive(dbh, "select count(queue) from tiers", "drop table tiers" , tiers_sql); switch_mutex_init(&queue->mutex, SWITCH_MUTEX_NESTED, queue->pool); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Added queue %s\n", queue->name); switch_core_hash_insert(globals.queue_hash, queue->name, queue); - /* Reset a unclean shutdown */ - sql = switch_mprintf("UPDATE agents SET state = 'Waiting', uuid = '' WHERE system = 'single_box';" - "UPDATE tiers SET state = 'Ready' WHERE agent IN (SELECT name FROM agents WHERE system = 'single_box');" - "UPDATE members SET state = '%q', session_uuid = '' WHERE system = 'single_box';", - cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); - - cc_execute_sql(NULL, sql, NULL); - switch_safe_free(sql); } end: @@ -1262,11 +1240,15 @@ end: static switch_status_t load_config(void) { + switch_status_t status = SWITCH_STATUS_SUCCESS; switch_xml_t cfg, xml, settings, param, x_queues, x_queue, x_agents, x_agent, x_tiers, x_tier; - + switch_cache_db_handle_t *dbh = NULL; + char *sql = NULL; + if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf); - return SWITCH_STATUS_TERM; + status = SWITCH_STATUS_TERM; + goto end; } switch_mutex_lock(globals.mutex); @@ -1297,6 +1279,30 @@ static switch_status_t load_config(void) globals.dbname = strdup(CC_SQLITE_DB_NAME); } + /* Initialize database */ + if (!(dbh = cc_get_db_handle())) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot open DB!\n"); + status = SWITCH_STATUS_TERM; + goto end; + } + switch_cache_db_test_reactive(dbh, "select count(session_uuid) from members", "drop table members", members_sql); + switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", NULL, "alter table agents add ready_time integer not null default 0;" + "alter table agents add reject_delay_time integer not null default 0;" + "alter table agents add busy_delay_time integer not null default 0;"); + switch_cache_db_test_reactive(dbh, "select count(no_answer_delay_time) from agents", NULL, "alter table agents add no_answer_delay_time integer not null default 0;"); + switch_cache_db_test_reactive(dbh, "select count(ready_time) from agents", "drop table agents", agents_sql); + switch_cache_db_test_reactive(dbh, "select count(queue) from tiers", "drop table tiers" , tiers_sql); + + switch_cache_db_release_db_handle(&dbh); + + /* Reset a unclean shutdown */ + sql = switch_mprintf("update agents set state = 'Waiting', uuid = '' where system = 'single_box';" + "update tiers set state = 'Ready' where agent IN (select name from agents where system = 'single_box');" + "update members set state = '%q', session_uuid = '' where system = 'single_box';", + cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + /* Loading queue into memory struct */ if ((x_queues = switch_xml_child(cfg, "queues"))) { for (x_queue = switch_xml_child(x_queues, "queue"); x_queue; x_queue = x_queue->next) { @@ -1342,11 +1348,14 @@ static switch_status_t load_config(void) } } +end: switch_mutex_unlock(globals.mutex); - switch_xml_free(xml); + if (xml) { + switch_xml_free(xml); + } - return SWITCH_STATUS_SUCCESS; + return status; } static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *thread, void *obj) From a4ed829db868dd71d5feb8db597c3573fbb5d9e7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 15 Apr 2011 14:22:45 -0500 Subject: [PATCH 314/558] fix race in sla --- src/mod/endpoints/mod_sofia/sofia.c | 13 +++++++------ src/switch_channel.c | 4 ++++ src/switch_ivr_bridge.c | 2 ++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index cf25aae369..9061270a91 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7150,7 +7150,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ const char *data = switch_channel_get_variable(b_channel, SWITCH_CURRENT_APPLICATION_DATA_VARIABLE); if (app && data && !strcasecmp(app, "conference")) { - destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s", data); + destination_number = switch_core_session_sprintf(session, "answer,conference:%s", data); dialplan = "inline"; } else { if (switch_core_session_check_interface(b_session, sofia_endpoint_interface)) { @@ -7188,7 +7188,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (!one_leg && (!b_tech_pvt || !sofia_test_flag(b_tech_pvt, TFLAG_SIP_HOLD)) && (!c_tech_pvt || !sofia_test_flag(c_tech_pvt, TFLAG_SIP_HOLD))) { - char *ext = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid); + char *ext = switch_core_session_sprintf(session, "answer,conference:%s@sla+flags{mintwo}", uuid); switch_channel_set_flag(c_channel, CF_REDIRECT); switch_ivr_session_transfer(b_session, ext, "inline", NULL); @@ -7200,16 +7200,17 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } if (do_conf) { - destination_number = switch_core_session_sprintf(b_session, "answer,conference:%s@sla+flags{mintwo}", uuid); + destination_number = switch_core_session_sprintf(session, "answer,conference:%s@sla+flags{mintwo}", uuid); } else { if (one_leg && c_app) { if (c_data) { - destination_number = switch_core_session_sprintf(b_session, "answer,%s:%s", c_app, c_data); + destination_number = switch_core_session_sprintf(session, "answer,%s:%s", c_app, c_data); } else { - destination_number = switch_core_session_sprintf(b_session, "answer,%s", c_app); + destination_number = switch_core_session_sprintf(session, "answer,%s", c_app); } } else { - destination_number = switch_core_session_sprintf(b_session, "answer,intercept:%s", uuid); + switch_channel_mark_hold(b_channel, SWITCH_FALSE); + destination_number = switch_core_session_sprintf(session, "answer,intercept:%s", uuid); } } diff --git a/src/switch_channel.c b/src/switch_channel.c index bc8daabbc6..2a53c34e93 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -634,6 +634,10 @@ SWITCH_DECLARE(void) switch_channel_mark_hold(switch_channel_t *channel, switch_ { switch_event_t *event; + if (!!on == !!switch_channel_test_flag(channel, CF_LEG_HOLDING)) { + return; + } + if (on) { switch_channel_set_flag(channel, CF_LEG_HOLDING); } else { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index f1a6bdba22..d10b5e0e5e 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1576,6 +1576,8 @@ SWITCH_DECLARE(void) switch_ivr_intercept_session(switch_core_session_t *session switch_channel_answer(rchannel); } + switch_channel_mark_hold(rchannel, SWITCH_FALSE); + switch_channel_set_state_flag(rchannel, CF_TRANSFER); switch_channel_set_state(rchannel, CS_PARK); From e4eade33acf02e0cde096ccd928cd61bd1f9b06c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 15 Apr 2011 14:46:24 +0000 Subject: [PATCH 315/558] fix default tipping point it was too low --- src/switch_core.c | 2 +- src/switch_time.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index d3a696bef5..1e91279091 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1409,7 +1409,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc if (flags & SCF_MINIMAL) return SWITCH_STATUS_SUCCESS; - runtime.tipping_point = 5000; + runtime.tipping_point = 0; runtime.timer_affinity = -1; switch_load_core_config("switch.conf"); diff --git a/src/switch_time.c b/src/switch_time.c index 0fd7d9ee49..d6aa8c8b08 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -433,7 +433,7 @@ SWITCH_DECLARE(void) switch_sleep(switch_interval_time_t t) SWITCH_DECLARE(void) switch_cond_next(void) { - if (globals.timer_count >= runtime.tipping_point) { + if (runtime.tipping_point && globals.timer_count >= runtime.tipping_point) { os_yield(); return; } @@ -510,7 +510,7 @@ static switch_status_t timer_init(switch_timer_t *timer) switch_mutex_lock(globals.mutex); globals.timer_count++; - if (globals.timer_count == (runtime.tipping_point + 1)) { + if (runtime.tipping_point && globals.timer_count == (runtime.tipping_point + 1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Crossed tipping point of %u, shifting into high-gear.\n", runtime.tipping_point); } switch_mutex_unlock(globals.mutex); @@ -593,7 +593,7 @@ static switch_status_t timer_next(switch_timer_t *timer) while (globals.RUNNING == 1 && private_info->ready && TIMER_MATRIX[timer->interval].tick < private_info->reference) { check_roll(); - if (globals.timer_count >= runtime.tipping_point) { + if (runtime.tipping_point && globals.timer_count >= runtime.tipping_point) { os_yield(); globals.use_cond_yield = 0; } else { @@ -660,7 +660,7 @@ static switch_status_t timer_destroy(switch_timer_t *timer) switch_mutex_lock(globals.mutex); if (globals.timer_count) { globals.timer_count--; - if (globals.timer_count == (runtime.tipping_point - 1)) { + if (runtime.tipping_point && globals.timer_count == (runtime.tipping_point - 1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Fell Below tipping point of %u, shifting into low-gear.\n", runtime.tipping_point); } } @@ -780,7 +780,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) rev_errs = 0; } - if (globals.timer_count >= runtime.tipping_point) { + if (runtime.tipping_point && globals.timer_count >= runtime.tipping_point) { os_yield(); } else { if (tfd > -1 && globals.RUNNING == 1) { From b63bff4c175352e56ec438d63dbc4fdf668378ae Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 15 Apr 2011 16:18:26 +0000 Subject: [PATCH 316/558] a few optimizations --- src/switch_core_sqldb.c | 2 ++ src/switch_event.c | 25 ++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 940b1c4698..a1baa9e2c5 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -201,9 +201,11 @@ SWITCH_DECLARE(switch_status_t) _switch_core_db_handle(switch_cache_db_handle_t r = _switch_cache_db_get_db_handle(dbh, SCDB_TYPE_CORE_DB, &options, file, func, line); } + /* I *think* we can do without this now, if not let me know if (r == SWITCH_STATUS_SUCCESS && !(*dbh)->io_mutex) { (*dbh)->io_mutex = sql_manager.io_mutex; } + */ return r; } diff --git a/src/switch_event.c b/src/switch_event.c index 86bf0c245c..9816834d37 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -291,6 +291,7 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi switch_queue_t *queue = (switch_queue_t *) obj; uint32_t index = 0; int my_id = 0; + int auto_pause = 0; switch_mutex_lock(EVENT_QUEUE_MUTEX); THREAD_COUNT++; @@ -307,6 +308,14 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi switch_event_t *event = NULL; int loops = 0; + if (auto_pause) { + if (!--auto_pause) { + switch_core_session_ctl(SCSC_PAUSE_INBOUND, &auto_pause); + } else { + switch_cond_next(); + } + } + if (switch_queue_pop(queue, &pop) != SWITCH_STATUS_SUCCESS) { break; } @@ -323,8 +332,22 @@ static void *SWITCH_THREAD_FUNC switch_event_thread(switch_thread_t *thread, voi while (event) { + if (++loops > 2) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event system overloading\n"); + uint32_t last_sps = 0, sess_count = switch_core_session_count(); + if (auto_pause) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Event system *still* overloading.\n"); + } else { + switch_core_session_ctl(SCSC_LAST_SPS, &last_sps); + last_sps = (uint32_t) (float) (last_sps * 0.75f); + sess_count = (uint32_t) (float) (sess_count * 0.75f); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, + "Event system overloading. Taking a 10 second break, Reducing max_sessions to %d %dsps\n", sess_count, last_sps); + switch_core_session_limit(sess_count); + switch_core_session_ctl(SCSC_SPS, &last_sps); + auto_pause = 10; + switch_core_session_ctl(SCSC_PAUSE_INBOUND, &auto_pause); + } switch_yield(1000000); } From bfdfac5e8ab261b8244fa251bd3997affd4115d6 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 16 Apr 2011 14:44:28 -0400 Subject: [PATCH 317/558] mod_voicemail: Adding a new voicemail fsdb api vm_fsdb_auth_login that does basic login authentication for a user --- .../mod_voicemail/mod_voicemail.c | 107 +++++++++++++++++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 877e3e8601..94b6985f26 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -5074,6 +5074,109 @@ done: return SWITCH_STATUS_SUCCESS; } +#define VM_FSDB_AUTH_LOGIN_USAGE " " +SWITCH_STANDARD_API(vm_fsdb_auth_login_function) +{ + char *sql; + char *password = NULL; + + const char *id = NULL, *domain = NULL, *profile_name = NULL; + vm_profile_t *profile = NULL; + + int argc = 0; + char *argv[6] = { 0 }; + char *mycmd = NULL; + + char user_db_password[64] = { 0 }; + const char *user_xml_password = NULL; + + switch_event_t *params = NULL; + switch_xml_t x_user = NULL; + switch_bool_t vm_enabled = SWITCH_TRUE; + + switch_memory_pool_t *pool; + + switch_core_new_memory_pool(&pool); + + if (!zstr(cmd)) { + mycmd = switch_core_strdup(pool, cmd); + argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[0]) + profile_name = argv[0]; + if (argv[1]) + domain = argv[1]; + if (argv[2]) + id = argv[2]; + if (argv[3]) + password = argv[3]; + + if (!profile_name || !domain || !id || !password) { + stream->write_function(stream, "-ERR Missing Arguments\n"); + goto done; + } + + if (!(profile = get_profile(profile_name))) { + stream->write_function(stream, "-ERR Profile not found\n"); + goto done; + } + + switch_event_create(¶ms, SWITCH_EVENT_GENERAL); + if (switch_xml_locate_user_merged("id", id, domain, NULL, &x_user, params) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Can't find user [%s@%s]\n", id, domain); + stream->write_function(stream, "-ERR User not found\n"); + } else { + switch_xml_t x_param, x_params; + + x_params = switch_xml_child(x_user, "params"); + + for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) { + const char *var = switch_xml_attr_soft(x_param, "name"); + const char *val = switch_xml_attr_soft(x_param, "value"); + if (zstr(var) || zstr(val)) { + continue; /* Ignore empty entires */ + } + + if (!strcasecmp(var, "vm-enabled")) { + vm_enabled = !switch_false(val); + } + if (!strcasecmp(var, "vm-password")) { + user_xml_password = val; + } + } + + sql = switch_mprintf("SELECT password FROM voicemail_prefs WHERE username = '%q' AND domain = '%q'", id, domain); + vm_execute_sql2str(profile, profile->mutex, sql, user_db_password, sizeof(user_db_password)); + switch_safe_free(sql); + } + + if (vm_enabled == SWITCH_FALSE) { + stream->write_function(stream, "%s", "-ERR Login Denied"); + } else if (!zstr(user_db_password)) { + if (!strcasecmp(user_db_password, password)) { + stream->write_function(stream, "%s", "-OK"); + } else { + stream->write_function(stream, "%s", "-ERR"); + } + } else if (!zstr(user_xml_password)) { + if (!strcasecmp(user_xml_password, password)) { + stream->write_function(stream, "%s", "-OK"); + } else { + stream->write_function(stream, "%s", "-ERR"); + } + } else { + stream->write_function(stream, "%s", "-ERR"); + + } + + switch_xml_free(x_user); + profile_rwunlock(profile); +done: + switch_core_destroy_memory_pool(&pool); + return SWITCH_STATUS_SUCCESS; +} + #define VM_FSDB_MSG_GET_USAGE " " SWITCH_STANDARD_API(vm_fsdb_msg_get_function) { @@ -5119,7 +5222,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_get_function) sql = switch_mprintf("SELECT * FROM voicemail_msgs WHERE username = '%q' AND domain = '%q' AND uuid = '%q' ORDER BY read_flags, created_epoch", id, domain, uuid); - memset(&cbt, 0, sizeof(cbt)); switch_event_create(&cbt.my_params, SWITCH_EVENT_REQUEST_PARAMS); @@ -5249,6 +5351,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_load) SWITCH_ADD_API(commands_api_interface, "vm_read", "vm_read", voicemail_read_api_function, VM_READ_USAGE); SWITCH_ADD_API(commands_api_interface, "vm_list", "vm_list", voicemail_list_api_function, VM_LIST_USAGE); + /* Auth API */ + SWITCH_ADD_API(commands_api_interface, "vm_fsdb_auth_login", "vm_fsdb_auth_login", vm_fsdb_auth_login_function, VM_FSDB_AUTH_LOGIN_USAGE); + /* Message Targeted API */ SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_count", "vm_fsdb_msg_count", vm_fsdb_msg_count_function, VM_FSDB_MSG_COUNT_USAGE); SWITCH_ADD_API(commands_api_interface, "vm_fsdb_msg_list", "vm_fsdb_msg_list", vm_fsdb_msg_list_function, VM_FSDB_MSG_LIST_USAGE); From fb549777cbe663eed074ca204ef8d8bb84c48cc1 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 16 Apr 2011 19:06:32 -0400 Subject: [PATCH 318/558] mod_protovm: This is a very early new prototype voicemail ivr system. You need to copy the sounds.xml and make it loadale in the language folder and protovm.conf.xml inside the autoload_configs folder. Configs file will most definitly change. Once stabilized, we make it install those file by default. --- src/mod/applications/mod_protovm/Makefile | 3 + src/mod/applications/mod_protovm/config.c | 130 ++++ src/mod/applications/mod_protovm/config.h | 49 ++ src/mod/applications/mod_protovm/ivr.c | 249 ++++++++ src/mod/applications/mod_protovm/ivr.h | 30 + src/mod/applications/mod_protovm/menu.c | 599 ++++++++++++++++++ src/mod/applications/mod_protovm/menu.h | 31 + .../applications/mod_protovm/mod_protovm.c | 139 ++++ .../applications/mod_protovm/protovm.conf.xml | 137 ++++ src/mod/applications/mod_protovm/sounds.xml | 375 +++++++++++ src/mod/applications/mod_protovm/util.c | 175 +++++ src/mod/applications/mod_protovm/util.h | 16 + 12 files changed, 1933 insertions(+) create mode 100644 src/mod/applications/mod_protovm/Makefile create mode 100644 src/mod/applications/mod_protovm/config.c create mode 100644 src/mod/applications/mod_protovm/config.h create mode 100644 src/mod/applications/mod_protovm/ivr.c create mode 100644 src/mod/applications/mod_protovm/ivr.h create mode 100644 src/mod/applications/mod_protovm/menu.c create mode 100644 src/mod/applications/mod_protovm/menu.h create mode 100644 src/mod/applications/mod_protovm/mod_protovm.c create mode 100644 src/mod/applications/mod_protovm/protovm.conf.xml create mode 100644 src/mod/applications/mod_protovm/sounds.xml create mode 100644 src/mod/applications/mod_protovm/util.c create mode 100644 src/mod/applications/mod_protovm/util.h diff --git a/src/mod/applications/mod_protovm/Makefile b/src/mod/applications/mod_protovm/Makefile new file mode 100644 index 0000000000..650837295f --- /dev/null +++ b/src/mod/applications/mod_protovm/Makefile @@ -0,0 +1,3 @@ +BASE=/home/fs/src/fs-trunk-git/ +LOCAL_OBJS=ivr.o util.o config.o menu.o +include $(BASE)/build/modmake.rules diff --git a/src/mod/applications/mod_protovm/config.c b/src/mod/applications/mod_protovm/config.c new file mode 100644 index 0000000000..feec69b79e --- /dev/null +++ b/src/mod/applications/mod_protovm/config.c @@ -0,0 +1,130 @@ +/* Copy paste from FS mod_voicemail */ +#include + +#include "config.h" + +const char *global_cf = "protovm.conf"; + +void populate_profile_menu_event(vmivr_profile_t *profile, vmivr_menu_profile_t *menu) { + switch_xml_t cfg, xml, x_profiles, x_profile, x_keys, x_phrases, x_menus, x_menu; + + free_profile_menu_event(menu); + + if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf); + goto end; + } + if (!(x_profiles = switch_xml_child(cfg, "profiles"))) { + goto end; + } + + if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile->name))) { + if ((x_menus = switch_xml_child(x_profile, "menus"))) { + if ((x_menu = switch_xml_find_child(x_menus, "menu", "name", menu->name))) { + if ((x_keys = switch_xml_child(x_menu, "keys"))) { + switch_event_import_xml(switch_xml_child(x_keys, "key"), "dtmf", "action", &menu->event_keys_dtmf); + switch_event_import_xml(switch_xml_child(x_keys, "key"), "action", "dtmf", &menu->event_keys_action); + switch_event_import_xml(switch_xml_child(x_keys, "key"), "action", "variable", &menu->event_keys_varname); + } + if ((x_phrases = switch_xml_child(x_menu, "phrases"))) { + switch_event_import_xml(switch_xml_child(x_phrases, "phrase"), "name", "value", &menu->event_phrases); + } + } + } + } +end: + if (xml) + switch_xml_free(xml); + return; + +} + +void free_profile_menu_event(vmivr_menu_profile_t *menu) { + if (menu->event_keys_dtmf) { + switch_event_destroy(&menu->event_keys_dtmf); + } + if (menu->event_keys_action) { + switch_event_destroy(&menu->event_keys_action); + } + if (menu->event_keys_varname) { + switch_event_destroy(&menu->event_keys_varname); + } + + if (menu->event_phrases) { + switch_event_destroy(&menu->event_phrases); + } +} + +vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile_name) +{ + vmivr_profile_t *profile = NULL; + switch_xml_t cfg, xml, x_profiles, x_profile, x_apis, param; + + if (!(xml = switch_xml_open_cfg(global_cf, &cfg, NULL))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", global_cf); + return profile; + } + if (!(x_profiles = switch_xml_child(cfg, "profiles"))) { + goto end; + } + + if ((x_profile = switch_xml_find_child(x_profiles, "profile", "name", profile_name))) { + if (!(profile = switch_core_session_alloc(session, sizeof(vmivr_profile_t)))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Alloc Failure\n"); + goto end; + } + + profile->name = profile_name; + + /* TODO Make the following configurable */ + profile->api_profile = profile->name; + profile->menu_check_auth = "std_authenticate"; + profile->menu_check_main = "std_navigator"; + profile->menu_check_terminate = "std_purge"; + + if ((x_apis = switch_xml_child(x_profile, "apis"))) { + int total_options = 0; + int total_invalid_options = 0; + for (param = switch_xml_child(x_apis, "api"); param; param = param->next) { + char *var, *val; + if ((var = (char *) switch_xml_attr_soft(param, "name")) && (val = (char *) switch_xml_attr_soft(param, "value"))) { + if (!strcasecmp(var, "msg_undelete") && !profile->api_msg_undelete) + profile->api_msg_undelete = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "msg_delete") && !profile->api_msg_delete) + profile->api_msg_delete = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "msg_list") && !profile->api_msg_list) + profile->api_msg_list = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "msg_count") && !profile->api_msg_count) + profile->api_msg_count = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "msg_save") && !profile->api_msg_save) + profile->api_msg_save = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "msg_purge") && !profile->api_msg_purge) + profile->api_msg_purge = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "msg_get") && !profile->api_msg_get) + profile->api_msg_get = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "pref_greeting_set") && !profile->api_pref_greeting_set) + profile->api_pref_greeting_set = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "pref_recname_set") && !profile->api_pref_recname_set) + profile->api_pref_recname_set = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "pref_password_set") && !profile->api_pref_password_set) + profile->api_pref_password_set = switch_core_session_strdup(session, val); + else if (!strcasecmp(var, "auth_login") && !profile->api_auth_login) + profile->api_auth_login = switch_core_session_strdup(session, val); + else + total_invalid_options++; + total_options++; + } + } + if (total_options - total_invalid_options != 11) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing api definition for profile '%s'\n", profile_name); + profile = NULL; + } + } + + } + +end: + switch_xml_free(xml); + return profile; +} + diff --git a/src/mod/applications/mod_protovm/config.h b/src/mod/applications/mod_protovm/config.h new file mode 100644 index 0000000000..04713fb7ae --- /dev/null +++ b/src/mod/applications/mod_protovm/config.h @@ -0,0 +1,49 @@ +#ifndef _CONFIG_H_ +#define _CONFIG_H_ + +extern const char *global_cf; + +struct vmivr_profile { + const char *name; + + const char *domain; + const char *id; + + const char *menu_check_auth; + const char *menu_check_main; + const char *menu_check_terminate; + + switch_bool_t authorized; + + const char *api_profile; + const char *api_auth_login; + const char *api_msg_delete; + const char *api_msg_undelete; + const char *api_msg_list; + const char *api_msg_count; + const char *api_msg_save; + const char *api_msg_purge; + const char *api_msg_get; + const char *api_pref_greeting_set; + const char *api_pref_recname_set; + const char *api_pref_password_set; + +}; +typedef struct vmivr_profile vmivr_profile_t; + +struct vmivr_menu_profile { + const char *name; + + switch_event_t *event_keys_action; + switch_event_t *event_keys_dtmf; + switch_event_t *event_keys_varname; + switch_event_t *event_phrases; +}; +typedef struct vmivr_menu_profile vmivr_menu_profile_t; + +vmivr_profile_t *get_profile(switch_core_session_t *session, const char *profile_name); + +void free_profile_menu_event(vmivr_menu_profile_t *menu); +void populate_profile_menu_event(vmivr_profile_t *profile, vmivr_menu_profile_t *menu); + +#endif /* _CONFIG_H_ */ diff --git a/src/mod/applications/mod_protovm/ivr.c b/src/mod/applications/mod_protovm/ivr.c new file mode 100644 index 0000000000..4b1f6ef0cc --- /dev/null +++ b/src/mod/applications/mod_protovm/ivr.c @@ -0,0 +1,249 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Marc Olivier Chouinard + * + * + * ivr.c -- MT IVR System Interface + * + */ + +#include + +#include "ivr.h" + +int match_dtmf(switch_core_session_t *session, dtmf_ss_t *loc) { + switch_bool_t is_invalid[128] = { SWITCH_FALSE }; + int i; + loc->potentialMatch = NULL; + loc->completeMatch = NULL; + loc->potentialMatchCount = 0; + + for (i = 0; i < loc->dtmf_received; i++) { + int j; + loc->potentialMatchCount = 0; + for (j = 0; !zstr(loc->dtmf_accepted[j]) && j < 128; j++) { + switch_bool_t cMatch = SWITCH_FALSE; + char test[2] = { 0 }; + + if (is_invalid[j]) + continue; + + test[0] = loc->dtmf_stored[i]; + if (loc->dtmf_accepted[j][i] == 'N' && atoi(test) >= 2 && atoi(test) <= 9) + cMatch = SWITCH_TRUE; + if (loc->dtmf_accepted[j][i] == 'X' && atoi(test) >= 0 && atoi(test) <= 9) { + cMatch = SWITCH_TRUE; + } + if (i >= strlen(loc->dtmf_accepted[j]) - 1 && loc->dtmf_accepted[j][strlen(loc->dtmf_accepted[j])-1] == '.') + cMatch = SWITCH_TRUE; + if (loc->dtmf_accepted[j][i] == loc->dtmf_stored[i]) + cMatch = SWITCH_TRUE; + + if (cMatch == SWITCH_FALSE) { + is_invalid[j] = SWITCH_TRUE; + continue; + } + + if (i == strlen(loc->dtmf_accepted[j]) - 1 && loc->dtmf_accepted[j][strlen(loc->dtmf_accepted[j])-1] == '.') { + loc->completeMatch = loc->dtmf_accepted[j]; + } + if (i == loc->dtmf_received - 1 && loc->dtmf_received == strlen(loc->dtmf_accepted[j]) && loc->dtmf_accepted[j][strlen(loc->dtmf_accepted[j])-1] != '.') { + loc->completeMatch = loc->dtmf_accepted[j]; + continue; + } + loc->potentialMatchCount++; + } + } + + return 1; +} + +static switch_status_t cb_on_dtmf_ignore(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) +{ + switch (itype) { + case SWITCH_INPUT_TYPE_DTMF: + { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_dtmf_t *dtmf = (switch_dtmf_t *) input; + switch_channel_queue_dtmf(channel, dtmf); + return SWITCH_STATUS_BREAK; + } + default: + break; + } + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t cb_on_dtmf(switch_core_session_t *session, void *input, switch_input_type_t itype, void *buf, unsigned int buflen) +{ + dtmf_ss_t *loc = (dtmf_ss_t*) buf; + + switch (itype) { + case SWITCH_INPUT_TYPE_DTMF: + { + switch_dtmf_t *dtmf = (switch_dtmf_t *) input; + switch_bool_t audio_was_stopped = loc->audio_stopped; + loc->audio_stopped = SWITCH_TRUE; + + if (loc->dtmf_received >= sizeof(loc->dtmf_stored)) { + loc->result = RES_BUFFER_OVERFLOW; + break; + } + if (!loc->terminate_key || dtmf->digit != loc->terminate_key) + loc->dtmf_stored[loc->dtmf_received++] = dtmf->digit; + + match_dtmf(session, loc); + + if (loc->terminate_key && dtmf->digit == loc->terminate_key && loc->result == RES_WAITFORMORE) { + if (loc->potentialMatchCount == 1 && loc->completeMatch != NULL) { + loc->result = RES_FOUND; + } else { + loc->result = RES_INVALID; + } + return SWITCH_STATUS_BREAK; + } else { + if (loc->potentialMatchCount == 0 && loc->completeMatch != NULL) { + loc->result = RES_FOUND; + return SWITCH_STATUS_BREAK; + } else if (loc->potentialMatchCount > 0) { + loc->result = RES_WAITFORMORE; + if (!audio_was_stopped) + return SWITCH_STATUS_BREAK; + } else { + loc->result = RES_INVALID; + return SWITCH_STATUS_BREAK; + } + } + } + break; + default: + break; + } + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t captureMenuInitialize(dtmf_ss_t *loc, char **dtmf_accepted) { + int i; + + memset(loc, 0, sizeof(*loc)); + + for (i = 0; dtmf_accepted[i] && i < 16; i++) { + strncpy(loc->dtmf_accepted[i], dtmf_accepted[i], 128); + } + + return SWITCH_STATUS_SUCCESS; +} + +switch_status_t playbackBufferDTMF(switch_core_session_t *session, const char *macro_name, const char *data, switch_event_t *event, const char *lang, int timeout) { + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (switch_channel_ready(channel)) { + switch_input_args_t args = { 0 }; + + args.input_callback = cb_on_dtmf_ignore; + + if (macro_name) { + status = switch_ivr_phrase_macro_event(session, macro_name, data, event, lang, &args); + } + } else { + status = SWITCH_STATUS_BREAK; + } + + return status; +} + + +switch_status_t captureMenu(switch_core_session_t *session, dtmf_ss_t *loc, const char *macro_name, const char *data, switch_event_t *event, const char *lang, int timeout) { + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (switch_channel_ready(channel)) { + switch_input_args_t args = { 0 }; + + args.input_callback = cb_on_dtmf; + args.buf = loc; + + if (macro_name && loc->audio_stopped == SWITCH_FALSE && loc->result == RES_WAITFORMORE) { + status = switch_ivr_phrase_macro_event(session, macro_name, data, event, lang, &args); + } + + if (switch_channel_ready(channel) && (status == SWITCH_STATUS_SUCCESS || status == SWITCH_STATUS_BREAK) && timeout && loc->result == RES_WAITFORMORE) { + loc->audio_stopped = SWITCH_TRUE; + switch_ivr_collect_digits_callback(session, &args, timeout, 0); + if (loc->result == RES_WAITFORMORE) { + if (loc->potentialMatchCount == 1 && loc->completeMatch != NULL) { + loc->result = RES_FOUND; + } else { + loc->result = RES_TIMEOUT; + } + } + } + } else { + status = SWITCH_STATUS_BREAK; + } + + return status; +} + +switch_status_t captureMenuRecord(switch_core_session_t *session, dtmf_ss_t *loc, switch_event_t *event, const char *file_path, switch_file_handle_t *fh, int max_record_len) { + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (switch_channel_ready(channel)) { + switch_input_args_t args = { 0 }; + + args.input_callback = cb_on_dtmf; + args.buf = loc; + + if (loc->audio_stopped == SWITCH_FALSE && loc->result == RES_WAITFORMORE) { + loc->recorded_audio = SWITCH_TRUE; + status = switch_ivr_record_file(session, fh, file_path, &args, max_record_len); + + } + if (loc->result == RES_WAITFORMORE) { + loc->result = RES_TIMEOUT; + } + + } else { + status = SWITCH_STATUS_BREAK; + } + + return status; +} + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 + */ diff --git a/src/mod/applications/mod_protovm/ivr.h b/src/mod/applications/mod_protovm/ivr.h new file mode 100644 index 0000000000..99136475fd --- /dev/null +++ b/src/mod/applications/mod_protovm/ivr.h @@ -0,0 +1,30 @@ +struct dtmf_ss { + char dtmf_stored[128]; + int dtmf_received; + char dtmf_accepted[16][128]; + int result; + switch_bool_t audio_stopped; + switch_bool_t recorded_audio; + const char *potentialMatch; + int potentialMatchCount; + const char *completeMatch; + char terminate_key; +}; +typedef struct dtmf_ss dtmf_ss_t; + +#define RES_WAITFORMORE 0 +#define RES_FOUND 1 +#define RES_INVALID 3 +#define RES_TIMEOUT 4 +#define RES_BREAK 5 +#define RES_RECORD 6 +#define RES_BUFFER_OVERFLOW 99 + +#define MAX_DTMF_SIZE_OPTION 32 + +switch_status_t captureMenu(switch_core_session_t *session, dtmf_ss_t *loc, const char *macro_name, const char *data, switch_event_t *event, const char *lang, int timeout); +switch_status_t captureMenuRecord(switch_core_session_t *session, dtmf_ss_t *loc, switch_event_t *event, const char *file_path, switch_file_handle_t *fh, int max_record_len); +switch_status_t captureMenuInitialize(dtmf_ss_t *loc, char **dtmf_accepted); + +switch_status_t playbackBufferDTMF(switch_core_session_t *session, const char *macro_name, const char *data, switch_event_t *event, const char *lang, int timeout); + diff --git a/src/mod/applications/mod_protovm/menu.c b/src/mod/applications/mod_protovm/menu.c new file mode 100644 index 0000000000..4dc3e19e78 --- /dev/null +++ b/src/mod/applications/mod_protovm/menu.c @@ -0,0 +1,599 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Marc Olivier Chouinard + * + * + * menu.c -- VoiceMail Menu + * + */ +#include + +#include "ivr.h" +#include "menu.h" +#include "util.h" +#include "config.h" + +/* List of available menu */ +vmivr_menu_function_t menu_list[] = { + {"std_authenticate", mtvm_menu_authenticate}, + {"std_navigator", mtvm_menu_main}, + {"std_record_name", mtvm_menu_record_name}, + {"std_set_password", mtvm_menu_set_password}, + {"std_select_greeting_slot", mtvm_menu_select_greeting_slot}, + {"std_record_greeting_with_slot", mtvm_menu_record_greeting_with_slot}, + {"std_preference", mtvm_menu_preference}, + {"std_purge", mtvm_menu_purge}, + { NULL, NULL } +}; + +#define MAX_ATTEMPT 3 /* TODO Make these fields configurable */ +#define DEFAULT_IVR_TIMEOUT 3000 + +void mtvm_menu_purge(switch_core_session_t *session, vmivr_profile_t *profile) { + if (profile->id && profile->authorized) { + if (1==1 /* TODO make Purge email on exit optional ??? */) { + const char *cmd = switch_core_session_sprintf(session, "%s %s %s", profile->api_profile, profile->domain, profile->id); + mt_api_execute(session, profile->api_msg_purge, cmd); + } + } +} +void mtvm_menu_main(switch_core_session_t *session, vmivr_profile_t *profile) { + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_event_t *msg_list_params = NULL; + size_t msg_count = 0; + size_t current_msg = 1; + size_t next_msg = current_msg; + size_t previous_msg = current_msg; + char *cmd = NULL; + int retry; + + /* Different switch to control playback of phrases */ + switch_bool_t initial_count_played = SWITCH_FALSE; + switch_bool_t skip_header = SWITCH_FALSE; + switch_bool_t msg_deleted = SWITCH_FALSE; + switch_bool_t msg_undeleted = SWITCH_FALSE; + switch_bool_t msg_saved = SWITCH_FALSE; + + vmivr_menu_profile_t menu = { "std_navigator" }; + + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &menu); + + if (!menu.event_keys_dtmf || !menu.event_phrases) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys\n"); + return; + } + + /* Get VoiceMail List And update msg count */ + cmd = switch_core_session_sprintf(session, "json %s %s %s", profile->api_profile, profile->domain, profile->id); + msg_list_params = jsonapi2event(session, NULL, profile->api_msg_list, cmd); + msg_count = atol(switch_event_get_header(msg_list_params,"VM-List-Count")); + + /* TODO Add Detection of new message and notify the user */ + + for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) { + dtmf_ss_t loc; + char *dtmfa[16] = { 0 }; + switch_event_t *phrase_params = NULL; + + switch_event_create(&phrase_params, SWITCH_EVENT_REQUEST_PARAMS); + + append_event_profile(phrase_params, profile, menu); + + populate_dtmfa_from_event(phrase_params, profile, menu, dtmfa); + + previous_msg = current_msg; + + /* Simple Protection to not go out of msg list scope */ + /* TODO: Add Prompt to notify they reached the begining or the end */ + if (next_msg == 0) { + next_msg = 1; + } else if (next_msg > msg_count) { + next_msg = msg_count; + } + + current_msg = next_msg; + + captureMenuInitialize(&loc, dtmfa); + + /* Prompt related to previous Message here */ + append_event_message(session, profile, phrase_params, msg_list_params, previous_msg); + if (msg_deleted) { + msg_deleted = SWITCH_FALSE; + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "ack"), "deleted", phrase_params, NULL, 0); + } + if (msg_undeleted) { + msg_undeleted = SWITCH_FALSE; + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "ack"), "undeleted", phrase_params, NULL, 0); + } + if (msg_saved) { + msg_saved = SWITCH_FALSE; + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "ack"), "saved", phrase_params, NULL, 0); + } + + /* Prompt related the current message */ + append_event_message(session, profile, phrase_params, msg_list_params, current_msg); + + /* TODO check if msg is gone (purged by another session, notify user and auto jump to next message or something) */ + if (!skip_header) { + if (!initial_count_played) { + cmd = switch_core_session_sprintf(session, "json %s %s %s", profile->api_profile, profile->domain, profile->id); + jsonapi2event(session, phrase_params, profile->api_msg_count, cmd); + initial_count_played = SWITCH_TRUE; + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "msg_count"), NULL, phrase_params, NULL, 0); + } + if (msg_count > 0) { + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "say_msg_number"), NULL, phrase_params, NULL, 0); + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "say_date"), NULL, phrase_params, NULL, 0); + } + } + if (msg_count > 0) { + /* TODO Update the Read date of a message (When msg start, or when it listen compleatly ??? To be determined */ + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "play_message"), NULL, phrase_params, NULL, 0); + } + skip_header = SWITCH_FALSE; + + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT); + + if (loc.result == RES_TIMEOUT) { + /* TODO Ask for the prompt Again IF retry != 0 */ + } else if (loc.result == RES_INVALID) { + /* TODO Say invalid option, and ask for the prompt again IF retry != 0 */ + } else if (loc.result == RES_FOUND) { /* Matching DTMF Key Pressed */ + const char *action = switch_event_get_header(menu.event_keys_dtmf, loc.dtmf_stored); + + /* Reset the try count */ + retry = MAX_ATTEMPT; + + if (action) { + if (!strcasecmp(action, "skip_intro")) { /* Skip Header / Play the recording again */ + skip_header = SWITCH_TRUE; + } else if (!strcasecmp(action, "next_msg")) { /* Next Message */ + next_msg++; + } else if (!strcasecmp(action, "prev_msg")) { /* Previous Message */ + next_msg--; + } else if (!strcasecmp(action, "delete_msg")) { /* Delete / Undelete Message */ + if (strncasecmp(switch_event_get_header(phrase_params, "VM-Message-Flags"), "delete", 6)) { + cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(phrase_params, "VM-Message-UUID")); + mt_api_execute(session, profile->api_msg_delete, cmd); + + msg_deleted = SWITCH_TRUE; + /* TODO Option for auto going to next message or just return to the menu (So user used to do 76 to delete and next message wont be confused) */ + next_msg++; + } else { + cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(phrase_params, "VM-Message-UUID")); + mt_api_execute(session, profile->api_msg_undelete, cmd); + + msg_undeleted = SWITCH_TRUE; + } + } else if (!strcasecmp(action, "save_msg")) { /* Save Message */ + cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(phrase_params, "VM-Message-UUID")); + mt_api_execute(session, profile->api_msg_save, cmd); + + msg_saved = SWITCH_TRUE; + } else if (!strncasecmp(action, "menu:", 5)) { /* Sub Menu */ + void (*fPtr)(switch_core_session_t *session, vmivr_profile_t *profile) = mtvm_get_menu_function(action+5); + if (fPtr) { + fPtr(session, profile); + } + } else if (!strcasecmp(action, "return")) { /* Return */ + retry = -1; + } + } + } + + /* IF the API to get the message returned us a COPY of the file locally (temp file create from a DB or from a web server), delete it */ + if (switch_true(switch_event_get_header(phrase_params, "VM-Message-Private-Local-Copy"))) { + const char *file_path = switch_event_get_header(phrase_params, "VM-Message-File-Path"); + if (file_path && unlink(file_path) != 0) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Failed to delete temp file [%s]\n", file_path); + } + } + switch_event_destroy(&phrase_params); + } + + switch_event_destroy(&msg_list_params); + + free_profile_menu_event(&menu); + + return; +} + +void mtvm_menu_record_name(switch_core_session_t *session, vmivr_profile_t *profile) { + switch_status_t status; + vmivr_menu_profile_t menu = { "std_record_name" }; + + char *tmp_filepath = generate_random_file_name(session, "protovm", "wav" /* TODO make it configurable */); + + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &menu); + + status = mtvm_menu_record(session, profile, menu, tmp_filepath); + + if (status == SWITCH_STATUS_SUCCESS) { + char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, tmp_filepath); + mt_api_execute(session, profile->api_pref_recname_set, cmd); + } +} + +void mtvm_menu_set_password(switch_core_session_t *session, vmivr_profile_t *profile) { + char *password; + vmivr_menu_profile_t menu = { "std_set_password" }; + + password = mtvm_menu_get_input_set(session, profile, menu, "XXX." /* TODO Conf Min 3 Digit */, "#" /* TODO Conf terminate input key */); + + /* TODO Add Prompts to tell if password was set and if it was not */ + if (password) { + char *cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, profile->id, password); + mt_api_execute(session, profile->api_pref_password_set, cmd); + } + + free_profile_menu_event(&menu); +} + +void mtvm_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *profile) { + switch_channel_t *channel = switch_core_session_get_channel(session); + vmivr_menu_profile_t menu = { "std_authenticate" }; + int retry; + const char *auth_var = NULL; + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &menu); + + if (profile->id && (auth_var = switch_channel_get_variable(channel, "voicemail_authorized")) && switch_true(auth_var)) { + profile->authorized = SWITCH_TRUE; + } + + for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0 && profile->authorized == SWITCH_FALSE; retry--) { + const char *id = profile->id, *password = NULL; + char *cmd = NULL; + + if (!id) { + vmivr_menu_profile_t sub_menu = { "std_authenticate_ask_user" }; + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &sub_menu); + + id = mtvm_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */, "#" /* TODO Conf terminate input key */); + free_profile_menu_event(&sub_menu); + } + if (!password) { + vmivr_menu_profile_t sub_menu = { "std_authenticate_ask_password" }; + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &sub_menu); + + password = mtvm_menu_get_input_set(session, profile, sub_menu, "X." /* TODO Conf Min 3 Digit */, "#" /* TODO Conf terminate input key */); + free_profile_menu_event(&sub_menu); + } + cmd = switch_core_session_sprintf(session, "%s %s %s %s", profile->api_profile, profile->domain, id, password); + + if (mt_api_execute(session, profile->api_auth_login, cmd) == SWITCH_STATUS_SUCCESS) { + profile->id = id; + profile->authorized = SWITCH_TRUE; + } else { + playbackBufferDTMF(session, switch_event_get_header(menu.event_phrases, "fail_auth"), NULL, NULL, NULL, 0); + } + } + free_profile_menu_event(&menu); +} + + +void mtvm_menu_select_greeting_slot(switch_core_session_t *session, vmivr_profile_t *profile) { + vmivr_menu_profile_t menu = { "std_select_greeting_slot" }; + + const char *result; + int gnum = -1; + + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &menu); + + result = mtvm_menu_get_input_set(session, profile, menu, "X", NULL); + + if (result) + gnum = atoi(result); + if (gnum != -1) { + char * cmd = switch_core_session_sprintf(session, "%s %s %s %d", profile->api_profile, profile->domain, profile->id, gnum); + if (mt_api_execute(session, profile->api_pref_greeting_set, cmd) == SWITCH_STATUS_SUCCESS) { + char *str_num = switch_core_session_sprintf(session, "%d", gnum); + playbackBufferDTMF(session, switch_event_get_header(menu.event_phrases, "selected_slot"), str_num, NULL, NULL, 0); + } else { + playbackBufferDTMF(session, switch_event_get_header(menu.event_phrases, "invalid_slot"), NULL, NULL, NULL, 0); + } + } + free_profile_menu_event(&menu); +} + +void mtvm_menu_record_greeting_with_slot(switch_core_session_t *session, vmivr_profile_t *profile) { + + vmivr_menu_profile_t menu = { "std_record_greeting_with_slot" }; + + const char *result; + int gnum = -1; + + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &menu); + + result = mtvm_menu_get_input_set(session, profile, menu, "X", NULL); + + if (result) + gnum = atoi(result); + + /* If user entered 0, we don't accept it */ + if (gnum > 0) { + vmivr_menu_profile_t sub_menu = { "std_record_greeting" }; + char *tmp_filepath = generate_random_file_name(session, "protovm", "wav" /* TODO make it configurable */); + switch_status_t status; + + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &sub_menu); + + status = mtvm_menu_record(session, profile, sub_menu, tmp_filepath); + + if (status == SWITCH_STATUS_SUCCESS) { + char *cmd = switch_core_session_sprintf(session, "%s %s %s %d %s", profile->api_profile, profile->domain, profile->id, gnum, tmp_filepath); + char *str_num = switch_core_session_sprintf(session, "%d", gnum); + mt_api_execute(session, profile->api_pref_greeting_set, cmd); + playbackBufferDTMF(session, switch_event_get_header(menu.event_phrases, "selected_slot"), str_num, NULL, NULL, 0); + } + free_profile_menu_event(&sub_menu); + + } + + free_profile_menu_event(&menu); + +} + +void mtvm_menu_preference(switch_core_session_t *session, vmivr_profile_t *profile) { + switch_channel_t *channel = switch_core_session_get_channel(session); + + int retry; + + vmivr_menu_profile_t menu = { "std_preference" }; + + /* Initialize Menu Configs */ + populate_profile_menu_event(profile, &menu); + + if (!menu.event_keys_dtmf || !menu.event_phrases) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys\n"); + return; + } + + for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) { + dtmf_ss_t loc; + char *dtmfa[16] = { 0 }; + switch_event_t *phrase_params = NULL; + + switch_event_create(&phrase_params, SWITCH_EVENT_REQUEST_PARAMS); + append_event_profile(phrase_params, profile, menu); + + populate_dtmfa_from_event(phrase_params, profile, menu, dtmfa); + + captureMenuInitialize(&loc, dtmfa); + + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT); + + if (loc.result == RES_TIMEOUT) { + /* TODO Ask for the prompt Again IF retry != 0 */ + } else if (loc.result == RES_INVALID) { + /* TODO Say invalid option, and ask for the prompt again IF retry != 0 */ + } else if (loc.result == RES_FOUND) { /* Matching DTMF Key Pressed */ + const char *action = switch_event_get_header(menu.event_keys_dtmf, loc.dtmf_stored); + + /* Reset the try count */ + retry = MAX_ATTEMPT; + + if (action) { + if (!strcasecmp(action, "return")) { /* Return to the previous menu */ + retry = -1; + } else if (!strncasecmp(action, "menu:", 5)) { /* Sub Menu */ + void (*fPtr)(switch_core_session_t *session, vmivr_profile_t *profile) = mtvm_get_menu_function(action+5); + if (fPtr) { + fPtr(session, profile); + } + } + } + } + switch_event_destroy(&phrase_params); + } + + free_profile_menu_event(&menu); +} + +char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *input_mask, const char *terminate_key) { + char *result = NULL; + int retry; + + switch_channel_t *channel = switch_core_session_get_channel(session); + + if (!menu.event_keys_dtmf || !menu.event_phrases) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys : %s\n", menu.name); + return result; + } + + for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) { + dtmf_ss_t loc; + char *dtmfa[16] = { 0 }; + int i; + switch_event_t *phrase_params = NULL; + + switch_event_create(&phrase_params, SWITCH_EVENT_REQUEST_PARAMS); + append_event_profile(phrase_params, profile, menu); + + populate_dtmfa_from_event(phrase_params, profile, menu, dtmfa); + + /* Find the last entry and append this one to it */ + for (i=0; dtmfa[i] && i < 16; i++){ + } + dtmfa[i] = (char *) input_mask; + + captureMenuInitialize(&loc, dtmfa); + if (terminate_key) + loc.terminate_key = terminate_key[0]; /* TODO Make this load from the configuration */ + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "instructions"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT); + + if (loc.result == RES_TIMEOUT) { + /* TODO Ask for the prompt Again IF retry != 0 */ + } else if (loc.result == RES_INVALID) { + /* TODO Say invalid option, and ask for the prompt again IF retry != 0 */ + } else if (loc.result == RES_FOUND) { /* Matching DTMF Key Pressed */ + + /* Reset the try count */ + retry = MAX_ATTEMPT; + + if (!strncasecmp(loc.completeMatch, input_mask, 1)) { + result = switch_core_session_strdup(session, loc.dtmf_stored); + retry = -1; + + } + } + switch_event_destroy(&phrase_params); + } + + return result; +} + +switch_status_t mtvm_menu_record(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *file_name) { + switch_status_t status = SWITCH_STATUS_FALSE; + switch_channel_t *channel = switch_core_session_get_channel(session); + int retry; + + switch_bool_t record_prompt = SWITCH_TRUE; + switch_bool_t listen_recording = SWITCH_FALSE; + switch_bool_t play_instruction = SWITCH_TRUE; + + if (!menu.event_keys_dtmf || !menu.event_phrases) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing Menu Phrases and Keys\n"); + return status; + } + + for (retry = MAX_ATTEMPT; switch_channel_ready(channel) && retry > 0; retry--) { + dtmf_ss_t loc; + + char *dtmfa[16] = { 0 }; + switch_event_t *phrase_params = NULL; + switch_file_handle_t fh = { 0 }; + + /* TODO Make the following configurable */ + fh.thresh = 200; + fh.silence_hits = 4; + //fh.samplerate = 8000; + + + switch_event_create(&phrase_params, SWITCH_EVENT_REQUEST_PARAMS); + append_event_profile(phrase_params, profile, menu); + + populate_dtmfa_from_event(phrase_params, profile, menu, dtmfa); + + captureMenuInitialize(&loc, dtmfa); + if (record_prompt) { + if (play_instruction) { + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "instructions"), NULL, phrase_params, NULL, 0); + } + play_instruction = SWITCH_TRUE; + + captureMenuRecord(session, &loc, phrase_params, file_name, &fh, 30 /* TODO Make max recording configurable */); + } else { + if (listen_recording) { + switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Record-File-Path", "%s", file_name); + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "play_recording"), NULL, phrase_params, NULL, 0); + listen_recording = SWITCH_FALSE; + + } + captureMenu(session, &loc, switch_event_get_header(menu.event_phrases, "menu_options"), NULL, phrase_params, NULL, DEFAULT_IVR_TIMEOUT); + } + + if (loc.recorded_audio) { + /* Reset the try count */ + retry = MAX_ATTEMPT; + + /* TODO Check if message is too short */ + + record_prompt = SWITCH_FALSE; + + } else if (loc.result == RES_TIMEOUT) { + /* TODO Ask for the prompt Again IF retry != 0 */ + } else if (loc.result == RES_INVALID) { + /* TODO Say invalid option, and ask for the prompt again IF retry != 0 */ + } else if (loc.result == RES_FOUND) { /* Matching DTMF Key Pressed */ + const char *action = switch_event_get_header(menu.event_keys_dtmf, loc.dtmf_stored); + + /* Reset the try count */ + retry = MAX_ATTEMPT; + + if (action) { + if (!strcasecmp(action, "listen")) { /* Listen */ + listen_recording = SWITCH_TRUE; + + } else if (!strcasecmp(action, "save")) { + retry = -1; + /* TODO ALLOW SAVE ONLY IF FILE IS RECORDED AND HIGHER THAN MIN SIZE */ + status = SWITCH_STATUS_SUCCESS; + + } else if (!strcasecmp(action, "rerecord")) { + record_prompt = SWITCH_TRUE; + + } else if (!strcasecmp(action, "skip_instruction")) { /* Skip Recording Greeting */ + play_instruction = SWITCH_FALSE; + + } else if (!strncasecmp(action, "menu:", 5)) { /* Sub Menu */ + void (*fPtr)(switch_core_session_t *session, vmivr_profile_t *profile) = mtvm_get_menu_function(action+5); + if (fPtr) { + fPtr(session, profile); + } + } else if (!strcasecmp(action, "return")) { /* Return */ + retry = -1; + } + } + } + switch_event_destroy(&phrase_params); + } + return status; +} + + +void (*mtvm_get_menu_function(const char *menu_name))(switch_core_session_t *session, vmivr_profile_t *profile) { + int i = 0; + + if (menu_name) { + for (i=0; menu_list[i].name ; i++) { + if (!strcasecmp(menu_list[i].name, menu_name)) { + return menu_list[i].pt2Func; + } + } + } + return NULL; +} + + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 + */ diff --git a/src/mod/applications/mod_protovm/menu.h b/src/mod/applications/mod_protovm/menu.h new file mode 100644 index 0000000000..a2d8cb09f5 --- /dev/null +++ b/src/mod/applications/mod_protovm/menu.h @@ -0,0 +1,31 @@ +#ifndef _MENU_H_ +#define _MENU_H_ + +#include "config.h" + +void mtvm_menu_purge(switch_core_session_t *session, vmivr_profile_t *profile); +void mtvm_menu_authenticate(switch_core_session_t *session, vmivr_profile_t *profile); +void mtvm_menu_main(switch_core_session_t *session, vmivr_profile_t *profile); +void mtvm_menu_record_name(switch_core_session_t *session, vmivr_profile_t *profile); +void mtvm_menu_set_password(switch_core_session_t *session, vmivr_profile_t *profile); +void mtvm_menu_select_greeting_slot(switch_core_session_t *session, vmivr_profile_t *profile); +void mtvm_menu_record_greeting_with_slot(switch_core_session_t *session, vmivr_profile_t *profile); +void mtvm_menu_preference(switch_core_session_t *session, vmivr_profile_t *profile); + +switch_status_t mtvm_menu_record(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *file_name); +char *mtvm_menu_get_input_set(switch_core_session_t *session, vmivr_profile_t *profile, vmivr_menu_profile_t menu, const char *input_mask, const char *terminate_key); + + +struct vmivr_menu_function { + const char *name; + void (*pt2Func)(switch_core_session_t *session, vmivr_profile_t *profile); + +}; +typedef struct vmivr_menu_function vmivr_menu_function_t; + +extern vmivr_menu_function_t menu_list[]; + +void (*mtvm_get_menu_function(const char *menu_name))(switch_core_session_t *session, vmivr_profile_t *profile); + +#endif /* _MENU_H_ */ + diff --git a/src/mod/applications/mod_protovm/mod_protovm.c b/src/mod/applications/mod_protovm/mod_protovm.c new file mode 100644 index 0000000000..7d826e03c2 --- /dev/null +++ b/src/mod/applications/mod_protovm/mod_protovm.c @@ -0,0 +1,139 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Marc Olivier Chouinard + * + * + * mod_protovm.c -- MT VoiceMail System + * + */ +#include + +#include "config.h" +#include "menu.h" + +/* Prototypes */ +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_protovm_shutdown); +SWITCH_MODULE_RUNTIME_FUNCTION(mod_protovm_runtime); +SWITCH_MODULE_LOAD_FUNCTION(mod_protovm_load); + +/* SWITCH_MODULE_DEFINITION(name, load, shutdown, runtime) + * Defines a switch_loadable_module_function_table_t and a static const char[] modname + */ +SWITCH_MODULE_DEFINITION(mod_protovm, mod_protovm_load, mod_protovm_shutdown, NULL); + + +#define MTVM_DESC "protovm" +#define MTVM_USAGE " profile domain [id]" + +SWITCH_STANDARD_APP(protovm_function) +{ + const char *id = NULL; + const char *domain = NULL; + const char *profile_name = NULL; + vmivr_profile_t *profile = NULL; + int argc = 0; + char *argv[6] = { 0 }; + char *mydata = NULL; + + if (!zstr(data)) { + mydata = switch_core_session_strdup(session, data); + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } + + if (argv[1]) + profile_name = argv[1]; + + if (argv[2]) + domain = argv[2]; + + if (!strcasecmp(argv[0], "check")) { + if (argv[3]) + id = argv[3]; + + if (domain && profile_name) { + profile = get_profile(session, profile_name); + + if (profile) { + void (*fPtrAuth)(switch_core_session_t *session, vmivr_profile_t *profile) = mtvm_get_menu_function(profile->menu_check_auth); + void (*fPtrMain)(switch_core_session_t *session, vmivr_profile_t *profile) = mtvm_get_menu_function(profile->menu_check_main); + void (*fPtrTerminate)(switch_core_session_t *session, vmivr_profile_t *profile) = mtvm_get_menu_function(profile->menu_check_terminate); + + profile->domain = domain; + profile->id = id; + + if (fPtrAuth && !profile->authorized) { + fPtrAuth(session, profile); + } + + if (fPtrMain && profile->authorized) { + fPtrMain(session, profile); + } + if (fPtrTerminate) { + fPtrTerminate(session, profile); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' not found\n", profile_name); + } + } + } + return; +} + +/* Macro expands to: switch_status_t mod_protovm_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) */ +SWITCH_MODULE_LOAD_FUNCTION(mod_protovm_load) +{ + switch_application_interface_t *app_interface; + switch_status_t status = SWITCH_STATUS_SUCCESS; + + /* connect my internal structure to the blank pointer passed to me */ + *module_interface = switch_loadable_module_create_module_interface(pool, modname); + + SWITCH_ADD_APP(app_interface, "protovm", "protovm", MTVM_DESC, protovm_function, MTVM_USAGE, SAF_NONE); + + /* indicate that the module should continue to be loaded */ + return status; +} + +/* + Called when the system shuts down + Macro expands to: switch_status_t mod_protovm_shutdown() */ +SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_protovm_shutdown) +{ + + return SWITCH_STATUS_SUCCESS; +} + + +/* For Emacs: + * Local Variables: + * mode:c + * indent-tabs-mode:t + * tab-width:4 + * c-basic-offset:4 + * End: + * For VIM: + * vim:set softtabstop=4 shiftwidth=4 tabstop=4 + */ diff --git a/src/mod/applications/mod_protovm/protovm.conf.xml b/src/mod/applications/mod_protovm/protovm.conf.xml new file mode 100644 index 0000000000..3c42ce1faa --- /dev/null +++ b/src/mod/applications/mod_protovm/protovm.conf.xml @@ -0,0 +1,137 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/applications/mod_protovm/sounds.xml b/src/mod/applications/mod_protovm/sounds.xml new file mode 100644 index 0000000000..2fe42a40d2 --- /dev/null +++ b/src/mod/applications/mod_protovm/sounds.xml @@ -0,0 +1,375 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/applications/mod_protovm/util.c b/src/mod/applications/mod_protovm/util.c new file mode 100644 index 0000000000..476e99bd26 --- /dev/null +++ b/src/mod/applications/mod_protovm/util.c @@ -0,0 +1,175 @@ +/* + * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * Copyright (C) 2005-2011, Anthony Minessale II + * + * Version: MPL 1.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application + * + * The Initial Developer of the Original Code is + * Anthony Minessale II + * Portions created by the Initial Developer are Copyright (C) + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Marc Olivier Chouinard + * + * + * utils.c -- MT VoiceMail / Different utility that might need to go into the core (after cleanup) + * + */ +#include + +#include "util.h" + +switch_status_t mt_merge_media_files(const char** inputs, const char *output) { + switch_status_t status = SWITCH_STATUS_SUCCESS; + switch_file_handle_t fh_output = { 0 }; + int channels = 1; + int rate = 8000; /* TODO Make this configurable */ + int j = 0; + + if (switch_core_file_open(&fh_output, output, channels, rate, SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't open %s\n", output); + goto end; + } + + for (j = 0; inputs[j] != NULL && j < 128 && status == SWITCH_STATUS_SUCCESS; j++) { + switch_file_handle_t fh_input = { 0 }; + char buf[2048]; + switch_size_t len = sizeof(buf) / 2; + + if (switch_core_file_open(&fh_input, inputs[j], channels, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't open %s\n", inputs[j]); + status = SWITCH_STATUS_GENERR; + break; + } + + while (switch_core_file_read(&fh_input, buf, &len) == SWITCH_STATUS_SUCCESS) { + if (switch_core_file_write(&fh_output, buf, &len) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Write error\n"); + status = SWITCH_STATUS_GENERR; + break; + } + } + + if (fh_input.file_interface) { + switch_core_file_close(&fh_input); + } + } + + if (fh_output.file_interface) { + switch_core_file_close(&fh_output); + } +end: + return status; +} + +switch_event_t *jsonapi2event(switch_core_session_t *session, switch_event_t *apply_event, const char *api, const char *data) { + switch_event_t *phrases_event = NULL; + switch_stream_handle_t stream = { 0 }; + SWITCH_STANDARD_STREAM(stream); + switch_api_execute(api, data, session, &stream); + switch_event_create_json(&phrases_event, (char *) stream.data); + switch_safe_free(stream.data); + + if (apply_event) { + switch_event_header_t *hp; + for (hp = phrases_event->headers; hp; hp = hp->next) { + if (!strncasecmp(hp->name, "VM-", 3)) { + switch_event_add_header(apply_event, SWITCH_STACK_BOTTOM, hp->name, "%s", hp->value); + } + } + switch_event_destroy(&phrases_event); + phrases_event = apply_event; + + } + + return phrases_event; +} + +char *generate_random_file_name(switch_core_session_t *session, const char *mod_name, char *file_extension) { + char rand_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = ""; + switch_uuid_t srand_uuid; + + switch_uuid_get(&srand_uuid); + switch_uuid_format(rand_uuid, &srand_uuid); + + return switch_core_session_sprintf(session, "%s%s%s_%s.%s", SWITCH_GLOBAL_dirs.temp_dir, SWITCH_PATH_SEPARATOR, mod_name, rand_uuid, file_extension); + +} + +switch_status_t mt_api_execute(switch_core_session_t *session, const char *apiname, const char *arguments) { + switch_status_t status = SWITCH_STATUS_SUCCESS; + + switch_stream_handle_t stream = { 0 }; + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute(apiname, arguments, session, &stream); + if (!strncasecmp(stream.data, "-ERR", 4)) { + status = SWITCH_STATUS_GENERR; + } + switch_safe_free(stream.data); + return status; +} + +void append_event_profile(switch_event_t *phrase_params, vmivr_profile_t *profile, vmivr_menu_profile_t menu) { + /* Used for some appending function */ + if (profile->name && profile->id && profile->domain) { + switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Profile", "%s", profile->name); + switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Account-ID", "%s", profile->id); + switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Account-Domain", "%s", profile->domain); + } +} + +void populate_dtmfa_from_event(switch_event_t *phrase_params, vmivr_profile_t *profile, vmivr_menu_profile_t menu, char **dtmfa) { + int i = 0; + if (menu.event_keys_dtmf) { + switch_event_header_t *hp; + + for (hp = menu.event_keys_dtmf->headers; hp; hp = hp->next) { + if (strlen(hp->name) < 3 && hp->value) { /* TODO This is a hack to discard default FS Events ! */ + const char *varphrasename = switch_event_get_header(menu.event_keys_varname, hp->value); + dtmfa[i++] = hp->name; + + if (varphrasename && !zstr(varphrasename)) { + switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, varphrasename, "%s", hp->name); + } + } + } + } + +} + +void append_event_message(switch_core_session_t *session, vmivr_profile_t *profile, switch_event_t *phrase_params, switch_event_t *msg_list_event, size_t current_msg) { + + char *varname; + char *apicmd; + + varname = switch_mprintf("VM-List-Message-%" SWITCH_SIZE_T_FMT "-UUID", current_msg); + apicmd = switch_mprintf("json %s %s %s %s", profile->api_profile, profile->domain, profile->id, switch_event_get_header(msg_list_event, varname)); + + switch_safe_free(varname); + + jsonapi2event(session, phrase_params, profile->api_msg_get, apicmd); + + /* TODO Set these 2 header correctly */ + switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Message-Type", "%s", "new"); + switch_event_add_header(phrase_params, SWITCH_STACK_BOTTOM, "VM-Message-Number", "%"SWITCH_SIZE_T_FMT, current_msg); + + switch_event_add_header_string(phrase_params, SWITCH_STACK_BOTTOM, "VM-Message-Private-Local-Copy", "False"); + + switch_safe_free(apicmd); +} + diff --git a/src/mod/applications/mod_protovm/util.h b/src/mod/applications/mod_protovm/util.h new file mode 100644 index 0000000000..1c46329e18 --- /dev/null +++ b/src/mod/applications/mod_protovm/util.h @@ -0,0 +1,16 @@ +#ifndef _UTIL_H_ +#define _UTIL_H_ + +#include "config.h" + +switch_status_t mt_merge_files(const char** inputs, const char *output); + +void append_event_message(switch_core_session_t *session, vmivr_profile_t *profile, switch_event_t *phrase_params, switch_event_t *msg_list_event, size_t current_msg); +void append_event_profile(switch_event_t *phrase_params, vmivr_profile_t *profile, vmivr_menu_profile_t menu); +char *generate_random_file_name(switch_core_session_t *session, const char *mod_name, char *file_extension); +switch_event_t *jsonapi2event(switch_core_session_t *session, switch_event_t *apply_event, const char *api, const char *data); +switch_status_t mt_merge_media_files(const char** inputs, const char *output); +switch_status_t mt_api_execute(switch_core_session_t *session, const char *apiname, const char *arguments); +void populate_dtmfa_from_event(switch_event_t *phrase_params, vmivr_profile_t *profile, vmivr_menu_profile_t menu, char **dtmfa); +#endif /* _UTIL_H_ */ + From 5cc3b2e6357629fa2c9bdd85bb4e3f83663bdf2e Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 16 Apr 2011 19:11:25 -0400 Subject: [PATCH 319/558] mod_protovm: Small fix in makefile --- src/mod/applications/mod_protovm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_protovm/Makefile b/src/mod/applications/mod_protovm/Makefile index 650837295f..92f8441104 100644 --- a/src/mod/applications/mod_protovm/Makefile +++ b/src/mod/applications/mod_protovm/Makefile @@ -1,3 +1,3 @@ -BASE=/home/fs/src/fs-trunk-git/ +BASE=../../../.. LOCAL_OBJS=ivr.o util.o config.o menu.o include $(BASE)/build/modmake.rules From bef6f0f40d51e7e94c1f153f25d89d29b93f21f8 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sun, 17 Apr 2011 12:46:32 -0400 Subject: [PATCH 320/558] mod_callcenter: Add a very prototype (and maybe not functional) strategy called : sequentially-by-next-agent-order. It will try to find the last agent we tried to reach, and start calling more agent after that one based on position. It will use the level for the next agent, but once that level is done, it start back at the lowest level --- .../mod_callcenter/mod_callcenter.c | 76 ++++++++++++------- 1 file changed, 50 insertions(+), 26 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 8ab3390e67..d40ee3854f 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1995,37 +1995,61 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.record_template = queue_record_template; cbt.agent_found = SWITCH_FALSE; - if (!strcasecmp(queue->strategy, "longest-idle-agent")) { - sql_order_by = switch_mprintf("level, agents.last_offered_call, position"); - } else if (!strcasecmp(queue_strategy, "agent-with-least-talk-time")) { - sql_order_by = switch_mprintf("level, agents.talk_time, position"); - } else if (!strcasecmp(queue_strategy, "agent-with-fewest-calls")) { - sql_order_by = switch_mprintf("level, agents.calls_answered, position"); - } else if (!strcasecmp(queue_strategy, "ring-all")) { - sql = switch_mprintf("UPDATE members SET state = '%q' WHERE state = '%q' AND uuid = '%q' AND system = 'single_box'", - cc_member_state2str(CC_MEMBER_STATE_TRYING), cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt.member_uuid); - cc_execute_sql(NULL, sql, NULL); - switch_safe_free(sql); - sql_order_by = switch_mprintf("level, position"); - } else if(!strcasecmp(queue_strategy, "sequentially-by-agent-order")) { - sql_order_by = switch_mprintf("level, position, agents.last_offered_call"); /* Default to last_offered_call, let add new strategy if needing it differently */ - } else { - /* If the strategy doesn't exist, just fallback to the following */ - sql_order_by = switch_mprintf("level, position, agents.last_offered_call"); - } + if (!strcasecmp(queue->strategy, "sequentially-by-next-agent-order")) { + /* This is a quick attempt to continue to the last tried agent using the position order */ + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid, tiers.position, agents.last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + " WHERE tiers.queue = '%q'" + " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" + " AND tiers.position > (SELECT tiers.position FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) ORDER BY agents.last_offered_call WHERE tiers.queue = '%q' DESC LIMIT 1)" + " AND tiers.level = (SELECT tiers.level FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' ORDER BY agents.last_offered_call DESC LIMIT 1)" + " UNION " + "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid, tiers.position, agents.last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + " WHERE tiers.queue = '%q'" + " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" + " ORDER BY dyn_order asc, tiers.level, tiers.position, agents.last_offered_call", + queue_name, + cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), + queue_name, + queue_name, + queue_name, + cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND) + ); - sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" - " WHERE tiers.queue = '%q'" - " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" - " ORDER BY %q", - queue_name, - cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), - sql_order_by); + } else { + + if (!strcasecmp(queue->strategy, "longest-idle-agent")) { + sql_order_by = switch_mprintf("level, agents.last_offered_call, position"); + } else if (!strcasecmp(queue_strategy, "agent-with-least-talk-time")) { + sql_order_by = switch_mprintf("level, agents.talk_time, position"); + } else if (!strcasecmp(queue_strategy, "agent-with-fewest-calls")) { + sql_order_by = switch_mprintf("level, agents.calls_answered, position"); + } else if (!strcasecmp(queue_strategy, "ring-all")) { + sql = switch_mprintf("UPDATE members SET state = '%q' WHERE state = '%q' AND uuid = '%q' AND system = 'single_box'", + cc_member_state2str(CC_MEMBER_STATE_TRYING), cc_member_state2str(CC_MEMBER_STATE_WAITING), cbt.member_uuid); + cc_execute_sql(NULL, sql, NULL); + switch_safe_free(sql); + sql_order_by = switch_mprintf("level, position"); + } else if(!strcasecmp(queue_strategy, "sequentially-by-agent-order")) { + sql_order_by = switch_mprintf("level, position, agents.last_offered_call"); /* Default to last_offered_call, let add new strategy if needing it differently */ + } else { + /* If the strategy doesn't exist, just fallback to the following */ + sql_order_by = switch_mprintf("level, position, agents.last_offered_call"); + } + + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + " WHERE tiers.queue = '%q'" + " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" + " ORDER BY %q", + queue_name, + cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), + sql_order_by); + switch_safe_free(sql_order_by); + + } cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, agents_callback, &cbt /* Call back variables */); switch_safe_free(sql); - switch_safe_free(sql_order_by); /* We update a field in the queue struct so we can kick caller out if waiting for too long with no agent */ if (!cbt.queue_name || !(queue = get_queue(cbt.queue_name))) { From 0b51aca3215d2c58f2ee4f2a7dc801d6e6578d78 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 18 Apr 2011 11:17:33 +0000 Subject: [PATCH 321/558] enable optimal defaults on linux kernels that can support newer features. --- src/switch_core.c | 3 --- src/switch_time.c | 19 +++++++++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/switch_core.c b/src/switch_core.c index 1e91279091..ef5d1c497d 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1662,9 +1662,6 @@ static void switch_load_core_config(const char *file) switch_time_set_monotonic(switch_true(val)); } else if (!strcasecmp(var, "enable-softtimer-timerfd")) { switch_time_set_timerfd(switch_true(val)); - if (switch_true(val)) { - switch_clear_flag((&runtime), SCF_CALIBRATE_CLOCK); - } } else if (!strcasecmp(var, "enable-clock-nanosleep")) { switch_time_set_nanosleep(switch_true(val)); } else if (!strcasecmp(var, "enable-cond-yield")) { diff --git a/src/switch_time.c b/src/switch_time.c index d6aa8c8b08..9ec902f4d7 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -61,14 +61,20 @@ static int MONO = 1; static int MONO = 0; #endif +/* clock_nanosleep works badly on some kernels but really well on others. + timerfd seems to work well as long as it exists so if you have timerfd we'll also enable clock_nanosleep by default. +*/ #if defined(HAVE_TIMERFD_CREATE) -// We'll default this to 1 after we have had some positive feedback that it works well -static int TFD = 0; +static int TFD = 1; +#if defined(HAVE_CLOCK_NANOSLEEP) +static int NANO = 1; +#else +static int NANO = 0; +#endif #else static int TFD = 0; -#endif - static int NANO = 0; +#endif static int OFFSET = 0; @@ -326,6 +332,7 @@ SWITCH_DECLARE(void) switch_time_set_timerfd(switch_bool_t enable) #if defined(HAVE_TIMERFD_CREATE) TFD = enable ? 1 : 0; switch_time_sync(); + #else TFD = 0; #endif @@ -1116,6 +1123,10 @@ SWITCH_MODULE_LOAD_FUNCTION(softtimer_load) switch_time_set_cond_yield(SWITCH_FALSE); } + if (TFD) { + switch_clear_flag((&runtime), SCF_CALIBRATE_CLOCK); + } + if (switch_test_flag((&runtime), SCF_CALIBRATE_CLOCK)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Calibrating timer, please wait...\n"); switch_time_calibrate_clock(); From e5739b3932f6573f9c3417f24f88bdf9f4a075e9 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 18 Apr 2011 15:10:40 -0400 Subject: [PATCH 322/558] mod_callcenter: SQL error in the new proto (and might not still be working) strategy --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index d40ee3854f..dd7364eefe 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2000,7 +2000,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid, tiers.position, agents.last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" - " AND tiers.position > (SELECT tiers.position FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) ORDER BY agents.last_offered_call WHERE tiers.queue = '%q' DESC LIMIT 1)" + " AND tiers.position > (SELECT tiers.position FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' ORDER BY agents.last_offered_call DESC LIMIT 1)" " AND tiers.level = (SELECT tiers.level FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' ORDER BY agents.last_offered_call DESC LIMIT 1)" " UNION " "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid, tiers.position, agents.last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" From 0315d32076210e684f7860d0239dcb21027431db Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 18 Apr 2011 17:16:51 -0400 Subject: [PATCH 323/558] mod_callcenter: More SQL changes to make the new strategy work on postgresql --- src/mod/applications/mod_callcenter/mod_callcenter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index dd7364eefe..a752b951b6 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1997,16 +1997,16 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName if (!strcasecmp(queue->strategy, "sequentially-by-next-agent-order")) { /* This is a quick attempt to continue to the last tried agent using the position order */ - sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid, tiers.position, agents.last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level as tiers_level, agents.type, agents.uuid, tiers.position as tiers_position, agents.last_offered_call as agents_last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" " AND tiers.position > (SELECT tiers.position FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' ORDER BY agents.last_offered_call DESC LIMIT 1)" " AND tiers.level = (SELECT tiers.level FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' ORDER BY agents.last_offered_call DESC LIMIT 1)" " UNION " - "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid, tiers.position, agents.last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level as tiers_level, agents.type, agents.uuid, tiers.position as tiers_position, agents.last_offered_call as agents_last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" - " ORDER BY dyn_order asc, tiers.level, tiers.position, agents.last_offered_call", + " ORDER BY dyn_order asc, tiers_level, tiers_position, agents_last_offered_call", queue_name, cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), queue_name, From 8134712627572ffdef40d3f484797af5f254fa44 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 18 Apr 2011 18:43:24 -0700 Subject: [PATCH 324/558] mod_hash: add realm filter to hash_dump db command so that you can quickly dump all entries that belong only to a specific realm without getting the whole db --- src/mod/applications/mod_hash/mod_hash.c | 33 +++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index e3f01cec96..cfabf5477a 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -531,16 +531,33 @@ SWITCH_STANDARD_API(hash_api_function) return SWITCH_STATUS_SUCCESS; } -#define HASH_DUMP_SYNTAX "all|limit|db" +#define HASH_DUMP_SYNTAX "all|limit|db []" SWITCH_STANDARD_API(hash_dump_function) { int mode; switch_hash_index_t *hi; + int argc = 0; + char *argv[4] = { 0 }; + char *mydata = NULL; + int realm = 0; + char *realmvalue = NULL; - if (zstr(cmd)) { + if (!zstr(cmd)) { + mydata = strdup(cmd); + switch_assert(mydata); + argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + } else { + realmvalue = "test"; + realm = 0; stream->write_function(stream, "Usage: "HASH_DUMP_SYNTAX"\n"); return SWITCH_STATUS_SUCCESS; - } + } + + cmd = strdup(argv[0]); + if (argc == 2) { + realm = 1; + realmvalue = switch_mprintf("%s_", argv[1]); + } if (!strcmp(cmd, "all")) { mode = 3; @@ -553,7 +570,6 @@ SWITCH_STANDARD_API(hash_dump_function) return SWITCH_STATUS_SUCCESS; } - if (mode & 1) { switch_thread_rwlock_rdlock(globals.limit_hash_rwlock); for (hi = switch_hash_first(NULL, globals.limit_hash); hi; hi = switch_hash_next(hi)) { @@ -577,8 +593,13 @@ SWITCH_STANDARD_API(hash_dump_function) const void *key; switch_ssize_t keylen; switch_hash_this(hi, &key, &keylen, &val); - - stream->write_function(stream, "D/%s/%s\n", key, (char*)val); + if (realm) { + if (strstr(key, realmvalue)) { + stream->write_function(stream, "D/%s/%s\n", key, (char*)val); + } + } else { + stream->write_function(stream, "D/%s/%s\n", key, (char*)val); + } } switch_thread_rwlock_unlock(globals.db_hash_rwlock); } From 6432d63f00eabf16b37c129c3e3ca785f5313df2 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 18 Apr 2011 23:17:58 -0400 Subject: [PATCH 325/558] mod_callcenter: Fix an SQL param errors ! Wish the compiler catched stuff like this --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index a752b951b6..420671523c 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2384,7 +2384,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_safe_free(sql); /* Confirm we took that member in */ - sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND session_uuid = '%q' AND state = '%q' AND queue = '%q'", member_session, member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), queue_name); + sql = switch_mprintf("SELECT abandoned_epoch FROM members WHERE uuid = '%q' AND session_uuid = '%q' AND state = '%q' AND queue = '%q'", member_uuid, member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), queue_name); cc_execute_sql2str(NULL, NULL, sql, res, sizeof(res)); switch_safe_free(sql); From 2b4b23aac1ea721446e647c9053958d841ad0ec8 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Tue, 19 Apr 2011 00:21:31 -0400 Subject: [PATCH 326/558] mod_callcenter: Ok we have round-robin and random strategy... Keep them comming ;) --- src/mod/applications/mod_callcenter/mod_callcenter.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 420671523c..85ebb9614d 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1995,13 +1995,12 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.record_template = queue_record_template; cbt.agent_found = SWITCH_FALSE; - if (!strcasecmp(queue->strategy, "sequentially-by-next-agent-order")) { - /* This is a quick attempt to continue to the last tried agent using the position order */ + if (!strcasecmp(queue->strategy, "round-robin")) { sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level as tiers_level, agents.type, agents.uuid, tiers.position as tiers_position, agents.last_offered_call as agents_last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" - " AND tiers.position > (SELECT tiers.position FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' ORDER BY agents.last_offered_call DESC LIMIT 1)" - " AND tiers.level = (SELECT tiers.level FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' ORDER BY agents.last_offered_call DESC LIMIT 1)" + " AND tiers.position > (SELECT tiers.position FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' AND agents.last_offered_call > 0 ORDER BY agents.last_offered_call DESC LIMIT 1)" + " AND tiers.level = (SELECT tiers.level FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' AND agents.last_offered_call > 0 ORDER BY agents.last_offered_call DESC LIMIT 1)" " UNION " "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level as tiers_level, agents.type, agents.uuid, tiers.position as tiers_position, agents.last_offered_call as agents_last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" @@ -2029,6 +2028,8 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); sql_order_by = switch_mprintf("level, position"); + } else if(!strcasecmp(queue_strategy, "random")) { + sql_order_by = switch_mprintf("level, random()"); } else if(!strcasecmp(queue_strategy, "sequentially-by-agent-order")) { sql_order_by = switch_mprintf("level, position, agents.last_offered_call"); /* Default to last_offered_call, let add new strategy if needing it differently */ } else { From bee247ca7b2f8ccf031a39cc5ad9ea5afc2f5b9c Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Tue, 19 Apr 2011 01:25:09 -0400 Subject: [PATCH 327/558] mod_callcenter: Another strategy 'top-down' (Name might change). This will call the agent one after the other by order... And every member start at position 1. --- .../mod_callcenter/mod_callcenter.c | 61 ++++++++++++++++--- 1 file changed, 52 insertions(+), 9 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 85ebb9614d..215eaf7954 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1772,9 +1772,10 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames const char *agent_wrap_up_time = argv[11]; const char *agent_state = argv[12]; const char *agent_ready_time = argv[13]; - const char *agent_tier_level = argv[14]; - const char *agent_type = argv[15]; - const char *agent_uuid = argv[16]; + const char *agent_tier_position = argv[14]; + const char *agent_tier_level = argv[15]; + const char *agent_type = argv[16]; + const char *agent_uuid = argv[17]; switch_bool_t contact_agent = SWITCH_TRUE; @@ -1886,8 +1887,16 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames h->reject_delay_time = atoi(agent_reject_delay_time); h->busy_delay_time = atoi(agent_busy_delay_time); h->no_answer_delay_time = atoi(agent_no_answer_delay_time); - + if (!strcasecmp(cbt->strategy, "top-down")) { + switch_core_session_t *member_session = switch_core_session_locate(cbt->member_session_uuid); + if (member_session) { + switch_channel_t *member_channel = switch_core_session_get_channel(member_session); + switch_channel_set_variable(member_channel, "cc_last_agent_tier_position", agent_tier_position); + switch_channel_set_variable(member_channel, "cc_last_agent_tier_level", agent_tier_level); + switch_core_session_rwunlock(member_session); + } + } cc_agent_update("state", cc_agent_state2str(CC_AGENT_STATE_RECEIVING), h->agent_name); sql = switch_mprintf( @@ -1994,15 +2003,49 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName cbt.strategy = queue_strategy; cbt.record_template = queue_record_template; cbt.agent_found = SWITCH_FALSE; - - if (!strcasecmp(queue->strategy, "round-robin")) { - sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level as tiers_level, agents.type, agents.uuid, tiers.position as tiers_position, agents.last_offered_call as agents_last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + + if (!strcasecmp(queue->strategy, "top-down")) { + /* WARNING this use channel variable to help dispatch... might need to be reviewed to save it in DB to make this multi server prooft in the future */ + switch_core_session_t *member_session = switch_core_session_locate(cbt.member_session_uuid); + int position = 0, level = 0; + const char *last_agent_tier_position, *last_agent_tier_level; + if (member_session) { + switch_channel_t *member_channel = switch_core_session_get_channel(member_session); + + if ((last_agent_tier_position = switch_channel_get_variable(member_channel, "cc_last_agent_tier_position"))) { + position = atoi(last_agent_tier_position); + } + if ((last_agent_tier_level = switch_channel_get_variable(member_channel, "cc_last_agent_tier_level"))) { + position = atoi(last_agent_tier_level); + } + switch_core_session_rwunlock(member_session); + } + + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.position as tiers_position, tiers.level as tiers_level, agents.type, agents.uuid, agents.last_offered_call as agents_last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + " WHERE tiers.queue = '%q'" + " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" + " AND tiers.position > %d" + " AND tiers.level = %d" + " UNION " + "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.position as tiers_position, tiers.level as tiers_level, agents.type, agents.uuid, agents.last_offered_call as agents_last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + " WHERE tiers.queue = '%q'" + " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" + " ORDER BY dyn_order asc, tiers_level, tiers_position, agents_last_offered_call", + queue_name, + cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND), + position, + level, + queue_name, + cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE), cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), cc_agent_status2str(CC_AGENT_STATUS_AVAILABLE_ON_DEMAND) + ); + } else if (!strcasecmp(queue->strategy, "round-robin")) { + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.position as tiers_position, tiers.level as tiers_level, agents.type, agents.uuid, agents.last_offered_call as agents_last_offered_call, 1 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" " AND tiers.position > (SELECT tiers.position FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' AND agents.last_offered_call > 0 ORDER BY agents.last_offered_call DESC LIMIT 1)" " AND tiers.level = (SELECT tiers.level FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent) WHERE tiers.queue = '%q' AND agents.last_offered_call > 0 ORDER BY agents.last_offered_call DESC LIMIT 1)" " UNION " - "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level as tiers_level, agents.type, agents.uuid, tiers.position as tiers_position, agents.last_offered_call as agents_last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + "SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.position as tiers_position, tiers.level as tiers_level, agents.type, agents.uuid, agents.last_offered_call as agents_last_offered_call, 2 as dyn_order FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" " ORDER BY dyn_order asc, tiers_level, tiers_position, agents_last_offered_call", @@ -2037,7 +2080,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName sql_order_by = switch_mprintf("level, position, agents.last_offered_call"); } - sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.level, agents.type, agents.uuid FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" + sql = switch_mprintf("SELECT system, name, status, contact, no_answer_count, max_no_answer, reject_delay_time, busy_delay_time, no_answer_delay_time, tiers.state, agents.last_bridge_end, agents.wrap_up_time, agents.state, agents.ready_time, tiers.position, tiers.level, agents.type, agents.uuid FROM agents LEFT JOIN tiers ON (agents.name = tiers.agent)" " WHERE tiers.queue = '%q'" " AND (agents.status = '%q' OR agents.status = '%q' OR agents.status = '%q')" " ORDER BY %q", From f17e96263623f82533f150c658d43a7ecaae4b06 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Tue, 19 Apr 2011 03:05:32 -0400 Subject: [PATCH 328/558] mod_callcenter: Small fix for strategy top-down --- src/mod/applications/mod_callcenter/mod_callcenter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 215eaf7954..0810abb49b 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2016,7 +2016,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName position = atoi(last_agent_tier_position); } if ((last_agent_tier_level = switch_channel_get_variable(member_channel, "cc_last_agent_tier_level"))) { - position = atoi(last_agent_tier_level); + level = atoi(last_agent_tier_level); } switch_core_session_rwunlock(member_session); } From c8a257dde232ff3f26cb4c514c2f918e09e5bfc8 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 10:09:55 -0500 Subject: [PATCH 329/558] FS-3213 please try this patch --- .../applications/mod_spandsp/mod_spandsp_fax.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 4dd936b8c6..b43dd05599 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -446,14 +446,15 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin /* we need to build a real packet here and make write_frame.packet and write_frame.packetlen point to it */ out_frame.flags = SFF_UDPTL_PACKET | SFF_PROXY_PACKET; out_frame.packet = pkt; - out_frame.packetlen = udptl_build_packet(pvt->udptl_state, pkt, buf, len); - - //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "WRITE %d udptl bytes\n", out_frame.packetlen); + if ((r = udptl_build_packet(pvt->udptl_state, pkt, buf, len)) > 0) { + out_frame.packetlen = r; + //switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "WRITE %d udptl bytes\n", out_frame.packetlen); - for (x = 0; x < count; x++) { - if (switch_core_session_write_frame(session, &out_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { - r = -1; - break; + for (x = 0; x < count; x++) { + if (switch_core_session_write_frame(session, &out_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + r = -1; + break; + } } } From fe3c4e900f8833cf3c3f232250497330f268351b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 10:21:16 -0500 Subject: [PATCH 330/558] update log --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index b43dd05599..1ea2fd790f 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -456,6 +456,8 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin break; } } + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID PACKETLEN: %d PASSED: %d:%d\n", r, len, count); } return r; From 6fa64e30db9d91b781fbabb8326885e33d998417 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 10:31:19 -0500 Subject: [PATCH 331/558] use queued sql for core registration handling --- src/switch_core_sqldb.c | 41 +++++++---------------------------------- 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index a1baa9e2c5..106c7b0599 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1642,18 +1642,12 @@ static char create_registrations_sql[] = SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, const char *realm, const char *token, const char *url, uint32_t expires, const char *network_ip, const char *network_port, const char *network_proto) { - switch_cache_db_handle_t *dbh; char *sql; if (!switch_test_flag((&runtime), SCF_USE_SQL)) { return SWITCH_STATUS_FALSE; } - if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB!\n"); - return SWITCH_STATUS_FALSE; - } - if (runtime.multiple_registrations) { sql = switch_mprintf("delete from registrations where hostname='%q' and (url='%q' or token='%q')", switch_core_get_hostname(), url, switch_str_nil(token)); @@ -1662,9 +1656,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c user, realm, switch_core_get_hostname()); } - switch_cache_db_execute_sql(dbh, sql, NULL); - free(sql); - + switch_queue_push(sql_manager.sql_queue[0], sql); + sql = switch_mprintf("insert into registrations (reg_user,realm,token,url,expires,network_ip,network_port,network_proto,hostname) " "values ('%q','%q','%q','%q',%ld,'%q','%q','%q','%q')", switch_str_nil(user), @@ -1677,40 +1670,29 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c switch_str_nil(network_proto), switch_core_get_hostname() ); + + + switch_queue_push(sql_manager.sql_queue[0], sql); - switch_cache_db_execute_sql(dbh, sql, NULL); - switch_cache_db_release_db_handle(&dbh); - - free(sql); - return SWITCH_STATUS_SUCCESS; } SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, const char *realm, const char *token) { - switch_cache_db_handle_t *dbh; char *sql; if (!switch_test_flag((&runtime), SCF_USE_SQL)) { return SWITCH_STATUS_FALSE; } - if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB!\n"); - return SWITCH_STATUS_FALSE; - } - if (!zstr(token) && runtime.multiple_registrations) { sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q' and token='%q'", user, realm, switch_core_get_hostname(), token); } else { sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", user, realm, switch_core_get_hostname()); } - switch_cache_db_execute_sql(dbh, sql, NULL); - switch_cache_db_release_db_handle(&dbh); - - free(sql); + switch_queue_push(sql_manager.sql_queue[0], sql); return SWITCH_STATUS_SUCCESS; } @@ -1718,7 +1700,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force) { - switch_cache_db_handle_t *dbh; char *sql; time_t now; @@ -1726,11 +1707,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force) return SWITCH_STATUS_FALSE; } - if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB!\n"); - return SWITCH_STATUS_FALSE; - } - now = switch_epoch_time_now(NULL); if (force) { @@ -1739,10 +1715,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force) sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_hostname()); } - switch_cache_db_execute_sql(dbh, sql, NULL); - switch_cache_db_release_db_handle(&dbh); - - free(sql); + switch_queue_push(sql_manager.sql_queue[0], sql); return SWITCH_STATUS_SUCCESS; From 9227b538723038f694ca121c382ecf1319f85331 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 10:50:09 -0500 Subject: [PATCH 332/558] FS-3252 try latest patch with new option to set sip_execute_on_image to 't38_gateway self nocng' this should skip the tone detection adn go right into the gateway mode so you should be able to do only this and have it work based on remote re-invite --- .../applications/mod_spandsp/mod_spandsp.c | 39 ++++++++++++------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index d9b9ff084a..ecb660eabb 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -80,23 +80,34 @@ SWITCH_STANDARD_APP(t38_gateway_function) switch_channel_t *channel = switch_core_session_get_channel(session); time_t timeout = switch_epoch_time_now(NULL) + 20; const char *var; + int argc = 0; + char *argv[2] = { 0 }; + char *dupdata; + const char *direction = argv[0], *flags = argv[1]; + + dupdata = switch_core_session_strdup(session, data); + argc = switch_split(dupdata, ' ', argv); - if (zstr(data) || strcasecmp(data, "self")) { - data = "peer"; - } - - switch_channel_set_variable(channel, "t38_leg", data); - - if ((var = switch_channel_get_variable(channel, "t38_gateway_detect_timeout"))) { - long to = atol(var); - if (to > -1) { - timeout = (time_t) (switch_epoch_time_now(NULL) + to); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s invalid timeout value.\n", switch_channel_get_name(channel)); - } + if (zstr(direction) || strcasecmp(direction, "self")) { + direction = "peer"; } - switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, data, NULL, t38_gateway_start); + switch_channel_set_variable(channel, "t38_leg", direction); + + if (!zstr(flags) && !strcasecmp(flags, "nocng")) { + t38_gateway_start(session, direction, NULL); + } else { + if ((var = switch_channel_get_variable(channel, "t38_gateway_detect_timeout"))) { + long to = atol(var); + if (to > -1) { + timeout = (time_t) (switch_epoch_time_now(NULL) + to); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s invalid timeout value.\n", switch_channel_get_name(channel)); + } + } + + switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start); + } } /** From 7fe313cf3dfe6a85c199a622b8a017084109a757 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 13:29:42 -0500 Subject: [PATCH 333/558] FS-3252 additional fix to this bug and add better fax detect code to mod_spandsp --- .../applications/mod_spandsp/mod_spandsp.c | 59 ++++- .../applications/mod_spandsp/mod_spandsp.h | 6 + .../mod_spandsp/mod_spandsp_fax.c | 244 ++++++++++++++++++ 3 files changed, 305 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.c b/src/mod/applications/mod_spandsp/mod_spandsp.c index ecb660eabb..fd2ac7f947 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp.c @@ -70,11 +70,46 @@ SWITCH_STANDARD_APP(stop_dtmf_session_function) spandsp_stop_inband_dtmf_session(session); } + +SWITCH_STANDARD_APP(spandsp_fax_detect_session_function) +{ + int argc = 0; + char *argv[3] = { 0 }; + char *dupdata; + const char *app = NULL, *arg = NULL; + int timeout = 0; + + if (!zstr(data) && (dupdata = switch_core_session_strdup(session, data))) { + if ((argc = switch_split(dupdata, ' ', argv)) == 3) { + app = argv[0]; + arg = argv[1]; + timeout = atoi(argv[2]); + if (timeout < 0) { + timeout = 0; + } + } + } + + if (app) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Enabling fax detection '%s' '%s'\n", argv[0], argv[1]); + spandsp_fax_detect_session(session, "rw", timeout, 1, app, arg, NULL); + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Cannot Enable fax detection '%s' '%s'\n", argv[0], argv[1]); + } +} + +SWITCH_STANDARD_APP(spandsp_stop_fax_detect_session_function) +{ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_NOTICE, "Disabling fax detection\n"); + spandsp_fax_stop_detect_session(session); +} + static void event_handler(switch_event_t *event) { mod_spandsp_fax_event_handler(event); } + SWITCH_STANDARD_APP(t38_gateway_function) { switch_channel_t *channel = switch_core_session_get_channel(session); @@ -83,10 +118,19 @@ SWITCH_STANDARD_APP(t38_gateway_function) int argc = 0; char *argv[2] = { 0 }; char *dupdata; - const char *direction = argv[0], *flags = argv[1]; + const char *direction = NULL, *flags = NULL; - dupdata = switch_core_session_strdup(session, data); - argc = switch_split(dupdata, ' ', argv); + if (!zstr(data) && (dupdata = switch_core_session_strdup(session, data))) { + if ((argc = switch_split(dupdata, ' ', argv))) { + if (argc > 0) { + direction = argv[0]; + } + + if (argc > 1) { + flags = argv[1]; + } + } + } if (zstr(direction) || strcasecmp(direction, "self")) { direction = "peer"; @@ -106,7 +150,8 @@ SWITCH_STANDARD_APP(t38_gateway_function) } } - switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start); + //switch_ivr_tone_detect_session(session, "t38", "1100.0", "rw", timeout, 1, direction, NULL, t38_gateway_start); + spandsp_fax_detect_session(session, "rw", timeout, 1, direction, NULL, t38_gateway_start); } } @@ -209,6 +254,12 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spandsp_init) SWITCH_ADD_APP(app_interface, "spandsp_stop_dtmf", "stop inband dtmf", "Stop detecting inband dtmf.", stop_dtmf_session_function, "", SAF_NONE); SWITCH_ADD_APP(app_interface, "spandsp_start_dtmf", "Detect dtmf", "Detect inband dtmf on the session", dtmf_session_function, "", SAF_MEDIA_TAP); + SWITCH_ADD_APP(app_interface, "spandsp_start_fax_detect", "start fax detect", "start fax detect", spandsp_fax_detect_session_function, + "[ ][ ]", SAF_NONE); + + SWITCH_ADD_APP(app_interface, "spandsp_stop_fax_detect", "stop fax detect", "stop fax detect", spandsp_stop_fax_detect_session_function, "", SAF_NONE); + + mod_spandsp_fax_load(pool); mod_spandsp_codecs_load(module_interface, pool); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 09e816627a..7b94b55062 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -68,3 +68,9 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session); switch_status_t callprogress_detector_start(switch_core_session_t *session, const char *name); switch_status_t callprogress_detector_stop(switch_core_session_t *session); + +SWITCH_DECLARE(switch_status_t) spandsp_fax_detect_session(switch_core_session_t *session, + const char *flags, time_t timeout, + int hits, const char *app, const char *data, switch_tone_detect_callback_t callback); + +SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_session_t *session); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 1ea2fd790f..620971b307 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1806,6 +1806,250 @@ switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, return SWITCH_FALSE; } +typedef struct { + char *app; + char *data; + char *key; + int up; + int total_hits; + int hits; + int sleep; + int expires; + int default_sleep; + int default_expires; + switch_tone_detect_callback_t callback; + modem_connect_tones_rx_state_t rx_tones; + + switch_media_bug_t *bug; + switch_core_session_t *session; + int bug_running; + +} spandsp_fax_tone_container_t; + +static switch_status_t tone_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + spandsp_fax_tone_container_t *cont = switch_channel_get_private(channel, "_fax_tone_detect_"); + + + if (!cont || dtmf->digit != 'f') { + return SWITCH_STATUS_SUCCESS; + } + + if (cont->callback) { + cont->callback(cont->session, cont->app, cont->data); + } else { + switch_channel_execute_on(switch_core_session_get_channel(cont->session), "execute_on_fax_detect"); + if (cont->app) { + switch_core_session_execute_application_async(cont->session, cont->app, cont->data); + } + } + + return SWITCH_STATUS_SUCCESS; + +} + + +static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_data, switch_abc_type_t type) +{ + spandsp_fax_tone_container_t *cont = (spandsp_fax_tone_container_t *) user_data; + switch_frame_t *frame = NULL; + switch_bool_t rval = SWITCH_TRUE; + + switch (type) { + case SWITCH_ABC_TYPE_INIT: + if (cont) { + cont->bug_running = 1; + modem_connect_tones_rx_init(&cont->rx_tones, MODEM_CONNECT_TONES_FAX_CED_OR_PREAMBLE, NULL, NULL); + } + break; + case SWITCH_ABC_TYPE_CLOSE: + break; + case SWITCH_ABC_TYPE_READ_REPLACE: + case SWITCH_ABC_TYPE_WRITE_REPLACE: + { + int skip = 0; + + if (type == SWITCH_ABC_TYPE_READ_REPLACE) { + frame = switch_core_media_bug_get_read_replace_frame(bug); + } else { + frame = switch_core_media_bug_get_write_replace_frame(bug); + } + + if (cont->sleep) { + cont->sleep--; + if (cont->sleep) { + skip = 1; + } + } + + if (cont->expires) { + cont->expires--; + if (!cont->expires) { + cont->hits = 0; + cont->sleep = 0; + cont->expires = 0; + } + } + + if (!cont->up) { + skip = 1; + } + + if (skip) { + return SWITCH_TRUE; + } + + cont->hits = 0; + modem_connect_tones_rx(&cont->rx_tones, frame->data, frame->samples); + cont->hits = modem_connect_tones_rx_get(&cont->rx_tones); + + if (cont->hits) { + switch_event_t *event; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_DEBUG, + "Fax Tone Detected. [%s][%s]\n", cont->app, switch_str_nil(cont->data)); + + if (cont->callback) { + cont->callback(cont->session, cont->app, cont->data); + } else { + switch_channel_execute_on(switch_core_session_get_channel(cont->session), "execute_on_fax_detect"); + if (cont->app) { + switch_core_session_execute_application_async(cont->session, cont->app, cont->data); + } + } + + + if (switch_event_create(&event, SWITCH_EVENT_DETECTED_TONE) == SWITCH_STATUS_SUCCESS) { + switch_event_t *dup; + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Detected-Fax-Tone", "true"); + + if (switch_event_dup(&dup, event) == SWITCH_STATUS_SUCCESS) { + switch_event_fire(&dup); + } + + if (switch_core_session_queue_event(cont->session, &event) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(switch_core_media_bug_get_session(bug)), SWITCH_LOG_ERROR, + "Event queue failed!\n"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true"); + switch_event_fire(&event); + } + } + + rval = SWITCH_FALSE; + } + + } + break; + case SWITCH_ABC_TYPE_WRITE: + default: + break; + } + + if (rval == SWITCH_FALSE) { + cont->bug_running = 0; + } + + return rval; +} + +SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_session_t *session) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + spandsp_fax_tone_container_t *cont = switch_channel_get_private(channel, "_fax_tone_detect_"); + + if (cont) { + switch_channel_set_private(channel, "_fax_tone_detect_", NULL); + cont->up = 0; + switch_core_media_bug_remove(session, &cont->bug); + return SWITCH_STATUS_SUCCESS; + } + return SWITCH_STATUS_FALSE; +} + +SWITCH_DECLARE(switch_status_t) spandsp_fax_detect_session(switch_core_session_t *session, + const char *flags, time_t timeout, + int hits, const char *app, const char *data, switch_tone_detect_callback_t callback) +{ + switch_channel_t *channel = switch_core_session_get_channel(session); + switch_status_t status; + spandsp_fax_tone_container_t *cont = switch_channel_get_private(channel, "_fax_tone_detect_"); + switch_media_bug_flag_t bflags = 0; + const char *var; + switch_codec_implementation_t read_impl = { 0 }; + switch_core_session_get_read_impl(session, &read_impl); + + if (cont) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Max Tones Reached!\n"); + return SWITCH_STATUS_FALSE; + } + + if (!cont && !(cont = switch_core_session_alloc(session, sizeof(*cont)))) { + return SWITCH_STATUS_MEMERR; + } + + if (app) { + cont->app = switch_core_session_strdup(session, app); + } + + if (data) { + cont->data = switch_core_session_strdup(session, data); + } + + cont->callback = callback; + cont->up = 1; + cont->session = session; + + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { + return SWITCH_STATUS_FALSE; + } + + cont->default_sleep = 25; + cont->default_expires = 250; + + if ((var = switch_channel_get_variable(channel, "fax_tone_detect_sleep"))) { + int tmp = atoi(var); + if (tmp > 0) { + cont->default_sleep = tmp; + } + } + + if ((var = switch_channel_get_variable(channel, "fax_tone_detect_expires"))) { + int tmp = atoi(var); + if (tmp > 0) { + cont->default_expires = tmp; + } + } + + if (zstr(flags)) { + bflags = SMBF_READ_REPLACE; + } else { + if (strchr(flags, 'r')) { + bflags |= SMBF_READ_REPLACE; + } else if (strchr(flags, 'w')) { + bflags |= SMBF_WRITE_REPLACE; + } + } + + bflags |= SMBF_NO_PAUSE; + + + switch_core_event_hook_add_send_dtmf(session, tone_on_dtmf); + switch_core_event_hook_add_recv_dtmf(session, tone_on_dtmf); + + + if ((status = switch_core_media_bug_add(session, "fax_tone_detect", "", + tone_detect_callback, cont, timeout, bflags, &cont->bug)) != SWITCH_STATUS_SUCCESS) { + cont->bug_running = 0; + return status; + } + + switch_channel_set_private(channel, "_fax_tone_detect_", cont); + + return SWITCH_STATUS_SUCCESS; +} + + /* For Emacs: From 7d8f848117abc165a4ef2b97c2a7c4574c84649c Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 13:51:08 -0500 Subject: [PATCH 334/558] adding fix that was reported on the mailing list and thoughtlessly left there to rot despite my begging them to open a JIRA --- src/switch_core_codec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_core_codec.c b/src/switch_core_codec.c index 96f8d57726..feaca4b7ed 100644 --- a/src/switch_core_codec.c +++ b/src/switch_core_codec.c @@ -658,7 +658,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_decode(switch_codec_t *codec, if (frames && codec->implementation->decoded_bytes_per_packet * frames > *decoded_data_len) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Buffer size sanity check failed!\n"); - return SWITCH_STATUS_GENERR; + *decoded_data_len = codec->implementation->decoded_bytes_per_packet; + memset(decoded_data, 255, *decoded_data_len); + return SWITCH_STATUS_SUCCESS; } } From 414c4d4aeaf8393ab053c6c81beac9a1dc66fa08 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 19 Apr 2011 14:19:49 -0500 Subject: [PATCH 335/558] windows build fix for last commit --- src/mod/applications/mod_spandsp/mod_spandsp.h | 4 ++-- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp.h b/src/mod/applications/mod_spandsp/mod_spandsp.h index 7b94b55062..21de3fa22b 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp.h +++ b/src/mod/applications/mod_spandsp/mod_spandsp.h @@ -69,8 +69,8 @@ switch_status_t spandsp_inband_dtmf_session(switch_core_session_t *session); switch_status_t callprogress_detector_start(switch_core_session_t *session, const char *name); switch_status_t callprogress_detector_stop(switch_core_session_t *session); -SWITCH_DECLARE(switch_status_t) spandsp_fax_detect_session(switch_core_session_t *session, +switch_status_t spandsp_fax_detect_session(switch_core_session_t *session, const char *flags, time_t timeout, int hits, const char *app, const char *data, switch_tone_detect_callback_t callback); -SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_session_t *session); +switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 620971b307..8dfdd07272 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1953,7 +1953,7 @@ static switch_bool_t tone_detect_callback(switch_media_bug_t *bug, void *user_da return rval; } -SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_session_t *session) +switch_status_t spandsp_fax_stop_detect_session(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); spandsp_fax_tone_container_t *cont = switch_channel_get_private(channel, "_fax_tone_detect_"); @@ -1967,7 +1967,7 @@ SWITCH_DECLARE(switch_status_t) spandsp_fax_stop_detect_session(switch_core_sess return SWITCH_STATUS_FALSE; } -SWITCH_DECLARE(switch_status_t) spandsp_fax_detect_session(switch_core_session_t *session, +switch_status_t spandsp_fax_detect_session(switch_core_session_t *session, const char *flags, time_t timeout, int hits, const char *app, const char *data, switch_tone_detect_callback_t callback) { From 973a850dbb14607505e7bdeee81157c2c46e7429 Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Tue, 19 Apr 2011 14:20:28 -0500 Subject: [PATCH 336/558] Lower NAT port mapping disabled log msg from WARNING to INFO --- src/switch_nat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_nat.c b/src/switch_nat.c index e9d4b2b9ca..ebea68e7cb 100644 --- a/src/switch_nat.c +++ b/src/switch_nat.c @@ -586,7 +586,7 @@ SWITCH_DECLARE(switch_status_t) switch_nat_add_mapping_internal(switch_port_t po switch_event_t *event = NULL; if (!nat_globals.mapping) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "NAT port mapping disabled\n"); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "NAT port mapping disabled\n"); return status; } From 4f5d273e2354d8642567d222cb69b0a8146934e9 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 14:03:29 -0500 Subject: [PATCH 337/558] FS-3213 another update --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 8dfdd07272..1d260f3098 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -459,6 +459,15 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID PACKETLEN: %d PASSED: %d:%d\n", r, len, count); } + + if (r < 0) { + t30_state_t *t30; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TERMINATING T30 STATE\n"); + if (pvt->t38_state && (t30 = t38_terminal_get_t30_state(pvt->t38_state))) { + t30_terminate(t30); + } + } + return r; } From 82e3ccf8e6c58f220bb34a96b7e1028bef8f5123 Mon Sep 17 00:00:00 2001 From: Raymond Chandler Date: Tue, 19 Apr 2011 15:44:09 -0400 Subject: [PATCH 338/558] don't add routes that have no rate of the desired type --- src/mod/applications/mod_lcr/mod_lcr.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index 93f9c9617d..ac5d90871e 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -133,7 +133,7 @@ struct callback_obj { profile_t *profile; switch_core_session_t *session; switch_event_t *event; - float sell_rate; + float max_rate; }; typedef struct callback_obj callback_t; @@ -622,6 +622,9 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa } else if (CF("lcr_carrier_name")) { additional->carrier_name = switch_core_strdup(pool, switch_str_nil(argv[i])); } else if (CF("lcr_rate_field")) { + if (!argv[i] || zstr(argv[i])) { + goto end; + } additional->rate = (float)atof(switch_str_nil(argv[i])); additional->rate_str = switch_core_sprintf(pool, "%0.5f", additional->rate); } else if (CF("lcr_gw_prefix")) { @@ -669,10 +672,12 @@ static int route_add_callback(void *pArg, int argc, char **argv, char **columnNa for (current = cbt->head; current; current = current->next) { - if (cbt->sell_rate && cbt->sell_rate > current->rate) { - continue; + if (cbt->max_rate && (cbt->max_rate < additional->rate)) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Skipping [%s] because [%f] is higher than the max_rate of [%f]\n", + additional->carrier_name, additional->rate, cbt->max_rate); + break; } - + key = switch_core_sprintf(pool, "%s:%s", additional->gw_prefix, additional->gw_suffix); if (switch_core_hash_find(cbt->dedup_hash, key)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, @@ -852,9 +857,9 @@ static switch_status_t lcr_do_lookup(callback_t *cb_struct) if (cb_struct->session) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(cb_struct->session), SWITCH_LOG_DEBUG, "we have a session\n"); if ((channel = switch_core_session_get_channel(cb_struct->session))) { - const char *sell_rate = switch_channel_get_variable(channel, "sell_rate"); - if (!zstr(sell_rate)) { - cb_struct->sell_rate = atof(sell_rate); + const char *max_rate = switch_channel_get_variable(channel, "max_rate"); + if (!zstr(max_rate)) { + cb_struct->max_rate = atof(max_rate); } switch_channel_set_variable_var_check(channel, "lcr_rate_field", rate_field, SWITCH_FALSE); switch_channel_set_variable_var_check(channel, "lcr_user_rate_field", user_rate_field, SWITCH_FALSE); From 1781ac884fae914db43ec04009005c72e0e77513 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Tue, 19 Apr 2011 17:52:45 -0700 Subject: [PATCH 339/558] Update phrase_en; add lang/en/ivr/sounds.xml for general phrase macros --- conf/lang/en/ivr/sounds.xml | 11 +++++++++++ docs/phrase/phrase_en.xml | 5 ++++- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 conf/lang/en/ivr/sounds.xml diff --git a/conf/lang/en/ivr/sounds.xml b/conf/lang/en/ivr/sounds.xml new file mode 100644 index 0000000000..58db0a6c15 --- /dev/null +++ b/conf/lang/en/ivr/sounds.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 34901054e9..30d642460f 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -437,7 +437,10 @@ - + + + + From 835860e79f62c005eb84fea3ac1dae306a53bc01 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 19 Apr 2011 15:59:53 -0500 Subject: [PATCH 340/558] reverse --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 1d260f3098..95eefd5c74 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1784,8 +1784,8 @@ switch_bool_t t38_gateway_start(switch_core_session_t *session, const char *app, switch_channel_set_variable(channel, "t38_peer", switch_core_session_get_uuid(other_session)); switch_channel_set_variable(other_channel, "t38_peer", switch_core_session_get_uuid(session)); - switch_channel_set_variable(peer ? other_channel : channel, "t38_gateway_format", "audio"); - switch_channel_set_variable(peer ? channel : other_channel, "t38_gateway_format", "udptl"); + switch_channel_set_variable(peer ? other_channel : channel, "t38_gateway_format", "udptl"); + switch_channel_set_variable(peer ? channel : other_channel, "t38_gateway_format", "audio"); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s starting gateway mode to %s\n", From 28738b062916a7d08eee17c901cfffb3852628e0 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 19 Apr 2011 23:02:51 -0500 Subject: [PATCH 341/558] FS-3001 --resolve --- conf/autoload_configs/cepstral.conf.xml | 12 +++++ src/mod/asr_tts/mod_cepstral/mod_cepstral.c | 56 ++++++++++++++++++++- 2 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 conf/autoload_configs/cepstral.conf.xml diff --git a/conf/autoload_configs/cepstral.conf.xml b/conf/autoload_configs/cepstral.conf.xml new file mode 100644 index 0000000000..cf4aa92f41 --- /dev/null +++ b/conf/autoload_configs/cepstral.conf.xml @@ -0,0 +1,12 @@ + + + + + + \ No newline at end of file diff --git a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c index 432a0b7c99..63ed2a23d9 100644 --- a/src/mod/asr_tts/mod_cepstral/mod_cepstral.c +++ b/src/mod/asr_tts/mod_cepstral/mod_cepstral.c @@ -65,6 +65,14 @@ typedef struct { } cepstral_t; +static struct { + char *encoding; +} globals; + +SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_encoding, globals.encoding); + + + /* This callback caches the audio in the buffer */ static swift_result_t write_audio(swift_event * event, swift_event_t type, void *udata) { @@ -223,7 +231,7 @@ static switch_status_t cepstral_speech_feed_tts(switch_speech_handle_t *sh, char if (zstr(text)) { return SWITCH_STATUS_FALSE; } - swift_port_speak_file(cepstral->port, text, NULL, &cepstral->tts_stream, NULL); + swift_port_speak_file(cepstral->port, text, globals.encoding, &cepstral->tts_stream, NULL); } else { char *to_say; if (zstr(text)) { @@ -231,7 +239,7 @@ static switch_status_t cepstral_speech_feed_tts(switch_speech_handle_t *sh, char } if ((to_say = switch_mprintf(" %s ", text))) { - swift_port_speak_text(cepstral->port, to_say, 0, NULL, &cepstral->tts_stream, NULL); + swift_port_speak_text(cepstral->port, to_say, 0, globals.encoding, &cepstral->tts_stream, NULL); switch_safe_free(to_say); } } @@ -401,10 +409,54 @@ static void cepstral_float_param_tts(switch_speech_handle_t *sh, char *param, do } +static switch_status_t load_config(void) +{ + char *cf = "cepstral.conf"; + switch_xml_t cfg, xml = NULL, param, settings; + + /* Init to SWIFT default encoding */ + set_global_encoding(SWIFT_DEFAULT_ENCODING); + + if (xml = switch_xml_open_cfg(cf, &cfg, NULL)) { + if ((settings = switch_xml_child(cfg, "settings"))) { + for (param = switch_xml_child(settings, "param"); param; param = param->next) { + char *var = (char *) switch_xml_attr_soft(param, "name"); + char *val = (char *) switch_xml_attr_soft(param, "value"); + if (!strcasecmp(var, "encoding")) { + if (!strcasecmp(val, "utf-8")) { + set_global_encoding(SWIFT_UTF8); + } else if (!strcasecmp(val, "us-ascii")) { + set_global_encoding(SWIFT_ASCII); + } else if (!strcasecmp(val, "iso8859-1")) { + set_global_encoding(SWIFT_ISO_8859_1); + } else if (!strcasecmp(val, "iso8859-15")) { + set_global_encoding(SWIFT_ISO_8859_15); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unknown value \"%s\" for param \"%s\". Setting to default.\n", val, var); + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Param \"%s\" unknown\n", var); + } + } + } + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Open of \"%s\" failed. Using default settings.\n", cf); + } + + if (xml) { + switch_xml_free(xml); + } + + return SWITCH_STATUS_SUCCESS; +} + SWITCH_MODULE_LOAD_FUNCTION(mod_cepstral_load) { switch_speech_interface_t *speech_interface; + memset(&globals, 0, sizeof(globals)); + load_config(); + /* Open the Swift TTS Engine */ if (!(engine = swift_engine_open(NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to open Swift Engine."); From b0a23f8e64e14e8a5c0a4e35dc10916b5b439e85 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 20 Apr 2011 03:32:03 -0500 Subject: [PATCH 342/558] skypopen: OSS driver, refinement --- src/mod/endpoints/mod_skypopen/oss/Makefile | 2 +- src/mod/endpoints/mod_skypopen/oss/main.c | 64 +++---------------- src/mod/endpoints/mod_skypopen/oss/skypopen.h | 27 +++----- 3 files changed, 17 insertions(+), 76 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/oss/Makefile b/src/mod/endpoints/mod_skypopen/oss/Makefile index 8df20f68c5..40b25f0e25 100644 --- a/src/mod/endpoints/mod_skypopen/oss/Makefile +++ b/src/mod/endpoints/mod_skypopen/oss/Makefile @@ -1,6 +1,6 @@ # Comment/uncomment the following line to disable/enable debugging #DEBUG = y -#LDDINC=/usr/src/linux-headers-2.6.32-26-server/include +#LDDINC= # Add your debugging flag (or not) to CFLAGS ifeq ($(DEBUG),y) diff --git a/src/mod/endpoints/mod_skypopen/oss/main.c b/src/mod/endpoints/mod_skypopen/oss/main.c index 10a210a574..465480e055 100644 --- a/src/mod/endpoints/mod_skypopen/oss/main.c +++ b/src/mod/endpoints/mod_skypopen/oss/main.c @@ -43,12 +43,13 @@ #include "skypopen.h" /* local definitions */ + /* * Our parameters which can be set at load time. */ int skypopen_major = SKYPOPEN_MAJOR; -int skypopen_minor = 3; +int skypopen_minor = SKYPOPEN_MINOR; int skypopen_nr_devs = SKYPOPEN_NR_DEVS; /* number of bare skypopen devices */ module_param(skypopen_major, int, S_IRUGO); @@ -61,9 +62,6 @@ MODULE_LICENSE("Dual BSD/GPL"); static struct skypopen_dev *skypopen_devices; /* allocated in skypopen_init_module */ static int unload = 0; -#ifdef CENTOS -#define HRTIMER_MODE_REL HRTIMER_REL -#endif// CENTOS #ifndef WANT_HRTIMER void my_timer_callback_inq( unsigned long data ) @@ -84,7 +82,7 @@ void my_timer_callback_outq( unsigned long data ) } #else// WANT_HRTIMER -#ifndef CENTOS +#ifndef CENTOS_5 static enum hrtimer_restart my_hrtimer_callback_inq( struct hrtimer *timer_inq ) { struct skypopen_dev *dev = container_of(timer_inq, struct skypopen_dev, timer_inq); @@ -113,7 +111,7 @@ static enum hrtimer_restart my_hrtimer_callback_outq( struct hrtimer *timer_outq return HRTIMER_RESTART; } -#else// CENTOS +#else// CENTOS_5 static int my_hrtimer_callback_inq( struct hrtimer *timer_inq ) { struct skypopen_dev *dev = container_of(timer_inq, struct skypopen_dev, timer_inq); @@ -138,7 +136,7 @@ static int my_hrtimer_callback_outq( struct hrtimer *timer_outq ) return HRTIMER_RESTART; } -#endif// CENTOS +#endif// CENTOS_5 #endif// WANT_HRTIMER /* The clone-specific data structure includes a key field */ @@ -159,10 +157,6 @@ static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key) { struct skypopen_listitem *lptr; #ifdef WANT_HRTIMER -#if 0 - ktime_t ktime_inq; - ktime_t ktime_outq; -#endif //0 #endif// WANT_HRTIMER list_for_each_entry(lptr, &skypopen_c_list, list) { @@ -181,6 +175,7 @@ static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key) init_waitqueue_head(&lptr->device.inq); init_waitqueue_head(&lptr->device.outq); + #ifndef WANT_HRTIMER setup_timer( &lptr->device.timer_inq, my_timer_callback_inq, (long int)lptr ); setup_timer( &lptr->device.timer_outq, my_timer_callback_outq, (long int)lptr ); @@ -188,19 +183,6 @@ static struct skypopen_dev *skypopen_c_lookfor_device(dev_t key) mod_timer( &lptr->device.timer_inq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) ); printk( "Starting skypopen OSS driver write timer (%dms) skype client:(%d)\n", SKYPOPEN_SLEEP, current->tgid ); mod_timer( &lptr->device.timer_outq, jiffies + msecs_to_jiffies(SKYPOPEN_SLEEP) ); -#else// WANT_HRTIMER -#if 0 - ktime_inq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000); - hrtimer_init( &lptr->device.timer_inq, CLOCK_MONOTONIC, HRTIMER_MODE_REL ); - lptr->device.timer_inq.function = &my_hrtimer_callback_inq; - hrtimer_start( &lptr->device.timer_inq, ktime_inq, HRTIMER_MODE_REL ); - - ktime_outq = ktime_set( 0, SKYPOPEN_SLEEP * 1000000); - hrtimer_init( &lptr->device.timer_outq, CLOCK_MONOTONIC, HRTIMER_MODE_REL ); - lptr->device.timer_outq.function = &my_hrtimer_callback_outq; - hrtimer_start( &lptr->device.timer_outq, ktime_outq, HRTIMER_MODE_REL ); -#endif - #endif// WANT_HRTIMER /* place it in the list */ @@ -249,14 +231,12 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos) { DEFINE_WAIT(wait); - size_t written; struct skypopen_dev *dev = filp->private_data; if(unload) return -1; #ifdef WANT_HRTIMER -#if 1 if(dev->timer_inq_started == 0){ ktime_t ktime_inq; @@ -266,39 +246,13 @@ static ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, hrtimer_start( &dev->timer_inq, ktime_inq, HRTIMER_MODE_REL ); dev->timer_inq_started = 1; } -#endif #endif// WANT_HRTIMER - //printk("READ\n"); prepare_to_wait(&dev->inq, &wait, TASK_INTERRUPTIBLE); schedule(); finish_wait(&dev->inq, &wait); - - if (!count) - return 0; - - if (!access_ok(VERIFY_WRITE, buf, count)) - return -EFAULT; - - written = 0; - while (count) { - unsigned long unwritten; - size_t chunk = count; - - if (chunk > PAGE_SIZE) - chunk = PAGE_SIZE; /* Just for latency reasons */ - unwritten = __clear_user(buf, chunk); - written += chunk - unwritten; - if (unwritten) - break; - if (signal_pending(current)) - return written ? written : -ERESTARTSYS; - buf += chunk; - count -= chunk; - cond_resched(); - } - return written ? written : -EFAULT; + return count; } static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, @@ -311,7 +265,6 @@ static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t return -1; #ifdef WANT_HRTIMER -#if 1 if(dev->timer_outq_started == 0){ ktime_t ktime_outq; @@ -321,10 +274,8 @@ static ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t hrtimer_start( &dev->timer_outq, ktime_outq, HRTIMER_MODE_REL ); dev->timer_outq_started = 1; } -#endif #endif// WANT_HRTIMER - //printk("WRITE\n"); prepare_to_wait(&dev->outq, &wait, TASK_INTERRUPTIBLE); schedule(); @@ -448,6 +399,7 @@ int skypopen_init_module(void) dev_t dev = 0; printk("skypopen OSS driver loading (www.freeswitch.org)\n"); + /* * Get a range of minor numbers to work with, asking for a dynamic * major unless directed otherwise at load time. diff --git a/src/mod/endpoints/mod_skypopen/oss/skypopen.h b/src/mod/endpoints/mod_skypopen/oss/skypopen.h index 2324e448cb..3d94085dde 100644 --- a/src/mod/endpoints/mod_skypopen/oss/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/oss/skypopen.h @@ -1,6 +1,7 @@ /* * skypopen.h -- definitions for the char module * + * Copyright (C) 2010 Giovanni Maruzzelli * Copyright (C) 2001 Alessandro Rubini and Jonathan Corbet * Copyright (C) 2001 O'Reilly & Associates * @@ -20,20 +21,20 @@ #include /* needed for the _IOW etc stuff used later */ +#define CENTOS_5 /* define this ONLY if you're on CentOS 5.x (eg: undef on CentOS 6.x ) */ +#define WANT_HRTIMER /* undef this only if you don't want to use High Resolution Timers (why?) */ #define SKYPOPEN_BLK 960 #define SKYPOPEN_SLEEP 10 -#define CENTOS -#ifndef SKYPOPEN_MAJOR #define SKYPOPEN_MAJOR 14 /* dynamic major by default */ -#endif +#define SKYPOPEN_MINOR 3 /* dynamic major by default */ +#define SKYPOPEN_NR_DEVS 1 /* not useful, I'm too lazy to remove it */ -#ifndef SKYPOPEN_NR_DEVS -#define SKYPOPEN_NR_DEVS 1 /* skypopen0 through skypopen3 */ -#endif +#ifdef CENTOS_5 +#define HRTIMER_MODE_REL HRTIMER_REL +#endif// CENTOS_5 -#define WANT_HRTIMER struct skypopen_dev { struct cdev cdev; /* Char device structure */ wait_queue_head_t inq; /* read and write queues */ @@ -56,16 +57,4 @@ struct skypopen_dev { extern int skypopen_major; /* main.c */ extern int skypopen_nr_devs; - -/* - * Prototypes for shared functions - */ - -//ssize_t skypopen_read(struct file *filp, char __user *buf, size_t count, - //loff_t *f_pos); -//ssize_t skypopen_write(struct file *filp, const char __user *buf, size_t count, - //loff_t *f_pos); -//int skypopen_ioctl(struct inode *inode, struct file *filp, - //unsigned int cmd, unsigned long arg); - #endif /* _SKYPOPEN_H_ */ From 4842a62062cd5567fd2edeb6099d71c2e92a2412 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Wed, 20 Apr 2011 03:38:45 -0500 Subject: [PATCH 343/558] skypopen: deleted osscuse subdir --- .../mod_skypopen/osscuse/98-osscuse.rules | 7 - .../endpoints/mod_skypopen/osscuse/LICENSE | 339 --- .../endpoints/mod_skypopen/osscuse/Makefile | 69 - src/mod/endpoints/mod_skypopen/osscuse/README | 119 - .../mod_skypopen/osscuse/ossp-alsap.c | 613 ----- .../mod_skypopen/osscuse/ossp-slave.c | 250 -- .../mod_skypopen/osscuse/ossp-slave.h | 28 - .../mod_skypopen/osscuse/ossp-util.c | 369 --- .../mod_skypopen/osscuse/ossp-util.h | 609 ----- src/mod/endpoints/mod_skypopen/osscuse/ossp.c | 83 - src/mod/endpoints/mod_skypopen/osscuse/ossp.h | 117 - .../endpoints/mod_skypopen/osscuse/osspd.c | 2374 ----------------- 12 files changed, 4977 deletions(-) delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/LICENSE delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/Makefile delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/README delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp.c delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/ossp.h delete mode 100644 src/mod/endpoints/mod_skypopen/osscuse/osspd.c diff --git a/src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules b/src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules deleted file mode 100644 index c1430fd5c0..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/98-osscuse.rules +++ /dev/null @@ -1,7 +0,0 @@ -# Since these devices are not part of 'sound' subsystem the group is forced -# to audio by name -# /dev/cuse can stay mode 0660 root:root since osspd is run as root -# and drops privileges to user level when opened by user -KERNEL=="dsp", GROUP="audio" -KERNEL=="mixer", GROUP="audio" -KERNEL=="adsp", GROUP="audio" diff --git a/src/mod/endpoints/mod_skypopen/osscuse/LICENSE b/src/mod/endpoints/mod_skypopen/osscuse/LICENSE deleted file mode 100644 index d511905c16..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/LICENSE +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - 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., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/src/mod/endpoints/mod_skypopen/osscuse/Makefile b/src/mod/endpoints/mod_skypopen/osscuse/Makefile deleted file mode 100644 index a42d37a8a3..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/Makefile +++ /dev/null @@ -1,69 +0,0 @@ -# These can be overridden if needed -# DESTDIR is completely respected -CC := gcc -AR := ar -CFLAGS := -Wall $(CFLAGS) -XLDFLAGS := $(LDFLAGS) -LDFLAGS := -L. -lossp $(LDFLAGS) -prefix := /usr/local -DESTDIR := -UDEVDIR := /etc/udev/rules.d - -ifeq "$(origin OSSPD_CFLAGS)" "undefined" -OSSPD_CFLAGS := $(shell pkg-config --cflags fuse) -endif - -ifeq "$(origin OSSPD_LDFLAGS)" "undefined" -OSSPD_LDFLAGS := $(shell pkg-config --libs fuse) -endif - -ifeq "$(origin OSSP_PADSP_CFLAGS)" "undefined" -OSSP_PADSP_CFLAGS := $(shell pkg-config --cflags libpulse) -endif - -ifeq "$(origin OSSP_PADSP_LDFLAGS)" "undefined" -OSSP_PADSP_LDFLAGS := $(shell pkg-config --libs libpulse) -endif - -ifeq "$(origin OSSP_ALSAP_CFLAGS)" "undefined" -OSSP_ALSAP_CFLAGS := $(shell pkg-config --libs alsa) -endif - -ifeq "$(origin OSSP_ALSAP_LDFLAGS)" "undefined" -OSSP_ALSAP_LDFLAGS := $(shell pkg-config --libs alsa) -endif - -headers := ossp.h ossp-util.h ossp-slave.h - -#all: osspd ossp-padsp ossp-alsap -all: osspd ossp-alsap - -install: - mkdir -p $(DESTDIR)$(prefix)/sbin - install -m755 osspd ossp-padsp ossp-alsap $(DESTDIR)$(prefix)/sbin - mkdir -p $(DESTDIR)$(UDEVDIR) - install -m644 98-osscuse.rules $(DESTDIR)$(UDEVDIR) - -libossp.a: ossp.c ossp.h ossp-util.c ossp-util.h ossp-slave.c ossp-slave.h - $(CC) $(CFLAGS) -c -o ossp.o ossp.c - $(CC) $(CFLAGS) -c -o ossp-util.o ossp-util.c - $(CC) $(CFLAGS) -c -o ossp-slave.o ossp-slave.c - $(AR) rc $@ ossp.o ossp-util.o ossp-slave.o - -osspd: osspd.c libossp.a $(headers) - $(CC) $(CFLAGS) $(OSSPD_CFLAGS) -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS) - -ossp-padsp: ossp-padsp.c libossp.a $(headers) - $(CC) $(CFLAGS) $(OSSP_PADSP_CFLAGS) -o $@ $< $(OSSP_PADSP_LDFLAGS) $(LDFLAGS) - -ossp-alsap: ossp-alsap.c libossp.a $(headers) - $(CC) $(CFLAGS) $(OSSP_ALSAP_CFLAGS) -o $@ $< $(OSSP_ALSAP_LDFLAGS) $(LDFLAGS) - -osstest: osstest.c - $(CC) $(CFLAGS) -o $@ $< $(XLDFLAGS) - -test: osstest - @./osstest - -clean: - rm -f *.o *.a osspd ossp-padsp ossp-alsap osstest diff --git a/src/mod/endpoints/mod_skypopen/osscuse/README b/src/mod/endpoints/mod_skypopen/osscuse/README deleted file mode 100644 index 6b716c76e4..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/README +++ /dev/null @@ -1,119 +0,0 @@ - - OSS Proxy - emulate OSS device using CUSE - - Copyright (C) 2008-2009 SUSE Linux Products GmbH - Copyright (C) 2008-2009 Tejun Heo - -1. What is it? --------------- - -Well, first, OSS refers to Open Sound System. If it still doesn't -ring a bell, think /dev/dsp, /dev/adsp and /dev/mixer. - -Currently, Linux supports two audio programming interface - ALSA and -OSS. The latter one is deprecated and has been that way for a long -time but there still are applications which still use them including -UML (usermode Linux) host sound support. - -ALSA contains OSS emulation but sadly the emulation is behind -multiplexing layer (which is in userland) which means that if your -sound card doesn't support multiple audio streams, only either one of -ALSA or OSS interface would be usable at any given moment. - -There have been also attempts to emulate OSS in userland using dynamic -library preloading - aoss and more recently padsp. This works for -many applications but it's just not easy to emulate everything using -the technique. Things like polling, signals, forking, privilege -changes make it very difficult to emulate things reliably. - -OSS Proxy uses CUSE (extension of FUSE allowing character devices to -be implemented in userspace) to implement OSS interface - /dev/dsp, -/dev/adsp and /dev/mixer. From the POV of the applications, these -devices are proper character devices and behave exactly the same way -so it can be made quite versatile. - - -2. Hmmm... So, how does the whole thing work? ---------------------------------------------- - -The OSS Proxy daemon - osspd - should be started first. Note that -osspd will fail to start if sound device number regions are already -occupied. You'll need to turn off OSS or its emulation[1]. - -On startup, osspd creates /dev/dsp, /dev/adsp and /dev/mixer using -CUSE. When an application access one of the devices, all IOs are -redirected to osspd via CUSE. Upon receiving a new DSP open request, -osspd creates a slave process which drops the root privilege and -assumes the opening process's credentials. After handshaking, osspd -forwards all relevant IOs to the slave which is responsible for -actually playing the sound. - -Currently there's only one slave implemented - ossp-padsp, which as -the name suggests forwards (again) the sound to pulseaudio. To sum -up, the whole pipe looks like the following. - - App <-> /dev/dsp <-> CUSE <-> osspd <-> ossp-padsp <-> pulseaudio - -Which is a lot of forwarding, but on modern machines, it won't be too -noticeable. - - -3. What works? --------------- - -Well, MIDI part isn't implemented and I doubt it will be in any near -future but except that everything should work. Playing, recording, -5.1ch, A-V syncing, all should work. If not, it's a bug, so please -report. - -The mixer behaves a bit differently tho. In the original OSS, -/dev/mixer is the hardware mixer, so adjusting volumes there affects -all audio streams. When using ossp, each process group gets its own -mixer and the mixer always contains only two knobs - PCM and IGAIN. -Combined with per-stream volume control of pulseaudio, this scheme -works quite well for applications with embedded volume control -although it makes standalone OSS mixer programs virtually useless[2]. - - -4. How do I use it? -------------------- - -First you need CUSE support in kernel which might land on 2.6.28 with -sufficient luck[3] and then you also need libfuse which supports -CUSE[4]. Once you have both, it should be easy. First build it by -running `make'. You can set OSSPD_CFLAGS, OSSPD_LDFLAGS, -OSSP_PADSP_CFLAGS and OSSP_PADSP_LDFLAGS if you have stuff at -non-default locations. - -After build completes, there will be two executables - `osspd' and -`ossp-padsp'. Just copy them to where other system executables live. -Specific location doesn't matter as long as both files end up in the -same directory. - -Execute `osspd'. It will create the device files and you're all set. -`osspd' uses syslog with LOG_DAEMON facility, so if something doesn't -work take a look at what osspd complains about. - - -[1] As of this writing, turning on any sound support makes the - soundcore module claim OSS device regions. Patch to make it claim - OSS device regions only when OSS support or emulation is enabled - is scheduled for 2.6.28. Even with the patch, soundcore will - claim OSS device regions if OSS support or ALSA OSS emulation is - enabled. Make sure they're turned off. - -[2] If you have a strong reason to use standalone OSS mixer program, - you can play some shell tricks to put it into the same process - group as the target audio application. e.g. To use aumix with - mpg123 - `(mpg123 asdf.mp3 > /dev/null 2>&1 & aumix)', but - seriously, just use PA or ALSA one. - -[3] For the time being, here's the git tree with all the necessary - changes. This tree is base on top of 2.6.27-rc3. - - http://git.kernel.org/?p=linux/kernel/git/tj/misc.git;a=shortlog;h=cuse - git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git cuse - -[4] And libfuse with the modifications can be found at... - - http://userweb.kernel.org/~tj/ossp/fuse-cuse.tar.gz diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c deleted file mode 100644 index 607e05ca84..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/ossp-alsap.c +++ /dev/null @@ -1,613 +0,0 @@ -/* - * ossp-alsap - ossp DSP slave which forwards to alsa - * - * Copyright (C) 2009 Maarten Lankhorst - * - * This file is released under the GPLv2. - * - * Why an alsa plugin as well? Just to show how much - * the alsa userspace api sucks ;-) - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include "ossp-slave.h" - -enum { - AFMT_FLOAT = 0x00004000, - AFMT_S32_LE = 0x00001000, - AFMT_S32_BE = 0x00002000, -}; - -static size_t page_size; - -/* alsa structures */ -static snd_pcm_t *pcm[2]; -static snd_pcm_hw_params_t *hw_params; -static snd_pcm_sw_params_t *sw_params; -static int block; - -static unsigned int byte_counter[2]; -static snd_pcm_uframes_t mmap_pos[2]; -static int stream_corked[2]; -static int stream_notify; - -static struct format { - snd_pcm_format_t format; - snd_pcm_sframes_t rate; - int channels; -} hw_format = { SND_PCM_FORMAT_U8, 8000, 1 }; - -#if 0 -/* future mmap stuff */ -static size_t mmap_raw_size, mmap_size; -static int mmap_fd[2] = { -1, -1 }; -static void *mmap_map[2]; -static uint64_t mmap_idx[2]; /* mmap pointer */ -static uint64_t mmap_last_idx[2]; /* last idx for get_ptr */ -static struct ring_buf mmap_stg[2]; /* staging ring buffer */ -static size_t mmap_lead[2]; /* lead bytes */ -static int mmap_sync[2]; /* sync with backend stream */ -#endif - -static snd_pcm_format_t fmt_oss_to_alsa(int fmt) -{ - switch (fmt) { - case AFMT_U8: return SND_PCM_FORMAT_U8; - case AFMT_A_LAW: return SND_PCM_FORMAT_A_LAW; - case AFMT_MU_LAW: return SND_PCM_FORMAT_MU_LAW; - case AFMT_S16_LE: return SND_PCM_FORMAT_S16_LE; - case AFMT_S16_BE: return SND_PCM_FORMAT_S16_BE; - case AFMT_FLOAT: return SND_PCM_FORMAT_FLOAT; - case AFMT_S32_LE: return SND_PCM_FORMAT_S32_LE; - case AFMT_S32_BE: return SND_PCM_FORMAT_S32_BE; - default: return SND_PCM_FORMAT_U8; - } -} - -static int fmt_alsa_to_oss(snd_pcm_format_t fmt) -{ - switch (fmt) { - case SND_PCM_FORMAT_U8: return AFMT_U8; - case SND_PCM_FORMAT_A_LAW: return AFMT_A_LAW; - case SND_PCM_FORMAT_MU_LAW: return AFMT_MU_LAW; - case SND_PCM_FORMAT_S16_LE: return AFMT_S16_LE; - case SND_PCM_FORMAT_S16_BE: return AFMT_S16_BE; - case SND_PCM_FORMAT_FLOAT: return AFMT_FLOAT; - case SND_PCM_FORMAT_S32_LE: return AFMT_S32_LE; - case SND_PCM_FORMAT_S32_BE: return AFMT_S32_BE; - default: return AFMT_U8; - } -} - -static void flush_streams(int drain) -{ - /* FIXME: snd_pcm_drain appears to be able to deadlock, - * always drop or check state? */ - if (drain) { - if (pcm[PLAY]) - snd_pcm_drain(pcm[PLAY]); - if (pcm[REC]) - snd_pcm_drain(pcm[REC]); - } else { - if (pcm[PLAY]) - snd_pcm_drop(pcm[PLAY]); - if (pcm[REC]) - snd_pcm_drop(pcm[REC]); - } - - /* XXX: Really needed? */ -#if 0 - if (pcm[PLAY]) { - snd_pcm_close(pcm[PLAY]); - snd_pcm_open(&pcm[PLAY], "default", - SND_PCM_STREAM_PLAYBACK, block); - } - if (pcm[REC]) { - snd_pcm_close(pcm[REC]); - snd_pcm_open(&pcm[REC], "default", - SND_PCM_STREAM_CAPTURE, block); - } -#endif -} - -static void kill_streams(void) -{ - flush_streams(0); -} - -static int trigger_streams(int play, int rec) -{ - int ret = 0; - - if (pcm[PLAY] && play >= 0) { - ret = snd_pcm_sw_params_set_start_threshold(pcm[PLAY], sw_params, - play ? 1 : -1); - if (ret >= 0) - snd_pcm_sw_params(pcm[PLAY], sw_params); - } - if (ret >= 0 && pcm[REC] && rec >= 0) { - ret = snd_pcm_sw_params_set_start_threshold(pcm[REC], sw_params, - rec ? 1 : -1); - if (ret >= 0) - snd_pcm_sw_params(pcm[REC], sw_params); - } - - return ret; -} - -static ssize_t alsap_mixer(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ -return -EBUSY; -} - -static int set_hw_params(snd_pcm_t *pcm) -{ - int ret; - unsigned rate; - - ret = snd_pcm_hw_params_any(pcm, hw_params); - if (ret >= 0) - ret = snd_pcm_hw_params_set_access(pcm, hw_params, - SND_PCM_ACCESS_RW_INTERLEAVED); - rate = hw_format.rate; - if (ret >= 0) - ret = snd_pcm_hw_params_set_rate_minmax(pcm, hw_params, - &rate, NULL, - &rate, NULL); - if (ret >= 0) - ret = snd_pcm_hw_params_set_format(pcm, hw_params, hw_format.format); - if (ret >= 0) - ret = snd_pcm_hw_params_set_channels(pcm, hw_params, - hw_format.channels); - if (ret >= 0) - ret = snd_pcm_hw_params(pcm, hw_params); - if (ret >= 0) - ret = snd_pcm_sw_params_current(pcm, sw_params); - if (ret >= 0) - ret = snd_pcm_sw_params(pcm, sw_params); - return ret; -} - -static ssize_t alsap_open(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - struct ossp_dsp_open_arg *arg = carg; - int ret; - block = arg->flags & O_NONBLOCK ? SND_PCM_NONBLOCK : 0; - int access; -// block |= SND_PCM_ASYNC; - /* Woop dee dooo.. I love handling things in SIGIO (PAIN!!) - * Probably needed for MMAP - */ - - if (!hw_params) - ret = snd_pcm_hw_params_malloc(&hw_params); - if (ret < 0) - return ret; - - if (!sw_params) - ret = snd_pcm_sw_params_malloc(&sw_params); - if (ret < 0) - return ret; - - if (pcm[PLAY]) - snd_pcm_close(pcm[PLAY]); - if (pcm[REC]) - snd_pcm_close(pcm[REC]); - pcm[REC] = pcm[PLAY] = NULL; - - access = arg->flags & O_ACCMODE; - if (access == O_WRONLY || access == O_RDWR) { - ret = snd_pcm_open(&pcm[PLAY], "default", - SND_PCM_STREAM_PLAYBACK, block); - if (ret >= 0) - ret = set_hw_params(pcm[PLAY]); - } - - if (ret >= 0 && (access == O_RDONLY || access == O_RDWR)) { - ret = snd_pcm_open(&pcm[REC], "default", - SND_PCM_STREAM_CAPTURE, block); - if (ret >= 0) - ret = set_hw_params(pcm[REC]); - } - - if (ret < 0) { - if (pcm[PLAY]) - snd_pcm_close(pcm[PLAY]); - if (pcm[REC]) - snd_pcm_close(pcm[REC]); - pcm[REC] = pcm[PLAY] = NULL; - return ret; - } - return 0; -} - -#define GIOVANNI -#ifdef GIOVANNI - -#define GIOVA_SLEEP 40000 -#define GIOVA_BLK 3840 -static ssize_t alsap_write(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - usleep((GIOVA_SLEEP/GIOVA_BLK)* din_sz); - return din_sz; -} -static ssize_t alsap_read(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - usleep((GIOVA_SLEEP/GIOVA_BLK)* *dout_szp); - return *dout_szp; -} -#else// GIOVANNI -static ssize_t alsap_write(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ -// struct ossp_dsp_rw_arg *arg = carg; - int ret, insize; - - insize = snd_pcm_bytes_to_frames(pcm[PLAY], din_sz); - - if (snd_pcm_state(pcm[PLAY]) == SND_PCM_STATE_SETUP) - snd_pcm_prepare(pcm[PLAY]); - -// snd_pcm_start(pcm[PLAY]); - ret = snd_pcm_writei(pcm[PLAY], din, insize); - if (ret < 0) - ret = snd_pcm_recover(pcm[PLAY], ret, 1); - - if (ret >= 0) - return snd_pcm_frames_to_bytes(pcm[PLAY], ret); - else - return ret; -} - -static ssize_t alsap_read(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ -// struct ossp_dsp_rw_arg *arg = carg; - int ret, outsize; - - outsize = snd_pcm_bytes_to_frames(pcm[REC], *dout_szp); - - if (snd_pcm_state(pcm[REC]) == SND_PCM_STATE_SETUP) - snd_pcm_prepare(pcm[REC]); - - ret = snd_pcm_readi(pcm[REC], dout, outsize); - if (ret < 0) - ret = snd_pcm_recover(pcm[REC], ret, 1); - if (ret >= 0) - *dout_szp = ret = snd_pcm_frames_to_bytes(pcm[REC], ret); - else - *dout_szp = 0; - - return ret; -} -#endif// GIOVANNI - -static ssize_t alsap_poll(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - unsigned revents = 0; - - stream_notify |= *(int *)carg; - - if (pcm[PLAY]) - revents |= POLLOUT; - if (pcm[REC]) - revents |= POLLIN; - - *(unsigned *)rarg = revents; - return 0; -} - - -static ssize_t alsap_flush(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - flush_streams(opcode == OSSP_DSP_SYNC); - return 0; -} - -static ssize_t alsap_post(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - int ret; - - ret = trigger_streams(1, 1); - if (ret >= 0 && pcm[PLAY]) - ret = snd_pcm_start(pcm[PLAY]); - if (pcm[REC]) - ret = snd_pcm_start(pcm[REC]); - return ret; -} - -static ssize_t alsap_get_param(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, - int tfd) -{ - int v = 0; - - switch (opcode) { - case OSSP_DSP_GET_RATE: - return hw_format.rate; - - case OSSP_DSP_GET_CHANNELS: - return hw_format.channels; - - case OSSP_DSP_GET_FORMAT: { - v = fmt_alsa_to_oss(hw_format.format); - break; - } - - case OSSP_DSP_GET_BLKSIZE: { - snd_pcm_uframes_t psize; - snd_pcm_hw_params_get_period_size(hw_params, &psize, NULL); - v = psize; - break; - } - - case OSSP_DSP_GET_FORMATS: - v = AFMT_U8 | AFMT_A_LAW | AFMT_MU_LAW | AFMT_S16_LE | - AFMT_S16_BE | AFMT_FLOAT | AFMT_S32_LE | AFMT_S32_BE; - break; - - case OSSP_DSP_GET_TRIGGER: - if (!stream_corked[PLAY]) - v |= PCM_ENABLE_OUTPUT; - if (!stream_corked[REC]) - v |= PCM_ENABLE_INPUT; - break; - - default: - assert(0); - } - - *(int *)rarg = v; - - return 0; -} - -static ssize_t alsap_set_param(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, - int tfd) -{ - int v = *(int *)carg; - int ret = 0; - - /* kill the streams before changing parameters */ - kill_streams(); - - switch (opcode) { - case OSSP_DSP_SET_RATE: { - hw_format.rate = v; - break; - } - - case OSSP_DSP_SET_CHANNELS: { - hw_format.channels = v; - break; - } - - case OSSP_DSP_SET_FORMAT: { - snd_pcm_format_t format = fmt_oss_to_alsa(v); - hw_format.format = format; - break; - } - - case OSSP_DSP_SET_SUBDIVISION: - if (!v) - v = 1; -#if 0 - if (!v) { - v = user_subdivision ?: 1; - break; - } - user_frag_size = 0; - user_subdivision = v; - break; - - case OSSP_DSP_SET_FRAGMENT: - user_subdivision = 0; - user_frag_size = 1 << (v & 0xffff); - user_max_frags = (v >> 16) & 0xffff; - if (user_frag_size < 4) - user_frag_size = 4; - if (user_max_frags < 2) - user_max_frags = 2; -#else - case OSSP_DSP_SET_FRAGMENT: -#endif - break; - default: - assert(0); - } - - if (pcm[PLAY]) - ret = set_hw_params(pcm[PLAY]); - if (ret >= 0 && pcm[REC]) - ret = set_hw_params(pcm[REC]); - - if (rarg) - *(int *)rarg = v; - return 0; -} - -static ssize_t alsap_set_trigger(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, - int fd) -{ - int enable = *(int *)carg; - - stream_corked[PLAY] = !!(enable & PCM_ENABLE_OUTPUT); - stream_corked[REC] = !!(enable & PCM_ENABLE_INPUT); - - return trigger_streams(enable & PCM_ENABLE_OUTPUT, - enable & PCM_ENABLE_INPUT); -} - -static ssize_t alsap_get_space(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - int dir = (opcode == OSSP_DSP_GET_OSPACE) ? PLAY : REC; - int underrun = 0; - struct audio_buf_info info = { }; - unsigned long bufsize; - snd_pcm_uframes_t avail, fragsize; - snd_pcm_state_t state; - - if (!pcm[dir]) - return -EINVAL; - - state = snd_pcm_state(pcm[dir]); - if (state == SND_PCM_STATE_XRUN) { - snd_pcm_recover(pcm[dir], -EPIPE, 0); - underrun = 1; - } else if (state == SND_PCM_STATE_SUSPENDED) { - snd_pcm_recover(pcm[dir], -ESTRPIPE, 0); - underrun = 1; - } - - snd_pcm_hw_params_current(pcm[dir], hw_params); - snd_pcm_hw_params_get_period_size(hw_params, &fragsize, NULL); - snd_pcm_hw_params_get_buffer_size(hw_params, &bufsize); - info.fragsize = snd_pcm_frames_to_bytes(pcm[dir], fragsize); - info.fragstotal = bufsize / fragsize; - if (!underrun) { - avail = snd_pcm_avail_update(pcm[dir]); - info.fragments = avail / fragsize; - } else - info.fragments = info.fragstotal; - - info.bytes = info.fragsize * info.fragments; - - *(struct audio_buf_info *)rarg = info; - return 0; -} - -static ssize_t alsap_get_ptr(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, int tfd) -{ - int dir = (opcode == OSSP_DSP_GET_OPTR) ? PLAY : REC; - struct count_info info = { }; - - if (!pcm[dir]) - return -EIO; - - snd_pcm_hw_params_current(pcm[dir], hw_params); - info.bytes = byte_counter[dir]; - snd_pcm_hw_params_get_periods(hw_params, (unsigned int *)&info.blocks, NULL); - info.ptr = mmap_pos[dir]; - - *(struct count_info *)rarg = info; - return 0; -} - -static ssize_t alsap_get_odelay(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, - int fd) -{ - snd_pcm_sframes_t delay; - - if (!pcm[PLAY]) - return -EIO; - - if (snd_pcm_delay(pcm[PLAY], &delay) < 0) - return -EIO; - - *(int *)rarg = snd_pcm_frames_to_bytes(pcm[PLAY], delay); - return 0; -} - -static ossp_action_fn_t action_fn_tbl[OSSP_NR_OPCODES] = { - [OSSP_MIXER] = alsap_mixer, - [OSSP_DSP_OPEN] = alsap_open, - [OSSP_DSP_READ] = alsap_read, - [OSSP_DSP_WRITE] = alsap_write, - [OSSP_DSP_POLL] = alsap_poll, -#if 0 - [OSSP_DSP_MMAP] = alsap_mmap, - [OSSP_DSP_MUNMAP] = alsap_munmap, -#endif - [OSSP_DSP_RESET] = alsap_flush, - [OSSP_DSP_SYNC] = alsap_flush, - [OSSP_DSP_POST] = alsap_post, - [OSSP_DSP_GET_RATE] = alsap_get_param, - [OSSP_DSP_GET_CHANNELS] = alsap_get_param, - [OSSP_DSP_GET_FORMAT] = alsap_get_param, - [OSSP_DSP_GET_BLKSIZE] = alsap_get_param, - [OSSP_DSP_GET_FORMATS] = alsap_get_param, - [OSSP_DSP_SET_RATE] = alsap_set_param, - [OSSP_DSP_SET_CHANNELS] = alsap_set_param, - [OSSP_DSP_SET_FORMAT] = alsap_set_param, - [OSSP_DSP_SET_SUBDIVISION] = alsap_set_param, - [OSSP_DSP_SET_FRAGMENT] = alsap_set_param, - [OSSP_DSP_GET_TRIGGER] = alsap_get_param, - [OSSP_DSP_SET_TRIGGER] = alsap_set_trigger, - [OSSP_DSP_GET_OSPACE] = alsap_get_space, - [OSSP_DSP_GET_ISPACE] = alsap_get_space, - [OSSP_DSP_GET_OPTR] = alsap_get_ptr, - [OSSP_DSP_GET_IPTR] = alsap_get_ptr, - [OSSP_DSP_GET_ODELAY] = alsap_get_odelay, -}; - -static int action_pre(void) -{ - return 0; -} - -static void action_post(void) -{ -} - -int main(int argc, char **argv) -{ - int rc; - - ossp_slave_init(argc, argv); - - page_size = sysconf(_SC_PAGE_SIZE); - - /* Okay, now we're open for business */ - rc = 0; - do { - rc = ossp_slave_process_command(ossp_cmd_fd, action_fn_tbl, - action_pre, action_post); - } while (rc > 0); - - return rc ? 1 : 0; -} diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c deleted file mode 100644 index 4c5cb2d129..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.c +++ /dev/null @@ -1,250 +0,0 @@ -/* - * ossp-slave - OSS Proxy: Common codes for slaves - * - * Copyright (C) 2008-2010 SUSE Linux Products GmbH - * Copyright (C) 2008-2010 Tejun Heo - * - * This file is released under the GPLv2. - */ - -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ossp-slave.h" - -static const char *usage = -"usage: ossp-SLAVE [options]\n" -"\n" -"proxies commands from osspd to pulseaudio\n" -"\n" -"options:\n" -" -u UID uid to use\n" -" -g GID gid to use\n" -" -c CMD_FD fd to receive commands from osspd\n" -" -n NOTIFY_FD fd to send async notifications to osspd\n" -" -m MMAP_FD fd to use for mmap\n" -" -o MMAP_OFFSET mmap offset\n" -" -s MMAP_SIZE mmap size\n" -" -l LOG_LEVEL set log level\n" -" -t enable log timestamps\n"; - -char ossp_user_name[OSSP_USER_NAME_LEN]; -int ossp_cmd_fd = -1, ossp_notify_fd = -1; -void *ossp_mmap_addr[2]; - -void ossp_slave_init(int argc, char **argv) -{ - int have_uid = 0, have_gid = 0; - uid_t uid; - gid_t gid; - int mmap_fd = -1; - off_t mmap_off = 0; - size_t mmap_size = 0; - int opt; - struct passwd *pw, pw_buf; - struct sigaction sa; - char pw_sbuf[sysconf(_SC_GETPW_R_SIZE_MAX)]; - - while ((opt = getopt(argc, argv, "u:g:c:n:m:o:s:l:t")) != -1) { - switch (opt) { - case 'u': - have_uid = 1; - uid = strtol(optarg, NULL, 0); - break; - case 'g': - have_gid = 1; - gid = strtol(optarg, NULL, 0); - break; - case 'c': - ossp_cmd_fd = strtol(optarg, NULL, 0); - break; - case 'n': - ossp_notify_fd = strtol(optarg, NULL, 0); - break; - case 'm': - mmap_fd = strtol(optarg, NULL, 0); - break; - case 'o': - mmap_off = strtoull(optarg, NULL, 0); - break; - case 's': - mmap_size = strtoul(optarg, NULL, 0); - break; - case 'l': - ossp_log_level = strtol(optarg, NULL, 0); - break; - case 't': - ossp_log_timestamp = 1; - break; - } - } - - if (!have_uid || !have_gid || ossp_cmd_fd < 0 || ossp_notify_fd < 0) { - fprintf(stderr, usage); - _exit(1); - } - - snprintf(ossp_user_name, sizeof(ossp_user_name), "uid%d", uid); - if (getpwuid_r(uid, &pw_buf, pw_sbuf, sizeof(pw_sbuf), &pw) == 0) - snprintf(ossp_user_name, sizeof(ossp_user_name), "%s", - pw->pw_name); - - snprintf(ossp_log_name, sizeof(ossp_log_name), "ossp-padsp[%s:%d]", - ossp_user_name, getpid()); - - if (mmap_fd >= 0) { - void *p; - - if (!mmap_off || !mmap_size) { - fprintf(stderr, usage); - _exit(1); - } - - p = mmap(NULL, mmap_size, PROT_READ | PROT_WRITE, MAP_SHARED, - mmap_fd, mmap_off); - if (p == MAP_FAILED) - fatal_e(-errno, "mmap failed"); - - ossp_mmap_addr[PLAY] = p; - ossp_mmap_addr[REC] = p + mmap_size / 2; - close(mmap_fd); - } - - /* mmap done, drop privileges */ - if (setresgid(gid, gid, gid) || setresuid(uid, uid, uid)) - fatal_e(-errno, "failed to drop privileges"); - - /* block SIGPIPE */ - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &sa, NULL)) - fatal_e(-errno, "failed to ignore SIGPIPE"); -} - -int ossp_slave_process_command(int cmd_fd, - ossp_action_fn_t const *action_fn_tbl, - int (*action_pre_fn)(void), - void (*action_post_fn)(void)) -{ - static struct sized_buf carg_sbuf = { }, rarg_sbuf = { }; - static struct sized_buf din_sbuf = { }, dout_sbuf = { }; - struct ossp_cmd cmd; - int fd = -1; - char cmsg_buf[CMSG_SPACE(sizeof(fd))]; - struct iovec iov = { &cmd, sizeof(cmd) }; - struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1, - .msg_control = cmsg_buf, - .msg_controllen = sizeof(cmsg_buf) }; - struct cmsghdr *cmsg; - size_t carg_size, din_size, rarg_size, dout_size; - char *carg = NULL, *din = NULL, *rarg = NULL, *dout = NULL; - struct ossp_reply reply = { .magic = OSSP_REPLY_MAGIC }; - ssize_t ret; - - ret = recvmsg(cmd_fd, &msg, 0); - if (ret == 0) - return 0; - if (ret < 0) { - ret = -errno; - err_e(ret, "failed to read command channel"); - return ret; - } - - if (ret != sizeof(cmd)) { - err("command struct size mismatch (%zu, should be %zu)", - ret, sizeof(cmd)); - return -EINVAL; - } - - if (cmd.magic != OSSP_CMD_MAGIC) { - err("illegal command magic 0x%x", cmd.magic); - return -EINVAL; - } - - for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; - cmsg = CMSG_NXTHDR(&msg, cmsg)) { - if (cmsg->cmsg_level == SOL_SOCKET && - cmsg->cmsg_type == SCM_RIGHTS) - fd = *(int *)CMSG_DATA(cmsg); - else { - err("unknown cmsg %d:%d received (opcode %d)", - cmsg->cmsg_level, cmsg->cmsg_type, cmd.opcode); - return -EINVAL; - } - } - - if (cmd.opcode >= OSSP_NR_OPCODES) { - err("unknown opcode %d", cmd.opcode); - return -EINVAL; - } - - carg_size = ossp_arg_sizes[cmd.opcode].carg_size; - din_size = cmd.din_size; - rarg_size = ossp_arg_sizes[cmd.opcode].rarg_size; - dout_size = cmd.dout_size; - - if ((fd >= 0) != ossp_arg_sizes[cmd.opcode].has_fd) { - err("fd=%d unexpected for opcode %d", fd, cmd.opcode); - return -EINVAL; - } - - if (ensure_sbuf_size(&carg_sbuf, carg_size) || - ensure_sbuf_size(&din_sbuf, din_size) || - ensure_sbuf_size(&rarg_sbuf, rarg_size) || - ensure_sbuf_size(&dout_sbuf, dout_size)) { - err("failed to allocate command buffers"); - return -ENOMEM; - } - - if (carg_size) { - carg = carg_sbuf.buf; - ret = read_fill(cmd_fd, carg, carg_size); - if (ret < 0) - return ret; - } - if (din_size) { - din = din_sbuf.buf; - ret = read_fill(cmd_fd, din, din_size); - if (ret < 0) - return ret; - } - if (rarg_size) - rarg = rarg_sbuf.buf; - if (dout_size) - dout = dout_sbuf.buf; - - ret = -EINVAL; - if (action_fn_tbl[cmd.opcode]) { - ret = action_pre_fn(); - if (ret == 0) { - ret = action_fn_tbl[cmd.opcode](cmd.opcode, carg, - din, din_size, rarg, - dout, &dout_size, fd); - action_post_fn(); - } - } - - reply.result = ret; - if (ret >= 0) - reply.dout_size = dout_size; - else { - rarg_size = 0; - dout_size = 0; - } - - if (write_fill(cmd_fd, &reply, sizeof(reply)) < 0 || - write_fill(cmd_fd, rarg, rarg_size) < 0 || - write_fill(cmd_fd, dout, dout_size) < 0) - return -EIO; - - return 1; -} diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h b/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h deleted file mode 100644 index 10c22cdb02..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/ossp-slave.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * ossp-slave - OSS Proxy: Common codes for slaves - * - * Copyright (C) 2008-2010 SUSE Linux Products GmbH - * Copyright (C) 2008-2010 Tejun Heo - * - * This file is released under the GPLv2. - */ - -#ifndef _OSSP_SLAVE_H -#define _OSSP_SLAVE_H - -#include "ossp.h" -#include "ossp-util.h" - -#define OSSP_USER_NAME_LEN 128 - -extern char ossp_user_name[OSSP_USER_NAME_LEN]; -extern int ossp_cmd_fd, ossp_notify_fd; -extern void *ossp_mmap_addr[2]; - -void ossp_slave_init(int argc, char **argv); -int ossp_slave_process_command(int cmd_fd, - ossp_action_fn_t const *action_fn_tbl, - int (*action_pre_fn)(void), - void (*action_post_fn)(void)); - -#endif /* _OSSP_SLAVE_H */ diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c deleted file mode 100644 index 325cefd5fd..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - * ossp-util - OSS Proxy: Common utilities - * - * Copyright (C) 2008-2010 SUSE Linux Products GmbH - * Copyright (C) 2008-2010 Tejun Heo - * - * This file is released under the GPLv2. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "ossp-util.h" - -#define BIT(nr) (1UL << (nr)) -#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG)) -#define BIT_WORD(nr) ((nr) / BITS_PER_LONG) -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) -#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) - -char ossp_log_name[OSSP_LOG_NAME_LEN]; -int ossp_log_level = OSSP_LOG_DFL; -int ossp_log_timestamp; - -static const char *severity_strs[] = { - [OSSP_LOG_CRIT] = "CRIT", - [OSSP_LOG_ERR] = " ERR", - [OSSP_LOG_WARN] = "WARN", - [OSSP_LOG_INFO] = NULL, - [OSSP_LOG_DBG0] = "DBG0", - [OSSP_LOG_DBG1] = "DBG1", -}; - -static int severity_map[] = { - [OSSP_LOG_CRIT] = LOG_ERR, - [OSSP_LOG_ERR] = LOG_ERR, - [OSSP_LOG_WARN] = LOG_WARNING, - [OSSP_LOG_INFO] = LOG_INFO, - [OSSP_LOG_DBG0] = LOG_DEBUG, - [OSSP_LOG_DBG1] = LOG_DEBUG, -}; - -void log_msg(int severity, const char *fmt, ...) -{ - static int syslog_opened = 0; - char buf[1024]; - size_t len = sizeof(buf), off = 0; - va_list ap; - - if (severity > abs(ossp_log_level)) - return; - - if (ossp_log_level < 0 && !syslog_opened) - openlog(ossp_log_name, 0, LOG_DAEMON); - - assert(severity >= 0 && severity < ARRAY_SIZE(severity_strs)); - - if (ossp_log_timestamp) { - static uint64_t start; - uint64_t now; - struct timeval tv; - gettimeofday(&tv, NULL); - now = tv.tv_sec * 1000 + tv.tv_usec / 1000; - if (!start) - start = now; - - off += snprintf(buf + off, len - off, "<%08"PRIu64"> ", - now - start); - } - - if (ossp_log_level > 0) { - char sev_buf[16] = ""; - if (severity_strs[severity]) - snprintf(sev_buf, sizeof(sev_buf), " %s", - severity_strs[severity]); - off += snprintf(buf + off, len - off, "%s%s: ", - ossp_log_name, sev_buf); - } else if (severity_strs[severity]) - off += snprintf(buf + off, len - off, "%s ", - severity_strs[severity]); - - va_start(ap, fmt); - off += vsnprintf(buf + off, len - off, fmt, ap); - va_end(ap); - - off += snprintf(buf + off, len - off, "\n"); - - if (ossp_log_level > 0) - fputs(buf, stderr); - else - syslog(severity_map[severity], "%s", buf); -} - -int read_fill(int fd, void *buf, size_t size) -{ - while (size) { - ssize_t ret; - int rc; - - ret = read(fd, buf, size); - if (ret <= 0) { - if (ret == 0) - rc = -EIO; - else - rc = -errno; - err_e(rc, "failed to read_fill %zu bytes from fd %d", - size, fd); - return rc; - } - buf += ret; - size -= ret; - } - return 0; -} - -int write_fill(int fd, const void *buf, size_t size) -{ - while (size) { - ssize_t ret; - int rc; - - ret = write(fd, buf, size); - if (ret <= 0) { - if (ret == 0) - rc = -EIO; - else - rc = -errno; - err_e(rc, "failed to write_fill %zu bytes to fd %d", - size, fd); - return rc; - } - buf += ret; - size -= ret; - } - return 0; -} - -void ring_fill(struct ring_buf *ring, const void *buf, size_t size) -{ - size_t tail; - - assert(ring_space(ring) >= size); - - tail = (ring->head + ring->size - ring->bytes) % ring->size; - - if (ring->head >= tail) { - size_t todo = min(size, ring->size - ring->head); - - memcpy(ring->buf + ring->head, buf, todo); - ring->head = (ring->head + todo) % ring->size; - ring->bytes += todo; - buf += todo; - size -= todo; - } - - assert(ring->size - ring->head >= size); - memcpy(ring->buf + ring->head, buf, size); - ring->head += size; - ring->bytes += size; -} - -void *ring_data(struct ring_buf *ring, size_t *sizep) -{ - size_t tail; - - if (!ring->bytes) - return NULL; - - tail = (ring->head + ring->size - ring->bytes) % ring->size; - - *sizep = min(ring->bytes, ring->size - tail); - return ring->buf + tail; -} - -int ring_resize(struct ring_buf *ring, size_t new_size) -{ - struct ring_buf new_ring = { .size = new_size }; - void *p; - size_t size; - - if (ring_bytes(ring) > new_size) - return -ENOSPC; - - new_ring.buf = calloc(1, new_size); - if (new_size && !new_ring.buf) - return -ENOMEM; - - while ((p = ring_data(ring, &size))) { - ring_fill(&new_ring, p, size); - ring_consume(ring, size); - } - - free(ring->buf); - *ring = new_ring; - return 0; -} - -int ensure_sbuf_size(struct sized_buf *sbuf, size_t size) -{ - char *new_buf; - - if (sbuf->size >= size) - return 0; - - new_buf = realloc(sbuf->buf, size); - if (size && !new_buf) - return -ENOMEM; - - sbuf->buf = new_buf; - sbuf->size = size; - return 0; -} - -static unsigned long __ffs(unsigned long word) -{ - int num = 0; - - if (BITS_PER_LONG == 64) { - if ((word & 0xffffffff) == 0) { - num += 32; - word >>= 32; - } - } - - if ((word & 0xffff) == 0) { - num += 16; - word >>= 16; - } - if ((word & 0xff) == 0) { - num += 8; - word >>= 8; - } - if ((word & 0xf) == 0) { - num += 4; - word >>= 4; - } - if ((word & 0x3) == 0) { - num += 2; - word >>= 2; - } - if ((word & 0x1) == 0) - num += 1; - return num; -} - -#define ffz(x) __ffs(~(x)) - -unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, - unsigned long offset) -{ - const unsigned long *p = addr + BITOP_WORD(offset); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset %= BITS_PER_LONG; - if (offset) { - tmp = *(p++); - tmp |= ~0UL >> (BITS_PER_LONG - offset); - if (size < BITS_PER_LONG) - goto found_first; - if (~tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) { - if (~(tmp = *(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = *p; - -found_first: - tmp |= ~0UL << size; - if (tmp == ~0UL) /* Are any bits zero? */ - return result + size; /* Nope. */ -found_middle: - return result + ffz(tmp); -} - -void __set_bit(int nr, volatile unsigned long *addr) -{ - unsigned long mask = BIT_MASK(nr); - unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); - - *p |= mask; -} - -void __clear_bit(int nr, volatile unsigned long *addr) -{ - unsigned long mask = BIT_MASK(nr); - unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr); - - *p &= ~mask; -} - -int get_proc_self_info(pid_t pid, pid_t *ppid_r, - char *cmd_buf, size_t cmd_buf_sz) - -{ - char path[64], buf[4096]; - int fd = -1; - char *cmd_start, *cmd_end, *ppid_start, *end; - ssize_t ret; - pid_t ppid; - int i, rc; - - snprintf(path, sizeof(path), "/proc/%ld/stat", (long)pid); - fd = open(path, O_RDONLY); - if (fd < 0) { - rc = -errno; - goto out; - } - - ret = read(fd, buf, sizeof(buf)); - if (ret < 0) - goto out; - if (ret == sizeof(buf)) { - rc = -EOVERFLOW; - goto out; - } - buf[ret] = '\0'; - - rc = -EINVAL; - cmd_start = strchr(buf, '('); - cmd_end = strrchr(buf, ')'); - if (!cmd_start || !cmd_end) - goto out; - cmd_start++; - - ppid_start = cmd_end; - for (i = 0; i < 3; i++) { - ppid_start = strchr(ppid_start, ' '); - if (!ppid_start) - goto out; - ppid_start++; - } - - ppid = strtoul(ppid_start, &end, 10); - if (end == ppid_start || *end != ' ') - goto out; - - if (ppid_r) - *ppid_r = ppid; - if (cmd_buf) { - size_t len = min_t(size_t, cmd_end - cmd_start, cmd_buf_sz - 1); - memcpy(cmd_buf, cmd_start, len); - cmd_buf[len] = '\0'; - } - - rc = 0; - out: - close(fd); - - return rc; -} diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h b/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h deleted file mode 100644 index f48d02257a..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/ossp-util.h +++ /dev/null @@ -1,609 +0,0 @@ -/* - * ossp-util - OSS Proxy: Common utilities - * - * Copyright (C) 2008-2010 SUSE Linux Products GmbH - * Copyright (C) 2008-2010 Tejun Heo - * - * This file is released under the GPLv2. - */ - -#ifndef _OSSP_UTIL_H -#define _OSSP_UTIL_H - -#include -#include -#include -#include -#include -#include -#include "ossp.h" - -#define OSSP_LOG_NAME_LEN 128 - -enum { - OSSP_LOG_CRIT = 1, - OSSP_LOG_ERR, - OSSP_LOG_WARN, - OSSP_LOG_INFO, - OSSP_LOG_DFL = OSSP_LOG_INFO, /* default log level */ - OSSP_LOG_DBG0, - OSSP_LOG_DBG1, - OSSP_LOG_MAX = OSSP_LOG_DBG1, -}; - -extern char ossp_log_name[OSSP_LOG_NAME_LEN]; -extern int ossp_log_level; -extern int ossp_log_timestamp; - -#define BITS_PER_BYTE 8 -#define BITS_PER_LONG (BITS_PER_BYTE * sizeof(long)) -#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) -#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) - -/* ARRAY_SIZE and min/max macros stolen from linux/kernel.h */ -#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) - -#define min(x, y) ({ \ - typeof(x) _min1 = (x); \ - typeof(y) _min2 = (y); \ - (void) (&_min1 == &_min2); \ - _min1 < _min2 ? _min1 : _min2; }) - -#define max(x, y) ({ \ - typeof(x) _max1 = (x); \ - typeof(y) _max2 = (y); \ - (void) (&_max1 == &_max2); \ - _max1 > _max2 ? _max1 : _max2; }) - -#define min_t(type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1: __min2; }) - -#define max_t(type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1: __max2; }) - -void log_msg(int severity, const char *fmt, ...) - __attribute__ ((format (printf, 2, 3))); - -#define fatal(fmt, args...) do { \ - log_msg(OSSP_LOG_CRIT, fmt , ##args); \ - _exit(1); \ -} while (0) -#define err(fmt, args...) log_msg(OSSP_LOG_ERR, fmt , ##args) -#define warn(fmt, args...) log_msg(OSSP_LOG_WARN, fmt , ##args) -#define info(fmt, args...) log_msg(OSSP_LOG_INFO, fmt , ##args) -#define dbg0(fmt, args...) log_msg(OSSP_LOG_DBG0, fmt , ##args) -#define dbg1(fmt, args...) log_msg(OSSP_LOG_DBG1, fmt , ##args) - -#define fatal_e(e, fmt, args...) \ - fatal(fmt" (%s)" , ##args, strerror(-(e))) -#define err_e(e, fmt, args...) \ - err(fmt" (%s)" , ##args, strerror(-(e))) -#define warn_e(e, fmt, args...) \ - warn(fmt" (%s)" , ##args, strerror(-(e))) -#define info_e(e, fmt, args...) \ - info(fmt" (%s)" , ##args, strerror(-(e))) -#define dbg0_e(e, fmt, args...) \ - dbg0(fmt" (%s)" , ##args, strerror(-(e))) -#define dbg1_e(e, fmt, args...) \ - dbg1(fmt" (%s)" , ##args, strerror(-(e))) - -struct ring_buf { - char *buf; - size_t size; - size_t head; - size_t bytes; -}; - -static inline size_t ring_size(struct ring_buf *ring) -{ - return ring->size; -} - -static inline size_t ring_bytes(struct ring_buf *ring) -{ - return ring->bytes; -} - -static inline size_t ring_space(struct ring_buf *ring) -{ - return ring->size - ring->bytes; -} - -static inline void ring_consume(struct ring_buf *ring, size_t size) -{ - assert(ring->bytes >= size); - ring->bytes -= size; -} - -static inline void ring_manual_init(struct ring_buf *ring, void *buf, - size_t size, size_t head, size_t bytes) -{ - ring->buf = buf; - ring->size = size; - ring->head = head; - ring->bytes = bytes; -} - -void ring_fill(struct ring_buf *ring, const void *buf, size_t size); -void *ring_data(struct ring_buf *ring, size_t *sizep); -int ring_resize(struct ring_buf *ring, size_t new_size); - -struct sized_buf { - char *buf; - size_t size; -}; - -int ensure_sbuf_size(struct sized_buf *sbuf, size_t size); - -int read_fill(int fd, void *buf, size_t size); -int write_fill(int fd, const void *buf, size_t size); - -/* - * Bitops lifted from linux asm-generic implementation. - */ -unsigned long find_next_zero_bit(const unsigned long *addr, unsigned - long size, unsigned long offset); -#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0) -extern void __set_bit(int nr, volatile unsigned long *addr); -extern void __clear_bit(int nr, volatile unsigned long *addr); - -typedef ssize_t (*ossp_action_fn_t)(enum ossp_opcode opcode, - void *carg, void *din, size_t din_sz, - void *rarg, void *dout, size_t *dout_szp, - int fd); - -int get_proc_self_info(pid_t tid, pid_t *pgrp, - char *cmd_buf, size_t cmd_buf_sz); - -/* - * Doubly linked list handling code shamelessly stolen from the Linux - * kernel 2.6.26 include/linux/list.h. - */ - -/** - * container_of - cast a member of a structure out to the containing structure - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. - * - */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) - -/* - * Simple doubly linked list implementation. - * - * Some of the internal functions ("__xxx") are useful when - * manipulating whole lists rather than single entries, as - * sometimes we already know the next/prev entries and we can - * generate better code by using them directly rather than - * using the generic single-entry routines. - */ - -struct list_head { - struct list_head *next, *prev; -}; - -#define LIST_HEAD_INIT(name) { &(name), &(name) } - -#define LIST_HEAD(name) \ - struct list_head name = LIST_HEAD_INIT(name) - -static inline void INIT_LIST_HEAD(struct list_head *list) -{ - list->next = list; - list->prev = list; -} - -/* - * Insert a new entry between two known consecutive entries. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_add(struct list_head *new, - struct list_head *prev, - struct list_head *next) -{ - next->prev = new; - new->next = next; - new->prev = prev; - prev->next = new; -} - -/** - * list_add - add a new entry - * @new: new entry to be added - * @head: list head to add it after - * - * Insert a new entry after the specified head. - * This is good for implementing stacks. - */ -static inline void list_add(struct list_head *new, struct list_head *head) -{ - __list_add(new, head, head->next); -} - -/** - * list_add_tail - add a new entry - * @new: new entry to be added - * @head: list head to add it before - * - * Insert a new entry before the specified head. - * This is useful for implementing queues. - */ -static inline void list_add_tail(struct list_head *new, struct list_head *head) -{ - __list_add(new, head->prev, head); -} - -/* - * Delete a list entry by making the prev/next entries - * point to each other. - * - * This is only for internal list manipulation where we know - * the prev/next entries already! - */ -static inline void __list_del(struct list_head * prev, struct list_head * next) -{ - next->prev = prev; - prev->next = next; -} - -/** - * list_del - deletes entry from list. - * @entry: the element to delete from the list. - * Note: list_empty() on entry does not return true after this, the entry is - * in an undefined state. - */ -static inline void list_del(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - entry->next = LIST_POISON1; - entry->prev = LIST_POISON2; -} - -/** - * list_replace - replace old entry by new one - * @old : the element to be replaced - * @new : the new element to insert - * - * If @old was empty, it will be overwritten. - */ -static inline void list_replace(struct list_head *old, - struct list_head *new) -{ - new->next = old->next; - new->next->prev = new; - new->prev = old->prev; - new->prev->next = new; -} - -static inline void list_replace_init(struct list_head *old, - struct list_head *new) -{ - list_replace(old, new); - INIT_LIST_HEAD(old); -} - -/** - * list_del_init - deletes entry from list and reinitialize it. - * @entry: the element to delete from the list. - */ -static inline void list_del_init(struct list_head *entry) -{ - __list_del(entry->prev, entry->next); - INIT_LIST_HEAD(entry); -} - -/** - * list_move - delete from one list and add as another's head - * @list: the entry to move - * @head: the head that will precede our entry - */ -static inline void list_move(struct list_head *list, struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add(list, head); -} - -/** - * list_move_tail - delete from one list and add as another's tail - * @list: the entry to move - * @head: the head that will follow our entry - */ -static inline void list_move_tail(struct list_head *list, - struct list_head *head) -{ - __list_del(list->prev, list->next); - list_add_tail(list, head); -} - -/** - * list_is_last - tests whether @list is the last entry in list @head - * @list: the entry to test - * @head: the head of the list - */ -static inline int list_is_last(const struct list_head *list, - const struct list_head *head) -{ - return list->next == head; -} - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. - */ -static inline int list_empty(const struct list_head *head) -{ - return head->next == head; -} - -/** - * list_empty_careful - tests whether a list is empty and not being modified - * @head: the list to test - * - * Description: - * tests whether a list is empty _and_ checks that no other CPU might be - * in the process of modifying either member (next or prev) - * - * NOTE: using list_empty_careful() without synchronization - * can only be safe if the only activity that can happen - * to the list entry is list_del_init(). Eg. it cannot be used - * if another CPU could re-list_add() it. - */ -static inline int list_empty_careful(const struct list_head *head) -{ - struct list_head *next = head->next; - return (next == head) && (next == head->prev); -} - -/** - * list_is_singular - tests whether a list has just one entry. - * @head: the list to test. - */ -static inline int list_is_singular(const struct list_head *head) -{ - return !list_empty(head) && (head->next == head->prev); -} - -static inline void __list_splice(const struct list_head *list, - struct list_head *head) -{ - struct list_head *first = list->next; - struct list_head *last = list->prev; - struct list_head *at = head->next; - - first->prev = head; - head->next = first; - - last->next = at; - at->prev = last; -} - -/** - * list_splice - join two lists - * @list: the new list to add. - * @head: the place to add it in the first list. - */ -static inline void list_splice(const struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) - __list_splice(list, head); -} - -/** - * list_splice_init - join two lists and reinitialise the emptied list. - * @list: the new list to add. - * @head: the place to add it in the first list. - * - * The list at @list is reinitialised - */ -static inline void list_splice_init(struct list_head *list, - struct list_head *head) -{ - if (!list_empty(list)) { - __list_splice(list, head); - INIT_LIST_HEAD(list); - } -} - -/** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_first_entry - get the first element from a list - * @ptr: the list head to take the element from. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_struct within the struct. - * - * Note, that list is expected to be not empty. - */ -#define list_first_entry(ptr, type, member) \ - list_entry((ptr)->next, type, member) - -/** - * list_for_each - iterate over a list - * @pos: the &struct list_head to use as a loop cursor. - * @head: the head for your list. - */ -#define list_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -/** - * list_for_each_prev - iterate over a list backwards - * @pos: the &struct list_head to use as a loop cursor. - * @head: the head for your list. - */ -#define list_for_each_prev(pos, head) \ - for (pos = (head)->prev; pos != (head); pos = pos->prev) - -/** - * list_for_each_safe - iterate over a list safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -/** - * list_for_each_prev_safe - iterate over a list backwards safe against removal of list entry - * @pos: the &struct list_head to use as a loop cursor. - * @n: another &struct list_head to use as temporary storage - * @head: the head for your list. - */ -#define list_for_each_prev_safe(pos, n, head) \ - for (pos = (head)->prev, n = pos->prev; \ - pos != (head); pos = n, n = pos->prev) - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_reverse - iterate backwards over list of given type. - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_reverse(pos, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) - -/** - * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() - * @pos: the type * to use as a start point - * @head: the head of the list - * @member: the name of the list_struct within the struct. - * - * Prepares a pos entry for use as a start point in list_for_each_entry_continue(). - */ -#define list_prepare_entry(pos, head, member) \ - ((pos) ? : list_entry(head, typeof(*pos), member)) - -/** - * list_for_each_entry_continue - continue iteration over list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Continue to iterate over list of given type, continuing after - * the current position. - */ -#define list_for_each_entry_continue(pos, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_continue_reverse - iterate backwards from the given point - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Start to iterate over list of given type backwards, continuing after - * the current position. - */ -#define list_for_each_entry_continue_reverse(pos, head, member) \ - for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.prev, typeof(*pos), member)) - -/** - * list_for_each_entry_from - iterate over list of given type from the current point - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Iterate over list of given type, continuing from current position. - */ -#define list_for_each_entry_from(pos, head, member) \ - for (; &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_for_each_entry_safe_continue - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Iterate over list of given type, continuing after current point, - * safe against removal of list entry. - */ -#define list_for_each_entry_safe_continue(pos, n, head, member) \ - for (pos = list_entry(pos->member.next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_for_each_entry_safe_from - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Iterate over list of given type from current point, safe against - * removal of list entry. - */ -#define list_for_each_entry_safe_from(pos, n, head, member) \ - for (n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_for_each_entry_safe_reverse - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_struct within the struct. - * - * Iterate backwards over list of given type, safe against removal - * of list entry. - */ -#define list_for_each_entry_safe_reverse(pos, n, head, member) \ - for (pos = list_entry((head)->prev, typeof(*pos), member), \ - n = list_entry(pos->member.prev, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.prev, typeof(*n), member)) - -#endif /*_OSSP_UTIL_H*/ diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp.c b/src/mod/endpoints/mod_skypopen/osscuse/ossp.c deleted file mode 100644 index 96f98fa37a..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/ossp.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ossp - OSS Proxy: emulate OSS device using CUSE - * - * Copyright (C) 2008-2010 SUSE Linux Products GmbH - * Copyright (C) 2008-2010 Tejun Heo - * - * This file is released under the GPLv2. - */ - -#include "ossp.h" - -const struct ossp_arg_size ossp_arg_sizes[OSSP_NR_OPCODES] = { - [OSSP_MIXER] = { sizeof(struct ossp_mixer_arg), - sizeof(struct ossp_mixer_arg), 0 }, - - [OSSP_DSP_OPEN] = { sizeof(struct ossp_dsp_open_arg), 0, 0 }, - [OSSP_DSP_READ] = { sizeof(struct ossp_dsp_rw_arg), 0, 0 }, - [OSSP_DSP_WRITE] = { sizeof(struct ossp_dsp_rw_arg), 0, 0 }, - [OSSP_DSP_POLL] = { sizeof(int), sizeof(unsigned), 0 }, - [OSSP_DSP_MMAP] = { sizeof(struct ossp_dsp_mmap_arg), 0, 0 }, - [OSSP_DSP_MUNMAP] = { sizeof(int), 0, 0 }, - - [OSSP_DSP_RESET] = { 0, 0, 0 }, - [OSSP_DSP_SYNC] = { 0, 0, 0 }, - [OSSP_DSP_POST] = { 0, 0, 0 }, - [OSSP_DSP_GET_RATE] = { 0, sizeof(int), 0 }, - [OSSP_DSP_GET_CHANNELS] = { 0, sizeof(int), 0 }, - [OSSP_DSP_GET_FORMAT] = { 0, sizeof(int), 0 }, - [OSSP_DSP_GET_BLKSIZE] = { 0, sizeof(int), 0 }, - [OSSP_DSP_GET_FORMATS] = { 0, sizeof(int), 0 }, - [OSSP_DSP_SET_RATE] = { sizeof(int), sizeof(int), 0 }, - [OSSP_DSP_SET_CHANNELS] = { sizeof(int), sizeof(int), 0 }, - [OSSP_DSP_SET_FORMAT] = { sizeof(int), sizeof(int), 0 }, - [OSSP_DSP_SET_SUBDIVISION] = { sizeof(int), sizeof(int), 0 }, - [OSSP_DSP_SET_FRAGMENT] = { sizeof(int), 0, 0 }, - [OSSP_DSP_GET_TRIGGER] = { 0, sizeof(int), 0 }, - [OSSP_DSP_SET_TRIGGER] = { sizeof(int), 0, 0 }, - [OSSP_DSP_GET_OSPACE] = { 0, sizeof(struct audio_buf_info), 0 }, - [OSSP_DSP_GET_ISPACE] = { 0, sizeof(struct audio_buf_info), 0 }, - [OSSP_DSP_GET_OPTR] = { 0, sizeof(struct count_info), 0 }, - [OSSP_DSP_GET_IPTR] = { 0, sizeof(struct count_info), 0 }, - [OSSP_DSP_GET_ODELAY] = { 0, sizeof(int), 0 }, -}; - -const char *ossp_cmd_str[OSSP_NR_OPCODES] = { - [OSSP_MIXER] = "MIXER", - - [OSSP_DSP_OPEN] = "OPEN", - [OSSP_DSP_READ] = "READ", - [OSSP_DSP_WRITE] = "WRITE", - [OSSP_DSP_POLL] = "POLL", - [OSSP_DSP_MMAP] = "MMAP", - [OSSP_DSP_MUNMAP] = "MUNMAP", - - [OSSP_DSP_RESET] = "RESET", - [OSSP_DSP_SYNC] = "SYNC", - [OSSP_DSP_POST] = "POST", - - [OSSP_DSP_GET_RATE] = "GET_RATE", - [OSSP_DSP_GET_CHANNELS] = "GET_CHANNELS", - [OSSP_DSP_GET_FORMAT] = "GET_FORMAT", - [OSSP_DSP_GET_BLKSIZE] = "GET_BLKSIZE", - [OSSP_DSP_GET_FORMATS] = "GET_FORMATS", - [OSSP_DSP_SET_RATE] = "SET_RATE", - [OSSP_DSP_SET_CHANNELS] = "SET_CHANNELS", - [OSSP_DSP_SET_FORMAT] = "SET_FORMAT", - [OSSP_DSP_SET_SUBDIVISION] = "SET_BUSDIVISION", - - [OSSP_DSP_SET_FRAGMENT] = "SET_FRAGMENT", - [OSSP_DSP_GET_TRIGGER] = "GET_TRIGGER", - [OSSP_DSP_SET_TRIGGER] = "SET_TRIGGER", - [OSSP_DSP_GET_OSPACE] = "GET_OSPACE", - [OSSP_DSP_GET_ISPACE] = "GET_ISPACE", - [OSSP_DSP_GET_OPTR] = "GET_OPTR", - [OSSP_DSP_GET_IPTR] = "GET_IPTR", - [OSSP_DSP_GET_ODELAY] = "GET_ODELAY", -}; - -const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES] = { - [OSSP_NOTIFY_POLL] = "POLL", - [OSSP_NOTIFY_OBITUARY] = "OBITUARY", - [OSSP_NOTIFY_VOLCHG] = "VOLCHG", -}; diff --git a/src/mod/endpoints/mod_skypopen/osscuse/ossp.h b/src/mod/endpoints/mod_skypopen/osscuse/ossp.h deleted file mode 100644 index 9d03e63adf..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/ossp.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * ossp - OSS Proxy: emulate OSS device using CUSE - * - * Copyright (C) 2008-2010 SUSE Linux Products GmbH - * Copyright (C) 2008-2010 Tejun Heo - * - * This file is released under the GPLv2. - */ - -#ifndef _OSSP_H -#define _OSSP_H - -#include -#include -#include - -#define OSSP_VERSION "1.3.2" -#define OSSP_CMD_MAGIC 0xdeadbeef -#define OSSP_REPLY_MAGIC 0xbeefdead -#define OSSP_NOTIFY_MAGIC 0xbebebebe - -#define PLAY 0 -#define REC 1 -#define LEFT 0 -#define RIGHT 1 - -enum ossp_opcode { - OSSP_MIXER, - - OSSP_DSP_OPEN, - OSSP_DSP_READ, - OSSP_DSP_WRITE, - OSSP_DSP_POLL, - OSSP_DSP_MMAP, - OSSP_DSP_MUNMAP, - - OSSP_DSP_RESET, - OSSP_DSP_SYNC, - OSSP_DSP_POST, - - OSSP_DSP_GET_RATE, - OSSP_DSP_GET_CHANNELS, - OSSP_DSP_GET_FORMAT, - OSSP_DSP_GET_BLKSIZE, - OSSP_DSP_GET_FORMATS, - OSSP_DSP_SET_RATE, - OSSP_DSP_SET_CHANNELS, - OSSP_DSP_SET_FORMAT, - OSSP_DSP_SET_SUBDIVISION, - - OSSP_DSP_SET_FRAGMENT, - OSSP_DSP_GET_TRIGGER, - OSSP_DSP_SET_TRIGGER, - OSSP_DSP_GET_OSPACE, - OSSP_DSP_GET_ISPACE, - OSSP_DSP_GET_OPTR, - OSSP_DSP_GET_IPTR, - OSSP_DSP_GET_ODELAY, - - OSSP_NR_OPCODES, -}; - -enum ossp_notify_opcode { - OSSP_NOTIFY_POLL, - OSSP_NOTIFY_OBITUARY, - OSSP_NOTIFY_VOLCHG, - - OSSP_NR_NOTIFY_OPCODES, -}; - -struct ossp_mixer_arg { - int vol[2][2]; -}; - -struct ossp_dsp_open_arg { - int flags; - pid_t opener_pid; -}; - -struct ossp_dsp_rw_arg { - unsigned nonblock:1; -}; - -struct ossp_dsp_mmap_arg { - int dir; - size_t size; -}; - -struct ossp_cmd { - unsigned magic; - enum ossp_opcode opcode; - size_t din_size; - size_t dout_size; -}; - -struct ossp_reply { - unsigned magic; - int result; - size_t dout_size; /* <= cmd.data_in_size */ -}; - -struct ossp_notify { - unsigned magic; - enum ossp_notify_opcode opcode; -}; - -struct ossp_arg_size { - ssize_t carg_size; - ssize_t rarg_size; - unsigned has_fd:1; -}; - -extern const struct ossp_arg_size ossp_arg_sizes[OSSP_NR_OPCODES]; -extern const char *ossp_cmd_str[OSSP_NR_OPCODES]; -extern const char *ossp_notify_str[OSSP_NR_NOTIFY_OPCODES]; - -#endif /* _OSSP_H */ diff --git a/src/mod/endpoints/mod_skypopen/osscuse/osspd.c b/src/mod/endpoints/mod_skypopen/osscuse/osspd.c deleted file mode 100644 index dc9f36a09b..0000000000 --- a/src/mod/endpoints/mod_skypopen/osscuse/osspd.c +++ /dev/null @@ -1,2374 +0,0 @@ -/* - * osspd - OSS Proxy Daemon: emulate OSS device using CUSE - * - * Copyright (C) 2008-2010 SUSE Linux Products GmbH - * Copyright (C) 2008-2010 Tejun Heo - * - * This file is released under the GPLv2. - */ -#undef GIOVANNI - -#define FUSE_USE_VERSION 28 -#define _GNU_SOURCE - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "ossp.h" -#include "ossp-util.h" - -/* - * MMAP support needs to be updated to the new fuse MMAP API. Disable - * it for the time being. - */ -#warning mmap support disabled for now -/* #define OSSP_MMAP */ - -#define DFL_MIXER_NAME "mixer" -#define DFL_DSP_NAME "dsp" -#define DFL_ADSP_NAME "adsp" -#define STRFMT "S[%u/%d]" -#define STRID(os) os->id, os->pid - -#define dbg1_os(os, fmt, args...) dbg1(STRFMT" "fmt, STRID(os) , ##args) -#define dbg0_os(os, fmt, args...) dbg0(STRFMT" "fmt, STRID(os) , ##args) -#define warn_os(os, fmt, args...) warn(STRFMT" "fmt, STRID(os) , ##args) -#define err_os(os, fmt, args...) err(STRFMT" "fmt, STRID(os) , ##args) -#define warn_ose(os, err, fmt, args...) \ - warn_e(err, STRFMT" "fmt, STRID(os) , ##args) -#define err_ose(os, err, fmt, args...) \ - err_e(err, STRFMT" "fmt, STRID(os) , ##args) - -enum { - SNDRV_OSS_VERSION = ((3<<16)|(8<<8)|(1<<4)|(0)), /* 3.8.1a */ - DFL_MIXER_MAJOR = 14, - DFL_MIXER_MINOR = 0, - DFL_DSP_MAJOR = 14, - DFL_DSP_MINOR = 3, - DFL_ADSP_MAJOR = 14, - DFL_ADSP_MINOR = 12, - DFL_MAX_STREAMS = 128, - MIXER_PUT_DELAY = 600, /* 10 mins */ - /* DSPS_MMAP_SIZE / 2 must be multiple of SHMLBA */ - DSPS_MMAP_SIZE = 2 * (512 << 10), /* 512k for each dir */ -}; - -struct ossp_uid_cnt { - struct list_head link; - uid_t uid; - unsigned nr_os; -}; - -struct ossp_mixer { - pid_t pgrp; - struct list_head link; - struct list_head delayed_put_link; - unsigned refcnt; - /* the following two fields are protected by mixer_mutex */ - int vol[2][2]; - int modify_counter; - time_t put_expires; -}; - -struct ossp_mixer_cmd { - struct ossp_mixer *mixer; - struct ossp_mixer_arg set; - int out_dir; - int rvol; -}; - -#define for_each_vol(i, j) \ - for (i = 0, j = 0; i < 2; j += i << 1, j++, i = j >> 1, j &= 1) - -struct ossp_stream { - unsigned id; /* stream ID */ - struct list_head link; - struct list_head pgrp_link; - struct list_head notify_link; - unsigned refcnt; - pthread_mutex_t cmd_mutex; - pthread_mutex_t mmap_mutex; - struct fuse_pollhandle *ph; - - /* stream owner info */ - pid_t pid; - pid_t pgrp; - uid_t uid; - gid_t gid; - - /* slave info */ - pid_t slave_pid; - int cmd_fd; - int notify_tx; - int notify_rx; - - /* the following dead flag is set asynchronously, keep it separate. */ - int dead; - - /* stream mixer state, protected by mixer_mutex */ - int mixer_pending; - int vol[2][2]; - int vol_set[2][2]; - - off_t mmap_off; - size_t mmap_size; - - struct ossp_uid_cnt *ucnt; - struct fuse_session *se; /* associated fuse session */ - struct ossp_mixer *mixer; -}; - -struct ossp_dsp_stream { - struct ossp_stream os; - unsigned rw; - unsigned mmapped; - int nonblock; -}; - -#define os_to_dsps(_os) container_of(_os, struct ossp_dsp_stream, os) - -static unsigned max_streams; -static unsigned umax_streams; -static unsigned hashtbl_size; -static char dsp_slave_path[PATH_MAX]; - -static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_mutex_t mixer_mutex = PTHREAD_MUTEX_INITIALIZER; -static unsigned long *os_id_bitmap; -static unsigned nr_mixers; -static struct list_head *mixer_tbl; /* indexed by PGRP */ -static struct list_head *os_tbl; /* indexed by ID */ -static struct list_head *os_pgrp_tbl; /* indexed by PGRP */ -static struct list_head *os_notify_tbl; /* indexed by notify fd */ -static LIST_HEAD(uid_cnt_list); -static int notify_epfd; /* epoll used to monitor notify fds */ -static pthread_t notify_poller_thread; -static pthread_t slave_reaper_thread; -static pthread_t mixer_delayed_put_thread; -static pthread_t cuse_mixer_thread; -static pthread_t cuse_adsp_thread; -static pthread_cond_t notify_poller_kill_wait = PTHREAD_COND_INITIALIZER; -static pthread_cond_t slave_reaper_wait = PTHREAD_COND_INITIALIZER; -static LIST_HEAD(slave_corpse_list); -static LIST_HEAD(mixer_delayed_put_head); /* delayed reference */ -static pthread_cond_t mixer_delayed_put_cond = PTHREAD_COND_INITIALIZER; - -static int init_wait_fd = -1; -static int exit_on_idle; -static struct fuse_session *mixer_se; -static struct fuse_session *dsp_se; -static struct fuse_session *adsp_se; - -static void put_os(struct ossp_stream *os); - - -/*************************************************************************** - * Accessors - */ - -static struct list_head *mixer_tbl_head(pid_t pid) -{ - return &mixer_tbl[pid % hashtbl_size]; -} - -static struct list_head *os_tbl_head(uint64_t id) -{ - return &os_tbl[id % hashtbl_size]; -} - -static struct list_head *os_pgrp_tbl_head(pid_t pgrp) -{ - return &os_pgrp_tbl[pgrp % hashtbl_size]; -} - -static struct list_head *os_notify_tbl_head(int notify_rx) -{ - return &os_notify_tbl[notify_rx % hashtbl_size]; -} - -static struct ossp_mixer *find_mixer_locked(pid_t pgrp) -{ - struct ossp_mixer *mixer; - - list_for_each_entry(mixer, mixer_tbl_head(pgrp), link) - if (mixer->pgrp == pgrp) - return mixer; - return NULL; -} - -static struct ossp_mixer *find_mixer(pid_t pgrp) -{ - struct ossp_mixer *mixer; - - pthread_mutex_lock(&mutex); - mixer = find_mixer_locked(pgrp); - pthread_mutex_unlock(&mutex); - return mixer; -} - -static struct ossp_stream *find_os(unsigned id) -{ - struct ossp_stream *os, *found = NULL; - - pthread_mutex_lock(&mutex); - list_for_each_entry(os, os_tbl_head(id), link) - if (os->id == id) { - found = os; - break; - } - pthread_mutex_unlock(&mutex); - return found; -} - -static struct ossp_stream *find_os_by_notify_rx(int notify_rx) -{ - struct ossp_stream *os, *found = NULL; - - pthread_mutex_lock(&mutex); - list_for_each_entry(os, os_notify_tbl_head(notify_rx), notify_link) - if (os->notify_rx == notify_rx) { - found = os; - break; - } - pthread_mutex_unlock(&mutex); - return found; -} - - -/*************************************************************************** - * Command and ioctl helpers - */ - -static ssize_t exec_cmd_intern(struct ossp_stream *os, enum ossp_opcode opcode, - const void *carg, size_t carg_size, const void *din, size_t din_size, - void *rarg, size_t rarg_size, void *dout, size_t *dout_sizep, int fd) -{ - size_t dout_size = dout_sizep ? *dout_sizep : 0; - struct ossp_cmd cmd = { .magic = OSSP_CMD_MAGIC, .opcode = opcode, - .din_size = din_size, - .dout_size = dout_size }; - struct iovec iov = { &cmd, sizeof(cmd) }; - struct msghdr msg = { .msg_iov = &iov, .msg_iovlen = 1 }; - struct ossp_reply reply = { }; - char cmsg_buf[CMSG_SPACE(sizeof(fd))]; - char reason[512]; - int rc; - - if (os->dead) - return -EIO; - - //dbg1_os(os, "opcode %s=%d carg=%zu din=%zu rarg=%zu dout=%zu", - //ossp_cmd_str[opcode], opcode, carg_size, din_size, rarg_size, - //dout_size); -#ifndef GIOVANNI -memset(dout, 255, dout_size); -memset(din, 255, din_size); - -#define GIOVA_BLK 3840 -#define GIOVA_SLEEP 40000 -switch(opcode){ - - case 1: //OPEN - reply.result = 0; - break; - case 2: //READ - usleep((GIOVA_SLEEP/GIOVA_BLK)* *dout_sizep); - reply.result = *dout_sizep; - break; - case 3: //WRITE - usleep((GIOVA_SLEEP/GIOVA_BLK)* din_size); - reply.result = din_size; - break; - case 9: //POST - reply.result = -32; - break; - case 13: //GET_BLKSIZE - reply.result = 0; - *(int *)rarg = GIOVA_BLK; - break; - case 14: //GET_FORMATS - reply.result = 0; - *(int *)rarg = 28731; - break; - case 15: //SET_RATE - reply.result = 0; - *(int *)rarg = *(int *) carg; - break; - case 16: //SET_CHANNELS - reply.result = 0; - *(int *)rarg = *(int *) carg; - break; - case 17: //SET_FORMAT - reply.result = 0; - *(int *)rarg = *(int *) carg; - break; - case 19: //SET_FRAGMENT - reply.result = 0; - break; - default: - reply.result = 0; - break; -} -#endif // GIOVANNI - -#ifdef GIOVANNI - if (fd >= 0) { - struct cmsghdr *cmsg; - - msg.msg_control = cmsg_buf; - msg.msg_controllen = sizeof(cmsg_buf); - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); - *(int *)CMSG_DATA(cmsg) = fd; - msg.msg_controllen = cmsg->cmsg_len; - } - - if (sendmsg(os->cmd_fd, &msg, 0) <= 0) { - rc = -errno; - snprintf(reason, sizeof(reason), "command sendmsg failed: %s", - strerror(-rc)); - goto fail; - } - - if ((rc = write_fill(os->cmd_fd, carg, carg_size)) < 0 || - (rc = write_fill(os->cmd_fd, din, din_size)) < 0) { - snprintf(reason, sizeof(reason), - "can't tranfer command argument and/or data: %s", - strerror(-rc)); - goto fail; - } - if ((rc = read_fill(os->cmd_fd, &reply, sizeof(reply))) < 0) { - snprintf(reason, sizeof(reason), "can't read reply: %s", - strerror(-rc)); - goto fail; - } - - if (reply.magic != OSSP_REPLY_MAGIC) { - snprintf(reason, sizeof(reason), - "reply magic mismatch %x != %x", - reply.magic, OSSP_REPLY_MAGIC); - rc = -EINVAL; - goto fail; - } - - if (reply.result < 0) - goto out_unlock; - - if (reply.dout_size > dout_size) { - snprintf(reason, sizeof(reason), - "data out size overflow %zu > %zu", - reply.dout_size, dout_size); - rc = -EINVAL; - goto fail; - } - - dout_size = reply.dout_size; - if (dout_sizep) - *dout_sizep = dout_size; - - if ((rc = read_fill(os->cmd_fd, rarg, rarg_size)) < 0 || - (rc = read_fill(os->cmd_fd, dout, dout_size)) < 0) { - snprintf(reason, sizeof(reason), "can't read data out: %s", - strerror(-rc)); - goto fail; - } - -#endif // GIOVANNI - -out_unlock: - //dbg1_os(os, " completed, result=%d dout=%zu", - //reply.result, dout_size); - -//if(rarg) - //dbg1_os(os, " 2 %s=%d completed, result=%d dout=%zu carg=%d rarg=%d", ossp_cmd_str[opcode], opcode, - //reply.result, dout_size, carg ? *(int *) carg : 666, *(int *)rarg); - return reply.result; - -fail: - warn_os(os, "communication with slave failed (%s)", reason); - os->dead = 1; - return rc; -} - -static ssize_t exec_cmd(struct ossp_stream *os, enum ossp_opcode opcode, - const void *carg, size_t carg_size, const void *din, size_t din_size, - void *rarg, size_t rarg_size, void *dout, size_t *dout_sizep, int fd) -{ - int is_mixer; - int i, j; - ssize_t ret, mret; - - /* mixer command is handled exlicitly below */ - is_mixer = opcode == OSSP_MIXER; - if (is_mixer) { - ret = -pthread_mutex_trylock(&os->cmd_mutex); - if (ret) - return ret; - } else { - pthread_mutex_lock(&os->cmd_mutex); - - ret = exec_cmd_intern(os, opcode, carg, carg_size, - din, din_size, rarg, rarg_size, - dout, dout_sizep, fd); - } - - /* lazy mixer handling */ - pthread_mutex_lock(&mixer_mutex); - - if (os->mixer_pending) { - struct ossp_mixer_arg marg; - repeat_mixer: - /* we have mixer command pending */ - memcpy(marg.vol, os->vol_set, sizeof(os->vol_set)); - memset(os->vol_set, -1, sizeof(os->vol_set)); - - pthread_mutex_unlock(&mixer_mutex); - mret = exec_cmd_intern(os, OSSP_MIXER, &marg, sizeof(marg), - NULL, 0, &marg, sizeof(marg), NULL, NULL, - -1); - pthread_mutex_lock(&mixer_mutex); - - /* was there mixer set request while executing mixer command? */ - for_each_vol(i, j) - if (os->vol_set[i][j] >= 0) - goto repeat_mixer; - - /* update internal mixer state */ - if (mret == 0) { - for_each_vol(i, j) { - if (marg.vol[i][j] >= 0) { - if (os->vol[i][j] != marg.vol[i][j]) - os->mixer->modify_counter++; - os->vol[i][j] = marg.vol[i][j]; - } - } - } - os->mixer_pending = 0; - } - - pthread_mutex_unlock(&os->cmd_mutex); - - /* - * mixer mutex must be released after cmd_mutex so that - * exec_mixer_cmd() can guarantee that mixer_pending flags - * will be handled immediately or when the currently - * in-progress command completes. - */ - pthread_mutex_unlock(&mixer_mutex); - - return is_mixer ? mret : ret; -} - -static ssize_t exec_simple_cmd(struct ossp_stream *os, - enum ossp_opcode opcode, void *carg, void *rarg) -{ - return exec_cmd(os, opcode, - carg, ossp_arg_sizes[opcode].carg_size, NULL, 0, - rarg, ossp_arg_sizes[opcode].rarg_size, NULL, NULL, -1); -} - -static int ioctl_prep_uarg(fuse_req_t req, void *in, size_t in_sz, void *out, - size_t out_sz, void *uarg, const void *in_buf, - size_t in_bufsz, size_t out_bufsz) -{ - struct iovec in_iov = { }, out_iov = { }; - int retry = 0; - - if (in) { - if (!in_bufsz) { - in_iov.iov_base = uarg; - in_iov.iov_len = in_sz; - retry = 1; - } else { - assert(in_bufsz == in_sz); - memcpy(in, in_buf, in_sz); - } - } - - if (out) { - if (!out_bufsz) { - out_iov.iov_base = uarg; - out_iov.iov_len = out_sz; - retry = 1; - } else - assert(out_bufsz == out_sz); - } - - if (retry) - fuse_reply_ioctl_retry(req, &in_iov, 1, &out_iov, 1); - - return retry; -} - -#define PREP_UARG(inp, outp) do { \ - if (ioctl_prep_uarg(req, (inp), sizeof(*(inp)), \ - (outp), sizeof(*(outp)), uarg, \ - in_buf, in_bufsz, out_bufsz)) \ - return; \ -} while (0) - -#define IOCTL_RETURN(result, outp) do { \ - if ((outp) != NULL) \ - fuse_reply_ioctl(req, result, (outp), sizeof(*(outp))); \ - else \ - fuse_reply_ioctl(req, result, NULL, 0); \ - return; \ -} while (0) - - -/*************************************************************************** - * Mixer implementation - */ - -static void put_mixer_real(struct ossp_mixer *mixer) -{ - if (!--mixer->refcnt) { - dbg0("DESTROY mixer(%d)", mixer->pgrp); - list_del_init(&mixer->link); - list_del_init(&mixer->delayed_put_link); - free(mixer); - nr_mixers--; - - /* - * If exit_on_idle, mixer for pgrp0 is touched during - * init and each stream has mixer attached. As mixers - * are destroyed after they have been idle for - * MIXER_PUT_DELAY seconds, we can use it for idle - * detection. Note that this might race with - * concurrent open. The race is inherent. - */ - if (exit_on_idle && !nr_mixers) { - info("idle, exiting"); - exit(0); - } - } -} - -static struct ossp_mixer *get_mixer(pid_t pgrp) -{ - struct ossp_mixer *mixer; - - pthread_mutex_lock(&mutex); - - /* is there a matching one? */ - mixer = find_mixer_locked(pgrp); - if (mixer) { - if (list_empty(&mixer->delayed_put_link)) - mixer->refcnt++; - else - list_del_init(&mixer->delayed_put_link); - goto out_unlock; - } - - /* reap delayed put list if there are too many mixers */ - while (nr_mixers > 2 * max_streams && - !list_empty(&mixer_delayed_put_head)) { - struct ossp_mixer *mixer = - list_first_entry(&mixer_delayed_put_head, - struct ossp_mixer, delayed_put_link); - - assert(mixer->refcnt == 1); - put_mixer_real(mixer); - } - - /* create a new one */ - mixer = calloc(1, sizeof(*mixer)); - if (!mixer) { - warn("failed to allocate mixer for %d", pgrp); - mixer = NULL; - goto out_unlock; - } - - mixer->pgrp = pgrp; - INIT_LIST_HEAD(&mixer->link); - INIT_LIST_HEAD(&mixer->delayed_put_link); - mixer->refcnt = 1; - memset(mixer->vol, -1, sizeof(mixer->vol)); - - list_add(&mixer->link, mixer_tbl_head(pgrp)); - nr_mixers++; - dbg0("CREATE mixer(%d)", pgrp); - -out_unlock: - pthread_mutex_unlock(&mutex); - return mixer; -} - -static void put_mixer(struct ossp_mixer *mixer) -{ - pthread_mutex_lock(&mutex); - - if (mixer) { - if (mixer->refcnt == 1) { - struct timespec ts; - - clock_gettime(CLOCK_REALTIME, &ts); - mixer->put_expires = ts.tv_sec + MIXER_PUT_DELAY; - list_add_tail(&mixer->delayed_put_link, - &mixer_delayed_put_head); - pthread_cond_signal(&mixer_delayed_put_cond); - } else - put_mixer_real(mixer); - } - - pthread_mutex_unlock(&mutex); -} - -static void *mixer_delayed_put_worker(void *arg) -{ - struct ossp_mixer *mixer; - struct timespec ts; - time_t now; - - pthread_mutex_lock(&mutex); -again: - clock_gettime(CLOCK_REALTIME, &ts); - now = ts.tv_sec; - - mixer = NULL; - while (!list_empty(&mixer_delayed_put_head)) { - mixer = list_first_entry(&mixer_delayed_put_head, - struct ossp_mixer, delayed_put_link); - - if (now <= mixer->put_expires) - break; - - assert(mixer->refcnt == 1); - put_mixer_real(mixer); - mixer = NULL; - } - - if (mixer) { - ts.tv_sec = mixer->put_expires + 1; - pthread_cond_timedwait(&mixer_delayed_put_cond, &mutex, &ts); - } else - pthread_cond_wait(&mixer_delayed_put_cond, &mutex); - - goto again; -} - -static void init_mixer_cmd(struct ossp_mixer_cmd *mxcmd, - struct ossp_mixer *mixer) -{ - memset(mxcmd, 0, sizeof(*mxcmd)); - memset(&mxcmd->set.vol, -1, sizeof(mxcmd->set.vol)); - mxcmd->mixer = mixer; - mxcmd->out_dir = -1; -} - -static int exec_mixer_cmd(struct ossp_mixer_cmd *mxcmd, struct ossp_stream *os) -{ - int i, j, rc; - - /* - * Set pending flags before trying to execute mixer command. - * Combined with lock release order in exec_cmd(), this - * guarantees that the mixer command will be executed - * immediately or when the current command completes. - */ - pthread_mutex_lock(&mixer_mutex); - os->mixer_pending = 1; - for_each_vol(i, j) - if (mxcmd->set.vol[i][j] >= 0) - os->vol_set[i][j] = mxcmd->set.vol[i][j]; - pthread_mutex_unlock(&mixer_mutex); - - rc = exec_simple_cmd(os, OSSP_MIXER, NULL, NULL); - if (rc >= 0) { - dbg0_os(os, "volume set=%d/%d:%d/%d get=%d/%d:%d/%d", - mxcmd->set.vol[PLAY][LEFT], mxcmd->set.vol[PLAY][RIGHT], - mxcmd->set.vol[REC][LEFT], mxcmd->set.vol[REC][RIGHT], - os->vol[PLAY][LEFT], os->vol[PLAY][RIGHT], - os->vol[REC][LEFT], os->vol[REC][RIGHT]); - } else if (rc != -EBUSY) - warn_ose(os, rc, "mixer command failed"); - - return rc; -} - -static void finish_mixer_cmd(struct ossp_mixer_cmd *mxcmd) -{ - struct ossp_mixer *mixer = mxcmd->mixer; - struct ossp_stream *os; - int dir = mxcmd->out_dir; - int vol[2][2] = { }; - int cnt[2][2] = { }; - int i, j; - - pthread_mutex_lock(&mixer_mutex); - - /* get volume of all streams attached to this mixer */ - pthread_mutex_lock(&mutex); - list_for_each_entry(os, os_pgrp_tbl_head(mixer->pgrp), pgrp_link) { - if (os->pgrp != mixer->pgrp) - continue; - for_each_vol(i, j) { - if (os->vol[i][j] < 0) - continue; - vol[i][j] += os->vol[i][j]; - cnt[i][j]++; - } - } - pthread_mutex_unlock(&mutex); - - /* calculate the summary volume values */ - for_each_vol(i, j) { - if (mxcmd->set.vol[i][j] >= 0) - vol[i][j] = mxcmd->set.vol[i][j]; - else if (cnt[i][j]) - vol[i][j] = vol[i][j] / cnt[i][j]; - else if (mixer->vol[i][j] >= 0) - vol[i][j] = mixer->vol[i][j]; - else - vol[i][j] = 100; - - vol[i][j] = min(max(0, vol[i][j]), 100); - } - - if (dir >= 0) - mxcmd->rvol = vol[dir][LEFT] | (vol[dir][RIGHT] << 8); - - pthread_mutex_unlock(&mixer_mutex); -} - -static void mixer_simple_ioctl(fuse_req_t req, struct ossp_mixer *mixer, - unsigned cmd, void *uarg, const void *in_buf, - size_t in_bufsz, size_t out_bufsz, - int *not_minep) -{ - const char *id = "OSS Proxy", *name = "Mixer"; - int i; - - switch (cmd) { - case SOUND_MIXER_INFO: { - struct mixer_info info = { }; - - PREP_UARG(NULL, &info); - strncpy(info.id, id, sizeof(info.id) - 1); - strncpy(info.name, name, sizeof(info.name) - 1); - info.modify_counter = mixer->modify_counter; - IOCTL_RETURN(0, &info); - } - - case SOUND_OLD_MIXER_INFO: { - struct _old_mixer_info info = { }; - - PREP_UARG(NULL, &info); - strncpy(info.id, id, sizeof(info.id) - 1); - strncpy(info.name, name, sizeof(info.name) - 1); - IOCTL_RETURN(0, &info); - } - - case OSS_GETVERSION: - i = SNDRV_OSS_VERSION; - goto puti; - case SOUND_MIXER_READ_DEVMASK: - case SOUND_MIXER_READ_STEREODEVS: - i = SOUND_MASK_PCM | SOUND_MASK_IGAIN; - goto puti; - case SOUND_MIXER_READ_CAPS: - i = SOUND_CAP_EXCL_INPUT; - goto puti; - case SOUND_MIXER_READ_RECMASK: - case SOUND_MIXER_READ_RECSRC: - i = SOUND_MASK_IGAIN; - goto puti; - puti: - PREP_UARG(NULL, &i); - IOCTL_RETURN(0, &i); - - case SOUND_MIXER_WRITE_RECSRC: - IOCTL_RETURN(0, NULL); - - default: - *not_minep = 1; - return; - } - assert(0); -} - -static void mixer_do_ioctl(fuse_req_t req, struct ossp_mixer *mixer, - unsigned cmd, void *uarg, const void *in_buf, - size_t in_bufsz, size_t out_bufsz) -{ - struct ossp_mixer_cmd mxcmd; - struct ossp_stream *os, **osa; - int not_mine = 0; - int slot = cmd & 0xff, dir; - int nr_os; - int i, rc; - - mixer_simple_ioctl(req, mixer, cmd, uarg, in_buf, in_bufsz, out_bufsz, - ¬_mine); - if (!not_mine) - return; - - rc = -ENXIO; - if (!(cmd & (SIOC_IN | SIOC_OUT))) - goto err; - - /* - * Okay, it's not one of the easy ones. Build mxcmd for - * actual volume control. - */ - if (cmd & SIOC_IN) - PREP_UARG(&i, &i); - else - PREP_UARG(NULL, &i); - - switch (slot) { - case SOUND_MIXER_PCM: - dir = PLAY; - break; - case SOUND_MIXER_IGAIN: - dir = REC; - break; - default: - i = 0; - IOCTL_RETURN(0, &i); - } - - init_mixer_cmd(&mxcmd, mixer); - - if (cmd & SIOC_IN) { - unsigned l, r; - - rc = -EINVAL; - l = i & 0xff; - r = (i >> 8) & 0xff; - if (l > 100 || r > 100) - goto err; - - mixer->vol[dir][LEFT] = mxcmd.set.vol[dir][LEFT] = l; - mixer->vol[dir][RIGHT] = mxcmd.set.vol[dir][RIGHT] = r; - } - mxcmd.out_dir = dir; - - /* - * Apply volume conrol - */ - /* acquire target streams */ - pthread_mutex_lock(&mutex); - osa = calloc(max_streams, sizeof(osa[0])); - if (!osa) { - pthread_mutex_unlock(&mutex); - rc = -ENOMEM; - goto err; - } - - nr_os = 0; - list_for_each_entry(os, os_pgrp_tbl_head(mixer->pgrp), pgrp_link) { - if (os->pgrp == mixer->pgrp) { - osa[nr_os++] = os; - os->refcnt++; - } - } - - pthread_mutex_unlock(&mutex); - - /* execute mxcmd for each stream and put it */ - for (i = 0; i < nr_os; i++) { - exec_mixer_cmd(&mxcmd, osa[i]); - put_os(osa[i]); - } - - finish_mixer_cmd(&mxcmd); - free(osa); - - IOCTL_RETURN(0, out_bufsz ? &mxcmd.rvol : NULL); - -err: - fuse_reply_err(req, -rc); -} - -static void mixer_open(fuse_req_t req, struct fuse_file_info *fi) -{ - pid_t pid = fuse_req_ctx(req)->pid, pgrp; - struct ossp_mixer *mixer; - int rc; - - rc = get_proc_self_info(pid, &pgrp, NULL, 0); - if (rc) { - err_e(rc, "get_proc_self_info(%d) failed", pid); - fuse_reply_err(req, -rc); - return; - } - - mixer = get_mixer(pgrp); - fi->fh = pgrp; - - if (mixer) - fuse_reply_open(req, fi); - else - fuse_reply_err(req, ENOMEM); -} - -static void mixer_ioctl(fuse_req_t req, int signed_cmd, void *uarg, - struct fuse_file_info *fi, unsigned int flags, - const void *in_buf, size_t in_bufsz, size_t out_bufsz) -{ - struct ossp_mixer *mixer; - - mixer = find_mixer(fi->fh); - if (!mixer) { - fuse_reply_err(req, EBADF); - return; - } - - mixer_do_ioctl(req, mixer, signed_cmd, uarg, in_buf, in_bufsz, - out_bufsz); -} - -static void mixer_release(fuse_req_t req, struct fuse_file_info *fi) -{ - struct ossp_mixer *mixer; - - mixer = find_mixer(fi->fh); - if (mixer) { - put_mixer(mixer); - fuse_reply_err(req, 0); - } else - fuse_reply_err(req, EBADF); -} - - -/*************************************************************************** - * Stream implementation - */ - -static int alloc_os(size_t stream_size, size_t mmap_size, pid_t pid, uid_t pgrp, - uid_t uid, gid_t gid, int cmd_sock, - const int *notify, struct fuse_session *se, - struct ossp_stream **osp) -{ - struct ossp_uid_cnt *tmp_ucnt, *ucnt = NULL; - struct ossp_stream *os; - int rc; - - assert(stream_size >= sizeof(struct ossp_stream)); - os = calloc(1, stream_size); - if (!os) - return -ENOMEM; - - INIT_LIST_HEAD(&os->link); - INIT_LIST_HEAD(&os->pgrp_link); - INIT_LIST_HEAD(&os->notify_link); - os->refcnt = 1; - - rc = -pthread_mutex_init(&os->cmd_mutex, NULL); - if (rc) - goto err_free; - - rc = -pthread_mutex_init(&os->mmap_mutex, NULL); - if (rc) - goto err_destroy_cmd_mutex; - - pthread_mutex_lock(&mutex); - - list_for_each_entry(tmp_ucnt, &uid_cnt_list, link) - if (tmp_ucnt->uid == uid) { - ucnt = tmp_ucnt; - break; - } - if (!ucnt) { - rc = -ENOMEM; - ucnt = calloc(1, sizeof(*ucnt)); - if (!ucnt) - goto err_unlock; - ucnt->uid = uid; - list_add(&ucnt->link, &uid_cnt_list); - } - - rc = -EBUSY; - if (ucnt->nr_os + 1 > umax_streams) - goto err_unlock; - - /* everything looks fine, allocate id and init stream */ - rc = -EBUSY; - os->id = find_next_zero_bit(os_id_bitmap, max_streams, 0); - if (os->id >= max_streams) - goto err_unlock; - __set_bit(os->id, os_id_bitmap); - - os->cmd_fd = cmd_sock; - os->notify_tx = notify[1]; - os->notify_rx = notify[0]; - os->pid = pid; - os->pgrp = pgrp; - os->uid = uid; - os->gid = gid; - if (mmap_size) { - os->mmap_off = os->id * mmap_size; - os->mmap_size = mmap_size; - } - os->ucnt = ucnt; - os->se = se; - - memset(os->vol, -1, sizeof(os->vol)); - memset(os->vol_set, -1, sizeof(os->vol)); - - list_add(&os->link, os_tbl_head(os->id)); - list_add(&os->pgrp_link, os_pgrp_tbl_head(os->pgrp)); - - ucnt->nr_os++; - *osp = os; - pthread_mutex_unlock(&mutex); - return 0; - -err_unlock: - pthread_mutex_unlock(&mutex); - pthread_mutex_destroy(&os->mmap_mutex); -err_destroy_cmd_mutex: - pthread_mutex_destroy(&os->cmd_mutex); -err_free: - free(os); - return rc; -} - -static void shutdown_notification(struct ossp_stream *os) -{ - struct ossp_notify obituary = { .magic = OSSP_NOTIFY_MAGIC, - .opcode = OSSP_NOTIFY_OBITUARY }; - ssize_t ret; - - /* - * Shutdown notification for this stream. We politely ask - * notify_poller to shut the receive side down to avoid racing - * with it. - */ - while (os->notify_rx >= 0) { - ret = write(os->notify_tx, &obituary, sizeof(obituary)); - if (ret <= 0) { - if (ret == 0) - warn_os(os, "unexpected EOF on notify_tx"); - else if (errno != EPIPE) - warn_ose(os, -errno, - "unexpected error on notify_tx"); - close(os->notify_rx); - os->notify_rx = -1; - break; - } - - if (ret != sizeof(obituary)) - warn_os(os, "short transfer on notify_tx"); - pthread_cond_wait(¬ify_poller_kill_wait, &mutex); - } -} - -static void put_os(struct ossp_stream *os) -{ - if (!os) - return; - - pthread_mutex_lock(&mutex); - - assert(os->refcnt); - if (--os->refcnt) { - pthread_mutex_unlock(&mutex); - return; - } - - os->dead = 1; - shutdown_notification(os); - - dbg0_os(os, "DESTROY"); - - list_del_init(&os->link); - list_del_init(&os->pgrp_link); - list_del_init(&os->notify_link); - os->ucnt->nr_os--; - - pthread_mutex_unlock(&mutex); - - close(os->cmd_fd); - close(os->notify_tx); - put_mixer(os->mixer); - pthread_mutex_destroy(&os->cmd_mutex); - pthread_mutex_destroy(&os->mmap_mutex); - - pthread_mutex_lock(&mutex); - dbg1_os(os, "stream dead, requesting reaping"); - list_add_tail(&os->link, &slave_corpse_list); - pthread_cond_signal(&slave_reaper_wait); - pthread_mutex_unlock(&mutex); -} - -static void set_extra_env(pid_t pid) -{ - char procenviron[32]; - const int step = 1024; - char *data = malloc(step + 1); - int ofs = 0; - int fd; - int ret; - - if (!data) - return; - - sprintf(procenviron, "/proc/%d/environ", pid); - fd = open(procenviron, O_RDONLY); - if (fd < 0) - return; - - /* - * There should really be a 'read whole file to a newly allocated - * buffer' function. - */ - while ((ret = read(fd, data + ofs, step)) > 0) { - char *newdata; - ofs += ret; - newdata = realloc(data, ofs + step + 1); - if (!newdata) { - ret = -1; - break; - } - data = newdata; - } - if (ret == 0) { - char *ptr = data; - /* Append the extra 0 for end condition */ - data[ofs] = 0; - - while ((ret = strlen(ptr)) > 0) { - /* - * Copy all PULSE variables and DISPLAY so that - * ssh -X remotehost 'mplayer -ao oss' will work - */ - if (!strncmp(ptr, "DISPLAY=", 8) || - !strncmp(ptr, "PULSE_", 6)) - putenv(ptr); - ptr += ret + 1; - } - } - - free(data); - close(fd); -} - -#ifndef GIOVANNI -int contapid = 13000; -#endif// GIOVANNI - -static int create_os(const char *slave_path, - size_t stream_size, size_t mmap_size, - pid_t pid, pid_t pgrp, uid_t uid, gid_t gid, - struct fuse_session *se, struct ossp_stream **osp) -{ - static pthread_mutex_t create_mutex = PTHREAD_MUTEX_INITIALIZER; - int cmd_sock[2] = { -1, -1 }; - int notify_sock[2] = { -1, -1 }; - struct ossp_stream *os = NULL; - struct epoll_event ev = { }; - int i, rc; - - /* - * Only one thread can be creating a stream. This is to avoid - * leaking unwanted fds into slaves. - */ - pthread_mutex_lock(&create_mutex); - - /* prepare communication channels */ - if (socketpair(AF_UNIX, SOCK_STREAM, 0, cmd_sock) || - socketpair(AF_UNIX, SOCK_STREAM, 0, notify_sock)) { - rc = -errno; - warn_e(rc, "failed to create slave command channel"); - goto close_all; - } - - if (fcntl(notify_sock[0], F_SETFL, O_NONBLOCK) < 0) { - rc = -errno; - warn_e(rc, "failed to set NONBLOCK on notify sock"); - goto close_all; - } - - /* - * Alloc stream which will be responsible for all server side - * resources from now on. - */ - rc = alloc_os(stream_size, mmap_size, pid, pgrp, uid, gid, cmd_sock[0], - notify_sock, se, &os); - if (rc) { - warn_e(rc, "failed to allocate stream for %d", pid); - goto close_all; - } - - rc = -ENOMEM; - os->mixer = get_mixer(pgrp); - if (!os->mixer) - goto put_os; - - /* - * Register notification. If successful, notify_poller has - * custody of notify_rx fd. - */ - pthread_mutex_lock(&mutex); - list_add(&os->notify_link, os_notify_tbl_head(os->notify_rx)); - pthread_mutex_unlock(&mutex); - -#ifndef GIOVANNI - os->slave_pid = contapid; - contapid++; - if(contapid > 30000) - contapid=13000; -#endif //GIOVANNI - -//#ifdef GIOVANNI - ev.events = EPOLLIN; - ev.data.fd = notify_sock[0]; - if (epoll_ctl(notify_epfd, EPOLL_CTL_ADD, notify_sock[0], &ev)) { - /* - * Without poller watching this notify sock, poller - * shutdown sequence in shutdown_notification() can't - * be used. Kill notification rx manually. - */ - rc = -errno; - warn_ose(os, rc, "failed to add notify epoll"); - close(os->notify_rx); - os->notify_rx = -1; - goto put_os; - } - - /* start slave */ - os->slave_pid = fork(); - if (os->slave_pid < 0) { - rc = -errno; - warn_ose(os, rc, "failed to fork slave"); - goto put_os; - } - - if (os->slave_pid == 0) { - /* child */ - char id_str[2][16], fd_str[3][16]; - char mmap_off_str[32], mmap_size_str[32]; - char log_str[16], slave_path_copy[PATH_MAX]; - char *argv[] = { slave_path_copy, "-u", id_str[0], - "-g", id_str[1], "-c", fd_str[0], - "-n", fd_str[1], "-m", fd_str[2], - "-o", mmap_off_str, "-s", mmap_size_str, - "-l", log_str, NULL, NULL }; - struct passwd *pwd; - - /* drop stuff we don't need */ - if (close(cmd_sock[0]) || close(notify_sock[0])) - fatal_e(-errno, "failed to close server pipe fds"); - -#ifdef OSSP_MMAP - if (!mmap_size) - close(fuse_mmap_fd(se)); -#endif - - clearenv(); - pwd = getpwuid(os->uid); - if (pwd) { - setenv("LOGNAME", pwd->pw_name, 1); - setenv("USER", pwd->pw_name, 1); - setenv("HOME", pwd->pw_dir, 1); - } - /* Set extra environment variables from the caller */ - set_extra_env(pid); - - /* prep and exec */ - slave_path_copy[sizeof(slave_path_copy) - 1] = '\0'; - strncpy(slave_path_copy, slave_path, sizeof(slave_path_copy) - 1); - if (slave_path_copy[sizeof(slave_path_copy) - 1] != '\0') { - rc = -errno; - err_ose(os, rc, "slave path too long"); - goto child_fail; - } - - snprintf(id_str[0], sizeof(id_str[0]), "%d", os->uid); - snprintf(id_str[1], sizeof(id_str[0]), "%d", os->gid); - snprintf(fd_str[0], sizeof(fd_str[0]), "%d", cmd_sock[1]); - snprintf(fd_str[1], sizeof(fd_str[1]), "%d", notify_sock[1]); - snprintf(fd_str[2], sizeof(fd_str[2]), "%d", -#ifdef OSSP_MMAP - mmap_size ? fuse_mmap_fd(se) : -#endif - -1); - snprintf(mmap_off_str, sizeof(mmap_off_str), "0x%llx", - (unsigned long long)os->mmap_off); - snprintf(mmap_size_str, sizeof(mmap_size_str), "0x%zx", - mmap_size); - snprintf(log_str, sizeof(log_str), "%d", ossp_log_level); - if (ossp_log_timestamp) - argv[ARRAY_SIZE(argv) - 2] = "-t"; - - execv(slave_path, argv); - rc = -errno; - err_ose(os, rc, "execv failed for <%d>", pid); - child_fail: - _exit(1); - } -//#endif //GIOVANNI - - /* turn on CLOEXEC on all server side fds */ - if (fcntl(os->cmd_fd, F_SETFD, FD_CLOEXEC) < 0 || - fcntl(os->notify_tx, F_SETFD, FD_CLOEXEC) < 0 || - fcntl(os->notify_rx, F_SETFD, FD_CLOEXEC) < 0) { - rc = -errno; - err_ose(os, rc, "failed to set CLOEXEC on server side fds"); - goto put_os; - } - - dbg0_os(os, "CREATE slave=%d %s", os->slave_pid, slave_path); - dbg0_os(os, " client=%d cmd=%d:%d notify=%d:%d mmap=%d:0x%llx:%zu", - pid, cmd_sock[0], cmd_sock[1], notify_sock[0], notify_sock[1], -#ifdef OSSP_MMAP - os->mmap_size ? fuse_mmap_fd(se) : -#endif - -1, - (unsigned long long)os->mmap_off, os->mmap_size); - - *osp = os; - rc = 0; - goto close_client_fds; - -put_os: - put_os(os); -close_client_fds: - close(cmd_sock[1]); - pthread_mutex_unlock(&create_mutex); - return rc; - -close_all: - for (i = 0; i < 2; i++) { - close(cmd_sock[i]); - close(notify_sock[i]); - } - pthread_mutex_unlock(&create_mutex); - return rc; -} - -static void dsp_open_common(fuse_req_t req, struct fuse_file_info *fi, - struct fuse_session *se) -{ - const struct fuse_ctx *fuse_ctx = fuse_req_ctx(req); - struct ossp_dsp_open_arg arg = { }; - struct ossp_stream *os = NULL; - struct ossp_mixer *mixer; - struct ossp_dsp_stream *dsps; - struct ossp_mixer_cmd mxcmd; - pid_t pgrp; - ssize_t ret; - - ret = get_proc_self_info(fuse_ctx->pid, &pgrp, NULL, 0); - if (ret) { - err_e(ret, "get_proc_self_info(%d) failed", fuse_ctx->pid); - goto err; - } - - ret = create_os(dsp_slave_path, sizeof(*dsps), DSPS_MMAP_SIZE, - fuse_ctx->pid, pgrp, fuse_ctx->uid, fuse_ctx->gid, - se, &os); - if (ret) - goto err; - dsps = os_to_dsps(os); - mixer = os->mixer; - - switch (fi->flags & O_ACCMODE) { - case O_WRONLY: - dsps->rw |= 1 << PLAY; - break; - case O_RDONLY: - dsps->rw |= 1 << REC; - break; - case O_RDWR: - dsps->rw |= (1 << PLAY) | (1 << REC); - break; - default: - assert(0); - } - - arg.flags = fi->flags; - arg.opener_pid = os->pid; - ret = exec_simple_cmd(&dsps->os, OSSP_DSP_OPEN, &arg, NULL); - if (ret < 0) { - put_os(os); - goto err; - } - - memcpy(os->vol, mixer->vol, sizeof(os->vol)); - if (os->vol[PLAY][0] >= 0 || os->vol[REC][0] >= 0) { - init_mixer_cmd(&mxcmd, mixer); - memcpy(mxcmd.set.vol, os->vol, sizeof(os->vol)); - exec_mixer_cmd(&mxcmd, os); - finish_mixer_cmd(&mxcmd); - } - - fi->direct_io = 1; - fi->nonseekable = 1; - fi->fh = os->id; - - fuse_reply_open(req, fi); - return; - -err: - fuse_reply_err(req, -ret); -} - -static void dsp_open(fuse_req_t req, struct fuse_file_info *fi) -{ - dsp_open_common(req, fi, dsp_se); -} - -static void adsp_open(fuse_req_t req, struct fuse_file_info *fi) -{ - dsp_open_common(req, fi, adsp_se); -} - -static void dsp_release(fuse_req_t req, struct fuse_file_info *fi) -{ - struct ossp_stream *os; - - os = find_os(fi->fh); - if (os) { - put_os(os); - fuse_reply_err(req, 0); - } else - fuse_reply_err(req, EBADF); -} - -static void dsp_read(fuse_req_t req, size_t size, off_t off, - struct fuse_file_info *fi) -{ - struct ossp_dsp_rw_arg arg = { }; - struct ossp_stream *os; - struct ossp_dsp_stream *dsps; - void *buf = NULL; - ssize_t ret; - - ret = -EBADF; - os = find_os(fi->fh); - if (!os) - goto out; - dsps = os_to_dsps(os); - - ret = -EINVAL; - if (!(dsps->rw & (1 << REC))) - goto out; - - ret = -ENXIO; - if (dsps->mmapped) - goto out; - - ret = -ENOMEM; - buf = malloc(size); - if (!buf) - goto out; - - arg.nonblock = (fi->flags & O_NONBLOCK) || dsps->nonblock; - - ret = exec_cmd(os, OSSP_DSP_READ, &arg, sizeof(arg), - NULL, 0, NULL, 0, buf, &size, -1); -out: - if (ret >= 0) - fuse_reply_buf(req, buf, size); - else - fuse_reply_err(req, -ret); - - free(buf); -} - -static void dsp_write(fuse_req_t req, const char *buf, size_t size, off_t off, - struct fuse_file_info *fi) -{ - struct ossp_dsp_rw_arg arg = { }; - struct ossp_stream *os; - struct ossp_dsp_stream *dsps; - ssize_t ret; - - ret = -EBADF; - os = find_os(fi->fh); - if (!os) - goto out; - dsps = os_to_dsps(os); - - ret = -EINVAL; - if (!(dsps->rw & (1 << PLAY))) - goto out; - - ret = -ENXIO; - if (dsps->mmapped) - goto out; - - arg.nonblock = (fi->flags & O_NONBLOCK) || dsps->nonblock; - - ret = exec_cmd(os, OSSP_DSP_WRITE, &arg, sizeof(arg), - buf, size, NULL, 0, NULL, NULL, -1); -out: - if (ret >= 0) - fuse_reply_write(req, ret); - else - fuse_reply_err(req, -ret); -} - -static void dsp_poll(fuse_req_t req, struct fuse_file_info *fi, - struct fuse_pollhandle *ph) -{ - int notify = ph != NULL; - unsigned revents = 0; - struct ossp_stream *os; - ssize_t ret; - - ret = -EBADF; - os = find_os(fi->fh); - if (!os) - goto out; - - if (ph) { - pthread_mutex_lock(&mutex); - if (os->ph) - fuse_pollhandle_destroy(os->ph); - os->ph = ph; - pthread_mutex_unlock(&mutex); - } - - ret = exec_simple_cmd(os, OSSP_DSP_POLL, ¬ify, &revents); -out: - if (ret >= 0) - fuse_reply_poll(req, revents); - else - fuse_reply_err(req, -ret); -} - -static void dsp_ioctl(fuse_req_t req, int signed_cmd, void *uarg, - struct fuse_file_info *fi, unsigned int flags, - const void *in_buf, size_t in_bufsz, size_t out_bufsz) -{ - /* some ioctl constants are long and has the highest bit set */ - unsigned cmd = signed_cmd; - struct ossp_stream *os; - struct ossp_dsp_stream *dsps; - enum ossp_opcode op; - ssize_t ret; - int i; - - ret = -EBADF; - os = find_os(fi->fh); - if (!os) - goto err; - dsps = os_to_dsps(os); - - /* mixer commands are allowed on DSP devices */ - if (((cmd >> 8) & 0xff) == 'M') { - mixer_do_ioctl(req, os->mixer, cmd, uarg, in_buf, in_bufsz, - out_bufsz); - return; - } - - /* and the rest */ - switch (cmd) { - case OSS_GETVERSION: - i = SNDRV_OSS_VERSION; - PREP_UARG(NULL, &i); - IOCTL_RETURN(0, &i); - - case SNDCTL_DSP_GETCAPS: - i = DSP_CAP_DUPLEX | DSP_CAP_REALTIME | DSP_CAP_TRIGGER | -#ifdef OSSP_MMAP - DSP_CAP_MMAP | -#endif - DSP_CAP_MULTI; - PREP_UARG(NULL, &i); - IOCTL_RETURN(0, &i); - - case SNDCTL_DSP_NONBLOCK: - dsps->nonblock = 1; - ret = 0; - IOCTL_RETURN(0, NULL); - - case SNDCTL_DSP_RESET: op = OSSP_DSP_RESET; goto nd; - case SNDCTL_DSP_SYNC: op = OSSP_DSP_SYNC; goto nd; - case SNDCTL_DSP_POST: op = OSSP_DSP_POST; goto nd; - nd: - ret = exec_simple_cmd(&dsps->os, op, NULL, NULL); - if (ret) - goto err; - IOCTL_RETURN(0, NULL); - - case SOUND_PCM_READ_RATE: op = OSSP_DSP_GET_RATE; goto ri; - case SOUND_PCM_READ_BITS: op = OSSP_DSP_GET_FORMAT; goto ri; - case SOUND_PCM_READ_CHANNELS: op = OSSP_DSP_GET_CHANNELS; goto ri; - case SNDCTL_DSP_GETBLKSIZE: op = OSSP_DSP_GET_BLKSIZE; goto ri; - case SNDCTL_DSP_GETFMTS: op = OSSP_DSP_GET_FORMATS; goto ri; - case SNDCTL_DSP_GETTRIGGER: op = OSSP_DSP_GET_TRIGGER; goto ri; - ri: - PREP_UARG(NULL, &i); - ret = exec_simple_cmd(&dsps->os, op, NULL, &i); - if (ret) - goto err; - IOCTL_RETURN(0, &i); - - case SNDCTL_DSP_SPEED: op = OSSP_DSP_SET_RATE; goto wi; - case SNDCTL_DSP_SETFMT: op = OSSP_DSP_SET_FORMAT; goto wi; - case SNDCTL_DSP_CHANNELS: op = OSSP_DSP_SET_CHANNELS; goto wi; - case SNDCTL_DSP_SUBDIVIDE: op = OSSP_DSP_SET_SUBDIVISION; goto wi; - wi: - PREP_UARG(&i, &i); - ret = exec_simple_cmd(&dsps->os, op, &i, &i); - if (ret) - goto err; - IOCTL_RETURN(0, &i); - - case SNDCTL_DSP_STEREO: - PREP_UARG(NULL, &i); - i = 2; - ret = exec_simple_cmd(&dsps->os, OSSP_DSP_SET_CHANNELS, &i, &i); - i--; - if (ret) - goto err; - IOCTL_RETURN(0, &i); - - case SNDCTL_DSP_SETFRAGMENT: - PREP_UARG(&i, NULL); - ret = exec_simple_cmd(&dsps->os, - OSSP_DSP_SET_FRAGMENT, &i, NULL); - if (ret) - goto err; - IOCTL_RETURN(0, NULL); - - case SNDCTL_DSP_SETTRIGGER: - PREP_UARG(&i, NULL); - ret = exec_simple_cmd(&dsps->os, - OSSP_DSP_SET_TRIGGER, &i, NULL); - if (ret) - goto err; - IOCTL_RETURN(0, NULL); - - case SNDCTL_DSP_GETOSPACE: - case SNDCTL_DSP_GETISPACE: { - struct audio_buf_info info; - - ret = -EINVAL; - if (cmd == SNDCTL_DSP_GETOSPACE) { - if (!(dsps->rw & (1 << PLAY))) - goto err; - op = OSSP_DSP_GET_OSPACE; - } else { - if (!(dsps->rw & (1 << REC))) - goto err; - op = OSSP_DSP_GET_ISPACE; - } - - PREP_UARG(NULL, &info); - ret = exec_simple_cmd(&dsps->os, op, NULL, &info); - if (ret) - goto err; - IOCTL_RETURN(0, &info); - } - - case SNDCTL_DSP_GETOPTR: - case SNDCTL_DSP_GETIPTR: { - struct count_info info; - - op = cmd == SNDCTL_DSP_GETOPTR ? OSSP_DSP_GET_OPTR - : OSSP_DSP_GET_IPTR; - PREP_UARG(NULL, &info); - ret = exec_simple_cmd(&dsps->os, op, NULL, &info); - if (ret) - goto err; - IOCTL_RETURN(0, &info); - } - - case SNDCTL_DSP_GETODELAY: - PREP_UARG(NULL, &i); - i = 0; - ret = exec_simple_cmd(&dsps->os, OSSP_DSP_GET_ODELAY, NULL, &i); - IOCTL_RETURN(ret, &i); /* always copy out result, 0 on err */ - - case SOUND_PCM_WRITE_FILTER: - case SOUND_PCM_READ_FILTER: - ret = -EIO; - goto err; - - case SNDCTL_DSP_MAPINBUF: - case SNDCTL_DSP_MAPOUTBUF: - ret = -EINVAL; - goto err; - - case SNDCTL_DSP_SETSYNCRO: - case SNDCTL_DSP_SETDUPLEX: - case SNDCTL_DSP_PROFILE: - IOCTL_RETURN(0, NULL); - - default: - warn_os(os, "unknown ioctl 0x%x", cmd); - ret = -EINVAL; - goto err; - } - assert(0); /* control shouldn't reach here */ -err: - fuse_reply_err(req, -ret); -} - -#ifdef OSSP_MMAP -static int dsp_mmap_dir(int prot) -{ - if (!(prot & PROT_WRITE)) - return REC; - return PLAY; -} - -static void dsp_mmap(fuse_req_t req, void *addr, size_t len, int prot, - int flags, off_t offset, struct fuse_file_info *fi, - uint64_t mh) -{ - int dir = dsp_mmap_dir(prot); - struct ossp_dsp_mmap_arg arg = { }; - struct ossp_stream *os; - struct ossp_dsp_stream *dsps; - ssize_t ret; - - os = find_os(fi->fh); - if (!os) { - fuse_reply_err(req, EBADF); - return; - } - dsps = os_to_dsps(os); - - if (!os->mmap_off || len > os->mmap_size / 2) { - fuse_reply_err(req, EINVAL); - return; - } - - pthread_mutex_lock(&os->mmap_mutex); - - ret = -EBUSY; - if (dsps->mmapped & (1 << dir)) - goto out_unlock; - - arg.dir = dir; - arg.size = len; - - ret = exec_simple_cmd(os, OSSP_DSP_MMAP, &arg, NULL); - if (ret == 0) - dsps->mmapped |= 1 << dir; - -out_unlock: - pthread_mutex_unlock(&os->mmap_mutex); - - if (ret == 0) - fuse_reply_mmap(req, os->mmap_off + dir * os->mmap_size / 2, 0); - else - fuse_reply_err(req, -ret); -} - -static void dsp_munmap(fuse_req_t req, size_t len, struct fuse_file_info *fi, - off_t offset, uint64_t mh) -{ - struct ossp_stream *os; - struct ossp_dsp_stream *dsps; - int dir, rc; - - os = find_os(fi->fh); - if (!os) - goto out; - dsps = os_to_dsps(os); - - pthread_mutex_lock(&os->mmap_mutex); - - for (dir = 0; dir < 2; dir++) - if (offset == os->mmap_off + dir * os->mmap_size / 2) - break; - if (dir == 2 || len > os->mmap_size / 2) { - warn_os(os, "invalid munmap request " - "offset=%llu len=%zu mmapped=0x%x", - (unsigned long long)offset, len, dsps->mmapped); - goto out_unlock; - } - - rc = exec_simple_cmd(os, OSSP_DSP_MUNMAP, &dir, NULL); - if (rc) - warn_ose(os, rc, "MUNMAP failed for dir=%d", dir); - - dsps->mmapped &= ~(1 << dir); - -out_unlock: - pthread_mutex_unlock(&os->mmap_mutex); -out: - fuse_reply_none(req); -} -#endif - - -/*************************************************************************** - * Notify poller - */ - -static void *notify_poller(void *arg) -{ - struct epoll_event events[1024]; - int i, nfds; - -repeat: - nfds = epoll_wait(notify_epfd, events, ARRAY_SIZE(events), -1); - for (i = 0; i < nfds; i++) { - int do_notify = 0; - struct ossp_stream *os; - struct ossp_notify notify; - ssize_t ret; - - os = find_os_by_notify_rx(events[i].data.fd); - if (!os) { - err("can't find stream for notify_rx fd %d", - events[i].data.fd); - epoll_ctl(notify_epfd, EPOLL_CTL_DEL, events[i].data.fd, - NULL); - /* we don't know what's going on, don't close the fd */ - continue; - } - - while ((ret = read(os->notify_rx, - ¬ify, sizeof(notify))) > 0) { - if (os->dead) - continue; - if (ret != sizeof(notify)) { - warn_os(os, "short read on notify_rx (%zu, " - "expected %zu), killing the stream", - ret, sizeof(notify)); - os->dead = 1; - break; - } - if (notify.magic != OSSP_NOTIFY_MAGIC) { - warn_os(os, "invalid magic on notification, " - "killing the stream"); - os->dead = 1; - break; - } - - if (notify.opcode >= OSSP_NR_NOTIFY_OPCODES) - goto unknown; - - dbg1_os(os, "NOTIFY %s", ossp_notify_str[notify.opcode]); - - switch (notify.opcode) { - case OSSP_NOTIFY_POLL: - do_notify = 1; - break; - case OSSP_NOTIFY_OBITUARY: - os->dead = 1; - break; - case OSSP_NOTIFY_VOLCHG: - pthread_mutex_lock(&mixer_mutex); - os->mixer->modify_counter++; - pthread_mutex_unlock(&mixer_mutex); - break; - default: - unknown: - warn_os(os, "unknown notification %d", - notify.opcode); - } - } - if (ret == 0) - os->dead = 1; - else if (ret < 0 && errno != EAGAIN) { - warn_ose(os, -errno, "read fail on notify fd"); - os->dead = 1; - } - - if (!do_notify && !os->dead) - continue; - - pthread_mutex_lock(&mutex); - - if (os->ph) { - fuse_lowlevel_notify_poll(os->ph); - fuse_pollhandle_destroy(os->ph); - os->ph = NULL; - } - - if (os->dead) { - dbg0_os(os, "removing %d from notify poll list", - os->notify_rx); - epoll_ctl(notify_epfd, EPOLL_CTL_DEL, os->notify_rx, - NULL); - close(os->notify_rx); - os->notify_rx = -1; - pthread_cond_broadcast(¬ify_poller_kill_wait); - } - - pthread_mutex_unlock(&mutex); - } - goto repeat; -} - - -/*************************************************************************** - * Slave corpse reaper - */ - -static void *slave_reaper(void *arg) -{ - struct ossp_stream *os; - int status; - pid_t pid; - - pthread_mutex_lock(&mutex); -repeat: - while (list_empty(&slave_corpse_list)) - pthread_cond_wait(&slave_reaper_wait, &mutex); - - os = list_first_entry(&slave_corpse_list, struct ossp_stream, link); - list_del_init(&os->link); - - pthread_mutex_unlock(&mutex); - - do { - pid = waitpid(os->slave_pid, &status, 0); - } while (pid < 0 && errno == EINTR); - - if (pid < 0) { - if (errno == ECHILD) - warn_ose(os, -errno, "slave %d already gone?", - os->slave_pid); - else - fatal_e(-errno, "waitpid(%d) failed", os->slave_pid); - } - - pthread_mutex_lock(&mutex); - - dbg1_os(os, "slave %d reaped", os->slave_pid); - __clear_bit(os->id, os_id_bitmap); - free(os); - - goto repeat; -} - - -/*************************************************************************** - * Stuff to bind and start everything - */ - -static void ossp_daemonize(void) -{ - int fd, pfd[2]; - pid_t pid; - ssize_t ret; - int err; - - fd = open("/dev/null", O_RDWR); - if (fd >= 0) { - dup2(fd, 0); - dup2(fd, 1); - dup2(fd, 2); - if (fd > 2) - close(fd); - } - - if (pipe(pfd)) - fatal_e(-errno, "failed to create pipe for init wait"); - - if (fcntl(pfd[0], F_SETFD, FD_CLOEXEC) < 0 || - fcntl(pfd[1], F_SETFD, FD_CLOEXEC) < 0) - fatal_e(-errno, "failed to set CLOEXEC on init wait pipe"); - - pid = fork(); - if (pid < 0) - fatal_e(-errno, "failed to fork for daemon"); - - if (pid == 0) { - close(pfd[0]); - init_wait_fd = pfd[1]; - - /* be evil, my child */ - chdir("/"); - setsid(); - return; - } - - /* wait for init completion and pass over success indication */ - close(pfd[1]); - - do { - ret = read(pfd[0], &err, sizeof(err)); - } while (ret < 0 && errno == EINTR); - - if (ret == sizeof(err) && err == 0) - exit(0); - - fatal("daemon init failed ret=%zd err=%d", ret, err); - exit(1); -} - -static void ossp_init_done(void *userdata) -{ - /* init complete, notify parent if it's waiting */ - if (init_wait_fd >= 0) { - ssize_t ret; - int err = 0; - - ret = write(init_wait_fd, &err, sizeof(err)); - if (ret != sizeof(err)) - fatal_e(-errno, "failed to notify init completion, " - "ret=%zd", ret); - close(init_wait_fd); - init_wait_fd = -1; - } -} - -static const struct cuse_lowlevel_ops mixer_ops = { - .open = mixer_open, - .release = mixer_release, - .ioctl = mixer_ioctl, -}; - -static const struct cuse_lowlevel_ops dsp_ops = { - .init_done = ossp_init_done, - .open = dsp_open, - .release = dsp_release, - .read = dsp_read, - .write = dsp_write, - .poll = dsp_poll, - .ioctl = dsp_ioctl, -#ifdef OSSP_MMAP - .mmap = dsp_mmap, - .munmap = dsp_munmap, -#endif -}; - -static const struct cuse_lowlevel_ops adsp_ops = { - .open = adsp_open, - .release = dsp_release, - .read = dsp_read, - .write = dsp_write, - .poll = dsp_poll, - .ioctl = dsp_ioctl, -#ifdef OSSP_MMAP - .mmap = dsp_mmap, - .munmap = dsp_munmap, -#endif -}; - -static const char *usage = -"usage: osspd [options]\n" -"\n" -"options:\n" -" --help print this help message\n" -" --dsp=NAME DSP device name (default dsp)\n" -" --dsp-maj=MAJ DSP device major number (default 14)\n" -" --dsp-min=MIN DSP device minor number (default 3)\n" -" --adsp=NAME Aux DSP device name (default adsp, blank to disable)\n" -" --adsp-maj=MAJ Aux DSP device major number (default 14)\n" -" --adsp-min=MIN Aux DSP device minor number (default 12)\n" -" --mixer=NAME mixer device name (default mixer, blank to disable)\n" -" --mixer-maj=MAJ mixer device major number (default 14)\n" -" --mixer-min=MIN mixer device minor number (default 0)\n" -" --max=MAX maximum number of open streams (default 256)\n" -" --umax=MAX maximum number of open streams per UID (default --max)\n" -" --exit-on-idle exit if idle\n" -" --dsp-slave=PATH DSP slave (default ossp-padsp in the same dir)\n" -" --log=LEVEL log level (0..6)\n" -" --timestamp timestamp log messages\n" -" -v increase verbosity, can be specified multiple times\n" -" -f Run in foreground (don't daemonize)\n" -"\n"; - -struct ossp_param { - char *dsp_name; - unsigned dsp_major; - unsigned dsp_minor; - char *adsp_name; - unsigned adsp_major; - unsigned adsp_minor; - char *mixer_name; - unsigned mixer_major; - unsigned mixer_minor; - unsigned max_streams; - unsigned umax_streams; - char *dsp_slave_path; - unsigned log_level; - int exit_on_idle; - int timestamp; - int fg; - int help; -}; - -#define OSSP_OPT(t, p) { t, offsetof(struct ossp_param, p), 1 } - -static const struct fuse_opt ossp_opts[] = { - OSSP_OPT("--dsp=%s", dsp_name), - OSSP_OPT("--dsp-maj=%u", dsp_major), - OSSP_OPT("--dsp-min=%u", dsp_minor), - OSSP_OPT("--adsp=%s", adsp_name), - OSSP_OPT("--adsp-maj=%u", adsp_major), - OSSP_OPT("--adsp-min=%u", adsp_minor), - OSSP_OPT("--mixer=%s", mixer_name), - OSSP_OPT("--mixer-maj=%u", mixer_major), - OSSP_OPT("--mixer-min=%u", mixer_minor), - OSSP_OPT("--max=%u", max_streams), - OSSP_OPT("--umax=%u", umax_streams), - OSSP_OPT("--exit-on-idle", exit_on_idle), - OSSP_OPT("--dsp-slave=%s", dsp_slave_path), - OSSP_OPT("--timestamp", timestamp), - OSSP_OPT("--log=%u", log_level), - OSSP_OPT("-f", fg), - FUSE_OPT_KEY("-h", 0), - FUSE_OPT_KEY("--help", 0), - FUSE_OPT_KEY("-v", 1), - FUSE_OPT_END -}; - -static struct fuse_session *setup_ossp_cuse(const struct cuse_lowlevel_ops *ops, - const char *name, int major, - int minor, int argc, char **argv) -{ - char name_buf[128]; - const char *bufp = name_buf; - struct cuse_info ci = { .dev_major = major, .dev_minor = minor, - .dev_info_argc = 1, .dev_info_argv = &bufp, - .flags = CUSE_UNRESTRICTED_IOCTL }; - struct fuse_session *se; - int fd; - - snprintf(name_buf, sizeof(name_buf), "DEVNAME=%s", name); - - se = cuse_lowlevel_setup(argc, argv, &ci, ops, NULL, NULL); - if (!se) { - err("failed to setup %s CUSE", name); - return NULL; - } - - fd = fuse_chan_fd(fuse_session_next_chan(se, NULL)); - if ( -#ifdef OSSP_MMAP - fd != fuse_mmap_fd(se) && -#endif - fcntl(fd, F_SETFD, FD_CLOEXEC) < 0) { - err_e(-errno, "failed to set CLOEXEC on %s CUSE fd", name); - cuse_lowlevel_teardown(se); - return NULL; - } - - return se; -} - -static void *cuse_worker(void *arg) -{ - struct fuse_session *se = arg; - int rc; - - rc = fuse_session_loop_mt(se); - cuse_lowlevel_teardown(se); - - return (void *)(unsigned long)rc; -} - -static int process_arg(void *data, const char *arg, int key, - struct fuse_args *outargs) -{ - struct ossp_param *param = data; - - switch (key) { - case 0: - fprintf(stderr, usage); - param->help = 1; - return 0; - case 1: - param->log_level++; - return 0; - } - return 1; -} - -int main(int argc, char **argv) -{ - static struct ossp_param param = { - .dsp_name = DFL_DSP_NAME, - .dsp_major = DFL_DSP_MAJOR, .dsp_minor = DFL_DSP_MINOR, - .adsp_name = DFL_ADSP_NAME, - .adsp_major = DFL_ADSP_MAJOR, .adsp_minor = DFL_ADSP_MINOR, - .mixer_name = DFL_MIXER_NAME, - .mixer_major = DFL_MIXER_MAJOR, .mixer_minor = DFL_MIXER_MINOR, - .max_streams = DFL_MAX_STREAMS, - }; - struct fuse_args args = FUSE_ARGS_INIT(argc, argv); - char path_buf[PATH_MAX], *dir; - char adsp_buf[64] = "", mixer_buf[64] = ""; - struct sigaction sa; - struct stat stat_buf; - ssize_t ret; - unsigned u; - - snprintf(ossp_log_name, sizeof(ossp_log_name), "osspd"); - param.log_level = ossp_log_level; - - if (fuse_opt_parse(&args, ¶m, ossp_opts, process_arg)) - fatal("failed to parse arguments"); - - if (param.help) - return 0; - - max_streams = param.max_streams; - hashtbl_size = max_streams / 2 + 13; - - umax_streams = max_streams; - if (param.umax_streams) - umax_streams = param.umax_streams; - if (param.log_level > OSSP_LOG_MAX) - param.log_level = OSSP_LOG_MAX; - if (!param.fg) - param.log_level = -param.log_level; - ossp_log_level = param.log_level; - ossp_log_timestamp = param.timestamp; - - if (!param.fg) - ossp_daemonize(); - - /* daemonization already handled, prevent forking inside FUSE */ - fuse_opt_add_arg(&args, "-f"); - - info("OSS Proxy v%s (C) 2008-2010 by Tejun Heo ", - OSSP_VERSION); - - /* ignore stupid SIGPIPEs */ - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = SIG_IGN; - if (sigaction(SIGPIPE, &sa, NULL)) - fatal_e(-errno, "failed to ignore SIGPIPE"); - -//#ifdef GIOVANNI - /* determine slave path and check for availability */ - ret = readlink("/proc/self/exe", path_buf, PATH_MAX - 1); - if (ret < 0) - fatal_e(-errno, "failed to determine executable path"); - path_buf[ret] = '\0'; - dir = dirname(path_buf); - - if (param.dsp_slave_path) { - strncpy(dsp_slave_path, param.dsp_slave_path, PATH_MAX - 1); - dsp_slave_path[PATH_MAX - 1] = '\0'; - } else { - ret = snprintf(dsp_slave_path, PATH_MAX, "%s/%s", - dir, "ossp-padsp"); - if (ret >= PATH_MAX) - fatal("dsp slave pathname too long"); - } - - if (stat(dsp_slave_path, &stat_buf)) - fatal_e(-errno, "failed to stat %s", dsp_slave_path); - if (!S_ISREG(stat_buf.st_mode) || !(stat_buf.st_mode & 0444)) - fatal("%s is not executable", dsp_slave_path); - -//#endif// GIOVANNI - /* allocate tables */ - os_id_bitmap = calloc(BITS_TO_LONGS(max_streams), sizeof(long)); - mixer_tbl = calloc(hashtbl_size, sizeof(mixer_tbl[0])); - os_tbl = calloc(hashtbl_size, sizeof(os_tbl[0])); - os_pgrp_tbl = calloc(hashtbl_size, sizeof(os_pgrp_tbl[0])); - os_notify_tbl = calloc(hashtbl_size, sizeof(os_notify_tbl[0])); - if (!os_id_bitmap || !mixer_tbl || !os_tbl || !os_pgrp_tbl || - !os_notify_tbl) - fatal("failed to allocate stream hash tables"); - for (u = 0; u < hashtbl_size; u++) { - INIT_LIST_HEAD(&mixer_tbl[u]); - INIT_LIST_HEAD(&os_tbl[u]); - INIT_LIST_HEAD(&os_pgrp_tbl[u]); - INIT_LIST_HEAD(&os_notify_tbl[u]); - } - __set_bit(0, os_id_bitmap); /* don't use id 0 */ - - /* create mixer delayed reference worker */ - ret = -pthread_create(&mixer_delayed_put_thread, NULL, - mixer_delayed_put_worker, NULL); - if (ret) - fatal_e(ret, "failed to create mixer delayed put worker"); - - /* if exit_on_idle, touch mixer for pgrp0 */ - exit_on_idle = param.exit_on_idle; - if (exit_on_idle) { - struct ossp_mixer *mixer; - - mixer = get_mixer(0); - if (!mixer) - fatal("failed to touch idle mixer"); - put_mixer(mixer); - } - - /* create notify epoll and kick off watcher thread */ - notify_epfd = epoll_create(max_streams); - if (notify_epfd < 0) - fatal_e(-errno, "failed to create notify epoll"); - if (fcntl(notify_epfd, F_SETFD, FD_CLOEXEC) < 0) - fatal_e(-errno, "failed to set CLOEXEC on notify epfd"); - - ret = -pthread_create(¬ify_poller_thread, NULL, notify_poller, NULL); - if (ret) - fatal_e(ret, "failed to create notify poller thread"); - - /* create reaper for slave corpses */ - ret = -pthread_create(&slave_reaper_thread, NULL, slave_reaper, NULL); - if (ret) - fatal_e(ret, "failed to create slave reaper thread"); - -#ifdef GIOVANNI - /* we're set, let's setup fuse structures */ - if (strlen(param.mixer_name)) - mixer_se = setup_ossp_cuse(&mixer_ops, param.mixer_name, - param.mixer_major, param.mixer_minor, - args.argc, args.argv); - if (strlen(param.adsp_name)) - adsp_se = setup_ossp_cuse(&dsp_ops, param.adsp_name, - param.adsp_major, param.adsp_minor, - args.argc, args.argv); - -#endif// GIOVANNI - dsp_se = setup_ossp_cuse(&dsp_ops, param.dsp_name, - param.dsp_major, param.dsp_minor, - args.argc, args.argv); - if (!dsp_se) - fatal("can't create dsp, giving up"); - -#ifdef GIOVANNI - if (mixer_se) - snprintf(mixer_buf, sizeof(mixer_buf), ", %s (%d:%d)", - param.mixer_name, param.mixer_major, param.mixer_minor); - if (adsp_se) - snprintf(adsp_buf, sizeof(adsp_buf), ", %s (%d:%d)", - param.adsp_name, param.adsp_major, param.adsp_minor); - -#endif// GIOVANNI - info("Creating %s (%d:%d)%s%s", param.dsp_name, param.dsp_major, - param.dsp_minor, adsp_buf, mixer_buf); - -#ifdef GIOVANNI - /* start threads for mixer and adsp */ - if (mixer_se) { - ret = -pthread_create(&cuse_mixer_thread, NULL, - cuse_worker, mixer_se); - if (ret) - err_e(ret, "failed to create mixer worker"); - } - if (adsp_se) { - ret = -pthread_create(&cuse_adsp_thread, NULL, - cuse_worker, adsp_se); - if (ret) - err_e(ret, "failed to create adsp worker"); - } -#endif// GIOVANNI - - /* run CUSE for /dev/dsp in the main thread */ - ret = (ssize_t)cuse_worker(dsp_se); - if (ret < 0) - fatal("dsp worker failed"); - return 0; -} From dff41af992ff9e83c6522168f403a889eaf2d837 Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Wed, 20 Apr 2011 14:11:24 +0200 Subject: [PATCH 344/558] add cepstral config file and ivr sounds control file to freeswitch specfile --- freeswitch.spec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/freeswitch.spec b/freeswitch.spec index 5e2ad85271..a266c1e919 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -752,6 +752,7 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_csv.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_pg_csv.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cdr_sqlite.conf.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cepstral.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/cidlookup.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/conference.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/autoload_configs/console.conf.xml @@ -1064,10 +1065,13 @@ fi %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/demo %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/vm +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/dir +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/en/ivr %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/demo/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/vm/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/dir/*.xml +%config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/en/ivr/*.xml %{prefix}/mod/mod_say_en.so* %files lang-de @@ -1085,6 +1089,7 @@ fi %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/demo %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/vm +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/fr/dir %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/demo/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/fr/vm/*.xml @@ -1096,6 +1101,7 @@ fi %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru/demo %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru/vm +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/ru/dir %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/demo/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/ru/vm/*.xml @@ -1107,6 +1113,7 @@ fi %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/he/ %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/he/demo %dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/he/vm +%dir %attr(0750, freeswitch, daemon) %{prefix}/conf/lang/he/dir %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/he/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/he/demo/*.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{prefix}/conf/lang/he/vm/*.xml From 6dd1237445ab67659cf75edbf15d5ec64f8ff15b Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 20 Apr 2011 11:35:14 -0500 Subject: [PATCH 345/558] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 18 ++++++++++++++++-- src/mod/languages/mod_managed/managed/swig.cs | 14 +++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 33c18dab84..c0402e142d 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -12688,6 +12688,18 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_string(char * jarg1) { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_clean_name_string(char * jarg1) { + char * jresult ; + char *arg1 = (char *) 0 ; + char *result = 0 ; + + arg1 = (char *)jarg1; + result = (char *)switch_clean_name_string(arg1); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT char * SWIGSTDCALL CSharp_switch_safe_strdup(char * jarg1) { char * jresult ; char *arg1 = (char *) 0 ; @@ -25903,7 +25915,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_json(void * jarg1, char * } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, char jarg2, char jarg3, char jarg4, void * jarg5, void * jarg6) { +SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, char jarg2, char jarg3, char jarg4, void * jarg5, void * jarg6, int jarg7) { int jresult ; char *arg1 = (char *) 0 ; char arg2 ; @@ -25911,6 +25923,7 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, cha char arg4 ; switch_event_t **arg5 = (switch_event_t **) 0 ; char **arg6 = (char **) 0 ; + switch_bool_t arg7 ; switch_status_t result; arg1 = (char *)jarg1; @@ -25919,7 +25932,8 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_event_create_brackets(char * jarg1, cha arg4 = (char)jarg4; arg5 = (switch_event_t **)jarg5; arg6 = (char **)jarg6; - result = (switch_status_t)switch_event_create_brackets(arg1,arg2,arg3,arg4,arg5,arg6); + arg7 = (switch_bool_t)jarg7; + result = (switch_status_t)switch_event_create_brackets(arg1,arg2,arg3,arg4,arg5,arg6,arg7); jresult = result; return jresult; } diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 400acef378..497630fd26 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -2945,6 +2945,11 @@ public class freeswitch { return ret; } + public static string switch_clean_name_string(string s) { + string ret = freeswitchPINVOKE.switch_clean_name_string(s); + return ret; + } + public static string switch_safe_strdup(string it) { string ret = freeswitchPINVOKE.switch_safe_strdup(it); return ret; @@ -3970,8 +3975,8 @@ public class freeswitch { return ret; } - public static switch_status_t switch_event_create_brackets(string data, char a, char b, char c, SWIGTYPE_p_p_switch_event arg4, ref string new_data) { - switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_brackets(data, a, b, c, SWIGTYPE_p_p_switch_event.getCPtr(arg4), ref new_data); + public static switch_status_t switch_event_create_brackets(string data, char a, char b, char c, SWIGTYPE_p_p_switch_event arg4, ref string new_data, switch_bool_t dup) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_create_brackets(data, a, b, c, SWIGTYPE_p_p_switch_event.getCPtr(arg4), ref new_data, (int)dup); return ret; } @@ -8827,6 +8832,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_clean_string")] public static extern string switch_clean_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_clean_name_string")] + public static extern string switch_clean_name_string(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_safe_strdup")] public static extern string switch_safe_strdup(string jarg1); @@ -12017,7 +12025,7 @@ class freeswitchPINVOKE { public static extern int switch_event_create_json(HandleRef jarg1, string jarg2); [DllImport("mod_managed", EntryPoint="CSharp_switch_event_create_brackets")] - public static extern int switch_event_create_brackets(string jarg1, char jarg2, char jarg3, char jarg4, HandleRef jarg5, ref string jarg6); + public static extern int switch_event_create_brackets(string jarg1, char jarg2, char jarg3, char jarg4, HandleRef jarg5, ref string jarg6, int jarg7); [DllImport("mod_managed", EntryPoint="CSharp_switch_event_running")] public static extern int switch_event_running(); From 4137b360cf42044d8b7c141d7a976dcfe272abfe Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Wed, 20 Apr 2011 13:09:03 -0400 Subject: [PATCH 346/558] switch_ivr/xml: Change the structure of the phrases/language system. Previously it was fxml->phrases->macros->language->macro. Changed it so fxml->languages->language->phrases->macros->macro You can have sub macros and allow you to call it login@voicemail. Change the sound-path to sound-prefix to make it constistant with the rest of freeswitch. Also allow to set a sound-prefix to a macros, so you can override it for a specific file set. You can set say-modules="en" or whatever in the - -
- - - - - - - + +
+ + + + +
diff --git a/conf/lang/de/de.xml b/conf/lang/de/de.xml index 5239489f75..1b44c9a1dd 100644 --- a/conf/lang/de/de.xml +++ b/conf/lang/de/de.xml @@ -1,7 +1,11 @@ - - - - + + + + + + + + diff --git a/conf/lang/en/en.xml b/conf/lang/en/en.xml index 6bd5a7d5fb..1e23dc5d7b 100644 --- a/conf/lang/en/en.xml +++ b/conf/lang/en/en.xml @@ -1,8 +1,12 @@ - - - - - + + + + + + + + + diff --git a/conf/lang/fr/fr.xml b/conf/lang/fr/fr.xml index 12bec06f20..eaf00f247e 100644 --- a/conf/lang/fr/fr.xml +++ b/conf/lang/fr/fr.xml @@ -1,8 +1,12 @@ - - - - - + + + + + + + + + diff --git a/conf/lang/he/he.xml b/conf/lang/he/he.xml index 006195bf9a..fe7c5d8a01 100644 --- a/conf/lang/he/he.xml +++ b/conf/lang/he/he.xml @@ -1,7 +1,11 @@ - - - - + + + + + + + + diff --git a/conf/lang/ru/ru.xml b/conf/lang/ru/ru.xml index 25d63b6110..686e840860 100644 --- a/conf/lang/ru/ru.xml +++ b/conf/lang/ru/ru.xml @@ -1,9 +1,13 @@ - - - - + + + + + + + + diff --git a/src/include/switch_xml.h b/src/include/switch_xml.h index f1164cee2e..2d3f994878 100644 --- a/src/include/switch_xml.h +++ b/src/include/switch_xml.h @@ -417,6 +417,8 @@ SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_opt_z_ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond); +SWITCH_DECLARE(switch_status_t) switch_xml_locate_language(switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language); + SWITCH_END_EXTERN_C ///\} #endif // _SWITCH_XML_H diff --git a/src/mod/applications/mod_protovm/protovm.conf.xml b/src/mod/applications/mod_protovm/protovm.conf.xml index 3c42ce1faa..e25b8760c8 100644 --- a/src/mod/applications/mod_protovm/protovm.conf.xml +++ b/src/mod/applications/mod_protovm/protovm.conf.xml @@ -17,7 +17,7 @@ - + @@ -25,7 +25,7 @@ - + @@ -34,7 +34,7 @@ - + @@ -43,12 +43,12 @@ - - - - - - + + + + + + @@ -62,7 +62,7 @@ - + @@ -75,9 +75,9 @@ - - - + + + @@ -90,9 +90,9 @@ - - - + + + @@ -106,9 +106,9 @@ - - - + + + @@ -116,7 +116,7 @@ - + @@ -124,7 +124,7 @@ - + diff --git a/src/mod/applications/mod_protovm/sounds.xml b/src/mod/applications/mod_protovm/sounds.xml index 2fe42a40d2..1760e7cc07 100644 --- a/src/mod/applications/mod_protovm/sounds.xml +++ b/src/mod/applications/mod_protovm/sounds.xml @@ -1,375 +1,376 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + - - - - - + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c index e58377ef5a..1ac0d38889 100644 --- a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c +++ b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c @@ -50,7 +50,8 @@ typedef enum { XML_LDAP_CONFIG = 0, XML_LDAP_DIRECTORY, XML_LDAP_DIALPLAN, - XML_LDAP_PHRASE + XML_LDAP_PHRASE, + XML_LDAP_LANGUAGE } xml_ldap_query_type_t; SWITCH_MODULE_LOAD_FUNCTION(mod_xml_ldap_load); @@ -247,6 +248,8 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c query_type = XML_LDAP_DIALPLAN; } else if (!strcmp(section, "phrases")) { query_type = XML_LDAP_PHRASE; + } else if (!strcmp(section, "languages")) { + query_type = XML_LDAP_LANGUAGE; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid section\n"); return NULL; @@ -269,6 +272,7 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c case XML_LDAP_DIALPLAN: case XML_LDAP_PHRASE: + case XML_LDAP_LANGUAGE: break; } } @@ -326,6 +330,7 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c break; case XML_LDAP_PHRASE: + case XML_LDAP_LANGUAGE: break; } } else { diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 07c341a580..825f2d30cd 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -29,6 +29,7 @@ * Matt Klein * Michael Jerris * Ken Rice + * Marc Olivier Chouinard * * switch_ivr.c -- IVR Library * @@ -2327,9 +2328,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, switch_say_interface_t *si; switch_channel_t *channel; switch_status_t status = SWITCH_STATUS_FALSE; - const char *save_path = NULL, *chan_lang = NULL, *lang = NULL, *lname = NULL, *sound_path = NULL; + const char *save_path = NULL, *chan_lang = NULL, *lang = NULL, *sound_path = NULL; switch_event_t *hint_data; - switch_xml_t cfg, xml = NULL, language, macros; + switch_xml_t cfg, xml = NULL, language = NULL, macros = NULL, phrases = NULL; char *p; switch_assert(session); @@ -2341,6 +2342,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, } if (module_name) { + char *p; p = switch_core_session_strdup(session, module_name); module_name = p; @@ -2371,58 +2373,35 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, switch_event_add_header_string(hint_data, SWITCH_STACK_BOTTOM, "lang", chan_lang); switch_channel_event_set_data(channel, hint_data); - if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of phrases failed.\n"); + if (switch_xml_locate_language(&xml, &cfg, hint_data, &language, &phrases, ¯os, chan_lang) != SWITCH_STATUS_SUCCESS) { goto done; } - if (!(macros = switch_xml_child(cfg, "macros"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macros tag.\n"); - goto done; - } - - if (!(language = switch_xml_child(macros, "language"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language tag.\n"); - goto done; - } - - while (language) { - if ((lname = (char *) switch_xml_attr(language, "name")) && !strcasecmp(lname, chan_lang)) { - const char *tmp; - - if ((tmp = switch_xml_attr(language, "module"))) { - module_name = tmp; - } - break; - } - language = language->next; - } - - if (!language) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language %s.\n", chan_lang); - goto done; - } - - if (!module_name) { + if ((p = (char *) switch_xml_attr(language, "say-module"))) { + module_name = switch_core_session_strdup(session, p); + } else if ((p = (char *) switch_xml_attr(language, "module"))) { + module_name = switch_core_session_strdup(session, p); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Deprecated usage of module attribute\n"); + } else { module_name = chan_lang; } - if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { - sound_path = (char *) switch_xml_attr(language, "sound_path"); + if (!(sound_path = (char *) switch_xml_attr(language, "sound-prefix"))) { + if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { + sound_path = (char *) switch_xml_attr(language, "sound_path"); + } } - save_path = switch_channel_get_variable(channel, "sound_prefix"); - - if (sound_path) { - switch_channel_set_variable(channel, "sound_prefix", sound_path); - p = switch_core_session_strdup(session, sound_path); - sound_path = p; + if (channel) { + const char *p = switch_channel_get_variable(channel, "sound_prefix_enforced"); + if (!switch_true(p)) { + save_path = switch_channel_get_variable(channel, "sound_prefix"); + if (sound_path) { + switch_channel_set_variable(channel, "sound_prefix", sound_path); + } + } } - if (xml) { - switch_xml_free(xml); - } - if ((si = switch_loadable_module_get_say_interface(module_name))) { /* should go back and proto all the say mods to const.... */ switch_say_args_t say_args = {0}; @@ -2446,7 +2425,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say(switch_core_session_t *session, if (save_path) { switch_channel_set_variable(channel, "sound_prefix", save_path); } - + + if (xml) { + switch_xml_free(xml); + } + return status; } @@ -2463,9 +2446,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *ses switch_say_interface_t *si; switch_channel_t *channel = NULL; switch_status_t status = SWITCH_STATUS_FALSE; - const char *save_path = NULL, *chan_lang = NULL, *lname = NULL, *sound_path = NULL; + const char *save_path = NULL, *chan_lang = NULL, *sound_path = NULL; switch_event_t *hint_data; - switch_xml_t cfg, xml = NULL, language, macros; + switch_xml_t cfg, xml = NULL, language = NULL, macros = NULL, phrases = NULL; if (session) { channel = switch_core_session_get_channel(session); @@ -2498,52 +2481,31 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_string(switch_core_session_t *ses switch_channel_event_set_data(channel, hint_data); } - if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of phrases failed.\n"); + if (switch_xml_locate_language(&xml, &cfg, hint_data, &language, &phrases, ¯os, chan_lang) != SWITCH_STATUS_SUCCESS) { goto done; } - if (!(macros = switch_xml_child(cfg, "macros"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macros tag.\n"); - goto done; - } - - if (!(language = switch_xml_child(macros, "language"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language tag.\n"); - goto done; - } - - while (language) { - if ((lname = (char *) switch_xml_attr(language, "name")) && !strcasecmp(lname, chan_lang)) { - const char *tmp; - - if ((tmp = switch_xml_attr(language, "module"))) { - module_name = tmp; - } - break; - } - language = language->next; - } - - if (!language) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language %s.\n", chan_lang); - goto done; - } - - if (!module_name) { + if ((module_name = switch_xml_attr(language, "say-module"))) { + } else if ((module_name = switch_xml_attr(language, "module"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Deprecated usage of module attribute\n"); + } else { module_name = chan_lang; } - if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { - sound_path = (char *) switch_xml_attr(language, "sound_path"); + if (!(sound_path = (char *) switch_xml_attr(language, "sound-prefix"))) { + if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { + sound_path = (char *) switch_xml_attr(language, "sound_path"); + } } if (channel) { - save_path = switch_channel_get_variable(channel, "sound_prefix"); - } - - if (sound_path && channel) { - switch_channel_set_variable(channel, "sound_prefix", sound_path); + const char *p = switch_channel_get_variable(channel, "sound_prefix_enforced"); + if (!switch_true(p)) { + save_path = switch_channel_get_variable(channel, "sound_prefix"); + if (sound_path) { + switch_channel_set_variable(channel, "sound_prefix", sound_path); + } + } } if ((si = switch_loadable_module_get_say_interface(module_name))) { diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 6c769ecfd8..76cea5a666 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -28,6 +28,7 @@ * Neal Horman * Matt Klein * Michael Jerris + * Marc Olivier Chouinard * * switch_ivr_play_say.c -- IVR Library (functions to play or say audio) * @@ -39,8 +40,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio switch_input_args_t *args) { switch_event_t *hint_data; - switch_xml_t cfg, xml = NULL, language, macros, macro, input, action; - char *lname = NULL, *mname = NULL; + switch_xml_t cfg, xml = NULL, language = NULL, macros = NULL, phrases = NULL, macro, input, action; switch_status_t status = SWITCH_STATUS_GENERR; const char *old_sound_prefix = NULL, *sound_path = NULL, *tts_engine = NULL, *tts_voice = NULL; const char *module_name = NULL, *chan_lang = NULL; @@ -49,6 +49,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio int matches = 0; const char *pause_val; int pause = 100; + const char *group_macro_name = NULL; + const char *local_macro_name = macro_name; + switch_bool_t sound_prefix_enforced = switch_true(switch_channel_get_variable(channel, "sound_prefix_enforced")); + switch_bool_t local_sound_prefix_enforced = SWITCH_FALSE; if (!macro_name) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No phrase macro specified.\n"); @@ -65,8 +69,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio chan_lang = lang; } - module_name = chan_lang; - switch_event_create(&hint_data, SWITCH_EVENT_REQUEST_PARAMS); switch_assert(hint_data); @@ -82,40 +84,21 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio } switch_channel_event_set_data(channel, hint_data); - if (switch_xml_locate("phrases", NULL, NULL, NULL, &xml, &cfg, hint_data, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Open of phrases failed.\n"); + if (switch_xml_locate_language(&xml, &cfg, hint_data, &language, &phrases, ¯os, chan_lang) != SWITCH_STATUS_SUCCESS) { goto done; } - if (!(macros = switch_xml_child(cfg, "macros"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macros tag.\n"); - goto done; + if ((module_name = switch_xml_attr(language, "say-module"))) { + } else if ((module_name = switch_xml_attr(language, "module"))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Deprecated usage of module attribute. Use say-module instead\n"); + } else { + module_name = chan_lang; } - if (!(language = switch_xml_child(macros, "language"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language tag.\n"); - goto done; - } - - while (language) { - if ((lname = (char *) switch_xml_attr(language, "name")) && !strcasecmp(lname, chan_lang)) { - const char *tmp; - - if ((tmp = switch_xml_attr(language, "module"))) { - module_name = tmp; - } - break; + if (!(sound_path = (char *) switch_xml_attr(language, "sound-prefix"))) { + if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { + sound_path = (char *) switch_xml_attr(language, "sound_path"); } - language = language->next; - } - - if (!language) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find language %s.\n", chan_lang); - goto done; - } - - if (!(sound_path = (char *) switch_xml_attr(language, "sound-path"))) { - sound_path = (char *) switch_xml_attr(language, "sound_path"); } if (!(tts_engine = (char *) switch_xml_attr(language, "tts-engine"))) { @@ -126,7 +109,41 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio tts_voice = (char *) switch_xml_attr(language, "tts_voice"); } - if (sound_path) { + /* If we use the new structure, check for a group name */ + if (language != macros) { + char *p; + char *macro_name_dup = switch_core_session_strdup(session, macro_name); + const char *group_sound_path; + const char *sound_prefix_enforced_str; + + if ((p = strchr(macro_name_dup, '@'))) { + *p++ = '\0'; + local_macro_name = macro_name_dup; + group_macro_name = p; + + if (!(macros = switch_xml_find_child(phrases, "macros", "name", group_macro_name))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macros group %s.\n", group_macro_name); + goto done; + } + } + /* Support override of certain language attribute */ + if ((group_sound_path = (char *) switch_xml_attr(macros, "sound-prefix")) || (group_sound_path = (char *) switch_xml_attr(macros, "sound-path")) || (group_sound_path = (char *) switch_xml_attr(macros, "sound_path"))) { + sound_path = group_sound_path; + } + + if (sound_prefix_enforced == SWITCH_FALSE && (sound_prefix_enforced_str = switch_xml_attr(macros, "sound-prefix-enforced")) + && (local_sound_prefix_enforced = switch_true(sound_prefix_enforced_str)) == SWITCH_TRUE) { + switch_channel_set_variable(channel, "sound_prefix_enforced", sound_prefix_enforced_str); + } + + } + + if (!(macro = switch_xml_find_child(macros, "macro", "name", local_macro_name))) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macro %s.\n", macro_name); + goto done; + } + + if (sound_path && sound_prefix_enforced == SWITCH_FALSE) { char *p; old_sound_prefix = switch_str_nil(switch_channel_get_variable(channel, "sound_prefix")); p = switch_core_session_strdup(session, old_sound_prefix); @@ -134,23 +151,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio switch_channel_set_variable(channel, "sound_prefix", sound_path); } - if (!(macro = switch_xml_child(language, "macro"))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find any macro tags.\n"); - goto done; - } - - while (macro) { - if ((mname = (char *) switch_xml_attr(macro, "name")) && !strcasecmp(mname, macro_name)) { - break; - } - macro = macro->next; - } - - if (!macro) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Can't find macro %s.\n", macro_name); - goto done; - } - if ((pause_val = switch_xml_attr(macro, "pause"))) { int tmp = atoi(pause_val); if (tmp >= 0) { @@ -342,6 +342,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio if (old_sound_prefix) { switch_channel_set_variable(channel, "sound_prefix", old_sound_prefix); } + if (local_sound_prefix_enforced == SWITCH_TRUE) { + switch_channel_set_variable(channel, "sound_prefix_enforced", NULL); + } + if (xml) { switch_xml_free(xml); } diff --git a/src/switch_xml.c b/src/switch_xml.c index 00f6ddd48e..0ad8768cad 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -25,7 +25,7 @@ * * Anthony Minessale II * Simon Capper - * + * Marc Olivier Chouinard * * switch_xml.c -- XML PARSER * @@ -2785,6 +2785,62 @@ SWITCH_DECLARE(int) switch_xml_std_datetime_check(switch_xml_t xcond) { return time_match; } +SWITCH_DECLARE(switch_status_t) switch_xml_locate_language(switch_xml_t *root, switch_xml_t *node, switch_event_t *params, switch_xml_t *language, switch_xml_t *phrases, switch_xml_t *macros, const char *str_language) { + switch_status_t status = SWITCH_STATUS_FALSE; + + if (switch_xml_locate("languages", NULL, NULL, NULL, root, node, params, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { + switch_xml_t sub_macros; + + if (switch_xml_locate("phrases", NULL, NULL, NULL, root, node, params, SWITCH_TRUE) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of languages and phrases failed.\n"); + goto done; + } + if (!(sub_macros = switch_xml_child(*node, "macros"))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find macros tag.\n"); + switch_xml_free(*root); + *root = NULL; + *node = NULL; + goto done; + } + if (!(*language = switch_xml_find_child(sub_macros, "language", "name", str_language))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find language %s.\n", str_language); + switch_xml_free(*root); + *root = NULL; + *node = NULL; + goto done; + } + *macros = *language; + } else { + if (!(*language = switch_xml_find_child(*node, "language", "name", str_language))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find language %s.\n", str_language); + switch_xml_free(*root); + *root = NULL; + goto done; + } + if (!(*phrases = switch_xml_child(*language, "phrases"))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find phrases tag.\n"); + switch_xml_free(*root); + *root = NULL; + *node = NULL; + *language = NULL; + goto done; + } + + if (!(*macros = switch_xml_child(*phrases, "macros"))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't find macros tag.\n"); + switch_xml_free(*root); + *root = NULL; + *node = NULL; + *language = NULL; + *phrases = NULL; + goto done; + } + } + status = SWITCH_STATUS_SUCCESS; + +done: + return status; +} #ifdef WIN32 /* From 407f47611bd4c2bb172e473fdcf398328000d28c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 20 Apr 2011 14:44:29 -0400 Subject: [PATCH 347/558] chlog: freetdm: Added q931-trace and q921-trace options --- .../freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 2 ++ .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 43d6ad555e..112e7cf27d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -213,6 +213,8 @@ typedef struct sngisdn_span_data { int8_t facility_timeout; uint8_t num_local_numbers; uint8_t ignore_cause_value; + uint8_t trace_q931; /* TODO: combine with trace_flags */ + uint8_t trace_q921; /* TODO: combine with trace_flags */ uint8_t raw_trace_q931; /* TODO: combine with trace_flags */ uint8_t raw_trace_q921; /* TODO: combine with trace_flags */ uint8_t timer_t3; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c index ee0cdbe1ef..49b07fff33 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_cfg.c @@ -369,6 +369,10 @@ ftdm_status_t ftmod_isdn_parse_cfg(ftdm_conf_parameter_t *ftdm_parameters, ftdm_ parse_yesno(var, val, &signal_data->facility_ie_decode); } else if (!strcasecmp(var, "ignore-cause-value")) { parse_yesno(var, val, &signal_data->ignore_cause_value); + } else if (!strcasecmp(var, "q931-trace")) { + parse_yesno(var, val, &signal_data->trace_q931); + } else if (!strcasecmp(var, "q921-trace")) { + parse_yesno(var, val, &signal_data->trace_q921); } else if (!strcasecmp(var, "q931-raw-trace")) { parse_yesno(var, val, &signal_data->raw_trace_q931); } else if (!strcasecmp(var, "q921-raw-trace")) { From e1c4f6c9c3f19dd40bb61e2c22995b9355d21697 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Wed, 20 Apr 2011 14:44:47 -0400 Subject: [PATCH 348/558] Missed file in last commit --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index d119ff4fd2..75379eef64 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -996,11 +996,15 @@ static ftdm_status_t ftdm_sangoma_isdn_start(ftdm_span_t *span) ftdm_clear_flag(span, FTDM_SPAN_STOP_THREAD); ftdm_clear_flag(span, FTDM_SPAN_IN_THREAD); - if (signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) { + if (signal_data->trace_q921 == SNGISDN_OPT_TRUE || + signal_data->raw_trace_q921 == SNGISDN_OPT_TRUE) { + sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); } - if (signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { + if (signal_data->trace_q931 == SNGISDN_OPT_TRUE || + signal_data->raw_trace_q931 == SNGISDN_OPT_TRUE) { + sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); } From 5d65d6d1e9a1f2f132690020ff7dbae2c3ebe883 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Wed, 20 Apr 2011 13:40:47 -0700 Subject: [PATCH 349/558] Update ChangeLog through April 20 --- docs/ChangeLog | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/ChangeLog b/docs/ChangeLog index 9aae7053a2..b4e93ab05c 100644 --- a/docs/ChangeLog +++ b/docs/ChangeLog @@ -238,6 +238,13 @@ freeswitch (1.0.7) core: Fix argument parsing for tone_detect app (r:38c3a67a/FS-3229) core: add L16 def for 32ms and allow timer matrix to drop to 1ms to support nelly (r:82e3d49f) core: fix segfault in zrtp srtcp (r:2330b340) + core: add switch_clean_name_string util function to strip out caller id name chars that can cause issues (r:244048f8) + core: switch_core_sqldb - clear pointer on release (r:aaef33cc) + core: all [] {} and <> can be stacked and override the delim per set <><^^:>{}{^^:}{^^;}[][^^:] (r:4c4bf59e/FS-3246) + core: fix default tipping point it was too low (r:e4eade33) + core: enable optimal defaults on linux kernels that can support newer features. (r:0b51aca3) + core: Lower NAT port mapping disabled log msg from WARNING to INFO (r:973a850d) + core: Change the structure of the phrases/language system. Previously it was fxml->phrases->macros->language->macro. Changed it so fxml->languages->language->phrases->macros->macro You can have sub macros and allow you to call it login@voicemail. Change the sound-path to sound-prefix to make it constistant with the rest of freeswitch. Also allow to set a sound-prefix to a macros, so you can override it for a specific file set. You can set say-modules="en" or whatever in the Date: Wed, 20 Apr 2011 16:26:47 -0500 Subject: [PATCH 350/558] stupid compiler this should never have worked --- libs/esl/fs_cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c index 2985bca2af..96cd81d349 100644 --- a/libs/esl/fs_cli.c +++ b/libs/esl/fs_cli.c @@ -839,9 +839,9 @@ static const char *basic_gets(int *cnt) } Sleep(20); } +#endif return command_buf; -#endif } #endif From 25ebf7159f312f85886d79d084321bf464ffc338 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 21 Apr 2011 12:44:05 -0500 Subject: [PATCH 351/558] skypopen: adding installer and Skype client configuration directories (to be announced :) ) --- .../skypeclient00/shared.lck | 0 .../skypeclient00/shared.xml | 99 ++++++ .../skypeclient00/skypenameA/config.lck | 0 .../skypeclient00/skypenameA/config.xml | 74 +++++ .../skypenameA/httpfe/cookies.dat | 1 + .../skypeclient00/skypenameA/index2.dat | Bin 0 -> 208 bytes .../skypeclient00/skypenameA/main.lock | 0 .../skypeclient00/skypenameB/config.lck | 0 .../skypeclient00/skypenameB/config.xml | 74 +++++ .../skypenameB/httpfe/cookies.dat | 1 + .../skypeclient00/skypenameB/index2.dat | Bin 0 -> 208 bytes .../skypeclient00/skypenameB/main.lock | 0 .../skypeclient01/shared.lck | 0 .../skypeclient01/shared.xml | 99 ++++++ .../skypeclient01/skypenameA/config.lck | 0 .../skypeclient01/skypenameA/config.xml | 74 +++++ .../skypenameA/httpfe/cookies.dat | 1 + .../skypeclient01/skypenameA/index2.dat | Bin 0 -> 208 bytes .../skypeclient01/skypenameA/main.lock | 0 .../skypeclient01/skypenameB/config.lck | 0 .../skypeclient01/skypenameB/config.xml | 74 +++++ .../skypenameB/httpfe/cookies.dat | 1 + .../skypeclient01/skypenameB/index2.dat | Bin 0 -> 208 bytes .../skypeclient01/skypenameB/main.lock | 0 .../skypeclient01/skypenameC/config.lck | 0 .../skypeclient01/skypenameC/config.xml | 74 +++++ .../skypenameC/httpfe/cookies.dat | 1 + .../skypeclient01/skypenameC/index2.dat | Bin 0 -> 208 bytes .../skypeclient01/skypenameC/main.lock | 0 .../endpoints/mod_skypopen/install/install.pl | 314 ++++++++++++++++++ 30 files changed, 887 insertions(+) create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/shared.lck create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/shared.xml create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/config.lck create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/config.xml create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/httpfe/cookies.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/index2.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/main.lock create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/config.lck create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/config.xml create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/httpfe/cookies.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/index2.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/main.lock create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/shared.lck create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/shared.xml create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/config.lck create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/config.xml create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/httpfe/cookies.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/index2.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/main.lock create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/config.lck create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/config.xml create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/httpfe/cookies.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/index2.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/main.lock create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/config.lck create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/config.xml create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/httpfe/cookies.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/index2.dat create mode 100644 src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/main.lock create mode 100755 src/mod/endpoints/mod_skypopen/install/install.pl diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/shared.lck b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/shared.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/shared.xml b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/shared.xml new file mode 100644 index 0000000000..4b72e67eb5 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/shared.xml @@ -0,0 +1,99 @@ + + + + + <_2>00001000A563932E7DE5A581942041A820F8437512A079C7ACB1B73281F191D109521E265BCD38C4133596B834AD9AA1D6BB5E1AC3D59E8675785321F722D39FBFAFB9A24E6482FA3030FFA3692D2C4A53BBCE9DC63F25D10207A20FA969982FEDC1DCC2A7C599071F4735E52AB2E06E34CA232C08B3AA2FB88A0C4A5763E0CD23C3AA37D1D2A7D6EED691EE99BA08BE294F68C24F9AE777DAF294F0AEB8346325A978DC6CF7C210AD11EF3F38111F6D98F388CF41CCBA40ABE9F0D6CBBD3118BA0588344953DF3C5E88B2CCAEDE2E692F320D20EBF16D7DB36156E617C0CC9FB2855D7FDB4C7F8638CC9830E7448D5EAE301A2810277062989841EE679E00E4E277615FEC038DE3A0A20DD7C6A2A00DFBC6A2A00DA6E2B6F404FDC6A2A00DFEC6A2A00DF7FBBB990CF2C6A2A00D8EB4FE8A0C8FB4FE8A0C95C7A6E00CF5FBBB990CD6C7A6E00CD0F896950CCCE2B6F40485CCA2A00DA1D8EEA50DFDFBBB990CA7C7A6E00CA8C7A6E00CA9C7A6E00C97C7A6E00C90B4FE8A0CFE90D59308C290D59308D1E2B6F404C5E2B6F404C6AAF18705C7AAF18705C8AAF18705BBD8EEA50DBCD8EEA50DBDD8EEA50D93CCA2A00D94CCA2A00DEFE2B6F40491B4FE8A0CE2FBBB990CE3FBBB990CBED8EEA50DA0CCA2A00DA1CCA2A00DA6B4FE8A0CA7B4FE8A0CCED8EEA50DA3CCA2A00DA4CCA2A00D84E698AD0DB8C7A6E00CD9E2B6F404E0E2B6F40486E698AD0DFDF896950C0013A60400173D0018DE0200190300AB01F40300449875044518C15F9A278109D4BBAC4E8109D408A6238109D5A63304810904460CC15F9A26303ED408A624303E0047B054004801004980A305004A80E90F004BE0A801004C80A305004D01005CAC02045E5A50FC55465BA050FC55475BA050FC55485BA0C32EFDEE5BA0C32EFDEF5BA0C2A5BC4A5BA0C2A5BC4B5BA0D4BBAC055BA0D4BBAC145BA0D4BBAC215BA0D408A3575BA0D408A37D5BA0D408A37E5BA08275487E5BA0827548425BA00060B817046506CC09A3D6303E04AE018C0125F8D500021A25F9D500011A162102200301220125FFD50025FAD5000C03E4000D2580D6000F060125F8D5000302172105050103080D06010501011C210302060125FCD50025F9D5000A25FDD50025FED5000A0D06020502050119211305020380808080100C05010D0380808080100B25FDD5000C01080005000380808080100D060307010503220101220104AC01BF012597CE002597CE002590CE0019152590CE002597CE000B033C1815210220030122012593CE0014212E2594CE002103030B220125A5CE00030F172103030B22012596CE00142103030B22012597CE00142103030B22012599CE00142103030A220125A5CE00030A1A2590CE002592CE000B031E1B15142103030A220125A4CE000380201D14210303092201259BCE0014210A2594CE002103030B2201259DCE00142103030822012593CE002103012201259ECE001421030306220103022201006800006901006A01006C987504740CC2A5BC4C303ED408A34C303E007828047912CC09A3D3303E82754864303E4E8DB16F303E047DBF010203020800050003020D0B0601030308000500020501030508000500021A03060800050003041A16030508000500021D160C0A0C060203D00F251205020A03020D0A050103D00F0C0A0603010800050003FFFFFFFF0F18030208000500021D141506042512020800050003030D05040C10030205040B0C06050306050505020A0C060603040800050003050800050003E400180C0607050703E400250A0B250A011C0C0A0314100608050303C03E0F03B8171005060388270F03DC0B100508047E5E0380010304080005000B03040D250403E4000F03140D0A2503250203030D0A0B0110060101080005000380020D0302080005000380020D172103010601250A03E4001B210D0501030A03E400250A210303DF002002250A0B0D0F0601050100800180EA49008101E003036F3139352E34362E3235332E3235333A313233353000038201706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B7970653B706F6F6C333D6578747261732E646F776E6C6F6164732E736B7970653B706F6F6C343D2A2E736B79706566696E642E736B7970653B706F6F6C353D2A2E7072656D69756D2E736B7970653B706F6F6C363D2A2E6D756C74696D656469612E736B7970653B706F6F6C373D2A2E6D756C74696D656469612E6D657461636166653B706F6F6C383D2A2E6D756C74696D656469612E6461696C796D6F74696F6E3B706F6F6C393D2A2E6D756C74696D656469612E6D6574616F6D6E69747572653B706F6F6C31303D77686174736E65772E736B7970653B706F6F6C31313D7061792E736B7970653B706F6F6C31323D7365637572652E7061792E736B7970653B706F6F6C31333D2A2E70696373746F72653B706F6F6C31343D2A2E6D796163636F756E742E736B7970653B706F6F6C31353D2A2E62696269743B706F6F6C31363D2A2E70726F6363796265723B706F6F6C31373D747261636B696E672E6F6D6E69747572653B706F6F6C31383D676F2E736B7970653B706F6F6C31393D747261636B2E736B7970657C706F6F6C313D3139342E3139322E3139392E3235313A31323335303B706F6F6C323D3139342E3139322E3139392E3235323A31323335303B706F6F6C333D3139342E3139322E3139392E3235323A31323335303B706F6F6C343D3139342E3136352E3138382E3130313A31323335303B706F6F6C353D3139332E39352E3135342E31353A31323335313B706F6F6C363D3139342E3136352E3138382E3130303A31323335303B706F6F6C373D3139342E3136352E3138382E3130303A31323335303B706F6F6C383D3139342E3136352E3138382E3130303A31323335303B706F6F6C393D3139342E3136352E3138382E3130303A31323335303B706F6F6C31303D3230342E392E3136332E3134313A31323335303B706F6F6C31313D3139352E34362E3235332E3234353A31323335303B706F6F6C31323D3139352E34362E3235332E3234353A31323335303B706F6F6C31333D3139332E39352E3135342E31343A31323335313B706F6F6C31343D3139332E39352E3135342E31343A31323335313B706F6F6C31353D3139332E39352E3135342E31343A31323335313B706F6F6C31363D3139332E39352E3135342E31343A31323335313B706F6F6C31373D3139342E3136352E3138382E3130303A31323335303B706F6F6C31383D3139342E3136352E3138382E3130303A31323335303B706F6F6C31393D3139332E39352E3135342E31343A31323335310003B101706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B797065206578747261732E646F776E6C6F6164732E736B7970653B706F6F6C333D2A2E687773746F72652E736B7970653B706F6F6C343D2A2E736B79706566696E642E736B797065202A2E6469726563746F72792E736B7970653B706F6F6C353D2A2E70696373746F7265202A2E6D796163636F756E742E736B797065202A2E6269626974202A2E70726F63637962657220747261636B2E736B79706520617070732E736B7970656173736574733B706F6F6C363D2A2E6D756C74696D656469612E736B797065202A2E6D756C74696D656469612E6D65746163616665202A2E6D756C74696D656469612E6461696C796D6F74696F6E202A2E6D756C74696D656469612E6D6574616F6D6E6974757265207777772E736B7970652077686174736E65772E736B7970653B706F6F6C373D7061792E736B797065207365637572652E7061792E736B7970653B706F6F6C383D6170692E736B7970653B706F6F6C393D63616C6C70686F6E65732E736B7970652063616C6C72617465732E736B7970653B706F6F6C31303D2A2E7072656D69756D2E736B7970653B706F6F6C31323D6C6F67732E736B7970653B706F6F6C31333D617661746172736572766963652E736B79706520636F6E74616374696D706F72742E736B7970653B706F6F6C31343D676F2E736B7970653B706F6F6C31353D747261636B696E672E6F6D6E69747572657C706F6F6C313D3139342E3139322E3139392E3235312C31323335302C312C4E4C2C77652C35302C313B706F6F6C323D3139342E3139322E3139392E3235322C31323335302C312C444B2C77652C35302C313B706F6F6C333D3139332E39352E3135342E31372C31323335312C312C49452C77652C35302C31203231322E3138372E3137322E36322C31323335312C312C49452C77652C35302C31203139352E34362E3235332E3232372C31323335312C312C4C552C77652C35302C31203231322E382E3136362E33332C31323335312C312C4C552C77652C35302C313B706F6F6C343D3139342E3136352E3138382E3130312C31323335302C312C49452C77652C35302C313B706F6F6C353D3139332E39352E3135342E31342C31323335312C312C49452C77652C35302C31203139352E34362E3235332E3230352C31323335312C312C4C552C77652C35302C31203231322E3138372E3137322E35392C31323335312C312C49452C77652C35302C31203231322E382E3136362E31392C31323335312C312C4C552C77652C35302C313B706F6F6C363D3139342E3136352E3138382E3130302C31323335302C312C49452C77652C35302C31203230342E392E3136332E3134302C31323335302C312C43412C6E612C35302C313B706F6F6C373D3139352E34362E3235332E3234352C31323335302C312C4C552C77652C35302C31203139332E39352E3135342E31362C31323335312C312C49452C77652C35302C31203231322E3138372E3137322E36312C31323335312C312C49452C77652C35302C31203231322E382E3136362E32302C31323335302C312C4C552C77652C35302C313B706F6F6C383D3230342E392E3136332E3138342C31323335302C312C43412C6E612C35302C312037382E3134312E3137372E38392C31323335302C312C4C552C77652C35302C313B706F6F6C393D3139342E3136352E3138382E3131352C31323335302C312C49452C77652C35302C31203230342E392E3136332E3134312C31323335302C312C43412C6E612C35302C313B706F6F6C31303D3139332E39352E3135342E31352C31323335312C312C49452C77652C35302C31203231322E3138372E3137322E36302C31323335312C312C49452C77652C35302C31203139352E34362E3235332E3232362C31323335312C312C4C552C77652C35302C31203231322E382E3136362E33322C31323335312C312C4C552C77652C35302C313B706F6F6C31323D37382E3134312E3137372E37362C31323335302C312C4C552C77652C35302C313B706F6F6C31333D3230342E392E3136332E3136372C31323335302C312C43412C6E612C35302C312037382E3134312E3137372E38312C31323335302C312C4C552C77652C35302C313B706F6F6C31343D3230342E392E3136332E3136382C31323335302C312C43412C6E612C35302C31203139342E3136352E3138382E3130302C31323335302C312C49452C77652C35302C313B706F6F6C31353D3230342E392E3136332E3136392C31323335302C312C43412C6E612C35302C31203139342E3136352E3138382E3130302C31323335302C312C49452C77652C35302C3100039701736B79706566696E642E736B7970653D31372C362C382C2D33392C3139206469726563746F72792E736B7970653D31372C362C382C2D33392C31390003A60138302E3235322E38352E37302C32333435362C312C6E6C2C77652C35302C312038302E3235322E38352E37312C32333435362C312C6E6C2C77652C35302C312038302E3235322E38352E37322C32333435362C312C6E6C2C77652C35302C31203139352E34362E3235332E3233382C32333435362C322C6C752C77652C35302C31203139352E34362E3235332E3233392C32333435362C322C6C752C77652C35302C31203139342E3136352E3138382E37342C32333435362C332C69652C77652C35302C31203139342E3136352E3138382E37352C32333435362C332C69652C77652C35302C31203231322E3138372E3137322E352C32333435362C342C69652C77652C35302C31203231322E3138372E3137322E32302C32333435362C342C69652C77652C35302C31203231322E3138372E3137322E33332C32333435362C342C69652C77652C35302C31203231322E382E3136332E38372C32333435362C362C6C752C77652C35302C31203231322E382E3136332E3132352C32333435362C362C6C752C77652C35302C31203231322E382E3136332E3132362C32333435362C362C6C752C77652C35302C31203133302E3131372E37322E3132362C32333435362C372C6E6C2C77652C35302C31203133302E3131372E37322E36362C32333435362C372C6E6C2C77652C35302C310004B2010B03A09C0125B3EA010B220104A5012A24A39C012102220025A19C010401F3C2011A142103030A220125B0EA0103051A2103030B2201030522010384012B39393030303131313A37382E3134312E3137372E39363A3233343536000086010C008701880E039101000493010CC2A5BC5C2774C32EFDD927740496010CD592BC1034504E8DB5F2345006C20105F801F901FA01FB01FC010395016272617465303D31206272617465313D31206272617465323D31206272617465333D31206272617465343D31206272617465353D31206272617465363D31206272617465373D31206272617465383D31207372617465303D31207372617465313D31207372617465323D31207372617465333D31207372617465343D31207372617465353D31207372617465363D31207372617465373D31207372617465383D310003B4013139342E3136352E3138382E37373A3132333530203231322E382E3136332E3130333A31323335300000C0010100C1010103CB012E6163636573732E736B7970652E6E65740000E1010F00F0010100F101A982CA950303D50137382E3134312E3137372E33383A3132333530203230342E392E3136332E3135313A31323335300003CF0137382E3134312E3137372E36393A3132333530203230342E392E3136332E3134393A31323335300000D6010103E4013139342E3136352E3138382E38303A3132333530203231322E382E3136362E353A31323335300003E5010000F8016403F7015B574845453A204F4646203130302C20563120302C20563220305D205B496E70757445513A204F46462035302C2056312035305D205B4945513A204F46462031362C2056312031322C2056322031322C2056332031322C2056342031322C2056352031322C2056362031322C2056372031325D205B53453A204453203130302C2057494F20305D205B5345323A2044532039302C2057494F2031305D205B414D504D3A204F4C442035302C20444147432035305D205B4B54523A204F46462035302C204F4E2035305D205B49414D323A204F46462039392C204D3120312C204D3220305D0003FA0152434F4E3D350003F901302F342E322E2A2E2A2C33322C3320302F352E302E2A2E2A2C31342C3320302F352E312E2A2E3130342C342C330003A80168747470733A2F2F7777775C2E70617970616C5C2E2E3F2E3F2E3F247C68747470733A2F2F696D616765735C2E70617970616C5C2E636F6D247C68747470733A2F2F7777775C2E70617970616C6F626A656374735C2E636F6D247C68747470733F3A2F2F2E2B5C2E666263646E5C2E6E6574247C68747470733F3A2F2F2E2B5C2E66616365626F6F6B5C2E636F6D247C68747470733F3A2F2F6368616E6E656C5C2E736B7970655C2E636F6D247C68747470733A2F2F617070735C2E736B7970655C2E636F6D247C68747470733F3A2F2F7161617070735C2E736B7970655C2E6E6574247C68747470733F3A2F2F636F6E6E6563745C2E66616365626F6F6B5C2E6E6574247C68747470733A2F2F2E2A5C2E736B7970656173736574735C2E636F6D247C68747470733A2F2F61645C2E646F75626C65636C69636B5C2E6E6574247C68747470733A2F2F61642D656D65615C2E646F75626C65636C69636B5C2E6E6574247C68747470733A2F2F61642D617061635C2E646F75626C65636C69636B5C2E6E6574247C68747470733A2F2F737461746963323F5C2E736B7970655C2E636F6D247C68747470733A2F2F7161737461746963323F5C2E736B7970655C2E6E6574247C68747470733A2F2F7072657374617469635C2E736B7970655C2E6E6574240003FF013078313030303230343030393136333231372D642D723230342E392E3136332E3231373A38313932203078313030303230343030393136333231392D642D723230342E392E3136332E3231393A38313932203078313030303230343030393136333232312D642D723230342E392E3136332E3232313A38313932203078313030303230343030393136333232332D642D723230342E392E3136332E3232333A38313932203078313030303230343030393136333232352D642D723230342E392E3136332E3232353A38313932203078313030303230343030393136333232372D642D723230342E392E3136332E3232373A38313932203078313030303230383038383138363030352D642D723230382E38382E3138362E353A38313932203078313030303230383038383138363030372D642D723230382E38382E3138362E373A38313932203078313030303230383038383138363030392D642D723230382E38382E3138362E393A38313932203078313030303230383038383138363031312D642D723230382E38382E3138362E31313A38313932203078313030303230383038383138363031332D642D723230382E38382E3138362E31333A38313932203078313030303230383038383138363031352D642D723230382E38382E3138362E31353A38313932203078313030303230383038383138363031372D642D723230382E38382E3138362E31373A38313932203078313030303230383038383138363031392D642D723230382E38382E3138362E31393A38313932203078313030303230383038383138363032312D642D723230382E38382E3138362E32313A38313932203078313030303230383038383138363032332D642D723230382E38382E3138362E32333A38313932203078313030303230383038383138363032352D642D723230382E38382E3138362E32353A38313932203078313030303230383038383138363032372D642D723230382E38382E3138362E32373A38313932203078313030303230383038383138363032392D642D723230382E38382E3138362E32393A38313932203078313030303230383038383138363033312D642D723230382E38382E3138362E33313A38313932203078313030303230383038383138363033332D642D723230382E38382E3138362E33333A38313932203078313030303230383038383138363033352D642D723230382E38382E3138362E33353A38313932203078313030303230383038383138363033372D642D723230382E38382E3138362E33373A38313932203078313030303230383038383138363033392D642D723230382E38382E3138362E33393A38313932203078313030303230383038383138363034372D642D723230382E38382E3138362E34373A38313932203078313030303230383038383138363034392D642D723230382E38382E3138362E34393A38313932203078313030303230383038383138363035312D642D723230382E38382E3138362E35313A38313932203078313030303230383038383138363035332D642D723230382E38382E3138362E35333A38313932203078313030303230383038383138363035352D642D723230382E38382E3138362E35353A38313932203078313030303230383038383138363035372D642D723230382E38382E3138362E35373A38313932203078313030303230383038383138363035392D642D723230382E38382E3138362E35393A38313932203078313030303230383038383138363036312D642D723230382E38382E3138362E36313A38313932203078313030303230383038383138363036332D642D723230382E38382E3138362E36333A38313932203078313030303230383038383138363035392D642D723230382E38382E3138362E36353A38313932203078313030303230383038383138363036312D642D723230382E38382E3138362E36373A38313932203078313030303230383038383138363036332D642D723230382E38382E3138362E36393A38313932203078313030303230383038383138363037312D642D723230382E38382E3138362E37313A38313932203078313030303230383038383138363037332D642D723230382E38382E3138362E37333A38313932203078313030303230383038383138363037352D642D723230382E38382E3138362E37353A38313932203078313030303230383038383138363037372D642D723230382E38382E3138362E37373A38313932203078313030303230383038383138363037392D642D723230382E38382E3138362E37393A38313932203078313030303230383038383138363038312D642D723230382E38382E3138362E38313A38313932203078313030303230383038383138363038332D642D723230382E38382E3138362E38333A38313932203078313030303230383038383138363038352D642D723230382E38382E3138362E38353A38313932203078313030303230383038383138363038372D642D723230382E38382E3138362E38373A38313932203078313030303230383038383138363038392D642D723230382E38382E3138362E38393A38313932203078313030303230383038383138363039312D642D723230382E38382E3138362E39313A38313932203078313030303230383038383138363039332D642D723230382E38382E3138362E39333A38313932203078313030303230383038383138363039352D642D723230382E38382E3138362E39353A38313932203078313030303230383038383138363039372D642D723230382E38382E3138362E39373A38313932203078313030303230383038383138363039392D642D723230382E38382E3138362E39393A38313932203078313030303230383038383138363130312D642D723230382E38382E3138362E3130313A38313932203078313030303230383038383138363130332D642D723230382E38382E3138362E3130333A38313932203078313030303230383038383138363130352D642D723230382E38382E3138362E3130353A38313932203078313030303230383038383138363130372D642D723230382E38382E3138362E3130373A38313932203078313030303230383038383138363130392D642D723230382E38382E3138362E3130393A38313932203078313030303230383038383138363131312D642D723230382E38382E3138362E3131313A38313932203078313030303230383038383138363131332D642D723230382E38382E3138362E3131333A38313932203078313030303230383038383138363131352D642D723230382E38382E3138362E3131353A38313932203078313030303230383038383138363131372D642D723230382E38382E3138362E3131373A38313932203078323030303134393030353034353031312D642D723134392E352E34352E31313A38313932203078323030303134393030353034353031332D642D723134392E352E34352E31333A38313932203078323030303134393030353034353031352D642D723134392E352E34352E31353A38313932203078323030303134393030353034353031372D642D723134392E352E34352E31373A38313932203078323030303134393030353034353031392D642D723134392E352E34352E31393A38313932203078323030303134393030353034353032312D642D723134392E352E34352E32313A38313932203078323030303134393030353034353032332D642D723134392E352E34352E32333A38313932203078323030303134393030353034353032352D642D723134392E352E34352E32353A38313932203078323030303134393030353034353032372D642D723134392E352E34352E32373A38313932203078323030303134393030353034353032392D642D723134392E352E34352E32393A38313932203078323030303134393030353034353033312D642D723134392E352E34352E33313A38313932203078323030303134393030353034353033332D642D723134392E352E34352E33333A38313932203078323030303134393030353034353033352D642D723134392E352E34352E33353A38313932203078323030303134393030353034353033372D642D723134392E352E34352E33373A38313932203078323030303134393030353034353033392D642D723134392E352E34352E33393A38313932203078323030303134393030353034353034312D642D723134392E352E34352E34313A38313932203078323030303134393030353034353034332D642D723134392E352E34352E34333A38313932203078323030303134393030353034353034352D642D723134392E352E34352E34353A38313932203078323030303134393030353034353034372D642D723134392E352E34352E34373A38313932203078323030303134393030353034353034392D642D723134392E352E34352E34393A38313932203078323030303134393030353034353035312D642D723134392E352E34352E35313A38313932203078323030303134393030353034353035332D642D723134392E352E34352E35333A38313932203078323030303134393030353034353035352D642D723134392E352E34352E35353A38313932203078323030303134393030353034353035372D642D723134392E352E34352E35373A38313932203078323030303134393030353034353035392D642D723134392E352E34352E35393A38313932203078323030303134393030353034353036312D642D723134392E352E34352E36313A38313932203078323030303134393030353034353036332D642D723134392E352E34352E36333A38313932203078323030303134393030353034353036352D642D723134392E352E34352E36353A38313932203078323030303134393030353034353036372D642D723134392E352E34352E36373A38313932203078323030303134393030353034353036392D642D723134392E352E34352E36393A38313932203078323030303134393030353034353037312D642D723134392E352E34352E37313A38313932203078323030303134393030353034353037332D642D723134392E352E34352E37333A38313932203078323030303134393030353034353037352D642D723134392E352E34352E37353A38313932203078323030303134393030353034353037372D642D723134392E352E34352E37373A38313932203078323030303134393030353034353037392D642D723134392E352E34352E37393A38313932203078323030303134393030353034353038312D642D723134392E352E34352E38313A38313932203078323030303134393030353034353038332D642D723134392E352E34352E38333A38313932203078323030303134393030353034353038352D642D723134392E352E34352E38353A38313932203078323030303134393030353034353038372D642D723134392E352E34352E38373A38313932203078323030303134393030353034353038392D642D723134392E352E34352E38393A38313932203078323030303134393030353034353039312D642D723134392E352E34352E39313A38313932203078323030303134393030353034353039332D642D723134392E352E34352E39333A38313932203078323030303134393030353034353039352D642D723134392E352E34352E39353A38313932203078323030303134393030353034353039372D642D723134392E352E34352E39373A38313932203078323030303134393030353034353039392D642D723134392E352E34352E39393A38313932203078323030303134393030353034353130312D642D723134392E352E34352E3130313A38313932203078323030303134393030353034353130332D642D723134392E352E34352E3130333A38313932203078323030303134393030353034353130352D642D723134392E352E34352E3130353A38313932203078323030303134393030353034353130372D642D723134392E352E34352E3130373A38313932203078323030303134393030353034353130392D642D723134392E352E34352E3130393A38313932203078323030303134393030353034353131312D642D723134392E352E34352E3131313A38313932203078323030303134393030353034353131332D642D723134392E352E34352E3131333A38313932203078323030303134393030353034353131352D642D723134392E352E34352E3131353A38313932203078323030303134393030353034353131372D642D723134392E352E34352E3131373A38313932203078323030303134393030353034353131392D642D723134392E352E34352E3131393A38313932203078323030303134393030353034353132312D642D723134392E352E34352E3132313A38313932203078323030303134393030353034353132332D642D723134392E352E34352E3132333A38313932203078323030303134393030353034353132352D642D723134392E352E34352E3132353A38313932203078323030303134393030353034353132372D642D723134392E352E34352E3132373A38313932203078323030303134393030353034353132392D642D723134392E352E34352E3132393A38313932000089020A062E19AEBFD5A40B80D4B6B30280D2AFF205808CFD910B80DEB9F1048FA486F4049CA486F404D5A486F404ACC686F404C2C686F404878F87F404CEB887F404ADC487F404BCC687F404D4D087F404F9EA87F4049CF587F404C8F487F404C9F487F404CAF487F404EACCBB9C05F7CCBB9C05E694D7BB058E96D7BB05A896D7BB050094023C0095021400930201039902536B79706520546563686E6F6C6F6769657320534100008E0200008F0280BAB70300910280A30503F2013231332E3134362E3138392E3230313A3132333530203231332E3134362E3138392E3230323A3132333530203231332E3134362E3138392E3230333A3132333530203231332E3134362E3138392E3230343A3132333530203231332E3134362E3138392E3230353A3132333530203231332E3134362E3138392E3230363A3132333530203231322E3136312E382E31303A3132333530203231322E3136312E382E323A3132333530203231322E3136312E382E333A3132333530203231322E3136312E382E343A3132333530203231322E3136312E382E353A3132333530203231322E3136312E382E363A31323335300000FC010106FD0106011E64AC02A403E807009002C20103C301687474703A2F2F37392E3132352E36332E3732247C68747470733F3A2F2F2E2B5C2E66616365626F6F6B5C2E636F6D240000DE0148 + <_256>000010011AC0AA3BA66DF7FB48228AE35F9BB4A032FE4A6A898DA7A1A5AE37DC59FB3D09607F1CACD46A5DBC008DABF8F09C797DF5A8903307D04C318825CEA7C481303C655A9EEE099E9A0AF1158373B458BB8FDACB336A6EC63C043E6782688E2350B417DDDDFF96B474DAEA7D1DF3742303B79111FC752BFB5D6887A5B822F945CC761FAF6E80DE5EC60868768CB8A9F9C876137806DCEA0DD1300181558ABFDBA26592078F5F84195C526D8C7F339EF82700FD93F8FB71ADA5ED3E977D27FA52D1F489EF5DA0A9E00B146BADCBDEBFB0DFEBCD61E5B8352A49893357E0DC3A736743929DA975782EA4D8184605FD064641986C47706D264281C876F926BF58003E9E + <_3>0000100498ECF8A7A4585F76C930739A1EAE590DE96D9EF3AA9B231E67965F3F08ECFC493E1DA23ECDE17A85C94CBE034E88F9414E9BBC82F32AAFCFFB2C09F6F57A478238BAEC9EEF2BB9C67F71257722E6786D88D6400F6B7D81450FB3B6CCCC3986E3782D2387E354EBA9099331AEF510D479C6601D2383D866E2B5B525DF0BA975D58C120EFAE88C89EE365FC696CC891B77F67CFA18FDE8E95DDAC25A7C7D70FA7A1414BAE593856A658888C622836006C1C131B4B2E805554DCFA52F3EFD34C1B759BF8A302E491835DCE701E84D37ED150C8ADD699AD3DCA9F515123C5B5AD94E253E173BA3465E64A0079D5EF4E6075E66D0F5FBC3D9BC25C4E80C4CB2FE9B87040003000004D00F0005D00F050041040400B80125C20003141B14230025D50003031B14230024E100142300250003191714230025EA0003141714230025EA00011724EA00140A14230025E400030F1C14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E10025E10003A006100A0309031725000325180C0A25C20003140B0C03040D0A03882725C3000C0A03E43225C4000C0A0602050228038407DC08FA1E0601050102050203FA1E1C0603250028061D1E1F202122060105010205010503050141060300636F756E74206279207175616C697479000001CC080002040003000004010005010501410603006261647175616C69747920636F756E742062792076657273696F6E000001D6080002070003000004010005010501410603006261647175616C6974792073756D2062792076657273696F6E000001E0080002070003000004010005010500410304005424E400142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E40025E40028043CB401D804901C060105010205014106030073756D206F66206C61737463616C6C206475726174696F6E73000001B009000201000300000480A3050005B054050141060300636F756E74206279206C61737463616C6C206475726174696F6E000001BA090002050003000004010005010500410204005025EB00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EB0028031E32D0000601050102050141060300636F756E742062792073797374656D20637075207573616765000001940A0002040003000004010005010500410204004F25EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050141060300636F756E742062792070726F63657373206370752075736167650000019E0A0002040003000004010005010500410304006824C20014230024E60014230025E600011A14230025EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050125C2000501410603006A6974746572636F756E742062792070726F6365737320637075207573616765000001F80A0002040003000004010005010501410603006A69747465722062792070726F6365737320637075207573616765000001820B0002040003000004D00F0005D00F0500410304004424E700142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A1423000225E700050141060300706F74656E7469616C207463702066616C6C6261636B73000001DC0B00020100030000040100050105014106030061637475616C207463702066616C6C6261636B73000001E60B00020100030000040100050105004103040056240C142300250C030A1814230025EA0003141714230025EA00011724EA00140A14230024E70014230025E700011A14230024E50014230025E500011C0602250C29050306070809280401020405060105010205010502050141060300636F756E74206279206E617474797065000001C00C0002050003000004010005010501410603007564706661696C75726573206279206E617474797065000001CA0C0002050003000004010005010500410204001B25D90014230025D90025DA000B0602050228030102040601050102050141060300636F756E74206279206E726F666D756C74696368617473000001A40D0002040003000004010005010500410304001425F700011C14230025000319171423000225F90005014106030075736572732077686F206861766520636F6D706C65746564204943000001880E0002010003000004010005010501410603006C617374204943207969656C6420676C6F62616C73756D000001920E0002010003000004E8070005500500410304001224F60014230025000319171423000225F60005014106030075736572732077686F206861766520494320737570706F7274000001EC0E0002010003000004010005010501410603004943207374617274757020636F756E7420676C6F62616C73756D000001F60E00020100030000046400051405004102040025240C142300250C030A18142300250C011C142300250C280802030405060708090601050102050141060300636F756E74206279206E617474797065000001D00F0002090003000004010005010500410404001A250003191714230025E20025E30025FC00280201020601050102050141060300766964656F2073656E642063617061626C650000019811000201000300000401000501050141060300766964656F20706172616C6C656C2063616C6C730000019911000201000300000414000502050141060300636F756E7420627920766964656F2063616C6C73206D616465000001A2110002030003000004010005010500410204003A250003191714230025EA0003141714230025EA00011724EA00140A14230024E50014230025E50003031914230025E50028030102030601050102050141060300636F756E742062792073747265616D7472616E73706F7274000001FC11000204000300000401000501050041090400E00125C20003141B25E400030F1C1514230024E100142300250003191714230025EA0003141725EA0001171514230025FF002580010A011A14230025E60003031A25E50003031A1514230024F5001423002412142300249F0114230025C30025E10025E10003A006100A03A0060B0309031725000325180C0A25C20003140B0C03040D0A2512030A0C251025F5001703CC080C0A1C160602020502250003231B241D150603050305020503150503251D03808080808080808080011D14150603050305020503150503251D038080808080808080C0011D1415060305030502050315050141060300706F74656E7469616C2052555F756E65787065637465645F62616471000001E01200020100030000040100050105014106030061637475616C2052555F756E65787065637465645F62616471000001EA1200020100030000040100050105014106030042435020706F74656E7469616C2052555F756E65787065637465645F62616471000001F4120002010003000004010005010501410603004243502061637475616C2052555F756E65787065637465645F62616471000001FE12000201000300000401000501050141060300424350203220706F74656E7469616C2052555F756E65787065637465645F62616471000001881300020100030000040100050105014106030042435020322061637475616C2052555F756E65787065637465645F626164710000019213000201000300000401000501050141060300424350203420706F74656E7469616C2052555F756E65787065637465645F626164710000019C130002010003000004010005010501410603004243502031362061637475616C2052555F756E65787065637465645F62616471000001A6130002010003000004010005010500410304000825B801011C25B701050141060300757365727320696E207075626C6963206368617473000001C4130002010003000004010005010501410603007075626C69632063686174206D6573736167657320696E206C617374206D696E757465000001CE1300020100030000046400050A0500410404005F248E0114230024D5001423002500032B1B1423002500032B1C250D03021C16250E03FFFFFFFF0F1D03B4E2C8F10217250E0380808080100D03B4E2C8F10217151614230025D500280219C80106010501020501258E010501258E0103880E1C050141060300636F756E742062792062756464696573000001A814000203000300000401000501050141060300617661696C6162696C697479206167652062792062756464696573000001B2140002030003000004C0FC150005A099020501410603006C6F6E6720617661696C6162696C697479206167652062792062756464696573000001BC140002030003000004010005010500410204003324C000142300250003191714230025F301290300E5C68583B7AEDE36F2CAB9A3A7AE983806020502280202030601050125C00005014106030073696D756C74616E656F75732063616C6C7320706572206E616D6573706163650000018C15000203000300000419000519050041020400C50125C00006020502142300250006030503031917142300050303231B06040504210302200225A1010605050421030502200225A2010606030606070505021A050503021A160506021A15210305072002010607050203021B050603021B152103050720020206070502021A050603021B15210305072002030206070502021A050503041A15210305072002030306070502021A050503031A15210305072002030406070502021A050503051A152103050720020305060705072806010203040506060105010205014106030063616C6C6572733A207332735F313120636F6E665F686F737420636F6E665F636C69656E7420736B7970656F757420736B797065696E20766F6963656D61696C20756E6B6E6F776E000001F015000207000300000401000501 + <_4>000010052A0B6759B71FBC1EF05BE97DFEA4EE6C1E15AF19ED70DEC1130B14C13CE41246D302B9662592907E3CA508A57702B5C00C2A05170857FA22012E0F235B425B4D919B23A541D3AD6E948FC634DE71A29493634884DFD5E9D89C5D951CBCD71B9B3ABFD3C4E2779BB1817D76E7C223CA36BD75A6A05B730AF138057E4048B2FFDD522BB588EC0B9D3E014BF9E354EB608150BC613C739D9E8C7465F05F047FAF7AFA3EE89B9B58BF0FC35F07B55CF3E4B59A7C4ED48B1C0C7F0305E6AC2E80AAEAD6064EB6ACDC1806FCE0B5CB66F0840DA7F0FE7B228E3898E3E42A9AFEFE13DDF019EF8D8F02A631AF2615BBC6E1EDB65C89A775F642C88109E6247EC4B463DC302E2A2E323000050541020006020307322E302E2A2E3100050541030006020307322E302E2A2E3200000AE4ED8009050541030006020307322E302E2A2E33000009B3E6CC990B050541040006020307322E302E2A2E3400000AE4ED8009000BA00B050541030006020308322E302E2A2E35000307322E302E2A2E3900050541040006020308322E302E2A2E39000307322E302E2A2E313100000AE4ED8009050541040006020308322E302E2A2E3131000307322E302E2A2E3135000009E6CC99B306050541050006020308322E302E2A2E3135000307322E302E2A2E323000000AE4ED8009000BA00B050041050303557067726164655465737433000301332E302E302E3130300003044E6963654272616E6400050541040006020307332E302E302E2A0003074E6963654272616E6400000AE4ED8009050541040006020307322E302E302E2A0003074E6963654272616E6400000AE4ED80090500410E0303557067726164655465737433000301332E302E302E31303000050541040006020307332E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307322E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307332E302E302E39380003074F746865724272616E64000009B3E6CC990B050541040006020307322E302E302E39380003074F746865724272616E64000009B3E6CC990B050541050006020307332E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541050006020307322E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541030006020307332E302E302E393900000AE4ED8009050541030006020307322E302E302E393900000AE4ED8009050541030006020307332E302E302E3938000009B3E6CC990B050541030006020307322E302E302E3938000009B3E6CC990B050541040006020307332E302E302E393700000AE4ED8009000BA00B050541040006020307322E302E302E393700000AE4ED8009000BA00B0500410303033130303031000301302E302E302E313000050541020006020307302E302E302E3900 + <_5>00001006739CA527EF827847E16F23CD52458C3EBA3460A42935EC6948BEFA626B49E3BDF279FC62486E2DDBCA19609ED23D31F4E5175920F282AD74A74A997C3909E67B622480C68A058E886C7D5F3C40954880D7798CD61CEA0FBAFB389BE5B2B8A887348F7AADB4DF642B194B814047CDA0E698EDDE61DFA731DCA5883A76F913D8C94066718054E85ADA7AE009F2B2A9AF762FDCB9B6CAF64C156911E3AB172CFD795F66FB6E8E15048A54E4AB17979D6C447DEBADE75CC6F606050D980061112AFF9AE7C7BF8065D711949E41FA4C8B6CBF0916BB395B3E186A7D617D353C6BFFC687FE79475DFA095D113D70B828FB597BC3665B7C9C3669CA9CBE5D308D3FC23803044E45544745415200050541020006040307302E392E302E2A000500410503033130303033000301312E302E302E3137000304534D4300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E312E302E313000030442454C4B494E00050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E3137000304454447452D434F524500050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E31330003044C4F474954454300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303035000301312E342E38382E31333636000304544F50434F4D00050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410503033130303035000301312E342E38382E313336360003045043484F4D4500050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410403033130303036000301302E302E302E313000050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303037000301312E302E312E330003045445434F00050541020006040307312E302E302E3800050541020006020307312E302E312E31000500410503033130303038000301302E392E332E3339370003044C494E4B53595300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003044E45544745415200050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003045048494C49505300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410403033130303130000301302E392E302E31310003044C494E4B53595300050541020006040307302E392E302E3130000500410403033130303130000301302E392E302E313100030442554646414C4F00050541020006040307302E392E302E3130000500410503033130303132000301312E302E302E310003044353544E00050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303133000301302E302E332E3234000304414B00050541020006040307302E302E312E323400050541020006020307302E302E322E3234000500410303033130303134000301312E372E34332E33382E3200050541020006040307312E372E32332E32372E34000500410503033130303135000301312E322E31372E30000304415A5445434800050541020006040307312E322E31312E3000050541020006020307312E322E31352E30000500410303033130303230000301312E302E302E343700050541030006020308312E302E302E3233000307312E302E302E3233000500410403033130303234000301332E322E302E323800050541030006040308332E302E302E35000307332E302E302E3500050541030006020308332E312E302E31000307332E322E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E494300050541020006040307302E302E302E3100050541020006020307302E302E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E4943434F4E53554D455200050541020006040307302E302E302E3100050541020006020307302E302E302E3800 + + 1 + + 400 + + + + 8118 + 39,64,8184 + 37,50,13164 + + 1 + + 1 + + + -1431699456 + -1431699456 + 1610612735 + + 41C801050041050200D9AF0D45D9E900010400028788BCED0400038788BCED04000400050041050200BB0AB3FDD1A40001040002B7DCBCED040003B7DCBCED040004000500410502005C3766C2DA6B00010400029FB2BCED0400039FB2BCED04000400050041050200D9F8DC20CA33000104000296DAAAED04000396DAAAED0400040005004105020063847B3765900001040002D794BDED040003D794BDED040004000500410502004E80142FD3C70001040002CF86BDED040003CF86BDED04000400050041050200C3B213EA24A50001040002BF89BBED040003BF89BBED040004000500410502006FFEF1BA804C0001040002CF86BDED040003CF86BDED0400040005004105020052ED923CB3A700010400028788BCED0400038788BCED040004000500410502005243330D305B000104000283FFB2ED04000383FFB2ED040004000500410502006FF9438E9E5D0001040002CF86BDED040003CF86BDED04000400050041050200585515F19D77000104000283FFB2ED04000383FFB2ED04000400050041050200729EE3A8DD460001040002CF86BDED040003CF86BDED040004000500410502004572795D3BB300010400029FB2BCED0400039FB2BCED040004000500410502009F94D72CABA40001040002CF86BDED040003CF86BDED0400040005004105020095052D9C81090001040002B7DCBCED040003B7DCBCED040004000500410502005859A15FD7FC0001040002DC8FB5ED040003DC8FB5ED0400040005004105020059D7AB3EBBFB0001020002F8FABCED040003CF86BDED04000400050041050200BB2481B9390E0001040002CF86BDED040003CF86BDED0400040005004105020059D7F395A7BA0001040002B7DCBCED040003B7DCBCED040004000500410502006DC4BEF5D52E0001040002B0DFBAED040003B0DFBAED040004000500410502004B6E709CF4290001040002B7DCBCED040003B7DCBCED040004000500410502007A7D5CEC2B8D0001040002CF86BDED040003CF86BDED040004000500410502006FFFA8AFB19D0001040002B7DCBCED040003B7DCBCED040004000500410502003E4475A07A6F0001040002B7DCBCED040003B7DCBCED040004000500410502003EDD8384A4F90001040002BF89BBED040003BF89BBED04000400050041050200560FBFA4E4900001040002B7DCBCED040003B7DCBCED04000400050041050200C24FAEEE43F10001040002B3CEB5ED040003B3CEB5ED040004000500410502004F378778C6F30001040002CF86BDED040003CF86BDED04000400050041050200C94418BB0EDF0001040002B7DCBCED040003B7DCBCED040004000500410502003B75A58BECB30001040002CF86BDED040003CF86BDED04000400050041050200772A7A0908890001040002CF86BDED040003CF86BDED0400040005004105020048BB63586DE100010400029088BCED0400039088BCED040004000500410502005544F881BEDA000104000283FFB2ED04000383FFB2ED040004000500410502005B4C1468EDF80001040002B7DCBCED040003B7DCBCED04000400050041050200538BAF3F934F0001040002B3CEB5ED040003B3CEB5ED0400040005004105020055D6F93A4FD70001040002D7B3BBED040003D7B3BBED04000400050041050200D5D64561E55F00010400028788BCED0400038788BCED0400040005004105020046ADF229B8570001040002CF86BDED040003CF86BDED04000400050041050200D5151C19FFD600010200029FB2BCED040003B7DCBCED04000400050041050200973CA35DB82400010400029FB2BCED0400039FB2BCED04000400050041050200C249E5B953700001040002CF86BDED040003CF86BDED04000400050041050200722C69D8C4F500010400029FB2BCED0400039FB2BCED0400040005004105020058CBB311F2400001040002DC8FB5ED040003DC8FB5ED040004000500410502004BB7A090766E0001040002CF86BDED040003CF86BDED040004000500410502007DEF80FBEBD90001040002EFDDBBED040003EFDDBBED0400040005004105020076A03698F87A0001040002CF86BDED040003CF86BDED0400040005004105020050E5DFDD0C700001040002CF86BDED040003CF86BDED040004000500410502004D4C85E0CEC80001040002CF86BDED040003CF86BDED040004000500410502006FEA6BCD92A10001020002F8FABCED040003CF86BDED0400040005004105020043BAA930F28600010400029FB2BCED0400039FB2BCED04000400050041050200722DB82DDB780001040002CF86BDED040003CF86BDED0400040005004105020052E995118B9F0001040002CF86BDED040003CF86BDED040004000500410502005403013B36D20001040002EFDDBBED040003EFDDBBED04000400050041050200B27C0C920B260001040002B7DCBCED040003B7DCBCED04000400050041050200D9AF0997A7450001040002BCD9AAED040003BCD9AAED04000400050041050200BC00130BB5F60001040002CF86BDED040003CF86BDED04000400050041050200591FF23B53830001040002CF86BDED040003CF86BDED04000400050041050200557EB01367590001040002CF86BDED040003CF86BDED04000400050041050200505F157093A2000102000297A4BCED04000397A4BCED040004000500410502003A036C495C670001040002CF86BDED040003CF86BDED0400040005004105020050D8CF0B7D480001040002B7DCBCED040003B7DCBCED040004000500410502004E34E4D0FF250001040002B7DCBCED040003B7DCBCED040004000500410502007A1E50A46E770001040002CF86BDED040003CF86BDED040004000500410502005F18C666CBB80001040002EFDDBBED040003EFDDBBED04000400050041050200C19335603A9E0001040002DC8FB5ED040003DC8FB5ED0400040005004105020097142BD7DF890001040002AFDFBAED040003AFDFBAED0400040005004105020052F3355FFED400010400029FB2BCED0400039FB2BCED04000400050041050200BCBA857EECDF0001040002D7B3BBED040003D7B3BBED04000400050041050200729259D605EF0001040002CF86BDED040003CF86BDED04000400050041050200BEC2F57655B300010400029FB2BCED0400039FB2BCED040004000500410502005BD905C8304B0001020002A8EEBBED0400038788BCED0400040005004105020055F2C0360F360001040002EFDDBBED040003EFDDBBED0400040005004105020082C01DB9605D00010400028788BCED0400038788BCED04000400050041050200BC73B8FB30360001040002CF86BDED040003CF86BDED0400040005004105020050390E32DF8B0001040002B0DFBAED040003B0DFBAED040004000500410502005BCE8A2D7B8000010400028788BCED0400038788BCED0400040005004105020042292BB45D2D0001040002CF86BDED040003CF86BDED040004000500410502004F1A354DCA9A00010400029FB2BCED0400039FB2BCED04000400050041050200591C1D7F0EC900010400028788BCED0400038788BCED04000400050041050200722E9D2CCB030001040002CF86BDED040003CF86BDED04000400050041050200443AB71D3F8A0001040002CF86BDED040003CF86BDED0400040005004105020018DEF34EB70600010400028788BCED0400038788BCED0400040005004105020097215860080F00010400029FB2BCED0400039FB2BCED040004000500410502007229C156A49E0001040002B7DCBCED040003B7DCBCED040004000500410502003A72EDECB0250001040002B3F7B4ED040003B3F7B4ED04000400050041050200D52F8CD18F640001040002E285B0ED040003E285B0ED040004000500410502006B0325208B4C0001040002EFDDBBED040003EFDDBBED040004000500410502005164424285660001040002938AB5ED040003938AB5ED04000400050041050200D4E9D6AB12F80001040002AFDFBAED040003AFDFBAED0400040005004105020059B3090F459C0001040002FCDDAAED040003FCDDAAED04000400050041050200BC10C41E7AAB0001040002CF86BDED040003CF86BDED040004000500410502009F9532B560C100010400028788BCED0400038788BCED0400040005004105020050EA7B4A63750001040002CF86BDED040003CF86BDED0400040005004105020045A658245E790001040002CF86BDED040003CF86BDED0400040005004105020047E3059299620001040002CF86BDED040003CF86BDED0400040005004105020081164AFC3B450001040002CF86BDED040003CF86BDED040004000500410502005703C3FC60FF00010400028788BCED0400038788BCED0400040005004105020063FAEB02F39300010400028788BCED0400038788BCED040004000500410502005714F2D9F6650001020002AFDFBAED040003ECE7BAED04000400050041050200505F1B22B00D0001040002CF86BDED040003CF86BDED0400040005004105020062C2F2A80C7900010400029FB2BCED0400039FB2BCED04000400050041050200425CA6CCD1FF0001040002CF86BDED040003CF86BDED0400040005004105020084C778D4AB110001040002CF86BDED040003CF86BDED040004000500410502005106437CD3B60001040002CF86BDED040003CF86BDED0400040005004105020058506B2B47D40001040002D7B3BBED040003D7B3BBED04000400050041050200DD70204563390001040002B7DCBCED040003B7DCBCED040004000500410502005CFFA5BE4A0000010200028888BCED040003F8FABCED0400040005004105020089BD8692E0400001040002B7DCBCED040003B7DCBCED040004000500410502004AC12BB2AB8D0001040002B7DCBCED040003B7DCBCED04000400050041050200DB555CBAEE6B0001040002CF86BDED040003CF86BDED0400040005004105020095052D8F81090001020002A7FDBCED040003CF86BDED04000400050041050200473AA0E1C9110001020002A7FDBCED040003CF86BDED040004000500410502004EFA971D2E4C0001040002B7DCBCED040003B7DCBCED04000400050041050200BCE6C5A829D900010400029E90B5ED0400039E90B5ED0400040005004105020051699F18DC540001040002D7B3BBED040003D7B3BBED040004000500410502005CFB85D7E6460001040002B3CEB5ED040003B3CEB5ED0400040005004105020052D17CE5A9840001040002BF89BBED040003BF89BBED0400040005004105020054DD54C818F20001040002CF86BDED040003CF86BDED040004000500410502005C3555EBDC670001040002B7DCBCED040003B7DCBCED0400040005004105020051D92EE554370001040002BF89BBED040003BF89BBED0400040005004105020095549556182D0001040002CF86BDED040003CF86BDED040004000500410502005419C1F7F52A0001040002B3CEB5ED040003B3CEB5ED040004000500410502008C7259638E1D0001040002B7DCBCED040003B7DCBCED04000400050041050200516745231C2200010400029FB2BCED0400039FB2BCED0400040005004105020055FB3DEAE2380001040002B7DCBCED040003B7DCBCED040004000500410502005D5470BCB83A00010400028788BCED0400038788BCED0400040005004105020054C6D511E6810001040002CF86BDED040003CF86BDED0400040005004105020062A7FAC0119000010200028788BCED0400038888BCED040004000500410502007225A1DCFB1A00010200028788BCED0400038888BCED04000400050041050200708B358CF15C00010400028788BCED0400038788BCED04000400050041050200D9A293C3FE550001040002AFDFBAED040003AFDFBAED04000400050041050200722119BAFCB600010400029FB2BCED0400039FB2BCED0400040005004105020054369C95EAC60001040002CF86BDED040003CF86BDED04000400050041050200AE74419813810001040002B7DCBCED040003B7DCBCED0400040005004105020048C613BC68510001040002EFDDBBED040003EFDDBBED04000400050041050200516E168D638B0001040002EFDDBBED040003EFDDBBED040004000500410502001819CFB484D20001040002CF86BDED040003CF86BDED04000400050041050200ADE013B3E9F10001040002CF86BDED040003CF86BDED040004000500410502005C708ABFAC890001040002B3CEB5ED040003B3CEB5ED04000400050041050200BC81882E891C0001040002B7DCBCED040003B7DCBCED0400040005004105020057785543EB480001040002CF86BDED040003CF86BDED040004000500410502006FF0CE6CB4500001040002CF86BDED040003CF86BDED040004000500410502005CE13B7199D4000102000283ADE7E304000383ADE7E30400040005004105020063F610137D170001040002B7DCBCED040003B7DCBCED04000400050041050200DC887BC89E210001040002CF86BDED040003CF86BDED040004000500410502005D9324151E7F0001020002A7FDBCED040003CF86BDED04000400050041050200BC02D363924D00010400029FB2BCED0400039FB2BCED040004000500410502004F28848E1AC50001040002CF86BDED040003CF86BDED0400040005004105020054C606DD0D260001040002D984B5ED040003D984B5ED04000400050041050200D5F586558C850001040002BF89BBED040003BF89BBED0400040005004105020082582B0468CF00010400028788BCED0400038788BCED040004000500410502005CE21BB9BD7C00010400029FB2BCED0400039FB2BCED0400040005004105020059A9ACE3BC02000104000296DAAAED04000396DAAAED040004000500410502005557DB28EDA300010400028788BCED0400038788BCED0400040005004105020076ABA00FF52C0001040002CF86BDED040003CF86BDED0400040005004105020052185C5CB8440001040002B7DCBCED040003B7DCBCED04000400050041050200441402A770A800010200028788BCED0400038888BCED04000400050041050200516623CC99760001040002CF86BDED040003CF86BDED040004000500410502005A3D6D867C2A0001040002BF89BBED040003BF89BBED04000400050041050200BC70864FCE530001040002B3F7B4ED040003B3F7B4ED040004000500410502005E9C9B4E7A740001040002CF86BDED040003CF86BDED0400040005004105020058ABF63F0EA70001040002FCDDAAED040003FCDDAAED040004000500410502005556BDBE86AC000104000286FFB2ED04000386FFB2ED0400040005004105020059D0D49C9B8000010400028788BCED0400038788BCED0400040005004105020059A934952E920001040002B3F7B4ED040003B3F7B4ED040004000500410502007220ABEC82C80001040002B7DCBCED040003B7DCBCED04000400050041050200807AB45544310001040002BF89BBED040003BF89BBED04000400050041050200187A8DFCCDCF0001040002BF89BBED040003BF89BBED04000400050041050200616B5C35801000010400028788BCED0400038788BCED040004000500410502005ABCE5EAE3790001040002938AB5ED040003938AB5ED0400040005004105020048DF5F3311D10001020002F8FABCED040003CF86BDED04000400050041050200D3146B24D6340001040002CF86BDED040003CF86BDED0400040005004105020059037023AC7D00010400029FB2BCED0400039FB2BCED040004000500410502003EDD92C929340001040002BF89BBED040003BF89BBED040004000500410502004C4EB0C1270D0001040002CF86BDED040003CF86BDED04000400050041050200BCA300CD17370001040002CF86BDED040003CF86BDED040004000500410502005BC42D9E789A0001040002D7B3BBED040003D7B3BBED04000400050041050200589755D3E75F0001020002D884B5ED040003B3CEB5ED040004000500410502007A7CC86B21530001040002CF86BDED040003CF86BDED040004000500410502005352A2DA24D300010400028788BCED0400038788BCED0400040005004105020058C9F9B6A86F0001040002B7DCBCED040003B7DCBCED040004000500410502005706A79DEAE60001020002AFDFBAED040003ECE7BAED0400040005004105020082D1B28F7A3A0001040002CF86BDED040003CF86BDED0400040005004105020052217343E79C0001040002CF86BDED040003CF86BDED0400040005004105020082CEA3A289FE000104000296DAAAED04000396DAAAED04000400050041050200D9E0FF79D1180001040002B7DCBCED040003B7DCBCED0400040005004105020052FD31513EE90001040002938AB5ED040003938AB5ED0400040005004105020052128CCDBA7C00010400029FB2BCED0400039FB2BCED040004000500410502006FB83DA167580001040002CF86BDED040003CF86BDED040004000500410502002E14B9387F540001020002B7DCBCED040003CF86BDED040004000500410502004F7E6F098A990001040002CF86BDED040003CF86BDED040004000500410502005D98B7099E1F0001040002B7DCBCED040003B7DCBCED04000400050041050200722A7476317600010400029FB2BCED0400039FB2BCED04000400050041050200BC18CE5EBDA10001020002AFDFBAED040003ECE7BAED040004000500410502005CF890CF3E270001040002B7DCBCED040003B7DCBCED040004000500410502008D72AE6DBEE30001040002CF86BDED040003CF86BDED0400040005004105020076A6D8E9EAAB0001040002CF86BDED040003CF86BDED04000400050041050200721B63925A140001040002CF86BDED040003CF86BDED040004000500410502007608B348A53A0001040002CF86BDED040003CF86BDED04000400 + + 0 + + -645574544 + 0 + 47500 + + 1 + + + 217.133.80.112:1076 217.133.80.112:47500 217.133.80.112:1083 217.133.80.112:1083 217.133.80.112:49734 + 7 + + <_1303289856>6C81442204F3D9855070B98CAE5879A505F3D9855070B98C4D4320134B66D9855070B98C5F4E60ED0D34D98550700434 + <_1303293952>4287274ED659D9855070B98C4287274ED74BD9855070B98C4287274EC15CD9855070B98C4287274ECE92D9855070B98C4287274EA75BD9855070B98C4287274E4B98D9855070B98C4287274EAA2DD9855070B98C4287274EA175D9855070B98C4287274ED735D9855070B98C4287274EAE25D9855070B98C4287274E1A2BD9855070B98C3D7D44372576D9855070B98CCF86DF304366D9855070B98C3D2E02A2259CD9855070B98C4287274EB98CD9855070B98C + <_1303298048>2E3363049108D9855070B98C2E3795FA3202D9855070B98C2E2F6F42E86DD9855070B98CB4B0620AA528D9855070B98C + <_1303306240>5F1894D8122BD9855070B98C2E40484969A3D9855070B98CD592A70A5566D9855070B98C2E26119F8DBED9855070B98C2E3754264E48D9855070B98C + <_1303314432>4D2BFFCAEC6CD9855070043B54BAD08D05E0D9855070B98C9D9D4DA11995D9855070B98C59584CCBB5CED9855070B98C972AC71733DDD9855070B98C + <_1303322624>5F3B0DCEB535D9855070043BD5150C1746D3D9855070B98C4D4B8646EF29D9855070B98CD5152F4D12BBD9855070B98C + <_1303326720>59D0D11D89DCD9855070C2462E755D8E1E97D9855070B98C2E492F875789D9855070B98C2E378784E9C6D9855070B98C2E2F6F6B48FCD9855070B98C + + + <_1303289856>9A4A56D31C619325C6601C71B23E13FDFAF5CA49F15C34A4E33F239B524D6BBC226021F010D2270A3B48DFA2E8CDB6FD37531B1118DB2D471CB980D0 + <_1303293952>D5A2186D0B45088ADDFA7B626C0904CED47E3DF13172672AED483E1EAD69DB781ABEC0D8812B1B5EFF91BC28C67FB5A3404D875A + <_1303298048>DB0EC5161D10171C7C6A4C7109DD + <_1303302144>5379BD98 + <_1303306240>88B19442A48D863ED54D712EEC36D53127BCE36653FE + <_1303310336>1908404B0F7BA3BE952CB1C533456D3CDA410BCB774AF93880FB8BD8C110 + <_1303314432>4B015AD444DD027FD3F61B2A51A53BA0 + <_1303322624>878BAF81A9F053B39E35081485E24B4EDA5F79D37E176C409B6E237A336451F42CFA7CEC013C98A18B51 + <_1303326720>CFB137906F6CCE77246BD5B6B434875570B1F9B9140C85D5114EE6953110B04F3557C0D1686D46A9F69106521979AE49E19F8622F93A + <_1303330816>BA4B81F735FDCDA4E4EF57ACF8A37051C66401E41CA4E562A5A49ACC2E246CCE + + + + 1 + + + 1 + + + 0 + + + 1 + + + + 9BF92EA4B417A7F6 + + + 4102030E322F322E302E302E37322F31373400000FF6EB9ADC04 + + + 0 + + + + 2 + en + + 357 + 258 + 0 + 0 + + 0 + + diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/config.lck b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/config.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/config.xml b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/config.xml new file mode 100644 index 0000000000..f7af8873ad --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/config.xml @@ -0,0 +1,74 @@ + + + + + 300 + 1800 + 63 + + + 41010300676D6172757A7A3400 + 1268962216 + + + 0 + 0 + 1303202372 + 0 + +

+ 35716ecf:2 + 98e6c103:0 +

+ +
+
+ + 1 + 3 + 65535 + 1266110339 + + + 1 + + + 1 + + + 1000000166 + 1303166852 + 1303209779 + + + 1267114269 + + 2 + + 4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608 + + + 1267114267 + 11 + 4263C0064DD5ACF9A03594DAB928D2B81510 + + + + <_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779 + +
+ + + skypopen + + + 0 + 2 + 2 + 2 + +
diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/httpfe/cookies.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/httpfe/cookies.dat new file mode 100644 index 0000000000..fc7f2b1150 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/httpfe/cookies.dat @@ -0,0 +1 @@ +B \ No newline at end of file diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/index2.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/index2.dat new file mode 100644 index 0000000000000000000000000000000000000000..b8b96d84318e540df1ace348fe21db2b6bc5db1c GIT binary patch literal 208 zcmXwuNdbT`5X8FNmjYy9pe~S#BNQM2CZ)5VNwV*L#B-llsu$ko2Zk2aTXAXCJ2}n& hUQDwOVw!yv)9jO&W}n40`y!^<5k^1s4DS literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/main.lock b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameA/main.lock new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/config.lck b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/config.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/config.xml b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/config.xml new file mode 100644 index 0000000000..f7af8873ad --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/config.xml @@ -0,0 +1,74 @@ + + + + + 300 + 1800 + 63 + + + 41010300676D6172757A7A3400 + 1268962216 + + + 0 + 0 + 1303202372 + 0 + +

+ 35716ecf:2 + 98e6c103:0 +

+ +
+
+ + 1 + 3 + 65535 + 1266110339 + + + 1 + + + 1 + + + 1000000166 + 1303166852 + 1303209779 + + + 1267114269 + + 2 + + 4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608 + + + 1267114267 + 11 + 4263C0064DD5ACF9A03594DAB928D2B81510 + + + + <_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779 + +
+ + + skypopen + + + 0 + 2 + 2 + 2 + +
diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/httpfe/cookies.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/httpfe/cookies.dat new file mode 100644 index 0000000000..fc7f2b1150 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/httpfe/cookies.dat @@ -0,0 +1 @@ +B \ No newline at end of file diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/index2.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/index2.dat new file mode 100644 index 0000000000000000000000000000000000000000..b8b96d84318e540df1ace348fe21db2b6bc5db1c GIT binary patch literal 208 zcmXwuNdbT`5X8FNmjYy9pe~S#BNQM2CZ)5VNwV*L#B-llsu$ko2Zk2aTXAXCJ2}n& hUQDwOVw!yv)9jO&W}n40`y!^<5k^1s4DS literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/main.lock b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient00/skypenameB/main.lock new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/shared.lck b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/shared.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/shared.xml b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/shared.xml new file mode 100644 index 0000000000..4b72e67eb5 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/shared.xml @@ -0,0 +1,99 @@ + + + + + <_2>00001000A563932E7DE5A581942041A820F8437512A079C7ACB1B73281F191D109521E265BCD38C4133596B834AD9AA1D6BB5E1AC3D59E8675785321F722D39FBFAFB9A24E6482FA3030FFA3692D2C4A53BBCE9DC63F25D10207A20FA969982FEDC1DCC2A7C599071F4735E52AB2E06E34CA232C08B3AA2FB88A0C4A5763E0CD23C3AA37D1D2A7D6EED691EE99BA08BE294F68C24F9AE777DAF294F0AEB8346325A978DC6CF7C210AD11EF3F38111F6D98F388CF41CCBA40ABE9F0D6CBBD3118BA0588344953DF3C5E88B2CCAEDE2E692F320D20EBF16D7DB36156E617C0CC9FB2855D7FDB4C7F8638CC9830E7448D5EAE301A2810277062989841EE679E00E4E277615FEC038DE3A0A20DD7C6A2A00DFBC6A2A00DA6E2B6F404FDC6A2A00DFEC6A2A00DF7FBBB990CF2C6A2A00D8EB4FE8A0C8FB4FE8A0C95C7A6E00CF5FBBB990CD6C7A6E00CD0F896950CCCE2B6F40485CCA2A00DA1D8EEA50DFDFBBB990CA7C7A6E00CA8C7A6E00CA9C7A6E00C97C7A6E00C90B4FE8A0CFE90D59308C290D59308D1E2B6F404C5E2B6F404C6AAF18705C7AAF18705C8AAF18705BBD8EEA50DBCD8EEA50DBDD8EEA50D93CCA2A00D94CCA2A00DEFE2B6F40491B4FE8A0CE2FBBB990CE3FBBB990CBED8EEA50DA0CCA2A00DA1CCA2A00DA6B4FE8A0CA7B4FE8A0CCED8EEA50DA3CCA2A00DA4CCA2A00D84E698AD0DB8C7A6E00CD9E2B6F404E0E2B6F40486E698AD0DFDF896950C0013A60400173D0018DE0200190300AB01F40300449875044518C15F9A278109D4BBAC4E8109D408A6238109D5A63304810904460CC15F9A26303ED408A624303E0047B054004801004980A305004A80E90F004BE0A801004C80A305004D01005CAC02045E5A50FC55465BA050FC55475BA050FC55485BA0C32EFDEE5BA0C32EFDEF5BA0C2A5BC4A5BA0C2A5BC4B5BA0D4BBAC055BA0D4BBAC145BA0D4BBAC215BA0D408A3575BA0D408A37D5BA0D408A37E5BA08275487E5BA0827548425BA00060B817046506CC09A3D6303E04AE018C0125F8D500021A25F9D500011A162102200301220125FFD50025FAD5000C03E4000D2580D6000F060125F8D5000302172105050103080D06010501011C210302060125FCD50025F9D5000A25FDD50025FED5000A0D06020502050119211305020380808080100C05010D0380808080100B25FDD5000C01080005000380808080100D060307010503220101220104AC01BF012597CE002597CE002590CE0019152590CE002597CE000B033C1815210220030122012593CE0014212E2594CE002103030B220125A5CE00030F172103030B22012596CE00142103030B22012597CE00142103030B22012599CE00142103030A220125A5CE00030A1A2590CE002592CE000B031E1B15142103030A220125A4CE000380201D14210303092201259BCE0014210A2594CE002103030B2201259DCE00142103030822012593CE002103012201259ECE001421030306220103022201006800006901006A01006C987504740CC2A5BC4C303ED408A34C303E007828047912CC09A3D3303E82754864303E4E8DB16F303E047DBF010203020800050003020D0B0601030308000500020501030508000500021A03060800050003041A16030508000500021D160C0A0C060203D00F251205020A03020D0A050103D00F0C0A0603010800050003FFFFFFFF0F18030208000500021D141506042512020800050003030D05040C10030205040B0C06050306050505020A0C060603040800050003050800050003E400180C0607050703E400250A0B250A011C0C0A0314100608050303C03E0F03B8171005060388270F03DC0B100508047E5E0380010304080005000B03040D250403E4000F03140D0A2503250203030D0A0B0110060101080005000380020D0302080005000380020D172103010601250A03E4001B210D0501030A03E400250A210303DF002002250A0B0D0F0601050100800180EA49008101E003036F3139352E34362E3235332E3235333A313233353000038201706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B7970653B706F6F6C333D6578747261732E646F776E6C6F6164732E736B7970653B706F6F6C343D2A2E736B79706566696E642E736B7970653B706F6F6C353D2A2E7072656D69756D2E736B7970653B706F6F6C363D2A2E6D756C74696D656469612E736B7970653B706F6F6C373D2A2E6D756C74696D656469612E6D657461636166653B706F6F6C383D2A2E6D756C74696D656469612E6461696C796D6F74696F6E3B706F6F6C393D2A2E6D756C74696D656469612E6D6574616F6D6E69747572653B706F6F6C31303D77686174736E65772E736B7970653B706F6F6C31313D7061792E736B7970653B706F6F6C31323D7365637572652E7061792E736B7970653B706F6F6C31333D2A2E70696373746F72653B706F6F6C31343D2A2E6D796163636F756E742E736B7970653B706F6F6C31353D2A2E62696269743B706F6F6C31363D2A2E70726F6363796265723B706F6F6C31373D747261636B696E672E6F6D6E69747572653B706F6F6C31383D676F2E736B7970653B706F6F6C31393D747261636B2E736B7970657C706F6F6C313D3139342E3139322E3139392E3235313A31323335303B706F6F6C323D3139342E3139322E3139392E3235323A31323335303B706F6F6C333D3139342E3139322E3139392E3235323A31323335303B706F6F6C343D3139342E3136352E3138382E3130313A31323335303B706F6F6C353D3139332E39352E3135342E31353A31323335313B706F6F6C363D3139342E3136352E3138382E3130303A31323335303B706F6F6C373D3139342E3136352E3138382E3130303A31323335303B706F6F6C383D3139342E3136352E3138382E3130303A31323335303B706F6F6C393D3139342E3136352E3138382E3130303A31323335303B706F6F6C31303D3230342E392E3136332E3134313A31323335303B706F6F6C31313D3139352E34362E3235332E3234353A31323335303B706F6F6C31323D3139352E34362E3235332E3234353A31323335303B706F6F6C31333D3139332E39352E3135342E31343A31323335313B706F6F6C31343D3139332E39352E3135342E31343A31323335313B706F6F6C31353D3139332E39352E3135342E31343A31323335313B706F6F6C31363D3139332E39352E3135342E31343A31323335313B706F6F6C31373D3139342E3136352E3138382E3130303A31323335303B706F6F6C31383D3139342E3136352E3138382E3130303A31323335303B706F6F6C31393D3139332E39352E3135342E31343A31323335310003B101706F6F6C313D2A2E6C6976657461622E736B7970653B706F6F6C323D7765622E6578747261732E736B797065206578747261732E646F776E6C6F6164732E736B7970653B706F6F6C333D2A2E687773746F72652E736B7970653B706F6F6C343D2A2E736B79706566696E642E736B797065202A2E6469726563746F72792E736B7970653B706F6F6C353D2A2E70696373746F7265202A2E6D796163636F756E742E736B797065202A2E6269626974202A2E70726F63637962657220747261636B2E736B79706520617070732E736B7970656173736574733B706F6F6C363D2A2E6D756C74696D656469612E736B797065202A2E6D756C74696D656469612E6D65746163616665202A2E6D756C74696D656469612E6461696C796D6F74696F6E202A2E6D756C74696D656469612E6D6574616F6D6E6974757265207777772E736B7970652077686174736E65772E736B7970653B706F6F6C373D7061792E736B797065207365637572652E7061792E736B7970653B706F6F6C383D6170692E736B7970653B706F6F6C393D63616C6C70686F6E65732E736B7970652063616C6C72617465732E736B7970653B706F6F6C31303D2A2E7072656D69756D2E736B7970653B706F6F6C31323D6C6F67732E736B7970653B706F6F6C31333D617661746172736572766963652E736B79706520636F6E74616374696D706F72742E736B7970653B706F6F6C31343D676F2E736B7970653B706F6F6C31353D747261636B696E672E6F6D6E69747572657C706F6F6C313D3139342E3139322E3139392E3235312C31323335302C312C4E4C2C77652C35302C313B706F6F6C323D3139342E3139322E3139392E3235322C31323335302C312C444B2C77652C35302C313B706F6F6C333D3139332E39352E3135342E31372C31323335312C312C49452C77652C35302C31203231322E3138372E3137322E36322C31323335312C312C49452C77652C35302C31203139352E34362E3235332E3232372C31323335312C312C4C552C77652C35302C31203231322E382E3136362E33332C31323335312C312C4C552C77652C35302C313B706F6F6C343D3139342E3136352E3138382E3130312C31323335302C312C49452C77652C35302C313B706F6F6C353D3139332E39352E3135342E31342C31323335312C312C49452C77652C35302C31203139352E34362E3235332E3230352C31323335312C312C4C552C77652C35302C31203231322E3138372E3137322E35392C31323335312C312C49452C77652C35302C31203231322E382E3136362E31392C31323335312C312C4C552C77652C35302C313B706F6F6C363D3139342E3136352E3138382E3130302C31323335302C312C49452C77652C35302C31203230342E392E3136332E3134302C31323335302C312C43412C6E612C35302C313B706F6F6C373D3139352E34362E3235332E3234352C31323335302C312C4C552C77652C35302C31203139332E39352E3135342E31362C31323335312C312C49452C77652C35302C31203231322E3138372E3137322E36312C31323335312C312C49452C77652C35302C31203231322E382E3136362E32302C31323335302C312C4C552C77652C35302C313B706F6F6C383D3230342E392E3136332E3138342C31323335302C312C43412C6E612C35302C312037382E3134312E3137372E38392C31323335302C312C4C552C77652C35302C313B706F6F6C393D3139342E3136352E3138382E3131352C31323335302C312C49452C77652C35302C31203230342E392E3136332E3134312C31323335302C312C43412C6E612C35302C313B706F6F6C31303D3139332E39352E3135342E31352C31323335312C312C49452C77652C35302C31203231322E3138372E3137322E36302C31323335312C312C49452C77652C35302C31203139352E34362E3235332E3232362C31323335312C312C4C552C77652C35302C31203231322E382E3136362E33322C31323335312C312C4C552C77652C35302C313B706F6F6C31323D37382E3134312E3137372E37362C31323335302C312C4C552C77652C35302C313B706F6F6C31333D3230342E392E3136332E3136372C31323335302C312C43412C6E612C35302C312037382E3134312E3137372E38312C31323335302C312C4C552C77652C35302C313B706F6F6C31343D3230342E392E3136332E3136382C31323335302C312C43412C6E612C35302C31203139342E3136352E3138382E3130302C31323335302C312C49452C77652C35302C313B706F6F6C31353D3230342E392E3136332E3136392C31323335302C312C43412C6E612C35302C31203139342E3136352E3138382E3130302C31323335302C312C49452C77652C35302C3100039701736B79706566696E642E736B7970653D31372C362C382C2D33392C3139206469726563746F72792E736B7970653D31372C362C382C2D33392C31390003A60138302E3235322E38352E37302C32333435362C312C6E6C2C77652C35302C312038302E3235322E38352E37312C32333435362C312C6E6C2C77652C35302C312038302E3235322E38352E37322C32333435362C312C6E6C2C77652C35302C31203139352E34362E3235332E3233382C32333435362C322C6C752C77652C35302C31203139352E34362E3235332E3233392C32333435362C322C6C752C77652C35302C31203139342E3136352E3138382E37342C32333435362C332C69652C77652C35302C31203139342E3136352E3138382E37352C32333435362C332C69652C77652C35302C31203231322E3138372E3137322E352C32333435362C342C69652C77652C35302C31203231322E3138372E3137322E32302C32333435362C342C69652C77652C35302C31203231322E3138372E3137322E33332C32333435362C342C69652C77652C35302C31203231322E382E3136332E38372C32333435362C362C6C752C77652C35302C31203231322E382E3136332E3132352C32333435362C362C6C752C77652C35302C31203231322E382E3136332E3132362C32333435362C362C6C752C77652C35302C31203133302E3131372E37322E3132362C32333435362C372C6E6C2C77652C35302C31203133302E3131372E37322E36362C32333435362C372C6E6C2C77652C35302C310004B2010B03A09C0125B3EA010B220104A5012A24A39C012102220025A19C010401F3C2011A142103030A220125B0EA0103051A2103030B2201030522010384012B39393030303131313A37382E3134312E3137372E39363A3233343536000086010C008701880E039101000493010CC2A5BC5C2774C32EFDD927740496010CD592BC1034504E8DB5F2345006C20105F801F901FA01FB01FC010395016272617465303D31206272617465313D31206272617465323D31206272617465333D31206272617465343D31206272617465353D31206272617465363D31206272617465373D31206272617465383D31207372617465303D31207372617465313D31207372617465323D31207372617465333D31207372617465343D31207372617465353D31207372617465363D31207372617465373D31207372617465383D310003B4013139342E3136352E3138382E37373A3132333530203231322E382E3136332E3130333A31323335300000C0010100C1010103CB012E6163636573732E736B7970652E6E65740000E1010F00F0010100F101A982CA950303D50137382E3134312E3137372E33383A3132333530203230342E392E3136332E3135313A31323335300003CF0137382E3134312E3137372E36393A3132333530203230342E392E3136332E3134393A31323335300000D6010103E4013139342E3136352E3138382E38303A3132333530203231322E382E3136362E353A31323335300003E5010000F8016403F7015B574845453A204F4646203130302C20563120302C20563220305D205B496E70757445513A204F46462035302C2056312035305D205B4945513A204F46462031362C2056312031322C2056322031322C2056332031322C2056342031322C2056352031322C2056362031322C2056372031325D205B53453A204453203130302C2057494F20305D205B5345323A2044532039302C2057494F2031305D205B414D504D3A204F4C442035302C20444147432035305D205B4B54523A204F46462035302C204F4E2035305D205B49414D323A204F46462039392C204D3120312C204D3220305D0003FA0152434F4E3D350003F901302F342E322E2A2E2A2C33322C3320302F352E302E2A2E2A2C31342C3320302F352E312E2A2E3130342C342C330003A80168747470733A2F2F7777775C2E70617970616C5C2E2E3F2E3F2E3F247C68747470733A2F2F696D616765735C2E70617970616C5C2E636F6D247C68747470733A2F2F7777775C2E70617970616C6F626A656374735C2E636F6D247C68747470733F3A2F2F2E2B5C2E666263646E5C2E6E6574247C68747470733F3A2F2F2E2B5C2E66616365626F6F6B5C2E636F6D247C68747470733F3A2F2F6368616E6E656C5C2E736B7970655C2E636F6D247C68747470733A2F2F617070735C2E736B7970655C2E636F6D247C68747470733F3A2F2F7161617070735C2E736B7970655C2E6E6574247C68747470733F3A2F2F636F6E6E6563745C2E66616365626F6F6B5C2E6E6574247C68747470733A2F2F2E2A5C2E736B7970656173736574735C2E636F6D247C68747470733A2F2F61645C2E646F75626C65636C69636B5C2E6E6574247C68747470733A2F2F61642D656D65615C2E646F75626C65636C69636B5C2E6E6574247C68747470733A2F2F61642D617061635C2E646F75626C65636C69636B5C2E6E6574247C68747470733A2F2F737461746963323F5C2E736B7970655C2E636F6D247C68747470733A2F2F7161737461746963323F5C2E736B7970655C2E6E6574247C68747470733A2F2F7072657374617469635C2E736B7970655C2E6E6574240003FF013078313030303230343030393136333231372D642D723230342E392E3136332E3231373A38313932203078313030303230343030393136333231392D642D723230342E392E3136332E3231393A38313932203078313030303230343030393136333232312D642D723230342E392E3136332E3232313A38313932203078313030303230343030393136333232332D642D723230342E392E3136332E3232333A38313932203078313030303230343030393136333232352D642D723230342E392E3136332E3232353A38313932203078313030303230343030393136333232372D642D723230342E392E3136332E3232373A38313932203078313030303230383038383138363030352D642D723230382E38382E3138362E353A38313932203078313030303230383038383138363030372D642D723230382E38382E3138362E373A38313932203078313030303230383038383138363030392D642D723230382E38382E3138362E393A38313932203078313030303230383038383138363031312D642D723230382E38382E3138362E31313A38313932203078313030303230383038383138363031332D642D723230382E38382E3138362E31333A38313932203078313030303230383038383138363031352D642D723230382E38382E3138362E31353A38313932203078313030303230383038383138363031372D642D723230382E38382E3138362E31373A38313932203078313030303230383038383138363031392D642D723230382E38382E3138362E31393A38313932203078313030303230383038383138363032312D642D723230382E38382E3138362E32313A38313932203078313030303230383038383138363032332D642D723230382E38382E3138362E32333A38313932203078313030303230383038383138363032352D642D723230382E38382E3138362E32353A38313932203078313030303230383038383138363032372D642D723230382E38382E3138362E32373A38313932203078313030303230383038383138363032392D642D723230382E38382E3138362E32393A38313932203078313030303230383038383138363033312D642D723230382E38382E3138362E33313A38313932203078313030303230383038383138363033332D642D723230382E38382E3138362E33333A38313932203078313030303230383038383138363033352D642D723230382E38382E3138362E33353A38313932203078313030303230383038383138363033372D642D723230382E38382E3138362E33373A38313932203078313030303230383038383138363033392D642D723230382E38382E3138362E33393A38313932203078313030303230383038383138363034372D642D723230382E38382E3138362E34373A38313932203078313030303230383038383138363034392D642D723230382E38382E3138362E34393A38313932203078313030303230383038383138363035312D642D723230382E38382E3138362E35313A38313932203078313030303230383038383138363035332D642D723230382E38382E3138362E35333A38313932203078313030303230383038383138363035352D642D723230382E38382E3138362E35353A38313932203078313030303230383038383138363035372D642D723230382E38382E3138362E35373A38313932203078313030303230383038383138363035392D642D723230382E38382E3138362E35393A38313932203078313030303230383038383138363036312D642D723230382E38382E3138362E36313A38313932203078313030303230383038383138363036332D642D723230382E38382E3138362E36333A38313932203078313030303230383038383138363035392D642D723230382E38382E3138362E36353A38313932203078313030303230383038383138363036312D642D723230382E38382E3138362E36373A38313932203078313030303230383038383138363036332D642D723230382E38382E3138362E36393A38313932203078313030303230383038383138363037312D642D723230382E38382E3138362E37313A38313932203078313030303230383038383138363037332D642D723230382E38382E3138362E37333A38313932203078313030303230383038383138363037352D642D723230382E38382E3138362E37353A38313932203078313030303230383038383138363037372D642D723230382E38382E3138362E37373A38313932203078313030303230383038383138363037392D642D723230382E38382E3138362E37393A38313932203078313030303230383038383138363038312D642D723230382E38382E3138362E38313A38313932203078313030303230383038383138363038332D642D723230382E38382E3138362E38333A38313932203078313030303230383038383138363038352D642D723230382E38382E3138362E38353A38313932203078313030303230383038383138363038372D642D723230382E38382E3138362E38373A38313932203078313030303230383038383138363038392D642D723230382E38382E3138362E38393A38313932203078313030303230383038383138363039312D642D723230382E38382E3138362E39313A38313932203078313030303230383038383138363039332D642D723230382E38382E3138362E39333A38313932203078313030303230383038383138363039352D642D723230382E38382E3138362E39353A38313932203078313030303230383038383138363039372D642D723230382E38382E3138362E39373A38313932203078313030303230383038383138363039392D642D723230382E38382E3138362E39393A38313932203078313030303230383038383138363130312D642D723230382E38382E3138362E3130313A38313932203078313030303230383038383138363130332D642D723230382E38382E3138362E3130333A38313932203078313030303230383038383138363130352D642D723230382E38382E3138362E3130353A38313932203078313030303230383038383138363130372D642D723230382E38382E3138362E3130373A38313932203078313030303230383038383138363130392D642D723230382E38382E3138362E3130393A38313932203078313030303230383038383138363131312D642D723230382E38382E3138362E3131313A38313932203078313030303230383038383138363131332D642D723230382E38382E3138362E3131333A38313932203078313030303230383038383138363131352D642D723230382E38382E3138362E3131353A38313932203078313030303230383038383138363131372D642D723230382E38382E3138362E3131373A38313932203078323030303134393030353034353031312D642D723134392E352E34352E31313A38313932203078323030303134393030353034353031332D642D723134392E352E34352E31333A38313932203078323030303134393030353034353031352D642D723134392E352E34352E31353A38313932203078323030303134393030353034353031372D642D723134392E352E34352E31373A38313932203078323030303134393030353034353031392D642D723134392E352E34352E31393A38313932203078323030303134393030353034353032312D642D723134392E352E34352E32313A38313932203078323030303134393030353034353032332D642D723134392E352E34352E32333A38313932203078323030303134393030353034353032352D642D723134392E352E34352E32353A38313932203078323030303134393030353034353032372D642D723134392E352E34352E32373A38313932203078323030303134393030353034353032392D642D723134392E352E34352E32393A38313932203078323030303134393030353034353033312D642D723134392E352E34352E33313A38313932203078323030303134393030353034353033332D642D723134392E352E34352E33333A38313932203078323030303134393030353034353033352D642D723134392E352E34352E33353A38313932203078323030303134393030353034353033372D642D723134392E352E34352E33373A38313932203078323030303134393030353034353033392D642D723134392E352E34352E33393A38313932203078323030303134393030353034353034312D642D723134392E352E34352E34313A38313932203078323030303134393030353034353034332D642D723134392E352E34352E34333A38313932203078323030303134393030353034353034352D642D723134392E352E34352E34353A38313932203078323030303134393030353034353034372D642D723134392E352E34352E34373A38313932203078323030303134393030353034353034392D642D723134392E352E34352E34393A38313932203078323030303134393030353034353035312D642D723134392E352E34352E35313A38313932203078323030303134393030353034353035332D642D723134392E352E34352E35333A38313932203078323030303134393030353034353035352D642D723134392E352E34352E35353A38313932203078323030303134393030353034353035372D642D723134392E352E34352E35373A38313932203078323030303134393030353034353035392D642D723134392E352E34352E35393A38313932203078323030303134393030353034353036312D642D723134392E352E34352E36313A38313932203078323030303134393030353034353036332D642D723134392E352E34352E36333A38313932203078323030303134393030353034353036352D642D723134392E352E34352E36353A38313932203078323030303134393030353034353036372D642D723134392E352E34352E36373A38313932203078323030303134393030353034353036392D642D723134392E352E34352E36393A38313932203078323030303134393030353034353037312D642D723134392E352E34352E37313A38313932203078323030303134393030353034353037332D642D723134392E352E34352E37333A38313932203078323030303134393030353034353037352D642D723134392E352E34352E37353A38313932203078323030303134393030353034353037372D642D723134392E352E34352E37373A38313932203078323030303134393030353034353037392D642D723134392E352E34352E37393A38313932203078323030303134393030353034353038312D642D723134392E352E34352E38313A38313932203078323030303134393030353034353038332D642D723134392E352E34352E38333A38313932203078323030303134393030353034353038352D642D723134392E352E34352E38353A38313932203078323030303134393030353034353038372D642D723134392E352E34352E38373A38313932203078323030303134393030353034353038392D642D723134392E352E34352E38393A38313932203078323030303134393030353034353039312D642D723134392E352E34352E39313A38313932203078323030303134393030353034353039332D642D723134392E352E34352E39333A38313932203078323030303134393030353034353039352D642D723134392E352E34352E39353A38313932203078323030303134393030353034353039372D642D723134392E352E34352E39373A38313932203078323030303134393030353034353039392D642D723134392E352E34352E39393A38313932203078323030303134393030353034353130312D642D723134392E352E34352E3130313A38313932203078323030303134393030353034353130332D642D723134392E352E34352E3130333A38313932203078323030303134393030353034353130352D642D723134392E352E34352E3130353A38313932203078323030303134393030353034353130372D642D723134392E352E34352E3130373A38313932203078323030303134393030353034353130392D642D723134392E352E34352E3130393A38313932203078323030303134393030353034353131312D642D723134392E352E34352E3131313A38313932203078323030303134393030353034353131332D642D723134392E352E34352E3131333A38313932203078323030303134393030353034353131352D642D723134392E352E34352E3131353A38313932203078323030303134393030353034353131372D642D723134392E352E34352E3131373A38313932203078323030303134393030353034353131392D642D723134392E352E34352E3131393A38313932203078323030303134393030353034353132312D642D723134392E352E34352E3132313A38313932203078323030303134393030353034353132332D642D723134392E352E34352E3132333A38313932203078323030303134393030353034353132352D642D723134392E352E34352E3132353A38313932203078323030303134393030353034353132372D642D723134392E352E34352E3132373A38313932203078323030303134393030353034353132392D642D723134392E352E34352E3132393A38313932000089020A062E19AEBFD5A40B80D4B6B30280D2AFF205808CFD910B80DEB9F1048FA486F4049CA486F404D5A486F404ACC686F404C2C686F404878F87F404CEB887F404ADC487F404BCC687F404D4D087F404F9EA87F4049CF587F404C8F487F404C9F487F404CAF487F404EACCBB9C05F7CCBB9C05E694D7BB058E96D7BB05A896D7BB050094023C0095021400930201039902536B79706520546563686E6F6C6F6769657320534100008E0200008F0280BAB70300910280A30503F2013231332E3134362E3138392E3230313A3132333530203231332E3134362E3138392E3230323A3132333530203231332E3134362E3138392E3230333A3132333530203231332E3134362E3138392E3230343A3132333530203231332E3134362E3138392E3230353A3132333530203231332E3134362E3138392E3230363A3132333530203231322E3136312E382E31303A3132333530203231322E3136312E382E323A3132333530203231322E3136312E382E333A3132333530203231322E3136312E382E343A3132333530203231322E3136312E382E353A3132333530203231322E3136312E382E363A31323335300000FC010106FD0106011E64AC02A403E807009002C20103C301687474703A2F2F37392E3132352E36332E3732247C68747470733F3A2F2F2E2B5C2E66616365626F6F6B5C2E636F6D240000DE0148 + <_256>000010011AC0AA3BA66DF7FB48228AE35F9BB4A032FE4A6A898DA7A1A5AE37DC59FB3D09607F1CACD46A5DBC008DABF8F09C797DF5A8903307D04C318825CEA7C481303C655A9EEE099E9A0AF1158373B458BB8FDACB336A6EC63C043E6782688E2350B417DDDDFF96B474DAEA7D1DF3742303B79111FC752BFB5D6887A5B822F945CC761FAF6E80DE5EC60868768CB8A9F9C876137806DCEA0DD1300181558ABFDBA26592078F5F84195C526D8C7F339EF82700FD93F8FB71ADA5ED3E977D27FA52D1F489EF5DA0A9E00B146BADCBDEBFB0DFEBCD61E5B8352A49893357E0DC3A736743929DA975782EA4D8184605FD064641986C47706D264281C876F926BF58003E9E + <_3>0000100498ECF8A7A4585F76C930739A1EAE590DE96D9EF3AA9B231E67965F3F08ECFC493E1DA23ECDE17A85C94CBE034E88F9414E9BBC82F32AAFCFFB2C09F6F57A478238BAEC9EEF2BB9C67F71257722E6786D88D6400F6B7D81450FB3B6CCCC3986E3782D2387E354EBA9099331AEF510D479C6601D2383D866E2B5B525DF0BA975D58C120EFAE88C89EE365FC696CC891B77F67CFA18FDE8E95DDAC25A7C7D70FA7A1414BAE593856A658888C622836006C1C131B4B2E805554DCFA52F3EFD34C1B759BF8A302E491835DCE701E84D37ED150C8ADD699AD3DCA9F515123C5B5AD94E253E173BA3465E64A0079D5EF4E6075E66D0F5FBC3D9BC25C4E80C4CB2FE9B87040003000004D00F0005D00F050041040400B80125C20003141B14230025D50003031B14230024E100142300250003191714230025EA0003141714230025EA00011724EA00140A14230025E400030F1C14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E10025E10003A006100A0309031725000325180C0A25C20003140B0C03040D0A03882725C3000C0A03E43225C4000C0A0602050228038407DC08FA1E0601050102050203FA1E1C0603250028061D1E1F202122060105010205010503050141060300636F756E74206279207175616C697479000001CC080002040003000004010005010501410603006261647175616C69747920636F756E742062792076657273696F6E000001D6080002070003000004010005010501410603006261647175616C6974792073756D2062792076657273696F6E000001E0080002070003000004010005010500410304005424E400142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025E40025E40028043CB401D804901C060105010205014106030073756D206F66206C61737463616C6C206475726174696F6E73000001B009000201000300000480A3050005B054050141060300636F756E74206279206C61737463616C6C206475726174696F6E000001BA090002050003000004010005010500410204005025EB00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EB0028031E32D0000601050102050141060300636F756E742062792073797374656D20637075207573616765000001940A0002040003000004010005010500410204004F25EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050141060300636F756E742062792070726F63657373206370752075736167650000019E0A0002040003000004010005010500410304006824C20014230024E60014230025E600011A14230025EC00011C142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A14230025EC0028030F1E320601050102050125C2000501410603006A6974746572636F756E742062792070726F6365737320637075207573616765000001F80A0002040003000004010005010501410603006A69747465722062792070726F6365737320637075207573616765000001820B0002040003000004D00F0005D00F0500410304004424E700142300250003191714230025EA0003141714230025EA00011724EA00140A14230025FC00011A24FF000A14230025FF00011A142300258001011A1423000225E700050141060300706F74656E7469616C207463702066616C6C6261636B73000001DC0B00020100030000040100050105014106030061637475616C207463702066616C6C6261636B73000001E60B00020100030000040100050105004103040056240C142300250C030A1814230025EA0003141714230025EA00011724EA00140A14230024E70014230025E700011A14230024E50014230025E500011C0602250C29050306070809280401020405060105010205010502050141060300636F756E74206279206E617474797065000001C00C0002050003000004010005010501410603007564706661696C75726573206279206E617474797065000001CA0C0002050003000004010005010500410204001B25D90014230025D90025DA000B0602050228030102040601050102050141060300636F756E74206279206E726F666D756C74696368617473000001A40D0002040003000004010005010500410304001425F700011C14230025000319171423000225F90005014106030075736572732077686F206861766520636F6D706C65746564204943000001880E0002010003000004010005010501410603006C617374204943207969656C6420676C6F62616C73756D000001920E0002010003000004E8070005500500410304001224F60014230025000319171423000225F60005014106030075736572732077686F206861766520494320737570706F7274000001EC0E0002010003000004010005010501410603004943207374617274757020636F756E7420676C6F62616C73756D000001F60E00020100030000046400051405004102040025240C142300250C030A18142300250C011C142300250C280802030405060708090601050102050141060300636F756E74206279206E617474797065000001D00F0002090003000004010005010500410404001A250003191714230025E20025E30025FC00280201020601050102050141060300766964656F2073656E642063617061626C650000019811000201000300000401000501050141060300766964656F20706172616C6C656C2063616C6C730000019911000201000300000414000502050141060300636F756E7420627920766964656F2063616C6C73206D616465000001A2110002030003000004010005010500410204003A250003191714230025EA0003141714230025EA00011724EA00140A14230024E50014230025E50003031914230025E50028030102030601050102050141060300636F756E742062792073747265616D7472616E73706F7274000001FC11000204000300000401000501050041090400E00125C20003141B25E400030F1C1514230024E100142300250003191714230025EA0003141725EA0001171514230025FF002580010A011A14230025E60003031A25E50003031A1514230024F5001423002412142300249F0114230025C30025E10025E10003A006100A03A0060B0309031725000325180C0A25C20003140B0C03040D0A2512030A0C251025F5001703CC080C0A1C160602020502250003231B241D150603050305020503150503251D03808080808080808080011D14150603050305020503150503251D038080808080808080C0011D1415060305030502050315050141060300706F74656E7469616C2052555F756E65787065637465645F62616471000001E01200020100030000040100050105014106030061637475616C2052555F756E65787065637465645F62616471000001EA1200020100030000040100050105014106030042435020706F74656E7469616C2052555F756E65787065637465645F62616471000001F4120002010003000004010005010501410603004243502061637475616C2052555F756E65787065637465645F62616471000001FE12000201000300000401000501050141060300424350203220706F74656E7469616C2052555F756E65787065637465645F62616471000001881300020100030000040100050105014106030042435020322061637475616C2052555F756E65787065637465645F626164710000019213000201000300000401000501050141060300424350203420706F74656E7469616C2052555F756E65787065637465645F626164710000019C130002010003000004010005010501410603004243502031362061637475616C2052555F756E65787065637465645F62616471000001A6130002010003000004010005010500410304000825B801011C25B701050141060300757365727320696E207075626C6963206368617473000001C4130002010003000004010005010501410603007075626C69632063686174206D6573736167657320696E206C617374206D696E757465000001CE1300020100030000046400050A0500410404005F248E0114230024D5001423002500032B1B1423002500032B1C250D03021C16250E03FFFFFFFF0F1D03B4E2C8F10217250E0380808080100D03B4E2C8F10217151614230025D500280219C80106010501020501258E010501258E0103880E1C050141060300636F756E742062792062756464696573000001A814000203000300000401000501050141060300617661696C6162696C697479206167652062792062756464696573000001B2140002030003000004C0FC150005A099020501410603006C6F6E6720617661696C6162696C697479206167652062792062756464696573000001BC140002030003000004010005010500410204003324C000142300250003191714230025F301290300E5C68583B7AEDE36F2CAB9A3A7AE983806020502280202030601050125C00005014106030073696D756C74616E656F75732063616C6C7320706572206E616D6573706163650000018C15000203000300000419000519050041020400C50125C00006020502142300250006030503031917142300050303231B06040504210302200225A1010605050421030502200225A2010606030606070505021A050503021A160506021A15210305072002010607050203021B050603021B152103050720020206070502021A050603021B15210305072002030206070502021A050503041A15210305072002030306070502021A050503031A15210305072002030406070502021A050503051A152103050720020305060705072806010203040506060105010205014106030063616C6C6572733A207332735F313120636F6E665F686F737420636F6E665F636C69656E7420736B7970656F757420736B797065696E20766F6963656D61696C20756E6B6E6F776E000001F015000207000300000401000501 + <_4>000010052A0B6759B71FBC1EF05BE97DFEA4EE6C1E15AF19ED70DEC1130B14C13CE41246D302B9662592907E3CA508A57702B5C00C2A05170857FA22012E0F235B425B4D919B23A541D3AD6E948FC634DE71A29493634884DFD5E9D89C5D951CBCD71B9B3ABFD3C4E2779BB1817D76E7C223CA36BD75A6A05B730AF138057E4048B2FFDD522BB588EC0B9D3E014BF9E354EB608150BC613C739D9E8C7465F05F047FAF7AFA3EE89B9B58BF0FC35F07B55CF3E4B59A7C4ED48B1C0C7F0305E6AC2E80AAEAD6064EB6ACDC1806FCE0B5CB66F0840DA7F0FE7B228E3898E3E42A9AFEFE13DDF019EF8D8F02A631AF2615BBC6E1EDB65C89A775F642C88109E6247EC4B463DC302E2A2E323000050541020006020307322E302E2A2E3100050541030006020307322E302E2A2E3200000AE4ED8009050541030006020307322E302E2A2E33000009B3E6CC990B050541040006020307322E302E2A2E3400000AE4ED8009000BA00B050541030006020308322E302E2A2E35000307322E302E2A2E3900050541040006020308322E302E2A2E39000307322E302E2A2E313100000AE4ED8009050541040006020308322E302E2A2E3131000307322E302E2A2E3135000009E6CC99B306050541050006020308322E302E2A2E3135000307322E302E2A2E323000000AE4ED8009000BA00B050041050303557067726164655465737433000301332E302E302E3130300003044E6963654272616E6400050541040006020307332E302E302E2A0003074E6963654272616E6400000AE4ED8009050541040006020307322E302E302E2A0003074E6963654272616E6400000AE4ED80090500410E0303557067726164655465737433000301332E302E302E31303000050541040006020307332E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307322E302E302E39390003074F746865724272616E6400000AE4ED8009050541040006020307332E302E302E39380003074F746865724272616E64000009B3E6CC990B050541040006020307322E302E302E39380003074F746865724272616E64000009B3E6CC990B050541050006020307332E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541050006020307322E302E302E39370003074F746865724272616E6400000AE4ED8009000BA00B050541030006020307332E302E302E393900000AE4ED8009050541030006020307322E302E302E393900000AE4ED8009050541030006020307332E302E302E3938000009B3E6CC990B050541030006020307322E302E302E3938000009B3E6CC990B050541040006020307332E302E302E393700000AE4ED8009000BA00B050541040006020307322E302E302E393700000AE4ED8009000BA00B0500410303033130303031000301302E302E302E313000050541020006020307302E302E302E3900 + <_5>00001006739CA527EF827847E16F23CD52458C3EBA3460A42935EC6948BEFA626B49E3BDF279FC62486E2DDBCA19609ED23D31F4E5175920F282AD74A74A997C3909E67B622480C68A058E886C7D5F3C40954880D7798CD61CEA0FBAFB389BE5B2B8A887348F7AADB4DF642B194B814047CDA0E698EDDE61DFA731DCA5883A76F913D8C94066718054E85ADA7AE009F2B2A9AF762FDCB9B6CAF64C156911E3AB172CFD795F66FB6E8E15048A54E4AB17979D6C447DEBADE75CC6F606050D980061112AFF9AE7C7BF8065D711949E41FA4C8B6CBF0916BB395B3E186A7D617D353C6BFFC687FE79475DFA095D113D70B828FB597BC3665B7C9C3669CA9CBE5D308D3FC23803044E45544745415200050541020006040307302E392E302E2A000500410503033130303033000301312E302E302E3137000304534D4300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E312E302E313000030442454C4B494E00050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E3137000304454447452D434F524500050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303033000301312E302E302E31330003044C4F474954454300050541020006040307302E392E302E313200050541020006020307302E392E302E3230000500410503033130303035000301312E342E38382E31333636000304544F50434F4D00050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410503033130303035000301312E342E38382E313336360003045043484F4D4500050541020006040307312E342E38382E3133353600050541020006020307312E342E38382E31333635000500410403033130303036000301302E302E302E313000050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303037000301312E302E312E330003045445434F00050541020006040307312E302E302E3800050541020006020307312E302E312E31000500410503033130303038000301302E392E332E3339370003044C494E4B53595300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003044E45544745415200050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410503033130303038000301302E392E332E3339370003045048494C49505300050541020006040307302E382E332E2A00050541020006020307302E392E332E333932000500410403033130303130000301302E392E302E31310003044C494E4B53595300050541020006040307302E392E302E3130000500410403033130303130000301302E392E302E313100030442554646414C4F00050541020006040307302E392E302E3130000500410503033130303132000301312E302E302E310003044353544E00050541020006040307302E302E302E3500050541020006020307302E302E302E39000500410503033130303133000301302E302E332E3234000304414B00050541020006040307302E302E312E323400050541020006020307302E302E322E3234000500410303033130303134000301312E372E34332E33382E3200050541020006040307312E372E32332E32372E34000500410503033130303135000301312E322E31372E30000304415A5445434800050541020006040307312E322E31312E3000050541020006020307312E322E31352E30000500410303033130303230000301312E302E302E343700050541030006020308312E302E302E3233000307312E302E302E3233000500410403033130303234000301332E322E302E323800050541030006040308332E302E302E35000307332E302E302E3500050541030006020308332E312E302E31000307332E322E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E494300050541020006040307302E302E302E3100050541020006020307302E302E302E38000500410503033130303232000301302E302E302E3900030450414E41534F4E4943434F4E53554D455200050541020006040307302E302E302E3100050541020006020307302E302E302E3800 + + 1 + + 400 + + + + 8118 + 39,64,8184 + 37,50,13164 + + 1 + + 1 + + + -1431699456 + -1431699456 + 1610612735 + + 41C801050041050200D9AF0D45D9E900010400028788BCED0400038788BCED04000400050041050200BB0AB3FDD1A40001040002B7DCBCED040003B7DCBCED040004000500410502005C3766C2DA6B00010400029FB2BCED0400039FB2BCED04000400050041050200D9F8DC20CA33000104000296DAAAED04000396DAAAED0400040005004105020063847B3765900001040002D794BDED040003D794BDED040004000500410502004E80142FD3C70001040002CF86BDED040003CF86BDED04000400050041050200C3B213EA24A50001040002BF89BBED040003BF89BBED040004000500410502006FFEF1BA804C0001040002CF86BDED040003CF86BDED0400040005004105020052ED923CB3A700010400028788BCED0400038788BCED040004000500410502005243330D305B000104000283FFB2ED04000383FFB2ED040004000500410502006FF9438E9E5D0001040002CF86BDED040003CF86BDED04000400050041050200585515F19D77000104000283FFB2ED04000383FFB2ED04000400050041050200729EE3A8DD460001040002CF86BDED040003CF86BDED040004000500410502004572795D3BB300010400029FB2BCED0400039FB2BCED040004000500410502009F94D72CABA40001040002CF86BDED040003CF86BDED0400040005004105020095052D9C81090001040002B7DCBCED040003B7DCBCED040004000500410502005859A15FD7FC0001040002DC8FB5ED040003DC8FB5ED0400040005004105020059D7AB3EBBFB0001020002F8FABCED040003CF86BDED04000400050041050200BB2481B9390E0001040002CF86BDED040003CF86BDED0400040005004105020059D7F395A7BA0001040002B7DCBCED040003B7DCBCED040004000500410502006DC4BEF5D52E0001040002B0DFBAED040003B0DFBAED040004000500410502004B6E709CF4290001040002B7DCBCED040003B7DCBCED040004000500410502007A7D5CEC2B8D0001040002CF86BDED040003CF86BDED040004000500410502006FFFA8AFB19D0001040002B7DCBCED040003B7DCBCED040004000500410502003E4475A07A6F0001040002B7DCBCED040003B7DCBCED040004000500410502003EDD8384A4F90001040002BF89BBED040003BF89BBED04000400050041050200560FBFA4E4900001040002B7DCBCED040003B7DCBCED04000400050041050200C24FAEEE43F10001040002B3CEB5ED040003B3CEB5ED040004000500410502004F378778C6F30001040002CF86BDED040003CF86BDED04000400050041050200C94418BB0EDF0001040002B7DCBCED040003B7DCBCED040004000500410502003B75A58BECB30001040002CF86BDED040003CF86BDED04000400050041050200772A7A0908890001040002CF86BDED040003CF86BDED0400040005004105020048BB63586DE100010400029088BCED0400039088BCED040004000500410502005544F881BEDA000104000283FFB2ED04000383FFB2ED040004000500410502005B4C1468EDF80001040002B7DCBCED040003B7DCBCED04000400050041050200538BAF3F934F0001040002B3CEB5ED040003B3CEB5ED0400040005004105020055D6F93A4FD70001040002D7B3BBED040003D7B3BBED04000400050041050200D5D64561E55F00010400028788BCED0400038788BCED0400040005004105020046ADF229B8570001040002CF86BDED040003CF86BDED04000400050041050200D5151C19FFD600010200029FB2BCED040003B7DCBCED04000400050041050200973CA35DB82400010400029FB2BCED0400039FB2BCED04000400050041050200C249E5B953700001040002CF86BDED040003CF86BDED04000400050041050200722C69D8C4F500010400029FB2BCED0400039FB2BCED0400040005004105020058CBB311F2400001040002DC8FB5ED040003DC8FB5ED040004000500410502004BB7A090766E0001040002CF86BDED040003CF86BDED040004000500410502007DEF80FBEBD90001040002EFDDBBED040003EFDDBBED0400040005004105020076A03698F87A0001040002CF86BDED040003CF86BDED0400040005004105020050E5DFDD0C700001040002CF86BDED040003CF86BDED040004000500410502004D4C85E0CEC80001040002CF86BDED040003CF86BDED040004000500410502006FEA6BCD92A10001020002F8FABCED040003CF86BDED0400040005004105020043BAA930F28600010400029FB2BCED0400039FB2BCED04000400050041050200722DB82DDB780001040002CF86BDED040003CF86BDED0400040005004105020052E995118B9F0001040002CF86BDED040003CF86BDED040004000500410502005403013B36D20001040002EFDDBBED040003EFDDBBED04000400050041050200B27C0C920B260001040002B7DCBCED040003B7DCBCED04000400050041050200D9AF0997A7450001040002BCD9AAED040003BCD9AAED04000400050041050200BC00130BB5F60001040002CF86BDED040003CF86BDED04000400050041050200591FF23B53830001040002CF86BDED040003CF86BDED04000400050041050200557EB01367590001040002CF86BDED040003CF86BDED04000400050041050200505F157093A2000102000297A4BCED04000397A4BCED040004000500410502003A036C495C670001040002CF86BDED040003CF86BDED0400040005004105020050D8CF0B7D480001040002B7DCBCED040003B7DCBCED040004000500410502004E34E4D0FF250001040002B7DCBCED040003B7DCBCED040004000500410502007A1E50A46E770001040002CF86BDED040003CF86BDED040004000500410502005F18C666CBB80001040002EFDDBBED040003EFDDBBED04000400050041050200C19335603A9E0001040002DC8FB5ED040003DC8FB5ED0400040005004105020097142BD7DF890001040002AFDFBAED040003AFDFBAED0400040005004105020052F3355FFED400010400029FB2BCED0400039FB2BCED04000400050041050200BCBA857EECDF0001040002D7B3BBED040003D7B3BBED04000400050041050200729259D605EF0001040002CF86BDED040003CF86BDED04000400050041050200BEC2F57655B300010400029FB2BCED0400039FB2BCED040004000500410502005BD905C8304B0001020002A8EEBBED0400038788BCED0400040005004105020055F2C0360F360001040002EFDDBBED040003EFDDBBED0400040005004105020082C01DB9605D00010400028788BCED0400038788BCED04000400050041050200BC73B8FB30360001040002CF86BDED040003CF86BDED0400040005004105020050390E32DF8B0001040002B0DFBAED040003B0DFBAED040004000500410502005BCE8A2D7B8000010400028788BCED0400038788BCED0400040005004105020042292BB45D2D0001040002CF86BDED040003CF86BDED040004000500410502004F1A354DCA9A00010400029FB2BCED0400039FB2BCED04000400050041050200591C1D7F0EC900010400028788BCED0400038788BCED04000400050041050200722E9D2CCB030001040002CF86BDED040003CF86BDED04000400050041050200443AB71D3F8A0001040002CF86BDED040003CF86BDED0400040005004105020018DEF34EB70600010400028788BCED0400038788BCED0400040005004105020097215860080F00010400029FB2BCED0400039FB2BCED040004000500410502007229C156A49E0001040002B7DCBCED040003B7DCBCED040004000500410502003A72EDECB0250001040002B3F7B4ED040003B3F7B4ED04000400050041050200D52F8CD18F640001040002E285B0ED040003E285B0ED040004000500410502006B0325208B4C0001040002EFDDBBED040003EFDDBBED040004000500410502005164424285660001040002938AB5ED040003938AB5ED04000400050041050200D4E9D6AB12F80001040002AFDFBAED040003AFDFBAED0400040005004105020059B3090F459C0001040002FCDDAAED040003FCDDAAED04000400050041050200BC10C41E7AAB0001040002CF86BDED040003CF86BDED040004000500410502009F9532B560C100010400028788BCED0400038788BCED0400040005004105020050EA7B4A63750001040002CF86BDED040003CF86BDED0400040005004105020045A658245E790001040002CF86BDED040003CF86BDED0400040005004105020047E3059299620001040002CF86BDED040003CF86BDED0400040005004105020081164AFC3B450001040002CF86BDED040003CF86BDED040004000500410502005703C3FC60FF00010400028788BCED0400038788BCED0400040005004105020063FAEB02F39300010400028788BCED0400038788BCED040004000500410502005714F2D9F6650001020002AFDFBAED040003ECE7BAED04000400050041050200505F1B22B00D0001040002CF86BDED040003CF86BDED0400040005004105020062C2F2A80C7900010400029FB2BCED0400039FB2BCED04000400050041050200425CA6CCD1FF0001040002CF86BDED040003CF86BDED0400040005004105020084C778D4AB110001040002CF86BDED040003CF86BDED040004000500410502005106437CD3B60001040002CF86BDED040003CF86BDED0400040005004105020058506B2B47D40001040002D7B3BBED040003D7B3BBED04000400050041050200DD70204563390001040002B7DCBCED040003B7DCBCED040004000500410502005CFFA5BE4A0000010200028888BCED040003F8FABCED0400040005004105020089BD8692E0400001040002B7DCBCED040003B7DCBCED040004000500410502004AC12BB2AB8D0001040002B7DCBCED040003B7DCBCED04000400050041050200DB555CBAEE6B0001040002CF86BDED040003CF86BDED0400040005004105020095052D8F81090001020002A7FDBCED040003CF86BDED04000400050041050200473AA0E1C9110001020002A7FDBCED040003CF86BDED040004000500410502004EFA971D2E4C0001040002B7DCBCED040003B7DCBCED04000400050041050200BCE6C5A829D900010400029E90B5ED0400039E90B5ED0400040005004105020051699F18DC540001040002D7B3BBED040003D7B3BBED040004000500410502005CFB85D7E6460001040002B3CEB5ED040003B3CEB5ED0400040005004105020052D17CE5A9840001040002BF89BBED040003BF89BBED0400040005004105020054DD54C818F20001040002CF86BDED040003CF86BDED040004000500410502005C3555EBDC670001040002B7DCBCED040003B7DCBCED0400040005004105020051D92EE554370001040002BF89BBED040003BF89BBED0400040005004105020095549556182D0001040002CF86BDED040003CF86BDED040004000500410502005419C1F7F52A0001040002B3CEB5ED040003B3CEB5ED040004000500410502008C7259638E1D0001040002B7DCBCED040003B7DCBCED04000400050041050200516745231C2200010400029FB2BCED0400039FB2BCED0400040005004105020055FB3DEAE2380001040002B7DCBCED040003B7DCBCED040004000500410502005D5470BCB83A00010400028788BCED0400038788BCED0400040005004105020054C6D511E6810001040002CF86BDED040003CF86BDED0400040005004105020062A7FAC0119000010200028788BCED0400038888BCED040004000500410502007225A1DCFB1A00010200028788BCED0400038888BCED04000400050041050200708B358CF15C00010400028788BCED0400038788BCED04000400050041050200D9A293C3FE550001040002AFDFBAED040003AFDFBAED04000400050041050200722119BAFCB600010400029FB2BCED0400039FB2BCED0400040005004105020054369C95EAC60001040002CF86BDED040003CF86BDED04000400050041050200AE74419813810001040002B7DCBCED040003B7DCBCED0400040005004105020048C613BC68510001040002EFDDBBED040003EFDDBBED04000400050041050200516E168D638B0001040002EFDDBBED040003EFDDBBED040004000500410502001819CFB484D20001040002CF86BDED040003CF86BDED04000400050041050200ADE013B3E9F10001040002CF86BDED040003CF86BDED040004000500410502005C708ABFAC890001040002B3CEB5ED040003B3CEB5ED04000400050041050200BC81882E891C0001040002B7DCBCED040003B7DCBCED0400040005004105020057785543EB480001040002CF86BDED040003CF86BDED040004000500410502006FF0CE6CB4500001040002CF86BDED040003CF86BDED040004000500410502005CE13B7199D4000102000283ADE7E304000383ADE7E30400040005004105020063F610137D170001040002B7DCBCED040003B7DCBCED04000400050041050200DC887BC89E210001040002CF86BDED040003CF86BDED040004000500410502005D9324151E7F0001020002A7FDBCED040003CF86BDED04000400050041050200BC02D363924D00010400029FB2BCED0400039FB2BCED040004000500410502004F28848E1AC50001040002CF86BDED040003CF86BDED0400040005004105020054C606DD0D260001040002D984B5ED040003D984B5ED04000400050041050200D5F586558C850001040002BF89BBED040003BF89BBED0400040005004105020082582B0468CF00010400028788BCED0400038788BCED040004000500410502005CE21BB9BD7C00010400029FB2BCED0400039FB2BCED0400040005004105020059A9ACE3BC02000104000296DAAAED04000396DAAAED040004000500410502005557DB28EDA300010400028788BCED0400038788BCED0400040005004105020076ABA00FF52C0001040002CF86BDED040003CF86BDED0400040005004105020052185C5CB8440001040002B7DCBCED040003B7DCBCED04000400050041050200441402A770A800010200028788BCED0400038888BCED04000400050041050200516623CC99760001040002CF86BDED040003CF86BDED040004000500410502005A3D6D867C2A0001040002BF89BBED040003BF89BBED04000400050041050200BC70864FCE530001040002B3F7B4ED040003B3F7B4ED040004000500410502005E9C9B4E7A740001040002CF86BDED040003CF86BDED0400040005004105020058ABF63F0EA70001040002FCDDAAED040003FCDDAAED040004000500410502005556BDBE86AC000104000286FFB2ED04000386FFB2ED0400040005004105020059D0D49C9B8000010400028788BCED0400038788BCED0400040005004105020059A934952E920001040002B3F7B4ED040003B3F7B4ED040004000500410502007220ABEC82C80001040002B7DCBCED040003B7DCBCED04000400050041050200807AB45544310001040002BF89BBED040003BF89BBED04000400050041050200187A8DFCCDCF0001040002BF89BBED040003BF89BBED04000400050041050200616B5C35801000010400028788BCED0400038788BCED040004000500410502005ABCE5EAE3790001040002938AB5ED040003938AB5ED0400040005004105020048DF5F3311D10001020002F8FABCED040003CF86BDED04000400050041050200D3146B24D6340001040002CF86BDED040003CF86BDED0400040005004105020059037023AC7D00010400029FB2BCED0400039FB2BCED040004000500410502003EDD92C929340001040002BF89BBED040003BF89BBED040004000500410502004C4EB0C1270D0001040002CF86BDED040003CF86BDED04000400050041050200BCA300CD17370001040002CF86BDED040003CF86BDED040004000500410502005BC42D9E789A0001040002D7B3BBED040003D7B3BBED04000400050041050200589755D3E75F0001020002D884B5ED040003B3CEB5ED040004000500410502007A7CC86B21530001040002CF86BDED040003CF86BDED040004000500410502005352A2DA24D300010400028788BCED0400038788BCED0400040005004105020058C9F9B6A86F0001040002B7DCBCED040003B7DCBCED040004000500410502005706A79DEAE60001020002AFDFBAED040003ECE7BAED0400040005004105020082D1B28F7A3A0001040002CF86BDED040003CF86BDED0400040005004105020052217343E79C0001040002CF86BDED040003CF86BDED0400040005004105020082CEA3A289FE000104000296DAAAED04000396DAAAED04000400050041050200D9E0FF79D1180001040002B7DCBCED040003B7DCBCED0400040005004105020052FD31513EE90001040002938AB5ED040003938AB5ED0400040005004105020052128CCDBA7C00010400029FB2BCED0400039FB2BCED040004000500410502006FB83DA167580001040002CF86BDED040003CF86BDED040004000500410502002E14B9387F540001020002B7DCBCED040003CF86BDED040004000500410502004F7E6F098A990001040002CF86BDED040003CF86BDED040004000500410502005D98B7099E1F0001040002B7DCBCED040003B7DCBCED04000400050041050200722A7476317600010400029FB2BCED0400039FB2BCED04000400050041050200BC18CE5EBDA10001020002AFDFBAED040003ECE7BAED040004000500410502005CF890CF3E270001040002B7DCBCED040003B7DCBCED040004000500410502008D72AE6DBEE30001040002CF86BDED040003CF86BDED0400040005004105020076A6D8E9EAAB0001040002CF86BDED040003CF86BDED04000400050041050200721B63925A140001040002CF86BDED040003CF86BDED040004000500410502007608B348A53A0001040002CF86BDED040003CF86BDED04000400 + + 0 + + -645574544 + 0 + 47500 + + 1 + + + 217.133.80.112:1076 217.133.80.112:47500 217.133.80.112:1083 217.133.80.112:1083 217.133.80.112:49734 + 7 + + <_1303289856>6C81442204F3D9855070B98CAE5879A505F3D9855070B98C4D4320134B66D9855070B98C5F4E60ED0D34D98550700434 + <_1303293952>4287274ED659D9855070B98C4287274ED74BD9855070B98C4287274EC15CD9855070B98C4287274ECE92D9855070B98C4287274EA75BD9855070B98C4287274E4B98D9855070B98C4287274EAA2DD9855070B98C4287274EA175D9855070B98C4287274ED735D9855070B98C4287274EAE25D9855070B98C4287274E1A2BD9855070B98C3D7D44372576D9855070B98CCF86DF304366D9855070B98C3D2E02A2259CD9855070B98C4287274EB98CD9855070B98C + <_1303298048>2E3363049108D9855070B98C2E3795FA3202D9855070B98C2E2F6F42E86DD9855070B98CB4B0620AA528D9855070B98C + <_1303306240>5F1894D8122BD9855070B98C2E40484969A3D9855070B98CD592A70A5566D9855070B98C2E26119F8DBED9855070B98C2E3754264E48D9855070B98C + <_1303314432>4D2BFFCAEC6CD9855070043B54BAD08D05E0D9855070B98C9D9D4DA11995D9855070B98C59584CCBB5CED9855070B98C972AC71733DDD9855070B98C + <_1303322624>5F3B0DCEB535D9855070043BD5150C1746D3D9855070B98C4D4B8646EF29D9855070B98CD5152F4D12BBD9855070B98C + <_1303326720>59D0D11D89DCD9855070C2462E755D8E1E97D9855070B98C2E492F875789D9855070B98C2E378784E9C6D9855070B98C2E2F6F6B48FCD9855070B98C + + + <_1303289856>9A4A56D31C619325C6601C71B23E13FDFAF5CA49F15C34A4E33F239B524D6BBC226021F010D2270A3B48DFA2E8CDB6FD37531B1118DB2D471CB980D0 + <_1303293952>D5A2186D0B45088ADDFA7B626C0904CED47E3DF13172672AED483E1EAD69DB781ABEC0D8812B1B5EFF91BC28C67FB5A3404D875A + <_1303298048>DB0EC5161D10171C7C6A4C7109DD + <_1303302144>5379BD98 + <_1303306240>88B19442A48D863ED54D712EEC36D53127BCE36653FE + <_1303310336>1908404B0F7BA3BE952CB1C533456D3CDA410BCB774AF93880FB8BD8C110 + <_1303314432>4B015AD444DD027FD3F61B2A51A53BA0 + <_1303322624>878BAF81A9F053B39E35081485E24B4EDA5F79D37E176C409B6E237A336451F42CFA7CEC013C98A18B51 + <_1303326720>CFB137906F6CCE77246BD5B6B434875570B1F9B9140C85D5114EE6953110B04F3557C0D1686D46A9F69106521979AE49E19F8622F93A + <_1303330816>BA4B81F735FDCDA4E4EF57ACF8A37051C66401E41CA4E562A5A49ACC2E246CCE + + + + 1 + + + 1 + + + 0 + + + 1 + + + + 9BF92EA4B417A7F6 + + + 4102030E322F322E302E302E37322F31373400000FF6EB9ADC04 + + + 0 + + + + 2 + en + + 357 + 258 + 0 + 0 + + 0 + + diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/config.lck b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/config.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/config.xml b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/config.xml new file mode 100644 index 0000000000..f7af8873ad --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/config.xml @@ -0,0 +1,74 @@ + + + + + 300 + 1800 + 63 + + + 41010300676D6172757A7A3400 + 1268962216 + + + 0 + 0 + 1303202372 + 0 + +

+ 35716ecf:2 + 98e6c103:0 +

+ +
+
+ + 1 + 3 + 65535 + 1266110339 + + + 1 + + + 1 + + + 1000000166 + 1303166852 + 1303209779 + + + 1267114269 + + 2 + + 4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608 + + + 1267114267 + 11 + 4263C0064DD5ACF9A03594DAB928D2B81510 + + + + <_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779 + +
+ + + skypopen + + + 0 + 2 + 2 + 2 + +
diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/httpfe/cookies.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/httpfe/cookies.dat new file mode 100644 index 0000000000..fc7f2b1150 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/httpfe/cookies.dat @@ -0,0 +1 @@ +B \ No newline at end of file diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/index2.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/index2.dat new file mode 100644 index 0000000000000000000000000000000000000000..b8b96d84318e540df1ace348fe21db2b6bc5db1c GIT binary patch literal 208 zcmXwuNdbT`5X8FNmjYy9pe~S#BNQM2CZ)5VNwV*L#B-llsu$ko2Zk2aTXAXCJ2}n& hUQDwOVw!yv)9jO&W}n40`y!^<5k^1s4DS literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/main.lock b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameA/main.lock new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/config.lck b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/config.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/config.xml b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/config.xml new file mode 100644 index 0000000000..f7af8873ad --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/config.xml @@ -0,0 +1,74 @@ + + + + + 300 + 1800 + 63 + + + 41010300676D6172757A7A3400 + 1268962216 + + + 0 + 0 + 1303202372 + 0 + +

+ 35716ecf:2 + 98e6c103:0 +

+ +
+
+ + 1 + 3 + 65535 + 1266110339 + + + 1 + + + 1 + + + 1000000166 + 1303166852 + 1303209779 + + + 1267114269 + + 2 + + 4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608 + + + 1267114267 + 11 + 4263C0064DD5ACF9A03594DAB928D2B81510 + + + + <_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779 + +
+ + + skypopen + + + 0 + 2 + 2 + 2 + +
diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/httpfe/cookies.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/httpfe/cookies.dat new file mode 100644 index 0000000000..fc7f2b1150 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/httpfe/cookies.dat @@ -0,0 +1 @@ +B \ No newline at end of file diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/index2.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/index2.dat new file mode 100644 index 0000000000000000000000000000000000000000..b8b96d84318e540df1ace348fe21db2b6bc5db1c GIT binary patch literal 208 zcmXwuNdbT`5X8FNmjYy9pe~S#BNQM2CZ)5VNwV*L#B-llsu$ko2Zk2aTXAXCJ2}n& hUQDwOVw!yv)9jO&W}n40`y!^<5k^1s4DS literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/main.lock b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameB/main.lock new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/config.lck b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/config.lck new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/config.xml b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/config.xml new file mode 100644 index 0000000000..f7af8873ad --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/config.xml @@ -0,0 +1,74 @@ + + + + + 300 + 1800 + 63 + + + 41010300676D6172757A7A3400 + 1268962216 + + + 0 + 0 + 1303202372 + 0 + +

+ 35716ecf:2 + 98e6c103:0 +

+ +
+
+ + 1 + 3 + 65535 + 1266110339 + + + 1 + + + 1 + + + 1000000166 + 1303166852 + 1303209779 + + + 1267114269 + + 2 + + 4109008620EBA4DDDB0400FA0100009E2001009420FB09008520B1A58BDD04008120CCD9E6E3040093209B0A00F501820200F801A3B608 + + + 1267114267 + 11 + 4263C0064DD5ACF9A03594DAB928D2B81510 + + + + <_59908281a5de1c9c602d40fe1f815199a1601558ebea75accdfae8b723bb342e>1303296179 23160:21600:1303209779 9589:7200:1303209779 8707:21600:1303209779 + +
+ + + skypopen + + + 0 + 2 + 2 + 2 + +
diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/httpfe/cookies.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/httpfe/cookies.dat new file mode 100644 index 0000000000..fc7f2b1150 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/httpfe/cookies.dat @@ -0,0 +1 @@ +B \ No newline at end of file diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/index2.dat b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/index2.dat new file mode 100644 index 0000000000000000000000000000000000000000..b8b96d84318e540df1ace348fe21db2b6bc5db1c GIT binary patch literal 208 zcmXwuNdbT`5X8FNmjYy9pe~S#BNQM2CZ)5VNwV*L#B-llsu$ko2Zk2aTXAXCJ2}n& hUQDwOVw!yv)9jO&W}n40`y!^<5k^1s4DS literal 0 HcmV?d00001 diff --git a/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/main.lock b/src/mod/endpoints/mod_skypopen/configs/skype-client-configuration-dir-template/skypeclient01/skypenameC/main.lock new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/mod/endpoints/mod_skypopen/install/install.pl b/src/mod/endpoints/mod_skypopen/install/install.pl new file mode 100755 index 0000000000..ac6eca8a60 --- /dev/null +++ b/src/mod/endpoints/mod_skypopen/install/install.pl @@ -0,0 +1,314 @@ +#!/usr/bin/perl + +my $myname ; +my $skype_download_url = "http://mirrors.kernel.org/archlinux/community/os/i686/skype-oss-2.0.0.72-2-i686.pkg.tar.gz"; +my $skype_download_pkg = "skype-oss-2.0.0.72-2-i686.pkg.tar.gz"; +my $skype_binary_dir = "/usr/bin"; +my $skype_download_dir = "/tmp/skype_download"; +my $skype_share_dir = "/usr/share/skype"; +my $freeswitch_modules_config_dir = "/usr/local/freeswitch/conf/autoload_configs"; +my $skypopen_sound_driver_dir = "/usr/local/freeswitch/skypopen/skypopen-sound-driver-dir"; +my $skype_config_dir = "/usr/local/freeswitch/skypopen/skype-clients-configuration-dir"; +my $skype_startup_dir = "/usr/local/freeswitch/skypopen/skype-clients-startup-dir"; +my $skype_symlinks_dir = "/usr/local/freeswitch/skypopen/skype-clients-symlinks-dir"; +my $skype_clients_to_be_launched = "5"; +my $skype_clients_starting_number = "100"; +my $skype_username = "your_own_skype_username"; +my $skype_password = "your_own_skype_password"; +my $sure = "nope"; + +### PRESENTATION ### +system("clear"); +printf("\n"); +printf("This is the interactive installation helper for Skypopen\n"); +printf("(http://wiki.freeswitch.org/wiki/Mod_skypopen_Skype_Endpoint_and_Trunk)\n"); +printf("\n"); +printf("Especially designed for FreeSWITCH\n"); +printf("by Giovanni Maruzzelli\n"); +printf("\n"); +printf("Please direct all questions or issues to the FreeSWITCH mailing list or Jira\n"); +printf("(http://lists.freeswitch.org/mailman/listinfo or http://jira.freeswitch.org)\n"); +printf("\n"); +printf("\n"); +printf("I'll ask you questions, giving default answers in square brackets [] if any\n"); +printf("To accept the default, just press Enter\n"); +printf("You'll be prompted to confirm your answer at each step\n"); +printf("At the end of questions, before I do anything, I'll let you review it all\n"); +printf("To abort, press Ctrl-C\n"); +printf("\n"); +printf("\n"); +printf("Let's start asking your name, so you see how the question/answer works\n"); +printf("To accept the default, just press Enter\n"); +$myname = &promptUser("Enter your name ", "Giovanni"); +system("clear"); +printf("\n"); +printf("OK %s, GREAT! Let's start real questions! (At any time, Ctrl-C to abort)\n", $myname); +printf("\n"); +printf("At the end of questions, before I do anything, I'll let you review all your answers, don't worry! :)\n"); +printf("\n"); +printf("\n"); + +### ASKING QUESTIONS ### + +printf("I'm about to download the Skype client for Linux version 2.0.0.72 for OSS\n"); +printf("nicely repackaged by Arch Linux with official Skype permission.\n"); +printf("I need to create a directory to download and unpack the Skype client\n"); +printf("To accept the default, just press Enter\n"); +$skype_download_dir = &promptUser("Enter the full path of the Skype download directory ", "$skype_download_dir"); +system("clear"); +printf("\n"); +printf("I'm about to install the Skype client\n"); +printf("I would put the binary in $skype_binary_dir and the associated files in $skype_share_dir\n"); +printf("Location of associated files is mandatory ($skype_share_dir)\n"); +printf("Location of binary is recommended ($skype_binary_dir)\n"); +printf("To accept the default, just press Enter\n"); +$skype_binary_dir = &promptUser("Enter the directory full path for Skype client binary ", "$skype_binary_dir"); +system("clear"); +printf("\n"); +printf("I'm about to create the FreeSWITCH configuration file for mod_skypopen (skypopen.conf.xml)\n"); +printf("I need to know where to put it, eg: where is the FreeSWITCH modules' config dir\n"); +printf("To accept the default, just press Enter\n"); +$freeswitch_modules_config_dir = &promptUser("Enter the directory full path for FreeSWITCH modules' config files ", "$freeswitch_modules_config_dir"); +system("clear"); +printf("\n"); +printf("I'm about to create the directory where to put our fake sound driver\n"); +printf("Location of fake sound driver directory is where you like it more :)\n"); +printf("To accept the default, just press Enter\n"); +$skypopen_sound_driver_dir = &promptUser("Enter the directory full path for fake sound driver ", "$skypopen_sound_driver_dir"); +system("clear"); +printf("\n"); +printf("I'm about to create the configuration directory needed by the Skype clients\n"); +printf("Location of Skype clients configuration directory is where you like it more :)\n"); +printf("To accept the default, just press Enter\n"); +$skype_config_dir = &promptUser("Enter the directory full path for Skype clients config ", "$skype_config_dir"); +system("clear"); +printf("\n"); +printf("I'm about to create a directory where I'll put the Skype clients startup script\n"); +printf("Location of Skype clients startup script directory is where you like it more :)\n"); +printf("To accept the default, just press Enter\n"); +$skype_startup_dir = &promptUser("Enter the directory full path for Skype clients startup script ", "$skype_startup_dir"); +system("clear"); +printf("\n"); +printf("I'm about to create the directory for symlinks needed by the Skype clients startup script\n"); +printf("Location of symlinks directory is where you like it more :)\n"); +printf("To accept the default, just press Enter\n"); +$skype_symlinks_dir = &promptUser("Enter the directory full path for Skype clients symlinks ", "$skype_symlinks_dir"); +system("clear"); +printf("\n"); +printf("I need the Skype username which will be used by the Skype clients to be launched\n"); +printf("(That's the one-word you registered as login to the Skype network)\n"); +printf("This installer will create the needed files to launch concurrently many (or one) instances of it\n"); +printf("\n"); +printf("NB: DON'T ACCEPT the DEFAULT, write YOUR OWN\n"); +$skype_username = &promptUser("Enter the Skype clients username ", "$skype_username"); +system("clear"); +printf("\n"); +printf("I need the Skype password which will be used by the Skype clients to be launched\n"); +printf("(That's the one-word you registered as password to the Skype network)\n"); +printf("\n"); +printf("NB: DON'T ACCEPT the DEFAULT, write YOUR OWN\n"); +$skype_password = &promptUser("Enter the Skype clients password ", "$skype_password"); +system("clear"); +printf("\n"); +printf("How many Skype clients do you want to launch?\n"); +printf("Each Skype client will use approx 70MB of ram\n"); +printf("A quad core CPU can very easily support 20 or more Skype clients\n"); +printf("Each Skype client allows one concurrent call\n"); +printf("Eg: if you plan to have a max of 10 concurrent (outbound and/or inbound) Skype calls then enter 10\n"); +printf("To accept the default, just press Enter\n"); +$skype_clients_to_be_launched = &promptUser("Enter how many Skype clients will be launched ", "$skype_clients_to_be_launched"); +system("clear"); + +### GETTING FINAL APPROVAL ### +printf("\n"); +printf("Please check the following values:\n"); +printf("\n"); +printf("directory for downloading and unpacking Skype client:\n'$skype_download_dir'\n"); +printf("directory for Skype client binary:\n'$skype_binary_dir'\n"); +printf("directory for FreeSWITCH modules' configs:\n'$freeswitch_modules_config_dir'\n"); +printf("directory for fake sound driver:\n'$skypopen_sound_driver_dir'\n"); +printf("directory for Skype clients configs:\n'$skype_config_dir'\n"); +printf("directory for Skype clients startup script:\n'$skype_startup_dir'\n"); +printf("directory for Skype clients symlinks:\n'$skype_symlinks_dir'\n"); +printf("how many Skype clients to launch: '$skype_clients_to_be_launched'\n"); +printf("Skype login: '$skype_username'\n"); +printf("Skype password: '$skype_password'\n"); + +$sure = &promptUser("Are you sure you like the values? Write 'sure' for yes ", "$sure"); +if($sure ne "sure"){ + printf("No problem, please relaunch the installer and begin again\n"); + exit 0; +} +system("clear"); + +printf("\n"); +printf("GREAT! Please stand back, I'm working...\n"); +printf("\n"); + +#### EXECUTION ### + +system("mkdir -p $skype_download_dir"); +system("cd $skype_download_dir ; wget $skype_download_url"); +system("cd $skype_download_dir ; tar -xzf $skype_download_pkg"); + +system("mkdir -p $skype_binary_dir"); +system("cd $skype_download_dir/usr/bin ; cp skype $skype_binary_dir/"); +system("mkdir -p $skype_share_dir"); +system("cd $skype_download_dir/usr/share/skype ; cp -a avatars $skype_share_dir/"); +system("cd $skype_download_dir/usr/share/skype ; cp -a sounds $skype_share_dir/"); +system("cd $skype_download_dir/usr/share/skype ; cp -a lang $skype_share_dir/"); + + +system("mkdir -p $skypopen_sound_driver_dir"); +system("cp ../oss/skypopen.ko $skypopen_sound_driver_dir/"); +system("mkdir -p $skype_config_dir"); +system("mkdir -p $skype_startup_dir"); +system("mkdir -p $skype_symlinks_dir"); + +system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); + + +system("echo \"#!/bin/sh\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"#Unload possible ALSA sound modules that would conflict with our OSS fake module\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"rmmod snd_pcm_oss\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"rmmod snd_mixer_oss\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"rmmod snd_seq_oss\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"sleep 1\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"#Create the inode our fake sound driver will use\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"mknod /dev/dsp c 14 3\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"#Load our OSS fake module\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"insmod $skypopen_sound_driver_dir/skypopen.ko\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo >> $skype_startup_dir/start_skype_clients.sh"); +system("echo >> $skype_startup_dir/start_skype_clients.sh"); + + +for ($count = 1; $count <= $skype_clients_to_be_launched; $count++) { + $skype_client_extension = $skype_clients_starting_number + $count ; + system("ln -s $skype_binary_dir/skype $skype_symlinks_dir/skype$skype_client_extension"); + system("mkdir -p $skype_config_dir/skype$skype_client_extension"); + system("cp -a ../configs/skype-client-configuration-dir-template/skypeclient01/shared.* $skype_config_dir/skype$skype_client_extension"); + system("cp -a ../configs/skype-client-configuration-dir-template/skypeclient01/skypenameA $skype_config_dir/skype$skype_client_extension/$skype_username"); + + system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); + system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); + system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); + + system("echo \"#start the fake X server on the given port\" >> $skype_startup_dir/start_skype_clients.sh"); + system("echo \"/usr/bin/Xvfb :$skype_client_extension -ac -nolisten tcp -screen 0 640x480x8 &\" >> $skype_startup_dir/start_skype_clients.sh"); + system("echo \"sleep 3\" >> $skype_startup_dir/start_skype_clients.sh"); + system("echo \"# start a Skype client instance that will connect to the X server above, and will login to the Skype network using the 'username password' you send to it on stdin.\" >> $skype_startup_dir/start_skype_clients.sh"); + system("echo \"su root -c \\\"/bin/echo '$skype_username $skype_password'| DISPLAY=:$skype_client_extension $skype_symlinks_dir/skype$skype_client_extension --dbpath=$skype_config_dir/skype$skype_client_extension --pipelogin &\\\"\" >> $skype_startup_dir/start_skype_clients.sh"); + system("echo \"sleep 7\" >> $skype_startup_dir/start_skype_clients.sh"); + system("echo >> $skype_startup_dir/start_skype_clients.sh"); +} + +system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); +system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); + +system("echo \"exit 0\" >> $skype_startup_dir/start_skype_clients.sh"); + + +printf("\n"); +printf("SUCCESS!!!\n"); +printf("\n"); + + +#=========================================================================# + + +#-------------------------------------------------------------------------# +# promptUser, a Perl subroutine to prompt a user for input. +# Copyright 2010 Alvin Alexander, devdaily.com. +# This code is shared here under the +# Creative Commons Attribution-ShareAlike Unported 3.0 license. +# See http://creativecommons.org/licenses/by-sa/3.0/ for more information. +#-------------------------------------------------------------------------# + +# Original at: http://www.devdaily.com/perl/edu/articles/pl010005 +# Modified to get confirmations by Giovanni Maruzzelli + +#----------------------------( promptUser )-----------------------------# +# # +# FUNCTION: promptUser # +# # +# PURPOSE: Prompt the user for some type of input, and return the # +# input back to the calling program. # +# # +# ARGS: $promptString - what you want to prompt the user with # +# $defaultValue - (optional) a default value for the prompt # +# # +#-------------------------------------------------------------------------# + +sub promptUser { + +#-------------------------------------------------------------------# +# two possible input arguments - $promptString, and $defaultValue # +# make the input arguments local variables. # +#-------------------------------------------------------------------# + + local($promptString,$defaultValue) = @_; + local $input; + local $confirm; + local $gave; + +#-------------------------------------------------------------------# +# if there is a default value, use the first print statement; if # +# no default is provided, print the second string. # +#-------------------------------------------------------------------# + + while(1){ + printf("\n"); + if ($defaultValue) { + print $promptString, "\n[", $defaultValue, "]: "; + } else { + print $promptString, ": "; + } + + $| = 1; # force a flush after our print + $input = ; # get the input from STDIN (presumably the keyboard) + + +#------------------------------------------------------------------# +# remove the newline character from the end of the input the user # +# gave us. # +#------------------------------------------------------------------# + + chomp($input); + + $gave = $input ? $input : $defaultValue; + print("You gave: '$gave'\nIt's OK? Please answer 'Y' for yes or 'N' for not [N]: "); + $| = 1; # force a flush after our print + $confirm = ; + chomp($confirm); + if($confirm eq "Y" or $confirm eq "y"){ + last; + } + } +#-----------------------------------------------------------------# +# if we had a $default value, and the user gave us input, then # +# return the input; if we had a default, and they gave us no # +# no input, return the $defaultValue. # +# # +# if we did not have a default value, then just return whatever # +# the user gave us. if they just hit the key, # +# the calling routine will have to deal with that. # +#-----------------------------------------------------------------# + + if ("$defaultValue") { + return $input ? $input : $defaultValue; # return $_ if it has a value + } else { + return $input; + } +} + From 3ad78ba4acbb485a4d213316a58454eaafee97b0 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 21 Apr 2011 12:59:37 -0500 Subject: [PATCH 352/558] OPENZAP-153 --resolve --- libs/freetdm/src/ftdm_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1d7a0d1eb1..1c10171202 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -3566,7 +3566,7 @@ static FIO_READ_FUNCTION(ftdm_raw_read) if (status == FTDM_SUCCESS && ftdm_test_flag(ftdmchan, FTDM_CHANNEL_USE_RX_GAIN) && (ftdmchan->native_codec == FTDM_CODEC_ALAW || ftdmchan->native_codec == FTDM_CODEC_ULAW)) { - int i = 0; + ftdm_size_t i = 0; unsigned char *rdata = data; for (i = 0; i < *datalen; i++) { rdata[i] = ftdmchan->rxgain_table[rdata[i]]; From dad670713b1efaaab3a28f037083d7fcd25cf088 Mon Sep 17 00:00:00 2001 From: Brian West Date: Thu, 21 Apr 2011 19:32:37 -0500 Subject: [PATCH 353/558] Fix issue with SLA and Barge --- src/mod/endpoints/mod_sofia/sofia.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 9061270a91..5b8896b7f4 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -7158,8 +7158,6 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } if ((uuid = switch_channel_get_variable(b_channel, SWITCH_SIGNAL_BOND_VARIABLE))) { - switch_channel_set_variable(b_channel, "presence_call_info", NULL); - switch_channel_set_variable(b_channel, "presence_call_info_full", NULL); one_leg = 0; } else { uuid = switch_core_session_get_uuid(b_session); From ac619fd0e89924e5eb022d0fb6df4e43cb483042 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 01:42:47 -0400 Subject: [PATCH 354/558] mod_callcenter: Possible fix on unload module freeze when an member uuid changed or is gone --- src/mod/applications/mod_callcenter/mod_callcenter.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 0810abb49b..e363fa8fd1 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2205,10 +2205,6 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj switch_core_session_t *member_session = switch_core_session_locate(m->member_session_uuid); switch_channel_t *member_channel = NULL; - switch_mutex_lock(globals.mutex); - globals.threads++; - switch_mutex_unlock(globals.mutex); - if (member_session) { member_channel = switch_core_session_get_channel(member_session); } else { @@ -2216,6 +2212,10 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj return NULL; } + switch_mutex_lock(globals.mutex); + globals.threads++; + switch_mutex_unlock(globals.mutex); + while(switch_channel_ready(member_channel) && m->running && globals.running) { cc_queue_t *queue = NULL; From 366f7ca677bb503241bb23b873bfb2e1903f8d4f Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 02:22:30 -0400 Subject: [PATCH 355/558] mod_callcenter: Changes lot of log file to include the uuid of the member. Also added a bunch of debug log entry to help debug an issue --- .../mod_callcenter/mod_callcenter.c | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index e363fa8fd1..0fc9aa2e6c 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -37,10 +37,6 @@ #define CC_AGENT_TYPE_UUID_STANDBY "uuid-standby" #define CC_SQLITE_DB_NAME "callcenter" -/* TODO - drop caller if no agent login - dont allow new caller - */ /* Prototypes */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_callcenter_runtime); @@ -1380,6 +1376,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* member is gone before we could process it */ if (!member_session) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Member %s <%s> with uuid %s in queue %s is gone just before we assigned an agent\n", h->member_cid_name, h->member_cid_number, h->member_session_uuid, h->queue_name); + + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); @@ -1449,7 +1448,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa cc_agent_update("uuid", "", h->agent_name); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid agent type '%s' for agent '%s', aborting member offering", h->agent_type, h->agent_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Invalid agent type '%s' for agent '%s', aborting member offering", h->agent_type, h->agent_name); status = SWITCH_CAUSE_USER_NOT_REGISTERED; } @@ -1560,7 +1559,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" <%s> from queue %s%s\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" <%s> from queue %s%s\n", h->agent_name, h->member_cid_name, h->member_cid_number, h->queue_name, (h->record_template?" (Recorded)":"")); switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); @@ -1638,7 +1637,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s Origination Canceled : %s\n", h->agent_name, switch_channel_cause2str(cause)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s Origination Canceled : %s\n", h->agent_name, switch_channel_cause2str(cause)); switch (cause) { /* When we hang-up agents that did not answer in ring-all strategy */ @@ -1667,7 +1666,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Put Agent on break because he didn't answer often */ if (h->max_no_answer > 0 && (h->no_answer_count + 1) >= h->max_no_answer) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s reach maximum no answer of %d, Putting agent on break\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s reach maximum no answer of %d, Putting agent on break\n", h->agent_name, h->max_no_answer); cc_agent_update("status", cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK), h->agent_name); } @@ -1679,7 +1678,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa char ready_epoch[64]; switch_snprintf(ready_epoch, sizeof(ready_epoch), "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL) + delay_next_agent_call); cc_agent_update("ready_time", ready_epoch , h->agent_name); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Agent %s sleeping for %d seconds\n", h->agent_name, delay_next_agent_call); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s sleeping for %d seconds\n", h->agent_name, delay_next_agent_call); } /* Fire up event when contact agent fails */ @@ -2220,12 +2219,12 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj cc_queue_t *queue = NULL; if (!m->queue_name || !(queue = get_queue(m->queue_name))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found\n", m->queue_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_WARNING, "Queue %s not found\n", m->queue_name); break; } /* Make the Caller Leave if he went over his max wait time */ if (queue->max_wait_time > 0 && queue->max_wait_time <= switch_epoch_time_now(NULL) - m->t_member_called) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait time\n", m->member_cid_name, m->member_cid_number, m->queue_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait time\n", m->member_cid_name, m->member_cid_number, m->queue_name); m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_TIMEOUT; switch_channel_set_flag_value(member_channel, CF_BREAK, 2); } @@ -2233,7 +2232,7 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj /* Will drop the caller if no agent was found for more than X seconds */ if (queue->max_wait_time_with_no_agent > 0 && m->t_member_called < queue->last_agent_exist_check - queue->max_wait_time_with_no_agent_time_reached && queue->last_agent_exist_check - queue->last_agent_exist >= queue->max_wait_time_with_no_agent) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait with no agent time\n", m->member_cid_name, m->member_cid_number, m->queue_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait with no agent time\n", m->member_cid_name, m->member_cid_number, m->queue_name); m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_NO_AGENT_TIMEOUT; switch_channel_set_flag_value(member_channel, CF_BREAK, 2); } @@ -2329,7 +2328,7 @@ SWITCH_STANDARD_APP(callcenter_function) mydata = switch_core_session_strdup(member_session, data); argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "No Queue name provided\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_WARNING, "No Queue name provided\n"); goto end; } @@ -2338,7 +2337,7 @@ SWITCH_STANDARD_APP(callcenter_function) } if (!queue_name || !(queue = get_queue(queue_name))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found\n", queue_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_WARNING, "Queue %s not found\n", queue_name); goto end; } @@ -2403,6 +2402,8 @@ SWITCH_STANDARD_APP(callcenter_function) if (abandoned_epoch == 0) { /* Add the caller to the member queue */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> joining queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); + sql = switch_mprintf("INSERT INTO members" " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,cid_number,cid_name,serving_agent,serving_system,state)" " VALUES('%q','single_box','%q','%q','%q','%ld','%d','%d','%q','%q','%q','','%q')", @@ -2421,6 +2422,9 @@ SWITCH_STANDARD_APP(callcenter_function) switch_safe_free(sql); } else { char res[256]; + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> restoring it previous position in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); + /* Update abandoned member */ sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%ld' WHERE uuid = '%q' AND state = '%q'", member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); @@ -2435,7 +2439,7 @@ SWITCH_STANDARD_APP(callcenter_function) if (atol(res) == 0) { /* Failed to get the member !!! */ /* TODO Loop back to just create a uuid and add the member as a new member */ - /* TODO ERROR MSG */ + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_ERROR, "Member %s <%s> restoring action failed in queue %s, exiting\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); queue_rwunlock(queue); goto end; } @@ -2519,6 +2523,8 @@ SWITCH_STANDARD_APP(callcenter_function) /* Canceled for some reason */ if (!switch_channel_up(member_channel) || h->member_cancel_reason != CC_MEMBER_CANCEL_REASON_NONE) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); + /* Update member state */ sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), member_uuid); @@ -2550,12 +2556,14 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_set_variable_printf(member_channel, "cc_cancel_reason", "%s", cc_member_cancel_reason2str(h->member_cancel_reason)); /* Print some debug log information */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Member \"%s\" <%s> exit queue %s due to %s\n", + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member \"%s\" <%s> exit queue %s due to %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name, cc_member_cancel_reason2str(h->member_cancel_reason)); } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); + /* Update member state */ sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ANSWERED), (long) switch_epoch_time_now(NULL), member_uuid); From 6fbfff0f915c8b558036d06b1e805836902e0f7a Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 03:01:08 -0400 Subject: [PATCH 356/558] mod_callcenter: Should resolve problem when agent transfered a call to another queue. FS-2888 --- .../applications/mod_callcenter/mod_callcenter.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 0fc9aa2e6c..1ba3173d70 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1563,9 +1563,11 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa h->agent_name, h->member_cid_name, h->member_cid_number, h->queue_name, (h->record_template?" (Recorded)":"")); switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); - /* This is used for the waiting caller to quit waiting for a agent */ switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); + /* This is used for the waiting caller to quit waiting for a agent */ + switch_channel_set_variable(member_channel, "cc_agent_found", "true"); + /* Wait until the member hangup or the agent hangup. This will quit also if the agent transfer the call */ while(switch_channel_up(member_channel) && switch_channel_up(agent_channel) && globals.running) { switch_yield(100000); @@ -2320,9 +2322,9 @@ SWITCH_STANDARD_APP(callcenter_function) switch_event_t *event; switch_time_t t_member_called = switch_epoch_time_now(NULL); long abandoned_epoch = 0; - const char *agent_uuid = NULL; switch_uuid_t smember_uuid; char member_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = ""; + switch_bool_t agent_found = SWITCH_FALSE; if (!zstr(data)) { mydata = switch_core_session_strdup(member_session, data); @@ -2479,6 +2481,7 @@ SWITCH_STANDARD_APP(callcenter_function) while (switch_channel_ready(member_channel)) { switch_input_args_t args = { 0 }; struct moh_dtmf_helper ht; + const char *p; ht.dtmf = '\0'; args.input_callback = moh_on_dtmf; @@ -2486,7 +2489,7 @@ SWITCH_STANDARD_APP(callcenter_function) args.buflen = sizeof(h); /* An agent was found, time to exit and let the bridge do it job */ - if ((agent_uuid = switch_channel_get_variable(member_channel, "cc_agent_uuid"))) { + if ((p = switch_channel_get_variable(member_channel, "cc_agent_found")) && (agent_found = switch_true(p))) { break; } /* If the member thread set a different reason, we monitor it so we can quit the wait */ @@ -2517,10 +2520,12 @@ SWITCH_STANDARD_APP(callcenter_function) } /* Check if we were removed be cause FS Core(BREAK) asked us too */ - if (h->member_cancel_reason == CC_MEMBER_CANCEL_REASON_NONE && !switch_channel_get_variable(member_channel, "cc_agent_uuid")) { + if (h->member_cancel_reason == CC_MEMBER_CANCEL_REASON_NONE && !agent_found) { + h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_BREAK_OUT; } + switch_channel_set_variable(member_channel, "cc_agent_found", NULL); /* Canceled for some reason */ if (!switch_channel_up(member_channel) || h->member_cancel_reason != CC_MEMBER_CANCEL_REASON_NONE) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); From c22aac0eac05300681354b2874e87a5fa05bd1a0 Mon Sep 17 00:00:00 2001 From: Georgiewskiy Yuriy Date: Fri, 22 Apr 2011 15:19:27 +0400 Subject: [PATCH 357/558] fix race condition on destroying signaling thread in h323 library --- src/mod/endpoints/mod_h323/changes.txt | 1 + src/mod/endpoints/mod_h323/mod_h323.cpp | 23 ++++++++++++++++++----- src/mod/endpoints/mod_h323/mod_h323.h | 16 +++++++++++++--- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_h323/changes.txt b/src/mod/endpoints/mod_h323/changes.txt index 4f75aef8b4..3af956f0cb 100644 --- a/src/mod/endpoints/mod_h323/changes.txt +++ b/src/mod/endpoints/mod_h323/changes.txt @@ -1,3 +1,4 @@ +fix race condition on destroying signaling thread in h323 library Adds an extra switch_rtp_destroy or switch_rtp_release_port when a session ends - to make sure the port is returned to FS. thx to Peter Olsson. fix issues with Progress message type if pre_answer enabled diff --git a/src/mod/endpoints/mod_h323/mod_h323.cpp b/src/mod/endpoints/mod_h323/mod_h323.cpp index 44295f618f..233e972e32 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.cpp +++ b/src/mod/endpoints/mod_h323/mod_h323.cpp @@ -1,9 +1,12 @@ /* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * H323 endpoint interface for Freeswitch Modular Media Switching Software Library / + * Soft-Switch Application * * Version: MPL 1.1 * + * Copyright (c) 2010 Ilnitskiy Mixim (max.h323@gmail.com) + * Copyright (c) 2010 Georgiewskiy Yuriy (bottleman@icf.org.ru) + * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,6 +17,11 @@ * for the specific language governing rights and limitations under the * License. * + * Contributor(s): + * + * + * + * * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is @@ -24,7 +32,7 @@ * * mod_h323.cpp -- H323 endpoint * - * Version 0.0.56 + * Version 0.0.57 */ //#define DEBUG_RTP_PACKETS @@ -708,6 +716,7 @@ FSH323Connection::FSH323Connection(FSH323EndPoint& endpoint, H323Transport* tran h323_private_t *tech_pvt = (h323_private_t *) switch_core_session_alloc(m_fsSession, sizeof(*tech_pvt)); tech_pvt->me = this; + tech_pvt->active_connection = true; switch_core_session_set_private(m_fsSession, tech_pvt); switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(m_fsSession)); @@ -748,8 +757,9 @@ FSH323Connection::~FSH323Connection() } else if (m_RTPlocalPort) { switch_rtp_release_port((const char *)m_RTPlocalIP.AsString(), m_RTPlocalPort); } - + tech_pvt->me = NULL; + tech_pvt->active_connection = false; // switch_mutex_unlock(tech_pvt->h323_mutex); // switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); } @@ -2387,6 +2397,9 @@ static switch_status_t on_hangup(switch_core_session_t *session) switch_mutex_lock(tech_pvt->h323_mutex); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,"------------->h323_mutex_unlock\n"); switch_mutex_unlock(tech_pvt->h323_mutex); - + while (tech_pvt->active_connection){ + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Wait clear h323 connection\n"); + h_timer(1); + } return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/endpoints/mod_h323/mod_h323.h b/src/mod/endpoints/mod_h323/mod_h323.h index 5477f9aa59..3a0d7aa235 100644 --- a/src/mod/endpoints/mod_h323/mod_h323.h +++ b/src/mod/endpoints/mod_h323/mod_h323.h @@ -1,9 +1,12 @@ /* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2011, Anthony Minessale II + * H323 endpoint interface for Freeswitch Modular Media Switching Software Library / + * Soft-Switch Application * * Version: MPL 1.1 * + * Copyright (c) 2010 Ilnitskiy Mixim (max.h323@gmail.com) + * Copyright (c) 2010 Georgiewskiy Yuriy (bottleman@icf.org.ru) + * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at @@ -14,6 +17,11 @@ * for the specific language governing rights and limitations under the * License. * + * Contributor(s): + * + * + * + * * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application * * The Initial Developer of the Original Code is @@ -24,7 +32,8 @@ * * mod_h323.h -- H323 endpoint * - */ + * Version 0.0.57 +*/ #if defined(__GNUC__) && defined(HAVE_VISIBILITY) #pragma GCC visibility push(default) @@ -184,6 +193,7 @@ typedef struct { switch_mutex_t *h323_io_mutex; FSH323Connection *me; + bool active_connection; char *token; } h323_private_t; From 73279f01bf1c8a5e419a4de29b8c65f524c64b7b Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 22 Apr 2011 16:43:29 -0500 Subject: [PATCH 358/558] FS-3166 --resolve --- libs/esl/src/esl.c | 2 +- libs/libteletone/src/libteletone_generate.c | 4 +- libs/spandsp/src/plc.c | 4 +- libs/stfu/stfu.c | 6 +- .../applications/mod_cluechoo/mod_cluechoo.c | 8 +-- .../applications/mod_commands/mod_commands.c | 20 +++---- .../mod_conference/mod_conference.c | 25 ++++----- .../applications/mod_dptools/mod_dptools.c | 8 +-- src/mod/applications/mod_esf/mod_esf.c | 4 +- src/mod/applications/mod_fifo/mod_fifo.c | 7 +-- src/mod/applications/mod_hash/mod_hash.c | 4 +- .../mod_spandsp/mod_spandsp_fax.c | 2 - src/mod/applications/mod_spandsp/udptl.c | 2 - .../mod_voicemail/mod_voicemail.c | 55 +++++-------------- .../mod_dialplan_asterisk.c | 3 +- src/mod/endpoints/mod_sofia/mod_sofia.c | 14 ++--- src/mod/endpoints/mod_sofia/sip-dig.c | 12 +--- src/mod/endpoints/mod_sofia/sofia.c | 12 ++-- src/mod/endpoints/mod_sofia/sofia_glue.c | 30 +++------- src/mod/endpoints/mod_sofia/sofia_presence.c | 23 ++------ src/mod/endpoints/mod_sofia/sofia_reg.c | 5 -- .../event_handlers/mod_cdr_csv/mod_cdr_csv.c | 3 +- .../mod_event_socket/mod_event_socket.c | 8 +-- .../mod_local_stream/mod_local_stream.c | 8 +-- src/mod/formats/mod_sndfile/mod_sndfile.c | 5 +- .../mod_spidermonkey/mod_spidermonkey.c | 12 +--- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c | 2 + src/switch.c | 4 +- src/switch_channel.c | 14 +---- src/switch_core.c | 1 + src/switch_core_file.c | 7 +-- src/switch_core_media_bug.c | 3 +- src/switch_core_session.c | 7 +-- src/switch_ivr.c | 10 +--- src/switch_ivr_async.c | 5 +- src/switch_ivr_bridge.c | 3 +- src/switch_ivr_play_say.c | 21 +++---- src/switch_loadable_module.c | 4 +- src/switch_rtp.c | 9 ++- src/switch_time.c | 1 + src/switch_xml.c | 6 +- 41 files changed, 125 insertions(+), 258 deletions(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index 95e9615107..bfdf58a625 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -323,7 +323,7 @@ static void default_logger(const char *file, const char *func, int line, int lev ret = esl_vasprintf(&data, fmt, ap); if (ret != -1) { - fprintf(stderr, "[%s] %s:%d %s() %s", LEVEL_NAMES[level], file, line, func, data); + fprintf(stderr, "[%s] %s:%d %s() %s", LEVEL_NAMES[level], fp, line, func, data); free(data); } diff --git a/libs/libteletone/src/libteletone_generate.c b/libs/libteletone/src/libteletone_generate.c index ebf62822a4..a5cefac98d 100644 --- a/libs/libteletone/src/libteletone_generate.c +++ b/libs/libteletone/src/libteletone_generate.c @@ -321,7 +321,7 @@ static char *my_strdup (const char *s) TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cmd) { char *data = NULL, *cur = NULL, *end = NULL; - int var = 0, LOOPING = 0; + int LOOPING = 0; if (!cmd) { return -1; @@ -335,7 +335,6 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm cur = data; while (*cur) { - var = 0; if (*cur == ' ' || *cur == '\r' || *cur == '\n') { cur++; continue; @@ -346,7 +345,6 @@ TELETONE_API(int) teletone_run(teletone_generation_session_t *ts, const char *cm } if (*(cur + 1) == '=') { - var = 1; switch(*cur) { case 'c': ts->channels = atoi(cur + 2); diff --git a/libs/spandsp/src/plc.c b/libs/spandsp/src/plc.c index fb1cea78be..392a7b01a6 100644 --- a/libs/spandsp/src/plc.c +++ b/libs/spandsp/src/plc.c @@ -165,10 +165,10 @@ SPAN_DECLARE(int) plc_fillin(plc_state_t *s, int16_t amp[], int len) float old_weight; float new_weight; float gain; - int16_t *orig_amp; + //int16_t *orig_amp; int orig_len; - orig_amp = amp; + //orig_amp = amp; orig_len = len; if (s->missing_samples == 0) { diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index d8797f7cd0..9e5fcf3b22 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -506,9 +506,9 @@ stfu_status_t stfu_n_add_data(stfu_instance_t *i, uint32_t ts, uint32_t pt, void i->diff_total += i->diff; if ((i->period_packet_in_count > i->period_time)) { - uint32_t avg; + //uint32_t avg; - avg = i->diff_total / least1(i->period_packet_in_count); + //avg = i->diff_total / least1(i->period_packet_in_count); i->period_packet_in_count = 0; @@ -904,7 +904,7 @@ static void default_logger(const char *file, const char *func, int line, int lev ret = stfu_vasprintf(&data, fmt, ap); if (ret != -1) { - fprintf(stderr, "[%s] %s:%d %s() %s", LEVEL_NAMES[level], file, line, func, data); + fprintf(stderr, "[%s] %s:%d %s() %s", LEVEL_NAMES[level], fp, line, func, data); free(data); } diff --git a/src/mod/applications/mod_cluechoo/mod_cluechoo.c b/src/mod/applications/mod_cluechoo/mod_cluechoo.c index 2699d82fc4..b4eaee0acb 100644 --- a/src/mod/applications/mod_cluechoo/mod_cluechoo.c +++ b/src/mod/applications/mod_cluechoo/mod_cluechoo.c @@ -217,7 +217,7 @@ int go(int i) int vgo(int i, switch_core_session_t *session) { int x; - int sleep_len = 40000; + //int sleep_len = 40000; switch_channel_t *channel = switch_core_session_get_channel(session); switch_frame_t *read_frame; switch_status_t status; @@ -233,9 +233,9 @@ int vgo(int i, switch_core_session_t *session) printf("%s", SWITCH_SEQ_CLEARSCR); - if (i > 0) { - sleep_len = i; - } + //if (i > 0) { + //sleep_len = i; + //} initscr(); signal(SIGINT, SIG_IGN); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 501b3f88b2..96ef58299e 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -2601,7 +2601,6 @@ SWITCH_STANDARD_API(uuid_broadcast_function) { char *mycmd = NULL, *argv[4] = { 0 }; int argc = 0; - switch_status_t status = SWITCH_STATUS_FALSE; if (!zstr(cmd) && (mycmd = strdup(cmd))) { argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -2635,7 +2634,7 @@ SWITCH_STANDARD_API(uuid_broadcast_function) flags = SMF_ECHO_ALEG | SMF_HOLD_BLEG; } - status = switch_ivr_broadcast(argv[0], argv[1], flags); + switch_ivr_broadcast(argv[0], argv[1], flags); stream->write_function(stream, "+OK Message Sent\n"); } @@ -2648,7 +2647,6 @@ SWITCH_STANDARD_API(sched_broadcast_function) { char *mycmd = NULL, *argv[4] = { 0 }; int argc = 0; - switch_status_t status = SWITCH_STATUS_FALSE; if (!zstr(cmd) && (mycmd = strdup(cmd))) { argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); @@ -2678,7 +2676,7 @@ SWITCH_STANDARD_API(sched_broadcast_function) flags |= SMF_ECHO_ALEG; } - status = switch_ivr_schedule_broadcast(when, argv[1], argv[2], flags); + switch_ivr_schedule_broadcast(when, argv[1], argv[2], flags); stream->write_function(stream, "+OK Message Scheduled\n"); } @@ -2763,8 +2761,6 @@ SWITCH_STANDARD_API(uuid_buglist_function) char *mydata = NULL, *argv[2] = { 0 }; int argc = 0; - switch_status_t status = SWITCH_STATUS_FALSE; - if (zstr(cmd)) { goto error; } @@ -2781,7 +2777,7 @@ SWITCH_STANDARD_API(uuid_buglist_function) switch_core_session_t *lsession = NULL; if ((lsession = switch_core_session_locate(argv[0]))) { - status = switch_core_media_bug_enumerate(lsession, stream); + switch_core_media_bug_enumerate(lsession, stream); switch_core_session_rwunlock(lsession); } goto ok; @@ -3863,7 +3859,6 @@ SWITCH_STANDARD_API(show_function) struct holder holder = { 0 }; int help = 0; char *mydata = NULL, *argv[6] = { 0 }; - int argc; char *command = NULL, *as = NULL; switch_core_flag_t cflags = switch_core_flags(); switch_status_t status = SWITCH_STATUS_SUCCESS; @@ -3884,7 +3879,7 @@ SWITCH_STANDARD_API(show_function) holder.justcount = 0; if (cmd && (mydata = strdup(cmd))) { - argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); command = argv[0]; if (argv[2] && !strcasecmp(argv[1], "as")) { as = argv[2]; @@ -4378,10 +4373,10 @@ SWITCH_STANDARD_API(uuid_fileman_function) char *cmd = argv[1]; if ((psession = switch_core_session_locate(uuid))) { - switch_channel_t *channel; + //switch_channel_t *channel; switch_file_handle_t *fh = NULL; - channel = switch_core_session_get_channel(psession); + //channel = switch_core_session_get_channel(psession); if (switch_ivr_get_file_handle(psession, &fh) == SWITCH_STATUS_SUCCESS) { switch_ivr_process_fh(psession, cmd, fh); @@ -4689,13 +4684,12 @@ SWITCH_STANDARD_API(strftime_tz_api_function) SWITCH_STANDARD_API(hupall_api_function) { char *mycmd = NULL, *argv[3] = { 0 }; - int argc = 0; char *var = NULL; char *val = NULL; switch_call_cause_t cause = SWITCH_CAUSE_MANAGER_REQUEST; if (!zstr(cmd) && (mycmd = strdup(cmd))) { - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); switch_assert(argv[0]); if ((cause = switch_channel_str2cause(argv[0])) == SWITCH_CAUSE_NONE) { cause = SWITCH_CAUSE_MANAGER_REQUEST; diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 57b241c57d..0a5ca0e292 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -948,7 +948,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr conference_member_t *imember; switch_frame_t *vid_frame; switch_status_t status; - int has_vid = 1, req_iframe = 0; + int has_vid = 1;// req_iframe = 0; int yield = 0; uint32_t last_member = 0; switch_core_session_t *session; @@ -983,7 +983,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr if (!SWITCH_READ_ACCEPTABLE(status) || !conference->floor_holder || switch_test_flag(vid_frame, SFF_CNG)) { conference->floor_holder = NULL; - req_iframe = 0; + //req_iframe = 0; goto do_continue; } @@ -1018,7 +1018,7 @@ static void *SWITCH_THREAD_FUNC conference_video_thread_run(switch_thread_t *thr goto do_continue; } - req_iframe = 0; + //req_iframe = 0; } last_member = conference->floor_holder->id; @@ -2512,7 +2512,7 @@ static void conference_loop_output(conference_member_t *member) switch_timer_t timer = { 0 }; uint32_t interval; uint32_t samples; - uint32_t csamples; + //uint32_t csamples; uint32_t tsamples; uint32_t flush_len; uint32_t low_count, bytes; @@ -2535,7 +2535,7 @@ static void conference_loop_output(conference_member_t *member) channel = switch_core_session_get_channel(member->session); interval = read_impl.microseconds_per_packet / 1000; samples = switch_samples_per_packet(member->conference->rate, interval); - csamples = samples; + //csamples = samples; tsamples = member->orig_read_impl.samples_per_packet; flush_len = 0; low_count = 0; @@ -2835,7 +2835,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th conference_record_t *rec = (conference_record_t *) obj; conference_obj_t *conference = rec->conference; uint32_t samples = switch_samples_per_packet(conference->rate, conference->interval); - uint32_t low_count = 0, mux_used; + uint32_t mux_used; char *vval; switch_timer_t timer = { 0 }; uint32_t rlen; @@ -2962,7 +2962,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t *th if (mux_used >= data_buf_len) { /* Flush the output buffer and write all the data (presumably muxed) to the file */ switch_mutex_lock(member->audio_out_mutex); - low_count = 0; + //low_count = 0; if ((rlen = (uint32_t) switch_buffer_read(member->mux_buffer, data_buf, data_buf_len))) { len = (switch_size_t) rlen / sizeof(int16_t); @@ -4091,7 +4091,7 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer switch_channel_t *channel; switch_caller_profile_t *profile; char *uuid; - char *name; + //char *name; uint32_t count = 0; switch_xml_t x_tag; int toff = 0; @@ -4104,7 +4104,7 @@ static void conference_xlist(conference_obj_t *conference, switch_xml_t x_confer uuid = switch_core_session_get_uuid(member->session); channel = switch_core_session_get_channel(member->session); profile = switch_channel_get_caller_profile(channel); - name = switch_channel_get_name(channel); + //name = switch_channel_get_name(channel); x_member = switch_xml_add_child_d(x_members, "member", moff++); @@ -5661,7 +5661,7 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference SWITCH_STANDARD_APP(conference_function) { switch_codec_t *read_codec = NULL; - uint32_t flags = 0; + //uint32_t flags = 0; conference_member_t member = { 0 }; conference_obj_t *conference = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -6049,7 +6049,7 @@ SWITCH_STANDARD_APP(conference_function) member.pool = switch_core_session_get_pool(session); if (setup_media(&member, conference)) { - flags = 0; + //flags = 0; goto done; } @@ -6338,7 +6338,6 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c uint32_t announce_count = 0; char *maxmember_sound = NULL; uint32_t rate = 8000, interval = 20; - switch_status_t status; int comfort_noise_level = 0; char *suppress_events = NULL; char *verbose_events = NULL; @@ -6552,7 +6551,6 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c /* Setup a memory pool to use. */ if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n"); - status = SWITCH_STATUS_TERM; conference = NULL; goto end; } @@ -6561,7 +6559,6 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c /* Create the conference object. */ if (!(conference = switch_core_alloc(pool, sizeof(*conference)))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - status = SWITCH_STATUS_TERM; conference = NULL; goto end; } diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 5d51ffdb60..5b982111d5 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -2298,14 +2298,14 @@ SWITCH_STANDARD_APP(record_function) char *path; switch_input_args_t args = { 0 }; switch_file_handle_t fh = { 0 }; - int argc; + //int argc; char *mydata, *argv[4] = { 0 }; char *l = NULL; const char *tmp; int rate; if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) { - argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No file specified.\n"); return; @@ -2490,7 +2490,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) const char *transfer_on_fail = NULL; char *tof_data = NULL; char *tof_array[4] = { 0 }; - int tof_arrayc = 0; + //int tof_arrayc = 0; const char *continue_on_fail = NULL, *failure_causes = NULL, *v_campon = NULL, *v_campon_retries, *v_campon_sleep, *v_campon_timeout, *v_campon_fallback_exten = NULL; switch_call_cause_t cause = SWITCH_CAUSE_NORMAL_CLEARING; @@ -2510,7 +2510,7 @@ SWITCH_STANDARD_APP(audio_bridge_function) transfer_on_fail = switch_channel_get_variable(caller_channel, "transfer_on_fail"); tof_data = switch_core_session_strdup(session, transfer_on_fail); - tof_arrayc = switch_split(tof_data, ' ', tof_array); + switch_split(tof_data, ' ', tof_array); transfer_on_fail = tof_array[0]; failure_causes = switch_channel_get_variable(caller_channel, "failure_causes"); diff --git a/src/mod/applications/mod_esf/mod_esf.c b/src/mod/applications/mod_esf/mod_esf.c index a2f8ddb8cd..39952f2a8c 100644 --- a/src/mod/applications/mod_esf/mod_esf.c +++ b/src/mod/applications/mod_esf/mod_esf.c @@ -71,7 +71,7 @@ SWITCH_STANDARD_APP(bcast_function) switch_port_t rtp_port; char guess_ip[25]; ls_how_t ready = SEND_TYPE_UNKNOWN; - int argc; + //int argc; char *mydata, *argv[5]; char *mcast_ip = "224.168.168.168"; switch_port_t mcast_port = 34567; @@ -87,7 +87,7 @@ SWITCH_STANDARD_APP(bcast_function) mydata = switch_core_session_strdup(session, data); assert(mydata != NULL); - argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); if ((var = switch_channel_get_variable(channel, "esf_multicast_ip"))) { mcast_ip = switch_core_session_strdup(session, var); diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index dd945b9bc7..a0a1f9df56 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -1167,7 +1167,7 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1]; switch_call_cause_t cancel_cause = 0; char *uuid_list = NULL; - int connected = 0, total = 0; + int total = 0; const char *codec; struct call_helper *rows[MAX_ROWS] = { 0 }; int rowcount = 0; @@ -1417,8 +1417,6 @@ static void *SWITCH_THREAD_FUNC ringall_thread_run(switch_thread_t *thread, void goto end; } - connected = 1; - channel = switch_core_session_get_channel(session); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { @@ -1513,7 +1511,6 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) switch_status_t status = SWITCH_STATUS_FALSE; switch_event_t *event = NULL; char *sql = NULL; - int connected = 0; if (!globals.running) return NULL; @@ -1592,8 +1589,6 @@ static void *SWITCH_THREAD_FUNC o_thread_run(switch_thread_t *thread, void *obj) goto end; } - connected = 1; - channel = switch_core_session_get_channel(session); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index cfabf5477a..f9b808fad1 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -611,7 +611,7 @@ SWITCH_STANDARD_API(hash_dump_function) #define HASH_REMOTE_SYNTAX "list|kill [name]|rescan" SWITCH_STANDARD_API(hash_remote_function) { - int argc; + //int argc; char *argv[10]; char *dup = NULL; @@ -622,7 +622,7 @@ SWITCH_STANDARD_API(hash_remote_function) dup = strdup(cmd); - argc = switch_split(dup, ' ', argv); + switch_split(dup, ' ', argv); if (argv[0] && !strcmp(argv[0], "list")) { switch_hash_index_t *hi; stream->write_function(stream, "Remote connections:\nName\t\t\tState\n"); diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 95eefd5c74..94d6bc752b 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -433,7 +433,6 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin { switch_frame_t out_frame = { 0 }; switch_core_session_t *session; - switch_channel_t *channel; pvt_t *pvt; uint8_t pkt[LOCAL_FAX_MAX_DATAGRAM]; int x; @@ -441,7 +440,6 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin pvt = (pvt_t *) user_data; session = pvt->session; - channel = switch_core_session_get_channel(session); /* we need to build a real packet here and make write_frame.packet and write_frame.packetlen point to it */ out_frame.flags = SFF_UDPTL_PACKET | SFF_PROXY_PACKET; diff --git a/src/mod/applications/mod_spandsp/udptl.c b/src/mod/applications/mod_spandsp/udptl.c index f5b3be2445..cde248c3d9 100644 --- a/src/mod/applications/mod_spandsp/udptl.c +++ b/src/mod/applications/mod_spandsp/udptl.c @@ -61,7 +61,6 @@ static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8 int octet_cnt; int octet_idx; int stat; - int i; const uint8_t **pbuf; for (octet_idx = 0, *p_num_octets = 0;; octet_idx += octet_cnt) { @@ -71,7 +70,6 @@ static int decode_open_type(const uint8_t *buf, int limit, int *len, const uint8 *p_num_octets += octet_cnt; pbuf = &p_object[octet_idx]; - i = 0; /* Make sure the buffer contains at least the number of bits requested */ if ((*len + octet_cnt) > limit) return -1; diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 94b6985f26..87008f9bc6 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2414,7 +2414,6 @@ static switch_status_t deliver_vm(vm_profile_t *profile, char *vm_email = NULL; char *vm_email_from = NULL; char *vm_notify_email = NULL; - char *email_addr = NULL; char *vm_timezone = NULL; int send_mail = 0; int send_main = 0; @@ -2479,8 +2478,6 @@ static switch_status_t deliver_vm(vm_profile_t *profile, vm_notify_email = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "vm-mailfrom")) { vm_email_from = switch_core_strdup(pool, val); - } else if (!strcasecmp(var, "email-addr")) { - email_addr = switch_core_strdup(pool, val); } else if (!strcasecmp(var, "vm-email-all-messages") && (send_main = switch_true(val))) { send_mail++; } else if (!strcasecmp(var, "vm-notify-email-all-messages") && (send_notify = switch_true(val))) { @@ -2987,8 +2984,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p int send_mail = 0; cc_t cc = { 0 }; char *read_flags = NORMAL_FLAG_STRING; - int priority = 3; - int email_attach = 1; char *operator_ext = NULL; char buf[2]; char key_buf[80]; @@ -3003,7 +2998,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p char *record_macro = VM_RECORD_MESSAGE_MACRO; int send_main = 0; int send_notify = 0; - int insert_db = 1; const char *read_id = NULL; const char *caller_id_name = NULL; const char *caller_id_number = NULL; @@ -3060,10 +3054,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p vm_storage_dir = switch_core_session_strdup(session, val); } else if (!strcasecmp(var, "vm-notify-email-all-messages") && (send_notify = switch_true(val))) { send_mail++; - } else if (!strcasecmp(var, "vm-keep-local-after-email")) { - insert_db = switch_true(val); - } else if (!strcasecmp(var, "vm-attach-file")) { - email_attach = switch_true(val); } else if (!strcasecmp(var, "vm-disk-quota")) { disk_quota = atoi(val); } else if (!strcasecmp(var, "vm-alternate-greet-id")) { @@ -3103,11 +3093,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Falling back to leaving message locally due to too many misconfiguration.\n"); send_mail = 0; - insert_db = 1; - } - - if (send_notify && !send_main) { - insert_db = 1; } } else { @@ -3289,7 +3274,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p (void) vm_macro_get(session, VM_RECORD_URGENT_CHECK_MACRO, key_buf, input, sizeof(input), 1, "", &term, profile->digit_timeout); if (*profile->urgent_key == *input) { read_flags = URGENT_FLAG_STRING; - priority = 1; (void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "marked-urgent", NULL, NULL); } else { (void) switch_ivr_phrase_macro(session, VM_ACK_MACRO, "saved", NULL, NULL); @@ -3331,7 +3315,6 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p SWITCH_STANDARD_APP(voicemail_function) { - int argc = 0; char *argv[6] = { 0 }; char *mydata = NULL; vm_profile_t *profile = NULL; @@ -3345,7 +3328,7 @@ SWITCH_STANDARD_APP(voicemail_function) if (!zstr(data)) { mydata = switch_core_session_strdup(session, data); - argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } for (;;) { @@ -4359,7 +4342,6 @@ SWITCH_STANDARD_API(voicemail_list_api_function) #define VOICEMAIL_SYNTAX "rss [ ] | [load|unload|reload] [reloadxml]" SWITCH_STANDARD_API(voicemail_api_function) { - int argc = 0; char *mydata = NULL, *argv[6]; char *host = NULL, *port = NULL, *uri = NULL; char *user = NULL, *domain = NULL; @@ -4371,7 +4353,7 @@ SWITCH_STANDARD_API(voicemail_api_function) void *val = NULL; switch_xml_t xml_root; const char *err; - + int argc = 0; if (session) { return SWITCH_STATUS_FALSE; @@ -4588,7 +4570,6 @@ SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function) char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -4598,7 +4579,7 @@ SWITCH_STANDARD_API(vm_fsdb_pref_greeting_set_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -4673,7 +4654,6 @@ SWITCH_STANDARD_API(vm_fsdb_pref_recname_set_function) char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -4683,7 +4663,7 @@ SWITCH_STANDARD_API(vm_fsdb_pref_recname_set_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -4756,7 +4736,6 @@ SWITCH_STANDARD_API(vm_fsdb_pref_password_set_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -4766,7 +4745,7 @@ SWITCH_STANDARD_API(vm_fsdb_pref_password_set_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -4821,7 +4800,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_list_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -4831,7 +4809,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_list_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[1]) @@ -4879,7 +4857,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_purge_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -4889,7 +4866,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_purge_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -4929,7 +4906,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_delete_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -4939,7 +4915,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_delete_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -4981,7 +4957,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_save_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -4991,7 +4966,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_save_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -5032,7 +5007,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_undelete_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -5042,7 +5016,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_undelete_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -5083,7 +5057,6 @@ SWITCH_STANDARD_API(vm_fsdb_auth_login_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -5100,7 +5073,7 @@ SWITCH_STANDARD_API(vm_fsdb_auth_login_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[0]) @@ -5188,7 +5161,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_get_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -5198,7 +5170,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_get_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[1]) @@ -5252,7 +5224,6 @@ SWITCH_STANDARD_API(vm_fsdb_msg_count_function) const char *id = NULL, *domain = NULL, *profile_name = NULL; vm_profile_t *profile = NULL; - int argc = 0; char *argv[6] = { 0 }; char *mycmd = NULL; @@ -5262,7 +5233,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_count_function) if (!zstr(cmd)) { mycmd = switch_core_strdup(pool, cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } if (argv[1]) diff --git a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c index 3bc5cb4a3d..4e62a00da8 100644 --- a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c +++ b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c @@ -164,7 +164,6 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt) int argc; char *argv[3] = { 0 }; char *pattern = NULL; - char *pri = NULL; char *app = NULL; char *argument = NULL; char *expression = NULL, expression_buf[1024] = ""; @@ -242,7 +241,7 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt) switch_channel_set_variable(channel, "CHANNEL", switch_channel_get_name(channel)); switch_channel_set_variable(channel, "UNIQUEID", switch_core_session_get_uuid(session)); - pri = argv[1]; + //pri = argv[1]; app = argv[2]; if ((argument = strchr(app, '('))) { diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index bcc8f75692..e18c0ea3c0 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -766,7 +766,6 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw { private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); - int payload = 0; switch_assert(tech_pvt != NULL); @@ -810,8 +809,6 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw return status; } - payload = tech_pvt->video_read_frame.payload; - if (tech_pvt->video_read_frame.datalen > 0) { break; } @@ -867,7 +864,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f { private_object_t *tech_pvt = switch_core_session_get_private(session); switch_channel_t *channel = switch_core_session_get_channel(session); - int payload = 0; uint32_t sanity = 1000; switch_rtcp_frame_t rtcp_frame; @@ -979,8 +975,6 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f return SWITCH_STATUS_SUCCESS; } - payload = tech_pvt->read_frame.payload; - if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) { switch_dtmf_t dtmf = { 0 }; switch_rtp_dequeue_dtmf(tech_pvt->rtp_session, &dtmf); @@ -1859,13 +1853,13 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1]; char *arg = NULL; char *argv[2] = { 0 }; - int argc; + //int argc; if (zstr(name) && !zstr(msg->string_arg)) { arg = strdup(msg->string_arg); switch_assert(arg); - argc = switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0]))); name = argv[0]; number = argv[1]; @@ -4910,7 +4904,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor switch_console_callback_match_t *my_matches = NULL; switch_status_t status = SWITCH_STATUS_FALSE; char *dup = NULL; - int argc; + //int argc; char *argv[4] = { 0 }; if (zstr(line)) { @@ -4918,7 +4912,7 @@ static switch_status_t list_profile_gateway(const char *line, const char *cursor } dup = strdup(line); - argc = switch_split(dup, ' ', argv); + switch_split(dup, ' ', argv); if (zstr(argv[2]) || !strcmp(argv[2], " ")) { goto end; diff --git a/src/mod/endpoints/mod_sofia/sip-dig.c b/src/mod/endpoints/mod_sofia/sip-dig.c index d0c9aa6aff..556abae96d 100644 --- a/src/mod/endpoints/mod_sofia/sip-dig.c +++ b/src/mod/endpoints/mod_sofia/sip-dig.c @@ -210,17 +210,14 @@ void _usage(int exitcode, switch_stream_handle_t *stream) switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_core_session_t *session, _In_ switch_stream_handle_t *stream) { - int exitcode = 0; int o_sctp = 1, o_tls_sctp = 1, o_verbatim = 1; int family = 0, multiple = 0; - char const *dnsserver = NULL; char const *string; url_t *uri = NULL; char const *host; char const *port; char *transport = NULL, tport[32]; - int argc; char *argv_[25] = { 0 }; char *mycmd = NULL; char **argv; @@ -239,7 +236,7 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor mycmd = strdup(cmd); - argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv_) / sizeof(argv_[0])) - 1); + switch_separate_string(mycmd, ' ', argv, (sizeof(argv_) / sizeof(argv_[0])) - 1); argv = argv_; @@ -321,10 +318,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor if (!family) dig->ip4 = 1, dig->ip6 = 2; - if (argv[1] && argv[1][0] == '@') - dnsserver = argv++[1] + 1; - - if (!argv[1]) {usage(2);} @@ -360,7 +353,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor if (!uri || (uri->url_type != url_sip && uri->url_type != url_sips)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid uri\n", string); - exitcode = 1; continue; } @@ -387,7 +379,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor if (!host_is_domain(host)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s: invalid host\n", string); - exitcode = 1; continue; } @@ -402,7 +393,6 @@ switch_status_t sip_dig_function(_In_opt_z_ const char *cmd, _In_opt_ switch_cor continue /* resolved a/aaaa */; stream->write_function(stream, "-ERR: %s: not found\n", string); - exitcode = 1; } if (xml) { diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 5b8896b7f4..992757c526 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -1457,7 +1457,7 @@ switch_thread_t *launch_sofia_worker_thread(sofia_profile_t *profile) void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void *obj) { sofia_profile_t *profile = (sofia_profile_t *) obj; - switch_memory_pool_t *pool; + //switch_memory_pool_t *pool; sip_alias_node_t *node; switch_event_t *s_event; int use_100rel = !sofia_test_pflag(profile, PFLAG_DISABLE_100REL); @@ -1717,7 +1717,7 @@ void *SWITCH_THREAD_FUNC sofia_profile_thread_run(switch_thread_t *thread, void su_home_unref(profile->home); su_root_destroy(profile->s_root); - pool = profile->pool; + //pool = profile->pool; sofia_glue_del_profile(profile); switch_core_hash_destroy(&profile->chat_hash); @@ -5581,7 +5581,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t { /* Incoming refer */ sip_from_t const *from; - sip_to_t const *to; + //sip_to_t const *to; sip_refer_to_t const *refer_to; private_object_t *tech_pvt = switch_core_session_get_private(session); char *etmp = NULL, *exten = NULL; @@ -5604,7 +5604,7 @@ void sofia_handle_sip_i_refer(nua_t *nua, sofia_profile_t *profile, nua_handle_t } from = sip->sip_from; - to = sip->sip_to; + //to = sip->sip_to; home = su_home_new(sizeof(*home)); switch_assert(home != NULL); @@ -6374,7 +6374,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ const char *displayname = NULL; const char *destination_number = NULL; const char *from_user = NULL, *from_host = NULL; - const char *referred_by_user = NULL, *referred_by_host = NULL; + const char *referred_by_user = NULL;//, *referred_by_host = NULL; const char *context = NULL; const char *dialplan = NULL; char network_ip[80]; @@ -6905,7 +6905,7 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ if (sip->sip_referred_by) { referred_by_user = sip->sip_referred_by->b_url->url_user; - referred_by_host = sip->sip_referred_by->b_url->url_host; + //referred_by_host = sip->sip_referred_by->b_url->url_host; channel_name = url_set_chanvars(session, sip->sip_referred_by->b_url, sip_referred_by); check_decode(referred_by_user, session); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 3c08f37011..3b750761aa 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2662,9 +2662,7 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); return SWITCH_STATUS_FALSE; } else { - int ms; tech_pvt->video_read_frame.rate = tech_pvt->video_rm_rate; - ms = tech_pvt->video_write_codec.implementation->microseconds_per_packet / 1000; switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n", switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms); tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec; @@ -2689,7 +2687,6 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) { - int ms; switch_status_t status = SWITCH_STATUS_SUCCESS; int resetting = 0; @@ -2782,7 +2779,6 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force) } tech_pvt->read_frame.rate = tech_pvt->rm_rate; - ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000; if (!switch_core_codec_ready(&tech_pvt->read_codec)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); @@ -2865,7 +2861,6 @@ switch_status_t sofia_glue_build_crypto(private_object_t *tech_pvt, int index, s switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *key_str, switch_rtp_crypto_direction_t direction) { unsigned char key[SWITCH_RTP_MAX_CRYPTO_LEN]; - int index; switch_rtp_crypto_key_type_t type; char *p; @@ -2874,8 +2869,6 @@ switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *ke goto bad; } - index = atoi(key_str); - p = strchr(key_str, ' '); if (p && *p && *(p + 1)) { @@ -2922,7 +2915,6 @@ switch_status_t sofia_glue_add_crypto(private_object_t *tech_pvt, const char *ke switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_flag_t myflags) { - int bw, ms; const char *err = NULL; const char *val = NULL; switch_rtp_flag_t flags; @@ -2963,9 +2955,6 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f goto end; } - bw = tech_pvt->read_impl.bits_per_second; - ms = tech_pvt->read_impl.microseconds_per_packet; - if (myflags) { flags = myflags; } else if (!sofia_test_pflag(tech_pvt->profile, PFLAG_DISABLE_RTP_AUTOADJ) && @@ -4095,7 +4084,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp) sdp_session_t *sdp; private_object_t *tech_pvt = switch_core_session_get_private(session); sdp_attribute_t *attr; - int ptime = 0, dptime = 0, dmaxptime = 0, maxptime = 0; + int ptime = 0, dptime = 0; if (!(parser = sdp_parse(NULL, r_sdp, (int) strlen(r_sdp), 0))) { return; @@ -4116,8 +4105,6 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp) if (!strcasecmp(attr->a_name, "ptime")) { dptime = atoi(attr->a_value); - } else if (!strcasecmp(attr->a_name, "maxptime")) { - dmaxptime = atoi(attr->a_value); } } @@ -4125,7 +4112,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp) for (m = sdp->sdp_media; m; m = m->m_next) { ptime = dptime; - maxptime = dmaxptime; + //maxptime = dmaxptime; if (m->m_proto == sdp_proto_rtp) { sdp_rtpmap_t *map; @@ -4133,7 +4120,7 @@ void sofia_glue_proxy_codec(switch_core_session_t *session, const char *r_sdp) if (!strcasecmp(attr->a_name, "ptime") && attr->a_value) { ptime = atoi(attr->a_value); } else if (!strcasecmp(attr->a_name, "maxptime") && attr->a_value) { - maxptime = atoi(attr->a_value); + //maxptime = atoi(attr->a_value); } } @@ -4803,7 +4790,6 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s } else if (m->m_type == sdp_media_video && m->m_port) { sdp_rtpmap_t *map; const char *rm_encoding; - int framerate = 0; const switch_codec_implementation_t *mimp = NULL; int vmatch = 0, i; switch_channel_set_variable(tech_pvt->channel, "video_possible", "true"); @@ -4823,7 +4809,7 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, const char *r_s for (attr = m->m_attributes; attr; attr = attr->a_next) { if (!strcasecmp(attr->a_name, "framerate") && attr->a_value) { - framerate = atoi(attr->a_value); + //framerate = atoi(attr->a_value); } if (!strcasecmp(attr->a_name, "rtcp") && attr->a_value) { switch_channel_set_variable(tech_pvt->channel, "sip_remote_video_rtcp_port", attr->a_value); @@ -6253,7 +6239,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use contact = sofia_glue_get_url_from_contact((char *) o_contact, 1); if (!zstr(network_ip) && sofia_glue_check_nat(profile, network_ip)) { char *ptr = NULL; - const char *transport_str = NULL; + //const char *transport_str = NULL; id = switch_mprintf("sip:%s@%s", user, profile->extsipip); @@ -6261,7 +6247,7 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use if ((ptr = sofia_glue_find_parameter(o_contact, "transport="))) { sofia_transport_t transport = sofia_glue_str2transport(ptr); - transport_str = sofia_glue_transport2str(transport); + //transport_str = sofia_glue_transport2str(transport); switch (transport) { case SOFIA_TRANSPORT_TCP: contact_str = profile->tcp_public_contact; @@ -6469,7 +6455,7 @@ void sofia_glue_parse_rtp_bugs(uint32_t *flag_pole, const char *str) char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sofia_nat_parse_t *np) { char *contact_str = NULL; - const char *contact_host, *contact_user; + const char *contact_host;//, *contact_user; sip_contact_t const *contact; char *port; const char *display = "\"user\""; @@ -6497,7 +6483,7 @@ char *sofia_glue_gen_contact_str(sofia_profile_t *profile, sip_t const *sip, sof port = (char *) contact->m_url->url_port; contact_host = sip->sip_contact->m_url->url_host; - contact_user = sip->sip_contact->m_url->url_user; + //contact_user = sip->sip_contact->m_url->url_user; display = contact->m_display; diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index cbc45024e1..fdc3bd4d9a 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -208,10 +208,10 @@ switch_status_t sofia_presence_chat_send(const char *proto, const char *from, co if (!zstr(remote_ip) && sofia_glue_check_nat(profile, remote_ip)) { char *ptr = NULL; - const char *transport_str = NULL; + //const char *transport_str = NULL; if ((ptr = sofia_glue_find_parameter(dst->contact, "transport="))) { sofia_transport_t transport = sofia_glue_str2transport(ptr); - transport_str = sofia_glue_transport2str(transport); + //transport_str = sofia_glue_transport2str(transport); switch (transport) { case SOFIA_TRANSPORT_TCP: contact_str = profile->tcp_public_contact; @@ -2059,7 +2059,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, tagi_t tags[]) { - long exp_abs, exp_delta; + long exp_delta; char exp_delta_str[30] = ""; sip_to_t const *to; const char *from_user = NULL, *from_host = NULL; @@ -2080,7 +2080,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, int sent_reply = 0; sip_contact_t const *contact; const char *ipv6; - const char *contact_host, *contact_user; + const char *contact_user; sofia_nat_parse_t np = { { 0 } }; if (!sip) { @@ -2095,7 +2095,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, return; } - contact_host = sip->sip_contact->m_url->url_host; + //contact_host = sip->sip_contact->m_url->url_host; contact_user = sip->sip_contact->m_url->url_user; tl_gets(tags, NUTAG_SUBSTATE_REF(sub_state), TAG_END()); @@ -2142,10 +2142,7 @@ void sofia_presence_handle_sip_i_subscribe(int status, } } - if (exp_delta) { - exp_abs = (long) switch_epoch_time_now(NULL) + exp_delta; - } else { - exp_abs = 0; + if (!exp_delta) { sub_state = nua_substate_terminated; } @@ -2773,9 +2770,7 @@ void sofia_presence_handle_sip_i_message(int status, sip_to_t const *to = sip->sip_to; const char *to_user = NULL; const char *to_host = NULL; - sip_subject_t const *sip_subject = sip->sip_subject; sip_payload_t *payload = sip->sip_payload; - const char *subject = "n/a"; char *msg = NULL; if (sip->sip_content_type && sip->sip_content_type->c_subtype) { @@ -2802,14 +2797,9 @@ void sofia_presence_handle_sip_i_message(int status, msg = payload->pl_data; } - if (sip_subject) { - subject = sip_subject->g_value; - } - if (nh) { char hash_key[512]; private_object_t *tech_pvt; - switch_channel_t *channel; switch_event_t *event; char *to_addr; char *from_addr; @@ -2840,7 +2830,6 @@ void sofia_presence_handle_sip_i_message(int status, } if (sofia_test_pflag(profile, PFLAG_IN_DIALOG_CHAT) && (tech_pvt = (private_object_t *) switch_core_hash_find(profile->chat_hash, hash_key))) { - channel = switch_core_session_get_channel(tech_pvt->session); if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", SOFIA_CHAT_PROTO); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->url); diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index cac1d2f051..9130ceb569 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -852,7 +852,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand const char *reg_host = profile->reg_db_domain; const char *sub_host = profile->sub_domain; char contact_str[1024] = ""; - int nat_hack = 0; uint8_t multi_reg = 0, multi_reg_contact = 0, avoid_multi_reg = 0; uint8_t stale = 0, forbidden = 0; auth_res_t auth_res; @@ -863,7 +862,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand char network_ip[80]; char network_port_c[6]; char url_ip[80]; - char *register_gateway = NULL; int network_port; const char *reg_desc = "Registered"; const char *call_id = NULL; @@ -1094,8 +1092,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand avoid_multi_reg = 1; } - register_gateway = switch_event_get_header(*v_event, "sip-register-gateway"); - /* Allow us to force the SIP user to be something specific - needed if * we - for example - want to be able to ensure that the username a UA can * be contacted at is the same one that they used for authentication. @@ -1166,7 +1162,6 @@ uint8_t sofia_reg_handle_register(nua_t *nua, sofia_profile_t *profile, nua_hand reg_desc = "Registered(AUTO-NAT)"; exptime = 30; } - nat_hack = 1; } else { char *p; switch_copy_string(contact_str, v_contact_str, sizeof(contact_str)); diff --git a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c index c139c053b1..4ea128dd31 100644 --- a/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c +++ b/src/mod/event_handlers/mod_cdr_csv/mod_cdr_csv.c @@ -94,7 +94,6 @@ static void do_rotate(cdr_fd_t *fd) char date[80] = ""; switch_size_t retsize; char *p; - size_t len; close(fd->fd); fd->fd = -1; @@ -103,7 +102,7 @@ static void do_rotate(cdr_fd_t *fd) switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); - len = strlen(fd->path) + strlen(date) + 2; + p = switch_mprintf("%s.%s", fd->path, date); assert(p); switch_file_rename(fd->path, p, globals.pool); diff --git a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c index f6a02623a7..4fbdcc8b96 100644 --- a/src/mod/event_handlers/mod_event_socket/mod_event_socket.c +++ b/src/mod/event_handlers/mod_event_socket/mod_event_socket.c @@ -990,19 +990,19 @@ SWITCH_STANDARD_API(event_sink_function) stream->write_function(stream, "\n"); while (switch_queue_trypop(listener->event_queue, &pop) == SWITCH_STATUS_SUCCESS) { - char *etype; + //char *etype; pevent = (switch_event_t *) pop; if (listener->format == EVENT_FORMAT_PLAIN) { - etype = "plain"; + //etype = "plain"; switch_event_serialize(pevent, &listener->ebuf, SWITCH_TRUE); stream->write_function(stream, "\n%s", listener->ebuf); } else if (listener->format == EVENT_FORMAT_JSON) { - etype = "json"; + //etype = "json"; switch_event_serialize_json(pevent, &listener->ebuf); } else { switch_xml_t xml; - etype = "xml"; + //etype = "xml"; if ((xml = switch_event_xmlize(pevent, SWITCH_VA_NONE))) { listener->ebuf = switch_xml_toxml(xml, SWITCH_FALSE); diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index ea94bd1cd6..4f36e20128 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -758,7 +758,7 @@ SWITCH_STANDARD_API(start_local_stream_function) char *mycmd = NULL, *argv[8] = { 0 }; char *local_stream_name = NULL, *path = NULL, *timer_name = NULL; uint32_t prebuf = 1; - int rate = 8000, shuffle = 1, interval = 20; + int rate = 8000, interval = 20; uint8_t channels = 1; int argc = 0; char *cf = "local_stream.conf"; @@ -790,7 +790,7 @@ SWITCH_STANDARD_API(start_local_stream_function) } } - shuffle = argv[3] ? switch_true(argv[3]) : 1; + //shuffle = argv[3] ? switch_true(argv[3]) : 1; prebuf = argv[4] ? atoi(argv[4]) : DEFAULT_PREBUFFER_SIZE; if (argv[5]) { @@ -833,8 +833,8 @@ SWITCH_STANDARD_API(start_local_stream_function) if (tmp == 8000 || tmp == 16000 || tmp == 32000) { rate = tmp; } - } else if (!strcasecmp(var, "shuffle")) { - shuffle = switch_true(val); + //} else if (!strcasecmp(var, "shuffle")) { + //shuffle = switch_true(val); } else if (!strcasecmp(var, "prebuf")) { tmp = atoi(val); if (tmp > 0) { diff --git a/src/mod/formats/mod_sndfile/mod_sndfile.c b/src/mod/formats/mod_sndfile/mod_sndfile.c index d2c53f0ba1..5b011dccb2 100644 --- a/src/mod/formats/mod_sndfile/mod_sndfile.c +++ b/src/mod/formats/mod_sndfile/mod_sndfile.c @@ -339,7 +339,6 @@ static char **supported_formats; static switch_status_t setup_formats(void) { SF_FORMAT_INFO info; - SF_INFO sfinfo; char buffer[128]; int format, major_count, subtype_count, m, s; int len, x, skip; @@ -358,7 +357,7 @@ static switch_status_t setup_formats(void) sf_command(NULL, SFC_GET_FORMAT_MAJOR_COUNT, &major_count, sizeof(int)); sf_command(NULL, SFC_GET_FORMAT_SUBTYPE_COUNT, &subtype_count, sizeof(int)); - sfinfo.channels = 1; + //sfinfo.channels = 1; len = ((major_count + (exlen + 2)) * sizeof(char *)); supported_formats = switch_core_permanent_alloc(len); @@ -402,7 +401,7 @@ static switch_status_t setup_formats(void) info.format = s; sf_command(NULL, SFC_GET_FORMAT_SUBTYPE, &info, sizeof(info)); format = (format & SF_FORMAT_TYPEMASK) | info.format; - sfinfo.format = format; + //sfinfo.format = format; /* if (sf_format_check(&sfinfo)) { switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_DEBUG, " %s\n", info.name); diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 1a57f5f2ae..7341a2b1e1 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -766,11 +766,8 @@ static JSBool dtmf_construct(JSContext * cx, JSObject * obj, uintN argc, jsval * { switch_dtmf_t *dtmf; int32 duration = switch_core_default_dtmf_duration(0); - char *ename; - if (argc > 0) { - ename = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); - } else { + if (argc <= 0) { eval_some_js("~throw new Error(\"Invalid Args\");", cx, obj, rval); return JS_FALSE; } @@ -1911,7 +1908,6 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval * char *tts_name = NULL; char *voice_name = NULL; char *text = NULL; - switch_codec_t *codec; void *bp = NULL; int len = 0; struct input_callback_state cb_state = { 0 }; @@ -1979,7 +1975,6 @@ static JSBool session_speak(JSContext * cx, JSObject * obj, uintN argc, jsval * } } - codec = switch_core_session_get_read_codec(jss->session); cb_state.ret = BOOLEAN_TO_JSVAL(JS_FALSE); cb_state.saveDepth = JS_SuspendRequest(cx); args.input_callback = dtmf_func; @@ -2281,13 +2276,12 @@ static JSBool session_detach(JSContext * cx, JSObject * obj, uintN argc, jsval * static JSBool session_execute(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) { JSBool retval = JS_FALSE; - switch_channel_t *channel; + struct js_session *jss = JS_GetPrivate(cx, obj); jsval ret = JS_TRUE; METHOD_SANITY_CHECK(); - channel = switch_core_session_get_channel(jss->session); /* you can execute some apps before you answer CHANNEL_SANITY_CHECK(); */ if (argc > 0) { @@ -3498,7 +3492,6 @@ static JSBool js_bridge(JSContext * cx, JSObject * obj, uintN argc, jsval * argv struct js_session *jss_a = NULL, *jss_b = NULL; JSObject *session_obj_a = NULL, *session_obj_b = NULL; void *bp = NULL; - int len = 0; switch_input_callback_function_t dtmf_func = NULL; struct input_callback_state cb_state = { 0 }; JSFunction *function; @@ -3548,7 +3541,6 @@ static JSBool js_bridge(JSContext * cx, JSObject * obj, uintN argc, jsval * argv cb_state.session_state = jss_a; dtmf_func = js_collect_input_callback; bp = &cb_state; - len = sizeof(cb_state); } } diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 30889cad4c..e49d1d958e 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -239,6 +239,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) #endif int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); + wrote++; close(fd); fd = -1; } else { @@ -393,6 +394,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) #endif int wrote; wrote = write(fd, xml_text, (unsigned) strlen(xml_text)); + wrote++; close(fd); fd = -1; } else { diff --git a/src/switch.c b/src/switch.c index 7d4d1a8217..401829cf82 100644 --- a/src/switch.c +++ b/src/switch.c @@ -776,10 +776,10 @@ int main(int argc, char *argv[]) #if defined(HAVE_SETRLIMIT) && !defined(__sun) if (!waste && !(flags & SCF_VG)) { - int x; + //int x; memset(&rlp, 0, sizeof(rlp)); - x = getrlimit(RLIMIT_STACK, &rlp); + getrlimit(RLIMIT_STACK, &rlp); if (rlp.rlim_max > SWITCH_THREAD_STACKSIZE) { char buf[1024] = ""; diff --git a/src/switch_channel.c b/src/switch_channel.c index 2a53c34e93..cfeb827949 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1193,16 +1193,10 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state) { - switch_channel_state_t state, mystate; for (;;) { - if (other_channel) { - state = switch_channel_get_running_state(other_channel); - } - mystate = switch_channel_get_running_state(channel); - if ((channel->state == channel->running_state && channel->running_state == want_state) || - (other_channel && other_channel->state >= CS_HANGUP) || channel->state >= CS_HANGUP) { + switch_channel_down(other_channel) || switch_channel_down(channel)) { break; } switch_yield(20000); @@ -1212,11 +1206,10 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw SWITCH_DECLARE(void) switch_channel_wait_for_state_timeout(switch_channel_t *channel, switch_channel_state_t want_state, uint32_t timeout) { - switch_channel_state_t state; + uint32_t count = 0; for (;;) { - state = switch_channel_get_running_state(channel); if ((channel->state == channel->running_state && channel->running_state == want_state) || channel->state >= CS_HANGUP) { break; @@ -3360,7 +3353,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_time_t answerusec = 0; switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0; time_t tt_created = 0, tt_answered = 0, tt_resurrected = 0, - tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_resurrected = 0, + tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0; void *pop; char dtstr[SWITCH_DTMF_LOG_LEN + 1] = ""; @@ -3476,7 +3469,6 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_channel_set_variable(channel, "answer_uepoch", tmp); tt_resurrected = (time_t) (caller_profile->times->resurrected / 1000000); - mtt_resurrected = (time_t) (caller_profile->times->resurrected / 1000); switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_resurrected); switch_channel_set_variable(channel, "resurrect_epoch", tmp); switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->resurrected); diff --git a/src/switch_core.c b/src/switch_core.c index ef5d1c497d..740b0629b5 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -1280,6 +1280,7 @@ static void switch_core_set_serial(void) if ((write_fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) >= 0) { bytes = write(write_fd, buf, sizeof(buf)); + bytes++; close(write_fd); write_fd = -1; } diff --git a/src/switch_core_file.c b/src/switch_core_file.c index fc7d223b5b..2186555386 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -204,7 +204,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, void *data, switch_size_t *len) { switch_status_t status = SWITCH_STATUS_FALSE; - switch_size_t want, got, orig_len = *len; + switch_size_t want, orig_len = *len; switch_assert(fh != NULL); switch_assert(fh->file_interface != NULL); @@ -276,8 +276,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_read(switch_file_handle_t *fh, } - got = *len; - if (!switch_test_flag(fh, SWITCH_FILE_NATIVE) && fh->native_rate != fh->samplerate) { if (!fh->resampler) { if (switch_resample_create(&fh->resampler, @@ -567,14 +565,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh) if (fh->spool_path) { char *command; - int result; #ifdef _MSC_VER command = switch_mprintf("move %s %s", fh->spool_path, fh->file_path); #else command = switch_mprintf("/bin/mv %s %s", fh->spool_path, fh->file_path); #endif - result = system(command); + system(command); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Copy spooled file [%s] to [%s]\n", fh->spool_path, fh->file_path); free(command); } diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index 1e7b260078..5cc28a3c88 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -511,7 +511,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *session) { switch_media_bug_t *bp = NULL, *last = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; int ttl = 0; @@ -540,7 +539,7 @@ SWITCH_DECLARE(uint32_t) switch_core_media_bug_prune(switch_core_session_t *sess switch_thread_rwlock_unlock(session->bug_rwlock); if (bp) { - status = switch_core_media_bug_close(&bp); + switch_core_media_bug_close(&bp); ttl++; goto top; } diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 2080c0b624..8d4a2851f3 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -481,15 +481,13 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ UNPROTECT_INTERFACE(endpoint_interface); return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; } else { - switch_caller_profile_t *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL; + switch_caller_profile_t *profile = NULL, *cloned_profile = NULL; switch_event_t *event; switch_channel_t *peer_channel = switch_core_session_get_channel(*new_session); const char *use_uuid; switch_assert(peer_channel); - peer_profile = switch_channel_get_caller_profile(peer_channel); - if ((use_uuid = switch_event_get_header(var_event, "origination_uuid"))) { use_uuid = switch_core_session_strdup(*new_session, use_uuid); if (switch_core_session_set_uuid(*new_session, use_uuid) == SWITCH_STATUS_SUCCESS) { @@ -1454,13 +1452,12 @@ SWITCH_DECLARE(switch_core_session_t *) switch_core_session_request_xml(switch_e switch_channel_t *channel; switch_xml_t tag, tag2, tag3, vars, callflow; switch_call_direction_t direction = SWITCH_CALL_DIRECTION_OUTBOUND; - char *bridgeto, *flag_str = NULL, *cap_str = NULL, *direction_s = NULL, *uuid = NULL; + char *flag_str = NULL, *cap_str = NULL, *direction_s = NULL, *uuid = NULL; uint32_t flags[CF_FLAG_MAX] = { 0 }; uint32_t caps[CC_FLAG_MAX] = { 0 }; int i; vars = switch_xml_child(xml, "variables"); - bridgeto = xml_find_var(vars, SWITCH_SIGNAL_BOND_VARIABLE); uuid = xml_find_var(vars, "uuid"); if ((tag = switch_xml_child(xml, "channel_data"))) { diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 825f2d30cd..64be6b7f14 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -299,14 +299,11 @@ static void *SWITCH_THREAD_FUNC unicast_thread_run(switch_thread_t *thread, void { switch_unicast_conninfo_t *conninfo = (switch_unicast_conninfo_t *) obj; switch_size_t len; - switch_channel_t *channel; if (!conninfo) { return NULL; } - channel = switch_core_session_get_channel(conninfo->session); - while (switch_test_flag(conninfo, SUF_READY) && switch_test_flag(conninfo, SUF_THREAD_RUNNING)) { len = conninfo->write_frame.buflen; if (switch_socket_recv(conninfo->socket, conninfo->write_frame.data, &len) != SWITCH_STATUS_SUCCESS || len == 0) { @@ -1363,11 +1360,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_media(const char *uuid, switch_media_ switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 250, NULL); switch_yield(250000); } else { - switch_status_t st; switch_channel_wait_for_flag(channel, CF_REQ_MEDIA, SWITCH_FALSE, 10000, NULL); switch_channel_wait_for_flag(channel, CF_MEDIA_ACK, SWITCH_TRUE, 10000, NULL); switch_channel_wait_for_flag(channel, CF_MEDIA_SET, SWITCH_TRUE, 10000, NULL); - st = switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); + switch_core_session_read_frame(session, &read_frame, SWITCH_IO_FLAG_NONE, 0); } if ((flags & SMF_REBRIDGE) @@ -2274,7 +2270,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 switch_frame_t *read_frame, write_frame = { 0 }; switch_status_t status; switch_channel_t *channel = switch_core_session_get_channel(session); - uint32_t interval, samples; + uint32_t interval; uint32_t ts = 0; switch_codec_implementation_t read_impl = { 0 }; switch_core_session_get_read_impl(session, &read_impl); @@ -2286,7 +2282,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3 } interval = read_impl.microseconds_per_packet / 1000; - samples = switch_samples_per_packet(read_impl.samples_per_second, interval); + //samples = switch_samples_per_packet(read_impl.samples_per_second, interval); qlen = delay_ms / (interval); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen); diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 9fb2eea95c..016fee7246 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1637,7 +1637,6 @@ static switch_bool_t preprocess_callback(switch_media_bug_t *bug, void *user_dat pp_cb_t *cb = (pp_cb_t *) user_data; switch_codec_implementation_t read_impl = { 0 }; switch_frame_t *frame = NULL; - int y; switch_core_session_get_read_impl(session, &read_impl); @@ -1682,7 +1681,7 @@ static switch_bool_t preprocess_callback(switch_media_bug_t *bug, void *user_dat memcpy(frame->data, cb->read_out, frame->datalen); } - y = speex_preprocess_run(cb->read_st, frame->data); + speex_preprocess_run(cb->read_st, frame->data); } if (cb->write_ec) { @@ -1703,7 +1702,7 @@ static switch_bool_t preprocess_callback(switch_media_bug_t *bug, void *user_dat memcpy(frame->data, cb->write_out, frame->datalen); } - y = speex_preprocess_run(cb->write_st, frame->data); + speex_preprocess_run(cb->write_st, frame->data); } if (cb->read_ec) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index d10b5e0e5e..7dc8edfa2c 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -862,10 +862,9 @@ static switch_status_t hanguphook(switch_core_session_t *session) switch_core_session_message_t msg = { 0 }; switch_channel_t *channel = NULL; switch_event_t *event; - switch_channel_state_t state; channel = switch_core_session_get_channel(session); - state = switch_channel_get_state(channel); + msg.message_id = SWITCH_MESSAGE_INDICATE_UNBRIDGE; msg.from = __FILE__; diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 76cea5a666..bec7eb45a4 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -832,7 +832,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi } for (;;) { - int done = 0; switch_status_t status; if (!switch_channel_ready(channel)) { @@ -874,7 +873,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi if (switch_channel_has_dtmf(channel)) { if (!args->input_callback && !args->buf && !args->dmachine) { status = SWITCH_STATUS_BREAK; - done = 1; break; } switch_channel_dequeue_dtmf(channel, &dtmf); @@ -902,7 +900,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi } if (status != SWITCH_STATUS_SUCCESS) { - done = 1; break; } } @@ -1003,7 +1000,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess switch_status_t status = SWITCH_STATUS_SUCCESS; switch_file_handle_t lfh; const char *p; - char *title = "", *copyright = "", *software = "", *artist = "", *comment = "", *date = ""; + //char *title = "", *copyright = "", *software = "", *artist = "", *comment = "", *date = ""; char *ext; const char *prefix; const char *timer_name; @@ -1235,35 +1232,35 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess } if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_TITLE, &p) == SWITCH_STATUS_SUCCESS) { - title = switch_core_session_strdup(session, p); + //title = switch_core_session_strdup(session, p); switch_channel_set_variable(channel, "RECORD_TITLE", p); } if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COPYRIGHT, &p) == SWITCH_STATUS_SUCCESS) { - copyright = switch_core_session_strdup(session, p); + //copyright = switch_core_session_strdup(session, p); switch_channel_set_variable(channel, "RECORD_COPYRIGHT", p); } if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_SOFTWARE, &p) == SWITCH_STATUS_SUCCESS) { - software = switch_core_session_strdup(session, p); + //software = switch_core_session_strdup(session, p); switch_channel_set_variable(channel, "RECORD_SOFTWARE", p); } if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_ARTIST, &p) == SWITCH_STATUS_SUCCESS) { - artist = switch_core_session_strdup(session, p); + //artist = switch_core_session_strdup(session, p); switch_channel_set_variable(channel, "RECORD_ARTIST", p); } if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_COMMENT, &p) == SWITCH_STATUS_SUCCESS) { - comment = switch_core_session_strdup(session, p); + //comment = switch_core_session_strdup(session, p); switch_channel_set_variable(channel, "RECORD_COMMENT", p); } if (switch_core_file_get_string(fh, SWITCH_AUDIO_COL_STR_DATE, &p) == SWITCH_STATUS_SUCCESS) { - date = switch_core_session_strdup(session, p); + //date = switch_core_session_strdup(session, p); switch_channel_set_variable(channel, "RECORD_DATE", p); } - + interval = read_impl.microseconds_per_packet / 1000; if (!fh->audio_buffer) { @@ -2314,7 +2311,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses switch_status_t status = SWITCH_STATUS_SUCCESS; switch_speech_handle_t lsh, *sh; switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; - switch_codec_t *read_codec; const char *timer_name, *var; cached_speech_handle_t *cache_obj = NULL; int need_create = 1, need_alloc = 1; @@ -2355,7 +2351,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses timer_name = switch_channel_get_variable(channel, "timer_name"); switch_core_session_reset(session, SWITCH_FALSE, SWITCH_FALSE); - read_codec = switch_core_session_get_read_codec(session); rate = read_impl.actual_samples_per_second; interval = read_impl.microseconds_per_packet / 1000; diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 627aa46707..db4f4fa1dd 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -1681,11 +1681,11 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_ switch_mutex_lock(loadable_modules.mutex); for (x = 0; x < preflen; x++) { - char *cur, *last = NULL, *next = NULL, *name, *p, buf[256]; + char *cur, *next = NULL, *name, *p, buf[256]; uint32_t interval = 0, rate = 0, bit = 0; switch_copy_string(buf, prefs[x], sizeof(buf)); - last = name = next = cur = buf; + name = next = cur = buf; for (;;) { if (!next) { diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 15424b3153..13ce9639c8 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -2342,7 +2342,6 @@ static void do_flush(switch_rtp_t *rtp_session) { int was_blocking = 0; switch_size_t bytes; - switch_status_t status; if (!switch_rtp_ready(rtp_session) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || @@ -2377,7 +2376,7 @@ static void do_flush(switch_rtp_t *rtp_session) do { if (switch_rtp_ready(rtp_session)) { bytes = sizeof(rtp_msg_t); - status = switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes); + switch_socket_recvfrom(rtp_session->from_addr, rtp_session->sock_input, 0, (void *) &rtp_session->recv_msg, &bytes); if (bytes) { int do_cng = 0; @@ -3981,14 +3980,14 @@ SWITCH_DECLARE(int) switch_rtp_write_frame(switch_rtp_t *rtp_session, switch_fra if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_PROXY_MEDIA) || switch_test_flag(rtp_session, SWITCH_RTP_FLAG_UDPTL)) { switch_size_t bytes; - char bufa[30]; - const char *tx_host; + //char bufa[30]; + /* Fast PASS! */ if (!switch_test_flag(frame, SFF_PROXY_PACKET) && !switch_test_flag(frame, SFF_UDPTL_PACKET)) { return 0; } bytes = frame->packetlen; - tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->remote_addr); + //tx_host = switch_get_addr(bufa, sizeof(bufa), rtp_session->remote_addr); send_msg = frame->packet; diff --git a/src/switch_time.c b/src/switch_time.c index 9ec902f4d7..cfd3ec7602 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -794,6 +794,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(softtimer_runtime) uint64_t exp; int r; r = read(tfd, &exp, sizeof(exp)); + r++; } else { do_sleep(1000); } diff --git a/src/switch_xml.c b/src/switch_xml.c index 0ad8768cad..243494aa7c 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1851,7 +1851,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key, switch_xml_t *domain, switch_xml_t *user, switch_xml_t *ingroup, switch_event_t *params) { switch_status_t status = SWITCH_STATUS_FALSE; - switch_event_t *my_params = NULL, *search_params = NULL; + switch_event_t *my_params = NULL; switch_xml_t group = NULL, groups = NULL, users = NULL; *root = NULL; @@ -1888,10 +1888,6 @@ SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(const char *key, status = SWITCH_STATUS_FALSE; - if (params != my_params) { - search_params = params; - } - if ((groups = switch_xml_child(*domain, "groups"))) { for (group = switch_xml_child(groups, "group"); group; group = group->next) { if ((users = switch_xml_child(group, "users"))) { From ffb4a3ae44541cfe6611b75d669ba24c6bcceb8a Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Fri, 22 Apr 2011 15:27:54 -0700 Subject: [PATCH 359/558] config: Talking clock dialplan example (Thanks AviMarcus) --- conf/dialplan/default/01_Talking_Clock.xml | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 conf/dialplan/default/01_Talking_Clock.xml diff --git a/conf/dialplan/default/01_Talking_Clock.xml b/conf/dialplan/default/01_Talking_Clock.xml new file mode 100644 index 0000000000..4e37962001 --- /dev/null +++ b/conf/dialplan/default/01_Talking_Clock.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + From f7e268a1c7529aad04bcdc16c8b0678689fe0d13 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 19:40:14 -0400 Subject: [PATCH 360/558] mod_callcenter: Quick changes to try to make it more multi platform friendly. Still need to find the best way to convert a string to time_t that is multi platform. --- .../mod_callcenter/mod_callcenter.c | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 1ba3173d70..f3baac2a07 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -899,13 +899,13 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2status(value) != CC_AGENT_STATUS_UNKNOWN) { /* Reset values on available only */ if (cc_agent_str2status(value) == CC_AGENT_STATUS_AVAILABLE) { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%ld', talk_time = 0, calls_answered = 0, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" " WHERE name = '%q' AND NOT status = '%q'", - value, (long) switch_epoch_time_now(NULL), + value, switch_epoch_time_now(NULL), agent, value); } else { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%ld' WHERE name = '%q'", - value, (long) switch_epoch_time_now(NULL), agent); + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" TIME_T_FMT "' WHERE name = '%q'", + value, switch_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -940,8 +940,8 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2state(value) != CC_AGENT_STATE_RECEIVING) { sql = switch_mprintf("UPDATE agents SET state = '%q' WHERE name = '%q'", value, agent); } else { - sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%ld' WHERE name = '%q'", - value, (long) switch_epoch_time_now(NULL), agent); + sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" TIME_T_FMT "' WHERE name = '%q'", + value, switch_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1379,8 +1379,8 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Member %s <%s> with uuid %s in queue %s is gone just before we assigned an agent\n", h->member_cid_name, h->member_cid_number, h->member_session_uuid, h->queue_name); - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", - cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), switch_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1524,9 +1524,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" TIME_T_FMT, t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" TIME_T_FMT, t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); @@ -1535,12 +1535,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } /* for xml_cdr needs */ switch_channel_set_variable(member_channel, "cc_agent", h->agent_name); - switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%ld", (long) switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); /* Set UUID of the Agent channel */ - sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%ld', calls_answered = calls_answered + 1, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" " WHERE name = '%q' AND system = '%q'", - agent_uuid, (long) switch_epoch_time_now(NULL), + agent_uuid, switch_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1582,10 +1582,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%ld", (long) switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" TIME_T_FMT, t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" TIME_T_FMT, t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); @@ -1593,12 +1593,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_fire(&event); } /* for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_terminated_epoch", "%ld", (long) switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_terminated_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); /* Update Agents Items */ /* Do not remove uuid of the agent if we are a standby agent */ - sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %ld, talk_time = talk_time + (%ld-last_bridge_start) WHERE name = '%q' AND system = '%q';" - , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), (long) switch_epoch_time_now(NULL), (long) switch_epoch_time_now(NULL), h->agent_name, h->agent_system); + sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" TIME_T_FMT ", talk_time = talk_time + (%" TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" + , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), switch_epoch_time_now(NULL), switch_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1617,10 +1617,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%ld", (long) t_agent_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%ld", (long) t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" TIME_T_FMT, t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" TIME_T_FMT, t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); @@ -1980,7 +1980,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } /* Once we pass a certain point, we want to get rid of the abandoned call */ if (abandoned_epoch + discard_abandoned_after < (long) switch_epoch_time_now(NULL)) { - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%ld' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); + sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); } @@ -2140,9 +2140,9 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; - sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%ld-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" + sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", - (long) switch_epoch_time_now(NULL), + switch_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, members_callback, NULL /* Call back variables */); @@ -2399,7 +2399,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_event_fire(&event); } /* for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_joined_epoch", "%ld", (long) switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_joined_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); switch_channel_set_variable(member_channel, "cc_queue", queue_name); if (abandoned_epoch == 0) { @@ -2408,12 +2408,12 @@ SWITCH_STANDARD_APP(callcenter_function) sql = switch_mprintf("INSERT INTO members" " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,cid_number,cid_name,serving_agent,serving_system,state)" - " VALUES('%q','single_box','%q','%q','%q','%ld','%d','%d','%q','%q','%q','','%q')", + " VALUES('%q','single_box','%q','%q','%q','%" TIME_T_FMT "','%d','%d','%q','%q','%q','','%q')", queue_name, member_uuid, member_session_uuid, start_epoch, - (long) switch_epoch_time_now(NULL), + switch_epoch_time_now(NULL), cc_base_score_int, 0 /*TODO SKILL score*/, switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), @@ -2428,8 +2428,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> restoring it previous position in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update abandoned member */ - sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%ld' WHERE uuid = '%q' AND state = '%q'", - member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), (long) switch_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", + member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), switch_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); @@ -2531,8 +2531,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", - cc_member_state2str(CC_MEMBER_STATE_ABANDONED), (long) switch_epoch_time_now(NULL), member_uuid); + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2544,8 +2544,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%ld", (long) switch_epoch_time_now(NULL)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%ld", (long) t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Cancel"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cancel-Reason", cc_member_cancel_reason2str(h->member_cancel_reason)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", member_uuid); @@ -2556,7 +2556,7 @@ SWITCH_STANDARD_APP(callcenter_function) } /* Update some channel variables for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%ld", (long) switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "cancel"); switch_channel_set_variable_printf(member_channel, "cc_cancel_reason", "%s", cc_member_cancel_reason2str(h->member_cancel_reason)); @@ -2570,8 +2570,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%ld' WHERE system = 'single_box' AND uuid = '%q'", - cc_member_state2str(CC_MEMBER_STATE_ANSWERED), (long) switch_epoch_time_now(NULL), member_uuid); + sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + cc_member_state2str(CC_MEMBER_STATE_ANSWERED), switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); From c63dd3ec39a2ac34e9a543bab93c310f264c316d Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 19:42:46 -0400 Subject: [PATCH 361/558] mod_callcenter: Adding the VC project file for 2008 and 2010. Not tested --- .../mod_callcenter/mod_callcenter.2008.vcproj | 287 ++++++++++++++++++ .../mod_callcenter.2010.vcxproj | 135 ++++++++ 2 files changed, 422 insertions(+) create mode 100644 src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj create mode 100644 src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj b/src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj new file mode 100644 index 0000000000..82103cfba3 --- /dev/null +++ b/src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj @@ -0,0 +1,287 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj b/src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj new file mode 100644 index 0000000000..a8d988ae36 --- /dev/null +++ b/src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + mod_callcenter + {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39} + mod_callcenter + Win32Proj + + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + DynamicLibrary + MultiByte + + + + + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + + false + + + + + + + X64 + + + + + + + false + + + MachineX64 + + + + + + + + {202d7a4e-760d-4d0e-afa1-d7459ced30ff} + false + + + + + + From f952719e89770f25379bc39cb673367decba6a30 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 21:45:42 -0400 Subject: [PATCH 362/558] autoconf: Added the -Wunused-but-set-variable to the default compile to help avoid commiting more unused variable but set value. Please report if you do have problem with it. --- configure.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configure.in b/configure.in index 4ae6dc7b59..1a5f1320a1 100644 --- a/configure.in +++ b/configure.in @@ -583,6 +583,17 @@ if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then fi CFLAGS="$saved_CFLAGS" +saved_CFLAGS="$CFLAGS" +AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [ +CFLAGS="$CFLAGS -Wunused-but-set-variable" +AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no]) +]) +AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable) +if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then + APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wunused-but-set-variable) +fi +CFLAGS="$saved_CFLAGS" + AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian])) # Checks for integer size From cf1494f7735684666053aa05a5df4b999748fc5a Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 21:55:56 -0400 Subject: [PATCH 363/558] mod_callcenter: Fix for -Wunused-but-set-variable required compiler --- src/mod/applications/mod_callcenter/mod_callcenter.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index f3baac2a07..3b81de9707 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1937,7 +1937,6 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName switch_bool_t tier_rule_wait_multiply_level; switch_bool_t tier_rule_no_agent_no_wait; uint32_t discard_abandoned_after; - switch_bool_t abandoned_resume_allowed; agent_callback_t cbt; const char *member_state = NULL; const char *member_abandoned_epoch = NULL; @@ -1964,7 +1963,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName tier_rule_wait_multiply_level = queue->tier_rule_wait_multiply_level; tier_rule_no_agent_no_wait = queue->tier_rule_no_agent_no_wait; discard_abandoned_after = queue->discard_abandoned_after; - abandoned_resume_allowed = queue->abandoned_resume_allowed; + if (queue->record_template) { queue_record_template = strdup(queue->record_template); } @@ -2300,7 +2299,6 @@ static switch_status_t moh_on_dtmf(switch_core_session_t *session, void *input, SWITCH_STANDARD_APP(callcenter_function) { - int argc = 0; char *argv[6] = { 0 }; char *mydata = NULL; cc_queue_t *queue = NULL; @@ -2328,7 +2326,7 @@ SWITCH_STANDARD_APP(callcenter_function) if (!zstr(data)) { mydata = switch_core_session_strdup(member_session, data); - argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_WARNING, "No Queue name provided\n"); goto end; From ab02493b9d9a5ac65e830948a329a3a19c1d3109 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 22:03:40 -0400 Subject: [PATCH 364/558] mod_python & mod_spidermonkey: Fix for -Wunused-but-set-variable required compiler --- src/mod/languages/mod_python/mod_python.c | 5 ----- src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/mod/languages/mod_python/mod_python.c b/src/mod/languages/mod_python/mod_python.c index bcaebd8856..78caf3b04f 100644 --- a/src/mod/languages/mod_python/mod_python.c +++ b/src/mod/languages/mod_python/mod_python.c @@ -77,13 +77,11 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi char *dupargs = NULL; char *argv[2] = { 0 }; int argc; - int lead = 0; char *script = NULL; PyObject *module = NULL, *sp = NULL, *stp = NULL, *eve = NULL; PyObject *function = NULL; PyObject *arg = NULL; PyObject *result = NULL; - switch_channel_t *channel = NULL; char *p; if (str) { @@ -105,8 +103,6 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi script = strdup(switch_str_nil(argv[0])); - lead = 1; - if ((p = strstr(script, "::"))) { *p = '\0'; p += 2; @@ -157,7 +153,6 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi } if (session) { - channel = switch_core_session_get_channel(session); sp = mod_python_conjure_session(module, session); } diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c index e60d8ce793..63709a4d8f 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_odbc.c @@ -513,12 +513,12 @@ static JSBool odbc_setProperty(JSContext * cx, JSObject * obj, jsval id, jsval * static JSBool odbc_getProperty(JSContext * cx, JSObject * obj, jsval id, jsval * vp) { - int param; + //int param; char *name = JS_GetStringBytes(JS_ValueToString(cx, id)); /* numbers are our props anything else is a method */ if (name[0] >= 48 && name[0] <= 57) { - param = atoi(name); + // param = atoi(name); } else { return JS_TRUE; } From 92cd0950062982ea90aab3bcfa0b225ed54db29e Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 22:11:34 -0400 Subject: [PATCH 365/558] sofia-lib: Fix for -Wunused-but-set-variable required compiler. (Might need to be ported back to sofia) --- libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c | 4 ++-- libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c index a6c7d49ac6..1a570b2494 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c @@ -550,7 +550,7 @@ int nea_server_shutdown(nea_server_t *nes, int retry_after) { nea_sub_t *s; - int status = 200; +// int status = 200; int in_callback; if (nes == NULL) @@ -577,7 +577,7 @@ int nea_server_shutdown(nea_server_t *nes, TAG_IF(retry_after, NEATAG_RETRY_AFTER(retry_after)), TAG_END()); else - status = 180; + //status = 180; } nes->nes_in_callback = in_callback; diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c index fd826e0e19..a0dcbb1c4e 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_register.c @@ -1879,14 +1879,14 @@ int nua_registration_process_request(nua_registration_t *list, nta_incoming_t *irq, sip_t const *sip) { - sip_call_id_t *i; + //sip_call_id_t *i; nua_registration_t *nr; if (!outbound_targeted_request(sip)) return 0; /* Process by outbound... */ - i = sip->sip_call_id; + //i = sip->sip_call_id; for (nr = list; nr; nr = nr->nr_next) { outbound_t *ob = nr->nr_ob; From e414d994380a435c10e9c2eec771467786217e63 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 22 Apr 2011 21:23:09 -0500 Subject: [PATCH 366/558] remove unreferenced variable --- src/mod/languages/mod_lua/freeswitch_lua.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mod/languages/mod_lua/freeswitch_lua.cpp b/src/mod/languages/mod_lua/freeswitch_lua.cpp index 7bc3d50b8a..0b0a17a225 100644 --- a/src/mod/languages/mod_lua/freeswitch_lua.cpp +++ b/src/mod/languages/mod_lua/freeswitch_lua.cpp @@ -123,7 +123,6 @@ void Session::check_hangup_hook() void Session::do_hangup_hook() { if (hh && !mark) { - const char *err = NULL; int arg_count = 2; mark++; From 5bcf487df9489bc74d7e13a9b2413c9d7ea03757 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 22 Apr 2011 21:30:42 -0500 Subject: [PATCH 367/558] fix for last commit --- libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c index 1a570b2494..bd1e63b478 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c +++ b/libs/sofia-sip/libsofia-sip-ua/nea/nea_server.c @@ -576,7 +576,7 @@ int nea_server_shutdown(nea_server_t *nes, TAG_IF(!retry_after, NEATAG_REASON("deactivated")), TAG_IF(retry_after, NEATAG_RETRY_AFTER(retry_after)), TAG_END()); - else + //else //status = 180; } From ba7dc9fde83d12b534288f407fea120fe89ddccb Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 22:49:41 -0400 Subject: [PATCH 368/558] Fix for -Wunused-but-set-variable required compiler. : mod_freetdm mod_avmd mod_cidlookup mod_ladspa mod_lcr mod_nibblebill mod_rss mod_vdm mod_dahdi_codec mod_skinny mod_cdr_pg_csv --- libs/freetdm/mod_freetdm/mod_freetdm.c | 3 +-- src/mod/applications/mod_avmd/mod_avmd.c | 4 ++-- .../applications/mod_cidlookup/mod_cidlookup.c | 3 +++ src/mod/applications/mod_ladspa/mod_ladspa.c | 3 +-- src/mod/applications/mod_lcr/mod_lcr.c | 10 ++++------ .../applications/mod_nibblebill/mod_nibblebill.c | 8 +++----- src/mod/applications/mod_rss/mod_rss.c | 4 ++-- src/mod/applications/mod_vmd/mod_vmd.c | 3 +-- src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c | 2 -- src/mod/endpoints/mod_portaudio/pablio.c | 4 +++- src/mod/endpoints/mod_skinny/mod_skinny.c | 6 ++---- src/mod/endpoints/mod_skinny/skinny_server.c | 15 +-------------- .../mod_cdr_pg_csv/mod_cdr_pg_csv.c | 2 -- 13 files changed, 23 insertions(+), 44 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8739c4c0bf..d1a5871b09 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -720,7 +720,6 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc ftdm_size_t len; unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE] = {0}; ftdm_wait_flag_t wflags = FTDM_WRITE; - ftdm_status_t status; channel = switch_core_session_get_channel(session); assert(channel != NULL); @@ -755,7 +754,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc wflags = FTDM_WRITE; - status = ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 10); + ftdm_channel_wait(tech_pvt->ftdmchan, &wflags, ftdm_channel_get_io_interval(tech_pvt->ftdmchan) * 10); if (!(wflags & FTDM_WRITE)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Dropping frame! (write not ready)\n"); diff --git a/src/mod/applications/mod_avmd/mod_avmd.c b/src/mod/applications/mod_avmd/mod_avmd.c index 8e6f2e124d..d0c9f6e419 100644 --- a/src/mod/applications/mod_avmd/mod_avmd.c +++ b/src/mod/applications/mod_avmd/mod_avmd.c @@ -479,7 +479,7 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame) double success = 0.0; double amp = 0.0; double s_rate; - double e_rate; +// double e_rate; double avg_a; double sine_len; uint32_t sine_len_i; @@ -523,7 +523,7 @@ static void avmd_process(avmd_session_t *session, switch_frame_t *frame) /*! Every once in a while we evaluate the desa2 and amplitude results */ if(((pos + 1) % sine_len_i) == 0){ s_rate = success / (error + success); - e_rate = error / (error + success); +// e_rate = error / (error + success); avg_a = amp / sine_len; /*! Results out of these ranges are considered invalid */ diff --git a/src/mod/applications/mod_cidlookup/mod_cidlookup.c b/src/mod/applications/mod_cidlookup/mod_cidlookup.c index 2ec41f19e4..06bf615ce5 100755 --- a/src/mod/applications/mod_cidlookup/mod_cidlookup.c +++ b/src/mod/applications/mod_cidlookup/mod_cidlookup.c @@ -729,6 +729,9 @@ SWITCH_STANDARD_APP(cidlookup_app_function) if (!session && pool) { switch_core_destroy_memory_pool(&pool); } + /* This is so compile doesn't failed because status is never used */ + if (status) { + } } SWITCH_STANDARD_API(cidlookup_function) diff --git a/src/mod/applications/mod_ladspa/mod_ladspa.c b/src/mod/applications/mod_ladspa/mod_ladspa.c index 43ea87a3ca..bab6ff5216 100644 --- a/src/mod/applications/mod_ladspa/mod_ladspa.c +++ b/src/mod/applications/mod_ladspa/mod_ladspa.c @@ -565,12 +565,11 @@ switch_status_t ladspa_session(switch_core_session_t *session, const char *flags static void ladspa_parse(switch_core_session_t *session, const char *data) { char *argv[5] = { 0 }; - int argc; char *lbuf; if (data) { lbuf = strdup(data); - argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0]))); + switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0]))); ladspa_session(session, argv[0], argv[1], argv[2], argv[3]); free(lbuf); } diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index ac5d90871e..fcb75ef4d5 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -248,14 +248,13 @@ static char *get_bridge_data(switch_memory_pool_t *pool, char *dialed_number, ch size_t tstrip; char *data = NULL; char *destination_number = NULL; - char *orig_destination_number = NULL; char *codec = NULL; char *cid = NULL; char *header = NULL; char *user_rate = NULL; char *export_fields = NULL; - orig_destination_number = destination_number = switch_core_strdup(pool, dialed_number); + destination_number = switch_core_strdup(pool, dialed_number); tstrip = ((cur_route->digit_len - cur_route->tstrip) + 1); lstrip = cur_route->lstrip; @@ -1263,7 +1262,6 @@ static switch_call_cause_t lcr_outgoing_channel(switch_core_session_t *session, const char *intralata = NULL; switch_core_session_t *mysession = NULL; switch_channel_t *channel = NULL; - switch_caller_profile_t *caller_profile = NULL; dest = strdup(outbound_profile->destination_number); @@ -1290,7 +1288,6 @@ static switch_call_cause_t lcr_outgoing_channel(switch_core_session_t *session, timelimit = atoi(var); } routes.session = session; - caller_profile = switch_channel_get_caller_profile(channel); intrastate = switch_channel_get_variable(channel, "intrastate"); intralata = switch_channel_get_variable(channel, "intralata"); cid_name_override = switch_channel_get_variable(channel, "origination_caller_id_name"); @@ -1670,7 +1667,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function) char *argv[4] = { 0 }; int argc; char *mydata = NULL; - char *dialstring = NULL; + //char *dialstring = NULL; char *lcr_profile = NULL; lcr_route current = NULL; max_obj_t maximum_lengths = { 0 }; @@ -1792,7 +1789,8 @@ SWITCH_STANDARD_API(dialplan_lcr_function) current = cb_struct.head; while (current) { - dialstring = get_bridge_data(pool, cb_struct.lookup_number, cb_struct.cid, current, cb_struct.profile, cb_struct.session); + //dialstring = + get_bridge_data(pool, cb_struct.lookup_number, cb_struct.cid, current, cb_struct.profile, cb_struct.session); rowcount++; if (as_xml) { diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c index 8487d0be62..068a31f5f3 100755 --- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c +++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c @@ -399,7 +399,7 @@ static switch_status_t do_billing(switch_core_session_t *session) const char *billrate; const char *billaccount; float nobal_amt = globals.nobal_amt; - float lowbal_amt = globals.lowbal_amt; + //float lowbal_amt = globals.lowbal_amt; float balance; if (!session) { @@ -421,10 +421,11 @@ static switch_status_t do_billing(switch_core_session_t *session) if (!zstr(switch_channel_get_variable(channel, "nobal_amt"))) { nobal_amt = (float)atof(switch_channel_get_variable(channel, "nobal_amt")); } + /* if (!zstr(switch_channel_get_variable(channel, "lowbal_amt"))) { lowbal_amt = (float)atof(switch_channel_get_variable(channel, "lowbal_amt")); } - + */ /* Return if there's no billing information on this session */ if (!billrate || !billaccount) { return SWITCH_STATUS_SUCCESS; @@ -802,9 +803,6 @@ SWITCH_STANDARD_API(nibblebill_api_function) if ((argc == 2 || argc == 3) && !zstr(argv[0])) { char *uuid = argv[0]; if ((psession = switch_core_session_locate(uuid))) { - switch_channel_t *channel; - channel = switch_core_session_get_channel(psession); - if (!strcasecmp(argv[1], "adjust") && argc == 3) { nibblebill_adjust(psession, (float) atof(argv[2])); } else if (!strcasecmp(argv[1], "flush")) { diff --git a/src/mod/applications/mod_rss/mod_rss.c b/src/mod/applications/mod_rss/mod_rss.c index b85d86bb99..073b471bb4 100644 --- a/src/mod/applications/mod_rss/mod_rss.c +++ b/src/mod/applications/mod_rss/mod_rss.c @@ -175,7 +175,7 @@ SWITCH_STANDARD_APP(rss_function) char *filename = NULL; char *argv[3], *feed_list[TTS_MAX_ENTRIES] = { 0 }, *feed_names[TTS_MAX_ENTRIES] = { 0}; - int argc, feed_index = 0; + int feed_index = 0; const char *cf = "rss.conf"; switch_xml_t cfg, cxml, feeds, feed; char buf[1024] = ""; @@ -236,7 +236,7 @@ SWITCH_STANDARD_APP(rss_function) if (!zstr(data)) { if ((mydata = switch_core_session_strdup(session, data))) { - argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])); + switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])); if (argv[0]) { engine = argv[0]; diff --git a/src/mod/applications/mod_vmd/mod_vmd.c b/src/mod/applications/mod_vmd/mod_vmd.c index 4a20df8183..3bb1e6b16e 100644 --- a/src/mod/applications/mod_vmd/mod_vmd.c +++ b/src/mod/applications/mod_vmd/mod_vmd.c @@ -237,9 +237,8 @@ static switch_bool_t process_data(vmd_session_info_t *vmd_info, switch_frame_t * double pts[P]; int16_t *data; int16_t max; - switch_ssize_t len; - len = frame->samples * sizeof(int16_t); + //len = frame->samples * sizeof(int16_t); data = (int16_t *) frame->data; for (max = (int16_t) abs(data[0]), i = 1; i < frame->samples; i++) { diff --git a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c index 0553607bfe..a5bf1ecad7 100644 --- a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c +++ b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c @@ -250,7 +250,6 @@ static switch_status_t switch_dahdi_encode(switch_codec_t *codec, { int32_t res; short *dbuf_linear; - unsigned char *ebuf_g729; unsigned char ebuf_ulaw[decoded_data_len / 2]; uint32_t i; struct dahdi_context *context = NULL; @@ -268,7 +267,6 @@ static switch_status_t switch_dahdi_encode(switch_codec_t *codec, } dbuf_linear = decoded_data; - ebuf_g729 = encoded_data; for (i = 0; i < decoded_data_len / sizeof(short); i++) { ebuf_ulaw[i] = linear_to_ulaw(dbuf_linear[i]); } diff --git a/src/mod/endpoints/mod_portaudio/pablio.c b/src/mod/endpoints/mod_portaudio/pablio.c index b994d21c2a..05fdf0f280 100644 --- a/src/mod/endpoints/mod_portaudio/pablio.c +++ b/src/mod/endpoints/mod_portaudio/pablio.c @@ -251,7 +251,7 @@ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr, PABLIO_Stream *aStream; long numFrames; //long numBytes; - int channels = 1; + //int channels = 1; if (!(inputParameters || outputParameters)) { return -1; @@ -262,11 +262,13 @@ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr, switch_assert(aStream); memset(aStream, 0, sizeof(PABLIO_Stream)); + /* if (inputParameters) { channels = inputParameters->channelCount; } else if (outputParameters) { channels = outputParameters->channelCount; } + */ numFrames = RoundUpToNextPowerOf2(samples_per_packet * 5); aStream->bytesPerFrame = bytesPerSample; diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 38ab78553a..3879cca7d4 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -462,7 +462,6 @@ uint32_t skinny_line_get_state(listener_t *listener, uint32_t line_instance, uin switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force) { - int ms; switch_status_t status = SWITCH_STATUS_SUCCESS; int resetting = 0; @@ -542,7 +541,7 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force) } tech_pvt->read_frame.rate = tech_pvt->rm_rate; - ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000; + //ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000; if (!switch_core_codec_ready(&tech_pvt->read_codec)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n"); @@ -880,7 +879,6 @@ switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_ { switch_channel_t *channel = switch_core_session_get_channel(session); private_t *tech_pvt = switch_core_session_get_private(session); - int payload = 0; while (!(tech_pvt->read_codec.implementation && switch_rtp_ready(tech_pvt->rtp_session))) { if (switch_channel_ready(channel)) { @@ -908,7 +906,7 @@ switch_status_t channel_read_frame(switch_core_session_t *session, switch_frame_ return SWITCH_STATUS_FALSE; } - payload = tech_pvt->read_frame.payload; + //payload = tech_pvt->read_frame.payload; if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) { switch_dtmf_t dtmf = { 0 }; diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 35cb74adb5..f6887060fc 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -588,14 +588,12 @@ switch_call_cause_t skinny_ring_lines(private_t *tech_pvt, switch_core_session_t switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); send_start_tone(listener, SKINNY_TONE_ALERT, 0, line_instance, tech_pvt->call_id); @@ -732,14 +730,12 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste switch_status_t skinny_session_hold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); skinny_session_stop_media(session, listener, line_instance); @@ -760,17 +756,15 @@ switch_status_t skinny_session_hold_line(switch_core_session_t *session, listene switch_status_t skinny_session_unhold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); - skinny_hold_active_calls(listener); + skinny_hold_active_calls(listener); send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id); send_set_speaker_mode(listener, SKINNY_SPEAKER_ON); send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff); @@ -825,14 +819,12 @@ switch_status_t skinny_session_transfer(switch_core_session_t *session, listener switch_status_t skinny_session_stop_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance) { - switch_channel_t *channel = NULL; private_t *tech_pvt = NULL; switch_assert(session); switch_assert(listener); switch_assert(listener->profile); - channel = switch_core_session_get_channel(session); tech_pvt = switch_core_session_get_private(session); switch_clear_flag_locked(tech_pvt, TFLAG_IO); @@ -1773,7 +1765,6 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn uint32_t call_id = 0; switch_core_session_t *session = NULL; switch_channel_t *channel = NULL; - private_t *tech_pvt = NULL; skinny_check_data_length(request, sizeof(request->data.soft_key_event.event)); @@ -1790,7 +1781,6 @@ switch_status_t skinny_handle_soft_key_event_message(listener_t *listener, skinn break; case SOFTKEY_NEWCALL: status = skinny_create_incoming_session(listener, &line_instance, &session); - tech_pvt = switch_core_session_get_private(session); skinny_session_process_dest(session, listener, line_instance, NULL, '\0', 0); break; @@ -1874,13 +1864,10 @@ switch_status_t skinny_handle_unregister(listener_t *listener, skinny_message_t switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, skinny_message_t *request) { skinny_message_t *message; - skinny_profile_t *profile; switch_assert(listener->profile); switch_assert(listener->device_name); - profile = listener->profile; - message = switch_core_alloc(listener->pool, 12+sizeof(message->data.soft_key_template)); message->type = SOFT_KEY_TEMPLATE_RES_MESSAGE; message->length = 4 + sizeof(message->data.soft_key_template); diff --git a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c index 0b96db82a1..7f2a7e8b3c 100644 --- a/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c +++ b/src/mod/event_handlers/mod_cdr_pg_csv/mod_cdr_pg_csv.c @@ -160,7 +160,6 @@ static void do_rotate(cdr_fd_t *fd) char date[80] = ""; switch_size_t retsize; char *p; - size_t len; close(fd->fd); fd->fd = -1; @@ -169,7 +168,6 @@ static void do_rotate(cdr_fd_t *fd) switch_time_exp_lt(&tm, switch_micro_time_now()); switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm); - len = strlen(fd->path) + strlen(date) + 2; p = switch_mprintf("%s.%s", fd->path, date); assert(p); switch_file_rename(fd->path, p, globals.pool); From 0b780702d972cf0fd1e7cfb6d94ccdee8897c2b0 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 23:05:36 -0400 Subject: [PATCH 369/558] mod_event_zmq: Update download file from 2.1.3 to 2.1.4 (2.1.3 tar file is gone from zmq server) --- src/mod/event_handlers/mod_event_zmq/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/event_handlers/mod_event_zmq/Makefile b/src/mod/event_handlers/mod_event_zmq/Makefile index 46d03f4bea..a724a63d1e 100644 --- a/src/mod/event_handlers/mod_event_zmq/Makefile +++ b/src/mod/event_handlers/mod_event_zmq/Makefile @@ -1,6 +1,6 @@ BASE=../../../.. -ZMQ=zeromq-2.1.3 +ZMQ=zeromq-2.1.4 ZMQ_BASEURL=http://download.zeromq.org From eb8ff5a06b91420b8e58ccd2eef40c31b69bd139 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Fri, 22 Apr 2011 23:09:40 -0400 Subject: [PATCH 370/558] autoconf: Comment out the forced -Wunused-but-set-variable since not all module could be tested. List of module I couldn't compile is in the comment. Please all the different module maintainer check your module for this. Thanks --- configure.in | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/configure.in b/configure.in index 1a5f1320a1..356e4c4705 100644 --- a/configure.in +++ b/configure.in @@ -583,16 +583,20 @@ if test x"$ac_cv_gcc_declaration_after_statement" = xyes; then fi CFLAGS="$saved_CFLAGS" -saved_CFLAGS="$CFLAGS" -AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [ -CFLAGS="$CFLAGS -Wunused-but-set-variable" -AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no]) -]) -AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable) -if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then - APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wunused-but-set-variable) -fi -CFLAGS="$saved_CFLAGS" +# Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready +# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_skypopen mod_h323 mod_khomp +# mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed +# +#saved_CFLAGS="$CFLAGS" +#AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [ +#CFLAGS="$CFLAGS -Wunused-but-set-variable" +#AC_TRY_COMPILE([],[return 0;],[ac_cv_gcc_unused_but_set_variable=yes],[ac_cv_gcc_unused_but_set_variable=no]) +#]) +#AC_MSG_RESULT($ac_cv_gcc_unused_but_set_variable) +#if test x"$ac_cv_gcc_unused_but_set_variable" = xyes; then +# APR_ADDTO(SWITCH_ANSI_CFLAGS, -Wunused-but-set-variable) +#fi +#CFLAGS="$saved_CFLAGS" AC_C_BIGENDIAN(AC_DEFINE([SWITCH_BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([SWITCH_BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian])) From 568fa83642176602bfced57af16170c508e993f4 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 23 Apr 2011 11:55:56 -0400 Subject: [PATCH 371/558] mod_callcenter: Decided to take the easy way for portability for the moment. We expect time_t to be an integral anyway in the core, so I'll expect the same here. Should fix the problem with the partial change I did on i386 system --- .../mod_callcenter/mod_callcenter.c | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 3b81de9707..71be9f6410 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -899,12 +899,12 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2status(value) != CC_AGENT_STATUS_UNKNOWN) { /* Reset values on available only */ if (cc_agent_str2status(value) == CC_AGENT_STATUS_AVAILABLE) { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" " WHERE name = '%q' AND NOT status = '%q'", value, switch_epoch_time_now(NULL), agent, value); } else { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" TIME_T_FMT "' WHERE name = '%q'", + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", value, switch_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); @@ -940,7 +940,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2state(value) != CC_AGENT_STATE_RECEIVING) { sql = switch_mprintf("UPDATE agents SET state = '%q' WHERE name = '%q'", value, agent); } else { - sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" TIME_T_FMT "' WHERE name = '%q'", + sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", value, switch_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); @@ -1379,7 +1379,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Member %s <%s> with uuid %s in queue %s is gone just before we assigned an agent\n", h->member_cid_name, h->member_cid_number, h->member_session_uuid, h->queue_name); - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), switch_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(NULL, sql, NULL); @@ -1524,9 +1524,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" TIME_T_FMT, t_agent_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" TIME_T_FMT, t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" SWITCH_TIME_T_FMT, t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" SWITCH_TIME_T_FMT, t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" SWITCH_TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); @@ -1535,10 +1535,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } /* for xml_cdr needs */ switch_channel_set_variable(member_channel, "cc_agent", h->agent_name); - switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); /* Set UUID of the Agent channel */ - sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" SWITCH_TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" " WHERE name = '%q' AND system = '%q'", agent_uuid, switch_epoch_time_now(NULL), h->agent_name, h->agent_system); @@ -1582,10 +1582,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" TIME_T_FMT, t_agent_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" TIME_T_FMT, t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" SWITCH_TIME_T_FMT, t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" SWITCH_TIME_T_FMT, t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" SWITCH_TIME_T_FMT, t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); @@ -1593,11 +1593,11 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_fire(&event); } /* for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_terminated_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_terminated_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); /* Update Agents Items */ /* Do not remove uuid of the agent if we are a standby agent */ - sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" TIME_T_FMT ", talk_time = talk_time + (%" TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" + sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" SWITCH_TIME_T_FMT ", talk_time = talk_time + (%" SWITCH_TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), switch_epoch_time_now(NULL), switch_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1617,10 +1617,10 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent", h->agent_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-System", h->agent_system); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" TIME_T_FMT, t_agent_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" TIME_T_FMT, t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" SWITCH_TIME_T_FMT, t_agent_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" SWITCH_TIME_T_FMT, t_agent_answered); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" SWITCH_TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); @@ -1979,7 +1979,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } /* Once we pass a certain point, we want to get rid of the abandoned call */ if (abandoned_epoch + discard_abandoned_after < (long) switch_epoch_time_now(NULL)) { - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); + sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" SWITCH_TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); } @@ -2139,7 +2139,7 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; - sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" + sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" SWITCH_TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", switch_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); @@ -2397,7 +2397,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_event_fire(&event); } /* for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_joined_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_joined_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); switch_channel_set_variable(member_channel, "cc_queue", queue_name); if (abandoned_epoch == 0) { @@ -2406,7 +2406,7 @@ SWITCH_STANDARD_APP(callcenter_function) sql = switch_mprintf("INSERT INTO members" " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,cid_number,cid_name,serving_agent,serving_system,state)" - " VALUES('%q','single_box','%q','%q','%q','%" TIME_T_FMT "','%d','%d','%q','%q','%q','','%q')", + " VALUES('%q','single_box','%q','%q','%q','%" SWITCH_TIME_T_FMT "','%d','%d','%q','%q','%q','','%q')", queue_name, member_uuid, member_session_uuid, @@ -2426,7 +2426,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> restoring it previous position in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update abandoned member */ - sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", + sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), switch_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); @@ -2529,7 +2529,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2542,8 +2542,8 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" TIME_T_FMT, t_member_called); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" SWITCH_TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Cancel"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cancel-Reason", cc_member_cancel_reason2str(h->member_cancel_reason)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", member_uuid); @@ -2554,7 +2554,7 @@ SWITCH_STANDARD_APP(callcenter_function) } /* Update some channel variables for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%" TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "cancel"); switch_channel_set_variable_printf(member_channel, "cc_cancel_reason", "%s", cc_member_cancel_reason2str(h->member_cancel_reason)); @@ -2568,7 +2568,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ANSWERED), switch_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); From d3e3b397397ccf18c2f5f0dc9952cb52d7f34040 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 23 Apr 2011 17:01:35 -0400 Subject: [PATCH 372/558] mod_callcenter: More temporary attempt to make it 32bit friendly --- .../mod_callcenter/mod_callcenter.c | 70 +++++++++++-------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 71be9f6410..0921de3f4e 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -245,6 +245,16 @@ static char tiers_sql[] = static switch_xml_config_int_options_t config_int_0_86400 = { SWITCH_TRUE, 0, SWITCH_TRUE, 86400 }; +/* TODO This is temporary until we either move it to the core, or use it differently in the module */ +switch_time_t local_epoch_time_now(switch_time_t *t) +{ + switch_time_t now = switch_micro_time_now() / 1000000; /* APR_USEC_PER_SEC */ + if (t) { + *t = now; + } + return now; +} + const char * cc_tier_state2str(cc_tier_state_t state) { uint8_t x; @@ -901,11 +911,11 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2status(value) == CC_AGENT_STATUS_AVAILABLE) { sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" " WHERE name = '%q' AND NOT status = '%q'", - value, switch_epoch_time_now(NULL), + value, local_epoch_time_now(NULL), agent, value); } else { sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", - value, switch_epoch_time_now(NULL), agent); + value, local_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -941,7 +951,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen sql = switch_mprintf("UPDATE agents SET state = '%q' WHERE name = '%q'", value, agent); } else { sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", - value, switch_epoch_time_now(NULL), agent); + value, local_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1380,7 +1390,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", - cc_member_state2str(CC_MEMBER_STATE_ABANDONED), switch_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1413,7 +1423,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "cc_side", "%s", "agent"); switch_event_add_header(ovars, SWITCH_STACK_BOTTOM, "ignore_early_media", "true"); - t_agent_called = switch_epoch_time_now(NULL); + t_agent_called = local_epoch_time_now(NULL); dialstr = switch_mprintf("%s", h->originate_string); status = switch_ivr_originate(NULL, &agent_session, &cause, dialstr, 60, NULL, h->member_cid_name, h->member_cid_number, NULL, ovars, SOF_NONE, NULL); switch_safe_free(dialstr); @@ -1515,7 +1525,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_core_session_hupall_matching_var("cc_member_pre_answer_uuid", h->member_uuid, SWITCH_CAUSE_ORIGINATOR_CANCEL); } - t_agent_answered = switch_epoch_time_now(NULL); + t_agent_answered = local_epoch_time_now(NULL); if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { switch_channel_event_set_data(agent_channel, event); @@ -1535,12 +1545,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa } /* for xml_cdr needs */ switch_channel_set_variable(member_channel, "cc_agent", h->agent_name); - switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); /* Set UUID of the Agent channel */ sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" SWITCH_TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" " WHERE name = '%q' AND system = '%q'", - agent_uuid, switch_epoch_time_now(NULL), + agent_uuid, local_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1585,7 +1595,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" SWITCH_TIME_T_FMT, t_agent_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" SWITCH_TIME_T_FMT, t_agent_answered); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" SWITCH_TIME_T_FMT, t_member_called); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Bridge-Terminated-Time", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-CID-Name", h->member_cid_name); @@ -1593,12 +1603,12 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_fire(&event); } /* for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_terminated_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_terminated_epoch", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); /* Update Agents Items */ /* Do not remove uuid of the agent if we are a standby agent */ sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" SWITCH_TIME_T_FMT ", talk_time = talk_time + (%" SWITCH_TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" - , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), switch_epoch_time_now(NULL), switch_epoch_time_now(NULL), h->agent_name, h->agent_system); + , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), local_epoch_time_now(NULL), local_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1619,7 +1629,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Agent-UUID", agent_uuid); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Called-Time", "%" SWITCH_TIME_T_FMT, t_agent_called); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Agent-Answered-Time", "%" SWITCH_TIME_T_FMT, t_agent_answered); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" SWITCH_TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-UUID", h->member_uuid); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Member-Session-UUID", h->member_session_uuid); @@ -1678,7 +1688,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Put agent to sleep for some time if necessary */ if (delay_next_agent_call > 0) { char ready_epoch[64]; - switch_snprintf(ready_epoch, sizeof(ready_epoch), "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL) + delay_next_agent_call); + switch_snprintf(ready_epoch, sizeof(ready_epoch), "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL) + delay_next_agent_call); cc_agent_update("ready_time", ready_epoch , h->agent_name); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s sleeping for %d seconds\n", h->agent_name, delay_next_agent_call); } @@ -1789,11 +1799,11 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames if (cbt->tier_rule_no_agent_no_wait == SWITCH_TRUE && cbt->tier_agent_available == 0) { cbt->tier = atoi(agent_tier_level); /* Multiple the tier level by the tier wait time */ - } else if (cbt->tier_rule_wait_multiply_level == SWITCH_TRUE && (long) switch_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= atoi(agent_tier_level) * cbt->tier_rule_wait_second) { + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_TRUE && (long) local_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= atoi(agent_tier_level) * cbt->tier_rule_wait_second) { cbt->tier = atoi(agent_tier_level); cbt->tier_agent_available = 0; /* Just check if joined is bigger than next tier wait time */ - } else if (cbt->tier_rule_wait_multiply_level == SWITCH_FALSE && (long) switch_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= cbt->tier_rule_wait_second) { + } else if (cbt->tier_rule_wait_multiply_level == SWITCH_FALSE && (long) local_epoch_time_now(NULL) - atol(cbt->member_joined_epoch) >= cbt->tier_rule_wait_second) { cbt->tier = atoi(agent_tier_level); cbt->tier_agent_available = 0; } else { @@ -1810,10 +1820,10 @@ static int agents_callback(void *pArg, int argc, char **argv, char **columnNames if (! (!strcasecmp(agent_state, cc_agent_state2str(CC_AGENT_STATE_WAITING)))) { contact_agent = SWITCH_FALSE; } - if (! (atol(agent_last_bridge_end) < ((long) switch_epoch_time_now(NULL) - atol(agent_wrap_up_time)))) { + if (! (atol(agent_last_bridge_end) < ((long) local_epoch_time_now(NULL) - atol(agent_wrap_up_time)))) { contact_agent = SWITCH_FALSE; } - if (! (atol(agent_ready_time) <= (long) switch_epoch_time_now(NULL))) { + if (! (atol(agent_ready_time) <= (long) local_epoch_time_now(NULL))) { contact_agent = SWITCH_FALSE; } if (! (strcasecmp(agent_status, cc_agent_status2str(CC_AGENT_STATUS_ON_BREAK)))) { @@ -1978,7 +1988,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName abandoned_epoch = atol(cbt.member_joined_epoch); } /* Once we pass a certain point, we want to get rid of the abandoned call */ - if (abandoned_epoch + discard_abandoned_after < (long) switch_epoch_time_now(NULL)) { + if (abandoned_epoch + discard_abandoned_after < (long) local_epoch_time_now(NULL)) { sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" SWITCH_TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2100,7 +2110,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Queue %s not found locally, skip this member\n", cbt.queue_name); goto end; } else { - queue->last_agent_exist_check = switch_epoch_time_now(NULL); + queue->last_agent_exist_check = local_epoch_time_now(NULL); if (cbt.agent_found) { queue->last_agent_exist = queue->last_agent_exist_check; } @@ -2141,7 +2151,7 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v char *sql = NULL; sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" SWITCH_TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", - switch_epoch_time_now(NULL), + local_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); cc_execute_sql_callback(NULL /* queue */, NULL /* mutex */, sql, members_callback, NULL /* Call back variables */); @@ -2224,7 +2234,7 @@ void *SWITCH_THREAD_FUNC cc_member_thread_run(switch_thread_t *thread, void *obj break; } /* Make the Caller Leave if he went over his max wait time */ - if (queue->max_wait_time > 0 && queue->max_wait_time <= switch_epoch_time_now(NULL) - m->t_member_called) { + if (queue->max_wait_time > 0 && queue->max_wait_time <= local_epoch_time_now(NULL) - m->t_member_called) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> in queue '%s' reached max wait time\n", m->member_cid_name, m->member_cid_number, m->queue_name); m->member_cancel_reason = CC_MEMBER_CANCEL_REASON_TIMEOUT; switch_channel_set_flag_value(member_channel, CF_BREAK, 2); @@ -2318,7 +2328,7 @@ SWITCH_STANDARD_APP(callcenter_function) const char *cur_moh = NULL; char start_epoch[64]; switch_event_t *event; - switch_time_t t_member_called = switch_epoch_time_now(NULL); + switch_time_t t_member_called = local_epoch_time_now(NULL); long abandoned_epoch = 0; switch_uuid_t smember_uuid; char member_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = ""; @@ -2383,7 +2393,7 @@ SWITCH_STANDARD_APP(callcenter_function) /* If system, will add the total time the session is up to the base score */ if (!switch_strlen_zero(start_epoch) && !strcasecmp("system", queue->time_base_score)) { - cc_base_score_int += ((long) switch_epoch_time_now(NULL) - atol(start_epoch)); + cc_base_score_int += ((long) local_epoch_time_now(NULL) - atol(start_epoch)); } if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CALLCENTER_EVENT) == SWITCH_STATUS_SUCCESS) { @@ -2397,7 +2407,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_event_fire(&event); } /* for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_joined_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_joined_epoch", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); switch_channel_set_variable(member_channel, "cc_queue", queue_name); if (abandoned_epoch == 0) { @@ -2411,7 +2421,7 @@ SWITCH_STANDARD_APP(callcenter_function) member_uuid, member_session_uuid, start_epoch, - switch_epoch_time_now(NULL), + local_epoch_time_now(NULL), cc_base_score_int, 0 /*TODO SKILL score*/, switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), @@ -2427,7 +2437,7 @@ SWITCH_STANDARD_APP(callcenter_function) /* Update abandoned member */ sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", - member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), switch_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); + member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), local_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); @@ -2530,7 +2540,7 @@ SWITCH_STANDARD_APP(callcenter_function) /* Update member state */ sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", - cc_member_state2str(CC_MEMBER_STATE_ABANDONED), switch_epoch_time_now(NULL), member_uuid); + cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2542,7 +2552,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_channel_event_set_data(member_channel, event); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Queue", queue_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Action", "member-queue-end"); - switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Leaving-Time", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "CC-Member-Joined-Time", "%" SWITCH_TIME_T_FMT, t_member_called); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cause", "Cancel"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CC-Cancel-Reason", cc_member_cancel_reason2str(h->member_cancel_reason)); @@ -2554,7 +2564,7 @@ SWITCH_STANDARD_APP(callcenter_function) } /* Update some channel variables for xml_cdr needs */ - switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%" SWITCH_TIME_T_FMT, switch_epoch_time_now(NULL)); + switch_channel_set_variable_printf(member_channel, "cc_queue_canceled_epoch", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); switch_channel_set_variable_printf(member_channel, "cc_cause", "%s", "cancel"); switch_channel_set_variable_printf(member_channel, "cc_cancel_reason", "%s", cc_member_cancel_reason2str(h->member_cancel_reason)); @@ -2569,7 +2579,7 @@ SWITCH_STANDARD_APP(callcenter_function) /* Update member state */ sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", - cc_member_state2str(CC_MEMBER_STATE_ANSWERED), switch_epoch_time_now(NULL), member_uuid); + cc_member_state2str(CC_MEMBER_STATE_ANSWERED), local_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); From 626a99f99418e4e3a521405862c22de370bb192a Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 23 Apr 2011 20:33:19 -0400 Subject: [PATCH 373/558] sofia-lib: More Fix for -Wunused-but-set-variable required compiler. (Might need to be ported back to sofia) --- libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c | 5 ++-- libs/sofia-sip/libsofia-sip-ua/nta/nta.c | 4 +-- .../libsofia-sip-ua/nua/nua_session.c | 6 ++--- .../sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c | 3 +-- .../sofia-sip/libsofia-sip-ua/sdp/sdp_print.c | 3 +-- .../libsofia-sip-ua/soa/soa_static.c | 2 -- libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c | 6 ++--- libs/sofia-sip/libsofia-sip-ua/stun/stun.c | 26 +++++++++---------- .../sofia-sip/libsofia-sip-ua/stun/stun_dns.c | 5 +++- libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c | 6 ++--- .../libsofia-sip-ua/su/su_localinfo.c | 12 +++++++-- libs/sofia-sip/libsofia-sip-ua/tport/tport.c | 4 +-- .../libsofia-sip-ua/tport/tport_type_stun.c | 4 +-- libs/sofia-sip/libsofia-sip-ua/url/url.c | 4 +-- 14 files changed, 46 insertions(+), 44 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c b/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c index a665e9d495..5a8f354fa5 100644 --- a/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c +++ b/libs/sofia-sip/libsofia-sip-ua/msg/msg_date.c @@ -182,7 +182,7 @@ int time_d(char const **ss, issize_t msg_date_d(char const **ss, msg_time_t *date) { char const *s = *ss; - char const *wkday; + //char const *wkday; char const *tz; unsigned long day, year, hour, min, sec; int mon; @@ -190,7 +190,8 @@ issize_t msg_date_d(char const **ss, msg_time_t *date) if (!IS_TOKEN(*s) || !date) return -1; - wkday = s; skip_token(&s); if (*s == ',') s++; + //wkday = s; + skip_token(&s); if (*s == ',') s++; while (IS_LWS(*s)) s++; if (is_digit(*s)) { diff --git a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c index 543f0e135a..b96ec2ba5b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nta/nta.c +++ b/libs/sofia-sip/libsofia-sip-ua/nta/nta.c @@ -2307,7 +2307,7 @@ int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr) /* Set via fields for the tports */ for (tp = primaries; tp; tp = tport_next(tp)) { - int maddr, first_via; + int maddr; tp_name_t tpn[1]; char const *comp = NULL; @@ -2339,8 +2339,6 @@ int agent_init_via(nta_agent_t *self, tport_t *primaries, int use_maddr) if (tport_has_tls(tp)) self->sa_tport_tls = 1; - first_via = 1; - ai = tport_get_address(tp); for (; ai; ai = ai->ai_next) { diff --git a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c index 032c0a04f2..a35669dd3b 100644 --- a/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c +++ b/libs/sofia-sip/libsofia-sip-ua/nua/nua_session.c @@ -1743,7 +1743,7 @@ static int nua_prack_client_request(nua_client_request_t *cr, nua_client_request_t *cri; int offer_sent = 0, answer_sent = 0, retval; int status = 0; char const *phrase = "PRACK Sent"; - uint32_t rseq = 0; + //uint32_t rseq = 0; if (du == NULL) /* Call terminated */ return nua_client_return(cr, SIP_481_NO_TRANSACTION, msg); @@ -1754,8 +1754,8 @@ static int nua_prack_client_request(nua_client_request_t *cr, cri = du->du_cr; - if (sip->sip_rack) - rseq = sip->sip_rack->ra_response; +// if (sip->sip_rack) +// rseq = sip->sip_rack->ra_response; if (cri->cr_offer_recv && !cri->cr_answer_sent) { if (nh->nh_soa == NULL) diff --git a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c index b6e0c01385..6455f4b5c8 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c +++ b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_parse.c @@ -1883,12 +1883,11 @@ static char *next(char **message, const char *sep, const char *strip) static int parsing_error(sdp_parser_t *p, char const *fmt, ...) { - int n; va_list ap; va_start(ap, fmt); memset(p->pr_error, 0, sizeof(p->pr_error)); - n = vsnprintf(p->pr_error, sizeof(p->pr_error), fmt, ap); + vsnprintf(p->pr_error, sizeof(p->pr_error), fmt, ap); va_end(ap); p->pr_ok = 0; diff --git a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c index e2852b446b..e94c6b6758 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c +++ b/libs/sofia-sip/libsofia-sip-ua/sdp/sdp_print.c @@ -685,9 +685,8 @@ static void printing_error(sdp_printer_t *p, const char *fmt, ...) va_list ap; if (p->pr_ok) { - int n; va_start(ap, fmt); - n = vsnprintf(p->pr_buffer, p->pr_bsiz, fmt, ap); + vsnprintf(p->pr_buffer, p->pr_bsiz, fmt, ap); va_end(ap); } diff --git a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c index e00d3912d8..4152669bfd 100644 --- a/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c +++ b/libs/sofia-sip/libsofia-sip-ua/soa/soa_static.c @@ -1010,7 +1010,6 @@ int soa_sdp_mode_set(sdp_session_t const *user, int retval = 0, i, j; int hold_all; int inactive_all; - int inactive = 0; char const *hold_media = NULL; sdp_mode_t send_mode, recv_mode; @@ -1029,7 +1028,6 @@ int soa_sdp_mode_set(sdp_session_t const *user, for (sm = session->sdp_media; sm; sm = sm->m_next, rm = rm_next, i++) { rm_next = rm ? rm->m_next : NULL; - inactive = 0; if (sm->m_rejected) continue; diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c index e494571f54..d719a68b90 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c @@ -3632,10 +3632,10 @@ sres_decode_msg(sres_resolver_t *res, * for the side effects in m */ for (i = 0; i < m->m_qdcount; i++) { char name[1024]; - uint16_t qtype, qclass; + //uint16_t qtype, qclass; m_get_domain(name, sizeof(name), m, 0); /* Query domain */ - qtype = m_get_uint16(m); /* Query type */ - qclass = m_get_uint16(m); /* Query class */ + //qtype = m_get_uint16(m); /* Query type */ + //qclass = m_get_uint16(m); /* Query class */ } if (m->m_error) { diff --git a/libs/sofia-sip/libsofia-sip-ua/stun/stun.c b/libs/sofia-sip/libsofia-sip-ua/stun/stun.c index 09ecff41cb..d2fabe3329 100644 --- a/libs/sofia-sip/libsofia-sip-ua/stun/stun.c +++ b/libs/sofia-sip/libsofia-sip-ua/stun/stun.c @@ -673,12 +673,12 @@ static stun_request_t *stun_request_create(stun_discovery_t *sd) void stun_request_destroy(stun_request_t *req) { - stun_handle_t *sh; + //stun_handle_t *sh; assert(req); enter; - sh = req->sr_handle; + //sh = req->sr_handle; if (x_is_inserted(req, sr)) x_remove(req, sr); @@ -1140,14 +1140,14 @@ static stun_discovery_t *stun_discovery_create(stun_handle_t *sh, static int stun_discovery_destroy(stun_discovery_t *sd) { - stun_handle_t *sh; + //stun_handle_t *sh; enter; if (!sd) return errno = EFAULT, -1; - sh = sd->sd_handle; + //sh = sd->sd_handle; if (sd->sd_timer) su_timer_destroy(sd->sd_timer), sd->sd_timer = NULL; @@ -1883,7 +1883,7 @@ static int process_test_lifetime(stun_request_t *req, stun_msg_t *binding_respon stun_discovery_t *sd = req->sr_discovery; stun_request_t *new; stun_handle_t *sh = req->sr_handle; - su_localinfo_t *li; + //su_localinfo_t *li; su_sockaddr_t *sa; su_timer_t *sockfdy_timer = NULL; su_socket_t sockfdy = sd->sd_socket2; @@ -1954,7 +1954,7 @@ static int process_test_lifetime(stun_request_t *req, stun_msg_t *binding_respon /* Rock, we come from sockfdx */ process_binding_request(req, binding_response); - li = &req->sr_localinfo; + //li = &req->sr_localinfo; sa = req->sr_local_addr; stun_free_message(binding_response); @@ -1981,7 +1981,7 @@ static int process_test_lifetime(stun_request_t *req, stun_msg_t *binding_respon static int action_bind(stun_request_t *req, stun_msg_t *binding_response) { - su_localinfo_t *li = NULL; + //su_localinfo_t *li = NULL; su_sockaddr_t *sa = NULL; stun_discovery_t *sd = req->sr_discovery; stun_handle_t *sh = req->sr_handle; @@ -1992,7 +1992,7 @@ static int action_bind(stun_request_t *req, stun_msg_t *binding_response) process_binding_request(req, binding_response); - li = &req->sr_localinfo; + //li = &req->sr_localinfo; sa = req->sr_local_addr; memcpy(sd->sd_addr_seen_outside, sa, sizeof(su_sockaddr_t)); @@ -3039,7 +3039,7 @@ int stun_process_request(su_socket_t s, stun_msg_t *req, su_sockaddr_t mod_addr[1] = {{ 0 }}, src_addr[1] = {{ 0 }}, chg_addr[1] = {{ 0 }}; stun_attr_t *tmp, m_attr[1], s_attr[1], c_attr[1], **p; su_sockaddr_t to_addr; - int c, i; + int i; tmp = stun_get_attr(req->stun_attr, RESPONSE_ADDRESS); @@ -3071,20 +3071,20 @@ int stun_process_request(su_socket_t s, stun_msg_t *req, /* SOURCE-ADDRESS depends on CHANGE_REQUEST */ tmp = stun_get_attr(req->stun_attr, CHANGE_REQUEST); if (!tmp) { - c = 0; + //c = 0; } else { switch (((stun_attr_changerequest_t *) tmp->pattr)->value) { case STUN_CR_CHANGE_IP: - c = 1; + //c = 1; break; case STUN_CR_CHANGE_PORT: - c = 2; + //c = 2; break; case STUN_CR_CHANGE_IP | STUN_CR_CHANGE_PORT: /* bitwise or */ - c = 3; + //c = 3; break; default: diff --git a/libs/sofia-sip/libsofia-sip-ua/stun/stun_dns.c b/libs/sofia-sip/libsofia-sip-ua/stun/stun_dns.c index bfbfe77e41..86ef0b2c37 100644 --- a/libs/sofia-sip/libsofia-sip-ua/stun/stun_dns.c +++ b/libs/sofia-sip/libsofia-sip-ua/stun/stun_dns.c @@ -163,7 +163,10 @@ stun_dns_lookup_t *stun_dns_lookup(stun_magic_t *magic, query = sres_query(self->stun_sres, priv_sres_cb, self, sres_type_srv, srvname); - } + if (query) { + /* TODO Just so compiler doesn't give error */ + } +} else { su_free(NULL, self), self = NULL; } diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c index edc47e5da9..51259ade1a 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_alloc.c @@ -429,13 +429,13 @@ void *sub_alloc(su_home_t *home, if (sub == NULL || 3 * sub->sub_used > 2 * sub->sub_n) { /* Resize the hash table */ - size_t i, n, n2, used; + size_t i, n, n2; su_block_t *b2; if (sub) - n = home->suh_blocks->sub_n, n2 = 4 * n + 3, used = sub->sub_used; + n = home->suh_blocks->sub_n, n2 = 4 * n + 3; //, used = sub->sub_used; else - n = 0, n2 = SUB_N, used = 0; + n = 0, n2 = SUB_N; //, used = 0; #if 0 printf("su_alloc(home = %p): realloc block hash of size %d\n", home, n2); diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c b/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c index de7279e493..523599c7a7 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_localinfo.c @@ -194,7 +194,8 @@ static void li_sort(su_localinfo_t *i, su_localinfo_t **rresult); int su_getlocalinfo(su_localinfo_t const *hints, su_localinfo_t **return_localinfo) { - int error = 0, ip4 = 0, ip6 = 0; + int error = 0, ip4 = 0; + int ip6 = 0; su_localinfo_t *result = NULL, **rr = &result; su_localinfo_t hh[1] = {{ 0 }}; @@ -231,7 +232,11 @@ int su_getlocalinfo(su_localinfo_t const *hints, break; case 0: - ip6 = ip4 = 1; + ip4 = 1; +#if SU_HAVE_IN6 + ip6 = 1; +#endif + break; default: @@ -260,6 +265,9 @@ int su_getlocalinfo(su_localinfo_t const *hints, } #endif + if (ip6) { + /* Required to make compiler happy */ + } if (!result) error = ELI_NOADDRESS; diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c index a33b77f3e2..8ebab4fd31 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport.c @@ -1595,7 +1595,7 @@ int tport_bind_server(tport_master_t *mr, { char hostname[TPORT_HOSTPORTSIZE]; char const *canon = NULL, *host, *service; - int error = 0, not_supported, family = 0; + int error = 0, family = 0; tport_primary_t *pri = NULL, **tbf; su_addrinfo_t *ai, *res = NULL; unsigned port, port0, port1, old; @@ -1691,8 +1691,6 @@ int tport_bind_server(tport_master_t *mr, break; } - not_supported = 0; - if (port0 == 0 && port == 0) { port = port1 = ntohs(su->su_port); assert(public != tport_type_server || port != 0); diff --git a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c index 55f67a9e2c..3233e1c616 100644 --- a/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c +++ b/libs/sofia-sip/libsofia-sip-ua/tport/tport_type_stun.c @@ -170,10 +170,10 @@ void tport_stun_bind_cb(tport_primary_t *pri, stun_action_t action, stun_state_t event) { - tport_master_t *mr; + //tport_master_t *mr; SU_DEBUG_3(("%s: %s\n", __func__, stun_str_state(event))); - mr = pri->pri_master; + //mr = pri->pri_master; if (event == stun_discovery_done) { tport_stun_bind_done(pri, sh, sd); diff --git a/libs/sofia-sip/libsofia-sip-ua/url/url.c b/libs/sofia-sip/libsofia-sip-ua/url/url.c index bef523e5c9..71544735e1 100644 --- a/libs/sofia-sip/libsofia-sip-ua/url/url.c +++ b/libs/sofia-sip/libsofia-sip-ua/url/url.c @@ -567,7 +567,7 @@ static int _url_d(url_t *url, char *s) { size_t n, p; - char *s0, rest_c, *host, *user; + char rest_c, *host, *user; int have_authority = 1; memset(url, 0, sizeof(*url)); @@ -578,8 +578,6 @@ int _url_d(url_t *url, char *s) return 0; } - s0 = s; - n = strcspn(s, ":/?#"); if (n && s[n] == ':') { From 37b14c9a31f8bc16daacada1c61854063a6eead9 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 23 Apr 2011 22:37:47 -0400 Subject: [PATCH 374/558] mod_callcenter: Display an warning when MOH is invalid and resume wait with silence. FS-2740 --- src/mod/applications/mod_callcenter/mod_callcenter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 0921de3f4e..cac669eb94 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2333,6 +2333,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_uuid_t smember_uuid; char member_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = ""; switch_bool_t agent_found = SWITCH_FALSE; + switch_bool_t moh_valid = SWITCH_TRUE; if (!zstr(data)) { mydata = switch_core_session_strdup(member_session, data); @@ -2507,10 +2508,14 @@ SWITCH_STANDARD_APP(callcenter_function) switch_core_session_flush_private_events(member_session); - if (cur_moh) { + if (moh_valid && cur_moh) { switch_status_t status = switch_ivr_play_file(member_session, NULL, cur_moh, &args); - if (!SWITCH_READ_ACCEPTABLE(status)) { + if (status == SWITCH_STATUS_FALSE /* Invalid Recording */) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_WARNING, "Couldn't play file '%s', continuing wait with no audio\n", cur_moh); + moh_valid = SWITCH_FALSE; + + } else if (!SWITCH_READ_ACCEPTABLE(status)) { break; } @@ -2529,7 +2534,6 @@ SWITCH_STANDARD_APP(callcenter_function) /* Check if we were removed be cause FS Core(BREAK) asked us too */ if (h->member_cancel_reason == CC_MEMBER_CANCEL_REASON_NONE && !agent_found) { - h->member_cancel_reason = CC_MEMBER_CANCEL_REASON_BREAK_OUT; } From adffe07f7512b00f7093091778965a119ca81513 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sat, 23 Apr 2011 23:52:03 -0400 Subject: [PATCH 375/558] mod_voicemail: Fix SQL error on forward when filename length become greater than 255. FS-2959 --- .../mod_voicemail/mod_voicemail.c | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 87008f9bc6..4d31279882 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -2514,12 +2514,26 @@ static switch_status_t deliver_vm(vm_profile_t *profile, goto failed; } - file_path = switch_mprintf("%s%smsg_%s_broadcast_%s", dir_path, SWITCH_PATH_SEPARATOR, use_uuid, filename); - if (copy) { + file_path = switch_mprintf("%s%smsg_%s_broadcast_%s", dir_path, SWITCH_PATH_SEPARATOR, use_uuid, filename); + + if (strlen(file_path) >= 250 /* Max size of the SQL field */) { + char *ext; + switch_safe_free(file_path); + + if (!(ext = strrchr(filename, '.'))) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Filename doesn't include a file format %s\n", filename); + ret = SWITCH_STATUS_FALSE; + goto failed; + } + + ext++; + + file_path = switch_mprintf("%s%smsg_%s_broadcast_%" SWITCH_TIME_T_FMT ".%s", dir_path, SWITCH_PATH_SEPARATOR, use_uuid, switch_micro_time_now(), ext); + } + switch_file_copy(path, file_path, SWITCH_FPROT_FILE_SOURCE_PERMS, pool); } else { - switch_safe_free(file_path); file_path = (char *) path; } From 68c9381770090d89d59bdff9ec391c874488b5d4 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Sun, 24 Apr 2011 22:47:12 -0400 Subject: [PATCH 376/558] switch_core_file: Fix a regression from earlier commit on some distro forcing warning on 'forced' return function value --- src/switch_core_file.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/switch_core_file.c b/src/switch_core_file.c index 2186555386..a3f7cc12cc 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -571,8 +571,11 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_close(switch_file_handle_t *fh) #else command = switch_mprintf("/bin/mv %s %s", fh->spool_path, fh->file_path); #endif - system(command); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Copy spooled file [%s] to [%s]\n", fh->spool_path, fh->file_path); + if (system(command) == -1) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to copy spooled file [%s] to [%s] because of a command error : %s\n", fh->spool_path, fh->file_path, command); + } else { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Copy spooled file [%s] to [%s]\n", fh->spool_path, fh->file_path); + } free(command); } From 566d94d094bd0409e20bb403badc95ea11aa1782 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 25 Apr 2011 06:57:01 -0500 Subject: [PATCH 377/558] VS2010 add esl lua project --- libs/esl/lua/esl_lua.2010.sln | 26 ++++ libs/esl/lua/esl_lua.2010.vcxproj | 178 ++++++++++++++++++++++ libs/esl/lua/esl_lua.2010.vcxproj.filters | 25 +++ 3 files changed, 229 insertions(+) create mode 100644 libs/esl/lua/esl_lua.2010.sln create mode 100644 libs/esl/lua/esl_lua.2010.vcxproj create mode 100644 libs/esl/lua/esl_lua.2010.vcxproj.filters diff --git a/libs/esl/lua/esl_lua.2010.sln b/libs/esl/lua/esl_lua.2010.sln new file mode 100644 index 0000000000..5cdab36b1c --- /dev/null +++ b/libs/esl/lua/esl_lua.2010.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ESL", "esl_lua.2010.vcxproj", "{86B6AB99-A261-455A-9CD6-9142A5A1652E}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|Win32.ActiveCfg = Debug|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|Win32.Build.0 = Debug|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|x64.ActiveCfg = Debug|x64 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Debug|x64.Build.0 = Debug|x64 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|Win32.ActiveCfg = Release|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|Win32.Build.0 = Release|Win32 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|x64.ActiveCfg = Release|x64 + {86B6AB99-A261-455A-9CD6-9142A5A1652E}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/libs/esl/lua/esl_lua.2010.vcxproj b/libs/esl/lua/esl_lua.2010.vcxproj new file mode 100644 index 0000000000..99a355f95a --- /dev/null +++ b/libs/esl/lua/esl_lua.2010.vcxproj @@ -0,0 +1,178 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + ESL + {86B6AB99-A261-455A-9CD6-9142A5A1652E} + esl_lua.2010 + Win32Proj + + + + DynamicLibrary + + + DynamicLibrary + + + DynamicLibrary + + + DynamicLibrary + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.40219.1 + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + $(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\ + true + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + $(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\;$(ProjectDir)..\src\include;%(AdditionalIncludeDirectories) + ESL_DECLARE_STATIC;WIN32;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + esl.lib;lua51.lib;ws2_32.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\$(Platform)\$(Configuration)\;$(ProjectDir)..\..\..\libs\esl\src\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + MachineX86 + + + + + $(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\;$(ProjectDir)..\src\include;%(AdditionalIncludeDirectories) + ESL_DECLARE_STATIC;WIN32;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + esl.lib;lua51.lib;ws2_32.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\$(Platform)\$(Configuration)\;$(ProjectDir)..\..\..\libs\esl\src\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + true + true + MachineX86 + + + + + X64 + + + Disabled + $(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\;$(ProjectDir)..\src\include;%(AdditionalIncludeDirectories) + ESL_DECLARE_STATIC;WIN32;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + esl.lib;lua51.lib;ws2_32.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\$(Platform)\$(Configuration);$(ProjectDir)..\..\..\libs\esl\src\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + MachineX64 + + + + + X64 + + + $(ProjectDir)..\..\..\src\mod\languages\mod_lua\lua\;$(ProjectDir)..\src\include;%(AdditionalIncludeDirectories) + ESL_DECLARE_STATIC;WIN32;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + esl.lib;lua51.lib;ws2_32.lib;%(AdditionalDependencies) + $(ProjectDir)..\..\..\$(Platform)\$(Configuration);$(ProjectDir)..\..\..\libs\esl\src\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) + true + Windows + true + true + MachineX64 + + + + + + + + + + \ No newline at end of file diff --git a/libs/esl/lua/esl_lua.2010.vcxproj.filters b/libs/esl/lua/esl_lua.2010.vcxproj.filters new file mode 100644 index 0000000000..51644e4cdf --- /dev/null +++ b/libs/esl/lua/esl_lua.2010.vcxproj.filters @@ -0,0 +1,25 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + Source Files + + + Source Files + + + \ No newline at end of file From 7470bf32a1478f75732e6ffad80d7c3365981409 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Mon, 25 Apr 2011 07:12:30 -0500 Subject: [PATCH 378/558] VS2010 add mod_callcenter to solution - not built by default --- Freeswitch.2010.sln | 16 ++++++++++++++++ .../mod_callcenter/mod_callcenter.2008.vcproj | 2 +- .../mod_callcenter/mod_callcenter.2010.vcxproj | 6 +----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Freeswitch.2010.sln b/Freeswitch.2010.sln index 63b3ad12f2..cfb4770b6f 100644 --- a/Freeswitch.2010.sln +++ b/Freeswitch.2010.sln @@ -709,6 +709,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_say_pt", "src\mod\say\m EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ldns", "libs\win32\ldns\ldns-lib\ldns-lib.2010.vcxproj", "{23B4D303-79FC-49E0-89E2-2280E7E28940}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_callcenter", "src\mod\applications\mod_callcenter\mod_callcenter.2010.vcxproj", "{47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution All|Win32 = All|Win32 @@ -3633,6 +3635,19 @@ Global {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64.Build.0 = Release|x64 {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x64 Setup.ActiveCfg = Release|x64 {23B4D303-79FC-49E0-89E2-2280E7E28940}.Release|x86 Setup.ActiveCfg = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.All|Win32.ActiveCfg = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.All|x64.ActiveCfg = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.All|x64.Build.0 = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.All|x64 Setup.ActiveCfg = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.All|x86 Setup.ActiveCfg = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Debug|Win32.ActiveCfg = Debug|Win32 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Debug|x64.ActiveCfg = Debug|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Debug|x64 Setup.ActiveCfg = Debug|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Debug|x86 Setup.ActiveCfg = Debug|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Release|Win32.ActiveCfg = Release|Win32 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Release|x64.ActiveCfg = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Release|x64 Setup.ActiveCfg = Release|x64 + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}.Release|x86 Setup.ActiveCfg = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -3680,6 +3695,7 @@ Global {2E250296-0C08-4342-9C8A-BCBDD0E7DF65} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {B889A18E-70A7-44B5-B2C9-47798D4F43B3} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {5C2B4D88-3BEA-4FE0-90DF-FA9836099D5F} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78} {07113B25-D3AF-4E04-BA77-4CD1171F022C} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {A27CCA23-1541-4337-81A4-F0A6413078A0} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} {E7BC026C-7CC5-45A3-BC7C-3B88EEF01F24} = {C5F182F9-754A-4EC5-B50F-76ED02BE13F4} diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj b/src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj index 82103cfba3..85c60c56cf 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj +++ b/src/mod/applications/mod_callcenter/mod_callcenter.2008.vcproj @@ -3,7 +3,7 @@ ProjectType="Visual C++" Version="9.00" Name="mod_callcenter" - ProjectGUID="{11C9BC3D-45E9-46E3-BE84-B8CEE4685E39}" + ProjectGUID="{47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A}" RootNamespace="mod_callcenter" Keyword="Win32Proj" TargetFrameworkVersion="131072" diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj b/src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj index a8d988ae36..224de6286f 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj +++ b/src/mod/applications/mod_callcenter/mod_callcenter.2010.vcxproj @@ -20,7 +20,7 @@ mod_callcenter - {11C9BC3D-45E9-46E3-BE84-B8CEE4685E39} + {47886A6C-CCA6-4F9F-A7D4-F97D06FB2B1A} mod_callcenter Win32Proj @@ -63,10 +63,6 @@ <_ProjectFileVersion>10.0.30319.1 - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ From 98157dbbfc518ff95befc16e8d7a293110bd8cfa Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 25 Apr 2011 09:13:39 -0500 Subject: [PATCH 379/558] skypopen: OSS driver, refinement --- src/mod/endpoints/mod_skypopen/oss/skypopen.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/oss/skypopen.h b/src/mod/endpoints/mod_skypopen/oss/skypopen.h index 3d94085dde..f61925626c 100644 --- a/src/mod/endpoints/mod_skypopen/oss/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/oss/skypopen.h @@ -23,8 +23,8 @@ #define CENTOS_5 /* define this ONLY if you're on CentOS 5.x (eg: undef on CentOS 6.x ) */ #define WANT_HRTIMER /* undef this only if you don't want to use High Resolution Timers (why?) */ -#define SKYPOPEN_BLK 960 -#define SKYPOPEN_SLEEP 10 +#define SKYPOPEN_BLK 1920 +#define SKYPOPEN_SLEEP 20 #define SKYPOPEN_MAJOR 14 /* dynamic major by default */ From 403b3a23bea9fd0a53436c5adf73fb4fc4af8ac3 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 25 Apr 2011 11:36:42 -0500 Subject: [PATCH 380/558] skypopen: OSS driver, refinement --- src/mod/endpoints/mod_skypopen/oss/skypopen.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skypopen/oss/skypopen.h b/src/mod/endpoints/mod_skypopen/oss/skypopen.h index f61925626c..de38c791c9 100644 --- a/src/mod/endpoints/mod_skypopen/oss/skypopen.h +++ b/src/mod/endpoints/mod_skypopen/oss/skypopen.h @@ -19,10 +19,18 @@ #ifndef _SKYPOPEN_H_ #define _SKYPOPEN_H_ +#include #include /* needed for the _IOW etc stuff used later */ -#define CENTOS_5 /* define this ONLY if you're on CentOS 5.x (eg: undef on CentOS 6.x ) */ +#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 18) +#define CENTOS_5 #define WANT_HRTIMER /* undef this only if you don't want to use High Resolution Timers (why?) */ +#endif /* CentOS 5.x */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24) +#define WANT_HRTIMER +#endif /* HRTIMER */ + #define SKYPOPEN_BLK 1920 #define SKYPOPEN_SLEEP 20 From 1ba18b357c09366b64b0053299fb7940db39d911 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 25 Apr 2011 10:29:25 -0700 Subject: [PATCH 381/558] Update to-be-recorded sounds (conf and vm stuff) --- docs/phrase/phrase_en.xml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 30d642460f..ab4f61bb46 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -436,12 +436,24 @@ + + - + + + + + + + + + + + From a2a09fb1d97662f81e9a25c2c3ddb0b35e1f866c Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 25 Apr 2011 14:22:57 -0400 Subject: [PATCH 382/558] mod_callcenter: Try to make uuid-standby continue the dialplan. Let me know if this helped --- src/mod/applications/mod_callcenter/mod_callcenter.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index cac669eb94..6007e96bdb 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1571,7 +1571,13 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" <%s> from queue %s%s\n", h->agent_name, h->member_cid_name, h->member_cid_number, h->queue_name, (h->record_template?" (Recorded)":"")); - switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); + + /* TODO Temp fix so it continue the dialplan after hangup... Not sure of the reason why the order make a difference */ + if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)) { + switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); + } else { + switch_ivr_uuid_bridge(switch_core_session_get_uuid(agent_session), h->member_session_uuid); + } switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); From debab81ce938b86bbd5e7b34fef7658fc8f2b89e Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 25 Apr 2011 15:06:32 -0400 Subject: [PATCH 383/558] it the other way arround ! --- src/mod/applications/mod_callcenter/mod_callcenter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 6007e96bdb..872e2bc0b0 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1574,9 +1574,9 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* TODO Temp fix so it continue the dialplan after hangup... Not sure of the reason why the order make a difference */ if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)) { - switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); - } else { switch_ivr_uuid_bridge(switch_core_session_get_uuid(agent_session), h->member_session_uuid); + } else { + switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); } switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); From bc19d28310cf322eab23b93c5b6152c7390c4c25 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Mon, 25 Apr 2011 15:53:54 -0400 Subject: [PATCH 384/558] Fix regression to dns resolve in sofia. It will make sofia and compiler happy --- libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c index d719a68b90..ceb7d0f601 100644 --- a/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c +++ b/libs/sofia-sip/libsofia-sip-ua/sresolv/sres.c @@ -3632,10 +3632,14 @@ sres_decode_msg(sres_resolver_t *res, * for the side effects in m */ for (i = 0; i < m->m_qdcount; i++) { char name[1024]; - //uint16_t qtype, qclass; + uint16_t qtype, qclass; m_get_domain(name, sizeof(name), m, 0); /* Query domain */ - //qtype = m_get_uint16(m); /* Query type */ - //qclass = m_get_uint16(m); /* Query class */ + qtype = m_get_uint16(m); /* Query type */ + qclass = m_get_uint16(m); /* Query class */ + if (qtype && qclass) { + /* XXX: never mind these useless check, this is done to make compiler happy about unused value */ + } + } if (m->m_error) { From 3484874f5848c2dc24e7515936fdb7d33e0f9e73 Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Tue, 26 Apr 2011 00:15:15 -0400 Subject: [PATCH 385/558] mod_callcenter: Apparently, it by design that only 1 of the 2 leg can continue the dialplan. So member are always A leg and agent are B leg. If you want to continue after hangup a call for the agent like in uuid standby mode, use the transfer_after_bridge feature. Sample example usage is on the mod_callcenter wiki page. --- src/mod/applications/mod_callcenter/mod_callcenter.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 872e2bc0b0..4ec9d12e92 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -1572,12 +1572,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Agent %s answered \"%s\" <%s> from queue %s%s\n", h->agent_name, h->member_cid_name, h->member_cid_number, h->queue_name, (h->record_template?" (Recorded)":"")); - /* TODO Temp fix so it continue the dialplan after hangup... Not sure of the reason why the order make a difference */ - if (!strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)) { - switch_ivr_uuid_bridge(switch_core_session_get_uuid(agent_session), h->member_session_uuid); - } else { - switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); - } + switch_ivr_uuid_bridge(h->member_session_uuid, switch_core_session_get_uuid(agent_session)); switch_channel_set_variable(member_channel, "cc_agent_uuid", agent_uuid); From 5d46ddbc92dce0fbb5649d536eebdbdd32839e27 Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Tue, 26 Apr 2011 15:10:37 +0200 Subject: [PATCH 386/558] FS-3195, thank you Christian Benke --- conf/lang/de/vm/sounds.xml | 407 ++++++++++++++++++++++++++++ src/mod/say/mod_say_de/mod_say_de.c | 37 ++- 2 files changed, 435 insertions(+), 9 deletions(-) create mode 100644 conf/lang/de/vm/sounds.xml diff --git a/conf/lang/de/vm/sounds.xml b/conf/lang/de/vm/sounds.xml new file mode 100644 index 0000000000..ad9dc2e136 --- /dev/null +++ b/conf/lang/de/vm/sounds.xml @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mod/say/mod_say_de/mod_say_de.c b/src/mod/say/mod_say_de/mod_say_de.c index 7212a5f581..667f3f6669 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -40,6 +40,7 @@ * Anthony Minessale II * Michael B. Murdock * Daniel Swarbrick + * Christian Benke * * mod_say_de.c -- Say for German * @@ -80,17 +81,27 @@ SWITCH_MODULE_DEFINITION(mod_say_de, mod_say_de_load, NULL, NULL); return SWITCH_STATUS_FALSE; \ }} \ -static switch_status_t play_group(switch_say_method_t method, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args) +static switch_status_t play_group(switch_say_method_t method, switch_say_gender_t gender, int a, int b, int c, char *what, switch_core_session_t *session, switch_input_args_t *args) { if (a) { - say_file("digits/%d.wav", a); - say_file("digits/hundred.wav"); + /*german nominativ for "one" in numbers like 21, 171, 4591 is flexed("ein" instead of "eins"), 2-9 are not*/ + if ( a == 1 ) { + say_file("digits/s-%d.wav"); + } else { + say_file("digits/%d.wav", a); + } + say_file("digits/hundred.wav"); } if (b) { if (b > 1) { - say_file("digits/%d.wav", c); + /*german nominativ for "one" in numbers like 21, 171, 4591 is flexed, 2-9 are not*/ + if ( c == 1 ) { + say_file("digits/s-%d.wav"); + } else { + say_file("digits/%d.wav", c); + } say_file("currency/and.wav"); if (method == SSM_COUNTED) { say_file("digits/h-%d0.wav", b); @@ -111,7 +122,15 @@ static switch_status_t play_group(switch_say_method_t method, int a, int b, int if (method == SSM_COUNTED) { say_file("digits/h-%d.wav", c); } else { - say_file("digits/%d.wav", c); + /*"one" used as an article is feminine or masculine in german, e.g. voicemail-message is feminine + only applies to the likes of 1, 101, 1001 etc.*/ + if ( b == 0 && c == 1 && gender == SSG_FEMININE ) { + say_file("digits/%d_f.wav", c); + } else if ( b == 0 && c == 1 && what ) { + say_file("digits/s-%d.wav"); + } else { + say_file("digits/%d.wav", c); + } } } @@ -150,7 +169,7 @@ static switch_status_t de_say_general_count(switch_core_session_t *session, char in = atoi(tosay); - if (in != 0) { + if (in != 0) { /*fills the places-array with tosay(resp. in) from tail to front e.g. 84371 would be places[|1|7|3|4|8|0|0|0|], up to 1 billion minus 1*/ for (x = 8; x >= 0; x--) { int num = (int) pow(10, x); if ((places[(uint32_t) x] = in / num)) { @@ -161,13 +180,13 @@ static switch_status_t de_say_general_count(switch_core_session_t *session, char switch (say_args->method) { case SSM_COUNTED: case SSM_PRONOUNCED: - if ((status = play_group(SSM_PRONOUNCED, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(SSM_PRONOUNCED, say_args->gender, places[8], places[7], places[6], "digits/million.wav", session, args)) != SWITCH_STATUS_SUCCESS) { return status; } - if ((status = play_group(SSM_PRONOUNCED, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(SSM_PRONOUNCED, say_args->gender, places[5], places[4], places[3], "digits/thousand.wav", session, args)) != SWITCH_STATUS_SUCCESS) { return status; } - if ((status = play_group(say_args->method, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) { + if ((status = play_group(say_args->method, say_args->gender, places[2], places[1], places[0], NULL, session, args)) != SWITCH_STATUS_SUCCESS) { return status; } break; From b81cc4bc275a1c8a524182d64cfc2af3f2d4374e Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Tue, 26 Apr 2011 15:12:30 +0200 Subject: [PATCH 387/558] FS-3195, added german additional say module stuff to debian build --- debian/freeswitch-lang-de.conffiles | 1 + debian/freeswitch-lang-de.install | 1 + 2 files changed, 2 insertions(+) diff --git a/debian/freeswitch-lang-de.conffiles b/debian/freeswitch-lang-de.conffiles index 34d88b70ea..5c1dded24e 100644 --- a/debian/freeswitch-lang-de.conffiles +++ b/debian/freeswitch-lang-de.conffiles @@ -1,3 +1,4 @@ /opt/freeswitch/conf/lang/de/demo/demo.xml /opt/freeswitch/conf/lang/de/de.xml /opt/freeswitch/conf/lang/de/vm/tts.xml +/opt/freeswitch/conf/lang/de/vm/sounds.xml diff --git a/debian/freeswitch-lang-de.install b/debian/freeswitch-lang-de.install index a7e326a6ad..1b33ebec72 100644 --- a/debian/freeswitch-lang-de.install +++ b/debian/freeswitch-lang-de.install @@ -1,4 +1,5 @@ opt/freeswitch/conf/lang/de/demo/demo.xml opt/freeswitch/conf/lang/de/de.xml opt/freeswitch/conf/lang/de/vm/tts.xml +/opt/freeswitch/conf/lang/de/vm/sounds.xml opt/freeswitch/mod/mod_say_de.so* From bf107c6f0f1cdfb8f78f984a596510215452f490 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 26 Apr 2011 09:43:22 -0500 Subject: [PATCH 388/558] FS-3269 --resolve --- src/switch_channel.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index cfeb827949..7d351791fd 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1194,9 +1194,11 @@ SWITCH_DECLARE(switch_bool_t) switch_channel_clear_flag_partner(switch_channel_t SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, switch_channel_t *other_channel, switch_channel_state_t want_state) { + switch_assert(channel); + for (;;) { if ((channel->state == channel->running_state && channel->running_state == want_state) || - switch_channel_down(other_channel) || switch_channel_down(channel)) { + (other_channel && !switch_channel_ready(other_channel)) || !switch_channel_ready(channel)) { break; } switch_yield(20000); From dd6853cb983ef149ca61318900d7da1453d8ae88 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 26 Apr 2011 11:04:44 -0400 Subject: [PATCH 389/558] freetdm: ss7 - Fix for some SIP RDNIS headers being overwritten --- libs/freetdm/mod_freetdm/mod_freetdm.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8739c4c0bf..e6930ab16f 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1301,22 +1301,27 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ftdm_set_string(caller_data.rdnis.digits, sipvar); } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-TON"); - if (sipvar) { - caller_data.rdnis.type = (uint8_t)atoi(sipvar); - } - sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan"); if (sipvar) { - caller_data.rdnis.plan = (uint8_t)atoi(sipvar); + ftdm_call_add_var(&caller_data, "ss7_rdnis_plan", sipvar); } - /* Used by ftmod_sangoma_ss7 only */ sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI"); if (sipvar) { ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_nadi", sipvar); } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Screen"); + if (sipvar) { + ftdm_call_add_var(&caller_data, "ss7_rdnis_screen_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Presentation"); + if (sipvar) { + ftdm_call_add_var(&caller_data, "ss7_rdnis_pres_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); if (sipvar) { caller_data.screen = (uint8_t)atoi(sipvar); From ce5c8462001636f1f84ed4c4a9ac87a6363174a6 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 26 Apr 2011 12:06:11 -0500 Subject: [PATCH 390/558] FS-3236 --resolve --- src/mod/endpoints/mod_sofia/sofia.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 992757c526..54e95f2b2e 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -4790,7 +4790,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, if (status == 183 && !r_sdp) { if ((channel && switch_true(switch_channel_get_variable(channel, "sip_ignore_183nosdp"))) || sofia_test_pflag(profile, PFLAG_IGNORE_183NOSDP)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Ignoring 183 w/o sdp\n", switch_channel_get_name(channel)); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Ignoring 183 w/o sdp\n", channel ? switch_channel_get_name(channel) : "None"); goto done; } status = 180; From 6558b9bba9738094c19527c25db2ffad7ad76d18 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 26 Apr 2011 13:21:49 -0400 Subject: [PATCH 391/558] freetdm: fix compile errors from previous commit --- libs/freetdm/mod_freetdm/mod_freetdm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index e6930ab16f..8d73e391a1 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1303,7 +1303,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan"); if (sipvar) { - ftdm_call_add_var(&caller_data, "ss7_rdnis_plan", sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_plan", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-NADI"); @@ -1313,12 +1313,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Screen"); if (sipvar) { - ftdm_call_add_var(&caller_data, "ss7_rdnis_screen_ind", sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_screen_ind", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Presentation"); if (sipvar) { - ftdm_call_add_var(&caller_data, "ss7_rdnis_pres_ind", sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_pres_ind", sipvar); } From f235d95537e6c140e8c11c6a233feacc6495694b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Apr 2011 14:52:53 -0400 Subject: [PATCH 392/558] freetdm: SS7 - Support for receiving RDNIS variables --- libs/freetdm/mod_freetdm/mod_freetdm.c | 12 ++++- .../ftmod_sangoma_ss7_handle.c | 12 +---- .../ftmod_sangoma_ss7_main.h | 1 + .../ftmod_sangoma_ss7_support.c | 45 ++++++++++++++++++- 4 files changed, 57 insertions(+), 13 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 8d73e391a1..da5f2c86f9 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1591,8 +1591,18 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-DNIS-Plan", "%d", channel_caller_data->dnis.plan); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS", "%s", channel_caller_data->rdnis.digits); - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-TON", "%d", channel_caller_data->rdnis.type); + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-NADI", "%d", channel_caller_data->rdnis.type); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Plan", "%d", channel_caller_data->rdnis.plan); + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_screen_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Screen", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_rdnis_pres_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Presentation", "%d", channel_caller_data->rdnis.plan); + } switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 40a712f8e2..e2af0852e8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -185,17 +185,7 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ SS7_INFO_CHAN(ftdmchan,"No Called party (DNIS) information in IAM!%s\n", " "); } - /* fill in rdnis information*/ - if (siConEvnt->redirgNum.eh.pres) { - if (siConEvnt->redirgNum.addrSig.pres) { - /* fill in the rdnis digits */ - copy_tknStr_from_sngss7(siConEvnt->redirgNum.addrSig, - ftdmchan->caller_data.rdnis.digits, - siConEvnt->cgPtyNum.oddEven); - } - } else { - SS7_DEBUG_CHAN(ftdmchan,"No RDNIS party information in IAM!%s\n", " "); - } + copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum); /* fill in the TMR/bearer capability */ if (siConEvnt->txMedReq.eh.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index ea31a89c5b..c698b4d261 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -790,6 +790,7 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); +ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 22b522409f..9be1f8a8fb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -389,13 +389,56 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven); } +ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum) +{ + char val[20]; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + + if (redirgNum->eh.pres != PRSNT_NODEF || redirgNum->addrSig.pres != PRSNT_NODEF) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Redirecting Number available\n"); + return FTDM_SUCCESS; + } + + copy_tknStr_from_sngss7(redirgNum->addrSig, ftdmchan->caller_data.rdnis.digits, redirgNum->oddEven); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number:%s\n", ftdmchan->caller_data.rdnis.digits); + + if (redirgNum->natAddr.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->natAddr.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_nadi", val); + caller_data->rdnis.type = redirgNum->natAddr.val; + } + + if (redirgNum->scrInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->scrInd.val); + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_screen_ind", val); + } + + if (redirgNum->presRest.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->presRest.val); + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Presentation Ind:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_pres_ind", val); + } + + if (redirgNum->numPlan.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", redirgNum->numPlan.val); + SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_rdnis_plan", val); + caller_data->rdnis.plan = redirgNum->numPlan.val; + } + + return FTDM_SUCCESS; +} + ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) { uint8_t i; uint8_t j; /* check if the token string is present */ - if (str.pres == 1) { j = 0; From 2e8b3d75d0ffe196d7ea8989c2411b8e57c34d28 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 26 Apr 2011 15:13:00 -0400 Subject: [PATCH 393/558] chlog: freetdm: SS7 - Fix for Screening Ind and Presentation Ind not being sent out --- libs/freetdm/mod_freetdm/mod_freetdm.c | 12 ++--- .../ftmod_sangoma_ss7_main.h | 8 +-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 4 +- .../ftmod_sangoma_ss7_support.c | 49 +++++++++++++------ 4 files changed, 45 insertions(+), 28 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index da5f2c86f9..7f69e11f6c 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1324,12 +1324,12 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); if (sipvar) { - caller_data.screen = (uint8_t)atoi(sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_screen_ind", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Presentation"); if (sipvar) { - caller_data.pres = (uint8_t)atoi(sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_pres_ind", sipvar); } @@ -1348,19 +1348,19 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi } if ((var = channel_get_variable(session, var_event, "freetdm_bearer_layer1"))) { - caller_data.bearer_layer1 = (uint8_t)atoi(var); + caller_data.bearer_layer1 = (uint8_t)atoi(var); } if ((var = channel_get_variable(session, var_event, "freetdm_screening_ind"))) { - ftdm_set_screening_ind(var, &caller_data.screen); + ftdm_set_screening_ind(var, &caller_data.screen); } if ((var = channel_get_variable(session, var_event, "freetdm_presentation_ind"))) { - ftdm_set_presentation_ind(var, &caller_data.pres); + ftdm_set_presentation_ind(var, &caller_data.pres); } if ((var = channel_get_variable(session, var_event, "freetdm_outbound_ton"))) { - ftdm_set_ton(var, &caller_data.dnis.type); + ftdm_set_ton(var, &caller_data.dnis.type); } else { caller_data.dnis.type = outbound_profile->destination_number_ton; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index c698b4d261..f8a9cec9ff 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -785,10 +785,10 @@ int ftmod_ss7_parse_xml(ftdm_conf_parameter_t *ftdm_parameters, ftdm_span_t *spa ftdm_status_t ftdm_sngss7_handle_cli_cmd(ftdm_stream_handle_t *stream, const char *data); /* in ftmod_sangoma_ss7_support.c */ -uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); -uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum); -uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); -uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum); +ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum); +ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum); +ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); +ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 9fe279d7c5..149e022ff8 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -180,10 +180,10 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } /* if ANSI */ /* copy down the called number information */ - copy_cdPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cdPtyNum); + copy_cdPtyNum_to_sngss7 (ftdmchan, &iam.cdPtyNum); /* copy down the calling number information */ - copy_cgPtyNum_to_sngss7 (&ftdmchan->caller_data, &iam.cgPtyNum); + copy_cgPtyNum_to_sngss7 (ftdmchan, &iam.cgPtyNum); /* check if the user would like a custom NADI value for the calling Pty Num */ clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 9be1f8a8fb..17cae48681 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -91,15 +91,16 @@ FTDM_ENUM_NAMES(BLK_FLAGS_NAMES, BLK_FLAGS_STRING) FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t, BLK_FLAGS_NAMES, 31) /* FUNCTIONS ******************************************************************/ -uint8_t copy_cgPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) +ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) { - return 0; + return FTDM_SUCCESS; } /******************************************************************************/ -uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) +ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) { + const char *val; int k; int j; int flag; @@ -108,24 +109,38 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) uint8_t lower; uint8_t upper; - /**************************************************************************/ + ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + cgPtyNum->eh.pres = PRSNT_NODEF; - /**************************************************************************/ + cgPtyNum->natAddrInd.pres = PRSNT_NODEF; cgPtyNum->natAddrInd.val = 0x03; - /**************************************************************************/ + + cgPtyNum->scrnInd.pres = PRSNT_NODEF; - cgPtyNum->scrnInd.val = ftdm->screen; - /**************************************************************************/ + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_screen_ind"); + if (!ftdm_strlen_zero(val)) { + cgPtyNum->scrnInd.val = atoi(val); + } else { + cgPtyNum->scrnInd.val = ftdm->screen; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Screening Ind %d\n", cgPtyNum->scrnInd.val); + cgPtyNum->presRest.pres = PRSNT_NODEF; - cgPtyNum->presRest.val = ftdm->pres; - /**************************************************************************/ + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_pres_ind"); + if (!ftdm_strlen_zero(val)) { + cgPtyNum->presRest.val = atoi(val); + } else { + cgPtyNum->presRest.val = ftdm->pres; + } + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", cgPtyNum->presRest.val); + cgPtyNum->numPlan.pres = PRSNT_NODEF; cgPtyNum->numPlan.val = 0x01; - /**************************************************************************/ + cgPtyNum->niInd.pres = PRSNT_NODEF; cgPtyNum->niInd.val = 0x00; - /**************************************************************************/ + cgPtyNum->addrSig.pres = PRSNT_NODEF; /* atoi will search through memory starting from the pointer it is given until @@ -207,18 +222,18 @@ uint8_t copy_cgPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCgPtyNum *cgPtyNum) cgPtyNum->oddEven.pres = PRSNT_NODEF; cgPtyNum->oddEven.val = odd; /**************************************************************************/ - return 0; + return FTDM_SUCCESS; } /******************************************************************************/ -uint8_t copy_cdPtyNum_from_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) +ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { - return 0; + return FTDM_SUCCESS; } /******************************************************************************/ -uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) +ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { int k; int j; @@ -228,6 +243,8 @@ uint8_t copy_cdPtyNum_to_sngss7(ftdm_caller_data_t *ftdm, SiCdPtyNum *cdPtyNum) uint8_t lower; uint8_t upper; + ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + /**************************************************************************/ cdPtyNum->eh.pres = PRSNT_NODEF; /**************************************************************************/ From f8835a817bad2d1cd35dc6bf5341f0b245cfd7fe Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Apr 2011 09:48:28 -0500 Subject: [PATCH 394/558] FS-3271 --resolve --- src/switch_channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 7d351791fd..2cd45b9e06 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1198,7 +1198,7 @@ SWITCH_DECLARE(void) switch_channel_wait_for_state(switch_channel_t *channel, sw for (;;) { if ((channel->state == channel->running_state && channel->running_state == want_state) || - (other_channel && !switch_channel_ready(other_channel)) || !switch_channel_ready(channel)) { + (other_channel && switch_channel_down(other_channel)) || switch_channel_down(channel)) { break; } switch_yield(20000); From 1badec17c8cdd70747eeda2d888b13d3d347045a Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 27 Apr 2011 11:26:08 -0500 Subject: [PATCH 395/558] fix issue on mailing list mod_crd_sqlite entry limit and sqlite segfaults on triggers --- libs/sqlite/src/sqliteInt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sqlite/src/sqliteInt.h b/libs/sqlite/src/sqliteInt.h index 6483912cc9..3686a091e7 100644 --- a/libs/sqlite/src/sqliteInt.h +++ b/libs/sqlite/src/sqliteInt.h @@ -297,7 +297,7 @@ static inline char *strndup_lite(const char *s, size_t n) #define sqliteMalloc(x) zmalloc(x)//sqlite3Malloc(x,1) #define sqliteMallocRaw(x) malloc(x)//sqlite3MallocRaw(x,1) #define sqliteRealloc(x,y) realloc(x, y)//sqlite3Realloc(x,y) -#define sqliteStrDup(x) strdup(x)//sqlite3StrDup(x) +#define sqliteStrDup(x) (x?strdup(x):NULL)//sqlite3StrDup(x) #define sqliteStrNDup(x,y) strndup_lite(x,y) //sqlite3StrNDup(x,y) #define sqliteReallocOrFree(x,y) sqlite3ReallocOrFree(x,y) From 36262e117f95bf08f7a7131f01edcc56d62b62fa Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Apr 2011 11:50:32 -0500 Subject: [PATCH 396/558] ping .update to force sofia rebuild --- libs/sofia-sip/.update | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index ecc88483f6..fafef50c36 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Tue Mar 22 15:01:49 CDT 2011 +Wed Apr 27 11:49:37 CDT 2011 From dcfc7924c5030eadc1cc936f7c0664159149a4bc Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Apr 2011 15:16:52 -0500 Subject: [PATCH 397/558] remove unnecessary locks --- .../mod_conference/mod_conference.c | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 0a5ca0e292..986ec56128 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -1623,7 +1623,7 @@ static void conference_loop_fn_energy_up(conference_member_t *member, caller_con if (member == NULL) return; - lock_member(member); + member->energy_level += 200; if (member->energy_level > 1800) { member->energy_level = 1800; @@ -1636,7 +1636,6 @@ static void conference_loop_fn_energy_up(conference_member_t *member, caller_con switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level); //conference_member_say(member, msg, 0); @@ -1660,7 +1659,6 @@ static void conference_loop_fn_energy_equ_conf(conference_member_t *member, call if (member == NULL) return; - lock_member(member); member->energy_level = member->conference->energy_level; if (test_eflag(member->conference, EFLAG_ENERGY_LEVEL) && @@ -1670,7 +1668,6 @@ static void conference_loop_fn_energy_equ_conf(conference_member_t *member, call switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level); //conference_member_say(member, msg, 0); @@ -1691,7 +1688,6 @@ static void conference_loop_fn_energy_dn(conference_member_t *member, caller_con if (member == NULL) return; - lock_member(member); member->energy_level -= 200; if (member->energy_level < 0) { member->energy_level = 0; @@ -1704,7 +1700,6 @@ static void conference_loop_fn_energy_dn(conference_member_t *member, caller_con switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->energy_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Energy level %d", member->energy_level); //conference_member_say(member, msg, 0); @@ -1725,7 +1720,6 @@ static void conference_loop_fn_volume_talk_up(conference_member_t *member, calle if (member == NULL) return; - lock_member(member); member->volume_out_level++; switch_normalize_volume(member->volume_out_level); @@ -1736,7 +1730,6 @@ static void conference_loop_fn_volume_talk_up(conference_member_t *member, calle switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level); //conference_member_say(member, msg, 0); @@ -1759,7 +1752,6 @@ static void conference_loop_fn_volume_talk_zero(conference_member_t *member, cal if (member == NULL) return; - lock_member(member); member->volume_out_level = 0; if (test_eflag(member->conference, EFLAG_VOLUME_LEVEL) && @@ -1769,7 +1761,6 @@ static void conference_loop_fn_volume_talk_zero(conference_member_t *member, cal switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level); //conference_member_say(member, msg, 0); @@ -1792,7 +1783,6 @@ static void conference_loop_fn_volume_talk_dn(conference_member_t *member, calle if (member == NULL) return; - lock_member(member); member->volume_out_level--; switch_normalize_volume(member->volume_out_level); @@ -1803,7 +1793,6 @@ static void conference_loop_fn_volume_talk_dn(conference_member_t *member, calle switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_out_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Volume level %d", member->volume_out_level); //conference_member_say(member, msg, 0); @@ -1825,7 +1814,6 @@ static void conference_loop_fn_volume_listen_up(conference_member_t *member, cal if (member == NULL) return; - lock_member(member); member->volume_in_level++; switch_normalize_volume(member->volume_in_level); @@ -1836,7 +1824,6 @@ static void conference_loop_fn_volume_listen_up(conference_member_t *member, cal switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level); //conference_member_say(member, msg, 0); @@ -1859,7 +1846,6 @@ static void conference_loop_fn_volume_listen_zero(conference_member_t *member, c if (member == NULL) return; - lock_member(member); member->volume_in_level = 0; if (test_eflag(member->conference, EFLAG_GAIN_LEVEL) && @@ -1869,7 +1855,6 @@ static void conference_loop_fn_volume_listen_zero(conference_member_t *member, c switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level); //conference_member_say(member, msg, 0); @@ -1892,7 +1877,6 @@ static void conference_loop_fn_volume_listen_dn(conference_member_t *member, cal if (member == NULL) return; - lock_member(member); member->volume_in_level--; switch_normalize_volume(member->volume_in_level); @@ -1903,7 +1887,6 @@ static void conference_loop_fn_volume_listen_dn(conference_member_t *member, cal switch_event_add_header(event, SWITCH_STACK_BOTTOM, "New-Level", "%d", member->volume_in_level); switch_event_fire(&event); } - unlock_member(member); //switch_snprintf(msg, sizeof(msg), "Gain level %d", member->volume_in_level); //conference_member_say(member, msg, 0); @@ -3785,18 +3768,18 @@ static switch_status_t conf_api_sub_kick(conference_member_t *member, switch_str { switch_event_t *event; - if (member == NULL) + if (member == NULL) { return SWITCH_STATUS_GENERR; - - lock_member(member); + } + switch_clear_flag(member, MFLAG_RUNNING); switch_set_flag_locked(member, MFLAG_KICKED); - switch_core_session_kill_channel(member->session, SWITCH_SIG_BREAK); - unlock_member(member); + if (stream != NULL) { stream->write_function(stream, "OK kicked %u\n", member->id); } + if (member->conference && test_eflag(member->conference, EFLAG_KICK_MEMBER)) { if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT) == SWITCH_STATUS_SUCCESS) { conference_add_event_member_data(member, event); @@ -3804,6 +3787,7 @@ static switch_status_t conf_api_sub_kick(conference_member_t *member, switch_str switch_event_fire(&event); } } + return SWITCH_STATUS_SUCCESS; } From 24003dc28ff81233a01477629441f18893b0b0dd Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 27 Apr 2011 16:18:59 -0500 Subject: [PATCH 398/558] set flag --- src/mod/applications/mod_conference/mod_conference.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 986ec56128..4f436534a4 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -778,7 +778,7 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe } switch_channel_clear_app_flag_key("conf_silent", channel, CONF_SILENT_REQ); - + switch_channel_set_app_flag_key("conf_silent", channel, CONF_SILENT_DONE); switch_ivr_dmachine_create(&member->dmachine, "mod_conference", NULL, 500, 0, NULL, NULL, NULL); From 3829e2fda588108fc98faf40136a9aeaeb3fdbf7 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 28 Apr 2011 00:29:28 -0500 Subject: [PATCH 399/558] FS-3272 --resolve moc we need to discuss this with anthm catch me on irc thanks --- .../mod_callcenter/mod_callcenter.c | 31 ++++++++++++------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 4ec9d12e92..552eee9518 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -37,6 +37,13 @@ #define CC_AGENT_TYPE_UUID_STANDBY "uuid-standby" #define CC_SQLITE_DB_NAME "callcenter" +#ifdef WIN32 +#define MSWITCH_TIME_T_FMT "lld" +#else +#define MSWITCH_TIME_T_FMT SWITCH_TIME_T_FMT +#endif + + /* Prototypes */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown); SWITCH_MODULE_RUNTIME_FUNCTION(mod_callcenter_runtime); @@ -909,12 +916,12 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2status(value) != CC_AGENT_STATUS_UNKNOWN) { /* Reset values on available only */ if (cc_agent_str2status(value) == CC_AGENT_STATUS_AVAILABLE) { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" MSWITCH_TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" " WHERE name = '%q' AND NOT status = '%q'", value, local_epoch_time_now(NULL), agent, value); } else { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" MSWITCH_TIME_T_FMT "' WHERE name = '%q'", value, local_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); @@ -950,7 +957,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2state(value) != CC_AGENT_STATE_RECEIVING) { sql = switch_mprintf("UPDATE agents SET state = '%q' WHERE name = '%q'", value, agent); } else { - sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", + sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" MSWITCH_TIME_T_FMT "' WHERE name = '%q'", value, local_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); @@ -1389,7 +1396,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Member %s <%s> with uuid %s in queue %s is gone just before we assigned an agent\n", h->member_cid_name, h->member_cid_number, h->member_session_uuid, h->queue_name); - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(NULL, sql, NULL); @@ -1548,7 +1555,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); /* Set UUID of the Agent channel */ - sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" SWITCH_TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" MSWITCH_TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" " WHERE name = '%q' AND system = '%q'", agent_uuid, local_epoch_time_now(NULL), h->agent_name, h->agent_system); @@ -1608,7 +1615,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Update Agents Items */ /* Do not remove uuid of the agent if we are a standby agent */ - sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" SWITCH_TIME_T_FMT ", talk_time = talk_time + (%" SWITCH_TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" + sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" MSWITCH_TIME_T_FMT ", talk_time = talk_time + (%" MSWITCH_TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), local_epoch_time_now(NULL), local_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1990,7 +1997,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } /* Once we pass a certain point, we want to get rid of the abandoned call */ if (abandoned_epoch + discard_abandoned_after < (long) local_epoch_time_now(NULL)) { - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" SWITCH_TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); + sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" MSWITCH_TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); } @@ -2150,7 +2157,7 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; - sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" SWITCH_TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" + sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" MSWITCH_TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", local_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); @@ -2418,7 +2425,7 @@ SWITCH_STANDARD_APP(callcenter_function) sql = switch_mprintf("INSERT INTO members" " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,cid_number,cid_name,serving_agent,serving_system,state)" - " VALUES('%q','single_box','%q','%q','%q','%" SWITCH_TIME_T_FMT "','%d','%d','%q','%q','%q','','%q')", + " VALUES('%q','single_box','%q','%q','%q','%" MSWITCH_TIME_T_FMT "','%d','%d','%q','%q','%q','','%q')", queue_name, member_uuid, member_session_uuid, @@ -2438,7 +2445,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> restoring it previous position in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update abandoned member */ - sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", + sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), local_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); @@ -2544,7 +2551,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2583,7 +2590,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ANSWERED), local_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); From a391d82b57a9bd384f0e9fd20f98b3680387cf04 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Apr 2011 10:56:08 -0500 Subject: [PATCH 400/558] remove unused code --- .../mod_conference/mod_conference.c | 138 ++++++++---------- 1 file changed, 59 insertions(+), 79 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 4f436534a4..b9b485a1b8 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -2500,20 +2500,10 @@ static void conference_loop_output(conference_member_t *member) uint32_t flush_len; uint32_t low_count, bytes; call_list_t *call_list, *cp; - int restarting = -1; switch_codec_implementation_t read_impl = { 0 }; - top: - switch_core_session_get_read_impl(member->session, &read_impl); - restarting++; - - if (switch_test_flag(member, MFLAG_RESTART)) { - switch_clear_flag(member, MFLAG_RESTART); - switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER); - switch_core_timer_destroy(&timer); - } channel = switch_core_session_get_channel(member->session); interval = read_impl.microseconds_per_packet / 1000; @@ -2540,82 +2530,77 @@ static void conference_loop_output(conference_member_t *member) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG, "Setup timer %s success interval: %u samples: %u\n", member->conference->timer_name, interval, tsamples); - if (!restarting) { - write_frame.data = data = switch_core_session_alloc(member->session, SWITCH_RECOMMENDED_BUFFER_SIZE); - write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; - } + + write_frame.data = data = switch_core_session_alloc(member->session, SWITCH_RECOMMENDED_BUFFER_SIZE); + write_frame.buflen = SWITCH_RECOMMENDED_BUFFER_SIZE; + write_frame.codec = &member->write_codec; - if (!restarting) { - /* Start the input thread */ - launch_conference_loop_input(member, switch_core_session_get_pool(member->session)); + /* Start the input thread */ + launch_conference_loop_input(member, switch_core_session_get_pool(member->session)); - if ((call_list = switch_channel_get_private(channel, "_conference_autocall_list_"))) { - const char *cid_name = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_name"); - const char *cid_num = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_number"); - const char *toval = switch_channel_get_variable(channel, "conference_auto_outcall_timeout"); - const char *flags = switch_channel_get_variable(channel, "conference_auto_outcall_flags"); - const char *profile = switch_channel_get_variable(channel, "conference_auto_outcall_profile"); - const char *ann = switch_channel_get_variable(channel, "conference_auto_outcall_announce"); - const char *prefix = switch_channel_get_variable(channel, "conference_auto_outcall_prefix"); - int to = 60; - - if (ann && !switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ)) { - member->conference->special_announce = switch_core_strdup(member->conference->pool, ann); - } - - switch_channel_set_private(channel, "_conference_autocall_list_", NULL); - - switch_set_flag(member->conference, CFLAG_OUTCALL); - - if (toval) { - to = atoi(toval); - if (to < 10 || to > 500) { - to = 60; - } - } - - for (cp = call_list; cp; cp = cp->next) { - int argc; - char *argv[512] = { 0 }; - char *cpstr = strdup(cp->string); - int x = 0; - - switch_assert(cpstr); - argc = switch_separate_string(cpstr, ',', argv, (sizeof(argv) / sizeof(argv[0]))); - for (x = 0; x < argc; x++) { - char *dial_str = switch_mprintf("%s%s", switch_str_nil(prefix), argv[x]); - switch_assert(dial_str); - conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL, - profile, &member->conference->cancel_cause); - switch_safe_free(dial_str); - } - switch_safe_free(cpstr); - } - - do { - switch_ivr_sleep(member->session, 500, SWITCH_TRUE, NULL); - } while(switch_channel_up(channel) && member->conference->originating); - - if (!switch_channel_ready(channel)) { - member->conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL; - goto end; - } - - conference_member_play_file(member, "tone_stream://%(500,0,640)", 0); + if ((call_list = switch_channel_get_private(channel, "_conference_autocall_list_"))) { + const char *cid_name = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_name"); + const char *cid_num = switch_channel_get_variable(channel, "conference_auto_outcall_caller_id_number"); + const char *toval = switch_channel_get_variable(channel, "conference_auto_outcall_timeout"); + const char *flags = switch_channel_get_variable(channel, "conference_auto_outcall_flags"); + const char *profile = switch_channel_get_variable(channel, "conference_auto_outcall_profile"); + const char *ann = switch_channel_get_variable(channel, "conference_auto_outcall_announce"); + const char *prefix = switch_channel_get_variable(channel, "conference_auto_outcall_prefix"); + int to = 60; + if (ann && !switch_channel_test_app_flag_key("conf_silent", channel, CONF_SILENT_REQ)) { + member->conference->special_announce = switch_core_strdup(member->conference->pool, ann); } + + switch_channel_set_private(channel, "_conference_autocall_list_", NULL); + + switch_set_flag(member->conference, CFLAG_OUTCALL); + + if (toval) { + to = atoi(toval); + if (to < 10 || to > 500) { + to = 60; + } + } + + for (cp = call_list; cp; cp = cp->next) { + int argc; + char *argv[512] = { 0 }; + char *cpstr = strdup(cp->string); + int x = 0; + + switch_assert(cpstr); + argc = switch_separate_string(cpstr, ',', argv, (sizeof(argv) / sizeof(argv[0]))); + for (x = 0; x < argc; x++) { + char *dial_str = switch_mprintf("%s%s", switch_str_nil(prefix), argv[x]); + switch_assert(dial_str); + conference_outcall_bg(member->conference, NULL, NULL, dial_str, to, switch_str_nil(flags), cid_name, cid_num, NULL, + profile, &member->conference->cancel_cause); + switch_safe_free(dial_str); + } + switch_safe_free(cpstr); + } + + switch_channel_set_app_flag(channel, CF_APP_TAGGED); + do { + switch_ivr_sleep(member->session, 500, SWITCH_TRUE, NULL); + } while(switch_channel_up(channel) && member->conference->originating); + switch_channel_clear_app_flag(channel, CF_APP_TAGGED); + + if (!switch_channel_ready(channel)) { + member->conference->cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL; + goto end; + } + + conference_member_play_file(member, "tone_stream://%(500,0,640)", 0); } if (!switch_test_flag(member->conference, CFLAG_ANSWERED)) { switch_channel_answer(channel); } - if (restarting) { - switch_channel_clear_app_flag(channel, CF_APP_TAGGED); - } - /* Fair WARNING, If you expect the caller to hear anything or for digit handling to be processed, */ /* you better not block this thread loop for more than the duration of member->conference->timer_name! */ while (switch_test_flag(member, MFLAG_RUNNING) && switch_test_flag(member, MFLAG_ITHREAD) @@ -2628,11 +2613,6 @@ static void conference_loop_output(conference_member_t *member) switch_mutex_lock(member->write_mutex); - if (switch_test_flag(member, MFLAG_RESTART)) { - switch_mutex_unlock(member->write_mutex); - goto top; - } - if (switch_core_session_dequeue_event(member->session, &event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { if (event->event_id == SWITCH_EVENT_MESSAGE) { char *from = switch_event_get_header(event, "from"); From bd471fc6a91f9aacb237e4be93e0b8f06f8157d2 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 28 Apr 2011 13:46:39 -0500 Subject: [PATCH 401/558] add bridged timestamp and hangup_complete_with_xml=true to add xml_cdr to the body of hangup_complete events --- src/include/switch_channel.h | 3 +- src/include/switch_utils.h | 39 +++++++++++++---------- src/switch_channel.c | 56 ++++++++++++++++++++++++++++----- src/switch_core_state_machine.c | 12 +++++++ src/switch_ivr.c | 6 ++++ src/switch_ivr_bridge.c | 7 ++++- 6 files changed, 97 insertions(+), 26 deletions(-) diff --git a/src/include/switch_channel.h b/src/include/switch_channel.h index febaf40f75..dc8175b202 100644 --- a/src/include/switch_channel.h +++ b/src/include/switch_channel.h @@ -49,6 +49,7 @@ SWITCH_BEGIN_EXTERN_C struct switch_channel_timetable { switch_time_t hungup; switch_time_t transferred; switch_time_t resurrected; + switch_time_t bridged; struct switch_channel_timetable *next; }; @@ -597,7 +598,7 @@ SWITCH_DECLARE(int) switch_channel_test_app_flag_key(const char *app, switch_cha #define switch_channel_clear_app_flag(_c, _f) switch_channel_clear_app_flag_key(__FILE__, _c, _f) #define switch_channel_test_app_flag(_c, _f) switch_channel_test_app_flag_key(__FILE__, _c, _f) - +SWITCH_DECLARE(void) switch_channel_set_bridge_time(switch_channel_t *channel); SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel); SWITCH_DECLARE(switch_call_direction_t) switch_channel_direction(switch_channel_t *channel); SWITCH_DECLARE(switch_core_session_t *) switch_channel_get_session(switch_channel_t *channel); diff --git a/src/include/switch_utils.h b/src/include/switch_utils.h index 4135ade091..88c13379b3 100644 --- a/src/include/switch_utils.h +++ b/src/include/switch_utils.h @@ -239,20 +239,23 @@ SWITCH_DECLARE(switch_size_t) switch_fd_read_line(int fd, char *buf, switch_size SWITCH_DECLARE(switch_status_t) switch_frame_alloc(switch_frame_t **frame, switch_size_t size); SWITCH_DECLARE(switch_status_t) switch_frame_dup(switch_frame_t *orig, switch_frame_t **clone); SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame); +SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str); /*! \brief Evaluate the truthfullness of a string expression \param expr a string expression \return true or false */ -#define switch_true(expr)\ -((expr && ( !strcasecmp(expr, "yes") ||\ -!strcasecmp(expr, "on") ||\ -!strcasecmp(expr, "true") ||\ -!strcasecmp(expr, "enabled") ||\ -!strcasecmp(expr, "active") ||\ -!strcasecmp(expr, "allow") ||\ -(switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE) +static inline int switch_true(const char *expr) +{ + return ((expr && ( !strcasecmp(expr, "yes") || + !strcasecmp(expr, "on") || + !strcasecmp(expr, "true") || + !strcasecmp(expr, "enabled") || + !strcasecmp(expr, "active") || + !strcasecmp(expr, "allow") || + (switch_is_number(expr) && atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE); +} #define switch_true_buf(expr)\ ((( !strcasecmp(expr, "yes") ||\ @@ -268,14 +271,16 @@ SWITCH_DECLARE(switch_status_t) switch_frame_free(switch_frame_t **frame); \param expr a string expression \return true or false */ -#define switch_false(expr)\ -((expr && ( !strcasecmp(expr, "no") ||\ -!strcasecmp(expr, "off") ||\ -!strcasecmp(expr, "false") ||\ -!strcasecmp(expr, "disabled") ||\ -!strcasecmp(expr, "inactive") ||\ -!strcasecmp(expr, "disallow") ||\ -(switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE) +static inline int switch_false(const char *expr) +{ + return ((expr && ( !strcasecmp(expr, "no") || + !strcasecmp(expr, "off") || + !strcasecmp(expr, "false") || + !strcasecmp(expr, "disabled") || + !strcasecmp(expr, "inactive") || + !strcasecmp(expr, "disallow") || + (switch_is_number(expr) && !atoi(expr)))) ? SWITCH_TRUE : SWITCH_FALSE); +} SWITCH_DECLARE(switch_status_t) switch_resolve_host(const char *host, char *buf, size_t buflen); @@ -670,7 +675,7 @@ SWITCH_DECLARE(switch_time_t) switch_str_time(const char *in); SWITCH_DECLARE(unsigned int) switch_separate_string(_In_ char *buf, char delim, _Post_count_(return) char **array, unsigned int arraylen); SWITCH_DECLARE(unsigned int) switch_separate_string_string(char *buf, char *delim, _Post_count_(return) char **array, unsigned int arraylen); -SWITCH_DECLARE(switch_bool_t) switch_is_number(const char *str); + SWITCH_DECLARE(char *) switch_strip_spaces(char *str, switch_bool_t dup); SWITCH_DECLARE(char *) switch_strip_whitespace(const char *str); SWITCH_DECLARE(char *) switch_strip_commas(char *in, char *out, switch_size_t len); diff --git a/src/switch_channel.c b/src/switch_channel.c index 2cd45b9e06..5b1d06ce33 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2513,11 +2513,21 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_caller_extension( } +SWITCH_DECLARE(void) switch_channel_set_bridge_time(switch_channel_t *channel) +{ + switch_mutex_lock(channel->profile_mutex); + if (channel->caller_profile && channel->caller_profile->times) { + channel->caller_profile->times->bridged = switch_micro_time_now(); + } + switch_mutex_unlock(channel->profile_mutex); +} + + SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel) { - if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) { + if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->bridged) { switch_mutex_lock(channel->profile_mutex); - channel->caller_profile->times->hungup = switch_micro_time_now(); + channel->caller_profile->times->bridged = switch_micro_time_now(); switch_mutex_unlock(channel->profile_mutex); } } @@ -3348,14 +3358,14 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_caller_profile_t *caller_profile, *ocp; switch_app_log_t *app_log, *ap; char *last_app = NULL, *last_arg = NULL; - char start[80] = "", resurrect[80] = "", answer[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", + char start[80] = "", resurrect[80] = "", answer[80] = "", bridge[80] = "", progress[80] = "", progress_media[80] = "", end[80] = "", tmp[80] = "", profile_start[80] = ""; int32_t duration = 0, legbillsec = 0, billsec = 0, mduration = 0, billmsec = 0, legbillmsec = 0, progressmsec = 0, progress_mediamsec = 0; - int32_t answersec = 0, answermsec = 0; + int32_t answersec = 0, answermsec = 0, waitsec = 0, waitmsec = 0; switch_time_t answerusec = 0; - switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0; - time_t tt_created = 0, tt_answered = 0, tt_resurrected = 0, - tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, + switch_time_t uduration = 0, legbillusec = 0, billusec = 0, progresssec = 0, progressusec = 0, progress_mediasec = 0, progress_mediausec = 0, waitusec = 0; + time_t tt_created = 0, tt_answered = 0, tt_resurrected = 0, tt_bridged, + tt_progress = 0, tt_progress_media = 0, tt_hungup = 0, mtt_created = 0, mtt_answered = 0, mtt_bridged = 0, mtt_hungup = 0, tt_prof_created, mtt_prof_created, mtt_progress = 0, mtt_progress_media = 0; void *pop; char dtstr[SWITCH_DTMF_LOG_LEN + 1] = ""; @@ -3427,6 +3437,12 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_channel_set_variable(channel, "answer_stamp", answer); } + if (caller_profile->times->bridged) { + switch_time_exp_lt(&tm, caller_profile->times->bridged); + switch_strftime_nocheck(bridge, &retsize, sizeof(bridge), fmt, &tm); + switch_channel_set_variable(channel, "bridge_stamp", bridge); + } + if (caller_profile->times->resurrected) { switch_time_exp_lt(&tm, caller_profile->times->resurrected); switch_strftime_nocheck(resurrect, &retsize, sizeof(resurrect), fmt, &tm); @@ -3470,6 +3486,13 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered); switch_channel_set_variable(channel, "answer_uepoch", tmp); + tt_bridged = (time_t) (caller_profile->times->bridged / 1000000); + mtt_bridged = (time_t) (caller_profile->times->bridged / 1000); + switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_bridged); + switch_channel_set_variable(channel, "bridge_epoch", tmp); + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->bridged); + switch_channel_set_variable(channel, "bridge_uepoch", tmp); + tt_resurrected = (time_t) (caller_profile->times->resurrected / 1000000); switch_snprintf(tmp, sizeof(tmp), "%" TIME_T_FMT, tt_resurrected); switch_channel_set_variable(channel, "resurrect_epoch", tmp); @@ -3501,6 +3524,16 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * mduration = (int32_t) (mtt_hungup - mtt_created); uduration = caller_profile->times->hungup - caller_profile->times->created; + if (caller_profile->times->bridged > caller_profile->times->created) { + waitsec = (int32_t) (tt_bridged - tt_created); + waitmsec = (int32_t) (mtt_bridged - mtt_created); + waitusec = caller_profile->times->bridged - caller_profile->times->created; + } else { + waitsec = 0; + waitmsec = 0; + waitusec = 0; + } + if (caller_profile->times->answered) { billsec = (int32_t) (tt_hungup - tt_answered); billmsec = (int32_t) (mtt_hungup - mtt_answered); @@ -3545,6 +3578,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%d", answersec); switch_channel_set_variable(channel, "answersec", tmp); + switch_snprintf(tmp, sizeof(tmp), "%d", waitsec); + switch_channel_set_variable(channel, "waitsec", tmp); + switch_snprintf(tmp, sizeof(tmp), "%d", progress_mediasec); switch_channel_set_variable(channel, "progress_mediasec", tmp); @@ -3563,6 +3599,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%d", answermsec); switch_channel_set_variable(channel, "answermsec", tmp); + switch_snprintf(tmp, sizeof(tmp), "%d", waitmsec); + switch_channel_set_variable(channel, "waitmsec", tmp); + switch_snprintf(tmp, sizeof(tmp), "%d", progress_mediamsec); switch_channel_set_variable(channel, "progress_mediamsec", tmp); @@ -3581,6 +3620,9 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t * switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, answerusec); switch_channel_set_variable(channel, "answerusec", tmp); + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, waitusec); + switch_channel_set_variable(channel, "waitusec", tmp); + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, progress_mediausec); switch_channel_set_variable(channel, "progress_mediausec", tmp); diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index e69c408013..6551b2b777 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -636,6 +636,18 @@ SWITCH_DECLARE(void) switch_core_session_reporting_state(switch_core_session_t * if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_HANGUP_COMPLETE) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Hangup-Cause", switch_channel_cause2str(cause)); switch_channel_event_set_data(session->channel, event); + if (switch_true(switch_channel_get_variable(session->channel, "hangup_complete_with_xml"))) { + switch_xml_t cdr = NULL; + char *xml_cdr_text; + + if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) { + xml_cdr_text = switch_xml_toxml(cdr, SWITCH_FALSE); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "CDR-Attached", "xml"); + switch_event_add_body(event, "%s", xml_cdr_text); + switch_xml_free(cdr); + switch_safe_free(xml_cdr_text); + } + } switch_event_fire(&event); } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 64be6b7f14..4932606ff2 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2219,6 +2219,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->answered); switch_xml_set_txt_d(time_tag, tmp); + if (!(time_tag = switch_xml_add_child_d(x_times, "bridged_time", t_off++))) { + goto error; + } + switch_snprintf(tmp, sizeof(tmp), "%" SWITCH_TIME_T_FMT, caller_profile->times->bridged); + switch_xml_set_txt_d(time_tag, tmp); + if (!(time_tag = switch_xml_add_child_d(x_times, "hangup_time", t_off++))) { goto error; } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 7dc8edfa2c..0fecc309f7 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -201,7 +201,9 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) chan_a = switch_core_session_get_channel(session_a); chan_b = switch_core_session_get_channel(session_b); - + + switch_channel_set_bridge_time(chan_a); + if ((exec_app = switch_channel_get_variable(chan_a, "bridge_pre_execute_app"))) { exec_data = switch_channel_get_variable(chan_a, "bridge_pre_execute_data"); } @@ -1067,6 +1069,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_signal_bridge(switch_core_session_t * switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Application-Data", switch_core_session_get_uuid(session)); switch_event_fire(&event); } + + switch_channel_set_bridge_time(caller_channel); + switch_channel_set_bridge_time(peer_channel); switch_channel_set_state_flag(caller_channel, CF_RESET); switch_channel_set_state_flag(peer_channel, CF_RESET); From e56cbeef414300a38c70043f8f3e5a6700739173 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Thu, 28 Apr 2011 14:39:24 -0500 Subject: [PATCH 402/558] fix trivial comiler warning for last commit --- src/switch_xml_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_xml_config.c b/src/switch_xml_config.c index 5ade057b37..31f44ce175 100644 --- a/src/switch_xml_config.c +++ b/src/switch_xml_config.c @@ -337,7 +337,7 @@ SWITCH_DECLARE(switch_status_t) switch_xml_config_parse_event(switch_event_t *ev int32_t *dest = (int32_t *) ptr; int index = (int) (intptr_t) item->data; int8_t currentval = (int8_t) ! !(*dest & index); - int8_t newval = 0; + int newval = 0; if (value) { newval = switch_true(value); From 360ed43a04f2ee7603d65c297ba658815610b425 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Fri, 29 Apr 2011 01:58:42 +0200 Subject: [PATCH 403/558] ftmod_libpri: ignore missing call_data in on_hangup() and use the call handle passed in the pevent structure (still needs more love...) Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 6653a923aa..0f45128ac9 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -854,7 +854,7 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even { ftdm_span_t *span = spri->span; ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel); - q931_call *call = NULL; +/* q931_call *call = NULL; */ if (!chan) { ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); @@ -868,22 +868,25 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even goto done; } +/* + * Make sure we can really tear-down a call, simply ignore the missing call_data and + * use the call handle from the event + * if (!chan->call_data) { ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_get_state_str(chan)); goto done; } call = (q931_call *)chan->call_data; - +*/ ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); - pri_release(spri->pri, call, 0); - pri_destroycall(spri->pri, call); + pri_release(spri->pri, pevent->hangup.call, 0); + pri_destroycall(spri->pri, pevent->hangup.call); chan->caller_data.hangup_cause = pevent->hangup.cause; chan->call_data = NULL; ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); - done: ftdm_channel_unlock(chan); return 0; From 55106186603f1f31add94443259a4c02851f1ff9 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Fri, 29 Apr 2011 08:57:00 -0500 Subject: [PATCH 404/558] OPENZAP-154 --resolve --- libs/freetdm/mod_freetdm/mod_freetdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index d1a5871b09..68728668bd 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -87,7 +87,7 @@ static struct { analog_option_t analog_options; switch_hash_t *ss7_configs; int sip_headers; - uint8_t crash_on_assert; + int crash_on_assert; } globals; /* private data attached to each fs session */ From 00b53a91ea31c2758ecf6eac600915f1b828101f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 29 Apr 2011 10:24:50 -0500 Subject: [PATCH 405/558] FS-3277 --resolve There are actually really only 2 places where it needs the real hostname, the hostname command and the header on the events. I changed everything to the switchname because there were some more sql stmts etc in the core. --- conf/autoload_configs/switch.conf.xml | 8 +++ src/include/private/switch_core_pvt.h | 1 + src/include/switch_core.h | 1 + .../mod_cidlookup/mod_cidlookup.c | 3 - .../applications/mod_commands/mod_commands.c | 15 ++-- src/mod/applications/mod_curl/mod_curl.c | 3 - src/mod/applications/mod_db/mod_db.c | 2 +- .../mod_directory/mod_directory.c | 4 +- src/mod/applications/mod_fifo/mod_fifo.c | 2 +- src/mod/applications/mod_redis/mod_redis.c | 10 +-- src/mod/endpoints/mod_sofia/mod_sofia.c | 3 +- .../mod_event_multicast/mod_event_multicast.c | 4 +- src/mod/event_handlers/mod_snmp/subagent.c | 7 +- src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 2 +- src/switch_console.c | 45 ++++++------ src/switch_core.c | 10 +++ src/switch_core_sqldb.c | 70 +++++++++---------- src/switch_event.c | 5 +- 18 files changed, 102 insertions(+), 93 deletions(-) diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index d2500a6463..3cba428e45 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -24,6 +24,14 @@ + + + diff --git a/src/include/private/switch_core_pvt.h b/src/include/private/switch_core_pvt.h index 0ef64d1079..23c5272a1f 100644 --- a/src/include/private/switch_core_pvt.h +++ b/src/include/private/switch_core_pvt.h @@ -248,6 +248,7 @@ struct switch_runtime { int max_sql_buffer_len; switch_dbtype_t odbc_dbtype; char hostname[256]; + char *switchname; int multiple_registrations; uint32_t max_db_handles; uint32_t db_handle_timeout; diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 5a2b8992b2..88e8152f2a 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -762,6 +762,7 @@ SWITCH_DECLARE(char *) switch_core_get_variable(_In_z_ const char *varname); SWITCH_DECLARE(char *) switch_core_get_variable_dup(_In_z_ const char *varname); SWITCH_DECLARE(char *) switch_core_get_variable_pdup(_In_z_ const char *varname, switch_memory_pool_t *pool); SWITCH_DECLARE(const char *) switch_core_get_hostname(void); +SWITCH_DECLARE(const char *) switch_core_get_switchname(void); /*! \brief Add a global variable to the core diff --git a/src/mod/applications/mod_cidlookup/mod_cidlookup.c b/src/mod/applications/mod_cidlookup/mod_cidlookup.c index 06bf615ce5..64e5fc7520 100755 --- a/src/mod/applications/mod_cidlookup/mod_cidlookup.c +++ b/src/mod/applications/mod_cidlookup/mod_cidlookup.c @@ -366,7 +366,6 @@ static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, cha switch_time_t time_diff = 0; CURL *curl_handle = NULL; long httpRes = 0; - char hostname[256] = ""; struct http_data http_data; @@ -375,8 +374,6 @@ static long do_lookup_url(switch_memory_pool_t *pool, switch_event_t *event, cha http_data.max_bytes = 10240; SWITCH_STANDARD_STREAM(http_data.stream); - gethostname(hostname, sizeof(hostname)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "url: %s\n", query); curl_handle = curl_easy_init(); diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index 96ef58299e..d7d67223e4 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -249,9 +249,13 @@ SWITCH_STANDARD_API(banner_function) SWITCH_STANDARD_API(hostname_api_function) { - char hostname[256] = ""; - gethostname(hostname, sizeof(hostname)); - stream->write_function(stream, "%s", hostname); + stream->write_function(stream, "%s", switch_core_get_hostname()); + return SWITCH_STATUS_SUCCESS; +} + +SWITCH_STANDARD_API(switchname_api_function) +{ + stream->write_function(stream, "%s", switch_core_get_switchname()); return SWITCH_STATUS_SUCCESS; } @@ -3862,9 +3866,7 @@ SWITCH_STANDARD_API(show_function) char *command = NULL, *as = NULL; switch_core_flag_t cflags = switch_core_flags(); switch_status_t status = SWITCH_STATUS_SUCCESS; - char hostname[256] = ""; - gethostname(hostname, sizeof(hostname)); - + const char *hostname = switch_core_get_switchname(); if (!(cflags & SCF_USE_SQL)) { stream->write_function(stream, "-ERR SQL DISABLED NO DATA AVAILABLE!\n"); @@ -5150,6 +5152,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load) SWITCH_ADD_API(commands_api_interface, "help", "Show help for all the api commands", help_function, ""); SWITCH_ADD_API(commands_api_interface, "host_lookup", "host_lookup", host_lookup_function, ""); SWITCH_ADD_API(commands_api_interface, "hostname", "Returns the system hostname", hostname_api_function, ""); + SWITCH_ADD_API(commands_api_interface, "switchname", "Returns the switch name", switchname_api_function, ""); SWITCH_ADD_API(commands_api_interface, "hupall", "hupall", hupall_api_function, " [ ]"); SWITCH_ADD_API(commands_api_interface, "in_group", "determine if a user is in a group", in_group_function, "[@] "); SWITCH_ADD_API(commands_api_interface, "is_lan_addr", "see if an ip is a lan addr", lan_addr_function, ""); diff --git a/src/mod/applications/mod_curl/mod_curl.c b/src/mod/applications/mod_curl/mod_curl.c index 633e4c80e2..adcfe453de 100644 --- a/src/mod/applications/mod_curl/mod_curl.c +++ b/src/mod/applications/mod_curl/mod_curl.c @@ -104,7 +104,6 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c CURL *curl_handle = NULL; long httpRes = 0; - char hostname[256] = ""; http_data_t *http_data = NULL; @@ -115,8 +114,6 @@ static http_data_t *do_lookup_url(switch_memory_pool_t *pool, const char *url, c http_data->max_bytes = 64000; SWITCH_STANDARD_STREAM(http_data->stream); - gethostname(hostname, sizeof(hostname)); - if (!method) { method = "get"; } diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index e611d036ea..165e02e949 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -598,7 +598,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_db_load) switch_limit_interface_t *limit_interface; memset(&globals, 0, sizeof(&globals)); - gethostname(globals.hostname, sizeof(globals.hostname)); + strncpy(globals.hostname, switch_core_get_switchname(), sizeof(globals.hostname)); globals.pool = pool; diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index 0127363064..b4c7d94e78 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -67,7 +67,7 @@ static switch_xml_config_int_options_t config_int_ht_0 = { SWITCH_TRUE, 0 }; static struct { switch_hash_t *profile_hash; - char hostname[256]; + const char *hostname; int integer; int debug; char *dbname; @@ -949,7 +949,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_directory_load) /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); - gethostname(globals.hostname, sizeof(globals.hostname)); + globals.hostname = switch_core_get_switchname(); globals.dbname = switch_core_sprintf(pool, "directory"); diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index a0a1f9df56..1984406eff 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -3885,7 +3885,7 @@ static switch_status_t load_config(int reload, int del_all) switch_cache_db_handle_t *dbh = NULL; fifo_node_t *node; - gethostname(globals.hostname, sizeof(globals.hostname)); + strncpy(globals.hostname, switch_core_get_switchname(), sizeof(globals.hostname)); if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf); diff --git a/src/mod/applications/mod_redis/mod_redis.c b/src/mod/applications/mod_redis/mod_redis.c index ebf2a9e324..36376dd069 100755 --- a/src/mod/applications/mod_redis/mod_redis.c +++ b/src/mod/applications/mod_redis/mod_redis.c @@ -89,7 +89,7 @@ SWITCH_LIMIT_INCR(limit_incr_redis) } /* Get the keys for redis server */ - uuid_rediskey = switch_core_session_sprintf(session,"%s_%s_%s", switch_core_get_hostname(), realm, resource); + uuid_rediskey = switch_core_session_sprintf(session,"%s_%s_%s", switch_core_get_switchname(), realm, resource); rediskey = switch_core_session_sprintf(session, "%s_%s", realm, resource); if ((pvt = switch_channel_get_private(channel, "limit_redis"))) { @@ -179,7 +179,7 @@ SWITCH_LIMIT_RELEASE(limit_release_redis) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", (char *)p_key); switch_goto_status(SWITCH_STATUS_FALSE, end); } - p_uuid_key = switch_core_session_sprintf(session, "%s_%s", switch_core_get_hostname(), (char *)p_key); + p_uuid_key = switch_core_session_sprintf(session, "%s_%s", switch_core_get_switchname(), (char *)p_key); if (credis_decr(redis,p_uuid_key,&uuid_val) != 0) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Couldn't decrement value corresponding to %s\n", p_uuid_key); switch_goto_status(SWITCH_STATUS_FALSE, end); @@ -193,7 +193,7 @@ SWITCH_LIMIT_RELEASE(limit_release_redis) } else { rediskey = switch_core_session_sprintf(session, "%s_%s", realm, resource); - uuid_rediskey = switch_core_session_sprintf(session, "%s_%s_%s", switch_core_get_hostname(), realm, resource); + uuid_rediskey = switch_core_session_sprintf(session, "%s_%s_%s", switch_core_get_switchname(), realm, resource); switch_core_hash_delete(pvt->hash, (const char *) rediskey); if (credis_decr(redis, rediskey, &val) != 0) { @@ -249,13 +249,13 @@ SWITCH_LIMIT_RESET(limit_reset_redis) { REDIS redis; if (redis_factory(&redis) == SWITCH_STATUS_SUCCESS) { - char *rediskey = switch_mprintf("%s_*", switch_core_get_hostname()); + char *rediskey = switch_mprintf("%s_*", switch_core_get_switchname()); int dec = 0, val = 0, keyc; char *uuids[2000]; if ((keyc = credis_keys(redis, rediskey, uuids, switch_arraylen(uuids))) > 0) { int i = 0; - int hostnamelen = strlen(switch_core_get_hostname())+1; + int hostnamelen = strlen(switch_core_get_switchname())+1; for (i = 0; i < keyc && uuids[i]; i++){ const char *key = uuids[i] + hostnamelen; diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index e18c0ea3c0..c1431c28e9 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -4956,7 +4956,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_sofia_load) switch_find_local_ip(mod_sofia_globals.guess_ip, sizeof(mod_sofia_globals.guess_ip), &mod_sofia_globals.guess_mask, AF_INET); in.s_addr = mod_sofia_globals.guess_mask; switch_set_string(mod_sofia_globals.guess_mask_str, inet_ntoa(in)); - gethostname(mod_sofia_globals.hostname, sizeof(mod_sofia_globals.hostname)); + + strcpy(mod_sofia_globals.hostname, switch_core_get_switchname()); switch_core_hash_init(&mod_sofia_globals.profile_hash, mod_sofia_globals.pool); diff --git a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c index 5c4d11e807..2c0b927c0f 100644 --- a/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c +++ b/src/mod/event_handlers/mod_event_multicast/mod_event_multicast.c @@ -51,7 +51,6 @@ static struct { char *address; char *bindings; uint32_t key_count; - char hostname[80]; switch_port_t port; switch_sockaddr_t *addr; switch_socket_t *udp_socket; @@ -282,7 +281,7 @@ static void event_handler(switch_event_t *event) case SWITCH_EVENT_LOG: return; default: - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Multicast-Sender", globals.hostname); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Multicast-Sender", switch_core_get_switchname()); if (switch_event_serialize(event, &packet, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) { size_t len; char *buf; @@ -377,7 +376,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_event_multicast_load) switch_core_hash_init(&globals.event_hash, module_pool); switch_core_hash_init(&globals.peer_hash, module_pool); - gethostname(globals.hostname, sizeof(globals.hostname)); globals.key_count = 0; if (load_config() != SWITCH_STATUS_SUCCESS) { diff --git a/src/mod/event_handlers/mod_snmp/subagent.c b/src/mod/event_handlers/mod_snmp/subagent.c index 8d58667687..69f135d6bd 100644 --- a/src/mod/event_handlers/mod_snmp/subagent.c +++ b/src/mod/event_handlers/mod_snmp/subagent.c @@ -140,7 +140,7 @@ int channelList_load(netsnmp_cache *cache, void *vmagic) idx = 1; - sprintf(sql, "SELECT * FROM channels WHERE hostname='%s' ORDER BY created_epoch", switch_core_get_hostname()); + sprintf(sql, "SELECT * FROM channels WHERE hostname='%s' ORDER BY created_epoch", switch_core_get_switchname()); switch_cache_db_execute_sql_callback(dbh, sql, channelList_callback, NULL, NULL); switch_cache_db_release_db_handle(&dbh); @@ -237,14 +237,13 @@ int handle_systemStats(netsnmp_mib_handler *handler, netsnmp_handler_registratio case SS_CURRENT_CALLS: { switch_cache_db_handle_t *dbh; - char sql[1024] = "", hostname[256] = ""; + char sql[1024] = ""; if (switch_core_db_handle(&dbh) != SWITCH_STATUS_SUCCESS) { return SNMP_ERR_GENERR; } - gethostname(hostname, sizeof(hostname)); - sprintf(sql, "SELECT COUNT(*) FROM calls WHERE hostname='%s'", hostname); + sprintf(sql, "SELECT COUNT(*) FROM calls WHERE hostname='%s'", switch_core_get_switchname()); switch_cache_db_execute_sql_callback(dbh, sql, sql_count_callback, &int_val, NULL); snmp_set_var_typed_integer(requests->requestvb, ASN_GAUGE, int_val); switch_cache_db_release_db_handle(&dbh); diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index bc143d7e48..6aa899babb 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -155,7 +155,7 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con char *uri = NULL; char *dynamic_url = NULL; - gethostname(hostname, sizeof(hostname)); + strncpy(hostname, switch_core_get_switchname(), sizeof(hostname)); if (!binding) { return NULL; diff --git a/src/switch_console.c b/src/switch_console.c index a73bb58e89..d902af69e7 100644 --- a/src/switch_console.c +++ b/src/switch_console.c @@ -443,11 +443,8 @@ SWITCH_DECLARE(void) switch_console_printf(switch_text_channel_t channel, const fflush(handle); } -static char hostname[256] = ""; static int32_t running = 1; - - struct helper { int len; int hits; @@ -643,9 +640,9 @@ SWITCH_DECLARE_NONSTD(switch_status_t) switch_console_list_uuid(const char *line if (!zstr(cursor)) { sql = switch_mprintf("select distinct uuid from channels where uuid like '%q%%' and hostname='%q' order by uuid", - cursor, switch_core_get_hostname()); + cursor, switch_core_get_switchname()); } else { - sql = switch_mprintf("select distinct uuid from channels where hostname='%q' order by uuid", switch_core_get_hostname()); + sql = switch_mprintf("select distinct uuid from channels where hostname='%q' order by uuid", switch_core_get_switchname()); } switch_cache_db_execute_sql_callback(db, sql, uuid_callback, &h, &errmsg); @@ -764,7 +761,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch if (h.words == 0) { sql = switch_mprintf("select distinct name from interfaces where type='api' and name like '%q%%' and hostname='%q' order by name", - buf, switch_core_get_hostname()); + buf, switch_core_get_switchname()); } if (sql) { @@ -792,7 +789,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch if (h.words == 0) { stream.write_function(&stream, "select distinct a1 from complete where " "a1 not in (select name from interfaces where hostname='%s') %s ", - switch_core_get_hostname(), argc ? "and" : ""); + switch_core_get_switchname(), argc ? "and" : ""); } else { if (switch_cache_db_get_type(db) == SCDB_TYPE_CORE_DB) { stream.write_function(&stream, "select distinct a%d,'%q','%q' from complete where ", h.words + 1, switch_str_nil(dup), switch_str_nil(lp)); @@ -821,7 +818,7 @@ SWITCH_DECLARE(unsigned char) switch_console_complete(const char *line, const ch } } - stream.write_function(&stream, " and hostname='%s' order by a%d", switch_core_get_hostname(), h.words + 1); + stream.write_function(&stream, " and hostname='%s' order by a%d", switch_core_get_switchname(), h.words + 1); switch_cache_db_execute_sql_callback(db, stream.data, comp_callback, &h, &errmsg); @@ -1001,7 +998,7 @@ static unsigned char console_f12key(EditLine * el, int ch) char *prompt(EditLine * e) { if (*prompt_str == '\0') { - switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", hostname); + switch_snprintf(prompt_str, sizeof(prompt_str), "freeswitch@%s> ", switch_core_get_switchname()); } return prompt_str; @@ -1067,8 +1064,6 @@ SWITCH_DECLARE(void) switch_console_loop(void) switch_threadattr_t *thd_attr = NULL; switch_memory_pool_t *pool; - gethostname(hostname, sizeof(hostname)); - if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Pool Failure\n"); return; @@ -1508,9 +1503,9 @@ SWITCH_DECLARE(void) switch_console_loop(void) /* Load/Init the config first */ console_xml_config(); - gethostname(hostname, sizeof(hostname)); + #ifdef _MSC_VER - sprintf(cmd, "\nfreeswitch@%s> ", hostname); + sprintf(cmd, "\nfreeswitch@%s> ", switch_core_get_switchname()); console_bufferInput(0, 0, cmd, PROMPT_OP); memset(cmd, 0, sizeof(cmd)); #endif @@ -1531,7 +1526,7 @@ SWITCH_DECLARE(void) switch_console_loop(void) } if (activity) { - switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\nfreeswitch@%s> ", hostname); + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_CONSOLE, "\nfreeswitch@%s> ", switch_core_get_switchname()); } #ifdef _MSC_VER activity = 0; @@ -1799,7 +1794,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string) } } } - mystream.write_function(&mystream, " '%s')", switch_core_get_hostname()); + mystream.write_function(&mystream, " '%s')", switch_core_get_switchname()); switch_cache_db_persistant_execute(db, mystream.data, 5); status = SWITCH_STATUS_SUCCESS; } else if (!strcasecmp(argv[0], "add")) { @@ -1815,7 +1810,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string) } } } - mystream.write_function(&mystream, " '%s')", switch_core_get_hostname()); + mystream.write_function(&mystream, " '%s')", switch_core_get_switchname()); switch_cache_db_persistant_execute(db, mystream.data, 5); status = SWITCH_STATUS_SUCCESS; @@ -1832,7 +1827,7 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_complete(const char *string) mystream.write_function(&mystream, "a%d = '%w'%w", x + 1, switch_str_nil(argv[x + 1]), x == argc - 2 ? "" : " and "); } } - mystream.write_function(&mystream, " and hostname='%s'", switch_core_get_hostname()); + mystream.write_function(&mystream, " and hostname='%s'", switch_core_get_switchname()); switch_cache_db_persistant_execute(db, mystream.data, 1); } status = SWITCH_STATUS_SUCCESS; @@ -1868,38 +1863,38 @@ SWITCH_DECLARE(switch_status_t) switch_console_set_alias(const char *string) } if (!strcasecmp(argv[0], "stickyadd") && argc == 3) { - sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_hostname()); + sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_switchname()); switch_cache_db_persistant_execute(db, sql, 5); switch_safe_free(sql); if (switch_cache_db_get_type(db) == SCDB_TYPE_CORE_DB) { sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (1, '%q','%q','%q')", - argv[1], argv[2], switch_core_get_hostname()); + argv[1], argv[2], switch_core_get_switchname()); } else { sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (1, '%w','%w','%w')", - argv[1], argv[2], switch_core_get_hostname()); + argv[1], argv[2], switch_core_get_switchname()); } switch_cache_db_persistant_execute(db, sql, 5); status = SWITCH_STATUS_SUCCESS; } else if (!strcasecmp(argv[0], "add") && argc == 3) { - sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_hostname()); + sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_switchname()); switch_cache_db_persistant_execute(db, sql, 5); switch_safe_free(sql); if (switch_cache_db_get_type(db) == SCDB_TYPE_CORE_DB) { sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (0, '%q','%q','%q')", - argv[1], argv[2], switch_core_get_hostname()); + argv[1], argv[2], switch_core_get_switchname()); } else { sql = switch_mprintf("insert into aliases (sticky, alias, command, hostname) values (0, '%w','%w','%w')", - argv[1], argv[2], switch_core_get_hostname()); + argv[1], argv[2], switch_core_get_switchname()); } switch_cache_db_persistant_execute(db, sql, 5); status = SWITCH_STATUS_SUCCESS; } else if (!strcasecmp(argv[0], "del") && argc == 2) { char *what = argv[1]; if (!strcasecmp(what, "*")) { - sql = switch_mprintf("delete from aliases where hostname='%q'", switch_core_get_hostname()); + sql = switch_mprintf("delete from aliases where hostname='%q'", switch_core_get_switchname()); switch_cache_db_persistant_execute(db, sql, 1); } else { - sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_hostname()); + sql = switch_mprintf("delete from aliases where alias='%q' and hostname='%q'", argv[1], switch_core_get_switchname()); switch_cache_db_persistant_execute(db, sql, 5); } status = SWITCH_STATUS_SUCCESS; diff --git a/src/switch_core.c b/src/switch_core.c index 740b0629b5..b80ca810eb 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -265,6 +265,13 @@ SWITCH_DECLARE(const char *) switch_core_get_hostname(void) return runtime.hostname; } +SWITCH_DECLARE(const char *) switch_core_get_switchname(void) +{ + if (!zstr(runtime.switchname)) return runtime.switchname; + return runtime.hostname; +} + + SWITCH_DECLARE(char *) switch_core_get_variable(const char *varname) { char *val; @@ -1716,6 +1723,9 @@ static void switch_load_core_config(const char *file) } else if (!strcasecmp(var, "rtp-enable-zrtp")) { switch_core_set_variable("zrtp_enabled", val); #endif + } else if (!strcasecmp(var, "switchname") && !zstr(val)) { + runtime.switchname = switch_core_strdup(runtime.memory_pool, val); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Set switchname to %s\n", runtime.switchname); } } } diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 106c7b0599..686c5d24de 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -1141,7 +1141,7 @@ static void core_event_handler(switch_event_t *event) new_sql() = switch_mprintf("insert into tasks values(%q,'%q','%q',%q, '%q')", id, switch_event_get_header_nil(event, "task-desc"), - switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", switch_core_get_hostname() + switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", switch_core_get_switchname() ); } } @@ -1149,7 +1149,7 @@ static void core_event_handler(switch_event_t *event) case SWITCH_EVENT_DEL_SCHEDULE: case SWITCH_EVENT_EXE_SCHEDULE: new_sql() = switch_mprintf("delete from tasks where task_id=%q and hostname='%q'", - switch_event_get_header_nil(event, "task-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "task-id"), switch_core_get_switchname()); break; case SWITCH_EVENT_RE_SCHEDULE: { @@ -1160,7 +1160,7 @@ static void core_event_handler(switch_event_t *event) new_sql() = switch_mprintf("update tasks set task_desc='%q',task_group='%q', task_sql_manager=%q where task_id=%q and hostname='%q'", switch_event_get_header_nil(event, "task-desc"), switch_event_get_header_nil(event, "task-group"), manager ? manager : "0", id, - switch_core_get_hostname()); + switch_core_get_switchname()); } } break; @@ -1170,10 +1170,10 @@ static void core_event_handler(switch_event_t *event) if (uuid) { new_sql() = switch_mprintf("delete from channels where uuid='%q' and hostname='%q'", - uuid, switch_core_get_hostname()); + uuid, switch_core_get_switchname()); new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'", - uuid, uuid, switch_core_get_hostname()); + uuid, uuid, switch_core_get_switchname()); } } @@ -1185,12 +1185,12 @@ static void core_event_handler(switch_event_t *event) "update calls set callee_uuid='%q' where callee_uuid='%q' and hostname='%q'", switch_event_get_header_nil(event, "unique-id"), switch_event_get_header_nil(event, "old-unique-id"), - switch_core_get_hostname(), + switch_core_get_switchname(), switch_event_get_header_nil(event, "unique-id"), switch_event_get_header_nil(event, "old-unique-id"), - switch_core_get_hostname(), + switch_core_get_switchname(), switch_event_get_header_nil(event, "unique-id"), - switch_event_get_header_nil(event, "old-unique-id"), switch_core_get_hostname() + switch_event_get_header_nil(event, "old-unique-id"), switch_core_get_switchname() ); break; } @@ -1205,7 +1205,7 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header_nil(event, "channel-state"), switch_event_get_header_nil(event, "channel-call-state"), switch_event_get_header_nil(event, "caller-dialplan"), - switch_event_get_header_nil(event, "caller-context"), switch_core_get_hostname() + switch_event_get_header_nil(event, "caller-context"), switch_core_get_switchname() ); break; case SWITCH_EVENT_CODEC: @@ -1218,7 +1218,7 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header_nil(event, "channel-write-codec-name"), switch_event_get_header_nil(event, "channel-write-codec-rate"), switch_event_get_header_nil(event, "channel-write-codec-bit-rate"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); break; case SWITCH_EVENT_CHANNEL_HOLD: case SWITCH_EVENT_CHANNEL_UNHOLD: @@ -1230,7 +1230,7 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header_nil(event, "application-data"), switch_event_get_header_nil(event, "channel-presence-id"), switch_event_get_header_nil(event, "channel-presence-data"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname() + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname() ); } @@ -1245,7 +1245,7 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header_nil(event, "channel-presence-data"), switch_event_get_header_nil(event, "channel-call-uuid"), extra_cols, - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); free(extra_cols); } else { new_sql() = switch_mprintf("update channels set " @@ -1253,7 +1253,7 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header_nil(event, "channel-presence-id"), switch_event_get_header_nil(event, "channel-presence-data"), switch_event_get_header_nil(event, "channel-call-uuid"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); } } @@ -1288,7 +1288,7 @@ static void core_event_handler(switch_event_t *event) switch_str_nil(name), switch_str_nil(number), switch_event_get_header_nil(event, "direction"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); name = switch_event_get_header(event, "callee-name"); number = switch_event_get_header(event, "callee-number"); @@ -1305,7 +1305,7 @@ static void core_event_handler(switch_event_t *event) { new_sql() = switch_mprintf("update channels set callstate='%q' where uuid='%q' and hostname='%q'", switch_event_get_header_nil(event, "channel-call-state"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); } break; @@ -1337,7 +1337,7 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header_nil(event, "channel-presence-id"), switch_event_get_header_nil(event, "channel-presence-data"), extra_cols, - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); free(extra_cols); } else { new_sql() = switch_mprintf("update channels set state='%s',cid_name='%q',cid_num='%q'," @@ -1352,13 +1352,13 @@ static void core_event_handler(switch_event_t *event) switch_event_get_header_nil(event, "caller-context"), switch_event_get_header_nil(event, "channel-presence-id"), switch_event_get_header_nil(event, "channel-presence-data"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); } break; default: new_sql() = switch_mprintf("update channels set state='%s' where uuid='%s' and hostname='%q'", switch_event_get_header_nil(event, "channel-state"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); break; } @@ -1384,7 +1384,7 @@ static void core_event_handler(switch_event_t *event) new_sql() = switch_mprintf("update channels set call_uuid='%q' where uuid='%s' and hostname='%q'", switch_event_get_header_nil(event, "channel-call-uuid"), - switch_event_get_header_nil(event, "unique-id"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "unique-id"), switch_core_get_switchname()); if (runtime.odbc_dbtype == DBTYPE_DEFAULT) { func_name = "function"; @@ -1411,7 +1411,7 @@ static void core_event_handler(switch_event_t *event) callee_cid_num, switch_event_get_header_nil(event, "Other-Leg-destination-number"), switch_event_get_header_nil(event, "Other-Leg-channel-name"), - switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_hostname() + switch_event_get_header_nil(event, "Other-Leg-unique-id"), switch_core_get_switchname() ); } break; @@ -1420,14 +1420,14 @@ static void core_event_handler(switch_event_t *event) char *uuid = switch_event_get_header_nil(event, "caller-unique-id"); new_sql() = switch_mprintf("delete from calls where (caller_uuid='%q' or callee_uuid='%q') and hostname='%q'", - uuid, uuid, switch_core_get_hostname()); + uuid, uuid, switch_core_get_switchname()); break; } case SWITCH_EVENT_SHUTDOWN: new_sql() = switch_mprintf("delete from channels where hostname='%q';" "delete from interfaces where hostname='%q';" "delete from calls where hostname='%q'", - switch_core_get_hostname(), switch_core_get_hostname(), switch_core_get_hostname() + switch_core_get_switchname(), switch_core_get_switchname(), switch_core_get_switchname() ); break; case SWITCH_EVENT_LOG: @@ -1445,7 +1445,7 @@ static void core_event_handler(switch_event_t *event) switch_mprintf ("insert into interfaces (type,name,description,syntax,ikey,filename,hostname) values('%q','%q','%q','%q','%q','%q','%q')", type, name, switch_str_nil(description), switch_str_nil(syntax), switch_str_nil(key), switch_str_nil(filename), - switch_core_get_hostname() + switch_core_get_switchname() ); } break; @@ -1456,7 +1456,7 @@ static void core_event_handler(switch_event_t *event) const char *name = switch_event_get_header_nil(event, "name"); if (!zstr(type) && !zstr(name)) { new_sql() = switch_mprintf("delete from interfaces where type='%q' and name='%q' and hostname='%q'", type, name, - switch_core_get_hostname()); + switch_core_get_switchname()); } break; } @@ -1468,7 +1468,7 @@ static void core_event_handler(switch_event_t *event) break; } new_sql() = switch_mprintf("update channels set secure='%s' where uuid='%s' and hostname='%q'", - type, switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_hostname() + type, switch_event_get_header_nil(event, "caller-unique-id"), switch_core_get_switchname() ); break; } @@ -1479,12 +1479,12 @@ static void core_event_handler(switch_event_t *event) if (!strcmp("add", op)) { new_sql() = switch_mprintf("insert into nat (port, proto, sticky, hostname) values (%s, %s, %d,'%q')", switch_event_get_header_nil(event, "port"), - switch_event_get_header_nil(event, "proto"), sticky, switch_core_get_hostname() + switch_event_get_header_nil(event, "proto"), sticky, switch_core_get_switchname() ); } else if (!strcmp("del", op)) { new_sql() = switch_mprintf("delete from nat where port=%s and proto=%s and hostname='%q'", switch_event_get_header_nil(event, "port"), - switch_event_get_header_nil(event, "proto"), switch_core_get_hostname()); + switch_event_get_header_nil(event, "proto"), switch_core_get_switchname()); } else if (!strcmp("status", op)) { /* call show nat api */ } else if (!strcmp("status_response", op)) { @@ -1650,10 +1650,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c if (runtime.multiple_registrations) { sql = switch_mprintf("delete from registrations where hostname='%q' and (url='%q' or token='%q')", - switch_core_get_hostname(), url, switch_str_nil(token)); + switch_core_get_switchname(), url, switch_str_nil(token)); } else { sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", - user, realm, switch_core_get_hostname()); + user, realm, switch_core_get_switchname()); } switch_queue_push(sql_manager.sql_queue[0], sql); @@ -1668,7 +1668,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_add_registration(const char *user, c switch_str_nil(network_ip), switch_str_nil(network_port), switch_str_nil(network_proto), - switch_core_get_hostname() + switch_core_get_switchname() ); @@ -1687,9 +1687,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_del_registration(const char *user, c } if (!zstr(token) && runtime.multiple_registrations) { - sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q' and token='%q'", user, realm, switch_core_get_hostname(), token); + sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q' and token='%q'", user, realm, switch_core_get_switchname(), token); } else { - sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", user, realm, switch_core_get_hostname()); + sql = switch_mprintf("delete from registrations where reg_user='%q' and realm='%q' and hostname='%q'", user, realm, switch_core_get_switchname()); } switch_queue_push(sql_manager.sql_queue[0], sql); @@ -1710,9 +1710,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_expire_registration(int force) now = switch_epoch_time_now(NULL); if (force) { - sql = switch_mprintf("delete from registrations where hostname='%q'", switch_core_get_hostname()); + sql = switch_mprintf("delete from registrations where hostname='%q'", switch_core_get_switchname()); } else { - sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_hostname()); + sql = switch_mprintf("delete from registrations where expires > 0 and expires <= %ld and hostname='%q'", now, switch_core_get_switchname()); } switch_queue_push(sql_manager.sql_queue[0], sql); @@ -1767,7 +1767,7 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_ char sql[512] = ""; char *tables[] = { "channels", "calls", "interfaces", "tasks", NULL }; int i; - const char *hostname = switch_core_get_hostname(); + const char *hostname = switch_core_get_switchname(); for (i = 0; tables[i]; i++) { switch_snprintf(sql, sizeof(sql), "delete from %s where hostname='%s'", tables[i], hostname); diff --git a/src/switch_event.c b/src/switch_event.c index 9816834d37..8c48b61f7c 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -66,7 +66,6 @@ struct switch_event_subclass { #define MAX_DISPATCH_VAL 20 static unsigned int MAX_DISPATCH = MAX_DISPATCH_VAL; static unsigned int SOFT_MAX_DISPATCH = 0; -static char hostname[128] = ""; static char guess_ip_v4[80] = ""; static char guess_ip_v6[80] = ""; static switch_event_node_t *EVENT_NODES[SWITCH_EVENT_ALL + 1] = { NULL }; @@ -647,7 +646,6 @@ SWITCH_DECLARE(switch_status_t) switch_event_init(switch_memory_pool_t *pool) switch_mutex_unlock(EVENT_QUEUE_MUTEX); switch_threadattr_create(&thd_attr, pool); - gethostname(hostname, sizeof(hostname)); switch_find_local_ip(guess_ip_v4, sizeof(guess_ip_v4), NULL, AF_INET); switch_find_local_ip(guess_ip_v6, sizeof(guess_ip_v6), NULL, AF_INET6); @@ -1359,7 +1357,8 @@ SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, c switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Event-Name", switch_event_name(event->event_id)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Core-UUID", switch_core_get_uuid()); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Hostname", hostname); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Hostname", switch_core_get_hostname()); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-Switchname", switch_core_get_switchname()); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv4", guess_ip_v4); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FreeSWITCH-IPv6", guess_ip_v6); From 16e3d1fa25448c2aba2553d3aa68c20d670d814a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 29 Apr 2011 11:09:14 -0500 Subject: [PATCH 406/558] default timer to run slower and increase as needed, Run the timer at 20ms by default and drop down as needed unless you set 1m-timer=true which was previous default --- conf/autoload_configs/switch.conf.xml | 3 ++ src/include/private/switch_core_pvt.h | 1 + src/switch_core.c | 5 ++- src/switch_time.c | 54 ++++++++++++++++----------- 4 files changed, 41 insertions(+), 22 deletions(-) diff --git a/conf/autoload_configs/switch.conf.xml b/conf/autoload_configs/switch.conf.xml index 3cba428e45..b0f0c53fef 100644 --- a/conf/autoload_configs/switch.conf.xml +++ b/conf/autoload_configs/switch.conf.xml @@ -24,6 +24,9 @@ + + + \" >> $free system("echo \"\" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); -system("echo \"#!/bin/sh\" >> $skype_startup_dir/start_skype_clients.sh"); +system("echo \"#!/bin/sh\" > $skype_startup_dir/start_skype_clients.sh"); system("echo \"#Unload possible ALSA sound modules that would conflict with our OSS fake module\" >> $skype_startup_dir/start_skype_clients.sh"); system("echo \"rmmod snd_pcm_oss\" >> $skype_startup_dir/start_skype_clients.sh"); system("echo \"rmmod snd_mixer_oss\" >> $skype_startup_dir/start_skype_clients.sh"); @@ -195,12 +246,17 @@ system("echo >> $skype_startup_dir/start_skype_clients.sh"); for ($count = 1; $count <= $skype_clients_to_be_launched; $count++) { $skype_client_extension = $skype_clients_starting_number + $count ; + $skype_login=$skype_username_array[$count]; + $skype_passwd=$skype_password_array[$count]; system("ln -s $skype_binary_dir/skype $skype_symlinks_dir/skype$skype_client_extension"); system("mkdir -p $skype_config_dir/skype$skype_client_extension"); system("cp -a ../configs/skype-client-configuration-dir-template/skypeclient01/shared.* $skype_config_dir/skype$skype_client_extension"); - system("cp -a ../configs/skype-client-configuration-dir-template/skypeclient01/skypenameA $skype_config_dir/skype$skype_client_extension/$skype_username"); + system("cp -a ../configs/skype-client-configuration-dir-template/skypeclient01/skypenameA $skype_config_dir/skype$skype_client_extension/$skype_login"); system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); + if($multi_skypeusername ne "one"){ + system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); + } system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); system("echo \" \" >> $freeswitch_modules_config_dir/skypopen.conf.xml"); @@ -208,7 +264,7 @@ for ($count = 1; $count <= $skype_clients_to_be_launched; $count++) { system("echo \"/usr/bin/Xvfb :$skype_client_extension -ac -nolisten tcp -screen 0 640x480x8 &\" >> $skype_startup_dir/start_skype_clients.sh"); system("echo \"sleep 3\" >> $skype_startup_dir/start_skype_clients.sh"); system("echo \"# start a Skype client instance that will connect to the X server above, and will login to the Skype network using the 'username password' you send to it on stdin.\" >> $skype_startup_dir/start_skype_clients.sh"); - system("echo \"su root -c \\\"/bin/echo '$skype_username $skype_password'| DISPLAY=:$skype_client_extension $skype_symlinks_dir/skype$skype_client_extension --dbpath=$skype_config_dir/skype$skype_client_extension --pipelogin &\\\"\" >> $skype_startup_dir/start_skype_clients.sh"); + system("echo \"su root -c \\\"/bin/echo '$skype_login $skype_passwd'| DISPLAY=:$skype_client_extension $skype_symlinks_dir/skype$skype_client_extension --dbpath=$skype_config_dir/skype$skype_client_extension --pipelogin &\\\"\" >> $skype_startup_dir/start_skype_clients.sh"); system("echo \"sleep 7\" >> $skype_startup_dir/start_skype_clients.sh"); system("echo >> $skype_startup_dir/start_skype_clients.sh"); } From aa7f47ac061e942d0ac9ff62bf49362f108ea9ca Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Sat, 30 Apr 2011 02:35:41 -0500 Subject: [PATCH 414/558] skypopen: refining INTERACTIVE INSTALLER for Linux (to be announced :) ) --- src/mod/endpoints/mod_skypopen/install/install.pl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/install/install.pl b/src/mod/endpoints/mod_skypopen/install/install.pl index bd27b14785..f4c04f3aef 100755 --- a/src/mod/endpoints/mod_skypopen/install/install.pl +++ b/src/mod/endpoints/mod_skypopen/install/install.pl @@ -178,11 +178,14 @@ printf("directory for Skype clients configs:\n'$skype_config_dir'\n"); printf("directory for Skype clients startup script:\n'$skype_startup_dir'\n"); printf("directory for Skype clients symlinks:\n'$skype_symlinks_dir'\n"); printf("how many Skype clients to launch: '$skype_clients_to_be_launched'\n"); -#printf("Skype login: '$skype_username'\n"); -#printf("Skype password: '$skype_password'\n"); -for($count=1; $count <= $skype_clients_to_be_launched ; $count++){ - $skype_client_extension = $skype_clients_starting_number + $count ; - printf("channel='skype$skype_client_extension' Skype login='$skype_username_array[$count]' Skype password='$skype_password_array[$count]'\n"); +if($multi_skypeusername eq "one"){ + printf("Skype login: '$skype_username'\n"); + printf("Skype password: '$skype_password'\n"); +}else { + for($count=1; $count <= $skype_clients_to_be_launched ; $count++){ + $skype_client_extension = $skype_clients_starting_number + $count ; + printf("channel='skype$skype_client_extension' Skype login='$skype_username_array[$count]' Skype password='$skype_password_array[$count]'\n"); + } } $sure = &promptUser("Are you sure you like the values? Write 'sure' for yes ", "$sure"); From ff9607c08fde27dd37c672f65ef49f176afbbc10 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Sat, 30 Apr 2011 03:01:51 -0500 Subject: [PATCH 415/558] skypopen: directories reshuffle, old stuff is now in old_stuff subdir :) --- src/mod/endpoints/mod_skypopen/alsa/alsa-driver-1.0.20-dummy.c | 1 - .../mod_skypopen/configs/{ => old-stuff}/README.skypopen_auth | 0 src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/copy | 0 src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/create | 0 .../multiple-instance-same-skype-username/README | 0 .../multiple-instance-same-skype-username/multi.sh | 0 .../multiple-instance-same-skype-username/skypopen.conf.xml | 0 .../mod_skypopen/configs/{ => old-stuff}/skypopen_auth.c | 0 .../mod_skypopen/configs/{ => old-stuff}/startskype.sh | 0 src/mod/endpoints/mod_skypopen/configs/skypopen.conf.xml | 2 +- 10 files changed, 1 insertion(+), 2 deletions(-) delete mode 120000 src/mod/endpoints/mod_skypopen/alsa/alsa-driver-1.0.20-dummy.c rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/README.skypopen_auth (100%) rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/copy (100%) rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/create (100%) rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/multiple-instance-same-skype-username/README (100%) rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/multiple-instance-same-skype-username/multi.sh (100%) rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/multiple-instance-same-skype-username/skypopen.conf.xml (100%) rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/skypopen_auth.c (100%) rename src/mod/endpoints/mod_skypopen/configs/{ => old-stuff}/startskype.sh (100%) diff --git a/src/mod/endpoints/mod_skypopen/alsa/alsa-driver-1.0.20-dummy.c b/src/mod/endpoints/mod_skypopen/alsa/alsa-driver-1.0.20-dummy.c deleted file mode 120000 index 1635114f26..0000000000 --- a/src/mod/endpoints/mod_skypopen/alsa/alsa-driver-1.0.20-dummy.c +++ /dev/null @@ -1 +0,0 @@ -./dummy.c \ No newline at end of file diff --git a/src/mod/endpoints/mod_skypopen/configs/README.skypopen_auth b/src/mod/endpoints/mod_skypopen/configs/old-stuff/README.skypopen_auth similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/README.skypopen_auth rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/README.skypopen_auth diff --git a/src/mod/endpoints/mod_skypopen/configs/copy b/src/mod/endpoints/mod_skypopen/configs/old-stuff/copy similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/copy rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/copy diff --git a/src/mod/endpoints/mod_skypopen/configs/create b/src/mod/endpoints/mod_skypopen/configs/old-stuff/create similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/create rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/create diff --git a/src/mod/endpoints/mod_skypopen/configs/multiple-instance-same-skype-username/README b/src/mod/endpoints/mod_skypopen/configs/old-stuff/multiple-instance-same-skype-username/README similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/multiple-instance-same-skype-username/README rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/multiple-instance-same-skype-username/README diff --git a/src/mod/endpoints/mod_skypopen/configs/multiple-instance-same-skype-username/multi.sh b/src/mod/endpoints/mod_skypopen/configs/old-stuff/multiple-instance-same-skype-username/multi.sh similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/multiple-instance-same-skype-username/multi.sh rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/multiple-instance-same-skype-username/multi.sh diff --git a/src/mod/endpoints/mod_skypopen/configs/multiple-instance-same-skype-username/skypopen.conf.xml b/src/mod/endpoints/mod_skypopen/configs/old-stuff/multiple-instance-same-skype-username/skypopen.conf.xml similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/multiple-instance-same-skype-username/skypopen.conf.xml rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/multiple-instance-same-skype-username/skypopen.conf.xml diff --git a/src/mod/endpoints/mod_skypopen/configs/skypopen_auth.c b/src/mod/endpoints/mod_skypopen/configs/old-stuff/skypopen_auth.c similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/skypopen_auth.c rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/skypopen_auth.c diff --git a/src/mod/endpoints/mod_skypopen/configs/startskype.sh b/src/mod/endpoints/mod_skypopen/configs/old-stuff/startskype.sh similarity index 100% rename from src/mod/endpoints/mod_skypopen/configs/startskype.sh rename to src/mod/endpoints/mod_skypopen/configs/old-stuff/startskype.sh diff --git a/src/mod/endpoints/mod_skypopen/configs/skypopen.conf.xml b/src/mod/endpoints/mod_skypopen/configs/skypopen.conf.xml index f4e1c0ec5a..c03fd718e0 100644 --- a/src/mod/endpoints/mod_skypopen/configs/skypopen.conf.xml +++ b/src/mod/endpoints/mod_skypopen/configs/skypopen.conf.xml @@ -1,6 +1,5 @@ - @@ -8,6 +7,7 @@ + From 1447aec4260a6f3b378c67f0c0846de2e400a839 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Sat, 30 Apr 2011 03:06:54 -0500 Subject: [PATCH 416/558] skypopen: directories reshuffle, old stuff is now in old_stuff subdir :) --- src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/Makefile | 0 src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/README | 0 .../mod_skypopen/{ => old-stuff}/asterisk/chan_skypiax.c | 0 .../mod_skypopen/{ => old-stuff}/asterisk/cyg_no_pthread_kill.c | 0 .../endpoints/mod_skypopen/{ => old-stuff}/asterisk/skypiax.conf | 0 src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/skypiax.h | 0 src/mod/endpoints/mod_skypopen/{alsa => old-stuff}/dummy.c | 0 src/mod/endpoints/mod_skypopen/{alsa => old-stuff}/pcm_lib.c | 0 src/mod/endpoints/mod_skypopen/{alsa => old-stuff}/pcm_native.c | 0 9 files changed, 0 insertions(+), 0 deletions(-) rename src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/Makefile (100%) rename src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/README (100%) rename src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/chan_skypiax.c (100%) rename src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/cyg_no_pthread_kill.c (100%) rename src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/skypiax.conf (100%) rename src/mod/endpoints/mod_skypopen/{ => old-stuff}/asterisk/skypiax.h (100%) rename src/mod/endpoints/mod_skypopen/{alsa => old-stuff}/dummy.c (100%) rename src/mod/endpoints/mod_skypopen/{alsa => old-stuff}/pcm_lib.c (100%) rename src/mod/endpoints/mod_skypopen/{alsa => old-stuff}/pcm_native.c (100%) diff --git a/src/mod/endpoints/mod_skypopen/asterisk/Makefile b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/Makefile similarity index 100% rename from src/mod/endpoints/mod_skypopen/asterisk/Makefile rename to src/mod/endpoints/mod_skypopen/old-stuff/asterisk/Makefile diff --git a/src/mod/endpoints/mod_skypopen/asterisk/README b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/README similarity index 100% rename from src/mod/endpoints/mod_skypopen/asterisk/README rename to src/mod/endpoints/mod_skypopen/old-stuff/asterisk/README diff --git a/src/mod/endpoints/mod_skypopen/asterisk/chan_skypiax.c b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/chan_skypiax.c similarity index 100% rename from src/mod/endpoints/mod_skypopen/asterisk/chan_skypiax.c rename to src/mod/endpoints/mod_skypopen/old-stuff/asterisk/chan_skypiax.c diff --git a/src/mod/endpoints/mod_skypopen/asterisk/cyg_no_pthread_kill.c b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/cyg_no_pthread_kill.c similarity index 100% rename from src/mod/endpoints/mod_skypopen/asterisk/cyg_no_pthread_kill.c rename to src/mod/endpoints/mod_skypopen/old-stuff/asterisk/cyg_no_pthread_kill.c diff --git a/src/mod/endpoints/mod_skypopen/asterisk/skypiax.conf b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.conf similarity index 100% rename from src/mod/endpoints/mod_skypopen/asterisk/skypiax.conf rename to src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.conf diff --git a/src/mod/endpoints/mod_skypopen/asterisk/skypiax.h b/src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.h similarity index 100% rename from src/mod/endpoints/mod_skypopen/asterisk/skypiax.h rename to src/mod/endpoints/mod_skypopen/old-stuff/asterisk/skypiax.h diff --git a/src/mod/endpoints/mod_skypopen/alsa/dummy.c b/src/mod/endpoints/mod_skypopen/old-stuff/dummy.c similarity index 100% rename from src/mod/endpoints/mod_skypopen/alsa/dummy.c rename to src/mod/endpoints/mod_skypopen/old-stuff/dummy.c diff --git a/src/mod/endpoints/mod_skypopen/alsa/pcm_lib.c b/src/mod/endpoints/mod_skypopen/old-stuff/pcm_lib.c similarity index 100% rename from src/mod/endpoints/mod_skypopen/alsa/pcm_lib.c rename to src/mod/endpoints/mod_skypopen/old-stuff/pcm_lib.c diff --git a/src/mod/endpoints/mod_skypopen/alsa/pcm_native.c b/src/mod/endpoints/mod_skypopen/old-stuff/pcm_native.c similarity index 100% rename from src/mod/endpoints/mod_skypopen/alsa/pcm_native.c rename to src/mod/endpoints/mod_skypopen/old-stuff/pcm_native.c From 6196a4199eff71fe6a5a85205e7c235a46752fa1 Mon Sep 17 00:00:00 2001 From: Markus Mueller Date: Sat, 30 Apr 2011 18:01:38 +0200 Subject: [PATCH 417/558] ftmod_libpri: Possible fix for call tear-down problems (+ locking cleanup) Remove pri_destroycall() in on_hangup() and use pri_hangup() instead of the deprecated pri_release(). NOTE: The original patch used PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION for the cause code, which (without pri_enable_hangup_fix() enabled) emits a RELEASE COMPLETE message. This version of the patch uses PRI_CAUSE_NORMAL_CLEARING (-1). (stkn) Additionally, use ftdm_set_state() instead of ftdm_set_state_locked() because the channel is already locked. (stkn) Completely-untested-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 0f45128ac9..949ea154e3 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -854,7 +854,6 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even { ftdm_span_t *span = spri->span; ftdm_channel_t *chan = ftdm_span_get_channel(span, pevent->hangup.channel); -/* q931_call *call = NULL; */ if (!chan) { ftdm_log(FTDM_LOG_CRIT, "-- Hangup on channel %d:%d %s but it's not in use?\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); @@ -868,25 +867,13 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even goto done; } -/* - * Make sure we can really tear-down a call, simply ignore the missing call_data and - * use the call handle from the event - * - if (!chan->call_data) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s with no call data\n", ftdm_channel_get_state_str(chan)); - goto done; - } - - call = (q931_call *)chan->call_data; -*/ ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); - pri_release(spri->pri, pevent->hangup.call, 0); - pri_destroycall(spri->pri, pevent->hangup.call); + pri_hangup(spri->pri, pevent->hangup.call, -1); chan->caller_data.hangup_cause = pevent->hangup.cause; chan->call_data = NULL; - ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_TERMINATING); + ftdm_set_state(chan, FTDM_CHANNEL_STATE_TERMINATING); done: ftdm_channel_unlock(chan); return 0; From 0f6d1aa5057eb72c7fb19459cbd282a457988726 Mon Sep 17 00:00:00 2001 From: Michal Bielicki - cypromis Date: Mon, 2 May 2011 16:48:09 +0200 Subject: [PATCH 418/558] FS3245 move pid var in redhat/centos init file to /var/run/freeswitch/freeswitch.pid, as it gets instaleld to do so --- build/freeswitch.init.redhat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/freeswitch.init.redhat b/build/freeswitch.init.redhat index 6fe9c43c47..b9dc3d8db5 100644 --- a/build/freeswitch.init.redhat +++ b/build/freeswitch.init.redhat @@ -15,7 +15,7 @@ . /etc/init.d/functions PROG_NAME=freeswitch -PID_FILE=${PID_FILE-/opt/freeswitch/run/freeswitch.pid} +PID_FILE=${PID_FILE-/var/run/freeswitch/freeswitch.pid} FS_USER=${FS_USER-freeswitch} FS_FILE=${FS_FILE-/opt/freeswitch/bin/freeswitch} FS_HOME=${FS_HOME-/opt/freeswitch} From a13064101fc0588434766b5d1d340ad068534d00 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 May 2011 10:37:05 -0500 Subject: [PATCH 419/558] 3280 --resolve missed a spot --- src/switch_channel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index 37ece108a4..683b430595 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -2525,7 +2525,7 @@ SWITCH_DECLARE(void) switch_channel_set_bridge_time(switch_channel_t *channel) SWITCH_DECLARE(void) switch_channel_set_hangup_time(switch_channel_t *channel) { - if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->bridged) { + if (channel->caller_profile && channel->caller_profile->times && !channel->caller_profile->times->hungup) { switch_mutex_lock(channel->profile_mutex); channel->caller_profile->times->hungup = switch_micro_time_now(); switch_mutex_unlock(channel->profile_mutex); From a6b336e4cbf85addd4db0fd697e7651aaa6efd68 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 May 2011 11:33:57 -0500 Subject: [PATCH 420/558] add option to disable srtp with --disble-srtp --- src/switch_rtp.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 13ce9639c8..038401da19 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -81,6 +81,7 @@ static int zrtp_on = 0; #ifdef _MSC_VER #pragma pack() +#define ENABLE_SRTP #endif static switch_hash_t *alloc_hash = NULL; @@ -844,14 +845,20 @@ SWITCH_DECLARE(void) switch_rtp_init(switch_memory_pool_t *pool) } #endif +#ifdef ENABLE_SRTP srtp_init(); +#endif switch_mutex_init(&port_lock, SWITCH_MUTEX_NESTED, pool); global_init = 1; } SWITCH_DECLARE(void) switch_rtp_get_random(void *buf, uint32_t len) { +#ifdef ENABLE_SRTP crypto_get_random(buf, len); +#else + switch_stun_random_string(buf, len, NULL); +#endif } @@ -888,7 +895,9 @@ SWITCH_DECLARE(void) switch_rtp_shutdown(void) zrtp_down(zrtp_global); } #endif +#ifdef ENABLE_SRTP crypto_kernel_shutdown(); +#endif } @@ -1357,6 +1366,10 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess switch_rtp_crypto_direction_t direction, uint32_t index, switch_rtp_crypto_key_type_t type, unsigned char *key, switch_size_t keylen) { +#ifndef ENABLE_SRTP + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "SRTP NOT SUPPORTED IN THIS BUILD!\n"); + return SWITCH_STATUS_FALSE; +#else switch_rtp_crypto_key_t *crypto_key; srtp_policy_t *policy; err_status_t stat; @@ -1471,6 +1484,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_add_crypto_key(switch_rtp_t *rtp_sess return SWITCH_STATUS_SUCCESS; +#endif } SWITCH_DECLARE(switch_status_t) switch_rtp_set_interval(switch_rtp_t *rtp_session, uint32_t ms_per_packet, uint32_t samples_per_interval) @@ -2117,6 +2131,7 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) switch_rtp_disable_vad(*rtp_session); } +#ifdef ENABLE_SRTP if (switch_test_flag((*rtp_session), SWITCH_RTP_FLAG_SECURE_SEND)) { srtp_dealloc((*rtp_session)->send_ctx); (*rtp_session)->send_ctx = NULL; @@ -2128,6 +2143,8 @@ SWITCH_DECLARE(void) switch_rtp_destroy(switch_rtp_t **rtp_session) (*rtp_session)->recv_ctx = NULL; switch_clear_flag((*rtp_session), SWITCH_RTP_FLAG_SECURE_RECV); } +#endif + #ifdef ENABLE_ZRTP /* ZRTP */ if (zrtp_on) { @@ -2515,7 +2532,8 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t break; } #endif - + +#ifdef ENABLE_SRTP if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) { int sbytes = (int) *bytes; err_status_t stat = 0; @@ -2553,6 +2571,7 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = sbytes; } +#endif } } @@ -2630,6 +2649,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = 0; } +#ifdef ENABLE_SRTP if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_RECV)) { int sbytes = (int) *bytes; err_status_t stat = 0; @@ -2653,6 +2673,7 @@ static switch_status_t read_rtcp_packet(switch_rtp_t *rtp_session, switch_size_t *bytes = sbytes; } +#endif #ifdef ENABLE_ZRTP @@ -2894,6 +2915,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ switch_test_flag(other_rtp_session, SWITCH_RTP_FLAG_ENABLE_RTCP)) { *other_rtp_session->rtcp_send_msg.body = *rtp_session->rtcp_recv_msg.body; +#ifdef ENABLE_SRTP if (switch_test_flag(other_rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { int sbytes = (int) rtcp_bytes; int stat = srtp_protect_rtcp(other_rtp_session->send_ctx, &other_rtp_session->rtcp_send_msg.header, &sbytes); @@ -2902,6 +2924,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_ } rtcp_bytes = sbytes; } +#endif #ifdef ENABLE_ZRTP /* ZRTP Send */ @@ -3713,7 +3736,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, switch_swap_linear((int16_t *)send_msg->body, (int) datalen); } - +#ifdef ENABLE_SRTP if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { int sbytes = (int) bytes; err_status_t stat; @@ -3740,6 +3763,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, bytes = sbytes; } +#endif #ifdef ENABLE_ZRTP /* ZRTP Send */ if (1) { @@ -3844,7 +3868,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, sr->oc = htonl((rtp_session->stats.outbound.raw_bytes - rtp_session->stats.outbound.packet_count * sizeof(srtp_hdr_t))); rtcp_bytes = sizeof(switch_rtcp_hdr_t) + sizeof(struct switch_rtcp_senderinfo); - +#ifdef ENABLE_SRTP if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { int sbytes = (int) rtcp_bytes; int stat = srtp_protect_rtcp(rtp_session->send_ctx, &rtp_session->rtcp_send_msg.header, &sbytes); @@ -3853,6 +3877,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, } rtcp_bytes = sbytes; } +#endif #ifdef ENABLE_ZRTP /* ZRTP Send */ @@ -4137,6 +4162,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, bytes = rtp_header_len + datalen; +#ifdef ENABLE_SRTP if (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND)) { int sbytes = (int) bytes; err_status_t stat; @@ -4160,6 +4186,7 @@ SWITCH_DECLARE(int) switch_rtp_write_manual(switch_rtp_t *rtp_session, } bytes = sbytes; } +#endif #ifdef ENABLE_ZRTP /* ZRTP Send */ if (1) { From a8b87ffe051784c2c1f10ad056b7a9af0ff254b5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 2 May 2011 11:34:13 -0500 Subject: [PATCH 421/558] add option to disable srtp with --disble-srtp --- Makefile.am | 3 +++ configure.in | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/Makefile.am b/Makefile.am index 5b6b9896ac..95c53dd128 100644 --- a/Makefile.am +++ b/Makefile.am @@ -106,7 +106,10 @@ CORE_CFLAGS += -I$(switch_srcdir)/libs/spandsp/src -I$(switch_srcdir)/libs/tiff- CORE_LIBS = libs/apr-util/libaprutil-1.la libs/apr/libapr-1.la CORE_LIBS += libs/sqlite/libsqlite3.la libs/pcre/libpcre.la libs/speex/libspeex/libspeexdsp.la +if ENABLE_SRTP +CORE_CFLAGS += -DENABLE_SRTP CORE_LIBS += libs/srtp/libsrtp.la +endif MOD_LINK = $(switch_srcdir)/libfreeswitch.la CLEANFILES = src/include/switch_version.h src/include/switch_swigable_cpp.h diff --git a/configure.in b/configure.in index 356e4c4705..389e4985b6 100644 --- a/configure.in +++ b/configure.in @@ -347,6 +347,11 @@ AC_ARG_ENABLE(cpp, AM_CONDITIONAL([ENABLE_CPP],[test "${enable_cpp}" = "yes"]) +AC_ARG_ENABLE(srtp, +[AC_HELP_STRING([--disable-srtp],[build without srtp support])],[enable_srtp="$enableval"],[enable_srtp="yes"]) + +AM_CONDITIONAL([ENABLE_SRTP],[test "${enable_srtp}" = "yes"]) + AC_ARG_ENABLE(zrtp, [AS_HELP_STRING([--enable-zrtp], [Compile with zrtp Support])],,[enable_zrtp="no"]) if test "x$enable_zrtp" = "xyes" ; then From 87e96ace722001d9485f74715c919f49da7856db Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 2 May 2011 12:58:20 -0400 Subject: [PATCH 422/558] mod_sangoma_codec: register G729 up to 100ms --- src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index dd97453c7a..3eff6779e3 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -89,7 +89,7 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_PCMA, IANA_PCMA_A_8000_1, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, { SNGTC_CODEC_L16_1, IANA_L16_A_8000_1, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, { SNGTC_CODEC_L16_2, IANA_L16_A_16000_1, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, - { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 40, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, + { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 100, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, { SNGTC_CODEC_G726_32, IANA_G726_32_8000_1, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, { SNGTC_CODEC_G722, IANA_G722_A_8000_1, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, From d655fa600f1675806a0c78c12d9be08ce7c89fe5 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Mon, 2 May 2011 14:05:11 -0400 Subject: [PATCH 423/558] mod_sangoma_codec: ok hardware documentation says 200ms for G729 --- src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c index 3eff6779e3..b6cfbb0c54 100644 --- a/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c +++ b/src/mod/codecs/mod_sangoma_codec/mod_sangoma_codec.c @@ -89,7 +89,7 @@ vocallo_codec_t g_codec_map[] = { SNGTC_CODEC_PCMA, IANA_PCMA_A_8000_1, "PCMA", "Sangoma PCMA", 40, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, { SNGTC_CODEC_L16_1, IANA_L16_A_8000_1, "L16", "Sangoma L16", 40, 120000, 10000, 80, 160, 160, 8000, 8000, 0 }, { SNGTC_CODEC_L16_2, IANA_L16_A_16000_1, "L16", "Sangoma L16 2", 40, 320000, 10000, 160, 320, 320, 16000, 16000, 0 }, - { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 100, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, + { SNGTC_CODEC_G729AB, IANA_G729_AB_8000_1, "G729", "Sangoma G729", 200, 8000, 10000, 80, 160, 10, 8000, 8000, 1 }, { SNGTC_CODEC_G726_32, IANA_G726_32_8000_1, "G726-32", "Sangoma G.726 32k", 40, 32000, 10000, 80, 160, 40, 8000, 8000, 1 }, { SNGTC_CODEC_G722, IANA_G722_A_8000_1, "G722", "Sangoma G722", 20, 64000, 10000, 80, 160, 80, 8000, 8000, 1 }, From 2246f3ca75eee93a7e7f4409aa816513b99e657a Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 2 May 2011 15:37:19 -0400 Subject: [PATCH 424/558] freetdm: ISDN - Fix for some API commands printing ERR - no return --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 63 ++++++++++++++----- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 6 +- .../ftmod_sangoma_isdn_support.c | 16 +++-- 3 files changed, 58 insertions(+), 27 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index 75379eef64..3cf4876070 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -1199,9 +1199,17 @@ static FIO_SIG_UNLOAD_FUNCTION(ftdm_sangoma_isdn_unload) return FTDM_SUCCESS; } +#define SANGOMA_ISDN_API_USAGE_TRACE "ftdm sangoma_isdn trace \n" +#define SANGOMA_ISDN_API_USAGE_SHOW_L1_STATS "ftdm sangoma_isdn l1_stats \n" +#define SANGOMA_ISDN_API_USAGE_SHOW_SPANS "ftdm sangoma_isdn show_spans []\n" + +#define SANGOMA_ISDN_API_USAGE "\t"SANGOMA_ISDN_API_USAGE_TRACE \ + "\t"SANGOMA_ISDN_API_USAGE_SHOW_L1_STATS \ + "\t"SANGOMA_ISDN_API_USAGE_SHOW_SPANS + static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) { - ftdm_status_t status = FTDM_SUCCESS; + ftdm_status_t status = FTDM_EINVAL; char *mycmd = NULL, *argv[10] = { 0 }; int argc = 0; @@ -1223,7 +1231,7 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) ftdm_span_t *span; if (argc < 3) { - ftdm_log(FTDM_LOG_ERROR, "Usage: ftdm sangoma_isdn trace \n"); + ftdm_log(FTDM_LOG_ERROR, "Usage: %s\n", SANGOMA_ISDN_API_USAGE_TRACE); status = FTDM_FAIL; goto done; } @@ -1232,34 +1240,40 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) status = ftdm_span_find_by_name(argv[2], &span); if (FTDM_SUCCESS != status) { stream->write_function(stream, "-ERR failed to find span by name %s\n", argv[2]); + + status = FTDM_FAIL; goto done; } if (!strcasecmp(trace_opt, "q921")) { - sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); + status = sngisdn_activate_trace(span, SNGISDN_TRACE_Q921); } else if (!strcasecmp(trace_opt, "q931")) { - sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); + status = sngisdn_activate_trace(span, SNGISDN_TRACE_Q931); } else if (!strcasecmp(trace_opt, "disable")) { - sngisdn_activate_trace(span, SNGISDN_TRACE_DISABLE); + status = sngisdn_activate_trace(span, SNGISDN_TRACE_DISABLE); } else { stream->write_function(stream, "-ERR invalid trace option \n"); + status = FTDM_FAIL; } + goto done; } + if (!strcasecmp(argv[0], "l1_stats")) { ftdm_span_t *span; if (argc < 2) { - stream->write_function(stream, "Usage: ftdm sangoma_isdn l1_stats \n"); + stream->write_function(stream, "Usage: %s\n", SANGOMA_ISDN_API_USAGE_SHOW_L1_STATS); status = FTDM_FAIL; goto done; } status = ftdm_span_find_by_name(argv[1], &span); if (FTDM_SUCCESS != status) { stream->write_function(stream, "-ERR failed to find span with name %s\n", argv[1]); - /* Return SUCCESS because we do not want to print the general FTDM usage list */ - status = FTDM_SUCCESS; + + status = FTDM_FAIL; goto done; } - sngisdn_print_phy_stats(stream, span); + status = sngisdn_show_l1_stats(stream, span); + goto done; } if (!strcasecmp(argv[0], "show_spans")) { @@ -1268,20 +1282,39 @@ static FIO_API_FUNCTION(ftdm_sangoma_isdn_api) status = ftdm_span_find_by_name(argv[1], &span); if (FTDM_SUCCESS != status) { stream->write_function(stream, "-ERR failed to find span with name %s\n", argv[1]); - /* Return SUCCESS because we do not want to print the general FTDM usage list */ - status = FTDM_SUCCESS; + + stream->write_function(stream, "Usage: %s\n", SANGOMA_ISDN_API_USAGE_SHOW_SPANS); + status = FTDM_FAIL; goto done; } - sngisdn_print_span(stream, span); - status = FTDM_SUCCESS; + status = sngisdn_show_span(stream, span); goto done; } - sngisdn_print_spans(stream); + status = sngisdn_show_spans(stream); + goto done; } + if (!strcasecmp(argv[0], "check_ids")) { - sngisdn_check_free_ids(); + status = sngisdn_check_free_ids(); + goto done; } done: + switch (status) { + case FTDM_SUCCESS: + stream->write_function(stream, "Command executed OK\n"); + break; + case FTDM_EINVAL: + stream->write_function(stream, "Invalid arguments [%s]\n", mycmd); + stream->write_function(stream, "Usage:\n%s\n", SANGOMA_ISDN_API_USAGE); + break; + default: + /* FTDM_FAIL - Do nothing since we already printed the cause of the error */ + break; + } + + /* Return SUCCESS because we do not want to print the general FTDM usage list */ + status = FTDM_SUCCESS; + ftdm_safe_free(mycmd); return status; } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 112e7cf27d..902729d01c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -471,9 +471,9 @@ ftdm_status_t sngisdn_stack_start(ftdm_span_t *span); ftdm_status_t sngisdn_stack_stop(ftdm_span_t *span); ftdm_status_t sngisdn_wake_up_phy(ftdm_span_t *span); -void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span); -void sngisdn_print_spans(ftdm_stream_handle_t *stream); -void sngisdn_print_span(ftdm_stream_handle_t *stream, ftdm_span_t *span); +ftdm_status_t sngisdn_show_l1_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span); +ftdm_status_t sngisdn_show_spans(ftdm_stream_handle_t *stream); +ftdm_status_t sngisdn_show_span(ftdm_stream_handle_t *stream, ftdm_span_t *span); #endif /* __FTMOD_SNG_ISDN_H__ */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 0ac52b085c..880b61efeb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -43,8 +43,6 @@ SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) -ftdm_status_t sngisdn_check_free_ids(void); - extern ftdm_sngisdn_data_t g_sngisdn_data; void get_memory_info(void); @@ -1131,7 +1129,7 @@ ftdm_user_layer1_prot_t sngisdn_get_usrInfoLyr1Prot_from_stack(uint8_t layer1_pr return FTDM_USER_LAYER1_PROT_ULAW; } -void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span) +ftdm_status_t sngisdn_show_l1_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span) { L1Mngmt sts; sngisdn_span_data_t *signal_data = (sngisdn_span_data_t*)span->signal_data; @@ -1169,11 +1167,11 @@ void sngisdn_print_phy_stats(ftdm_stream_handle_t *stream, ftdm_span_t *span) stream->write_function(stream, " TX Errors Details"); stream->write_function(stream, "\n---------------------------------------------------------------------\n"); stream->write_function(stream, "Aborted:\t%u\tFifo:\t\t%u\tCarrier:\t%u\n", sts.t.sts.tx_aborted_errors, sts.t.sts.tx_fifo_errors, sts.t.sts.tx_carrier_errors); - return; + return FTDM_SUCCESS; } -void sngisdn_print_span(ftdm_stream_handle_t *stream, ftdm_span_t *span) +ftdm_status_t sngisdn_show_span(ftdm_stream_handle_t *stream, ftdm_span_t *span) { ftdm_signaling_status_t sigstatus; ftdm_alarm_flag_t alarmbits; @@ -1188,18 +1186,18 @@ void sngisdn_print_span(ftdm_stream_handle_t *stream, ftdm_span_t *span) stream->write_function(stream, "span:%s physical:%s signalling:%s\n", span->name, alarmbits ? "ALARMED" : "OK", ftdm_signaling_status2str(sigstatus)); - return; + return FTDM_SUCCESS; } -void sngisdn_print_spans(ftdm_stream_handle_t *stream) +ftdm_status_t sngisdn_show_spans(ftdm_stream_handle_t *stream) { int i; for(i=1;i<=MAX_L1_LINKS;i++) { if (g_sngisdn_data.spans[i]) { - sngisdn_print_span(stream, g_sngisdn_data.spans[i]->ftdm_span); + sngisdn_show_span(stream, g_sngisdn_data.spans[i]->ftdm_span); } } - return; + return FTDM_SUCCESS; } ftdm_status_t sngisdn_add_var(sngisdn_chan_data_t *sngisdn_info, const char* var, const char* val) From 43442e4f41c1f2a85fa07ec2d18e1421f1e81585 Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 2 May 2011 17:21:39 -0500 Subject: [PATCH 425/558] refactor mod_loopback timeout handling --- src/mod/endpoints/mod_loopback/mod_loopback.c | 66 ++++++++----------- 1 file changed, 29 insertions(+), 37 deletions(-) diff --git a/src/mod/endpoints/mod_loopback/mod_loopback.c b/src/mod/endpoints/mod_loopback/mod_loopback.c index be9b4994d6..8fb8384e6b 100644 --- a/src/mod/endpoints/mod_loopback/mod_loopback.c +++ b/src/mod/endpoints/mod_loopback/mod_loopback.c @@ -48,7 +48,7 @@ typedef enum { TFLAG_LINKED = (1 << 0), TFLAG_OUTBOUND = (1 << 1), TFLAG_WRITE = (1 << 2), - TFLAG_CNG = (1 << 3), + TFLAG_USEME = (1 << 3), TFLAG_BRIDGE = (1 << 4), TFLAG_BOWOUT = (1 << 5), TFLAG_BLEG = (1 << 6), @@ -158,7 +158,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses tech_pvt->cng_frame.data = tech_pvt->cng_databuf; tech_pvt->cng_frame.buflen = sizeof(tech_pvt->cng_databuf); - //switch_set_flag((&tech_pvt->cng_frame), SFF_CNG); + tech_pvt->cng_frame.datalen = 2; tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second / @@ -297,12 +297,10 @@ static switch_status_t channel_on_init(switch_core_session_t *session) static void do_reset(private_t *tech_pvt) { switch_clear_flag_locked(tech_pvt, TFLAG_WRITE); - switch_set_flag_locked(tech_pvt, TFLAG_CNG); switch_mutex_lock(tech_pvt->mutex); if (tech_pvt->other_tech_pvt) { switch_clear_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE); - switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_CNG); } switch_mutex_unlock(tech_pvt->mutex); } @@ -446,12 +444,6 @@ static switch_status_t channel_kill_channel(switch_core_session_t *session, int switch (sig) { case SWITCH_SIG_BREAK: - switch_set_flag_locked(tech_pvt, TFLAG_CNG); - switch_mutex_lock(tech_pvt->mutex); - if (tech_pvt->other_tech_pvt) { - switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_CNG); - } - switch_mutex_unlock(tech_pvt->mutex); break; case SWITCH_SIG_KILL: switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); @@ -583,18 +575,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch tech_pvt->write_frame->codec = &tech_pvt->read_codec; *frame = tech_pvt->write_frame; tech_pvt->packet_count++; - switch_clear_flag_locked(tech_pvt, TFLAG_CNG); switch_clear_flag(tech_pvt->write_frame, SFF_CNG); } else { - switch_set_flag(tech_pvt, TFLAG_CNG); - } - - if (switch_test_flag(tech_pvt, TFLAG_CNG)) { *frame = &tech_pvt->cng_frame; tech_pvt->cng_frame.codec = &tech_pvt->read_codec; tech_pvt->cng_frame.datalen = tech_pvt->read_codec.implementation->decoded_bytes_per_packet; switch_set_flag((&tech_pvt->cng_frame), SFF_CNG); - switch_clear_flag_locked(tech_pvt, TFLAG_CNG); } @@ -613,6 +599,17 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch return status; } +static void clear_queue(private_t *tech_pvt) +{ + void *pop; + + while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { + switch_frame_t *frame = (switch_frame_t *) pop; + switch_frame_free(&frame); + } +} + + static switch_status_t channel_write_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id) { switch_channel_t *channel = NULL; @@ -626,7 +623,7 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc switch_assert(tech_pvt != NULL); if (switch_test_flag(frame, SFF_CNG) || - switch_test_flag(tech_pvt, TFLAG_CNG) || (switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) { + (switch_test_flag(tech_pvt, TFLAG_BOWOUT) && switch_test_flag(tech_pvt, TFLAG_BOWOUT_USED))) { switch_core_timer_sync(&tech_pvt->timer); switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer); return SWITCH_STATUS_SUCCESS; @@ -672,23 +669,27 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) { switch_frame_t *clone; - + if (frame->codec->implementation != tech_pvt->write_codec.implementation) { /* change codecs to match */ tech_init(tech_pvt, session, frame->codec); tech_init(tech_pvt->other_tech_pvt, tech_pvt->other_session, frame->codec); } - if (switch_queue_size(tech_pvt->other_tech_pvt->frame_queue) < FRAME_QUEUE_LEN) { - if (switch_frame_dup(frame, &clone) != SWITCH_STATUS_SUCCESS) { - abort(); - } - if (switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone) != SWITCH_STATUS_SUCCESS) { - switch_frame_free(&clone); - } + if (switch_frame_dup(frame, &clone) != SWITCH_STATUS_SUCCESS) { + abort(); + } + + if ((status = switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone)) != SWITCH_STATUS_SUCCESS) { + clear_queue(tech_pvt->other_tech_pvt); + status = switch_queue_trypush(tech_pvt->other_tech_pvt->frame_queue, clone); + } + if (status == SWITCH_STATUS_SUCCESS) { switch_set_flag_locked(tech_pvt->other_tech_pvt, TFLAG_WRITE); + } else { + switch_frame_free(&clone); } status = SWITCH_STATUS_SUCCESS; @@ -747,22 +748,13 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s case SWITCH_MESSAGE_INDICATE_UNBRIDGE: case SWITCH_MESSAGE_INDICATE_AUDIO_SYNC: { - void *pop; done = 1; - while (switch_queue_trypop(tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { - switch_frame_t *frame = (switch_frame_t *) pop; - switch_frame_free(&frame); - } - - while (switch_queue_trypop(tech_pvt->other_tech_pvt->frame_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) { - switch_frame_t *frame = (switch_frame_t *) pop; - switch_frame_free(&frame); - } - + clear_queue(tech_pvt); + clear_queue(tech_pvt->other_tech_pvt); switch_core_timer_sync(&tech_pvt->timer); - + switch_core_timer_sync(&tech_pvt->other_tech_pvt->timer); } break; default: From ccce356392b5cf32a157864458d50bf9fac323db Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 3 May 2011 13:02:01 +0200 Subject: [PATCH 426/558] ftmod_libpri: Rewrite parts of hangup handling to fix hanging calls problem. Let's hope this fixes it for good and doesn't introduce new problems. Tested-by: SparFux (#freetdm @ irc.freenode.net) Signed-off-by: Stefan Knoblich --- .../src/ftmod/ftmod_libpri/ftmod_libpri.c | 83 +++++++++++++++---- 1 file changed, 65 insertions(+), 18 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index 949ea154e3..ec7fe39c7d 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -562,14 +562,18 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) sig.chan_id = ftdm_channel_get_id(chan); sig.span_id = ftdm_channel_get_span_id(chan); sig.channel = chan; - + ftdm_channel_complete_state(chan); switch (ftdm_channel_get_state(chan)) { case FTDM_CHANNEL_STATE_DOWN: { ftdm_channel_t *chtmp = chan; - chan->call_data = NULL; + + if (call) { + pri_destroycall(isdn_data->spri.pri, call); + chan->call_data = NULL; + } if (ftdm_channel_close(&chtmp) != FTDM_SUCCESS) { ftdm_log(FTDM_LOG_WARNING, "-- Failed to close channel %d:%d\n", @@ -776,8 +780,7 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) pri_hangup(isdn_data->spri.pri, call, caller_data->hangup_cause); // pri_destroycall(isdn_data->spri.pri, call); - - chan->call_data = NULL; +// chan->call_data = NULL; } ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); } @@ -785,10 +788,10 @@ static ftdm_status_t state_advance(ftdm_channel_t *chan) case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: { - if (call) { - pri_destroycall(isdn_data->spri.pri, call); - chan->call_data = NULL; - } +// if (call) { +// pri_destroycall(isdn_data->spri.pri, call); +// chan->call_data = NULL; +// } ftdm_set_state_locked(chan, FTDM_CHANNEL_STATE_DOWN); } break; @@ -862,18 +865,61 @@ static int on_hangup(lpwrap_pri_t *spri, lpwrap_pri_event_t event_type, pri_even ftdm_channel_lock(chan); - if (ftdm_channel_get_state(chan) >= FTDM_CHANNEL_STATE_TERMINATING) { - ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", ftdm_channel_get_state_str(chan)); - goto done; + switch (event_type) { + case LPWRAP_PRI_EVENT_HANGUP_REQ: /* DISCONNECT */ + if (ftdm_channel_get_state(chan) >= FTDM_CHANNEL_STATE_TERMINATING) { + ftdm_log_chan(chan, FTDM_LOG_DEBUG, "Ignoring remote hangup in state %s\n", + ftdm_channel_get_state_str(chan)); + goto done; + } + ftdm_log(FTDM_LOG_DEBUG, "-- Hangup REQ on channel %d:%d\n", + ftdm_span_get_id(spri->span), pevent->hangup.channel); + + pri_hangup(spri->pri, pevent->hangup.call, pevent->hangup.cause); + + chan->caller_data.hangup_cause = pevent->hangup.cause; + ftdm_set_state(chan, FTDM_CHANNEL_STATE_TERMINATING); + break; + + case LPWRAP_PRI_EVENT_HANGUP_ACK: /* */ + ftdm_log(FTDM_LOG_DEBUG, "-- Hangup ACK on channel %d:%d\n", + ftdm_span_get_id(spri->span), pevent->hangup.channel); + + pri_hangup(spri->pri, pevent->hangup.call, pevent->hangup.cause); + + ftdm_set_state(chan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + break; + + case LPWRAP_PRI_EVENT_HANGUP: /* "RELEASE/RELEASE_COMPLETE/other" */ + ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", + ftdm_span_get_id(spri->span), pevent->hangup.channel); + + switch (ftdm_channel_get_state(chan)) { + case FTDM_CHANNEL_STATE_DIALING: + case FTDM_CHANNEL_STATE_RINGING: + case FTDM_CHANNEL_STATE_PROGRESS: + case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: + case FTDM_CHANNEL_STATE_PROCEED: + case FTDM_CHANNEL_STATE_UP: + chan->caller_data.hangup_cause = pevent->hangup.cause; + ftdm_set_state(chan, FTDM_CHANNEL_STATE_TERMINATING); + break; + case FTDM_CHANNEL_STATE_HANGUP: + chan->caller_data.hangup_cause = pevent->hangup.cause; + ftdm_set_state(chan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); + break; +// case FTDM_CHANNEL_STATE_TERMINATING: +// ftdm_set_state(chan, FTDM_CHANNEL_STATE_HANGUP); +// break; +// case FTDM_CHANNEL_STATE_HANGUP_COMPLETE: +// ftdm_set_state(chan, FTDM_CHANNEL_STATE_DOWN); +// break; + } + break; + default: + break; } - ftdm_log(FTDM_LOG_DEBUG, "-- Hangup on channel %d:%d\n", ftdm_span_get_id(spri->span), pevent->hangup.channel); - - pri_hangup(spri->pri, pevent->hangup.call, -1); - - chan->caller_data.hangup_cause = pevent->hangup.cause; - chan->call_data = NULL; - ftdm_set_state(chan, FTDM_CHANNEL_STATE_TERMINATING); done: ftdm_channel_unlock(chan); return 0; @@ -1644,6 +1690,7 @@ static void *ftdm_libpri_run(ftdm_thread_t *me, void *obj) LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_DCHAN_UP, on_dchan_up); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_DCHAN_DOWN, on_dchan_down); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_HANGUP_REQ, on_hangup); + LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_HANGUP_ACK, on_hangup); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_HANGUP, on_hangup); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_INFO_RECEIVED, on_info); LPWRAP_MAP_PRI_EVENT(isdn_data->spri, LPWRAP_PRI_EVENT_RESTART, on_restart); From 1e74a714d7b605490a48b153f1a24879a6a410fc Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Tue, 3 May 2011 10:13:30 -0500 Subject: [PATCH 427/558] skypopen: * FS-351 --- src/mod/endpoints/mod_skypopen/Makefile.am | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/Makefile.am b/src/mod/endpoints/mod_skypopen/Makefile.am index b572b58e20..eff7b61ac3 100644 --- a/src/mod/endpoints/mod_skypopen/Makefile.am +++ b/src/mod/endpoints/mod_skypopen/Makefile.am @@ -1,7 +1,24 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_skypopen + +TIFF_DIR=$(switch_srcdir)/libs/tiff-3.8.2 +TIFF_BUILDDIR=$(switch_builddir)/libs/tiff-3.8.2 +TIFF_LA=$(TIFF_BUILDDIR)/libtiff/libtiff.la + +SPANDSP_DIR=$(switch_srcdir)/libs/spandsp +SPANDSP_BUILDDIR=$(switch_builddir)/libs/spandsp +SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la + mod_LTLIBRARIES = mod_skypopen.la mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c -mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -DSKYPOPEN_C_VER=\"`git log -1 --format="%h" skypopen_protocol.c`\" -DMODSKYPOPEN_C_VER=\"`git log -1 --format="%h" mod_skypopen.c`\" -I../../../../libs/spandsp/src -I../../../..//libs/tiff-3.8.2/libtiff -mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la -mod_skypopen_la_LDFLAGS = -L../../../../libs/spandsp/src -avoid-version -module -no-undefined -shared -lX11 -lspandsp +mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DSKYPOPEN_SVN_VERSION=\"`git describe`\" +mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA) +mod_skypopen_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lX11 + +$(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update + cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1 + $(TOUCH_TARGET) + +$(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update + cd $(TIFF_BUILDDIR) && $(MAKE) -j1 + $(TOUCH_TARGET) From e1c21a67dc973ae465b45ca84f419670ccd7a6e6 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Tue, 3 May 2011 10:17:28 -0500 Subject: [PATCH 428/558] gsmopen: FS-351 --- src/mod/endpoints/mod_gsmopen/Makefile.am | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/mod/endpoints/mod_gsmopen/Makefile.am b/src/mod/endpoints/mod_gsmopen/Makefile.am index bde175df8f..8879a4616d 100644 --- a/src/mod/endpoints/mod_gsmopen/Makefile.am +++ b/src/mod/endpoints/mod_gsmopen/Makefile.am @@ -1,7 +1,24 @@ include $(top_srcdir)/build/modmake.rulesam MODNAME=mod_gsmopen + +TIFF_DIR=$(switch_srcdir)/libs/tiff-3.8.2 +TIFF_BUILDDIR=$(switch_builddir)/libs/tiff-3.8.2 +TIFF_LA=$(TIFF_BUILDDIR)/libtiff/libtiff.la + +SPANDSP_DIR=$(switch_srcdir)/libs/spandsp +SPANDSP_BUILDDIR=$(switch_builddir)/libs/spandsp +SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la + mod_LTLIBRARIES = mod_gsmopen.la mod_gsmopen_la_SOURCES = mod_gsmopen.cpp gsmopen_protocol.cpp -mod_gsmopen_la_CFLAGS = $(AM_CFLAGS) -DGSMOPEN_SVN_VERSION=\"`cat $(switch_builddir)/.version`\" -mod_gsmopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la -mod_gsmopen_la_LDFLAGS = -avoid-version -module -no-undefined -lasound -lgsmme -lspandsp +mod_gsmopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DGSMOPEN_SVN_VERSION=\"`cat $(switch_builddir)/.version`\" +mod_gsmopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA) +mod_gsmopen_la_LDFLAGS = -avoid-version -module -no-undefined -lasound -lgsmme + +$(SPANDSP_LA): $(TIFF_LA) $(SPANDSP_DIR) $(SPANDSP_DIR)/.update + cd $(SPANDSP_BUILDDIR) && $(MAKE) -j1 + $(TOUCH_TARGET) + +$(TIFF_LA): $(TIFF_DIR) $(TIFF_DIR)/.update + cd $(TIFF_BUILDDIR) && $(MAKE) -j1 + $(TOUCH_TARGET) From 9ff8f53f053dec3babb802c8a5c96c2e9fc627ca Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Tue, 3 May 2011 12:13:52 -0400 Subject: [PATCH 429/558] mod_callcenter: Fix member been switch as abandoned when he was pickup by an agent FS-3281 --- src/mod/applications/mod_callcenter/mod_callcenter.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index 552eee9518..fee07b54bf 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -2342,6 +2342,7 @@ SWITCH_STANDARD_APP(callcenter_function) char member_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = ""; switch_bool_t agent_found = SWITCH_FALSE; switch_bool_t moh_valid = SWITCH_TRUE; + const char *p; if (!zstr(data)) { mydata = switch_core_session_strdup(member_session, data); @@ -2498,7 +2499,6 @@ SWITCH_STANDARD_APP(callcenter_function) while (switch_channel_ready(member_channel)) { switch_input_args_t args = { 0 }; struct moh_dtmf_helper ht; - const char *p; ht.dtmf = '\0'; args.input_callback = moh_on_dtmf; @@ -2519,7 +2519,8 @@ SWITCH_STANDARD_APP(callcenter_function) if (moh_valid && cur_moh) { switch_status_t status = switch_ivr_play_file(member_session, NULL, cur_moh, &args); - if (status == SWITCH_STATUS_FALSE /* Invalid Recording */) { + if (status == SWITCH_STATUS_FALSE /* Invalid Recording */ && SWITCH_READ_ACCEPTABLE(status)) { + /* Sadly, there doesn't seem to be a return to switch_ivr_play_file that tell you the file wasn't found. FALSE also mean that the channel got switch to BRAKE state, so we check for read acceptable */ switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_WARNING, "Couldn't play file '%s', continuing wait with no audio\n", cur_moh); moh_valid = SWITCH_FALSE; @@ -2535,6 +2536,11 @@ SWITCH_STANDARD_APP(callcenter_function) } + /* Make sure that an agent was not found, since we could have break out before settign it previously */ + if (!agent_found && (p = switch_channel_get_variable(member_channel, "cc_agent_found"))) { + agent_found = switch_true(p); + } + /* Stop Member Thread */ if (h) { h->running = 0; From 89e635cd63cea2ed9407e67f05ee60d17cfee469 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 3 May 2011 16:28:29 -0400 Subject: [PATCH 430/558] FreeTDM: SS7 - Fix for one call state not handled --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index e2af0852e8..72a82acf1f 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -599,6 +599,7 @@ ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL); break; /**************************************************************************/ case FTDM_CHANNEL_STATE_RING: + case FTDM_CHANNEL_STATE_RINGING: case FTDM_CHANNEL_STATE_PROGRESS: case FTDM_CHANNEL_STATE_PROGRESS_MEDIA: case FTDM_CHANNEL_STATE_UP: From c4b78a49c764ee7941cba3be6986ec6e461d764a Mon Sep 17 00:00:00 2001 From: Marc Olivier Chouinard Date: Tue, 3 May 2011 17:27:21 -0400 Subject: [PATCH 431/558] record_session: Will auto create recursive destination folder if it doesn't already exist (Doesn't create folder when used with local cache feature) --- src/switch_ivr_async.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 016fee7246..ed69799d26 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1443,6 +1443,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t struct record_helper *rh = NULL; int file_flags = SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT; switch_bool_t hangup_on_error = SWITCH_FALSE; + char *file_path = NULL; if ((p = switch_channel_get_variable(channel, "RECORD_HANGUP_ON_ERROR"))) { hangup_on_error = switch_true(p); @@ -1534,9 +1535,30 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t } else { tfile = NULL; } + } else { + file_path = switch_core_session_sprintf(session, "%s%s%s", prefix, SWITCH_PATH_SEPARATOR, file); } file = switch_core_session_sprintf(session, "%s%s%s%s%s", switch_str_nil(tfile), tfile ? "]" : "", prefix, SWITCH_PATH_SEPARATOR, file); + } else { + file_path = switch_core_session_strdup(session, file); + } + + if (file_path) { + char *p; + char *path = switch_core_session_strdup(session, file_path); + + if ((p = strrchr(path, *SWITCH_PATH_SEPARATOR))) { + *p = '\0'; + if (switch_dir_make_recursive(path, SWITCH_DEFAULT_DIR_PERMS, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error creating %s\n", path); + return SWITCH_STATUS_GENERR; + } + + } else { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Error finding the folder path section in '%s'\n", path); + path = NULL; + } } if (switch_core_file_open(fh, file, channels, read_impl.actual_samples_per_second, file_flags, NULL) != SWITCH_STATUS_SUCCESS) { From a57336ba37ac5cffd4d93e17c48e3bc28bac2670 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Tue, 3 May 2011 22:40:43 -0500 Subject: [PATCH 432/558] FS-3004 --resolve --- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 94d6bc752b..a1dacf7a6f 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -414,18 +414,19 @@ static void phase_e_handler(t30_state_t *s, void *user_data, int result) /* Fire event */ if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, pvt->app_mode == FUNCTION_TX ? SPANDSP_EVENT_TXFAXRESULT : SPANDSP_EVENT_RXFAXRESULT) == SWITCH_STATUS_SUCCESS) { + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-success", (result == T30_ERR_OK) ? "1" : "0"); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-result-code", fax_result_code); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-result-text", t30_completion_code_to_str(result)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-document-transferred-pages", fax_document_transferred_pages); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-document-total-pages", fax_document_total_pages); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-image-resolution", fax_image_resolution); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-image-size", fax_image_size); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-bad-rows", fax_bad_rows); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-transfer-rate", fax_transfer_rate); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-result-code", fax_result_code); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-result-text", t30_completion_code_to_str(result)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-ecm-used", (t.error_correcting_mode) ? "on" : "off"); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-local-station-id", local_ident); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "fax-remote-station-id", far_ident); - switch_core_session_queue_private_event(session, &event, SWITCH_FALSE); + switch_event_fire(&event); } } From c890fbfa2edf04f253027d9f54303bc3c666aa75 Mon Sep 17 00:00:00 2001 From: Steve Underwood Date: Wed, 4 May 2011 20:49:21 +0800 Subject: [PATCH 433/558] Changed T.38 terminal handling, so errors from the user's packet transmit routine properly filter up the chain, cause termination of the FAX session, and are reported to the caller. --- libs/spandsp/src/t38_core.c | 18 ++++- libs/spandsp/src/t38_terminal.c | 132 +++++++++++++++++++++++++------- 2 files changed, 121 insertions(+), 29 deletions(-) diff --git a/libs/spandsp/src/t38_core.c b/libs/spandsp/src/t38_core.c index e7ee967e93..55b524af61 100644 --- a/libs/spandsp/src/t38_core.c +++ b/libs/spandsp/src/t38_core.c @@ -799,7 +799,11 @@ SPAN_DECLARE(int) t38_core_send_indicator(t38_core_state_t *s, int indicator) return len; } span_log(&s->logging, SPAN_LOG_FLOW, "Tx %5d: indicator %s\n", s->tx_seq_no, t38_indicator_to_str(indicator)); - s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, transmissions); + if (s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, transmissions) < 0) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Tx Packet Handler Failure\n"); + return -1; + } s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; delay = modem_startup_time[indicator].training; if (s->allow_for_tep) @@ -837,7 +841,11 @@ SPAN_DECLARE(int) t38_core_send_data(t38_core_state_t *s, int data_type, int fie span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len); return len; } - s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]); + if (s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]) < 0) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Tx Packet Handler Failure\n"); + return -1; + } s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; return 0; } @@ -853,7 +861,11 @@ SPAN_DECLARE(int) t38_core_send_data_multi_field(t38_core_state_t *s, int data_t span_log(&s->logging, SPAN_LOG_FLOW, "T.38 data len is %d\n", len); return len; } - s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]); + if (s->tx_packet_handler(s, s->tx_packet_user_data, buf, len, s->category_control[category]) < 0) + { + span_log(&s->logging, SPAN_LOG_PROTOCOL_WARNING, "Tx Packet Handler Failure\n"); + return -1; + } s->tx_seq_no = (s->tx_seq_no + 1) & 0xFFFF; return 0; } diff --git a/libs/spandsp/src/t38_terminal.c b/libs/spandsp/src/t38_terminal.c index c9961f665b..64b30f4805 100644 --- a/libs/spandsp/src/t38_terminal.c +++ b/libs/spandsp/src/t38_terminal.c @@ -63,10 +63,18 @@ #include "spandsp/v17rx.h" #include "spandsp/t4_rx.h" #include "spandsp/t4_tx.h" -#if defined(SPANDSP_SUPPORT_T85) +#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85) #include "spandsp/t81_t82_arith_coding.h" +#endif +#if defined(SPANDSP_SUPPORT_T85) #include "spandsp/t85.h" #endif +#if defined(SPANDSP_SUPPORT_T42) +#include "spandsp/t42.h" +#endif +#if defined(SPANDSP_SUPPORT_T43) +#include "spandsp/t43.h" +#endif #include "spandsp/t4_t6_decode.h" #include "spandsp/t4_t6_encode.h" #include "spandsp/t30_fcf.h" @@ -78,10 +86,18 @@ #include "spandsp/t38_terminal.h" #include "spandsp/private/logging.h" -#if defined(SPANDSP_SUPPORT_T85) +#if defined(SPANDSP_SUPPORT_T42) || defined(SPANDSP_SUPPORT_T43) | defined(SPANDSP_SUPPORT_T85) #include "spandsp/private/t81_t82_arith_coding.h" +#endif +#if defined(SPANDSP_SUPPORT_T85) #include "spandsp/private/t85.h" #endif +#if defined(SPANDSP_SUPPORT_T42) +#include "spandsp/private/t42.h" +#endif +#if defined(SPANDSP_SUPPORT_T43) +#include "spandsp/private/t43.h" +#endif #include "spandsp/private/t4_t6_decode.h" #include "spandsp/private/t4_t6_encode.h" #include "spandsp/private/t4_rx.h" @@ -629,7 +645,9 @@ static int set_no_signal(t38_terminal_state_t *s) if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_REGULAR_INDICATORS)) { - t38_core_send_indicator(&s->t38_fe.t38, 0x100 | T38_IND_NO_SIGNAL); + if ((delay = t38_core_send_indicator(&s->t38_fe.t38, 0x100 | T38_IND_NO_SIGNAL)) < 0) + return delay; + /*endif*/ s->t38_fe.timed_step = T38_TIMED_STEP_NO_SIGNAL; #if 0 if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_2S_REGULAR_INDICATORS)) @@ -641,7 +659,9 @@ static int set_no_signal(t38_terminal_state_t *s) return s->t38_fe.ms_per_tx_chunk*1000; } /*endif*/ - delay = t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL); + if ((delay = t38_core_send_indicator(&s->t38_fe.t38, T38_IND_NO_SIGNAL)) < 0) + return delay; + /*endif*/ s->t38_fe.timed_step = T38_TIMED_STEP_NONE; return delay; } @@ -649,7 +669,11 @@ static int set_no_signal(t38_terminal_state_t *s) static int stream_no_signal(t38_terminal_state_t *s) { - t38_core_send_indicator(&s->t38_fe.t38, 0x100 | T38_IND_NO_SIGNAL); + int delay; + + if ((delay = t38_core_send_indicator(&s->t38_fe.t38, 0x100 | T38_IND_NO_SIGNAL)) < 0) + return delay; + /*endif*/ #if 0 if (s->t38_fe.timeout_tx_samples && s->t38_fe.next_tx_samples >= s->t38_fe.timeout_tx_samples) s->t38_fe.timed_step = T38_TIMED_STEP_NONE; @@ -663,6 +687,7 @@ static int stream_non_ecm(t38_terminal_state_t *s) { t38_terminal_front_end_state_t *fe; uint8_t buf[MAX_OCTETS_PER_UNPACED_CHUNK + 50]; + int res; int delay; int len; @@ -674,9 +699,15 @@ static int stream_non_ecm(t38_terminal_state_t *s) case T38_TIMED_STEP_NON_ECM_MODEM: /* Create a 75ms silence */ if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + { + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0) + return delay; + /*endif*/ + } else + { delay = 75000; + } /*endif*/ fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_2; #if 0 @@ -690,7 +721,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) #if 0 if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_REGULAR_INDICATORS)) { - delay = t38_core_send_indicator(&fe->t38, 0x100 | fe->next_tx_indicator); + if ((delay = t38_core_send_indicator(&fe->t38, 0x100 | fe->next_tx_indicator)) < 0) + return delay; + /*endif*/ if (fe->next_tx_samples >= fe->timeout_tx_samples) fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; /*endif*/ @@ -698,7 +731,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) } /*endif*/ #endif - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator); + if ((delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator)) < 0) + return delay; + /*endif*/ fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_3; break; case T38_TIMED_STEP_NON_ECM_MODEM_3: @@ -731,7 +766,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) else { /* If we are sending quickly there seems no point in doing any padding */ - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); + if ((res = t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END)) < 0) + return res; + /*endif*/ fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; delay = 0; break; @@ -739,7 +776,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) /*endif*/ } /*endif*/ - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); + if ((res = t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA)) < 0) + return res; + /*endif*/ delay = bits_to_us(s, 8*len); break; case T38_TIMED_STEP_NON_ECM_MODEM_4: @@ -750,7 +789,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) { len += fe->non_ecm_trailer_bytes; memset(buf, 0, len); - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END); + if ((res = t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_SIG_END, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA_END)) < 0) + return res; + /*endif*/ fe->timed_step = T38_TIMED_STEP_NON_ECM_MODEM_5; /* Allow a bit more time than the data will take to play out, to ensure the far ATA does not cut things short. */ @@ -763,7 +804,9 @@ static int stream_non_ecm(t38_terminal_state_t *s) } /*endif*/ memset(buf, 0, len); - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA); + if ((res = t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_T4_NON_ECM_DATA, buf, len, T38_PACKET_CATEGORY_IMAGE_DATA)) < 0) + return res; + /*endif*/ delay = bits_to_us(s, 8*len); break; case T38_TIMED_STEP_NON_ECM_MODEM_5: @@ -785,6 +828,7 @@ static int stream_hdlc(t38_terminal_state_t *s) t38_data_field_t data_fields[2]; int category; int previous; + int res; int delay; int i; @@ -796,9 +840,15 @@ static int stream_hdlc(t38_terminal_state_t *s) case T38_TIMED_STEP_HDLC_MODEM: /* Create a 75ms silence */ if (fe->t38.current_tx_indicator != T38_IND_NO_SIGNAL) - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + { + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0) + return delay; + /*endif*/ + } else + { delay = 75000; + } /*endif*/ fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_2; #if 0 @@ -814,7 +864,9 @@ static int stream_hdlc(t38_terminal_state_t *s) #if 0 if ((s->t38_fe.chunking_modes & T38_CHUNKING_SEND_REGULAR_INDICATORS)) { - delay = t38_core_send_indicator(&fe->t38, 0x100 | fe->next_tx_indicator); + if ((delay = t38_core_send_indicator(&fe->t38, 0x100 | fe->next_tx_indicator)) < 0) + return delay; + /*endif*/ if (fe->next_tx_samples >= fe->timeout_tx_samples) fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; /*endif*/ @@ -822,8 +874,10 @@ static int stream_hdlc(t38_terminal_state_t *s) } /*endif*/ #endif - delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator) - + t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); + if ((delay = t38_core_send_indicator(&fe->t38, fe->next_tx_indicator)) < 0) + return delay; + /*endif*/ + delay += t38_core_send_flags_delay(&fe->t38, fe->next_tx_indicator); fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; break; case T38_TIMED_STEP_HDLC_MODEM_3: @@ -852,7 +906,9 @@ static int stream_hdlc(t38_terminal_state_t *s) data_fields[1].field = NULL; data_fields[1].field_len = 0; category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; - t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); + if ((res = t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category)) < 0) + return res; + /*endif*/ fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; /* We add a bit of extra time here, as with some implementations the carrier falling too abruptly causes data loss. */ @@ -868,7 +924,9 @@ static int stream_hdlc(t38_terminal_state_t *s) data_fields[1].field = NULL; data_fields[1].field_len = 0; category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; - t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category); + if ((res = t38_core_send_data_multi_field(&fe->t38, fe->current_tx_data_type, data_fields, 2, category)) < 0) + return res; + /*endif*/ fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; delay = bits_to_us(s, i*8 + fe->hdlc_tx.extra_bits); } @@ -877,14 +935,18 @@ static int stream_hdlc(t38_terminal_state_t *s) } /*endif*/ category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category); + if ((res = t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category)) < 0) + return res; + /*endif*/ fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_4; } else { i = fe->octets_per_data_packet; category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; - t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category); + if ((res = t38_core_send_data(&fe->t38, fe->current_tx_data_type, T38_FIELD_HDLC_DATA, &fe->hdlc_tx.buf[fe->hdlc_tx.ptr], i, category)) < 0) + return res; + /*endif*/ fe->hdlc_tx.ptr += i; } /*endif*/ @@ -901,7 +963,9 @@ static int stream_hdlc(t38_terminal_state_t *s) { /* End of transmission */ category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA_END : T38_PACKET_CATEGORY_IMAGE_DATA_END; - t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, category); + if ((res = t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK_SIG_END, NULL, 0, category)) < 0) + return res; + /*endif*/ fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_5; /* We add a bit of extra time here, as with some implementations the carrier falling too abruptly causes data loss. */ @@ -922,7 +986,9 @@ static int stream_hdlc(t38_terminal_state_t *s) /*endif*/ /* Finish the current frame off, and prepare for the next one. */ category = (s->t38_fe.current_tx_data_type == T38_DATA_V21) ? T38_PACKET_CATEGORY_CONTROL_DATA : T38_PACKET_CATEGORY_IMAGE_DATA; - t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category); + if ((res = t38_core_send_data(&fe->t38, previous, T38_FIELD_HDLC_FCS_OK, NULL, 0, category)) < 0) + return res; + /*endif*/ fe->timed_step = T38_TIMED_STEP_HDLC_MODEM_3; /* We should now wait enough time for everything to clear through an analogue modem at the far end. */ delay = bits_to_us(s, fe->hdlc_tx.extra_bits); @@ -955,14 +1021,18 @@ static int stream_ced(t38_terminal_state_t *s) of silence, starting the delay with a no signal indication makes sense. We do need a 200ms delay, as that is a specification requirement. */ fe->timed_step = T38_TIMED_STEP_CED_2; - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0) + return delay; + /*endif*/ delay = 200000; fe->next_tx_samples = fe->samples; break; case T38_TIMED_STEP_CED_2: /* Initial 200ms delay over. Send the CED indicator */ fe->timed_step = T38_TIMED_STEP_CED_3; - delay = t38_core_send_indicator(&fe->t38, T38_IND_CED); + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_CED)) < 0) + return delay; + /*endif*/ fe->current_tx_data_type = T38_DATA_NONE; break; case T38_TIMED_STEP_CED_3: @@ -994,7 +1064,9 @@ static int stream_cng(t38_terminal_state_t *s) be sending 200ms of silence, according to T.30, starting that delay with a no signal indication makes sense. */ fe->timed_step = T38_TIMED_STEP_CNG_2; - delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL); + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_NO_SIGNAL)) < 0) + return delay; + /*endif*/ delay = 200000; fe->next_tx_samples = fe->samples; break; @@ -1003,7 +1075,9 @@ static int stream_cng(t38_terminal_state_t *s) coming the other way interrupts it, or a long timeout controlled by the T.30 engine expires. */ fe->timed_step = T38_TIMED_STEP_NONE; - delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG); + if ((delay = t38_core_send_indicator(&fe->t38, T38_IND_CNG)) < 0) + return delay; + /*endif*/ fe->current_tx_data_type = T38_DATA_NONE; return delay; } @@ -1067,6 +1141,12 @@ SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples break; } /*endswitch*/ + if (delay < 0) + { + t30_terminate(&s->t30); + return TRUE; + } + /*endif*/ fe->next_tx_samples += us_to_samples(delay); return FALSE; } From 88f4828c88ebc3be24df1d59a6d788653231ef85 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 4 May 2011 10:00:22 -0500 Subject: [PATCH 434/558] FS-3282 --resolve ms resolution with new query-timeout-ms, query-timeout still works as expected --- src/mod/applications/mod_enum/mod_enum.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index 043dbab16f..c7766d250a 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -109,6 +109,8 @@ static switch_status_t load_config(void) goto done; } + globals.timeout = 5000; + if ((settings = switch_xml_child(cfg, "settings"))) { for (param = switch_xml_child(settings, "param"); param; param = param->next) { const char *var = switch_xml_attr_soft(param, "name"); @@ -120,6 +122,8 @@ static switch_status_t load_config(void) } else if (!strcasecmp(var, "auto-reload")) { globals.auto_reload = switch_true(val); } else if (!strcasecmp(var, "query-timeout")) { + globals.timeout = atoi(val) * 1000; + } else if (!strcasecmp(var, "query-timeout-ms")) { globals.timeout = atoi(val); } else if (!strcasecmp(var, "default-isn-root")) { set_global_isn_root(val); @@ -404,6 +408,7 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se ldns_rdf *serv_rdf; switch_status_t status = SWITCH_STATUS_FALSE; char *name = NULL; + struct timeval to = { 0, 0}; if (!(name = reverse_number(number, root))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Parse Error!\n"); @@ -431,6 +436,11 @@ switch_status_t ldns_lookup(const char *number, const char *root, const char *se goto end; } + to.tv_sec = globals.timeout / 1000; + to.tv_usec = (globals.timeout % 1000) * 1000; + + ldns_resolver_set_timeout(res, to); + if ((p = ldns_resolver_query(res, domain, LDNS_RR_TYPE_NAPTR, From 789a9ce8d18414ce0f7733accb0724200d397b06 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 4 May 2011 10:03:45 -0500 Subject: [PATCH 435/558] FS-3213 --resolve --- libs/spandsp/.update | 2 +- src/mod/applications/mod_spandsp/mod_spandsp_fax.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libs/spandsp/.update b/libs/spandsp/.update index c79813d90a..bbfb583730 100644 --- a/libs/spandsp/.update +++ b/libs/spandsp/.update @@ -1 +1 @@ -Mon Jun 7 20:09:38 EDT 2010 +Wed May 4 10:03:23 CDT 2011 diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index a1dacf7a6f..119294f4bd 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -220,7 +220,7 @@ static void *SWITCH_THREAD_FUNC timer_thread_run(switch_thread_t *thread, void * } for (pvt = t38_state_list.head; pvt; pvt = pvt->next) { - if (pvt->udptl_state) { + if (pvt->udptl_state && pvt->session && switch_channel_ready(switch_core_session_get_channel(pvt->session))) { t38_terminal_send_timeout(pvt->t38_state, samples); } } @@ -451,6 +451,7 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin for (x = 0; x < count; x++) { if (switch_core_session_write_frame(session, &out_frame, SWITCH_IO_FLAG_NONE, 0) != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID WRITE: %d:%d\n", out_frame.packetlen, count); r = -1; break; } @@ -461,14 +462,16 @@ static int t38_tx_packet_handler(t38_core_state_t *s, void *user_data, const uin if (r < 0) { t30_state_t *t30; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "TERMINATING T30 STATE\n"); + if (pvt->t38_state && (t30 = t38_terminal_get_t30_state(pvt->t38_state))) { t30_terminate(t30); } + switch_yield(10000); } - - return r; + return r < 0 ? r : 0; } static switch_status_t spanfax_init(pvt_t *pvt, transport_mode_t trans_mode) From 7c971707b15b76862f647c22b47c4bb83cdcb770 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Wed, 4 May 2011 12:51:49 -0400 Subject: [PATCH 436/558] add specific alarm status in dump --- libs/freetdm/mod_freetdm/mod_freetdm.c | 28 ++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 68728668bd..4569416d41 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3518,6 +3518,12 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre "physical_span_id: %u\n" "physical_chan_id: %u\n" "physical_status: %s\n" + "physical_status_red: $d\n" + "physical_status_yellow: $d\n" + "physical_status_rai: $d\n" + "physical_status_blue: $d\n" + "physical_status_ais: $d\n" + "physical_status_general: $d\n" "signaling_status: %s\n" "type: %s\n" "state: %s\n" @@ -3538,7 +3544,13 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre phspan_id, phchan_id, alarmflag ? "alarmed" : "ok", - ftdm_signaling_status2str(sigstatus), + (alarmflag & FTDM_ALARM_RED) ? 1 : 0, + (alarmflag & FTDM_ALARM_YELLOW) ? 1 : 0, + (alarmflag & FTDM_ALARM_RAI) ? 1 : 0, + (alarmflag & FTDM_ALARM_BLUE) ? 1 : 0, + (alarmflag & FTDM_ALARM_AIS) ? 1 : 0, + (alarmflag & FTDM_ALARM_GENERAL) ? 1 : 0, + ftdm_signaling_status2str(sigstatus), chan_type, state, last_state, @@ -3594,6 +3606,12 @@ void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t * " %u\n" " %u\n" " %s\n" + " %d\n" + " %d\n" + " %d\n" + " %d\n" + " %d\n" + " %d\n" " %s\n" " %s\n" " %s\n" @@ -3614,7 +3632,13 @@ void dump_chan_xml(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t * phspan_id, phchan_id, alarmflag ? "alarmed" : "ok", - ftdm_signaling_status2str(sigstatus), + (alarmflag & FTDM_ALARM_RED) ? 1 : 0, + (alarmflag & FTDM_ALARM_YELLOW) ? 1 : 0, + (alarmflag & FTDM_ALARM_RAI) ? 1 : 0, + (alarmflag & FTDM_ALARM_BLUE) ? 1 : 0, + (alarmflag & FTDM_ALARM_AIS) ? 1 : 0, + (alarmflag & FTDM_ALARM_GENERAL) ? 1 : 0, + ftdm_signaling_status2str(sigstatus), chan_type, state, last_state, From fca0575ad23fafcefbca703083a6f877569ffb78 Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 4 May 2011 14:47:32 -0500 Subject: [PATCH 437/558] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 119 ++++++++++++++++-- src/mod/languages/mod_managed/managed/swig.cs | 73 +++++++++-- 2 files changed, 172 insertions(+), 20 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index c0402e142d..dbce0886cc 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -7549,6 +7549,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_hostname() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_switchname() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_core_get_switchname(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_variable(char * jarg1, char * jarg2) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; @@ -12430,6 +12440,42 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_free(void * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_bool_t result; + + arg1 = (char *)jarg1; + result = (switch_bool_t)switch_is_number((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_true(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_true((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_false(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_false((char const *)arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_resolve_host(char * jarg1, char * jarg2, unsigned long jarg3) { int jresult ; char *arg1 = (char *) 0 ; @@ -12798,18 +12844,6 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_separate_string_string(char * } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { - int jresult ; - char *arg1 = (char *) 0 ; - switch_bool_t result; - - arg1 = (char *)jarg1; - result = (switch_bool_t)switch_is_number((char const *)arg1); - jresult = result; - return jresult; -} - - SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) { char * jresult ; char *arg1 = (char *) 0 ; @@ -23277,6 +23311,35 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_resurrected_get(vo } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_bridged_set(void * jarg1, void * jarg2) { + switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ; + switch_time_t arg2 ; + switch_time_t *argp2 ; + + arg1 = (switch_channel_timetable *)jarg1; + argp2 = (switch_time_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->bridged = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_bridged_get(void * jarg1) { + void * jresult ; + switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ; + switch_time_t result; + + arg1 = (switch_channel_timetable *)jarg1; + result = ((arg1)->bridged); + jresult = new switch_time_t((switch_time_t &)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_next_set(void * jarg1, void * jarg2) { switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ; switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ; @@ -24658,6 +24721,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag_key(char * jarg1, } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_bridge_time(void * jarg1) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + switch_channel_set_bridge_time(arg1); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hangup_time(void * jarg1) { switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -31382,6 +31453,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_std_datetime_check(void * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_language(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, void * jarg6, char * jarg7) { + int jresult ; + switch_xml_t *arg1 = (switch_xml_t *) 0 ; + switch_xml_t *arg2 = (switch_xml_t *) 0 ; + switch_event_t *arg3 = (switch_event_t *) 0 ; + switch_xml_t *arg4 = (switch_xml_t *) 0 ; + switch_xml_t *arg5 = (switch_xml_t *) 0 ; + switch_xml_t *arg6 = (switch_xml_t *) 0 ; + char *arg7 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_xml_t *)jarg1; + arg2 = (switch_xml_t *)jarg2; + arg3 = (switch_event_t *)jarg3; + arg4 = (switch_xml_t *)jarg4; + arg5 = (switch_xml_t *)jarg5; + arg6 = (switch_xml_t *)jarg6; + arg7 = (char *)jarg7; + result = (switch_status_t)switch_xml_locate_language(arg1,arg2,arg3,arg4,arg5,arg6,(char const *)arg7); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set(void * jarg1, void * jarg2) { switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ; switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 497630fd26..d7a3aa9682 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -1399,6 +1399,11 @@ public class freeswitch { return ret; } + public static string switch_core_get_switchname() { + string ret = freeswitchPINVOKE.switch_core_get_switchname(); + return ret; + } + public static void switch_core_set_variable(string varname, string value) { freeswitchPINVOKE.switch_core_set_variable(varname, value); } @@ -2862,6 +2867,21 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_is_number(string str) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str); + return ret; + } + + public static int switch_true(string expr) { + int ret = freeswitchPINVOKE.switch_true(expr); + return ret; + } + + public static int switch_false(string expr) { + int ret = freeswitchPINVOKE.switch_false(expr); + return ret; + } + public static switch_status_t switch_resolve_host(string host, string buf, uint buflen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resolve_host(host, buf, buflen); return ret; @@ -2985,11 +3005,6 @@ public class freeswitch { return ret; } - public static switch_bool_t switch_is_number(string str) { - switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str); - return ret; - } - public static string switch_strip_spaces(string str, switch_bool_t dup) { string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup); return ret; @@ -3697,6 +3712,10 @@ public class freeswitch { return ret; } + public static void switch_channel_set_bridge_time(SWIGTYPE_p_switch_channel channel) { + freeswitchPINVOKE.switch_channel_set_bridge_time(SWIGTYPE_p_switch_channel.getCPtr(channel)); + } + public static void switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel channel) { freeswitchPINVOKE.switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel.getCPtr(channel)); } @@ -5283,6 +5302,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_xml_locate_language(SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml node, switch_event arg2, SWIGTYPE_p_p_switch_xml language, SWIGTYPE_p_p_switch_xml phrases, SWIGTYPE_p_p_switch_xml macros, string str_language) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_language(SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg2), SWIGTYPE_p_p_switch_xml.getCPtr(language), SWIGTYPE_p_p_switch_xml.getCPtr(phrases), SWIGTYPE_p_p_switch_xml.getCPtr(macros), str_language); + return ret; + } + public static switch_status_t switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel)); return ret; @@ -7683,6 +7707,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_hostname")] public static extern string switch_core_get_hostname(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_switchname")] + public static extern string switch_core_get_switchname(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_variable")] public static extern void switch_core_set_variable(string jarg1, string jarg2); @@ -8784,6 +8811,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_free")] public static extern int switch_frame_free(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_is_number")] + public static extern int switch_is_number(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_true")] + public static extern int switch_true(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_false")] + public static extern int switch_false(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_resolve_host")] public static extern int switch_resolve_host(string jarg1, string jarg2, uint jarg3); @@ -8856,9 +8892,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_string_string")] public static extern uint switch_separate_string_string(string jarg1, string jarg2, ref string jarg3, uint jarg4); - [DllImport("mod_managed", EntryPoint="CSharp_switch_is_number")] - public static extern int switch_is_number(string jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] public static extern string switch_strip_spaces(string jarg1, int jarg2); @@ -11439,6 +11472,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_resurrected_get")] public static extern IntPtr switch_channel_timetable_resurrected_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_bridged_set")] + public static extern void switch_channel_timetable_bridged_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_bridged_get")] + public static extern IntPtr switch_channel_timetable_bridged_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_next_set")] public static extern void switch_channel_timetable_next_set(HandleRef jarg1, HandleRef jarg2); @@ -11748,6 +11787,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag_key")] public static extern int switch_channel_test_app_flag_key(string jarg1, HandleRef jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_bridge_time")] + public static extern void switch_channel_set_bridge_time(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hangup_time")] public static extern void switch_channel_set_hangup_time(HandleRef jarg1); @@ -13170,6 +13212,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_std_datetime_check")] public static extern int switch_xml_std_datetime_check(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_language")] + public static extern int switch_xml_locate_language(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, string jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set")] public static extern void switch_io_event_hook_outgoing_channel_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2); @@ -22046,6 +22091,18 @@ public class switch_channel_timetable : IDisposable { } } + public SWIGTYPE_p_switch_time_t bridged { + set { + freeswitchPINVOKE.switch_channel_timetable_bridged_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_bridged_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public switch_channel_timetable next { set { freeswitchPINVOKE.switch_channel_timetable_next_set(swigCPtr, switch_channel_timetable.getCPtr(value)); From 7adaceb87a052e36f6bb6055ba0d702f1de2b2ea Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 4 May 2011 16:54:45 -0500 Subject: [PATCH 438/558] Fix for issue reported on the mailing list with a Chinese locale and windows. This commit removes a hidden char that should not have been there anyway. --- libs/sofia-sip/libsofia-sip-ua/su/su_string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/sofia-sip/libsofia-sip-ua/su/su_string.c b/libs/sofia-sip/libsofia-sip-ua/su/su_string.c index 6774d372b6..249e788389 100644 --- a/libs/sofia-sip/libsofia-sip-ua/su/su_string.c +++ b/libs/sofia-sip/libsofia-sip-ua/su/su_string.c @@ -478,7 +478,7 @@ size_t su_memspn(const void *mem, size_t memlen, * of bytes not in @a reject. * * @param mem pointer to memory area - * @param memlen size of @a mem in bytes + * @param memlen size of @a mem in bytes * @param reject pointer to table containing bytes to reject * @param rejectlen size of @a reject table * From 1b8013a171dd4d130645426c32ee0e1ea8d9f025 Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Wed, 4 May 2011 21:59:17 -0500 Subject: [PATCH 439/558] vs2010 reswig --- .../mod_managed/freeswitch_wrap.2010.cxx | 118 ++++++++++++++++-- .../mod_managed/managed/swig.2010.cs | 73 +++++++++-- 2 files changed, 171 insertions(+), 20 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx index 7165efc483..a0bf23dbfb 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.2010.cxx @@ -7257,6 +7257,16 @@ SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_hostname() { } +SWIGEXPORT char * SWIGSTDCALL CSharp_switch_core_get_switchname() { + char * jresult ; + char *result = 0 ; + + result = (char *)switch_core_get_switchname(); + jresult = SWIG_csharp_string_callback((const char *)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_core_set_variable(char * jarg1, char * jarg2) { char *arg1 = (char *) 0 ; char *arg2 = (char *) 0 ; @@ -12105,6 +12115,42 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_frame_free(void * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + switch_bool_t result; + + arg1 = (char *)jarg1; + result = (switch_bool_t)switch_is_number((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_true(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_true((char const *)arg1); + jresult = result; + return jresult; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_switch_false(char * jarg1) { + int jresult ; + char *arg1 = (char *) 0 ; + int result; + + arg1 = (char *)jarg1; + result = (int)switch_false((char const *)arg1); + jresult = result; + return jresult; +} + + SWIGEXPORT int SWIGSTDCALL CSharp_switch_resolve_host(char * jarg1, char * jarg2, unsigned long jarg3) { int jresult ; char *arg1 = (char *) 0 ; @@ -12473,18 +12519,6 @@ SWIGEXPORT unsigned int SWIGSTDCALL CSharp_switch_separate_string_string(char * } -SWIGEXPORT int SWIGSTDCALL CSharp_switch_is_number(char * jarg1) { - int jresult ; - char *arg1 = (char *) 0 ; - switch_bool_t result; - - arg1 = (char *)jarg1; - result = (switch_bool_t)switch_is_number((char const *)arg1); - jresult = result; - return jresult; -} - - SWIGEXPORT char * SWIGSTDCALL CSharp_switch_strip_spaces(char * jarg1, int jarg2) { char * jresult ; char *arg1 = (char *) 0 ; @@ -22614,6 +22648,34 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_resurrected_get(vo } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_bridged_set(void * jarg1, void * jarg2) { + switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ; + switch_time_t arg2 ; + switch_time_t *argp2 ; + + arg1 = (switch_channel_timetable *)jarg1; + argp2 = (switch_time_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_time_t", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->bridged = arg2; +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_channel_timetable_bridged_get(void * jarg1) { + void * jresult ; + switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ; + switch_time_t result; + + arg1 = (switch_channel_timetable *)jarg1; + result = ((arg1)->bridged); + jresult = new switch_time_t((const switch_time_t &)result); + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_timetable_next_set(void * jarg1, void * jarg2) { switch_channel_timetable *arg1 = (switch_channel_timetable *) 0 ; switch_channel_timetable *arg2 = (switch_channel_timetable *) 0 ; @@ -23993,6 +24055,14 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_channel_test_app_flag_key(char * jarg1, } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_bridge_time(void * jarg1) { + switch_channel_t *arg1 = (switch_channel_t *) 0 ; + + arg1 = (switch_channel_t *)jarg1; + switch_channel_set_bridge_time(arg1); +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_channel_set_hangup_time(void * jarg1) { switch_channel_t *arg1 = (switch_channel_t *) 0 ; @@ -30660,6 +30730,30 @@ SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_std_datetime_check(void * jarg1) { } +SWIGEXPORT int SWIGSTDCALL CSharp_switch_xml_locate_language(void * jarg1, void * jarg2, void * jarg3, void * jarg4, void * jarg5, void * jarg6, char * jarg7) { + int jresult ; + switch_xml_t *arg1 = (switch_xml_t *) 0 ; + switch_xml_t *arg2 = (switch_xml_t *) 0 ; + switch_event_t *arg3 = (switch_event_t *) 0 ; + switch_xml_t *arg4 = (switch_xml_t *) 0 ; + switch_xml_t *arg5 = (switch_xml_t *) 0 ; + switch_xml_t *arg6 = (switch_xml_t *) 0 ; + char *arg7 = (char *) 0 ; + switch_status_t result; + + arg1 = (switch_xml_t *)jarg1; + arg2 = (switch_xml_t *)jarg2; + arg3 = (switch_event_t *)jarg3; + arg4 = (switch_xml_t *)jarg4; + arg5 = (switch_xml_t *)jarg5; + arg6 = (switch_xml_t *)jarg6; + arg7 = (char *)jarg7; + result = (switch_status_t)switch_xml_locate_language(arg1,arg2,arg3,arg4,arg5,arg6,(char const *)arg7); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set(void * jarg1, void * jarg2) { switch_io_event_hook_outgoing_channel *arg1 = (switch_io_event_hook_outgoing_channel *) 0 ; switch_outgoing_channel_hook_t arg2 = (switch_outgoing_channel_hook_t) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.2010.cs b/src/mod/languages/mod_managed/managed/swig.2010.cs index 6d8c374d44..9a1f30fd9b 100644 --- a/src/mod/languages/mod_managed/managed/swig.2010.cs +++ b/src/mod/languages/mod_managed/managed/swig.2010.cs @@ -1409,6 +1409,11 @@ public class freeswitch { return ret; } + public static string switch_core_get_switchname() { + string ret = freeswitchPINVOKE.switch_core_get_switchname(); + return ret; + } + public static void switch_core_set_variable(string varname, string value) { freeswitchPINVOKE.switch_core_set_variable(varname, value); } @@ -2872,6 +2877,21 @@ public class freeswitch { return ret; } + public static switch_bool_t switch_is_number(string str) { + switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str); + return ret; + } + + public static int switch_true(string expr) { + int ret = freeswitchPINVOKE.switch_true(expr); + return ret; + } + + public static int switch_false(string expr) { + int ret = freeswitchPINVOKE.switch_false(expr); + return ret; + } + public static switch_status_t switch_resolve_host(string host, string buf, uint buflen) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_resolve_host(host, buf, buflen); return ret; @@ -2995,11 +3015,6 @@ public class freeswitch { return ret; } - public static switch_bool_t switch_is_number(string str) { - switch_bool_t ret = (switch_bool_t)freeswitchPINVOKE.switch_is_number(str); - return ret; - } - public static string switch_strip_spaces(string str, switch_bool_t dup) { string ret = freeswitchPINVOKE.switch_strip_spaces(str, (int)dup); return ret; @@ -3707,6 +3722,10 @@ public class freeswitch { return ret; } + public static void switch_channel_set_bridge_time(SWIGTYPE_p_switch_channel channel) { + freeswitchPINVOKE.switch_channel_set_bridge_time(SWIGTYPE_p_switch_channel.getCPtr(channel)); + } + public static void switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel channel) { freeswitchPINVOKE.switch_channel_set_hangup_time(SWIGTYPE_p_switch_channel.getCPtr(channel)); } @@ -5293,6 +5312,11 @@ public class freeswitch { return ret; } + public static switch_status_t switch_xml_locate_language(SWIGTYPE_p_p_switch_xml root, SWIGTYPE_p_p_switch_xml node, switch_event arg2, SWIGTYPE_p_p_switch_xml language, SWIGTYPE_p_p_switch_xml phrases, SWIGTYPE_p_p_switch_xml macros, string str_language) { + switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_locate_language(SWIGTYPE_p_p_switch_xml.getCPtr(root), SWIGTYPE_p_p_switch_xml.getCPtr(node), switch_event.getCPtr(arg2), SWIGTYPE_p_p_switch_xml.getCPtr(language), SWIGTYPE_p_p_switch_xml.getCPtr(phrases), SWIGTYPE_p_p_switch_xml.getCPtr(macros), str_language); + return ret; + } + public static switch_status_t switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session session, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t outgoing_channel) { switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_event_hook_add_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_switch_core_session_unsigned_long__switch_status_t.getCPtr(outgoing_channel)); return ret; @@ -7697,6 +7721,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_hostname")] public static extern string switch_core_get_hostname(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_get_switchname")] + public static extern string switch_core_get_switchname(); + [DllImport("mod_managed", EntryPoint="CSharp_switch_core_set_variable")] public static extern void switch_core_set_variable(string jarg1, string jarg2); @@ -8798,6 +8825,15 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_frame_free")] public static extern int switch_frame_free(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_is_number")] + public static extern int switch_is_number(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_true")] + public static extern int switch_true(string jarg1); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_false")] + public static extern int switch_false(string jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_resolve_host")] public static extern int switch_resolve_host(string jarg1, string jarg2, uint jarg3); @@ -8870,9 +8906,6 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_separate_string_string")] public static extern uint switch_separate_string_string(string jarg1, string jarg2, ref string jarg3, uint jarg4); - [DllImport("mod_managed", EntryPoint="CSharp_switch_is_number")] - public static extern int switch_is_number(string jarg1); - [DllImport("mod_managed", EntryPoint="CSharp_switch_strip_spaces")] public static extern string switch_strip_spaces(string jarg1, int jarg2); @@ -11453,6 +11486,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_resurrected_get")] public static extern IntPtr switch_channel_timetable_resurrected_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_bridged_set")] + public static extern void switch_channel_timetable_bridged_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_bridged_get")] + public static extern IntPtr switch_channel_timetable_bridged_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_timetable_next_set")] public static extern void switch_channel_timetable_next_set(HandleRef jarg1, HandleRef jarg2); @@ -11762,6 +11801,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_test_app_flag_key")] public static extern int switch_channel_test_app_flag_key(string jarg1, HandleRef jarg2, uint jarg3); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_bridge_time")] + public static extern void switch_channel_set_bridge_time(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_channel_set_hangup_time")] public static extern void switch_channel_set_hangup_time(HandleRef jarg1); @@ -13184,6 +13226,9 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_std_datetime_check")] public static extern int switch_xml_std_datetime_check(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_xml_locate_language")] + public static extern int switch_xml_locate_language(HandleRef jarg1, HandleRef jarg2, HandleRef jarg3, HandleRef jarg4, HandleRef jarg5, HandleRef jarg6, string jarg7); + [DllImport("mod_managed", EntryPoint="CSharp_switch_io_event_hook_outgoing_channel_outgoing_channel_set")] public static extern void switch_io_event_hook_outgoing_channel_outgoing_channel_set(HandleRef jarg1, HandleRef jarg2); @@ -22100,6 +22145,18 @@ public class switch_channel_timetable : IDisposable { } } + public SWIGTYPE_p_switch_time_t bridged { + set { + freeswitchPINVOKE.switch_channel_timetable_bridged_set(swigCPtr, SWIGTYPE_p_switch_time_t.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_switch_time_t ret = new SWIGTYPE_p_switch_time_t(freeswitchPINVOKE.switch_channel_timetable_bridged_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public switch_channel_timetable next { set { freeswitchPINVOKE.switch_channel_timetable_next_set(swigCPtr, switch_channel_timetable.getCPtr(value)); From e497784ade50912588da722c257ba7d8bc4b3b62 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Thu, 5 May 2011 12:04:15 -0400 Subject: [PATCH 440/558] freetdm: ftmod_r2 - take charge_calls parameter into consideration when accepting a call --- libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 64d8b4fc3c..171112e0af 100755 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -360,11 +360,15 @@ static void ft_r2_clean_call(ftdm_r2_call_t *call) static void ft_r2_accept_call(ftdm_channel_t *ftdmchan) { openr2_chan_t *r2chan = R2CALL(ftdmchan)->r2chan; - // FIXME: not always accept as no charge, let the user decide that - // also we should check the return code from openr2_chan_accept_call and handle error condition + ftdm_r2_data_t *r2data = ftdmchan->span->signal_data; + + // FIXME: we should check the return code from openr2_chan_accept_call and handle error condition // hanging up the call with protocol error as the reason, this openr2 API will fail only when there something // wrong at the I/O layer or the library itself - openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE); + if (r2data->charge_calls) + openr2_chan_accept_call(r2chan, OR2_CALL_WITH_CHARGE); + else + openr2_chan_accept_call(r2chan, OR2_CALL_NO_CHARGE); } static void ft_r2_answer_call(ftdm_channel_t *ftdmchan) @@ -1697,6 +1701,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) r2data->category = r2conf.category; r2data->allow_collect_calls = r2conf.allow_collect_calls; r2data->flags = 0; + r2data->charge_calls = r2conf.charge_calls; spanpvt->r2context = r2data->r2context; /* just the value must be freed by the hash */ From 65a324b8ba10394334adc7584db99c2bfb04c621 Mon Sep 17 00:00:00 2001 From: Arnaldo Pereira Date: Thu, 5 May 2011 12:22:18 -0400 Subject: [PATCH 441/558] freetdm: ftmod_r2 - consider force_release and overwrite the disconnect cause, on incoming calls, when it's set. --- libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c index 171112e0af..1c15f992a2 100755 --- a/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c +++ b/libs/freetdm/src/ftmod/ftmod_r2/ftmod_r2.c @@ -1702,6 +1702,7 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_r2_configure_span_signaling) r2data->allow_collect_calls = r2conf.allow_collect_calls; r2data->flags = 0; r2data->charge_calls = r2conf.charge_calls; + r2data->forced_release = r2conf.forced_release; spanpvt->r2context = r2data->r2context; /* just the value must be freed by the hash */ @@ -1859,6 +1860,10 @@ static ftdm_status_t ftdm_r2_state_advance(ftdm_channel_t *ftdmchan) { if (!r2call->disconnect_rcvd) { openr2_call_disconnect_cause_t disconnect_cause = ftdm_r2_ftdm_cause_to_openr2_cause(ftdmchan); + /* overwrite the hangup cause if this is an incoming call and forced_release is set */ + if (openr2_chan_get_direction(r2chan) == OR2_DIR_BACKWARD && r2data->forced_release) { + disconnect_cause = OR2_CAUSE_FORCED_RELEASE; + } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Clearing call, cause = %s\n", openr2_proto_get_disconnect_string(disconnect_cause)); /* this will disconnect the call, but need to wait for the call end before moving to DOWN */ openr2_chan_disconnect_call(r2chan, disconnect_cause); From 6341694d13918bb5a4bb12cd8a7ddfc694fda2c3 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Thu, 5 May 2011 12:32:25 -0500 Subject: [PATCH 442/558] skypopen: let's bump the thread priorities (to be refined, thanks Tony) --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index eac0a67943..8841ee246b 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -1733,6 +1733,7 @@ static switch_status_t load_config(int reload_type) switch_threadattr_create(&skypopen_api_thread_attr, skypopen_module_pool); switch_threadattr_detach_set(skypopen_api_thread_attr, 0); switch_threadattr_stacksize_set(skypopen_api_thread_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(skypopen_api_thread_attr); switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].skypopen_api_thread, skypopen_api_thread_attr, skypopen_do_skypeapi_thread, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool); @@ -1742,6 +1743,7 @@ static switch_status_t load_config(int reload_type) switch_threadattr_create(&skypopen_signaling_thread_attr, skypopen_module_pool); switch_threadattr_detach_set(skypopen_signaling_thread_attr, 0); switch_threadattr_stacksize_set(skypopen_signaling_thread_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(skypopen_signaling_thread_attr); switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id]. skypopen_signaling_thread, skypopen_signaling_thread_attr, skypopen_signaling_thread_func, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool); @@ -2197,6 +2199,7 @@ int start_audio_threads(private_t *tech_pvt) switch_threadattr_create(&thd_attr, skypopen_module_pool); switch_threadattr_detach_set(thd_attr, 0); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(thd_attr); switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); //DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); if (switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { @@ -2213,6 +2216,7 @@ int start_audio_threads(private_t *tech_pvt) switch_threadattr_create(&thd_attr, skypopen_module_pool); switch_threadattr_detach_set(thd_attr, 0); switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(thd_attr); switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); //DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); if (switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { From a5170df009c7008da415ae9a2689163519048d27 Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Thu, 5 May 2011 13:45:14 -0400 Subject: [PATCH 443/558] mod_radius_cdr: Add 'Freeswitch-Direction' av pair --- .../event_handlers/mod_radius_cdr/mod_radius_cdr.c | 12 ++++++++++++ .../event_handlers/mod_radius_cdr/mod_radius_cdr.h | 1 + .../event_handlers/mod_radius_cdr/radius/dictionary | 1 + 3 files changed, 14 insertions(+) diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c index 440cbf90a7..1d4ec1335a 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c @@ -24,6 +24,7 @@ * Contributor(s): * * Chris Parker + * Mathieu Rene * * * mod_radius_cdr.c -- RADIUS CDR Module @@ -628,6 +629,17 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) rc_destroy(rad_config); goto end; } + + { + const char *direction_str = profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? "inbound" : "outbound"; + + if (rc_avpair_add(rad_config, &send, PW_FS_DIRECTION, (void *) direction_str, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Direction: %s\n", direction_str); + rc_destroy(rad_config); + goto end; + } + } + } else { /* no profile, can't create data to send */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n"); } diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h index e4e5a38afc..12badeb665 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h @@ -58,6 +58,7 @@ #define PW_FS_CALLANSWERDATE 21 #define PW_FS_CALLTRANSFERDATE 22 #define PW_FS_CALLENDDATE 23 +#define PW_FS_DIRECTION 24 #endif diff --git a/src/mod/event_handlers/mod_radius_cdr/radius/dictionary b/src/mod/event_handlers/mod_radius_cdr/radius/dictionary index 8c04c6dd93..e496fb3215 100644 --- a/src/mod/event_handlers/mod_radius_cdr/radius/dictionary +++ b/src/mod/event_handlers/mod_radius_cdr/radius/dictionary @@ -276,6 +276,7 @@ ATTRIBUTE Freeswitch-Callstartdate 20 string Freeswitch ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch ATTRIBUTE Freeswitch-Callenddate 23 string Freeswitch +ATTRIBUTE Freeswitch-Direction 24 string Freeswitch # # Freeswitch-Hangupcause From 18d29b46706a063dd4136604943e27fe71a5b27b Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Thu, 5 May 2011 15:21:27 -0400 Subject: [PATCH 444/558] mod_radius_cdr: Add 'Freeswitch-Other-Leg-Id' av pair --- src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c | 9 +++++++++ src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h | 1 + src/mod/event_handlers/mod_radius_cdr/radius/dictionary | 1 + 3 files changed, 11 insertions(+) diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c index 1d4ec1335a..1083183981 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c @@ -146,6 +146,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) switch_time_t callanswerdate = 0; switch_time_t callenddate = 0; switch_time_t calltransferdate = 0; + const char *signal_bond = NULL; char *uuid_str; @@ -211,6 +212,14 @@ static switch_status_t my_on_routing(switch_core_session_t *session) return SWITCH_STATUS_TERM; } */ + + if ((signal_bond = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && !zstr(signal_bond)) { + if (rc_avpair_add(rad_config, &send, PW_FS_OTHER_LEG_ID, (void*) signal_bond, -1, PW_FS_PEC) == NULL) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s\n", uuid_str); + rc_destroy(rad_config); + goto end; + } + } profile = switch_channel_get_caller_profile(channel); diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h index 12badeb665..a3effad005 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.h @@ -59,6 +59,7 @@ #define PW_FS_CALLTRANSFERDATE 22 #define PW_FS_CALLENDDATE 23 #define PW_FS_DIRECTION 24 +#define PW_FS_OTHER_LEG_ID 25 #endif diff --git a/src/mod/event_handlers/mod_radius_cdr/radius/dictionary b/src/mod/event_handlers/mod_radius_cdr/radius/dictionary index e496fb3215..c126e685d4 100644 --- a/src/mod/event_handlers/mod_radius_cdr/radius/dictionary +++ b/src/mod/event_handlers/mod_radius_cdr/radius/dictionary @@ -277,6 +277,7 @@ ATTRIBUTE Freeswitch-Callanswerdate 21 string Freeswitch ATTRIBUTE Freeswitch-Calltransferdate 22 string Freeswitch ATTRIBUTE Freeswitch-Callenddate 23 string Freeswitch ATTRIBUTE Freeswitch-Direction 24 string Freeswitch +ATTRIBUTE Freeswitch-Other-Leg-Id 25 string Freeswitch # # Freeswitch-Hangupcause From fee49b16dfc8e0bc75723ac1e801519220d99f4d Mon Sep 17 00:00:00 2001 From: Mathieu Rene Date: Thu, 5 May 2011 15:23:53 -0400 Subject: [PATCH 445/558] mod_radius_cdr: log errors with the call's uuid --- .../mod_radius_cdr/mod_radius_cdr.c | 116 +++++++++--------- 1 file changed, 58 insertions(+), 58 deletions(-) diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c index 1083183981..d42914d061 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c @@ -153,7 +153,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) switch_time_exp_t tm; char buffer[32]; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_routing\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_routing\n"); if (globals.shutdown) { return SWITCH_STATUS_FALSE; @@ -162,7 +162,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) if (channel) { const char *disable_flag = switch_channel_get_variable(channel, "disable_radius_start"); if (switch_true(disable_flag)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Start\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Start\n"); return SWITCH_STATUS_SUCCESS; } } @@ -172,14 +172,14 @@ static switch_status_t my_on_routing(switch_core_session_t *session) rad_config = my_radius_init(); if (rad_config == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing radius, Start packet not logged.\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing radius, Start packet not logged.\n"); goto end; } if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) { uuid_str = switch_core_session_get_uuid(session); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n"); goto end; } @@ -187,13 +187,13 @@ static switch_status_t my_on_routing(switch_core_session_t *session) /* Set Status Type */ if (rc_avpair_add(rad_config, &send, PW_ACCT_STATUS_TYPE, &status_type, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed setting Acct-Status-Type: Start\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed setting Acct-Status-Type: Start\n"); rc_destroy(rad_config); goto end; } if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Acct-Session-ID: %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Acct-Session-ID: %s\n", uuid_str); rc_destroy(rad_config); goto end; } @@ -207,7 +207,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) /* cause = switch_channel_get_cause(channel); if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause); rc_destroy(rad_config); return SWITCH_STATUS_TERM; } @@ -215,7 +215,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) if ((signal_bond = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && !zstr(signal_bond)) { if (rc_avpair_add(rad_config, &send, PW_FS_OTHER_LEG_ID, (void*) signal_bond, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Failed adding Freeswitch-Other-Leg-Id: %s\n", uuid_str); rc_destroy(rad_config); goto end; } @@ -232,35 +232,35 @@ static switch_status_t my_on_routing(switch_core_session_t *session) if (profile->username) { if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username); rc_destroy(rad_config); goto end; } } if (profile->caller_id_number) { if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number); rc_destroy(rad_config); goto end; } } if (profile->caller_id_name) { if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name); rc_destroy(rad_config); goto end; } } if (profile->destination_number) { if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number); rc_destroy(rad_config); goto end; } } if (profile->dialplan) { if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan); rc_destroy(rad_config); goto end; } @@ -269,42 +269,42 @@ static switch_status_t my_on_routing(switch_core_session_t *session) inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr); framed_addr = htonl(framed_addr); if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, &framed_addr, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr); rc_destroy(rad_config); goto end; } } if (profile->rdnis) { if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis); rc_destroy(rad_config); goto end; } } if (profile->context) { if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context); rc_destroy(rad_config); goto end; } } if (profile->ani) { if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani); rc_destroy(rad_config); goto end; } } if (profile->aniii) { if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii); rc_destroy(rad_config); goto end; } } if (profile->source) { if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source); rc_destroy(rad_config); goto end; } @@ -315,7 +315,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer); rc_destroy(rad_config); goto end; } @@ -327,7 +327,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer); rc_destroy(rad_config); goto end; } @@ -339,7 +339,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer); rc_destroy(rad_config); goto end; } @@ -351,7 +351,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer); rc_destroy(rad_config); goto end; } @@ -360,21 +360,21 @@ static switch_status_t my_on_routing(switch_core_session_t *session) if (profile->caller_extension && profile->caller_extension->last_application && profile->caller_extension->last_application->application_name) { if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP, (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source); rc_destroy(rad_config); goto end; } } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n"); } } if (rc_acct(rad_config, client_port, send) == OK_RC) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] RADIUS Accounting OK\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] RADIUS Accounting OK\n"); retval = SWITCH_STATUS_SUCCESS; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] RADIUS Accounting Failed\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] RADIUS Accounting Failed\n"); retval = SWITCH_STATUS_TERM; } rc_avpair_free(send); @@ -414,26 +414,26 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) if (channel) { const char *disable_flag = switch_channel_get_variable(channel, "disable_radius_stop"); if (switch_true(disable_flag)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Stop\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Not Sending RADIUS Stop\n"); return SWITCH_STATUS_SUCCESS; } } switch_thread_rwlock_rdlock(globals.rwlock); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_reporting\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Entering my_on_reporting\n"); rad_config = my_radius_init(); if (rad_config == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing radius, session not logged.\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error initializing radius, session not logged.\n"); goto end; } if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) { uuid_str = switch_core_session_get_uuid(session); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "[mod_radius_cdr] Error Generating Data!\n"); goto end; } @@ -441,13 +441,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) /* Set Status Type */ if (rc_avpair_add(rad_config, &send, PW_ACCT_STATUS_TYPE, &status_type, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str); rc_destroy(rad_config); goto end; } if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_ID, uuid_str, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Acct-Session-ID: %s\n", uuid_str); rc_destroy(rad_config); goto end; } @@ -460,7 +460,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) cause = switch_channel_get_cause(channel); if (rc_avpair_add(rad_config, &send, PW_FS_HANGUPCAUSE, &cause, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Hangupcause: %d\n", cause); rc_destroy(rad_config); goto end; } @@ -469,7 +469,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) if (profile) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Calculating billable time\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Calculating billable time\n"); /* calculate billable time */ callstartdate = profile->times->created; @@ -490,39 +490,39 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) } billsec = (billusec / 1000000); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "[mod_radius_cdr] Finished calculating billable time\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "[mod_radius_cdr] Finished calculating billable time\n"); if (profile->username) { if (rc_avpair_add(rad_config, &send, PW_USER_NAME, (void *) profile->username, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding User-Name: %s\n", profile->username); rc_destroy(rad_config); goto end; } } if (profile->caller_id_number) { if (rc_avpair_add(rad_config, &send, PW_FS_SRC, (void *) profile->caller_id_number, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Src: %s\n", profile->caller_id_number); rc_destroy(rad_config); goto end; } } if (profile->caller_id_name) { if (rc_avpair_add(rad_config, &send, PW_FS_CLID, (void *) profile->caller_id_name, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-CLID: %s\n", profile->caller_id_name); rc_destroy(rad_config); goto end; } } if (profile->destination_number) { if (rc_avpair_add(rad_config, &send, PW_FS_DST, (void *) profile->destination_number, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dst: %s\n", profile->destination_number); rc_destroy(rad_config); goto end; } } if (profile->dialplan) { if (rc_avpair_add(rad_config, &send, PW_FS_DIALPLAN, (void *) profile->dialplan, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Dialplan: %s\n", profile->dialplan); rc_destroy(rad_config); goto end; } @@ -531,42 +531,42 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) inet_pton(AF_INET, (void *) profile->network_addr, &framed_addr); framed_addr = htonl(framed_addr); if (rc_avpair_add(rad_config, &send, PW_FRAMED_IP_ADDRESS, &framed_addr, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Framed-IP-Address: %s\n", profile->network_addr); rc_destroy(rad_config); goto end; } } if (profile->rdnis) { if (rc_avpair_add(rad_config, &send, PW_FS_RDNIS, (void *) profile->rdnis, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-RDNIS: %s\n", profile->rdnis); rc_destroy(rad_config); goto end; } } if (profile->context) { if (rc_avpair_add(rad_config, &send, PW_FS_CONTEXT, (void *) profile->context, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Context: %s\n", profile->context); rc_destroy(rad_config); goto end; } } if (profile->ani) { if (rc_avpair_add(rad_config, &send, PW_FS_ANI, (void *) profile->ani, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANI: %s\n", profile->ani); rc_destroy(rad_config); goto end; } } if (profile->aniii) { if (rc_avpair_add(rad_config, &send, PW_FS_ANIII, (void *) profile->aniii, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-ANIII: %s\n", profile->aniii); rc_destroy(rad_config); goto end; } } if (profile->source) { if (rc_avpair_add(rad_config, &send, PW_FS_SOURCE, (void *) profile->source, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Source: %s\n", profile->source); rc_destroy(rad_config); goto end; } @@ -574,13 +574,13 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) if (profile->caller_extension && profile->caller_extension->last_application && profile->caller_extension->last_application->application_name) { if (rc_avpair_add(rad_config, &send, PW_FS_LASTAPP, (void *) profile->caller_extension->last_application->application_name, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Lastapp: %s\n", profile->source); rc_destroy(rad_config); goto end; } } if (rc_avpair_add(rad_config, &send, PW_FS_BILLUSEC, &billusec, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Billusec: %u\n", (uint32_t) billusec); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Billusec: %u\n", (uint32_t) billusec); rc_destroy(rad_config); goto end; } @@ -591,7 +591,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLSTARTDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callstartdate: %s\n", buffer); rc_destroy(rad_config); goto end; } @@ -603,7 +603,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLANSWERDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callanswerdate: %s\n", buffer); rc_destroy(rad_config); goto end; } @@ -615,7 +615,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLTRANSFERDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Calltransferdate: %s\n", buffer); rc_destroy(rad_config); goto end; } @@ -627,14 +627,14 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_usec, tm.tm_gmtoff / 3600, tm.tm_gmtoff % 3600); if (rc_avpair_add(rad_config, &send, PW_FS_CALLENDDATE, &buffer, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Callenddate: %s\n", buffer); rc_destroy(rad_config); goto end; } } if (rc_avpair_add(rad_config, &send, PW_ACCT_SESSION_TIME, &billsec, -1, 0) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Acct-Session-Time: %u\n", billsec); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Acct-Session-Time: %u\n", billsec); rc_destroy(rad_config); goto end; } @@ -643,22 +643,22 @@ static switch_status_t my_on_reporting(switch_core_session_t *session) const char *direction_str = profile->direction == SWITCH_CALL_DIRECTION_INBOUND ? "inbound" : "outbound"; if (rc_avpair_add(rad_config, &send, PW_FS_DIRECTION, (void *) direction_str, -1, PW_FS_PEC) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "failed adding Freeswitch-Direction: %s\n", direction_str); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "failed adding Freeswitch-Direction: %s\n", direction_str); rc_destroy(rad_config); goto end; } } } else { /* no profile, can't create data to send */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "profile == NULL\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "profile == NULL\n"); } } if (rc_acct(rad_config, client_port, send) == OK_RC) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RADIUS Accounting OK\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RADIUS Accounting OK\n"); retval = SWITCH_STATUS_SUCCESS; } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "RADIUS Accounting Failed\n"); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "RADIUS Accounting Failed\n"); retval = SWITCH_STATUS_TERM; } rc_avpair_free(send); From b7da00209f173efad709831f618ca8f0b680948f Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 5 May 2011 22:04:43 -0400 Subject: [PATCH 446/558] too much perl --- libs/freetdm/mod_freetdm/mod_freetdm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 4569416d41..eb0cef001c 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -3518,12 +3518,12 @@ void dump_chan(ftdm_span_t *span, uint32_t chan_id, switch_stream_handle_t *stre "physical_span_id: %u\n" "physical_chan_id: %u\n" "physical_status: %s\n" - "physical_status_red: $d\n" - "physical_status_yellow: $d\n" - "physical_status_rai: $d\n" - "physical_status_blue: $d\n" - "physical_status_ais: $d\n" - "physical_status_general: $d\n" + "physical_status_red: %d\n" + "physical_status_yellow: %d\n" + "physical_status_rai: %d\n" + "physical_status_blue: %d\n" + "physical_status_ais: %d\n" + "physical_status_general: %d\n" "signaling_status: %s\n" "type: %s\n" "state: %s\n" From 7e8c44a407e00663788c3732e694f25b8305012c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 29 Apr 2011 16:23:18 -0400 Subject: [PATCH 447/558] chlog:freetdm: Support for SS7 - SPIROU TXA and ITX messages --- .../ftmod_sangoma_ss7_handle.c | 43 +++++++++++- .../ftmod_sangoma_ss7_main.h | 4 ++ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 69 +++++++++++++++++-- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c | 6 +- 4 files changed, 115 insertions(+), 7 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 72a82acf1f..57f7e4d927 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -480,6 +480,47 @@ ftdm_status_t handle_con_sta(uint32_t suInstId, uint32_t spInstId, uint32_t circ case (SUBDIRNUM): SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx SUB-DIR\n", sngss7_info->circuit->cic); break; +#ifdef SANGOMA_SPIROU + case (CHARGE_ACK): + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx TXA\n", sngss7_info->circuit->cic); + break; + case (CHARGE_UNIT): + { + uint32_t charging_unit = 0; + uint32_t msg_num = 0; + char val[3]; + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx ITX\n", sngss7_info->circuit->cic); + + memset(val, '\0', sizeof(val)); + + if (siCnStEvnt->chargUnitNum.eh.pres == PRSNT_NODEF && + siCnStEvnt->chargUnitNum.chargUnitNum.pres == PRSNT_NODEF) { + + charging_unit = siCnStEvnt->chargUnitNum.chargUnitNum.val; + } + + if (siCnStEvnt->msgNum.eh.pres == PRSNT_NODEF && + siCnStEvnt->msgNum.msgNum.pres == PRSNT_NODEF) { + + msg_num = siCnStEvnt->msgNum.msgNum.val; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "Charging Unit:%d Msg Num:%d\n", charging_unit, msg_num); + + sprintf(val, "%d", charging_unit); + sngss7_add_var(sngss7_info, "ss7_itx_charge_unit", val); + + sprintf(val, "%d", msg_num); + sngss7_add_var(sngss7_info, "ss7_itx_msg_num", val); + + if (sngss7_info->circuit->itx_auto_reply) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_INFO, "Auto-reply with TXA msg\n"); + ft_to_sngss7_txa (ftdmchan); + } + } + break; +#endif /**************************************************************************/ default: SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Rx Unknown Msg\n", sngss7_info->circuit->cic); @@ -522,7 +563,7 @@ ftdm_status_t handle_con_cfm(uint32_t suInstId, uint32_t spInstId, uint32_t circ /* go to UP */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_UP); - + break; /**************************************************************************/ case FTDM_CHANNEL_STATE_DIALING: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index f8a9cec9ff..7c29530c62 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -322,6 +322,7 @@ typedef struct sng_isup_ckt { uint8_t rdnis_nadi; uint32_t min_digits; + uint8_t itx_auto_reply; void *obj; uint16_t t3; uint16_t t12; @@ -728,6 +729,9 @@ void ft_to_sngss7_cgba(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgua(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgb(ftdm_channel_t * ftdmchan); void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan); +void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan); +void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan); + /* in ftmod_sangoma_ss7_in.c */ void sngss7_sta_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circuit, uint8_t globalFlg, uint8_t evntType, SiStaEvnt *siStaEvnt); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 149e022ff8..4b2c9c438d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -187,7 +187,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* check if the user would like a custom NADI value for the calling Pty Num */ clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); - if ((clg_nadi != NULL) && (*clg_nadi)) { + if (!ftdm_strlen_zero(clg_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); } else { @@ -196,7 +196,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) } cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); - if ((cld_nadi != NULL) && (*cld_nadi)) { + if (!ftdm_strlen_zero(cld_nadi)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); } else { @@ -206,7 +206,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* check if the user would like us to send a clg_sub-address */ clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr"); - if ((clg_subAddr != NULL) && (*clg_subAddr)) { + if (!ftdm_strlen_zero(clg_subAddr)) { SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling Sub-Address value \"%s\"\n", clg_subAddr); /* clean out the subAddrIE */ @@ -302,7 +302,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) return; } -/******************************************************************************/ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); @@ -382,7 +381,6 @@ void ft_to_sngss7_acm (ftdm_channel_t * ftdmchan) return; } -/******************************************************************************/ void ft_to_sngss7_anm (ftdm_channel_t * ftdmchan) { SS7_FUNC_TRACE_ENTER (__FUNCTION__); @@ -892,6 +890,67 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) return; } +/* French SPIROU send Charge Unit */ +/* No one calls this function yet, but it has been implemented to complement TXA messages */ +void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) +{ + const char* var = NULL; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); +#ifndef SANGOMA_SPIROU + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "ITX message not supported!, please update your libsng_ss7\n"); +#else + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SiCnStEvnt itx; + + memset (&itx, 0x0, sizeof (itx)); + + itx.msgNum.eh.pres = PRSNT_NODEF; + itx.msgNum.msgNum.pres = PRSNT_NODEF; + var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_msg_num"); + if (!ftdm_strlen_zero(var)) { + itx.msgNum.msgNum.val = atoi(var); + } else { + itx.msgNum.msgNum.val = 0x0; + } + + itx.chargUnitNum.eh.pres = PRSNT_NODEF; + itx.chargUnitNum.chargUnitNum.pres = PRSNT_NODEF; + var = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_itx_charge_unit"); + if (!ftdm_strlen_zero(var)) { + itx.chargUnitNum.chargUnitNum.val = atoi(var); + } else { + itx.chargUnitNum.chargUnitNum.val = 0x0; + } + + ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "ITX Charging Unit:%d Msg Num:%d\n", itx.chargUnitNum.chargUnitNum.val, itx.msgNum.msgNum.val); + sng_cc_con_status (1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &itx, CHARGE_UNIT); + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx ITX\n", sngss7_info->circuit->cic); +#endif + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} + +/* French SPIROU send Charging Acknowledgement */ +void ft_to_sngss7_txa (ftdm_channel_t * ftdmchan) +{ +#ifndef SANGOMA_SPIROU + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "TXA message not supported!, please update your libsng_ss7\n"); +#else + SiCnStEvnt txa; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + + memset (&txa, 0x0, sizeof(txa)); + + sng_cc_con_status(1, sngss7_info->suInstId, sngss7_info->spInstId, sngss7_info->circuit->id, &txa, CHARGE_ACK); + + SS7_INFO_CHAN(ftdmchan,"[CIC:%d]Tx TXA\n", sngss7_info->circuit->cic); +#endif + SS7_FUNC_TRACE_EXIT (__FUNCTION__); + return; +} /******************************************************************************/ /* For Emacs: diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c index 815377b476..2df0a88edb 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_xml.c @@ -124,6 +124,7 @@ typedef struct sng_ccSpan uint32_t cld_nadi; uint32_t rdnis_nadi; uint32_t min_digits; + uint32_t itx_auto_reply; uint32_t t3; uint32_t t12; uint32_t t13; @@ -1892,7 +1893,9 @@ static int ftmod_ss7_parse_cc_span(ftdm_conf_node_t *cc_span) sng_ccSpan.typeCntrl = sng_cic_cntrl_type_map[ret].tril_type; SS7_DEBUG("Found an ccSpan typeCntrl = %s\n", sng_cic_cntrl_type_map[ret].sng_type); } - /**********************************************************************/ + } else if (!strcasecmp(parm->var, "itx_auto_reply")) { + sng_ccSpan.itx_auto_reply = ftdm_true(parm->val); + SS7_DEBUG("Found itx_auto_reply %d\n", sng_ccSpan.itx_auto_reply); } else if (!strcasecmp(parm->var, "cicbase")) { /**********************************************************************/ sng_ccSpan.cicbase = atoi(parm->val); @@ -2913,6 +2916,7 @@ static int ftmod_ss7_fill_in_ccSpan(sng_ccSpan_t *ccSpan) g_ftdm_sngss7_data.cfg.isupCkt[x].options = ccSpan->options; g_ftdm_sngss7_data.cfg.isupCkt[x].switchType = ccSpan->switchType; g_ftdm_sngss7_data.cfg.isupCkt[x].min_digits = ccSpan->min_digits; + g_ftdm_sngss7_data.cfg.isupCkt[x].itx_auto_reply = ccSpan->itx_auto_reply; if (ccSpan->t3 == 0) { g_ftdm_sngss7_data.cfg.isupCkt[x].t3 = 1200; From 81198ac6715ed8f8eab4fec207122a56635bb11c Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 13:13:44 -0400 Subject: [PATCH 448/558] Fix compile issue when SANGOMA_SPIROU is not defined --- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 4b2c9c438d..10407963e1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -894,14 +894,16 @@ void ft_to_sngss7_cgu(ftdm_channel_t * ftdmchan) /* No one calls this function yet, but it has been implemented to complement TXA messages */ void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) { - const char* var = NULL; - SS7_FUNC_TRACE_ENTER (__FUNCTION__); #ifndef SANGOMA_SPIROU + SS7_FUNC_TRACE_ENTER (__FUNCTION__); ftdm_log_chan_msg(ftdmchan, FTDM_LOG_CRIT, "ITX message not supported!, please update your libsng_ss7\n"); #else + const char* var = NULL; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; SiCnStEvnt itx; + SS7_FUNC_TRACE_ENTER (__FUNCTION__); + memset (&itx, 0x0, sizeof (itx)); itx.msgNum.eh.pres = PRSNT_NODEF; From 2af0dc00c8bbcb9b6f22bdb9fe6349b38f32bf96 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Fri, 6 May 2011 13:10:57 -0500 Subject: [PATCH 449/558] skypopen: let's bump the thread priorities, refined --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 8841ee246b..133c8b7ff0 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -1733,7 +1733,7 @@ static switch_status_t load_config(int reload_type) switch_threadattr_create(&skypopen_api_thread_attr, skypopen_module_pool); switch_threadattr_detach_set(skypopen_api_thread_attr, 0); switch_threadattr_stacksize_set(skypopen_api_thread_attr, SWITCH_THREAD_STACKSIZE); - switch_threadattr_priority_increase(skypopen_api_thread_attr); + //switch_threadattr_priority_increase(skypopen_api_thread_attr); switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id].skypopen_api_thread, skypopen_api_thread_attr, skypopen_do_skypeapi_thread, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool); @@ -1743,7 +1743,7 @@ static switch_status_t load_config(int reload_type) switch_threadattr_create(&skypopen_signaling_thread_attr, skypopen_module_pool); switch_threadattr_detach_set(skypopen_signaling_thread_attr, 0); switch_threadattr_stacksize_set(skypopen_signaling_thread_attr, SWITCH_THREAD_STACKSIZE); - switch_threadattr_priority_increase(skypopen_signaling_thread_attr); + //switch_threadattr_priority_increase(skypopen_signaling_thread_attr); switch_thread_create(&globals.SKYPOPEN_INTERFACES[interface_id]. skypopen_signaling_thread, skypopen_signaling_thread_attr, skypopen_signaling_thread_func, &globals.SKYPOPEN_INTERFACES[interface_id], skypopen_module_pool); @@ -2170,7 +2170,8 @@ int dtmf_received(private_t *tech_pvt, char *value) int start_audio_threads(private_t *tech_pvt) { - switch_threadattr_t *thd_attr = NULL; + switch_threadattr_t *tcp_srv_thread_thd_attr = NULL; + switch_threadattr_t *tcp_cli_thread_thd_attr = NULL; tech_pvt->begin_to_write = 0; tech_pvt->begin_to_read = 0; @@ -2196,13 +2197,13 @@ int start_audio_threads(private_t *tech_pvt) switch_core_timer_sync(&tech_pvt->timer_write); - switch_threadattr_create(&thd_attr, skypopen_module_pool); - switch_threadattr_detach_set(thd_attr, 0); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_threadattr_priority_increase(thd_attr); + switch_threadattr_create(&tcp_srv_thread_thd_attr, skypopen_module_pool); + switch_threadattr_detach_set(tcp_srv_thread_thd_attr, 0); + switch_threadattr_stacksize_set(tcp_srv_thread_thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(tcp_srv_thread_thd_attr); switch_mutex_lock(tech_pvt->mutex_thread_audio_srv); //DEBUGA_SKYPE("debugging_hangup srv lock\n", SKYPOPEN_P_LOG); - if (switch_thread_create(&tech_pvt->tcp_srv_thread, thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { + if (switch_thread_create(&tech_pvt->tcp_srv_thread, tcp_srv_thread_thd_attr, skypopen_do_tcp_srv_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { DEBUGA_SKYPE("started tcp_srv_thread thread.\n", SKYPOPEN_P_LOG); } else { ERRORA("failed to start tcp_srv_thread thread.\n", SKYPOPEN_P_LOG); @@ -2213,13 +2214,13 @@ int start_audio_threads(private_t *tech_pvt) switch_mutex_unlock(tech_pvt->mutex_thread_audio_srv); //DEBUGA_SKYPE("debugging_hangup srv unlock\n", SKYPOPEN_P_LOG); - switch_threadattr_create(&thd_attr, skypopen_module_pool); - switch_threadattr_detach_set(thd_attr, 0); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_threadattr_priority_increase(thd_attr); + switch_threadattr_create(&tcp_cli_thread_thd_attr, skypopen_module_pool); + switch_threadattr_detach_set(tcp_cli_thread_thd_attr, 0); + switch_threadattr_stacksize_set(tcp_cli_thread_thd_attr, SWITCH_THREAD_STACKSIZE); + switch_threadattr_priority_increase(tcp_cli_thread_thd_attr); switch_mutex_lock(tech_pvt->mutex_thread_audio_cli); //DEBUGA_SKYPE("debugging_hangup cli lock\n", SKYPOPEN_P_LOG); - if (switch_thread_create(&tech_pvt->tcp_cli_thread, thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { + if (switch_thread_create(&tech_pvt->tcp_cli_thread, tcp_cli_thread_thd_attr, skypopen_do_tcp_cli_thread, tech_pvt, skypopen_module_pool) == SWITCH_STATUS_SUCCESS) { DEBUGA_SKYPE("started tcp_cli_thread thread.\n", SKYPOPEN_P_LOG); } else { ERRORA("failed to start tcp_cli_thread thread.\n", SKYPOPEN_P_LOG); From c19074bcd2afac73e7354a47c6434d3ad35d38ca Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 15:31:56 -0400 Subject: [PATCH 450/558] freetdm: ss7 - Support for transmission of Generic Number --- .../ftmod_sangoma_ss7_main.c | 3 +++ .../ftmod_sangoma_ss7_main.h | 12 ++++++++- .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 27 ++++--------------- 3 files changed, 19 insertions(+), 23 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c index 4f8c069b71..59660765a1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.c @@ -674,6 +674,9 @@ ftdm_status_t ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan) } else { /*INBOUND...so FS told us it was going to answer...tell the stack */ ft_to_sngss7_anm(ftdmchan); +#if 1 /* DAVIDY */ + ft_to_sngss7_itx(ftdmchan); +#endif } break; diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index 7c29530c62..a355ee0ee7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -320,6 +320,15 @@ typedef struct sng_isup_ckt { uint32_t clg_nadi; uint32_t cld_nadi; uint8_t rdnis_nadi; + + /* Generic Number defaults */ + uint8_t gn_nmbqual; /* Number Qualifier */ + uint8_t gn_nadi; /* Nature of Address indicator */ + uint8_t gn_screen_ind; /* Screening Indicator */ + uint8_t gn_pres_ind; /* Presentation Indicator */ + uint8_t gn_npi; /* Numbering Plan Indicator */ + uint8_t gn_num_inc_ind; /* Number Incomplete Indicator */ + /* END - Generic Number defaults */ uint32_t min_digits; uint8_t itx_auto_reply; @@ -795,7 +804,8 @@ ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cd ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum); ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); - +ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); +ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index 10407963e1..a746301cd7 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -74,8 +74,6 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) SS7_FUNC_TRACE_ENTER (__FUNCTION__); sngss7_chan_data_t *sngss7_info = ftdmchan->call_data;; - const char *clg_nadi = NULL; - const char *cld_nadi = NULL; const char *clg_subAddr = NULL; const char *cld_subAddr = NULL; char subAddrIE[MAX_SIZEOF_SUBADDR_IE]; @@ -185,25 +183,10 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* copy down the calling number information */ copy_cgPtyNum_to_sngss7 (ftdmchan, &iam.cgPtyNum); - /* check if the user would like a custom NADI value for the calling Pty Num */ - clg_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_nadi"); - if (!ftdm_strlen_zero(clg_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Calling NADI value \"%s\"\n", clg_nadi); - iam.cgPtyNum.natAddrInd.val = atoi(clg_nadi); - } else { - iam.cgPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].clg_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLG, using \"%d\"\n", iam.cgPtyNum.natAddrInd.val); - } + /* copy down the generic number information */ + copy_genNmb_to_sngss7(ftdmchan, &iam.genNmb); - cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); - if (!ftdm_strlen_zero(cld_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); - iam.cdPtyNum.natAddrInd.val = atoi(cld_nadi); - } else { - iam.cdPtyNum.natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", iam.cdPtyNum.natAddrInd.val); - } - + /* TODO - move this to copy_clg_subAddr_to_sngss7 function */ /* check if the user would like us to send a clg_sub-address */ clg_subAddr = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_clg_subaddr"); if (!ftdm_strlen_zero(clg_subAddr)) { @@ -912,7 +895,7 @@ void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) if (!ftdm_strlen_zero(var)) { itx.msgNum.msgNum.val = atoi(var); } else { - itx.msgNum.msgNum.val = 0x0; + itx.msgNum.msgNum.val = 0x1; } itx.chargUnitNum.eh.pres = PRSNT_NODEF; @@ -921,7 +904,7 @@ void ft_to_sngss7_itx (ftdm_channel_t * ftdmchan) if (!ftdm_strlen_zero(var)) { itx.chargUnitNum.chargUnitNum.val = atoi(var); } else { - itx.chargUnitNum.chargUnitNum.val = 0x0; + itx.chargUnitNum.chargUnitNum.val = 0x1; } ftdm_log_chan(ftdmchan, FTDM_LOG_INFO, "ITX Charging Unit:%d Msg Num:%d\n", itx.chargUnitNum.chargUnitNum.val, itx.msgNum.msgNum.val); From b51074f9df9bda7ef6a1f1efa0b1bfeb212627e5 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 15:35:08 -0400 Subject: [PATCH 451/558] Support for TX generic Number --- .../ftmod_sangoma_ss7_support.c | 301 ++++++------------ 1 file changed, 104 insertions(+), 197 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 17cae48681..21071e680a 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -97,19 +97,11 @@ ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cg return FTDM_SUCCESS; } -/******************************************************************************/ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) { const char *val; - int k; - int j; - int flag; - int odd; - char tmp[2]; - uint8_t lower; - uint8_t upper; - ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; cgPtyNum->eh.pres = PRSNT_NODEF; @@ -122,7 +114,7 @@ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPt if (!ftdm_strlen_zero(val)) { cgPtyNum->scrnInd.val = atoi(val); } else { - cgPtyNum->scrnInd.val = ftdm->screen; + cgPtyNum->scrnInd.val = caller_data->screen; } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Screening Ind %d\n", cgPtyNum->scrnInd.val); @@ -131,7 +123,7 @@ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPt if (!ftdm_strlen_zero(val)) { cgPtyNum->presRest.val = atoi(val); } else { - cgPtyNum->presRest.val = ftdm->pres; + cgPtyNum->presRest.val = caller_data->pres; } ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Number Presentation Ind %d\n", cgPtyNum->presRest.val); @@ -141,210 +133,125 @@ ftdm_status_t copy_cgPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPt cgPtyNum->niInd.pres = PRSNT_NODEF; cgPtyNum->niInd.val = 0x00; - cgPtyNum->addrSig.pres = PRSNT_NODEF; - - /* atoi will search through memory starting from the pointer it is given until - * it finds the \0...since tmp is on the stack it will start going through the - * possibly causing corruption. Hard code a \0 to prevent this - */ - - tmp[1] = '\0'; - k = 0; - j = 0; - flag = 0; - odd = 0; - upper = 0x0; - lower = 0x0; - - while (1) { - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->cid_num.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - /* move on to the next value */ - k++; - tmp[0] = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push it into the lower nibble */ - lower = strtol(&tmp[0], (char **)NULL, 16); - /* move to the next digit */ - k++; - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->cid_num.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - k++; - tmp[0] = ftdm->cid_num.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push the digit into the upper nibble */ - upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; - } else { - /* there is no upper ... fill in 0 */ - upper = 0x0; - /* throw the odd flag */ - odd = 1; - /* throw the end flag */ - flag = 1; - } /* if (tmp != '\0') */ - } else { - /* keep the odd flag down */ - odd = 0; - /* break right away since we don't need to write the digits */ - break; - } - - /* push the digits into the trillium structure */ - cgPtyNum->addrSig.val[j] = upper | lower; - - /* increment the trillium pointer */ - j++; - - /* if the flag is up we're through all the digits */ - if (flag) break; - - /* move to the next digit */ - k++; - } /* while(1) */ - - cgPtyNum->addrSig.len = j; - - /**************************************************************************/ - cgPtyNum->oddEven.pres = PRSNT_NODEF; - cgPtyNum->oddEven.val = odd; - /**************************************************************************/ - return FTDM_SUCCESS; + return copy_tknStr_to_sngss7(caller_data->cid_num.digits, &cgPtyNum->addrSig, &cgPtyNum->oddEven); } -/******************************************************************************/ ftdm_status_t copy_cdPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { - + /* TODO: Implement me */ return FTDM_SUCCESS; } -/******************************************************************************/ + ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPtyNum) { - int k; - int j; - int flag; - int odd; - char tmp[2]; - uint8_t lower; - uint8_t upper; + const char *cld_nadi = NULL; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - ftdm_caller_data_t *ftdm = &ftdmchan->caller_data; - - /**************************************************************************/ cdPtyNum->eh.pres = PRSNT_NODEF; - /**************************************************************************/ + cdPtyNum->natAddrInd.pres = PRSNT_NODEF; - cdPtyNum->natAddrInd.val = 0x03; - /**************************************************************************/ + cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); + if (!ftdm_strlen_zero(cld_nadi)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); + cdPtyNum->natAddrInd.val = atoi(cld_nadi); + } else { + cdPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val); + } + cdPtyNum->numPlan.pres = PRSNT_NODEF; cdPtyNum->numPlan.val = 0x01; - /**************************************************************************/ + cdPtyNum->innInd.pres = PRSNT_NODEF; cdPtyNum->innInd.val = 0x01; - /**************************************************************************/ - cdPtyNum->addrSig.pres = PRSNT_NODEF; - - /* atoi will search through memory starting from the pointer it is given until - * it finds the \0...since tmp is on the stack it will start going through the - * possibly causing corruption. Hard code a \0 to prevent this - */ /* dnis */ - tmp[1] = '\0'; - k = 0; - j = 0; - flag = 0; - odd = 0; - upper = 0x0; - lower = 0x0; - - while (1) { - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->dnis.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - /* move on to the next value */ - k++; - tmp[0] = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push it into the lower nibble */ - lower = strtol(&tmp[0], (char **)NULL, 16); - /* move to the next digit */ - k++; - /* grab a digit from the ftdm digits */ - tmp[0] = ftdm->dnis.digits[k]; - - /* check if the digit is a number and that is not null */ - while (!(isxdigit(tmp[0])) && (tmp[0] != '\0')) { - SS7_INFO("Dropping invalid digit: %c\n", tmp[0]); - k++; - tmp[0] = ftdm->dnis.digits[k]; - } /* while(!(isdigit(tmp))) */ - - /* check if tmp is null or a digit */ - if (tmp[0] != '\0') { - /* push the digit into the upper nibble */ - upper = (strtol(&tmp[0], (char **)NULL, 16)) << 4; - } else { - /* there is no upper ... fill in ST */ - upper = 0xF0; - /* keep the odd flag down */ - odd = 0; - /* throw the end flag */ - flag = 1; - } /* if (tmp != '\0') */ - } else { - /* throw the odd flag */ - odd = 1; - /* need to add the ST */ - lower = 0xF; - upper = 0x0; - /* throw the flag */ - flag = 1; - } - - /* push the digits into the trillium structure */ - cdPtyNum->addrSig.val[j] = upper | lower; - - /* increment the trillium pointer */ - j++; - - /* if the flag is up we're through all the digits */ - if (flag) break; - - /* move to the next digit */ - k++; - } /* while(1) */ - - cdPtyNum->addrSig.len = j; - - /**************************************************************************/ - cdPtyNum->oddEven.pres = PRSNT_NODEF; - - cdPtyNum->oddEven.val = odd; - - /**************************************************************************/ - return 0; + + return copy_tknStr_to_sngss7(caller_data->dnis.digits, &cdPtyNum->addrSig, &cdPtyNum->oddEven); } +ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) +{ + const char *val = NULL; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_digits"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number qualifier \"%s\"\n", val); + if (copy_tknStr_to_sngss7((char*)val, &genNmb->addrSig, &genNmb->oddEven) != FTDM_SUCCESS) { + return FTDM_FAIL; + } + } else { + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number qualifier \"%s\"\n", val); + return FTDM_SUCCESS; + } + genNmb->eh.pres = PRSNT_NODEF; + genNmb->addrSig.pres = PRSNT_NODEF; + + genNmb->nmbQual.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_numqual"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number qualifier\" \"%s\"\n", val); + genNmb->nmbQual.val = atoi(val); + } else { + genNmb->nmbQual.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nmbqual; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number qualifier\" \"%d\"\n", genNmb->nmbQual.val); + } + genNmb->natAddrInd.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_nadi"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"nature of address\" \"%s\"\n", val); + genNmb->natAddrInd.val = atoi(val); + } else { + genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nadi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val); + } + genNmb->scrnInd.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_screen_ind"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val); + genNmb->scrnInd.val = atoi(val); + } else { + genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_screen_ind; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val); + } + genNmb->presRest.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_pres_ind"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val); + genNmb->presRest.val = atoi(val); + } else { + genNmb->presRest.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_pres_ind; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val); + } + genNmb->numPlan.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_npi"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val); + genNmb->numPlan.val = atoi(val); + } else { + genNmb->numPlan.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_npi; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val); + } + genNmb->niInd.pres = PRSNT_NODEF; + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_num_inc_ind"); + if (!ftdm_strlen_zero(val)) { + SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val); + genNmb->niInd.val = atoi(val); + } else { + genNmb->niInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_num_inc_ind; + SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); + } + SS7_FUNC_TRACE_EXIT(__FUNCTION__); + return FTDM_SUCCESS; +} + +ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) +{ + /* TODO: Implement me */ + return FTDM_SUCCESS; +} ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum) { From eb1a0a395f01e0d592e54006b3540d2078bbf7c6 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 16:03:14 -0400 Subject: [PATCH 452/558] freetdm: ss7 - Support for receiving Generic Number IE --- .../ftmod_sangoma_ss7_handle.c | 2 + .../ftmod_sangoma_ss7_support.c | 54 ++++++++++++++++++- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 57f7e4d927..3348292935 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -187,6 +187,8 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ copy_redirgNum_from_sngss7(ftdmchan, &siConEvnt->redirgNum); + copy_genNmb_from_sngss7(ftdmchan, &siConEvnt->genNmb); + /* fill in the TMR/bearer capability */ if (siConEvnt->txMedReq.eh.pres) { if (siConEvnt->txMedReq.trMedReq.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 21071e680a..5204c1b8fc 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -249,7 +249,59 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) { - /* TODO: Implement me */ + char val[64]; + sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; + SS7_FUNC_TRACE_ENTER(__FUNCTION__); + + memset(val, 0, sizeof(val)); + + if (genNmb->eh.pres != PRSNT_NODEF || genNmb->addrSig.pres != PRSNT_NODEF) { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No Generic Number available\n"); + return FTDM_SUCCESS; + } + + copy_tknStr_from_sngss7(genNmb->addrSig, val, genNmb->oddEven); + + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number:%s\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_digits", val); + + if (genNmb->nmbQual.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->nmbQual.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_numqual", val); + } + + if (genNmb->natAddrInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"nature of address\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_nadi", val); + } + + if (genNmb->scrnInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->scrnInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"screening indicator\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_screen_ind", val); + } + + if (genNmb->presRest.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->presRest.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"presentation indicator\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_pres_ind", val); + } + + if (genNmb->numPlan.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->numPlan.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"numbering plan\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_npi", val); + } + + if (genNmb->niInd.pres == PRSNT_NODEF) { + snprintf(val, sizeof(val), "%d", genNmb->niInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number incomplete indicator\" \"%s\"\n", val); + sngss7_add_var(sngss7_info, "ss7_gn_num_inc_ind", val); + } + + SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; } From b21cea801a7c9b8246da2e9264f70415e38c4d08 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Fri, 6 May 2011 13:27:02 -0700 Subject: [PATCH 453/558] Update English, French phrase files --- docs/phrase/phrase_en.xml | 49 ++++++++++++++++++++++++++++++++++----- docs/phrase/phrase_fr.xml | 6 ++--- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index ab4f61bb46..9e31cccf08 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -438,20 +438,57 @@ - + + - + - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/phrase/phrase_fr.xml b/docs/phrase/phrase_fr.xml index ef3ee7bb6d..2d5f488152 100644 --- a/docs/phrase/phrase_fr.xml +++ b/docs/phrase/phrase_fr.xml @@ -219,14 +219,14 @@ - + - - + + From 8529ba33367521e301acf44bb8ed4195130fab91 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Fri, 6 May 2011 13:28:21 -0700 Subject: [PATCH 454/558] config: fix talking clock regexes (need ^ and $ so they don't match only 917x) --- conf/dialplan/default/01_Talking_Clock.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/dialplan/default/01_Talking_Clock.xml b/conf/dialplan/default/01_Talking_Clock.xml index 4e37962001..205132a249 100644 --- a/conf/dialplan/default/01_Talking_Clock.xml +++ b/conf/dialplan/default/01_Talking_Clock.xml @@ -1,6 +1,6 @@ - + @@ -8,7 +8,7 @@ - + @@ -17,7 +17,7 @@ - + From 1772fcb079e36e1b1d1b32902b8d2c909a859959 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 May 2011 15:25:00 -0500 Subject: [PATCH 455/558] add largest_jb_size --- src/include/switch_types.h | 1 + src/mod/endpoints/mod_sofia/sofia_glue.c | 1 + src/switch_rtp.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index 988d2da641..6664dc0653 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -489,6 +489,7 @@ typedef struct { switch_size_t dtmf_packet_count; switch_size_t cng_packet_count; switch_size_t flush_packet_count; + switch_size_t largest_jb_size; } switch_rtp_numbers_t; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 74da94b2c4..ab37ecd7f7 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2554,6 +2554,7 @@ static void set_stats(switch_rtp_t *rtp_session, private_object_t *tech_pvt, con add_stat(stats->inbound.dtmf_packet_count, "in_dtmf_packet_count"); add_stat(stats->inbound.cng_packet_count, "in_cng_packet_count"); add_stat(stats->inbound.flush_packet_count, "in_flush_packet_count"); + add_stat(stats->inbound.largest_jb_size, "in_largest_jb_size"); add_stat(stats->outbound.raw_bytes, "out_raw_bytes"); add_stat(stats->outbound.media_bytes, "out_media_bytes"); diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 038401da19..2eeb7bfdb9 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -4138,6 +4138,10 @@ SWITCH_DECLARE(switch_rtp_stats_t *) switch_rtp_get_stats(switch_rtp_t *rtp_sess s = &rtp_session->stats; } + if (rtp_session->jb) { + s->inbound.largest_jb_size = stfu_n_get_most_qlen(rtp_session->jb); + } + return s; } From 3ba6a71570deeeb053e59a9a25d29cfa33f229c0 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 May 2011 15:25:07 -0500 Subject: [PATCH 456/558] add largest_jb_size --- libs/stfu/stfu.c | 10 ++++++++++ libs/stfu/stfu.h | 1 + 2 files changed, 11 insertions(+) diff --git a/libs/stfu/stfu.c b/libs/stfu/stfu.c index 9e5fcf3b22..a4c3bb78d3 100644 --- a/libs/stfu/stfu.c +++ b/libs/stfu/stfu.c @@ -76,6 +76,7 @@ struct stfu_instance { uint32_t miss_count; uint32_t max_plc; uint32_t qlen; + uint32_t most_qlen; uint32_t max_qlen; uint32_t orig_qlen; uint32_t packet_count; @@ -136,6 +137,11 @@ int32_t stfu_n_get_drift(stfu_instance_t *i) return i->ts_drift; } +int32_t stfu_n_get_most_qlen(stfu_instance_t *i) +{ + return i->most_qlen; +} + void stfu_global_set_logger(stfu_logger_t logger) { if (logger) { @@ -253,6 +259,10 @@ stfu_status_t stfu_n_resize(stfu_instance_t *i, uint32_t qlen) s = stfu_n_resize_aqueue(&i->b_queue, qlen); s = stfu_n_resize_aqueue(&i->c_queue, qlen); + if (qlen > i->most_qlen) { + i->most_qlen = qlen; + } + i->qlen = qlen; i->max_plc = 5; i->last_frame = NULL; diff --git a/libs/stfu/stfu.h b/libs/stfu/stfu.h index d8fbf447af..b802bbaef6 100644 --- a/libs/stfu/stfu.h +++ b/libs/stfu/stfu.h @@ -188,6 +188,7 @@ stfu_status_t stfu_n_sync(stfu_instance_t *i, uint32_t packets); void stfu_n_call_me(stfu_instance_t *i, stfu_n_call_me_t callback, void *udata); void stfu_n_debug(stfu_instance_t *i, const char *name); int32_t stfu_n_get_drift(stfu_instance_t *i); +int32_t stfu_n_get_most_qlen(stfu_instance_t *i); #define stfu_im_done(i) stfu_n_add_data(i, 0, NULL, 0, 0, 1) #define stfu_n_eat(i,t,p,d,l,tt) stfu_n_add_data(i, t, p, d, l, tt, 0) From e9f8fb4942af2519b5387772e8a827350f606f47 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 6 May 2011 17:52:41 -0400 Subject: [PATCH 457/558] freetdm - SS7 Support for custom SIP headers for RDNIS and Generic Number --- libs/freetdm/mod_freetdm/mod_freetdm.c | 70 +++++++++++++++++ .../ftmod_sangoma_ss7_support.c | 76 +++++++++++-------- 2 files changed, 115 insertions(+), 31 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 7f69e11f6c..f0b09fda56 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1299,6 +1299,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS"); if (sipvar) { ftdm_set_string(caller_data.rdnis.digits, sipvar); + ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_digits", sipvar); } sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-RDNIS-Plan"); @@ -1321,7 +1322,41 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ftdm_usrmsg_add_var(&usrmsg, "ss7_rdnis_pres_ind", sipvar); } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_digits", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumQual"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_numqual", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NADI"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_nadi", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Screen"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_screen_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Presentation"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_pres_ind", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-Plan"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_npi", sipvar); + } + + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-GN-NumInComp"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_gn_num_inc_ind", sipvar); + } + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-Screen"); if (sipvar) { ftdm_usrmsg_add_var(&usrmsg, "ss7_screen_ind", sipvar); @@ -1603,6 +1638,41 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session if (!ftdm_strlen_zero(var_value)) { switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-RDNIS-Presentation", "%d", channel_caller_data->rdnis.plan); } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN", "%d", var_value); + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_numqual"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumQual", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_nadi"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NADI", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_screen_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Screen", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_pres_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Presentation", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_npi"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-Plan", "%d", var_value); + } + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_num_inc_ind"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumInComp", "%d", var_value); + } + } /* End - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); */ switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 5204c1b8fc..8fafa8995c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -154,11 +154,11 @@ ftdm_status_t copy_cdPtyNum_to_sngss7(ftdm_channel_t *ftdmchan, SiCdPtyNum *cdPt cdPtyNum->natAddrInd.pres = PRSNT_NODEF; cld_nadi = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cld_nadi"); if (!ftdm_strlen_zero(cld_nadi)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Called NADI value \"%s\"\n", cld_nadi); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Called NADI value \"%s\"\n", cld_nadi); cdPtyNum->natAddrInd.val = atoi(cld_nadi); } else { cdPtyNum->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].cld_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied NADI value found for CLD, using \"%d\"\n", cdPtyNum->natAddrInd.val); } cdPtyNum->numPlan.pres = PRSNT_NODEF; @@ -178,12 +178,12 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_digits"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number qualifier \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number qualifier \"%s\"\n", val); if (copy_tknStr_to_sngss7((char*)val, &genNmb->addrSig, &genNmb->oddEven) != FTDM_SUCCESS) { return FTDM_FAIL; } } else { - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number qualifier \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number qualifier \"%s\"\n", val); return FTDM_SUCCESS; } genNmb->eh.pres = PRSNT_NODEF; @@ -192,56 +192,56 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) genNmb->nmbQual.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_numqual"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number qualifier\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"%s\"\n", val); genNmb->nmbQual.val = atoi(val); } else { genNmb->nmbQual.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nmbqual; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number qualifier\" \"%d\"\n", genNmb->nmbQual.val); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \n"); } genNmb->natAddrInd.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_nadi"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"nature of address\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"nature of address\" \"%s\"\n", val); genNmb->natAddrInd.val = atoi(val); } else { genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_nadi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"nature of address\" \"%d\"\n", genNmb->natAddrInd.val); } genNmb->scrnInd.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_screen_ind"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"screening indicator\" \"%s\"\n", val); genNmb->scrnInd.val = atoi(val); } else { genNmb->natAddrInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_screen_ind; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"screening indicator\" \"%d\"\n", genNmb->natAddrInd.val); } genNmb->presRest.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_pres_ind"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"presentation indicator\" \"%s\"\n", val); genNmb->presRest.val = atoi(val); } else { genNmb->presRest.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_pres_ind; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"presentation indicator\" \"%d\"\n", genNmb->presRest.val); } genNmb->numPlan.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_npi"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"numbering plan\" \"%s\"\n", val); genNmb->numPlan.val = atoi(val); } else { genNmb->numPlan.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_npi; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"numbering plan\" \"%d\"\n", genNmb->numPlan.val); } genNmb->niInd.pres = PRSNT_NODEF; val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_num_inc_ind"); if (!ftdm_strlen_zero(val)) { - SS7_DEBUG_CHAN(ftdmchan,"Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Generic Number \"number incomplete indicator\" \"%s\"\n", val); genNmb->niInd.val = atoi(val); } else { genNmb->niInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_num_inc_ind; - SS7_DEBUG_CHAN(ftdmchan,"No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); } SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; @@ -267,7 +267,7 @@ ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb if (genNmb->nmbQual.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", genNmb->nmbQual.val); - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \"%s\"\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Generic Number \"number qualifier\" \n", val); sngss7_add_var(sngss7_info, "ss7_gn_numqual", val); } @@ -310,11 +310,22 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red const char* val = NULL; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; - uint8_t len = strlen(caller_data->rdnis.digits); - if (!len) { + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_rdnis_digits"); + if (!ftdm_strlen_zero(val)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", val); + if (copy_tknStr_to_sngss7((char*)val, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) { + return FTDM_FAIL; + } + } else if (!ftdm_strlen_zero(caller_data->rdnis.digits)) { + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Found user supplied Redirection Number\"%s\"\n", val); + if (copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven) != FTDM_SUCCESS) { + return FTDM_FAIL; + } + } else { + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Redirection Number\n"); return FTDM_SUCCESS; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number %s\n", caller_data->rdnis.digits); redirgNum->eh.pres = PRSNT_NODEF; @@ -327,7 +338,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red } else { redirgNum->natAddr.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].rdnis_nadi; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number NADI:%d\n", redirgNum->natAddr.val); /* Screening indicator */ redirgNum->scrInd.pres = PRSNT_NODEF; @@ -337,7 +348,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red } else { redirgNum->scrInd.val = FTDM_SCREENING_VERIFIED_PASSED; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%d\n", redirgNum->scrInd.val); /* Address presentation restricted ind */ redirgNum->presRest.pres = PRSNT_NODEF; @@ -348,7 +359,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red } else { redirgNum->presRest.val = FTDM_PRES_ALLOWED; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Address Presentation Restricted Ind:%d\n", redirgNum->presRest.val); /* Numbering plan */ redirgNum->numPlan.pres = PRSNT_NODEF; @@ -360,7 +371,7 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red redirgNum->numPlan.val = caller_data->rdnis.plan; } - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Numbering plan:%d\n", redirgNum->numPlan.val); return copy_tknStr_to_sngss7(caller_data->rdnis.digits, &redirgNum->addrSig, &redirgNum->oddEven); } @@ -379,6 +390,9 @@ ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *r copy_tknStr_from_sngss7(redirgNum->addrSig, ftdmchan->caller_data.rdnis.digits, redirgNum->oddEven); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number:%s\n", ftdmchan->caller_data.rdnis.digits); + snprintf(val, sizeof(val), "%s", ftdmchan->caller_data.rdnis.digits); + sngss7_add_var(sngss7_info, "ss7_rdnis_digits", val); + if (redirgNum->natAddr.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->natAddr.val); @@ -389,19 +403,19 @@ ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *r if (redirgNum->scrInd.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->scrInd.val); - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Screening Ind:%s\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Screening Ind:%s\n", val); sngss7_add_var(sngss7_info, "ss7_rdnis_screen_ind", val); } if (redirgNum->presRest.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->presRest.val); - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Presentation Ind:%s\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Presentation Ind:%s\n", val); sngss7_add_var(sngss7_info, "ss7_rdnis_pres_ind", val); } if (redirgNum->numPlan.pres == PRSNT_NODEF) { snprintf(val, sizeof(val), "%d", redirgNum->numPlan.val); - SS7_DEBUG_CHAN(ftdmchan, "Redirecting Number Numbering plan:%s\n", val); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Redirecting Number Numbering plan:%s\n", val); sngss7_add_var(sngss7_info, "ss7_rdnis_plan", val); caller_data->rdnis.plan = redirgNum->numPlan.val; } @@ -583,7 +597,7 @@ int check_for_state_change(ftdm_channel_t *ftdmchan) if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_STATE_CHANGE)) { /* the flag is still up...so we have a problem */ - SS7_DEBUG_CHAN(ftdmchan, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "FTDM_CHANNEL_STATE_CHANGE flag set for over 500ms, channel state = %s\n", ftdm_channel_state2str (ftdmchan->state)); return 1; @@ -1625,7 +1639,7 @@ void sngss7_set_sig_status(sngss7_chan_data_t *sngss7_info, ftdm_signaling_statu ftdm_sigmsg_t sig; ftdm_channel_t *ftdmchan = sngss7_info->ftdmchan; - SS7_DEBUG_CHAN(ftdmchan, "Signalling link status changed to %s\n", + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Signalling link status changed to %s\n", ftdm_signaling_status2str(status)); memset(&sig, 0, sizeof(sig)); @@ -1679,12 +1693,12 @@ ftdm_status_t check_for_reconfig_flag(ftdm_span_t *ftdmspan) /* check if the interface is paused or resumed */ if (sngss7_test_flag(sngss7_intf, SNGSS7_PAUSED)) { - SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is PAUSED\n", sngss7_intf->id); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ISUP intf %d is PAUSED\n", sngss7_intf->id); /* throw the pause flag */ sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_RESUME); sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); } else { - SS7_DEBUG_CHAN(ftdmchan, "ISUP intf %d is RESUMED\n", sngss7_intf->id); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "ISUP intf %d is RESUMED\n", sngss7_intf->id); /* throw the resume flag */ sngss7_clear_ckt_flag(sngss7_info, FLAG_INFID_PAUSED); sngss7_set_ckt_flag(sngss7_info, FLAG_INFID_RESUME); From 23d86585055a0fa7a450063b1935e7d1a6633e0a Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sat, 7 May 2011 00:27:20 -0400 Subject: [PATCH 458/558] make ananlog alarm --- .../src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c index 20a173abb2..3a2e72e69b 100644 --- a/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c +++ b/libs/freetdm/src/ftmod/ftmod_wanpipe/ftmod_wanpipe.c @@ -1269,7 +1269,7 @@ static FIO_GET_ALARMS_FUNCTION(wanpipe_get_alarms) ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_LINK_STATUS, &sangoma_status); ftdmchan->alarm_flags = sangoma_status == FTDM_HW_LINK_DISCONNECTED ? FTDM_ALARM_RED : FTDM_ALARM_NONE; ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Link status is %d\n", sangoma_status); - } + } } if (alarms) { @@ -1293,6 +1293,7 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_type) { case WP_API_EVENT_LINK_STATUS: { + if (FTDM_IS_DIGITAL_CHANNEL(fchan)) { switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: /* *event_id = FTDM_OOB_ALARM_CLEAR; */ @@ -1305,6 +1306,22 @@ static __inline__ ftdm_status_t wanpipe_channel_process_event(ftdm_channel_t *fc }; /* The WP_API_EVENT_ALARM event should be used to clear alarms */ *event_id = FTDM_OOB_NOOP; + } else { + switch(tdm_api->wp_tdm_cmd.event.wp_tdm_api_event_link_status) { + case WP_TDMAPI_EVENT_LINK_STATUS_CONNECTED: + /* *event_id = FTDM_OOB_ALARM_CLEAR; */ + ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Using analog link connected event as alarm clear\n"); + *event_id = FTDM_OOB_ALARM_CLEAR; + fchan->alarm_flags = FTDM_ALARM_NONE; + break; + default: + /* *event_id = FTDM_OOB_ALARM_TRAP; */ + ftdm_log_chan_msg(fchan, FTDM_LOG_DEBUG, "Using analog link disconnected event as alarm trap\n"); + *event_id = FTDM_OOB_ALARM_TRAP; + fchan->alarm_flags = FTDM_ALARM_RED; + break; + }; + } } break; From d495124f642f8bb5c89a4223feb46e579faa910a Mon Sep 17 00:00:00 2001 From: Jeff Lenk Date: Sun, 8 May 2011 13:10:01 -0500 Subject: [PATCH 459/558] windows permanent fix for %I64d problems - all versions after vs2003 support %lld --- src/include/switch_platform.h | 8 ++--- .../mod_callcenter/mod_callcenter.c | 30 ++++++++----------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/src/include/switch_platform.h b/src/include/switch_platform.h index 15b3277404..609dde8b7a 100644 --- a/src/include/switch_platform.h +++ b/src/include/switch_platform.h @@ -223,15 +223,15 @@ typedef intptr_t switch_ssize_t; #ifdef WIN32 #ifdef WIN64 -#define SWITCH_SSIZE_T_FMT "I64d" -#define SWITCH_SIZE_T_FMT "I64d" +#define SWITCH_SSIZE_T_FMT "lld" +#define SWITCH_SIZE_T_FMT "lld" #else #define SWITCH_SSIZE_T_FMT "d" #define SWITCH_SIZE_T_FMT "d" #endif -#define SWITCH_INT64_T_FMT "I64d" -#define SWITCH_UINT64_T_FMT "I64u" +#define SWITCH_INT64_T_FMT "lld" +#define SWITCH_UINT64_T_FMT "llu" #ifndef TIME_T_FMT #define TIME_T_FMT SWITCH_INT64_T_FMT diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index fee07b54bf..e3bf1797dc 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -37,12 +37,6 @@ #define CC_AGENT_TYPE_UUID_STANDBY "uuid-standby" #define CC_SQLITE_DB_NAME "callcenter" -#ifdef WIN32 -#define MSWITCH_TIME_T_FMT "lld" -#else -#define MSWITCH_TIME_T_FMT SWITCH_TIME_T_FMT -#endif - /* Prototypes */ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_callcenter_shutdown); @@ -916,12 +910,12 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2status(value) != CC_AGENT_STATUS_UNKNOWN) { /* Reset values on available only */ if (cc_agent_str2status(value) == CC_AGENT_STATUS_AVAILABLE) { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" MSWITCH_TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "', talk_time = 0, calls_answered = 0, no_answer_count = 0" " WHERE name = '%q' AND NOT status = '%q'", value, local_epoch_time_now(NULL), agent, value); } else { - sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" MSWITCH_TIME_T_FMT "' WHERE name = '%q'", + sql = switch_mprintf("UPDATE agents SET status = '%q', last_status_change = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", value, local_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); @@ -957,7 +951,7 @@ cc_status_t cc_agent_update(const char *key, const char *value, const char *agen if (cc_agent_str2state(value) != CC_AGENT_STATE_RECEIVING) { sql = switch_mprintf("UPDATE agents SET state = '%q' WHERE name = '%q'", value, agent); } else { - sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" MSWITCH_TIME_T_FMT "' WHERE name = '%q'", + sql = switch_mprintf("UPDATE agents SET state = '%q', last_offered_call = '%" SWITCH_TIME_T_FMT "' WHERE name = '%q'", value, local_epoch_time_now(NULL), agent); } cc_execute_sql(NULL, sql, NULL); @@ -1396,7 +1390,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Member %s <%s> with uuid %s in queue %s is gone just before we assigned an agent\n", h->member_cid_name, h->member_cid_number, h->member_session_uuid, h->queue_name); - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q' AND state != '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), h->member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(NULL, sql, NULL); @@ -1555,7 +1549,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa switch_channel_set_variable_printf(member_channel, "cc_queue_answered_epoch", "%" SWITCH_TIME_T_FMT, local_epoch_time_now(NULL)); /* Set UUID of the Agent channel */ - sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" MSWITCH_TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" + sql = switch_mprintf("UPDATE agents SET uuid = '%q', last_bridge_start = '%" SWITCH_TIME_T_FMT "', calls_answered = calls_answered + 1, no_answer_count = 0" " WHERE name = '%q' AND system = '%q'", agent_uuid, local_epoch_time_now(NULL), h->agent_name, h->agent_system); @@ -1615,7 +1609,7 @@ static void *SWITCH_THREAD_FUNC outbound_agent_thread_run(switch_thread_t *threa /* Update Agents Items */ /* Do not remove uuid of the agent if we are a standby agent */ - sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" MSWITCH_TIME_T_FMT ", talk_time = talk_time + (%" MSWITCH_TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" + sql = switch_mprintf("UPDATE agents SET %s last_bridge_end = %" SWITCH_TIME_T_FMT ", talk_time = talk_time + (%" SWITCH_TIME_T_FMT "-last_bridge_start) WHERE name = '%q' AND system = '%q';" , (strcasecmp(h->agent_type, CC_AGENT_TYPE_UUID_STANDBY)?"uuid = '',":""), local_epoch_time_now(NULL), local_epoch_time_now(NULL), h->agent_name, h->agent_system); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -1997,7 +1991,7 @@ static int members_callback(void *pArg, int argc, char **argv, char **columnName } /* Once we pass a certain point, we want to get rid of the abandoned call */ if (abandoned_epoch + discard_abandoned_after < (long) local_epoch_time_now(NULL)) { - sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" MSWITCH_TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); + sql = switch_mprintf("DELETE FROM members WHERE system = 'single_box' AND uuid = '%q' AND (abandoned_epoch = '%" SWITCH_TIME_T_FMT "' OR joined_epoch = '%q')", cbt.member_uuid, abandoned_epoch, cbt.member_joined_epoch); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); } @@ -2157,7 +2151,7 @@ void *SWITCH_THREAD_FUNC cc_agent_dispatch_thread_run(switch_thread_t *thread, v while (globals.running == 1) { char *sql = NULL; - sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" MSWITCH_TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" + sql = switch_mprintf("SELECT queue,uuid,session_uuid,cid_number,cid_name,joined_epoch,(%" SWITCH_TIME_T_FMT "-joined_epoch)+base_score+skill_score AS score, state, abandoned_epoch FROM members" " WHERE state = '%q' OR state = '%q' OR (serving_agent = 'ring-all' AND state = '%q') ORDER BY score DESC", local_epoch_time_now(NULL), cc_member_state2str(CC_MEMBER_STATE_WAITING), cc_member_state2str(CC_MEMBER_STATE_ABANDONED), cc_member_state2str(CC_MEMBER_STATE_TRYING)); @@ -2426,7 +2420,7 @@ SWITCH_STANDARD_APP(callcenter_function) sql = switch_mprintf("INSERT INTO members" " (queue,system,uuid,session_uuid,system_epoch,joined_epoch,base_score,skill_score,cid_number,cid_name,serving_agent,serving_system,state)" - " VALUES('%q','single_box','%q','%q','%q','%" MSWITCH_TIME_T_FMT "','%d','%d','%q','%q','%q','','%q')", + " VALUES('%q','single_box','%q','%q','%q','%" SWITCH_TIME_T_FMT "','%d','%d','%q','%q','%q','','%q')", queue_name, member_uuid, member_session_uuid, @@ -2446,7 +2440,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> restoring it previous position in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update abandoned member */ - sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", + sql = switch_mprintf("UPDATE members SET session_uuid = '%q', state = '%q', rejoined_epoch = '%" SWITCH_TIME_T_FMT "' WHERE uuid = '%q' AND state = '%q'", member_session_uuid, cc_member_state2str(CC_MEMBER_STATE_WAITING), local_epoch_time_now(NULL), member_uuid, cc_member_state2str(CC_MEMBER_STATE_ABANDONED)); cc_execute_sql(queue, sql, NULL); switch_safe_free(sql); @@ -2557,7 +2551,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> abandoned waiting in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', session_uuid = '', abandoned_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ABANDONED), local_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); @@ -2596,7 +2590,7 @@ SWITCH_STANDARD_APP(callcenter_function) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member_session), SWITCH_LOG_DEBUG, "Member %s <%s> is answered by an agent in queue %s\n", switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_name")), switch_str_nil(switch_channel_get_variable(member_channel, "caller_id_number")), queue_name); /* Update member state */ - sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" MSWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", + sql = switch_mprintf("UPDATE members SET state = '%q', bridge_epoch = '%" SWITCH_TIME_T_FMT "' WHERE system = 'single_box' AND uuid = '%q'", cc_member_state2str(CC_MEMBER_STATE_ANSWERED), local_epoch_time_now(NULL), member_uuid); cc_execute_sql(NULL, sql, NULL); switch_safe_free(sql); From ac7ca637f0378617f0400f479d4f4770a122c759 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 9 May 2011 08:24:55 -0500 Subject: [PATCH 460/558] skypopen: * FS-3287 --- src/mod/endpoints/mod_skypopen/mod_skypopen.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/mod/endpoints/mod_skypopen/mod_skypopen.c b/src/mod/endpoints/mod_skypopen/mod_skypopen.c index 133c8b7ff0..7b8bc16507 100644 --- a/src/mod/endpoints/mod_skypopen/mod_skypopen.c +++ b/src/mod/endpoints/mod_skypopen/mod_skypopen.c @@ -462,6 +462,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session) left in the initial state, nothing will happen. */ switch_channel_set_state(channel, CS_ROUTING); DEBUGA_SKYPE("%s CHANNEL INIT %s\n", SKYPOPEN_P_LOG, tech_pvt->name, switch_core_session_get_uuid(session)); + switch_copy_string(tech_pvt->session_uuid_str, switch_core_session_get_uuid(session), sizeof(tech_pvt->session_uuid_str)); return SWITCH_STATUS_SUCCESS; } From b8543ea310dd164c008ab55c066200eb229d3299 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 9 May 2011 08:42:10 -0500 Subject: [PATCH 461/558] skypopen: reinstating 5f91e46914359248f62c25f7cb427ec279b2e0f5 on Makefile.am, was overwritten by 1e74a714d7b605490a48b153f1a24879a6a410fc --- src/mod/endpoints/mod_skypopen/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skypopen/Makefile.am b/src/mod/endpoints/mod_skypopen/Makefile.am index eff7b61ac3..216970354f 100644 --- a/src/mod/endpoints/mod_skypopen/Makefile.am +++ b/src/mod/endpoints/mod_skypopen/Makefile.am @@ -11,7 +11,7 @@ SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la mod_LTLIBRARIES = mod_skypopen.la mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c -mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DSKYPOPEN_SVN_VERSION=\"`git describe`\" +mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DSKYPOPEN_C_VER=\"`git log -1 --format="%h" skypopen_protocol.c`\" -DMODSKYPOPEN_C_VER=\"`git log -1 --format="%h"` mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA) mod_skypopen_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lX11 From 3ad0d5d624cf94d8c342d95264b00ab400c20614 Mon Sep 17 00:00:00 2001 From: Giovanni Maruzzelli Date: Mon, 9 May 2011 09:09:04 -0500 Subject: [PATCH 462/558] skypopen: fixing previous fix, Makefile.am now is ok --- src/mod/endpoints/mod_skypopen/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/endpoints/mod_skypopen/Makefile.am b/src/mod/endpoints/mod_skypopen/Makefile.am index 216970354f..ab1909817b 100644 --- a/src/mod/endpoints/mod_skypopen/Makefile.am +++ b/src/mod/endpoints/mod_skypopen/Makefile.am @@ -11,7 +11,7 @@ SPANDSP_LA=$(SPANDSP_BUILDDIR)/src/libspandsp.la mod_LTLIBRARIES = mod_skypopen.la mod_skypopen_la_SOURCES = mod_skypopen.c skypopen_protocol.c -mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DSKYPOPEN_C_VER=\"`git log -1 --format="%h" skypopen_protocol.c`\" -DMODSKYPOPEN_C_VER=\"`git log -1 --format="%h"` +mod_skypopen_la_CFLAGS = $(AM_CFLAGS) -I$(SPANDSP_DIR)/src -I$(TIFF_DIR)/libtiff -I$(SPANDSP_BUILDDIR)/src -I$(TIFF_BUILDDIR)/libtiff -I. -DSKYPOPEN_C_VER=\"`git log -1 --format="%h" skypopen_protocol.c`\" -DMODSKYPOPEN_C_VER=\"`git log -1 --format="%h" mod_skypopen.c`\" mod_skypopen_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SPANDSP_LA) $(TIFF_LA) mod_skypopen_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lX11 From a0c673be6bc57ca3f2937400eeb9f7adb6609e8d Mon Sep 17 00:00:00 2001 From: Brian West Date: Mon, 9 May 2011 09:14:01 -0500 Subject: [PATCH 463/558] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 29 +++++++++++++++++++ src/mod/languages/mod_managed/managed/swig.cs | 18 ++++++++++++ 2 files changed, 47 insertions(+) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index dbce0886cc..d1c0dfcb31 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -3023,6 +3023,35 @@ SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_flush_packet_count_get } +SWIGEXPORT void SWIGSTDCALL CSharp_switch_rtp_numbers_t_largest_jb_size_set(void * jarg1, void * jarg2) { + switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ; + switch_size_t arg2 ; + switch_size_t *argp2 ; + + arg1 = (switch_rtp_numbers_t *)jarg1; + argp2 = (switch_size_t *)jarg2; + if (!argp2) { + SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "Attempt to dereference null switch_size_t", 0); + return ; + } + arg2 = *argp2; + if (arg1) (arg1)->largest_jb_size = arg2; + +} + + +SWIGEXPORT void * SWIGSTDCALL CSharp_switch_rtp_numbers_t_largest_jb_size_get(void * jarg1) { + void * jresult ; + switch_rtp_numbers_t *arg1 = (switch_rtp_numbers_t *) 0 ; + switch_size_t result; + + arg1 = (switch_rtp_numbers_t *)jarg1; + result = ((arg1)->largest_jb_size); + jresult = new switch_size_t((switch_size_t &)result); + return jresult; +} + + SWIGEXPORT void * SWIGSTDCALL CSharp_new_switch_rtp_numbers_t() { void * jresult ; switch_rtp_numbers_t *result = 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index d7a3aa9682..d06e9881d4 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -6597,6 +6597,12 @@ class freeswitchPINVOKE { [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_flush_packet_count_get")] public static extern IntPtr switch_rtp_numbers_t_flush_packet_count_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_largest_jb_size_set")] + public static extern void switch_rtp_numbers_t_largest_jb_size_set(HandleRef jarg1, HandleRef jarg2); + + [DllImport("mod_managed", EntryPoint="CSharp_switch_rtp_numbers_t_largest_jb_size_get")] + public static extern IntPtr switch_rtp_numbers_t_largest_jb_size_get(HandleRef jarg1); + [DllImport("mod_managed", EntryPoint="CSharp_new_switch_rtp_numbers_t")] public static extern IntPtr new_switch_rtp_numbers_t(); @@ -29222,6 +29228,18 @@ public class switch_rtp_numbers_t : IDisposable { } } + public SWIGTYPE_p_switch_size_t largest_jb_size { + set { + freeswitchPINVOKE.switch_rtp_numbers_t_largest_jb_size_set(swigCPtr, SWIGTYPE_p_switch_size_t.getCPtr(value)); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + } + get { + SWIGTYPE_p_switch_size_t ret = new SWIGTYPE_p_switch_size_t(freeswitchPINVOKE.switch_rtp_numbers_t_largest_jb_size_get(swigCPtr), true); + if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } + public switch_rtp_numbers_t() : this(freeswitchPINVOKE.new_switch_rtp_numbers_t(), true) { } From 3dca2ebb00564ad01902a949d9b9a692d3c29d45 Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Mon, 9 May 2011 09:45:35 -0500 Subject: [PATCH 464/558] mod_lcr - FS-3283 --resolve fix as xml for larger number of arguments --- src/mod/applications/mod_lcr/mod_lcr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index fcb75ef4d5..f475671ef1 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1664,7 +1664,7 @@ static void write_data(switch_stream_handle_t *stream, switch_bool_t as_xml, con SWITCH_STANDARD_API(dialplan_lcr_function) { - char *argv[4] = { 0 }; + char *argv[9] = { 0 }; int argc; char *mydata = NULL; //char *dialstring = NULL; From 5fa9619fe70e30e75fb24cfe87570b63d7d65071 Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Mon, 9 May 2011 11:19:58 -0500 Subject: [PATCH 465/558] mod_lcr - FS-3284 --resolve - fix malformed XML when has embedded %s --- src/mod/applications/mod_lcr/mod_lcr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_lcr/mod_lcr.c b/src/mod/applications/mod_lcr/mod_lcr.c index f475671ef1..c0d99dfc35 100644 --- a/src/mod/applications/mod_lcr/mod_lcr.c +++ b/src/mod/applications/mod_lcr/mod_lcr.c @@ -1825,7 +1825,7 @@ SWITCH_STANDARD_API(dialplan_lcr_function) if (as_xml) { event_xml = switch_event_xmlize(current->fields, SWITCH_VA_NONE); event_str = switch_xml_toxml(event_xml, SWITCH_FALSE); - stream->write_function(stream, event_str); + stream->write_function(stream, "%s", event_str); switch_xml_free(event_xml); switch_safe_free(event_str); } From e61c95933632f49af4578863be6e204d1f5efba5 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 9 May 2011 12:38:30 -0400 Subject: [PATCH 466/558] freetdm: changed print from warning to debug when we receive a Facility IE without Calling Name --- .../ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c index b1af8a61c3..0789c433f9 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_hndl.c @@ -831,7 +831,7 @@ void sngisdn_process_fac_ind (sngisdn_event_data_t *sngisdn_event) if (sng_isdn_retrieve_facility_caller_name(&facEvnt->facElmt.facStr.val[2], facEvnt->facElmt.facStr.len, retrieved_str) == 0) { strcpy(ftdmchan->caller_data.cid_name, retrieved_str); } else { - ftdm_log_chan_msg(ftdmchan, FTDM_LOG_WARNING, "Failed to retrieve Caller Name from Facility IE\n"); + ftdm_log_chan_msg(ftdmchan, FTDM_LOG_DEBUG, "Failed to retrieve Caller Name from Facility IE\n"); } if (signal_data->facility_timeout) { /* Cancel facility timeout */ From 154731a777377c3daf5fa4ffed705c0f942d33de Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 9 May 2011 09:41:50 -0700 Subject: [PATCH 467/558] Add jaybinks' tel: patch --- src/mod/endpoints/mod_sofia/sofia_glue.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index ab37ecd7f7..cc21bd0c04 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -2171,6 +2171,15 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) if (!strncasecmp(url_str, "sips:", 5)) { s = url_str + 5; } + + /* tel: patch from jaybinks, added by MC + It compiles but I don't have a way to test it + */ + if (!strncasecmp(url_str, "tel:", 4)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), + SWITCH_LOG_ERROR, "URL Error! tel: uri's not supported at this time\n"); + return SWITCH_STATUS_FALSE; + } if (!s) { s = url_str; } From 403dd0c5b083734799d97700c85376c9b145f7e5 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Mon, 9 May 2011 18:04:07 -0400 Subject: [PATCH 468/558] freetdm: ISDN - Fix for segfault when setting outbound-called-npi=e164 --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.h | 6 + .../ftmod_sangoma_isdn_support.c | 117 +++++++++++------- libs/freetdm/src/include/freetdm.h | 12 +- 3 files changed, 83 insertions(+), 52 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h index 902729d01c..ac69fa8d66 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.h @@ -292,6 +292,12 @@ typedef struct ftdm_sngisdn_data { sngisdn_span_data_t *spans[MAX_L1_LINKS+1]; /* spans are indexed by link_id */ }ftdm_sngisdn_data_t; +typedef struct ftdm2trillium +{ + uint8_t ftdm_val; + uint8_t trillium_val; +}ftdm2trillium_t; + /* TODO implement these 2 functions */ #define ISDN_FUNC_TRACE_ENTER(a) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 880b61efeb..edad62fc0d 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -43,9 +43,55 @@ SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_descr, ftdm_sngisdn_progind_descr SNGISDN_ENUM_NAMES(SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_STRINGS) SNGISDN_STR2ENUM(ftdm_str2ftdm_sngisdn_progind_loc, ftdm_sngisdn_progind_loc2str, ftdm_sngisdn_progind_loc_t, SNGISDN_PROGIND_LOC_NAMES, SNGISDN_PROGIND_LOC_INVALID) +static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val); +static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val); + extern ftdm_sngisdn_data_t g_sngisdn_data; void get_memory_info(void); +ftdm2trillium_t npi_codes[] = { + {FTDM_NPI_UNKNOWN, IN_NP_UNK}, + {FTDM_NPI_ISDN, IN_NP_ISDN}, + {FTDM_NPI_DATA, IN_NP_DATA}, + {FTDM_NPI_TELEX, IN_NP_TELEX}, + {FTDM_NPI_NATIONAL, IN_NP_NATIONAL}, + {FTDM_NPI_PRIVATE, IN_NP_PRIVATE}, + {FTDM_NPI_RESERVED, IN_NP_EXT}, +}; + +ftdm2trillium_t ton_codes[] = { + {FTDM_TON_UNKNOWN, IN_TON_UNK}, + {FTDM_TON_INTERNATIONAL, IN_TON_INT}, + {FTDM_TON_NATIONAL, IN_TON_NAT}, + {FTDM_TON_NETWORK_SPECIFIC, IN_TON_NETSPEC}, + {FTDM_TON_SUBSCRIBER_NUMBER, IN_TON_SUB}, + {FTDM_TON_ABBREVIATED_NUMBER, IN_TON_ABB}, + {FTDM_TON_RESERVED, IN_TON_EXT}, +}; + +static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val) +{ + ftdm2trillium_t *val = vals; + while(val++) { + if (val->ftdm_val == ftdm_val) { + return val->trillium_val; + } + } + return default_val; +} + +static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val) +{ + ftdm2trillium_t *val = vals; + while(val++) { + if (val->trillium_val == trillium_val) { + return val->ftdm_val; + } + } + return default_val; +} + + void clear_call_data(sngisdn_chan_data_t *sngisdn_info) { uint32_t cc_id = ((sngisdn_span_data_t*)sngisdn_info->ftdmchan->span->signal_data)->cc_id; @@ -257,11 +303,11 @@ ftdm_status_t get_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) } if (cdPtyNmb->nmbPlanId.pres == PRSNT_NODEF) { - caller_data->dnis.plan = cdPtyNmb->nmbPlanId.val; + caller_data->dnis.plan = get_ftdm_val(npi_codes, cdPtyNmb->nmbPlanId.val, IN_NP_UNK); } if (cdPtyNmb->typeNmb0.pres == PRSNT_NODEF) { - caller_data->dnis.type = cdPtyNmb->typeNmb0.val; + caller_data->dnis.type = get_ftdm_val(ton_codes, cdPtyNmb->typeNmb0.val, IN_TON_UNK); } if (cdPtyNmb->nmbDigits.pres == PRSNT_NODEF) { @@ -281,11 +327,11 @@ ftdm_status_t get_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) } if (redirNmb->nmbPlanId.pres == PRSNT_NODEF) { - caller_data->rdnis.plan = redirNmb->nmbPlanId.val; + caller_data->rdnis.plan = get_ftdm_val(npi_codes, redirNmb->nmbPlanId.val, IN_NP_UNK); } if (redirNmb->typeNmb.pres == PRSNT_NODEF) { - caller_data->rdnis.type = redirNmb->typeNmb.val; + caller_data->rdnis.type = get_ftdm_val(ton_codes, redirNmb->typeNmb.val, IN_TON_UNK); } if (redirNmb->nmbDigits.pres == PRSNT_NODEF) { @@ -380,11 +426,13 @@ ftdm_status_t get_facility_ie_str(ftdm_channel_t *ftdmchan, uint8_t *data, uint8 ftdm_status_t get_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd) { uint8_t val; + if (!progInd->eh.pres) { return FTDM_FAIL; } if (progInd->progDesc.pres) { + /* TODO: use get_ftdm_val function and table here */ switch (progInd->progDesc.val) { case IN_PD_NOTETEISDN: val = SNGISDN_PROGIND_DESCR_NETE_ISDN; @@ -462,19 +510,11 @@ ftdm_status_t set_calling_num(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) cgPtyNmb->presInd0.val = caller_data->pres; cgPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - if (caller_data->cid_num.plan >= FTDM_NPI_INVALID) { - cgPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; - } else { - cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; - } + cgPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->cid_num.plan, IN_NP_UNK); cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; - if (caller_data->cid_num.type >= FTDM_TON_INVALID) { - cgPtyNmb->typeNmb1.val = FTDM_TON_UNKNOWN; - } else { - cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; - } + cgPtyNmb->typeNmb1.val = get_trillium_val(ton_codes, caller_data->cid_num.type, IN_TON_UNK); cgPtyNmb->nmbDigits.pres = PRSNT_NODEF; cgPtyNmb->nmbDigits.len = len; @@ -508,7 +548,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) val = FTDM_SCREENING_INVALID; string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.screening_ind"); - if ((string != NULL) && (*string)) { + if (!ftdm_strlen_zero(string)) { val = ftdm_str2ftdm_screening(string); } @@ -525,7 +565,7 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) val = FTDM_PRES_INVALID; string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.presentation_ind"); - if ((string != NULL) && (*string)) { + if (!ftdm_strlen_zero(string)) { val = ftdm_str2ftdm_presentation(string); } @@ -540,14 +580,14 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) val = FTDM_NPI_INVALID; string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.npi"); - if ((string != NULL) && (*string)) { + if (!ftdm_strlen_zero(string)) { val = ftdm_str2ftdm_npi(string); } if (val == FTDM_NPI_INVALID) { cgPtyNmb->nmbPlanId.val = caller_data->cid_num.plan; } else { - cgPtyNmb->nmbPlanId.val = val; + cgPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, val, IN_NP_UNK); } cgPtyNmb->typeNmb1.pres = PRSNT_NODEF; @@ -555,14 +595,14 @@ ftdm_status_t set_calling_num2(ftdm_channel_t *ftdmchan, CgPtyNmb *cgPtyNmb) /* Type of Number */ val = FTDM_TON_INVALID; string = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.cg_pty2.ton"); - if ((string != NULL) && (*string)) { + if (!ftdm_strlen_zero(string)) { val = ftdm_str2ftdm_ton(string); } if (val == FTDM_TON_INVALID) { cgPtyNmb->typeNmb1.val = caller_data->cid_num.type; } else { - cgPtyNmb->typeNmb1.val = val; + cgPtyNmb->typeNmb1.val = get_trillium_val(ton_codes, val, IN_TON_UNK); } return FTDM_SUCCESS; } @@ -575,21 +615,14 @@ ftdm_status_t set_called_num(ftdm_channel_t *ftdmchan, CdPtyNmb *cdPtyNmb) if (!len) { return FTDM_SUCCESS; } - cdPtyNmb->eh.pres = PRSNT_NODEF; - - cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF; - if (caller_data->dnis.plan >= FTDM_NPI_INVALID) { - cdPtyNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; - } else { - cdPtyNmb->nmbPlanId.val = caller_data->dnis.plan; - } - cdPtyNmb->typeNmb0.pres = PRSNT_NODEF; - if (caller_data->dnis.type >= FTDM_TON_INVALID) { - cdPtyNmb->typeNmb0.val = FTDM_TON_UNKNOWN; - } else { - cdPtyNmb->typeNmb0.val = caller_data->dnis.type; - } + cdPtyNmb->eh.pres = PRSNT_NODEF; + + cdPtyNmb->nmbPlanId.pres = PRSNT_NODEF; + cdPtyNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->dnis.plan, IN_NP_UNK); + + cdPtyNmb->typeNmb0.pres = PRSNT_NODEF; + cdPtyNmb->typeNmb0.val = get_trillium_val(ton_codes, caller_data->dnis.type, IN_TON_UNK); cdPtyNmb->nmbDigits.pres = PRSNT_NODEF; cdPtyNmb->nmbDigits.len = len; @@ -610,18 +643,10 @@ ftdm_status_t set_redir_num(ftdm_channel_t *ftdmchan, RedirNmb *redirNmb) redirNmb->eh.pres = PRSNT_NODEF; redirNmb->nmbPlanId.pres = PRSNT_NODEF; - if (caller_data->rdnis.plan >= FTDM_NPI_INVALID) { - redirNmb->nmbPlanId.val = FTDM_NPI_UNKNOWN; - } else { - redirNmb->nmbPlanId.val = caller_data->rdnis.plan; - } + redirNmb->nmbPlanId.val = get_trillium_val(npi_codes, caller_data->rdnis.plan, IN_NP_UNK); redirNmb->typeNmb.pres = PRSNT_NODEF; - if (caller_data->rdnis.type >= FTDM_TON_INVALID) { - redirNmb->typeNmb.val = FTDM_TON_UNKNOWN; - } else { - redirNmb->typeNmb.val = caller_data->rdnis.type; - } + redirNmb->typeNmb.val = get_trillium_val(ton_codes, caller_data->rdnis.type, IN_TON_UNK); redirNmb->nmbDigits.pres = PRSNT_NODEF; redirNmb->nmbDigits.len = len; @@ -1103,9 +1128,9 @@ ftdm_bearer_cap_t sngisdn_get_infoTranCap_from_stack(uint8_t bearer_capability) { switch(bearer_capability) { case IN_ITC_SPEECH: - return FTDM_BEARER_CAP_SPEECH; + return FTDM_BEARER_CAP_SPEECH; case IN_ITC_UNRDIG: - return FTDM_BEARER_CAP_64K_UNRESTRICTED; + return FTDM_BEARER_CAP_64K_UNRESTRICTED; case IN_ITC_A31KHZ: return FTDM_BEARER_CAP_3_1KHZ_AUDIO; default: diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 6ab518a6e3..3bc2f5b25d 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -241,12 +241,12 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_ton, ftdm_ton2str, ftdm_ton_t) /*! Numbering Plan Identification (NPI) */ typedef enum { FTDM_NPI_UNKNOWN = 0, - FTDM_NPI_ISDN = 1, - FTDM_NPI_DATA = 3, - FTDM_NPI_TELEX = 4, - FTDM_NPI_NATIONAL = 8, - FTDM_NPI_PRIVATE = 9, - FTDM_NPI_RESERVED = 10, + FTDM_NPI_ISDN, + FTDM_NPI_DATA, + FTDM_NPI_TELEX, + FTDM_NPI_NATIONAL, + FTDM_NPI_PRIVATE, + FTDM_NPI_RESERVED, FTDM_NPI_INVALID } ftdm_npi_t; #define NPI_STRINGS "unknown", "ISDN", "data", "telex", "national", "private", "reserved", "invalid" From 1a71dbf2678f6a696354233aa82eab67b82acc9b Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 9 May 2011 16:36:35 -0700 Subject: [PATCH 469/558] Add sound_test.lua utility script (lets you listen to all the sound files in a particular rate/type combo --- scripts/lua/sound_test.lua | 74 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 scripts/lua/sound_test.lua diff --git a/scripts/lua/sound_test.lua b/scripts/lua/sound_test.lua new file mode 100644 index 0000000000..e29c2f9ca7 --- /dev/null +++ b/scripts/lua/sound_test.lua @@ -0,0 +1,74 @@ +-- +-- sound_test.lua +-- +-- accepts two args and then rolls through the sound files +-- arg 1: type +-- arg 2: rate +-- +--[[ Use a dialplan entry like this: + + + + + + + + +Note the syntax of the destination number: +Rate can be 8000, 16000, 32000, or 48000 +Type can be ivr, conference, voicemail, misc, digits, etc. + +Using the extension listed above you could call it with mod_portaudio from fs_cli: + + pa call 16000ivr + pa call 8000conference + pa call 32000conference + + etc. + +]] + +-- Create tables that hold our rates and types + +tbl_types = { + ['ascii'] = 1, + ['base256'] = 1, + ['conference'] = 1, + ['currency'] = 1, + ['digits'] = 1, + ['directory'] = 1, + ['ivr'] = 1, + ['misc'] = 1, + ['phonetic-ascii'] = 1, + ['time'] = 1, + ['voicemail'] = 1, + ['zrtp'] = 1 +}; + +tbl_rates = {['8000'] = 1 ,['16000'] = 1, ['32000'] = 1, ['48000'] = 1}; + +stype = argv[1]; +srate = argv[2]; + +freeswitch.consoleLog("INFO","Args: Type = " .. argv[1] .. ', Rate = ' .. argv[2] .. "\n"); + +if ( tbl_types[stype] == nil ) then + freeswitch.consoleLog("ERR","Type '" .. stype .. "' is not valid.\n"); +elseif ( tbl_rates[srate] == nil ) then + freeswitch.consoleLog("ERR","Rate '" .. srate .. "' is not valid.\n"); +else + -- Looks good, let's play some sound files + sound_base = session:getVariable('sounds_dir') .. '/en/us/callie/' .. stype .. '/' .. srate; + input_file = '/tmp/filez.txt'; + res = os.execute('ls -1 ' .. sound_base .. ' > ' .. input_file); + freeswitch.consoleLog("INFO","Result of system call: " .. res .. "\n"); + if ( res == 0 ) then + for fname in io.lines(input_file) do + freeswitch.consoleLog("NOTICE","Playing file: " .. fname .. "\n"); + session:streamFile(sound_base .. '/' .. fname); + session:sleep(100); + end + else + freeswitch.consoleLog("ERR","Result of system call: " .. res .. "\n"); + end +end \ No newline at end of file From 7499dfb2273448e2af312c983a615de42ecabc22 Mon Sep 17 00:00:00 2001 From: Michael S Collins Date: Mon, 9 May 2011 22:20:27 -0700 Subject: [PATCH 470/558] Update phrase_en.xml to reflect 1.0.16 sounds version --- docs/phrase/phrase_en.xml | 54 ++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/docs/phrase/phrase_en.xml b/docs/phrase/phrase_en.xml index 9e31cccf08..507fc7bd34 100644 --- a/docs/phrase/phrase_en.xml +++ b/docs/phrase/phrase_en.xml @@ -5,6 +5,23 @@ + + + + + + + + + + + + + + + + + @@ -222,6 +239,8 @@ + + @@ -270,7 +289,13 @@ - + + + + + + + @@ -432,8 +457,6 @@ - - @@ -445,37 +468,14 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -489,6 +489,8 @@ + + From 897e6573fa5d724ffad5240c4248ab6a55583ee9 Mon Sep 17 00:00:00 2001 From: Rupa Schomaker Date: Tue, 10 May 2011 08:12:27 -0500 Subject: [PATCH 471/558] FS-2890 --resolve mod_nibblebill, remove on_reporting hook --- src/mod/applications/mod_nibblebill/mod_nibblebill.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mod/applications/mod_nibblebill/mod_nibblebill.c b/src/mod/applications/mod_nibblebill/mod_nibblebill.c index 068a31f5f3..2cd772ece0 100755 --- a/src/mod/applications/mod_nibblebill/mod_nibblebill.c +++ b/src/mod/applications/mod_nibblebill/mod_nibblebill.c @@ -902,7 +902,7 @@ switch_state_handler_table_t nibble_state_handler = { /* on_hibernate */ NULL, /* on_reset */ NULL, /* on_park */ NULL, - /* on_reporting */ process_hangup, /* force billing event on b-leg if we can */ + /* on_reporting */ NULL, /* on_destroy */ NULL }; From 05fa93f831d58b9ddcc57b8aae48f8851b2b6264 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 10 May 2011 11:38:23 -0400 Subject: [PATCH 472/558] chlog: freetdm: ss7 - Support for Calling Party's Category --- libs/freetdm/mod_freetdm/mod_freetdm.c | 12 ++- .../ftmod_sangoma_isdn_support.c | 4 +- .../ftmod_sangoma_ss7_handle.c | 2 + .../ftmod_sangoma_ss7_main.h | 9 +++ .../ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c | 10 +-- .../ftmod_sangoma_ss7_support.c | 81 ++++++++++++++++--- libs/freetdm/src/include/freetdm.h | 7 +- 7 files changed, 105 insertions(+), 20 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index f0b09fda56..ff72eb2ec4 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1367,7 +1367,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi ftdm_usrmsg_add_var(&usrmsg, "ss7_pres_ind", sipvar); } - + sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-CPC"); + if (sipvar) { + ftdm_usrmsg_add_var(&usrmsg, "ss7_cpc", sipvar); + } } if (switch_test_flag(outbound_profile, SWITCH_CPF_SCREEN)) { @@ -1673,7 +1676,12 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumInComp", "%d", var_value); } } /* End - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); */ - + + var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_cpc"); + if (!ftdm_strlen_zero(var_value)) { + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%d", var_value); + } + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Presentation", "%d", channel_caller_data->pres); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c index 0ac52b085c..a343809b4c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_support.c @@ -743,7 +743,7 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s int loc = prog_ind.loc; str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.prog_ind.descr"); - if (str && *str) { + if (!ftdm_strlen_zero(str)) { /* User wants to override progress indicator */ descr = ftdm_str2ftdm_sngisdn_progind_descr(str); } @@ -754,7 +754,7 @@ ftdm_status_t set_prog_ind_ie(ftdm_channel_t *ftdmchan, ProgInd *progInd, ftdm_s } str = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "isdn.prog_ind.loc"); - if (str && *str) { + if (!ftdm_strlen_zero(str)) { loc = ftdm_str2ftdm_sngisdn_progind_loc(str); } if (loc == SNGISDN_PROGIND_LOC_INVALID) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c index 3348292935..596ae7c734 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_handle.c @@ -189,6 +189,8 @@ ftdm_status_t handle_con_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ copy_genNmb_from_sngss7(ftdmchan, &siConEvnt->genNmb); + copy_cgPtyCat_from_sngss7(ftdmchan, &siConEvnt->cgPtyCat); + /* fill in the TMR/bearer capability */ if (siConEvnt->txMedReq.eh.pres) { if (siConEvnt->txMedReq.trMedReq.pres) { diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h index a355ee0ee7..04723048f6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_main.h @@ -60,6 +60,13 @@ #define MAX_SIZEOF_SUBADDR_IE 24 /* as per Q931 4.5.9 */ +typedef struct ftdm2trillium +{ + uint8_t ftdm_val; + uint8_t trillium_val; +}ftdm2trillium_t; + + typedef enum { SNGSS7_CON_IND_EVENT = 0, SNGSS7_CON_CFM_EVENT, @@ -806,6 +813,8 @@ ftdm_status_t copy_redirgNum_to_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *red ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *redirgNum); ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb); +ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat); +ftdm_status_t copy_cgPtyCat_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat); ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); ftdm_status_t append_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c index a746301cd7..e1944513d1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_out.c @@ -112,12 +112,7 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) iam.fwdCallInd.isdnAccInd.val = ISDNACC_ISDN; iam.fwdCallInd.sccpMethInd.pres = PRSNT_NODEF; iam.fwdCallInd.sccpMethInd.val = SCCPMTH_NOIND; - - /* copy down the calling number information */ - iam.cgPtyCat.eh.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.pres = PRSNT_NODEF; - iam.cgPtyCat.cgPtyCat.val = CAT_ORD; /* ordinary suscriber */ - + /* copy down the transmission medium requirements */ iam.txMedReq.eh.pres = PRSNT_NODEF; iam.txMedReq.trMedReq.pres = PRSNT_NODEF; @@ -185,6 +180,9 @@ void ft_to_sngss7_iam (ftdm_channel_t * ftdmchan) /* copy down the generic number information */ copy_genNmb_to_sngss7(ftdmchan, &iam.genNmb); + + /* copy down the calling party category */ + copy_cgPtyCat_to_sngss7(ftdmchan, &iam.cgPtyCat); /* TODO - move this to copy_clg_subAddr_to_sngss7 function */ /* check if the user would like us to send a clg_sub-address */ diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 8fafa8995c..b6e4d28745 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -91,9 +91,50 @@ FTDM_ENUM_NAMES(BLK_FLAGS_NAMES, BLK_FLAGS_STRING) FTDM_STR2ENUM(ftmod_ss7_blk_state2flag, ftmod_ss7_blk_flag2str, sng_ckt_block_flag_t, BLK_FLAGS_NAMES, 31) /* FUNCTIONS ******************************************************************/ +static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val); +static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val); + + + +/* Maps generic FreeTDM CPC codes to SS7 CPC codes */ +ftdm2trillium_t cpc_codes[] = { + {FTDM_CPC_UNKNOWN, CAT_UNKNOWN}, + {FTDM_CPC_OPERATOR_FRENCH, CAT_OPLANGFR}, + {FTDM_CPC_OPERATOR_ENGLISH, CAT_OPLANGENG}, + {FTDM_CPC_OPERATOR_GERMAN, CAT_OPLANGGER}, + {FTDM_CPC_OPERATOR_RUSSIAN, CAT_OPLANGRUS}, + {FTDM_CPC_OPERATOR_SPANISH, CAT_OPLANGSP}, + {FTDM_CPC_ORDINARY, CAT_ORD}, + {FTDM_CPC_PRIORITY, CAT_PRIOR}, + {FTDM_CPC_DATA, CAT_DATA}, + {FTDM_CPC_TEST, CAT_TEST}, + {FTDM_CPC_PAYPHONE, CAT_PAYPHONE}, +}; + +static uint8_t get_trillium_val(ftdm2trillium_t *vals, uint8_t ftdm_val, uint8_t default_val) +{ + ftdm2trillium_t *val = vals; + while(val++) { + if (val->ftdm_val == ftdm_val) { + return val->trillium_val; + } + } + return default_val; +} + +static uint8_t get_ftdm_val(ftdm2trillium_t *vals, uint8_t trillium_val, uint8_t default_val) +{ + ftdm2trillium_t *val = vals; + while(val++) { + if (val->trillium_val == trillium_val) { + return val->ftdm_val; + } + } + return default_val; +} + ftdm_status_t copy_cgPtyNum_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyNum *cgPtyNum) { - return FTDM_SUCCESS; } @@ -174,7 +215,6 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) { const char *val = NULL; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SS7_FUNC_TRACE_ENTER(__FUNCTION__); val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_gn_digits"); if (!ftdm_strlen_zero(val)) { @@ -183,9 +223,9 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) return FTDM_FAIL; } } else { - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number qualifier \"%s\"\n", val); return FTDM_SUCCESS; } + genNmb->eh.pres = PRSNT_NODEF; genNmb->addrSig.pres = PRSNT_NODEF; @@ -243,7 +283,6 @@ ftdm_status_t copy_genNmb_to_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb) genNmb->niInd.val = g_ftdm_sngss7_data.cfg.isupCkt[sngss7_info->circuit->id].gn_num_inc_ind; ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "No user supplied Generic Number \"number incomplete indicator\" \"%d\"\n", genNmb->niInd.val); } - SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; } @@ -251,7 +290,6 @@ ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb { char val[64]; sngss7_chan_data_t *sngss7_info = ftdmchan->call_data; - SS7_FUNC_TRACE_ENTER(__FUNCTION__); memset(val, 0, sizeof(val)); @@ -301,7 +339,6 @@ ftdm_status_t copy_genNmb_from_sngss7(ftdm_channel_t *ftdmchan, SiGenNum *genNmb sngss7_add_var(sngss7_info, "ss7_gn_num_inc_ind", val); } - SS7_FUNC_TRACE_EXIT(__FUNCTION__); return FTDM_SUCCESS; } @@ -423,6 +460,35 @@ ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *r return FTDM_SUCCESS; } +ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat) +{ + const char* val = NULL; + + cgPtyCat->eh.pres = PRSNT_NODEF; + cgPtyCat->cgPtyCat.pres = PRSNT_NODEF; + + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cpc"); + if (!ftdm_strlen_zero(val)) { + cgPtyCat->cgPtyCat.val = get_trillium_val(cpc_codes, ftdm_str2ftdm_calling_party_category(val), CAT_ORD); + } else { + cgPtyCat->cgPtyCat.val = CAT_ORD; /* ordinary suscriber */ + } + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n", cgPtyCat->cgPtyCat.val); + return FTDM_SUCCESS; +} + +ftdm_status_t copy_cgPtyCat_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat) +{ + if (cgPtyCat->eh.pres == PRSNT_NODEF && + cgPtyCat->cgPtyCat.pres == PRSNT_NODEF) { + + sngss7_add_var((sngss7_chan_data_t*)ftdmchan->call_data, "ss7_cpc", + ftdm_calling_party_category2str(get_ftdm_val(cpc_codes, cgPtyCat->cgPtyCat.val, FTDM_CPC_UNKNOWN))); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n", cgPtyCat->cgPtyCat.val); + } + return FTDM_SUCCESS; +} + ftdm_status_t copy_tknStr_from_sngss7(TknStr str, char *ftdm, TknU8 oddEven) { uint8_t i; @@ -648,8 +714,6 @@ int check_cics_in_range(sngss7_chan_data_t *sngss7_info) /******************************************************************************/ ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_info, ftdm_channel_t **ftdmchan) { - /*SS7_FUNC_TRACE_ENTER(__FUNCTION__);*/ - if (g_ftdm_sngss7_data.cfg.isupCkt[circuit].obj == NULL) { SS7_ERROR("sngss7_info is Null for circuit #%d\n", circuit); return FTDM_FAIL; @@ -662,7 +726,6 @@ ftdm_status_t extract_chan_data(uint32_t circuit, sngss7_chan_data_t **sngss7_in ftdm_assert_return((*sngss7_info)->ftdmchan, FTDM_FAIL, "received message on signalling link or non-configured cic\n"); *ftdmchan = (*sngss7_info)->ftdmchan; - /*SS7_FUNC_TRACE_EXIT(__FUNCTION__);*/ return FTDM_SUCCESS; } diff --git a/libs/freetdm/src/include/freetdm.h b/libs/freetdm/src/include/freetdm.h index 6ab518a6e3..6b14d14524 100755 --- a/libs/freetdm/src/include/freetdm.h +++ b/libs/freetdm/src/include/freetdm.h @@ -298,6 +298,11 @@ FTDM_STR2ENUM_P(ftdm_str2ftdm_usr_layer1_prot, ftdm_user_layer1_prot2str, ftdm_u typedef enum { FTDM_CPC_UNKNOWN, FTDM_CPC_OPERATOR, + FTDM_CPC_OPERATOR_FRENCH, + FTDM_CPC_OPERATOR_ENGLISH, + FTDM_CPC_OPERATOR_GERMAN, + FTDM_CPC_OPERATOR_RUSSIAN, + FTDM_CPC_OPERATOR_SPANISH, FTDM_CPC_ORDINARY, FTDM_CPC_PRIORITY, FTDM_CPC_DATA, @@ -305,7 +310,7 @@ typedef enum { FTDM_CPC_PAYPHONE, FTDM_CPC_INVALID } ftdm_calling_party_category_t; -#define CALLING_PARTY_CATEGORY_STRINGS "unknown", "operator", "ordinary", "priority", "data-call", "test-call", "payphone", "invalid" +#define CALLING_PARTY_CATEGORY_STRINGS "unknown", "operator", "operator-french", "operator-english", "operator-german", "operator-russian", "operator-spanish", "ordinary", "priority", "data-call", "test-call", "payphone", "invalid" FTDM_STR2ENUM_P(ftdm_str2ftdm_calling_party_category, ftdm_calling_party_category2str, ftdm_calling_party_category_t) /*! \brief Digit limit used in DNIS/ANI */ From 2ac7a9de4f691df2622d8d962c55ef4083f29d70 Mon Sep 17 00:00:00 2001 From: Stefan Knoblich Date: Tue, 10 May 2011 19:35:56 +0200 Subject: [PATCH 473/558] ftmod_libpri: Set default config values, just in case the user forgot to set some parameters in freetdm.conf.xml. This fixes the "[ERR] ftmod_libpri.c:128 Don't know how to SABME on a type 0 node" messages from libpri, when there's no "node"/"mode" parameter set for the span. NOTE: Now defaulting to CPE mode; EuroISDN on BRI/E1 and 4ESS on J1/T1 lines, make sure you set dialect/switchtype! Signed-off-by: Stefan Knoblich --- libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c index ec7fe39c7d..8093443986 100644 --- a/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c +++ b/libs/freetdm/src/ftmod/ftmod_libpri/ftmod_libpri.c @@ -1965,6 +1965,10 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) assert(isdn_data != NULL); memset(isdn_data, 0, sizeof(*isdn_data)); + /* set some default values */ + isdn_data->mode = PRI_CPE; + isdn_data->ton = PRI_UNKNOWN; + switch (ftdm_span_get_trunk_type(span)) { case FTDM_TRUNK_BRI: case FTDM_TRUNK_BRI_PTMP: @@ -1975,12 +1979,14 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span) #endif case FTDM_TRUNK_E1: ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ALAW since this is an E1/BRI/BRI PTMP trunk\n"); - isdn_data->layer1 = PRI_LAYER_1_ALAW; + isdn_data->layer1 = PRI_LAYER_1_ALAW; + isdn_data->dialect = PRI_SWITCH_EUROISDN_E1; break; case FTDM_TRUNK_T1: case FTDM_TRUNK_J1: ftdm_log(FTDM_LOG_NOTICE, "Setting default Layer 1 to ULAW since this is a T1/J1 trunk\n"); - isdn_data->layer1 = PRI_LAYER_1_ULAW; + isdn_data->layer1 = PRI_LAYER_1_ULAW; + isdn_data->dialect = PRI_SWITCH_LUCENT5E; break; default: ftdm_log(FTDM_LOG_ERROR, "Invalid trunk type: '%s'\n", ftdm_span_get_trunk_type_str(span)); From 95f2d6de0d803d3f7ee67f57694bfb55f67bb18d Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 10 May 2011 15:28:10 -0400 Subject: [PATCH 474/558] freetdm: Changed SS7 to use global CPC variable --- libs/freetdm/mod_freetdm/mod_freetdm.c | 4 ++-- .../src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index ff72eb2ec4..ffd2d7747a 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1369,7 +1369,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi sipvar = switch_channel_get_variable(channel, "sip_h_X-FreeTDM-CPC"); if (sipvar) { - ftdm_usrmsg_add_var(&usrmsg, "ss7_cpc", sipvar); + ftdm_set_calling_party_category(var, (uint8_t *)&caller_data.cpc); } } @@ -1677,7 +1677,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session } } /* End - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); */ - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_cpc"); + var_value = ftdm_sigmsg_get_var(sigmsg, "freetdm_calling_party_category"); if (!ftdm_strlen_zero(var_value)) { switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%d", var_value); } diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index b6e4d28745..24813f4a0c 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -467,7 +467,7 @@ ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPt cgPtyCat->eh.pres = PRSNT_NODEF; cgPtyCat->cgPtyCat.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "ss7_cpc"); + val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "calling_party_category"); if (!ftdm_strlen_zero(val)) { cgPtyCat->cgPtyCat.val = get_trillium_val(cpc_codes, ftdm_str2ftdm_calling_party_category(val), CAT_ORD); } else { @@ -482,7 +482,7 @@ ftdm_status_t copy_cgPtyCat_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cg if (cgPtyCat->eh.pres == PRSNT_NODEF && cgPtyCat->cgPtyCat.pres == PRSNT_NODEF) { - sngss7_add_var((sngss7_chan_data_t*)ftdmchan->call_data, "ss7_cpc", + sngss7_add_var((sngss7_chan_data_t*)ftdmchan->call_data, "calling_party_category", ftdm_calling_party_category2str(get_ftdm_val(cpc_codes, cgPtyCat->cgPtyCat.val, FTDM_CPC_UNKNOWN))); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n", cgPtyCat->cgPtyCat.val); } From 32bf306af596521c7b2b604a40a3de58f6fadce4 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 10 May 2011 15:56:30 -0400 Subject: [PATCH 475/558] freetdm: ss7 - CPC --- libs/freetdm/mod_freetdm/mod_freetdm.c | 4 +++- .../ftmod_sangoma_ss7_support.c | 18 +++++++----------- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index ffd2d7747a..d1f03b3a24 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1608,9 +1608,11 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "freetdm_chan_number", "%d", chanid); switch_channel_set_variable_printf(channel, "freetdm_bearer_capability", "%d", channel_caller_data->bearer_capability); switch_channel_set_variable_printf(channel, "freetdm_bearer_layer1", "%d", channel_caller_data->bearer_layer1); + switch_channel_set_variable_printf(channel, "freetdm_calling_party_category", ftdm_calling_party_category2str(channel_caller_data->cpc)); switch_channel_set_variable_printf(channel, "screening_ind", ftdm_screening2str(channel_caller_data->screen)); switch_channel_set_variable_printf(channel, "presentation_ind", ftdm_presentation2str(channel_caller_data->pres)); + if (globals.sip_headers) { switch_channel_set_variable(channel, "sip_h_X-FreeTDM-SpanName", ftdm_channel_get_span_name(sigmsg->channel)); switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-SpanNumber", "%d", spanid); @@ -1676,7 +1678,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-GN-NumInComp", "%d", var_value); } } /* End - var_value = ftdm_sigmsg_get_var(sigmsg, "ss7_gn_digits"); */ - + var_value = ftdm_sigmsg_get_var(sigmsg, "freetdm_calling_party_category"); if (!ftdm_strlen_zero(var_value)) { switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%d", var_value); diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c index 24813f4a0c..a60a6c48ed 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_ss7/ftmod_sangoma_ss7_support.c @@ -462,28 +462,24 @@ ftdm_status_t copy_redirgNum_from_sngss7(ftdm_channel_t *ftdmchan, SiRedirNum *r ftdm_status_t copy_cgPtyCat_to_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat) { - const char* val = NULL; + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; cgPtyCat->eh.pres = PRSNT_NODEF; cgPtyCat->cgPtyCat.pres = PRSNT_NODEF; - val = ftdm_usrmsg_get_var(ftdmchan->usrmsg, "calling_party_category"); - if (!ftdm_strlen_zero(val)) { - cgPtyCat->cgPtyCat.val = get_trillium_val(cpc_codes, ftdm_str2ftdm_calling_party_category(val), CAT_ORD); - } else { - cgPtyCat->cgPtyCat.val = CAT_ORD; /* ordinary suscriber */ - } - ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n", cgPtyCat->cgPtyCat.val); + cgPtyCat->cgPtyCat.val = get_trillium_val(cpc_codes, caller_data->cpc, CAT_ORD); + ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n",cgPtyCat->cgPtyCat.val); return FTDM_SUCCESS; } ftdm_status_t copy_cgPtyCat_from_sngss7(ftdm_channel_t *ftdmchan, SiCgPtyCat *cgPtyCat) { + ftdm_caller_data_t *caller_data = &ftdmchan->caller_data; + if (cgPtyCat->eh.pres == PRSNT_NODEF && cgPtyCat->cgPtyCat.pres == PRSNT_NODEF) { - - sngss7_add_var((sngss7_chan_data_t*)ftdmchan->call_data, "calling_party_category", - ftdm_calling_party_category2str(get_ftdm_val(cpc_codes, cgPtyCat->cgPtyCat.val, FTDM_CPC_UNKNOWN))); + + caller_data->cpc = get_ftdm_val(cpc_codes, cgPtyCat->cgPtyCat.val, FTDM_CPC_UNKNOWN); ftdm_log_chan(ftdmchan, FTDM_LOG_DEBUG, "Calling Party Category:0x%x\n", cgPtyCat->cgPtyCat.val); } return FTDM_SUCCESS; From 3b2019cd1ff5f475989af63ecc7a9086968f0650 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 10 May 2011 16:09:02 -0400 Subject: [PATCH 476/558] minor changes --- libs/freetdm/mod_freetdm/mod_freetdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index d1f03b3a24..954a568e6f 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -1681,7 +1681,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session var_value = ftdm_sigmsg_get_var(sigmsg, "freetdm_calling_party_category"); if (!ftdm_strlen_zero(var_value)) { - switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%d", var_value); + switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-CPC", "%s", var_value); } switch_channel_set_variable_printf(channel, "sip_h_X-FreeTDM-Screen", "%d", channel_caller_data->screen); From 72d98bf16dce74d60f6df3eb41dd0c34fe53cadf Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Tue, 10 May 2011 17:38:03 -0400 Subject: [PATCH 477/558] freetdm - ISDN disabled T302 timer on non EuroISDN variants --- .../ftmod_sangoma_isdn_stack_cfg.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index 1bd2753e81..be6ba07884 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -745,8 +745,16 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) /* TODO: Fill in these timers with proper values - eventually pass them */ cfg.t.cfg.s.inDLSAP.tmr.t301.enb = TRUE; cfg.t.cfg.s.inDLSAP.tmr.t301.val = 180; - cfg.t.cfg.s.inDLSAP.tmr.t302.enb = TRUE; - cfg.t.cfg.s.inDLSAP.tmr.t302.val = 15; + + /* It looks like ETSI is the only variant that supports Overlap */s + if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { + cfg.t.cfg.s.inDLSAP.tmr.t302.enb = TRUE; + cfg.t.cfg.s.inDLSAP.tmr.t302.val = 15; + } else { + cfg.t.cfg.s.inDLSAP.tmr.t302.enb = FALSE; + cfg.t.cfg.s.inDLSAP.tmr.t302.val = 0; + } + cfg.t.cfg.s.inDLSAP.tmr.t303.enb = TRUE; cfg.t.cfg.s.inDLSAP.tmr.t303.val = 4; cfg.t.cfg.s.inDLSAP.tmr.t304.enb = TRUE; From b073d1a3963cdf445fc13fff3d22bfc9c77a9e65 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 10 May 2011 23:07:15 -0400 Subject: [PATCH 478/558] freetdm: typo --- .../src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c index be6ba07884..88aa9131b6 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn_stack_cfg.c @@ -746,7 +746,7 @@ ftdm_status_t sngisdn_stack_cfg_q931_dlsap(ftdm_span_t *span) cfg.t.cfg.s.inDLSAP.tmr.t301.enb = TRUE; cfg.t.cfg.s.inDLSAP.tmr.t301.val = 180; - /* It looks like ETSI is the only variant that supports Overlap */s + /* It looks like ETSI is the only variant that supports Overlap */ if (signal_data->switchtype == SNGISDN_SWITCH_EUROISDN) { cfg.t.cfg.s.inDLSAP.tmr.t302.enb = TRUE; cfg.t.cfg.s.inDLSAP.tmr.t302.val = 15; From e544e4cff1bdd5f342c0effd310970ff28d6abe1 Mon Sep 17 00:00:00 2001 From: Moises Silva Date: Tue, 10 May 2011 23:35:20 -0400 Subject: [PATCH 479/558] freetdm: Add initial testing support for unrestricted digital calls using G722 codec --- libs/freetdm/mod_freetdm/mod_freetdm.c | 18 +++++++++----- libs/freetdm/src/ftdm_io.c | 24 +++++++++++++++---- libs/freetdm/src/include/private/ftdm_types.h | 2 ++ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/libs/freetdm/mod_freetdm/mod_freetdm.c b/libs/freetdm/mod_freetdm/mod_freetdm.c index 4cc364c9f3..b2ac9a8293 100755 --- a/libs/freetdm/mod_freetdm/mod_freetdm.c +++ b/libs/freetdm/mod_freetdm/mod_freetdm.c @@ -294,10 +294,7 @@ static void cycle_foreground(ftdm_channel_t *ftdmchan, int flash, const char *bc } } - - - -static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session, ftdm_channel_t *ftdmchan) +static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *session, ftdm_channel_t *ftdmchan, ftdm_caller_data_t *caller_data) { const char *dname = NULL; uint32_t interval = 0, srate = 8000; @@ -321,6 +318,14 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses return SWITCH_STATUS_GENERR; } + if (caller_data->bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Initializing digital call.\n"); + /* temporary hack, this will be configurable */ + dname = "G722"; + srate = 16000; + goto init_codecs; + } + if (FTDM_SUCCESS != ftdm_channel_command(ftdmchan, FTDM_COMMAND_GET_CODEC, &codec)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to retrieve channel codec.\n"); return SWITCH_STATUS_GENERR; @@ -349,6 +354,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses } } +init_codecs: if (switch_core_codec_init(&tech_pvt->read_codec, dname, @@ -1093,7 +1099,7 @@ static ftdm_status_t on_channel_found(ftdm_channel_t *fchan, ftdm_caller_data_t span_id = ftdm_channel_get_span_id(fchan); chan_id = ftdm_channel_get_id(fchan); - tech_init(hdata->tech_pvt, hdata->new_session, fchan); + tech_init(hdata->tech_pvt, hdata->new_session, fchan, caller_data); snprintf(name, sizeof(name), "FreeTDM/%u:%u/%s", span_id, chan_id, caller_data->dnis.digits); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connect outbound channel %s\n", name); @@ -1542,7 +1548,7 @@ ftdm_status_t ftdm_channel_from_event(ftdm_sigmsg_t *sigmsg, switch_core_session tech_pvt = (private_t *) switch_core_session_alloc(session, sizeof(private_t)); assert(tech_pvt != NULL); channel = switch_core_session_get_channel(session); - if (tech_init(tech_pvt, session, sigmsg->channel) != SWITCH_STATUS_SUCCESS) { + if (tech_init(tech_pvt, session, sigmsg->channel, channel_caller_data) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Initilization Error!\n"); switch_core_session_destroy(&session); return FTDM_FAIL; diff --git a/libs/freetdm/src/ftdm_io.c b/libs/freetdm/src/ftdm_io.c index 1c10171202..ddfe78dd71 100644 --- a/libs/freetdm/src/ftdm_io.c +++ b/libs/freetdm/src/ftdm_io.c @@ -508,13 +508,16 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_set_caller_data(ftdm_channel_t *ftdmchan, { ftdm_status_t err = FTDM_SUCCESS; if (!ftdmchan) { - ftdm_log(FTDM_LOG_CRIT, "Error: trying to set caller data, but no ftdmchan!\n"); + ftdm_log(FTDM_LOG_CRIT, "trying to set caller data, but no ftdmchan!\n"); return FTDM_FAIL; } if ((err = ftdm_set_caller_data(ftdmchan->span, caller_data)) != FTDM_SUCCESS) { return err; } ftdmchan->caller_data = *caller_data; + if (ftdmchan->caller_data.bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_set_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA); + } return FTDM_SUCCESS; } @@ -2628,6 +2631,7 @@ static ftdm_status_t ftdm_channel_done(ftdm_channel_t *ftdmchan) ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_MEDIA); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_ANSWERED); ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_USER_HANGUP); + ftdm_clear_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA); ftdm_mutex_lock(ftdmchan->pre_buffer_mutex); ftdm_buffer_destroy(&ftdmchan->pre_buffer); ftdmchan->pre_buffer_size = 0; @@ -3780,6 +3784,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_read(ftdm_channel_t *ftdmchan, void *data handle_tone_generation(ftdmchan); + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA)) { + goto done; + } + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_SLIN) { codec_func = fio_ulaw2slin; @@ -3994,6 +4002,10 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat status = FTDM_FAIL; goto done; } + + if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_DIGITAL_MEDIA)) { + goto do_write; + } if (ftdm_test_flag(ftdmchan, FTDM_CHANNEL_TRANSCODE) && ftdmchan->effective_codec != ftdmchan->native_codec) { if (ftdmchan->native_codec == FTDM_CODEC_ULAW && ftdmchan->effective_codec == FTDM_CODEC_SLIN) { @@ -4025,6 +4037,8 @@ FT_DECLARE(ftdm_status_t) ftdm_channel_write(ftdm_channel_t *ftdmchan, void *dat } } +do_write: + if (ftdmchan->span->sig_write) { status = ftdmchan->span->sig_write(ftdmchan, data, *datalen); if (status == FTDM_BREAK) { @@ -5374,10 +5388,12 @@ FT_DECLARE(ftdm_status_t) ftdm_span_send_signal(ftdm_span_t *span, ftdm_sigmsg_t ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_CALL_STARTED); ftdm_call_set_call_id(sigmsg->channel, &sigmsg->channel->caller_data); /* when cleaning up the public API I added this because mod_freetdm.c on_fxs_signal was - * doing it during SIGEVENT_START, but now that flags are private they can't, wonder if - * is needed at all? - * */ + * doing it during SIGEVENT_START, but now that flags are private they can't, wonder if + * is needed at all? */ ftdm_clear_flag(sigmsg->channel, FTDM_CHANNEL_HOLD); + if (sigmsg->channel->caller_data.bearer_capability == FTDM_BEARER_CAP_64K_UNRESTRICTED) { + ftdm_set_flag(sigmsg->channel, FTDM_CHANNEL_DIGITAL_MEDIA); + } } break; diff --git a/libs/freetdm/src/include/private/ftdm_types.h b/libs/freetdm/src/include/private/ftdm_types.h index b263b64a2d..e4d2b6900d 100755 --- a/libs/freetdm/src/include/private/ftdm_types.h +++ b/libs/freetdm/src/include/private/ftdm_types.h @@ -249,6 +249,8 @@ typedef enum { #define FTDM_CHANNEL_IND_ACK_PENDING (1ULL << 34) /*!< There is someone blocking in the channel waiting for state completion */ #define FTDM_CHANNEL_BLOCKING (1ULL << 35) +/*!< Media is digital */ +#define FTDM_CHANNEL_DIGITAL_MEDIA (1ULL << 36) #include "ftdm_state.h" From 7064487df2cbee30f20e5dc72a413d833964529a Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 11 May 2011 10:07:00 -0500 Subject: [PATCH 480/558] FS-2936 please test on windows --- Makefile.am | 6 ++++-- build/modmake.rules.in | 6 +++--- configure.in | 5 +++++ src/include/switch.h | 3 +++ src/mod/applications/mod_cidlookup/Makefile | 1 - src/mod/applications/mod_curl/Makefile | 1 - src/mod/applications/mod_memcache/Makefile | 2 -- src/mod/event_handlers/mod_json_cdr/Makefile | 1 - src/mod/formats/mod_shout/Makefile | 2 -- src/mod/formats/mod_shout/mod_shout.c | 3 --- src/mod/languages/mod_spidermonkey/mod_spidermonkey.c | 6 ------ .../languages/mod_spidermonkey/mod_spidermonkey_curl.c | 1 - src/mod/xml_int/mod_xml_cdr/Makefile | 1 - src/mod/xml_int/mod_xml_curl/Makefile | 1 - src/mod/xml_int/mod_xml_curl/mod_xml_curl.c | 5 +---- src/switch_core.c | 8 ++++++++ 16 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Makefile.am b/Makefile.am index 95c53dd128..343d98a2bd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -130,7 +130,7 @@ endif lib_LTLIBRARIES = libfreeswitch.la libfreeswitch_la_CFLAGS = $(CORE_CFLAGS) $(AM_CFLAGS) libfreeswitch_la_LDFLAGS = -version-info 1:0:0 $(AM_LDFLAGS) $(PLATFORM_CORE_DEPLIBS) -libfreeswitch_la_LIBADD = $(CORE_LIBS) +libfreeswitch_la_LIBADD = $(CORE_LIBS) $(LIBCURL) libfreeswitch_la_DEPENDENCIES = $(BUILT_SOURCES) if HAVE_ODBC @@ -180,7 +180,8 @@ library_include_HEADERS = \ libs/libteletone/src/libteletone_generate.h \ libs/libteletone/src/libteletone.h \ src/include/switch_limit.h \ - src/include/switch_odbc.h + src/include/switch_odbc.h \ + src/include/switch_curl.h nodist_libfreeswitch_la_SOURCES = \ src/include/switch_frame.h \ @@ -240,6 +241,7 @@ libfreeswitch_la_SOURCES = \ src/switch_pcm.c \ src/switch_profile.c \ src/switch_json.c \ + src/switch_curl.c \ libs/stfu/stfu.c \ libs/libteletone/src/libteletone_detect.c \ libs/libteletone/src/libteletone_generate.c \ diff --git a/build/modmake.rules.in b/build/modmake.rules.in index 51923ec3dd..f0db222f71 100644 --- a/build/modmake.rules.in +++ b/build/modmake.rules.in @@ -80,9 +80,9 @@ TOUCH_TARGET=@TOUCH_TARGET@ MAKE_OPTS = `test -n "$(VERBOSE)" || echo -s` RECURSE_MODNAME=`pwd | sed -e 's|^.*/||'` RECURSE_SOURCEFILE=`if test -f "$$modname.cpp" -o -f "$(MODDIR)/$$modname.cpp"; then echo "$$modname.cpp"; else echo "$$modname.c"; fi` -RECURSE_OUR_DEPS=`test -z "$(WANT_CURL)" || if test ! -z "$(LIBCURL_DEPS)"; then echo $(CURLLA); fi ` -RECURSE_OUR_CFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL_CPPFLAGS) ; $(LOCAL_INSERT_CFLAGS) ` -RECURSE_OUR_LDFLAGS=`test -z "$(WANT_CURL)" || echo $(LIBCURL) ; $(LOCAL_INSERT_LDFLAGS) ` +RECURSE_OUR_DEPS= +RECURSE_OUR_CFLAGS=`$(LOCAL_INSERT_CFLAGS)` +RECURSE_OUR_LDFLAGS=`$(LOCAL_INSERT_LDFLAGS)` RECURSE_MODDIR=`if test -z $(MODDIR); then pwd | sed -e 's|$(switch_builddir)|$(switch_srcdir)|'; else echo $(MODDIR); fi` RECURSE_MAKE=+modname="$(RECURSE_MODNAME)" ; \ sourcefile="$(RECURSE_SOURCEFILE)" ; \ diff --git a/configure.in b/configure.in index 389e4985b6..50351d69d6 100644 --- a/configure.in +++ b/configure.in @@ -790,6 +790,11 @@ if test "$ac_cv_use_system_curl" != "yes" ; then LIBCURL_DEPS='${switch_builddir}/libs/curl/lib/libcurl.la' LIBCURL='${switch_builddir}/libs/curl/lib/libcurl.la' LIBCURL_CPPFLAGS='-I${switch_srcdir}/libs/curl/include' +else + AC_CHECK_LIB(curl, curl_global_init, have_curl=yes, have_curl=no) + if test "x$have_curl" = "xyes" ; then + APR_ADDTO(SWITCH_AM_LDFLAGS, -lcurl) + fi fi AC_SUBST(LIBCURL_DEPS) diff --git a/src/include/switch.h b/src/include/switch.h index de099f1b94..268243e989 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -137,6 +137,9 @@ #include "switch_odbc.h" #include "switch_json.h" #include "switch_limit.h" +#ifndef WIN32 +#include "switch_curl.h" +#endif #include diff --git a/src/mod/applications/mod_cidlookup/Makefile b/src/mod/applications/mod_cidlookup/Makefile index 5ffe1d8476..24790d0d39 100644 --- a/src/mod/applications/mod_cidlookup/Makefile +++ b/src/mod/applications/mod_cidlookup/Makefile @@ -1,4 +1,3 @@ -WANT_CURL=yes BASE=../../../.. include $(BASE)/build/modmake.rules diff --git a/src/mod/applications/mod_curl/Makefile b/src/mod/applications/mod_curl/Makefile index b276633355..6cae5a8595 100644 --- a/src/mod/applications/mod_curl/Makefile +++ b/src/mod/applications/mod_curl/Makefile @@ -1,6 +1,5 @@ json-c=json-c-0.9 BASE=../../../.. -WANT_CURL=yes JSON_DIR=$(switch_srcdir)/libs/$(json-c) JSON_BUILDDIR=$(switch_builddir)/libs/$(json-c) diff --git a/src/mod/applications/mod_memcache/Makefile b/src/mod/applications/mod_memcache/Makefile index 80c1d2b936..0f469ff9e2 100644 --- a/src/mod/applications/mod_memcache/Makefile +++ b/src/mod/applications/mod_memcache/Makefile @@ -1,8 +1,6 @@ MEMCACHED=libmemcached-0.32 BASE=../../../.. -WANT_CURL=yes - MEMCACHED_DIR=$(switch_srcdir)/libs/$(MEMCACHED) MEMCACHED_BUILDDIR=$(switch_builddir)/libs/$(MEMCACHED) diff --git a/src/mod/event_handlers/mod_json_cdr/Makefile b/src/mod/event_handlers/mod_json_cdr/Makefile index d5043e017d..1819f0a4c3 100644 --- a/src/mod/event_handlers/mod_json_cdr/Makefile +++ b/src/mod/event_handlers/mod_json_cdr/Makefile @@ -1,6 +1,5 @@ json-c=json-c-0.9 BASE=../../../.. -WANT_CURL=yes JSON_DIR=$(switch_srcdir)/libs/$(json-c) JSON_BUILDDIR=$(switch_builddir)/libs/$(json-c) diff --git a/src/mod/formats/mod_shout/Makefile b/src/mod/formats/mod_shout/Makefile index 7388bc0c67..50dc9d5b3a 100644 --- a/src/mod/formats/mod_shout/Makefile +++ b/src/mod/formats/mod_shout/Makefile @@ -3,8 +3,6 @@ SHOUT=libshout-2.2.2 MPG123=mpg123-1.13.2 BASE=../../../.. -WANT_CURL=yes - LAME_DIR=$(switch_srcdir)/libs/$(LAME) SHOUT_DIR=$(switch_srcdir)/libs/$(SHOUT) MPG123_DIR=$(switch_srcdir)/libs/$(MPG123) diff --git a/src/mod/formats/mod_shout/mod_shout.c b/src/mod/formats/mod_shout/mod_shout.c index 377cfe520c..c506e18933 100644 --- a/src/mod/formats/mod_shout/mod_shout.c +++ b/src/mod/formats/mod_shout/mod_shout.c @@ -1480,8 +1480,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load) supported_formats[0] = "shout"; supported_formats[1] = "mp3"; - curl_global_init(CURL_GLOBAL_ALL); - /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); file_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_FILE_INTERFACE); @@ -1507,7 +1505,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_shout_load) SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_shout_shutdown) { - curl_global_cleanup(); mpg123_exit(); return SWITCH_STATUS_SUCCESS; } diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 7341a2b1e1..30ec8789d6 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -2551,7 +2551,6 @@ static JSBool js_fetchurl_file(JSContext * cx, JSObject * obj, uintN argc, jsval url = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); filename = JS_GetStringBytes(JS_ValueToString(cx, argv[1])); - curl_global_init(CURL_GLOBAL_ALL); curl_handle = curl_easy_init(); if (!strncasecmp(url, "https", 5)) { curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); @@ -2600,7 +2599,6 @@ static JSBool js_fetchurl(JSContext * cx, JSObject * obj, uintN argc, jsval * ar JS_ValueToInt32(cx, argv[1], &buffer_size); } - curl_global_init(CURL_GLOBAL_ALL); curl_handle = curl_easy_init(); if (!strncasecmp(url, "https", 5)) { curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0); @@ -3803,8 +3801,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_spidermonkey_load) SWITCH_ADD_APP(app_interface, "javascript", "Launch JS ivr", "Run a javascript ivr on a channel", js_dp_function, "

o$GReupNRI^H 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�b2i(*>~X)q8F?Fv|_BTi4IWTt0N0jFLuu-dDh5d_I9Qg-?v_ zj5Qz&^xeEC6a|j>oQ)!Csz~WytIiMEajg(?Ss1;ed)l_;mDxpe(EO zFuP%SXQ^4SSzdSH^2U#Nq@FHRPVS_)p=hY}N*ONiu=az_xUZ12K53gAZC|7=$OcJINd_gCk+m-}|Y*Q&wr zY%H@^>mHVwVQFh?t2+F!{PF2%X86ug_)Zn;cwu3obW+6DWcb#<48P0s+$$hfX7DVWyBxi+`n2>GMGnm6yI;TH46vU(a$cfP=Tn zg^9h_)E+w}t^G(}$Mx<0{(i4>tQSLE zWOt2WK*kJiKEO3qx0mA+*|317bM}rX*>+K(e21YnX{Z`y{%vIfWf`JRgj^fDv>3$| zmKysT+Kfab=BN*3YVyT=%WR3h@02w%y{QZC7^1M^MTjEt#4#?N8(10lb7KwrXr*`u zgH#rKJBMAuRB;kzXQ*b{XZY&^@yIXf@Yfey+KeQdJerUj+@K;wO6RXZZ5T9%y$y=h zAVJ=Mt$l|LX90+!5i)x}#z^TkR5f~7pOGY+Z;8cV5zfh6^qD?38lHzZB+3=Z5G9{7 z5r4u)YD}ZbZol09mO0iCMM>DU6T(-dfG65!u=8Lb4rk~NXOYdvAL7zRs&<;~=VQXN zi&N4!iNke_2ZKW94Y0D?c{?Gtuv0_gH$O1#(fwu8y1|zo1B#!nEmbU0K^Hw44v6l> zFV%0rV}idjQ!Vs-S!x3FpjLtng(1;NQqI(;e1#GveKN@aO#;j*HjlK_T>w$85WlE18id7CP^CNK8g11T00D-hevASZav!g&hb)*W_qA%X98^t z`dJ-~ys2&2-{K9-if(4}I&oxH3C>SZVVMR29sy zRoVsN5C9s$eY~$#Gyd@GBBerSW$_rpj62pH0@wa8EG^M`aB}W2LbD=A#!HRR!^&K~$edpgFh6WV1 zCPRT`?7F=&BgVgx?%Uo#A*M38Y1Yl;44r6s@-&Dh`+Ky%1IB-uxTCI%HD(x)!^3U7 zx)Wuugv~beXs*2ja_%f|W6&4UKLc*#YUcNkrX|_|Y*=MVZFl0@LhU>QvL@C^wkvzX z-G=q~Fcx#13||CMpQImx{yfAoqxl?Rzz+76sW%*6CI-9_3Yz-+Yi{(Ao)`Drp$UfzenaQ59ce< z<0=fTO@15G3xgV%R(ur^MNfM4T_`fhEu?Ov#mfWN+}J?i-xBoY2vEQG$O$ejw(9Ix zX;mkw12i_?1=xEL&9{T_2=Lo3Icvg~(dasRhhVfD>CE$+Q`x?kot5RDFp%tU0l;IB zl@Z=@IkomFB7{#>RcW}+4{^&_bFUjm2c18W{2b zSp#;nNlDXIaC<`h>U=&K{qmB&5IC~}@Uz_9yy<^-B^Lklhc@yZLuIbP&$)Z(Uw8u% z&vXsmimPaUGqQJ`Wv@$5tcY^LLs-;qQ~)FSpyZ22{G^stf+0$^hN|eo;;+skB0M~(79Ab4m6HuHwpZhiFUBVy zM}&nEzsxbHg+t(5*XH`BYGVW&L}Y}|^^nUaE4f#oc18F7Hw8HguEvv?*&|{_R;e5y zecprWhB0DS-`kGq0g0TF9gzG`3U<-FKc(Q)v=n{r*;6}1h5AIoCY1&yY_@l}FviMs z5PxWvUU_N0OxK}`eGi8a(;0Xmi3z-^+aZnQRAT2)2TJ4&!?QF)EhzErm)+bnsi$5E zpN$6LH{B6|v2+@*-S`|>xK5N!P2M`D1RCAf;v#fzRqZy`P*-_$pKNrr2Xsdf9I-D% z)KlQb%v^LD^E8wcMM8YHX_b3m)L3zo`&#MC!ijt(ab>E#=NI42MQ*=Sc5_k@ca+ds ziZL=CC)UB{>jqX+)>bdZi%^$Nc*1@ZIG0T`T&H+a0pYZg;(cbz;#yN7K>ooHkL}UZ zZcHMUhj!lPU|0}-ZDQE#EIS;lljlbJK`&0rogej2gE7FqoL2<77AbpVGB~3*YgU3yZI5DCHPoT?S1t|0L0geH$w=cN}q3SBQ!6g>-LLMv-g#zG&8f z*kGaf+aDgv8w@DmIbJShj+MdnGn#h$7Ko$&rJJFmzjBn1`Flc7L7el9jG7^a7q%-r z_LEA@N=g|^&cT%sz-fyfCbfPRGXDXgYH6PGjWg`6y#trZZehG#P0GDkty!Nl^**6@ zx1PV$I*NZK8!6?s;*R?$XM@=F@s`bZ8Cd(B*pEPO1QXpOr}qKTYOWVm{91jnF83&{ zqAw9>0hE8&T2WdK;N=F(G5#82w|u|nto$X4;CKuOX!gL{w2s~%_xM%G1y}4***U12 z5SjIQ9d#Qaoy14R>RM2afXn`$);eR-x{luQ8wZ`cFI-G-#MsU!-86=(B6)ulyfXqh zzncdvi|3!lK1nz<2~(x8lHuiZApP+b@8F3Z=LV zu(m|Lk*$1!kac1`{|~Y2AY{*gt8@kAXtWZc_~Q%9vB7Ad*j1KEJ;-jwF z|Cz{Ba-#%A$_3! zP_BVfP>bPbiKX*%(a=vW$O7#e_E+90#o9noV9NXB!1)nLn9TMK*_~mik!6jln2ine zp#I0+={ao<1Y5v6LD%wJdfIIwgTlC^Ftg2ePr@UfIPctGd-Fl4}TGC;|HFBM8?v&V(D{#j_r0!GY{7+o_6l9PhuT<{g#B@Gn+1o8T%6W7SNP zDfanng@{w26;77D;&~&ce=ld&#dM}>zjREW7x`$*?~&H^g>RN^XP^(N`t^%RHJA9s zk3SaQMobHh#Kl0@_Gh-yz+m%QLo5kxc2u)XDC@(z)T9e_%C*?ct6_j#c zd02>@`3b)Xs1kA`M0$TQ@btZswh$lPxWiYNCN@8RO+Qvg_>xR5dlO8=v+s-y{UGhQ z{ouseN=%QA0EG33=<*eEUeA~@`+iXWV$*!dPnshhIwoFRD)?r8wcW)1+d2>Q2AEL3 z1?f_G{jdMza+~5t2XR`xX78tlj>^KMVv*xk|sT@T_B5EjR{ZVE-nBn)?5FNd$OXc+H3FFosAIb zKIBPylL54g#Rb>B+dHKV55L(MKP3At`RRyv=byzHqt+$Fs9uk>u}M{IE%y|VL4n~ zU382Mp~N~MSZLn#xoX?A8&S%wMj~BxC(zE?D1gKIb!Plfo^5uPZ+Jm}OA9sVL}3eK zt!HjW5!hchhj!BH`G-E%H3G*ZUM*47+c`cgYSuI^@z;Z5NtQ*&@eBVhDk3W>ct^5)8JjB`UzWs6_WA7xHQenyj$cC{5EsfLTrG$TF+$k9ECW>FHr1 zPWW{~Mp%nTT-{_9!7&QjYN;?EfA7DCHbXeC$$bs(!gWwgz$tI-e@`1lKc#|38p_^! z`P&ecv>f+};w^X2fC@fY?Iro02KFtE16x>3(#i)!SwX+_L%!H$F$)t%lMz3g@kbVh zFq3icjreiC3#y>33xB!`&(3pYQhkudB}v$DIe4|#60t@9mDs(@1*HL&R9cQ@O~w89 zO6MS!RO;$C{(S1{VC8D?Y9o`@nb&|E5|?|rsBhC2wB*2k#;{_I{E#-uMH*2vwNa`E1kc(dhXz` zB=Gp8m*%{krhR+ermnQ?H1=NTLT|c&(n+e)`(nO4z=8$Xz1X?Cg#P_G;JfA}8)H*0 zvHg!2HM#{^Al@-7f3Z&@(|}CvGjP6BE@L^y5puM%iy|mR$hUt=pL4!`f-H`KYQaRl z^A#d_-`tNkO43-6dZz}Z&qweV+!v-EduLY>U(o&_4cPFghEyONAGAfenpK2YKc4dg z!dVkY!a5|kxb}`yX^G=RG;Cp!&U{Xkit{i-La(QSOS}kz4>bs=DDWq#>3k9@N2Y-0 z2IHd?<5-Za90nypRVaVd&%6oL*pKbw?xmKhrOc-pWh%$yihaYoYAlK@pYxsLeQiwP z;!bYY|Et&u$tddqYBpbruA?~X>ahn{XL|N92v3GLy)ydFsPVfoDfzA`8JSXoQsh2y zMe#SBhyp#H4~mruC24ds<->K=nfca{2v2y7pb3#I*|jmJM`0h6v|}osJ|EoIDDDY< zDfBb7aY?pF=N6W>^Of;?Yv1A8N38R&6!0Vq9%`nqlEkntKdVFd3Lxf6z~@S}BjH9b znLh4$=p%K>!o{ zq?@_lX}`EEG615w1fq0T6S#Xw1frp+p__mRGlV{^CDAqA&%Sa0m8h;xIjkfy_?04w5kp))yT}Wm&Ael zk}5T@+|Z(*o_^n$0d%Rra6_{@LBM5C*4eX&sALSOJnb0;XL8cTxLUFOw9nvx_5|eF z2!aFp{+;+JSU+WB891T>_Y^ouC7j&QY~5&CS;?RUNeOIhpMf2cMs5H|^zfJ(6ahOI zaPk1c4b4Abi5evIDitQN$sKgOqXGs@)`GDS779|e*K!h>R@RUgLk*_hrjlvip9 zo$^qSX~-VaeUK6O#IuL2b-cF&$lU-PUaHul%CV7+g@XKUkAaw-RO2GXcjZA{QO~Y8 zc?JQZFf<@E)jV>90c5$k7tqF~Rk%8V94{y#gImt#h*7Kw{e8NyU0V8!QEo?lp=m7$ zd))M%MClFhKV;W?5ajLj6*z8So8JG^#b-xd)R6!LgXx|Dr$OZ!$Y)H>4W*oQhV-1z zmv&dPy62*EBA$3^!IwXcoiDF-)2i;D-0pXM3t1^%vCkJk{S6$<793EGw@F_Hr9;}k zkEfMa$N6-2^u6soPz~gj+Rl$RZ)<{lvC#GYR7gGuD0+Yg&%`sqPdbzvL}*Rt2RoOO zQ=oaWn^C4D*#gP1=+!4Hbp8b-ekhHAzQQF4 z$>u5=4_~R(S4e;Y2L`3x`4yPJSjD=1zPdCdNMC#*O`dwJ$re(~9(b?H_TuLnPbAYm zFl|8cSB7#ToGzOA`EsRCrmQ6+4((P7c?NU%2e2UR@lsPiy9fbLN|5v(9_p_}`ya?Z z0S|YMi7)GZb1XH85|Ow`b!%5_Y#+2IHO3yAO6rZhcejN>DrR;sKty=iU%9dO75sfH zd(!0L=iL$K5$BuFLLwgu^D&sdm17_a0i~O+$wNLWJK`dozq-@soQYM6y$*y%y-kV3$ppIQWTP*%Ws??fDA zUM^n!Sud~tdx|+}IsqiOScx8*ke4WuMIna4p;oLm;_%tk`q0IAE=AY#fPeruw~hJv zJlpD)ssxdGj}RA^H86r&U*QnuI2cLipBWLW@qz2P>Sy!wA}}AK?F8(b)6>)Axk^FG-MCTD;ZmY)?9bs&WN_fAX zum|+po?YmKQPQwkwtV}Y=^vV3Rzfh7A?Po~x#on=l4zm*P5;h!U$M!B$ zgoM(%+NrJXQJ$F6H@>~RAVNPM?2j$$>IEAtufF)(VaaWru+!FH^!#$i-dVlBwUV`B zab8P<@zPQQYquO{&=MV1CN$Lqw=hc8pv$wOpvvNK@HOY^6$?w|8C&RN`P@;@PPNER zsr;(R0l`@yzI#o~>D@ZRd}@#P2Y( zvoL;qatG!pribSG@kJgTw(s|Ge*k8kgA_kzax@nZ3U%n`?%80UohCJrvlv&ie5k=U za*Px7^{R7^Dr7@w%vDYYc=RjSF#LCd2**3T-y>t;5Z_}~`XZ98j2%Rqsazak$p1#n zZP^Bx^=T5RZ*MQLO3XHhKnS8Ycj4G~-jem#m|jsrHA5GFbvs+nsFjD&q^_$4`HZ}J z`#{PcfgS%tJ3`6A!qc8e(P(;fd8mS8H2ys6_qZ{1(d1l6mo+5v$W+?12Lqm$xjJw$ zN{(9ZVBu?V5IgC}#da+BM6n!Yz>w<6aH^M5SHlpC-&xgO+MwUQYRE)1G!<5^&RO8D_?i*ryl~Mrf_Ip1t z9Y^flM^g+h@K^-Zj}bN9fLvD|p3#sbE&0ae)S*sX*9-l+0P{lv-`{hJb9*|v;@9zB zTg_q5|9nkVA$f7-x)V_yQjTd6Icjrllus&0pWC*r^oLj-r?`$>YzCP*c(#ddi*Kue zn?u1~I<5JsKkSr32=C0@k#LwJw)Zi%@Hc0;T*qo;A|pnZd(k|#nkDqAZ*RA)r7GCG zPPrpo(<7A!k%>PO|D6-P6dNpkuvEm34~WCt+|^WL-(N^wCvaO^#nRnnpWMxhy{M8n zkGxlX*7k=R@0n`5<{=i95E{Thi3=~>qfNVstDc=~2nzV!s+k~}^w^cAde^h%LMz;s zJ#)#&I;qcFMyUJ0MwZMS%^(0_lY6+viv3(Hr)A+wX!!KSs06;7Nc3tll za%#OWq*d@XE^*G~JjXLPy~n2C37fQG&Q3gbGoiY6c6P1-VP`)R1del?@{C~7vaR&; z`Ov2yQ8IZl|8y*LM@vb2E1r3qs~REY_u*g|%FGxX0@|ll1-z%xq4A~prrN-clBbhb zX-NFqEC6s~t#pHzfH#;c?Z;2j;mt+pn-~L(0KD1pO=@9W5he;#7V_+4Q(lzQMo<Sb#%&8-M&g%sTRE}M&cz!&xE)O+?ls_i_Z~cA+-BLDK#3hL@OLTzY8q|B zpqjOO>7p={^a~S96nJ=8r`1LYlfyl(%eXF8R*{!lbOD%$zX)RhN&s8b>hls~TinT| zjG|#Eu$<{JEd++E%*D&VRl)BwxXYcM#Kaa#m1)MJZ=#yB8-tm@hCqobwf15yls11S z5wlpEJTQzo^Q<9GE+~mlgh>}lj7Pu0j9}(s-6rt2QI(2?j;5IrFMl>XW51Pj8YfjA z#fkzWge2o3;xKDD@IU%v8kgVS_s$GmMr|EMokP(to3&Kyfngfp|5F5mNS>9TSYgt7 z|2+g7TT@LAm%Rj!dLFDaZR+_CTKuS^IfdFpRUWm90Z*6e_cm`QRBdy48K6{X`(Y4^Yc#6 znXyD(UO~D-Tulhvu0pRhiFN23!|R0)y+jFjPf{Z9sbv3E6yRkU|%wH6>GD%&?_XnepP8#gFnae9Y1Xe=S zYl-isIDYtk^g1Po;O%2&D-WCT~_Z8*$NnbA5iU96R>g*ARO5!_|_G5!^EAM?F6)ZL)$BSS9N zAsv!_GKERx#T&s>09V!r<~WZy8*mj*;CUANHekwNvm=cW$PWa9IQzmG#sX`q*e4F< zTv=gi`FLMZ$|uY%(OtSLKSSnCBwc-B1^IaGHOk=H?QBH8_ou@>>&d!flYeV9^=l9dj#dRgtpM+{@r`Z6uS z(KT7JhA9%X_iQH&bChuGMM(Z~KVj!U)Ndr$MPuBYK9WXIWGTyF^HajUIGwosOEy5Y zr5qij2$`s-}>X-?bq_o+MI4u`@DseUk;K|FcqcY=?^0QWQ8)mf$e zX$B;%`qTU;KOAWexT_0jB8)x?R1>N=mfVS(?{LjVAa}2f?iO9^LHp2nm^3O@N_oC3@hkTR9I4P7o{T~2**3XaUG1zE^yL9l> zB@d9J(L^sA^S(9Yz3Qe?gWub#h=6`qa?i0T^KJ!zIuT)36#1FAbr)&@#LPTx_O&jM zugvs>2YmlpnJc^-IP`RJqaRaGwMl;cV#h4ju)l4YY0x=I0=wRzKWoKvM+O=pV4G|* z>m~--fUL+81fAmYYQB%(!jxcC;LY9r1#LVg6L2m?^rgjQOjd%ALiv{Ahj_KvS@4ED z;=Q^qpki^n1p@Y=@ivzH!abEc*B?AooOcRvVm|NtL@PdS`Yj7~{if4B`9LFt_Tt_4 zgIEN(P#i%Aa~}4-AHSauu6joGKj?6Eu1Rj>1$7bRd5WjPm2qse%uC9pwvyp>m6_x^ z_G&=qL-^KsU5$(M%M>#I9PgiqMJ9&~5q}xWu#S{+E6$k46_~qiq&v?JaB{c2%!k?b>_0(|HSx)Fx{w{FyCI={r(q z*uputvMYgMw_(Mv!3g0ypfr_+X_{63r%ucsi?h13{*V%R9?9V+2CHTm&8D%a_{Uk7 z1QE-CU;Qrcp(gn_Y*(7J>0(-Mh|uy9Jk+4E{6}GVuVzulC??S0|;IxW$8n}%A%(w3n zm52(klGt#6hQDkB?j(T^R?)uYrJDfQ;Jm@>gMoHs&*=#|j4nhdwfp%&^06P#xDC*1 zfy-*mtd6bwC%Bx3`UMhaXfEsdIDn02>ps}aTJwRgGx?OkR zVS}@Nvw-BGKpwsbHU7!yl@Q~4oF+8B`_+j2^nnzz<+EpN7Q%g|^j%*D^1v)fX4}dP zQq*?}lirqHJVr;-3A)@VMMhQ-ObDxW#nT_^FdZhT#UqKRY*6S6Wfk99sqF}-0$rvd zUw}@Mk4sLY`lj-UioeHv+Z{I>f=lba4f>9V#@~y3fa;4?7d8~&a4`V5>WPe!*MiC4 z3xt0T`*lLK22LXiadf6SZgsR@NmtW+(qF78y594Ac@W`0bSKF#z$oBt zDxLpQ5SSPP4~4>T1D3O0kEu}f9C$d{(f-eshV<1BVZhCc?S9aWuuGdKCn@NofHhn_ zeE-p?gRhA3D*buo23s-l(Ibp8bh>M*o{E=(aaS~8<7yQ!)5I#Dd$*P(HV{ zx}HeV>txZ2(^Tz#!k{BKeW(qFO`jndDFYn%uy(N&Td7y_0L7S&{>F0Ax`-A92MG@v z1%-TS-+#I&25cwX<1FgqF5!)9**y{8D5Sa-RtxnG`GoYp_RP6LhlzR4);@UDR7NAy zucqDTOo6pa#`&yBru6r-Rr*;dH(FuuKuO;#k9bRGK=nTCuMgC2<52fsy+&&*@mri6 z3J5b!`Zq-T9FY78uWrRoae4J`8P62U@L61bvn7oLuc1V~KXeV!^8G1>szxbCG(9j! zWna#Ejh?;tZ3rG(nJ1U#@#`)x8@+mRfDO%g26<=$rJ{M}3$l)Hb3}=;$n!FS_MV=j zNGm%LS(sO6eQwr;)*Pp8xh5|(M}xCutcp1p$!27=78yaKF0fP3ZPzuReFJP1efPhKjS zZ`KAg+OdQMEBxS`d_7g)#EV@QBs6P`#~|Plz}@*}vJlM3c-7GdpLsu$iv1D1#;bBG zU@bY!DW(G+8fM?5vi>pJGFffaS6cbegYQd=zK^5t1$Q z=+rbu-O;B;4F!hQ5-?5R7Qy9RPyrscWOB3b`VpTU9&32VaTEQcGQKnjARLzuOEOgx(KMI< zzeW#VqDCI^+rf+madBmU5Xn1(i@;erZ?2(ej14-H5nDi(tYUx)xWU&5H`mqxTP9O? zt;IKQI?hq#H3_I6~@-V_pcUFRynm?oN&pC z4a-<>71yEMU#P}+=tv6qwuD~~`nDKC2gU|s08#O*A$NH5@*`)Q_|Rv1xp8jS{^J~~_F5Up%%tf?tb#Z-$4yll{#a%gD54Vk1FC*AG*1XPd z9t7Q?S6!dX#eZP>(K%@K`0d@$jAnN1x-is{wq-|Hd?g%KLA4v&J;THj=lMeU;>E`v zkuIOG`-%-B<<$3i9yMsnBHDBDRhW~*XCs+lZ7D>*=TKJgd1{1No`%kY%$|S6d@_Nh zFTe}@%$7m?JL%_m*=UaaD4ffnE}(9UGeBjRH+#cK;#8mDX`FuxXN3vE>|&hYp+Qv3 zOr1wCdV1vI?V#tQ^znX(s!vZ`W<4w(w z%%Z9@m2I0Im`*WJt;|UaJB2tukNH{1AnOUYu%(*8JahJ*5G|B6i@iw)?{EJmk{z6Y zwy%(L#5JE8)(RYw*(gHPAhPKEK6M*HhrmW*rj`u7Si@ZWcB|5!DzOpG3>mhg9w5zU zv3QCoLXN=VYVXPjogTqPS2sJs+C}B`gs3Cv$EIQ0zvzJOz6j1nBmQgQ%teKQSzZRS z`2%Yc^Qs=e4bG-?)0o=CAU0aLfx4unx&bvN8aHsa&c-Z29ka3k>XE4iBT}%HEq4OD zS$5V0H8(>GfResp$t>6eM~1nV!IkJQ<r2(5_M>70n#QMM`^6-B>hq4>J z>NREg7@(xD*nOHmy~Q`Sj5W-xi_iXZlRDA)PtXryd1I^MRIuJgP*U4eAY>!u^JSNB zF0y(k4O_=?^l>iU1KuoCdqI&!@fJ=G_2`acGc|!jT~v}_mKVV){t*9;JUMr`!r5Y* z#Tnqbhq6Q7x-v59zSyXcdx(3a*pQC(W^iSk@%yU{BblsPQEfP`C$0Add6q_qkIRXB zbNJ$*;>;jjR~m|AS-__)wRTS+#<(#IC#KeOD8Eq$yRHqLX0j8uyJ-7#|E02(^E7Nq zmHYj^Idv-HGa9cDc@!0DU*rjS!^O_l_PtgC^~%@hLVyD%`Sc^YY5-*Al)iWsFEnBZ zOQx@+uZ)#3(44@{GARloEv>gahl(1{QUl=OjW45764SSt(} z#o8mMm$}IPq?Arrt-3|=&L)t!wG|LwJ%)}n+koeCxv1fV=g({v1T{bjvHa~#*OAI5S2Ti6Q)4%O`x|H&j@0~s3vvCFBQ|g-~QYG4ZH7=oe=x+AA2uI}MN6)&>pNxJG zHywAk?r-+R%~xRa%Rn*Kp2U6yknGb$my2;E+S^R84h3pk@(OKzjxx6;vR<=3L6b2* zFy)vy3?y6a8gAgl7+qLe(Zxf?$zg1DC3T~cu3LwZ%P*P_wkBuLP_8t%Q}K>cG@4_K z=EWGxq`)Lw>pArqY&62U1ZI5$tPQAql0K6+j_s;wHiHf7;rhlT4NXBQi&vgfqe)PO zoD0t1n$dIFm>S0X`=?5@fC@PHWi)JjCq0VMm{E6nN*wFiWI2eD0285&B+m zSu+4ObO~|EpGgr!^*OUPXEpdfG8`bhkd8ucc#5xV#1aY43gTrZ6 zANF;*B(tOBLcEJ%tJBsS5^^bM1IV!0iX_Z-pk4>Xni1TIc29P;r)FA%Skq8-+D6Gxtx zXp0scf%TJA+N$=`LrP8a-&J;|LY(DRF1~iT_YqvkF%K{qQq5>IksF+a+;4Nh*`xkc z?>8w>SK}Sy=fHMBJHB+oV`k#}|I2^Xi*F<%U57;xu9EZpA=;2(Au^(WsdMquq-OI5 z*N`SnCXG$s(7Q0%Ep|47JnD~hlSEk!S`YPJ&?2whP;>YCeHXAf(2Q;`H7YD~%-*`j zZq5a_SGNIvu<@_lf88e0Tf0O{>buBa&W*6LcU8X!mk=P0`+xa{+lX;3u} zO$Q#f+lVL;su%OWqR7=MPG8jVEHU*e-JuXtsoLI;5IwUKeO_m$neF7r>JiOmL%5iK zGFnJ_eanb|uHDQzbU_&6Vqz(P2}4Z}o|lCm<9fH#)a6!G!ChP!Yc?6*)WOE)k+(Y`ORvt7SH5fs3_N0qH3` zGz$%i6B@3Zxz%;C_QQ=;9+*o${?nB?7Nix<1itU8{nn3J%N0I7*vv^&f?cOvZaCnf z<}E56FXqz6{P5u%S~YEZL|=_Qui9`$blMI&eFt|3BMsk=YEy2D|IHio=vHPDO|! z2J4#@tV%3LtHn9SWe(3?_=Cw>|MX*77HP(YJH8x6#BKUS)5RuG^%wD z8Ezb@IC4=GX%2g^s$Rc!1`BRIc3?-P0h>LX=+2$60m*}tU~zpujY;g?vgUQz8br9> z=Ek-GlvG>!6^HylX*XrA92oHyI+<_No7bcFeH)|tM+BkwWR) z$_-KOieJBCL|fkldCcg$?6DLG9zw{>OT$j|f?U1BEx=}}_32m$^MTRT7-d51;JA(a zw$P74Tk$ZM)bShd)8au7xH}~E-ppog5tT4-Bxpk&U(?igCpgx;&bCyPyKzk0#IaBj zZb2>w#1**3fVw`B0$XU{iVYz)G$#C*)k6^6PwR*K)y{y?NXYR*@)v-sgR3XudPl|k z>)W5S`TshkYt7|k`SrH5`qF>UG7D3&e-hnHxHiIE2y z-%Jf8W4d?_=6GXZ=II{bV)`xN4w>;9{^g}Dj0bAJ;@xQ{vrV!1=P6&shLK@!W3ysa z{|3j{)Rb>~^P1zDkqzR|hB@rID&gjg$#v|O;LXpFn7nrBjZ62#f!%|Hfb{+yKmT_d zy6-9h^D^TX*4*5Yd>3U9y|@5i0Y|(a(RW42BoMHaJfHYvM-HLkn&q&+tFCDNBf}8~ zt}{RSc=XPH_?PFK#cE@R#||{8{edWe3DbA~6Pg2o%}jp@qJM(IA-Iees>!&OQjw&8m$i6I!;;4V^%! zCCOyT-hUDl*!?gJjegULvqJ#%%TBkv5MJV*vaMN2I$MWt<^JE29+U!0O&pjHN;Ik~ zzg=|gG<3>ApNB?R;dC(Zs4h$v(YIA;N}$ygCvm7EXaAdqbwJl_u9v$&foV-T;L0X% znDLtmrjCg9%Y-P{+yW&I8du^#u#3rTr1Q6rjI>~QWf7TezaY~vA3#t1s+Cha z5Frpu4PZl1_;s`O-FDxhX9P{mHQluILkE___PkWop3#_Gf2{`S@Dr9SgHY9a^Lrap z3J=XdSHvz4umA4pn!^;v)Bsg`j0&7w;YP*|4C>#pJQbIAb>pmBrJ^qREB}i6myLEL z=1dB;)(oRD!*JEtwNVNu75n#{;*JG;Rj91l-K<7-@@0+lVM@+i>Z91Mj6K0k#ZyUg z#*X7lw!y6T=EUkg{O~%pr!)uDfH>jQC8<01X0OWy<^?iu*rHgJ@1X9pW`;+(c>bSV z7E_vUo>;__vZHM5eo18uY&Ix0d$;QxzRubja1YDcpW|%dh{m6vtzpp~_Z!aa&aT-K zStEa_t!7Xx%ZqZR6p{Bd*ZBu;7yFIULge&rU&npL>|k_bjj-MiM;**ih7F9HjUT0} zU(B)k_N3=ZQUIz0-2VzbY?rFbW@oiB+n!Twc!RprW4;WL`I370`PF4F!t7PAg}ORl zy6EJPEka4T^!CMC(M|so?OLZ#FT2bIN5>9rPnTcX_hQ#QU_*m-=8rYSbmK{XT;Xbc z6BNV4zx5N$gKc+Yi#c*XV|B6{fxn`D3LHvQ1G3vN)%`}X+<1n}R$)T0S*Gc45{Pg0`|s2CRbPxX zrJb^-VgJd%raEgQrC{wa2WVhkRYRVc5l)d_C#26=@ z^yEX$eE3$|;>QIZ(DCBY!g~gu(t-Ry&hHK1`*dT6nU~69Wr$Bcw$mK&aOWv~qpt=v z_ij0YooNIa_GtD2n=eQCkUW&R5Qgl2Y7C9=CERvJxZWg$!?MWkP=MNX{hu60fQsvy zGJ`sQ`Z>9EB@pu;TFw_a9Z9?TdIr)q3t?qTUj=?$8DUfhP4cy}S@4GoDTY@TB!BL_ zxYSRS-3TJ^{Ty7#`<_VP8ylJyelEdtNz@7$O72Wk_s7!nOFzR2a);+)jLkwb-Vf=dT+Kbbey0W;jY z1%|U<%0sI1HQt>~NFbbs3|eQ!KKDq_E$yHxaAIZRsIj{y<_^aAggHFmC6V86Zs0Q(i(YNjQQ8^e>yicnOp@u()vlB{CmD4klsZP+dEF8Pl1tQ;2cu_icaS zao+!Gt&i-~Im!h-afI{?RDfyR^&NcNo8J$Ug#vISzgj=Q-Nj}?|#Z;{WlWr$X4 zC}AGD`)q>@7#I_Cgs{qK6CfMsoz9;;37eZ`6nq+%)G=G1BbN6f7e9icpJyUI!Wf|T zRU1q_r=JAOnu<$1&XwthdkbBDF6l*b?wBs?`$#<$R1I;-RKb9}e<8X7yB>2GQ)PqK zG2O@tV*EAS#87Mg(lmr+>no|sl9KLl-zVrlW(=YuhmA?oJx8+Hy>z1Be@laPrvR3KbWwhWNtr<&^Q@ty(+aC^XQ}knbcFyOUzJ(Y3f@`Km}6680RDq;7z|E zMzTn5y?17f|AWH<;;22x0jKnp6m(v18;-?}@qoqiTsjp33BdQgtOi~L$r5RaPtX=+ zb-_BIN*b*TOaJ0Tsm#)edk^+k_MW(JhVz9j{sC-P_8u!01IsIHwogrb_-G9IP{>(w z;gL$86Q9fR?C^RbH5GQNkdJwHba0DzEck{T^Na!lomVI_Gyp7weCfIOS`Zq+J$Y%f zDayb56~b-WWTa##G#Vr>^|DkR8}md)D(fQi%kmk zHSZqAT%N&)+Y;Dd%L}uZ!tLrx%E0?X0#Bt>+Tf*3^kD(Qhk2377KBUzCp;y-TV~A^G9-e|BZejuF-}& zEyVuh)9j13f`ypXa+i`<<;Rp(ftFa=XC$l>vlI6kIr#a2QPz37{bzx^C->S_bdvAC ztq;{)+`cW&@CZNx`t`Sk$GH%B`vmLOfdovwD(k0HsrP+Rp?B$ul0!HblfP2@ANWYS z9@(`>lP^0kUtg`1jKr;es@B6qfWu4}9^%u6cFGlN8B*(v$MVSTE$Ul|Q zDWDn6sw(Da*~dEDH475eoXUz>a<61t@KD}$wQ|%;fB%>krNFdTT^s2e*@qWTh_J() zV0bXu81Dzud!M3^s=#C3>@bFG`HE>Va*U1bWSGcId87H*ii0{^e0fx7zLFFx+CUV+ zICHPECcM~_*Aq(_<;gyMM$*!fSaEk%gSKlw?iY%eVbLb)e&s)8ISg8Nm#yVo)JTl> zhWCmS>*SeV`NHG*EyHY_tQ_y@f6Z-_2hXO;Y^MNsX)Hhy`6Sq0|7mb`dfO<0%qT&X zC8EX$x-XD`nz?vV0@aGMjLh>)Lynm4;q`xZ-3;W%f2r&$Y>Jl}J5@_I{$LgnZN8|Z z|A*g|4mzzpJ`zh&0-4Y1zd9@fbCI=J*> zh0`9m$0cCbm*_t?u;@4;MQ7#+Uy%NO^xn_dth9Qt(MiYJ#I9+*)}7F|c~RC6{bVBT zmLd+B*Cn9>T+SB;skCK6o8zK^o`{_7|lv+n%e z_f^3F!>(wu#R6P=;o!;)O;zi9(g#No=z=rNQnVV>gx@ar(Rlr7KC*bn_{22a4;Hr2 z8$QxMTsX+PIww5z4dbrdalxh9c#2cxP9!^#-gigg3cDrwXPX8Y;*=EOe`D=@WbQU6 z>i9ndv=N)Oe)06&ufzza6X8^u1QJiSw$tGLs7V{Wt!y@cRW`WSsNs(yk`1v#h(p4{n^U@TmnN;-B5i0mXj$ zQ^F>k9_5!3rUu@~IVHM2r2?;w{LnI5*c59R0f@w4(>_>ku)D^rj&p{yf+ zSWjhYaX`$IvH*$iCU=@x_;Er!T4`%PH&+V&C@*mA(+?9fe*g#FzQHc8gbfa3OOe-Yi+ILDX@8} zwFznz)6stbzSehrl3j#v$6APV*pKy1@)7<7GM{zM;^@L$-v8SHRBkl+OsfFRU2 zzfi&}WyXbsc0!>IR&|xl@@;17{7IQk``z$^OlLPnznH7!lqq} zLUmu3U~`!4=c~Xl|GTQ=Bag#Kw-@xZY<7wn55WIW$|2!5prkVYuDLwG@})8*6i<@6 z)VshiScS<{qb$2S3fwdbvS7@-l|(goDnmM8RLQp}d(aIpwum3E!w|l&n^K85rqOri z+>_Yop2XiSmsf6R4Gv$qlj%Sx#+ab)riLtySH^(UOdipxvmiUNPa_isOQ^)*1(*R5 z;1Z;|cw{jpuep#U%J^=XO76|v>((=|yx!3%-d0>7MCD1_TBjtW5d~-Z(oocXcH_MO zSJN5C0+VB-NHd-mdziH@%+X}Z#QLB<)FY>{0iE@b5CcJ6)%bnk2n@@Air$TV0}qX~ zW6-4+mkW_mt4)`SqrGRR1OO>-}YnFL@c3PunWO z#{URP4(u?(ar8f>af;a7BW-JK58P$<}rXymUHgSWw~iNl*}PZ0d!=%1FcVZU;pVMH(Wh2c>6oTdar-u zZ}i98)cib{DhY$#i}v&kT+2E{YE5ZeNEZunjFc;e!w1K$D5FnRm@&bai%^ocRx@9* zd$F*^({L;MLYMr27?_N~e<04$bCdZ-j6JmdIxZ7=ux{Re{I7}cs+0@x&Ojz8e)*MI zxiOUpMcsOPv2+!xbB=C_25&s z4zwd{>YSS?&7q*FSzeJsO_5Dalt;6S%q_;*OjL_UbQG-BB9v~cTgfe~qz zc&XgWIA6>#{j^1R+YbQGY_#b6l5d7{pfZ{JH((Ag1>z{Zy9zo_C3?HqFxX!hvDIR> zj#S4G)wGSLgsz7-n$wo9OJ*i)Z~o+TYZoeysujv>q{i0P-zqRU@AR)pWaqUx{qd5Z-ew%7Zt^hn= z)rK*K`}WHjj)21Q@mna>UKf2$;Pk+SW#+hPqHl|P?3XI>JD-^`2MJLW!H-92fY5;| zQv)KnAEw!l9Uydhjf~ev)Bd`Br|ZP%ge)T;QC)e$Zh3xzv4a(E|7W(?StN3*V9U@Jj5o)Uz2{NKv{lp$?&8XO7;`*Ocv3W_ODbtX0di|OQRDgXbA|G#odjIU`9$nshMth@-|CJDVt7B?u zq4h)ydF~i`nQw*-l{T2jCM;EE`lKL+<{+11iL)k_Uj7FX4khal?!sD(9YhXZbOVvv zJrfiCa!7rP*rk%;kdh8*e+%r^V~=14k+wtoC*m=HNn7g{sLcZ`Iknt2_E_1G!tfD4Oj%j{jKD(f9F8(q~yx%?IT# z{32Ml_Nu?3(1O;vN?NDXWlH#!uWCj|pB$PCXpuj$p=|aCp!Yy{dXxgQlN3T6N-CM+ z1yk<Bk!` zLNKSy(5L7n@P;hH7ZwD|m&vve_}H5qGVv_^#5z0>Rsfr_!kHy3+4KR5q`*F+RPpp0 zS4--niYEd_xW~#j7?0m5&L!$!JhJqS?r$G8IdRApaegzC)fO)NR{}vZQ}g%k>k9PI zcE@##pY^lnpaS-i2mS6z=P}$(WpTYq;Q##Awt2dX)v(N30P zg8TBI{=^)|Y;~~tOv@Se=Ps%`MO7zf&+bsVh}A5qRQlp&MCUWDs1|e~xKrqj?j2OH zuYCbq&b~xh1(n9_6d)n>t&52XTtvIZ?pu*Ri*JpOH=y399c8-DwU{0o;wn+_7s2u9 zbV#QtV%l?#L5L4_8W$CtHN5Vxb3QCi%++sVK#gZSuCjcHG zP44k6fRh(o*Ouhe7?v;NwkL&QM*Zq-Z(|+E1e0IWzxVOI#5T~?EcLSHQ^^n2m%Ra1 zCt-xEPR!Jm-7K80ib87#vHIc*`EqGmMJO)ux=?x=uLYOhQJN9swju1@LAmnwg}jMU zOo^5s+p9#!2wvLkPouuFX^C^Kyj$<-k#})b@cn1#+r($zyZ~DSg`@)Tu!xje@_Jn2 zcCOrgyNl_YCl;;-Gs{G|nbnR9n?{GyI&Mi+R>%&Yf4T{@r%^f zDG|kr^dh|?Ee$jD#_UqyJwaAJTuOW@AQdvtn#ha2qC9P@pPFwLl|+acc~QU^aowm| zQ31n8*$HvCA#(AhDJzUv#}E5f*VE(!Wc>5d{Q=Cl=GKL*Mnx8@$A*g^9~q8Y4`6kk zr5uF0h7j&U+qK5?(3JUaKOyo1RYnkD_ze1KQvmc=;cb4#(3sDG25-JW$DZs`iUOMa zuMG}V_*Tkh-mVp^tjW1E;@4vAdf__(KP(q*vgM<2SSea+k0TP{5Bb4eBe zl+oT!tUGBcMcZhvnVMAl_wPSqTJebGWZo4^78tlxxEpYTa+A=2JI!d6{U@!*-o5-? z|0vz_6W)30CCm9N`DNv&qtTSE`7GRP_1?cW(8CL&PaMI~ZPwx2UW*{O*!_NM&q4A1dZjBOf`Hiveq^3z0KQ>I|DHFUE z)|{8pfh~jEFWEXI(>WY(b(!$gb^X{sN2Ppb9~9r7JhdB$%1*;@*IPSA9ab#dnV~3l zkOETmFHfM8bMX_XG)z_2#KHm5HbL5AVdBUa)=NxJbn_eZ#Z;kqKsuQA?DqMj$6nLR z9w=cA-IQGWX4)SqRIsi}z#naQXAZnS}hw`?~#GrI`0u`aU*Wxz&K;!E!>qsPubIHQjBg&9 zXYGglf^@YGuU~-`(2y4IDMq9B<=;lPLLPc*MGnRcSMK4aAivc?>cSMInD?!9c~O@U z2QN-N2zE2TJI8Ihf|Q-^^SQEV;VE`4+_jpUpO5{Z5ma#tGO~Vao4v9D&~2;k0*QI? z$!aTL#`B-}=2q^l4C0W~k#ANFiSB?TwS6CdJl{GRa}=sem~D&U;N#>O$SS!NEpf?Y z&Fk#^A4^3GZHN5{H}_qy@$rjGm+t7pR#)%Wg@PRlIlu@}*Q-#?vM;Is-KV66(49JZ z?+6~8mhbPj+Q851Q`g^*3xj{VFt^x+nk*1+UhzSOaW7(@p~P8A`>j7(gkOahV@Ugh z_QL->6ukU4_4OzItA(PsDW$&OjR2le3S#rOc>X+>3CYj48VpjrjywNvea$KIP!>hM z@GXV%Z07_sWaS4Uq}lxf9qQq>TLXiyOS(ubq{Wv4w@jx#Oi3tFJA%-?zM6HlLe5BN zM+(<RZ1YD#@rIY#d~Q2#BjFL)@ggo(yQ27Z_1!o~myn zzy=&LS>+F*Fvtp7DcipFh5SYJoM<3FpZtUPB(cc|rX~(iFXv{7uFP2PeCK)Sh^l6+ z2%*aK3n5jaDE0E6aV-T7hl?Z}6Ydwgd{9SALdUxo5>Ik%7qtabKnkY$ zTH_Xp48BhE>77|u6$;{>idz;odgBF<;(x4BJrLp;Pt4fpcswQ=Baq>;q(`{c(Z1ou zKXAcS398vVC7}SD5<`8%lnB?P$JENkE}Loau)Uguw0%mM-lLJnht6@vX^D1-x>_&zKyQ1 z0h#9GyAqo3Vn(eaiM5tWWlkRng7xGENDuJ_jO?}P4MY49o8yoynTd06k(#k|XN7FgRF+!|%xzJ@-? z!|&Jmx}WI2P>y>lska59iqbh^kj~E%6fzR}5Ed%5V58&^@e`#^p3 zpV9#bWoT`vx9wL$iW2!}H>@(o64&1U1Pe?2J>PQ@)khFMiGI}4*n=&~+4I6uL|6C; zd@!|nCi3jOPCb_^>RWGwn@Q)DAVPeq>&)j-5x{8Qi9QnbljFda^t+LPA9aIF`rG0} z_cxuvu0!S+tkzRl->llez+c-<3UGOC{bAd~fB5*1e&IyfHVwbfKO>&sN7gv4*53Vr zL)&Q|jNeb4JQyym6^p$q&3&0^;0Js^T<+f>VRm#EXiBb5E!Xoc&f7PFRiI96g+?(67l0qwE^ z`XyFq!$iOmx^1Xj$}X^*?5Chi?hN2UnG5hSrkXFtzF-GbFa7$pD?0LkE*vF} zt7NW)};Xa-$;>ha2@L~%g{2H?pE7WG|m;!<{e1F=DSiEQ6)Cg=rOAvi)zQle)!T;1yk^*n`Ma@7X@+M5}TDw~{*>cq-CmYlt-wW;U`w^{J-*ph#pJ`yNJ8)@+k??8P8M80#R( zK6Y7u$M?Q}&+GZ;c|CucvpDBm=UkuVdN0xdN4G^CXNfB?=K;t{y+-I<#D)w6cd)cKLM*Nl=Nu>*YUYoM?L{lUhs0tBdY>_eME7Glb=E zk1(;h{rqN#eYSedt$VNo((@Y+008dJt#fs$9TAGTW|{}_Vv=XuQVVAT>!s!m*NKQD z-D=0MA>w>Df=Li_(7~gI=%BL2YQ|kZC_pdnvK-k(kB3P(%&;Ck&-D!l_-SlHJj}jr z-Kig*((bfr^P{wzf0}mbl&Qp9mfMuvHw(u3NY@~Xb{@&3)= ziZkgAZfKUjKWNr?Ma9}IP0y*()m48Pk;22PU%%hHjKyv`xbvgv?rJphl?9YqZ;~EJ zl&PUNL2utC`~Pe7#2jFzF)A>>-lKXo(%<_aGde zzY=Tp!Al0fRVZDfGmQ|?8QMesNgi!+x0ZtLra0H6%9Wxdk-|v1bkw`P`V|w?Hl3%r z075oJ?rCJ;jKkS9V@xm&S7I#Jzf#NT=a`7v3p38i#>SZgpn+_=H&U=|=` ztaA7&nN5U-p-NZrIt&nzu?;w4i>i2+saM%d6bQGQKC>rjb;B(W5u5i_vki^&$|}y@ z3Vnv>#w^Xsr0hySl)S2KO3;5^rvBI|xfL=jpond^L=yg4f6>@t18V;UXUhp5Z7;LxV@9m6itYI6wh%RA) z%MXrRv%{H>v!F>6TF*pyx!0WSj%iNrQu_ZnmHwT>gQh{Vn?dq=n-cHD2PP1TcH%{A zeHc~W>=r9-dJ$hy3OP6DhsC+x9dry&c4%eb9o_sSV)QN{;%}6WYDi_(%;Ax4lt1y| zE@EKQ= zsp6J@pm`Be-~EMDUH_^Q+z4vb!AXgWYl%yJQKvUAB@1#~v%_W<@q72{oPLz%x&6Y> z9=}@AVqfCjZc=Y%29y9Ij-JP77M_ZG4*z9Zq7A?97^*?2yPw^^(D_t(9{RUcLKF=D zdukRYUlbf7!j;Tg-$rq0T)M&j2Lq~QN#~)MwoKd-A#7XJ=ac`n5!s4OpcF|(kQ=@W zAWa|zQcC*mojj4gAVMdiq|(XO3>3uHXBO%3Q?~Eye$rFbzDM2vEQI>l<^}Ea##eG4 zHo_8iK4KCr4q9mPrYIrXOSDH1f8+f8dxM39{x;taps*_4;94rx7#5k~N+&%@vu=}h zXuYmVw$Ln6$++zH@BZ2K?WE|I!eBXGH(2|n2!r`2wE+9juZhL4=FVx+A0`n!^>^l> z{5RwO35DZ7OFS~X`y?pFc}C>a(YMgGKl#zjqmsWC=Bgk6iE5arL4FPYX;VyQPYoP?Is1HJD&RKY@nOKcB(a9^O4&>EGJAwVEeWOxL;aI2?by&_ zmohS|$BA3+cBLl%j~I8GpXo!D_zUMH8L(!i8(%-Up}Rl6DtjI7RtEcxp%~?3|B}Ns zu%4b_dzC@`pYHmW7^HoPaQ|$IW*i`e%m+6-%&SW~gOFnRU1;otrjZIa8oA9nB%JGf zfF3>1v`IrFN@DwlqwV4$PEm7w+>X$!m{$#8ui+3r3p~--ieIezLm;nF*NI61M592= z2zikHO0q(oLwX2q^ZJ=pMSFQ9NzmfIHdmoWy-HVXd?D9)behsNXusaEnSNbpbubsqFyE&cLtiKVFNnOyJZ&xEAi$lgr9%>X;&P zsKsO280fp^%!K}sdD5#5&%)CYh|^4YsnANPc!c|4l;v(^x0+pv%O`-vGSZFR>~4DF zy6AYi^pzb!x4B2j`{8OB951ffS<_+5bP~!4FS09zQ?z9oR!8+(vm5ZQhkC3DiHge$ z{bTFVIC-7D*QQY8CFb6yv?=u>gnNx_(I;=Nr-@!a0E7oS zvFWX~mr#ZUYVjcBy8>{bD3XyZeDywnSvCe5cw4y)j@wM5Ozvfj*eI%9@L3%0pcx&;>(9LK`_NW~wSiM$? zGo@kAmb~|u^(S!kZq?!Q2G|{Q90j~~PRC*DR~X%Zd#`sF;_6Tc{0gxyvs}RCb)uU^ zvwon_E+zoV)rq|$KA^9}d!&iO!tPvc(@F2N7J+r0-Kc!u=)7Qkc%l=)*i0LmzjLBe zs!I1mKux%?(nfRzam2Rw^{A7mO|XM569hx*+j*k6kjA{b-z)MLXRe>HrKy2ed`__3mkGVmZhmRrYMLfA7y;h?#(biRfOd*wF`|*|Du7If|9|@mIGAb=%jXliI zT6UwM{5EaHp4Zjp*b6U8(y0YL6`*F36_kfU6ELZSI^wR4Nk)Co*}0x|VXCV4VCPoL zmuTs$u!GkqmF+8o{bBxh^*OKI_I!WAM`xxUQzR6$_?q@g>@Mi2cl@I(DB2OxaqrtKPcf18+^#LUNsW4UMiVWo(5K|+20pNlUIpi&JmBSCFk9BvTp95FYAci3GO+| zLS(kJo?b*M<83VKgC$N20N5>gOO)k%j1EPrbBZb@B4a=gY$L85H76v&+bhlT6OYY{ zImZtW-_F~>{46C(=C49-|8+$R!4?y%(HDgjE2IK0MVWN5RKMwu9-hzm^b+%3@#Azy zpFT4wq@}huN&3g{o{LsJY*+hZYE>$>O|vN6c1n%-JKpp1h<14_;`BteLWt-{sJ;Ks z-0GfW?$*4$#1vzL$Z34S!Y!WO0cNCq7TyWj8uRj)sw(~$%9=gqZ&HbSbYhWZFS~uau)ImN9G=D*Ipou7mA`GZ&>GwxuzUr(DH-&>#~s;EPy>JQcy5kmdd zs9d6ErW(PT_i&zOCg*5Z%tcT)i<2*`hLZR`AnnkfeLT)?R>UY?ZCtIQ=m#UXJlQn} zww&_Fu-vVq>Fou;=wg=Ez~2TP_n!Jj zQ><@(b!m6C9m(lAQL7?XO)Qdo0jIZOv{mVQMBvMJBc)p8gBLf(lJT)jT96;1Cwo&K zEtP(&0n%!mD*F`13DJ&irSwDA(t7@A(ZKPbYns5m0R5%T{Y0tC_*Lv?_|1E{kOS)< znQc}d8Q&{c6(H=-1?~RaZo@bLtHGUf?BizcuIG9_7knfd0{}v0AGIM(Zq~Jxw#Vct zbk2OvJrH=8S73=A>OX&ePv@ccn(id!hOmb=5?ub8-4r4?%LAco5TNU|z16wRSO5}> zEKID`c;o!{jel%f<9jsJl%*Hm)+P?42_Qu(#`{?=o zc^QV4Y8h`c{;W_R=HFB3%BMJ*A8J6SVyQXC--#t4rA_I!+WokMx$Lg=+neSse6vn_ z9K5-wTw&k08bDP-n0I+)Xt9NVw4lf;iGI&g8%-l z&Ey)_S{V}n&uKJK13&EPhO>=#A`Pj|U!PQZkZ?2PMEd(SM<uM=q%7F|%}-+^|LOFvh9=m$5xqr*n8)HC8CtMqYN=ipNPz5H za#JT*Lfj=kV+*{Jv!nSLdZv5agmQ8W^??RGw){x>z1jMGpquUtDU#kxcLtW?1%pzt z^_6IvU9OjAgPY8<)Bg~uv*^s5egX^zQDqJ_O3=&RU@upPN3}51Ti>ntl1GAl5S)65 zo{jAM+>aEc50K!}J5wbBqrr0K)JVBZfDXvXqoZXa16nz5tG+`8xcPj|(Zx+815FtC$GMRo#Vu!5CRey`AC^^lKsUpMzR|25_xf3j zxsU7P+`Dt++BGzPYTpfUXtgaq_OXF6I2&oPA2!DOs^`=|`_c|Yl*jZ|G+dLv;X;|0 zop2Uo>AyE^`;SG125dtiNa6UP54I8>gT}G)FJvLvA=~CnUDbvr1?4~VdO7zWh3g?v zlkU(sFAJO|C(1xiiIjnJpIW*S#f5br(q7+^fH1AEqHFA&q59eQLnN%-_MDH9h7uJj z_mDTfGuK@NseBW(jF4El25DdRw#$0H)|nU}HGOy20P=2z8s=vr(c8euJN`QavhwFT z#&3Qf;rd;cLG_uRA#^PpUsSzu3r;@Cu$^>s4z$)qyL$@)>*~e4N8Y(zOZ(2A9Vm_sJ<^#ufi~i5*ei=q(k9 z^?eue@5G7TEZBj2ZJh#dU7)U2zA^kX>m{dmK2W;LDJNApQ9~O4IU2Z2hDTB8lM72> z{d)zEBzczxh_6@)QpzCVFU7e-#80h4Z`Yf`5v-FN#-Ey$z1<2AAW8gVzMF+0-1j! zsDT2hEtY{RkJro`7V8VzPG6Tao~0Z@JVp)?xitxWy;K;22;bYb9R1}zb3y{8P5)h= z$O5+%sb0Z7L#Cy(uqnq-_3sd!6z5)+h8b7<5DSJwrZUmTJSC`S-(0vacl&RnverL$ z0_z7$`!h}WWCR~gud0((lYC*YU|t$%x-Wn#FS!CdB84fFL9nQjH@+&Py4Jo!{CU(y zBC8c}C%Eh9;4k|1RG=*Kou(d=lV*aqO@6ISF9kZ{UZ+jb# zt8^eh#5j8Uzl#ObEi6j_2zul?x18L50l^czn|_FDG+&Zx4J&i&CyG@DMO2eXr3Be|lxH6oVL{X;8dPRl`1LVTjj^Yxk(EB^xRoFUv@6>}2>SuPe)Zr1j*xJeaY z&7*So_y~a@B?vcv*`GV2>bZ|@o2G>OFO^`TUmy@%Ibq8;}Vj$%(VfyDvDW*R%$1(SCe%4}QeI5+#} zSTSZ3DcK%k97yPEe+oM=tuD-L5nu6yv<Uug`kJs^(70fQnFci zYRnHz4Kivz9{rXKkXRW)@^&;$OQyV{o23{}?eSqIK5T}EcBe*63fQ&MT%{@5w#QV+ zL7KJ&(UF_?p=OI3Lu;H8zT)0FsA`|{2C}>T2d6cw zuaK`%SPZrmT;ZNBlopf6FD6hJ#w10C5RI7^<1$r5SF{K=0X834yyq(8nV!C4JuQ0X z*lZa9o|SKrsFDmFDvR~+mJIWEqDS@Y_|c!MalTP=tmqX~;d^U4CE<7i2-$gis&O9< z2i+`7x8822Fk3k6yC6#0hkXlcArfhYA{%Sxm_|~c#qP0ccPtUZs_}aUY}FD zMK3Y)>0a_yq#9U~!n4yhnqd7Pz30^Yl=R6|?7pT$^b4YhCnE_W$+sgUT<@Fd9r00> za376-b76?^RCxH60xwvbz6CSGP@ClDt5b+7Qz?_>Ld^G=BhaBi^VAiBpX&}A<4(T0 zh*u1vpn|Cv5%e7ptYJFpN0<^6Wt+Zw8&WOWepn+E;I}^XM993!dVA{i{^TbWA{xQ$ z(IV{PV`pGh-Kacf)|j@XXQ4c}@%w1}pfPec@KLStf+K|P-nOd9k6@4Qr%;KLMr~Xr zTArYB8ri6Af2JnTjd?MO(uIqUsff4;oodNTc^VuG-LMcd;4xTAh4j><~t;SdpF>H&{n-aprfWH;ls!{|6KM2(&tFL z*z7n`4{vbzhe9WeH=_k6sSll}IJaZn&Uz}gZ(0-iQH`VQUa*2=l#k2KdMdJ ze~%Zl^lyy7Y6ChfZU>2I%xrHq%)?A=zxJZ&!2?vy*ITUsJ;OP7*nvl#Q#MI&sDgJ( zruAd!+T-f#h}?_0Qh#*cOCKic@U$O%WYU!101Jk=qnUKd)kN4Pews(yqq+ZFr8%;1W)FGj(m ziam$D8gCve-Ru+!p*tNHs5eE*UH>vq6JSie8gZBg=)RC=33_OoXkpjQWG%mAKi;l! z8E{{-$cand1~?3IH7*OylJ2m(4xhqM#lP=vHX0XQIc4S-kR+2#lylUaw7Jn}-`)nJ zf?8Cm8?DDYS z?1{!K(CQ7Mm=KzrjBcdj1&Dto0LD-tdx(Rz2<$?`wJ7M>p1O-ecv7Z1-PP?$xRiqy zU4GKD-v&CI6VsN@zoN)_xYS5{$RO4oG0DU5ED)qxxTV>V-j2=d(y(7=$ax%axE>{T z+lWB(a7F*H!`u&CPB(0qi*^WMl@h4v- z94&=I{)5P(QUzR~kcugGs~z^jr?~lFthF+_S$a6A zfmf-+6u@n0PV_HfIy!w!2aSEhUGji%<|*ki;K~~W6izInba84}YaJSUSJ;Z@qum4kE5DcwBfE!hoDtV|LIg(OF4<6_ z0n2ua9S&a2^2e3VwKIa;Y!^%)q;oiyjcI8X!{!^neth=HS)W8Z1!*7ZqV>dtTI={<9;rlyhka?Z1bREhEvI zQ*KN`Wc}NP!2~Y?ecTq=BLH_9D`t4O7{2W%Rc6V;06u!iJ;H*)*KwbWVOnJ7*xKw9 zdO%8{*On_DMQ)76h6Ho>`df)#F!_%Kw@B}cy8DZG7K{F9u@>Lr?2qbJeapzP6<$i5 z->Y00{OC2m9o6T=$vkfV?E9-LykW%1uYnrj#g6A!A?nkyXpNQp%sI!i82&9;xC1W8 zJ9bDJoxCQCaWp>UCM0ICsqXxJ2?@ofcb_mM48L&a9FzIiQfo2sAl`&eHdc3x>zq8kJkpT7Z%oa}O_R8)^ly8ICr0O;goIejd(#BA{oj#0 z4C-?th=_#SqIW&!B9~`LhbGSh@vX-!t27C)7Pk~J(R*ght8?Vs%)9-O5jd&7GY$Ss ziY?Oo^G2sEw=({?yFOo{wuRpFow)%n?Wk&^(r3Bm?xL2Z-n(s$=EuEn`yHo@ z(JZcG+tcSU9jCiaFWTtJcwR`o6-$jJtlT;#an|GHroM-eazFG{u@OQ#4ykl@ur2dRbp7HrfPbeiJW^@$2 zu+7T5Tm+%rJA&o#S+|xR+$zO5Gye80RMa_hXmTlR>CBey z`w-kTIrwr*JEw^$L}Xgo2XWSgJ{%-k42~4Q{kFQp(!n#cBy$zdPJxs`>Q0o)r+1M! zCTxUdT{5b?=%YeX3i}pYUS^92>?9kn4tcul$MU&_ZZGw*%VRtj=6-PmDipo+HKL7$}nxz6M=*TJ~J_02Rfa_OOq4|1^705>+qt*`q@yb7#-7f}U7u^RnW}no| zar#I=R|9~vEg*cAq!I3i4x=hyasP4X@h$DQc`Vzg)-YwYa`qjfd6`etRSg~S+t-*gojQ?pN;l@!L$j5Ff`l4 z4#yr{Tm=+FM|_HF+0G->*tdEtWd?PCP8NDpD}cni0wuc8Ja`5B3`X}u`GE4L7H$~5 zyWOMyx-lKQzOU;L;N0bX+s<@%KHrNBB*a4oG#A)XJVJ#5#iQ3gOIvf8ZqvIuzZAR9 z4kYs=LOD+JPOJV&S~fYbHaESJ4vin|4XL?v%M@8l&$}PsC>wOM@yT3!Q=wEPQzZDE0HBZgCpne2w~h3O>BUP&Oh^IPWM4{8a=-_L^*!)cu#IVNRMwN=K) zFX9V-p1Z&28u-R1Kd;_Mcuh7&VM@}YYr)~)Y%3W5@+PDge@b@>*G2xh(bSoh1c2M} z3D%+nKp%tTJnHS*><|P$Z!28`0;{}jOT5{k^V<%lre|@D!Lp5hGbh-_ek9r3d7LR> zz9?C*@7Dsl%@8q-tWzN(hQ}N+rbpjzdQ(k1(s<oYav1g3ky=(iu zf&cskLU9sKdq_8VWeceU;8|lgfE6-htA4EoMXxfgk3*s;Md_M3q4Kb{53I3^L51F) zTZO{&V6@jSpU9mtpIpjC#Gj_Z83rMV1TnX>qD>yn!_3SOewTU0u{t8#s#c_50$EJJ z$Y#+W`|TTfZ@j-L=5=G&b&!()dTo{>agVQg?PSQC73tT0{bR**Sn--F&FT54q8S;W z1ixO;+-fo5=N{?db*HA6=A>Nz&#&!Mr*4KCHiss)Fqt?ah4Lu2HTI4lrDRW&T?y$X zIen*NQp=@00`wfvd4+*T0Mi>lb8?f?Q@-Y9p}5t%JPI?^b46@^A^P`>(%+Cp3SpzV7G-@?Ln04}CcR0LZD}OcGsAGIvK<uX_UTTlzu7EE1T9v zug%_$R(*aZ=57Xn&LOR%#$f3FF(~R zY)-d6(Ok;=G-0Rdb`hlb)W4%#zgU_kpX{Z+g=$Wj+oBT$+>>$%e19Rd*~3$F!PdE7 z60`ZsZQLw6a+rg*xwrlY*_$D8d*So5eZIJ zr1Q^1@HVujq{JD+QU2I{&jHDbk8HJreeaQub?mM+M8B!j;^BPKvJpwAdetZ;XD{!Tg|gPEh1CD{u>?yD80U zq+Hx37Z1pWr}!_w(pT>RoPEw2v8xC8Z6oWl0^xW|90I^yzJTg83=EiLTq3oSFe!3yRK=BgYsS>I>L_wLeIE#&_XR7D|;?*HVW{cbxG+!aiw5 zg(5xE_EJ$pLMqJtLsWre{@tpkskK$8Z19Gt%O}89r(9?yoQWIw!>8I4)*lMh5i90}UChe62t>6K`?gg5!8)$%o{c5cM=$pa= ztxzQMKk|g%Rtpe;AtVGSlvq3ebPrlmVc5ermeVkc6FMi_bxa3y4f@m2(3b&H~_6?BpBde z^kCvKOa;WSWwI05^z=)D0&`x-*%$Lu--1j=^@NOk-ou8crB&xXAA%xh_-G%HThTpW znz5t$Rge;F4|C*%KTqyfRdcmFiy{JWpg_A@gu<^%UUvZGE7(Q&Kh-5}umoie4In01 zN%KXu@aF(PqHT^{dD*O7CK+|9zE!%vF^7#>H2sLs@jIk)47{>ce+%K6DyAbC2Bm#* zP^gVRrf(R;(lkG;xBl^UG?nwqPeqS;8ooMrGo`^Tto!~)+jrnnK%y-xX`Nml`P--? z;K+0u;rs^0K}(NiBW=30DN=(Jo%jyZJ?3*Jq0+T5#C6SwwKz)LE)xVOC7*$1e?ofW zH&sx5^uCH4eq0Q*fMiXTWAVOP@ac{GiaS9LTBDz(iL--V*GZpfz}!JnM%CMgpDY8fg7hPyZ!d?=ffz;wI#bY0cUU~X{c~vg$%O&XD!!aL zYI(jYmvQ_jP4(Zh>Lptm!1wz7H)a2ik5(-YAaSdGImVY$&Hr`Rs^!5kjlTbn6^{ga zyuF-2fT;z=!<3ZA@UHgy(~`1lNjG?UF6? zqTVA3TzHBb2f#-L6IyP6u0T~jOK2h=kOV@NDk^A@cgRdD>OXj-KKPIY_IUICb1P*P zRh3*`S*;bv5#0n9tNOXVS>hG_M-VHeDLJ6#3js_ZGVoN$JIK*)>^Vp5MJ=GFL5}7& z3eJ&>xV*PiK^H?v&A!88%oD!0oxtaO%FhF*)nFmATvLB@YZ)D$pFVbqMNmboHtnhmRkbdU490G*1FG|E`IuT&Ms<(!?d2h=U!t)-63i zrfHf;5x72Zsorn^2CHWBMV;@Zf?j#p{loDhFOoEzSl|+J}DDe1EP)!uO{U004cFJ{Bvrrz5!9^)Kiu$|`eB@MP!! z^7piv;Ok*cKDOxW&l0*p{4d`ML0O_VEBnJ+;fH1xh+Ee*7V|M7sB z@6U|lqWJz)w!V@LU~r}y7c#)_!grbU z*y1cAk3)p48P}rpCZ&QIFW&1)t!O}{NY~Og)+nL7Y<<~!O08**n-VK!6Bj|q^P8nF z0piokOM6E-Mri*+QJamR4#MCHU_(?Y{2Fk<`xUMgZU8Q)x#8kMxM~+4Y1Cn8hSIrzg@uN@nN6ox+O4 z;`$HduMPb$b9iCbV-f$4=@g-$P{m$FR`s$@O7nj%0tvj!`GPz6+Rn z$=4Wp3pur$w_f+=Ao5g@tGw|?3^>Ay3I_q&aEl3N27yDiNp{ti?g0h2E37ROzpw6P zX92wq;v%KWzzaWGDy@Qit6vzcly;h#&`!pqX?p-(H})#%7C-%nTuZ4rcxj=~k}`ndL{f5heU zet&cL%=gKI3+S2=vX%ibim>YymfI#JzRNsoNZWS|uNVMtI%C-FgzcV-XA7o*g8R@j zma?fHYGjATw}$ikg2UEmEHm(j`#Eh=+n^5e$tW20~h@PKHk^CLgz87DK6UMQdebORzaPhq_DHPOisdKT8%m&H!zE>)V3 z5(<}a!w)rJe9=-k5~#{0UTWVpfBnyYGdT%x=?qoEvuD1}bxx}ol;bNC16~Sk);Us7Z?3&C_@wXquk_9ZO{$wg9q*g)n7f1SKS1Ozmyt z+%>>K%lmc(W|}OA?Q6n24~CxH&-v};wik4nq@h%RhT!g2^(Jd`(AM+Gcjt*ufq~)$ zzFIRfs*n36jk?F=<{eno^8YmTJ#aTgpsxH29;Z|jAV5ua=7~qaP&i z;Rzk)iU73*D2fvNhD*}H1Mg5vM8aE*u%$<&uD+tNPlqiqQFG|zz+e`Td&xGN$Zt);mMjBW)tHFI11G{UFJK&+<@#T4-@p! z!i??AkIl+@Z6$30ODO)|;lQ+*9>x~VVnV8iToqVxf!6e#79jn+!bA2_<@U*y@`{8u zeqtIGpcWs)eVyaiw+)g!UO>&DKwWboUyyqNovaHOvf33`@c{%xpWFoMhqwGqZAjFw z+g#GdSfgL}PbQem$tMEIxQ9kD33O#aQbaA#+APSO6f#GS_X7oz^^>Y86y&mnag+9ebfwCKCyJzb%& z_kIlRyHtkM>tqno(r4c$8PV4iSu!~OK4Lb~CGn~VHWNI1(Qy-H%3`s#UE zHeCjLhC+M+q87p8{b1eSsOL#XJg6dmNw)i2{_RN{$Y4J&Mi>rH{1s*f-hWrGyx7+@ ztnM|9taqtxadX!ZZzI3>nIkwjJP`S^ir;fPi*th2Xf^P0aWa2t4N6(#U>078A8?rY zistHU_6e~~l0%fOQA4Q8xNckVjiX053#&IAe60D><=AEWMN9nd&fCJM=50LzH>A9r ztc}LdXv7mU>$Dus5ITk4woUydukde<=kA1`7WGqnLzA;YeYB)=J*QyIAqEn8{FZFF z=ad)YBS_Y>q_{fAt~{tKC!*-)p5jx&ohO=N}l${1vC0#h)2mGA!$m3 z-TIhS83cP?am%BWbYPKWG=$9@_0UFaa?2!fgT*dYL=BYlsJ@Lh{9=@UC>66Q(I@HZIJYhS zCnEKZp^)8NkI1^%3gmY%SB@c6JGJOdU|Uc z-JM;BsfRaUzy6ugp<8l^-7HgVZOr+W-ocVD+vz$&ZKnQ*LeJVOVeF*`j6A-p+|fGx z2XXVZ_m>~mk-OGxTUmGopZL(!Jqc-pR}BNq%MD$f=(>+gv5Pc2iYMUqBCx zWo%zPtmuFGtv@q!B#VN1%vmY}$U;E(bT6yG2 z{^-r27|bxT-tD8KxLTBs#;ihL{I`Ol0Ziq9V*!b8JI`Bv2zA-@v=nW7Slj%01{YwO ztQlu(ER;twc5BYryf@ErI><7O$Xq%STy6cu(+xURUjD7&JkEkj-Lf8*z_>yW=&uRJs0d}X>tTtI0$62O$zb* zLePf!p|;}i-0k#G4Ky$MF;2qAeU5d^n!b#xS!9J565K8Z^IL%TwJ2}CX(iqC0-)A8 z*6+TA(Jf?b_N2BdVAmDx=AJv>m@RH(Qhh-;J@kBP;*an2&XHrm%uJZ2kVKTf?BLZ` zBeqR4$*6rsYQrJ<8oFC$mb_+Rk`(lYYepy9I4XEzKf@OZeVn%g^AH3b`8&jJ@Q70f zX98&2X@<}1V{Zrh-@5;O5HtKAJh z)MU2sE(cHz4!5M_)W2+MsaeW)jjtX zVK|PwFgDjnt77l5P4u!LoZ)(HzTdfW1cDD^XA_oa0a$+s(gA($MNw>oUixy=lX{J5 zd9kJAPVAy8WNu-ePFpvN2f)wpX7iA?+Z{+3OpP*(_&OaU+#lDU zsy7=UEM=P-Ccg?x7+n?)_0i^fy9A#%lne9ZcSLXb{}KS&vGo}HBa!G%J=z5~g5Gqy zC%+gu_A-;OU};+*u>|qZQNZiw zJs{mNg_8F)(j}15s;(9=!&HE50t}rl2=H_z6BJ&A0y~WL$s9e8G5J~H39rb}33n2b zVE^U-?4)!nn^64%sf{e^M4G-u$rC47RBn}>gV>>Qk$;~O)MbOJ!Ut}8a6>!8Qe!lb z$#X1SHY6mXzoDA<9;1pFJC_kXO>e0(@lC(dN+m8037_!0kZkUb6s6s2TMV%E?0Nl6 zBIz=r1_n5W_{xGVJ}ll43HU`b{vng-~N*>=OU`~^3oGZ z&w>Jg#0sh&sAOybSF%F!2?&VD1*sz zNUdC9wty+#BSCK)?bBY3jiwk^!nsT>yI6uE0BL=Ys@ZDIRZLB84Wz;DSIE+#tuE75lkGX3mvD? z|2Ea?JC)S^A+Nq0Vf^7&k~V)o{I?BQ2Lk^E?4s;`tqs5qf_TXR>C_*C5~W^s6z=-} zwcRWQ0jv-GJCtbn)9|6N?l3;bUyT?Ic>2WWUuiWGmt7a&47GHoq_b44vNb?3jEF9- zm-H5^E8*6=l?aS8uo>k6cwhluYAj1?<%I=T$}ihZ|G6DsUMzw9QW4F0-23`vF@AY9 zpcGMcpzcZjuU}ZNt$LK)_2c6H_5W=jP69rT^8YO`T%H(6ME`#_{J&4|DKlwQ2RHgF zt?0qW3qaBkw8ks8vh^$NF7R(l(}C_HpyN0&1jD@h#aj4Y)WP-2BT(`aOTy(X*Z}QG z0S=kQB;71_bE*v1Bg&!Q%1rF!4{o}s0RAj9QZ7(J@~0+gZ=fo(7@M`gIAXqH_Amyp zgJRTDcmUwfu)cr)>|I!07+?nnJ9zLks2}u_Bq3cQpFX3)+!mKLd`_h4#dDZ*WKaN_ zc)XVseHS_ax~2(qK;gV(^`OQ@eDFAxFa@kbLNpdct2v_)-XDJEc&5oR*~E&bVZSO4 zf=I1++oezZ5ryt{=F?0(!Wd#wFm=dtOIKaoFy?9Xrl#G$j?grUbIbazFX1kI6v$B? zIN1cpU)mh;l{c>WN5Gwu1I^|iD4|b`x~p+wcOL%Vh?#nyi+S>eL2 zBcCrz*o9@DN%X0NwUKIgFS%W<`ka}G`V!8MlV>%WYbZhE8RU|;a?9L0xyLAcgzDSr`@~3{#zEPTdcPI-VjzNSiIqZ9( zr403V%{0@KyLx9r#MF#w1M<+AuW|IY{YS<2(yjc1kK*A zX|b@oNGG)fCFll{PLL~Nu&ohlJVk(!CeLQ=nUnogZ}>3A8mWq5sh;s9i2gbkGa@VJ*4o8s(NY66%*boWH=3}h=?l@VPUn`Fb})c!@wyw zaQTL`ZJo(EpYf9GXQjh=JgB?e@7FI{KVI{?37R5=t{|$hT`^|N6IV;n< z$)5tw2~fB|%nxkxBYKhp5u3`H@+ZkA7R=yqDwCqWVJ6eEHvPiW?|f|x&3@B^H5%eK z|9WANmRKD2x0|i!N$Ow-#+M#?x>q$q++EQ08HJCKPI%Bu@QEOOeDNak-O>0BCd{el zrZx+td+gkqCC{A8@P)*;+?;D7X@G@Ki=7x@t^tyYQ4fp0)cU(+t_$yji* ztguvM0p%9Jjs18n|NiN+$K+9gzy}QAleHWZH0^<&`csAU<{V-4Izb+;Vm#mwb;nBU zW4BTW327#EXWUP%sDh;t9T{C-9`O(A$lkVd`155vWj@A}m=CyT>%1%MD16OaH3IY9 zXwD7WTL@wyxsr)ZX}7#2A;*T{GtfuKy=p+fcu_HJ@RFYv%K*P4-@Y`|g>XSEPK*83 zNq0qz$z^o(^tK7hMR1WZd=!Yv1C<)C^;n!_KKyIOjo2v&==s0ska$t@R_)qA(zFnV z1AO6l9b)!Z@)u?BD>v4kfrMbs5ed%%T-ATS7#=p+$pcwVGo)v)VlH{?u#qZiLA9EL z)A^2lH)Y)0sAJ|m7*^+oOGwA-8x56=!j8;445;)-&wKrfR=zCgT0+)ZBst>_R+GN8 z6Qkc7;J|#;)i}g_OFB#-Gi_1=Fa~-_AI}DgK=%}tgsXamAZ&#~9ydoyD&SZ7pB+H2 zJehBxvM=oQ$Y#EzMH(o_`IwFJ{nwmF zFwxoXzK_x~7mhkVs;vJsOg}d0VMu^}@y&}TJ04$P@`}g1hJUB|Bu>vn`WuhxFh<1U zz4;uN(Wscv5vUjYLSl@hgm`x*vln9>lN?{TZ|k9+5jaKsT0tOT;PH#c-oj1jjeHW& zUP7rFpA_;@ZVL-EJNhO(J*C4Fb{D=M$%D+W5eAcLlFr@^o&m0`1AfQKj7R(%Kv7G{ z$VSYZg1((Hv9V6IP+ANShU%gXPSox-EuHOW zl``?K$K2GUq3>b?m)I9LK}M#*`FKwsr%#WoEOCqdX25Xn_$SlIc2YlJo~QwGJ_g2a z2B+~55Mummj8uT;l$o`)apSAhyoDioJK?OkxV)OTX&`&kj6N#y}hb^Lr2apYs0SgZ!b zlKk^*xGc`vEp+p45ZY*$mhL??5&T9Ivt!sUwHx~>(2z)X`> z;?4M(u|Wr-H4eu`;iAlY93x`l>OyKt5k@_?x33L6>Io0W;rnI*8-jhOUZ3cX%V0Cu z?!_JwP_zBMm%+J!BIc2hI|Fdhb4j{u94{W_tDn#msCwg=RmQ|}aGXuKyff~p-buMT z#U4Hn4wVjlXUlUo3R56X12aEissB=P2li<_|@v&dwO zFo(lA0iqb^i0D)}pL#bf^VqWh2(FqUg5#VHqewPMFq-;*!%gX zo8r`c8U+1%`3wqw!RxLRJ^G7;!FVEoee6vHMUrf23kgPhqi`LAA<>XZDNh(FneqIm zMSt;gfoCf5T!>lc*F>_|hEPHyi^9(mn+?0?2y!rZl-jXQj8=jkeC1rV3aU*P z;EZIad36@dl$W_bnJU9|+Kc`Yfu>?p2mf`OXD*7jFRJw61Xx2VrgsVT9UlMKAr_&pqU|?=Ki31%u)7mc*4*FjommMV$@PQyc!i>Uj)QUL z6bU@`KM<74>kBe3y;OO0WMRe{62I}=76^#`?ckHI282@L!* zHNb4Yza$K-uBy-$#xSQPw%MNv;s15Y9hdK8iMG~#o;nzSs{IO9?7V4xAQ;_KIR)lD zw(E}XVJyZiM!nAKk`h~Zj6rTq8Xx;D9$qw5^vvv4I@r-#PC*f5kz$-+nL@nCIW^4X zhB~GYIH$@+5!sZaa(c+TBPKQf}CgEY|e4<;dTiZ+)$k0Rve!A++%80 zs)Zq8tHn8=D}N~BW`X`v+9T!-6lS{q{kh}GVAyU!e3GrnuLBbyO1s`?{vpQs(2qo} zRJjxkPO)@_v7}MY5+Dsg(5i|t4(FKr?M-FS`M4g^}6gId!4CM>#HP}2FN020NrAhYv+iHkgj$wrGP zHT|)gB5_@d=sMwy?Ty^^C=h`6FoL^wDCnYAU+!TgC41!6D=y{fa8PsS{(O;^g*2tx z&J2;nZNGB9=(Fr;<_}n8m$RQ;La?TL`YoD&q6Q?GlUyU*)Fq893^9d9!rA}e>^wxc zyv01`@NJFZNOpy#=Y3`tr5fG8kon>HBc?rbq?*369^D7qf`mIMel@nwm_BBr)oL_;EXalY2rKbV2Rj^z}E6HT2!Mxy)s;Gw?;R z{~{VctFiTwsI_!uZT;9zTX|T@46jS6gOd%<+Jf*<-fzvtV{%r)RrQpXQ;`ZJ>lfgu z7))2otzY09h-)kNY}8!5y&U#(SGxFVqjG1WAEUSqnBRBJbU)MNhS7uy!1OOR+eD5| zGW`)os~i*pA4m-zSYkA=l1Sl+RD^{S1Q6leHYvpC6_sQy@orn85H>+boy686bdSl_ zu}2acWQBf!&IC4OsWXHA7w^*Vq1oFefYDrJ(L<(S2N;!4ZMsf`7#6N0zOmy=ieMUf za!5Ca519yKu~WAb)J$rSJDf@DyT7&q(ZNHun42FoR@o6^(1nNiuf<^Az1 z#>Hj-5+VbHspIhj%?}M59*Ml}|GxeR63SS1rHIElhKt3w`55IaaQl6Uz+C)$E%D0T zP-pDIJmbZr`C`E>O&}VmLYfjcvLw7UC(;UX!OT$xgBO$BaWJz*1*86!RhQ=+RGSGn zaNsKZ()uyE{)F9UzSXVNNHcI_)u9zhYHxE6;z92>&~a)!Yr>~2Bl|vcro7WOu@V|{ z+1}8>c2K$F0mMu;;g2l6hkBr)z{S`7M>MnW-OU%{&@aX08782otH=fA?3G{VPV)`P zU*e>CG(PDK;8;naIw|f5tlfkQP|f1+NjsbzE{dH|bgEfmMzbvN{=Bt)^Q(wKDAIvC zC-f6fXfoa!V;bpg_U~^yy^%a0L99Jj75AGA$eWHF3eaC$RQvA@4>u;4Z;UE#I(J!& z9smh`S|>Lb2)E_vcbwzS9CA>z1D0n2CaVWCYbf(W^H(RvC)!)K7LpoHh>O&kOf?0Z zfG2Ju(Vm2$#0k7MupA{Yu%dIAea0)EnFm-FYT2MT{u1pgWasM?Y5*saHcQb zPK5R|s;w4rBKNQM+@Q8nM9QU8M8R^0+eHGnPyVkdX25hyn2UrWxigS|UdAE08~V|E za(l_0&P0lkbALuQ&1m{TOdEXe|I7adE!<<_+N#(O{(&(*2bGk0W8s+e73bLC8#S%c zm~&Zjw5hTTTro2!&ip8C(b&~FOX)(6Z8}*CF)P1!=9i-b zKEP&uK8{te^W~Bjs}6@u$X#ereNg<+MjbprVNlStWL769&qpIGNI-$gVJ?o>N9U-0 zt?YC1UEsJFJYrBZGS;{2_H-z)KF+g5V|A9EY)H4GIufRkqZ|wUv>(2`XzLSco?Gu^ zBhWTVk13V+bPi%VDy_`Hov*)Jk0*+@K)DbQDr{?cvT@t*_G_j)`d`U6}F^CX0~(XtJl;ZAs%L1 zX@mBpvF1wW$Fje7{Hr-zYM$<@L0boUe>dM;9e@lN&BY9dv40vrYkHq^`emC7aXIlf zKdak_tE3ASg&4hZG?5=5Zh}p2DE!Iz7++EVmgX&l(iGd)0hKv;RwUY|a3bVqihmhdH5VENQ`hYg13+zoNwnM+105_Iz@@)>zUuX3 ztu_XQ)Z%z`X7 zt(LJM=jUOoYSb{@E(a{hh@=P*P{@SO-tp5ZQ<1};PkRX~aQ(byJpWTIxnvbXl7k2v zFtY@GN^lNtCc67Tl*->Cy%X_T?9d2Md7)XWmvD0uX7*|0#qTHN!9o%TOvA3-vYj^e ztb!2-iQrw+UW&FCoqhF0#5m=T$NC~sgx-G+y7fvXt9FHolaE|O7K&5R{yoETHnoUqGqbk`Gc z#V&&}>h=krzOgSfpA;2QHT7lY`)z4vZg}aE${}I3+hbp8Pjjfnx3hNJ)N@v+y3Y}l z$9i{H#m@Ni`J5zH3ryr~Z+V@$QE#^hxi{>sMFdy8$%76q6AB*PhxhBhcrsm*f>iIW&)Ba+G`=pSdtk>)o*vd83_WRUD;rCXnXri`LtS%3Q7| zX*WXJ@RxfESi>@p?qoiD;?YTr7LvW>x$m4f{a0E;oS}6HBG6j_mrdCuStnKGQI@U^ z9OIPwp~mnK?w-wzWLyXsic8_gl}6Ol}%x2!2{h>f^9kBqs6OPZL` z?D`B!=C|_~d!FVtn6wTJeUJa9-y=-2en+-9ch0xbn6rPX22a;rXd^ zn**zel0xI1kK}#TrBMFvLsi}oG0tBhr4-NANAF}!Y9O51R2$mF9n7%)zrRZ9H%8iE zCh%pG9TK^o^_AGJl^Z3Ik>eOYv1W@Prbnf+bbmX4>=*Yu{+b0I?Y@`?gkTgWW98Gs zs_a{w5{`lTDAHwFlW3xzTtsSB`xfbeEw zfaqIzH(b9Uxss6XB9Zv%*tq}XZlK;G{>Wm6n62KvSJVbRY!gRht{sRf*oq4N)FNn3 zhVktg`d6PRjW*;RD~)~s05)=6CK#g8ypaQZ%>8J(ini9@oesG?wRtU*Lr!Es4c7Kz zY5xMwk;ngsa7f;DasH{zgx^;kUeEIV99VgES6}eqcPKn4@wYR&VDnJF`gCT)?bf&F7p0lBT%d%<)e zI{un=ajN}`7|3#RM>j+yrK7O9{ONA(MAW}k+4mK2Zuy5bKw<9h5a;58#eq!ilvee9oxIpSy;>_41Py2rP zjkD5t0cgpEj&H#yR#Y)>O=<)MH+l8a zCC6pfB6wT^TaHDY`+4Q3jHx^N#o`W<$fmL{$B7rd=S+BwA8kZ) zH{A4|kuy|c6kG_Z$V#-FO)o?T~x3VEd`j)(H z?({*}^1J7h?|Q7vKEWGV)ChqAG+&Y3-MZ?{m7~e#mltkV+7U-j?dX$An%Sc@zt6j2 z51*+pf=!^_RM~wIfEKoo3>O$MKy$D)6Qd9Ky38Rl&D^8=*z-d)DU%vlcdK?0`GN%F zE9qHvhw{o3U|v(K<<$iVbt6z~f_uf>51+0qPpv}k$@Xt>moY|MU%$OD{x28q%Zqg- zpLhGbWto&5LJG}`!RN(&GeIL_Q^GT_@-&J15tRLinS_l--nY}VsVl8QX22c9lu7-~ zk1IB^I~M_Yl7W8cc$y@LcBiN?Y)dONUxAw?1z5*d!F`mR;)5$GZGPVU5rM6mc0Hzm zBX*Mp8(ISwjKcR#sg1#pwx&N)cvo=6a4%-#&9C1Kx8Nrh9^s=*Vdv{*5mg&CXW04s!*Rs= zsAag#q@n*~#=9&y9J*Gg?1mp$4--ru3$TZT`zZpJCR2;74n%xY;870T{dvU@LjkBu zTVJeAQsGsjiMcMpv>RQ50ml|!wQ~J)HU6FkJu<*U?0NH~S{~^{XB*fJK)HBU$ zS;^^40d<5d_GJJS6kfRlcD||d@$#e@2aoaoE?v)G!eL5NhHWSo$LHvgw-q+~uKdYz z#W95yGhqDiI{!IRM7(FbgtzW^4sIr&l=(`P=&34 z{E}!cJ!Kf*Sc+<`T5)L!jJtZ`jjl`|t?j7i`E2e?pKuNM2xn;+b7+=%5f)Ou8J*hvuH-&W z9iNDjd?hi^wM2tA2R1E6fq-;Mz}#XsT=(Z>h8@H5rmYo7BPwCNjys5EElz zAFMgdNaIA+h5IrUu0I3!Sk!uSPIbuAp_g@jh6;993lhI?$dqMMd{YN6fjEv3yNh53 z0+cO+WF;nS1dp(;yw=z+ZLVK&dL9r<34c1``|0fV`#~O3gsgkIhKs1&>|D>?kiOD{ zx5Z?U8aNm)NC5`aYX{CKd)fX<#L^?^(#5Yr#Osa9nPD@hAQ(@WPLry`@I-#V`Ls4I zEtaZUyYIA*AYT#d%&sXCbMEF}M^WA~zZ9u0x_v{GGdzlH+Wa_f->YhAAbrVA^4K?K%B3#C{aS9E1IkoACstF zXEw})4ay*kJrU71heTZWcrZr$qEbFeNQm?`wyRfZ4#x%s&RPocGy-ywxw%)0-_Pd@ z+^FaJ9frcY?gabU=ZW`S*5~Z_SsfcN#>CnCUbKv@Bw^=*Y4dp#lIz5?^B_EZKZ=sO zI+eqk_Uj%)1X`74i{p|-?T0shl&eC9)cS#sQ&C-4?D%tLWzf&2pWQq8?a7JpF4|aX zH&Q2|ZC)n+gBnyDSPVLNh=0T1z3_RV?a}f?T5*(BTIiQ4U=1521J)_CodvVT!+BYh zCcnr#clLfv8;s=4TY??~sf4kitq6D(gBjwYvIk3ytGAwYpi6+-h2>s&4&Zc}j(LF_{}DYFiF_ldmuqzJqMao#>7)?wypbfiH3HKeYDJk1ChyZ|JVSJpGXt9^~W?Y zIupH;oUQtE$+yMrr@nRWP71%9r!Cx6-QrzZ08g3Yxit?X3qJ=P$J9c2x)wlg`G?Xr zONmTI`=akL!ZWj#_D z$^R249VIGML`gw$d(PlTSwcd}8W>Xar5+XMGP3ErFa>aGI^-R5Oxl`&0-gyi+7l$=5*`y-}Y4lDDMU|7~U z0cZjzomt9s^S!;D-&3`Dwz+JN{{n@_>x8@)bCwl=e&7UPgsDm!d{-aNnLKC<$}opnDT4RgDt$EGg2@yh z2M7c%W7_&=dzl89>#YmYZQqX1=gyzK7?un^@P>c0`6p-#;V8`?G)9;v9JEGCUN=~M z=4_N7_Pt;x6VaZndo)4UqbQCD_M|>&s!$dtuqKoJ)me8GrWT67uC)dFIqZLbNhTSl zz|;!63msQ0f19%??ri5EaeRbXG@G)t_cBRgSR@l-*d z-{6X^{coxXG=|^mAmR)f!FkNlJ8H|F{;VEf@##Y^+p|m1Z{~LR{p6%HVQovgZC|#OK8AjHh zn&rj}r|cv?s~}P|5%tLYDoQ8P`>eYx{e&}t(uNQ_?f!z&VzQ+u?M|U6SS?>7A-@0J zCP9!{17AY?h&NRhM;e=T;j4^35t;3d%MZ_Csj|u8X zr86&BhV=&%X1ctLzo&!Alfb|BXcZ3$dfBJdu}e3!MfurhUIW~~?uD0UmThYe(I|We zO^Q6&rhjKdM=aGHYuV++h~p^JAy77{Tme4cMZlk_40sm?10Nz&+QJPC5nhX_Vf^t@ z$*UE9x`e~wy8kd!?tIGhq+bmLaxd;vnO6w#m$-#!Hv+7>N(V(I+kTt$-a;#L4^^N(&Mc zL5--ZSAaFJdBupBfytQGzt3fdQaOgYy7nN_(`3UJnhqU?5MhT54UAXf6mlZfJfe36 zR}ZR%BDKf|5Vh37;lGKJxpsAMy(*4>hU^}5P9-N49o3>-H$O6_8~-M)>i|ad z5?%sGc((n3cYPS;+)j*yKp>~WuG + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + - CLIENT - + any program making use of ldns + + + - WIRE module - + from_wire to_wire- convert to and from wireformat- all name encoding and decoding is contained in these functions + + + - central structures - + pkt structurerdf structuredname structurerr structurerrlist structurerrset structurepkt structurezone structure + + + - resolver module - + stub resolversendquerybgsendaxfr + + + - net module - + all network interfacing code + + - OS/libc layer - + + str module + from_str to_str- convert from and to string- dig-style formatted output + + + DNSSEC module + signverify + + + + + + + + + + diff --git a/libs/ldns/doc/libdns.css b/libs/ldns/doc/libdns.css new file mode 100644 index 0000000000..2d2f385863 --- /dev/null +++ b/libs/ldns/doc/libdns.css @@ -0,0 +1,425 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { +text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84c7b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84c7b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} + +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84c7b0; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A { + text-decoration: none; + font-weight: bold; + color: #1ba159; +} + +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1ba159; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1b7159; +} +A.qindex:hover { + text-decoration: none; + background-color: #ddffdd; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; color: #1ba159} +A.code:visited { text-decoration: none; font-weight: normal; color: #1b7159} +A.codeRef:link { font-weight: normal; color: #1ba159} +A.codeRef:visited { font-weight: normal; color: #1b7159} +A:hover { text-decoration: none; background-color: #c0c0c0 } + +DL.el { margin-left: -1cm } +.fragment { + font-family: monospace; + font-size: 100%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } +TD.md { background-color: #F4F4FB; font-weight: bold; } +TD.mdPrefix { + background-color: #F4F4FB; + color: #606060; + font-size: 80%; +} +TD.mdname1 { background-color: #F4FBF4; font-weight: bold; color: #602020; } +TD.mdname { background-color: #F4FBF4; font-weight: bold; color: #602020; width: 600px; } +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #009933; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #008000; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +a { + color: #1ba159; +} +a:visited { + color: #1b7159; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84C7B0; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1b7159; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI#current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI#current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.nav +{ + background : none; + border : none; + border-bottom : 1px solid #84C7B0; +} + +.logo +{ + text-align: right; +} diff --git a/libs/ldns/doc/tutorial1_mx.dox b/libs/ldns/doc/tutorial1_mx.dox new file mode 100644 index 0000000000..f442e7f501 --- /dev/null +++ b/libs/ldns/doc/tutorial1_mx.dox @@ -0,0 +1,98 @@ +/** + \page tutorial1_mx Tutorial 1: Querying for MX records + \dontinclude ldns-mx.c + + The full source code can be found in \link examples/ldns-mx.c \endlink + + ldns-mx is a simple tool that queries your default caching forwarder for + the MX (Mail exchange) record of the given domain. + +

o$GReupNRI^H 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�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 - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - - CLIENT - - any program making use of ldns - - - - WIRE module - - from_wire to_wire- convert to and from wireformat- all name encoding and decoding is contained in these functions - - - - central structures - - pkt structurerdf structuredname structurerr structurerrlist structurerrset structurepkt structurezone structure - - - - resolver module - - stub resolversendquerybgsendaxfr - - - - net module - - all network interfacing code - - - OS/libc layer - - - str module - from_str to_str- convert from and to string- dig-style formatted output - - - DNSSEC module - signverify - - - - - - - - - - diff --git a/libs/ldns/doc/libdns.css b/libs/ldns/doc/libdns.css deleted file mode 100644 index 2d2f385863..0000000000 --- a/libs/ldns/doc/libdns.css +++ /dev/null @@ -1,425 +0,0 @@ -BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { - font-family: Geneva, Arial, Helvetica, sans-serif; -} -BODY,TD { - font-size: 90%; -} -H1 { -text-align: center; - font-size: 160%; -} -H2 { - font-size: 120%; -} -H3 { - font-size: 100%; -} -CAPTION { font-weight: bold } -DIV.qindex { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84c7b0; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.nav { - width: 100%; - background-color: #e8eef2; - border: 1px solid #84c7b0; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} - -DIV.navtab { - background-color: #e8eef2; - border: 1px solid #84c7b0; - text-align: center; - margin: 2px; - margin-right: 15px; - padding: 2px; -} -TD.navtab { - font-size: 70%; -} -A { - text-decoration: none; - font-weight: bold; - color: #1ba159; -} - -A.qindex { - text-decoration: none; - font-weight: bold; - color: #1ba159; -} -A.qindex:visited { - text-decoration: none; - font-weight: bold; - color: #1b7159; -} -A.qindex:hover { - text-decoration: none; - background-color: #ddffdd; -} -A.qindexHL { - text-decoration: none; - font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; -} -A.qindexHL:hover { - text-decoration: none; - background-color: #6666cc; - color: #ffffff; -} -A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code:link { text-decoration: none; font-weight: normal; color: #1ba159} -A.code:visited { text-decoration: none; font-weight: normal; color: #1b7159} -A.codeRef:link { font-weight: normal; color: #1ba159} -A.codeRef:visited { font-weight: normal; color: #1b7159} -A:hover { text-decoration: none; background-color: #c0c0c0 } - -DL.el { margin-left: -1cm } -.fragment { - font-family: monospace; - font-size: 100%; -} -PRE.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - margin-top: 4px; - margin-bottom: 4px; - margin-left: 2px; - margin-right: 8px; - padding-left: 6px; - padding-right: 6px; - padding-top: 4px; - padding-bottom: 4px; -} -DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } -TD.md { background-color: #F4F4FB; font-weight: bold; } -TD.mdPrefix { - background-color: #F4F4FB; - color: #606060; - font-size: 80%; -} -TD.mdname1 { background-color: #F4FBF4; font-weight: bold; color: #602020; } -TD.mdname { background-color: #F4FBF4; font-weight: bold; color: #602020; width: 600px; } -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; -} -DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } -BODY { - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; -} -TD.indexkey { - background-color: #e8eef2; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TD.indexvalue { - background-color: #e8eef2; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TR.memlist { - background-color: #f0f0f0; -} -P.formulaDsp { text-align: center; } -IMG.formulaDsp { } -IMG.formulaInl { vertical-align: middle; } -SPAN.keyword { color: #008000 } -SPAN.keywordtype { color: #604020 } -SPAN.keywordflow { color: #e08000 } -SPAN.comment { color: #800000 } -SPAN.preprocessor { color: #806020 } -SPAN.stringliteral { color: #002080 } -SPAN.charliteral { color: #008080 } -.mdTable { - border: 1px solid #868686; - background-color: #F4F4FB; -} -.mdRow { - padding: 8px 10px; -} -.mdescLeft { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.mdescRight { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.memItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplParams { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - color: #606060; - background-color: #FAFAFA; - font-size: 80%; -} -.search { color: #009933; - font-weight: bold; -} -FORM.search { - margin-bottom: 0px; - margin-top: 0px; -} -INPUT.search { font-size: 75%; - color: #008000; - font-weight: normal; - background-color: #e8eef2; -} -TD.tiny { font-size: 75%; -} -a { - color: #1ba159; -} -a:visited { - color: #1b7159; -} -.dirtab { padding: 4px; - border-collapse: collapse; - border: 1px solid #84b0c7; -} -TH.dirtab { background: #e8eef2; - font-weight: bold; -} -HR { height: 1px; - border: none; - border-top: 1px solid black; -} - -/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ - -DIV.tabs -{ - float : left; - width : 100%; - background : url("tab_b.gif") repeat-x bottom; - margin-bottom : 4px; -} - -DIV.tabs UL -{ - margin : 0px; - padding-left : 10px; - list-style : none; -} - -DIV.tabs LI, DIV.tabs FORM -{ - display : inline; - margin : 0px; - padding : 0px; -} - -DIV.tabs FORM -{ - float : right; -} - -DIV.tabs A -{ - float : left; - background : url("tab_r.gif") no-repeat right top; - border-bottom : 1px solid #84C7B0; - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - -DIV.tabs A:hover -{ - background-position: 100% -150px; -} - -DIV.tabs A:link, DIV.tabs A:visited, -DIV.tabs A:active, DIV.tabs A:hover -{ - color: #1b7159; -} - -DIV.tabs SPAN -{ - float : left; - display : block; - background : url("tab_l.gif") no-repeat left top; - padding : 5px 9px; - white-space : nowrap; -} - -DIV.tabs INPUT -{ - float : right; - display : inline; - font-size : 1em; -} - -DIV.tabs TD -{ - font-size : x-small; - font-weight : bold; - text-decoration : none; -} - - - -/* Commented Backslash Hack hides rule from IE5-Mac \*/ -DIV.tabs SPAN {float : none;} -/* End IE5-Mac hack */ - -DIV.tabs A:hover SPAN -{ - background-position: 0% -150px; -} - -DIV.tabs LI#current A -{ - background-position: 100% -150px; - border-width : 0px; -} - -DIV.tabs LI#current SPAN -{ - background-position: 0% -150px; - padding-bottom : 6px; -} - -DIV.nav -{ - background : none; - border : none; - border-bottom : 1px solid #84C7B0; -} - -.logo -{ - text-align: right; -} diff --git a/libs/ldns/doc/tutorial1_mx.dox b/libs/ldns/doc/tutorial1_mx.dox deleted file mode 100644 index f442e7f501..0000000000 --- a/libs/ldns/doc/tutorial1_mx.dox +++ /dev/null @@ -1,98 +0,0 @@ -/** - \page tutorial1_mx Tutorial 1: Querying for MX records - \dontinclude ldns-mx.c - - The full source code can be found in \link examples/ldns-mx.c \endlink - - ldns-mx is a simple tool that queries your default caching forwarder for - the MX (Mail exchange) record of the given domain. - -

o$GReupNRI^H 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�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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + - CLIENT - + any program making use of ldns + + + - WIRE module - + from_wire to_wire- convert to and from wireformat- all name encoding and decoding is contained in these functions + + + - central structures - + pkt structurerdf structuredname structurerr structurerrlist structurerrset structurepkt structurezone structure + + + - resolver module - + stub resolversendquerybgsendaxfr + + + - net module - + all network interfacing code + + - OS/libc layer - + + str module + from_str to_str- convert from and to string- dig-style formatted output + + + DNSSEC module + signverify + + + + + + + + + + diff --git a/libs/ldns/doc/libdns.css b/libs/ldns/doc/libdns.css new file mode 100644 index 0000000000..2d2f385863 --- /dev/null +++ b/libs/ldns/doc/libdns.css @@ -0,0 +1,425 @@ +BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { + font-family: Geneva, Arial, Helvetica, sans-serif; +} +BODY,TD { + font-size: 90%; +} +H1 { +text-align: center; + font-size: 160%; +} +H2 { + font-size: 120%; +} +H3 { + font-size: 100%; +} +CAPTION { font-weight: bold } +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84c7b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84c7b0; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} + +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84c7b0; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A { + text-decoration: none; + font-weight: bold; + color: #1ba159; +} + +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1ba159; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1b7159; +} +A.qindex:hover { + text-decoration: none; + background-color: #ddffdd; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } +A.el { text-decoration: none; font-weight: bold } +A.elRef { font-weight: bold } +A.code:link { text-decoration: none; font-weight: normal; color: #1ba159} +A.code:visited { text-decoration: none; font-weight: normal; color: #1b7159} +A.codeRef:link { font-weight: normal; color: #1ba159} +A.codeRef:visited { font-weight: normal; color: #1b7159} +A:hover { text-decoration: none; background-color: #c0c0c0 } + +DL.el { margin-left: -1cm } +.fragment { + font-family: monospace; + font-size: 100%; +} +PRE.fragment { + border: 1px solid #CCCCCC; + background-color: #f5f5f5; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; +} +DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } +TD.md { background-color: #F4F4FB; font-weight: bold; } +TD.mdPrefix { + background-color: #F4F4FB; + color: #606060; + font-size: 80%; +} +TD.mdname1 { background-color: #F4FBF4; font-weight: bold; color: #602020; } +TD.mdname { background-color: #F4FBF4; font-weight: bold; color: #602020; width: 600px; } +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; +} +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } +BODY { + background: white; + color: black; + margin-right: 20px; + margin-left: 20px; +} +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; +} +TR.memlist { + background-color: #f0f0f0; +} +P.formulaDsp { text-align: center; } +IMG.formulaDsp { } +IMG.formulaInl { vertical-align: middle; } +SPAN.keyword { color: #008000 } +SPAN.keywordtype { color: #604020 } +SPAN.keywordflow { color: #e08000 } +SPAN.comment { color: #800000 } +SPAN.preprocessor { color: #806020 } +SPAN.stringliteral { color: #002080 } +SPAN.charliteral { color: #008080 } +.mdTable { + border: 1px solid #868686; + background-color: #F4F4FB; +} +.mdRow { + padding: 8px 10px; +} +.mdescLeft { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.mdescRight { + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; + background-color: #FAFAFA; + border-top: 1px none #E0E0E0; + border-right: 1px none #E0E0E0; + border-bottom: 1px none #E0E0E0; + border-left: 1px none #E0E0E0; + margin: 0px; +} +.memItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemLeft { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #009933; + font-weight: bold; +} +FORM.search { + margin-bottom: 0px; + margin-top: 0px; +} +INPUT.search { font-size: 75%; + color: #008000; + font-weight: normal; + background-color: #e8eef2; +} +TD.tiny { font-size: 75%; +} +a { + color: #1ba159; +} +a:visited { + color: #1b7159; +} +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* tabs styles, based on http://www.alistapart.com/articles/slidingdoors */ + +DIV.tabs +{ + float : left; + width : 100%; + background : url("tab_b.gif") repeat-x bottom; + margin-bottom : 4px; +} + +DIV.tabs UL +{ + margin : 0px; + padding-left : 10px; + list-style : none; +} + +DIV.tabs LI, DIV.tabs FORM +{ + display : inline; + margin : 0px; + padding : 0px; +} + +DIV.tabs FORM +{ + float : right; +} + +DIV.tabs A +{ + float : left; + background : url("tab_r.gif") no-repeat right top; + border-bottom : 1px solid #84C7B0; + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + +DIV.tabs A:hover +{ + background-position: 100% -150px; +} + +DIV.tabs A:link, DIV.tabs A:visited, +DIV.tabs A:active, DIV.tabs A:hover +{ + color: #1b7159; +} + +DIV.tabs SPAN +{ + float : left; + display : block; + background : url("tab_l.gif") no-repeat left top; + padding : 5px 9px; + white-space : nowrap; +} + +DIV.tabs INPUT +{ + float : right; + display : inline; + font-size : 1em; +} + +DIV.tabs TD +{ + font-size : x-small; + font-weight : bold; + text-decoration : none; +} + + + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +DIV.tabs SPAN {float : none;} +/* End IE5-Mac hack */ + +DIV.tabs A:hover SPAN +{ + background-position: 0% -150px; +} + +DIV.tabs LI#current A +{ + background-position: 100% -150px; + border-width : 0px; +} + +DIV.tabs LI#current SPAN +{ + background-position: 0% -150px; + padding-bottom : 6px; +} + +DIV.nav +{ + background : none; + border : none; + border-bottom : 1px solid #84C7B0; +} + +.logo +{ + text-align: right; +} diff --git a/libs/ldns/doc/tutorial1_mx.dox b/libs/ldns/doc/tutorial1_mx.dox new file mode 100644 index 0000000000..f442e7f501 --- /dev/null +++ b/libs/ldns/doc/tutorial1_mx.dox @@ -0,0 +1,98 @@ +/** + \page tutorial1_mx Tutorial 1: Querying for MX records + \dontinclude ldns-mx.c + + The full source code can be found in \link examples/ldns-mx.c \endlink + + ldns-mx is a simple tool that queries your default caching forwarder for + the MX (Mail exchange) record of the given domain. + +